texts:
I had installed Magento2 in Xampp earlier and now I am trying it removing xampp with local apache2, php and mysql server. I have used the backup database and the previously used Magento2 folder here.

When I tried to access the website as 127.0.0.1/magento2, I am getting the following error. But I can log in to mysql server with mysql - root -p with password correctly. What can be the reason?

  PDOException: SQLSTATE[HY000] [1698] Access denied for user
  'root'@'localhost' in
  /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:128
  Stack trace: #0
  /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(128):
  PDO->__construct('mysql:host=loca...', 'root', 'root', Array) #1
  /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111):
  Zend_Db_Adapter_Pdo_Abstract->_connect() #2
  /var/www/magento2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(398):
  Zend_Db_Adapter_Pdo_Mysql->_connect() #3
  /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(460):
  Magento\Framework\DB\Adapter\Pdo\Mysql->_connect() #4
  /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238):
  Zend_Db_Adapter_Abstract->query('SELECT store_w...', Array) #5
  /var/www/magento2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(517):
  Zend_Db_Adapter_Pdo_Abstract->query('SELECTstore_w...', Array) #6
  /var/www/magento2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(580):
  Magento\Framework\DB\Adapter\Pdo\Mysql->_query('SELECT `store_w...',
  Array) #7
  /var/www/magento2/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(737):
  Magento\Framework\DB\Adapter\Pdo\Mysql->query(Object(Magento\Framework\DB\Select),
  Array) #8
  /var/www/magento2/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(87):
  Zend_Db_Adapter_Abstract->fetchAll(Object(Magento\Framework\DB\Select))

  9 /var/www/magento2/vendor/magento/module-store/App/Config/Source/RuntimeConfigSource.php(57):

  Magento\Store\App\Config\Source\RuntimeConfigSource->getEntities('store_website',
  'code') #10
  /var/www/magento2/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(40):
  Magento\Store\App\Config\Source\RuntimeConfigSource->get('') #11
  /var/www/magento2/generated/code/Magento/Framework/App/Config/ConfigSourceAggregated/Proxy.php(95):
  Magento\Framework\App\Config\ConfigSourceAggregated->get('') #12
  /var/www/magento2/vendor/magento/module-store/App/Config/Type/Scopes.php(63):
  Magento\Framework\App\Config\ConfigSourceAggregated\Proxy->get() #13
  /var/www/magento2/vendor/magento/framework/App/Config.php(131):
  Magento\Store\App\Config\Type\Scopes->get('websites') #14
  /var/www/magento2/vendor/magento/module-store/Model/WebsiteRepository.php(182):
  Magento\Framework\App\Config->get('scopes', 'websites', Array) #15
  /var/www/magento2/vendor/magento/module-store/Model/WebsiteRepository.php(141):
  Magento\Store\Model\WebsiteRepository->initDefaultWebsite() #16
  /var/www/magento2/vendor/magento/module-store/Model/StoreResolver/Website.php(46):
  Magento\Store\Model\WebsiteRepository->getDefault() #17
  /var/www/magento2/vendor/magento/module-store/Model/StoreResolver.php(140):
  Magento\Store\Model\StoreResolver\Website->getAllowedStoreIds(NULL)

  18 /var/www/magento2/vendor/magento/module-store/Model/StoreResolver.php(126):

  Magento\Store\Model\StoreResolver->readStoresData() #19
  /var/www/magento2/vendor/magento/module-store/Model/StoreResolver.php(89):
  Magento\Store\Model\StoreResolver->getStoresData()
  ..... and so on..


texts: Products are removed from mini cart after homepage load it doesn't clear if load another URL

texts: When I added products to cart it's added succesfully but when i click on homepage the mini cart become empty. what can be issue??


texts: After enabling shared catalog in magento (cloud), the assigned price structure for the created catalog is not applied at frontend

texts:
I have created a new shared catalog in a magneto cloud environment and I also assigned the prices & companies for the created catalog.
But the price structure that I have configured in the shared catalog is not displaying on the frontend.
Can anyone give suggestions on this?


texts: Apply Security Patches on Multiple Magento Installations

texts: I have multiple Magento websites with different versions (1.9.0.1, 1.9.1.0 and 1.9.1.1) in multiple servers. Is there any more easy and painless way other than ssh into each server separately and apply the patch files?


texts: Magento 2 admin message notifications are not display on redirect to same page

texts:
On select an option from dropdown, I am getting value in phtml file and from there in js function , i am redirecting to my controllers.

Everything works fine but only admin message notifications are not displaying while i used return $resultRedirect->setRefererOrBaseUrl();

It is redirecting to same page but messages are not displaying.
But when i gave $resultRedirect->setPath('/');

It is redirect to dashboard and displaying message at dashboard. but its not working for same page redirect.

Can anyone help me where is the issue ?


texts: Problem with product attribute attaching to quote/order item

texts:
I'm following this guide (product attribute to quote item and order item) however for whatever reason I seem unable to retrieve my attribute in my observer. My attribute I created is called "budgetcode" and is assigned to the product I'm trying to purchase. In my observer I'm attempting to use the same theory as the above post however my "budgetcode" attribute appears so deep within the schema I cannot retrieve it. I did Zend_Debug::dump($item) and can see a massive output (too big to paste) with my budgetcode shown way down, problem is I can't seem to retrieve it.

Observer.php

class Bendart_BudgetCode_Model_Observer extends Varien_Event_Observer
{
    public function setBudgetCodeAttribute(Varien_Event_Observer $observer)
    {
        $item = $observer->getQuoteItem();
        Zend_Debug::dump($item);
        $product = $observer->getProduct();
        $item->setBudgetCode($product->getBudgetCode());
        return $this;
    }
}

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Bendart_BudgetCode>
            <version>0.1.0</version>
        </Bendart_BudgetCode>
    </modules>
    <global>
        <fieldsets>
            <sales_convert_quote_item>
                <budgetcode>
                    <to_order_item>*</to_order_item>
                </budgetcode>
            </sales_convert_quote_item>
        </fieldsets>

        <sales>
            <quote>
                <item>
                    <product_attributes>
                        <budgetcode />
                    </product_attributes>
                </item>
            </quote>
        </sales>

        <events>
            <sales_quote_item_set_product>
                <observers>
                    <Bendart_BudgetCode>
                        <class>Bendart_BudgetCode_Model_Observer</class>
                        <method>setBudgetCodeAttribute</method>
                    </Bendart_BudgetCode>
                </observers>
            </sales_quote_item_set_product>
        </events>
    </global>
</config>

Any help is appreciated.


texts: Magento 2 : Confirm Form Resubmission Error in Controller

texts:
I'm getting this Confirm Form Resubmission error in the
  Controller while going back to the browser.

  No errors found in Logs and Console. I'm getting this below in headers, in the Network tab.

  Can anyone tell me why this error is coming? and suggest me a
  solution.


texts: Magento 1.9.2.1 error SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

texts:
I imported database backup through terminal . in terminal it gave error

  ERROR 1062 (23000) at line 1016624: Duplicate entry '0' for key
  'PRIMARY'

then I used the below commands to resolve this -
TRUNCATE log_customer; TRUNCATE log_quote; TRUNCATE log_summary; TRUNCATE log_summary_type; TRUNCATE log_url; TRUNCATE log_url_info; TRUNCATE log_visitor; TRUNCATE log_visitor_info; TRUNCATE log_visitor_online;
But still in admin panel I am getting error-

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
  '0' for key 'PRIMARY', query was: INSERT INTO
  adminnotification_inbox (severity, date_added, title,
  description, url) VALUES (?, ?, ?, ?, ?).


texts: After logging in, the user name is not displaying in header section

texts:
After logging in, the user name is not displaying between 'Wilkommen' and 'Anmelden' .

Which files are responsible for rendering out this part of the header ?
How to get the user name of the currently logged in user ?


texts:
I would like to log some variables such as $mageRunCode before it hits:

Mage::run($mageRunCode, $mageRunType);

It appears that Mage::log and even the Zend logging facility don't seem to log out to an arbitrary file output here.  How would one do this properly?


texts: getData() of Users created from Admin backend

texts:
I have created users from backend admin i.e. System->Permissions->Users .
Now I want to obtain details of every users that are created. Can anyone please answer me how to obtain created user details?


texts: Magento 2.2.5 URL Rewrites - Duplicate entry 'myurl' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'

texts:
I am seeing this error when trying to perform a search/replace on the url_rewrites table:

UPDATE url_rewrite SET request_path = REPLACE(request_path, '.html/', '/');

SQL Error (1062): Duplicate entry 'myurl' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'

(I need to do this because my URLs are messed up and being formatted like this:
category1/category2.html/category3/product-url)

I understand that there are unique constraints on this table but when I search for the offending rewrite that is given in the error message it is not found.

SELECT * FROM url_rewrite WHERE request_path LIKE '%myurl etc etc%';

So there is my confusion! How can it be a duplicate if there is not one there already?!

(Magento 2.2.5)


texts: Magento 2 + Customer logged out automatically in checkout process

texts:
I have a strange issue on one of the site. When I log in or register as a new customer and adding few items in shopping cart. Then go to the checkout page it is automatically logged out the customer in some random cases.

Sometimes it just logged out the user when I come to the checkout page. Sometimes it logged out the user when I go to the payment selection page. This is random behavior. Also in some cases, I can able to place an order with logged in but in success page, it is automatically logged out the customer.


texts: How to avoid Law of Demeter violation ("Newable objects should not hold a field reference to an injectable object")

texts:
In the Rules for using dependency injection, the Magento 2 devdocs state:

  Newable objects should not hold a field reference to an injectable object nor should they request one in their constructor. This is a Law of Demeter violation.

I understand that this is a good goal to have, but how is this actually possible with Magento 2 models?

If we have a look at the Customer module, which has been presented as shining example for the new architecture, the customer model constructor signature looks like this:

public function __construct(
    \Magento\Framework\Model\Context $context,
    \Magento\Framework\Registry $registry,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Eav\Model\Config $config,
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
    \Magento\Customer\Model\ResourceModel\Customer $resource,
    \Magento\Customer\Model\Config\Share $configShare,
    \Magento\Customer\Model\AddressFactory $addressFactory,
    \Magento\Customer\Model\ResourceModel\Address\CollectionFactory $addressesFactory,
    \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
    GroupRepositoryInterface $groupRepository,
    \Magento\Framework\Encryption\EncryptorInterface $encryptor,
    \Magento\Framework\Stdlib\DateTime $dateTime,
    CustomerInterfaceFactory $customerDataFactory,
    DataObjectProcessor $dataObjectProcessor,
    \Magento\Framework\Api\DataObjectHelper $dataObjectHelper,
    \Magento\Customer\Api\CustomerMetadataInterface $metadataService,
    \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry,
    \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
    array $data = []
)

And Magento\Framework\Model\Context alone, which is used by all models, takes five injectable arguments.

Apparently models, although newable, are not a good example at all for this rule.

I want to follow best practices with my own classes (not even models), but I need access to things like repositories of related entities or to the event manager. What would be the preferred way to handle this without breaking the rule from above?

I currently tend to ignore it or at best see it as friendly guideline, not as a rule.


texts: Is it possible to have two logos in Magento Store?

texts:
I want to have one logo (say maybe a white logo) for my Main Page and another one to be shown on the Show Search Results page (maybe the same logo but black).
Is it possible to achieve that in Magento 1.9.3?


texts:
I've started getting heaps of exceptions and my Cart2Quote emails are no longer sending. Our email server is working fine and our Cart2Quote settings haven't changed since it was working.

It looks like it may be an issue with SMTP Pro, but, again, the settings have no changed since we were in a working status.

How do I trace the exception to find the real problem?

Or, what does the error (Connection temporarily blocked by local policy; try again later) actually mean?

2015-07-06T15:45:02+00:00 ERR (3):
exception 'Zend_Mail_Protocol_Exception' with message '4.7.1 Connection temporarily blocked by local policy; try again later
' in /var/www/sites/mbs/lib/Zend/Mail/Protocol/Abstract.php:431
Stack trace:
#0 /var/www/sites/mbs/lib/Zend/Mail/Protocol/Smtp.php(199): Zend_Mail_Protocol_Abstract->_expect(220, 300)
#1 /var/www/sites/mbs/lib/Zend/Mail/Transport/Smtp.php(200): Zend_Mail_Protocol_Smtp->helo('localhost')
#2 /var/www/sites/mbs/lib/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#3 /var/www/sites/mbs/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#4 /var/www/sites/mbs/app/code/local/Aschroder/SMTPPro/Model/Email/Queue.php(98): Zend_Mail->send(Object(Zend_Mail_Transport_Smtp))
#5 [internal function]: Aschroder_SMTPPro_Model_Email_Queue->send(Object(Mage_Cron_Model_Schedule))
#6 /var/www/sites/mbs/app/code/core/Mage/Cron/Model/Observer.php(325): call_user_func_array(Array, Array)
#7 /var/www/sites/mbs/app/code/core/Mage/Cron/Model/Observer.php(72): Mage_Cron_Model_Observer->_processJob(Object(Mage_Cron_Model_Schedule), Object(Mage_Core_Model_Config_Element))
#8 /var/www/sites/mbs/app/code/core/Mage/Core/Model/App.php(1338): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#9 /var/www/sites/mbs/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Cron_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#10 /var/www/sites/mbs/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#11 /var/www/sites/mbs/cron.php(76): Mage::dispatchEvent('default')
#12 {main}


texts: Google Sitemap generation error magento version 1.9.0.1

texts:
Today I tried to generate google sitemap on my site, through admin panel > catalog > generate the sitemap. after a moment it keeps displaying this error message in my browser 504 Gateway Time-out.

I have Magento version 1.9.0.1.


texts: keep the checkboxes of mass action checked for some items, by default

texts:
In my Grid.php of custom module, I added the following code (excerpt) to enable mass action.

protected function _prepareMassaction(){
    $this->setMassactionIdField('entity_id');
    $this->getMassactionBlock()->setFormFieldName('some_thing');
    // options code here
    return $this;
}

I want the checkboxes of mass action to be checked by default for some items based on a variable which holds the field entity_id of the items in an array.

I am trying to show the checked items as shown in the below image even after page reload:

How to do this?


texts: Get input context in Magento UI validation

texts:
Is it possible to get information about the element that is being validated, when using Magento_Ui/js/lib/validation/validator?
I've added a validation rule for a custom field in the checkout. In my case I need to validate the value based on the class of a nearby <div>. If I could even get the input's id attribute that would be really helpful.
For example:
validator.addRule(
    'custom-validate',
    function (value, params, additionalParams) {
        // to demonstrate - `element` is not defined here
        return $(element).attr('class') === 'valid class';
    },
    $.mage.__('message')
);

This guide https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/validations/custom-validation.html shows that you can get the element when using mage/validation - but it seems I can't use that in the checkout because element IDs are set dynamically by knockout.js.


texts: Magento 2.3 - Products URL key regenerate on import functionality

texts:
I update the products with no url_key header present (only sku,description) using the import functionality

The import should only update the fields which are mentioned in the CSV file.

The import removes the URL keys from admin against every sku mentioned in the CSV and URL keys regenerate from the name against each product sku.


texts:
In my website till the last week crons was working fine and suddenly stopped working and even stopped scheduling in the cron_schedule table. so i had truncated cron_schedule and executed php cron.php file through ssh and jobs has been scheduled but this jobs are not executing and status of this jobs are still pending.

Please Help me in debbuging this issue.


texts: I want to duplicate my custom field data and qty while creating the new product by "duplicate & save" feature in Magento 2


texts: Check if Layered navigation filter is active on Magento

texts:
I'm having trouble identifying the catalog pages that are in active filters in Magento. I use a rewrite for URLs, are my filters as follows:

http://store.com/brand/foobrand/type/luxe/class/standard

In the Catalog page, I need to know is that the filter page is active or not.

Wherever I looked I thought almost always the same, but could not make it work:

$filters = array();
            $appliedFilters = Mage::getSingleton('catalog/layer')->getState()->getFilters();

            foreach($appliedFilters as $filter) {
                $filters[] = $filter->getFilter()->getRequestVar();
            }

            if (!empty($filters)) {
                //filter active
            }
            if (empty($filters)) {
                //no
            }

Can anyone help me identify where you may be experiencing the problem?


texts: Magento 1: Performance optimizations to delete entities

texts:
I'm currently trying to improve a couple of modules regarding performance.

Some of you may know the usage of the walk() method on collection which is very useful to avoid looping through products directly.

On top of that and thanks to @Vinai, one can also use the collection delete() method.

But I noticed that Magento 1 native files don't always use any of those methods for deletion.

One of the worst code I've seen is the massDelete() method from app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php where products are loaded in a loop before deletion.

foreach ($productIds as $productId) {
    $product = Mage::getSingleton('catalog/product')->load($productId);
    Mage::dispatchEvent('catalog_controller_product_delete', array('product' => $product));
    $product->delete();
}

So I made some performance tests, added some logging calls to check the time taken and the memory usage for 100 products deletion.

Test 1: walk method

I replaced the original code pasted above with this code:

$collection = Mage::getResourceModel('catalog/product_collection')
                        ->addAttributeToSelect('entity_id')
                        ->addIdFilter($productIds)
                        ->walk('delete');

And my results are the following on my crappy dev server (average based on 10 tests):

Original code: 19.97 seconds, 15.84MB used
Custom code: 17.12 seconds, 15.45MB used

So for 100 products deletion, my custom code is 3 seconds faster and uses 0.4MB less.

Test 2: Using the collection delete() method

I replaced the original code with this one:

$collection = Mage::getResourceModel('catalog/product_collection')
                        ->addAttributeToSelect('entity_id')
                        ->addIdFilter($productIds)
                        ->delete();

And mind blown here are the results:

Original code: 19.97 seconds, 15.84MB used
Custom code: 1.24 seconds, 6.34MB used

So for 100 products deletion, my custom code is 18 seconds faster and uses 9MB less.

As stated in the comments, it seems like this method does not trigger the Magento events (after load, after delete) nor the index/cache flush.

Question

So my question is: is there a reason why the Magento core team did not use the walk('delete') or event better the collection delete() method instead of loading products in a loop (which we all know is a very very bad practice) ?

Main goal is to be aware of such key points in case of a module development: is there any particular cases where one can't use the walk / collection delete() method ?

EDIT: the reason is definitely not because of the catalog_controller_product_delete event being dispatched as the same code can be found in several places (check the massDelete methods) in Magento core. I've used the example of products to highlight the performance as they are usually the biggest entities


texts:
I have two customer attribute that I would like to display on the "Customer view" Tab in Magento admin. I have been able to display the values from the attribute but adding:

        <?php echo $this->__('Customer attribute:') ?>
        <?php echo $this->htmlEscape($this->getCustomer()->getCutomerAttribute()) ?>

To adminhtml/default/default/template/customer/tab/view.phtml file. The problem is I'd prefer not to directly edit this template file and have been looking for a way to add my template without touching the default.

I have tried to add a local.xml file to override the default template but it's not working correctly...

<layout>
    <adminhtml_customer_edit>
        <reference name="content">
            <block type="adminhtml/customer_edit" name="customer_edit"></block>
        </reference>
        <reference name="head">
            <block type="adminhtml/template" name="optional_zip_countries" as="optional_zip_countries" template="directory/js/optional_zip_countries.phtml" />
            <action method="addJs"><file>mage/adminhtml/product/composite/configure.js</file></action>
            <action method="addJs"><file>varien/configurable.js</file></action>
        </reference>
        <reference name="left">
            <block type="adminhtml/customer_edit_tabs" name="customer_edit_tabs">
                <block type="adminhtml/customer_edit_tab_view" name="customer_edit_tab_view" template="path/to/customer/tab/view.phtml">
                    <block type="adminhtml/customer_edit_tab_view_sales" name="sales" template="customer/tab/view/sales.phtml" before="-" />
                    <block type="adminhtml/customer_edit_tab_view_accordion" name="accordion" />
                </block>
                <action method="addTab"><name>customer_edit_tab_view</name><block>customer_edit_tab_view</block></action>
            </block>
        </reference>

</adminhtml_customer_edit>
</layout>

I've also tried to use a layout update inside of my module but I kept getting errors

"Mage registry key "subscriber" already exists";i:1;s:2926:"#0

And then..

  Wrong tab configuration

when I tried to rewrite the block class

I'm now running out of ideas and could do with some help here please...

Many thanks!


texts: How to add a Block Grid with Mass Action in an UI form in Magento 2?

texts:
I have UI form with a Block grid.

<fieldset name="profile_products">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Products</item>
            <item name="collapsible" xsi:type="boolean">true</item>
        </item>
    </argument>
    <field name="in_profile_products">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="visible" xsi:type="boolean">false</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="formElement" xsi:type="string">input</item>
                <item name="source" xsi:type="string">amazon_profile_form_data_source</item>
                <item name="label" xsi:type="string" translate="true">Selected Products</item>
            </item>
        </argument>
    </field>
    <container name="profile_products_container_grid">
        <htmlContent name="html_content">
            <argument name="block" xsi:type="object">MyVendor\MyModule\Block\Adminhtml\Profile\Ui\Form\Product</argument>
        </htmlContent>
    </container>
</fieldset>

namespace MyVendor\MyModule\Block\Adminhtml\Profile\Ui\Form;

class Product extends \Magento\Backend\Block\Template
{
    /**
     * Block template
     *
     * @var string
     */
    protected $_template = 'MyVendor_MyModule::profile/product.phtml';

    /**
     * @var \Magento\Catalog\Block\Adminhtml\Category\Tab\Product
     */
    protected $blockGrid;

    /**
     * Retrieve instance of grid block
     *
     * @return \Magento\Framework\View\Element\BlockInterface
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function getBlockGrid()
    {
        if (null === $this->blockGrid) {
            $this->blockGrid = $this->getLayout()->createBlock(
                \MyVendor\MyModule\Block\Adminhtml\Profile\Ui\Form\Product\Grid::class,
                'mymodule.admin.profile.product.grid'
            );
        }
        return $this->blockGrid;
    }
}

Grid.php

namespace MyVendor\MyModule\Block\Adminhtml\Profile\Ui\Form\Product;

class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
{ .....
}

products.phtml

   $block->getGridHtml()

For reference: Link

I need to add a mass-action bar and select-all option in selection checkbox.


texts: Magento 1: How to check if "Estimate Shipping" button is clicked or submitted?

texts:
How can I check if Estimate Shipping form is submitted?

I could have check it like this:

<?php if(isset($_POST['submit_name'])) ?>

But in the code it's a button type:

<button type="button" name="estimate" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Get a Quote')) ?>" onclick="coShippingMethodForm.submit()" class="button"><?php echo $this->__('Get a Quote') ?></button>

With the javascript code:

Thanks


texts: How do you pass more / custom parameters to the customer bind / private data in knockout

texts:
So this is an extension of this question

Magento 2.3 display logged in/out message using private content

Default behavior is that data-bind="scope: 'customer' has a few properties

eg

data_id: 1234567890
firstname: "Dominic"
fullname: "Dominic Xigen"
websiteId: "1"

I'm looking for an example on how to pass other or custom customer attributes to knockout.


texts: Need to reduce the zooming level of the image

texts:
please visit link1 you can see image is zooming too much ,

but here link2 its fine. how to display link 1 image  as like link2

code for link 1 :

<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getImage()); ?>

code for link 2 :

<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image')); ?>

why we are using code for link 1 is because to solve this problem

media.phtml

<?php
    $_product = $this->getProduct();
    $_helper = $this->helper('catalog/output');
    $dexxtz = Mage::helper('productzoom');

    $dexxtz->getCss();
    $dexxtz->getJs();
?>

        <img class="etalage_thumb_image"
        src="<?php echo Mage::getModel('catalog/product_media_config')->getMediaUrl($_product->getImage()); ?>" />
        <img class="etalage_source_image" title="<?php echo $_product->getImageLabel(); ?>" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image'), true); ?>" />

    <?php
        foreach ($this->getGalleryImages() as $_image) {
            if(Mage::registry('current_product')->getImage() != $_image->getFile()) { ?>

                <img class="etalage_thumb_image" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile())); ?>" />
                <img class="etalage_source_image" title="<?php echo $_image->getLabel(); ?>" src="<?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()), true); ?>" />

        <?php
            }
        }
    ?>

script

var jQuery = jQuery.noConflict();
var b, c, w, h, t, l;

b = jQuery('.dexxtz-bg-modal');
c = jQuery('.dexxtz-modal-content');
w = (jQuery('body').innerWidth() / 2);
h = (window.innerHeight / 2);
t = ((h - (c.height() / 2)) < 15) ? '15px' : h - (c.height() / 2) + 'px';
l = ((w - (c.width() / 2)) > 0) ? w - (c.width() / 2) + 'px' : 0;

jQuery(window).resize(function() {
    w = (jQuery('body').innerWidth() / 2);
    h = (window.innerHeight / 2);
    t = ((h - (c.height() / 2)) < 15) ? '15px' : h - (c.height() / 2) + 'px';
    l = ((w - (c.width() / 2)) > 0) ? w - (c.width() / 2) + 'px' : 0;

    c.css('top', t)
    c.css('left', l);
});

function DexxtzModal() {
    c.css('top', t)
    c.css('left', l);
    b.fadeIn('slow');
    c.fadeIn('slow');
}

function DexxtzModalClose() {
    b.fadeOut('slow');
    c.fadeOut('slow');
}

we have same kind of configuration in both links.


texts: update category attributes programmatically

texts: I can't seem to figure out how to best update hundreds of category attributes with a script.  Any suggestions as the best way to approach this?  I won't be using the installer or anything like that.


texts: Magento unsecure URLs set to https > can't access to admin and front

texts:
I am using Magento version 1.9.1

I have installed ssl certificates and given the base secure url as https://www.mydomain.com. I have also selected both the options : Use secure urls in frontend and Use Secure urls in admin.

But it didn't worked, so I've tried to set the unsecure urls to https and I've saved it.

Now I am not able to access into my admin page or My site ..

Before I reinstall magento and start from scratch, are there any other ideas that I should be trying?
THANK YOU FOR ANY HELP!


texts: Configurable products for different product sizes and price

texts:
I am trying to make a store for car care chemicals in Magento for online buyers and company distributors.

Each chemical has a size option - 0.5 liters, 5 liters, 207 liters

And the above options have price difference depending upon the customer is a normal buyer or a distributor.

I have made a configurable product, but the price in the "Super product attributes configuration" overrides the Group pricing in the simple products.

Can somebody please suggest the right way?


texts: Magento Bundled Item that requires certain items

texts:
Let's say I have a tshirt store. In my store, I sell different types of tshirts each for $10. I'd like to make a special bundle that includes a red shirt, blue shirt, and black shirt at a discounted total price of $25 (instead of $30).

In Magento, is there any way to build a product like this? If I use the API to reduce the quantity of this new bundled item, it should automatically reduce one from each of the respective bundle items (i.e. red shirt, blue shirt, and black shirt). Is this possible in magento?


texts: Bug change limit from toolbar advance search collection

texts:
i face strange issue using advance search filter. When i select multiselect from advance search they

{baseUrl}/catalogsearch/advanced/

when apply search url bocome like this.

{baseUrl}/catalogsearch/advanced/result/?an_material_class[]=2733

they show desire result.

when i set page limit.

then url become like

{baseUrl}/catalogsearch/advanced/?an_material_class%255B0%255D=27337 like this

i think there some bug in url encoding. if any one have face this issue let me. help will b appreciated
thanks in advance


texts: We have a lot of customers requesting custom orders from us that are not available on the website. Is there any solution that would allow me to send a custom invoice to somebody from our magento back end and then auto populate that into our sales queue when the customer purchased it?


texts: Remove and add block in layout explanation - Magento 1.9

texts:
I had fun to create some small scenario in layout and I don't understand some thing.

In the layout, would it be possible to remove a block and then create it again ?

I explain: assuming that I want to remove the header so i add <remove name="header"/> in local.xml good the block is removed, now I recreate it again by adding the xml code bellow but it doesn't work. The second block is quite correct because if i delete <remove name="header"/> i will have two headers.

The xml who creates the header:

<block type="page/html_header" name="header" as="header">
     <block type="page/template_links" name="top.links" as="topLinks"/>
     <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
     <block type="core/text_list" name="top.menu" as="topMenu" translate="label">
           Navigation Bar
           <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
     </block>
     <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
           Page Header
           <action method="setElementClass"><value>top-container</value></action>
     </block>
     <block type="page/html_welcome" name="welcome" as="welcome"/>
</block>


texts: How to stop Magento 2 using cookies like recently_viewed_product?

texts:
According to the GDPR and recent court decisions, technically unnecessary cookies may only be set after the user has given his active consent.
Cookies that are not technically necessary are widely regarded as cookies for tracking, marketing, external media, etc.
Magento 2 sets the following cookies, among others:

recently_viewed_product
recently_viewed_product_previous
recently_compared_product
recently_compared_product_previous

First question:
Does Magento use these cookies to recognize the preferences of the visitor during subsequent page views or sessions and to display products that suit the visitor? In my opinion, these would then be marketing cookies that should not be set until the user actively agrees?
Second question:
How can the above mentioned cookies be deactivated without affecting the basic functionality of Magento?


texts: how can i get customer already bought products list in magento2

texts:
The answer is here

I want to check my current cart products with customer already bought products for disallow repeated buyers for specified category.

I'm getting current cart products like this

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');

// retrieve quote items collection
$itemsCollection = $cart->getQuote()->getItemsCollection();

// get array of all items what can be display directly
$itemsVisible = $cart->getQuote()->getAllVisibleItems();

// retrieve quote items array
$items = $cart->getQuote()->getAllItems();   //citem means Cart items :)

foreach($items as $item) {
   echo $item->getProductId().'<br />';   // current product id

}

Help me to get customer already bought products list

Thanks in Advance


texts: Magento 2 Certified Professional Developers Plus Exam Reading Material

texts:
Recently Magento announced  Certified Professional Developers Plus exam for Magento2.

  https://u.magento.com/magento-2-certified-professional-developer-plus

I have some questions about this Certified Professional Developers Plus exam.

What is the passing score for developer plus exam?
Which study materials useful for preparation of this exam except Free study Guide?
What is the retake policy for this exam?
How many free retakes are available?


texts: Form key doesnt change remains the same - resulting 403 forbidden error on few links magento 1.9.2

texts:
i have further investigated in my case and i have identified that the
form key generated is not generating new form key . instead it is using the same form key for all users and pages

www.smartcityfood.in

Is my website that is running since. 2015 December..

Recently few of my customers gave me a complaint that on the view cart page. They cant delete or click on account link on top

When they click they are getting a 403 forbidden error

I did not have this problem before . I didnt make any changes to files of magento
All of a sudden am getting these errors

Try a store of my site http://www.smartcityfood.in/seasons/
Add items to cart
Go to cart page http://www.smartcityfood.in/seasons/checkout/cart

Then try the option to delete or on the top right of page there is a account link icon

Its giving is 403 forbidden error

Any help is appreciated


texts: Magento2 composer update throws exception

texts:
When I am running composer update I am faced with the error like:

$ ./composer update
X-Powered-By: PHP/7.0.31
Content-type: text/html; charset=UTF-8

Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Loading composer repositories with package information
    Authentication required (repo.magento.com):                                                                                Authentication required (repo.magento.com):                                                                                Authentication required (repo.magento.com):
      Username:

  [Symfony\Component\Console\Exception\RuntimeException]
  Aborted

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

does anyone face similar issue and how it can be fixed?


texts: Magento 2 - display none for emails less styles

texts:
How can I use

display: none

for inline class in _email-extend.less or email.less

without removing element from html structure in Magento Sales email that is send to customer?

When I use it the html element with class that have display: none is removed from html output that is send to a customer.


texts: How can i change or move the link that when i click the (Contact us) in navigation bar the output will be the same in (contact us) in footer?


texts: Google Universal Analytics Simple Product Price Zero when Configurable Product Sold Magento 1.4.2

texts:
I have two issues with Universal Analytics tracking product prices:

When a Configurable Product without any custom options is sold, Google Universal Analytics tracks the sale of the associated Simple Product, but the price of the Simple Product is missing.  Therefore I cannot report on the total sales of these items.
When a Configurable Product with a custom option is sold, Google Universal Analytics tracks the sale of the both the Configurable product with correct price AND the associated Simple Product with price missing.  So I can report on the correct total sales amount of these items, but not the quantities.

Here is the current code in our checkout that Google support provided for Universal Analytics:

<?php
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
$subtotal = $order->getSubtotal();
$order_id = $order->getIncrementId(); //the id of the order
//$order->getIncrementId();//the increment id of the order
$gtotal = $order->getBaseGrandTotal(); //grand total of the order
$tax = $order->getBaseTaxAmount(); //tax amount of the order
$shipping = $order->getBaseShippingAmount(); //shipping amount of the order
$address = $order->getBillingAddress()->getData();
$city = $address['city'];
$state = $address['region'];
$country = $address['country_id'];
?>
<script type="text/javascript">
ga('require', 'ecommerce', 'ecommerce.js');

ga('ecommerce:addTransaction', {
  'id': '<?php echo $order_id; ?>',                     // Transaction ID. Required.
  'affiliation': '',   // Affiliation or store name.
  'revenue': '<?php echo $gtotal;?>',               // Grand Total.
  'shipping': '<?php echo $shipping;?>',  // Shipping.
  'tax': '<?php echo $tax;?>' // Tax.
});

<?php
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
foreach ($items as $itemId => $item)
{?>

ga('ecommerce:addItem', {
  'id': '<?php echo $order_id; ?>',                     // Transaction ID. Required.
  'name': '<?php echo $item->getName(); ?>',    // Product name. Required.
  'sku': '<?php echo $item->getSku(); ?>',                 // SKU code.
  'category': '',         // Category or variation.
  'price': '<?php echo $item->getBasePrice(); ?>',                 // Unit price.
  'quantity': '<?php echo $item->getQtyOrdered(); ?>'                   // Quantity.
});
<?php
}
?>

ga('ecommerce:send');

</script>

I wish to only get the Simple Product details and correct price, and not Configurable details or price.  So I will need a check to see if it's a configurable product to then only get the associated Simple Product details.

I don't know whether it should be parent and child, of test for configurable first.  It will be a change to the code below but I don't have the knowledge to figure this out!

Many thanks in advance :)

<?php
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
foreach ($items as $itemId => $item)
{?>


texts:
I am studying use of symlinks in Magento 2 and also read some articles on it. But I am not clear about what they are . And also what does the option Allow Symlinks in Magento 2 backend does? Can anyone offer me a proper explanation. Some of the links which I referred to are

https://alanstorm.com/magento-2-symlinks-for-modules/

https://community.magento.com/t5/Can-Magento-do/How-to-use-Magento-2-with-no-symlinks-anywhere/td-p/48402


texts: Add subscription and unsubscription date in magento

texts: i want to add subscription and unsubscription date in magento newsletter


texts: how to get customer name for a resesrvation in magento 2

texts:
good morning guys, in my case I want to retrieve the customer name which is responsible for doing a reservation, but I can't get any attribute from reservation describe me the customer name

Can anyone please tell me how to get costumer name from the reservation ? , because any reservation was done by a customer.

  this is  how do i get the current reservation :

public function getReservation()
    {
        return $this->_coreRegistry->registry('current_reservation');
    }

  this is another way , but why it throws for me an error while fetching why ?

Why there are a problems when fetching the data

  the block :

 public function getReservationCollection()
    {
        $collection = $this->_reservationCollectionFactory->create();
        $collection->addAttributeToSelect('*');
        $collection->setPageSize();
        return $collection;
    }

  the phtml file :

<?php
$res = $block->getReservationCollection();
var_dump($res);
foreach ($res as $re) {
    print_r($re->getData());
    echo "<br>";
}?>


texts:
How to override the below file in magento 1 module ?
app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php


texts: Getting a table first row from repository

texts:
I'm building my first Magento 2 module, and I'm a bit stuck.

First of all, this is what I have so far (I'm still fixing the coding standards on all the pages). https://github.com/moloni/magento2

I have a doubt about something a bit simple... How do I get the first row of the table I created?

I made a repository, created all the files for the Tokens model, and I can access the first row using the following:

$collection = $this->getCollection();
if ($collection->getSize()) {
    $this->tokensRow = $collection->getFirstItem();
}

But, since the method getCollection says it will be deprecated, what can I use to the get the first row of a table?

Every method I saw was using the getCollection mehtod, and that's why my doubt.

Also, if I want to read the first row and update the row if it exists, or create a new one if it does not, how can I do so without the getCollection?

Still learning how to properly code for Magento 2.


texts:
I'm attempting to build a module but I can't even get the url routing to work as it keeps responding with a 404. I've follow this tutorial in an attempt to get it working but I still get a 404 page every time.

http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-3-magento-controller-dispatch

This is my folder structure.

app
    code
        local
            Group
                Customnewsletter
                    etc
                        config.xml
                    controllers
                        IndexController.php

My module xml is

<?xml version="1.0"?>
    <config>
        <modules>
            <Group_Customnewsletter>
                <active>true</active>
                <codePool>local</codePool>
            </Group_Customnewsletter>
         </modules>
    </config>

config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Group_Customnewsletter>
        <version>0.1</version>
    </Group_Customnewsletter>
</module>

 <frontend>
    <routers>
        <customnewsletter>
            <use>standard</use>
            <args>
                <module>Group_Customnewsletter</module>
                <frontName>customnewsletter</frontName>
            </args>
        </customnewsletter>
    </routers>
</frontend>
</config>

IndexController.php

<?php

class Group_Customnewsletter_IndexController extends Mage_Core_Controller_Front_Action {
    public function indexAction(){
        echo 'hello';
    }

}

The module appears under System->Configuration->Advanced and i've checked my syntax and every time i go to store.local/customnewsletter/index/index/ I get a 404 response. Any help would be greatly appreciated.


texts: How to overrite cart subtotal price in order summary block magento2

texts:
can any one know that i want to update the price of the checkout page order summary Cart subtotal line.

how can i do that ?

knowckout file is render is

subtotal.html :

and it will render from

checkout_index_index.xml :

<item name="subtotal" xsi:type="array">
    <item name="component"  xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
        <item name="config" xsi:type="array">
        <item name="title" xsi:type="string" translate="true">Cart Subtotal</item>
    </item>
</item>

please let me know if any one knows about this

thanks


texts: Magento2 - cannot load custom css - via default_head_blocks.xml

texts:
UPDATE
Seems that you cannot inherit Luma.... it works properly when inheriting from blank.
github magento source says luma wasn't meant to be inherited.
Challenge is, I really like luma, but need to customize some stuff... so is there a way to do this?
Original Question:
new to Magento 2, followed the directions to make my own theme, a child of luma theme.
now, I cannot figure out why my default head blocks modification is not working.
I have put developer mode on, cleared cache, and it's not loading my custom css or the external font awesome I tried to link to, this is my code inside default_head_blocks.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <!--Custom Styles-->
    <css src="css/cvpstyle.css" />

    <!--Before-After Script-->
    <link src="js/jquery.twentytwenty.js"/>
    <link src="js/jquery.event.move.js"/>

    <!--Font Awesome-->
    <css src="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" src_type="url" />

</head>
</page>

and my folder structure:

have I structured something wrong? I cannot figure out why this won't work.
Thanks in advance for any help!
UPDATE
per suggestions below, I changed the directory structure.... still does not work, this is the new directory structure

my actual XML:

and here's the folder structure now:

UPDATE - Jan 29
I have gotten closer to the solution I believe...
I tried making another theme, and inherited from blank instead of luma, and it seems to work, I can see my css and js loaded, but there's literally NO styling on the page of course from blank.
what I wish to do is start with luma, and add some of my custom css...
here is my current XML, is there something wrong with this?
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>CVPStyle</title>
 <parent>Magento/luma</parent>
 <media>
     <preview_image>media/preview.jpg</preview_image>
 </media>
</theme>


texts:
I want to get products collection and I need to join it to several tables so I made this function
public function getProducts()
    {
        $products = $this->_productCollectionFactory->create()->addFieldToSelect('*');

        $products->getSelect()
            ->join(
                'catalog_category_product',
                'e.entity_id=`catalog_category_product`.product_id'
            )
            ->join(
                'catalog_category_entity_varchar',
                new \Zend_Db_Expr('`catalog_category_entity_varchar`.entity_id=`catalog_category_product`.category_id AND catalog_category_entity_varchar.attribute_id = (select attribute_id from eav_attribute where attribute_code = \'name\' and entity_type_id = 3)'),
                [
                    'category' => 'catalog_category_entity_varchar.value'
                ]
            )->group('sku');

        $products->getSelect()->join(
            'cataloginventory_stock_item',
            'e.entity_id =`cataloginventory_stock_item`.product_id',
            [
                'stock' => 'cataloginventory_stock_item.product_id'
            ]
        );

        return $products->load();
    }

Now I want to filter this collection such like where sku like '%'.q.'%' or stock like '%'.q.'%' or category like '%'.q.'%', I implemented it such like this but I got Warning: Illegal string offset 'attribute'
public function filterProducts($q)
    {

        $products = $this->getProducts();

        $products->addFieldToFilter(
            [
                'sku',
                'category',
                'stock'
            ],
            [
                ['like' =>  '%' . $q . '%'],
                ['like' =>  '%' . $q . '%'],
                ['like' =>  '%' . $q . '%'],
            ]

        );

        return $products;
}

What should I do to make the filter works?


texts: How to know customer's order choose which shipping method with shipment id

texts:
I developed a custom module so that customers can choose the logistics methods provided by the plugin, and these logistics methods all have a unified CarrierCode.
But how do I know if the order comes from my custom logistics method when the user tracks shipment so that I can provide them with logistics information.

May be I need to change details.phtml in module-shipping,
\vendor\magento\module-shipping\view\frontend\templates\tracking\details.phtml
.But in this page I don't know which shipping method it use,juse know $track['number'],or $shipmentId in parent page.

So,how can i get shipping method they used?


texts: How to custom code for magento as developer

texts:
What is best IDE to develop code for magento?
we have admin panel and frontend. When we say we develop/custom magento, we just develop the functions for admin panel? instead of frontend? We use admin panel to control what it will be looked like in frontend? Can we directly develop code for frontend?
Is there any documentation to describe what is the code/project file structure for magento CE 2.1.5? I am new to it, I have no idea where to start to develop it?
If a magento in not 2.x.x version, we have to upgrade it to 2.x.x version for better security issue?
Can we debug step by step for magento? If yes, how?


texts: How to edit welcome message in header file in magento 2?

texts:
I created following files,

app/design/frontend/Magestore/Sample/composer.json

{
"name": "magento/sample-module-theme",
"description": "N/A",
"require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
    "magento/theme-frontend-luma": "~100.0",
    "magento/framework": "~100.0"
},
"type": "magento2-theme",
"version": "1.0.0",
"license": [
    "OSL-3.0",
    "AFL-3.0"
],
"autoload": {
    "files": [ "registration.php" ]
}
}

app/design/frontend/Magestore/Sample/registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/Magestore/sample',
__DIR__

);

app/design/frontend/Magestore/Sample/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Magestore Sample Theme</title>
<parent>Magento/luma</parent>
</theme>

app/design/frontend/Magestore/Sample/Magento_Theme/templates/html/header.phtml

<?php
    $welcomeMessage = "Hello";
?>
<?php switch ($block->getShowPart()):
case 'welcome': ?>

        <span data-bind="text: new String('<?php echo $block->escapeHtml(__('Welcome, %1!', '%1'));?>').replace('%1', customer().firstname)">

        <span data-bind="html:'<?=$block->escapeHtml($welcomeMessage) ?>'">

<?php break; ?>

<?php case 'other': ?>
    <?php echo $block->getChildHtml(); ?>
<?php break; ?>

<?php endswitch; ?>

But changes are not reflected?


texts: Magento 2 : how to add custom grid using ui-component in admin Form Tab

texts:
I want to have a custom Grid in Admin Form tab using ui_component .

Here is my Grid ui_component for tab fieldset.

<fieldset name="assign_applicants">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Applicants</item>
                <item name="collapsible" xsi:type="boolean">true</item>
                <item name="sortOrder" xsi:type="number">30</item>
            </item>
        </argument>
        <container name="assign_products_container" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="sortOrder" xsi:type="number">160</item>
                </item>
            </argument>
            <htmlContent name="html_content">
                <argument name="block" xsi:type="object">Package_Name\Module\Block\Adminhtml\Job\AssignApplicants</argument>
            </htmlContent>
        </container>
    </fieldset>


texts: Proceed to checkout button missing from cart Page

texts:
The proceed to checkout button displays on the cart page when using the native OnePage checkout of magento (1.9.2.4). However, as soon as TM's Firecheckout module is used, the Proceed to Checkout button disappears. Important thing to note here is, that FIrecheckout is still accessible using the

  www.example.com/index.php/firecheckout/

But the button "Proceed to Checkout" is not displayed on the following page :

  www.example.com/index.php/checkout/cart/

I have tried enabling as well as disabling the native onepage checkout module, but it doesn't make any difference. As soon as I disable the Firecheckout module, the "Proceed to checkout" button returns.

Has anyone ever faced this issue, or can anyone help me out here?


texts:
I've build a module that creates a new manageable entity to Magento, including the Backend Forms.

What I now want to do is to display custom content above the form editing segment and below the title.

From what I understand I'd start by creating a new Fieldset and create a new element that is not text, textarea, image upload or whatsoever but own content. This might take place in /Edit/Tab/Form.php?

What code is needed to create a new fieldset with (dynamic) content?


texts: How to hide default system error message

texts:
I have implemented an observer controller_action_predispatch_checkout_cart_couponPost to be able to add custom discounts in certain cases without having to  create the coupon codes. So even if the coupon code is invalid, my custom coupon validation can add a discount.

Its working fine but what I want to do is hide the default error message

  "Coupon code X is not valid"

Only in cases where my custom validation is successful. I know I can edit app/code/core/Mage/Checkout/controllers/CartController.php file but I don't want to edit core files and I don't want to hide the error message when my validation is not successful.


texts: How to add a text on Homepage using module (code)

texts:
Need help writing a code for adding text on Homepage.
I'm running Magento 2 on localhost


texts:
I would like to output another name instead of "Cart" or "My Cart" on my Magento store. So here is what I did, I went to the app/locale/en_US folder and changed "Cart","My custom name", "Add to Cart","Add to My custom name" and so on.

Unfortunately this doesn't work. Can anyone tell me why and provide me with a solution or somewhere to look?


texts:
I need to get base subtotal including tax. This

Mage::helper('checkout/cart')->getQuote()->getBaseSubtotal()

will show subtotal without tax, even if config Display Subtotal is set to Including tax.

This

$totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
$totals["subtotal"]->getValue()

will show subtotal with tax (if config Display Subtotal is set to Including tax).

But I can not find any method to display base subtotal with tax. Does anybody have any idea?

tnx


texts: How to Remove index.php from Magento URL | show error 404

texts:
we follow all steps for remove index.php in url
step like:

change admin panel config > general.. > web > seo or other = YES,
.htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

When we click any menu then it directly displays 404 page!


texts: How to programmatically create a product review in Magento 2

texts: I am trying to programmatically create a product review for an existing product in Magento 2.


texts: Backend: Form like in 'Customers->Add Addresses'

texts:
I wasn't really sure how to call this kind of form element. I was trying to get a Grid within a Tab of my module but then I stumbled across the

 'Customer->Manage Customers->Add Customer->Addresses'

form, more specifically the 'Add New Address' tab which would work perfect for my module. I'm looking at the core files right now but I'm not experienced enough to separate the needed code from all the (for me) unnecessary stuff. I hope somebody can give me a hint on what is needed to accomplish something like this or a link to a tutorial/overview (I couldn't find anything). I already have a working Grid, I only need to add a tab with similar functionality like explained above.


texts:
The website is throwing a bunch of javascript errors.  They are the kind that look like jquery was not loaded properly.  These errors don't happen 100% of the time though.  I don't understand requirejs enough to understand what is going on.

This is running Magento 2 and the Pearl theme by WeltPixel.

Not sure what else would be useful, should I post the source code of the page?


texts: Magento 2 Limit Product quantity per customer

texts: In my magento store there are virtual subscription products which come as trials. I need to set maximum 1 product which is allowed to purchase by a customer. Does any one knows what is the programmatic way to do this ?


texts: Magento2: How to trigger a popup when click on My Account header link?

texts:
I want to show a popup when click on My Account header link.
As I could not find any phtml file for My Account.
Please anybody help me on this.

Any help would be appreciated.


texts: I can't run magento2 sample data after magento installation. Authentication required

texts:
I am trying to run sample data using command line. I used the following command

composer config repositories.magento composer http://packages.magento.com
composer require magento/sample-data:1.0.0-beta

But after running the script it stops at Authentication
username:
password

And the passworddon't show anything even when typing on it. Afterwards i get Authentication failed returning composer.json to previous.

Is there a way to run without authentication? or is there something am doing wrong?


texts: No (full) administrator access on backend Magento 2

texts:
After couple of weeks holiday i came back and stared in to an problem. I don't have access to the backend of Magento 2. My colleges have access and can do their work (product, inventory and ordermanagement), but full administrator access isn't possible with my account.

When I created the Magento 2 environment, i've made an back-up admin account. Also with this seperate account, i can't get in. This seperate back-up admin account isn't used for the last months..

I'am getting the following page after giving in the credentials and press login:

Hope anyone can help me out.


texts: Magento2 :getting empty customer grid with No Such Entity message after migration

texts:
After migration from Magento 1.9 to 2.1.6, I am getting empty Customer Grid in Admin Panel with No Such Entity message. I can see the customer data in customer_entity table, but grid show No such entity. I have reset and reindexes, but still same issue.
Please suggest how to resolve this issue.


texts: Magento 2 Order creates Shipment twice that causes an error

texts:
If I click the ship button in the order, sometimes I got 404 Error. I only encountered this error if I use Microsoft Edge.
In my Network Monitor, the POST request sometimes sending twice.

Is there anyone knows how to fix it?


texts: Set special “shipping” price for afterpay payment

texts:
can i configure in Magento a special shipping price for a payment solution like afterpay?

Customer gonna to make the payment
Customer can choose which payment he wanna pay with:
A (paypal) No fee
B (mastercard) Fee (2,-)
For B the customer needs to pay 2,- fee and choose B
The fee will be included the price
The customer makes his payment with the fee and the productprice

What i want is that customer MUST pay the fee when they choose for B.

Is it possible? So yes, how?


texts:
Can we use a fetched Magento collection more than once?
If Yes, then how is it implemented?
For Example:
I have an action in a controller in which I fetched all the products with its required attribute. Now I have to perform filters and sorting to that collection via AJAX.
 public function getProductCollection(){

 $collection = Mage::getModel('catalog/product')
        ->getCollection()
        ->addAttributeToSelect('a1')
        ->addAttributeToSelect('sku')
        ->addAttributeToSelect('a3')
        ->addAttributeToSelect('a4')
        ->addAttributeToSelect('...');

        return $collection;

}

Now I have another action
public function sortcollection(){
/*
    Here I want to apply filter and sorting to the collection fetched in
    above action. It this is not possible than I am open to apply filters
    and sorting in previous action as well but without fetching collection
    again.
*/
}


texts:
I have a module in which a protected variable is defined as follows:

protected $stores = array('a','b', 'c', 'd');

I want to load define this variable inside a custom block so I am trying to do this:

protected $staticBlock = Mage::getModel('cms/block')->load('custom_block')->getContent();

protected $stores = array($staticBlock);

This gives me PHP errors of course.

It really sounds like a newling question, but the real problem is that I tried to transform it into a function, but the entire code uses the variable without calling anything except the variable directly. I am really lost now and can't find a way to achieve this.

Any idea will be appreciated.

Thanks


texts: Upload optimized images to magento cloud server

texts: We have 90 optimized images that we need to upload to our production server hosted in Magento Cloud, the problem is that Magento Cloud just provides read-access only, is there a proper fast way to do this process without having to upload the images one by one on the admin?


texts: Customer created at time swaps month and day when day falls between 1-12

texts:
When looking at my customers created, I am showing a customer created on January 4, that was created on April 1.... at first I thought it was an April fools joke (no, seriously, I didn't), and then I noticed that there were some other date swaps as well

I found an answer here that gave me an idea of what is needed, but it leaves more questions.  The answer references an Inchoo blog post that has me completely lost as to where to begin with the edits.

Can anyone clarify the file structure for this specific edit and what I would need to do... the changes I tried using the blog post above created no change in functionality of the site, or customer save function, so I know I did it wrong, but at least that is better than breaking the site completely!

the core function the post seems to be editing can be found at \app\code\core\Mage\Eav\Model\Entity\Attribute\Backend\Time\Created.php, there are 3 functions on this file, and 2 are edited... so if I could just move it to a local folder (like modifying a theme file) that would be awesome as well (can I just move it to \app\code\local\Mage\Eav\Model\Entity\Attribute\Backend\Time\Created.php and make the edits there?)


texts: I'm trying to save category url as sarees/applique-work as url path but it's being saved as sarees-applique-work . How I can save / in the URL ?


texts: how to add category sub menu in product page of website magento 1.9

texts:
I would like to add sub categories like "categories & Shops" on product listing page (as displayed in below image1). Further upon hovering on these sub menus, it should display the child menus (as shown in below image2).

**


texts: Best place to add URL Rewrite during extension install

texts: I am working on an extension right now that needs to have a URL rewrite setup when it is installed. Is the best place to do this in a data install script? If not, where should this be done?


texts: How to set value of property of Class B using Plugin (Class A)

texts:
di.xml

<type name="Magento\Sales\Model\Order\Invoice">
    <plugin name="Vendor_Module::InvoiceIncrementId" type="Vendor\Module\Plugin\InvoiceSaveBefore" />
</type>

Plugin code:

public function aroundGetIncrementId(
   \Magento\Sales\Model\Order\Invoice $invoice,
   \Closure $closure
)
{
   ..
   $this->_transportBuilder->setTemplateIdentifier($emailTemplate);
   ..
}

The template ID is set in the plugin. But, it is not found in SenderBuilder.php class. Instead, $this->templateContainer->getTemplateId() in \magento\module-sales\Model\Order\Email\SenderBuilder.php returns default template.

If I set the TemplateId in plugin, how can I get it in Email\SenderBuilder.php class to send an email with Custom Template?


texts: Magento 1 with Php 7.2, add to cart error if product have option

texts:
I have Magento 1.9.3.10 with the patch for PHP 7.2 applied.
If I click "add to cart" on a product that has options and no options are selected, I get this error:

Exception: Warning: count(): Parameter must be an array or an object that implements Countable  in /var/www/html/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php on line 57 in /var/www/html/app/code/core/Mage/Core/functions.php:232
Stack trace:
#0 /var/www/html/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php(57): mageCoreErrorHandler(2, 'count(): Parame...', '/var/www/html/a...', 57, Array)
#1 /var/www/html/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php(533): Mage_Catalog_Model_Product_Option_Type_Select->validateUserValue(NULL)
#2 /var/www/html/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php(322): Mage_Catalog_Model_Product_Type_Abstract->_prepareOptions(Object(Varien_Object), Object(Mage_Catalog_Model_Product), 'full')
#3 /var/www/html/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php(410): Mage_Catalog_Model_Product_Type_Abstract->_prepareProduct(Object(Varien_Object), Object(Mage_Catalog_Model_Product), 'full')
#4 /var/www/html/app/code/core/Mage/Sales/Model/Quote.php(969): Mage_Catalog_Model_Product_Type_Abstract->prepareForCartAdvanced(Object(Varien_Object), Object(Mage_Catalog_Model_Product), 'full')
#5 /var/www/html/app/code/core/Mage/Sales/Model/Quote.php(1045): Mage_Sales_Model_Quote->addProductAdvanced(Object(Mage_Catalog_Model_Product), Object(Varien_Object), 'full')
#6 /var/www/html/app/code/core/Mage/Checkout/Model/Cart.php(268): Mage_Sales_Model_Quote->addProduct(Object(Mage_Catalog_Model_Product), Object(Varien_Object))
#7 /var/www/html/app/code/core/Mage/Checkout/controllers/CartController.php(235): Mage_Checkout_Model_Cart->addProduct(Object(Mage_Catalog_Model_Product), Array)
#8 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_CartController->addAction()
#9 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('add')
#10 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /var/www/html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#12 /var/www/html/app/Mage.php(686): Mage_Core_Model_App->run(Array)
#13 /var/www/html/index.php(85): Mage::run('', 'store')
#14 {main}


texts: How to override html for a module within custom theme?

texts:
What is the correct way to customize Braintree payment options - add image for payments card ? How to override module-braintree HTML within my custom theme?

I tried to copy form.html from

vendor/magento/module-braintree/view/frontend/web/template/payment/form.html

and customize it and paste to:

app/design/frontend/MJ/theme/Magento_Braintree/web/template/

Also tried here:

app/design/frontend/MJ/theme/Magento_Braintree/templates/html/

but the native one shows instead (I used different classes names to disgusting files). So I assume I have the wrong structure.

My goal was to add payment method images like Visa and PayPal to appear under Credit Card options. I managed to do so by editing this file:

vendor/magento/module-braintree/view/frontend/web/template/payment/form.html

Adding this code:

And my objective was achieved:

Now my question is, how to override module-braintree within my custom theme?

I was not sure how to structure folders or where to place form.htmlThis is what I tried:


texts: Magento2 : cross origin issue on sub store

texts:
I have created a sub store in magento2, but on subdomain I'm getting below error in console.

Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "https://sub.domain.com" from accessing a cross-origin frame.

at contents (https://domain.com/pub/static/version1525152785/frontend/Package/theme/en_US/jquery.js:3123:9)

Cross origin error coming for all js files.

For this I tried to change pub/static/.htaccess file to add Header always set Access-Control-Allow-Origin "*" but after this I'm getitng error Access-Control-Allow-Origin has multiple value '*, *

How to fix this issue?


texts:
There is CLI command to set up Redis as backend for Magento cache:

$ ./bin/magento setup:config:set --cache-backend=redis

Does any CLI command exist to switch off Redis as cache backend for Magento?


texts: How to edit an address from the address book of the customer using the address id?

texts:
I have to edit the address of the customer programmatically using the address id. Here I have customer id and address id of the address to be edited. I tried the following code. But it is not working.

$customerAddress = Mage::getModel('customer/address');
$customerAddress->load($data['address_id']);
$customerAddress->setCustomerId($data['customer_id']);
$customerAddress->setWebsiteId(1);
$customerAddress->setStore(1);
$customerAddress->setFirstname('test');
$customerAddress->save();

It gives following error Call to a member function getStore() on boolean in ../app/code/core/Mage/Customer/Model/Observer.php

I need to edit all fields of the address. Can anyone help on this?


texts:
I'm trying to install Magento CE 2 on AWS following this tutorial:

https://comtechies.com/how-to-install-magento-on-amazon-ec2.html

However, I cannot go to http:///magento. I've look on Google and I saw that my /app/etc/env.php does not exist.

How should I proceed to finish this installation?

Many thanks!


texts: How can I set per-website defaults in config.xml?

texts:
With custom modules I prefer to put system config settings in config.xml (the default settings part). This makes it easier when I push code from my local machine to a dev/staging/live environment as I don't need to go into admin and re-enter settings. There are other benefits too - it can be quicker to do things in a text editor and you can always have a sensible default if there is something in the config.xml for that.

I would like to do this for a multi-website Magento store that has different shipping prices for different websites (and store views). At the moment my stores are called 'euro', 'usd' and 'gbp'. The 'euro' view takes the admin defaults with no over-ride at the website level whereas 'gbp' and 'usd' views are with the over-ride at website level.

    ...
    <default>
    <carriers>
        <my_courier>
            <stuff_goes_here_such_as_price/>
            <price>15.00</price>
            ...
        </my_courier>
    </carriers>
</default>


texts: Fix for Paypal false cancellation bug, how to apply to multi-site?

texts:
We have been experiencing a bug with PayPal sending a order cancelled message to Magento, then sending a order paid message.  But because Magento got the cancelled message it cancels the order (and ignores the paid message). It was happening very rarely but it happened twice in the last week.  A few people seem to have the same issue on the magento forms with one (only) solution was to ingorre PayPal cancel message using the code (in the index.php file):

    if (strpos($_SERVER["REQUEST_URI"], '/paypal/standard/cancel') !==  false) {
header("Location: http://<your customer gets redirected here>");
die();
}

But we have 2 website running on our Magento ( different domains),  can I get it to return the homepage (base url) of the site the user is/was, using (so the get returned to the correct homepage?


texts: Bundle Product price is required after Data migration from Magento1 to Magento2

texts:
I have Migrated all data from my Magento1 website to Magento2 using Magento2 data migration tool but I am facing one issue when in Magento2 website I go to Catalog > Product and Edit any Bundle Product and try to Save the Bundle Product then it give validation error like Price is required filed.
http://prntscr.com/mptlxk

but Price should not required for bundle product as dynamic price is set to Yes
http://prntscr.com/mptl6t
So Price filed should be disabled and not required like in M1 website for bundle product its disabled and not required.

so please hlep me in this issue so I can save the bundle product without entering the price.

Thanks


texts: Is Magento the right platform for 1M products?

texts:
I need to see how Magento will perform with 1M SKUs; but I'm struggling to find a large data set of sample data to download - or find a feasible method of generating the feed for import (and the import process itself).

Does anyone know where I could download a large dataset of dummy data for import (or a sensible means to generate and import it)?
What issues do you forsee with having a catalogue size of 1M+ products?
Is there a way to share a single products DB with multiple independent stores (different companies)?


texts: Show my payment method as checked in checkout page in magento2?

texts:
I have PayPal express checkout payment, I configured it's working fine. But I want that payment checked as default after choosing the shipping method. Please tell me how can I achieve this...As per Magento default, it's not checked. I tried below link but it's not working for me. Please tell me if anything I missed.

How to show default payment method as checked at checkout page in Magento 2


texts: How to hide offline custom module of magento when total amount is more than 100 $

texts:
My module file is

<?php
namespace Inchoo\Shipping\Model\Carrier;

use Magento\Quote\Model\Quote\Address\RateRequest;
use Magento\Shipping\Model\Rate\Result;

class Example extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
    \Magento\Shipping\Model\Carrier\CarrierInterface
{
    /**
     * @var string
     */
    protected $_code = 'example';

    /**
     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
     * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
     * @param \Psr\Log\LoggerInterface $logger
     * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory
     * @param \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory,
        \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
        array $data = []
    ) {
        $this->_rateResultFactory = $rateResultFactory;
        $this->_rateMethodFactory = $rateMethodFactory;
        parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data);
    }

    /**
     * @return array
     */
    public function getAllowedMethods()
    {
        return ['example' => $this->getConfigData('name')];
    }

    /**
     * @param RateRequest $request
     * @return bool|Result
     */
    public function collectRates(RateRequest $request)
    {
        if (!$this->getConfigFlag('active')) {
            return false;
        }

        /** @var \Magento\Shipping\Model\Rate\Result $result */
        $result = $this->_rateResultFactory->create();

        /** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
        $method = $this->_rateMethodFactory->create();

        $method->setCarrier('example');
        $method->setCarrierTitle($this->getConfigData('title'));

        $method->setMethod('example');
        $method->setMethodTitle($this->getConfigData('name'));

        /*you can fetch shipping price from different sources over some APIs, we used price from config.xml - xml node price*/
        $amount = $this->getConfigData('price');

        $method->setPrice($amount);
        $method->setCost($amount);

        $result->append($method);

        return $result;
    }
}


texts: Magento1.9 Product SKU in Sales order grid

texts:
i have use default collection and change this file

  /app/code/core/Mage/Adminhtml/Block/Sales/Order/grid.php

Now replace your _prepareCollection() function to this following code

 protected function _getCollectionClass()
{
    return 'sales/order_grid_collection';
}

 protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel($this->_getCollectionClass())
            ->join(
                'sales/order_item',
                '`sales/order_item`.order_id=`main_table`.entity_id',
                array(
                    'sku'  => new Zend_Db_Expr('group_concat(`sales/order_item`.sku SEPARATOR ",")'),)
            );
        $collection->getSelect()->group('entity_id');
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

and add skus field in grid

$this->addColumn('skus', array(
            'header'    => Mage::helper('Sales')->__('Skus'),
            'width'     => '100px',
            'index'     => 'skus',
            'filter_index' => 'sku',
            'type'        => 'text',

        ));

but order count showing wrong
how can solve this issue
Thanks!!


texts:
I trying to create a shipment with track id for the order.

but it displays 404 error in chrome browser after enable bundling option in production mode.

How to solve the issue.

Thanks.

And the shipment submit call was canceled.


texts: Magento 2 How to put a rule condition into the custom admin form using the ui component

texts:
Magento 2 custom extension how to put a rule condition into the custom admin form using the ui component with data base interaction.

please refer the following rule condition image


texts: How to change Magento 2 checkout shipping radio button to dropdown

texts: I need to change the format of displaying shipping methods as radio button to dropdown.


texts: How can I change the login link to logout when customer logged in Magento2?

texts:
I have added a login link in the footer by cms like as:

    Login

As soon as customer login I want to change that in the Logout link in magento2 footer.


texts: 404 page when creating module in Magento2

texts:
I have followed exactly this to create module, but module is redirecting at 404. When I run command php bin/magento module:enable Tutorial_Example

  Unknown module(s): 'Tutorial_Example'

This error is shown in terminal, I think this is the reason for 404 redirection.

Can anyone please help.


texts:
I am trying to add Order Comments field in checkout.

I am following this Tutorial

I am using Magento 1.8

I am getting below error:

Fatal error: Call to a member function getSource() on boolean in C:\xampp\htdocs\my_store\app\code\core\Mage\Catalog\Model\Product.php on line 1390

can anyone have any idea about the error?


texts: Mage::getDesign()->getTheme('frontend') has an equivalent in magento 2

texts:
Mage::getDesign()->getTheme('frontend')

Just wondering if there is an equivalent of theme name in Magento 2?


texts: How to load the Magento 2 core (external file)

texts:
I'm creating a file outside of the public_html folder. In Magento 1.x I could access Magento Core functionality be doing this:

require_once('./app/Mage.php');
Mage::app();

Does anybody know the equivalent in Magento 2?


texts: Is it possible to use an observer to add a checkout button after product has been added to shopping cart?

texts:
I have been scratching my head for nearly three hours trying to figure out how I could add a "checkout" button to a page once a product has been successfully added to the shopping cart.

I have created a module that uses the checkout_cart_product_add_after event but I have hit a brick wall.

I there a simpler method to do this?

After some input from @Sven I scrapped the Observer method. I'm try to write an IF clause that will check if an item is in the shopping cart but not having much success IF anyone can share the correct argument to pass please let me know...

IF clause

<?php $totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); ?>
<?php if($totalItemsInCart) ?>
    <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="whatever btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><?php echo $this->__('Continue Shopping') ?></button>
<?php else: ?>
    //Nothing to delclare
<?php endif ?>


texts: Magento2 - Creating Purchase Order Grid based on Sales Order Grid

texts:
I have successfully replicated part of the default Magento Sales Order Grid to display and filter another grid, this one regrouping the purchase orders instead.

I chose to replicate the Sales Order Grid as I want my grid to be synchronized in a similar way (on grid load and via cron) from the main table containing the purchase orders.

I have encountered an issue where when I register my handle for my grid, it shows up fine but on the other side unexpectedly the original Sales Order Grid give me the error that it's handled is not registered.

This is the error given:

Not registered handle sales_order_grid_data_source

I have realized that as soon as I comment out my module_purchaseorder_grid_data_source declaration in my di.xml file below, the Sales Order Grid starts working again. Of course the Purchase Order one does not anymore.

  app/code/NameSpace/Module/etc/adminhtml/di.xml

<config>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="module_purchaseorder_grid_data_source" xsi:type="string">NameSpace\Module\Model\Resource\PurchaseOrder\Grid\Collection</item>
            </argument>
        </arguments>
    </type>

    <virtualType name="NameSpace\Module\Model\Resource\PurchaseOrder\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">purchase_order_table_grid</argument>
            <argument name="resourceModel" xsi:type="string">NameSpace\Module\Model\Resource\PurchaseOrder</argument>
        </arguments>
    </virtualType>
</config>

I'm not sure to understand what is interfering. I revised my code to see if I would be rewriting anything from Sales Order by mistake and I do not (I searched through all of my module files with different keywords). I have completely remove Magento Sales Order module and replaced it with original files in case I would have edited one by mistake while digging. I did dig up in Magento code and to find how the Sales Order Grid data source is retrieved.

This page from mage2.pro resumes it a bit:

How are the rows data retrieved for the backend's orders grid?.

If someone knowledgeable enough regarding the Sales Order Grid could point in the right direction as where the interference might be residing it would be appreciated. I did not share all of the related code but looking at the Sales Order and Sales Order Grid models one should be able to see the pattern, I have replicated it in almost the same exact way. Someone might be able to pinpoint which config/class would be more eligible to influence a completely different module (Sales) and I would be pleased to share this specific part on request.


texts: Update magento from 2.3.1 to 2.4.2 - sql error - on getting the products

texts:
So after updating magento from 2.3.1 to 2.4.2, went almost flawless, until i saw this error on the category page,
"0":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'cat_index_position' in 'order clause', query was: SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IFNULL(review_summary.reviews_count, 0) AS `reviews_count`, IFNULL(review_summary.rating_summary, 0) AS `rating_summary`, `stock_status_index`.`stock_status` AS `is_salable` FROM `catalog_product_entity` AS `e`\n INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1'\n LEFT JOIN `review_entity_summary` AS `review_summary` ON e.entity_id = review_summary.entity_pk_value AND review_summary.store_id = 1 AND review_summary.entity_type = (SELECT `review_entity`.`entity_id` FROM `review_entity` WHERE (entity_code = 'product'))\n INNER JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id WHERE (e.entity_id IN (112, 113, 114, 115, 116, 117, 118, 119, 170, 249, 250)) ORDER BY `cat_index_position` ASC\n","1":"

So im almost lost, on what to do or fix it. Anybody who has any idea?


texts:
First of all, im using magento 2.4 here. Im building a new form via the LayoutProcessor. The form in the checkout that i have is depending on the products sold. In my case im selling virtual exams which means in the checkout i need to request extra candidate info for each item sold.
In general i have all the fields on the page which works however the validation somehow is not. The fields are added like below:
[
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [
                    'customScope' => 'extraCheckoutForm',
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input',
                ],
                'provider' => 'checkoutProvider',
                'dataScope' => 'extraCheckoutForm['.$attributeSet.'][' . $item->getId() . '][' . $i . '][' . $f['name'] . ']',
                'label' => $f['label'],
                'sortOrder' => $this->sortOrderPointer,
                'validation' => [
                    'required-entry' => (bool) $f['required'],
                ],
            ]

Even all this works and the form field is rendered in the UI like this:
<input class="input-text valid" type="text" data-bind="
    value: value,
    valueUpdate: 'keyup',
    hasFocus: focused,
    attr: {
        name: inputName,
        placeholder: placeholder,
        'aria-describedby': getDescriptionId(),
        'aria-required': required,
        'aria-invalid': error() ? true : 'false',
        id: uid,
        disabled: disabled
    }" name="extraCheckoutForm[elearning][30][0][firstname]" aria-required="true" aria-invalid="false" id="M477C2H">

The problem now actually is that when i validate the form with my JS it is not validating anything since there are no validation rules on the generated input field. The validation method looks like:
validateFields: function () {
    var formSelector = '#extra-checkout-form';
    var valid = true;
    $(formSelector).validation();
    $(formSelector + ' input').each(function () {
        if (!Boolean($(this).valid())) {
            valid = false;
        }
    })
    if (!valid) {
        return false;
    }
    return true;
},

Hope that someone has an idea
Best,
Pim


texts: How to add Dynamic Table of Product from Modal

texts:
Please help me to show what products I selected in the images below.

At the bottom of "Add Products" button.

If you have any example project or article.


texts: Remove "default shipping address" from customers account

texts:
So I have removed the "shipping address" from checkout page, and only using billing information. I also want to remove the option of "default shipping address" which is in customers account.

thanks


texts: Magento2.3 generate coupon codes not generating

texts:
In Magento2.3 I create a cart price rule and then co to manage coupon codes and click the generate button after filling out the form to generate 5 codes.
I then get a message that says
Message is added to queue, wait to get your coupons soon

Yes they are never generated.


texts: Magento 2: Use Magento\Sales\Model\Order after order has been placed

texts:
I'm currently working on a custom module. I need to get order data of the order that has just been placed. The problem is, that I cannot get the data with Magento\Sales\Model\Order. It looks like the event is triggered too soon to use the Order Model. I've tried a couple of events but none seem to work. Does anyone know a solution that will work? It may be a different event, an alternative for the Order Model, or any fixes in the code.

  Observer:

<?php

namespace Vendor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;
use Psr\Log\LoggerInterface;
use Magento\Sales\Model\Order;

class OrderExport implements ObserverInterface {

    protected $_logger;

    protected $orderModel;

    public function __construct(
        LoggerInterface $logger,
        Order $orderModel
    ) {
        $this->_logger = $logger;
        $this->orderModel = $orderModel;
    }

    public function execute(\Magento\Framework\Event\Observer $observer) {
        $order = $observer->getEvent()->getOrder();

        $orderId = $order->getIncrementId();
        $orderId = ltrim($orderId, '0');
        $orderId = (int)$orderId;

        $this->_logger->info("New order: ".$orderId);

        $this->createXml($orderId);
    }

    public function createXml($orderId) {
        $this->orderModel->load($orderId);
        $orderModel = $this->orderModel;

        // It breaks on this:
        $customerName = $orderModel->getBillingAddress()->getFirstname();
    }
}

  Events:

<?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="sales_order_place_after">
        <observer name="order_export" instance="Vendor\Module\Observer\OrderExport" />
    </event>
</config>


texts: Reset super-attributes in select drop down for configurable products

texts:
Currently I have 2 select options: size and color as dropdown menus for my configurable products.  On the frontend, users can select size, then color. Options for color are greyed out accordingly if that color is out of stock for that size.

Is there a way to reset the attributes without refreshing the page? As of right now, I cannot go back up to size and change my size select since some of those are greyed out as well after choosing my color.  Is it possible to select the option "choose an option" and have it reset my choices?  I have been looking at my getJsonConfig() function and not sure where to approach this.


texts:
Magento version: 2.3.4
When I create a new shopping cart price rule (coupon code) and choose a date range like this:

Then in the coupon overview list I see this date:

So that correct, but when I open the coupon code to edit I see this date range:

I have no idea where this is coming from... Anyone a idea?


texts: Magento 2.3.3: Uncaught Error: Call to a member function getPayment() on null

texts:
In one of my templates I was using this code in Magento 2.2.3:

$order = $this->getData('order'); // This returns NULL in Magento 2.3.3
$paymentTitle = $order->getPayment()->getMethodInstance()->getTitle(); // This throws the error

After an update to 2.3.3 I am now getting the error mentioned in the header. Any idea how to fix that?

Thanks


texts:
Is it possible to call getdata() from inside the block class like this? Because as it is now, i get no data from getdata().
    class Index extends Template implements BlockInterface
{
protected $_template = "";

public function __construct(Template\Context $context, array $data = [])
{
    parent::__construct($context, $data);

    if($this->getData('template_layout') == "LPS" )
    {
        $this->_template = "widget/Image_left.phtml";

    }else if($this->getData('template_layout') == "RPS")
    {
        $this->_template = "widget/Image_right.phtml";
    }
    else if($this->getData('template_layout') == "RPWS")
    {
        $this->_template = "widget/Image_right_No_Space.phtml";
    }
    else if($this->getData('template_layout') == "LPWS")
    {
        $this->_template = "widget/Image_right_No_Space.phtml";
    }else{
        $this->_template = "widget/Image_right.phtml";

    }

  }

}


texts: Displaying price on frontend based on different attribute

texts:
Check the screen shot.

The attribute id for price[USD] is 75 and is stored in the table catalog_product_entity_decimal. The attribute ids of Price[INR] and Price[EUR] are 134 and 135 respectively and both are stored in the table catalog_product_entity_varchar. I want the value for Price[INR] to be displayed in product view page when a corresponding currency is selected from drop down list in magento header. I don't want magento to convert the values based on webserviceex rates. So I'm writing a module to achieve this.
Here is my code.

app/code/local/price/changer/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <price_changer>
            <version>0.1.0</version>
        </price_changer>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <price_changer before="Mage_Adminhtml">price_changer</price_changer>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <global>
        <models>
            <price_changer>
                <class>price_changer_Model</class>
            </price_changer>
        </models>
        <events>
            <catalog_product_select_after>
                <observer>
                    <price_changer>
                        <class>price_changer/observer</class>
                        <method>priceUpdate</method>
                        <type>singleton</type>
                    </price_changer>
                </observer>
            </catalog_product_select_after>
        </events>
    </global>
</config>

And observer.php in Model folder is like this:

<?php
class price_changer_Model_Observer {
    public function priceUpdate(Varien_Event_Observer $observer){
        $product=$observer->getEvent()->getProduct();
        $price=$observer->getEvent()->getProduct();
        if (value_id=2) {
            $price=$observer->getInfo()->getProduct();
        }
        foreach ($price as $ => $value) {
            # code...
        }
    }
}

Observer.php is incomplete. How can I connect those 2 tables in DB to observer.php, so that it can be achieved?
P.S: I'm going to put some bounties for this question very soon.