texts: How to refresh reports aggregation data on plugin install

texts:
I'm building a module where i'm adding a few extra columns to the default magento reports under Reports > Sales > Orders & Reports > Sales > Tax

I'm adding the extra columns to the corresponding aggregation tables from the module's install script. Now after adding the columns, I have to truncate the table & then aggregate all the existing data all over again. I got it working on my local with some sample data & it worked as expected.

The problem is that I added set_time_limit(0) to index.php so that it doesn't timeout & even though it worked correctly it took like 10 minutes. It might get even worse when the amount of existing data grows.

So my question is if there is any better way to do it? Maybe putting some consecutive crons that run one after other & refresh all the data in batches?

Thanks

UPDATE

I decided it would be better to just ask users to run the refresh script from the terminal. The idea here is that a user would run it from ssh & keep it running for maybe a day & all the data gets refreshed in that time.
So, working on that, I now have a file that I'm running from the command line. Below is the code (with time recording, Mage::log & echo statements stripped out)

require_once 'app/Mage.php';
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app();

$from = strtotime('-1 day');
$to   = strtotime('now');
$day = $to - $from;
do {
    try {
        Mage::getResourceModel('sales/report_order')->aggregate($from, $to);
        echo 'success.';
        $to   = $from;
        $from = $from - $day;
    } catch(Mage_Core_Exception $e) {
        echo $e->getMessage();
    } catch(Exception $e) {
        echo 'Failed due to ' . $e->getMessage();
    }
    sleep(4);
} while($to > strtotime($argv[1]));

This also works but still, it's taking forever. By judging from the logs etc. it seems that it just randomly selects days on which it has to spend 5-10 minutes & there are others that are done within seconds. The code, again, is working. But whenever it chooses to take 5-10 minutes, then during that time the server is in a crisis. Another interesting thing is that none of the queries actually failed or threw any exception. It's always a success.
Any thoughts?


texts: Magento username/password incorrect. Password retrieval not working

texts:
Tried logging in today to my Magento (localhost/magento/admin/)

Password is incorrect.

Trying to use the password retrieval, I am not receiving the e-mail with the new password. Not in spam etc...

Attemped to changed the password in phpadmin > magent > user_admin (something like that). Changed the password for my username, confirmed correct e-mail. Pressed go.

Still cannot login in.

Any suggestions?


texts: difference between collection and collectionFactory

texts:
I need the list of all the admin users.

And, both the below set of codes, provide the same result.

Code 1

public function __construct(
        \Magento\User\Model\ResourceModel\User\Collection $userCollectionFactory
    )
    {
        $this->userCollectionFactory = $userCollectionFactory;
    }

    public function getCustomData()
    {
        $userCollection = $this->userCollectionFactory;
        var_dump($userCollection->getData());
    }

Code 2

public function __construct(
    \Magento\User\Model\ResourceModel\User\CollectionFactory $userCollectionFactory
)
{
    $this->userCollectionFactory = $userCollectionFactory;
}

public function getCustomData()
{
    $userCollection = $this->userCollectionFactory->create();
    var_dump($userCollection->getData());
    exit('test');
}

My question here is, what is the difference between both these set of codes and which one is better to use and in which case we can use the other one?
And if there is any other better way to fetch the same result set?


texts: In Magento 1, you can use Mage::getVersion(). But I can't find code for getting version in Magento 2.


texts:
Im in a custom controller tying to get the order info with checkout session. There is my code.
    $order = $this->_checkoutSession->getLastRealOrder(); // Magento\Sales\Model\Order\Interceptor
    $orderId = $order->getEntityId(); // null
    $orderIncrementId = $order->getIncrementId(); // null

But actually Im getting null on $orderId and $orderIncrementId.
Seems like the order is not being correctly placed.


texts: Add a custom text field to categories in Magento 2

texts:
I want to add a new text area to my categories in Magento2, similar to this, but its for Magento 1: adding custom drop down field to category

Basically there should be a field for each category where my customer can put in some category-based SEO content. I want to echo it later on the sidebar.

How could I achieve this? Bonus points if I can achieve this with pure XML.


texts: Setting block as link using anchor tag in another block

texts: In my theme I have created block of contact-us,about-us,footer and I want to set contact-us block as link using anchor tag in footer block.  I don't know how to set this using admin panel.


texts: What table information do I need to be able to connect my database externally?

texts:
I am trying to connect my moodle site to my magento shopping cart. The enrolment plug in, in moodle is asking for my stores database info:
host, Database Name,  DB User & password which I have, but I also need

Name of the table in the database - I assume this is the customer stored data so I have entered mag_customer_entity

Username field
Password field - Which I can not find in php my admin
Password format

Does anybody know where I can find this information? I thought that using the table "mag_customer_entity" would be obvious but there is no username and password field available here, yet there is the customers email address and id number etc.

Any help with this I will be forever greatful! thanks for reading :)


texts: magento meta description not showing correctly

texts:
I am using magento 1.9 and I am having issues with the Meta Descrioptions not appearing correctly in Google results.

the homepage source it has this:

 <meta name="description" content="Maximise the aesthetic appeal and functionality of your retail business with our quality shop fittings. Browse our online range today." />

but the Google results look like:

www.mysite.com/
Banner1. Banner2. Banner3. Shopings & delivering direct from the importers!! All prices are PLUS G.S.T. Buy Direct & save today!! close. Banner1 ...

these banner1,banner2,banner3 are banner names given to the ecsso easybanner slider installed in the site .i want to display meta description instead of these contents.can any one suggest?


texts: Wishlist qty update not working in a store view

texts:
When I update the "qty" in the wishlist page
the page reloads and set the default value to "1". When I input a value above "31" it works fine.

I had the same problem with cart qty update but I fixed it using this post : https://www.apptha.com/blog/how-to-bug-fix-shopping-cart-quantity-update-in-arabic-store-view-magento/

But I still have the issue in wishlist qty update.

The issue is only in Arabic store view.

Magento ver : 1.9.0.1

sorry for my bad formatting this is my first time posting in stack exchange !


texts:
what is the equivalent event name in magento 2 for the below: controller_action_predispatch_catalogsearch_result_index

<?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="controller_action_predispatch_catalogsearch_result_index">
    <!--<observer name="controller_action_predispatch_catalogsearch_result_handler" instance="Vendor\Module\Observer\createSearchResultPage"/> -->
    <observer name="controller_action_predispatch_catalogsearch_result_handler" instance="Vendor\Module\Model\Observer"/>
                                                                            <!-- method="createSearchResultPage" attribute removed-->
</event>


texts: Getting Mage_Core_Exception with message Invalid block type

texts:
In exception.log, I am getting this error:

exception 'Mage_Core_Exception' with message 'Invalid block type: Mage_Catalog_Block_Product_Bestseller' in /home/cloudpanel/htdocs/www.example.com/app/Mage.php:595
Stack trace:
#0 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('catalog/product...', Array)
#2 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Model/Email/Template/Filter.php(169): Mage_Core_Model_Layout->createBlock('catalog/product...', NULL, Array)
#3 [internal function]: Mage_Core_Model_Email_Template_Filter->blockDirective(Array)
#4 /home/cloudpanel/htdocs/www.example.com/lib/Varien/Filter/Template.php(163): call_user_func(Array, Array)
#5 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Model/Email/Template/Filter.php(548): Varien_Filter_Template->filter('<p>{{block type...')
#6 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Cms/Block/Block.php(69): Mage_Core_Model_Email_Template_Filter->filter('<p>{{block type...')
#7 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Cms_Block_Block->_toHtml()
#8 /home/cloudpanel/htdocs/www.example.com/app/design/frontend/default/dark-night/template/page/2columns-left.phtml(57): Mage_Core_Block_Abstract->toHtml()
#9 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Block/Template.php(241): include('/home/cloudpane...')
#10 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#11 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#12 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#13 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#14 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#15 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Catalog/controllers/CategoryController.php(161): Mage_Core_Controller_Varien_Action->renderLayout()
#16 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_CategoryController->viewAction()
#17 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('view')
#18 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /home/cloudpanel/htdocs/www.example.com/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/cloudpanel/htdocs/www.example.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21 /home/cloudpanel/htdocs/www.example.com/index.php(89): Mage::run('', 'store')
#22 {main}

I am not getting where I have committed a mistake and how to start debugging this case, can anyone please help!


texts: Updated Magento, still see old version in admin

texts:
I just did a upgrade using Mage_All_Latest in the Magento Connect Manager.
it now shows 1.9.3.2 (stable) but the version at the bottom of all the admin pages shows ver 1.9.1.0. Is this anything I need to fix or worry about?


texts: Error while changing tabs in the backend

texts:
When I try to switch in the backend between the tabs I get the page with this error:

  There has been an error processing your request

This happens not with all the tabs only with "Category" in the Products section.

Could you please show or help me to fix this?

Added link to the complete error log file, because its too long to post as is I've uploaded it to the cloud:

https://www.dropbox.com/s/grq42dzf794xhir/error.txt?dl=0


texts: Magento2 cannot override class Magento\GroupedProduct\Model\Product\Type\Grouped?

texts:
I was trying to override the above class (Magento\GroupedProduct\Model\Product\Type\Grouped)

Below is my app/code/Best/CustomGrouped/etc/adminhtml/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\GroupedProduct\Model\Product\Type\Grouped" type="Best\CustomGrouped\Model\Product\Type\Grouped"/>
</config>

And below is the model class app/code/Best/CustomGrouped/Model/Product/Type/Grouped.php

<?php
namespace Best\CustomGrouped\Model\Product\Type;

class Grouped extends \Magento\GroupedProduct\Model\Product\Type\Grouped
{
    public function getAssociatedProducts($product)
    {
        // Do something
    }
}

I debug through the code, but it still goes to the core class rather using my overridden one. I do not want to use a plugin. I just want to know what am I missing here when overriding the class Magento\GroupedProduct\Model\Product\Type\Grouped

Any suggestions would be appreciated.

P.S. : I already checked with clearing the cache, generation etc. in var folder. But it didn't worked. I'm using Magento EE 2.1


texts: PayPal Express integration isn't working when I enable the term and condition

texts:
I am using Magento ver. 2.1.9

I have integrated with PayPal express.but when I enable term and condition, the PayPal is not working.

please give me a quick solution.


texts: compile less files with grunt don t work!errors with EXEC command

texts:
After creating my theme I'm trying to compile less files.
but I'm having errors when : grunt exec:exercise1.
I'm using a windows machine.


texts:
I have implemented multiple image upload using the following code.

   <field name="press_images">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">press_images</item>
                <item name="label" xsi:type="string" translate="true">Image</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">imageUploader</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                <item name="isMultipleFiles" xsi:type="boolean">true</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                </item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="pressfeature/image/upload"/>
                </item>
            </item>
        </argument>
    </field>

I used https://github.com/Turiknox/magento2-sample-imageuploader way to upload images. The image uploading works fine. When you browser the image and choose it. Then a controller gets fired which uploads all images in temp folder using an ajax call. When i click save button the image data and other data is send correctly.

My question is how should i save this filename in database so when i click edit i should see both images in edit form.


texts:
I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank.

I want to add a My cart link to the top links:

Clicking this link should make the Ajax cart visible. I have displayed on the page this way:

<referenceBlock name="top.links">
    <block class="Magento\Framework\View\Element\Html\Link" name="mycart.link" after="register-link">
        <arguments>
        <argument name="label" xsi:type="string" translate="false">My Cart</argument>
        <argument name="path" xsi:type="string" translate="false">checkout/cart</argument>
        <argument name="class" xsi:type="string" translate="false">my-cart-link</argument>
        </arguments>
    </block>
</referenceBlock>

I have only kept the My Wish List link inside the top links block:

<referenceBlock name="catalog.compare.link" remove="true" />
<referenceBlock name="header" remove="true" />
<referenceBlock name="authorization-link" remove="true" />
<move element="wish-list-link" destination="panel.top.links" />

A pastebin with the full default.xml file can be seen HERE.

Is there a piece of XML code that would put the My cart link near the Wishlist?
Also, how can I put a "pipe" separator between them?


texts: Magento 1.9 Get price from catalog price rule to a SKU programmatically

texts:
In Magento, we can use $product->getSpecialPrice() to get the discount price which is set under product view.

Is there a way to get the discount price for a SKU from Catalog Price Rule programmatically?


texts: Javascript file 404s when loaded via Require JS alias

texts:
I've ran into a strange problem where a custom javascript file 404s when loaded via a RequireJS alias but it works fine when loaded directly.

This does not work

Require JS

var config = {
    map: {
        '*': {
            recentlyViewedCarousel: 'Magento_Reports/js/recently-viewed'
        }
    }
};

Template

File: app/design/frontend/Vendorname/theme/Magento_Reports/templates/widget/viewed/column/viewed_images_list.phtml

<?php if ($exist): ?>
    <script type="text/x-magento-init">
        {
            "*": {
                "recentlyViewedCarousel": {}
            }
        }
    </script>
<?php endif; ?>

Error

GET http://localhost:3000/static/frontend/Vendorname/default/en_GB/recentlyViewedCarousel.js 404

require.js:166 Uncaught Error: Script error for: recentlyViewedCarousel

Yet this does work

Template

File: app/design/frontend/Vendorname/theme/Magento_Reports/templates/widget/viewed/column/viewed_images_list.phtml

<?php if ($exist): ?>
    <script type="text/x-magento-init">
        {
            "*": {
                "Magento_Reports/js/recently-viewed-carousel": {}
            }
        }
    </script>
<?php endif; ?>

The path is the exact same, the only difference is the method that does not work uses a Require alias and the method that does work directly references the file.

I have done this exact same thing as part of the Magento_Theme module and it works fine.

I'm happy with the workaround but I'm intrigued as to what's causing this.

This template is loaded via the CMS recently viewed widget inside a static block, so it may be a bug where Require aliases do not work with CMS widgets?


texts:
I'm using magento 2.3 to create a custom module, i tried to create database tables for my custom module in etc/db_schema.xml like this:

    <column comment="Entity Id" identity="true" name="province_id" nullable="false" padding="6" unsigned="false" xsi:type="smallint"/>
    <constraint referenceId="PRIMARY" xsi:type="primary">
        <column name="province_id"/>
    </constraint>
    <column length="255" name="name" nullable="true" xsi:type="varchar"/>

    <column comment="Entity Id" identity="true" name="city_id" nullable="false" padding="6" unsigned="false" xsi:type="smallint"/>
    <constraint referenceId="PRIMARY" xsi:type="primary">
        <column name="city_id"/>
    </constraint>
    <column name="province_id" nullable="true" xsi:type="integer"/>
    <column length="255" name="name" nullable="true" xsi:type="varchar"/>
    <column length="255" name="type" nullable="true" xsi:type="varchar"/>

there are 2 new tables which is province and city , province_id field is the primary key of province table, i also put the province_id field in city table , but for now that field does not refer as foreign key to province table, how can i make the province_id in city table as foreign key that refers to province table province_id ?


texts: Add Pagination To Catalog Search Results REST API: Magento 2

texts:
I am using this API for search:

http://domain.com/index.php/rest/V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][0][filters][0][field]=search_term&searchCriteria[filterGroups][0][filters][0][value]=life

The response is:
- Total results is 7
I need to get results in pagination mode so I updated the API to become:

http://domain.com/index.php/rest/V1/search?searchCriteria[requestName]=quick_search_container&searchCriteria[filterGroups][0][filters][0][field]=search_term&searchCriteria[filterGroups][0][filters][0][value]=life&searchCriteria[current_page]=1&searchCriteria[page_size]=5

The response is:
- Total results is 5
- Current page is 1
If I changed the current page 2, the response supposed to be:
-Total results is 2
- Current page is 2
But, I got the same result in the page 1.


texts: How to create and display Featured Product on Home Page

texts:
I want show Featured products on my store home page. I added all code but don't see anything on the home page.

Please see the image and help me to fix this

I followed the guides here to create 'featured product' attribute,
https://kartikmaniyar.wordpress.com/

This is the template code:

<?php echo $this->__('Featured products') ?>

<?php
$_helper = $this->helper('catalog/output');
$storeId = Mage::app()->getStore()->getId();
$catalog = $this->getLayout()->createBlock('catalog/product_list')->setStoreId($storeId);

$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('*')
->addAttributeToFilter(array(array('attribute' => 'featured_product', 'eq' => true)));
?>

<?php if(!$collection->count()): ?>

<?php echo $this->__('There are no featured products at the moment.') ?>

<?php else : ?>

<?php $_collectionSize = $collection->count(); $_columnCount = 4; $i = 0; ?>
<?php foreach($collection as $_product): ?>

<?php $_product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($_product->getId()); ?>
<?php if ($i++%$_columnCount==0): ?>

<?php endif ?>

<a href="<?php echo getCategoryInProductUrl($_product) ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

<a href="<?php echo getCategoryInProductUrl($_product) ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
<?php endif; ?>
<?php echo $this->getPriceHtml($_product, true) ?>

<?php if($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $catalog->getAddToCartUrl($_product) ?>')">
<?php echo $this->__('Add to Cart') ?>
</button>
<?php else: ?>

<?php echo $this->__('Out of stock') ?>

<?php endif; ?>

<?php if ($this->helper('wishlist')->isAllow()) : ?>

<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"><?php echo $this->__('Add to Wishlist') ?>

<?php endif; ?>
<?php if($_compareUrl=$catalog->getAddToCompareUrl($_product)): ?>

|
<a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?>

<?php endif; ?>

<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>

<?php endif ?>

<?php endforeach ?>

<?php endif ?>


texts: How do I set up cron job in Magento for Google product feed?

texts:
I have installed following Magento extension on website.

http://www.magentocommerce.com/magento-connect/cpc-strategy-feed-exporter-9392.html

They have given following instruction to set up cron job. If cron job will set up perfectly then and only I can create perfect Google product feed with help of this Magento extension.

I have CPanel of website and able to see Cron Job section over there. But, I am confused to add command in Command text field.

What exactly Command I require to add over there before click on Add New Cron Job. You can find out attachment to know more about it.

Instruction Given By Magento Extension Developer

You can add a cronjob easily from the Direct control panel. Please follow the steps below in order to setup the cronjob.

Login to Direct control panel
Click on 'Cron Jobs' option in the home page of Direct Admin control panel.
From that page you can setup the time interval at which the cronjob should be executed.

Basically, to apply cronjob to Magento,

add */5 * * * * followed by command /usr/local/lsws/fcgi-bin/lsphp5

/home/user/domains/mydomain.com/public_html/cron.php

in the space provided.

This will execute the cronjob in every 5 minutes. To execute cron job in 5th minute of every hour you should add 5 * * * * followed by above command.

Make sure that you add each information in the box provided correctly.

I have set up cron job on CPanel as follow. But, It's not working. Can you please help me to fix this issue?


texts: Magento 2: How to Change Default Captcha Font, Color & Background

texts:
In Mangeto 2 We have default Captcha, which is not easily readable.

So how to change/customize Font Name it's Color & Background


texts: Magento 2 Add Column To Sales Order Grid Issue

texts:
I am facing layout issue when I added new column in sales order Grid. For some reason filter and options are displaying below grid.

Please Refer Screenshot

My Code How I added the column.

etc/module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Namespace_Modulename" setup_version="1.0.0"/>
    <sequence>
        <module name="Magento_Sales" />
    </sequence>
</config>

view/adminhtml/ui_component/sales_order_grid.xml

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="sales_order_columns">
        <column name="my_custom_column">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="sorting" xsi:type="string">desc</item>
                    <item name="label" xsi:type="string" translate="true">My Custom Column</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

etc/di.xml

<virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid">
    <arguments>
        <argument name="columns" xsi:type="array">
            <item name="my_custom_column" xsi:type="string">sales_order.my_custom_column</item>
        </argument>
    </arguments>
</virtualType>

My column was added but now I am facing this layout issue.


texts: Magento2 what scopes for observer exist?

texts:
I know I can have a events.xml directly in etc, in etc/frontend and etc/adminhtml. If I want to regsiter an observer for the event sales_order_save_before it does either work in etc/frontend nor in etc/adminhtml. Do I have to place it globally in etc or is there enother specific scope for REST calls?

Can I find a list of all existing scopes somewhere?


texts: Magento2 data migration faild at Map Step with message Record structure does not contain field points_action

texts:
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: Url Rewrite Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: Log Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: Ratings Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: ConfigurablePrices step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: OrderGrids Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: Tier Price Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: integrity check][step: SalesIncrement Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:39][INFO][mode: data][stage: setup triggers][step: Stage]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:43][INFO][mode: data][stage: data migration][step: EAV Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:46][INFO][mode: data][stage: volume check][step: EAV Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:46][INFO][mode: data][stage: data migration][step: Customer Attributes Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:59][INFO][mode: data][stage: volume check][step: Customer Attributes Step]: started
100% [============================] Remaining Time: < 1 sec
[2018-10-07 04:21:59][INFO][mode: data][stage: data migration][step: Map Step]: started
21% [=====>----------------------] Remaining Time: 3 mins
[2018-10-07 04:22:52][ERROR]: Record structure does not contain field points_action


texts: How to filter category list by custom product attribute in Magento

texts:
I have two different headers in my Magento one for retail shop and second is for commercial shop in same store view. In both header Product category will be same.

Condition #1 :- In retail shop when we click on "Products" category then it will be list all products.
Condition #2 :- when I will change click on commercial shop header then it will be show only commercial products I have assigned custom attribute for it.
Is this possible ?

I found code for loaded product collection in this file \app\code\core\Mage\Catalog\Block\Product\List.php can we add attribute filter in this function ?

protected function _getProductCollection()
    {
        if (is_null($this->_productCollection)) {
            $layer = $this->getLayer();
            /* @var $layer Mage_Catalog_Model_Layer */
            if ($this->getShowRootCategory()) {
                $this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
            }

            // if this is a product view page
            if (Mage::registry('product')) {

                // get collection of categories this product is associated with
                $categories = Mage::registry('product')->getCategoryCollection()
                    ->setPage(1, 1)
                    ->load();

                // if the product is associated with any category
                if ($categories->count()) {
                    // show products from this category
                    $this->setCategoryId(current($categories->getIterator()));
                }
            }

            $origCategory = null;
            if ($this->getCategoryId()) {
                $category = Mage::getModel('catalog/category')->load($this->getCategoryId());
                if ($category->getId()) {
                    $origCategory = $layer->getCurrentCategory();
                    $layer->setCurrentCategory($category);
                    $this->addModelTags($category);
                }
            }
            $this->_productCollection = $layer->getProductCollection();

            $this->prepareSortableFieldsByCategory($layer->getCurrentCategory());

            if ($origCategory) {
                $layer->setCurrentCategory($origCategory);
            }
        }

        return $this->_productCollection;
    }


texts: Magento 2 Update product additional option added in add to cart

texts:
I have configurable product in my website and I added the product additional option in add to cart to hold the custom value, Now on cart page I want to allow the user to update those additional option value.

I created a custom controller to handle the edit action, But here the value updated by the user is not reflecting into the cart.

Please give me your suggestion to fix the issue, Below is my code.

My Observer code

catalog_product_load_after:

public function execute(\Magento\Framework\Event\Observer $observer) {
        // Check and set information according to your need
        if ($this->_request->getFullActionName() == 'checkout_cart_add') { //checking when product is adding to cart
            $post = $this->_request->getParam('personalized');

            $additionalOptions = [];
            $additionalOptions[] = array('label' => "labelVal1", 'value' => 'Text1');
            $additionalOptions[] = array('label' => "labelVal2", 'value' => 'Text2');

            if (count($additionalOptions) > 0) {
                $observer->getProduct()->addCustomOption('additional_options', serialize($additionalOptions));
            }
        }
    }

The above code is working fine, I am able to add these additonal option in cart and it's displaying in cart page.

Now for updating on cart page I have done the following code which is not working.

$quoteObj = $this->_cart->getQuote();

                    $item_id = 201;
                    $item = $quoteObj->getItemById($item_id);

                    if (!empty($item)) {

                        $additionalOptions = [];

                        ### Setting up additional options
                        $additionalOptions[] = array('label' => "labelVal1", 'value' => 'Text3');
                        $additionalOptions[] = array('label' => "labelVal2", 'value' => 'Text4');

                        if (count($additionalOptions) > 0) {

                            $item->getProduct()->addCustomOption('additional_options', serialize($additionalOptions));
                        }

                        $item->getProduct()->setIsSuperMode(true);
                        $item->save();
                    }


texts: magento 2 : Add new attribute button not showing in Product Attributes Grid

texts: In my Magento store Add new Attribute button  not showing when I go to stores>product>attribute grid open but no showing Add New Attribute button.


texts: Tax free for specific products for users in a customer group

texts:
I have setup a customer group "Tax Exempt", which works fine but it only works for ALL products.

I want the users in "Tax Exempt" to only receive tax free on specific products. Is there a way to do this out of the box?

This is exactly what I'm looking for.

User 1 : Customer Group: (Tax Exempt)

Product 1: Charge Taxes for Customer Group: (Tax Exempt)

Product 2: No Taxes for Customer Group: (Tax Exempt)

Product 3: Charge Taxes for Customer Group: (Tax Exempt)

Etc..


texts: Magento 2 - How to Overwrite Default Translation Core en_US Dictionary Package

texts:
I want to change the word "Magento" to "Magento 2 CE" for the Default Translation Core en_US Dictionary Package.
How to achieve this without overwrite Magento's core functionality directly at vendor/magento/< module-name >/i18n/en_US.csv and what is the best way to do this?

I need this only for the adminhtml Core and Custom Modules.


texts: How to add fee to All-In-One Paypal Payment Method for specific customer group

texts:
I've searched but with no success, I need to add a 3.5% fee to Paypal buyers if it's a B2B sale, basically depending on the customer group.
I've seen a lot of solutions to pre 2.3 but very few to a version after that, and even less that depend on costumer group.
I checked some extensions but the ones I checked worked fine with all payment types but All-In-One never show to add a fee.
Basically I don't even know where to start. Am I seeing this the wrong way?
Any solution to this?
Best regards,
Rui Silva


texts: Incomplete shipping info during checkout

texts:
We have an intermittent issue where shipping info is missing the ship to name or province.
Less than 5% of our order is missing one of the lines. Ship-to name isn't a big deal, but when the province is missing tax do not calculate at all.vWhere should I look to find the problem?


texts: Magento 2 - Admin Grid Listing with Third Party API

texts:
I created admin grid according to devdocs guide. But my requirement is to list third party API data into admin grid. Let's take example of https://jsonplaceholder.typicode.com/users API. How I can list these users in magento admin grid.

I just need a clue to get this done.

Thanks in advance.


texts: How to allow ordering of is_in_stock = 0 products?

texts:
I'm using a popular dropship module that uses the Magento inventory as the local inventory and when an item is not available locally (is_in_stock = 0) items get assigned to various vendors. So the is_in_stock = 0 status needs to be preserved and not just overwritten to return true.

What should be changed in Magento so that is_in_stock = 0 can be purchased?

By Default - if you try to add an item  with (is_in_stock = 0) to your cart, Magento will stop you with this message: This product is currently out of stock.

I found the 2 files that trigger that message.

app\code\local\Mage\CatalogInventory\Model\Stock\Item\Item.php
app\code\local\Mage\CatalogInventory\Model\Observer.php

By modifying the observer.php, I'm able to successfully add an is_in_stock = 0 item to the cart and check out but I'm not sure this is the best way. I also noticed when viewing the order in the admin area, the item details don't show up but the item totals do.

I just added one line of code to the observer.php that skipped the step which checked for if (!$stockItem->getIsInStock().


texts: Products are not showing in category Magento 2

texts:
I am facing an issue that categories are not showing products. Some categories are showing product but I assigned 3 products to a category and it's showing me only 1 and some categories are not showing a single product. I checked

  Product status as Enabled
  Product Visibility as catalog, search
  Product quantity > 0
  Product inventory as In Stock
  Product price > 0

For category :

  Is Active as Yes
  Display Mode as Product Only
  In the category products tab, it's showing all the products that are assigned to the category.

But it is not showing on the category page on front-end.

I am using SM Market theme.

Can anyone help to get this issue fixed?


texts: How to Import Configurable product price with his simple product variant

texts:
I want to import configurable product price and his varients.
I created Data Flow profile with following variants...I used sku and price...attribute to export....then after some modification..i import them....but price is coming in backend....but in fronted only configurable product price is coming on all....I want to Update configurable product price  with simple....
my excel sheet image is bellow....

so i want to know that how to update price of existing product if that is configurable.....with simple variants


texts: How can I set Comment box as Required field In Checkout Page Magento 2

texts:
I have purchased one extension for Delivery date and comment box.
Now I want to set Comment Box Mandatory, I have tried I think it uses Knockout JS so I am unable to set it mandatory.
Any Help.

My Code:-

            <input readonly="readonly" id="shipping_arrival_date" class="shipping_arrival_date"
                   type="text" size="17" name="shipping_arrival_date"
                   data-bind="afterRender: initDate()"/>

            <select id="delivery_time_slot"
                    data-bind="options: listTimeSlot(),
                        optionsText: function(item) {
                            return item
                        },
                        optionsValue: function(item) {
                            return item
                        },
                        optionsCaption: $t('Please select delivery time slot')">
            </select>

            <textarea id="shipping_arrival_comments" class="shipping_arrival_comments"
                   type="text" size="17" name="shipping_arrival_comments"></textarea>


texts:
I have a problem with default checkout in Mangeto, customers can't register, even if they complete all fields in the checkout Billing section I have this error - Invalid email address. I try to install any other extensions like IWD and I have the same error.

I check with firebug: and in the Response I have this:

{"error":-1,"message":"Invalid email address \"\"."}

The error is look like in the following image:


texts: magento2 database changes details in each update

texts:
Is there a place we can keep track of magento2 database table each time it's updated. I found this would be helpful for people who already start using magento2. Simplest scenario, user can backup the whole database where there are already hundreds of products and store configuration and re-use it safely on new magento version.

Due to the change of database schema, simple dump and import the whole database from old version magento to new version magento would sometimes break integrity. Therefore, knowing which table schema changed in each certain update is necessary to avoid data corruption and thus remain integrity.

If the above hard to understand what it means, then here is a real world question: How Can I import the whole database backup file to new magento installation for products/store configuration etc. data without break the new magento system?


texts: product quantity is not added more than one product in magento1

texts:
In magento1.9 If I will try to add product more than 1 item then item is added in cart only 1 item.
I have checked admin configuration is fine but I am unable to to add more than one items in cart.

please help me if any one have this solution.


texts: Call module on product-page with attribute value

texts:
I have developed a module and want to call this module on product-page with custom-attribute.

I want to call this module on specific product, not on all products so to do that i will create a custom attribute and put the code in attribute on product-edit-page.  That module display only on specific product.

How can I achieve this using magento standard?

Any help will be appreciated.


texts: Maximum function nesting level of '1000' reached, aborting?

texts:
I have created custom admin module it's showing empty page without adding <stores/> tag in config.xml file if I adding <stores/> tag it's returning an error.

error is:

Fatal error: Maximum function nesting level of '1000' reached, aborting! in C:\xampp\htdocs\magento\app\Mage.php on line 185

//config.xml file

<stores>
        <admin>
            <design>
                <package>
                    <name>default</name>
                </package>
                <theme>
                    <default>Department</default>
                </theme>
            </design>
        </admin>
    </stores>

Can you tell my bug where it is?

thanks in advance.


texts: Magento 2 - Admin Breaks Frequently if we do not clear the cache for longer time

texts:
I am getting a very strange issue on my live site. If we do not clear the cache for longer time such as 2 to 3 days, any admin page gets broken.

After clearing the cache it resolves issue but it is too frequent.

Have anyone faced this kind of issue?

Varnish and Redis are installed in my site. Does any of these creates the issue?


texts: Different/Custom page layout for specific category/products

texts:
I encountered the situation where I needed to use a slightly different/modified view.phtml, list.phtml and page template for specific category, so I found the following solution:

I had used the following code (which I inserted in Catalog -> Manage Categories -> Custom Layout Update) and I set up the option: Applay to Product to Yes!

Here is my 1rst part of code and explanation:

<reference name="product_list">
<action method="setTemplate"> <template>catalog/product/list_custom.phtml</template></action>
</reference>

Above code is working great and because I wanted to have a slightly different list view templajt I created a new file called list_custom.phtml and there make some changes.

Here is my 2nd part of code and explanation:

<reference name="product.info">
<action method="setTemplate"> <template>catalog/product/view_custom.phtml</template></action>
</reference>

Also, above code is working great and because I wanted to have a slightly different view templajt I created a new file called view_custom.phtml and there make some changes. This is OK!

I, also, use the following code:

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

Here is where I need help :(

Above code is listening all the products as I want to, but when I click on the product I want that product (from specific category) to have different/custom page layout! Now, it is opened in custom_list.phtml templejt.


texts: Email-link Downloadable product linked with Configurable Product

texts:
I have a Configurable Product with Associated Products (Downloadable product(s)). When I place an order I want to receive an email with the links to the Downloadable product(s).

How can I set this in Magento?

I have tried:

Changed the layout in the sales.xml app/design/frontend/base/default/layout/sales.xml
Changed the template in app/design/frontend/base/default/template/email/order/items/order/default.phtml


texts: Layout XML block rendered twice in Magento skin

texts:
I'm having a bit of trouble with a custom layout block which I'm trying to add to the head.phtml file of my theme. Basically, I'm trying to add extra favicon definitions to the header of my document.

In my local.xml file, I've added the lines:

<default>
    <reference name="head">
        <block type="core/template" name="favicon.extra" as="favicon.extra" template="page/html/head/favicon-extra.phtml" />
    </reference>
</default>

And then inside head.phtml, I'm calling this as a childHtml template as:

<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php echo $this->getChildHtml('favicon.extra') ?>

The problem is that the block is rendered twice, in two different spots:

Underneath the other favicons, as per the head.phtml getChildHtml call, and
After the other scripts in the header

The desired outcome is that I only want the first of these two to render.

From what I've read, I think this has to do with that particular block/reference being automatically rendered via the toHtml output - is this correct?

If so, is there a better/correct way to accomplish what I'm trying to do here? Is there another way to remove the second render?

Any help possible is much appreciated.

Note: apologies if this is considered bad practice but I'm reposting a question I posted on StackOverflow (https://stackoverflow.com/questions/25348878/layout-xml-block-rendered-twice-in-magento-skin) as I thought this might be a more appropriate forum.


texts: Adding a manufacturer to a virtual product?

texts:
I noticed that the options for manufacturer disappears for downloadable and virtual products. Is there anyway to change the code to override this restriction in magento 1.8.1?

Thanks


texts: Magento2 : admin grid action column position deviation

texts: When I select multiple columns, the action is in the wrong position


texts: Why does this require "..path" is returning a fatal error (PHP)?

texts:
my question is simple but I have not found a form to solve it. I am trying to include a library located on the magento's module which I am developing.

$simple_excel_path = Mage::getBaseDir('code')."/local/Javi/libraries/SimpleExcelLibrary/src/SimpleExcel/SimpleExcel.php";
echo $simple_excel_path;
require $simple_excel_path;

This code returns the following error:

(echo) this route is correct.
/home/javiertxu/Documentos/webs/magentoabc/app/code/local/Javi/libraries/SimpleExcelLibrary/src/SimpleExcel/SimpleExcel.php

(error) but the require function is going to another site
Fatal error: require(): Failed opening required '/home/javiertxu/Documentos/webs/magentoabc/app/codelocal/Javi/libraries/SimpleExcelLibrary/src/SimpleExcel/SimpleExcel.php' (include_path='/home/javiertxu/Documentos/webs/magentoabc/app/code/local:/home/javiertxu/Documentos/webs/magentoabc/app/code/community:/home/javiertxu/Documentos/webs/magentoabc/app/code/core:/home/javiertxu/Documentos/webs/magentoabc/lib:.:/usr/share/php') in /home/javiertxu/Documentos/webs/magentoabc/app/design/adminhtml/default/default/template/massiveupdatingproducts/massiveupdatingproductsbackend.phtml on line 5

This is the directory:

What I should do?

Thanks


texts: I'm looking for the exact SQL query that lists products - or at least a list of tables which it hits. I was looking for it in the source code, but could not find it.


texts: Tree categories from products collection

texts:
If I have a collection like this:

$collection = Mage::getResourceModel('catalog/product')
   ->getCollection()
   ->addAttributeToFilter('my_custom_attribbute','my custom value');

What is the best method to extract the category tree from this collection? (Maybe changing the collection with some joins)

- Category 1
  -- Sub 1
  -- Sub 2
- Category 2
  ...


texts:
As part of an exercise I am trying to list all users email from my database on one page. So far the closest i've got is

$user = mage::getModel('customer/customer')->getCollection()->getData();

returns

array
0 =>
array
  'entity_id' => string '1' (length=1)
  'entity_type_id' => string '1' (length=1)
  'attribute_set_id' => string '0' (length=1)
  'website_id' => string '1' (length=1)
  'email' => string 'john.doe@example.com' (length=20)
  'group_id' => string '1' (length=1)
  'increment_id' => string '000000001' (length=9)
  'store_id' => string '1' (length=1)
  'created_at' => string '2007-08-30 23:23:13' (length=19)
  'updated_at' => string '2008-08-08 12:28:24' (length=19)
  'is_active' => string '1' (length=1)
  'disable_auto_group_change' => string '0' (length=1)
1 =>
array
  'entity_id' => string '2' (length=1)
  'entity_type_id' => string '1' (length=1)
  'attribute_set_id' => string '0' (length=1)
  'website_id' => string '1' (length=1)
  'email' => string 'tony09uk@gmail.com' (length=18)
  'group_id' => string '1' (length=1)
  'increment_id' => null
  'store_id' => string '1' (length=1)
  'created_at' => string '2013-07-19 14:31:00' (length=19)
  'updated_at' => string '2013-07-19 14:31:00' (length=19)
  'is_active' => string '1' (length=1)
  'disable_auto_group_change' => string '0' (length=1)

but I only want their emails to be listed I have tried the magic getters and setters but noluck (or at least not the way ive used them). I have also tried

    $user = mage::getModel('customer/customer')->getCollection()->load();

and

    $user = mage::getModel('customer/customer')->getCollection()
                                               ->addAttributeToSort('email', 'ASC');

and

$user = mage::getModel('customer/customer')->getCollection()->getEmail()->getData();

and

$user = mage::getModel('customer/customer')->getCollection()->getData();
echo $user->getEmail();

as well as several other variations, now I have got to the point that i am just randomly sticking commands in in the the hope they work, which I do not like doing.

How do I display the email for all my users? (I hope i'm not to far off the mark)


texts:
I made a simple module wich create a simple table.
This is my module.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Tutorial_TutorialTable" setup_version="1.0.0" active="true">

</module>
</config>

This is my InstallSchema.php under Tutorial/TutorialTable/Setup/

<?php

namespace Tutorial\TutorialTable\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;

    class InstallSchema implements InstallSchemaInterface
    {
        public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
        {
            $installer = $setup;
            $installer->startSetup();

            // Get tutorial_simplenews table
            $tableName = $installer->getTable('tutorial_simplenews');
            // Check if the table already exists
            if ($installer->getConnection()->isTableExists($tableName) != true) {
                // Create tutorial_simplenews table
                $table = $installer->getConnection()
                    ->newTable($tableName)
                    ->addColumn(
                        'id',
                        Table::TYPE_INTEGER,
                        null,
                        [
                            'identity' => true,
                            'unsigned' => true,
                            'nullable' => false,
                            'primary' => true
                        ],
                        'ID'
                    )

and so on...

The table is correctly created.

Now I want to use UpgradeData.php to insert into table something and I add UpgradeData.php under Tutorial/TutorialTable/Setup

<?php

namespace Tutorial\TutorialTable\Setup;

use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;

class UpgradeData implements UpgradeDataInterface
{
    public function upgrade(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $setup->startSetup();
        if (version_compare($context->getVersion(), '1.0.1') == 0) {
            // Get tutorial_simplenews table
            $tableName = $setup->getTable('tutorial_simplenews');
            // Check if the table already exists
            if ($setup->getConnection()->isTableExists($tableName) == true) {

.. add some data in $data array .. and then

   foreach ($data as $item) {
                    $setup->getConnection()->insert($tableName, $item);
                }
            }
        }

        $setup->endSetup();
    }
}

Si i edit the setup_version in my module.xml

setup_version="1.0.1"

and then i run

  php bin/magento setup:upgrade

And all module is correctly load but i don't have any data in my table.
Where i'm wrong?
Thanks in advice.


texts:
So normally when implementing FPC we'll holepunch certain blocks out that have dynamic data. What I can't seem to figure out, is there not a way to holepunch a url. So for example if we have /index/index with the following:

class Namespace_Module_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        $jsonArray = array('time'=>time());
        $response = Mage::helper('core')->jsonEncode($jsonArray);
        $this->getResponse()->setBody($response);
    }
}

Obviously with FPC enabled we'll always get the same JSON. Is there a way to holepunch a URL so that we can just always return up to date times? (Obviously I'm not using Magento just to return times, but it's a good example of dynamic data)

One alternative I can think of is to just create a block that will house the json through maybe a text block or something, but I was wondering if there was some way to do this without actually constructing a block. (Theoretically version shouldn't matter? But if it does let's say EE 1.13)


texts: Magento 2: Paypal Express Checkout: We can't place the order

texts:
I'm using Magento 2 CE Version 2.1.2. Facing strange issue. My website is live.

Using Paypal Express Checkout. We are using CDN & SSL.

Out of 100 Customers 10 Customers will face above kind of issue. When i turn on Debug Mode ON

I have below ones in the log.

  'L_SHORTMESSAGE0' => 'Shipping Address1 Empty', 'L_LONGMESSAGE0' =>
  'The field Shipping Address1 is required',

  'L_SHORTMESSAGE0' => 'Shipping Address Postal Code Empty',
  'L_LONGMESSAGE0' => 'The field Shipping Address Postal Code is
  required',

  'L_SHORTMESSAGE0' => 'Customer must choose new funding sources.',
  'L_LONGMESSAGE0' => 'The customer must return to PayPal to select new
  funding sources.',

When i check Customer Address on Admin they have all the information. We disabled Guest Checkout.

The issue is where is data loss from Paypal to Magento? How can solve this issue 100%, so no user will face this issue.


texts: I have a client that needs to be able to filter orders they placed.  Is there a way to do it when they try to use "View All" when viewing "My Account"?


texts: Magento Commerce Cloud 2.3 download link PDF document

texts:
I need to provide a download link in my footer where customers get the revocation form.

I have the following in my phtml filebut it is not working. The PDF document is in pub/media/pdf/Muster-Widerrufsformular.pdf

<a href="<?php echo $this->getMediaUrl('pdf/Muster-Widerrufsformular.pdf');?>"><?php echo __('Revocation Form') ?>

I also tried

can anyone help? Thanks!


texts: How to get the media_url in custom GraphQl in Magento 2.3?

texts:
I have a custom module to update Faq of the website.question and answers can update from the back-end.Answer field is wysiwyg editor.Can upload image to the answer content.

If i get the result using graphQl , for the answer which have image retrieving the image path as below.

<img src=\"{{media url=&quot;wysiwyg/what_next.jpg&quot;}}\" alt=\"\" width=\"560\" height=\"460\">

If i use this in front end the image is broken.Image is not showing.

My GraphQl query

type Query {
faqs : [Faqs] @resolver( class: "Ayakil\\Faq\\Model\\Resolver\\Faq") @doc(description: "Get list of active answered FAQS")
}
type Faqs {
id : Int  @doc(description: "Id")
question : String  @doc(description: "Question")
answer : String  @doc(description: "Answer")
}

My resolver File

public function getFaq( )
{
    try {

        $collection = $this->_faqFactory->create()->getCollection();
        $collection->addFieldToFilter('faq_active',1);
        $collection->setOrder('short_order', 'ASC');
        $faqData = $collection->getData();

        foreach($collection as $faq){
            $faq_id = $faq->getId();
            $news_data[$faq_id]['id'] = $faq_id;
            $news_data[$faq_id]['question'] = $faq->getQuestion();
            $news_data[$faq_id]['answer'] = $faq->getAnswer();
        }

    } catch (NoSuchEntityException $e) {
        throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
    }
    return $faqData;
}

How Can i get the actual file path here?


texts:
I want to show a list of subcategories contained in a category in a CMS page. This subcategories are NOT in navigation menu, but active. They show a BRAND with description and its products.

I am using this code in CMS page admin:

{{block type="core/template" template="custom/brands-page.phtml" }}

And my brands-page.phtml template file includes:

...
$_brands = Mage::getModel('catalog/category')
    ->setStoreId($store_id)
    ->load(37)
    ->getChildrenCategories();
foreach($_brands as $_brand):
    $_cat = Mage::getModel('catalog/category')->load($_brand->getId());
    echo $_cat->getUrl()
    echo $_cat->getImageUrl()
    echo htmlspecialchars($_cat->getName())
    echo htmlspecialchars($_cat->getDescription())
endforeach
...

This correctly loops through categories included in navigation, but won't take care for those that aren't included.

I see this information is stored in IncludeInMenu in the data property of the object passed, but I can't figure out how to process the loop to show all childcategories, both included and not included in navigation.

Any ideas?


texts: Is it possible to have a different url for a different language

texts:
Currently, I have a multiple language website. it's xxxx.nl. Its available in Dutch and in English.

I also own the domain .eu. Would it be possible to have the English version of the website on the .eu domain and the Dutch version on the .nl domain without making 2 completely different websites?

And also give customers the possibility to switch between the Dutch website and the English one just like the language switcher i have now.


texts:
How to show cheapest simple product price on product list?
As far as I know the values shown on product list are values taken from catalog_product_index_price.price and catalog_product_index_price.final_price.

It seems that magento indexes prices taken from the first associated product for a configurable product.
How to override it to get the cheapest associated product instead of the first one?


texts: How to add custom option during add to cart in Magento 2.2?

texts:
I want to add the custom option when click on add to cart button in Magento 2.2

I am using the code in Observer:

<?php
namespace Vendor\Delivery\Observer;

use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Serialize\Serializer\Json;

class CheckoutCartProductAddAfterObserver implements ObserverInterface {

    protected $_request;

    public function __construct(
Json $serializer = null,
RequestInterface $request
) {
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
$this->_request = $request;
}

public function execute(EventObserver $observer) {
        $item = $observer->getQuoteItem();
$additionalOptions = [];

        if ($additionalOption = $item->getOptionByCode('additional_options')){
          $additionalOptions = (array) unserialize($additionalOption->getValue());
        }

       // $post = $this->_request->getParam('print_style'); // Your data added here
    $post = array('Print Style' => 'Test');

        if (is_array($post)) {
            foreach ($post as $key => $value) {
                if ($key == '' || $value == '') {
                    continue;
                }

                $additionalOptions[] = array(
                    'label' => $key,
                    'value' => $value
                );
            }
        }

  if(count($additionalOptions) > 0){
            $item->addOption(array(
                'code' => 'additional_options',
                'value' => $this->serializer->serialize($additionalOptions)
            ));
        }

    }

}

I have changed the line for Magento 2.2

'value' => $this->serializer->serialize($additionalOptions)

For magento 2.1 its working below

 'value' => serialize($additionalOptions)

I am getting this Error in console:

{"message":"Warning: array_merge(): Argument #2 is not an array in \/home\/root\/M2\/vendor\/magento\/module-catalog\/Helper\/Product\/Configuration.php on line 118"}

What is going wrong?


texts:
After placing an order the Customer's Account shows

  You have placed no orders. and shopping carts and wish lists. it gone?

Please Help

Backend

Thanks


texts: Create custom button on catalog > product page in admin panel

texts: How can i create button on Product listing page in admin menu.


texts: Preliminary question on editing Grid.php in Adminhtml

texts:
I have attached a screenshot of a typical backend interface.  I have three ideas of things I want to do, with the first one being the most important:

turn the values into the price field into form inputs instead, along with a button at the bottom to "Update Prices" - this is the thing we do the most and it's cumbersome to do this one by one.
add a class to rows based on products that are in a certain status, i.e. have not been updated recently, are missing options, etc.
Add a column that is not easily calculable just by an SQL query - basically a column that is not a data field column but instead can invoke a callback function.

As I said, #1 is priority.

The issue is, the grid methods are buried so deep in core I don't know where to start on this.  ANY suggestions or help or would be appreciated.


texts:
Working on setting up a theme for Magento CE 2.2.1. Magento application is running in Centos 7.

Getting this error msg in report.

{"0":"Can't create directory \/var\/www\/html\/magento221\/generated\/code\/Magento\/Framework\/View\/Asset\/MergeService\/. in [Magento\\Framework\\View\\Asset\\MergeService\\Interceptor]","1":"#0
\/var\/www\/html\/magento221\/vendor\/magento\/framework\/Code\/Generator\/Autoloader.php(35): Magento\\Framework\\Code\\Generator->generateClass('Magento\\\\Framewo...')\n#1 [internal function]: Magento\\Framework\\Code\\Generator\\Autoloader->load('Magento\\\\Framewo...')\n#2 [internal function]: spl_autoload_call('Magento\\\\Framewo...')\n#3 \/var\/www\/html\/magento221\/vendor\/magento\/framework\/Code\/Reader\/ClassReader.php(19): ReflectionClass->__construct('Magento\\\\Framewo...')\n#4

Gave full permissions to the var folder.
chmod 777 var -R.
Manually cleared the cache, page_cache and view_processed folders.

Not sure, what is that I am missing.
Looking for suggestions/advice.
Still a novice in Centos.


texts: Are these Windows CLI commands or Linux terminal commands?

texts:
Windows 10, Magento 2.1.

I am reading Vagrant directions so I can get VirtualBox and Magento running. These directions tell me to run commands, but they don't say where to run the commands. I have used the Windows CLI, but never the ($) character. Am I supposed to use the below commands in Windows CLI or the emulated Linux OS terminal that is running inside of VirtualBox? Thanks.

$ mkdir vagrant_getting_started

$ cd vagrant_getting_started

$ vagrant init

Here is the page with directions I am following:
https://www.vagrantup.com/docs/getting-started/project_setup.html


texts: Magento2 Elastic search curl request for Fetch category and layered navigation data

texts:
I have implement Elastic search for my magento2 project and it working fine.
But want to know how Elastic Search module Post our query to Elastic Database and retrieve data and need to know how Elastic module Query build for fetch data from Elastic.

Let me know if anyone have idea.


texts: Magento 2 : How can i add Icons to the user links such as "My account" Login" Sign in etc

texts:
Further in Magento 1, I  could just edit the html template file and do anything I could imagine. Now with this complicated with xml thing, extending templates etc. I'm confused.

What I' trying to do is the following :
Text under Icon on top.

I don't know where I can add that span tag before the text, so I can style them in CSS?

I looked into all files can't find it.

Below is an example of what I want to do.


texts:
I have a custom module for checkout. I want to add some custom code for function _getStepCodes() in app/code/core/Mage/Checkout/Block/Onepage/Abstract.php

I found that abstract functions cannot be override or rewrite.

How can I add custom to the function _getStepCodes() in my custom module. Is it possibe to add this function to app/code/local/Vendor/Modulename/Block/Onepage/Abstract.php ?

Any help would be appreciated.


texts: how to exclude special prices and multiple purchase discount from coupon code discounts

texts:
I want to create a discount code which will allow x% discount on the customers basket but I want to exclude items that are already have a discount applied (Special Price) but also want to exclude items which have a discount applied when 2 or more have been purchased.

See the attached image of my current conditions and actions we have setup


texts: Magento 1.9.2. - (Configurable) Sort collection of associated products by attribute value position

texts:
I tried with multiple codes to try and sort the collection of associated products based on the position of the attribute value but without success.

With my foreach in the product page I have pulled out all the records of the associated products but are always shown by order of id and not by position of the value they have with the attribute. This is my situation:

In this way I take the collection of associated products:

$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();

How can I get the correct order S, M, L, XL, XXL?
Thanks


texts: Magento 2 Catalog Input Type for Store Owner from Visual Swatch to Dropdown programatically

texts:
How can I change Catalog Input Type for Store Owner from Visual Swatch to Dropdown in Magento 2 programmatically

$eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'size', 'swatch_input_type', 'dropdown');

not working


texts:
i want to change the background color of product image on product page.as by default the color is white but can same be changed ?

we have cropped images but as per main image the background doesn't match.
as can be seen in image the background is white can a custom color be set on the same.


texts: Remove a block from layout without a name

texts:
I want to remove a block from the layout in magento 2 that is declared in a third party extension, but the block does not have a name.
Can I do that?

The block is declared like this

<referenceContainer name="before.body.end">
    <block class="Magento\Backend\Block\Template" template="[Vendor_Module]::template.phtml"/>
</referenceContainer>

I cannot use

<referenceBlock name="..." remove="true" />

because, as you can see there is no name on it.


texts: How to get selected option of the attribute for the product?

texts:
Struggling to get value of the selected option for product.

Example:Product require assembly so created attribute dropdown
Below few methods I've tried

echo $data = $_product->getAssembly();
echo $label = $_product->getAttributeText('Assembly');

$_attribute = $_product->getResource()->getAttribute('assembly');
$attribute_label = $_attribute->getStoreLabel(Mage::app()->getStore()->getName());

echo 'Label: '.$attribute_label;//empty
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','assembly');

$attributeModel->getData('label');
echo 'Model: '.$attributeModel;// empty
$atributeCode = 'assembly';

$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product',$atributeCode);
$options = $attribute->getSource()->getAllOptions();

var_dump is displaying only an array of all options.

How can I get  it ?


texts: magento 1.8.0.0: System -> Manage Currency -> Symbols: Page Not Found!

texts:
I've performed a search for "magento" "currency symbol" but did not find anything related to the problem I am having. Basically, I installed the XAMPP BitNami version of Magento on Windows 7, and most things tried so far work, but when I go to
System -> Manage Currecny -> Symbols
I get the following:

Whoops, our bad...
The page you requested was not found, and we have a fine guess why.
    If you typed the URL directly, please make sure the spelling is correct.
    If you clicked on a link to get here, the link is outdated.

Any idea what is causing this?


texts: Looking for a Product Management (Mass Updates) Extension w/ Some Key Features

texts:
Looking for an extension where I can import / export / make mass updates to existing products. Needs to have the following features:

Exports nicely into excel. The current stock Magento export has only csv option which causes unplanned column breaks (because some of our data has commas in it)
Has the ability to change the actual SKUs of products in bulk (I currently can't do this with Magento's stock import / export due to "SKU" being the primary key).
Has the ability to import new attribute options. For example, if I currently have the attribute "color" with the following options: red, green, blue. Then I get some new products, and one they have colors of orange, yellow, brown, white, etc. Right now I have to go in and manually add new options one by one. Would like to do it via upload.


texts: Shopping cart price rule SKU-A and SKU-B condition

texts:
How can I set a condition if I require two unique SKUs to be purchased first, before a discount is availed?

For example, if SKU 0001 and SKU 0002 exists on the cart, then you'll get 50% OFF. Both SKUs are required.

I already tried the if SKU "contains" SKU002,SKU001 condition, and the if SKU "is" SKU002,SKU001 condition, but it doesn't seem to satisfy what I'm trying to achieve.


texts:
I need to create a routine that does the following tasks:

Delete files in a specific folder that are more than 15 days of creation.
Clear the cache folder daily
Clean other specific folders also daily

I use easycron.com, therefore it's necessary that this routine is within the cron.php.


texts: override Magento\Catalog\Block\Product\View\Gallery using preference not working

texts:
I am trying to override the getGalleryImagesJson() method of Class Magento\Catalog\Block\Product\View\Gallery but I am unable to do so.

Below are my codes:

di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Block\Product\View\Gallery" type="Custom\Catalogoverride\Block\Product\View\Gallery" />
</config>

My overriden file

<?php
namespace Custom\Catalogoverride\Block\Product\View;

    class Gallery extends \Magento\Catalog\Block\Product\View\Gallery
        {
            /**
     * Retrieve product images in JSON format
     *
     * @return string
     */
    public function getGalleryImagesJson()
    {
        die('here');
        //var_dump('here');die();
        $imagesItems = [];
        foreach ($this->getGalleryImages() as $image) {
            $imagesItems[] = [
                'thumb' => $image->getData('small_image_url'),
                'img' => $image->getData('medium_image_url'),
                'full' => $image->getData('large_image_url'),
                'caption' => $image->getLabel(),
                'position' => $image->getPosition(),
                'isMain' => $this->isMainImage($image),
            ];
        }
        if (empty($imagesItems)) {
            $imagesItems[] = [
                'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'),
                'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
                'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
                'caption' => '',
                'position' => '0',
                'isMain' => true,
            ];
        }
        return json_encode($imagesItems);
    }
        }
?>

I am not getting up this file. I have tried same way to override other methods of checkout module which worked but not this time.

I have found similar question here but it followed the approach of plugin but I need to do it using preference.

Can anyone suggest why it is not working from this method.

Thanks in advance.


texts: How to add grunt watch to an app/code extension's css file in M2?

texts:
I have been customizing the landofcoder > Backend extension that creates an adminhtml theme.
It lives in the app/code/Ves/Backend folder.  However, the only thing I'd like to add is the ability to watch the .css file with grunt watch. Currently, it doesn't see any changes, and I have to continuously manually reload.

I've tried a simple themes.js config, but it could never find the CSS file because it's expecting it elsewhere for an admin theme.   If anybody has any pointers, suggestions on how to get the grunt to see the file, that would be amazing.
For full reference its:

app/code/Ves/backend/view/adminhtml/web/css/style.css

The Backend extension already has the following in its layout file, app/code/Ves/backend/view/adminhtml/layout/default.xml :

<?xml version="1.0"?>
<page xmlns:xsi="w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Ves_Backend::css/styles.css" order="102"/>
        <css src="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" src_type="url"/>
    </head>
</page>

Yet the problem persists.


texts:
I know this has been asked multiple times but I still don't understand how Magento calculates the total amount when a discount is applied.

I want all prices to be shown including tax but I want the discount to be calculated before tax is calculated.

Currently i have this situation. Suppose

Settings:
Apply Customer Tax : After Discount
Apply Discount On Prices : Including Tax (as recommended in the User Guide for EU based shops)
Apply Tax On : Custom Price If available

Display Prices: Including Tax
Display Subtotal : Excluding Tax

Order:
Product price = 40.20 (tax 21% included)

Cart shows:
Subtotal: €33.22 (excl tax)
Discount: €6.03- (incl tax)
Tax: €5.93 (tax=(subtotal-discount(excl tax))*0.21)
Total incl tax: 34.17 (total=(33,22-4,98)*1,21

The total amount and the tax calculation is correct but I want the discount to be shown excluding tax and not including tax as it is now.

When I change the setting Apply Discount On Prices to Excluding Tax, it messes up the calculation of the total and tax amount.

Cart shows:
Subtotal: €33.22 (excl tax) CORRECT
Discount: €4.98- (excl tax) CORRECT
Tax: €6.11 INCORRECT (33.22-4.98)*0.21=5.93
Total incl tax: 35.22 INCORRECT

Tax should be calculated as Subtotal - Discount x 0.21


texts:
I want to get products URL's using product collection,I have tried many links from searching browser,please help me with appropriate file path this is my module catalog import export code to get URL's in export.

protected function loadCollection(): array
{
    $data = [];

    $collection = $this->_getEntityCollection();
    foreach (array_keys($this->_storeIdToCode) as $storeId) {
        $collection->setStoreId($storeId);
        foreach ($collection as $itemId => $item) {
            $data[$itemId][$storeId] = $item;
        }
        $collection->clear();
    }

    return $data;
}


texts:
Magento 2 minimum length validation is not working for text field. My code lines:

<input type="text" tabindex="3"
    class="input-text required-entry validate-length maximum-length-8 minimum-length-4 validate-digits"
    id="daytime"  name="daytime">


texts: Magento 2 and Animated GIFs as Product Images

texts:
Is there a way in Magento 2 to allow for animated gifs as product images?

I can upload them to the backend without any issues, but when I view a product on the front-end it just shows them as separate images.


texts:
I am trying to figure out the script on how to call magento's category thumbnail image to a specific location in my script can anyone guide me in the right direction with this?

I thought it would have been as simple as:

                       <?php if($menu_type == 'mega-menu') { ?>
                        <?php if($_subcategory->getThumbnail()) { ?>

                               <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>"><img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$_subcategory->getThumbnail()  ?>" alt="<?php echo $_subcategory->getName() ?>" />

                        <?php } ?>
                    <?php } ?>


texts: Modifying shipping methods for admins creating orders

texts:
I am trying to apply changes to the shipping information that gets displayed once the admin clicks on the link to "Get Shipping Methods & Rates".

Obviously I need to grab the product and address info before the order is ever saved. I need to trigger this data when the shipping link is clicked. Grabbing the data after the order is saved will not work for me.

I have tried adminhtml_sales_order_create_process_data However, this doesn't seem to be returning anything relevant. The only thing I can seem to return with this event is the following:

$observer->getEvent()->getRequest()

Which returns:

Array
(
    [collect_shipping_rates] => 1
    [customer_id] => 2
    [store_id] => 1
    [currency_id] => false
    [form_key] => 0Is4G9KJ2XYer2c7
    [json] => true
)

Am I grabbing the data wrong or is there a better observer?

I also tried $observer->getEvent()->getOrder(); but that does not return anything.

Update: Not sure why people mark a question as a possible duplicate when in fact the two questions are completely different. This question has to do with properly grabbing the correct data, not observer placement like the other question asked and before the order is submitted.


texts: ERROR: URI '/checkout/cart/add/uenc/%25uenc%25/product/9495/'' cannot be accessed with GET method (Magento\Checkout\Controller\Cart\Add)

texts:
I keep seeing this error in my system error logs and not sure what it is and why this error keeps popping up? Any help on how to fix this error would be greatly appreciated. We are on Magento2.3.5pt-2.
URI '/checkout/cart/add/uenc/%25uenc%25/product/9495/'' cannot be accessed with GET method (Magento\Checkout\Controller\Cart\Add)


texts: Explanation about getSelect() join() joinLeft()

texts:
I don't understand these functions of Magento 1:

  getSelect()
  join()
  joinLeft()

Where can I find a complete doc with all functions documentation ?

Thanks..


texts: Authorize.net direct post update from md5 to signature sha

texts:
Recently i have seen 2 blogs , one is http://www.programmingsimplified.in/2019/03/how-to-update-magento-authorizenet.html

& other is official: https://support.magento.com/hc/en-us/articles/360024368392-Update-Authorize-Net-Direct-Post-from-MD5-to-SHA-512

In magento , there is two payment method of authorize (1. Authorize.net direct post and 2. authorize.net)

I have my magento store which uses 2nd method Authorize.net since last two years. but i am not using authorize.net direct post.

My question is that, Should i update the authorize.net using patch ?


texts:
In the below code which path or which file name have to give in 7 th line instead of slide. Because i am creating Ui form  in backend

<field name="name">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string">Name</item>
            <item name="visible" xsi:type="boolean">true</item>
            <item name="dataType" xsi:type="string">text</item>
            <item name="formElement" xsi:type="string">input</item>
            <item name="source" xsi:type="string">slide</item>
        </item>
    </argument>
</field>


texts: Magento 2.2.4: You need to choose options for your item

texts:
won't be able to add product to cart. I always got "You need to choose options for your item.". I am sure i have select all the required options.

This is the parameters i got when submitting the add to cart form.

         array(10) {
        ["uenc"]=>
          string(80) "aHR0cDovLzIwNi4xODkuMjA5LjYzLzIwLTktb3otaDJnby1jb25jb3JkLXRoZXJtYWwtYm90dGxlcw,,"
          ["product"]=>
          string(5) "15343"
          ["selected_configurable_option"]=>
          string(0) ""
          ["related_product"]=>
          string(0) ""
          ["form_key"]=>
          string(16) "88DObwCS6oMd7vJj"
          ["super_attribute"]=>
          array(1) {
            [983]=>
            string(3) "469"
          }
          ["options"]=>
          array(3) {
            [130]=>
            string(3) "524"
            [131]=>
            string(3) "526"
            [139]=>
            array(3) {
              ["month"]=>
              string(0) ""
              ["day"]=>
              string(0) ""
              ["year"]=>
              string(0) ""
            }
          }
          ["qty"]=>
          string(2) "24"
          ["validate_datetime_139"]=>
          string(0) ""
          ["options_140_file_action"]=>
          string(8) "save_new"
        }


texts: Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

texts:
I am building Magento 2.0 only to sell 2 of my products online.  The compare products and wishlist module is irrelevant for me.

How I safely and easily remove those modules? I dont want to hack the core code.


texts:
here i am replacing configurable.js with my own module. but its not working, and the default one is loading. do i need to initialize it as well ?
here is the code

path : app/code/ABC/Module/view/frontend/requirejs-config.js

var config = {
map: {
    "*": {
        'attributesLoader': 'ABC_Module/js/configurable',
        'Magento_ConfigurableProduct/js/configurable': 'ABC_Module/js/configurable'
    }
}
};

my configurable.js is

path : app/code/ABC/Module/view/frontend/web/js

i am just calling console.log in create function. to know which one is working.

static-contents deplyed, cache folders removed.


texts:
We need to add an attribute with value Yes to a lot of products (250+), but not to all of our products.
Is there a way to fix this automatically, instead of manually add this value to all 250 products?

Thanks!


texts: Magento 2: How to Set controller, module, action name?

texts:
I want to do these codes like in magento 1

$request->setModuleName('catalogsearch')
        ->setControllerName('advanced')
        ->setActionName('result');

and then the page load content page like catalogsearch/advanced/result/ page. but Url still keep old url like  /abc/xyz.html


texts: Display number of found products in layered navigation

texts:
I want to display the total number of currently found/selected above/inside the layered navigation.
In the templates catalog/layer/view.phtml or catalog/layer/state.phtml

I tried:

/* @var Mage_Catalog_Model_Category $_category */
$_category = Mage::registry('current_category');
var_dump($_category->getProductCount());

And a few other functions that are in the class but none seem to give the number I need.
Anyone who can help me out?


texts: how to store form data in table via controller

texts:
I need to save form data in table . I need to know better way. Is it better to store from controller. i have tried using following code but no success

form

<form id="orderapproval-item-form" class="orderapproval-hidden" action="<?php echo $this->getUrl('orderapproval/customercart/remarksdecline');?>" method="post">
<input type="text" name="message" class="orderapproval-disabled" value="<?php echo $this->__('Enter decline reason'); ?>" id="decline" />
<input type="submit" value="<?php echo $this->__('Decline'); ?>" onclick="namet()" />

controller

    public function remarksdeclineAction()
    {
       $message =  $this->getRequest()->getParam('message');
       $model =Mage::getModel('orderapproval/sales_flat_quote_item');
       $model->setItemcomment( $message );
       $model->save(); // save data

    }

Model/Orderapproval.php

<?php
class ZetaPrints_OrderApproval_Model_OrderApproval extends Mage_Core_Model_Abstract
{
        public function _construct()
    {
        $this->_init('orderapproval/sales_flat_quote_item');
    }
}

Model/Resource/Orderapproval.php

<?php
class ZetaPrints_OrderApproval_Model_Resource_OrderApproval extends Mage_Core_Model_Resource_Db_Abstract
{
        public function _construct()
    {
        $this->_init('orderapproval/sales_flat_quote_item', 'item_id');
    }
}

Model/Resource/Orderapproval/Collection.php

<?php
class ZetaPrints_OrderApproval_Model_Resource_OrderApproval_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
        protected function _constuct(){
 $this->_init('orderapproval/sales_flat_quote_item');
 }
}

config.xml

<?xml version="1.0" ?>
<config>
  <modules>
    <ZetaPrints_OrderApproval>
      <version>3</version>
    </ZetaPrints_OrderApproval>
  </modules>

  <global>
    <models>
      <orderapproval>
        <class>ZetaPrints_OrderApproval_Model</class>
        <resourceModel>zetaprints_orderapproval_resource</resourceModel>
      </orderapproval>

      <ZetaPrints_OrderApproval_resource>
         <class>ZetaPrints_OrderApproval_Model_Resource</class>
         <entities>
             <sales_flat_quote_item>

sales_flat_quote_item

             </sales_flat_quote_item>
          </entities>
    </ZetaPrints_OrderApproval_resource>

      <sales>
        <rewrite>
          <quote>ZetaPrints_OrderApproval_Model_Quote</quote>
        </rewrite>
      </sales>
    </models>

    <blocks>
      <orderapproval>
        <class>ZetaPrints_OrderApproval_Block</class>
      </orderapproval>
    </blocks>

    <helpers>
      <orderapproval>
        <class>ZetaPrints_OrderApproval_Helper</class>
      </orderapproval>
    </helpers>

    <resources>
      <orderapproval_setup>
        <setup>
          <module>ZetaPrints_OrderApproval</module>
          <class>Mage_Eav_Model_Entity_Setup</class>
        </setup>
        <connection>
          <use>Core_setup</use>
        </connection>
      </orderapproval_setup>

      <orderapproval_write>
        <connection><use>Core_write</use></connection>
      </orderapproval_write>

      <orderapproval_read>
        <connection><use>Core_read</use></connection>
      </orderapproval_read>
    </resources>

its my folder name and file name of model folder

**

ZetaPrints/OrderApproval/Model/Orderapproval.php

**

ZetaPrints/OrderApproval/Model/Resource/Orderapproval.php
ZetaPrints/OrderApproval/Model/Resource/Orderapproval/Connection.php


texts: Magento 2 Images from one .phtml to another .phtml

texts:
In a module I have installed I am trying to create a phtml page but can't work out how to pull through information(Like an image) to my new custom .phtml

File containing information:

view.phtml

<?php
            /**
             * Blog post view template
             *
             * @var $block \Magefan\Blog\Block\Post\View
             */
            ?>
            <?php
                $_post = $this->getPost();
                $_postUrl = $_post->getPostUrl();
                $_postName = $block->escapeHtml($_post->getTitle(), null, true);
            ?>

                <div class="post-holder post-holder-<?php echo $_post->getId() ?>">

                        <div class="addthis_toolbox addthis_default_style" addthis:url="<?php echo $_postUrl ?>">

                        <?php echo $this->getInfoHtml() ?>

                            <?php if ($featuredImage = $_post->getFeaturedImage()) { ?>

                                <img src="<?php echo $featuredImage ?>" alt="<?php echo $_postName ?>" />

                            <?php } ?>

                                <?php echo $block->getContent() ?>

                        <?php echo $this->getChildHtml('blog.post.bottom') ?>

My custom .phtml

<?php
/**
* Blog post view template
*
* @var $block \Magefan\Blog\Block\Post\View
*/
?>
<?php
$_post = $this->getPost();
$_postUrl = $_post->getPostUrl();
?>

Hello world

<?php echo $_post->getFeaturedImage() ?>

Obviously this doesn't work so how can I get it to work? Both files are in the same location

Edit XML added

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

    <referenceContainer name="content">
        <container name="landing.page">
            <block class="Magefan\Blog\Block\Post\Info" name="landing.content" as="landingcontent" template="Magefan_Blog::post/landing.phtml" />
        </container>
        <block class="Magefan\Blog\Block\Index" name="blog.posts.list" template="post/list.phtml" />
    </referenceContainer>

</page>


texts: Add an attribute TO A PRODUCT programmatically

texts:
After searching for examples using "magento add attribute to product programmatically" I keep getting copious results on adding or removing ATTRIBUTES programmatically.

I want to programmatically add attribute values to a specific product - both the product and the attribute (and options) will have already been created previously.  Something like:

function addAttributeToProduct($product, $attribute, $option_value, $scope='global'){ ...

Where $product could be the object or could be the product SKU, $attribute could be the attribute object or the attribute name, etc. with $option_value.

How would I do this?


texts: How can i add a static block in the design---->page layout

texts:
i want to add a static block that consist of some formatted text
i want to add at the bottom of this code, but i dont know how to add the below static block content
Productos m&aacute;s Vendidos

and
here is the code of my homepage:

<reference name="header">
<block type="cms/block" name="header_slider">
    <action method="setBlockId"><block_id>header_slider</block_id></action>
</block>
</reference>
<reference name="left">
 <remove name="cart_sidebar" />
 <remove name="catalog.compare.sidebar" />
 <remove name="tags_popular" />
 <remove name="right.poll" />
 <remove name="right.reports.product.viewed" />
 <remove name="right.reports.product.compared" />
 <remove name="wishlist_sidebar" />
<block type="cms/block" name="side_banners">
    <action method="setBlockId"><block_id>side_banners</block_id></action>
</block>
</reference>
<reference name="content">
    <block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page">
        <action method="setColumnCount"><columns>3</columns></action>
        <action method="setProductsCount"><count>9</count></action>
        <action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
<action method="unsetData"><key>cache_lifetime</key></action>
     <action method="unsetData"><key>cache_tags</key></action>
    </block>
</reference>

The cms block i want to put will be here after this last </reference>

what code should i use to add the statick block?

thanks


texts: Why does setting the template for the product description remove the entire product tabs?

texts:
I am following a course where the task was to change the template forthe product description:

etc/frontend/di.xml:

  <type name="Magento\Catalog\Block\Product\View\Description">
    <plugin name="product-view-desription-plugin"
  type="Training\Test\Block\Product\View\Description" sortOrder="10"/>

Block/Product/View/Description.php:

<?php

namespace Training\Test\Block\Product\View;

class Description extends \Magento\Framework\View\Element\Template
{
  public function beforeToHtml(\Magento\Catalog\Block\Product\View\Description $originalBlock) {
      //Set a new tempalte
      $originalBlock->setTemplate('Training_test::description.phtml');
  }
}

view/frontend/templates/description.phtml

Custom description template!

However when I view the page the product tabs are gone (Bonus points where is the error message for this layout breakage?)


texts: How to get customer custom multi select attribute value in magento 2

texts:
I have created a customer multi-selected attribute but I am not able to get its value on checkout can you please guide me on how can I get it. I try these two solutions but it not work.
$customer = $customerSession->getCustomer();
echo $customer->getResource()->getAttribute('payment_method')->getFrontend()->getValue($customer);

2nd
$customer = $customerSession->getCustomer();
$paymentValue = $customer->getCustomAttributeText('payment_method')->getValue();

Thanks in advance


texts: Displaying a product attribute of type text area

texts:
I have created a product attribute of type text area. Its typical value will be a unordered list, such as:

line 1

line 2

line 3

The attribute code is 'usp'
I wish to display this attribute on the product screen and have created a new template for this purpose. When I hard code a value in the template, it displays properly. However, when I put the following

<?php echo $this->getProduct()->getAttributeText('usp') ?>

in the template, I get an error:

  Call to a member function getAttributeText() on null in...

How should I code this?


texts:
I have added below code in my config.xml file to add one option in Magento multi select captcha section

<default>
    <customer>
        <captcha>
            <always_for>
                <custom_faq>1</custom_faq>
            </always_for>
        </captcha>
    </customer>
    <captcha  translate="label">
        <frontend>
            <areas>
                <custom_faq>
                    <label>FAQ</label>
                </custom_faq>
            </areas>
        </frontend>
    </captcha>
</default>

It look like this.

Now I want to get value of this multi-select option. How can I get this multi select value?


texts:
Recently I purchased a Magento 2 theme and their support has been less than helpful. I'm still pretty new to Magento 2 and XML Files overall. Is there anything obvious that I'm missing?
Exception #0 (Magento\Framework\Exception\LocalizedException): The XML in file "/app/code/Zemez/LayoutSwitcher/etc/layouts.xml" is invalid:
Element 'config': No matching global declaration available for the validation root.
**
layouts.xml
**
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Zemez_LayoutSwitcher:etc/layouts.xsd">
    <layout id="header_layout_1" label="Header Layout 1" type="header" />
    <layout id="header_layout_2" label="Header Layout 2" type="header" />
    <layout id="header_layout_3" label="Header Layout 3" type="header" />

    <layout id="listing_layout_1" label="Listing Layout 1" type="listing" />

    <layout id="product_layout_1" label="Product Layout 1" type="product" depends="catalog_product_view,checkout_cart_configure" />
    <layout id="product_layout_2" label="Product Layout 2" type="product" depends="catalog_product_view,checkout_cart_configure" />
    <layout id="product_layout_3" label="Product Layout 3" type="product" depends="catalog_product_view,checkout_cart_configure" />

    <layout id="footer_layout_1" label="Footer Layout 1" type="footer" />
    <layout id="footer_layout_2" label="Footer Layout 2" type="footer" />
    <layout id="footer_layout_3" label="Footer Layout 3" type="footer" />
</config>

**
layouts.xsd
**
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="config" type="configType"/>
  <xs:complexType name="layoutType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string" name="id"/>
        <xs:attribute type="xs:string" name="label"/>
        <xs:attribute type="xs:string" name="type"/>
        <xs:attribute type="xs:string" name="depends" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="configType">
    <xs:sequence>
      <xs:element type="layoutType" name="layout" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>