texts: Custom Category Attribute not in Repository

texts:
I created a custom category multiselect attribute. (it's even a custom source but that does not matter).

Everything is OK on save, admin forms OK, even the flat contains my values. ( thx to https://github.com/magento/magento2/issues/417 )

BUT, when i do a list/get on front through repository, my category object does not have the values... (flat is activated)

I found an event in \Magento\Catalog\Model\ResourceModel\Category\Flat

// Allow extensions to modify select (e.g. add custom category attributes to select)
$this->_eventManager->dispatch('catalog_category_flat_loadnodes_before', ['select' => $select]);

Is that the only way ?  It seems weird to me when i think about the XML of Magento 1.
Do i have to modify anything else ?

edit: Even with flat disabled, i can't get it...

edit2: ok, i'm stupid. A part of the problem was because i was in \Magento\Catalog\Helper\Category function canShow , and it uses a "hard coded" collection through the getCategoryTree function . Hooray, another plugin to write. The funny thing is that i know have a string instead of an array through get. As if the afterLoad was not called... Another mystery...

But then... the observer i gave. What is its purpose ?


texts: What is the point of the assign() function in Mage_Rating_Block_Entity_Detailed?

texts:
I'm studying Magento and trying to wrap my head around the way this particular function is set up. In the Mage_Rating_Block_Entity_Detailed block, this line creates the $collection variable that can be used in the phtml template:

$this->assign('collection', $ratingCollection);

The assign function, found in the Mage_Core_Block_Template block, goes like this:

public function assign($key, $value=null)
    {
        if (is_array($key)) {
            foreach ($key as $k=>$v) {
                $this->assign($k, $v);
            }
        }
        else {
            $this->_viewVars[$key] = $value;
        }
        return $this;
    }

This uses the _viewVars function, which I haven't found much on--but from what I can tell, it just takes the $key variable ('collection' in this case) and makes it into a proper variable ($collection) with the assigned value.

So why bother with all of this? Why not just replace the assign function with something like:

$collection = $ratingCollection;

Or, for that matter, why bother renaming $ratingCollection at all? There obviously must be some need for the fancy footwork here, but I don't see it.


texts: How to add Access-Control-Allow-Origin to Magento? PHP solution possible?

texts:
As a near final step before launching, we have activated SSL/secure pages for checkout etc and are running into the headaches it brings with cross origin requests.

We have an ajax cart function that calls, in essence:

https://shop.domain.com/checkout/cart/add/

from

http://shop.domain.com/category/product.html

Unfortunately, everything I've tried in htaccess doesn't seem to work and I think the host did not allow/enable mod_headers...

So I'm wondering if there's any PHP solution to allow http://shop.domain.com to access https://shop.domain.com

I've tried adding:

<?php header('Access-Control-Allow-Origin: *'); ?>

To the header.php template, but I imagine that didn't work because headers are probably processed by that point?


texts: Magento2 : How to add custom link in footer inside newsletter block?

texts: To add custom link in newsletter block magento 2 ??


texts: How to set product custom options value in Order?

texts:
I am getting here product custom option value.
Here is my code.

$orderId = 100017234;
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$items = $order->getAllVisibleItems();
foreach ($items as $item)
{
  $productOptions = $item->getProductOptions();
  foreach ($productOptions['options'] as $key => $value)
  {
    echo $value['value']; // HOW CAN I SET THIS VALUE ??
  }
}

Can anyone help to set this value.


texts: Magento 2 - How to add,save,display custom Field in Product Edit form using UiComponent?

texts:
Hi I want to add a custom field in Product add/Edit form using UiComponent and want to save its value and displayed back to form as well

I have read a couple of threads for this - but not getting the exact solution

I have added custom field using uicomponent in product_form.xml file below is the code  :

<?xml version="1.0" encoding="UTF-8"?>

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<modal name="advanced_inventory_modal">
     <fieldset name="manage_note">
         <argument name="data" xsi:type="array">
             <item name="config" xsi:type="array">
                 <item name="label" xsi:type="string" translate="true">Manage Note</item>
                 <item name="dataScope" xsi:type="string"/>
                 <item name="sortOrder" xsi:type="number">0</item>
                 <item name="collapsible" xsi:type="boolean">true</item>
                 <item name="opened" xsi:type="boolean">true</item>
             </item>
         </argument>
         <field name="note">
             <argument name="data" xsi:type="array">
                 <item name="config" xsi:type="array">
                     <item name="label" xsi:type="string" translate="true">Notes</item>
                     <item name="formElement" xsi:type="string">textarea</item>
                     <item name="dataScope" xsi:type="string">quantity_and_stock_status.note</item>
                     <item name="sortOrder" xsi:type="number">1</item>
                     <item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
                 </item>
             </argument>
         </field>
     </fieldset>
     <fieldset name="stock_data">
         <argument name="data" xsi:type="array">
             <item name="config" xsi:type="array">
                 <item name="label" xsi:type="string" translate="true">Stock Configuration</item>
                 <item name="dataScope" xsi:type="string"/>
                 <item name="sortOrder" xsi:type="number">100</item>
                 <item name="collapsible" xsi:type="boolean">true</item>
             </item>
         </argument>
     </fieldset>
</modal>
</form>

Custom Field is added successfully, but its value is not getting saved ? due to that its value is not displayed in edit form as well.

so what is the best approach to achieve this?


texts: Success message won't disappear in the home page Magento 2

texts: When I try to use the LUMA Theme, the success message is working properly, but when I use the custom theme, that's where the problem starts. The success message accumulates in the home page whenever I try to add a product to the compare list. I'm using Magento 2.1.3. See the picture below:


texts: How to Add/Remove Top Links for logged-in/logged-out Users in Magento 2.1

texts:
I researched since yesterday, but just can't find a definitive answer on how to add/remove links from top menu for logged-in and guest users in Magento 2.

I'm using Magento 2.1.9 and what I want to achieve is to add a link to top menu (header links) when a customer is logged-in and not display the link for guest users that are not logged-in.

Magento 1 had very neat handles  and  that are deprecated in Magento 2.

My preference is to achieve this via XML layout, if there is such possibility in Magento 2. I tried removing the link from Magento_Theme/layout/default.xml and leave it only in Magento_Customer/layout/default.xml alas removing the link from Magento_Theme's default.xml removes the link totally and it does not get displayed for logged-in customers either.

Then, I tried adding a css class to the link via XML, so that I can hide it and show it via display: none / block, however, it seems like I can't add css class to this single link, not via

<argument name="css_class" ..> and not via <block class="Magento\Framework\View\Element\Html\Link" htmlClass="my-css-class">

I'm not sure how exactly to target the top link in question via the PHP isLoggedIn method either. Say, if I add in topmenu.phtml

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');

if($customerSession->isLoggedIn()) { how to call the link from here? }

I found a module that will add custom layout handles for logged-in and logged-out customers via custom XML files. However, I wonder if there is a cleaner, simpler way to achieve this without creating a custom module?

Thank you all in advance!


texts: Configurable Product problem in product page

texts:
I created Configurable Product based on size and gender it was perfectly work, to explain more i have shoes as my product with size 39,42,43,44 with male and female but i have only 39 for female the it mean i have the shoes with size 39 just for female, the rest is belong to male 42,43,44 when i clicked on female i have a opportunity to choose 42,43,44 but actually i don't have this size for female, and when i want to checkout this message with come

  Critical! Please specify the product's option(s).
  my point is when somebody choose female directly the size of 42,43,44 will be unclickable, after that the customer know that we don't have this product size for female.

Thanks a lot


texts: How to Override Mage_Catalog_Block_Product_View with a Custom Module

texts:
I am trying to override Mage_Catalog_Block_Product_View through a custom module in order to strip html tags out of the default meta description. I'm not sure what I'm missing or if I'm making any mistakes.

  app/code/local/Companyname/Catalog/Block/Product/View.php

class Companyname_Catalog_Block_Product_View extends Mage_Catalog_Block_Product_View
{
/**
 * Add meta information from product to head block
 *
 * @return Mage_Catalog_Block_Product_View
 */
protected function _prepareLayout()
{
    parent::_prepareLayout();
    $this->getLayout()->createBlock('catalog/breadcrumbs');
    $headBlock = $this->getLayout()->getBlock('head');
    if ($headBlock) {
        $product = $this->getProduct();
        $title = $product->getMetaTitle();
        if ($title) {
            $headBlock->setTitle($title);
        }
        $keyword = $product->getMetaKeyword();
        $currentCategory = Mage::registry('current_category');
        if ($keyword) {
            $headBlock->setKeywords($keyword);
        } elseif ($currentCategory) {
            $headBlock->setKeywords($product->getName());
        }
        $description = $product->getMetaDescription();
        if ($description) {
            $headBlock->setDescription( ($description) );
        } else {
            /* Added $strippeddesc to remove html tags from default description if used in meta description */
            $strippeddesc = html_entity_decode(strip_tags($product->getDescription()));
            $headBlock->setDescription(Mage::helper('core/string')->substr($strippeddesc, 0, 255));
        }
        if ($this->helper('catalog/product')->canUseCanonicalTag()) {
            $params = array('_ignore_category' => true);
            $headBlock->addLinkRel('canonical', $product->getUrlModel()->getUrl($product, $params));
        }
    }
    return parent::_prepareLayout();
}
}

  app/code/local/Companyname/Catalog/etc/config.xml

<config>
  <modules>
    <Companyname_Catalog>
      <version>0.1.0</version>
    </Companyname_Catalog>
    <depend>
      <Mage_Catalog/>
    </depend>
  </modules>
  <global>
    <blocks>
      <catalog>
        <rewrite>
          <product_view>Companyname_Catalog_Block_Product_View</product_view>
        </rewrite>
      </catalog>
    </blocks>
  </global>
</config>


texts:
How to assign any block to group detailed_info in magento using <referenceBlock> tag in magento 2.2?

In Magento 1.x it was like:

<action method="addToParentGroup"><group>detailed_info</group></action>

Can anyone help me out here, how to perform same thing in Magento 2.


texts: in Magento 2 how to Open Modal popup with dynamic value for dynamic click button?

texts:
When I click on item "edit link" modal popup is open but when i edit other product it will show previous product data.
Can anyone help to get dynamic popup with dynamic data in per different products?
Please refer screenshots below:


texts: change in media query break point in magento2

texts: In magento2, desktop view comes from media point 768. i want to change this view. Rather than 768 my desktop view should start from 992. For that i am overritting the value of @screen__m from 768 to 992. But my changes are not reflecting. What are the other changes which i need to make ? Any solution ?


texts: Is it possible to move the configurable options for a product to a custom tab on the product detail page


texts: Magento is discounting the entire shopping cart when I have it set to discount specific products. How can I fix this?

texts:
Here is what I have in the promotions

If ALL  of these conditions are TRUE :

If ALL  of these conditions are TRUE :

If an item is FOUND  in the cart with ALL  of these conditions true:
Category  is  40
Pattern  contains  Vanderbilt
Material  contains  Porcelain

I tried to get as specific as possible with the conditions, but it still isn't working and it just applies it to the entire cart as a whole. I have Magento 1.9.0.1 version.


texts: Cant see product images in backend after upgrading to 1.9.0.3

texts:
I have recently upgraded my magento site to 1.9.0.3 but now I cant see product images in the backend, please help???

Thanks

Andy


texts:
I was working with the Algolia search module in Magento 2 and foud something like below in the template files. Can anybody let me know what this notation is called and where can I learn more about this notation.

                {{#categories_without_path}}
                <?php echo $block->escapeHtml(__('in')); ?> {{{categories_without_path}}} {{/categories_without_path}} {{#_highlightResult.color}} {{#_highlightResult.color.value}}

                    {{#categories_without_path}} | {{/categories_without_path}} Color: {{{_highlightResult.color.value}}}

                {{/_highlightResult.color.value}} {{/_highlightResult.color}}

Thank you


texts: Magento 2 how add extension attribute to order item

texts:
I need to save the extension attribute for Order item. I have tried using plugin with below code, but it is not working for me. I have placed a log inside the method but the method is not working.
<type name="Magento\Sales\Api\OrderItemRepositoryInterface">
    <plugin name="order_item_extension_attr" type="Vendor\CustomModule\Plugin\Model\Test"/>
</type>

public function afterGet(
        \Magento\Sales\Api\OrderItemRepositoryInterface $orderItem,
        \Magento\Sales\Api\Data\OrderItemExtensionInterface $extension = null
    ) {

}

How to save and get order item extension attribute?
Edited:
Used an observer after order saved, stored the order and item extension attributes in db. Which is working fine, but showing the order item values are not showing up in the order view page.


texts: Custom URL Rewrites - Deleting after reindex

texts:
I've researched this problem but still I have got no idea on how to fix it.

So, I worked on creating a proper menu structure for my products and by doing so, I have made categories with the intention of linking them up to the url taken from my layered navigation, let me try and explain:

I created a category called: Cases & Accessories --> Computer Cases --> Full Tower ('Full tower' being the type of products, filtered out)

I get the required URL by using my layered navigation, filtering the type of computer case which leaves me a URL of:  XXX/cases-accessories/computer-cases.html?i_form_factor_771_1=6967 where i realised i cannot use special characters in the URL key inside catalog --> manage categories,  then I start to create a custom url rewrite

The setup of the custom URL rewrite works perfectly, so I delete the system generated rewrite but when i reindex the catalog url writes, it generates a new system rewrite with a higher ID so uses that over the custom one with now a lower ID.

I tried another option which was to edit the system generated one, which only allows me to change the request path, I do this then reindex but again, the default request path is back on.

Here is a screenshot:

You see, the ID for the custom is currently higher but the front end is still showing the system url rewrite. For me to reflect the custom rewrite, i would have to delete the system one.

Futher screenshot reflecting the comments:

This seemed to work, so i now need to change the 1st system rewrite from cases-accessories/computer-cases/full-tower-cases.html to fulltower.html, i try doing this inside the system rewrite, but after a reindex it changes back to cases-accessories/computer-cases/full-tower-cases.html. Any ideas? I created a 3rd url write with the target path of "catalog/category/view/id/1234" but it didnt work.


texts: Magento 2 : scope of knockout JS variable

texts:
Here's my code -

define(
[
    'ko',
    'uiComponent',
    'underscore',
    'jquery',
    'mage/url',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/checkout-data',
    'Magento_Checkout/js/action/select-shipping-address'
],
function (
    ko,
    Component,
    _,
    $,
    urlBuilder,
    quote,
    checkoutData,
    selectShippingAddress
) {
    'use strict';

    return Component.extend({
        defaults: {
            template: 'Vendor_Module/shipping-address/list'
        },

        initObservable: function () {

        this._super()
            .observe({
                foo: ko.observable(false)
            });
        this._super()
            .observe({
                phoenix: ko.observable(false)
            });

        this.addresses = window.checkoutConfig.addresses;

        this.phoenix.subscribe(function(someVal){
            console.log("phoenix");
            var group = someVal;
            this.addresses.filter(function(el){
                console.log(el);
                return el.indexOf('Montreal');
            });
       this.foo.subscribe(function (newValue) {
            console.log(newValue);

        });

        return this;
        },

        initialize: function () {
            this._super();

            return this;
        },

        getAddressGroups:function(){
            return window.checkoutConfig.addressGroups;
        }

    });
},

 );

  Error: TypeError: this.addresses is undefined

As far as I understand, this.addresses is a global variable.
Thanks


texts: Change magento 2 controller language response

texts:
I have a controller that act as an API endpoint in magento 2, i need to have a response on different language base on parameter that were passed, this controller can access model and etc.

for example:

public function execute()
{
     if (isset($_SERVER['HTTP_ORIGIN'])) {
        header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Max-Age: 86400');
    }

     if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {

        if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
            header("Access-Control-Allow-Methods: GET, POST, OPTIONS");

        if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
            header("Access-Control-Allow-Headers:        {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");

        exit(0);
    }

    try {
        $lang = $this->getRequest()->getParam('lang');
        if($lang == 'en'){
          $message = 'who are you';
          $data['var_1'] = "Live";
        }elseif($lang == 'jp'){
          $messsage = 'あなたは誰';
          $data['var_1'] = "ライブ";
        }
        return $this->_formatResponse(500,$message,$data);
    } catch (\Exception $ex) {
        $message = $ex->getMessage();
        return $this->_formatResponse(500,$message);
    }
}

protected function _formatResponse($status, $message = '', $data = [])
{
    $result = $this->_resultJsonFactory->create();
    $result->setHttpResponseCode($status);
    return $result->setData([
        'status' => $status,
        'message' => $message,
        'data' => $data
    ]);
}

how can i achieve to manage this translation message dynamically when there is a lot of user access my controller.


texts: Magneto 2 : remove attribute from particular configurable product programmatically

texts:
ex. I have a configurable product id X
having attributes like color, size, material,A,B,C etc. and I want to remove attribute C from the product X.

and also remove from every linked products with X.
I have attached a SS here.

This delete button is on product view page of configurable product X.
and it has child products P,Q,R.

if I remove color green then all linked product with size like,
size S-green, L- green, M-green should remove.

likewise, If I remove 'specification' attribute, it will remove from configuration and linked simple products(P,Q,R) too.

can anyone help me on this ?
Thanks in Advance !!


texts: Directory tree is empty in enhanced media gallery backend

texts:
For some reason the enhanced media gallery from backend > content > media gallery is not showing up the folder tree on the left. This is happening only on the staging server. It works good with exact same code base and configuration.
I also ran the following command but it did not help.
bin/magento media-gallery:sync
bin/magento media-content:sync

Does any one had this same issue ?
Thx
Laxman


texts: mageInit KO binding not working for a custom jQuery widget

texts:
I can't get the mageInit binding to work on a custom jQuery widget which I have created.

I have used it in my KO template like:

But in the chrome inspector I can see that it does not load the JS file for my widget.

However, when I try adding a one of Magento's own jQuery widgets it works.

Also, I can get my own custom widget to work in a phtml template with...

I created my jQuery widget by adding the following code.

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

var config = {
    map: {
        '*': {
            mywidget: 'Namespace_Module/js/my-widget'
        }
    }
}

Namespace/Module/view/frontend/web/js/my-widget.js

define([
    'jquery',
    'jquery/ui'
], function($) {
    "use strict";

    $.widget('mage.mywidget', {
        _create: function() {
            // Init code
            console.log('test1');
        }
    });

    return $.mage.mywidget;
});

In the above piece of code I've used the mage namespace, but I've also tried using holy. It doesn't make a difference either way and Im unsure which is correct.

I have also tried using the full path to my widget in the mageInit binding...

Also I looked at where magento declares the mageInit binding, vendor/magento/module-ui/view/base/web/js/lib/knockout/bindings/mage-init.js, but I can't see why it won't work when I use it for my custom jQuery widget.

UPDATE

Following the call stack it seems these files are all responsible for initialising components which use the mageInit binding.

lib/web/mage/bootstrap.js ln 20
lib/web/mage/apply/main.js ln 24 (Initializes components assigned to a specified element via data-* attribute.)
vendor/magento/module-ui/view/base/web/js/lib/knockout/bindings/mage-init.js ln 20


texts: Loading a .phtml file within an Observer Magento 2

texts:
I'm trying to load my .phtml files in the template folder within my observer but I'm getting this error

  Invalid template file: 'VENDOR_MYModule::Category/index.phtml' in module: 'VENDOR_MYModule' block's name: 'category_0'

Here's the structure of my files

app
 + code
    + VENDOR
      + MYModule
        + Block
            - Category.php
        + Controller
            + Category
               - Index.php
        + etc
            + frontend
                - routes.xml
        + Observer
            - CategoryObserver.php
        + view
            + frontend
                + layout
                    - header_category_index.xml
                + templates
                    + category
                        - index.phtml

Now the content of my Block/Category.php is below

<?php
namespace VENDOR\MYModule\Block;

class Category extends \Magento\Framework\View\Element\Template
{
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        array $data = []
    ){
        parent::__construct($context, $data);
    }

}

The content of my Controller/Category/Index.php is below

<?php
namespace VENDOR\MYModule\Controller\Category;

class Index extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $pageFactory
    )
    {
        $this->_pageFactory = $pageFactory;
        return parent::__construct($context);
    }

    public function execute()
    {
        return $this->_pageFactory->create();
    }
}

The content of the layout/header_category_index.xml is below

<?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="content">
        <block class="VENDOR\MYModule\Block\Category" name="category_items" template="VENDOR_MYModule::category/index.phtml" />
    </referenceContainer>
</page>

The content of my .phtml is just a simple
Hello world
. Now in my Observer I'm trying to load this .phtml file but I can't load it and getting the error. The content of my Observer Observer\CategoryObserver is below

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $layout = $this->_layout->create();
    $block = $layout->createBlock('VENDOR\MYModule\Block\Category')->setTemplate('VENDOR_MYModule::Category/index.phtml')->toHtml();

    $this->_logger->debug("[DEBUG]::" , [$block]);
}

Here's the content of my events.xml

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_category_save_after">
        <observer name="category-edit" instance="VENDOR\MYModule\Observer\CategoryObserver" />
    </event>
</config>

But I'm getting the error as mentioned above. Any idea on how to load this .phtml file to the observer? I'm planning to write the content of this .phtml file to a .txt file. But I can't proceed since I tried outputting it but I'm still getting an error

  UPDATE:

Tried my code using the Frontend controller/action access and the block successfully loaded. Now I think there's another way or implementation when retrieving the .phtml in the Admin part or in the Observer. Also note that the observer is triggered when I try to edit/save a catalog->category.


texts: Notice: Undefined index: # in /var/www/...../magento/module-sales/Block/Adminhtml/Reorder/Renderer/Action.php on line 110

texts:
in my case I want to just add options in my grid like 'renew' and 'delete' inside select 'view' inside the file 'Action.php' ,but i face some error tells me what i mention in the question above , can anyone tells how were is the problem in the foreach inside the function '_actionsToHtml'

here is the function _actionsToHtml():

protected function _actionsToHtml(array $actions = [])
    {
        $html = [];
        $attributesObject = new \Magento\Framework\DataObject();
        $attributesObject1 = new \Magento\Framework\DataObject();
        $attributesObject2 = new \Magento\Framework\DataObject();

        if (empty($actions)) {
            $actions = $this->_actions;
        }

        foreach ($actions as $action) {
            $attributesObject->setData($action['view']);
            $attributesObject1->setData($action['renew']);
            $attributesObject2->setData($action['delete']);
            $html[] = 'serialize() . '>' . $action['#'] . '';
            $html[] = 'serialize() . '>' . $action['#'] . '';
            $html[] = 'serialize() . '>' . $action['#'] . '';
            var_dump($html);
        }
        return implode('', $html);
    }

  and here is the function render also :

public function render(\Magento\Framework\DataObject $row)
    {
        $this->_actions = [];
        if ($this->_salesReorder->canReorder($row->getId())) {
            $reorderAction = [
                'view' => [
                    'href' => $this->getUrl('sales/order_create/reorder', ['order_id' => $row->getId()]),
                    'label' => __('View'),
                ],
                'renew' => [
                    'href' => $this->getUrl('sales/order_create/reorder', ['order_id' => $row->getId()]),
                    'label' => __('Renew'),
                ],
                'delete' => [
                    'href' => $this->getUrl('sales/order_create/reorder', ['order_id' => $row->getId()]),
                    'label' => __('Delete'),
                    'confirm' => [
                        'title' => __('Delete'),
                        'message' => __('Are you sure you want to delete this row ?'),
                    ],
                ],
            ];
            $this->addToActions($reorderAction);
        }
        $this->_eventManager->dispatch(
            'adminhtml_customer_orders_add_action_renderer',
            ['renderer' => $this, 'row' => $row]
        );
        return $this->_actionsToHtml();
    }


texts: how to create auto email send after x days

texts:
I have install extension for a testimonial.
now I want to send email to customer after 7 days of purchase to let them write their review on the testimonial page

how to do that?


texts: What exactly does the file app/etc/use_cache.ser do?

texts: I was faced with a caching error this afternoon which is generally (by the unanimous opinion of the interwebs) solved (and in this case was) by deleting app/etc/use_cache.ser. What exactly does this file do? The content is not descriptive by any means. Also, at what point does Magento regenerate this file on its own?


texts: Displaying Attribute in Product Listings issue

texts:
I seem to be having a bit of strange problem when trying to pull Attribute data to my product listing page. If I add this line of PHP:

<?php echo $this->escapeHtml($_product->getAttributeText('manufacturer')); ?>

I can successfully add the Manufacturer Attribute to my listings page however if I try the same code for example:

<?php echo $this->escapeHtml($_product->getAttributeText('model')); ?>

If I change the Attribute to model the code does not pull through the data for that attribute.

I find it strange how Manufacturers pulls through to the front end but Model does not.

It made me wonder if I setup the attribute wrongly so I copied all of the settings the Manufacturer attribute has and I still can't pull the data through.

Any ideas why this might be happening guys?

Here is my block of PHP:

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->escapeHtml($_product->getAttributeText('manufacturer')); ?>&nbsp;<?php echo $this->escapeHtml($_product->getAttributeText('model')); ?><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>


texts: changing "setOrder" value removes price from product group data. Or price data not found for product groups

texts:
The code looks something like this:

<?php
$category_id = '1';
$_products = Mage::getModel('catalog/category')
...
->setOrder('price', 'asc');
?>
...
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
...
<?php print_r($_products->getItems()); ?>
...

When doing print_r I get all the data relating to the product. If ordering by price as seen above I find the following fields amongst the data:

[price] =>
[tax_class_id] => 2
[final_price] => 0
[minimal_price] => 16.6250
[min_price] => 16.6250
[max_price] => 16.6250
[tier_price] =>

This is great. It allows me to show a "from: xxxx" price when listing product groups.

However if I order by something else such as

->setOrder('name', 'asc'); or
->setOrder('news_from_date', 'desc'); (added attribute)

then the price data is missing when doing print_r. It's just missing.

How do I sort the products in a category in another way than price, and still retain the price info for product groups?


texts: Magento, create Superuser who has to accept orders

texts:
Im using Magento 1.9.0.1.

Is it possible to create a Superuser, who gets an E-mail, everytime one of his Subusers makes an Order.
The order should not be placed until the Superuser accepts the Order.


texts:
I have integrated PayPal with my website using Magento 1.9.3.4.

I have set-up USD as the base currency and EURO as second currency.

Everything is working fine, but whenever customer place order using paypal, it redirects on paypal's  product=ec&fallback=1&reason=UNSUPPORTED_PAYEE_CURRENCY URL after login into the paypal and finally returns error "as this time we are unable to process. please returns to synctechnolab and try another" which is give in below screenshot.

Could anyone tell on this? I also tried to take help from paypal.

And could you also tell me that Is there alternatives of paypal for individual account in India?


texts: How to place custom template (phtml) file in local module direcotry instead of default template directory

texts:
I am creating a new module for my Magento project where I have a few template files which get appended to >catalog_product_view catalog_category_default checkout_cart_index and few other pages.

Currently, I have placed my module configuration file in design/fontend/base/default/layout/modulename_subfolder.xml and template file is placed at

design/frontend/base/default/template/modulename/subfolder/my_product_view.phtml

I want to move this XML and phtml files to local/modulename/subfolder

I have tried creating the same folder structure in my module folder but it didn't work

design/fontend/base/default/layout/modulename_subfolder.xml

<layout version="0.1.0">
  <catalog_product_view>
    <reference name="content">
      <block type="core/template" name="modulename_subfolder_product_view_block" template="modulename/subfolder/my_catalog_product_view.phtml" />
    </reference>
  </catalog_product_view>
</layout>


texts: How can I redirect if only a part of url match?

texts:
I have 2 different domains:

www.mysite.com
www.mysite.it

and my product urls are something like:

www.mysite.com/car-nissan.html
www.mysite.it/auto-nissan.html

Can I use wildcard in Magento backend URL Rewrite Management to redirect?

e.g.:
www.mysite.com/car-*  <----> www.mysite.it/auto-*

Or I need to do this in .htaccess?

I tried something like:

    RewriteCond %{HTTP_HOST} ^(.*)\.com$ [NC]
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^(.*)auto-(.*)$ http%1://%{HTTP_HOST}/car-$1 [R=301,L]

    RewriteCond %{HTTP_HOST} ^(.*)\.it$ [NC]
    RewriteCond %{HTTPS}s ^on(s)|
    RewriteRule ^(.*)car-(.*)$ http%1://%{HTTP_HOST}/auto-$1 [R=301,L]

but it doesn't work.


texts: Royal Mail Click and Drop will not Integrate through Firewall Reverse-Proxy

texts:
Our Magento 2 (Magento Commerce Inc. Magento ver. 2.3.4-p2). Was previosuly integrated with Royal Mail Click and Drop and our orders on Magento migrated automatically to Click and Drop.
We have recently had to move over to Sucuri and as a result the Magento 2 instance will no longer integrate with Click and drop. I have included a screenshot below to show the problem.

We have whitelisted all the necessary i.p. addresses on both the firewall and the server but the problem persists. When we contacted our firewall provider they gave the following response.

The Sucuri Firewall is a Web Application Firewall that serves the by
what is considered a reverse-proxy.
The flow of traffic now looks like this:
User ===> Firewall ===> Hosting Server
Given this new info from Royal Mail, I'd recommend to review the
integration settings and ensure that Royal Mail is referencing your
hosting server via IP address xx.xxx.xxx.xxx, as opposed to the
Firewall IP address yyy.yyy.yyy.yy.

Having sent this to Royal Mail, they responded with the following:

We wouldn't be able to connect directly to your IP, as we currently
use URL's to integrate with, you will need to investigate and address
this at you end to allow us to see the right IP.   Please accept my
apologies that we are unable to assist further with this.

Has anyone else run across this issue and is there a solution that will allow us to use Click and Drop with the new firewall?
Update - 06 July 2020
Royal Mail and SUCURI have finally gotten back to us and suggested setting up a subdomain and having click and drop integrate through that.
We've set up a subdomain which redirects to the original i.p. but we aren't sure how to get the integrations to use the new domain.
If anyone has any ideas about this we'd appreciate it.


texts: Enabling a module for the first time via admin panel

texts: I have created a very simple module. I can see it listed as disabled when I check via cli php bin/magento module:status, but when I go to admin panel Advanced -> Advanced I do not see it listed there. How should I enable the module? (other than cli, via admin panel)


texts: Rounding products prices in Magento 1.8 CE

texts:
I need to round the products prices with precision 2, but with the last decimal equal to 0 or 5.
Example:

16,50€
76,70€
5,05€

Inserted prices have precision 4.

16,5963 need to be -> 16,60
16,5388 need to be -> 16,55

How can I do it?


texts: Magento 2: How to get registered customer IP

texts: Anyone know how to determine registered customers IP? I have some spam registrations, so I have to block some IPs. If it's not available from M2 backend then by database table or something?


texts: All links in search engines redirect to home page

texts:
A click on google search results on all products on my site directs you to the homepage rather than the actual product page.

Why is it happening and how can I resolve this?


texts: Increasing/decreasing Cross-sell products limit?

texts:
I'm trying to increase the cross-sell products on the cart page up to 5.

In Magento-1, this is possible by overriding a checkout block (or changing a var in the core). I've been trying to use something similar to do this in Magento-2 but I am unable to produce any results.

Could someone please help me with increasing the limit.


texts: Is there a way to tell if Magento's controller is being overridden and if so where?

texts:
I'm currently using Magento 1.7!
In the Admin Panel under System-->Permissions-->Users

I want to alter data inside the User Info tab once I click Save User.

From what I know about Magento:

app/code/local/Mage/Adminhtml/controllers/Permissions/UserController.php

This should be the file path, to change if I want to do extra stuff with the params passed in.  However inside this controller even if I put die() inside the functions they are never reached.  Is it possible an extension overrode it?  The only extension that I use that I can think of would be:

https://amasty.com/sales-reps-and-dealers.html

Is there a way I can check when the Admin User is submitted through "Save User" where it is sent to?

The extension Sales-Reps and Dealers has :

<admin_user_save_after>
          <observers>
               <amperm>
                    <type>singleton</type>
                    <class>amperm/observer</class>
                    <method>handleAdminUserSaveAfter</method>
               </amperm>
          </observers>
</admin_user_save_after>

Would that interfere with it?

I already added custom fields to Magento's create permissions User in the form and I'm trying to change the custom params in the controller to do specific things but I can't find which controller it's going to.


texts: I have created package in magento and I want to upload extension in magento marketplace for free  but how to encryption file of extension and when I can encryption a file of extension ? Guide me


texts: Magento2: How Data interface and model function interact with each other?

texts:
I've been following article on Models and Resources here. According to my understanding, Magento2 uses service contract to provide model access to 3rd parties.

Here I'm interested in Data interface PostInterface.php which contains all constants and gettters/setter methods defined. Ex:

const POST_ID       = 'post_id';
const URL_KEY       = 'url_key';
public function getId();
public function getUrlKey();
public function setUrlKey($url_key);

Now these methods are also defined in the model Model/Post.php. Ex:

public function getUrlKey()
{
    return $this->getData(self::URL_KEY);
}

Questions:

If a model request is made from 3rd party, it will hit interfaces function & interfaces function will model's function?
Is it necessary to use interfaces here if my modules doesn't uses or isn't needed by any 3rd party?
How these functions interact with each other internally? Is there any case where I can use interface function getUrlKey(), instead of model's getUrlKey() function, if I'm developing another module in Magento itself?


texts: Set an active class for magento2.1 wishlist

texts:
I can add product to my Wish-list on product page Magnnto2.1, but after refresh the product page,I want to see this product already added to wish-list by changing color of wish-list icon (set active class for example)
what should i do if anyone idea share with me?


texts: Magento 2 get total spend so far for each customer to custom customer attribute

texts:
public function test($setup)
{
    /** @var CustomerSetup $customerSetup */
    $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

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

            'label'                 => 'test',
            'input'                 => 'text',
            'required'              => false,
            'sort_order'            => 1000,
            'position'              => 1000,
            'visible'               => true,
            'system'                => false,
            'is_used_in_grid'       => true,
            'is_visible_in_grid'    => false,
            'is_filterable_in_grid' => false,
            'is_searchable_in_grid' => false,
            'default'               => '0'
        ]
    );

    // add attribute to form
    /** @var  $attribute */
    $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'lifetime_sales');
    $attribute->setData('used_in_forms', ['adminhtml_customer', 'customer_account_create', 'customer_account_edit']);
    $attribute->save();

    $setup->endSetup();
}

public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
    $installer = $setup;

    $installer->startSetup();

    if (version_compare($context->getVersion(), '0.0.1', '<')) {
        $installer->getConnection()->addColumn(
            $installer->getTable('customer_grid_flat'),
            'Test',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'nullable' => false,
                'length' => '255',
                'comment' => 'test'
            ]
        );
    }

    $installer->endSetup();
}

}

This is my code and I can see test in customer section in admin which is what I wanted.
But at the moment I am not sure how to populate the current amount customers have ordered.
I want to update the test field when customer spend and update the value.

Please can anyone guide me or give any tips to progress this.

This is an example what I want to do.
If customer A purchase a product for 10 pound that should be added to test field
If the customer A purchase again and say the product is 119.86 pound the total should be 129.86 in test field


texts: Magento points to wrong paths in duplicated project

texts:
I created a duplicate of my project including the database.

I changed the value in the magento database table core_config_data where path is web/unsecure/base_url and web/secure/base_url to
 http://localhost/projects/botec/devLocal/

But images are still pointing to a false path e.g.

http://localhost/media/wysiwyg/kategorie_bilder/example.jpg

instead of

http://localhost/projects/botec/devLocal/media/wysiwyg/kategorie_bilder/example.jpg

I already cleared the cache in "var/cache"


texts: Magento2: How to get Grand total and Shipping total in Minicart

texts: Show grand_total and ShippingTotal in mini-cart without creating or using any module.


texts:
I've created a module that sends custom emails. I've tried to add a custom layout handle in the email template
{{layout handle="sales_email_order_items_no_price" order=$order}}
Where should I place the new layout? I know I shouldn't touch app/design/frontend/base/default/layout/sales.xml
I tried to place it in app/design/frontend/mypackage/default/etc/theme.xml but it doesn't seem to be working.
Sorry for the beginner question.


texts:
So I don't think this can be done out of the box and I'm stuck on how to implement this.  I'm using Magento 1.9.0.1.

I want to allow the option in a dropdown or similar to select from a range of grouped products. So kind of like a bundle product, where in the bundle items, I could have one option that has a dropdown that shows grouped products.  I am planning to try adding grouped products to the allowed types for bundle products (via. updating appropriate the configuration xml).  But anyhow, I don't know if that's a good idea to allow in any case.

Basically, this is how I want to map my product:

Product with a dropdown to choose:

Option 1 (grouped product consisting of Product A and Product B)
Option 2 (grouped product consisting of Product C and Product D)
Option 3 (grouped product consisting of Product E and Product E)

Any ideas or has anyone implemented products like this.


texts: Can't see Magento 2 front nor admin page on excluded IP when in maintenance mode. Using Varnish

texts:
So as I said, I am trying to see my website while others see it in maintenance.
BTW I have Varnish configured.

What I did:

magento maintenance:enable --ip=<my-ip-address>

What hapened:

At first I was able to see only frontend from excluded IP, but admin was regular "Service temporary unavailable" page.
Than I red about maintenance.flag in var and how it is what causes maintenance mode. So I deleted it to deactivate maintenance and again created it with touch. After that frontend was also unavailable from my excluded IP.

System:

nginx
magento 2.3.3
mariadb 10.*
php 7.2
Varnish [latest as of today]

I followed official magento 2 installation guide along with this for setup of varnish and letsencrypt.

I gathered from other questions that it is problem with varnish and it can be fixed with forwarding headers, but not sure how to do this on Nginx server.


texts: How can I use the product/list template in my module?

texts:
I have an own module to listing products using the product list template. So my call in cms block is:

{{block type="XX/XX" name="XX" template="catalog/product/list.phtml"}}

In my block code I use this function:

public function getProducts()
{
    $products = Mage::getModel("catalog/product")
        ->getCollection()
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('XX',array('eq' => 1))
        ->setOrder('entity_id', 'DESC')
        ->setPageSize(10);

    $this->setProductCollection($products);

    return $products;
}

But it isn't working. What is the problem?

Edit:

public function getProducts()
{
    $arr_products = array();
    $products = Mage::getModel("mycode/mycode")->getProducts();

    foreach ($products as $product) {
        $arr_products[] = array(
            'id' => $product->getId(),
            'name' => $product->getName(),
            'url' => $product->getProductUrl(),
        );
    }

    return $arr_products;
}


texts: Magento 1.9 403 Forbidden error after trying to update

texts:
I tried to update Magento 1.9.3.3 to newer 1.9 versions and deleted magento_all_latest.txt in pkginfo folder, also deleted maintenance.flag then I have this error throughout the website (frontend, admin, downloader):

403 Forbidden
You do not have permission to access this document.

Any help is highly appreciated.


texts: How to remove password box in checkout page and disabled email ajax call Magento 2

texts: I need to remove password box after call email ajax. I don't need this functionality while backend side guest checkout setting is on.


texts:
I am Beginner of Magento I want to create New Module that time in controller they used some code

if ($this->getRequest()->isPost()){
    $int1 = $this->getRequest()->getPost('int1');
    $int2 = $this->getRequest()->getPost('int2');
  }

I followed this link http://blog.baobaz.com/en/blog/magento-module-create-your-own-controller

Can you please suggest any basic tutorial for creating form


texts:
I would like to know that why we create compose.json and What is it use. Can someone briefly explain that to me?

company
--module
  composer.json


texts:
I have an observer that listens for when a customer is successfully registered! Using the Magento Event: customer_register_success

I have a custom table called "am_perm" I'm able to manually go into my database and write the SQL query:

INSERT INTO `am_perm`(`uid`, `cid`) VALUES (25, 139)

and it works perfectly!  However in my event observer it does not work!

Here is my code in the event listener the params passed in are:

$userId = 25 & $customerId = 139

public function assignDealer(Varien_Event_Observer $observer)
{
    function assignOneCustomer($userId, $customerId)
    {
        try {
            $userId = intVal($userId);
            $customerId = intVal($customerId);

            $resource = Mage::getSingleton('core/resource');
            $writeConnection = $resource->getConnection('core_write');
            $themeTable = $resource->getTableName('am_perm');
            $sql = "INSERT INTO `am_perm`(`uid`, `cid`) VALUES ($userId, $customerId)";
            $writeConnection->query($sql);//insert
            return true;
        }
        catch(Exception $e){
            die($e);
        }
    }

    $registerParams = Mage::app()->getRequest()->getParams();
    $paramMerchantCode = $registerParams['merchant_code'];

    if (isset($paramMerchantCode)) {

        $customerId = $observer->getCustomer()->getId();
        $merchantIdArray = array();

        //Grab the Admin_Role Table from SQL
        $model = Mage::getModel('admin/role');
        //Grab all roles with Merchant but only need the first one for ID
        //Table will be massive unless we use relational database ID versus primary ID
        $role = $model->getCollection()->addFieldToFilter('role_name', ['eq' => "Merchant"])->getFirstItem();

        //Loop through database and grab all ID's for Merchants and place into $mcArray
        if ($roleId = $role->getId()) {
            $dealerArray = $model->getCollection()->addFieldToFilter('parent_id', ['eq' => $roleId]);
            foreach ($dealerArray as $currentDealer) {
                array_push($merchantIdArray, $currentDealer['user_id']);
            }
        }

        //Look up Merchants and compare code to Merchant Code
        //If Code matches we store the $merchantId
        foreach ($merchantIdArray as $id) {
            $adminUser = Mage::getModel('admin/user')->load($id);
            $userMerchantCode = $adminUser->getData("merchant_code");
            if (strtolower($paramMerchantCode) == strtolower($userMerchantCode)) {
                $uid = $id;
            }
        }
        if ($uid && $customerId) {
            Mage::getModel('amperm/perm')->assignOneCustomer($uid, $customerId);
        }
    }

}

It never catches the Exception $e but it also never saves to my database?  What am I missing?


texts: I want to reset the usedtime for one customer back to 0 that he can use this coupon again. I tried to change thing in the sql but didn't work.


texts:
I have a Model in my code that creates a custom product collection based on a user search term. That search term should search products and filter it by sku or name... The issue is that it takes too much time to retrieve the data, maybe from 4 to 9 seconds... my catalog has 8000 skus.  I would like to optimize this filter. At the same time I have flat catalog enabled as well as categories. And I'm also have Elasticsearch enabled (My current installation has Magento 2.3.5p1).  Here is my code:
public function getSearchResult($queryText)
{
    try {
        /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */
        $productCollection = $this->layerResolver->get()->getProductCollection();

        $queryLike = $this->_getQueryPattern($queryText);

        $productCollection
            ->setVisibility([
                Visibility::VISIBILITY_BOTH,
                Visibility::VISIBILITY_IN_SEARCH,
                Visibility::VISIBILITY_IN_CATALOG
            ])
            ->addFieldToFilter('status', Status::STATUS_ENABLED)
            ->addAttributeToFilter('type_id', ['neq' => ProductType::TYPE_BUNDLE])
            ->addAttributeToFilter(
                [
                    ['attribute' => 'sku', 'like' => $queryLike],
                    ['attribute' => 'name', 'like' => $queryLike]
                ]
            );
        $productCollection->getSelect()->limit($this->searchModel->getMaxResShow());

        $this->stockFilter->addInStockFilterToCollection($productCollection);

        $productCollection = $this->searchModel->getResData($productCollection);

        $query_test = $productCollection->getSelect()->__toString();

        $this->_logger->debug(print_r($query_test,true));

        if (!empty($productCollection)) {
            $data = $productCollection->toArray([
                'name',
                'sku',
                'entity_id',
                'type_id',
                'product_hide_price',
                'product_hide_html',
                'product_thumbnail',
                'product_url',
                'popup',
                'product_price',
                'product_price_amount',
                'product_price_exc_tax_html',
                'product_price_exc_tax',
                'inner',
                'master',
            ]);
            return $data;
        }
        return false;
    } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
        return false;
    }
}

/**
 * @param string $queryText
 * @return string
 */
private function _getQueryPattern($queryText)
{
    $queryText = preg_replace('/\s+/', '%', $queryText);
    $queryLike = '%' . $queryText . '%';
    return $queryLike;
}

Now, the raw SQL generated by this filter... on $query_test.. is the following: https://pastebin.pl/view/raw/ae39c71f . Please check!.
My question is... is there a way to optimize this?. Or, is there a way to use Elasticsearch to improve this?. I mean... this is taking too much time to retrieve the data... I mean, it takes from 4 to 9 seconds to retrieve the filter. What I think it could be optimized is the e.entity_id IN part... but based on magento 2 practices that I think I'm following what should I do to improve it?.
Thanks in advance for any kind of help and thanks for reading.


texts: Magento 1.9 - Override layout to display Custom Attribute on Cart Page (RWD Theme)

texts:
I am trying to display custom attribute on cart page below SKU field. I managed to do it using below code at this location app/design/frontend/rwd/default/template/checkout/cart/item

  <?php echo $this->__('Points'); ?>: <?php echo $_item->getProduct()->getData('customer_product_points'); ?>

Placing default.phtml at location app/design/frontend/base/default/template/namespace/modulename/checkout/cart/item is not working.

How do I override default layout in order to display my custom attribute ? Currently it fetches rwd package. I do not intend to change the package, but if my module is installed, it will call my item/default.phtml and display attribute.

Tried using below code in my layout xml but not does not seem to be working.

<checkout_cart_index>
  <reference name ="checkout.cart">
        <block type="checkout/cart" name="checkout.cart">
                <action method="addItemRender">
                    <type>simple</type><block>checkout/cart_item_renderer</block><template>ei/productpoint/checkout/cart/item/default.phtml</template>
                </action>
            </block>
        </reference>
    </checkout_cart_index>

P.S. It should work for all types of products


texts: Will the layout be the same for each product being entered, if it's just simple only or if I add grouped as well. I may down the road have more so would it be better to always do grouped too and simple for each one that I enter? Also is it better to add simple first then go back to grouped after you have completed the simple products?


texts: Magento 2 filter not working on custom customer attribute

texts:
I have created custom customer attribute. It is displaying in customer grid in admin panel but when I try to filter on my custom attribute, I get error

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customer_attribute' in 'where clause'.

This is because it's not available in  table customer_grid_flat
I have already done re-indexing.

When I change value of is_used_in_grid to 1 from table customer_eav_attribute and start re indexing i am getting following error

  PHP Fatal error:  Uncaught Error: Call to undefined method Magento\Customer\Model\Indexer\Source::addAttributeToSelect() in /opt/lampp/htdocs/magento-221/vendor/magento/framework/Indexer/Handler/AttributeHandler.php:38

I have tried changing following column value to 1 but not working.

is_visible_in_grid
is_filterable_in_grid
is_searchable_in_grid

Here is setup file code

use Magento\Eav\Model\Config;
use Magento\Eav\Model\Entity\Setup\Context;
use Magento\Eav\Setup\EavSetup;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;

class CustomerSetup extends EavSetup {

    protected $eavConfig;

    public function __construct(
        ModuleDataSetupInterface $setup,
        Context $context,
        CacheInterface $cache,
        CollectionFactory $attrGroupCollectionFactory,
        Config $eavConfig
        ) {
        $this -> eavConfig = $eavConfig;
        parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
    }

    public function installAttributes($customerSetup) {
        $this -> installCustomerAttributes($customerSetup);
        $this -> installCustomerAddressAttributes($customerSetup);
    }

    public function installCustomerAttributes($customerSetup) {

        $customerSetup -> addAttribute(\Magento\Customer\Model\Customer::ENTITY,
            'customer_approval',
            [
            'label' => 'Customer Approve',
            'system' => 0,
            'position' => 108,
            'sort_order' =>108,
            'visible' =>  false,
            'note' => 'Customer Approval',

                        'type' => 'int',
                        'input' => 'boolean',
                        'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',

            ]
            );

        $customerSetup -> getEavConfig() -> getAttribute('customer', 'customer_approval')->setData('is_user_defined',1)->setData('is_required',0)->setData('default_value','')->setData('used_in_forms', ['adminhtml_customer', 'customer_account_create', 'customer_account_edit']) -> save();

    }

    public function installCustomerAddressAttributes($customerSetup) {

    }

    public function getEavConfig() {
        return $this -> eavConfig;
    }

Can anyone please let me know what is wrong with that.


texts: How to override core files into app/code/Magento folder in magento2

texts:
How do I override core files in app/code/Magento folder in Magento 2?

I want to change core functionality so I need to override core files in the app/code/Magento folder instead of directly changing that core files.

Core file:

  vendor/magento/module-catalog-import-export/Model/Export/Product.php

Overriden at:

  app/code/Magento/CatalogImportExport/Model/Export/Product.php

But it is not working. I don't know how to implement this task. Can you please help me?


texts: SYSTEM and REPORTS menu disappeared after upgrade to 1.9

texts:
I just upgraded my Magento v1.7 to v1.9 without too much complication. All the front end functionality seemed just fine but when I logged into the back end I noticed that two of the main pull down menus were not showing up... "Reports" and "System".

I was about to roll back to my backup until I found that one of my extensions that has it's own top level menu had an option that was a short cut to "SYSTEM -> SYSTEM" so I could view/change some of my system settings.

I don't seem to have any problems adding products, editing any CMS pages or any number of admin type functions. I did find that some items from the "System" menu I could handcraft a URL that would get me there. That tells me it's not an issue with not having the sufficient rights.

Double checked MySQL entries, just poking around and all look OK. I have 3 other admin level accounts and can log in but still no menus.

My issue seems familiar to another Stack Exchange issue from 5 months ago... System, Reports Menu not show in magento 1.9

While someone did offer up a solution the original poster never commented if it worked or not. I tried it and it didn't work for me.

My wild guess is that there is an XML file somewhere that controls what menus show up, what's listed under the menu and what conditions need to be met in order to display the menu. I've been under the hood a fair bit with Magento but real deep in tinkering with CORE config issues.

Any help is greatly appreciated!

Kevin E.


texts: Not a valid template while on onepage checkout

texts:
The time I am coming to onepage checkout, I am getting a critical error

  CRIT (2): Not valid template
  file:frontend/base/default/template/aitcommonfiles/design--frontend--base--default--template--checkout--onepage--shipping_method.phtml

Because of this issue, customers are not being able to move to onepage checkout step 'shipping methods' from billing or shipping address.

Can anyone address the possible ways to handle this issue?

NOTE: I am using Magento v1.9.2.1.


texts: Difference between InstallSchema and InstallData

texts:
I want to know the difference between InstallSchema and InstallData in details.

I also need to know when can I use InstallSchema.php and InstallData.php?


texts: Internal server error when setting full permissions

texts:
I am working on magento 1.9.x. I have currently moved my local project instance to new server.
When I go to Connect Manager(/downloader), it gives warning message saying, "Warning: Your Magento folder does not have sufficient write permissions.".

After some research, I had tried with putting 777 permissions to root directory, but due to which it gives Internal Server Error and none of the page works.

If I just put 777 to downloader directory only, then Magento Connect Manager redirects to 404 page. I didn't understand why this happens on this server.

Is there any issue with server configuration or do I need to give permissions to any other directory as well?


texts:
I am trying to override cart.phtml from checkout\cart.phtml  using local.xml

<layout version="0.1.0">
    <checkout_cart_index translate="label">
        <reference name="checkout.cart">
            <action method="setTemplate"><template>test/cart.phtml</template></action>
        </reference>
    </checkout_cart_index>
</layout>

override works fine but when i try to empty cart it always call my cart.phtml instead of checkout\cart\noItems.phtml.

when my cart is empty then it looks like

Any help will be appreciated

Thank you


texts: Adding string to firstname for certain storeview in checkout?

texts:
I am running Magento 1.7.0.2 and I want to add a string to the firstname and lastname in the checkout.

My template is template/persistent/checkout/onepage/billing.phtml. The code there which seems to be responsible for rendering the firstname and lastname is:

<?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>

I also know how to make it only for a certain storeview, but I do not know where ... so, any advice on where I would do that?

Thanks


texts: Get cart item details for logged in customer Magento REST API

texts: I want to get the list of items in a customer's shopping cart through REST API. I am using GET /V1/carts/mine but not getting the shopping cart item list. What will be the best way to get it with thumbnail.


texts: How to list products in descending order?

texts:
This seemed simple but is proving otherwise -- I just want to list all products in my store from high -> low

To do so, I went to:

Configuration -> Catalog -> Product Listing Sort by -> (I Selected) "Price"

Now this sorts every product from low to high for all products - but there doesn't seem to be a way to chose ascending vs descending order.

Is there something in the admin area I'm overlooking or do I have to modify a file to do this?


texts: Add a Fee / Surcharge on Cart/Order amount over 200$

texts:
How can i add a fee / surcharge on cart amount over 200$?
Or how can i add shipping fee for orders over 200$?

Thanks!


texts: Create a "Feeling Luky" widget Magento 2

texts:
I need to create a "feeling lucky" widget that have 2 fields:

price range & color (both drop down lists), when user chooses his preferred price and color, I need to show 3-4 random products that match his selection.

I am lost on where to start on this, as this is my first Magento 2 widget.

I have tried to watch a few tutorials but nothing answered my questions.

Could anybody help me with main steps to do it or even recommend a good course.

Many Thanks.


texts: how to redirect http to https permanently magento?

texts:
How to redirect http to https permanently magento?

I have added below code but its not working:

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]


texts: Dynamically show and hide Checkout Agreement (Terms & Conditions)?

texts:
Based on some quote details (e.g. products in the quote) I need to show or hide a certain Checkout Agreement. The same as described here, but for Magento 2: https://stackoverflow.com/questions/12567937/magento-have-terms-and-conditions-if-customer-buys-certain-products
I have not yet been able to find a solution for Magento 2.
I know how to get the quote details and determine if the agreement needs to be shown, but I do not know where to hook into the agreement loading to stop a particular agreement from being shown if my conditions are met.
Any ideas?


texts:
I need to divide SGST and CGST in equal amount. currently on my site there is showing total tax amount of SGST and CGST on subtotal total. I need it should be show equal CGST and SGST amount. for more details see below snap

Result Updated


texts:
I am converting a module from Magento 1.9 to Magento 2. I made the necessary changes (all the imports, extends, config files, changing the structure of the module, etc.), and now I'm trying to include it in my site.

The problem is that, when i run the command php bin/magento setup:upgrade I get this error:
 [ErrorException]
array_merge(): Argument #1 is not an array
. I know that is a generic error (because in the code I made didn't use the function call array_merge()).

My question is: How to get a full stack trace of the error when the previous command is run from a CLI?


texts: it there a setting to make my mercado website catalog only, ie. disable purchasing of all products. The site is a music publisher who doesn't want to sell items directly to customers, but rather just want to show a listing of available items.


texts: Override vendor/magento/module-customer PHTML file

texts:
Magento 2.2.

I have a theme:

/app/design/frontend/Companyname/Newtheme/

I would like to override this PHTML file:

/vendor/magento/module-customer/view/frontend/templates/account/authentication-popup.phtml

What is the correct directory structure in my theme's folder to put my new file?

I have tried:

/app/design/frontend/Companyname/Newtheme/Magento_Customer/view/frontend/templates/account/authentication-popup.phtml

and

/app/design/frontend/Companyname/Newtheme/Magento_Theme/view/frontend/templates/account/authentication-popup.phtml

and

/app/design/frontend/Companyname/Newtheme/Magento_Theme/templates/account/authentication-popup.phtml

p.s.
I know this is a really basic question, I am just not understanding the documentation and many examples online. Not sure why.


texts:
I'm looking for advice on best practices on how to debug the routing of Magento 1.9.x efficiently.

We're running into a strange issue here where we push a Mage 1.9.3.6 install from our local dev stage to prod stage and one particular custom module throws a 404 error. Everything else works just fine on the prod server.

The entire install works perfectly (incl. this one custom module) on our local dev stage, which is a clone of the prod server (Nginx, PHP 5.6.30, MySQL).

We've cleared all caches, re-indexed all data and triple checked the code was pushed correctly to the prod stage.

So now we need to debug the routing of the prod stage Magento 1.9.x since the 404 error page does not contain any useful debugging information...

Any advice on how this can be done efficiently ?

Thank you !


texts: How to fix Magento2 MySQL error message ERROR 1054: 1054: Unknown column 'entity_id' in 'NEW'

texts:
I recently upgraded Magento 2.07 to Magento 2.1 and then to 2.1.1 but now I get the MySQL error ERROR 1054: 1054: Unknown column 'entity_id' in 'NEW' any time I try to import a product or update a product attribute.

I can't re-import my DB backup either because MySQL reports errors whilst importing the backup about NEW.entity_id


texts: Increasing character limit for database tables

texts:
I have recently upgraded a copy of my site from 2.2.5 to version 2.3. All appeared to work correctly however I have encountered issues with a third party extension for a payment gateway.

The extension developer has informed me that recent changes in 2.3 mean that our prefix is causing the end of the table names to be truncated .

I have tried removing the Prefix but this has caused me a lot of issues, so I would rather avoid this if I can.

The developer also informed me that apparently Magento have recently accepted a proposed change to increase this limit and it would be released at some point in the future.

However, having no idea how long this may take I was wandering if anyone can tell me how this limit can be increased?

Where do I need to go in the Magento code?

Thanks in advance :)


texts:
My store based on Silver. Am plan to introduce Silver exchange concept.

I mean customer can exchange their sliver and buy new one.

My question Is there any extension for related my concept ?


texts: How many extensions do you have on your website?

texts: I know Magento is made endure a lot of customization, but I'm wondering exactly how many extensions many of you guys have. We don't have a lot, probably close to 20. Just getting feelers out there.


texts: How can I apply discount on cross sell products on cart page in Magento 2?

texts:
I have added cross sell products and these cross sell products are showing in cart page but I want to add discount some of these cross sell products as per configuration on the cart page.
I created preference but I am unable to overwrite getItems() method . Is there any other way we can archive it ?  please suggest.


texts: if joining two tables, is it need to define models with two table tab in module\etc\config.xml?

texts:
i had made a backend module before only select a single table which will be used in a collection, here is the code

    <models>
        <adminlog>
            <class>Rayman_Adminlog_Model</class>
            <resourceModel>Adminlog_mysql4</resourceModel>
        </adminlog>
        <adminlog_mysql4>
            <class>Rayman_Adminlog_Model_Mysql4</class>
    <entities>
                <adminlog>

admin_log

                </adminlog>
            </entities>
        </adminlog_mysql4>
    </models>

but i'm going to made another backend module which will use two tables or more, so my question how can i adjust above code so the collection can use two tables?


texts: Magento 2. Technical Guidelines. Module Version Dependency Question

texts:
I am looking at the official docs here

Why is it that when changing the preference of a class marked with @api you can depend on a MAJOR version but when you change the preference of an interface marked with @api you have to depend on a MINOR version release. Is it not kinda the same thing?

Same thing goes for implementing an interface (depend on MINOR) and extending a concrete class (depend on MAJOR) both marked with @api

What is the reasoning behind this?

IMHO implementing an interface should not make me more dependent on a module than extending a concrete class.


texts: Magento 2 Content Security Policy: The page’s settings observed the loading of a resource at https://xuz/font-awesome.min.css (“style-src”)

texts:
We transfer hosting to another hosting company everything is working fine but we are getting console errors in firefox like this - "The page’s settings observed the loading of a resource at https://xuz/font-awesome.min.css (“style-src”). A CSP report is being sent."
Does anyone know how to solve this?


texts: Attempted Magento Backup - now throws 500 Internal server error page

texts:
I tried taking a backup of Magento by Admin->System->Tools and when I clicked on System Backup, the website showed me -

  Internal Server Error

  The server encountered an internal error or misconfiguration and was unable to complete your request.

  Please contact the server administrator, webmaster@dnuvo.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

  More information about this error may be available in the server error log.

  Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

  Apache Server at ***.com Port 80

Now, every page is loading the same error.

Please help.


texts:
i want to change magento admin sidebar labels for eg "catalog" to "My products"

is there way to do it without changing core files i tried using translation by adding files in "app/design/adminhtml/default/custom/locale/en_US"

translate.csv

but it does not seems working


texts: Magento products collection change reload category page

texts:
I am tring to change product collection using catalog_product_collection_load_before.
I need to sort products by in stock. Out of stock must be last.

following config.xml,

<events>
    <catalog_product_collection_load_before>
        <observers>
            <gst_sales_order_observer>
                <class>Magecomp_Sortby_Model_Observer</class>
                <method>modifyProductCollection</method>
            </gst_sales_order_observer>
        </observers>
    </catalog_product_collection_load_before>
</events>

following Observer.php

public function modifyProductCollection($observer)
{
    if (Mage::registry('current_category'))
    {
        $products = $observer->getEvent()->getCollection();
        $_category_detail=Mage::registry('current_category');

        //Inventory Stock
        $toolbar = Mage::getBlockSingleton('catalog/product_list_toolbar');
        if ($toolbar) {
            $products = $observer->getEvent()->getCollection();

            $stockId = Mage_CatalogInventory_Model_Stock::DEFAULT_STOCK_ID;
            $websiteId = Mage::app()->getStore($products->getStoreId())->getWebsiteId();

            $products->getSelect()->joinLeft(
                array('_inv' => $products->getResource()->getTable('cataloginventory/stock_status')),
                "_inv.product_id = e.entity_id and _inv.website_id=$websiteId and _inv.stock_id=$stockId",
                array('stock_status')
            );
            $products->addExpressionAttributeToSelect('in_stock', 'IFNULL(_inv.stock_status,0)', array());

            $products->getSelect()->reset('order');
            $products->getSelect()->order('in_stock DESC');

            if ($toolbar->getCurrentOrder()) {
                $products->addAttributeToSort($toolbar->getCurrentOrder(), $toolbar->getCurrentDirection());
            }
        }
        return $this;
    }
}

Issue When I reload category page product collection is change. any things wrong ?


texts:
I am a newbie and am trying to get a collection working. I read a lot, tried many things and had no luck.

This is a very basic need.
I am trying to add a column sap_increment_id on my sales order grid but I am being stuck as I can't get it working.

I would like to join sales_flat_order to sales_order_grid with entity.id

The column is displayed but this is not working.

I guess there is a syntax mistake in my JOIN but don't understand too much what the problem is.

Here is what I wrote

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

protected function _prepareCollection()
    {
       $collection = Mage::getResourceModel($this->_getCollectionClass());

       $collection->getSelect()->join(array('address_billing' => $collection->getTable("sales/order_address")),'main_table.entity_id = address_billing.parent_id AND address_billing.address_type = "billing"',array('address_billing.company as billing_company'));

       $collection->getSelect()->join(array('address_shipping' => $collection->getTable("sales/order_address")),'main_table.entity_id = address_shipping.parent_id AND address_shipping.address_type = "shipping"',array('address_shipping.company as shipping_company'));

       $collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id', array('sap_increment_id'));

       $this->setCollection($collection);

       return parent::_prepareCollection();
    }

magento 1.9.0.1


texts: Install Product Out of Stock Subscription magento extenstion fetch error

texts:
Magento  Product Out of Stock Subscription extenstion
https://www.magentocommerce.com/magento-connect/product-out-of-stock-subscription.html


texts: Magento 1.8 - Custom Block just on Homepage

texts:
I am trying to add a custom block to just the homepage.  All pages use the same template which is 1column.phtml

In this file I have added a customblock above the content:

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

In my layout.xml within here (I'm guessing this is the hompage?):

<cms_index_index translate="label">

I have added this:

<reference name="notsurethisshouldbe">
  <block type="core/template" name="customblock" template="homepage/customblock.phtml" />
</reference>

In template/homepage/customblock.phtml I have a simple page:

<?php
  echo "testing testing 123";
?>

However nothing is showing up.  What have I done wrong?

Thanks


texts: How to get output from helper for attribute value in layout?

texts:
I'm trying to pass a helper as parameter for attribute class in layout XML, like I did sometimes in M1.

The layout XML currently looks like:

<body>
   <attribute name="class">
            <argument name="value" xsi:type="helper" helper="Company\Module\Helper\Data::getCssNameRegion"/>
   </attribute>
</body>

The helper will return a string like "region-us", "region-uk", and so on.

I'm just trying to make <attribute name="class" value="FROMHELPER"/> bring the value from there.

How to do that in M2?

In this other question the user asks about other kind of usage, but I was unable to replicate for attribute node.


texts: Rename default value of 'none' in custom option?

texts:
Just want to rename the default value of 'none' to something different in a set of radio buttons for custom options. I'm assuming this has to be edited in a core file. I'm ok with it being site wide. any help?

As of right now, i want the custom option to be optional/not required for a product. But 'none' shows up among my choices. Once I go to required, none goes away. So, I just want to change 'none' to say 'no preference'.

Magento 1.9.2.2


texts: CSS Conflict in Megamenu and default Magento navigation menu

texts:
In my project, there is Megamenu implemented and to customization of Megamenu, I have used custom _module.less in my theme folder By overriding the Megamenu Folder.

app->code->RB->Megamenu (is the Megamenu that i have implemented).which contains its core files (Megamenu module folder)

app->design->mytheme->RB_Megamenu->web>source->css->_module.less (In this file i have put customizing Megamenu css)

Now the issue is whenever I disable Megamenu and the default Magento Menu is Enabled, The default Magento menu taking CSS of from Megamenu which creates confliction between two CSS file.


texts:
So I know that in the theme.xml files in Community 1.9 or Enterprise 1.14 you can specify the theme fallback but while upgrading a customer from Enterprise 1.13 to 1.14 I noticed that there are also layout updates in this file. These only appear in the rwd theme file in the enterprise version. What are these for? I guess they are to update the files for certain modules layout and if so in this case what advantages to they have?

Example file: app/design/frontend/rwd/enterprise/etc/theme.xml

<theme>
    <parent>rwd/default</parent>
    <layout>
        <updates>
            <enterprise_catalogsearch>
                <file>enterprise/catalogsearch.xml</file>
            </enterprise_catalogsearch>
            <enterprise_checkout>
                <file>enterprise/checkout.xml</file>
            </enterprise_checkout>
            <enterprise_cms>
                <file>enterprise/cms.xml</file>
            </enterprise_cms>
            <enterprise_customer>
                <file>enterprise/customer.xml</file>
            </enterprise_customer>
            <enterprise_newsletter>
                <file>enterprise/newsletter.xml</file>
            </enterprise_newsletter>
            <enterprise_oauth>
                <file>enterprise/oauth.xml</file>
            </enterprise_oauth>
            <enterprise_page>
                <file>enterprise/page.xml</file>
            </enterprise_page>
            <enterprise_review>
                <file>enterprise/review.xml</file>
            </enterprise_review>
        </updates>
    </layout>
</theme>

So on the official Magento article about the rwd theme I have found the following snippet. It appears that this allows you to simply update some layout items to add the enterprise features rather than have complete copies with extra items added. I still do not full understand what is going on here.

  Using the New Theme/Layout Structure—Magento EE only

  If you've worked
  with a previous version of Magento EE, you're aware that the
  enterprise/default theme contains copies of many of the layout and
  template files from base/default—some with very minor changes. This is
  not an optimal approach because as it results in duplicated content.

  The Magento EE responsive theme's rwd/enterprise directory includes
  only template and layout files that contain Magento EE-only features.

  Instead of copying layout files as the enterprise/default theme does,
  rwd/enterprise isolates changes in their own layout files in [your
  Magento install
  dir]app/design/frontend/rwd/enterprise/layout/enterprise

  The rwd/enterprise theme replaces the enterprise/default theme and
  contains far fewer files than its predecessor (156 compared to 280).
  This new approach makes it easier for you to see what functionality is
  unique to Magento EE.


texts: Admin CSS/JS change path from http to https manualy

texts:
I have a problem with SSL and I need to modify manualy the admin CSS/JS paths from HTTP to HTTPS, was looking for the coresponding files for day's now... But with no luck.

Can anyone point me to the right direction?

I tryed everything from the guides and other questions and nothing worked for me.

Thanks,


texts: API: Accessing All attributes associated to a Attribute-Group

texts:
So I'm in need to check to see if an attribute group contains a specific attribute_id. However using the API, there doesn't appear to be a specific endpoint which lists all attributes associated to a group, only to an attribute set.
What I was hoping to achieve was to use the endpoint:
/rest/default/V1/products/attribute-sets/{attributeSetId}/attributes

and use searchCriteria[filterGroups] to search for a group_id field which doesn't appear to exist.
Does anyone know if this is even possible to do?
Thanks


texts:
I'm a building a function that should retrieve all the payments made in the last hour, and update the order status from pending to processing.

The problem is that, for some reason some of the orders (pending) return false when I do this:

$orderModel = Mage::getModel('sales/order');
$order = $orderModel->load($entityId);
//$order->canInvoice() --> false

Do you have any idea/ sugestion?

Thanks


texts: How to hide messages one by one after each one is visible for a certain amount of time?

texts:
Tried that the messages hide one by one depending on the time of creation
so far I have this but it does not work very well in some moments it does not wait for the 15s and in others it erases them all together

I need this for all messages

  vendor/magento/module-ui/view/frontend/web/js/view/messages.js

I will do the override is just a test

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @api
 */
define([
    'ko',
    'jquery',
    'uiComponent',
    '../model/messageList'
], function (ko, $, Component, globalMessages) {
    'use strict';

    return Component.extend({
        defaults: {
            template: 'Magento_Ui/messages',
        //    selector: '[data-role=checkout-messages]',
            // isHidden: false,
            // listens: {
            //     isHidden: 'onHiddenChange'
            // }
        },

        /** @inheritdoc */
        initialize: function (config, messageContainer) {
            this._super()
                .initObservable();

            this.messageContainer = messageContainer || config.messageContainer || globalMessages;

            this.initAutoHidden();
            return this;
        },

        // /** @inheritdoc */
        // initObservable: function () {
        //     this._super()
        //         .observe('isHidden');
        //
        //     return this;
        // },

        /**
         * Checks visibility.
         *
         * @return {Boolean}
         */
        isVisible: function () {
            return this.messageContainer.hasMessages();
        },

        /**
         * Remove all messages.
         */
        removeAll: function () {
            this.messageContainer.clear();
        },

        /**
         * init auto hidden all messages
         */
        initAutoHidden: function () {
            setInterval(function () {

                var date = new Date();
                var now = date.getTime();
            //.fixed
                $('div.message:not(.error):visible').each(function () {
                    var message = $(this);
                    if (message.attr('time-created')) {
                        var timeCreated = parseInt(message.attr('time-created'));
                        if (now - timeCreated > 15000) {
                            //message.removeAttr('time-created');
                            message.hide('blind', function() {
                                message.remove();
                            }, 500);

                        }
                    } else {
                        message.attr('time-created', now);
                    }
                });
            }, 1000);
         }
    });
});


texts:
I use in my decision the answer that was in this question
Magento 2 Custom Collection

Everything works fine, but how to filter data when they are searched?

My code

$collection = $this->_postFactory->create()->getCollection();

    $collection2 = $this->_purchaseListCollection;

    foreach ($collection->getData() as $key => $data) {
        $data['model_number'] = 'tested'.$key;
        $collection2->addItem(
            new \Magento\Framework\DataObject($data)
        );
    }

    $this->setCollection($collection2);

    return parent::_prepareCollection();

Code create table

  $this->addColumn(
        'model_number',
        [
            'header'            => __('Model number'),
            'index'             => 'model_number',
            'sortable'          => true,
            'type'              => 'text',
            'escape'            => true,
            'header_css_class'  => 'col-value',
            'column_css_class'  => 'col-value',
        ]
    );

My code on model/resourceModel collection

namespace Magento\PurchaseWizard\Model\ResourceModel\PurchaseList;

use Magento\Framework\Data\Collection as DataCollection;
class EmptyCollection extends DataCollection
{

}


texts: magento 2. 2 Attribute labels do not change even if language is switched

texts:
I am facing the problem that attribute labels are not changed for each language in magento 2.

foreach ($attributes as $key => $attribute) {

    if ($attribute->getIsVisibleOnFront() && $attribute->getFrontend()->getValue($product) !="" && $attribute->getFrontend()->getValue($product) !="Non") {

        $html .= '
';
        $html .= '' . $attribute->getFrontend()->getLabel() . '	';
        $html .= '' .  $attribute->getFrontend()->getValue($product) . '	';
        $html .= '
';

    }

}

how can I fix it?


texts: Getting $_item within configurable product type template

texts:
We've used the AttributeIcons extension to convert our configurable product options from drop downs to radio buttons and we now wish to implement a quantity field against each option (as can be set with grouped product types).

The extension includes it's own configurable.js override and the template override for inserting the radio buttons is:-

this.radioTemplate = new Template('
<input type="radio" name="#{name}" onclick="$(\'#{element}\').setValue(#{value});" id="#{id}" value="#{value}">#{label}</input>
');

I'd like to modify this to include the quantity inputs (using the grouped type template as a guide). I have this so far...

this.radioTemplate = new Template('
<input type="radio" name="#{name}" onclick="$(\'#{element}\').setValue(#{value});" id="#{id}" value="#{value}">#{label}</input><input type="text" name="super_group_#{name}" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /></input>
');

I'm struggling to convert the value and the title to something that will work in this file however. The $_item variable is not declared in the configurable type template whereas it is in the grouped, specifically:-

<?php foreach ($_associatedProducts as $_item): ?>

How can I get the default quantity and display the quantity input against each product option within the configurable template? I've tried loading associated products in the configurable type template from the below but it didn't like that...

<?php $_associatedProducts = $this->getAssociatedProducts(); ?>
<?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>

Can I use something else other than $_item to get the quantity of each product option (associated product) or do I have to find a way of loading these into the configurable type template?


texts: Customer can't register an account during order process,redirect to the shopping cart page

texts: Everyone thought it was an old one.Actually, it is.magento 1.9.1.0,When I checked out, clicking on my account was redirected back to the shopping cart page.It's not just this version, I've installed 1.9.x and most of them will.But I looked for a lot and still couldn't find a solution.Any friends know, please help me, thank you very much!


texts:
I have added a currency switcher as per the inchoo tutorial

The issue is though when a customer changes the currency, the call is a physical page load and not an Ajax call which in turn means if they use the browser's back button they need to click it twice to actually go back to the last page.

Is there a way to change this or what's the best way to change the currency via Ajax?


texts: remove catalog search box which is present left to normal search box

texts:
here : "CATALOG SEARCH BOX" is displaying. please help me to remove it

I want to remove "CATALOG SEARCH BOX" which is left to normal search box,

I dont want to delete normal "SEARCH BOX".

please help to find solution.

thanks in advance.


texts: Unable to validate magento custom login form in fancybox

texts:
I am trying to validate the following form in fancybox popup but it keeps on submitting the form instead of doing the validation what am I doing wrong in this? This works perfectly when Outside fancybox.

<form id="login-form-popup" method="post" action="<?php echo $this->getUrl('customer/account/loginPost') ?>">
                 <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

                        Email ID
                    <input type="text" placeholder="<?php echo $this->__('Email ID') ?>" class="input-text required-entry validate-email" name="login[username]" id="email" title="Email Address" />

                        Password
                    <input type="password" placeholder="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" name="login[password]" id="pass" title="Password" />

                    <input class="buttonstyle" type="submit" value="<?php echo $this->__('Login') ?>" name="subloginpop" id="subloginpop" />

                     <a class="forgot-password" href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>">Forgot Your Password?

                </form>


texts: Magento 2: Set cms home page using setup script

texts:
I am writing setup script for the theme configuration but stuck at how to set default cms home page for this theme.

Here is the script  that is setting my theme as default theme. Setup script is working fine.
app/code/RLTSquare/CmsInstall/Setup/InstallData.php

<?php

namespace RLTSquare\CmsInstall\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\Store;

class InstallData implements InstallDataInterface
{
    const THEME_NAME = 'Rlts/brokertheme';

     /**
     * @var \Magento\Theme\Model\Config
     */
    private $config;

    /**
     * @var \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory
     */
    private $collectionFactory;

    public function __construct(
        \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory $collectionFactory,
        \Magento\Theme\Model\Config $config,
        \Magento\Framework\App\Config\ConfigResource\ConfigInterface  $resourceConfig,
    ) {
        $this->resourceConfig = $resourceConfig;
        $this->collectionFactory = $collectionFactory;
        $this->config = $config;

    }

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

        $themeID = $this->getThemeId();
        $this->resourceConfig->saveConfig('design/theme/theme_id',$themeID,'default','0');
        $setup->endSetup();
    }

     protected function getThemeId()
    {
        $themes = $this->collectionFactory->create()->loadRegisteredThemes();
        /**
         * @var \Magento\Theme\Model\Theme $theme
         */
        $themeId=NULL;
        foreach ($themes as $theme) {
            if ($theme->getCode() == self::THEME_NAME) {
                $themeId = $theme->getid();
                break;
            }
        }
        return $themeId;
    }
}


texts: Magento 2: How to insert a custom JS file in the header of custom theme. This custom JS file is placed in pub/media/pmm-custom directory?

texts: I'm looking for a way to add a custom js file in the header.phtml file. I don't place custom JS file under theme_directory for a obvious reason. Could anyone please tell me how to override header files to inset the custom JS file from pub/media/pmm-custom? To someone who may wonder why the custom JS has to be in pub/media/pmm-custom directory, it is only to help the client to push his minor changes that he often makes in the actual custom.js file residing under the theme_directory so that we don't have to build the Magento site every time he makes and pushes his changes made to this custom file.


texts: Should pub/media directories be included in the gitignore?

texts:
I've inherited a Magento 2 codebase and the .gitignore file matches the one in the Magento 2.3 repo.
I downloaded the latest copy of the database and the /pub/media folder from the live site for my local dev environment so I could get as close a match as possible.
However, I now have a lot of directories in /pub/media that Git is picking up as untracked files.
I feel like I should be gitignore-ing these directories as they aren't currently in the codebase, but I don't want to do anything that will upset the live site on deployment.
These are the directories being picked up by Git:
/pub/media/amasty/
/pub/media/amlabel/
/pub/media/back/
/pub/media/cache/
/pub/media/css_secure/
/pub/media/custom_options/
/pub/media/email/
/pub/media/gbu0/
/pub/media/images/
/pub/media/js/
/pub/media/khxc/
/pub/media/klevu_images/
/pub/media/mbimages/
/pub/media/meigee/
/pub/media/og_image/
/pub/media/xmlconnect/

It looks like most of these have been created by/for the theme that has been used.
Should I add these to the gitignore?