texts:
I want to generate coupon on order success below is the code i am unsing to generate in Observer

public function __construct(
        \Psr\Log\LoggerInterface $logger,
        \Magento\SalesRule\Model\Rule $rule
    )
    {
        $this->logger = $logger;
        $this->rule = $rule;
    }
public function execute(\Magento\Framework\Event\Observer $observer)
        {
            $order = $observer->getEvent()->getOrder();
            $orderId = $order->getId();
            $coupon = [];
            $coupon['name'] = 'vip_signup';
            $coupon['desc'] = 'Discount for vip signup coupon.';
            $coupon['start'] = date('Y-m-d');
            $coupon['end'] = '';
            $coupon['max_redemptions'] = 1;
            $coupon['discount_type'] ='by_percent';
            $coupon['discount_amount'] = 15;
            $coupon['flag_is_free_shipping'] = 'no';
            $coupon['redemptions'] = 1;
            $coupon['code'] ='NL01-1234';

        //this code will normally be autogenetated but i am hard coding for testing purposes

        $shoppingCartPriceRule =  $this->rule->create('Magento\SalesRule\Model\Rule');
        $shoppingCartPriceRule->setName($coupon['name'])
                ->setDescription($coupon['desc'])
                ->setFromDate($coupon['start'])
                ->setToDate($coupon['end'])
                ->setUsesPerCustomer($coupon['max_redemptions'])
                ->setCustomerGroupIds(array('0','1','2','3',))
                ->setIsActive(1)
                ->setSimpleAction($coupon['discount_type'])
                ->setDiscountAmount($coupon['discount_amount'])
                ->setDiscountQty(1)
                ->setApplyToShipping($coupon['flag_is_free_shipping'])
                ->setTimesUsed($coupon['redemptions'])
                ->setWebsiteIds(array('1'))
                ->setCouponType(2)
                ->setCouponCode($coupon['code'])
                ->setUsesPerCoupon(NULL);
        $shoppingCartPriceRule->save();

        }

events.xml

<event name="sales_order_save_after">
        <observer name="vendor_coupon_order_save_after" instance="Vendor\Coupon\Observer\GiftcardSave" />
    </event>


texts: How can i get selected value in multiple dropdown in admin form

texts:
Code:

$fieldset->addField('race', 'multiselect', array(
        'label'     => Mage::helper('tuition')->__('Race'),
        'values'   => Example_Tuition_Block_Adminhtml_Student_Grid::getValueArray4(),
        'name' => 'race',
        "class" => "required-entry",
        "required" => true,
    ));

in grid.php

static public function getOptionArray4()
{
    $data_array=array();
    $data_array[0]='Indian';
    $data_array[1]='Chinese';
    $data_array[2]='Malay';
    $data_array[3]='Eurasian';
    $data_array[4]='Others';
    return($data_array);
}
static public function getValueArray4()
{
    $data_array=array();
    foreach(Example_Tuition_Block_Adminhtml_Tutor_Grid::getOptionArray4() as $k=>$v){
       $data_array[]=array('value'=>$k,'label'=>$v);
    }
    return($data_array);

}

and save data like this

$post_data['race'] = implode(',',$post_data['race']); // 0,1,2,3

Now i want to get selected value in admin form how can i do this

Here i want to get selected that value which is saved in database but i m getting only one selected value


texts: How to determine if a customer is new in Magento when using afterSave (or other) Plugin?

texts:
What is the best way to identify a new customer when using an afterSave Plugin?

Or should I use a different approach to do something with new customers?


texts:
I have been working in a project with some custom code... this is our first "medium" Magento 2 project, so (as all people here I think) every day we learn new things, and we have to change the way to deal with this new Magento version

The reason for this question is asking about the command setup:di:compile

I've been using it since the first day with Magento 2, as bin/magento asks for it after every setup:upgrade, with message "Please re-run Magento compile command"

Well... I have found executing setup:di:compile breaks product view page in this project, with a totally ambiguous Fatal Error. I've spent whole working days trying to debug it and testing with code changes with zero result

Today, I have discovered that if I omit that command then all works like a charm, even in production mode

So, the question is... what exactly does that setup:di:compile command? Is it required? Just recommended? Or it is some deprecated command, which is not needed to be executed?

UPDATE

As some users have required, this is the Fatal Error I was referring

  PHP Fatal error:  Cannot instantiate abstract class
  Magento\Catalog\Block\Product\View\AbstractView in
  ***/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php
  on line 93

I've searched for any custom block using Magento\Catalog\Block\Product\View\AbstractView but I've found it only in layout files, it is not present in any block class constructor

What I can't understand is: why Magento is throwing this Fatal Error with compiled code, but it works like a charm without compiled code


texts: Magento 2 - How to add external css/script to head?

texts:
I try to add external css/javascript to the head. I added this to my theme under Magento_Theme\layout\default_head_blocks.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">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
              integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
              crossorigin="anonymous"
              src_type="url"
              type="text/css"
        >

        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
                integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
                crossorigin="anonymous"
                src_type="url"
        >
        </script>
    </head>
</page>

But it does not load the files and they are not showing in the sourcecode.
I also removed the attributes integrity and crossorigin but it still fails. I executed grunt clean to clear the cache.


texts: Magento 2 Rest API - How to add custom option to Cart Item?

texts:
I am using Magento 2 default quoteCartItem restful APIs to add, delete and update items in cart. Things are working as expected.

GET /V1/carts/{cartId}/items
POST /V1/carts/{cartId}/items
DELETE /V1/carts/{cartId}/items/{itemId}
PUT /V1/carts/{cartId}/items/{itemId}
GET /V1/carts/mine/items
POST /V1/carts/mine/items
DELETE /V1/carts/mine/items/{itemId}

Now, I have to add an identifier/flag to identify whether the user has chosen the item as home delivery or self pick-up.

What are the quote item options and when we need it?
How to add custom attribute/option to quote item?
Is there any in-built API, which I can use achieve my requirement?
Do I need to write Custom API for this?

I'm new in magento 2, not too familiar with technical keywords. Hope I explained this question properly.


texts: Will deleting a store delete all the products in it?

texts:
I have a multi store website in Magento.

If I delete a store will the products in that store also be deleted?

If a product is assigned to all the store what will happen?


texts: Custom field of mobile number is not showing on registration page in Magento 2.2.5

texts:
I want to add mobile no field in registration form.
here is the code

InstallData.php

<?php
/**
 * Copyright © 2016 Rouven Alexander Rieker
 * See LICENSE.md bundled with this module for license details.
 */
namespace Semaio\AdvancedLogin\Setup;

use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
 * Class InstallData
 *
 * @package Semaio\AdvancedLogin\Setup
 */
class InstallData implements InstallDataInterface
{
    /**
     * Customer setup factory
     *
     * @var \Magento\Customer\Setup\CustomerSetupFactory
     */
    private $customerSetupFactory;

    /**
     * Init
     *
     * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
     */
    public function __construct(\Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory)
    {
        $this->customerSetupFactory = $customerSetupFactory;
    }

    /**
     * Installs DB schema for a module
     *
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface   $context
     * @return void
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        /** @var CustomerSetup $customerSetup */
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        // Add new customer attribute
        $customerSetup->addAttribute(
            Customer::ENTITY,
            'customer_number',
            [

                'label'                 => 'Customer Number',
                'input'                 => 'text',
                'required'              => false,
                'sort_order'            => 10,
                'visible'               => true,
                'system'                => false,
                'is_used_in_grid'       => true,
                'is_visible_in_grid'    => true,
                'is_filterable_in_grid' => true,
                'is_searchable_in_grid' => true
            ]
        );

        // add attribute to form
        /** @var  $attribute */
        $attribute = $customerSetup->getEavConfig()->getAttribute('customer', 'customer_number');
        $attribute->setData('used_in_forms', ['adminhtml_customer','checkout_register','customer_account_create','customer_account_edit','adminhtml_checkout']);
        $attribute->save();

        $setup->endSetup();
    }
}

view/frontend/templates/form/register.phtml

    <?= __('CustomerNumber') ?>

        <input type="text" name="customer_number" id="customer_number" value="<?= $block->escapeHtml($block->getFormData()->getCustomerNumber()) ?>" title="<?= __('CustomerNumber') ?>" class="input-text" data-validate="{required:true, 'validate-phoneStrict':true}">

can anyone help me where is the problem?


texts:
I just migrated my website. But I got a problem.

My customers can't log in to their account. When click log in on log-in page. http://www.mywebsite.com/customer/account/login/ It should be log in on their account but it redirects the same page.

I'm very new to magento.
Please Help me how to fix that?


texts:
I am seeing a jQuery error in the console when the page loads. i have tried this link, but the issue has not been resolved

i do know where it comes from.when i refresh the page the issue is resolved.

anyone have idea about this?


texts: How to retrieve the SKU of the first simple product for a configurable product

texts:
I am trying to retrieve the SKU of the first simple product of configurable product as soon as a certain SKU type is found to be "configurable" type. The code below helps find out if the main SKU is configurable or not. I need to find out the SKU of the first simple product of this configurable product. Please advice.

if($_product->getTypeId() == 'configurable'){
 echo 'This is a configurable product';
 // I need to retrieve the SKU of the first simple product for this configurable product and return the SKU
}else{
 echo 'This is not a configurable product';
}


texts: Using magento 2 only show review not rating in product page

texts: I'm using Magento 2 and porto theme on the product page only show the product review. Rating option not displayed in the page.


texts: How to stop a product from adding to cart in Magento 2?

texts:
I am creating an extension for adding a free product Y to cart when adding product X. I don't want to add product Y to cart if the user trying to add product Y itself. Can anyone suggest a solution for me??? (I tried to stop the product from adding to cart, but it is not working).
Thanks


texts: Which MySQL Server provides a better performance for Magento

texts:
What do you use as a MySQL Server for Magento?

MySQL (Oracle)
Percona
others (MariaDB)

Percona provides a set of improvments for InnoDB storage used by Magento intensively, but these improvements do make a difference when running a Magento store.

How do you improve performance (general approaches about architecture, not specific info about setting specific variables like innodb_flush_log_at_trx_commit=2 and so on). I know NBS tryied master-master replication but that is not stable.

I did encounter quite some issues with a master-slave replication with reads redirected towards the slave, because there were some delays in replicating data.

Moving out of MySQL as much as possible? (search to solr and so on).


texts: Admin order status only pending accesible

texts:
I don't know maybe it is correct behaviour (probably not), but in Sales → Orders → Specific Order in comments history box I have available only Pending status. Why is  it so and what/where to change to have the rest of the options?

Update 1

There seems to be statuses assigned to states in Magento. Maybe something is wrong there?


texts: Override Magento 2 Adminhtml Template File

texts:
I'm trying to override this file:

  /vendor/magento/module-import-export/view/adminhtml/templates/export/form/filter/after.phtml

This template file has been declared in:

  /vendor/magento/module-import-export/view/adminhtml/layout/adminhtml_export_getfilter.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <container name="root" label="Root">
        <block class="Magento\ImportExport\Block\Adminhtml\Export\Filter" name="export.filter"/>
        <block class="Magento\Backend\Block\Template" template="Magento_ImportExport::export/form/filter/after.phtml" name="export.form.after" as="form_after"/>
    </container>
</layout>

In my custom extension I created a new layout file:

  /app/code/[Vendorname]/[Extensionname]/view/adminhtml/layout/adminhtml_export_getfilter.xml

With the following content:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="form_after">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">[Vendorname]_[Extensionname]::export/form/filter/aftertwo.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

I have created my template file for a testing purpose:

  /app/code/[Vendorname]/[Extensionname]/view/adminhtml/template/export/form/filter/aftertwo.phtml

I have searched before asking the question, but without success to override the template file after.phtml with aftertwo.phtml. In fact from admin panel it shows the previous template file not mine.

Thank you in advance ^^


texts:
The skin folder on my site is showing the full document root. How do I prevent this?

http://dev.cshardware.net/var/www/html/magento/skin/frontend/enterprise/wood/css/jqtransform.css


texts: Adding Product to Category on selecting yes/no attribute in Magento 2

texts: I want to add a product to my 'On Sale' category when the system admin selects the 'On Sale' yes/no attribute in Magento 2. Please help. Thanks.


texts:
How to check current customer ordered with Purchase Order number in past?

If any ordered with "Purchase Order Number" then print that number.

If you have any idea please help.


texts: Related product rules are not working for newly created product attribute with comma separated values in conditions

texts:
Preconditions (*)

The issue is reproducible in EE 2.3.3.
There are no dependencies modules. Verified in 2.3.3 with sample data.
Verified in the UAT environment with an existing client environment. The issue is reproducible.

Steps to reproduce (*)
Product attribute creation:
Created a product attribute named "Test" as a Global attribute with type as "Text Filed", scope "Global".

Creating a Related Product Rule:

Open Magento admin, and navigate to Marketing->Promotions->Related
Product Rules
Click on Add Rule
Provide the information like below

Tab: Rule Information
1. Rule Name like "Testing"
2. Status like "Active"
3. Apply to "Related Products"
4. From "07/1/2020"

Tab: Products to Match
If All of these conditions are True

1. "Test" (product attribute) **is** MAGT2NA_Test3

Tab: Products to display
If All of these conditions are True

1. "Test" (product attribute) **is one of Constant Value** 24-MB02,701644329389M

Click on Save or Save & Continue Edit
Expected result (*)
The rule should apply for product "MAGT2NA_Test3", and the corresponding products 24-MB02, 701644329389M should display as related products.
Actual result (*)
The products (24-MB02,701644329389M) are not displaying in related products for "MAGT2NA_Test3" on the PDP page.

The product is displaying as a "Related product" when we assign only one product in the Product to the display tab instead of two with comma-separated.


texts: Magento Core: identical block name in one handle

texts:
I want to change the template with block name "persistent.remember.me", but there are two blocks with that same name under the same handle:

app/design/frontend/base/default/layout/persistent.xml

<checkout_onepage_index>
    <reference name="checkout.onepage.login">
        <action method="setTemplate"><template>persistent/checkout/onepage/login.phtml</template></action>
        <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
    </reference>
    <reference name="checkout.onepage.billing">
        <action method="setTemplate"><template>persistent/checkout/onepage/billing.phtml</template></action>
        <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
        <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
    </reference>
</checkout_onepage_index>

I have created a local.xml with the following contents:

app/design/frontend/mytheme/default/layout/local.xml

<checkout_onepage_index>
    <reference name="persistent.remember.me">
        <action method="setTemplate"><template>mytheme/persistent/remember_me.phtml</template></action>
    </reference>
</checkout_onepage_index>

And everything works fine; Only the template of the last reference ("checkout.onepage.billing") gets updated, which is exactly what I want, but I'm not sure why it does this. I was under the impression that block names should always be unique. Is this a bug in Magento? What could happen to this code if I upgrade Magento?


texts:
How can I change the date in magento 2? Not the format, but the date.

For example, I want to post some article with the date of a week ago, like 20 march. How can I do this?

I have searched for it but I can't find it. I can only find for the format.


texts: Magento 2.2: How to apply breakpoints in custom .less files

texts:
Magento 2.2.3
Ubuntu 16.04 Server VM using VirtualBox with icewm window manager
Apache 2.4
MySQL 14.14
PHP 7.0
Custom theme which inherits from Magento/blank

I have a custom .phtml file:

  Vendor/theme/Magento_Theme/templates/html/new_products.phtml

NEW RELEASES

<?php echo $this->getLayout()
            ->createBlock("Magento\Catalog\Block\Product\Widget\NewWidget")
            ->setProductsCount("10")
            ->setTemplate("product/widget/new/content/new_grid.phtml")
            ->toHtml();
?>

The block inherits styles perfectly well when written outside of any media query, however I can use neither the .media-width mixin, nor a CSS @media query to separate mobile/desktop styles.

When placing these styles within media queries, the default styles are applied. I have tried various configurations within the .less file and its current state is as follows:

  Vendor/theme/Magento_Theme/web/css/new_products.less

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .new-products-banner-container {
        width: 100%;
        height: 53px;
        z-index: 1;
    }
    .new-products-banner {
        width: 100%;
        max-width: 1280px;
        height: 100%;
        margin: 0 auto;
    }
    .new-products-banner-title {
      margin-bottom: 0;
    }
    .block-title {
      display: none;
    }
    .block-new-products {
      margin-top: 10px;
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .new-products-banner-container {
        width: 100%;
        height: 53px;
        z-index: 1;
    }
    .new-products-banner {
        width: 100%;
        max-width: 1280px;
        height: 100%;
        margin: 0 auto;
    }
    .new-products-banner-title {
      margin-bottom: 0;
      line-height: 2;
    }
    .block-title {
      display: none;
    }
    .block-new-products {
      margin-top: 10px;
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .new-products-banner-container {
        width: 100%;
        height: 53px;
        z-index: 1;
    }
    .new-products-banner {
        width: 100%;
        max-width: 1280px;
        height: 100%;
        margin: 0 auto;
    }
    .new-products-banner-title {
      margin-bottom: 0;
      line-height: 1.25;
    }
    .block-title {
      display: none;
    }
    .block-new-products {
      margin-top: 10px;
    }
}

Note:

I am aware that styles needn't be repeated for mobile/desktop views when they are included in the common view, however even these measures do not ensure that the CSS is rendered.


texts: Magento 2: How to create gird in configuration

texts:
I am trying to create a new configuration for checking postcodes.
Is it possible to add so many postcodes rather than creating one text field
So I can pick which ever postcode by using
type="select"


texts: How to obtain catalog price rule expire date?

texts:
On catalog page I need to show offer "expires in N days".
It can be easily achieved if each product has defined Special Price and date individually for example $this->getProduct()->getSpecialToDate();, but if you set discount via Catalog Price Rule product has no information about discount currently applied and other related data.

I'm wandering how can I get information about current product discount rules used like date?


texts: Magento is anchor shows products from disabled subcategories

texts:
I have a categorie with is anchor = true.

In this categorie I display all the products of all the subcategories. For that I have a special CMS Block where I include another template:

{{block type="catalog/navigation" name="catalog.categories" template="catalog/navigation/myview.phtml"}}

I think that is not so relevant. More relevant is, in this template I get myself a product collection:

$magentoCurrentCategory = Mage::registry('current_category');
$collection = $magentoCurrentCategory->getProductCollection()->distinct(true)->addAttributeToSelect('*');
foreach ($collection as $_product) {
// do something
}

The problem now is, with this I get all products, even products from subcategories that are disabled.

How can I get all products of subcategories, but only from subcategories that are enabled?


texts: How to set default product group price in magento

texts:
We have 3 customer group.
When we create a new product at that time we want all 3 groups are selected and it's price set default 0(zero).
Anyone help me to set this type of functionality.
Find attach image for more clear my requirement.


texts: Invalid template file when executing cron by command

texts:
I'm executing cron job by command

 php -dmemory_limit=-1 ./n98-magerun2.phar sys:cron:run

The cron is sending a quote reminder email, the quote is very similar to an order
I got this error on console:

Invalid template file: 'Magento_OfflinePayments::info/pdf/purchaseorder.phtml' in module: 'Magento_OfflinePayments' block's name: 'info\purchaseorder_0'

I checked this file Magento_OfflinePayments::info/pdf/purchaseorder.phtml and it exists in vendor/magento/module-offline-payments/view/adminhtml/templates/info/pdf/purchaseorder.phtml


texts: How to call displayProductStockStatus() method from a custom block?

texts:
in catalog_product_view.xml of my theme I have a block like this

`<block class="Magento\Catalog\Block\Product\View" name="extra.product.info" template="product/view/extra-product-info.phtml" after="product.price.final"/>`

Then in "extra-product-info.phtml" file I see these lines of code:

    [...]
    $_product = $block->getProduct();
    if ($block->displayProductStockStatus()){
    [...]

displayProductStockStatus() method is used by Magento to decide whether to display or not, the product's stock status in the product detail page; The stock status visibility can be set from the Admin -> Configuration -> Catalog -> Inventory -> Stock Options -> "Display products availability in stock on Storefront" backend config option.

Now, how can I get displayProductStockStatus() method from a custom block?

For example, I created a custom module and I added the block in catalog_product_view.xml, then I created the block file
app/code/{CustomVendor}/{CustomModule}/Block/MyBlock.php with this code
`

use Magento\Framework\View\Element\Template;
use Magento\Framework\Registry;

class MyBlock extends \Magento\Framework\View\Element\Template
{
    /**
     * @var Registry
     */
    protected $registry;

    /**
     * @var \Magento\Catalog\Model\Product
     */
    protected $product;

    /**
     * ProductView constructor.
     * @param Template\Context $context
     * @param array $data
     * @param Registry $registry
     */
    public function __construct(
        Template\Context $context,
        array $data = [],
        Registry $registry
    )
    {
        $this->registry = $registry;
        parent::__construct($context, $data);
    }

    /**
     * @return \Magento\Catalog\Model\Product
     */
    public function getProduct()
    {
        if (is_null($this->product)) {
            $this->product = $this->registry->registry('product');
        }

        return $this->product;
    }

}

`

Besides, from my template file /app/code/{CustomVendor}/{CustomModule}/view/frontend/templates/myblock.phtml I can access the product like this:

`<?php $_product = $block->getProduct(); ?>`

But I can't get $block->displayProductStockStatus() because the block class extends \Magento\Framework\View\Element\Template and not \Magento\Catalog\Block\Product\View

any idea how to implement this method in the class?


texts: How To Download Magento 2.2.2 with Sample data using Composer?

texts:
I know how to install Magento 2 using composer. Magento latest release of version Magento 2.2.2. I don't know how to download or Installation with sample data Using Composer. I try to run direct

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

But I need direct inject with sample data. It's possible?


texts:
I change my price using this code:

update`catalog_product_index_price`
set price = price + price*0.15;

He change, but after 10-30 miuntes he return me the old pices


texts:
OK SO I am making a custom module for our magento 2 store.

I have created a module which displays a " Download Product PDF Link " on every product page. But I need to make the link open a new page in a new tab when it is clicked.

My Layout XML located : Modzinc/dynamicpdf/View/frontend/layout/catalogue_product_view.xml

<?xml version="1.0"?>

<referenceContainer name="product.info.social">
    <block class="Modzinc\Productpdf\Block\Product\View\Link"
           name="modzinc.dynamicpdf.link"
           template="Modzinc_Productpdf::product/view/link.phtml"
           after="-">
    </block>
</referenceContainer>

MY Template File located at :

<?php

$linkTitle = $this->helper('Modzinc\Productpdf\Helper\Data')->getConfig('dynamicpdf/general/linkText');
$linkTextColor = $this->helper('Modzinc\Productpdf\Helper\Data')->getConfig('dynamicpdf/general/linkTextColor');
$linkBGColor = $this->helper('Modzinc\Productpdf\Helper\Data')->getConfig('dynamicpdf/general/linkBGColor');
$linkImage  = $this->helper('Modzinc\Productpdf\Helper\Data')->getConfig('dynamicpdf/general/linkImage');

###TODO make this more dynmic
$linkImage = "http://www.modzinc.co.uk/pub/media/modzinc/dynamicpdf/" .$linkImage;

##style the link and image properly

echo "";
if($linkImage!='') {
    echo "";
}

echo "$linkTitle ";

This all works great and produces the following in the following link as shown here :

Now this is where I am stuck. I need to create a new page opens as "target_blank" in the browser and then I will use my custom code to generate a nice dynamic pdf for the product details.

If this was just a pure PHP application I would do something like this

"Download Product PDF";

And then  I would generate the PDF on the pdfMaker.php page .

So I guess my question is how can I make my link open a new page in magento  and also install this page when my module is uploaded.

Any pointers will be greatly appreciated


texts: Magento 2 : Add External JS Library In Custom Module

texts:
I would like to add External Library to My Custom Module.

I did below steps.

  Vendor/Module/view/frontend/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <link src="Vendor_Module::js/sweetalert.min.js"/>

</head>
<body>
    ......
</body>

  Vendor/Module/view/frontend/requirejs-config.js

 var config = {
 map: {
   '*': {
       sweetalert: 'Vendor_Module/js/sweetalert.min',

 }
}};

** Note:-** JS Added I can see it in the source but there's error in the console too.

Uncaught Error: Mismatched anonymous define() module:

Anything missing ??


texts: Best Redis maxmemory configuration for Magento 2

texts: Right now i'm using Redis as my Magento 2 full page cache and session cache, but sometime this cause my website to get out of memory error, i've fixed the memory_limit for the php and i found out my maxmemory is set to 0 which is unlimited, this can be the source of the problem, what is the best maxmmemory config for Redis?


texts: Get order Collection of last 14 days based on product collection

texts:
I have already product collection which fetches product based on category id, now I want to fetch only products which are ordered from last 14 days from above condition

Any SOlution?

public function getProductCollectionByCategories()
    {
        $ids = $this->cat_id;
        $to = date("Y-m-d h:i:s"); // current date
        $from = strtotime('-15 day', strtotime($to));
        $from = date('Y-m-d h:i:s', $from); // 2 days before

        $collection = $this->_productCollectionFactory->create();
        $collection->addAttributeToSelect('*');
        $collection->addCategoriesFilter(['in' => $ids]);
        $collection->addAttributeToFilter('status', '0');
        $collection->setPageSize(2);
        return $collection;
    }


texts: Mage::log() does not log in all files used by Magento?

texts:
I have overwritten Sitemap.php in app/code/local/Mage/Sitemap/Model/Sitemap.php. The file seems to be used, if I remove all contents, there's an error as expected.

I copied the complete content of the standard Sitemap.php, with one single change. I added

public function generateXml() {
    Mage::log('test');
    ...
}

When I do this anywhere else, it prints test in var/log/system.log as expected, only in this file, it does not log the message.

Any help is greatly appreciated

EDIT

using

Mage::log('text', null, <file>, true);

does not work either


texts: What is the correct way to put a link in template file?

texts:
I have customised the mega menu and integrated it on my Magento site. Now, I need to link the categories links to its corresponding categories.

What is the correct way to link the categories in phtml file?

Looking forward your reply.


texts:
Using How to create a custom grid from scratch article, I have created a custom order grid in Magento admin.

Previously I had added one custom column with name 'my_data' in sales_flat_ordertable.

Now, to display data from this column in Order Grid, I have added following code:

$this->addColumn('my_data', array(
            'header'   => $helper->__('My Data'),
            'index'    => 'my_data',
            'filter_index'=>'main_table.my_data'
        ));

Data is displaying correctly from that column.

My problem is, I have stored values like 1,2,3 in 'my_data' column and now I want to display different values in Order grid depending on the values from 'my_data' column.

For example :

If 1 then 'A' should be displayed.
If 2 then 'B' should be displayed.
If 3 then 'C' should be displayed.


texts:
I have a php script for making catalog updates of prices and inventory. This script might take quite a long time to run, because I need to update around 3k skus.

The site is on a shared hosting, so not all php.ini changes might be possible.

I have 3 problems / questions:

Should I shut down the site or can I avoid it?
If I can avoid shutting down the server, I need to preserve some cpu in order to let people access the site with decent reponse times
How can I avoid the max_execution_time error? Is there a suggested strategy for breaking the task into smaller chunks?


texts:
I am trying to import a spreadsheet with some products in csv with a standard sku, as alm001-alm002-etc.
I already have some registered products of 001-560, but when I import the new .csv file (beyond 561 to 0610), it deletes the other products of the same early sku (alm)


texts: rewrite a controller that is already rewriting another

texts:
Is it possible to rewrite a controller in a community module that is already rewriting a core controller?

I have the syntax correct as it is working in other rewrites but in this specific case the rewrite is not working.

There is a community module rewriting the cart controller and i want to rewrite the community modules cart controller.

It would be like this:

My Controller -> Community Modules cart controller -> Mage Cart controller


texts: Magento2: How to create password protected cms page?

texts:
I want to create password protected page.
Where users once click on password protected page then they redirect to the password page. And then after filling password, they redirect on actual page content. manage session and all.


texts: Error place an order with credit card payment method

texts:
In checkout section i try to place an order using a credit card payment method, my cc data is valid, but when i click place order button the page stuck at loading circle gif, and when i inspect network to find the error i got this error response from payment-information :

  Fatal error:  Call to a member function formatPrice() on null in
  /home/project/public_html/vendor/magento/module-weee/view/frontend/templates/email/items/price/row.phtml
  on line 25

  {"messages":{"error":[{"code":500,"message":"Server internal error.
  See details in report api/1309099902234"}]}}

i try to open the row.phtml file at row 25, i've found this line of code:

  <?= /* @escapeNotVerified */  $_order->formatPrice($block->getRowDisplayPriceExclTax()) ?>

when i try to print the $block->getRowDisplayPriceExclTax() it prints 25.5, and when i try to comment the code like this:

<?//= /* @escapeNotVerified */  $_order->formatPrice($block->getRowDisplayPriceExclTax()) ?>

place an order is working just fine and sending email


texts: How to save data in a table from observer in magento?

texts:
The given below is my code, by which I am able to save data in database. It is working because I am extending Mage_Core_Model_Abstract in observer file. However I don't want to extend the Mage_Core_Model_Abstract file in observer file. Is their any other way to save data from observer?

The given below is my code where I declared observer in config file:

<global>
       <models>
           <User_Tracker>
               <class>User_Tracker_Model</class>
           </User_Tracker>
       </models>
       <events>
           <sales_order_place_after>
               <observers>
                   <User_Tracker>
                       <type>singleton</type>
                       <class>User_Tracker/observer</class>
                       <method>customOrderSave</method>
                   </User_Tracker>
               </observers>
           </sales_order_place_after>
       </events>
   </global>

and the given below is my Observer.php inside model folder through which I save data in table:

class User_Tracker_Model_Observer extends Mage_Core_Model_Abstract
  {
    public function _construct()
     {
        parent::_construct();
        $this->_init('tracker/observer');
     }
    public function customOrderSave($observer)
     {
      $order = $observer->getEvent()->getOrder();
      $ordered_items = $order->getAllItems();
      $customer_name = $order->getCustomerName();
      $customer_email = $order->getCustomerEmail();
      $shippingAddress = Mage::getModel('sales/order_address')->load($order->getShippingAddress()->getId());
      $company = $shippingAddress->getCompany();
      $street = $shippingAddress->getStreet();
      $phone = $shippingAddress->getTelephone();
      $city = $shippingAddress->getCity();
      $zip = $shippingAddress->getPostcode();
      $region = $shippingAddress->getRegion();
      $address = implode(" ",$street);
      $order_date = Date("d/m/y");
      foreach ($ordered_items as $item)
       {
        $product_id = $item->getProductId();
        $product_price = $item->getPrice();
        $product_tax = $item->getTax();
        $product_name = $item->getName();
        $orderedQty = $item->getQtyOrdered();
        $total_price = $orderedQty*$product_price;
       }
      $observer_model = Mage::getModel("tracker/observer");
      $observer_model->setName($customer_name)->setEmail($customer_email)->setProduct($product_name)->setStreet($address)->setCity($city)->setZip($zip)->setQuantity($orderedQty)->setTotalPrice($total_price)->setOrderDate($order_date)->save();
    }
 }


texts: Not able to install Magento 2.9 getting an API error message : An error occured when executing th application API

texts:
FUrther Drill down on the log reveled the below.

  [ERROR] Exception: Missing following extensions: 'zip' in

Need help


texts: bundle product with configurable options

texts:
I have a item and I wanted to sell them as single, 3 pack, 5 pack and 10 pack.
The product comes in 4 different colors so I want to create a product for each pack and if the customer chooses e.g. the 3 pack i want him to be able to select the color of each single product.

I created 4 simple products (for each color one) and then a configurable product with all them combined.

How can I do this? I tried a bundle product but I can't add a configurable product to it.


texts: Magento 2 add custom external url to product

texts:
I'm doing an e-commerce site that instead of having products it will have overview of properties, but this properties are stored in an external website.
I need to add an external url to the products, for example Propertie 1 has this link:
https://example.com/property1
I tried to change the url in Search Engine Optimization  and Url Key but it does not allow me to add a custom url.
Greetings!


texts: Why my product stock and stable quantity are not equal?

texts:
I'm selling this product and add 7 into stocks but the default stock is showing only 4.Customer can buy only 4.

What is the Default Stock? And how can I make it equal to my real quantitys that I added to the stock?


texts: instagram feed error is coming in server in magento2

texts:
when I am using widget it is giving an error like
We're sorry, an error has occurred while generating this content.
and the error is in this code
Instagram.phtml

<?php
  $helper = $this->helper('\Solwin\Instagram\Helper\Data');
  $enable = $helper-
 >getConfig('instagramsection/instagramgroup/active');
 $userId = $helper-
 >getConfig('instagramsection/instagramgroup/userid');
 $accessToken = $helper-
>getConfig('instagramsection/instagramgroup/accesstoken');
 $imageNumber = $this->getData('numberimage');
$imageResolution = $this->getData('resolution');
 ?>

<?php
 if ($enable) {
  ?>

<?php echo $this->getData('title'); ?>

    <?php
    $url = 'https://api.instagram.com/v1/users/' . $userId . '/media/recent/?access_token=' . $accessToken.'&count='.$imageNumber;
    $args = stream_context_create(array('http' => array('timeout' => 2500,)));
    //for Live server

    $instagramFeedsData = file_get_contents($url, false, $args);
    // for Local Server
    // $instagramFeedsData = $helper->getInstangramData($url);

    $instagramFeeds = json_decode($instagramFeedsData);

    $instangramData = $instagramFeeds->data;
    foreach ($instangramData as $instagramFeed) {
        $instagramImage = $instagramFeed->images->$imageResolution->url;
        ?>

        <?php
        $caption_text = 'Instagram';
        if (is_object($instagramFeed->caption)) {
            $caption_text = $instagramFeed->caption->text;
        }
        ?>

            <a href ="<?php echo $instagramFeed->link; ?>" target="_blank">
                <img src="<?php echo $instagramImage; ?>" title="<?php echo $caption_text; ?>" alt="<?php echo $caption_text; ?>"/>

        <?php
    } ?>

<?php }

i am not getting where is the error in this


texts: Currency converter is not working properly? please help?

texts:
website name: http://kopanaacreations.com/. Present we are using INR is the default currency.

When user select the currency as "Euro" it is changing, but value is not converting correctly.

Example if a product cost is 6000 Rs. When converting to Euro it has to show approximately as 85 Euros. But it showing as 2Euros. [Values are approximately i am giving here].


texts: Product preview button in manage product page

texts:
I want to implement product preview button on manage products page,before saving the products so admin have some idea how products are looking in frontend, there are extension available for doing this, but they all preview page after saving the products, but how we can implement before saving product?

I think to use ajax functionality to take all product fields value when call, but how we can determine what current theme and what breadcrumb will look like. If product has review and tag then display those field also and upsell and related products, default header and footer etc etc....


texts:
My home page of magento website is loading twice. I am not able to detect the reason. Could any one suggest me some idea? It is happing in live site only not local. i have checked below things.

<img src="">
<input type="image" src="">
<script src="">
<link rel="stylesheet" href="">
<embed src="">
<object data="">
<iframe src="">
<video src="">
<video poster="">
<audio src="">
<command icon="">
<html manifest="">
<source src="">

It is not due to any of the above code


texts: How to Text editor value display product image?

texts:
Please see this below image

In this, the right has the text editor column and left side to have the product image frame. I need the text area value is display on image frame.how can I write this functionality...?


texts: Editing Magento EE recurring profiles Add To Cart Button

texts:
We are looking to use the Magento EE recurring profiles function to enable people to buy/sign up to recieve a product automatically shipped to them monthly.

However I noticed that enabling the recurring profiles function results in the page having two "add to cart" buttons. Which could cause some confusion by the customer knowing which button is which.

I tried looking for where the html code was for the recurring profiles add to cart button but could not find it. Does anyone know where the code is for the button so that it can be edited (want to change the text label on it)


texts: Magento 2 : Checkout with new shipping method issue when code length exceeds 40 characters

texts:
Want to discuss about issue i faced and suggestions on it.

In quote_shipping_rate table's column code's allowed length is 255 but in quote_address table's column shipping_method's length is 40 only.

So when setting carrier and method in shipping method it combines both and saving in table quote_shipping_rate.

So here if combined code length exceeds 40 character then loosing characters from index 41.

With this configuration i can reach checkout payment page. But after that i am getting "An error occurred on the server. Please try to place the order again"

Preconditions

List item
Magento Version : 2.1.6 (community-edition)
PHP : 7.0.24
MySQL : 5.7.19

Steps to reproduce

Add new shipping method Reference for Creating New Shipping Method
Try checkout by selecting this shipping method
At Payment checkout step error will be triggered

Expected result

It should place order successfully

Suggested Solution

Increase quote_address table's column shipping_method's length from 40 to 255 (It should be same as quote_shipping_rate table's column code's length 255)
The error is not catchable so i am suggesting this update.

Original bug on github.


texts: Change order of short_description on catalog_product_view.xml - Magento2

texts:
How can I change the order of the "short description"? I would like to place it above the "add to cart" button and not under it, like it is now.

Here how it is right now:

Here how it should be:

Thanks alot!


texts: Magento2.2 sitemap genrate after some product url not showing properly

texts:
I have to used Magento2.2 and we are also install in our site this plugin olegkoval/magento2-regenerate-url-rewrites but we are truncate url_rewite table after run this command on our staging site than after flush and reindex sitemap.xml inside getting url

http://test.XXX-italy.com/catalog/product/view/id/86

Please if any one know how to resolve it url for sitemap already i used this plugin  OlegKoval RegenerateUrlRewrites but when i regenrate after check it sitemap.xml there  this type "http://test.XXX-italy.com/catalog/product/view/id/86" of more than url  showing it.


texts: Magento 2 - Add external scripts from CDN

texts:
I try to load all required scripts for bootstrap 4 like seen on w3schools.com

app\design\frontend\company\base\Magento_Theme\layout\default.xml

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

        <!-- jQuery library -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

        <!-- Popper JS -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>

        <!-- Latest compiled JavaScript -->
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
    </head>
    <body>
        <referenceBlock name="footer_links" remove="true"/>
        <referenceContainer name="footer">
            <block class="Magento\Cms\Block\Block" name="footer_menu">
                <arguments>
                    <argument name="block_id" xsi:type="string">footer_menu</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>

  But if I inspect the source code of my site, then I see this:

<script  type="text/javascript"  src="http://example.com/pub/static/version1573136151/frontend/hausfux/base/de_DE/https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script  type="text/javascript"  src="http://example.com/pub/static/version1573136151/frontend/hausfux/base/de_DE/https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script  type="text/javascript"  src="http://example.com/pub/static/version1573136151/frontend/hausfux/base/de_DE/https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>


texts: How to completely separate layouts for different customer groups

texts:
We are building a store in which it is required to make totally different account dashboards for various customer groups.

So, for my humble experience, I have two options, to filter on the controller level (to make checks in the AccountController for example and pass vars to block), and to filter (add/remove layout handles) it via observer (according to this link http://www.atwix.com/magento/magento-customer-group-layout-handle/).

I decide to do it via observer, but client worrying if some difficulties may occur in future (adding/removing lots of layout handles), in case dashboard for certain user group will grow, and asks me to separate the logic "on the root".

Thinking on how to do it and would love to hear some expert's advice on how to plan architecture for this purpose, thanks!


texts: How to create new shipping module with user input during checkout?

texts:
I bought a couple of books on Magento extension development and understood the mechanism on how to create a new shipping module. However in my current project I need to allow the customer to enter his/her own shipping account number and the number should appear in the order details (similar to a tracking number).

In other words, during checkout the customer should see:
Shipping Method
  Customer Shipping Account
  Carrier [dropdown list to choose UPS, FedEx and Others]
  Account Number [free text]

Where should I start looking for documentation on how this can be implemented? Sorry I am very new to magento development.


texts: ERROR One or more indexers are invalid. Make sure your Magento cron job is running

texts: Here is the image with what happens when I try to reindex


texts: What is the best way to get product image(thumbnail) by sku ?


texts: How can i solve Multi-Store Customer Login Error?

texts:
I have multi store website, store 1 there is no issue, 2nd store getting error while customer login, may i know the possibilities of error?

Note : There is no error in error log files


texts:
I am going to take the Magento Certified Developer exam soon.
I know there are 72 questions in the exam, but I can't find any information about the passing score even from the official Magento website.

What is the passing score for the Magento Certified Developer Exam?


texts: Type Error when trying to Edit Configurable Product in magento 2.3.3

texts:
I am getting an uncaught type error when trying to edit configurable product in magento 2.3.3
See error here https://prnt.sc/vd1jf0


texts: Get Store View id or code in plugin in magento2

texts:
I want to write a plugin which executes a code only if a specific store view is active.
I have read in the magento docs, that __construct is not allowed in plugins.
How can I get the store view in a plugin?


texts: Magento 2 : how to save values of custom field in user(customer) registration form

texts:
InstallData.php

<?php
namespace Pulsestorm\HelloWorldMVVM\Setup;
use Magento\Framework\Module\Setup\Migration;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
    /**
     * Customer setup factory
     *
     * @var \Magento\Customer\Setup\CustomerSetupFactory
     */
    private $customerSetupFactory;
    /**
     * Init
     *
     * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
     */
    public function __construct(\Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory)
    {
        $this->customerSetupFactory = $customerSetupFactory;
    }
    /**
     * Installs DB schema for a module
     *
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     * @return void
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
    $installer = $setup;
    $installer->startSetup();
    $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
    $entityTypeId = $customerSetup->getEntityTypeId(\Magento\Customer\Model\Customer::ENTITY);

    $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "regulation",  array(
        "type"     => "int",
        "backend"  => "",
        "label"    => "Regulation",
        "input"    => "text",
        "source"   => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
        "visible"  => true,
        "required" => true,
        "default" => "",
        "frontend" => "",
        "unique"     => false,
        "note"       => ""

    ));

    $regulation   = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "regulation");

    $regulation = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'regulation');
    $used_in_forms[]="adminhtml_customer";
    $used_in_forms[]="checkout_register";
    $used_in_forms[]="customer_account_create";
    $used_in_forms[]="customer_account_edit";
    $used_in_forms[]="adminhtml_checkout";
    $regulation->setData("used_in_forms", $used_in_forms)
        ->setData("is_used_for_customer_segment", true)
        ->setData("is_system", 0)
        ->setData("is_user_defined", 1)
        ->setData("is_visible", 1)
        ->setData("sort_order", 100);
    $regulation->save();

    $installer->endSetup();
}
}

customer_account_create.xml

<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <referenceContainer name="form.additional.info">
        <block class="Magento\Framework\View\Element\Template" name="my_form_additional_info_customer" template="Pulsestorm_HelloWorldMVVM::customer.phtml"/>
    </referenceContainer>
</page>

customer.phtml

<fieldset class="fieldset create account" >
    <legend class="legend"><?php /* @escapeNotVerified */
            echo __('Additional Information') ?></legend>

    <?php /* @escapeNotVerified */
            echo __('Regulation') ?>

        <input type="text" name="regulation" id="photo" title="<?php /* @escapeNotVerified */
        echo __('Regulation') ?>" class="input-text" data-validate="{required:false}">

</fieldset>

I need to know how can i insert value of regulation in database ?
the field (regulation) is not saving in database. In which table this field will be saved ?


texts:
I have a dataflow profile to export products: name, sku, stock qty

Is it possible though to export where stock qty is not 0?

Current Code:

 <action type="catalog/convert_adapter_product" method="load">
    <var name="store"><![CDATA[0]]></var>
</action>

<action type="catalog/convert_parser_product" method="unparse">
    <var name="store"><![CDATA[0]]></var>
    <var name="url_field"><![CDATA[0]]></var>
</action>

<action type="dataflow/convert_mapper_column" method="map">
    <var name="map">
        <map name="name"><![CDATA[Name ]]></map>
        <map name="sku"><![CDATA[sku]]></map>
        <map name="qty"><![CDATA[qty]]></map>
    </var>
    <var name="_only_specified">true</var>
</action>

<action type="dataflow/convert_parser_csv" method="unparse">
    <var name="delimiter"><![CDATA[,]]></var>
    <var name="enclose"><![CDATA["]]></var>
    <var name="fieldnames">true</var>
</action>

<action type="dataflow/convert_adapter_io" method="save">
    <var name="type">file</var>
    <var name="path">var/export</var>
    <var name="filename"><![CDATA[export_stock.csv]]></var>
</action>


texts: Magento Admin Form Data blank when got Session Error message

texts:
I am checking a field for unique data, I put this code:

if ($data = $this->getRequest()->getPost()) {
 if($data['cs']['company_name']){
                $checkCollection = Mage::getModel('test/test')->getCollection();
                $checkCollection->addFieldToFilter('company_name',$data['cs']['company_name']);
                    if(count($checkCollection)){

                        Mage::getSingleton('adminhtml/session')->setFormData(true);
                          Mage::getSingleton('adminhtml/session')->setFormData($data);
                          Mage::getSingleton('adminhtml/session')->addError(Mage::helper('csmarketplace')->__('Company name should be unique.'));
                       /* echo "<pre>"; print_r($data);
                          $test = Mage::getSingleton('adminhtml/session')->getFormData($data);
                          echo "<pre>"; print_r($test);
                        exit;*/

                        $this->_redirect('*/*/new');
                        return;
                    }
                }
}

It is working fine but the form is blank after redirection and Session error.

Can I do this via ajax, this module is admin side module.


texts: How to tell Magento that a cache has become invalid?

texts:
Once a module's configuration in Admin has been changed, page cache should be invalidated (I've confirmed it experimentally), but I do not get such warning for this module I've installed.

So, I suppose it's module's responsibility to explicitly mark specific cache type as invalid.

How can I do it? If it's by using events, the only "cache" events I've found seem to be fired after caches get cleaned, not after they get invalid.


texts: Disabling modules in Mage_All.xml breaks backend in Magnet 1.9.3.8

texts:
I did not change the core files. I created a zzz_deactivate.xml and disabled the modules in this file.

But as explained by @Jonathan Eltgroth in this thread What Default Modules I can disable? disabling a module in Mage_All.xml breaks the backend after flushing the cache.

How can I still completely disable the suggested modules in this thread for better performance without breaking anything?


texts: How can I use mysql functions when I use collection filters?

texts:
How can I use something like this one NOW() - INTERVAL 10 DAY in collection filter?

->addFieldToFilter('period', ['gteq' => 'NOW() - INTERVAL 1 DAY'])

Before running the query, the value in the filter is going to be converted into a string, so MySQL will not run it as functions.

Is there any way I can use the MySql functions in a filter?


texts: Magento 2 api - How to get layer navigation filters available in rest api?

texts:
I have someone issue in api magento 2. I need get layer navigation data available in product collection ( current category , search product ) but I don't know magento 2 api available it or not . I have create new custom api using Magento\Catalog\Model\Layer\Resolver but it not work . Any one can help me ?

thanks guys


texts:
I have followed below magento instructions. I am using the the default nginx file provided by magento. Media and static files are accessible with and without pub folder. Example I am able to access example.com/pub/banner.jpg and example.com/banner.jpg

https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html


texts: Correct way to execute PHP in the background

texts:
Magento CE 1.9.0.1

I've cobbled together a very simple up-sell function using PHP and I'm trying to determine how to proceed with implementing it.

The details of the function:
User adds a simple product (no options) to cart then clicks "Proceed to Checkout" during which time a modal window pops up showing an image and details of the up-sell option. They can click "No Thanks" and proceed to normal checkout URL or they can click "Add to Cart" which will replace the product in there cart with the better/upsell version and automatically go to checkout.

The latter part - Add to Cart - requires PHP and at this point a page refresh in order for it to work. This code modifies the cart contents. In my crude attempt to resolve the issue, I've made it so that when the user Clicks "Add to Cart" it will send them to an empty CMS page where it processes the PHP and then sends them to the checkout. Almost imperceptible in production but I'm assuming there is a better way to trigger a function or event containing PHP. Here is my code:

<?php
// Delete base product
$id = '123'; // this is the product I am removing
$cartHelper = Mage::helper('checkout/cart');
$items = $cartHelper->getCart()->getItems();
foreach($items as $item):
if($item->getProduct()->getId() == $id):
$itemId = $item->getItemId();
$cartHelper->getCart()->removeItem($itemId)->save();
break;
endif;
endforeach;
?>
<?php
// Add upsold product and qty
$id = '321'; // Adds upsold product to cart
$qty = '1'; // Choose how many products to add
$_product = Mage::getModel('catalog/product')->load($id);
$cart = Mage::getModel('checkout/cart');
$cart->init();
$cart->addProduct($_product, array('qty' => $qty));
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
?>

More, potentially arbitrary details: I am using OneStepCheckout and not Magento's default checkout.


texts: Returning wishlist item collection for currently logged in user

texts:
I'm trying to return the wishlist item collection for the currently logged in user and iterate over the collection.

I've tried the following, but I get an empty collection.

<?php /* @escapeNotVerified */
                                    $_in_wishlist = false;
                                    echo count($this->helper('Magento\Wishlist\Helper\Data')->getWishlistItemCollection());
                                    foreach ($this->helper('Magento\Wishlist\Helper\Data')->getWishlistItemCollection() as $_wishlist_item){
                                        if($_product->getId() == $_wishlist_item->getProduct()->getId()){
                                            $_in_wishlist = true;
                                            break;
                                        }
                                    } ?>

I've also tried, getWishlist()->getItemCollection() but this doesn't return anything either.

I'm logged in and I have 2 items in my wishlist. Could this be to do with caching?


texts:
I'm starting a new PWA project, so I'm 'extending' from venia theme this way:

yarn buildpack create-project 'testproject' --template venia-concept --backendUrl https://localtest.com --npmClient yarn --install true

According to Magento docs, that command will generate a new pwa project based on venia theme. Now, when I'm trying to run

yarn build run

I'm getting this error:

TypeError: Cannot destructure property `getMediaURL` of 'undefined' or 'null'.

This is the stack:

TypeError: Cannot destructure property `getMediaURL` of 'undefined' or 'null'.
    at Object.<anonymous> (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/webpack.config.js:4:5)
    at Module._compile (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at WEBPACK_OPTIONS (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:115:13)
    at requireConfig (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:117:6)
    at /Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:124:17
    at Array.forEach (<anonymous>)
    at module.exports (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/convert-argv.js:122:15)
    at yargs.parse (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/cli.js:228:39)
    at Object.parse (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/yargs/yargs.js:567:18)
    at /Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/cli.js:206:8
    at Object.<anonymous> (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack-cli/bin/cli.js:500:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Applications/MAMP/htdocs/pwa/pwa-test/testproject/node_modules/webpack/bin/webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I havent found an answer for that error yet. Anyone around who has been through the same?


texts: How to update Minimum Qty 1 Allowed in Catalog sample products?

texts: Right now in my products minimum quantity 0 is showing. How can i update in bulk products with 1 query ? i want to set minimum qty 1 in all sample products. and also Unchecked box (Using Config Settings). please look at screenshots and give me solution asap. Thanks


texts:
I want to show Ex. GST on everywhere of the store with each price for example if a product price is $15.00 I want to display it like "$15.00 EX. GST" in the cart, product page all over the store.

Please suggest me the solution.

Thanks


texts: Magento 2: How to get user agent and remote ip?

texts:
In magento 1 it

$user_agent = Mage::helper('core/http')->getHttpUserAgent();
$remote_ip = Mage::helper('core/http')->getRemoteAddr();

Are there any similar features in magento 2 ?


texts: Pictures of products not showing up when doing the deploiement on the server from the local

texts: when trying to do the deploiment on the server of my website, the pictures of products were not showing up so what i have to do to show them on server as local thanks in advance


texts: Magento 2: How to set default value of quantity in new product page

texts:
I am new developer of Magento 2.

Is Magento provided a way to set default value of quantity in admin new product page?


texts: Review tab is not showing in magento2 product page

texts:
I have created a custom theme but the review tab is not showing on product page. If I change my custom theme for default luma theme than the review tab starts displaying on product page.

Is there someone who can guide me what am I doing wrong?


texts: MAGENTO - want to get delievery date from UPS

texts:
How can I get the delivery date from the UPS?

Does anyone have any idea about this?


texts: Attribute set is missing after upgrade to magento 2.2.9 from 2.2.6 which is migrated website from magento 1.x

texts:
I had migrated Magento 1 website to Magento 2.2.6, so after some days i had upgraded my Magento version to 2.2.9, after upgrade i can see that my attributes sets are missing and when i checked into databases eav_attribute_set and this table is empty.

Any one have face this type of issue. Please Help


texts: Different views for different customer types

texts:
Our website has 100 products.
We have 50 customers.
20 are friends group
30 are customer group

Is there a way so the friend group can see a specific 40 products, while the customer group can see all 100 products?


texts: Unable to execute cron.php via SSH nor CRONTAB

texts:
I recently hosted my website using Magento, upon setting up my cron.php i get the following output :

/home/xxx/webapps/abc/cron.php: line 1: ?php
: No such file or directory
/home/xxx/webapps/abc/cron.php: line 2: /**
: No such file or directory
/home/xxx/webapps/abc/cron.php: line 3: bin: command not found
/home/xxx/webapps/abc/cron.php: line 4: $'*\r': command not found
/home/xxx/webapps/abc/cron.php: line 5: bin: command not found
/home/xxx/webapps/abc/cron.php: line 6: $'*\r': command not found
/home/xxx/webapps/abc/cron.php: line 7: syntax error near unexpected token `('
/home/xxx/webapps/abc/cron.php: line 7: ` * This source file is subject to the Open Software License (OSL 3.0)

'

I host this on Webfaction, and it appears that this error only happen on Webfaction. My other website (using the same Magento version) which is hosted on another service runs just fine.

Even after i removed the following lines on cron.php, it still does not work:

/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage
 * @copyright  Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

I've also tried to put "shebang" just before the php opening tag like so:

#!/usr/local/bin/php

And get this result:

/usr/local/bin/php^M: bad interpreter: No such file or directory

This is what happen when i run php cron.php

I suspect that there might be something wrong with the encoding. Can anyone help me with this ?


texts: SMTP PRO installed and activated properly but

texts: Magento sends mails only on thunderbird email, and probably through native magento mail function. About a month ago it was working fine, and then for some unknown reason it stopped. Worth to say there was some malware sending spam through our ip, and ip got blacklisted on two lists, it got removed from one, I'm waiting for it to be removed from the second blacklist, is it possible that the ip is blacklisted on some google blacklist, and for that reason I can't receive it on gmail, outlook etc. Although I'm not sure if that would be the case because the mail is being sent through mailto function and not smtp server.


texts:
I've been searching all over, and I can't believe no one has already made a plugin that does this.

So standard Magento, you will filter products, say all size 10's - it will show you all the variable products that have size 10 available - but the price states "From" price....

Now the size 10 is an extra 5 pound than everything else, so is there a way to just show the size 10 price instead of the "From" price? There must be a plugin available for this type of situation?


texts: PayPal Payments Advanced Posts back to some odd site

texts:
I can say for sure, but after I installed Affirm as a payment method on my site, the other payment methods seem to be messed up.

Specifically in this case, payflow advanced, is only half working.  It actually does collect payment at PayPal, but when it is completed, it is posting back to some other site for some odd reason.  Because it doesn't post back correctly to my site, it tells the user it was canceled or incomplete, and the transaction doesn't show to have gone through in the backend.

PayPal tells me the payments are going, but it sees it posting to some other site and can't help me further.  It looks like the return URL is correct, and it shows the transaction approved:

I noticed this on my payment screen if I use the iframe style payment with no cart or logo:

Or, if I use another style layout with the logo and subtotal:

Any suggestions?


texts: Popup modal :Submitting url in magento 2

texts:
I have created custom link using popup modal. I need to placed this link in My Account page->My Orders and next to Reorder link. Like below

While clicking cancel it shows an popup window which consist text area and submit button. While clicking submit,It should save in DB. I have written code, in my Controller file to save the message in DB, But I don't know where I need to give the submit url in below file. Please provide me a solution.

Thanks in advance

history.phtml

                                Cancel

                                <textarea>
                                </textarea>

Controller

<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace XXX\SalesOrder\Controller\Index;

use Magento\Framework\App\Action\Action;
use Magento\Sales\Model\Order;

//use Magento\Framework\Controller\ResultFactory;

class Index extends Action
{

    protected $_resultPageFactory;
    protected $order;

    public function __construct(
    \Magento\Framework\App\Action\Context $context, Order $order, \Magento\Framework\View\Result\PageFactory $resultPageFactory
    )
    {
        $this->_resultPageFactory = $resultPageFactory;
        $this->order = $order;
        parent::__construct($context);
    }

    public function execute()
    {
        $orderId = 3;
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $order = $objectManager->create('\Magento\Sales\Model\Order')->load($orderId);
        $order->addStatusHistoryComment('I need to get message here');// I need to get textarea message here
        $orderState = Order::STATE_PROCESSING;
        $order->setState($orderState)->setStatus(Order::STATE_PROCESSING);
        $order->save();

        $resultPage = $this->_resultPageFactory->create();
        return $resultPage;
    }

}


texts: How to get discount amount for corresponding coupon code in magento?

texts: How to get the discount amount for corresponding coupon code in magento using magentoprogramming?


texts:
I have been wondering always, where is all the registry data stored in Magento ?

I know that even singleton objects are stored in the registry. And registry is just a static array variable of the Mage class.

I have a couple of questions here to clear my confusion:

Is registry different for different users ? I mean is it created on
    a per-user (per HTTP request) basis?

For example,

Mage::register('foo', 'Hello World'); //set a value for foo
Mage::registry('foo'); //will this return hello world for all HTTP users ?

Is registry data stored in
        sessions ? If not how will Magento identify which user invoked the
        registry data ?

I have read Alan Storm's blog article as well as his answer on StackOverFlow regarding this. But I couldn't kill the confusion. Please correct me If I you think my basics are messed up. Thanks


texts: Magento 2.3.3 all swatches are crossed for salable quantity instead of showing out of stock

texts:
In Magneto 2.3.3 configurable product's all swatches are crossed instead of showing out of stock when salable quantity is 0 for all child products.
For example Colour Red, Size: S, M now Red-S and Red-M both salable quantity are 0 but the quantity is 1. Now all 3 swatches (Red, S, M) are crossed and they are not clickable.
So I am looking for some solution when all swatches are not clickable product should show either Out of stock.
That would be a great help if anyone could help me in finding the solution.
Thanks.


texts:
I have installed my theme on localhost and its working fine.

I have my default magento 2.3  setup on server.

I need to install the same theme on server.

Can anyone say which folder i need to copy?

Is it just 'app' and 'pub'???


texts: Magento 2 validate the form input using plugin and save the modified data

texts:
I am using custom plugin to validate the user input for customer profile.

I have created Module Company_Module  and create di.xml file in etc to verify the input given by the user:

<type name="Magento\Customer\Controller\Account\EditPost">

 <plugin name="restrictEditInfo" type="Company\Mymodule\Plugin\Controller\Customer\EditPost" />

</type>

For this in my EditPost  plugin file i have given following code:

public function aroundExecute(
    \Magento\Customer\Controller\Account\EditPost $subject,
    \Closure $proceed
)
{

    $resultRedirect = $this->resultRedirectFactory->create();
    $requestParameters = $subject->getRequest()->getPostValue();

    if ($this->preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/',$requestParameters['firstname']))
    {
            $this->messageManager->addError(__('Special Characters are not allowed.'));
            return $resultRedirect->setRefererOrBaseUrl();
    }
 return $proceed();

}

This validates the input given by the user and prevent form saving if any special characters are given by the user.

Now issue is:  I want to send modified output. It means if customer enter any special characters in input then i want to remove those tags and save it as normal string. To do so i am doing preg_replace which works fine but to save the modified data  i am passing the $requestParameter in proceed method.

    return $proceed($requestParamaters);

To save the modified data i am passing $requestparamaters In  proceed method but it's not working.

To debug this i checked after this around method call is going into controller which is showing the same input given by the user not the modified output i given from the proceed method.

How can i pass my modified input to save?  How can i pass modified output for save?

Any help would be appreciated!


texts: Magento swatches 1.9.1 non latin characters usage

texts:
the swatches in the website are working fine.

I have attributes in native language (Lithuanian) thus I am using non latin characters in file names of swatches.

Thus the situation is as follows the translated images of swatches which have only latin characters shows up perfectly, however non latin character swatches don't show.

Here a screen of filterable navigation http://prntscr.com/71br65

I have swatches named žydra.png and it doesn't show.

Any fix to this?

Magento Community Ed. 1.9.1


texts: Is there any options to reset all configuration setting not the product or attributes. I need to reset only settings because I'm facing some issue.


texts: Magento 2: How to make a block image as sticky header? with category?

texts:
So, I was looking For Making A Block image, or extension sticky! But after searching a lot I found no solutions!!! what i have right now is?

And I want whenever i start scrolling,
I want my Tent Image sticky!!

Okay, If this not possible forget about the categories. just make that tent sticky! which is a image block !!!

or give a good guideline for getting a sticky image header!!!


texts: How to get a shipping method names in admin grid in magento 2

texts:
How to get a shipping method names in admin grid in Magento 2.

I tried like  the below way..

xml file

<block class="Magento\Backend\Block\Widget\Grid\Column" as="methods">
  <arguments>
     <argument name="header" xsi:type="string"
      translate="true">Method</argument>
    <argument name="index" xsi:type="string">methods</argument>
    <argument name="width" xsi:type="string">150px</argument>
    <argument name="type" xsi:type="string">options</argument>
    <argument name="renderer"
 xsi:type="string">Bg\ShippingRestriction\Ui\DataProvider\Columns\Modifier\ShippingMethod </argument>
 </arguments>
</block>

  Bg\ShippingRestriction\Ui\DataProvider\Columns\Modifier\ShippingMethod.php

<?php
namespace Bg\ShippingRestriction\Ui\DataProvider\Columns\Modifier;
use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer;
use \Magento\Framework\App\Config\ScopeConfigInterface;
use \Magento\Shipping\Model\Config\Source\Allmethods;
class ShippingMethod extends AbstractRenderer
{
      public function __construct(
        \Magento\Backend\Block\Context $context,
        \Magento\Framework\App\Config\ScopeConfigInterface $scope,
        Allmethods $allmethods,
        \Magento\Shipping\Model\Config $shippingConfig,
        array $data = array()
    )
    {
        $this->scope = $scope;
        $this->allmethods = $allmethods;
        $this->_shippingConfig = $shippingConfig;
        parent::__construct($context, $data);
    }

    /**
     * {@inheritdoc}
     */
    public function render(\Magento\Framework\DataObject $row)
    {
        $shippingMethods = explode(',', $row->getData($this->getColumn()->getIndex()));
        $methodList     = $this->allmethods->toOptionArray();

        $result = '';
        foreach ($shippingMethods as $method) {
            $result .= $methodList[$method]['label'].',';
        }

        return rtrim($result, ',');
    }

}


texts:
I am using a separate theme for mobile devices but I still want to present the desktop theme for Android tablets.

here's my matched expressions for the exception

iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini

and in iPad it shows the desktop theme as it should but on Android tablets i'm still getting the mobile theme.


texts: Magento 2 - custom layout extending 2columns-left not working

texts:
I know there are 2 or 3 similar questions but there's no response for them.

I'm creating a custom layout based on the 2columns-left layout. I have investigated from everywhere on the internet and the official documentation but none help me to get it working.

Basically everything is working, my custom layout is showing in the Magento admin page, my module is printing what I want inside the "block" in my xml file.

But the problem is that it doesn't show the 2 columns, it shows everything in 1 single column.

Here are my files:

app/design/frontend/Yael/Onigirishop/Magento_Theme/page_layout/homepage_side_menu.xml

    <?xml version="1.0"?>

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="2columns-left"/>

    <referenceContainer name="columns">
        <referenceContainer name="sidebar.main">
            <block class="Yael\CustomHome\Block\Categorylist" name="category-sidebar" template="Yael_CustomHome::category.phtml"/>
        </referenceContainer>
    </referenceContainer>
</layout>

app/code/Yael/CustomHome/view/frontend/templates/category.phtml

<?php
$category = $block->getEnableCategory();
?>

Catálogo

<?php foreach ($category as $categorydata) : ?>
    <?php
    $categoryid = $categorydata->getEntityId();
    $categoryFactory = $block->getCategoryName($categoryid);
    $categoryNameshow = $categoryFactory->getName();
    $categoryUrlShow = $categoryFactory->getUrl();
    ?>

        <a class="category-link-show" href="<?php echo $categoryUrlShow; ?>" alt="<?php echo $categoryNameshow; ?>"
           title="<?php echo $categoryNameshow; ?>">

<?php echo $categoryNameshow; ?>

<?php endforeach; ?>

I have seen some styles not loaded when I set the home page to my custom layout but they are loaded when I use the 2columns-left layout.

When I have 2columns-left layout selected for the home page:

When I have my custom layout selected for the home page:

Hope someone would be able to help or see something I'm missing.

Thanks for your time!

EDIT (adding the solution for others who have the same problem):

As mentioned by Readio, the body class is changing for each selected layout, so just created a xml file to add the 2columns-left class name to the home page body.

app/design/frontend/Yael/Onigirishop/Magento_Cms/layout/cms_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">

        <attribute name="class" value="page-layout-2columns-left"/>

</page>


texts: How to get list billing address and list shipping address based on customer id

texts:
Please, can someone tell me, how to get list shipping addresses and billing addresses the specific customer by customer id in Magento 1.9?

Thanks.


texts: Unable to Update a quote item programmatically

texts:
I would like to update the quote item programmatically,

I am trying below

    $walletAmount = Mage::app()->getRequest()->getPost('walletAmount'); //i AM GETTING THIS VALUE THROUGH AN AJAX REQUEST
    $item = Mage::getModel('sales/quote_item')->load($rowQuoteId); // $rowQuoteId CONTAINS item_id OF THE `sales_flat_quote_item` TABLE.
    $item->setWalletAmount($walletAmount);
    $item->getProduct()->setIsSuperMode(true);
    $item->save();

But above this code gives the error message as below,

  Fatal error: Call to a member function getStoreId() on a non-object in \app\code\core\Mage\Sales\Model\Quote\Item\Abstract.php on line


texts: Web Setup Wizard option missing in Magento 2.3

texts: This option does not appear in my menu "System -> Tools". How can I do it appear? My user is admin


texts: Sales Order Grid Filter issue with custom column - Magento 2

texts:
We have set the default timezone for admin as IST.

now, we added one column in sales order grid for CST date but the filter is not working as Expected.

While search with 20th Date only one record display instead of two.

Thanks,

Can anyone know how we can fix that??


texts: Set a minimum order amount for paypal checkout

texts:
Although I have set the minimum order in system > configuration > sales, it does not prevent the customer from ordering with the "Check out with Paypal" button.
Is there anyway to include this checkout option in the minimum rule?


texts: get all order list for logged in customer in magento

texts:
I'm trying to generate the list of past ordered products for logged in customer. My attempt so far.

<?php
    $OrderProducts = Mage::getResourceModel('sales/order_collection')
                        ->addFieldToSelect('*')
                        ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
                        ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
                        ->setOrder('created_at', 'desc');

                foreach($OrderProducts as $ord){

                    $o=Mage::getModel('sales/order')->load($ord->getId());
                    $items = $o->getAllItems(); ?>

                    <?php foreach($items as $p){
                          $p= Mage::getModel('catalog/product')->load($p->getId());
                          ?>

                         <a href="<?php echo $p->getProductUrl()?>"><img class="recently-img" src="<?php echo $this->helper('catalog/image')->init($p, 'small_image')->keepFrame(false) ->keepAspectRatio(true)->resize(140) ?>" />

          <?php }} ?>

This code showing some past order items but some contents are wrong. And also it does not show those products which are configurable products. Please help. Thanks in advance.


texts:
One method for controlling multiple stores involves adding SetEnvIf statements to .htaccess to set server variables MAGE_RUN_CODE and MAGE_RUN_TYPE.

http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_apache.html

However this method is sometimes prevented by server settings that block SetEnvIf from setting variables that don't begin with 'HTTP_'.

My answer below will show how to test for this.


texts: How to customize styles from navigation menu in Blank theme?

texts:
I've figured out how to change background color in navigation menu by changing values from the navigation UI library (LESS file).
Now I want to add top and bottom borders to this menu, how can I achieve that?
Is it possible to add a new property like "border-top-style" (or any other) to the navigation styles? and how it is done?


texts: Magento 1.9: Product Export all categories in single line

texts:
Single product has multiple categories. Within CSV Export file only one category is listed. Does anyone know why only one category is exported?

I need an export that has all categories listed by single product. How can I achieve that?

Now:

sku,_store,_attribute_set,_type,_category,_root_category,_product_websites
5108,,Default,simple,"Beauty/Bad",Pflege,base
5109,,Default,simple,"Beauty/Bad",Pflege,base

What i need is something like this:

sku,_store,_attribute_set,_type,_category,_root_category,_product_websites
5108,Default,simple,"Beauty/Bad;"Beauty/Küche";"Beauty/Pflege",Pflege,base
5109,Default,simple,"Beauty/Bad;"Beauty/Küche";"Beauty/Pflege",Pflege,base


texts: export all products from magento 2 for import into magento 1.9 programatically

texts:
I have finally come to realize that Magento 2 is a way to buggy and unusable. I have 30,000 products and 1500 categories. What tables do I need to export in order to bring them in Magento 1.9?

Also, are there any differences I need to know about? I know category paths are stored as text instead of primary keys in 1.9, anything else?


texts: magento reset password email via php code

texts:
i want to create reset password link and mail it to customer using php code what have i to write to do this could not figure out ?..

i wrote below code in my custom page but it not works:

$email='abc@gmail.com';

$customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);
$newResetPasswordLinkToken =  $customer->_getHelper('customer')->generateResetPasswordLinkToken();
echo $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
$customer->sendPasswordResetConfirmationEmail();


texts: Trying to change permanent title tag for all of the pages

texts:
I'm working on a site and can't find where to change the end of the title of all of the pages. All of the titles get the url of the site and i want to change it to the brand itself, and not the URL.

How can i do it?

Thanks,


texts:
The cron php bin/magento cron:run is set to run every minute in our project.

Along with various other tasks it runs indexing in Magento. Indexing is part of index  cron group.

For debugging purpose all cron groups, which runs can be dumped from execute method of vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php . $jobGroupsRoot variable has all the data related to these groups.

index group has following 3 cron jobs which runs re-indexing and updates mviews.

indexer_reindex_all_invalid
indexer_update_all_views
indexer_clean_all_changelogs

Now my questing is, what will be impacted if I skip/remove these 3 cron jobs when php bin/magento cron:run runs by modifying vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php(I will extend this class to modify execute method) ?

I will configure a new cron for php bin/magento indexer:reindex , which will run once or twice a day.


texts: Create a search filiter textbox on admin page

texts:
I am using the https://webkul.com/blog/add-ui-select-with-search-filter-admin-form-magento2/ to create a search filter but what I was expecting was

I am getting is this, No search area.


texts: Increasing php limit to 756 MB in Magento 2.2

texts:
When I tried to install new modules it shows a error that says

  "Your current PHP memory limit is 256M. Magento 2 requires it to be
  set to 756M or more. As a user with root privileges, edit your php.ini
  file to increase memory_limit. (The command php --ini tells you where
  it is located.) After that, restart your web server and try again."

I edited php.ini file but it didn't work. It also contains a php.ini.sample file in root. I have a shared hosting plan and hosting  provider says they won't increase php limit size from their side in case of Shared hosting plan. Someone please help me. What should I do?


texts: Product quantity to nearest Qty Increments multiples when adding to cart

texts:
We have products as pack. Lets say 8 coke canes. So users can add any quantity as multiple of 8.

For doing this we enabled Enable Qty Increments and entered Qty Increments as 8. And this functionality works fine.

What we need is user enter any quantity which is not a multiple of 8, quantity should be updated as next nearest 8 multiples.

I checked with any observers available before updating it. But no luck.


texts:
How can I check if product is a Grouped Product?

I tried:

<?php if( $_products->isGrouped() ) ?>

but doesn't  work.


texts:
Featured products on the homepage disappeared after upgrading all packages through Magento connect.

I've cleared all the caches and reindexed the site but the problem still persists.


texts:
i was trying to create customer in magento via SOAP API (customerCustomerCreate (SOAP V2)) in android app , but i get this error :

  SoapFault - faultcode: '100' faultstring: 'Customer email is required' faultactor: 'null' detail: null

i set email address with this code :

    request = new SoapObject(NAMESPACE, "customerCustomerCreate");
    request.addProperty("sessionId", sessionId);

    SoapObject value = new SoapObject(NAMESPACE, "associativeEntity");
    value.addProperty("key", "in");
    value.addProperty("value", "xxxxx@xxxxx.com");

    SoapObject complexFilter = new SoapObject(NAMESPACE,
            "complexFilter");
    complexFilter.addProperty("key", "email");
    complexFilter.addProperty("value", value);
                SoapObject filterArray = new SoapObject(NAMESPACE,
            "complexFilterArray");
    filterArray.addProperty("item", complexFilter);

    SoapObject filters = new SoapObject(NAMESPACE, "filters");
    filters.addProperty("complex_filter", filterArray);

    request.addProperty("filters", filters);

    env.setOutputSoapObject(request);

    androidHttpTransport.call("", env);
    result = env.getResponse();

Does anyone have any idea what is the wrong I am doing here?


texts: Magento2 - adding notice under counry_id field in checkout

texts:
So Im trying to add notice under country_id, I tried the following layout in checkout_index_index.xml:

<referenceBlock name="checkout.root">
    <arguments>
        <argument name="jsLayout" xsi:type="array">
            <item name="components" xsi:type="array">
                <item name="checkout" xsi:type="array">
                    <item name="children" xsi:type="array">
                        <item name="steps" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="shipping-step" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="shippingAddress" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="shipping-address-fieldset" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="country_id" xsi:type="array">
                                                            <item name="config" xsi:type="array">
                                                                <item name="notice" xsi:type="string" translate="true">Some note here</item>
                                                            </item>
                                                            <item name="label" xsi:type="string">Select Field</item>
                                                            <item name="sortOrder" xsi:type="string">115</item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </item>
        </argument>
    </arguments>
</referenceBlock>

Only thing i could update, is the field order

Cant update the notice or the label...

How can this be done?


texts: addAttributeToFilter not working with final_price

texts:
When I try using the addAttributeToFilter to the final_price, the list it not returned. It gives an error instead. PHP Fatal error:  Call to a member function getBackend() on a non-object in /mnt/webdrive/foo.foo-web.net/app/code/core/Mage/Eav/Model/Entity/Abstract.php

However, when I use it with the normal price, it will work without any problems!
I've used both addAttributeToSelect('final_price') as well as $collection->addFinalPrice() but neither seem to fix the issue.

The array I'm using is as follows:

 2016-08-17T12:12:33+00:00 DEBUG (7): Array
 (
     [0] => Array
         (
             [attribute] => final_price
             [from] => 50000.00
             [to] => 150000.00
         )
 )

It's being returned in a column in the query though. Is there no way to filter the collection based on that?