texts:
Situation: I have some custom code that I would like to have evaluated when someone clicks "Save Category" within the "Manage Categories" section of the Admin panel. I am thinking that this can be accomplished via an Observer, but I'm not certain.

Question: Is an Observer the correct way of accomplishing this task? If so, how would I identify the correct Observer to use in this situation?

Thank you for any insight!!


texts:
I have extended Mage_Catalog_Model_Category_Attribute_Source_Mode (and it's Resource model) to add two new modes display_mode values for Categories. Now I want to validate the value of that attribute when saving a category. Specifically, I want to make sure that is_anchor is always set to "No" when either of my two new modes are selected.

The problem is that neither Mage_Eav_Model_Entity_Attribute_Backend_Abstract::beforeSave nor Mage_Eav_Model_Entity_Attribute_Backend_Abstract::validate dispatch any events that I can listen for.

Mage_Catalog_Model_Category also has no _beforeSave method.

How can I validate category attributes on save? Thanks!


texts: Magento 2 - How to unset a checkout step by checking a quote item option value?

texts:
I have added a custom checkout step in magento 2. How can i remove that specific step in one page checkout by checking quote item specific option value ?

I can not specify condition in xml file, Is there any way that I can override a one page checkout block and do that there ?

Please suggest!

Thanks


texts: Magento 2 - Checkout. Remove “New Address” button from billing/shipping address with module or theme

texts:
I want to disable the "new address" button from checkout page in Magento 2.
Will it be easy with the theme or create a new module?

Magento 2 - Checkout. Remove the “New Address” button from billing/shipping address with module or theme.

Please help.


texts: Get the user in `catalog_product_save_after` observer

texts:
In Magento2.1, I create a observer use the event catalog_product_save_after, how can I get the user who saved the product in the observer.

The way in Get customer from save event observer Magento 2 doesn't work, because it used different event.

$user = $observer->getCustomer()->getData(); doesn't work too.


texts: Displaying products from static block in phtml file

texts:
I've got a static block in which I'm getting the products from a specific category so like this:

{{block type="catalog/product_list" name="product_list" category_id="429" column_count="4"  mode="grid" limit="50"  template="catalog/product/list.phtml"}}

Now I'm trying to call this static block in my phtml file like this:

 <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('products')->toHtml();
    ?>

But it doesn't show the products on the page.
I've tried adding the code of the static block to a cms page and then the products are showing, just not for the page with the phtml file.

Am I missing something here?


texts:
I setted up shipping method with Table Rates using Price vs Destination.

Now i need for products in a specific category shipping price is calculate in the following way:
shippingprice = shippingrate*(productsnumber/2)

Example :
NormalProduct 10€
BigProduct 20€
Shipping Cost 10€

NormalProduct 10€
NormalProduct 10€
Shipping Cost 10€

BigProduct 20€
BigProduct 20€
Shipping Cost 10€

NormalProduct 10€
NormalProduct 10€
NormalProduct 10€
Shipping Cost 10€

BigProduct 20€
BigProduct 20€
BigProduct 20€
Shipping Cost 20€


texts:
In my product detail page, fotorama slider images are not the size I expected. I tried using view.xml inside my theme and tried using fallback view.xml. I'm using Blank theme as parent.

I need to change image sizes(in this case increase the sizes) as I wish. I cant find which image size to change inside view.xml file. I've included two images, one with how I get the images and other one showing chrome inspector that Im getting some inline file sizes (261px for this), which I cant find inside view.xml for any image size.

Can please somebody help me?


texts: how to use getPriceHtml() in custom module with custom phtml

texts:
I have a custom module with custom phtml which will print the product. But it seems that, the below code

$this->getPriceHtml($_product, true);

won't render any thing on that page. So I tried to change my code to

$product_block = new Mage_Catalog_Block_Product;
echo $product_block->getPriceHtml($_product, true);

But it generated an  error message like this.

  Call to a member function getStoreLabel() on a non-object in lines XX

How can i fix this problem?


texts: System Extensions Integrations missing from admin. Can't add new Integration

texts:
I have a magento 2 site, trying to add a required 'integration' for a 3rd party module. System > Extensions > Integrations is completely missing from the admin menu. Nothing else seems to be missing. I cannot access it directly via url either ("/admin/admin/integration/index/key/xxx"), it just redirects to dashboard.

I have searched high and low and haven't found anything similar being reported by anyone.

There are no relevant errors in magento system, exception or debug logs. No browser console or network errors.

This is the staging site, on the live and local site (same codebase) 'Integrations' is there...?

I compared databases and found nothing, but may have missed something.
Magento_Integration module is enabled.

I reset file permissions (like this https://gist.github.com/alihalabyah/e9d5cd077efb4b62cdd40bf4cf75c8ac)

I have cleared caches, redeployed etc.

I turned off the htpasswd just in case this was causing issues.

Anyone else ever seen this issue?? What further steps should I now take to try and fix this?

Would adding integrations manually to 'integrations' and 'oauth_consumer' work? (needs a 'key' and 'secret', not sure if these are meant to be dynamically generated, seems like this way will be trouble..? Would feel better doing it the normal way)

Thanks in advance...! :]


texts: magento-change product name base on value of custom attribute

texts:
I need to write some code in checkout/order review section. file--- app\design\frontend\base\default\template\checkout\onepage\review/item.phtml

Now the problem in details:

I have a drop down custom attribute PURCHASE_TYPE. And one of its value MARGIN

Now, I need to show (*) after the product name in the checkout/order review which products custom attribute  PURCHASE_TYPE. is  MARGIN.


texts:
How can I set how long will the success message be displayed. Now its visible for one second and then it disappears. Can I somehow set that this message stays visible for 10 seconds? Or maybe, that it never goes away?

I tried with jQuery but that's not a good solution. Where in Magento is defined how long will the message be shown?


texts: WSDL soap v1 error: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

texts:
the complete error is:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">    <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>1</faultcode>
         <faultstring>SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s), query was: SELECT `customer_entity`.* FROM `customer_entity` WHERE (entity_id =8, 'firstname => Matheus, lastname => teste')</faultstring>
      </SOAP-ENV:Fault>    </SOAP-ENV:Body> </SOAP-ENV:Envelope>

My request sending is simple, just a array with two resources:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Magento" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <ns1:call>
         <sessionId>e4a9c70ae37dff4f4f27dbd0e1245s5s5s2b29</sessionId>
         <resourcePath>customer_address.create</resourcePath>
         <args SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array" enc:arrayType="rs:Resource[2]">
            <item xsi:type="ns2:Map">
              <item  xsi:type="rs:Resource">
              <key xsi:type="xsd:string">customerId</key>
              <value xsi:type="xsd:int">8</value>
            </item>
              <item  xsi:type="rs:Resource">
              <key xsi:type="enc:Array">addressdata</key>
              <value xsi:type="xsd:array">firstname => Matheus, lastname => teste</value>
            </item>
            </item>
        </args>
      </ns1:call>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

So....
as I understand it must send the request only 1 ITEM with the value of the customerId and the array values addressdata as link http://www.magentocommerce.com/api/soap/customer/customerAddress/customer_address.create.html But I am sent with XML and my code above does not work, someone could say why? thank you


texts: Product image does not change when selecting color attribute magento 2.3.3

texts:
I have configurable products, with a collection of simple products with color and Product length attributes.
I want to change the image of the product on selection of only color attribute.
But in my case, when i select both the color and product length option then only the image is changed, otherwise not.
I have set the Update product preview image to YEs https://prnt.sc/v96ymp
Check this product link for understanding the issue https://5iallk0uwem1coeq.mojostratus.io/4d-zorb-soaker-fabric-silver.html . And try selecting color option, you will see image does not change. But when you select color and Product length both, the image gets change.
Please help.


texts: Magento 2 : Checkout Shipping Address selection changed to drop down, Selected Options is not coming

texts:
Magento 2 Shipping address selection changes to drop down form radio options. I want to display default shipping address on page load but it's always showing first shipping address as a selected. In Magento_Checkout/template/shipping-address/list.html :

            <select class="select" name="billing_address_id" data-bind="
        options: shippingAddressOptions,
        optionsText: shippingAddressOptionsText,
        value: selectedShippingAddress,
        selectedOptions: chosenCountries,
        event: {change: onShippingAddressChange(selectedShippingAddress())};
    "></select>

In js/view/shipping.js file:

define(
[
    'jquery',
    "underscore",
    'Magento_Ui/js/form/form',
    'ko',
    'Magento_Customer/js/model/customer',
    'Magento_Customer/js/model/address-list',
    'Magento_Checkout/js/model/address-converter',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/action/create-shipping-address',
    'Magento_Checkout/js/action/select-shipping-address',
    'Magento_Checkout/js/model/shipping-rates-validator',
    'Magento_Checkout/js/model/shipping-address/form-popup-state',
    'Magento_Checkout/js/model/shipping-service',
    'Magento_Checkout/js/action/select-shipping-method',
    'Magento_Checkout/js/model/shipping-rate-registry',
    'Magento_Checkout/js/action/set-shipping-information',
    'Magento_Checkout/js/model/step-navigator',
    'Magento_Ui/js/modal/modal',
    'Magento_Checkout/js/model/checkout-data-resolver',
    'Magento_Checkout/js/checkout-data',
    'uiRegistry',
    'Magento_Catalog/js/price-utils',
    'mage/translate',
    'Magento_Checkout/js/model/shipping-rate-service'
],
function(
    $,
    _,
    Component,
    ko,
    customer,
    addressList,
    addressConverter,
    quote,
    createShippingAddress,
    selectShippingAddress,
    shippingRatesValidator,
    formPopUpState,
    shippingService,
    selectShippingMethodAction,
    rateRegistry,
    setShippingInformationAction,
    stepNavigator,
    modal,
    checkoutDataResolver,
    checkoutData,
    registry,
    priceUtils,
    $t
) {
    'use strict';
    var popUp = null,
    shippingAddress = quote.shippingAddress,
    newAddressOption = {
            getAddressInline: function () {
            return $t('New Address');
        },
            customerAddressId: null
        },
        shippingAddressOptions = addressList().filter(function (address) {
            return address.getType() == 'customer-address';
        });

    shippingAddressOptions.push(newAddressOption);
    return Component.extend(
        {
            defaults: {
                template: 'Magento_Checkout/shipping'
            },
            visible: ko.observable(!quote.isVirtual()),
            errorValidationMessage: ko.observable(false),
            isCustomerLoggedIn: customer.isLoggedIn,
            isFormPopUpVisible: formPopUpState.isVisible,
            isFormInline: addressList().length == 0,
            isNewAddressAdded: ko.observable(false),
            saveInAddressBook: 1,
            quoteIsVirtual: quote.isVirtual(),
            shippingAddressOptions: shippingAddressOptions,
            chosenCountries:ko.observableArray([shippingAddress]),


texts: Base and thumbnail image etc not showing

texts:
We list through a 3rd party Order Management system and have done for years but recently even after we select the Base image for the product it does not update in Magento Back-End.

I have to go into Magento to select any base image for it to show the image I chose in the Order management system.

Has anyone else experienced this?

Does anyone know of a script that would find any product that does not have an image assigned and select a random image as Base, small and thumbnail image?

Thanks


texts: Magento 2: Terms and Conditions Validation issue

texts:
I am working with Magento 2.1.0. I have enabled 'Terms and conditions' on site and added 2 conditions one for 'Terms and conditions' and other for 'Replacement Policy'. It displayed both in checkout page correctly, but validation is done only for the first check-box. Not considering the second one. If first check-box is checked. We will be able to place the order.

I have found out that it is the issue with the Magento 2. How can I fix this issue? Please help.


texts:
I am new to Magento and I have installed Magento ver. 1.9.1.0 just couple of days ago.
This is my problem:
My store is not sending any emails after placing the order, or commenting the order, changing status of it or any sales activity at all, as well as emails to friend.
However when I submit an email through Contact Us form, this email is delivered.

Background:

testmail.php is working I can send emails and they are delivered
Configuration/General/Store Email Addresses are configured
Configuration/Sales/Sales Emails are enabled
I have even set Configuration/Advanced/System/Mail Sending Settings (No,smtp.xxx.xx,25,No), even though I believe this is not required
I receive no error message. When I check the logs (had to create files manually myself), exception.log contains nothing related to mail, system.log is empty.
I think this is not the problem, but now I am a bit paranoid, i run Magento no directly on the address www.example.com but on the www.example.com/apps/magento191_2

Any idea whats going on please?
Thank you.


texts: How to get event observer data after save category?

texts:
I want to export data of a category when its save in magento system. So, I also create a module & create a event name which is catalog_category_save_commit_after.
My code is like below..

<config>
<global>
 ....
<events>
        <catalog_category_save_commit_after>
            <observers>
                <category_category_observer>
                    <type>singleton</type>
                    <class>Feed_Category_Model_Category_Observer</class>
                    <method>saveCategoryData</method>
                </category_category_observer>
            </observers>
        </catalog_category_save_commit_after>
    </events>
</global>

class Feed_Category_Model_Category_Observer
{
    public function saveCategoryData($observer)
    {

        $category = $observer->getEvent()->getDataObject();
        Mage::log($category);
        // or
        Mage::log($observer->getEvent()->getCategory());

    }
 }

Both are return blank. Have any idea??


texts: Magento 2 Uncaught TypeError: Cannot read property 'confirmation' of undefined in datapost.js

texts:
I get this error while using a<> tag with attribute data-post.
I used a data-post to re-order.
history.phtml
Reorder

the KO observable postData has value
{"action":"http:\/\/smagento2.com\/sales\/order\/reorder\/order_id\/23\/","data":{"uenc":"aHR0cDovL3NtYWdlbnRvMi5jb20vc2FsZXMvb3JkZXIvaGlzdG9yeS8,"}}


texts: why buttons are not showing in frontend ui form in magento2?

texts:
Why buttons are not showing in frontend UI Form in Magento2 ? Can anyone help in this.

Code added in employee_form.xml file:

<argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
        <item name="provider" xsi:type="string">employee_form.employee_form_data_source</item>
        <item name="deps" xsi:type="string">employee_form.employee_form_data_source</item>
    </item>
    <item name="label" xsi:type="string" translate="true">Employee Information</item>
    <item name="reverseMetadataMerge" xsi:type="boolean">true</item>
    <item name="config" xsi:type="array">
        <item name="dataScope" xsi:type="string">data</item>
        <item name="namespace" xsi:type="string">employee_form</item>
    </item>
    <item name="template" xsi:type="string">templates/form/collapsible</item>

    <item name="buttons" xsi:type="array">
        <item name="save_and_continue" xsi:type="string">Magedeal\Customui\Block\Buttons\SaveButton</item>
    </item>

</argument>

<settings>
    <buttons>
        <button name="save" class="Magedeal\Customui\Block\Buttons\SaveButton"/>
    </buttons>
    <namespace>employee_form</namespace>
    <dataScope>data</dataScope>
    <deps>
        <dep>employee_form.employee_form_data_source</dep>
    </deps>
</settings>


texts: Magento:2 I want to display product image in 1 column vertically instead of using default Fortorama.js. I want to remove slider

texts:
I am facing this issue ..I don't want to display product images in default slider which is coming from fotorama.js
I want them to displayed as one by one without slider

What should I do

    $images = $block->getGalleryImages()->getItems();
$mainImage = current(array_filter($images, function ($img) use ($block) {
    return $block->isMainImage($img);
}));

if (!empty($images) && empty($mainImage)) {
    $mainImage = $block->getGalleryImages()->getFirstItem();
}

$helper = $block->getData('imageHelper');
$mainImageData = $mainImage ?
    $mainImage->getData('medium_image_url') :
    $helper->getDefaultPlaceholderUrl('image');

?>

<div class="gallery-placeholder _block-content-loading" data-gallery-role="gallery-placeholder">
    <img
        alt="main product photo"
        class="gallery-placeholder__image"
        src="<?= /* @noEscape */ $mainImageData ?>"
    />
</div>

<script type="text/x-magento-init">
    {
        "[data-gallery-role=gallery-placeholder]": {
            "mage/gallery/gallery": {
                "mixins":["magnifier/magnify"],
                "magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>,
                "data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>,
                "options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>,
                "fullscreen": <?= /* @noEscape */ $block->getGalleryOptions()->getFSOptionsJson() ?>,
                 "breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?>
            }
        }
    }
</script>


texts: Specific Terms and Conditions based on Product Selection

texts:
Is there a way of only showing SPECIFIC Terms and Conditions during the checkout process only if SPECIFIC products are in the basket?

I am currently using Bartosz Górski's Conditional Agreements module.
https://github.com/bgorski/conditionalagreements

However, this module shows ALL terms and conditions if specific products are in the basket. If none of the relevent products are in the basket, then NONE of the terms and conditions are shown.
(It works by products having a 'show agreements' attribute)

What I really want is something like this:

Basket Contains Product A => Show Agreement A only
Basket Contains Product B => Show Agreement B only
Basket Contains Products A & B => Show Agreement A and Agreement B

Rather than what I have with the current module

Basket Contains Product A => Show Agreement A and B
Basket Contains Product B => Show Agreement A and B
Basket Contains Products A & B => Show Agreement A and B

Any ideas where I can go with this?


texts: Magento 2 custom module admin field output must be true

texts:
I want to add a filed in the Magento 2 admin panel, this field must return in the frontend True if in admin is selected Yes. I try to add this in the system.xml:

<field id="do_something" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Do something?</label>
    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
    <comment>Do we want to do something?</comment>
</field>

but this is return only 1 and 0 value and I need to have true or false;

What I can do?

Thank you

Update:

<?php if ($config->getDoSomething()): ?>'<?php echo $config->getDoSomething(); ?>',<?php else: ?><?php endif; ?>


texts: Is it possible to view 'default storeview' dropdown attribute values in product Admin Grid?

texts:
I've got a dropdown attribute as is in M2.3.4 admin
Admin => 1
Default Store view => 'Text for id 1'
Admin => 2
Default Store view => 'Text for id 2'
But when I go to product section, even when changing scope to 'Default Store view', Admin values are shown in the dropdown. So it's not very easy to create a product. Any solution for this ?
Thank you.


texts: Creating New custom Product Type similar as Configurable but configurable tab is missing

texts: I am trying to create a new product type which basic functionality is similar to the configurable product that’s why i extend product type with \Magento\ConfigurableProduct\Model\Product\Type\Configurable but still it is not showing the functionality of the Configurable. Such as my custom product type is not showing Configurations tab while creating my custom product type.


texts: Get Wishlist product collection in Controller of Custom module Magento2

texts:
I am trying to get Wishlist product collection in Custom module controller for the new functionality. I searched in google and I got this:

Inject this class in your constructor:

protected $wishlistProvider;

public function __construct(
    ...
    \Magento\Wishlist\Controller\WishlistProviderInterface $wishlistProvider
) {
    $this->wishlistProvider = $wishlistProvider;
    ...
}

and

$currentUserWishlist = $this->wishlistProvider->getWishlist();
if ($currentUserWishlist) {
    $wishlistItems = $currentUserWishlist->getItemCollection();
}

I have tried using this code. But its not working. I am getting this error:

  Uncaught TypeError: Argument 3 passed to
  namespace\modulename\Controller\Index\Index::__construct() must be an
  instance of Magento\Wishlist\Controller\WishlistProviderInterface,
  none given, called in
  /var/www/project_name/var/generation/namespace/modulename/Controller/Index/Index/Interceptor.php
  on line 14

Please suggest me a way to do this. Thanks in advance!!


texts:
i would like to run a command window which monitors the user registration.
But i do not find the correct command to display that.
So how can i see in command window each time a user registers, logs in and out?


texts:
I analyzed my website on Gtmetrix.com for optimization and the result was this:

  There are 4 static components without a far-future expiration date:

http://www.someextensionsite.com/widgets/v1.0/init.js
http://static.someextensionsite.com/templates.0p4D3v0p5f.js
http://static.someextensionsite.com/styles.0p4D3v0p5f.css
http://static.someextentionsite.com/preload_data.0p4D3v0p5f.js

  Expires headers let the browser know whether to server a cached
  version of the page.

and i should add this: someextentionsite is a search extentin.

how to solve this problem?


texts:
The client wants to use custom UPS Shipping Rates for different continents:

For instance:

EU: 20 euros
US: 30 euros
Asia: 40 euros

Is it possible to setup custom rates in Magento for UPS and then also ensure that UPS tracking etc. continues to work? Any useful extensions for this?

Thanks!


texts:
What is a good way to remove some links from the account dashboard?

Mostly:

My Downloadable Products
My Applications
Billing Agreements
Recurring Profiles

I did some Googling and searched the "duplicate" questions here on SE and found some promising solutions but I am not sure if they are compatible with my version of Magento which is ver. 1.9.1.0. I am looking for a solution that won't break the code in any future updates. thanks!


texts: robots.txt allow crawling of category/product pages and js/css/images

texts:
I'm new to configuring robots.txt and trying to understand how to best configure for our Magento EE install. Right now, I have the following:

### bots should have full access to category/product url-key paths
### bots should have full access to media (images), skin (images/js/css), js directories

User-agent: *
### Directories
Disallow: /app/
Disallow: /var/
Disallow: /downloader/
Disallow: /lib/
Disallow: /pkginfo/
### Paths (clean URLs)
Disallow: /*?
Disallow: /admin/
Disallow: /catalog/
Disallow: /catalogsearch/
Disallow: /checkout/
Disallow: /customer/
Disallow: /newsletter/
Disallow: /onestepcheckout/
Disallow: /report/
Disallow: /review/
Disallow: /wishlist/
### Files
Disallow: /api.php
Disallow: /apc_clear.php
Disallow: /index.php
Disallow: /cron.php
Disallow: /cron.sh
Disallow: /get.php
Disallow: /install.php
Disallow: /pi.php
Disallow: /LICENSE.html
Disallow: /LICENSE_AFL.txt
Disallow: /LICENSE_EE.html
Disallow: /LICENSE_EE.txt
Disallow: /LICENSE_SMD_ColorSwatch.txt
Disallow: /RELEASE_NOTES.txt

Sitemap: http://www.example.com/sitemap/sitemap.xml

Agents should still be able to crawl all clean web page URLs, like CMS pages and category/product url-key paths, correct? For example, these URLs/pages would not be blocked and are still crawlable:

www.example.com/shape/fedora/            #category view page
www.example.com/shape/fedora/cool-hat    #product view page
www.example.com/some-cms-page/url-key    #CMS page


texts:
I want to Create the cron job, but everytime I do this step crontab -u Magento file system owner user name -e I got an error: must be privileged to use -u.
The problem is I don't know what the Magento file system owner is. Where can I find this?


texts: When 'sales_bestsellers_aggregated_daily' table will get update data?

texts:
In my local 'sales_bestsellers_aggregated_daily' table is empty, But I need to get the best selling products from this table. I made an order and created shipments also. But this table is empty.

Is anybody knows when this 'sales_bestsellers_aggregated_daily' will get update with product data?


texts: Magento 2 :Add custom field on order create page admin

texts:
I want to add a date field right below shipping method on admin order create page

I tried searching but magento 1 solution shows up I'm new to Magneto


texts: Picture of the product disappears after entering the product

texts:
I have a problem with newly added products.  When I enter the product, the photo disappears.

when I enter old products, then the pictures work correctly.

Here is movie which description problem: https://streamable.com/oz97w


texts: i could not fetch customer attribute in magento1.9

texts:
this is code give error ERR_EMPTY_RESPONSE and This page isn’t working
    $attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'customer_attribute')->getSource();

    $attribute =$attribute->getAllOptions(false);
    echo "<pre>";print_r($attribute);echo "</pre>";die;


texts: How to edit admin TinyMCE JavaScript code (without modifying core files)?

texts:
I'm looking to change the init of TinyMCE for Magento admin.

I'm just not satisfied with the default options and want to give my client a more user-friendly way of working with. So I want to remove some plugins, change some options and perhaps add some other plugins. But I want to keep the integrated Magento functionality.

I have not yet found a way to acomplish this without editing the js/mage/adminhtml/wysiwyg/tiny_mce/setup.js directly.

Is there a working solution?

UPDATE

Tobias' solution works very well! As you can read below, I had some trouble getting it to work due to 403 forbidden errors on my localhost. On my staging server however it worked as expected.

After some more testing, I found that the Fooman_Speedster extension I had installed was the cause of the problem. After disabling that, everything works fine!


texts: How to show "out of stock" in ONE category only while hiding them from all other categories?

texts:
I am trying to display out of stock product in only one category.
I have already change admin setting

  "display out of stock"  - No

any idea how to display it in one category.


texts: How to set extension attribute to Order search interface api magento 2

texts:
Please review following files:

  OrderRepositoryPlugin.php

<?php
namespace Retailinsights\Cartrules\Plugin;

use Magento\Catalog\Api\ProductRepositoryInterfaceFactory as ProductRepository;

use Magento\Sales\Api\Data\OrderExtensionFactory;
use Magento\Sales\Api\Data\OrderExtensionInterface;
use Magento\Sales\Api\Data\OrderInterface;
use Magento\Sales\Api\Data\OrderSearchResultInterface;
use Magento\Catalog\Helper\ImageFactory as ProductImageHelper;
use Magento\Sales\Api\OrderRepositoryInterface;

/**
 * Class OrderRepositoryPlugin
 */
class OrderRepositoryPlugin {
    /**
     *@var \Magento\Catalog\Helper\ImageFactory
     */
    protected $productImageHelper;

    /**
     * @var ProductRepository
     */
    protected $productRepository;

    /**
     * Order Comment field name
     */
    const FIELD_NAME = 'unitm';

    /**
     * Order Extension Attributes Factory
     *
     * @var OrderExtensionFactory
     */
    protected $extensionFactory;

    /**
     * OrderRepositoryPlugin constructor
     *
     * @param OrderExtensionFactory $extensionFactory
     */

    public function __construct(
        ProductImageHelper $productImageHelper,
        OrderExtensionFactory $extensionFactory,
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
    ) {
        $this->productImageHelper = $productImageHelper;
        $this->extensionFactory = $extensionFactory;
        $this->_productRepository = $productRepository;
    }

    public function afterGet(OrderRepositoryInterface $subject, OrderInterface $order) {
        $addAtt = array();
        $info = array();
        $addImage = array();
        $infoImage = array();

        foreach ($order->getAllItems() as $orderItems) {
            $itemExtAttr = $order->getExtensionAttributes();
            $product = $this->_productRepository->getById($orderItems->getProductId());
            $uom = $product->getUnitm();
            $weight = round($product->getWeight(), 0);
            $optionId = $product->getUnitm();
            $attribute = $product->getResource()->getAttribute('unitm');
            if ($attribute->usesSource()) {
                $optionText = $attribute->getSource()->getOptionText($optionId);
            }

            $sku = $orderItems->getSku();

            $imageurl =$this->productImageHelper->create()->init($product, 'product_thumbnail_image')->setImageFile($product->getThumbnail())->getUrl();
            $addAtt[$sku] = $weight." ".$optionText;
            $addImage[$sku] = $imageurl;
        }

        $info[] = $addAtt;
        $infoImage[] = $addImage;
        $data = json_encode($info);
        $dataImage = json_encode($infoImage);
        $orderComment = $order->getData(self::FIELD_NAME);

        $extensionAttributes = $order->getExtensionAttributes();
        $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
        $extensionAttributes->setUnitm($data);
        $extensionAttributes->setImageUrl($dataImage);
        $order->setExtensionAttributes($extensionAttributes);
        return $order;
    }
}

  extension_attributes.xml

<extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
    <attribute code="image_url" type="string" />
    <attribute code="unitm" type="string" />
</extension_attributes>

Here I am trying to set extension attribute to order interface, but its working in other Orders but not in search criteria, how to achieve it, Thank you in advance.
API is like rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=customer_email&searchCriteria[filter_groups][0][filters][0][value]=me345@gmail.com


texts: How do I use MAGMI Column mapper for attributes with the same value?

texts:
The title speaks for itself.

I'm not able to configure magmi column mapper plugin for writing only one csv cell for attributes that are having the same value. IE: image, small_image and thumbnail or name and product_name.

So, can anyone tell me how to do this? I want my CSV file to be as clean and optimized as it can be made.


texts: Magento display configurable color's on category page

texts:
I have this code. It works great, get's the values.

<?php if($_product->isConfigurable()): ?>
  <?php $attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product) ?>
  <?php if(count($attributes)): ?>

    <?php foreach($attributes as $att): ?>
      <?php $pAtt=$att->getProductAttribute();
        //get the child products
        $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
        $frontValues =array() ?>

<?php echo $pAtt->getFrontendLabel() ?>

       <?php foreach($allProducts as $p): ?>
         <?php if(!$p->isSaleable()) continue; ?>
         <?php $out=$p->getAttributeText($pAtt->getName()); ?>
         <?php $frontValues[$out]=$out; ?>
       <?php endforeach ?>

<?php echo implode('

', $frontValues) ?>

    <?php endforeach ?>

  <?php endif ?>
<?php endif ?>

But I don't want to see the Size option, just available colors and add ID to every
 according to the color. For example:

The color is 251 in magento, so I want to add ID with a-Code (a-251) so I can target it with css easily.

Can you help me to modify a bit this code? Because I'm new, trying to modify it and getting errors.

Thanks,

UPDATE:

The code I have now:

                  <?php if($_product->isConfigurable()): ?>
                    <?php $attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product) ?>
                    <?php if(count($attributes)): ?>

                      <?php foreach($attributes as $att): ?>
                        <?php $pAtt=$att->getProductAttribute();
                          if ($pAtt->getFrontendLabel() != 'Color') continue;
                          //get the child products
                          $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
                          $frontValues =array() ?>

                         <?php foreach($allProducts as $p): ?>
                           <?php if(!$p->isSaleable()) continue; ?>
                           <?php $out=$p->getAttributeText($pAtt->getName()); ?>
                           <?php $frontValues[$out]=$out; ?>
                           <?php $colors=$p->getData(strtolower($pAtt->getName()))?>
                         <?php endforeach ?>

<a id="a-<?php echo $colors ?>"><?php echo implode('

', $frontValues) ?>

                      <?php endforeach ?>

                    <?php endif ?>
                  <?php endif ?>

I need to add the id in to the array, so it would add correct values (id's) to each color, can you help?


texts: Programatically Adding Configurable Product To Cart Not Working

texts:
I'm trying to add a configurable product to the cart, but while it's not throwing any Exceptions, the cart is still empty.

I've used this code before without problems, so I'm not sure if it's something to do with the version of Magento I'm using.

The code I'm using is:

   $post = $this->getRequest()->getPost();
   $session = Mage::getSingleton('customer/session');

   $attr = array_keys($post['sa']);

   $cart = Mage::getSingleton('checkout/cart');
   $cart->init();

    foreach ($post['sa'][$attr[0]] as $optId){
        try {
            if (abs($post['qty'][$optId]) > 0){
                $product = Mage::getModel('catalog/product')->load($post['product']);
                $this->getRequest()->setParam('product',$post['product']);
                $this->getRequest()->setParam('super_attribute',array(
                        $attr[0] => $optId
                    ));
                $options = array(
                    "product"=>$post['product'],
                    "super_attribute"=>array(
                        $attr[0] => $optId
                    ),
                    "qty"=>$post['qty'][$optId]
                );

                $opts = new Varien_Object();
                $opts->setData($options);

                var_dump($opts);

                $cart->addProduct($product, $opts);
                $cart->save();

            }
        } catch (Exception $e){
            var_dump($e);
        }

    }

    $cart->save(); // save the cart
    $cart->setCartWasUpdated(true);

$pdts = $cart->getAllVisibleItems();

    var_dump($pdts);
    die("??");

So I'd expect to get a cart with 6 items in it (3 products, configurable + simple), however I'm getting null instead - as you can see from the below, which also shows the $opts object I'm trying to pass:

    object(Varien_Object)[507]
      protected '_data' =>
        array (size=3)
          'product' => string '86' (length=2)
          'super_attribute' =>
            array (size=1)
              179 => string '20' (length=2)
          'qty' => string '1' (length=1)
      protected '_hasDataChanges' => boolean true
      protected '_origData' => null
      protected '_idFieldName' => null
      protected '_isDeleted' => boolean false
      protected '_oldFieldsMap' =>
        array (size=0)
          empty
      protected '_syncFieldsMap' =>
        array (size=0)
          empty
    object(Varien_Object)[663]
      protected '_data' =>
        array (size=3)
          'product' => string '86' (length=2)
          'super_attribute' =>
            array (size=1)
              179 => string '19' (length=2)
          'qty' => string '2' (length=1)
      protected '_hasDataChanges' => boolean true
      protected '_origData' => null
      protected '_idFieldName' => null
      protected '_isDeleted' => boolean false
      protected '_oldFieldsMap' =>
        array (size=0)
          empty
      protected '_syncFieldsMap' =>
        array (size=0)
          empty
    object(Varien_Object)[678]
      protected '_data' =>
        array (size=3)
          'product' => string '86' (length=2)
          'super_attribute' =>
            array (size=1)
              179 => string '17' (length=2)
          'qty' => string '3' (length=1)
      protected '_hasDataChanges' => boolean true
      protected '_origData' => null
      protected '_idFieldName' => null
      protected '_isDeleted' => boolean false
      protected '_oldFieldsMap' =>
        array (size=0)
          empty
      protected '_syncFieldsMap' =>
        array (size=0)
          empty
    null
    ??

Any help would be apprciated!


texts: How to pull in variable for order value into fulfilment company?

texts:
Can anyone tell me how I can include the actual value of an order (not including shipping, although I might like that as an option as well) in an Order CSV that gets sent to the order fulfillment company? I am using Magento CE 1.8.1.

Basically when an order is generated, it also generates a CSV file with the order details and uploads this to the order fulfillment company. Looking through the code I can see that it pulls in other order data from variables e.g:

$billingAddress = $order->getBillingAddress()->toArray();
$email = $billingAddress['email'];
$telephone = $billingAddress['telephone'];

What would be the variable name for pulling in the value of the order? I can't see any way of finding this out. I'm guessing it's $order -> something or other but I can't see any documentation on what the correct variable is?


texts: Magento TTFB really slow 1+ minute after installing new theme

texts:
I installed a new theme on magento 1.7, and I also had to uninstall GTSpeed, seeing that was breaking the theme. And now I'm getting 1.9 minutes average TTFB time. I don't believe it is because I uninstalled GTSpeed, there is too much difference.

I installed APC and Varnish, but it didn't help. Magento with the old theme (currently live) delivers the first byte in less than 0.6 seconds usually.

Here is the URL to the test slow version:
http://178.62.76.226/musicminds.ie/httpdocs/index.php/

What could possibly be causing this?

EDIT:
It's possibly something to do with the 2columns-left.phtml, when I changed the home page to 1 column the TTFB time went down to 4 seconds.


texts: Magento2: How to delete cookies programmatically?

texts: I want to delete cookies programmatically before as login customer.


texts: Magento 1.9: Creating a page for just 1 product

texts:
I am trying to create a view for just 1 product, a gift card.
We want some special front-end code to display some variable options for a gift card.

We have a gift card product type and it comes to some special options for selecting a price value. So the functionality of user-selected values is already coded.

I just want to take that product type and give it a spiffy front end without disrupting the other products.

We already have a product template, and it has some components that i need to remove.
This is the path of our product view:

  app/design/frontend/vendor/vendor/template/catalog/product/view.phtml

There's also a:

  app/design/frontend/vendor/vendor/template/catalog/giftcard/price.phtml

(and other pages)

If someone could give me a high-level idea of steps I need to take, I would very much appreciate it.


texts:
After installing divante/magento2-vsbridge-indexer my admin page gone not found
I'm using Magento 2.4.1 and I've tried clearing cache and changing the admin uri and upgrading and compiling but nothing helped.
Using NGINX
Everything else is working fine except for the admin page


texts: Getting collection programatically won't load out of stock items

texts:
I'm trying to load a collection of simple products programmatically. However, for some reason, Magento is filtering out of stock products with

WHERE (IF(at_status.value_id > 0, at_status.value, at_status_default.value) = 1)

Even though I did not use addInStockFilterToCollection anywhere in the code! I tried setting Show Out of stock products both to true and false, and neither seemed to work..

What might be the reason?


texts: Magento 2 code to add block into phtml file

texts: I'm using Magento 2 and I want to add block to all my category pages , by directly writing it into the code in the app/design/frontend/Venustheme/yume/Magento_Catalog/templates/product/list.phtml page , there is any way to call the block there, and not through the admin panel?


texts: How to sort attribute options in Magento 2 alphabetically

texts:
For example, if you have thousands of colors (options) in the color attribute, it becomes a pain to use the drag & drop sorting functionality.

I'd like to override the default sorting (based on option position) to sort by attribute label alphabetically for all attributes.

I did some digging around in core files, but couldn't locate the class or function which does this.

Any ideas where this functionality is inside Magento's core?


texts:
I'm trying to to an ajax call using following code

$.ajax({
                    type: 'POST'
                    ,url: SOME_URL
                    ,data: {testdata : testid}
                    ,success: function(result){
                     //code
                    }});

SOME_URL points to a controller file having following code.

public function execute()
{

echo '{"test":["-1.00","-2.00"]}';

}

when I debug the success function of ajax call I get data in the result variable of success function parameter.

"{"test":["-1.00","-2.00"]}exception 'Exception' with message 'Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/magentoce21/app/code/<<company>>/<<route_name>>/Controller/Index/View.php:58) in /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php on line 126' in /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'Cannot modify h...', '/Applications/M...', 126, Array)
#1 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php(126): setcookie('X-Magento-Vary', '252f89d2ca7ad02...', 0, '/', '', false, true)
#2 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php(78): Magento\Framework\Stdlib\Cookie\PhpCookieManager->setCookie('X-Magento-Vary', '252f89d2ca7ad02...', Array)
#3 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/App/Response/Http.php(85): Magento\Framework\Stdlib\Cookie\PhpCookieManager->setSensitiveCookie('X-Magento-Vary', '252f89d2ca7ad02...', Object(Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata))
#4 /Applications/MAMP/htdocs/magentoce21/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(37): Magento\Framework\App\Response\Http->sendVary()
#5 /Applications/MAMP/htdocs/magentoce21/vendor/magento/module-page-cache/Model/App/Response/HttpPlugin.php(25): Magento\Framework\App\Response\Http\Interceptor->sendVary()
#6 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/Interception/Interceptor.php(123): Magento\PageCache\Model\App\Response\HttpPlugin->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor))
#7 /Applications/MAMP/htdocs/magentoce21/var/generation/Magento/Framework/App/Response/Http/Interceptor.php(117): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array)
#8 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/App/Http.php(185): Magento\Framework\App\Response\Http\Interceptor->sendResponse()
#9 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/App/Http.php(156): Magento\Framework\App\Http->handleDeveloperMode(Object(Magento\Framework\App\Bootstrap), Object(Exception))
#10 /Applications/MAMP/htdocs/magentoce21/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->catchException(Object(Magento\Framework\App\Bootstrap), Object(Exception))
#11 /Applications/MAMP/htdocs/magentoce21/index.php(52): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#12 {main}"

I checked for any white-spacing in the php code, but found none.


texts: Magento 1.9 : Xdebug can no longer be used for as xdebug no longer support php 5

texts:
I am trying to use Xdebug for magento 1. However, Xdebug no longer supports PHP under 7.0. Magento 1 on the other hand only works for php 5.

Does anyone know any solution to this problem.


texts: Magento 2: How to debug on Checkout Pages when having KnockOut JS & Web Template

texts:
http://localhost/magento2/checkout/

vendor\magento\module-paypal\Model\Hostedpro\Request.php

public function setPaymentMethod($paymentMethod)
    {
        $this->paymentMethod = $paymentMethod;
        $requestData = $this->getPaymentData($paymentMethod);

        echo "<pre>";
        print_r($requestData);
        exit;

        $this->addData($requestData);

        return $this;
    }

I'm not able to see on FireBug or it's neither printing on browser or neither in View Source.

Checkout page just shows Blank.

On any of the checkout pages, when you have combination of KnockOut & Web Template

Example: vendor\magento\module-paypal\view\frontend\web\template\payment\paypal-express-in-context.html

Whenever you do PHP echo or Javascript alert it's not gonna work. So how to check & debug?

Must say for me it's tough for now & time-consuming. In CorePHP can do easily but Magento 2 + Zend + KnockOut +++.


texts: Custom email templates sales_email_order_items has no style

texts:
I made a custom email template from the backend of Magento. When I add

{{layout handle="sales_email_order_items" order=$order area="frontend"}}

I see the item table, but no styling and there is no formatting, just a basic table

How do I add styling to this?


texts: How to add a background image to header content?

texts:
It's been last 42 hours i am trying to get a background image to header content on luma! [magento 2]
but nothing getting accurately!!
how do i add a background image to header content on magento luma!!? and make it sticky or fixed on top!!!
can anybody give me just proper guide through this problem i'm stuck with?


texts:
When i look at magento 2 root then found nginx.conf file.I googled and read many links like

DEMO HERE

But still confusion.
My question is why do i configure nginx.conf? What is relation between nginx.config and magento?

Thanks


texts: UPS shipping is only returning three methods

texts:
I am using UPS for shipping method and set the shipping origin to colorado USA, products have set their weight but i am getting only three shipping methods to ship I am on CE 1.7.0 i have checked with another installation with same version and that working great, so i have copied the shipping module to my live site and this is super unfortunate that tihs is not working.

United Parcel Service

    Next Day Air Saver $99.97
    Next Day Air $107.35
    Next Day Air Early AM $140.65

Note : I have set up all the conditons to a test site with same CE 1.7.0 version there they are working fine but for live site only three rates are coming.

Any idea for this.

Thnaks


texts: I am not getting the value in $quote in mulitple currency

texts:
I am facing the strange issue. I have enabled multi currence on the store but when I change the currency from cart page I seeing entire blank page and getting error'Allowed memory size of 268435456 bytes exhausted '.While trying to debugg the issue I found that I am not getting the value in $quote.
I am using following code to get quote $quote= Mage::getSingleton('checkout/cart')->getQuote(); please help me in this issue.


texts: Notice: Array to string conversion in vendor/magento/framework/Escaper.php on line 261 in magento 2.4.1

texts:
I am facing this issue when I create a custom theme under my Magento 2.4.1.
The product displaying hides automatically showing this error.


texts:
I'm trying to build my new environment but I'm receiving error 502 every time. When I check the logs in the Magento Cloud panel I don't have the end of the file, it seems to be too long to show.

Do you know how can I debug it?


texts: Hug size of debug.log file in Magento 2.2

texts: Yesterday I passed my Magento 2.2 to production and the debug.log is collapsing the server every 12 hours. Can someone tell me how to disable the debug.log?


texts: Magento 2: How to sort order of custom links nav?

texts:
I've used following code to insert custom links in topmenu.

But those are coming in the last of main nav. I want first about us then some other category then contacts us etc.

<?php

namespace Dcw\Customer\Plugin\Block;

use Magento\Framework\Data\Tree\NodeFactory;

class Topmenu
{
    /**
     * @var NodeFactory
     */
    protected $nodeFactory;

    public function __construct(
        NodeFactory $nodeFactory
    ) {
        $this->nodeFactory = $nodeFactory;
    }

    public function beforeGetHtml(
        \Magento\Theme\Block\Html\Topmenu $subject,
        $outermostClass = '',
        $childrenWrapClass = '',
        $limit = 0
    ) {
        $node = $this->nodeFactory->create(
            [
                'data' => [
            'name' => __('ABOUT US'),
            'id' => 'aboutus',
            'url' => 'http://www.example.com/',
            'has_active' => true,
            'is_active' => true // (expression to determine if menu item is selected or not)
        ],
                'idField' => 'id',
                'tree' => $subject->getMenu()->getTree()
            ]
        );
        $subject->getMenu()->addChild($node);
        $node = $this->nodeFactory->create(
            [
                'data' => [
            'name' => __('CONTACT US'),
            'id' => 'contactus',
            'url' => 'http://www.example.com/',
            'has_active' => true,
            'is_active' => true // (expression to determine if menu item is selected or not)
        ],
                'idField' => 'id',
                'tree' => $subject->getMenu()->getTree()
            ]
        );
        $subject->getMenu()->addChild($node);
        $node = $this->nodeFactory->create(
            [
                'data' => [
            'name' => __('CATALOG DOWNLOAD'),
            'id' => 'catalogdownload',
            'url' => 'http://www.example.com/',
            'has_active' => true,
            'is_active' => true // (expression to determine if menu item is selected or not)
        ],
                'idField' => 'id',
                'tree' => $subject->getMenu()->getTree()
            ]
        );
        $subject->getMenu()->addChild($node);
    }

}


texts: getSelectionTitlePrice() only show special price for bundle product

texts:
I have a bundle product, and the function to show the price for product options is : $this->getSelectionTitlePrice(), which only show me the special price.

What I need to do if I also what to display the original price?


texts: Combo Errors MySQL gone away & Product Price :Cannot initialize the indexer process

texts:
Indexing Stuck at Processing while Reindexing

And The exception.log shows Error as

  General error: 2006 MySQL server has gone away

The Full Exception.log Contents are as follows :

2014-06-17T11:55:38+00:00 DEBUG (7): Exception message: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Trace: #0 /home/sabkafgs/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/sabkafgs/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/sabkafgs/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/sabkafgs/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `index_p...', Array)
#4 /home/sabkafgs/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `index_p...', Array)
#5 /home/sabkafgs/public_html/lib/Zend/Db/Adapter/Abstract.php(632): Varien_Db_Adapter_Pdo_Mysql->query('UPDATE `index_p...', Array)
#6 /home/sabkafgs/public_html/app/code/core/Mage/Index/Model/Resource/Process.php(137): Zend_Db_Adapter_Abstract->update('index_process', Array, Array)
#7 /home/sabkafgs/public_html/app/code/core/Mage/Index/Model/Resource/Process.php(109): Mage_Index_Model_Resource_Process->_updateProcessData('2', Array)
#8 /home/sabkafgs/public_html/app/code/core/Mage/Index/Model/Process.php(222): Mage_Index_Model_Resource_Process->failProcess(Object(Mage_Index_Model_Process))
#9 /home/sabkafgs/public_html/app/code/core/Mage/Index/Model/Process.php(258): Mage_Index_Model_Process->reindexAll()
#10 /home/sabkafgs/public_html/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(182): Mage_Index_Model_Process->reindexEverything()
#11 /home/sabkafgs/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Index_Adminhtml_ProcessController->massReindexAction()
#12 /home/sabkafgs/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('massReindex')
#13 /home/sabkafgs/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 /home/sabkafgs/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#15 /home/sabkafgs/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#16 /home/sabkafgs/public_html/index.php(87): Mage::run('', 'store')
#17 {main}

Any Solutions ??


texts: Change Add to Cart button in Luma 2 child theme on Magento 2

texts:
I have Magento 2.4.1 installed with a custom theme. I have a _theme.less file (themeDir\web\css\source_theme.less), where I changed the button color to:
@button-primary__active__background: @color-black;

But the button color is still the default blue Luma color.


texts:
I'm going to upload one image. I need to put below validations on Client side & Server Side

Allowed file formats: jpeg, jpg, png
Max. File Size is 5MB.
Image size should be 100 Width x 100 height

lib\web\mage\validation.js

From above file, not able to achieve this.

app\code\Custom\Module\Block\MyPost\Edit.php

<input type="file" name="image" id="image" value=""  data-validate="{required:true}" />


texts: Magento 2: file_get_contents and curl not working on server

texts:
file_get_contents and curl not working on server but working well in local.
And also allow_url_fopen = On.
$b1 = "https://www.demo.com/";

$response = file_get_contents($b1);
print_r(json_decode($response,true));

How to fix to it?
Thanks!


texts: Estimated shipping not showing in Magento 2

texts:
I am trying to show the Estimated Shipping and Tax block on Magento 2 but it's not showing up. I found multiple ways to remove it but I can't figure out how to show one. Previous developer left the project hanging and I am trying to get this fixed. Upon inspecting the page, I found that it has the following elements

And shipping.phtml has the following

If I remove "display: none" using Chrome developer tools, I am able to see the block but I can't figure out how to make this change permanent. Any help will be appreciated.


texts: The path Problem in menu product at checkout/cart page

texts:
I have created a mega menu via one module in which i am facing a weird problem of url change. When i am on the homepage, category page or on product page the menu product URLs are working fine but on the cart page the menu product URLs are being changed to http://www.mysite.com/checkout/cart/product.html rather than http://www.mysite.com/product.html.

This issue get corrected when I flush the cache.


texts: PayPal Express FIRSTNAME and LASTNAME instead of SHIPTONAME

texts:
In Magento 1.9 PayPal is transferring a SHIPTONAME which is used for the shipping address. Instead of populating firstname and lastname with the correct variables, only firstname is populated with SHIPTONAME which includes both first- and lastname and the field for lastname remains empty.
I need to change this so SHIPTONAME isn't being used and instead each field is populated with the correct variable.

This function

protected function _exportAddressses($data)
{
    $address = new Varien_Object();
    Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap);
    $address->setExportedKeys(array_values($this->_billingAddressMap));
    $this->_applyStreetAndRegionWorkarounds($address);
    $this->setExportedBillingAddress($address);
    // assume there is shipping address if there is at least one field specific to shipping
    if (isset($data['SHIPTONAME'])) {
        $shippingAddress = clone $address;
        Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap);
        $this->_applyStreetAndRegionWorkarounds($shippingAddress);
        // PayPal doesn't provide detailed shipping name fields, so the name will be overwritten
        $shippingAddress->addData(array(
            'firstname'  => $data['SHIPTONAME'],
        ));
        $this->setExportedShippingAddress($shippingAddress);
    }
}

assigns SHIPTONAME to the firstname field, but simply adding a second declaration like 'lastname'  => $data['LASTNAME'], has no effect, as apparently only the firstname field is being used for the shipping address for PayPal Express orders.


texts:
Payments method are visible in backend-printed invoices, but on custom front-end function field payment is blank, any suggestions?

No templete files were edited.

Controller responsible of printing invoices:

public function downloadPdfAction()
{
    $invoiceId = (int) $this->getRequest()->getParam('invoice_id');
    if ($invoiceId) {
        $invoice = Mage::getModel('sales/order_invoice')->load($invoiceId);
        $order = $invoice->getOrder();
    } else {
        $orderId = (int) $this->getRequest()->getParam('order_id');
        $order = Mage::getModel('sales/order')->load($orderId);
    }

    if ($this->_canViewOrder($order)) {

        Mage::register('current_order', $order);
        if (isset($invoice)) {
            Mage::register('current_invoice', $invoice);
            $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($invoice));
        } else {
            $invoices = $order->getInvoiceCollection();
            $invoicesSet = array();
            foreach ($invoices as $_invoice) {
                array_push($invoicesSet, $_invoice);
            }

            $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoicesSet);
        }

        $this->_prepareDownloadResponse('invoice'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').
            '.pdf', $pdf->render(), 'application/pdf');
    } else {
        if (Mage::getSingleton('customer/session')->isLoggedIn()) {
            $this->_redirect('*/*/history');
        } else {
            $this->_redirect('sales/guest/form');
        }
    }
}

Thanks for help.


texts: Magento 2 showing different customers name in header

texts:
I have shown customer name in header programmatically.But when you login with customer it show other customer name which was logged in past on same web browser on some pages.instead of current customer name in dropdown.
app/code/[VendorName]/Customer/view/frontend/layout/default.xml
<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

        <referenceBlock name="customer">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">[VendorName]_Customer::account/customer.phtml
                </argument>
            </action>
            <arguments>
                <argument name="view_model" xsi:type="object">[VendorName]\Customer\ViewModel\Account\Customer
                </argument>
            </arguments>
        </referenceBlock>
        <referenceBlock name="invitation_link_top" remove="true"/>

</page>

app/code/[VendorName]/[ModuleName]/view/frontend/templates/account/customer.phtml
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

?>
<?php if ($block->customerLoggedIn()) : ?>
    <?php $viewModel = $block->getViewModel(); ?>

            <button type="button"
                    class="action switch"
                    tabindex="-1"
                    data-action="customer-menu-toggle">
                <?= $viewModel->getCustomerName() ?>
            </button>

        <?php if ($block->getChildHtml()) :?>

                <?= $block->getChildHtml() ?>

        <?php endif; ?>

<?php endif; ?>

app/code/[VendorName]/[ModuleName]/ViewModel/Account/Customer.php
<?php
namespace [VendorName]\Customer\ViewModel\Account;

class Customer implements \Magento\Framework\View\Element\Block\ArgumentInterface
{
    /**
     * @var \Magento\Customer\Model\SessionFactory
     */
    protected $_customerSession;

    /**
     * @param \Magento\Customer\Model\SessionFactory $customerSession
     */
    public function __construct(
        \Magento\Customer\Model\SessionFactory $customerSession
    ) {
        $this->_customerSession = $customerSession;
    }

    /**
     * Get customer name
     *
     * @return string
     */
    public function getCustomerName()
    {
        $customerSession = $this->_customerSession->create();
        if ($customerSession->isLoggedIn()) {
            return $customerSession->getCustomer()->getFirstname();
        }
        return 'Change';
    }
}


texts: bin/magento cron:install not writing to crontab

texts:
I have ran bin/magento cron:install and then show

  Crontab has been generated and saved

but I run crontab -l, nothing was written into cron, any ideas?


texts: How to check the value of customers's custom attribute in layout xml

texts:
I had added is_seller custom attribute to the Customer entity to mark the customer as seller. And now I want to add links to customer account left column only for the sellers. Now the problem is that how can I check the logged in customer is seller or a regular customer?

I want to check the condition in layout file


texts: How to apply a non default H1 only for a specific category?

texts:
I need to change the H1 only for one specific category.
The default in Magento 2 is that it will be the category name and I need it to be different in one category.


texts: Return codes from payment-information webservice

texts:
For my custom method, I am calling PlaceOrder javascript function. It finally calls this URL:

/rest/default/V1/carts/mine/payment-information

That calling returns "32". What does it mean?


texts: I'm wondering if anyone knows what I would need to do to adjust the dashboard to show the last day (since midnight) instead of the last 24 hours.


texts: How to set ifconfig for checkout_index_index.xml Magento 2

texts:
I have to set ifconfig configuration for below code:-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
                <arguments>
                    <argument name="jsLayout" xsi:type="array">
                        <item name="components" xsi:type="array">
                            <item name="checkout" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="steps" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <!-- The new step you add -->
                                            <item name="check-login-step" xsi:type="array">
                                                <item name="component" xsi:type="string">AssaAbloy_Pickupstep/js/view/checkout-login-step</item>
                                                    <!--To display step content before shipping step "sortOrder" value should be < 1-->
                                                    <!--To display step content between shipping step and payment step  1 < "sortOrder" < 2 -->
                                                    <!--To display step content after payment step "sortOrder" > 2 -->
                                                <item name="sortOrder" xsi:type="string">3</item>
                                                <item name="children" xsi:type="array">
                                                    <!--add here child component declaration for your step-->
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </argument>
                </arguments>
        </referenceBlock>
    </body>
</page>

Actually, I am using multiple websites and have to remove this step from one of the website.
You can also suggest an alternate option if any.


texts:
Here is my code:

        $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', $oldstatus);

        $now = time(); // or your date as well

        if($orders){
            foreach ($orders as $order) {
                $orderId = $order->getIncrementId();
                $CreatedAt = strtotime($order->getCreatedAt());
                $email = $order->getCustomerEmail();
                $datediff = $now - $CreatedAt;
                $Diff = floor($datediff/(60*60*24));
                $Diff = $Diff - 1;
                if($Diff >= $time){

                   try{
                        $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
                        $state = 'processing';
                        $status = $newstatus;

                        //If you choose to set $isCustomerNotified = true;
                        // then it would make the necessary notification to customer.
                        if($EnableAutomatedStatusEmail==1){
                            $isCustomerNotified = true;
                        } else {
                            $isCustomerNotified = false;
                        }
                        /*
                        $order->setState($state, $status, $comment, $isCustomerNotified);
                        $order->save();

                        //Send email to customer. If not required then comment this line out.
                        if($EnableAutomatedStatusEmail==1){
                          $order->sendOrderUpdateEmail(true, $comment);
                        }
                        */
                    }
                   catch(Exception $e)
                   {
                   Mage::log($e->getMessage());
                   }

                    Mage::log("The order $orderId with status $oldstatus received new status $newstatus for customer with email $email!", null, "AutomatedStatus.log", true);
                }

            }
        }

With this code i am parsing all the orders searching for orders with specific order status. Then if a certain time passed from the creation of the order and the order is still in the specific order status the script is changing the order status.

Everything works fine.

The only problem is that i do not need to get the order created date getCreatedAt() but i need to get the date of when the order received a specific order status. For instance i need to know when the order received order status processing not when the order was created. Also i need to get this date in the same format i am receiving it from getCreatedAt().

Is it possible ?

I hope i have explained everything well, please if you have any questions do not hesitate to ask me in the comments.


texts: Add custom product attribute to mini-cart

texts:
I have to use a custom product attribute in the mini cart and the full cart view.
After creating the file /etc/catalog_attributes.xml in my module folder i could read my custom attribute in the full cart view at base.url/checkout/cart.

/etc/catalog_attributes.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd">
    <group name="quote_item">
        <attribute name="custom_attribute"/>
    </group>
</config>

I now can access the custom_attribute via $product->getData("custom_attribute").
But this doesn't work for the minicart.

Is there any way to add the attribute to the minicart view?


texts:
I have set up a Magento web server as per below
varnish (127.0.0.1:6081) -> magento 2.3 (192.168.1.250:8080)
The varnish is installed in the separate host and Magento is installed in another host.
I'm using the sample data. When I select other links on the home page, the URL is changed from 192.168.1.251:6081 to 192.168.1.250:8080/women.html.
I'm able to access the 192.168.1.251:6081/women.html but if I navigate once again to other sections like men the URL is changed to 192.168.1.250:8080/men.html
I'm using Magento's default varnish config. Need help to overcome this problem.I will provide the required logs.


texts: How to display "HelloWorld" using *.phtml file but helloworld must not direct written in .phtml file

texts:
I want to display "Hello world" in category page through .phtml file but condition is that hello world must not directly written on .phtml file. We can write any code in .phtml file and call that phtml file and it will display hello world.

So, how it is possible?

I guess that if I make .php file and make one function, and that function I call in .phtml file , is it possible? and then .phtml call in .xml .

Thanks.


texts:
Is there a simple way as in magento1 :

 $crumbs = Mage::app()->getLayout->getBlock('breadcrumbs');


texts: Dont remove pub/static content in setup:upgrade command

texts:
It is possible to keep pub/static folder as it is after run setup:upgrade command.

Becuase I have multilanguage site and every time when we add new module I run upgrade command and run content deploy for every language.

So it is possible to keep pub/static content during setup:upgrade command?


texts:
So i have a controller to access form with structure like this:

  Controller>Adminhtml>Preferences>NewAction.php

but when i try to acces /preferences/new, it gives me an error like this:

  Fatal error: Uncaught TypeError: Argument 1 passed to
  Lime\Courier\Controller\Adminhtml\Preferences\NewAction::__construct()
  must be an instance of Magento\Backend\App\Action\Context, instance of
  Magento\Framework\ObjectManager\ObjectManager given, called in
  C:\xampp7\htdocs\magento2\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php
  on line 93 and defined in
  C:\xampp7\htdocs\magento2\app\code\Lime\Courier\Controller\Adminhtml\Preferences\NewAction.php:16
  Stack trace: #0

here's my controller NewAction.php:

namespace Lime\Courier\Controller\Adminhtml\Preferences;

class NewAction extends \Lime\Courier\Controller\Adminhtml\Preferences
{

    protected $resultForwardFactory;

    /**
     * @param \Magento\Backend\App\Action\Context $context
     * @param \Magento\Framework\Registry $coreRegistry
     * @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\Registry $coreRegistry,
        \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
    ) {
        $this->resultForwardFactory = $resultForwardFactory;
        parent::__construct($context, $coreRegistry);
    }

    /**
     * New action
     *
     * @return \Magento\Framework\Controller\ResultInterface
     */
    public function execute()
    {
        /** @var \Magento\Framework\Controller\Result\Forward $resultForward */
        $resultForward = $this->resultForwardFactory->create();
        return $resultForward->forward('edit');
    }
}


texts: Magento 1.9 adding custom option programmatically

texts:
I am trying to add a custom option programmatically.
Below is piece of code I tried to attempt.

Problem is for my first product get updated with one custom option where as my second product gets updated with two custom options.

product 1 with one custom option.

product 2 with two custom options.

I dont know what is going wrong.
Please advice how to address this issues. I am using magento 1.9.x version.

        <?php
        require_once 'app/Mage.php';
        require_once 'Zend/Crypt/Hmac.php';

        umask(0);
        Mage::app('default');
        Mage::getSingleton('core/session', array('name' => 'frontend'));

        function getOptions(){
           return array(
           array(
            'title' => 'Option Value 1',
            'price' =>100,
            'price_type' => 'fixed',
            'sort_order' => '1'
            ),
          array(
            'title' => 'Option Value 2',
            'price' =>100,
            'price_type' => 'fixed',
            'sort_order' => '1'
            ),
          array(
            'title' => 'Option Value 3',
            'price' =>100,
            'price_type' => 'fixed',
            'sort_order' => '1'
            )
         );
        }

        $option = array(
            'title' => 'custom option title',
            'type' => 'radio', // could be drop_down ,checkbox , multiple
            'is_require' => 1,
            'sort_order' => 0,
            'values' => getOptions()
            );

        $obj = Mage::getModel('catalog/product');

        $product_id = $obj->getIdBySku('skuid1');
        $product = $obj->load($product_id);
        $product->setProductOptions(array($option));
        $product->setCanSaveCustomOptions(true);
        $product->save();
        unset($product);
        echo "Done";

        $product_id = $obj->getIdBySku('skuid2');
        $product = $obj->load($product_id);
        $product->setProductOptions(array($option));
        $product->setCanSaveCustomOptions(true);
        $product->save();
        unset($product);
        echo "Done";

        ?>


texts: Magento2 | Can't connect to Market place --> Encountered end of file

texts: some how I am unable to connect to marketplace, does anyone know how to fix this?


texts:
On Magento 2.3.2 I switched from php 7.1 to php 7.2. When I did I started getting this error-
Exception #0 (Exception): Warning: count(): Parameter must be an array or an object that implements Countable in /chroot/home/html/app/code/WeltPixel/GoogleTagManager/view/frontend/templates/cart.phtml on line 10

Here is the code-

<?php
// @codingStandardsIgnoreFile
?>
<?php if($this->isEnabled()) : ?>
<?php $helper = $this->helper('WeltPixel\GoogleTagManager\Helper\Data'); ?>
    <?php
    $crosselProductsCollection = $this->getCrosselProductCollection();
    $productImpressions = [];

    if (count($crosselProductsCollection)) :
        $i = 1;
        foreach($crosselProductsCollection as $_product) :
            $crosselProduct = array();
            $crosselProduct['name'] = html_entity_decode($_product->getName());
            $crosselProduct['id'] = $helper->getGtmProductId($_product);
            $crosselProduct['price'] = number_format($_product->getPriceInfo()->getPrice('final_price')->getValue(), 2, '.', '');
            if ($helper->isBrandEnabled()) :
                $crosselProduct['brand'] = $helper->getGtmBrand($_product);
            endif;
            $crosselProduct['category'] = $helper->getGtmCategoryFromCategoryIds($_product->getCategoryIds());
            $crosselProduct['list'] = __('Crossel Products');
            $crosselProduct['position'] = $i;
            $productImpressions[] = $crosselProduct;
            $i++ ;
        endforeach;
    endif;

    if (count($productImpressions)) :
        $this->setEcommerceData('currencyCode', $this->getCurrencyCode());
        $this->setEcommerceData('impressions', $productImpressions);
        $this->setDataLayerOption('event', 'impression');
        $this->setDataLayerOption('eventCategory', 'Ecommerce');
        $this->setDataLayerOption('eventAction', 'Impression');
        $this->setDataLayerOption('eventLabel',  \WeltPixel\GoogleTagManager\Model\Api\Remarketing::ECOMM_PAGETYPE_CART);
    endif;

    if ($helper->isAdWordsRemarketingEnabled()):
        $remarketingData = [];
        $remarketingData['ecomm_pagetype'] = \WeltPixel\GoogleTagManager\Model\Api\Remarketing::ECOMM_PAGETYPE_CART;
        $remarketingData['ecomm_prodid'] = $this->getProductIds();
        $remarketingData['ecomm_totalvalue'] = number_format($this->getCartTotal(), 2, '.', '');
        $this->setDataLayerOption('google_tag_params', $remarketingData);
    endif;

    ?>

How can I clear that error?


texts: No such entity with orderId error while submitting place order in magento 2

texts:
I am having Cash on delivery and Credit card payment methods at checkout.
While clicking the place order button throws the following errors
"No such entity with orderId="

And also sends 400 bad requests for payment
/rest/default/V1/carts/mine/payment-information


texts: Cannot move the search bar after the logo

texts:
I want to move the search bar right after the logo and sign-in, and sign-up link next to search bar. I have used the below instruction in my theme xml file but its not working.
<move element="top.search" destination="header-wrapper" after="logo" />

Code in default.xml
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="3columns" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <update handle="default_head_blocks" />
   <body>
      <move element="top.search" destination="header-wrapper" after="logo" />
      <move element="authorization-link-login" destination="header-wrapper" after="top.search" />
   </body>
</page>

I'm getting as below but I want to show as search bar after the logo and signin and signup next to search bar:

Please help.


texts: Fatal Error (time-out) when trying to Export Customers from Magento 1.3.1

texts:
I recently setup a brand new fresh install of Magento 1.9.1. I have an old Magento store 1.3.1. After I've put in all the products by hand, I realized that my customers are missing their login accounts! The thing is - there are 2100 registered customers! When I try to EXPORT CUSTOMERS - I get the following Errors:

Starting profile execution, please wait...
Warning: Please don't close window during importing/exporting data

Fatal error: Maximum execution time of 30 seconds exceeded in /home/MYstore/public_html/lib/Zend/Db/Adapter/Abstract.php on line 406

Starting profile execution, please wait...
Warning: Please don't close window during importing/exporting data

Fatal error: Maximum execution time of 30 seconds exceeded in /home/MYstore/public_html/app/code/core/Mage/Dataflow/Model/Batch.php on line 98

Thanks for any ideas! ;-)


texts: Magento 2 undefind function Magento\Framework\Stdlib\iconv_strlen() in vendor/magento/framework/Stdlib/StringUtils.php?

texts:
I am getting the below error when I upload my project to live server.Everything is working perfect in my local system.But The below error only getting on server

Fatal error:  Call to undefined function Magento\Framework\Stdlib\iconv_strlen() in /home/mydomain/public_html/vendor/magento/framework/Stdlib/StringUtils.php on line 151

Can you help me on this.What to do.


texts: Create dynamic form in checkout step magento2

texts:
Hi i have crated a custom checkout step in magento 2 , now I need to create dynamic from which will analyse cart items and output some form elements to my form. How can I implement that ?

view/fronted/layout/checkout_index_index.xml

<item name="steps" xsi:type="array">
    <item name="children" xsi:type="array">
        <item name="my-new-step" xsi:type="array">
            <item name="component" xsi:type="string">Amsi_UserManagement/js/view/select-student</item>
            <item name="sortOrder" xsi:type="string">2</item>
            <item name="children" xsi:type="array">
            </item>
        </item>
    </item>
</item>

view/frontend/web/js/view/select-student.js

define(
    [
        'ko',
        'uiComponent',
        'underscore',
        'Magento_Checkout/js/model/step-navigator',
        'Magento_Checkout/js/model/quote',
        'jquery'
    ],
    function (
        ko,
        Component,
        _,
        stepNavigator,
        quote,
        $
    ) {
        'use strict';

        function checkVisible() {
            if(quote.isVirtual() && !stepNavigator.stepCodes.length)
                return ko.observable(true);
            else
                return ko.observable(false);
        }

        return Component.extend({
            defaults: {
                template: 'Amsi_UserManagement/checkout/select-student'
            },

            isVisible: checkVisible(),

            initialize: function () {
                this._super();
                stepNavigator.registerStep(
                    'select_student',
                    'select_student',
                    'Select Student',
                    this.isVisible,

                    _.bind(this.navigate, this),
                    15
                );

                return this;
            },

            navigate: function () {
            },
            navigateToNextStep: function (form) {
                stepNavigator.next();
            }
        });
    }
);

My current template is static I need to make it dynamic and also need to validate the fields by clicking the next button in my template

view/frontend/web/template/checkout/select-student.html

        <form data-bind="submit: navigateToNextStep" novalidate="novalidate">

                        <input type="email"
                               class="input-text"
                               id="save-email"
                               name="email"
                               data-validate="{required:true}" />

                    <button data-role="opc-continue" type="submit" class="button action continue primary">

                    </button>

        </form>

I have researched about it and I got an idea to use layout processor, how can i implement that, any idea ?


texts: Magento 2: What Causes the "Failed to enable crypto" Error?

texts:
I'm trying to install Magento 2.1 via the composer meta-package with the following command

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition

However, composer fails to update the packages.json from repo.magento.com, and reports

  The "https://repo.magento.com/packages.json" file could not be downloaded: Failed to enable crypto

Does anyone know what triggers this "Failed to enable crypto" error is and how someone could fix it?


texts: xsi:type="foreign" not working in db_schema.xml in magento 2

texts:
This is my db_schema.xml file

    <column name="entity_id"       xsi:type="int" identity="true" padding="10" unsigned="true" nullable="false" comment="Entity Id" />
    <column name="item_id"         xsi:type="int" padding="10" unsigned="true" comment="Item Id" />
    <column name="variation_id"    xsi:type="int" padding="10" unsigned="true" comment="Variation Id" />
    <constraint xsi:type="primary" referenceId="PRIMARY" >
        <column name="entity_id"/>
    </constraint>

    <column name="entity_id"           xsi:type="int" padding="10" unsigned="true" nullable="false" identity="true" comment="Entity Id" />
    <column name="variation_bundle_id" xsi:type="int" padding="10" unsigned="true" nullable="true" comment="Variation Bundle Id" />
    <column name="item_id"             xsi:type="int" padding="10" unsigned="true" comment="Item Id" />
    <constraint xsi:type="primary" referenceId="PRIMARY" >
        <column name="entity_id"/>
    </constraint>
    <constraint xsi:type="foreign" referenceId="PLE_IMP_BUN_ITM_PLE_IMP_ITM"
                table="plenty_item_Import_item_bundle" column="item_id"
        referenceTable="plenty_item_Import_item" referenceColumn="item_id" onDelete="CASCADE"/>

In second table I am trying to add a foreign key, in this line

<constraint xsi:type="foreign" referenceId="PLE_IMP_BUN_ITM_PLE_IMP_ITM"
            table="plenty_item_Import_item_bundle" column="item_id"
    referenceTable="plenty_item_Import_item" referenceColumn="item_id" onDelete="CASCADE"/>

Now when I run the command

php bin/magento setup:db-declaration:generate-whitelist --module-name=Plenty_Item

to generate db_schema_whitelist.json file, then it was not generating. I checked online for this and I found if there is an issue in db_schema.xml file then json will not generate and I can also debug db_schema.xml file for errors.
I got the answer from this link
Magento 2 is not generating the db_schema_whitelist.json file via CLI

Now when I checked the errors then it was showing

2019-09-18T15:02:57+00:00 INFO (6): Notice: Undefined index: plenty_item_Import_item in D:\xampp\htdocs\magento-2.2\vendor\magento\framework\Setup\Declaration\Schema\Declaration\SchemaBuilder.php on line 352

It is showing undefined index for plenty_item_Import_item. Now when I remove the line to add the foreign key then it works perfectly.
Now my question is How and why it is showing undefined index for plenty_item_Import_item as this table is added at top.
I also checked db_scema.xml for catalog module that is present by default and found they have also added a foreign key by same method.
Code from db_schema.xml present in module-catalog

<constraint xsi:type="foreign" referenceId="CAT_PRD_ENTT_DTIME_ENTT_ID_CAT_PRD_ENTT_ENTT_ID"
                table="catalog_product_entity_datetime" column="entity_id" referenceTable="catalog_product_entity"
                referenceColumn="entity_id" onDelete="CASCADE"/>


texts:
I want to install magento 2 on Ubuntu. I upgrade my PHP version to 7.1.3 and when I execute command to check php version I am getting below output:

  PHP 7.1.3-3+deb.sury.org~trusty+1 (cli) (built: Mar 25 2017 14:24:10) ( NTS )
  Copyright (c) 1997-2017 The PHP Group
  Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
      with Zend OPcache v7.1.3-3+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies

When I am trying to install Magento 2.1.x, I am gettig php version 5.5.9-1ubuntu4.21.

Please check below screenshots for referance.

and because of this i am unable to proceed.


texts:
Cancellation of individual product from the order, when a customer orders multiple products, not the complete order.
Magento has such functionality to implement this or using any third party extension help.


texts: Magento sales_order_create page don't add product in ordered list

texts:
When inside the sidebar in any product select and click on add to order button. The product don't add in ordered list.
What can i do?
Please see this image.


texts: Update BillingAddress detail in observer checkout_submit_before

texts:
I would like to update the billingAddress from the parameter/observer->quote before proceeding to saving and place order. Below is the code
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_submit_before">
        <observer name="validate_max_length" instance="Vendor\Module\Observer\Order\ValidateMaxLength"/>
    </event>
</config>

This is the observer value
class ValidateMaxLength implements ObserverInterface
{
    protected $data;
    protected $logger;
    protected $request;

    public function __construct(
        \Psr\Log\LoggerInterface $logger,
        CheckoutSession $checkoutSession,
        ProductFactory $productLoader,
        RequestInterface $request,
        ProductRepository $productRepository,
        cart $cart,
        ManagerInterface $messageManager
    ){
        $this->logger = $logger;
        $this->checkoutSession = $checkoutSession;
        $this->_productloader = $productLoader;
        $this->_request = $request;
        $this->_productRepository = $productRepository;
        $this->_cart = $cart;
        $this->_messageManager = $messageManager;
    }

    public function execute(Observer $observer)
    {
        $quote = $this->checkoutSession->getQuote();
        $billingAddress = $quote->getBillingAddress();
        if ($billingAddress) {
            $this->logger->error("------------- Personal message content", [$quote]);
                $personalMessage = "Testing message";
                $billingAddress->setPersonalMessage($personalMessage);
                $observer->getEvent()->getQuote()->setBillingAddress($billingAddress);
                $this->_cart->saveQuote();
                $this->_cart->save();

               // I want the quote and billing address to be saved
        }
    }
}

As you can see I modified one Property under the billingAddress. I want the new params I set to be saved instead of what was submitted.


texts: Magento2 : REST API call always return unauthorized

texts:
I use Magento 2.4.0 community edition.
I try to call diffrent type of REST API like
https://www.domain.com/rest/default/V1/modules
https://www.domain.com/rest/V1/orders/1850
https://www.domain.com/rest/all/V1/guest-carts/11/items

But always it return this error :
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "Magento_Backend::admin"
    }
}

I already verify the ROLE, USER PERMISSION,
Allow Anonymous Guest Access = YES

Can anyone help me about this one?


texts: Magento2-Send email notification to main admin when price changed by admin

texts:
I want to send eamil notification to main admin, for modification avail in price by any admin.

Please help,

Thank You in advance.


texts: Getting attribute from simple products of configurable products

texts:
After having to work on someone else's Magento webshop, I found a huge performance issue. The shop consists of configurable products. In the overview, an attribute from the simple products is shown. However, the person who made this before me, used getUsedProducts which caused enormous load times. I've been trying to optimise the script, but am still not satisfied.

The current code is the following:

            <?php
            // First check if the product is configurable
            if($_product->isConfigurable()) {
                // get the necessary model
                $_helper2 = Mage::getModel('catalog/product_type_configurable')
                            ->setProduct($_product);
                $_subproducts = $_helper2
                                ->getUsedProductCollection()
                                ->addAttributeToSelect('color')
                                ->addFilterByRequiredOptions(); // the biggest speedbump

                // initialise our colours array
                $_colors = array();
                $_color_id = array();

                // look for attribute value of color in each associated product and assign to $_colours array
                foreach ($_subproducts as $_subproduct) {
                  // look for attribute value of color in each associated product and assign to $_colours array

                  $label = $_subproduct->getAttributeText('color');
                  $_colors[] = $label;

                  if (!isset($_color_id[$label])) {
                    $_color_id[$label] = $_subproduct->getData('color');
                  }
                }

                // remove dup's
                $_color_swatch = array_unique($_colors);

                echo '
';

                foreach($_color_swatch as $_inner_option_id){
                    echo '

' . $_inner_option_id . '

';
                }

                echo '
';
            }

            ?>

It get's the color attribute from each simple product, removes duplicates, and places one color swatch for each color. However, this still get's quite a big loading time, because it still loads too much information I think.

Could somebody point me in the right direction to create a better way of loading the attributes of the simple products?

Edit: IS there a better way of loading the attributes?


texts:
I moved to new server and ready to install Magento but I getting this error
please help!

  Fatal error: Uncaught Magento\Framework\Exception\FileSystemException:
  The file
  "/home/xxxx/public_html/generated/code/Symfony/Component/Console/Question/QuestionFactory.php"
  cannot be deleted
  Warning!unlink(/home/xxxx/public_html/generated/code/Symfony/Component/Console/Question/QuestionFactory.php):
  Permission denied in
  /home/xxxx/public_html/vendor/magento/framework/Filesystem/Driver/File.php:382
  Stack trace: #0
  /home/xxxx/public_html/vendor/magento/framework/Filesystem/Driver/File.php(405):
  Magento\Framework\Filesystem\Driver\File->deleteFile('/home/xxxx/...')
   #1 /home/xxxx/public_html/vendor/magento/framework/Filesystem/Driver/File.php(403):
  Magento\Framework\Filesystem\Driver\File->deleteDirectory('/home/xxxx/...')
   #2 /home/xxxx/public_html/vendor/magento/framework/Filesystem/Driver/File.php(403):
  Magento\Framework\Filesystem\Driver\File->deleteDirectory('/home/xxxx/...')
   #3 /home/xxxx/public_html/vendor/magento/framework/Filesystem/Driver/File.php(403):
  Magento\Framework\File in
  /home/xxxx/public_html/vendor/magento/framework/Filesystem/Driver/File.php
  on line 382

new

Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/home/xxxx/public_html/var/page_cache" is not writable in /home/xxxx/public_html/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 /home/xxxx/public_html/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/hom...') #1 /home/xxxx/public_html/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/home/xxxx/...') #2 /home/xxxx/public_html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /home/xxxx/public_html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /home/xxxx/public_html/vendor/magento/framework/App/Cache/Frontend/Factory.php(158): Zend_Cache::factory('Magento\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /home/xxxx/public_html/vendor/magento/framewor in /home/xxxx/public_html/vendor/magento/zendframework1/library/Zend/Cache.php on line 209


texts:
I'm using Magestore's mega menu extension and using a plain content for rendering menu dropdowns. There, I want to use dynamic block's. I tried adding my dynamic block in xml layout file and its working fine there. The code is as below:

<block class="Sebwite\Sidebar\Block\Categorymenutree" name="category-menu-tree" as="catmenutree" before="-" template="Sebwite_Sidebar::categorymenutree.phtml" >
                <arguments>
                    <argument name="menu_id" xsi:type="number">239</argument>
                </arguments>
            </block>

So my question is how can I add this block from backend with arguments?

Thanks in advance.


texts: best practice for placing descriptions and landing pages

texts:
this is probably a question for the magento forums directly, but as they are such a spam-fest.. I'll try here :)

I want to put at the top of each product category a large splash image and description etc (which I've done) and it all looks and works fine.

However, the ultimo theme which I'm using looks to encourage the use of blocks for content > and enabling those as needed in each category.

Personally, its much quicker and easier for me to just edit the categories as I go. My question is though.. which is really the best practice, and why? The one thing that comes to mind is, if I kill a category by mistake - the landing page would still exist in a block > so maybe safer? Any other reasons?