texts:
I'm creating an ajax add-to-cart module. It's working fine (adding product, respecting quantity, etc) BUT the response is always the full HTML page, instead of a JSON object. In particular, the responseJSON object is always NULL.

I'm overriding the core controller with my own:

File: app/code/local/My/Module/controllers/CartController.php

class My_Module_CartController extends Mage_Checkout_CartController
{
    public function addAction() {
        $params = $this->getRequest()->getParams();

        if ( !isset($params['my_module'] ) {
            return parent::addAction();
            exit();
        }

        try {
            ...
                // controller logic
            ...
        } catch (Exception $e) {
            ...
        }

        $jsonResponse = Mage::helper('core')
            ->jsonEncode(
                array(
                    'success' => $success,
                    'message' => $responseMsg
                )
            );

        $this->getResponse()->setHeader('Content-type', 'application/json');
        $this->getResponse()->setBody($jsonResponse);
    }
}

I'm then receiving this with my prototype (barf) function.

File: app/design/frontend/default/default/template/my_module/add-to-cart.phtml

<script type="text/javascript">
    //<![CDATA[
        productAddToCartForm.submit = function(button) {
            if (this.validator.validate()) {
                var form = this.form;
                try {
                    form.request({
                        parameters: { my_module: 'true', isAjax: '1' },
                        onSuccess: function(transport) {
                            console.log(transport); // <-- responseJSON is always NULL inside this object
                            ...
                        },
                        onFailure: function(transport) {
                            ...
                        }
                    });
                } catch (e) {}

                if (e) {
                    throw e;
                }
            }
        }.bind(productAddToCartForm);
    //]]>
</script>

I'm logging the full response from the server. The responseText object contains the entire HTML page, as it would render in a browser, while the responseJSON object is NULL.

So, my question is: how can I get a JSON response from the cart controller's addAction method? Thanks.

~ edit ~

FYI: There are no errors in the logs, either for Mage or the server.


texts: I am having trouble With Magento Tooltip Multiple Image Labels For Grouped Products, is there any way to fix this?

texts:
I am having trouble with multiple image labels for grouped products on Magento 1.9, is there any way to fix this? I will explain in detail about my issue using screenshots.

For example:

When I hover over here to the correct picture and correct tooltip label, it says: "Apple Crumble"

However, when I clicked to the next picture, and hover over with my mouse, the tooltip label still says "Apple Crumble" which is incorrect. The tooltip label should say "Warm Berry Crumble" from the already typed label in the product > images section on the admin backend for example, but the image label feature does not cover that unfortunately.

Unfortunately, the label feature in the images section of Magento products on the admin backend only covers the small multiple images thumbnails at the bottom of the preview image, not the hover over picture on the next one on top that is clicked on by the user. Is there anyway to fix this problem by editing a file code that I found in file manager from our Magento installation?

I did find two files in file manager that may need editing from this though:

app/design/frontend/default/theme201k/template/ecommerceteam/cloud-zoom/catalog/product/view/media.phtml
skin/frontend/default/theme201k/css/styles.css

Any help would be appreciated, thank you.


texts: How to assign ACL to UI component Form in magento 2?

texts: I need to assign acl to Ui Component Form? Anyone know about it?


texts:
I'm trying run two step below
step1:
rm -rf pub/static/* ./var/view_preprocessed/* ./var/page_cache/* ./var/cache/* ./var/generation/*

step2:
php bin/magento setup:static-content:deploy -f --theme Nature/CustomTheme
But in real process another theme like: Magento/Luma and Magento/Blank still run deploy.
What should we do to deploy specific theme ?


texts: Customer join query result getSize() issue

texts:
join query with customer table getSize() count mismatch with the mysql db result.

Query
-----
$collection = Mage::getModel('customer/customer')->getCollection();
$collection->getSelect()->join(array('endorsement'=>'flendorsement'),'e.entity_id = endorsement.to_user_id',array('total_endorsement'=>'COUNT(endorsement.endorsement_id)'));
            $collection->getSelect()->group('endorsement.to_user_id');

When i execute this query in mysql phpmyadmin, there will show the 3rows,
but  getSize() method return "2"

see the screen below:


texts:
Good days everyone,

i am using the default Magento web page template and i have some issues with categories product count.

1) Problem 1

Under the Default Category (Manage Category),

I created a root category named Women and sub category of Women named Dress. I added a product named BlackDress and categorize on Women / Dress.

Under Manage Category section --> Women (0) --> Dress(1), the product count of all items in Women category is shown 0 which is not true. (I have one item on women subdirectory)

2) Problem 2

By default, when i clicked on the Women Menu, there is 1 dropdown menu --> Dress. When i clicked Dress menu --> Its display the item BlackDress but i received the following problem after clicking View All Women menu.

BROWSE BY

CATEGORY
Dress (0)

Can anyone professional advise on this?


texts: Magento API Report place order Error: Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string

texts:
When i tried to place an order there is an api error report error that saying:

Fatal Error: 'Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string, object given in \/var\/www\/M2\/vendor\/magento\/framework\/Stdlib\/DateTime.php:58

vendor/magento/framework/Stdlib/DateTime.php:58

...
} elseif (!is_numeric($date)) {
   $date = (new \DateTime($date))->getTimestamp();
}
...

i tried to var_dump the $date variable, here's the result:

string(37) "Magento\Quote\Model\Quote\Interceptor"

i tried to debug_backtrace , here's the result:

Magento\Framework\Stdlib\DateTime->formatDate
Magento\Framework\DB\Adapter\Pdo\Mysql->formatDate
Magento\Framework\DB\Adapter\Pdo\Mysql->prepareColumnValue
Magento\Framework\Model\ResourceModel\AbstractResource->_prepareDataForTable
Magento\Sales\Model\ResourceModel\EntityAbstract->_prepareDataForSave
Magento\Sales\Model\ResourceModel\EntityAbstract->saveNewObject
Magento\Framework\Model\ResourceModel\Db\AbstractDb->save
Magento\Sales\Model\ResourceModel\Order->save
Magento\Sales\Model\OrderRepository->save
Magento\Sales\Model\OrderRepository\Interceptor->___callParent
Magento\Sales\Model\OrderRepository\Interceptor->Magento\Framework\Interception\{closure}
Magento\Sales\Model\OrderRepository\Interceptor->___callPlugins
Magento\Sales\Model\OrderRepository\Interceptor->save
Magento\Sales\Model\Service\OrderService->place
Magento\Quote\Model\QuoteManagement->submitQuote
Magento\Quote\Model\QuoteManagement->submit
Magento\Quote\Model\QuoteManagement\Interceptor->___callParent
Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}
Magento\Quote\Model\QuoteManagement\Interceptor->___callPlugins
Magento\Quote\Model\QuoteManagement\Interceptor->submit
Magento\Quote\Model\QuoteManagement->placeOrder
Magento\Quote\Model\QuoteManagement\Interceptor->___callParent
Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}
Magento\Braintree\Plugin\OrderCancellation->aroundPlaceOrder
Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}
Magento\Quote\Model\QuoteManagement\Interceptor->___callPlugins
Magento\Quote\Model\QuoteManagement\Interceptor->placeOrder
Magento\Checkout\Model\PaymentInformationManagement->savePaymentInformationAndPlaceOrder
Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callParent
Magento\Checkout\Model\PaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}
Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callPlugins
Magento\Checkout\Model\PaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder
call_user_func_array
Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process
Magento\Webapi\Controller\Rest->dispatch
Magento\Webapi\Controller\Rest\Interceptor->___callParent
Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}
Magento\Webapi\Controller\Rest\Interceptor->___callPlugins
Magento\Webapi\Controller\Rest\Interceptor->dispatch
Magento\Framework\App\Http->launch
Magento\Framework\App\Bootstrap->run


texts: I got the error "There has been an error processing your request" while trying to access the M2 backend. It happened because I set the session timeout beyond "9999." Its just a dev site now so I would like to hold it open while Im working. Where is that info stored in the database so I can change it?


texts:
We tried to change the Add to Cart button from 'out of stock' to '4-5 business days' for out of stock products using translate inline, which was simple enough.  However, although the text was changed, we also deleted the functionality of the button thereby disabling the possibility of back/pre-ordering.

Is it possible to restore the button using translate inline, and, if so, which code should we use?  Our website is www.yellowbrickboardgames.com and we're using Magento 1.9.1.0.

Thank you so much for your help.


texts: magento customer edit not working showing blank page and also customer name not showing

texts:
Its error log error which is showing in my root server error log.

Please help me I have use wholesale customer activation extension and removed all file of wholesale customer activation and removed is site live, customer activation & paymentmode from my sql server.

PHP Notice: Undefined index: SCRIPT_FILENAME in /home/vaishf62/public_html/swarnjewelry.com/cron.php on line 41
[23-Apr-2016 09:26:42 UTC] PHP Fatal error: Call to a member function setRenderer() on a non-object in /home/vaishf62/public_html/swarnjewelry.com/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php on line 77
[23-Apr-2016 09:27:17 UTC] PHP Fatal error: Call to a member function getBackendType() on a non-object in /home/vaishf62/public_html/swarnjewelry.com/app/code/core/Mage/Log/Model/Resource/Visitor/Online/Collection.php on line 73
[23-Apr-2016 09:27:49 UTC] PHP Fatal error: Call to a member function setRenderer() on a non-object in /home/vaishf62/public_html/swarnjewelry.com/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php on line 77

My website Account.php code that showing 77 line error. Please guide me to solve this issue.


texts: strange page displaying after clicking add to cart button

texts:
please visit this link and click on "add to cart" button

http://hotwheelstoys.in/mobileapp3/index.php/petals-paper-quilling-finger-puppets.html

it will give strange page, but the item  is added to cart, if you press back button,

you can see the item is added to cart

please help me to find solution

thanks in advance


texts: Get attribute option value from option_ID

texts:
I'm getting the child products of a configurable product through this code

 $childProducts = Mage::getModel('catalog/product_type_configurable')
                        ->getUsedProducts(null,$_product);

And in a foreach I'm trying to get a specific attribute value to show up (in this case Storage capacity).

It should display a string like this '32 GB' but instead it is displaying a number like '23'.

 foreach($childProducts as $index => $child){
      echo child->getData('storage_capacity'); // Prints 21 or 22 or 23
 }

I don't know enough about the EAV resource structure to get the associated value for this attribute. Can anyone push me in the right direction?


texts: How to reduce first time byte via code optimization?

texts:
I understand, first time byte is a tricky subject since it depends on lot of factors.I am trying to optimize the code as much as I can for this site
This site is on a shared hosting hence, I am not excepting top notch performance, however still I am trying squeeze every single precious ms that I can .

This is my profile output

Could anybody tell me if the execution times on Banner7(Home Page Slider) is good enough? The slider takes some to load. Is the Banner7 is a bottleneck. What could be the other areas of opportunity to optimize?
Here's the result from Webpagetest.org


texts: I want to apply condition only on sub categories of specific Category ID

texts:
I have root category default this has sub category  Shop then shop has further sub category Collection
Now collection has a further sub category list
Tree Structure:
ROOT
|-Shop
|--Collection
|---Towel
|---Cloth
Now we are getting sub category for collection from CSV and It's running as a cron job

I want guide how can I create a cron job for this ??

second is If Towel sub category does not contain a products   then I want to put condition only on the sub category list of collection that if product does not exist then It should not be shown??


texts: Reset all categories store view use default value

texts:
how can I reset all my store views value to use default "All Store View" value?

Which database table(s) should be done that?

I have 279 categories and 2 store views.

Magento v1.9.2.2


texts: How can i remove catalog price rule from products which are in cart magento1?

texts:
I want to remove catalog price rule when customer apply discount coupon in cart page.

Because i want to give one discount at a time and when customer is going to apply discount code i need to remove catalog price rule from cart items.


texts: SQL install script doesn't run when caches are turned on

texts:
I created an SQL installation script for my extension and it ran just fine. I was developing the extension with the caches turned off. When I turn the caches on, the installation script doesn't get run, and I can't work out why.

I've tried clearing all of the Magento caches through the admin panel, flushing the cache storage, manually removing the contents of the magento/var/cache folder, clearing the APC cache, clearing the redis backend from the command line and restarting the PHP process, and nothing has worked. The only way I've managed to get the installation script to run is by turning the caches off.

Does anyone know why this would be happening? I'm using Magento v1.4.0.0 RC1.


texts: Getting placeholder image instead of swatch image. Magento2.3

texts:
I have some issues with swatch images. Clicking swatches in catalog list pages loads placeholder images instead of real product images.

I noticed that request to get swatch images returns only small image and placeholder image for the rest of dimensions.

I can confirm that swatch images have been set correctly in magento administration.
I have tried clearing image cache
I have tried running php bin/magento catalog:image:resize to regenerate resized images. Didn't work.

Any ideas?


texts:
I installed a local copy of Magento 2 into my XAMPP and have been getting to know the new structure. I have however run into a problem when trying to setup a basic module.

I have created the following file/folder structure

app/code/Heirik/Test/etc/module.xml

Inside this file I have the following

<?xml version="1.0"?>
<config>
    <module name="Heirik_Test" schema_version="2.0.0">
    </module>
</config>

I refreshed the store cache however when I go to store>configuration>advanced the module is not loading into the list. According to the most recent devdocs there is no longer a need to set the module to active inside the XML.

I know that Magento is reading the module.xml because if I remove the schema_version parameter I get an error.


texts: Magento 2 Migration : SQLSTATE[23000]: Integrity constraint violation: 1062

texts:
I followed http://devdocs.magento.com/guides/v2.0/migration/bk-migration-guide.html for migration. I am facing issue -

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'customer-service-1' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'

Checked table for duplicate entries but didn't find any duplicate value.

How to solve this?


texts: Magento1 - Show catalog products only to logged-in customer

texts:
I want to show product1 is only to the logged in customers and this product is not visible in STORE view.

Does anyone have a solution for this?

Thanks.


texts: how can I create a new admin page in magento2?

texts:
I need to have new backend page in my magento2 admin panel but I have no idea how I can create it with a db installer.
I have already created the db table and a backend page but have no idea how can I show the data in the backend page


texts: Why isn't there a "base" design package in adminhtml?

texts:
Why isn't there a /design/adminhtml/base and /skin/adminhtml/base? Sine CE 1.4 and EE 1.8 the frontend section uses /design/base now instead of /design/default as the final fallback area. It seems inconsistent that adminhtml would still use /design/adminhtml/default instead of having been refactored to be called /design/adminhtml/base.

Just curious really.


texts: Names of the associated products of a configurable product are not visible in admin? Simple Configurable Products by Organic Internet

texts:
Simple problem - the simple associated product names are not showing in the associated products tab within configurable products in the Magento admin.

I'm running the Simple Configurable Products extension by Organic Internet

Someone posted a solution here:

https://stackoverflow.com/a/8927616/2565123

But the fix is not working in my 1.9.1.0 project.

Could really do with some help on this - thanks!


texts: I'm not able add any item into cart with two store in one installation

texts:
I have a magento site that has two store in it. Retail and wholesale.

I'm not able to add any item to the cart it shows blank page.

The error is this:

Fatal error: Call to undefined method Mage_Weee_Helper_Data::setStore() in /var/www/vhosts/club27clothing.com/club27clothing.com/app/code/core/Mage/Weee/Model/Total/Quote/Weee.php on line 93

Compilation is disabled, cache cleared and refreshed.


texts:
Magento production mode note set display like http://prntscr.com/n6kl5q

  VPS server 8GB RAM, Nginx server  php vesion :Php 7.2
  /etc/php/7.2/fpm/php.ini   (php Memory limit =4G)
  /etc/php/7.2/cli/php.ini   (php  Memory limit =4G)

How to resolve?


texts: How to remove the .00 decimal from the shopping cart & Invoice of magento store?

texts:
I am building an ecommerce website named bookslab.in.

I want to remove the .00 decimals from the all products prices that i am adding in the shopping cart & in Invoice generated.

I am using the ET currency manager, it removes the prices decimals of all the products except the shopping cat products & Invoice

Is there any way to remove the decimals from the shopping cart products & from Invoices & to convert the main price without decimals. I want my grand total without the decimals.

My store currency in **Indian Rupees.

I am attaching the screenshot. Do i require any changes.


texts: Hide Prices everywhere but allow ordering

texts: We have a client who is using a legacy developed webstore, but we are looking to move them to magento 2. They currently have a web store with no pricing features, as each client has a different contracted price. I am curious about to do this with Magento? The goal would be to have no pricing, no cart totals, no pricing in order / email summary. The store will operate only once logged and registration will be closed.


texts: Magento 2: How to use cacheable=false in referenceBlock?

texts:
I want to set cacheable=false in referenceBlock, Can anyone help to set up this, please.
Any help would be appreciated. Thanks in advance.


texts: Magento set extra data to customer session

texts:
I have to set some additional data to currently logged in customer session. I have tried setting up new data in following way, but it doesn't work.

if (Mage::getSingleton('customer/session')->isLoggedIn()):
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customer->setTest1("test1_value");
$customer->setTest2("test2_value);
endif;

If I print the session right after I set new data to session,I can see the data, but when I refresh the page, the data (test1 and test2) disappears. Note: I can see other regular customer session data.

Please suggest how the session data can be set to customer data session.
Looking forward, thank you in advance!


texts: Dependency in admin form field in magento 2

texts:
How to set dependency of admin form field in magento 2?

How can i set dependency of admin fields

I am trying this code

$this->setChild('form_after',
        $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence')
            ->addFieldMap('answers', 'answer')
            ->addFieldMap('is_status', 'status')
            ->addFieldDependence('status', 'answer', 'Customer')

    );

but its not working

EDIT

protected function _prepareForm()
{
    ......
    $model = $this->_coreRegistry->registry('answers');
    $form = $this->_formFactory->create();
    $form->setHtmlIdPrefix('page_');

     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Answer Information')]);
    if ($model->getId()) {
        $fieldset->addField('answers_id', 'hidden', ['name' => 'answers_id']);
    }

    $fieldset->addField(
        'answers',
        'select',
        [
            'label' => __('Answer'),
            'title' => __('Answer'),
            'name' => 'answers',
            options => $this->_answerby->getOptionArray(),
        ]

    );
    $fieldset->addField(
        'is_status',
        'text',
        [
           'label' => __('Status'),
            'title' => __('Status'),
            'name' => 'is_status',
        ]

    );

    $this->setChild('form_after',
    $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Form\Element\Dependence')
        ->addFieldMap('answers', 'answer')
        ->addFieldMap('is_status', 'status')
        ->addFieldDependence('status', 'answer', 'Customer')

);
     $form->setValues($model->getData());

    $this->setForm($form);

    return parent::_prepareForm();
}


texts: How to make multiple cart sessions on each store (Multiple Baskets on one magento login )

texts:
I would like to setup a login for magento where there are mutiple baskets for the same customer.

The Logic is that customers have have many branches, they order for each branch which has its own delivery address.

Usecase
Priya logs onto magento site
Priya adds few products to default cart
Priya choses 2nd cart
Priya adds few products to this cart
Priya checkout of 2nd cart ( but not first)

So they would have the option when logged in to select a cart and add to it

ie AAA hair London Branch, AAA hair Surrey Branch etcetra.  instead of having two logins for the main site. Each branch also has its own customer code so when the order goes into the accounting system, it needs to be mapped accordingly.

Really struggling to find how to do this using magento or offering my boss a alternative method of working that is suitable


texts: Payment success e-mail is equal email of order confirmation

texts:
I have a virtual store in magento 2.3 and it works well, except for one detail.

When I place an order I receive an email with the details of my order.

When I pay for the order, I end up receiving the same email that I had received for order confirmation.

I've already accessed the administrative panel to look for something in the settings but I haven't found anything very relevant.

I am using ecomteck and proxypay as a payment service. Can anyone help?


texts: Detect Inventory change on Magento2 triggered by API

texts:
I'm working on a module for keeping track of inventory changes on orders, admin variation, api calls.

I'm using the event cataloginventory_stock_item_save_after which works fine on 2.2 but it seems to work only on the admin side. No luck on frontend orders.

Should it supposed to be dispatched whenever a stock item change is detected? What about api?


texts: Use a Custom Controller on Product Page - Magento 1.9

texts:
I have created a controller following the documentation

The module works just fine stand alone, however, I cannot add it to a page.  It will display in a product page if I call the template file but does not work.

<reference name="calculator">
<block type="core/template" name="calculatorBlock" template="calculator/calculator.phtml" />
</reference>

I suspect it is because it needs to be called differently to get the "whole" thing (models, etc.)

Can someone help point me in the correct direction?


texts: Show thumbnail image and delete image in custom module admin form

texts:
I'm trying to display thumbnail image in my custom admin module edit form like this

Right now I'm using this addfield.

 $fieldset->addField('main_image', 'image', array(
        'label'     => Mage::helper('ram')->__('Image'),
        'required'  => false,
        'name'      => 'main_image',
    ));

I looked at lib/Varien/Data/Form/Element/Image.php and found this code which uses images url there.

public function getElementHtml()
    {
        $html = '';

        if ((string)$this->getValue()) {
            $url = $this->_getUrl();

            if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) {
                $url = Mage::getBaseUrl('media') . $url;
            }

But I'm not storing images in media folder for this module. I'm uploading images from the controller in ram_images folder.

 $path = Mage::getBaseDir('media') . DS .'ram_images' ;
   $uploader->save($path, $_FILES['main_image']['name'] );

Also, i could not change URL from Image.php file as it will affect other system modules. is there any workaround here. Please suggest a solution.

And I also want to delete image using checkbox provided below upload button.

Thanks.


texts: totals not showing on shipping step in opc-summary-block

texts:
Sometimes I get the totals block saying totals can't yet be calculated.
On very few occasions I get the same totals block as on billing step.
But most of the time the totals block is just empty and not even loaded.
I just have the list of ordered items.

Has anyone looked into the totals block and can tell me where loading happens and where the logic resides that handles wether or not the block is loaded?
I'm searching my ass off again and can't find anything that would prevent it's loading -.-

THANKS!


texts: How to choose article attributes in the frontend without any order?

texts:
in the frontend of my shop customers first have to choose the color of an article and only then they are able to choose the size. But i want the free choice. :-) How can I set magento to that's regardless of which attribute my customers want to choose first?

Thanks in advance.

<<<< EDIT >>>>

Sorry, but i don't really know what additional informations you need, so that the question will not be marked as "too broad".

The problem in my shop is, for example, when a customer want to buy a T-Shirt he has to choose the color first and then he can choose the size. But I want him to do this also the other way around. So that he can choose the color or size first. At now, he is not able to choose the size before he chose the color.

I hope it's understandable what i mean.

Thanks.


texts: There has been an error processing you request

texts:
I tried activating production mode, However i got an error saying exec is disabled. So i activated the production mode by using php bin/magento deploy:mode:set production -s. Then when i tried to access the site, i got exception printing error. So i reversed to default mode and everything works fine.
Could you please tell me what might be the error ? i need to set my site to production mode ASAP.


texts: Magento 2.2.5 : Stock Item with id "x" does not exist

texts:
I have got an issue of "Stock Item with id "x" does not exist" because of this some product have didn't display price and options in product detail page.

Have any solution?


texts: Trying to trigger event after order is placed

texts:
I am using Magento 1.9.1

Here is my config.xml:

<config>
    <modules>
        <VivasIndustries_Smartparser>
            <version>0.1.0</version>
        </VivasIndustries_Smartparser>
    </modules>
    <global>
        <models>
            <smartparser>
                <class>VivasIndustries_Smartparser_Model</class>
            </smartparser>
        </models>
        <events>
        <sales_order_place_after>
            <observers>
                <vivasindustries_smartparser_model_observer>
                    <type>singleton</type>
                    <class>VivasIndustries_Smartparser_Model_Observer</class>
                    <method>clearcartitems</method>
                </vivasindustries_smartparser_model_observer>
            </observers>
        </sales_order_place_after>
        </events>
        <helpers>
            <smartparser>
                <class>VivasIndustries_Smartparser_Helper</class>
            </smartparser>
        </helpers>
        <blocks>
             <smartparser>
                 <class>VivasIndustries_Smartparser_Block</class>
             </smartparser>
         </blocks>
     </global>
    <adminhtml>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <vivasparser>
                                            <title>vivasparser - All</title>
                                        </vivasparser>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
          <layout>
            <updates>
              <smartparser>
                <file>smartparser.xml</file>
              </smartparser>
            </updates>
          </layout>
    </adminhtml>
</config>

Here is my obsrerver:

<?php

class VivasIndustries_Smartparser__Model_Observer
{
   public function checkPound() {

    Mage::log("$NowTime has started autmated pound currency check rate of $PoundRate status check!", null, "PoundCurrency.log", true);

    }

    public function clearcartitems($observer)
    {
        $data = $observer->getEvent()->getOrder();
        Mage::log("Order is placed",  null, "Order.log", true);
        Mage::log($data->debug(),  null, "Order.log", true);
    }
}

However when i place an order there nothing happens. The log is not created.
Where is my mistake and how can i fix it ?


texts: Get recently viewed products programmatically in Magento 2.2.2

texts:
I am trying to fetch recently viewed products.

I tried to implement the provided code from here but did not get any success.


texts: Magento2 Update price automatically when quantity changed on product page?

texts:
How to Update price automatically when quantity changed on the product page?

I am updating the qty input type to dropdown through below code and I want when I change the qty in dropdown price to be updated...

 <td class="col qty" data-th="<?php echo $block->escapeHtml(__('Qty')); ?>">

                <select id="cart-<?php /* @escapeNotVerified */
                echo $_item->getId() ?>-qty" name="cart[<?php /* @escapeNotVerified */
                echo $_item->getId() ?>][qty]" title="<?php echo $block->escapeHtml(__('Qty')); ?>" data - cart - item -
                        id="<?php /* @escapeNotVerified */
                        echo $_item->getSku() ?>">
                    <?php for ($i = 1; $i <= $qty; $i++): ?>
                        <option value="<?php echo $i; ?>"<?php if ($i == $block->getQty()) {
                            echo 'selected';
                        } ?>><?php echo $i; ?></option>
                        <//?php $i = $i + 4; ?>
                    <?php endfor; ?>
                </select>


texts: Undefined variation of configurable products

texts:
I have created a configurable product that has 5 variations. Configuration works great and simple boxes are made just fine.
Now if I want to add a value option of one of attributes I get new products showing undefined.

Let's say I have product variation color and when I created thd configurable product originally i had 3 colors, red, blue and orange.  and let's say my base sku for the configurable products is BASE.

So when I create the configurable product, magento creates simple products with name BASE-blue, BASE-red, and BASE-orange.

Now let's say I decided to add a new variation value for variation color, and its purple, so I go to the attribute, add purple, save, go to the configurable product, edit the configuration, add purple to the variable configuration, then once I finish the configuration dialog, magento says i'm making new simple product Undefined-purple, instead of BASE-purple.  How can this issue be fixed ?


texts: Magento 2 translation package not making a change on website?

texts:
What i want?

I want to translate Magento 2 to Serbian language.

What i did?

I followed instructions on magento official guide for making a language package. I followed the "create a language package example" guide on this link https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-i18n.html

After that i ran these commands in order:

magento setup:upgrade
magento cache:flush

What happened?

Well nothing actually happened. There is no change on website.

Info:

distro: centos 7
Single-Store Mode is enabled
magento version: 2.3.3
name of the language file: sr_CS.csv

Package folder content:

composer.json  language.xml  registration.php  sr_CS.csv


texts: CSS files just stopped loading // MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

texts:
Hello I am new with magento and ran into a issue that has caused a huge headache this morning. I updated a phtml file the same way I have previously but this time I got back this error and now none of the css loads on the front or backend.

I have flushed the cache and ran my usuall commands that i do
m -rf var/cache/* var/page_cache/* var/view_preprocessed/* pub/static/*

$ php bin/magento setup:static-content:deploy -f

$ php bin/magento cache:flush

and still nothing
I have added this to my htaccess file
 <IfModule mod_headers.c>
        # Header set X-Content-Type-Options: nosniff
 </IfModule>

still does not fix the issue
so any help would be greatly appreciated


texts:
This is loading gtm.checkout.success after google.tags.head on the checkout success page. I need it to load before. I added the before= attribute but it doesn't work. I assume it's because they have different parent nodes.

<?xml version="1.0"?>
<layout version="0.1.0">

    <default>
        <reference name="head">
            <!-- Need this on all pages -->
            <block type="core/template" name="google.tags.head" template="gtm/google-tags-head.phtml" />
        </reference>
    </default>

    <checkout_onepage_success>
        <reference name="head">
            <!-- Need this on checkout success page BEFORE google.tags.head -->
            <block type="core/template" name="gtm.checkout.success" before="google.tags.head" template="gtm/gtm-checkout-success.phtml"/>
        </reference>
    </checkout_onepage_success>

</layout>

So, question is how can I accomplish this? I tried removing google.tags.head and re-adding it but it doesn't show up at all this way...

<?xml version="1.0"?>
<layout version="0.1.0">

    <default>
        <reference name="head">
            <block type="core/template" name="google.tags.head" template="gtm/google-tags-head.phtml" />
        </reference>
    </default>

    <checkout_onepage_success>
        <reference name="head">
            <remove name="google.tags.head"/>
            <block type="core/template" name="gtm.checkout.success" template="gtm/gtm-checkout-success.phtml"/>
            <block type="core/template" name="google.tags.head" template="gtm/google-tags-head.phtml" after="gtm.checkout.success" />
        </reference>
    </checkout_onepage_success>

</layout>


texts: Cannot get autoincrement value, Magento 2

texts:
I getting this error inside /var/log/system.log on instalation succesfully finished, but with error. My admin site not function, sample data either:

[2019-08-05 16:41:20] main.ERROR: Error: Application is not installed yet.  [] []
[2019-08-05 16:44:12] main.INFO: Reference to undeclared plugin with name 'stockedProductsFilterPlugin'. [] []
[2019-08-05 16:46:26] main.ERROR: Sample Data error: Cannot get autoincrement value [] []

are you someone able to advice me what I made wrong?
I set values as recomanded from Magento 2:

php.ini
my.ini

using windows 10, apache 2, php 7.2.2, mysql server 8.0, Magento-CE-2.3.2_sample_data


texts: Use new customer attributes in shopping cart price rules - offi_customer_attributes_manager

texts:
This is not about "custom attributes". It is about using new customer attributes in shopping cart price rules. Means attributes related to a customer not a product.

We added some customer attributes with help of the Extension "offi_customer_attributes_manager".

Is there a way to use the added customer attributes in the shopping cart rules? eg. the customer attribute "company" can be used to apply a rule only for customers which have a specific customer attribute value?

I searched a lot but could not even find someone who has the same problem.


texts: Magento 2: Custom sort order for product collection(skus, ids etc)

texts:
For example, I want collection list in order "sku2,sku3,sku1", it is not simple DESC or ASC order. How to achieve it?

Example codes is below:

$skus = 'sku2,sku3,sku1';
$collection->addAttributeToSelect('*')
    ->addAttributeToFilter(
        'sku', array('in' => $skus)
    );

Magento 1.x has a way here How to specify custom sort order for product collection?, but it doesn't work on Magento 2:

$collection->getSelect()->order(new Zend_Db_Expr("FIELD(e.sku, $skus)"));

  Fatal error: Uncaught Error: Class '.../Zend_Db_Expr' not found in ...


texts:
I'm having a problem that is occurring after the volume of concurrent users on my site has increased. I'm currently with almost 600 concurrent users and the server is using 100% CPU.

To alleviate this load, I use some caching systems:

ElasticSearch, Memcached, and varnish.

My server is running with Nginx, php-fpm56 and Magento 1.9.3.

Configs nginx (/etc/nginx/nginx.conf):

fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 300;

php-fpm (/etc/php-fpm.d/www.conf):

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

My server is AWS with c3.4xlarge configuration (vCPU:16 MEM: 30GB SSD: 2 x 160GB)

Monitoring CloudWatch:

htop:

The theme was built by us, the entire front-end searches the ElasticSearch, the whole system is cached.
We do not use many modules, just OneStepCheckout, payment gateway, and SMTP.
I do not know what could be happening anymore because with this machine configuration it should be able to handle at least triple the users.

Anyone have any idea what might be happening?

Thanks!


texts: Generate Admin URL from frontend Magento 2

texts:
I have to generate secure Admin URL in the frontend, for example in Magento 1.9 i can achieve it like this:
$adminUrl = Mage::getUrl('adminhtml/sales_order/view', array( 'order_id' => $order->getId()));

how can i achieve this in Magento 2.3 ?


texts: Breadcrumb on custom category listing page Magento 1.9

texts:
I am working on a theme which is customized by someone else.

So in

  /websitename.com/app/design/frontend/rwd/ysv/template/page/category.phtml

is created which is called.When I click on any category or subcategory.

I want to show breadcrumbs, when user is on category/sub-category page.

  echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();
  This will not help in my case i think.

System > Configuration > General > Web > Default Pages > Show Breadcrumbs for CMS Pages. is set to YES.

Update:

<catalog_category_default translate="label">
        Catalog Category (Non-Anchor)
    .........
     <reference name="content">
            <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>

and

    <catalog_category_layered translate="label">
        Catalog Category (Anchor)
      .....................
        <reference name="content">
            <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <block type="core/text_list" name="product_list.name.after" as="name.after" />
                    <block type="core/text_list" name="product_list.after" as="after" />
                    <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>

In page.xml

    <catalog_category_default>
    <reference name="root">
      <action method="setTemplate"><template>page/category.phtml</template></action>
    </reference>
    </catalog_category_default>

In category.phtml

<?php echo $this->getChildHtml('head'); ?>
<?php echo $this->getChildHtml('after_body_start'); ?>

<?php echo $this->getChildHtml('global_notices'); ?>

<?php echo $this->getChildHtml('header'); ?>

<?php echo $this->getChildHtml('content'); ?>

<?php echo $this->getChildHtml('footer'); ?>
<?php echo $this->getChildHtml('before_body_end'); ?>
<?php echo $this->getAbsoluteFooter(); ?>

Can I create dynamic breadcrumbs based on current URL in a custom module or any other method? Please suggest.


texts: Magento 2 : Rating Filter in Layered Navigation

texts: In Magento 2 How to add Star Rating Filter in to Layered Navigation?


texts: Magento 2 Scandi PWA theme shows admin panel and frontend without styles

texts:
so I have been struggling installing Scandi PWA on Magento 2.4.2.
I have managed to get to the final step, where you just need to select the theme on admin panel like documentation says:
Run the upgrade command and disable full-page caching:
bin/magento setup:upgrade
bin/magento cache:disable full_page
It is now time to enable the new theme. In the Magento admin panel, navigate to Content > Design > Configuration. Edit the scope you want to change (typically the most general one in the list), and select the new theme. Finally, flush the cache:
bin/magento cache:flush

But I can't choose the theme because my admin panel looks without styles and javascript.
I have tried to run every command Magento has
setup:upgrade
setup:static-content:deploy
setup:di:compile
cache:clean
cache:flush
indexer:reindex

even clean the cache of scandi pwa with
php bin/magento scandipwa:pq:flush

but nothing seems to work, I don't know what could cause this error
Official documentation: https://docs.scandipwa.com/getting-started/getting-started/magento-integration
Greetings!


texts: 1.9.2.2 - New products created not displaying in front end categories or search

texts:
I'm working on upgrades to 1.9.2.2 on a test site before rolling out to production. When testing adding products, any new product I create post-upgrade does not display in the catalog or search, while any products that already existed prior to the upgrade display in both the catalog and search with no problems.

I've validated that the products are created correctly (all are being created manually in the admin interface), they show enabled, visibility is catalog/search.  While I normally don't use manage stock, I've tried both enabling and disabling manage stock on the products and confirmed they show In Stock with sufficient quantity.

Any suggestions?


texts: Magento 2, error in saving custom image path (external link) to product

texts:
Product image links are from third-party. Using below code in controller, I'm trying to save it for one product as a test. But no success and getting "image does not exist" in controller, however the link is fine.

$attributeImage = array('image', 'small_image', 'thumbnail');
$product = $this->productFactory->create()->load(2);
$imageLink = "https://link-from-thirdparty";
echo $imageLink;
$product->addImageToMediaGallery( $imageLink , $attributeImage, true,false );
$product->save();


texts: How to call catalog attributes to extension module's view file phtml

texts:
Magento 2.3

The extension sits in app/code/VendorName/ModuleName/

it has etc, view, Block, Controller, Model directories

What is the best way to call short_description and selected size configurable product (custom attribute)/specific simple product size from the database to render in view/frontend/templates/product/list/items.phtml?

A related question from me: How to show catalog attribute in cross-sell in shopping cart which overridden by an Extension module

I have done it in shopping cart section with method getData() for short_description and getAttributeText() for selected size. But this way to call the data cannot work in an extension module environment.

Source: getData getAttributeText


texts: Custom field in Block with specific ID - Magetno 2

texts:
i wolud like add new custom field in Block with specific ID in Magento 2.3.

It is possible?

Thanks


texts: Email newsletter unsubscribe link is not working?

texts:
I am using this to generate URL for unsubscribe in email template

{{var subscriber.getUnsubscriptionLink()}}

This only generates this link: http://www.sitename.com/index.php/newsletter/subscriber/unsubscribe/ without any code and id in URL

The method in app\code\core\Mage\Newsletter\Helper\Data.php looks like this

public function getUnsubscribeUrl($subscriber)
    {
        return Mage::getModel('core/url')
            ->setStore($subscriber->getStoreId())
            ->getUrl('newsletter/subscriber/unsubscribe', array(
                'id'     => $subscriber->getId(),
                'code'   => $subscriber->getCode(),
                '_nosid' => true
            ));

   }

I have tested it many time using test newsletter option
How can I fix this issue ?


texts: How do you rewrite a page to your homepage?

texts:
I am trying to redirect https://www.example.com/index.html to https://www.example.com

and i've tried ../ and / and https://www.example.com but none of these work as target path.


texts: Magento2.3 error symlink in custom email template

texts:
I have a problem with one custom email, in admin panel I can previzualize it with no error but when email send I have:

Blockquote
Error filtering template: A symlink for "C:/Dev/wampp/www/WO_Custom/lib/web/css/source/lib/_actions-toolbar.less" can't be created and placed to "C:/Dev/wampp/www/WO_Custom/pub/static/frontend/Magento/luma/fr_FR/css/source/lib/_actions-toolbar.less". Warning!symlink(): Cannot create symlink, error code(1314)

When I delete

Blockquote
{{template config_path="design/email/header_template"}}

I have no error but not the header.
I have no idea how can I have this email correctly. Thanks for your help


texts:
I am currently facing a very strange issue. Why does Magento returns null for the below code even we have products. What is the best way to load the product collection based on product attributes?

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager
        $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
        $collection = $productCollection->addAttributeToSelect('id')->addAttributeToFilter('root_product_id', ['eq' => $rootProductSku])->load();


texts: Magento 2 : Fatal error: Uncaught Error: Call to a member function dispatch() | Store Information

texts:
I'm trying to get store information which are set in backend like email,contact,address etc...(I've taken reference from here : https://magento.stackexchange.com/a/125359/39607 )

To do so I've created a module

Following is my block file...

Contact.php

<?php

namespace Vendor\Module\Block;

class Contact extends \Magento\Framework\View\Element\Template
{
    protected $_storeInfo;

    public function __construct(
        \Magento\Store\Model\Information $storeInfo
    )
    {
        $this->_storeInfo = $storeInfo;
    }
    public function getPhoneNumber()
    {
        return $this->_storeInfo->getInformationObject()->getPhone();
    }

}

And in my phtml I'm calling like this :

<?php
    echo "Phone: ".$block->getPhoneNumber();
?>

But it's not working and showing me an error :

  ( ! ) Fatal error: Uncaught Error: Call to a member function
  dispatch() on null in
  vendor\magento\framework\View\Element\AbstractBlock.php on line 644 (
  ! ) Error: Call to a member function dispatch() on null in
  vendor\magento\framework\View\Element\AbstractBlock.php on line 644

What can be the issue here??


texts: Magento 2 - Change font-size of element with LESS

texts:
I try to change the font-size of the element with class box-content in the customer area from 1.6rem to 1rem.

As you can see it shows that this is defined in _module.less Line #406 :
//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .block-reviews-dashboard {
        .product-name {
            &:extend(.abs-account-block-font-size all);
        }
    }
}

The whole path is: pub/static/frontend/hausfux/base/de_DE/Magento_Review/css/source/_module.less but interestingly, there is no such file in vendor/magento/module-review/view/web there is not even a css folder... ???
↑↑↑ EDIT: Now I understand. The file is in vendor/magento/theme-frontend-luma, which is the Luma theme which I extend.
Im not sure why it leaded me to this code, I can't see box-content anywhere in this file. How does the code in _module.less generate the code from the second screenshot?? LESS is so frustrating compared to CSS :(
How am I supposed to change the font-size without simply overriding it or is it okay to override it? I hope some experienced LESS user can tell me the best way to solve this.

Screenshots for answers:


texts: Magento 2 : Stock Inventory Save After Observer - Issue

texts: This observer triggered only when Quantity is out of stock or when we save the Quantity. Is there any other Observer event in Magento when the Quantity get Change while creating an order from the backend that observer will trigger?


texts:
Is it possible to insert a dataset of Amazon products to Magento 2?
The Amazon dataset file is in json format.
How could this be done?


texts: dial codes with phone number in magento2

texts: How can I put an option to choose country dial codes with the phone number in magneto 2.3.2.


texts: Magento 2 Data Migration SQL error 'Column not found' Column in m2 DB but not in m1 DB

texts:
im having this error:

Its the first data migration step, the integrity step. Anyone knows what to do with that?
Thanks!


texts: How to unhide magento2 product image programmatically?

texts:
I have programmatically added image to catalog_product_entity_media_gallery table and to catalog_product_entity_media_gallery_value, and catalog_product_entity_media_gallery_value_to_entity as well, i see my image in product catalog list, but it tells me the image is hidden.

What attribute i should change to unhide it? i have tried to update varchar attributes small_image image thumbnail and swatch_image but no luck


texts: URGENT HELP NEEDED! in magento 2 getting list of errors after enabling developer mode through command line

texts:
i was having an error on frontend

after looking for an answer here i got an answer :Magento 2 error: We're sorry, an error has occurred while generating this email
according to which i enabled the developers mode by command line as:

  php bin/magento deploy:mode:set developer
  and then clearing the caches:
  php bin/magento cache:flush
  and after refreshing the front page it gave me a crazy list of errors :

can someone guide me what to do now because my website was running but now customers have started to move on to other websites which i a great shock to me as it is a huge projct for me.


texts: Why is form key added to content on each page?

texts:
The form key block is added to the content container of each page in Magento 2 by the Magento_Theme default.xml.

What is the purpose of adding this to every page in the middle of content?

https://github.com/magento/magento2/blob/2.0/app/code/Magento/Theme/view/frontend/layout/default.xml


texts: I have some extensions installed and developed in my Magento store. I see their settings in /app/etc/modules files, but i would like to export one of them so i could implement it on other website. Is it possible to export module/extension from Magento?


texts: Add a tab on product page based on attribute set

texts:
I would like to add a static block on the frontend product page conditionally, based on the attribute set of the product. (e.g. Helmets -> display helmet size chart, which does not apply to other products.)

I have added:

<reference name='product.info.tabs'>
    <block type="cms/block" name="helmets_size_chart">
        <action method="setBlockId"><block_id>helmets_size_chart</block_id></action>
    </block>
</reference>

to the tabs block in local.xml, but that shows the static block on the tabs section on all product pages.
Secondly, I've added:

protected function _prepareLayout() {
    $product = Mage::registry('current_product');

    if (!($setId = $product->getAttributeSetId())) {
        $setId = $this->getRequest()->getParam('set', null);
    }

    if($setId != 12) { // helmets
        $this->getLayout()->unsetBlock('helmets_size_chart');
    }
}

to app/code/local/Mage/Catalog/Block/Product/View/Tabs.php
When viewing the product page, I can verify indeed the code in the setId != 12 block is parsed, but the unsetBlock() call doesn't do anything.

As you may have guessed, this is my first attempt at something programmatically in Magento, and I have no clue if I'm on the right track. Any thoughts welcome!

Thanks


texts: Will Magento 2 be included in next year Magento developers' certification?

texts: I'm going to take the test next year (2016) and I know that Magento 2 is going to be released. Is there any information about next year's quiz? Will there have Magento 2? And where can i find quizzes (like the original ones) to practice?


texts:
Each controller I need to define how many action can be
like saleAction() , productAction() something else.

But I want to make a action who receive all action like ......Action() It's receive all request except indexAction(). Is this possible only edit controller file?

Because now my URL like http://www.example.com/controller/action/parameter
I need to convert that  http://www.example.com/controller/action_as_parameter/somethings_if_need

UPDATE

Actually I not make yet. But I want to make a simple routers
like

<frontend>
        <routers>
            <marketshop>
                <use>standard</use>
                <args>
                    <module>Myname_Mymodule</module>
                    <frontName>market</frontName>
                </args>
            </marketshop>
        </routers>
    </frontend>

And controllers also simple. If I can this way then I make my module or find another way

class Myname_Mymodule_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction(){
        $this->loadLayout();
        $this->renderLayout();
    }
    public function globalAction(){
        // I want all action comes here and doing somethings
        // their not have any 404 page
    }
}


texts: Customer attribute setup script gives: "Attribute with the same code already exists"

texts:
I am trying to create a customer attribute but it gives the following error whenever you try to run the setup:upgrade

  Attribute with the same code already exists

I see that attribute with such code is already created despite of errors. After x-debugging,
I noticed that $attribute->save() is trying to create an attribute instead of updating.

I am using Magento EE 2.1.1.
And the module version is changed from 1.0.0 to 1.0.1 for setup upgrade.

File: MagePsycho/Customer/Setup/UpgradeData.php

<?php

namespace MagePsycho\Customer\Setup;

use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;

/**
 * @codeCoverageIgnore
 */
class UpgradeData implements UpgradeDataInterface
{
    const CUSTOMER_ATTRIBUTE_TWITTER_HANDLE = 'mp_twitter_handle';

    /**
     * @var CustomerSetupFactory
     */
    private $customerSetupFactory;

    /**
     * @var AttributeSetFactory
     */
    private $attributeSetFactory;

    public function __construct(
        CustomerSetupFactory $customerSetupFactory,
        AttributeSetFactory $attributeSetFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
        $this->attributeSetFactory  = $attributeSetFactory;
    }

    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    public function upgrade( ModuleDataSetupInterface $setup, ModuleContextInterface $context )
    {
        $installer = $setup;

        $installer->startSetup();

        if ($context->getVersion()
            && version_compare($context->getVersion(), '1.0.1') < 0) {
            $this->_execUpgrade101($setup);
        }

        $installer->endSetup();
    }

    protected function _execUpgrade101(ModuleDataSetupInterface $setup)
    {
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
        $attributesInfo = [
            self::CUSTOMER_ATTRIBUTE_TWITTER_HANDLE => [
                'label'     => 'Twitter Handle',
                'type'      => 'varchar',
                'input'     => 'text',
                'source'    => '',
                'required'  => false,
                'visible'   => true,
                'system'    => false,
                'user_defined'  => true,
                'backend'       => '',
                'position'  => 333,
            ]
        ];

        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
        $attributeSetId = $customerEntity->getDefaultAttributeSetId();

        /** @var $attributeSet AttributeSet */
        $attributeSet       = $this->attributeSetFactory->create();
        $attributeGroupId   = $attributeSet->getDefaultGroupId($attributeSetId);

        foreach ($attributesInfo as $attributeCode => $attributeParams) {
            $customerSetup->addAttribute(Customer::ENTITY, $attributeCode, $attributeParams);
        }

        $attribute = $customerSetup->getEavConfig()
            ->getAttribute(Customer::ENTITY, self::CUSTOMER_ATTRIBUTE_TWITTER_HANDLE);
        $attribute->addData([
            'attribute_set_id'      => $attributeSetId,
            'attribute_group_id'    => $attributeGroupId,
            'used_in_forms'         => [
                'adminhtml_customer',
                'adminhtml_checkout'
            ],
        ]);
        $attribute->save();
    }
}

What's wrong with the code?


texts: Magento 1.9: I need to create custom theme in enterprise edition

texts:
I need to create custom theme in enterprise edition.
Anyone have solution for this?

Thanks


texts: how to add custom field under shipping address in checkout magento 2?


texts: magento 2 "out of stock" not displaying in configurable swatch option product

texts:
In my magnto 2.2 "out of stock" option product was not dispalying in configurable swatch product. I like to list all option even if "out of stock".

Please help to solve this solution.


texts: Magento2 - Add Custom Column in cart item table and insert data to custom column when product add to cart

texts: i have added new column in 'quote_item' table. i want to add the data to custom column when user add any product to cart.


texts: how to put close button on hamburger menu click while it is expended

texts: How to put the close button on hamburger menu while it is expended ?


texts: Overlap Product image By uploaded image in product view page

texts:
We are displaying Product image1 in site as below :

Now we are giving an option to upload image2 from Product view page using below code, and what we want is uploaded image2 should overlap on existed image1 like here.

but now when we upload image2, image1 is overlapping on image2.

code for upload image from product view page

html

<input type="file" id="file">

<canvas id="canvas" width="450" height="450"></canvas>

script

Display Product image :

<?php echo $this->getChildHtml('media') ?>

We Tried below code, but it did't worked for us

#case_canvas {
     z-index:-1;
}

also once we click on "Add to cart" button we need to save uploaded image. after user place an order , the image should display in backend [ order view page ] as like Default Magento File upload option


texts: Declarative schema uses padding in 2.3, gone in 2.4, do we have to use it?

texts:
In a module we're developing we declare a new database table with a foreign key relationship to the sales_order table. We want to support Magento 2.3 and 2.4, so we use the declarative schema (db_schema.xml).
The schema looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

        <column xsi:type="int" unsigned="true" nullable="false" name="sales_order_id" padding="10" />

        <constraint xsi:type="foreign" referenceId="MY_ORDER_SALES_ORDER_ID" table="my_order_table" column="sales_order_id" referenceTable="sales_order" referenceColumn="entity_id" />

</schema>

So the column my_order_table.sales_order_id references Magento's sales_order.entity_id, and all is well. As long as we use Magento 2.4, because for 2.3 their own declaration is different. Compare:
Magento 2.3:
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

        <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true"
                comment="Entity ID"/>

Magento 2.4:
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

        <column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true"
                comment="Entity ID"/>

In 2.3, there's the padding="10" attribute on the column, which is gone in 2.4. If we add that same attribute to our schema, it works in both 2.3 (on MariaDB 10.3) and 2.4 (on MySQL 5.7). If we omit that padding, it works in 2.4 but in 2.3 gives the error while running setup:upgrade:

Column definition "sales_order_id" and reference column definition "entity_id" are different in tables "my_order_table" and "sales_order"

This attribute was removed in a commit named "MC-14884: MySQL-8 and MariaDB-10.4 support".
So my question is: why does it work if we declare the referencing column with padding, and what problems can that cause on later upgrades? Is it related to MariaDB?


texts:
I have products that have 4 configurable attributes:

Colour (~36 possible options)
Headboard (2 possible options)
Mattress (3 possible options)
Drawer (3 possible options)

I am confused, how many associated products need to be created. I have created 324 but they are not getting assigned to configurable product properly.


texts: MAGENTO2 - SQLSTATE[23000]:Integrity constraint violation: 1062 Duplicate entry '1486-1420'

texts:
Hi I am doing migration activity from magento version 1.9.0.1 to Magento 2.3.5 using default migration. I have success fully done the migration of the settings part. I am performing the migration for the data and facing the below error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1486-1420' for key 'CAT_PRD_ENTT_MDA_GLR_VAL_TO_ENTT_VAL_ID_ENTT_ID'

Can anyone help me how to resolve this issue?


texts: how can we add a jQuery Library in phtml file Magento 2

texts:
I am using below code in my phtml file.

Afte using below code:

province drop down is not showing.


texts: Magento 2 autoload error : "Magento\Framework\Profiler\Driver\Standard\Output\HTML" doesn't exist

texts:
Am getting the following error after I enabled the profiler from the command line

Autoload error Cannot create standard driver output, class
"Magento\Framework\Profiler\Driver\Standard\Output\HTML" doesn't
exist.

I tried disabling the profiler But the error still persists.
My Magento version : 2.3.5, Varnish Enabled.
Does anyone have the idea why this happens? Please help me out.


texts: Track account creation in Google Analytics

texts:
I want to setup an event or goal in Google Analytics to track account creation, as that is a success metric for my magento site. An event is a js append to a link that is clicked and a goal can be the js link or a destination url.

It doesn't look like there is a unique url that I can only associated with account creation. Anyone have any ideas on how to accomplish this?

Background on Magento setup:

I have social login and manual login
I require confirmation of email address before they can login


texts: Need to display subcategories and their products on parent category page?

texts:
I want to display subcategories and their products on parent category in bottom of the page using different phtml file with limitation of products like only need to show 4 products. can anyone please help.
Thanks


texts: How To Get Min & Max Attribute Values From Database to Link to Price Slider

texts:
I have implemented this jQuery Slider on my Advanced Search form.

Currently, I have arbitrary min and max values.

How would I set the min value as the minimum value of my database, and vice versa for the max?

var slider = {
   $: jQuery,
   initSpace: function (el) {
       slider.el = slider.$(el);
       slider.el.children().hide();
       slider.el.append('Start' +
           '&nbsp; to &nbsp; End' +
           '

').width('400px');
   },
   initSlider: function () {
       var params = {
           range: true,
           min: 11,  //--------------arbitrary
           max: 240,  //---------------arbitrary
           values: [11, 240],
           slide: function (event, ui) {
               slider.el.find('.search-min').html(Math.floor(ui.values[0] / 12) + '\' ' + (ui.values[0] - (12 * Math.floor(ui.values[0] / 12))) + '"');
               slider.el.find('.search-max').html(Math.floor(ui.values[1] / 12) + '\' ' + (ui.values[1] - (12 * Math.floor(ui.values[1] / 12))) + '"');

               slider.$(slider.el.children('input')[0]).val(ui.values[0]);
               slider.$(slider.el.children('input')[1]).val(ui.values[1]);
           }
       };
       slider.$('.slider').slider(params);
   }
};


texts:
I Have this problem when trying to add a product to cart:

{"message":"No such entity with %fieldName = %fieldValue","parameters":{"fieldName":"cartId","fieldValue":null}}

My API:

POST on:

https://domain.com/rest/V1/guest-carts/ce7b9f063fb07fcb03d71a2eff922d8d/items?cartItem[sku]=1508110&cartItem[qty]=1&cartItem[quote_id]=353

ce7b9f063fb07fcb03d71a2eff922d8d is the cart-key which I got through API:

POST http://domain.com/rest/V1/guest-carts
quote_id = 353 is the id which I got from cart details through API:

GET http://domain.com/rest/V1/guest-carts/ce7b9f063fb07fcb03d71a2eff922d8d

Please help.


texts:
I have a strange problem and I hope its me who is doing something wrong.

When I see an order in admin, I see that tax is not applied to all products. It is 0 for many. I checked each such product in catalog->products and found that they have same tax class assigned as the product on which tax is calculated.

Please tell me where I should look for this. The information regarding tax setting is this:


texts: How to determine if customer is new or existing from "customer_save_after_data_object" event ? Magento 2

texts:
Here is my events.xml file
<?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="customer_save_after">
        <observer instance="Vendor\Module\Observer\CustomerRegister" name="customer_register_observer"/>
    </event>
</config>

CustomerRegister.php
<?php

namespace Vendor\Module\Observer;

use Vendor\Module\Helper\Tracking;
use Magento\Framework\Event\ObserverInterface;
use Psr\Log\LoggerInterface;

class CustomerRegister implements ObserverInterface
{
    /**
  * @var \Magento\Framework\Registry
  */

 protected $_registry;
 protected $request;
 /**
 * ...
 * ...
 * @param \Magento\Framework\Registry $registry,
 */
    /**
     * @var \Psr\Log\LoggerInterface
     */
    protected $logger;

    /**
     * @var Tracking
     */
    protected $helper;

    public function __construct(LoggerInterface $logger, Tracking $helper, \Magento\Framework\Registry $_registry,\Magento\Framework\App\Request\Http $request)
    {
        $this->logger = $logger;
        $this->_registry = $_registry;
        $this->helper = $helper;
        $this->request = $request;
    }

    /**
     * @param Observer $observer
     * Call helper & pass customer object
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        try {
            $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/getActionName.log');
            $logger = new \Zend\Log\Logger();
            $logger->addWriter($writer);
            $logger->info('action'.$this->request->getActionName());
            if($this->_registry->registry('custom_var')){
                return $this; //this method has already been executed once in this request (see comment below)
            }
            $this->_registry->register('custom_var', true);
            $customer = $observer->getEvent()->getCustomer();
            $this->helper->trackCustomerRegister($customer);
        } catch (\Exception $e) {
            $this->logger->info($e->getMessage());
        }
    }
}

Any thoughts how can i differentiate, customer is new in this observer ?
As this also calls on customer update.
Any reviews appreciated
Thanks


texts: Magento programatically convert quote to order - orders missing in backend

texts:
I'm dealing with a strange issue with orders placed with PayPal (most likely IPN problems) as a payment method and I have about 10 orders that are not showing in Magento Admin backend under Sales -> Orders.

To have a better idea of the situation here is the workflow of the issue:
Client adds products to cart -> proceeds to checkout -> selects PayPal -> Places the order -> Client is getting redirected to PayPal where he makes the payment, SUCCESSFULLY gets charged and I get the payment -> Order Confirmation is received with Order number, details, etc...

After that, the customer is redirected back to the website and the products are still in cart! But he paid and got the confirmation.

If I log to PayPal and go to IPN History.. it's full of retrying messages like this (Need to mention that this website worked correctly with PayPal for the past 7 months. 6 days ago the issues started without any changes to PayPal settings)

HTTP response code 503 | Delivery status | Retrying | No. of retries | 11

Now, if I log into admin backend and go to Sales/Orders -> the order is not there.
If I connect to MySQL and look for the order id (entity id) in sales_flat_order the order is not there. But if I go to sales_flat_quotes, the quote id is there and contains all info (even the reserved_order_id which corresponds with the number from the email - Order #).

If someone else encountered this issue, any help is welcome!

2. Is there a way or what's the best way to convert the quote to order so it can be viewed in backend?
I have about 15 orders that we're placed through PayPal in the last 6 days and I need to convert the corresponding quotes to orders

Thank you in advance!


texts: Do I need to copy the cron.php and cron.sh files into the subdomain of my second Magento store (running from the original installation) in order for sales emails to work for the second store?


texts: Creating an extra field in sales order grid

texts:
I need to insert the company name into the order grid. I added this to app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php in the function _prepareColumns()

    $this->addColumn('billing_company', array(
        'header' => Mage::helper('sales')->__('Company Name'),
        'index' => 'billing_company',
    ));

It is not working. Is billing_company the wrong name or do I need to change something else were as well?

UPDATE: I think i need to add the propety to the collection variable and then it will work something like this  (i cant find the right one for company yet)

$collection->getSelect()->join($prefix.'sales_flat_order', 'main_table.entity_id = '.$prefix.'sales_flat_order.entity_id',array('shipping_method','customer_email','coupon_code','weight','base_tax_amount','tax_amount','base_discount_amount','discount_amount','base_total_refunded','total_refunded','customer_group_id'));


texts: Add product form validation for downloadable product in magento2

texts:
I want to stop converting downloadable product to virtual product on click of button shown below

How can i make is compulsary to add link on click of this button. After click on button without adding download link product is converting to virtual product need to stop. Let me know any solution.


texts: How to get a collection of sales_order_status_history models with a specific set of id's for parent_id column?

texts:
Magento 2 has order status history inside each order which essentially is just comments related to a order. All of them are stored in one single database table sales_order_status_history. Each comment relates to order by value in column parent_id which maps to order_id. I have a set of order id's in an array.
My end goal is to get an array or a collection with comments related to those orders with single query to make it more efficient. I don't want to write direct database queries. I want to utilize collections functionality that I believe allows you to do something like that.


texts:
I want to rewrite magento2 js

The file path is "vendor/magento/theme-adminhtml-backend/web/js/theme.js",
 what should i do?

Thanks for you helping


texts:
I have setup different shipping methods in my store and I want to offer 3 promotions with 3 different coupon codes wherein:

Promo 1: ORDERS over $25 get free Priority Mail shipping upgrade
Promo 2: Order $99+ and 2day shipping is on us
Promo 3: Order $125+ and overnight shipping is on us

I am new to Magento and as per my research, I have seen that extensions will solve this but also want to know if there's a no-cost method on how to do it?

Thank you very much,

Mara


texts: Using jquery in phtml got an error: Uncaught ReferenceError: require is not defined

texts:
I use jquery in my phtml frontend page like this:

all the function work properly, but in my browser console i got an error pointing at require saying :

VM4522:2 Uncaught ReferenceError: require is not defined


texts: Search for a deleted table's reference id in all tables, rows and columns of a DB

texts:
I had copied the table structure of table 'url_rewrite' and created a new table named 'url_rewrite_new' with empty data in my Magento 2 store DB, also renamed the 'url_rewrite' table. Then I ran magento commands and the entries were added in table 'url_rewrite_new'.
Then I deleted the new table 'url_rewrite_new' and restored old table 'url_rewrite' in DB.
But now I am getting the reference id of that deleted table 'url_rewrite_new'.
How could I get Reference ID and remove that?


texts: Set Magento Cookie Variable Using jQuery click() event

texts:
I am in the process of trying to set a Magento cookie variable on click using jQuery but can't seem to get it too work.

Would the best way to do this be to hit a controller action using ajax when the click event is fired and then use the following code snippet inside the controller action?

Mage::getModel(‘core/cookie’)->set($name, $value);

Or is this approach a complex way of doing such a task and is there a different approach I should take?


texts: What would be Mage::getSingleton('adminhtml/session_quote') in magento 2?

texts:
In magento 1 my code is,

 Mage::getSingleton('adminhtml/session_quote');

How can I change this piece of code in magento 2?

I know I would need to do something like this:

However, what would be ('adminhtml/session_quote') in magento 2?

Please can anyone help?


texts: Magento 1.9 - Get attributes per group (nearly there!)

texts:
I'm trying to get the attributes in the layered navigation to show per group. On default, they show per seperate attribute option like so

Walls
   Walls (12)

Ceilings
   Ceilings (14)

Wood
   Wood (5)

While in the backend, in the attribute group, all these attributes are grouped in a group called 'Application'. I want to call the layered navigation per those groups so that it appears as:

Application
   Walls (12)
   Ceilings (14)
   Wood (5)

I feel like I'm halfway there. I got this code to show the groups (with name and ID) and in there the attribute codes are called:

    $groups = Mage::getModel('eav/entity_attribute_group')
        ->getResourceCollection()
        ->setAttributeSetFilter(4) // Attribute set Id
        ->setSortOrder()
        ->load();

    $attributeCodes = array();
    foreach ($groups as $group) {
        $groupName = $group->getAttributeGroupName();
        $groupId   = $group->getAttributeGroupId();

        $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
            ->setAttributeGroupFilter($group->getId())
            ->addVisibleFilter()
            ->checkConfigurableProducts()
            ->load();

        if ($groupId == 43) { // Get group 'Application'
            if ($attributes->getSize() > 0) {
                echo ''.$groupName.'
';
                foreach ($attributes->getItems() as $attribute) {
                    /* @var $child Mage_Eav_Model_Entity_Attribute */
                    $attributeCodes[] = $attribute->getAttributeCode();
                    echo $attribute->getName(); echo '
';
                }
            }
        }

This shows the attribute codes for the group Application, but just those. I'm unclear how to get the actual filter code there.

In the default way where the filters are shown functional (tied in with Ajax filtering and all that);

            <?php $_filters = $this->getFilters() ?>
            <?php foreach ($_filters as $_filter): ?>
            <?php if($_filter->getItemsCount()): ?>
                <?php
                $source = $_filter->getFilter()->getRequestVar();
                ?>
                <div class="<?php echo $source ?>">

<?php echo $this->__($_filter->getName()) ?>

<?php echo $_filter->getHtml() ?>

            <?php endif; ?>
            <?php endforeach; ?>

So the question is; how do I get able to call the $_filter->getHtml() inside the foreach ($groups as $group)? I tried simply using $attribute->getHtml() etc, but that was a long shot and doesn't work.


texts: Magento 2: Calculate discounts based on Base Original Price

texts:
I'm looking to add a functionality to my site where all discounts are calculated on the base original price of a product. This is our scenario:
A customer adds a set of products in their cart. Upon navigating to checkout we call an API that sets a new price for the customer, by setting a custom price for the product via this function:
$cartItems = $cart->getQuote()->getAllItems();

foreach ($cartItems as $item ) {
    $cartItem->setCustomPrice($price);
    $cartItem->setOriginalCustomPrice($price);
    $cartItem->getProduct()->setIsSuperMode(true);
    $cartItem->save();
}

Now I want all of the discounts added by Magento 2 to calculate the discount by the base original price and not this custom price.
How would I go about doing that?


texts: Magento2: Connect to an external non Magento DB

texts:
Sometimes I need to connect to different databases, Mysql / Oracle etc.
What is the best practice to do it in Magento2


texts: How to remove or disable street address and city fields from shipping address in Magento2

texts:
Is there any solution disable or remove the city and street fields from checkout_index_index.xml?

Thanks


texts: Join sales/order and ordered items in grid column render Magento 2

texts:
I created a custom column in sales/order grid named Product name, They are coming fine on first time, When I am doing sorting Found :

Column not found: 1054 Unknown column 'product_name' in 'order clause'

And find there is need to join ordered items also, Here is my code:

     $joinTable2 =$this->getTable('customer_entity_varchar');
    $this->getSelect()->join($joinTable2. ' as fn', 'main_table.customer_id = fn.entity_id and fn.attribute_id = 177',array('value'));
return $this;

Please suggest if anyone have solution, Thanks in advance.


texts: Magento 2 cached image error, Warning: getimagesize()

texts:
I recently pulled the latest version of Magento 2 and now all my product & catgeory pages display a version of the following error, which basically says that the image cannot be found to get the dimensions.

Warning: getimagesize(/Users/adammoss/projects/magento2/pub/media/catalog/product/cache/1/small_image/240x300/beff4985b56e3afdbeabfc89641a4582/m/y/freddy.jpg): failed to open stream: No such file or directory in /Users/adammoss/PhpstormProjects/magento2/app/code/Magento/Catalog/Model/Product/Image.php on line 936

I have cleared the main cache, var/generation, images cache etc but nothing seems to help. The cache directory is missing from the pub/media/catalog/product directory.

Version: 2.0.0.0-dev35


texts: Modify existing custom attribute value of category in magento 2.4 using rest API

texts:
As the title says, I want to modify the value of a custom attribute of each of my categories in magento 2.4 and I want to do this using REST APIs.
I am using this endpoint https://magento.redoc.ly/2.4.0-admin/tag/categoriesid#operation/catalogCategoryRepositoryV1SavePut What I do not understand is that endpoint works fine if I want to modify the name of the category, but it does not work for the custom attributes. The changes are not saved.
I send the put request and the old data is returned with the incorrect/old custom attr value.
This is what I am doing:
response = requests.put("/rest/V1/categories/1111",
                        data=json.dumps({
                            "category":
                                {
                                    "id": 1111,
                                    "parent_id": 1000,
                                    "name": "cat name",
                                    "is_active": True,
                                    "position": 1,
                                    "level": 4,
                                    "path": "1/2/1031/6000/6001",
                                    "include_in_menu": True,
                                    "custom_attributes": [
                                        {
                                            "attribute_code": "description",
                                            "value": "new_value"
                                        }
                                    ]
                                }
                        }),
                        headers={
                            "Content-Type": "application/json",
                            "Authorization": "Bearer {}".format(token)
                        }, timeout=config.timeout)

I should see new_value as the value of the attr description, but I see value which is the old value.
Anyone has any ideas what I am doing wrong? Should I use another endpoint?
Thank you


texts: Magento 2 : Add product to cart programmatically does not populate quote item id in validate method

texts:
How to add product to cart programmatically in Magento 2.2.0 ?

I have tried below code but when I do not get Quote item id in Validate method of below file.

\Magento\AdvancedSalesRule\Model\Rule\Condition\Product.php

Code:

protected $formKey;
protected $cart;
protected $product;

public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Data\Form\FormKey $formKey,
\Magento\Checkout\Model\Cart $cart,
\Magento\Catalog\Model\Product $product,
array $data = []) {
    $this->formKey = $formKey;
    $this->cart = $cart;
    $this->product = $product;
    parent::__construct($context);
}

public function execute()
 {
  $productId = 32;
  $params = array(
                'form_key' => $this->formKey->getFormKey(),
                'product' => $productId,
                'qty'   => 2
            );

    $_product = $this->product->load($productId);

    $this->cart->addProduct($_product, $params);

    $this->cart->save();
 }

Sales Rule Validate Method Code:

File: \Magento\AdvancedSalesRule\Model\Rule\Condition\Product.php

Method:

public function validate(\Magento\Framework\Model\AbstractModel $model)
    {
        //@todo reimplement this method when is fixed MAGETWO-5713
        /** @var \Magento\Catalog\Model\Product $product */
        $product = $model->getProduct();
        if (!$product instanceof \Magento\Catalog\Model\Product) {
            $product = $this->productRepository->getById($model->getProductId());
        }

        if ($model instanceof \Magento\Quote\Model\Quote\Item) {
            die($model->getItemId()); //NULL

Thanks


texts: Magento 2: How to override the magnifier.js?

texts:
I had a requirement that the entire image need not be zoomable, and I had to scale the image to take the full width on the product page so I modified the magnifier.js according to my requirement. Now I modified it in the lib folder directly, which is not a good way.

How can I override or use a custom magnifier library with my theme?


texts: How to determine if custom extension has frontend page/controller

texts:
I'm working with a custom extension that was developed for our site by our previous developer some time ago. The extension was fully built out and met the company's needs at the time however there is very little documentation on the extension's full capabilities and we can no longer reach the developer.

With that being said: We have an extension that essentially manages magazine/publication subscriptions. When Magento users are logged in, they should be able to manage their subscriptions at a dedicated URL that is populated by this extension. We can’t seem to find that URL but there are code comments in the extension that imply that this page exists and is generated by the module. I’m trying to determine the namespace of the URL but don’t know where or what to check for.

I started by looking into the extension’s controllers directory and I see several files that appear promising but I couldn’t determine the URL that I was supposed to be visiting.

My Question: Where would I look in an extension’s files to determine if there is a URL accessible page or controller?


texts: Why can Magento 2 only uninstall composer packages

texts:
When you run bin/magento module:uninstall Vendor_Module -r and Vendor_Module happens te be a module that's not installed by Composer, Magento will not perform an uninstall.

Why did Magento add this constrain? Why am I not allowed for my own domain-specific modules to add uninstall scripts?


texts: Update Magento 2.1.2 for 2.1.3 : Undefined index issue

texts:
My magento current version is 2.1.2 and upgraded with Composer by following command:

composer require magento/product-community-edition 2.1.3 --no-update
composer update
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade

I'm getting following error while run command php bin/magento setup:upgrade

  [Exception]
    Notice: Undefined index: attribute_id in vendor\magento\module-catalog\Setup\UpgradeData.
    php on line 375

Please help me for solve this error.


texts: I am getting an error installing Magento 2 using the composer in ubuntu

texts: when I install Magento 2 setup using composer in ubuntu I am getting this issue it's permission issue and me also giving 755 permission to my htdocs.


texts: Store in multiple geographical locations

texts:
I am interested in setting up a store which has presence in multiple geographical locations (NA, EMEA, APAC). The reason for this is obviously to reduce the latency for end-users, at least while browsing and looking at products, I am fine with higher latency when it comes to placing an order etc.

FPC, CDN is already in use, but that obviously does not solve the latency problem.

Considering secondary regions will not be performing any admin tasks, the only shared state between the regions is the database and the media files.
Media files I've already solved using GlusterFS geo-replication but I am struggling with the database.

I was able to come up with the following options as general solutions to the problem:

Setup a completely independant store per region.
Having a MySQL replica in the secondary region, doing reads locally, writes across the pond.
Having clustered multi-master MySQL (Galera/Percona)
Varnish caches across the pond (disabling caching when the user adds something to basket, etc).

Issues with #1:

Management. All the stores would have the same products, so modifying descriptions, stock etc would be a pain.
Integrating with external providers. If for example the store uses some third-party provider which deals with uploading listings in Amazon, eBay etc, they might not even support this sort of setup (adjusting stock in multiple stores as the purchase is made).

Issues with #2:

Magento already provides read/write splitting, but it seems that even when using FPC, and disabling visitor tracking, Magento still connects to the write side of the database to check for index locks which basically brings the performance down to the level as if it was served from across the pond.
Even if I patch out the code which checks for index locks, it still tries to establish a connection to the write database for some reason.
Given no writes are happening, if I set the write database to be the read only database, the performance becomes acceptable.

Issues with #3:

I assume that it will suffer from even worse issues than #2, just because every transaction has to be confirmed by every region, causing all of the regions to have latency, rather than just the secondary ones.

Issues with #4:

Invalidation. I am yet to discover a reasonable solution which is able to invalidate Varnish caches upon stock levels dropping to 0, staff making adjustments to descriptions, etc.

My questions:

Are you aware of any other solutions to the problem?
Do you have any experience using the options I provided above, the problems you've encountered, and ways you solved them (if you managed to)?


texts:
What is the format of a Magento 2 password? For example:

  0504c745003c3d3e7ddc542ae510e1122b7e351435fbdc2986587f9ef295d6af:pfcFuoTL2qienx37PGFHOhWYoXEQwyxo:1

Is it (salt + password):salt:1 ?
Because I've tried creating a SHA256 hashed password through a python function with that format, but it doesn't work.


texts: Sort Order of Image gallery is not working for Magento 1.9

texts:
I'm using Magento 1.9.2.4 and there is feature for product using which one can sort images for gallery, but for me it is not working, actually the changes of sorting order are not saved.

Any other changes like add new image or excluding it is working.


texts: How to get order id in custom block sales_order_create reorder

texts:
I have created one custom block in reorder page for scheduling reorder.
I am not getting orderid in the phtml file.

I have used this for but not working

$this->getId(), $this->getEntityId

and

Mage::getSingleton('adminhtml/session_quote')->getQuote();

How do i get orderid in phtml file ?

I have made block using block type adminhtml/sales_order_create_data.

<adminhtml_sales_order_create_index>
    <reference name="items">
         <block type="adminhtml/sales_order_create_data" name="reorder" template="reorder/schedule.phtml" after="items_grid"/>
     </reference>
    </adminhtml_sales_order_create_index>

How do i use my own block  "adminhtml/reorder" ?

Please help


texts: Magento2 reset button in Grid column not working

texts:
I am using the UIComponent for showing the grid in front end under the customer account for a custom link.All things are going well but 'reset' button is not working in 'column' drop down for reset the visibility of columns in the grid.

Did anyone face the same issue?

Looking forward to hearing from Magento developer.


texts:
When creating a new user I get a error 500.

It seems that a class does not exist. I "grepped" for the name of the class but it does not show up anywhere else than the line in the error

"PHP message: PHP Fatal error:  Class 'Pelago_Emogrifier' not found in app/code/core/Mage/Core/Model/Email/Template/Abstract.php on line 197" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: website.com, request: "POST /customer/account/createpost/ HTTP/1.1", upstream: "fastcgi://unix:/run/php/php5.6-fpm.sock:", host: "website.com", referrer: "http://website.com/customer/account/create/"


texts: Magento2.3 w/ php7.2 - Emails not being sent

texts:
I am running Magento 2.3 on php7.2 everything works perfectly, except emails are not being sent to the customers or myself.

I have checked:

Sales Order Emails set to YES
Cron tabs configured properly

Is there a bug in M2.3 with regard to sending emails?


texts: Magento 2.3.2: How to delete custom table column

texts:
I have created Custom Table Using below code. Table has been created successfully with columns.

<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

        <column xsi:type="int" name="inc_id" padding="11" unsigned="false" nullable="false" identity="true" comment="ID"/>
        <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
         <column xsi:type="varchar" name="subtitle" nullable="false" length="255" comment="Subtitle"/>
        <constraint xsi:type="primary" name="PRIMARY">
            <column name="inc_id"/>
        </constraint>

</schema>

But when i try to remove the column by removing the subtitle column, It doesn't get deleted.My Updated Xml looks like this,

<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

        <column xsi:type="int" name="inc_id" padding="11" unsigned="false" nullable="false" identity="true" comment="ID"/>
        <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
        <constraint xsi:type="primary" name="PRIMARY">
            <column name="inc_id"/>
        </constraint>

</schema>

I have run following command after removing the column from xml,which created db_schema_whitelist.json in etc folder.

$ bin/magento setup:db-declaration:generate-whitelist [options]

Finally upgrade command.

$ bin/magento setup:upgrade


texts: What does "clone_fields" and "clone_model" attribute mean in vendor\magento\module-catalog\etc\adminhtml\system.xml?

texts:
<group id="placeholder" translate="label" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Product Image Placeholders</label>
    <clone_fields>1</clone_fields>
    <clone_model>Magento\Catalog\Model\Config\CatalogClone\Media\Image</clone_model>
    <field id="placeholder" type="image" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
        <backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
        <upload_dir config="system/filesystem/media" scope_info="1">catalog/product/placeholder</upload_dir>
        <base_url type="media" scope_info="1">catalog/product/placeholder</base_url>
    </field>
</group>

I have come across source_model, backend_model but this clone_model is seen the first time.


texts: how to add google map as a ui component in magento 2.1

texts:
I need to display a coordinated field, coming from the database, currently am displaying it as an input like this:

I need to display it as the map like this:

I googled a LOT and lot of answers on how to load the map using requireJS, but is not working with Magento 2.1...

help pleaaaaase


texts: Magento 2: How to change the position/order of a sub-category?

texts:
I'm trying to change sub category order into magento 2. Look at the image below:

I tried it from dashboard, I change position using drag and drop features. But it is not appear in same sequence into the front-end page.

I flush cache and did reindex too. But still no changes appear into the front-end page. Can anyone help me.

Thanks,
Omar