texts: add product attribute from external script

texts:
I'm working on a custom import script and I want to check if the
  product I'm going to import has an attribute that does not exist in
  Magento, the script will create the attribute

use Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');
if ( $_POST['product'] && validate_key($_POST['key'] )) {

    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    $state = $objectManager->get('Magento\Framework\App\State');
    $state->setAreaCode('frontend');
    $_product = $objectManager->create('Magento\Catalog\Model\Product');
    .
    .
    .
    $eav = $objectManager->create('\Magento\Eav\Model\Entity\Attribute');
    if ( !$eav->load($code)->getId()  ) {
        $eavFac = $objectManager->create("\Magento\Eav\Setup\EavSetupFactory");

        $eavFac->addAttribute( \Magento\Catalog\Model\Product::ENTITY, $code,
                        [
                            'group'                     => 'Product Details',/* Group name in which you want to display your custom attribute */
                            'type'                      => 'int',/* Data type in which formate your value save in database*/
                            'backend'                   => '',
                            'frontend'                  => '',
                            'label'                     => $t, /* lablel of your attribute*/
                            'input'                     => 'select',
                            'class'                     => '',
                            'source'                    => 'ModuleNameSpace\YourModuleName\Model\Config\Source\Options',
                            'global'                    => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,  /*Scope of your attribute */
                            'visible'                   => true,
                            'required'                  => false,
                            'user_defined'              => false,
                            'default'                   => '',
                            'searchable'                => true,
                            'filterable'                => true,
                            'comparable'                => false,
                            'visible_on_front'          => true,
                            'used_in_product_listing'   => true,
                            'unique'                    => false
                        ]
                    );
                    $all_attrs[] = $eav->load($code)->getId();

                }
}

its giving the error

  Call to undefined method
  Magento\Eav\Setup\EavSetupFactory::addAttribute()


texts:
We are using authorize.net payment method with payment action as authorize. We also have an order edit module where we can update the order totals.So when the order total is updated and then if we are trying to create the invoice to capture the latest amount,we are getting the issue like "Transaction has been declined. Please try again later.".
So we need to void the existing transcation,authorize it and then capture.I was able to void the transcation but unable to find how to authorize and capture the new order total.
Can anyone please guide me on how to achieve this
Thanks!


texts: Undefined variable: store_id Error trying to fix Magento CE 1.9.1.0

texts:
Magento CE 1.9.1.0 and trying to fix a plugin that is suppose to sync my products with the jet.com shopping portal. Unfortunately the developer has not responded to any request for help I am trying to fix it myself. its installed correctly and it is all configured. However when I go to sync an item to jet.com I see the following in my system log file

Undefined variable: store_id in app/code/local/MKMage/Jet/Helper/Data.php on line 65

I am wondering if anyone knows how to edit the below to fix this error?
I tried adding the below to line 65 right after the else{ but got the same error

$store_id = = Mage::app()->getStore()->getStoreId();

The Data.php file is too big to past so you can see it here
http://bit.ly/2bZnrcl


texts: How to create the magento2 Mega drop down menu?

texts: Creating mega drop down menu on magento2, able to get the data from the database product categories and subcategories


texts:
In this config.xml of module I am using there is a frontName defined as adyen:

    <routers>
        <adyen>
            <use>standard</use>
            <args>
                <module>Madia_Adyen</module>
                <frontName>adyen</frontName>
            </args>
        </adyen>
    </routers>

But if I open http://myshop.com/adyen/ there is no page. In another module I have a similar definition for another frontName and it works fine there.

Why does it work the same way here?


texts: Get pages content in txt , excel or word format magento 1.9

texts:
Is it possible to convert all the content of my pages into a .txt or word file and then download it ? maybe with an extension I'm not aware of.. The version is magento 1.9.x
Thanks in advance


texts: Is there any danger in resetting date_default_time_zone() mid-script?

texts:
I have a cms block in /app/design/frontend/default/{mytheme}/template/cms

I was having trouble creating time-based control structures because PHP was using UTC instead of California Pacific time.

So I've inserted this at the top of the CMS phtml file:

date_default_timezone_set('America/Los_Angeles');

And then I inserted this at the bottom, just in case:

date_default_timezone_set('UTC');

Now I can use strtotime() and time() to get/set unix timestamps in the timezone of concern to me.

Is there any danger in that method? Is there a better one?


texts: Parent product in result on searching child sku

texts:
I want to have functionality if a user searches for the child SKU, then parent products should appear in the result.

It is happening in my store but for few products not for all.
Example : I have a parent product A and its child are A1 and A2, if I am searching A1 or A2 then A is appearing in the search result.
I have one more parent product B and its child are B1 and B2, now when I am searching for B1 or B2, then B is not appearing in the search result.
Configuration for all the child products is nearly same.
Like all the child products are not visible individually and all parent product's visibility is catalog, search.

My first question is why this is working for only few products and not for all.
Secondly, how can I achieve this for all products.
Any help would be appreciated.


texts: Magento 2 : Add Custom Tax Amount To Shipping Tax In Order

texts:
Does Anyone know how  can i add custom tax amount to shipping tax in magento2 order ?

Total Tax Amount  20
   Shipping Tax : 10
   Other Tax :    10


texts: Magento 2: How to call PHP file in another phtml file inside the module?

texts:
I am using magefan blog extension, i want to move post page bottom section related product to sidebar

I have created custom phtml file based on the side bar postion under app\code\Magefan\Blog\view\frontend\templates\sidebar\related_products.phtml
<?php
echo "hell hello";
?>

The output,

The related product php file under \app\code\Magefan\Blog\Block\Post\View\RelatedProducts.php how to call this file into side bar section?


texts: How to add custom fee block in total block checkout?

texts:
I have two custom modules. One is onestepcheckout and another is for a custom fee.
I need to add a customs fee block into the onestepcheckout.

Thanks in advance.


texts: Get the object of the whole quotation in observer

texts:
I am doing this:

public function setQuoteShippingMethod (Varien_Event_Observer $observer) {
        $item = $observer->getEvent()->getQuoteItem();

       //to have more code
    }

but it takes the last item (product) in the quotation (i.e. I have 4 items). I want to take the object of the whole quotation (bundle product), so I manipulate its shipping method.

I am observing checkout_cart_product_add_after. The point is - I have a quotation in the Customer Account's quotes - and when you open(view) the quotation - you can click "Add to cart". That's where my method is caught.


texts:
here is my config file..   (Lalit/Consultation/etc/config.xml)

<?xml version="1.0" ?>
<config>
    <modules>
        <Lalit_Consultation>
            <version>0.1.0</version>
        </Lalit_Consultation>
    </modules>
    <frontend>
        <routers>
            <consultation>
                <use>standard</use>
                <args>
                    <module>Lalit_Consultation</module>
                    <frontName>online-consultation</frontName>
                </args>
            </consultation>
        </routers>
        <layout>
            <updates>
                <consultation>
                    <file>consulation.xml</file>
                </consultation>
            </updates>
        </layout>
    </frontend>
    <global>
        <blocks>
            <consultation>
                <class>Lalit_Consultation_Block</class>
            </consultation>

        </blocks>
        <helpers>
            <consultation>
                <class>Lalit_Consultation_Helper</class>
            </consultation>
        </helpers>
    </global>

</config>

working fine! here's controller file (Lalit/Consultation/controllers/IndexController.php)

<?php
class Lalit_Consultation_IndexController extends Mage_Core_Controller_Front_Action{
    public function indexAction(){

       Mage::log('im in controller');
        $this->loadLayout();
        Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());

        $this->renderLayout();
    }

}

here's block file   (Lalit/Consultation/Block/Consultation.php)

<?php
class Lalit_Consultation_Block_Consultation extends Mage_Core_Block_Template{
    public function _prepareLayout()
    {
        return parent::_prepareLayout(); // TODO: Change the autogenerated stub
    }
}

here's layout file (app/design/frontend/base/default/layout/consultation.xml)

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

    <consultation_index_index>
        <reference name="content">
            <block type="consultation/consultation" name="consultation" template="consultation/consultation.phtml"/>
        </reference>
    </consultation_index_index>

</layout>

Helper file in (app/design/frontend/base/default/templates/consultation/Helper/Data.php)

<?php
class Lalit_Consultation_Helper_Data extends Mage_Core_Helper_Abstract{

}

template file in (app/design/frontend/base/default/templates/consultation/consultation.phtml)

<?php echo $this->__('this is testing') ?>

Here's my output


texts:
Magento frontend theme fallback to backend

Hi - we use a frontend pdf program that uses backend/adminhtml templates - and now these are not found. I think what we would like and have to to is tell Magento to:

first look for the theme in frontend
and if not found then look in the backend theme templates

question: Can this be easily achieved?

I understand you can influence frontend fallback - but don't know how you can add the functionality to look for all missing template files in the backend template model if frontend fails to find it

thanks in advance


texts: Product rating display total review score

texts:
I use 5 rating options for a product review.
It is displayed with the well known stars, see below.

But I want to also display the total score. A score that display the average score of the total 5 of that score.

(I do not want to display the average of all reviews, only the average of each individual review)

This is my detailed.phtml

    <?php $_votes = $this->getRatingVotes($_review->getId());?>
    <?php if (count($_votes)): ?>

        <col width="1" />
        <col />

            <?php foreach ($_votes as $_vote): ?>

                <?php echo $_vote->getRatingCode() ?>

                        <div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;">

            <?php endforeach; ?>

    <?php endif; ?>

How can I display this?


texts:
Is anybody Implemented "Marketing Conversion Tag" pixel code?

I need pass some data to script which I did in magento1 but not an idea in Magento2.

    var rm_trans = {
        orderid : 'ORDERID',
        currency: 'CURRENCYCODE',
        customerStatus: 'CUSTOMER_STATUS',
        conversionType: 'Sale',
        customerID: 'CUSTOMER_ID',
        discountCode: 'DISCOUNT_CODE',
        discountAmount: DISCOUNT_AMOUNT,
        taxAmount: TAX_AMOUNT,
        ranMID: ‘’,
        lineitems : [{
            quantity : QUANTITY_PURCHASED,
            unitPrice : SINGLE_UNIT_ITEM_PRICE,
            unitPriceLessTax: SINGLE_UNIT_ITEM_PRICE_NO_TAX,
            SKU: 'PRODUCT_SKU',
            productName: 'PRODUCT_NAME'
        }]
    };

We have two option for doing it:

By Directly Object Manager
By making a custom Module by passing DI

If anybody implemented it, please help me.

Thanks in advanced


texts:
I have a column in my custom grid, I am getting image URL in that column, I want to show image instead of URL. My code of calling that column is:

$this->addColumn(
    'image',
    [
        'header' => __('Header Image'),
        'index' => 'image'
    ]
);

How can I achieve this?


texts: How to use ajax to auto load Latest News?

texts: How can I use ajax auto load Best News?  when I add news in admin, Best News will update without F5.


texts: Upgrade from Magento 2.2.6 to 2.3.1 CLI Command Error

texts:
When upgrading from Magento CE 2.2.6 to Magento CE 2.3.1, I am following the command line upgrade as explained here. All was well and the commands ran just as they should have until I ran the following command:

php bin/magento setup:upgrade

Upon running this command I am seeing the following error:

Please advise me on how I can go about solving this error.


texts: Magento 2: Themes! What are they Good for?

texts:
Based on my preliminary research, you can use a Magento 2 theme to

Add additional, or replace already defined, translation strings for Magento’s __ localization function
Specify the height and width for named Magento image assets
Replace any front end asset files added by a Magento module
Replace any email template file
Add files for Magento’s //@magento_import LessCSS directive to consume
Add additional layout handle XML files to merge when Magento merges a specific module’s layout handle XML
Override a module’s layout handle XML file (edited)

Is there anything else you change change about Magento's system behavior via a theme?


texts: Reaching memory limit when updating child product when parent is changed

texts:
Back again.  I'm almost there with my observer to update "Manage Stock" on child items when the parent configurable item is changed, but I've run into a memory problem.  First, I tried updating all the children when the memory limit was set to 64MB, then raised it to 256MB and finally to 512MB...each time, I hit the limit when executing the code.  As a test, I made it to where the script would exit after updating just one child product, but it still hit the limit.  This leads me to believe that I'm doing something wrong, as I'm pretty sure Magento wouldn't need more than half a gig of memory allocated to update two fields of one child.  My observer is as follows:

<?php

class MyCompany_Catalog_Model_Observer
{
    public function mc_update_child (Varien_Event_Observer $observer)
    {
        if (Mage::app()->getRequest()->getPost('mc_update_child_products'))
        {
            $productid = Mage::registry('current_product')->getId();
            $product = Mage::getModel('catalog/product')->load($productid);
            $productType = $product->getTypeID();
            if ($productType === 'configurable')
            {
                $parent = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productid);
                $parentMS = $parent->getData('manage_stock');
                $parentUCMS = $parent->getData('use_config_manage_stock');
                $children = $product->getTypeInstance()->getUsedProducts();
                foreach ($children as $child)
                {
                    $childId = $child->getId();
                    $childProduct = Mage::getModel('catalog/product')->load($childId);
                    $childStock = $childProduct->getStockItem();
                    $childStock->setData('manage_stock', $parentMS);
                    $childStock->setData('use_config_manage_stock', $parentUCMS);
                    $childStock->save();
                    $childProduct->save();
                    Mage::log($childId);
                    exit;
                }
            }
        }
    }
}

As you can see, I was hoping to log the id of the child product that got updated, and exit, but no log entry is made, and I get this in the Apache error log:

[Wed Mar 19 16:45:03 2014] [error] [client 192.168.1.120] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in /var/www/magento-www/docs/lib/Zend/Db/Statement/Pdo.php on line 290, referer: https://www.mycompany.com.local/index.php/admin/catalog_product/edit/id/9407/back/edit/tab/product_info_tabs_inventory/key/d32f1b287f7eff4f68951efbd09418265067fabe9adb78541b070adb748dbfd6/

Hopefully someone can see a mistake I'm making.  TIA.


texts:
I am using Magento 2.2,

When a customer checks out using a credit card, Authorize.net, and the payment fails due to address verification, or any other reason, all Magento says is "Server error. Please contact administrator".

In Magento 1, there was an extension that could be installed that would give the customer the proper error message i.e. payment failed to payment AVS Address Failure.

Is there anything like this for Magento 2?


texts: loader.js:41 Uncaught TypeError: url.match is not a function, When running AJAX in admin form

texts:
i have a select field set that triggered AJAX script when onchange, the ajax is calling the controller with post data, but i got an error saying

  loader.js:41 Uncaught TypeError: url.match is not a function

here's the code:

$k = Mage::getSingleton('core/session')->getFormKey();
$event = $fieldset->addField(
            'category_id',
            'select',
            array(
                'label'  => Mage::helper('test_sellercenter')->__('Category '),
                'name'   => 'category',
                'values' => Mage::helper('test_sellercenter/dropdown')->getLazadaCategories(),
                'class' => 'required-entry lazadacat',
                'onchange'  => 'checkSelectedItem(this)',
                'container_id' => 'categoryId'
        ));

        $event->setAfterElementHtml("<script type=\"text/javascript\">
          function checkSelectedItem(selectElement){
              new Ajax.Request({
                url: '".$this->getUrl('test_sellercenter/Adminhtml_MassActions/attributeslazada')."',
                type: 'POST',
                data: {category: selectElement.value, form_key:'".$k."'},
                success: function(data) {
                          console.log(data);
                        }
              });

          }
      </script>");


texts: How can I change below texts ? I would like to change them as "Sign In or Register".


texts: Easiest way to setup multiple websites/stores with different domains in Magento 2.x?

texts:
Magento 2.4.1

I was able to set up different websites/stores with different domains in Magento 1.9.4 in a very easy way:
 1. Add the 2nd domain as an Alias in the Control Panel
    2. Create a new root directory
    3. Create a new website, store and store front and assign it to the new root directory
    4. Specify the Base URL in the correct Configuration Scope for the new website/store/storefront
    5. Add a few lines in the .htaccess file, located in the root directory of the Magento installation

This whole process was simple and quick (took less than 15 minutes) and it worked! Much like the steps here:
https://www.properhost.com/support/kb/30/How-To-Setup-Magento-With-Multiple-Stores-And-Domains
Now I'm setting up a new secondary website/store/storefront with it's own domain on a new Magento 2.4.1 install. I've googled the steps and found dozens of websites which all seem to have a different process of achieving this. Most insist on some kind of Apache configuration via SSH root access?
Is there an easy way (perhaps somehow similar to what I used to do on Magento 1.9.4) to set up a new website/store/store front on Magento 2.4.1 with it's own domain?
I have already done steps 1-4 from above in my new Magento 2.4.1 install. It's the additional steps I find (unnecessarily?) difficult.

Updated on January 13th, 2021:
I ended up using the following code from the post referenced below. It seems to work. Can anyone think of any potential problems running it this way?
Add this to index.php on Magento installation root:
switch ($_SERVER['HTTP_HOST']) {
    case 'www.domain-x.com':
    case 'domain-x.com':
        $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'x';
        $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
        $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
        $app = $bootstrap->createApplication('Magento\Framework\App\Http');
        $bootstrap->run($app);
        break;
    case 'www.domain-y.com':
    case 'domain-y.com':
        $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'y';
        $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
        $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
        $app = $bootstrap->createApplication('Magento\Framework\App\Http');
        $bootstrap->run($app);
    break;

    default:
        Mage::run();
    break;
}

Magento 2 with multiple domain names


texts: How to pass form id to insetListing components dataprovider in magento 2?

texts:
I want to add affected products listing inside catalog price rule form.

I have followed related product example to do the same.

Same as related products I have added insertListing component inside catalog form components XML file for affected product listing like below.

<insertListing>
        <argument name="data" xsi:type="array">
            <item name="dataScope" xsi:type="string">affected_product_listing</item>
            <item name="config" xsi:type="array">
                <item name="autoRender" xsi:type="string">false</item>
                <item name="ns" xsi:type="string">affected_product_listing</item>
                <item name="externalProvider" xsi:type="string">affected_product_listing.affected_product_listing.affected_product_listing_data_source</item>
                <item name="selectionsProvider" xsi:type="string">affected_product_listing.affected_product_listing.product_columns.ids</item>
                <item name="render_url" xsi:type="url" path="mui/index/render"/>
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
                <item name="realTimeLink" xsi:type="boolean">false</item>
                <item name="behaviourType" xsi:type="string">simple</item>
                <item name="externalFilterMode" xsi:type="boolean">true</item>
                <item name="dataLinks" xsi:type="array">
                    <item name="imports" xsi:type="boolean">true</item>
                    <item name="exports" xsi:type="boolean">false</item>
                </item>
                <item name="imports" xsi:type="array">
                    <item name="rule_id" xsi:type="string">${ $.provider }:data.rule_id</item>
                </item>
                <item name="exports" xsi:type="array">
                    <item name="rule_id" xsi:type="string">${ $.externalProvider }:params.rule_id</item>
                </item>
            </item>
        </argument>
    </insertListing>

I have added another ui component and data provider for grid affected_product_listing

In my dataprovider i have printed request params like this :-

public function getData()
{
    $catalogPriceRuleId = $this->request->getParams();
    print_r($catalogPriceRuleId);
    exit;
    $rule = $this->rule->load(2);  /* catalog price rule id */
    $productIdsArray = $rule->getMatchingProductIds();
    $productIdsArray = array_keys($productIdsArray);

    if (!$this->getCollection()->isLoaded()) {
        $this->getCollection()->addFieldToFilter('entity_id', ['in' => $productIdsArray])->load();
    }
    $items = $this->getCollection()->toArray();

    $data = [
        'totalRecords' => $this->getCollection()->getSize(),
        'items' => array_values($items),
    ];

    /** @var ModifierInterface $modifier */
    foreach ($this->modifiersPool->getModifiersInstances() as $modifier) {
        $data = $modifier->modifyData($data);
    }
    return $data;
}

Now the issue is I am not getting catalog rule id here in request params.

So I want to pass catalog price rule id in insertListing components dataprovider to fetch only affected products of this particular catalog price rule, So how can I pass it.Thanks in advance.


texts: What will be the best way to overwrite the core functionality in Magento 2?

texts: It will be great if someone provides me a small example of any core functionality overwrite.


texts: Magento backend new order, new customer - email field missing

texts:
we have th strangest problem. In admin/sales_order_create/index the email field is missing. We actually found this in 2 stores.

The form is loaded here

app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php

// add system required attributes
foreach ($customerForm->getSystemAttributes() as $attribute) {
    /* @var $attribute Mage_Customer_Model_Attribute */
    if ($attribute->getIsRequired()) {
        $attributes[$attribute->getAttributeCode()] = $attribute;
    }
}

It seems that $attribute->getIsRequired() is not true for $attribute->getAttributeCode()=="email"

I have seen this for the 3rd time now in 3 stores.

Question: Where and how can the required-ness of the "email" attribute be changed? (so we don't see this problem anymore)


texts:
I'm trying to add a custom attribute to order entity.

I managed to add a column to sales_order, but I cannot save any value while placing the order.

I tracked down the problem in: Magento\Framework\Api\DataObjectHelper::_setDataValues where my custom column is excluded beacause it is not in the OrderInterface.

Is there any way to add it?

How do custom attributes work in Magento 2?


texts: Auto-split Magento shipments based on maximum weight

texts:
Here in Australia we have AusPost who will not ship anything above 20kg. On this particular site, there are often shipments much larger comprising of a lot of smaller products, say 1kg each.

I would like to know if it is possible to extend Magento so that based on a maximum weight threshold, the shipments are automatically split into lots of 20kg packages (versus the client having to work out the QTY for each item to make the shipment match as close to the threshold weight (20kg in this example) as possible.

Ideally the solution should work with bulk order management extensions such as Better Order Management by Amasty or Simplify Bulk Order Processing by Xtento - preferably the former.


texts: Grouped Product is shown in Configurable product view!

texts:
I am trying to set up grouped products in my store. I created a grouped product with using magento admin panel and associated it with 2 simple products. Product is created but when I try to access grouped product's page I see the normal product page.

I checked the local.xml and there is nothing related to grouped products template. I checked the catalog.xml and I found that the grouped product template is set to

template="catalog/product/view/type/grouped.phtml"

Which is correct. But I still see the normal product template when ever I call the page

/gr1.html

I am in need of some help on this issue.

I use Magento CE 1.7.0.2

Cheers


texts: Is there a way to check if an extension is enabled from within the extension?

texts:
I have an extension which needs to be on for some sites and off for others, however it is creating a page on all the sites even when disabled.

Is there a way for an extension to check if it is enabled for output for a specific store id?

I'm using:

 $enabled =  Mage::helper('core')->isModuleEnabled('Module_Name');

But this returns 1 if echoed out, as the module is enabled in general, therefore the hook is still making a page even if the output is disabled.

Updated code based on answer - but still rendering to the blank page:

    if(Mage::getStoreConfig('advanced/modules_disable_output/module_name',$store_id) == 35)
    {
        $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
        $this->getResponse()->setHeader('Status','404 File not found');
        $this->_forward('defaultNoRoute');
    }else{
        $this->loadLayout();
        $this->renderLayout();
    }


texts: How to add subscribers with same Email ID registered on different websites?

texts:
Let me explain.

I have two websites created in magento admin abc.domain.com and xyz.domain.com. A customer registers from both websites using same email id.

Now I add that email ID to subscribers list programmatically. But only one row is inserted. I need two rows, each for both websites.

Is this possible?


texts: install npm for Magento 2 on a system the runs Plesk Onyx without deleteing Plesk

texts:
When i try to install npm per apt-get on my Linux machine with Plesk onyx it always want to remove my plesk packages. i still wanna use plesk on my server since its my developer environment. but i need npm for magento 2 because i need to install grunt with it.

any idea how i can install npm on the server without loosing plesk ? i know plesk supports nodejs in the web interface but i need to call npm on the cli. ...realy need yall help. thx


texts: Custom data send with order into backend

texts:
I am trying to send order programmaticaly and I want to send with this order a custom information about user-uploaded image that could be visible in admin backend.

Here is my simple code:

$image = 'uploads/123193284234.jpg';
$cart = Mage::getModel('checkout/cart');
$cart->init();
$params = array(
    'product' => 37,
    'qty' => 1,
    'options' => array(
        371 => array(
            'user-uploaded-image' => $image // the info I want to send with order
        )
    )
);
$cart->addProduct(37, $params);
$cart->save();

This code works, now, I want the user-uploaded-image to be displayed in admin backened in order detail as new custom field like this:

Thanks for every suggestions ( plugin, workflow to use ) especially about the part of how to add custom field to order-detail view in admin backend.


texts: How to add a field in login form in magento

texts:
I have added a drop down field in registration form.
Now i want to add this field in login form,I tried to do in login.phtml but it is not showing
anything.

Can anyone please suggest..


texts: Desperately need help. why search and categories stopped working?

texts:
Just to be clear: I have already tried flushing cache, compiler, reindexing, etc and the issue persists, same happens with default theme and both default and rwd packages. My other store works fine with identical config, 1.9.2.

Issue: search & categories results 0 results, even though there are results and it is somewhat working.

Category: https://www.airyhair.com/hair-samples-accessories.html

Search for "hair": https://www.airyhair.com/catalogsearch/result/?q=hair

As you can see, while it does not list any items, it finds them as typing "ggg" gives NO RESULTS error.

https://www.airyhair.com/catalogsearch/result/?q=ggg

Any help or tips would be appreciated.


texts:
In which table Magento 1.9 stores shipping methods like free shipping ,flat rate ?

Please help to find it out.


texts: Magento 2 How is Layout.xml rendered to html file

texts:
I have this catalog_product_view.xml in my theme layout folder.

I want to edit the html code for this part all-products-left-wrapper,

<referenceContainer name="content">
    <container name="all-products-left-wrapper" label="All Products Left Wrapper" as="all-products-left-wrapper" htmlTag="div" htmlClass="all-products-left-wrapper" before="-">
    </container>
    <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.media.image" template="product/view/mediaimage.phtml" />
</referenceContainer>

But I have searched all over my Magento folders, I simply can't find the phtml file for this?

But on the front-end, when I look at the source code from browser, I do see this is generated <div class="all-products-left-wrapper">. So how does Magento 2 render it's .xml files to html?


texts: Magento 2 Checkout not showing first name

texts:
I've used the migration tool to import data from a Magento 1 site into a new Magento 2 site. Just a slight problem, on the checkout there is no First Name field for either shipping or billing address.

I'm also missing the title for the section:

Enter delivery name and address

Similar to:
Magento 2 Checkout not showing all fields

Any ideas how I can restore this field?


texts:
Often we need to sort products in the admin on creation date. I know I can sort on ID, and this way I'll get the products in the this order, and I found some (free) extensions that give me the option to sort on date on the frontend but that is not what we need.

Is there an easy way to show this option in the admin?


texts: magento 2 How to add new column in order csv export

texts: magento 2 How to add new column qty ordered in order csv export. and coumn should not be visible in the grid


texts: Magento 2.2 - Sorting product in category page by position not working

texts:
I'm trying sort products in category page by position. But Magento2 does not react to changes.

Any ideas how can I fix it?


texts: I am willing to get product SKU value to auto-increment in Magento 2. For example the last product created sku was 100001 then the next product would be 100002 and so on.


texts:
I want to connect MongoDB to my magento 2.x website and store some custom entries in same.

So basically I will require connection details and how i can insert and update the records in mongo db. Please note my primary db will be mysql. Mongo DB will a additional DB.


texts: Magento2 : Logged-in user has to re-login before checkout

texts:
Login in
Add product to cart
In top bar there is text "Welcome Michael Surname", but there is
still option to sign-in and sign-up next to it.
Go to cart > checkout
Login prompt is displayed

minicart code

    <a class="action showcart desktop" href="<?= /* @escapeNotVerified */ $block->getShoppingCartUrl() ?>"
       data-bind="scope: 'minicart_content'">
       <svg class="cart-icon"><use xlink:href="<?php echo $this->getViewFileUrl('images/icon-sprite.svg#cart');?>"></use></svg>

    <a class="action showcart mobile" href="<?= /* @escapeNotVerified */ $block->getShoppingCartUrl() ?>"
       data-bind="scope: 'minicart_content'">
       <svg class="cart-icon"><use xlink:href="<?php echo $this->getViewFileUrl('images/icon-sprite.svg#cart');?>"></use></svg>

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

            <?= $block->getChildHtml('minicart.addons') ?>

    <?php endif ?>


texts: Magento 2 - Warning: Invalid argument supplied for foreach() in the file vendor/magento/module-config/Model/Config/Structure/Mapper/Sorting.php

texts:
I am getting this warning message when I go to store > configuration in the admin panel.

  Warning: Invalid argument supplied for foreach() in
  /opt/lampp/htdocs/Magento2/vendor/magento/module-config/Model/Config/Structure/Mapper/Sorting.php

Posted my answer for the same. Need your suggestion in my answer.


texts: Show all color variations (as separate products) on listing page

texts:
We have Product level variations as Color and Size. Since the catalog is very small, client needs all the color variations to be listed on category listing page and then navigate to the item to be able to select size and color. I would like to have options of using color swatch too.

What would be the best way to achieve this? should we have simple products with custom options or go with regular configurable products and do customization on the listing template? or any better suggestions to do this!


texts: Error showing special prices when changing store view - Magento 2.3.1

texts:
I have 2 store views, one for normal customers (product prices including tax) and one for wholesale customers (product prices excluding tax). See images for reference.

Normal Store View (product prices including tax):

Wholesale Store View (product prices excluding tax):

And additionally, I have special prices for the customer group Wholesale in some products like this:

When I log in with a wholesale account for example in the store view EN (prices including tax), I see the correct special prices.

But when in the same session I change the store view, I lose the special prices and I only see the normal customer prices:

If I log in with a wholesale account but now in the store view Wholesale (prices excluding tax), I see the correct special prices too:

But when in the same session I change the store view, I lose the special prices and I only see the normal customer prices again:

I don't understand why, this happens to me only if I change the store view and it is very strange right? Is this an error for Magento? Any idea why this happens and how to solve it?

UPDATE 1

The entity_id of this product is 2726, the customer_group_id is "2" (Wholesale group) and this is the result of Query:

  SELECT * FROM catalog_product_index_price WHERE entity_id = 2726;

UPDATE 2

This is the configuration that I have for my taxes:


texts: How to remove related products check boxes on magento2

texts:
I've used app/design/frontend/<your_vendor_name>/<your_theme_name>/Magento_Catalog/templates/product/list/items.phtml to set $showCart = true; so that an Add to Cart button is used for related products rather than checkboxes.

<?php
switch ($type = $block->getType()) {

    case 'related-rule':
        if ($exist = $block->hasItems()) {
            $type = 'related';
            $class = $type;

            $image = 'related_products_list';
            $title = __('Related Products');
            $items = $block->getAllItems();
            $limit = $block->getPositionLimit();
            $shuffle = (int) $block->isShuffled();
            $canItemsAddToCart = $block->canItemsAddToCart();

            $showAddTo = true;
            $showCart = true;
            $templateType = null;
            $description = false;
        }
    break;

Is there a way for me to remove the checkboxes for adding the related products to the cart?

I know I could use CSS to simply hide the checkboxes but am wondering if there is a better way?


texts: Select All Rows after applying filter to Magento2 Extended Grid

texts:
I am working on Magento 2.2.0. I have an extended grid in my custom module. When I apply the filter to the grid and choose "Select All" from the drop-down, it is not working. All the row ids are posting to the controller.

I want it to post only the rows which are visible after applying the filter. Anyone had the same problem?


texts: The label New not displayed on all new products magento 2

texts:
I installed the template shop4u and i see that just on one product the label new is displayed despite i set featured = true. Can any one explain to me this code:

if (($newsTo != '' || $newsFrom != '') && $_config->getAdvanced('show_newlabel')) {
        if (($newsTo != '' && $newsFrom != '' && $now >= $newsFrom && $now <= $newsTo) || ($newsTo == '' && $now >= $newsFrom) || ($newsFrom == '' && $now <= $newsTo)){ ?>

                <?php echo __('New'); ?>

        <?php }
    } ?>

specially getAdvanced('show_newlabel')) because the rest is clear. please any explanation and thanks in advance


texts: How session is managed in magento system?

texts:
<?php
session_start();
var_dump($_SESSION);
?>

I tried the above code in root of the magento system but it fails to list all the session variables. It returns null.

Then how the magento stores all the session values?

Does it use $_SESSION super global or it follows some other way to store session?


texts:
Looking for thoughts if I should go to 13.1 before going to 14.0.1 on an upgrade from 13.0.1?

EDIT: My question more specifically. Should I bother into copy in the 1.13.1 files, then do the php scripts, then run the 1.14 files?


texts: How to disable redirect dashboard after creating an account using the shopping cart?

texts:
How to not be redirected to the dashbord after creating an account when validating the basket? Here is my configuration and the screenshots of the process:

When Allow Guest Checkout is disable :

And

Redirect Customer to Account Dashboard after Logging is disable :

> website/checkout/cart/

> website/checkout/cart/

> website/customer/account/create/

> website/customer/account/


texts: Add custom table field in layered navigation

texts: I need help. I have created custom tables and its fields. Like create doctor table and in doctor table  product_id  is working as foreign_key and it's column name like     shift_time  etc. There are columns in doctor table. So I need this custom column in layered navigation and it's filter. So how can i achieve this functionality? Any tutorial ? Any hint ?


texts: Custom Customer Attribute not being read from Request

texts:
I'm trying to add a new Custom attribute to the Magento customer model, and I think that I've set everything up correctly from what I've been able to scour off of this website & google, but I'm just not having any luck with it.

Essentially, the project is about overloading some of the functionality for the Magento Customer module, we want to execute some custom code in & around  the Customer saving, loading and authentication functionality.

I'm building all of my interceptors into a custom module which I've successfully vendored into my Dev instance.

This module has an InstallData.php script which does successfully create my Custom Attribute:

class InstallData implements InstallDataInterface
{
    private $eavSetupFactory;

    public function __construct(EavSetupFactory $eavSetupFactory, Config $eavConfig)
    {
        $this->eavSetupFactory = $eavSetupFactory;
        $this->eavConfig       = $eavConfig;
    }

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        $eavSetup->addAttribute(
            Customer::ENTITY,
            'MSISDN',
            [
                'type'         => 'varchar',
                'label'        => 'MSISDN',
                'input'        => 'text',
                'required'     => true,
                'visible'      => true,
                'user_defined' => true,
                'position'     => 999,
                'system'       => 0
            ]
        );
        $msisdnAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'MSISDN');
        $msisdnAttribute->setData(
            'used_in_forms',
            ['adminhtml_customer']

        );
        $msisdnAttribute->save();
    }

Once I've run composer update & php bin/magento setup:upgrade, I can confirm that the custom attribute has been created in the database.

However, when I try to register a new customer using the REST API, following request:
{
  "customer": {
    "group_id": 1,
    "default_billing": "",
    "default_shipping": "",
    "created_at": "2019-02-05 12:12:12",
    "updated_at": "2019-02-05 12:12:12",
    "created_in": "dev_store",
    "dob": "1981-03-01",
    "email": "test@gmail.com",
    "firstname": "User",
    "lastname": "Name",
    "middlename": "X",
    "prefix": "B",
    "suffix": "A",
    "gender": 1,
    "store_id": 1,
    "taxvat": "string",
    "website_id": 1,
    "custom_attributes": [
      {
        "attribute_code": "MSISDN",
        "value": "121314151617"
      }
    ]
  },
  "password": "TestPassword1234"
}

I get the Error response:

{"message":"\"MSISDN\" is a required value."}

Ultimately, I want to be able to intercept this value before the Customer data model gets saved so that I can execute custom validations & a few other tasks.

Please let me know if I can provide any other info.

Thanks in advance for the help.


texts: Fetching SKUs containing a "/" (forward slash character) from the /rest/v1/products/ REST API endpoint?

texts:
A lot of our SKUs have spaces and forward slashes in them (eg: "PRODUCT1-DARK BLUE" and "PRODUCT2-DARK/RED".   I'm able to curl to the products with spaces via url encoding:
    # sample SKU: "PRODUCT1-DARK BLUE"
    # encoded: "PRODUCT1-DARK%20BLUE"
    > curl -X GET -H "Authorization: Bearer" "https://www.magentosite.com/index.php/rest/V1/products/PRODUCT1-Dark%20Blue"
    > returns data successfully

But unfortunately I can't seem to fetch any of our SKUs with the forward slash.  For example:
    # sample SKU: "PRODUCT2-DARK/RED"
    # encoded: "PRODUCT2-Dark%2FRed"
    > curl -X GET -H "Authorization: Bearer" "https://www.magentosite.com/index.php/rest/V1/products/PRODUCT2-Dark%2FRed"
    > returns "The requested URL was not found on this server." error

I've tried encoding other variations ("PRODUCT2-DARK\/RED", "PRODUCT2-DARK//RED", and "PRODUCT2-DARK&#47;RED") with no luck.  Any other ideas of something I can try?
Outside of changing our SKUs, is still there a way I can still try to GET/POST to our catalog product data containing forward slash characters in their SKU?  I know I can use products?&searchCriteria, however I need to POST and not just GET.
Thank you for any assistance!


texts: Magento2 Stable Release - Render Layout not working in custom module

texts:
My module was working perfectly in Magento2 Beta version. In stable version, module is getting listed and custom module backend is working fine. However frontend pages of my module are not working. Here is my code.

Index Controller

namespace Companyname\Modulename\Controller\Index;

use Magento\Framework\App\Action\Action;

class Index extends Action {
    public function execute() {
        $this->_view->loadLayout();
        $this->_view->renderLayout();
    }

}

Layout - /app/code/Companyname/Modulename/view/frontend/layout/modulename_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceContainer name="content">
        <block class="Companyname\Modulename\Block\Modulename" name="modulename" template="Companyname_Modulename::modulename.phtml" />
    </referenceContainer>
    </body>
</page>

Block File

namespace Companyname\Modulename\Block;
class Modulename extends \Magento\Framework\View\Element\Template {
   public function __construct(
       \Magento\Framework\View\Element\Template\Context $context,
        array $data = array()
    ) {
        parent::__construct($context, $data);
   }
}

When i debug, it does not come in construct of the block. I am assuming that it is not able to find the block. The phtml file simply prints echo "hello world"; But nothing appears on frontend. Any ideas as to what i am doing wrong ?


texts: magento 2 static content deploy error: @minicart-icon-color is undefined

texts:
I have created a new theme, and deployed the static content, but it's giving me an error when the front-end static content deployment is running.

That is:

  @minicart-icon-color is undefined in the view-processed file.

Please help me to solve this. Thanks.


texts: What If I disable developer mode in magento 1.9

texts:
I want to know what will happen if I disable developer mode in magento 1.9 by setting in index.php file

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

to

Mage::setIsDeveloperMode(false);

Will it affect my site?
Actually I want to site to be in production mode.If you have any other suggestions please share.Thanks


texts: Magento 1.9 CE security fixing end of life

texts:
I just read all answers from this question: Future Support of Magento 1.9 - Coming Magento 2.0
But I can't find a clear date or an official reference about the end of life date for Magento 1.9.

Is there nothing like this?: http://php.net/supported-versions.php

I found some sentences like this:

  Magento 1x will be supported for the next three years from the Magento 2.0 release date.

or this:

  Will be supported for 3 years after 2.0 comes out of beta by Magento itself

or this:

  Magento will continue to provide security updates to Magento Enterprise Edition 1.13 and 1.14 for 3 years after Magento 2.0 general availability

But it is not clear if I'm supposed to count three years from Magento 2 beta release (early 2015?) or Magento 2.0 release (late 2015) and if security updates will be only for Magento EE or Magento CE 1.9 also?

Furthermore I can't find any official reference about these claims.


texts: Jump to review-form tab from magento product view

texts:
In my magento 1.9.0.1 store I correctly have the review-form in tab, on product page. If i click on "review link" in rating box I go to product review page. I want go to review-form tab on same page and not to the product review page. How I can do this? Is there some JS or code for doing this?
Thanks in advance.


texts: Add a brand attribute.Add a custom page and show all the  brand values. On clicking the brand values display the products filtered by the selected value.


texts:
I want home menu in top Navigation.
But One thing is that , i Created root category and that link to top navigation.
In that root category i already add Home category but that leads to http://www.xyz.com/home.phml page but i want http://www.xyz.com In that case we have to write store URL in URL_key line but that also can't accept. so help me.
Thanks.


texts: Is it possible create paypal business account create in india?

texts:
I want to create paypal business account from india for my usa business(Actually my store in usa, i want to create payment gateway using paypal). Is it possible indian contact number accept (Airtel)?

  Note : I am getting error at enter the contact number(indian number),
  i added but still not getting massage or call.


texts: Minimum total of items in shopping cart to allow checkout

texts:
I'm trying to find a configuration that allows one of my customer groups (wholesale) to add any given number of items to their shopping carts, but have a restricted checkout equal or greater than 16 items in total.

For example:
8 items from product A
2 items from product B
6 items from product C

That would be a total of 16 items and it would be possible for them to checkout.

I tried configuring the Minimum Qty Allowed in Shopping Cart, but then, they have to get 16 items of each product.

Do you know if there is a way to configure, add an extension or hardcode something to solve this problem?

Thank you for your time!


texts:
I install magento2 in my system and its work properly but when i changed in less files then it's not affect in frontend.
then how can i compile less files in magento2 for get css effect in frontend.


texts: Magento 2.2 Override admin forget password email template still load from vendor

texts:
Hi I have been stuck about 1 day, what I want is override this file in my magento 2:

  vendor/magento/module-user/view/adminhtml/email/password_reset_confirmation.html

I have many attempt but still no luck, the magento still load the template from the vendor's template, what I was try is this:

1.copy vendor/magento/module-user/view/adminhtml/email/password_reset_confirmation.htmlto app/design/adminhtml/Magento/email/password_reset_confirmation.html

make new module with this structure :

googling and try aplly the solution from google but still no luck, thi is is the link from any link that I have find in google Magento 2 Change Reset Password email template

so, how to override the forgot password template for admin? not for customer


texts: cdn deploy static files magento - still deploying to "normal" directories

texts:
I'm trying to get my static files to be deployed in static.domain.com

I have pointed my base url and secure base urls like below

After I did - the website is trying to pull data from that location but when I check the folder of the new subdomain no files are generated after I deployed the static content and cleared all caches. The static content is still deployed in domain.com/pub/static instead of static.domain.com/pub/static.

am I missing something?


texts: USPS Create Shipping Label checkbox doesn't show on Ship Order screen

texts:
I'm running Magento 2.2.7. I have both UPS and USPS accounts with the API account information added in and in Production mode.

I have successfully added UPS, retrieve rates on checkout, and can process an order shipment with the checkbox to Create Shipping Label.

However, viewing an order that has USPS as the shipping method, will not show Create Shipping Label checkbox on the Order's Ship screen. I have tried just about everything, and I believe the USPS account is in production mode. I've not been able to locate anyone talking about this as an issue. Is there something I'm missing?


texts: Magento2 How to override base/ui_component/customer_form.xml

texts:
I want to override the below file

  vendor/magento/module-customer/view/base/ui_component/customer_form.xml

I have copied that file to the specific location and made the changes.

  app/code/[vendor]/[module]/view/base/ui_component/customer_form.xml

Also tried with below location

  app/code/[vendor]/[module]/view/adminhtml/ui_component/customer_form.xml

But still, my changes do not reflect.

I just want to modify content in my ui_component file.

<field name="sendemail_store_id">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\Store\Model\System\Store</item>
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Send Welcome Email From</item>
                <item name="dataType" xsi:type="string">number</item>
                <item name="formElement" xsi:type="string">select</item>
            </item>
        </argument>
    </field>

Please help me if you have any idea.
I really appreciate your response.


texts: Can any one tell me how can I get the customer id whose order is being created by admin in admin panel, in file /vendor/magento/module-sales/view/adminhtml/templates/order/create/form/account.phtml


texts: PayPal Pro Direct Payment using Credit Card

texts:
Finished setting up PayPal Pro direct payment. For credit/debit card options, it does not ask for Name on the card. Only card numbers, CVN expiration etc. So, does it just assume the same name that was entered in the previous billing information step or it just doesn't need any name on the card?
Thanks


texts: on click cancel button is hiding value inside textfield

texts:
we are using magento multivendor/multiseller site.

We are providing an option for vendor to update the price from their account through frontend.

when vendor clicks on update button, its updating price sucessfully.

but vendor clicks on cancel button, its hiding the value inside textfield.

what i need is vendor trying to update price, in that time vendor type some number in textfield and if he clicks on "cancel" button ,it should revert back to original price.

code for updating price

<button id="price_update_button_<?php echo $products->getId(); ?>" class="update" onclick="updateFieldPrice('<?php echo $products->getId(); ?>'); return false;" >
<?php echo $helper->__('Update') ?>
</button>

code for cancelling price

<button id="price_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetPrice('<?php echo $products->getId(); ?>','<?php echo $products->getPrice(); ?>'); return false;">
<?php echo $helper->__('Cancel') ?>
</button>


texts: Magento 2: Redirect user to login if not access on store view

texts:
I am using plugin for Magento 2:
Store Login Access, but I am facing some issue.
Consider an example:
There is a user who is having access on store view English and France but not having access on Store View Spanish.
So when he tries to access store view Spanish, it shows error:

  There has been an error processing your request

I want the user, to be redirected to the login page if he is not having access.
I have explored couple of options on admin panel but not getting exact way to do it. Also, I am new to Magento so I am not sure which file I need to edit to fix this.


texts: Checkout broken after update to Magento 1.9.0.1

texts:
Just upgraded to 1.9.0.1 and now "shipping methods" screen will not CONTINUE when CONTINUE button pushed during ordering - site is broken and no orders coming in - YIKES. Error messages coming into admin say:

Payment transaction failed.

Reason
Please specify a shipping method.

Checkout Type
onepage

THANKS MAgento Angels!


texts: Cloud first merge into Integration - Admin stops working

texts:
Having done my first merge into integration the admin profile login screen refuses to accept the variable defined login credentials.

I could previously login into integration.

Note this is on magento-2.2 but I cannot add this tag.


texts:
I wan't to know how to set a max length for the Qty field that is when you click a product (I guess it's product View)
I tried to override the following template and set maxlength = "4" but did not work.

magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

What template should I override or what item can I modify in the layout to allow just 4 digits in Qty field?

Thanks!


texts: Magento 1.9 - Hide Category product slider out of stock products

texts:
I have disabled displaying out of stock items by Admin panel.

But It doesn't hide in category tab slider.

All items are out of stocks as per the below snapshot.How can I get out of this issue??


texts: InstallData categories not add the categories

texts:
I make and installData to define new categories (I have a lot of categories and sub-categories and I don't know why but they are nor added, in the database I see they are added but it's strange see the picture).

In my installData I create a new Category object from Magento\Catalog\Model\Category

In my install function I put this :

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
  {
    $setup->startSetup();

    // get datas to insert the categories
    $categories_data = $this->getCategoriesData();

    // Insert all main categories
    foreach ($categories_data as $category_data)
    {
      $this->insertCategory($category_data);
    }

    $setup->endSetup();
  }

So I get my datas by the getCategoriesData function which return me an array like :

[
  'data' => ['name' => 'A category', 'parent_id' => 3],
  'childs' => [
    [
      'data' => ['name' => 'A sub category 1'],
      'childs' => [],
    ],
    [
      'data' => ['name' => 'A sub category 2'],
      'childs' => [
        [
          'data' => ['name' => 'A sub category of sub category 2'],
          'childs' => [],
        ],
      ],
    ],
  ]
],
[
  'data' => ['name' => 'A category not in menu', 'parent_id' => 3, 'include_in_menu' => false],
  'childs' => [],
]

And in my insertCategory function I put :

private function insertCategory($category_data)
  {
    $category = $this->_category->setData($category_data['data'])->save();
    if (!empty($category_data['childs']))
    {
      foreach ($category_data['childs'] as $category_child)
      {
        $category_child['data']['parent_id'] = $category->getId();
        $this->insertCategory($category_child);
      }
    }
  }

So if the category have an array child which is not empty, I add a new data 'parent_id' to the child data key. But I don't know why, this not work. Look at the screen of my database, the parent_id of the Childs is the id of the child, it's not possible, I dont understand why... I define a parent_id = 3 to put theses in a root category test I created but they are not showed in the back office. (I have run bin/magento setup:upgrade and bin/magento cache:flush).


texts:
I have been looking into RequireJS for a while, but till now, I still can not figure out how to add the TouchSwipe plugin into my theme.

Would somebody take the time to give me a step by step?


texts: Maximum function nesting level , what it means?

texts:
when i add

    Mage::log($name, null, 'events.log', true);

in the function of dispatchEvent()

public static function dispatchEvent($name, array $data = array())
{
    Mage::log($name, null, 'events.log', true);
    Varien_Profiler::start('DISPATCH EVENT:'.$name);
    $result = self::app()->dispatchEvent($name, $data);
    Varien_Profiler::stop('DISPATCH EVENT:'.$name);
    return $result;
}

the  following error i got

  ( ! ) Fatal error: Maximum function nesting level of '100' reached,
  aborting! in
  E:\wamp\www\magento\app\code\core\Mage\Core\Model\Abstract.php on line
  119

how to avoid this?


texts:
I trying to duplicate advanced search forum with some custom attribute, this clone is a filter page so is different from the real advanced search, for do this I copy advanced search form into a template, now I need to replace

$this->getSearchableAttributes();

with my custom attribute, so i try something like this:

$attribute = Mage::getModel( 'eav/config' )->getAttribute( 'catalog_product' , 'formulazione' );
$array[] = $attribute;

but without success, one thing i note that $this in the original form is different from $this inside my template, I think the problem is this but I don't know how to solve it


texts: Add product to cart programatically is not setting price when we add product at first time

texts:
When adding product first time to the cart is not setting the product price, But when we add another product to the same cart (second time) the price of both product is set.
my code is below:

public function createCustomerCar($customerId,$authorization,$sku,$qty)
{
    $result_arr = $this->_masterobj->getResultarray();
    $storeId = $this->storeManager->getStore()->getStoreId();

    try {
        $quote = $this->createCustomerCart($customerId, $storeId,$sku,$qty);
    } catch (\Exception $e) {
        $result_arr[$this->_masterobj->_json_keys["DATA_KEY"]]["message"] = $e->getMessage();
    }

}

/**
 * Creates a cart for the currently logged-in customer.
 *
 * @param int $customerId
 * @param int $storeId
 * @param string $sku
 * @param int $qty
 * @return \Magento\Quote\Model\Quote Cart object.
 * @throws CouldNotSaveException The cart could not be created.
 */
protected function createCustomerCart($customerId, $storeId,$sku,$qty)
{
    $result_arr = $this->_masterobj->getResultarray();
    $customer = $this->customerRepository->getById($customerId);

    try {
        $quote = $this->cartRepositoryInterface->getActiveForCustomer($customerId);
        // echo "err12";
        // exit;
    } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
        /** @var \Magento\Quote\Model\Quote $quote */
        $quote = $this->QuoteFactory->create();
        $quote->setStoreId($storeId);
        $quote->setCustomer($customer);
        $quote->setCustomerIsGuest(0);
    }

    $this->cartItem->setQuoteId($quote->getId());
    $this->cartItem->setQty($qty);
    $this->cartItem->setSku($sku);

    $quoteItems = $quote->getItems();
    $quoteItems[] = $this->cartItem;
    $quote->setItems($quoteItems);

    $this->cartRepositoryInterface->save($quote);

    $quote->collectTotals();
}


texts:
I'm trying to display upsell products on the view page. For that, I created my own custom block for the template with following code:

<?php

namespace YS\India\Block;

use Magento\Framework\App\ObjectManager;
use Magento\Catalog\Block\Product\AbstractProduct;

/**
 * Catalog product upsell items block
 *
 * @SuppressWarnings(PHPMD.LongVariable)
 */
class Upsell extends AbstractProduct
{
/**
 * @param \Magento\Catalog\Block\Product\Context $context
 * @param array $data
 */
public function __construct(
    \Magento\Catalog\Block\Product\Context $context
) {
    parent::__construct($context);
}

public function getUpSellProducts()
{
    $product = $this->_coreRegistry->registry('product');

    $upSellProductIds = $product->getUpSellProductIds();

    if(isset($upSellProductIds)){

        $products = array();
        $objectManager = ObjectManager::getInstance();

        foreach($upSellProductIds as $productId) {
            $product = $objectManager->get('Magento\Catalog\Model\Product')->load($productId);

            $products[] = $product;
        }

        return $products;
    }

    return null;
}
}

What's going with above code is this:

The following line is working fine and giving me upsell ids.

$upSellProductIds = $product->getUpSellProductIds();

The problem is after executing the loop:

foreach($upSellProductIds as $productId) {
    ....
}

the products array has same product although productId is different.

What I am missing here?


texts: Order and Product information in Magento 2

texts:
In Magento 1 Simply I can get the Order information by using Mage::getModel() as well Product also same thing right?

$order_information = Mage::getModel('sales/order')->load($order_id);

as well

$product_information = Mage::getModel('catalog/product')->load($product_id)

In magento 2 I'm fallowing below code but it's not working the website is hanging up.

my code is:

Order event Learning/Custom/etc/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd">
    <event name="sales_order_save_after">
        <observer name="custom_event" instance="Learning\Custom\Model\Observer" method="getOrder" />
    </event>
</config>

Product event Learning/Custom/etc/adminhtml/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd">
    <event name="catalog_product_save_commit_after">
        <observer name="custom_event" instance="Learning\Custom\Model\Observer" method="getProduct" />
    </event>
</config>

Observer Code from Learning\Custom\Model\Observer.php file

<?php

namespace Learning\Custom\Model;

class Observer{

   protected $orderFactory;

   protected $productFactory;

    public function __construct( \Magento\Sales\Model\OrderFactory $orderFactory,\Magento\Catalog\Model\ProductFactory $productFactory)
    {
        $this->orderFactory = $orderFactory;
        $this->productFactory = $productFactory;
    }

    /**
     * Get the Order Information
     *
     * @param \Magento\Framework\Event\Observer $observer
     */
    public function getOrder(\Magento\Framework\Event\Observer $observer)
    {

        /* this 4 lines of code working fine */
        $event = $observer->getEvent();
        $order = $event->getOrder();
        $order_id = $order->getIncrementId();

        file_put_contents('Order ID.txt',print_r($order_id,true));

        /* when this 3 lines of code executing website is hanging */
        $order_factory = $this->orderFactory->create();
        $order_information = $order_factory->loadByIncrementId($order_id);

        file_put_contents('Order.txt',print_r($order_information,true));

        /* when this line of code executing website is hanging */
        file_put_contents('Order Information.txt',\Zend_Debug::dump($order->getData(), $label = null, $echo = true));

    }

    /**
     * Get the Product Information
     *
     * @param \Magento\Framework\Event\Observer $observer
     */
    public function getProduct(\Magento\Framework\Event\Observer $observer)
    {

        /* this 2 lines of code working fine */
        $product_id = $observer->getProduct()->getId();

        file_put_contents('Product ID.txt',print_r($product_id,true));

        /* when this 3 lines of code executing website is hanging */
        $product_information = $this->productFactory->create();

        $prod = $product_information->load($product_id);

        file_put_contents('Product.txt',print_r($prod,true));

    }

}

Please let me know where I went wrong? or Any suggestions?


texts: Magento 2 Allowed Memory exhausted error in Magento 2.3/Wampp

texts:
I have an error when i add module..

so i run below command but also display error that below when run command from root,

php magento setup:di:compile

How i fix it?

i already allow memory limit to 4G


texts: Magento2: How can add custom search boxes in admin grid for products?

texts:
I want to add custom search box in product grid in admin. please find below screenshot: https://prnt.sc/o3tsso
How can do this?


texts: Code to Display data on page coming in form of array?

texts:
Hi i have a data of table coming in form of array in function inside my block class :
What i want basically is to display that array form data on my homepage :

here's my code :

protected function _getAllProductProductCollection()
    {
       $collection = $this->productCollectionFactory->create();

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager
        $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
        $collection2 = $resource->getConnection();
        $tableName = $resource->getTableName('catalog_product_flat_19'); //gives table name with prefix

        $sql = "Select name , image FROM " . $tableName . " where image IS NOT NULL " ;
        $result = $collection2->fetchAll($sql);

//         echo "<pre>";
//        var_dump($result);
//        echo "</pre>";

//basically i want to pass that $result below here but no idea how ?

        $conditions = $this->getConditions();
        $conditions->collectValidatedAttributes($collection);
        $this->sqlBuilder->attachConditionToCollection($collection, $conditions);
        return $collection;
    }

this is the data in form of array :

i want this list of products data to display over here , following products are coming from another function i would replace it from my function :

------------------Edit --------------------------
if i pass $result variable from here :

$conditions->collectValidatedAttributes($result);

It gives me following error on screen:

  Fatal error: Uncaught Error: Call to a member function isEnabledFlat()
  on array in
  C:\xampp\htdocs\chase\vendor\magento\module-catalog-widget\Model\Rule\Condition\Product.php:


texts: How to add WYSIWYG editor button editor in backend block form

texts:
when editing product there is wysiwyg button like this

this button will popup wysiwyg editor when you click it and the value goes to the field text with html tag, i've tried the solution in  here, but it didnt work at all

is there a way to add it to one of my fieldset that goes like this

$fieldset->addField(
            'custom_field',
            'text',
            array(
                'name'   => 'custom_field0',
                'container_id' => 'attribute-custom0',
                'placeholder' => $this->__('Custom Attribute Field'),
        ));


texts: Unable to login to magento admin panel from any browser

texts:
I am using magento 1.9
When I try to login to magento with user name and password the page refresh and nothing happen.
facing this issue when i moved my site from siteground to bluehost.
I seen the logs and found that a same error is comming all time.

2017-10-10T10:49:30+00:00 ERR (3): Recoverable Error: session_regenerate_id(): Failed to create(read) session ID: user (path: /var/cpanel/php/sessions/ea-php70)  in /home4/bedshee9/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 513

I have tried every single thing on internet but nothing work. Facing this issue from long time.

Please help.


texts: M2 Live reload not refreshing sourcemaps

texts:
Magento 2.3.4
Apache
Chrome 83.0.4103.97
Dev tools

Everything started, everything working, watcher is watching. Opened the page, saw the correct path to the less file in Dev tools.

Made the less changes, page refreshed. The path changed to the path to the CSS file.

Tried to find the answer yesterday's whole evening, but no success.
Any ideas?


texts: How to make admin grid text to skip to next line?

texts:
I have admin grid made by using UI component.
One of the columns is comments column.
Comments can be long and text is spreading horizontally in one line and that breaks grid layout. I want to achieve that text, when it reaches end of cell skips to the next line.


texts: How to Display available Lowest price for Magento configurable products?

texts: We know that configurable products has different prices. By default Magento displays base price of the configurable product. But I want to display the lowest price available in associated products of that configurable product everywhere in the store. How can I do that?I use Magento 1.9.0.1


texts: Magento 2 Plugin - ProductRepository getList override

texts:
I'm a beginner with Magento 2 and am having some issues with plugins - I've successfully done a plugin to change a simple object get statement (after event) - and in this case after compiling my code I've seen the generated files inside the var/generation folder.

However, when trying to tap in to the ProductRepository getList method, I'm having some issues - it's not doing anything.

Is there a log I can check after compilation to try to find out what the issue is?

I've tried before, around, after - different settings, but can't get it to work.  Am I missing something?

I just need to add final price to the product collection.  The example below obviously won't do this, but it doesn't even get compiled.

Can someone hint as to how to achieve this? Perhaps by using 'aroundGetList' - and show me which parameters would work?

Plugin class:

<?php

    namespace MyCo\MyExt\Plugin;

    class ProductOverride {

        public function afterGetList($subject) {

            $subject->addFinalPrice();

        }

di.xml file

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

    <type name="Magento\Catalog\Model\ProductRepository">
        <plugin name="MyListener" type="MyCo\MyExt\Plugin\ProductOverride" sortOrder="1" />
    </type>

</config>

The method I want to plug in to has this signature:

 /**
     * Get product list
     *
     * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
     * @return \Magento\Catalog\Api\Data\ProductSearchResultsInterface
     */
    public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
}

The method already appears to have a generated interceptor file also... is it wise to do it this way if i just want to call $collection->addFinalPrice();?

   public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
    {
        $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getList');
        if (!$pluginInfo) {
            return parent::getList($searchCriteria);
        } else {
            return $this->___callPlugins('getList', func_get_args(), $pluginInfo);
        }
    }


texts:
How can I limit the client to only buy 4 products per month.

For example I have product A, B, C, D and E.

The costumer makes an order and puts in the cart product A,B and C.

In the same month the costumer can only put in cart product A,B,C and D or E. But not D,E and A. Because the costumer already ordered product A,B and C and he can only buy 4 products per month. The next month he can make an order with A,B,D,E , but in the same month he can only buy one of those 4 and he won't be able to buy the other one. How can I do that ?

I got this

    $orders = Mage::getResourceModel('sales/order_collection')
    ->addFieldToSelect('*')
    ->addFieldToFilter('customer_id', $customer->getId())
    ->addAttributeToSelect('created_at')
    ->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to))
    ->load();

to get the orders, but how can I find the products purchased so I can check if he putted any product in the cart the he shouldn't ?


texts:
Hi am trying to export a product csv file but am not getting a file as does not appear and when i export the file i get this message messeage is added to queue,wait to get you file soon and i never get it..
i have also run all the commands
php bin/magento setup:di:comlile

php bin/magento setup:upgrade

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

and cache flush
but issue seem to remain please help me its urjent am still a learner in magento


texts: Magento 2 : How to override translation file module wise?

texts: I need to update translation file only for checkout page , so how can I do that . I don't want to use translation file which is use in theme folder.


texts: Magento 2 EE: How can I disable certain B2B emails?

texts:
I have a Magento 2.2.4 store with the B2B extension installed.

I am looking to disable some of the emails for which you can set templates in

  Stores > Configuration > Customers > Company Configuration

How can I add an admin setting to disable the sending of these emails like you see in the

  Sales > Sales Emails settings


texts: add conditional filter to sales_order_grid collection (magento2)

texts:
I want to add a custom filter to the order collection, checking if some conditions are met. A helper method should return false/true, and then apply the custom filter if it returns true. The custom filter is just a boolean returned from a custom column added to sales_order table. Basically, I want to show the orders that have this column value set as true only to a specific admin user and hide them from the other admin users. Of course, this should only be applied to the admin sales order grid.

I am just starting to learn about the UI components and I have no idea how could I achieve this using the new system.

Should I go with a class preference for the grid collection instead? Should I add a plugin to a relevant method maybe?

I'm hoping that some more advanced users can help me choosing the best path for this.

Thanks!


texts: Creating category from flat file csv and save in loop

texts:
I have csv flat file with the items and with the category and subcategories attached to this item. Using this file i have to create a categories tree. I have this piece of code:

there is a loop here and some code to get data from file line by line{
$category = Mage::getModel('catalog/category');
           $category->setName($level);
           $category->setUrlKey(strtolower($level));
           $category->setIsActive(1);
           $category->setDisplayMode('PRODUCTS');
           $category->setIsAnchor(1);
           $category->setStoreId(1);
           $category->setPath($parent_path);
           $category->save();
}

and generally it works fine but because of save() method in loop it takes ages... how could I optimize it? I tried to move save() outside the loop but it doesn't work also saveAttribute() method doesn't work.


texts: Multiple custom product tabs not displaying in Magento2.3.1

texts:
<referenceBlock name="product.info.details">
        <block class="Magento\Catalog\Block\Product\View" name="whats_in_the_box.tab" template="Vendor_Module::product/view/whats_in_the_box.phtml" group="detailed_info" >
            <arguments>
                <argument translate="true" name="title" xsi:type="string">Whats In the Box</argument>
            </arguments>
        </block>
        <block class="Magento\Catalog\Block\Product\View" name="product_image_gallery.tab" template="Vendor_Module::product/view/product_image_gallery.phtml" group="detailed_info" >
            <arguments>
                <argument translate="true" name="title" xsi:type="string">Gallery</argument>
            </arguments>
        </block>
        <block class="Magento\Catalog\Block\Product\View" name="product_video.tab" template="Vendor_Module::product/view/product_video.phtml" group="detailed_info" >
            <arguments>
                <argument translate="true" name="title" xsi:type="string">Video Gallery</argument>
            </arguments>
        </block>
    </referenceBlock>


texts: How to add store selector multi select field in admin form without using ui component?

texts:
I am trying to get store selector in admin form. I created this form without using ui component. I tried the below code but it didn't worked and I got the below error.
The expected input field is:

The input field code is:
$fieldset->addField(
        'store_view',
        'Magento\Store\Ui\Component\Form\Field\StoreView',
        [
            'label' => __('Store view'),
            'name' => 'store_view',
            'disabled' => false,
            //'class' => 'Magento\Store\Ui\Component\Form\Field\StoreView',
            'values' => $this->options->toOptionArray()
        ]
    );

In the above code $this->options is "Magento\Cms\Ui\Component\Listing\Column\Cms\Options" class object.
The error is:

1 exception(s): Exception #0 (InvalidArgumentException):
Magento\Store\Ui\Component\Form\Field\StoreView doesn't extend
\Magento\Framework\Data\Form\Element\AbstractElement
Exception #0 (InvalidArgumentException):
Magento\Store\Ui\Component\Form\Field\StoreView doesn't extend
\Magento\Framework\Data\Form\Element\AbstractElement #1
Magento\Framework\Data\Form\AbstractForm->addField() called at
[vendor/magento/framework/Data/Form/Element/Fieldset.php:214]
#2 Magento\Framework\Data\Form\Element\Fieldset->addField() called at [app/code/Vital/CustomisedIntegrations/Preference/CustomisedForm.php:104]
#3 Vital\CustomisedIntegrations\Preference\CustomisedForm->_addGeneralFieldset()
called at
[vendor/magento/module-integration/Block/Adminhtml/Integration/Edit/Tab/Info.php:53]
#4 Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info->_prepareForm()
called at [vendor/magento/module-backend/Block/Widget/Form.php:156]
#5 Magento\Backend\Block\Widget\Form->_beforeToHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1110]

Note: I need the store selector in admin form without using ui component.
I found a related question here but still didn't get a proper answers. please suggest me a better solutions


texts: Magento 2.3 Customer custom Attribute in email template

texts:
I have created some custom Customer attribute and added them in Customer registration form, everything is fine, except that when a successful registration email goes I want to send those attribute values in email, I am able to send customer name in email fine using
$customer.name

and for custom attributes I tried:
{{var $customer.getCustomAttribute('attribute_code')}}

also tried this:
{{trans "%bname" banme=$customer.getCustomAttribute('attribute_code')}}

but always getting blank value.
==========================
Managed to get the values directly using
{{var customer.customattributecode}}


texts: M2 Filter shows different number while after applying the filter it returns more

texts:
When navigating to a category, the filter shows a number which is different from what the result returns when clicking on it.

This is what I could see:

This is the result after applying the filter temperature sensor:

As you can see, it shows 1 in the filter but returns 13 products. the 13 products are okay, that's what I need as you can see in here:

I found the template, but its hard to see where this happens. Does anybody have an idea where to look first?


texts: Custom module works on localhost but not on server | Magento 2

texts:
I have a simple custom module. It works fine on localhost but not on server. Frontend test route get a 404. Backend button action exist but does not works. I have no server log and no magento log. I have try to compile, reindex, flush cache, setting server permission but no way.

Where can i find for a log or try another solution?


texts: Magento after login SSL, page redirects to https account dashboard

texts:
We have Magento and we have secure login page. After you login it directs you to account page and the url is https and every page after that is https. How can we make the page after login or page after any https page go to http. It is causing issues with a module.

We just want the login and the checkout to be https. If a person is at https checkout and wants to go back to an unsecure part of the store, we would like the url to go back to http.


texts: Parent category products set as anchor do not show on front-end - Magento 2.3.1

texts:
We are facing a very strange problem and hope someone has maybe an idea to help.

We are using Magento version 2.3.1

No products of the main category, set as anchor are showing up in the front-end. Thing is, we have this parent category here ID:4) set as Anchor. Total quantity of products of child categories here is 485.

This here is the setting: https://pasteboard.co/Iurzba6.jpg

It seems somehow, that 485 products in this category are somewhat not displaying, but 125 products when using the filter do.

We have re-indexed multiple times, deployed, cleaned the cache and all, but products are not showing.

Only when we say "Anchor = No" and manually add products it is working (but also only up to a certain quantity). Strangely it is also working once we use the filter and product quantity is below 200. Then all works fine.

But for now, only the static block with content is showing in the front end, but no products.

We have disabled all filter modules, but same thing happens. All other categories work just fine and products do show up!

Has anyone maybe experience the same behaviour and has a hint or an idea, where to look at to solve this problem?

Thank you very much in advance and best regards.


texts: Not getting customer orders in Magento 1.8.0.0

texts:
I currently have magento sending Emails to the customer upon making an order, but i am not getting bcc'd or a separate email notifying me at all.

I do have all of the emails I wish to receive the email listed in Config > System > Sales Emails >

I have also read about magento forcing you to use a cron job to send the emails, but that seems to be only relevant in magento 1.9 and beyond.

All other resources I have googled in regards to this issue have discussed modifying code that is not even existent in my magento installation.

Please help


texts:
Does magento attribute sets have any relation with categories ?

It's just that recently I removed all the attribute sets except "Default" attribute set(id=4), the mysql query of delete didn't tell anything about foreign key check issues and the query ran successfully.

But after that when I see in admin > Catalog > Manage Categories, I can't find the first three tabs of any category. Also I can't go to any category page in frontend, all redirect to 404 page. Don't understand why this happens.

Can anybody let me if I am on right track or guide me if I ain't ?


texts:
I am trying to override the way that the Images in the Catalog, Checkout and Cart are going to be loaded someway different then Magento does it by default.

Thats why I'm trying to create a module that changes ImageFactory.php for me.

Module Structure:

I have created an appropriate 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\ImageFactory" type="Vendor\Name\Block\Product\ImageFactory" />
</config>

In ImageFactory I have changed the module that's being loaded by Magento2, which is located correctly in the structure.

However, neither the Phtml or the ImageFactory is being called by Magento. The module is actively read by Magento as I see the adminhtml settings that I've configured in config.xml and such.


texts: Backend Locale Options is missing most of the countries?

texts:
I've a magento 2.2.2, the locale is missing most of the countries in backend
and converted into chinese, where is these options loaded from? How can i fix it?


texts:
Note: There is no solution for this issue in SE.

PayPal gateway has rejected the request. The totals of the cart item amounts do not match order amounts (#10413: Transaction refused because of an invalid argument. See additional error messages for details).

2017-07-28T12:48:59+00:00 DEBUG (7): Array
(
    [url] =><.......url.........>
    [SetExpressCheckout] => Array
        (
            [PAYMENTACTION] => Authorization
            [AMT] => 100.00
            [CURRENCYCODE] => USD
            [RETURNURL] => https://abcd.com/paypal/express/return/
            [CANCELURL] => https://abcd.com/paypal/express/cancel/
            [INVNUM] => *****
            [SOLUTIONTYPE] => Mark
            [GIROPAYCANCELURL] => https://abcd.com/paypal/express/cancel/
            [GIROPAYSUCCESSURL] => https://abcd.com/checkout/onepage/success/
            [BANKTXNPENDINGURL] => https://abcd.com/checkout/onepage/success/
            [LOCALECODE] => en_US
            [ITEMAMT] => 2.00
            [TAXAMT] => 0.00
            [SHIPPINGAMT] => 0.00
            [BUSINESS] =>
            [NOTETEXT] =>
            [EMAIL] => abcd@gmail.com
            [FIRSTNAME] => abcd
            [LASTNAME] => 215
            [MIDDLENAME] =>
            [SALUTATION] =>
            [SUFFIX] =>
            [COUNTRYCODE] => country
            [STATE] => state
            [CITY] => city
            [STREET] => address
            [ZIP] => zip code
            [PHONENUM] => mobile
            [SHIPTOCOUNTRYCODE] => IN
            [SHIPTOSTATE] => state
            [SHIPTOCITY] => city
            [SHIPTOSTREET] => address
            [SHIPTOZIP] => zip code
            [SHIPTOPHONENUM] => mobile
            [SHIPTOSTREET2] =>
            [STREET2] =>
            [SHIPTONAME] => name
            [ADDROVERRIDE] => 1
            [METHOD] => SetExpressCheckout
            [VERSION] => 72.0
            [USER] => ****
            [PWD] => ****
            [SIGNATURE] => ****
            [BUTTONSOURCE] => Magento_Cart_Community
        )

    [response] => Array
        (
            [TIMESTAMP] => 2017-07-28T12:48:59Z
            [CORRELATIONID] => **************
            [ACK] => Failure
            [VERSION] => 72.0
            [BUILD] => *******
            [L_ERRORCODE0] => 10413
            [L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
            [L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
            [L_SEVERITYCODE0] => Error
        )

    [__pid] => 1928
)

2017-07-28T12:49:04+00:00 DEBUG (7): Array
(
    [url] => ...url...
    [getPalDetails] => Array
        (
            [METHOD] => getPalDetails
            [VERSION] => 72.0
            [USER] => ****
            [PWD] => ****
            [SIGNATURE] => ****
            [BUTTONSOURCE] => Magento_Cart_Community
        )

    [response] => Array
        (
            [PAL] => ************
            [LOCALE] => en_GB
            [TIMESTAMP] => 2017-07-28T12:49:04Z
            [CORRELATIONID] => ***********
            [ACK] => Success
            [VERSION] => 72.0
            [BUILD] => **********
        )

    [__pid] => 1930
)


texts: Adding description to product form csv file

texts:
I wrote a code to add product description from sku. Now script works fine but all formatting seems to be lost as in csv and description added to product is partial (seems it removes string after any special character).

My code:

require_once 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
if (($handle = fopen("Witedescriptions.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $desc =$data[1];
        $sku = $data[2];
        $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
        $product->setDescription($desc);
        $product->save();
    }
    fclose($handle);
}

Csv file struture

Sno. | Description | Sku

on sample data for description

Test this is dummy data abd’s base is of a slim yellow gold halo that easily fits on a finger.

list here
•   list 1
•   list 2

When I ran script, product has below data only:

Test this is dummy data abd


texts: Go to payment option directly if user is logged in in onepagecheckout

texts:
I am trying to override the onepage checkout controllers in way that if the user is logged in he should directly go to the payment options and will not see the billing details.

The approach I am using is that I'm trying to override the /app/code/core/Mage/Checkout/controllers/OnepageController.php file and edit the indexAction() method to achieve this. But I see that I cannot do that until each step is posted its data. I have modified the indexAction() method in the following way uptil now,

public function indexAction()
{
    if (!Mage::helper('checkout')->canOnepageCheckout()) {
        Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
        $this->_redirect('checkout/cart');
        return;
    }
    $quote = $this->getOnepage()->getQuote();
    if (!$quote->hasItems() || $quote->getHasError()) {
        $this->_redirect('checkout/cart');
        return;
    }
    if (!$quote->validateMinimumAmount()) {
        $error = Mage::getStoreConfig('sales/minimum_order/error_message') ?
            Mage::getStoreConfig('sales/minimum_order/error_message') :
            Mage::helper('checkout')->__('Subtotal must exceed minimum order amount');

        Mage::getSingleton('checkout/session')->addError($error);
        $this->_redirect('checkout/cart');
        return;
    }
    Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
    Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure' => true)));

    // Save the billing and shipping sections
    // And then proceed to payment section
    if(Mage::getSingleton('customer/session')->isLoggedIn()){
        $this->saveBillingAction();
        $this->saveShippingAction();

    }

    $this->getOnepage()->initCheckout();
    $this->loadLayout();
    $this->_initLayoutMessages('customer/session');
    $this->getLayout()->getBlock('head')->setTitle($this->__('Checkout'));
    $this->renderLayout();
}


texts: Are there any extensions, open-source Magento modules, or tutorials that make adding a step to the one page checkout any easier?  I've poked at the core code for this a few times and it seems like there's a lot of hard coded step information.


texts:
In my home page there is product listing. Each product contains a button called "Add to Cart". On clicking it is adding into the cart and a pop up is showing telling "your product has been added to the cart". I want to show the respective product name in the pop up .
Following is the ajax code while clicking on the button..

jQuery('#buy_<?php echo $_product->getId(); ?>').click(function() {
jQuery.ajax({
    url: '/ajax/index/add',
    dataType: 'json',
    type : 'post',
    data: { isAjax: 1, qty: 1, product: jQuery(this).data('product-id') },
    success: function(data){
        jQuery('#add-product-container').jqmShow();
    }
});

return false;
});

            <?php echo "PRODUCT NAME"; ?>
            has been added to <a href="<?php echo $this->getUrl('checkout/cart'); ?>" class="text-link">your basket.


texts: Magento 2.0 ShipmentNotifier: required parameter 'theme_dir' was not passed (within cronjob)

texts:
I'm working on an order updater and got everything working except for the shipment notifier (sending the email on order completion).

The log below shows looping over three orders and the errors being thrown when $this->ShipmentNotifier->notify($shipment); is being called.
I already load configuration using $objectManager->configure($configLoader->load('frontend'));

My log is as follows:

[2016-12-23 09:02:48] main.INFO: Company\Plugin\Cron\Orders::update [] []
[2016-12-23 09:02:48] main.INFO: Updating 000000006 [] []
[2016-12-23 09:02:49] main.ERROR: Required parameter 'theme_dir' was not passed [] []
[2016-12-23 09:02:49] main.INFO: Updating 000000013 [] []
[2016-12-23 09:02:49] main.ERROR: Environment emulation nesting is not allowed. [] []
[2016-12-23 09:02:49] main.ERROR: From Header set twice [] []
[2016-12-23 09:02:49] main.INFO: Updating 000000015 [] []
[2016-12-23 09:02:49] main.ERROR: From Header set twice [] []

Even with the errors being thrown ShipmentNotifier is still returning true.
What am I missing?

ps: The code I'm using is largely following this tutorial: http://www.magestore.com/magento-2-tutorial/how-to-create-shipment-programmatically-in-magento-2/  Only difference being that I am using dependency injection instead of the object manager.


texts: Magento 2 : We can show add to cart with default required option of bundle product in upsell list?

texts:
I want to call bundle product with all option and add to cart button in upsell section.

OR

Want to add bundle product in cart directly from any listing with all its default option.

Is it possible to do this ?


texts:
MY custom database, is getting data from a form, and is inserted when the consumer reach a certain page. I can't make it any other way (because of reasons)

the page is an easy access page, and people (and bots) can reach it easy.
It result of a lot of empty rows in my table, and I want to write a code that delete all empty row, each time they reach the that page.

When I'm inserting the data I use below code:

$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO mage_emailorder (emailorder_id, order_date, product_name, location, date_for, name_title, email, company, adress, zipcode, city, phone, ean, comment, order_done, number_of_entries)
VALUES (NULL, '$newdate', '$conferance_name', '$hotel', '$datefor', '$ogtitel', '$email', '$virksomhed', '$adresse', '$postnr', '$by', '$telefon', '$ean', '$kommentarer', '0', '$entries')";

try {
    $conn = Mage::getSingleton('core/resource')->getConnection('core_write');
    $conn->query($sql);
} catch (Exception $e){
    echo $e->getMessage();
}

the deleting code

$sql2 = "DELETE FROM mage_emailorder WHERE product_name IS NULL;"

try {
    $conn = Mage::getSingleton('core/resource')->getConnection('core_write');
    $conn->query($sql2);
} catch (Exception $e){
    echo $e->getMessage();
}
?>

My code for deleting is giving me error in the try{ }catch(){}, can some one help me with why?


texts: Magento 2: How to programatically create credit memo for order item & refund amount to store credit?

texts:
Is their any way we can create credit memo programmatically for a product
and also refund as store credit in customer account ?
Any thoughts ?
Thankyou