texts:
My client's website has many levels of category, and each level has it's own All category. They want to build target rules that include the "Product category is the Same as Matched Product Cagegories" however the All categories are messing that up. Here is an example:

A
    B
        C
            ✓
        D
            ✗
        E
            ✗
        B-All
            ✓
    F
        G
            ✗
        H
            ✓
        I
            ✗
        F-All
            ✓
    B-All
        ✓
A-All
    ✓

So the product belongs to C, B-All, H, F-All and A-All

If we setup the target rules like the following, we run into problems:

Product category is the Same as Matched Product Cagegories
Product Category does not contain Constant Value [the ids of the all categories]

The problem is that everything in C is also in B-All, so if we exclude B-All then all products in C, D and E get excluded.

We are looking for a way to say "ignore these categories when checking matched product categories". Is there any way to do that which is built in? Any suggestions on a simple code approach that will work?


texts: Magento 2 product changes not reflecting on frontend after updating from admin

texts:
I update catalog price from admin, but the changes is not reflecting on frontend. This needs to deploy static content and cache flush every-time, I change something in admin.

Is there any solution for this?


texts: Save button does not return to admin grid

texts:
I have a plain old save button on an admin form, but it doesn't return me to the grid after saving. It's more or less a copy of Magento\Customer\Block\Adminhtml\Edit\Address\SaveButton.
What could be wrong?
class SaveButton implements ButtonProviderInterface
{
    public function getButtonData(): array
    {
        return [
            'label' => __('Save'),
            'class' => 'save primary',
            'data_attribute' => [
                'mage-init' => ['button' => ['event' => 'save']],
                'form-role' => 'save',
            ],
            'sort_order' => 20,
        ];
    }
}


texts: M2.1: &quot; in frontend product attribute dropdowns

texts:
One of our clients sells products that have sizes displayed as e.g. 4" x 6"

The client has just reported that configurable products that contain the size option in a dropdown have started to be displayed as 4&quot; x 6&quot;. This may or may not be related to a recent upgrade to 2.12, I can't say for certain.

The JSON that's rendered in the page for the configurable combinations is correct - "4&quot; x 6&quot;", it has to be because the fields are delimited by quotes.

But when the string is rendered into the select box by the front end code, it is translated to &amp;quot;, hence the display issue.

Has anyone else encountered this and found a fix?


texts: productAttributeOptionManagementInterface api not loading attributes

texts: I use \Magento\Catalog\Api\ProductAttributeOptionManagementInterface in my constructor and since Magento 2.3.5 it doesn't load any attributes.


texts: How do I override block class for Sales Order Products grid?

texts:
I'm working on Magento 2.3.2 and am trying to override a block in adminhtml.

I overrode the template file perfectly fine, but it seems layout updates are being ignored?

This is the class that gets displayed with template hints with block class hints enabled:

  Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped\Interceptor

The template path shows as my theme.

The theme's directory for overriding the template is:

  app/design/adminhtml/Theme/Vendor/Magento_GroupedProduct

Which contains a folder for Block classes, a folder for templates and the last being for layout.

I copied the layout file from the module-grouped-product folder into my layout folder and made a change:

<block class="Vendor\Module\Block\FieldsetGrouped"
       name="product.composite.fieldset.grouped"
       before="product.composite.fieldset.options"
       template="Magento_GroupedProduct::catalog/product/composite/fieldset/grouped.phtml" />

If I go to app/code/Vendor/Module/Block I can see the FieldsetGrouped class I made. However, after a full php bin/magento command list, still no changes.

I also copied the Block class into the Magento_GroupedProduct folder to see if it would work that way and it didn't seem to make a difference.

The area I'm specifically trying to update is the pop-up you get when clicking "configure" on grouped products when creating an order and adding products:

How do I tell Magento to listen to my xml update?

Thanks,


texts: Breadcrum issue after embeding advance search on home page:magento2

texts:
I have moved the advance search form on home page with the custom template as:
  <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout  /etc/page_configuration.xsd">
     <referenceContainer name="page.wrapper">
        <block class="Magento\CatalogSearch\Block\Advanced\Form" name="catalogsearch_advanced_form"
           template="Your_Theme::advance-search.phtml"/>
     </referenceContainer>
  </page>

Now issue is whenever i visit an page from home page the breadcrumb always includes the advance search in it like this:

How this can be fixed? so it can show what page user on in the breadcrumb?


texts: Magento Admin : How to show custom calculation besides admin grid pager in custom module

texts:
In admin, I want to show custom calculations next to pager in custom module's grid.

If there is any a way to do that, please share.

Example :


texts:
a have a question to some basic stuff of filtering and limiting product collections. I searched the web for the solution but nothing worked. I hope to get some help here.
So, the task is to limit the results with the limit() function. What i want is to set the last product id and to query the next 100 products. The code is called by cron jobs and i need a solution to query every time the next bunch of products. Here my code:

$simpleProducts = Mage::getModel('catalog/product')->getCollection()
        ->addAttributeToFilter('type_id', array('eq' => 'simple'))
        ->addAttributeToFilter('sku', array("notnull" => true))
        ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)
        ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
        ->addAttributeToSelect('entity_id')
        ->addAttributeToSelect('search_sku_textfield')
        ->addAttributeToSelect('sku')
        ->limit(100,$lastProdId);

I also have on some products an attribute set (with the attribute set). It would be nice to query just the products which have the attribute (assigned truh the attribute set). This doesn't work

         ->addFieldToFilter('search_sku_textfield', array("null" => true))


texts: Magento Full Page Cahe expire after catalog modification?

texts:
After using EE 1.12 for a while I migrate to EE 1.13.1, using the default new backend Mage_Cache_Backend_File.

After a new order or a catalog modification, the whole FPC expire completely (all categories and products).

I understand that after an order or catalog modification the related product and categories's cache should be refresh or invalidated, but not the entire FPC.

Any idea what i'm doing wrong?

Thanks

UPDATE

Looking in Enterprise/PageCache/etc/config.xml

The adminhtml event "catalogrule_after_apply" trigger "cleanCache()" which delete my FPC. By removing this event my FPC is not deleted after I update a product from the admin. Only the corresponding cache are correctly deleted.

Still have the issue, for new order that invalidate my whole FPC.


texts: magento special price still showing after expiration, reindexed, flushed, special date & price removed, still

texts:
I have major problem with my magento 1.9 website

Special prices are being shown in a front page despite it expired.
I googled the problem.
I reindexed data.
I cleared cache.
I removed special dates and prices via import.
I checked products in inventory - they do not have special dates or prices.
IT IS STILL SHOWING them in FRONT PAGE.
In result I have phone calls from pissed customers...

Please, if anyone experienced the same and have solution, kindly share.


texts:
I'm creating quote / order programmaticaly. But when I do this, I have an exception : (in english, "select shipping method")

  Magento\Framework\Exception\LocalizedException: Sélectionnez un mode
  de livraison.

However, on my localhost, I can create quote / order. See my code :

$quote=$this->quote->create(); //Create object of quote
        $quote->setStore($store); //set store for which you create quote
        $customer= $this->customerRepository->getById($customer->getEntityId());
        $quote->setCurrency();
        $quote->assignCustomer($customer); //Assign quote to customer

        //add items in quote
        foreach($orderData['items'] as $item){
            $product = $this->getProduct($item['product_id']);
//            $product->setPrice($item['price']);
            $product->setPrice(0);
            $quote->addProduct(
                $product,
                intval($item['qty'])
            );
        }

        //Set Address to quote
        $quote->getBillingAddress()->addData($orderData['shipping_address']);
        $quote->getShippingAddress()->addData($orderData['shipping_address']);

        // Collect Rates and Set Shipping & Payment Method

        $shippingAddress=$quote->getShippingAddress();
        //set shipping method is not working
        $shippingAddress->setCollectShippingRates(true)
                        ->collectShippingRates()
                        ->setShippingMethod('freeshipping_freeshipping'); //shipping method
        $quote->setPaymentMethod('checkmo'); //payment method
        $quote->setInventoryProcessed(false); //not effetc inventory

            $this->quoteRepository->save($quote);
//        $quote->save(); //Now Save quote and your quote is ready

            // Set Sales Order Payment
            $quote->getPayment()->importData(['method' => 'checkmo']);

            // Collect Totals & Save Quote
            $quote->collectTotals();

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

            // Create Order From Quote (exception here)
            $order = $this->quoteManagement->submit($quote);


texts: Rapidly increasing system log in magento 2

texts:
I have one Magento 2.2.4 website and used Template Monster Theme. but I am facing problem when any user accessing website continuously increase system log with below logs.

[2018-09-27 08:06:27] main.INFO: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2018-09-27 08:06:27] main.INFO: Broken reference: the 'catalog.sidebarnav' element cannot be added as child to 'div.sidebar.main', because the latter doesn't exist [] []
[2018-09-27 08:06:27] main.INFO: Broken reference: the 'brand.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2018-09-27 08:06:27] main.INFO: Broken reference: the 'catalog.sidebarnav' tries to reorder itself towards '', but their parents are different: 'div.sidebar.main' and '' respectively. [] []
[2018-09-27 08:06:27] main.INFO: Broken reference: the 'brand.sidebar' tries to reorder itself towards 'catalog.compare.sidebar', but their parents are different: 'sidebar.additional' and '' respectively. [] []
[2018-09-27 08:06:27] main.INFO: Broken reference: the 'header.panel' tries to reorder itself towards 'header_info', but their parents are different: 'rd.navbar' and '' respectively. [] []
[2018-09-27 08:06:27] main.INFO: Broken reference: the 'currency' tries to reorder itself towards 'store_language', but their parents are different: 'header.switchers' and 'header.panel' respectively. [] []

Please anyone help me to solve this issue.


texts: Efficiently loading product data via model

texts:
I have a custom attribute for product called warehouse of type drop down.

In order to load the Sku => Warehouse (get assigned value for each product) updates between dates via models; I do the following:

// Load warehouse attribute options
$warehouse_options = array();
$options = array();
$attribute = Mage::getSingleton('eav/config')
    ->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'warehouse');
if ($attribute->usesSource()) {
    $options = $attribute->getSource()->getAllOptions(false);
}
$attribute = null;
foreach ($options as $option) {
    $warehouse_options[$option['value']] = $option['label'];
}
$options = null;

// Load all products updated since last sync
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToFilter('updated_at', array(
    'from' => $datetime_from,
    'to' => $datetime_to,
    'date' => true
));

// Init results
$results = array(
    'ServerDateTime' => $datetime_now,
    'Mapping' => array()
);

// Build results
foreach ($collection as $p) {
    $product = Mage::getModel('catalog/product')->load($p->getId());
    $results['Mapping'][] = array(
        'Sku' => $product->getSku(),
        'Warehouse' => isset($warehouse_options[$product->getWarehouse()]) ? $warehouse_options[$product->getWarehouse()] : ''
    );
    $product = null;
}
$collection = null;

This works, but quite slow as each product is getting loaded, so if I had 3000 products, thats 3000+ queries.

Is there a way to optimise this so I can load the desired data with minimal amount of query & processing?

I have tried to use just the collection like this using addAttributeToSelect:

$collection->addAttributeToSelect('sku', 'warehouse');

However, the returned $collection->getData() does not contain the field warehouse. Here's an example response array:

Array
(
    [0] => Array
        (
            [status] => 1
            [entity_id] => 4
            [type_id] => simple
            [attribute_set_id] => 4
            [updated_at] => 2015-07-07 15:35:35
            [sku] => C13S041061
        )


texts: How to display discount amount on shopping cart page magento 2 custom theme?

texts:
Actually i want to display discount amount once we apply the discount
  code in shopping cart page magento2 in custom theme.Please guide me if
  anyone have any idea.


texts: All http redirects to https://homepage.com

texts:
my Magento site 1.9.2.4 redirects all users from http://example.com/foo to https://example.com.

How do I change this to redirect to https://example.com/foo?

I looked at .htaccess in my document root and I can't tell why they're being redirected in the first place. Thanks in advance!


texts: Magento 2 How to add simple product to Grouped product

texts:
I want to add a simple product to a grouped product. I tried a lot of different approaches, including direct database modifications, all without success. I'm guessing it should be something like this.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $product = $objectManager->create('Magento\Catalog\Model\Product')->load($groupedID); // Load Configurable Product
    $associatedProductIds = array($simpleID); //Product Ids Of Associated Products
    $product->setAssociatedProductIds($associatedProductIds);// Setting Associated Products
    $product->save();

the above gives no error. but also does not create a link.


texts: Mass email customers for a password reset

texts: We want to import our customer database from our old site to our new one which we are going to use cart2cart for but from other reviews on the internet I hear they do not transfer the customer passwords. Is there a way I can send a mass email to every customer asking them to go change their passwords, giving them a link to click on?


texts: Magento2 unable to create|use a virtual type

texts:
I'm trying to make use of a virtual type. I'm following the docs on this and everything should be pretty straight forward yet I'm kinda stuck.

This is what I have.

The class.

namespace Company\Extension\Model\Product\Attribute\Source;

class Test
{
    protected $string;

    public function __construct(String $test)
    {
        $this->string = $test;
    }

    public function test()
    {
        return $this->string;
    }
}

The di.xml

<config>
    <virtualType name="TestVirtualType" type="Company\Extension\Model\Product\Attribute\Source\Test">
        <arguments>
            <argument name="value" xsi:type="string">foo</argument>
        </arguments>
    </virtualType>
</config>

Now when running a simple php/bin magento

[Magento\Framework\Exception\LocalizedException]
  Invalid Document
  Element 'argument': The type definition is abstract.
  Line: 13
  Internal error: xmlSchemaXPathProcessHistory, The state object to be removed is not the first in the list.
  Line: 12
  Internal error: xmlSchemaValidateChildElem, calling xmlRegExecPushString2().
  Line: 3
  Internal error: xmlSchemaValidateElem, calling xmlSchemaStreamValidateChildElement().
  Line: 3
  Internal error: xmlSchemaDocWalk, calling xmlSchemaValidateElem().
  Line: 3

I'm following the docs on this as well as many provided examples. I'm not really sure what I'm doing wrong. Any help or pointers in the right direction are highly appreciated


texts: exception 'Mage_Core_Exception' with message 'Type invalid block : ' in /home/website/www/app/Mage.php:594

texts:
When I click on category like example-category page magento rise following error.
In this category have only one product like : example-product.

Catogary URL : https://www.website.com/main-category/example-category.html this redirect to https://www.website.com/main-category/example-category/example-product.html but its give 302 status and redirect to homepage https://www.website.com

Another category have multiple products its work fine but above category page not working propely

After that its give following error.

Stack trace:
#0 /home/website/www/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Type de bloc no...')
#1 /home/website/www/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /home/website/www/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'category.produc...')
#3 /home/website/www/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'category.produc...')
#4 /home/website/www/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /home/website/www/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /home/website/www/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 /home/website/www/app/code/core/Mage/Catalog/controllers/CategoryController.php(146): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 /home/website/www/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController->viewAction()
#9 /home/website/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('view')
#10 /home/website/www/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /home/website/www/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#12 /home/website/www/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#13 /home/website/www/index.php(87): Mage::run('french', 'store')
#14 {main}
2016-06-25T05:42:24+00:00 ERR (3):

I tried clear Cache and Reindexing.
What is wrong for this issue in Magento 1.7.0.2.


texts: catalog_product_flat is not taking new attributes

texts:
Flat product table, once enabled should be used solely to display a product.
Am I wrong ?

So, if I add attributes, how can I add these in the flat tables..?

example of a line I get on catalog_product_flat on my website:

entity_id   ;   268232
attribute_set_id    ;   9
type_id ;   simple
availability_titelive   ;   6
cost    ;   NULL
created_at  ;   08/05/2014 13:55
credit_amount   ;   NULL
enable_googlecheckout   ;   1
fb_product  ;   NULL
gift_message_available  ;   NULL
has_options ;   0
image_label ;   NULL
is_recurring    ;   NULL
links_exist ;   NULL
links_purchased_separately  ;   NULL
links_title ;   NULL
msrp    ;   NULL
msrp_display_actual_price_type  ;   NULL
msrp_enabled    ;   NULL
name    ;

Mon&#32;Bloc&#32;De&#32;Dessin&#32;3d&#32;&#59;&#32;Special&#32;Filles
news_from_date  ;   NULL
news_to_date    ;   NULL
price   ;   130.0000
price_type  ;   NULL
price_view  ;   NULL
publication_date_titelive   ;   01/12/2015 00:00
recurring_profile   ;   NULL
required_options    ;   0
shipment_type   ;   NULL
short_description   ;

Une&#32;nouvelle&#32;collection&#32;de&#32;kits&#32;totalement&#32;in&#233;dite

&#32;avec&#32;tout&#32;le&#32;mat&#233;riel&#32;pour&#32;cr&#233;er&#32;des&#32

;images&#32;en&#32;3&#32;dimensions&#32;&#
sku ;   9782215109372
sku_type    ;   NULL
small_image ;   NULL
small_image_label   ;   NULL
special_from_date   ;   NULL
special_price   ;   NULL
special_to_date ;   NULL
tax_class_id    ;   0
thumbnail   ;   NULL
thumbnail_label ;   NULL
updated_at  ;   02/09/2014 16:57
url_key ;   mon-bloc-de-dessin-3d-special-filles
url_path    ;   mon-bloc-de-dessin-3d-special-filles.html
visibility  ;   4
weight  ;   283.0000
weight_type ;   NULL

etc..What I infer from this is the flat table isn't correctly getting all the

new attributes I added. And (since the product page displays correctly that

magento will look for what is missing using INNER JOIN). Great but best would

be that all fields are correctly fed.

Thanks for your help.

Mat


texts: How to implement a method retrieving config value both at store and default scope: Magento 2

texts:
In Magento 1, a call to Mage::getStoreConfig('section/group/field') was able to retrieve a config of the current store. Indeed, if we called it from a front block for example, it retrieved the config value of the current store and if we called it from an admin block, it retrieved the value of the admin store (id=0).

Is it still possible in Magento 2 to have such a method ?

For example, I created an helper with the following content :

namespace VendorName\ModuleName\Helper;

use Magento\Store\Model\ScopeInterface;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;

class Config extends AbstractHelper
{
    const XML_PATH_FEATURE_ENABLED = 'section/group/my_feature_enabled';

    /**
     * Get enabled config
     * @param int|null $storeId
     * @return mixed
     */
    public function isEnabled($storeId = null)
    {
            return $this->scopeConfig->getValue(
                self::XML_PATH_FEATURE_ENABLED,
                ScopeInterface::SCOPE_STORE,
                $storeId
            );
    }
}

For informations : in my test environnement, I have only one store view.
My core_config_data table looks like :

scope   |  scope_id |                path               |    value
default |    0      | section/group/my_feature_enabled  |      0
stores  |    1      | section/group/my_feature_enabled  |      1

When I call it from the frontend area, it works as expected (returns 1). But when I call it from the admin, it does not return the default admin value : it returns 1 too ...

If I change ScopeInterface::SCOPE_STORE by default in the isEnabled method, it always returns the default value (admin value) but it's not returning the good front end value anymore ...

So, what is the Magento 2 way to have the same result as the Magento 1 Mage::getStoreConfig method ?

UPDATE :

Using the answer of @Sumit, I was able to create a method working as I expected :

namespace VendorName\ModuleName\Helper;

use Magento\Framework\App\Area;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\State;
use Magento\Store\Model\ScopeInterface;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;

class Config extends AbstractHelper
{
    const XML_PATH_FEATURE_ENABLED = 'section/group/my_feature_enabled';

    /**
     * @var State
     */
    protected $_state;
    /**
     *
     * @var bool
     */
    protected $_isEnabled;

    public function __construct(
        State $state,
        Context $context
    ) {
        parent::__construct($context);
        $this->_state = $state;
    }
    /**
     * Get enabled config
     * @param int|null $storeId
     * @return mixed
     */
    public function isEnabled($storeId = null)
    {
       $scopeCode = ($this->_state->getAreaCode() == Area::AREA_ADMINHTML) ?
                    ScopeConfigInterface::SCOPE_TYPE_DEFAULT :
                    ScopeInterface::SCOPE_STORE;
       return $this->scopeConfig->getValue(
                self::XML_PATH_FEATURE_ENABLED,
                $scopeCode,
                $storeId
              );

    }
}

If there is other suggestion, please share with us.


texts: Magento 2 Password Reset Email goes to 404 link

texts:
I am unsure what has happened but my email template Reset Password button now links to a 404 page. Is there any way that I can get the original variable used for getting a customers password reset link?

I can confirm that the email template being called is the correct one as I have previously formatted the template.

The anchor tag currently being used that links to the 404 page is as follows:

Reset Password


texts: Website Customizable Color not shown in Navigation Menu

texts:
I have installed the JM Trex theme, which uses JM Mega Menu to edit the Navigation Menu of the theme. The theme has 5 colors, which the website visitor can choose from: Red, Blue, Green, Violet and Yellow. In the Navigation Bar, if I move my mouse cursour on "Culori (eng. colors), I have there only Albastru (eng. blue), Rosu (eng. red), Verde (eng. green), Yellow Color (which I tried to change into my language, but I couldn't, because I couldn't find it in my Admin Panel) and Galben (which is also Yellow in my language. I added this hoping that the other one (Yellow Color) will dissapear from my Navigation Bar, but it also dissappeared from the Admin Panel, where I edited them. Both, Yellow Color and Galben change the color of the website to yellow, if they are clicked.

Now, in the Admin Panel, I have only 4 of them: Albastru (eng. Blue), Verde (eng. Green), Violet (eng. Violet) and Rosu (eng. Red). "Yellow Color" and "Galben" both are missing.
I would like to remove "Yellow Color" from the menu, but the problem is that I can't find it in JM Mega Menu, so I can't hide it from the Navigation Menu.


texts: How to override block with plugin in Magento 2

texts:
I want to override a _prepareLayout function of the block module-catalog-search/Block/Result.php .

 protected function _prepareLayout()
    {
        $title = $this->getSearchQueryText();
        $this->pageConfig->getTitle()->set($title);
        // add Home breadcrumb
        $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
        if ($breadcrumbs) {
            $breadcrumbs->addCrumb(
                'home',
                [
                    'label' => __('Home'),
                    'title' => __('Go to Home Page'),
                    'link' => $this->_storeManager->getStore()->getBaseUrl()
                ]
            )->addCrumb(
                'search',
                ['label' => $title, 'title' => $title]
            );
        }

        return parent::_prepareLayout();
    }

In above function, if I want to change the breadcrumbs name from Home > Search Result to something else.
How can I do it with the help of plugin ?


texts: How can I make a sub url recognize the theme's favicon, not the main url's theme?

texts:
I have a site that I am making and I am using a sub url (like suburl.site.com) for a development. They are each a store within the same Magento instance. They both have  I put different favicon for each of these in their theme folders, but when I go to the sub url the favicon is for the main url.

How can I make the sub url show the favicon for its theme, not the favicon for the theme of the main url?

Thanks.


texts:
I uploaded my theme package in cpanel file manager public_html, and I had this error : your account is disabled in Magento admin login page.

I don't know how to unlock it and how to upload theme properly in cpanel to start using my store.


texts: Virtualtype admin grid filter data collection in Magento 2

texts:
I created an admin grid using virtual type in di.xml like this:

<virtualType name="Namespace\Module\Model\ResourceModel\Test\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
   <arguments>
      <argument name="mainTable" xsi:type="string">module_test</argument>
      <argument name="resourceModel" xsi:type="string">Namespace\Module\Model\ResourceModel\Test\Collection</argument>
   </arguments>
</virtualType>

i want to filter the data by the id that passed via an url like this:

http://localhost/admin/namespace_module/test/index/test_id/<id>/key/<form_key>

I want my grid to load only data that contain only test_id which sent via url

<column name="test_id">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" translate="true" xsi:type="string">test_id</item>
                </item>
            </argument>
        </column>


texts: multiselect product attribute not showing option labels on frontend

texts:
I have checked lot and tried many things, but I am still not getting the product multiselect selected values label on product view page.

I have product attribute called package which is multiselect,
Code that create the product attribute

$this->addAttribute(
    'catalog_product',
    'package',
    array(
        'group'             => 'Package',
        'backend'           => 'eav/entity_attribute_backend_array',
        'frontend'          => '',
        'class'             => '',
        'default'           => '',
        'label'             => 'Package',
        'input'             => 'multiselect',
        'type'              => 'text',
        'source'            => 'npm_recurrex/package_source',
        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'is_visible'        => 1,
        'required'          => 0,
        'searchable'        => 0,
        'filterable'        => 0,
        'unique'            => 0,
        'comparable'        => 0,
        'visible_on_front'  => 0,
        'user_defined'      => 1,
    )
);

this works fine, I am successfully saving the product.
But in frontend product view page when I say

Mage::log(print_r($_product->getData('package'), true));

Its prints the result as 1,2
But I wanted to display option labels of multiselect not option id's.
So I tried with this code

Mage::log(print_r($_product->getAttributeText('package'), true));

It prints nothing, just blank space :(.

I have checked this link but no use.

I am confused with this, Where I am wrong? and what is the wrong thing?

Can anybody explain me what is happening in my case?

my getOptionText Method

public function getOptionText($value)
{
    $options = $this->getAllOptions(false);
    foreach ($options as $item) {
        if ($item['value'] == $value) {
            return $item['label'];
        }
    }
    return false;
}


texts:
I've added a custom attribute to a product of mine with code _ek_test_, a text field where I save a number like 0.18.

Now in my plugin I try to access that custom field however I never get something returned. I tried various methods that I found by Googling but nothing works. If I use a predefined attribute it works fine.

Here's my code

// returns 'ek_test';
$product_costs_attribute = $this->_config['product_costs_attribute'];

// Load product, $item is a order item
$product = Mage::getModel('catalog/product')->load($item->getProductId());

// queries attribute but is nil
$bp = floatval($product->getData($product_costs_attribute));

Mage::log('Attribute value: ' . $bp, null, 'plugin.log');

What's the correct way to do it?


texts: How to add Add frontend product url column to admin product grid

texts: I want to add new column in the product grid in magento admin to show the frontend product url .


texts: Is it safe to OPTIMIZE MySQL database using Optimize Table option in phpMyAdmin?

texts:
Looking to optimize MySQL database for magento using the Optimize table option in phpMyAdmin?

Are there any risks to optimize using such option?


texts: pub/static/_requirejs is not being created in magento 2 version 2.2.4

texts:
i am trying to include slick plugin into magento 2 through custom theme by requirejs but pub/static/_requirejs folder + files are not being generated on code deploy.
file structure is following:

/app/design/frontend/Vendor_Name/Theme_Name/requirejs-config.js
/app/design/frontend/Vendor_Name/Theme_Name/web/js/slick.js and
slick.min.js
/app/design/frontend/Vendor_Name/Theme_Name/web/css/source/vendor/slick.less
and slick-theme.less

Code for requirejs-config.js is as follows:

 `var config = {
           paths: {
               slick:'js/slick'
           },
           shim: {
               slick: {
               deps: ['jquery']
               }
           }
       };`

This is not a duplicate question, i have not found any solution on internet in last two days. Do let me know if any thing else needed regarding this question if it is not clear.
I have followed this tutorial:
https://inchoo.net/magento-2/magento-2-slick-carousel/

but i am stuck on point 7 as "requirejs-config.js" is not getting included may be because pub/static/_requirejs folder is not being generated on deploy

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

Please help me as i am stuck on this issue from last 2 days

Screenshot of View-source is:


texts:
By default , magento have the file upload option under customise option->option type in product form.

How to add multiple file uploader under customise option .

Thanks.


texts: Magento configuration in a clustered environment

texts:
I'm currently working on a large Magento (Enterprise Edition) project where the client wants to use four load balanced web servers and four MySQL servers (one master, three slaves).  I have not been able to find any clear information on the best way to configure Magento in this situation as far as cache and media storage.  Anyone who has done something similar care to share their experience or point to a list of best practices for this?

My current plan is:

Store session data in DB
A single memcache server accessible from all four Apache servers for cache
A single Solr server for search
NFS drive mounted to /media on web servers

I've seen some recommendations where multiple memcache servers are used, such as one on each web server in the cluster.  Wouldn't this cause problems and decrease performance when something is cached on one host and not the other?


texts: Way to include js library using magento admin

texts: Is there any way to include js library on all magento product view and list pages using magento admin ?


texts: Set form values with javascript: not saved

texts:
in my admin edit form I set an input field value with a javascript function. The function works and the value is displayed in my input field.

My problem is, that when I save the edit page, Magento ignore the setted value.
How can I tell Magento to save my javascript value.

Thats my javascript code inside:

document.addEventListener('readystatechange', event => {

if (event.target.readyState === "complete") {
    setTimeout(function(){
        if(document.getElementsByName("material_id")[0].value == "0"){
            var materialId = "<?php echo $parentId; ?>"
            var a = document.getElementsByName("material_id");
                a[0].value = materialId;
            }
        }, 3000);
}

});

As below described, the value is setted, but magento does not save the value.

Thanks for help.

Christian


texts: Magento 2.2.4: What is "You can now deploy static content on demand while in production mode"?

texts:
While reading through the release notes for Magento 2.2.4 (devdocs.magento.com) I found the following: "You can now deploy static content on demand while in production mode".

Does anyone know what was changed with this? There's no reference to a pull request nor can I find anything changed in the documentation (devdocs.magento.com).


texts: HI Everyone , i want to move header section in menu bar ? i dont know how ? can anybody help me out for this question

texts: I want to move header section into menu bar. Can anyone help me out for this?


texts: Include Toolbar Pager in custom product collection in custom page

texts:
I have a custom page where I am listing the custom product collection. I am using the default catalog/product/list.phtml as template to display the page. It's listing fine like the category page. But it's missing the toolbar pager. I tried the code in the following way

<reference name="content">
            <block type="customization/product_searchbycity" name="searchbycity" as="searchbycity" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setColumnCount"><count>4</count></action>
            </block>
</reference>

And in the block

class Probytes_Customization_Block_Product_Searchbycity extends Mage_Catalog_Block_Product_Abstract
{
    public function getLoadedProductCollection() {
        $data['address'] = $this->getRequest()->getParam('city-to-search');
        $model = Mage::getModel('customization/citysearch');
        $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
        $collection->addAttributeToFilter('status',1)
                    ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
        $collection = $model->searchResult($data,$collection);

        return $collection;
    }
}

It's not showing the toolbar pager in the custom page. I need the page like the category page. Please anyone help on this.


texts: Custom page Data render from FPC magento 2

texts:
I have a custom page which gets data from the block.
FPC is enabled so when I change data it is not reflecting without page cache.

I do not want to use cacheable="false" in the block because it will always non-cacheable block.

Basically, I want when There is not data change it will come from the cache and when Data is changing it will reflect at a time.

Magento product page  is using like this to render data change

$this->_cacheManager->clean('catalog_product_' . $this->getId());

Can i use this way? if yes how can i use this?

How can I do that without ajax? Is it possible to do that?


texts: Magento 2: Create different menus with links?

texts:
Is there a way to create menus and specify which links go in each menu?

For example, I would like two menus in my header:
1. A specific list of items (just 6 items)
2. A few account page links (My Account) and static information pages (About Us etc)

I'd like to place the menus in two different positions in the header. Is there a way for me to create these menus and then use the XML layout file to call each of the menus and position them?


texts: Not able to translate OK and cancel buttons in confirmation popup minicart

texts:
After adding an item into cart if we goto mini cart and click on remove item a confirmation popup with Ok and Cancel option will appear. I am not able to translate the Ok and Cancel buttons.

Please guide me how to do this. Thanks in advance.


texts: Hide columns under condition when exporting csv

texts:
Fyi, I did read from another similar post where I came to a good solution (Setting is system true will prevent it from getting exported).

However, my problem is I would like to have two type of csv export where the first type will export all columns. The second type will only export certain column. I cant set is_system true as this will hide the columns from both types of export function. Is there any way to set condition in the controller where it can set is_system true to the grid or any alternative way?

Beforehand, let me thank you in advance.

   public function example()
    {
        $fileName   = 'example.csv';
        $content    = $this->getLayout()->createBlock('example/example_grid')
            ->getCsv();

        $this->_sendUploadResponse($fileName, $content);
    }

//Grid

$this->addColumn('detail', array(
    'header'    => Mage::helper('example')->__('Detail'),
    'align'     => 'left',
    'renderer'  => 'example/example'
));


texts:
Hi there I'm trying to run a custom module when a product is saved at the moment I have an event listener on the product page and need to send some of the info entered to a controller using ajax.

When making the Ajax call the result is coming back with the current pages HTML on the console. Here is my code any help would be awesome thanks :)

  RelatedProducts/Items/view/adminhtml/templates/js.phtml

            function ajax(){
                var name = document.getElementsByName("product[name]")[0].value;
                var type = document.getElementsByName("product[product_category_type]")[0].value;

                $.ajax({
                    url: "RelatedProducts_Items/Adminhtml/CustomAjax",
                    data: { name : name, type : type},
                    type: "POST",
                    success: function(result){
                        console.log(result);
                    }
                });
            }

  RelatedProducts/Items/etc/adminhtml/routes.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route id="RelatedProducts" frontName="RelatedProducts">
            <module name="RelatedProducts_Items"/>
        </route>
    </router>
</config>

  RelatedProducts/Items/Controller/Adminhtml/CustomAjax.php

namespace RelatedProducts\Items\Controller\Adminhtml;

class CustomAjax extends \Magento\Backend\App\Action

    public function execute()
    {

       echo "testing";
    }
}


texts: how to remove discount amount from creditmemo items in magento

texts:
I want to remove discount amount from creditmemo items and totals at the time of creditmemo create and view. And also updated grand total accordingly as shown in below figure :

How to do that?


texts: Magento 2 CLI commands not working in windows 10

texts:
I installed magento 2 setup on windows 7 and windows 10. In windows 7
  commands works fine but in windows 10, nothing happens after running
  any of magento 2 CLI commands and not even it gives any error.

Tried commands in shell script. Result is in non readable format.


texts:
I have setup phpunit using composer to do some testing in Magento.

And after the setup I see the following lines added to my Mage.php file.

/** AUTOLOADER PATCH **/
if (file_exists($autoloaderPath = BP . DS . 'vendor/autoload.php') ||
    file_exists($autoloaderPath = BP . DS . '../vendor/autoload.php')
) {
    require $autoloaderPath;
}
/** AUTOLOADER PATCH **/

What I want to know is what is the purpose of this patch, and can we do anything without changing our Mage.php file.

My composer.json, which I used for installing phpunit is as follows :

{
"name": "company)name/api",
"type": "project",
"require": {
    "magento-hackathon/magento-composer-installer": "*"
},
"require-dev": {
    "phpunit/phpunit": "^7.5",
    "phpunit/php-invoker": "^2.0"
},
"extra": {
    "magento-root-dir": "/var/www/html/parent_project_dir"
},
"config": {
    "platform": {
        "ext-pcntl": "7.2",
        "ext-posix": "7.2"
    }
}

}

PS : I am using Magento 1.9.


texts: Magento 1.9 - Observer Event redirection issue after placing order

texts:
This is my xml :

<global>
    <events>
        <sales_order_place_after>
            <observers>
                <test_magewidget_model_observer>
                    <type>singleton</type>
                    <class>Test_MageWidget_Model_Observer</class>
                    <method>testRedirection</method>
                </test_magewidget_model_observer>
            </observers>
        </sales_order_place_after>
    </events>
</global>

This is my Observer :

class Test_MageWidget_Model_Observer {

    public function testRedirection($observer) {
        try {
            Mage::app()->getResponse()->setRedirect(Mage::getUrl("checkout/cart"));
            Mage::log('Hi', null, 'magewidget.log');
        } catch (Exception $e) {
            Mage::logException($e->getMessage());
        }
    }

After placing order event being triggered, but redirection not working properly. It's showing in Browser network response, but not reflecting on the browser.

What can be the reason behind this? Please help me.


texts: Coupon Plugin the cart is shown as empty

texts:
I want to create a plugin to hook into the CouponManagement System. I hook into beforeSet and it triggers but the cart is shown as empty, This is my code:

  protected $_quote;
  private $logger;

  public function __construct(
    \Magento\Quote\Model\QuoteFactory $quoteFactory
  ){
    $this->_quote = $quoteFactory;
  }

  public function beforeSet(\Magento\Quote\Model\CouponManagement $subject, $cartId, $couponCode){
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $this->logger = $objectManager->create('\Psr\Log\LoggerInterface');
    $this->logger->debug('test before set');

    $cart = $this->_quote->create()->get($cartId);
    $this->logger->debug($cart);
  }

Can someone help me to get the actual cart?

Thank you in advance!


texts: I have an Issue with "Use Product Image for Swatch if Possible" in magento 2.2

texts:
I have an issue with swatch image URL on product detail page. You can check this link for color attribute.

Swatch Image url is : `

  pub/media/catalog/product\cache\f307e558402b572df42bba27be68d88b//f/_/f_pillow_clr3.png

The image exists in pub media folder but it's not showing in the box.

http://prntscr.com/jrfjob

Please help I am stuck from last 2 days in this issue.


texts: Magento 2.3.3 installation with composer fails: Could not delete

texts:
I'm trying to install Magento 2.3.3 on Debian 9 over a virtual machine.

I'm stuck during the magento installation process because of the magento-composer-installer plugin. I also did a manual installation using the following command from the magento devdocs, but I always get the same error:

composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
    Finished: success: 0, skipped: 0, failure: 334, total: 334
Package operations: 460 installs, 0 updates, 0 removals
  - Installing magento/magento-composer-installer (0.1.13): Loading from cache
Plugin installation failed, rolling back
  - Removing magento/magento-composer-installer (0.1.13)

  [RuntimeException]
  Could not delete /home/vagrant/magento/magento2/vendor/magento/magento-composer-installer/src/MagentoHackathon:

I'm using Windows 10 as host machine.

Composer 1.9.2
PHP 7.2
Vagrant 2.2.6
Virtual Box 6.0.16

Do you have any idea how to resolve that error? I saw a similar question here, but no really relevant answer.

Thanks!


texts:
this action is called when i m upload image:

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");

    $targetDir = Mage::getBaseDir('media') . DS . 'plupload' ;
    $cleanupTargetDir = true; // Remove old files
    $maxFileAge = 5 * 3600; // Temp file age in seconds
    if (!file_exists($targetDir)) {
        @mkdir($targetDir);
    }

    if (isset($_REQUEST["name"])) {
    $fileName = $_REQUEST["name"];
    } elseif (!empty($_FILES)) {
    $fileName = $_FILES["file"]["name"];
    } else {
    $fileName = uniqid("file_");
    }

    $_SESSION['file'] = $fileName;
    $filePath = $targetDir . DS . $fileName;
    // Chunking might be enabled
    $chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
    $chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
    // Remove old temp files
    if ($cleanupTargetDir) {
    if (!is_dir($targetDir) || !$dir = opendir($targetDir)) {
    die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
    }
    while (($file = readdir($dir)) !== false) {
    $tmpfilePath = $targetDir . DS . $file;
    // If temp file is current file proceed to the next
    if ($tmpfilePath == "{$filePath}.part") {
    continue;
    }
    // Remove temp file if it is older than the max age and is not the current file
    if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge)) {
    @unlink($tmpfilePath);
    }
    }
    closedir($dir);
    }
    // Open temp file
    if (!$out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb")) {
    die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
    }
    if (!empty($_FILES)) {
    if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) {
    die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
    }
    // Read binary input stream and append it to temp file
    if (!$in = @fopen($_FILES["file"]["tmp_name"], "rb")) {
    die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
    }
    } else {
    if (!$in = @fopen("php://input", "rb")) {
    die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
    }
    }
    while ($buff = fread($in, 4096)) {
    fwrite($out, $buff);
    }
    @fclose($out);
    @fclose($in);
    // Check if file has been uploaded
    if (!$chunks || $chunk == $chunks - 1) {
    // Strip the temp .part suffix off
    rename("{$filePath}.part", $filePath);
    }
    // Return Success JSON-RPC response
    die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');

this action is called when i m click on button:

    $comment = $_POST['comments1'];

    $id = $_SESSION['id'];
    $time =  date("Y-m-d h:i:s", Mage::getModel('core/date')->timestamp(time()));
    $conn = Mage::getModel('management/comment');
    $conn->setData('comment',$comment);
    $conn->setData('task_id',$id);
    $conn->setData('time',$time);
    $conn->save();
//  $obj = Mage::getModel('management/comment')->getCollection();
    $cid = $conn->getCommentId();
    $file = $_SESSION['img'];
    $fileName = $_SESSION['file'];
    $type = $_SESSION['type'];

    $conn = Mage::getModel('management/file');
    $conn->setData('filename',$fileName);
    $conn->setData('file',$file);
    $conn->setData('type',$type);
    $conn->setData('comment_id',$cid);
    $conn->setData('task_id',$id);
    $conn->save();

In plupload i m upload two or more files n when i m click on button that time i want to store all file in database.

how to store all file in database when i m click on button?


texts:
I have an error on checkout page if I am logged in. But its does not occur if I am not logged in. On the checkout page I am getting the following error:

  Error occurred during "shipping_address" processing. Error occurred
  during "save_in_address_book" processing. Invalid type for value: "1".
  Expected Type: "int".

I believe this is related to data being sent from the browser to magento is invalid but I cannot find a solution. I am running Magento 2.1.0 and upgraded to 2.1.2 to test and got the same error.

Can anyone offer any assistance? TIA


texts: Dynamic Rows can not delete in edit form in admin magento 2

texts:
I have created custom modules with Magento 2.2.6 and there is dynamic rows added in custom module UI component form.
Admin can add/delete dynamic row in new form. but admin can not delete dynamic rows in edit form

Is there any way to do this ? please suggest


texts: How to add noindex,follow to Category page when sorting applied?

texts:
How to add noindex,follow to category sorting pages? For example a category sort by high price or low price.

How do I add noindex,follow to this sort result.


texts: Very Slow Magento 2 in windows subsystem for Linux(WSL )

texts:
I have installed Magento 2 inside WSL ubuntu 20 for local development, but the speed is very slow.
Cache is enabled and store mode is default.
Anyone experiences the same issue.
My system configuration is
Core i5 2.3
RAM 8 GB
SSD: 250 GB


texts: How to display sum of additional options for each product and shipping cost on checkout page sidebar?

texts:
I added additional option assemble cost for each product. But it is not added with product total. Same with the shipping cost that is not added with grand order total.
I have already both variable(shipping + product assemble) with Magneto 2. Therefore I am trying to show sum of additional option(assemble cost) of each product and shipping cost on checkout page. In my case, The shipping cost & product assemble cost is not included with order total or product total and it will be collect from customer at delivery time.
I created a custom knockout checkout component using this post Add custom knockout component to checkout sidebar in Magento 2
Now i would like to show the data in custom block. Please help.
Sample of layout as below:
Services : To be pay at delivery time.
=========================================
Shipping cost : $10
Assemble cost : $20
===========================
Total cost :    $ 30


texts: How to return products in stock via API REST using SearchCriteria?

texts:
I have an integration that must get my products in stock via the Magento 2 API using SearchCriteria.

How could I filter it, since it's inside my custom_attributes?


texts:
I have set 404 page in admin stores > configuration but for some reason its not loading on frontend urls , its throwing following error:

Front controller reached 100 router match iterations

Can anyone let me know the solution?


texts: How to print columns which are coming from data dataprovider in listing uiComponent

texts: I want to print the columns on screen which are fetched from dataprovider for my listing uiComponent. So where can i print those columns? Like in which php file. Thanks in advance.


texts: Magento 2 : How to get request and send response in custom REST API?

texts:
I have created a custom API i need to know how can i get request and response using this custom API ?
I use this link to create custom API : http://inchoo.net/magento/api-magento/magento-2-custom-api/


texts:
I am trying to add custom js file using my custom module. But getting below error in console.

Uncaught ReferenceError: Plyr is not defined
DevTools failed to load SourceMap: Could not load content for http://localhost/magento/pub/static/version1592134088/frontend/Magento/luma/en_US/Vendor_Module/js/plyr.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

My code:

app\code\Vendor\Modle\view\frontend\requirejs-config.js

var config = {
    map: {
        '*': {
            plyr: 'Vendor_Module/js/plyr'
        }
    }
};

On phtml file

<script type="text/javascript">
require(['jquery','plyr'],function($){
    const player = new Plyr('#player1', {
        fullscreen:{ enabled: true, fallback: true, iosNative: true },
        controls:['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen', 'download']
    });
});
</script>

Does anyone have any solution?
Thanks in advance.


texts: Get stores id of static block on Magento 1.x

texts:
For programatically create a static block I use a function that behaves like this pieces of code

    $block = Mage::getModel('cms/block');
    $block->setTitle($title);
    $block->setIdentifier($identifier);
    $block->setStores(array($storeId));
    $block->setIsActive($isActive);
    $block->setContent($content);
    $block->save();

But if I want to know the stores of a static block what I want to do.
I try innocently to call getStores on block but this not works

    $blockCollection = Mage::getModel('cms/block')->getCollection();
    foreach($blockCollection as $block) {
        var_dump($block->getIdentifier());
        var_dump($block->getStores());
    }

there is something wrong that I forget ?


texts: How to add Swatches options to Recently viewed UI component

texts:
How to add swatches options for product item to a Recently viewed UI component?

I use the following code to show recently viewed block on the page

<block class="Magento\Catalog\Block\Widget\RecentlyViewed" name="recently_viewed" template="Magento_Catalog::product/widget/viewed/grid.phtml" after="-">
   <arguments>
       <argument name="uiComponent" xsi:type="string">widget_recently_viewed</argument>
       <argument name="page_size" xsi:type="number">4</argument>
       <argument name="show_attributes" xsi:type="string">name,image,price</argument>
       <argument name="show_buttons" xsi:type="string">add_to_cart,add_to_compare,add_to_wishlist</argument>
   </arguments>
</block>


texts:
I am new to magento . I am directly learning Magento 2 .Here I created a Collection class inside Model for a custom module as I got a tutorial on internet.

What is this collection ? How does it work?
Can anyone explain me this in detail.


texts:
I have modified the Abandoned cart grid collection so it can have some additional columns. But the issue is all the records are showing in one page. I tried with setPageSize(). But it didn't work out.
 How can I solve this issue?

Any suggestions will appreciated.

EDIT:
I have overridden the block Mage_Adminhtml_Block_Report_Shopcart_Abandoned_Grid.

protected function _prepareCollection()
    {
$collection = Mage::getResourceModel('reports/quote_collection');

        $filter = $this->getParam($this->getVarNameFilter(), array());
        if ($filter) {
            $filter = base64_decode($filter);
            parse_str(urldecode($filter), $data);
        }

        if (!empty($data)) {
            $collection->prepareForAbandonedReport($this->_storeIds, $data);
        } else {
            $collection->prepareForAbandonedReport($this->_storeIds);
        }

//------------------ my modifications---------------
// This was done to show item names comma separately in the abandoned cart grid as a new column.
foreach($collection as $col)
       {
           $itemcollection = $col->getItemsCollection();
           $products = array();
           foreach ($itemcollection as $item)
           {
               $products[] = $item->getName();
           }
             $productname = implode( " , ", $products);
             $col->setQuoteItemName($productname);
       }
//------------------ my modifications---------------

    $this->setCollection($collection);

        return Mage_Adminhtml_Block_Report_Grid_Shopcart::_prepareCollection();
}

protected function _prepareColumns()
    {
        parent::_prepareColumns();

    $this->addColumnAfter('quote_item_name', array(
            'header'    =>Mage::helper('reports_abandonedcart')->__('Item(s) Name'),
            'index'     =>'quote_item_name',
            'filter_index'=>'table_quote_items.name',
            'sortable'  =>false
        ),'items_qty');

        return Mage_Adminhtml_Block_Report_Grid_Shopcart::_prepareColumns();
}


texts: Magento 2 google recaptcha Console log ERROR grecaptcha.render is not a function

texts:
I have installed Magento officially released Google reCAPTCHA it's working fine, But when I browse directly two customer account creation page https://example.com/customer/account/create/ captcha is not loading for the first time if I refresh it's loading fine.

Console log ERROR:

reCaptcha.js:127 Uncaught TypeError: grecaptcha.render is not a function
    at UiClass.initCaptcha (reCaptcha.js:127)
    at reCaptcha.js:175

/vendor/msp/recaptcha/view/frontend/web/js/reCaptcha.js

Tried below link but no luck

https://stackoverflow.com/a/50224757/8237294


texts:
I have a magento CE 1.6 store, with ~ 22.000 products, and the product save in the admin panel takes about 70 secs.

The product attributes index was set to manual.
Flat tables are enabled.
Zend cache is enabled.
Mysql query cache is enabled, with 128M buffer size.
The log is cleaned from database, and its size is over 1.5 GB
The var/reports folder is empty.
The system.log, and the exception.log is empty.
The product attributes is separeted in some attribute sets.
There is no unused products.
The store is running on a shared server...There are 6 stores, in the system.

Can anybody help to me? I googled so many time, with no results...

Thanks


texts: Product attributes Re-indexing not working in magento 1.9.2.2

texts:
I use magento 1.9.2.2 in that when i try to re-indexing data than "Product attributes" re-indexing not working it's display "There was a problem with re-indexing process" error.
I check solution from http://newsinfo-blog.blogspot.com/2015/11/solve-re-indexing-error-cannot.html and try all steps but not found any solution.
I create new reindex.php file as below

<?php
require_once 'app/Mage.php';
$app = Mage::app('admin');
umask(0);
for ($index = 1; $index load($index);
  $process->reindexAll();
}
?>

I found below error when i run that file on browser.

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]:
Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
(`catalog_product_index_eav`, CONSTRAINT `FK_OMNI_CAT_PRD_IDX_EAV_ENTT_ID_OMNI_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` )'
in /home/public_html/lib/Zend/Db/Statement/Pdo.php:228 Stack trace: #0
/home/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1
/home/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #2
/home/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #3
/home/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) #4
/home/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(' in /home/public_html/lib/Zend/Db/Statement/Pdo.php on line 235


texts: Error while runing static content deploy

texts:
We are in the process of migrating our magento from 2.2.2 CE version to 2.3.6 CE version. After migrating while running content deploy getting below errors:

#0 /var/www/posicweb/posicgit/vendor/magento/framework/App/View/Asset/Publisher.php(74): Magento\Framework\View\Asset\File->getSourceFile()
#1 /var/www/posicweb/posicgit/vendor/magento/framework/App/View/Asset/Publisher.php(62): Magento\Framework\App\View\Asset\Publisher->publishAsset(Object(Magento\Framework\View\Asset\File))
#2 /var/www/posicweb/posicgit/vendor/magento/module-deploy/Service/DeployStaticFile.php(89): Magento\Framework\App\View\Asset\Publisher->publish(Object(Magento\Framework\View\Asset\File))
#3 /var/www/posicweb/posicgit/vendor/magento/module-deploy/Service/DeployPackage.php(189): Magento\Deploy\Service\DeployStaticFile->deployFile('css/images/fanc...', Array)
#4 /var/www/posicweb/posicgit/vendor/magento/module-deploy/Service/DeployPackage.php(133): Magento\Deploy\Service\DeployPackage->processFile(Object(Magento\Deploy\Package\PackageFile), Object(Magento\Deploy\Package\Package))
#5 /var/www/posicweb/posicgit/vendor/magento/module-deploy/Service/DeployPackage.php(102): Magento\Deploy\Service\DeployPackage->deployEmulated(Object(Magento\Deploy\Package\Package), Array, false)
#6 [internal function]: Magento\Deploy\Service\DeployPackage->Magento\Deploy\Service{closure}()
#7 /var/www/posicweb/posicgit/vendor/magento/framework/App/State.php(187): call_user_func_array(Object(Closure), Array)
#8 /var/www/posicweb/posicgit/generated/code/Magento/Framework/App/State/Interceptor.php(89): Magento\Framework\App\State->emulateAreaCode('frontend', Object(Closure), Array)
#9 /var/www/posicweb/posicgit/vendor/magento/module-deploy/Service/DeployPackage.php(103): Magento\Framework\App\State\Interceptor->emulateAreaCode('frontend', Object(Closure))
#10 /var/www/posicweb/posicgit/vendor/magento/module-deploy/Process/Queue.php(358): Magento\Deploy\Service\DeployPackage->deploy(Object(Magento\Deploy\Package\Package), Array)


texts: Where helper aliases of some of core modules defined?

texts:
This confuses me a bit. I wonder why I didn't notice it before. When I look for helper definition of Mage_Sales core module, it surprised me that, I couldn't find helper defintion there. This confuses me a lot. Hence I tried this code

print_r(get_class(Mage::helper('sales')));

and it gave me this result

Mage_Sales_Helper_Data

Then where is the sales alias for Mage_Sales_Helper_Data is defined in magento. In other words, where should I can find this code snippet?

<global>
    <helpers>
         <sales>
             <class>Mage_Sales_Helper</class>
         </sales>
    </helpers>
</global>

I have also checked all xml files that are available for Mage_Sales's etc module. None of them holds helper definition. So how magento assigned sales alias to helper class Mage_Sales_Helper_Data.

Please enlighten me with your valuable thoughts


texts: 100% Discount for matching products with discount code, Max qty 1 per product, Maximum fixed total, with 5 items

texts:
We have a clothing shop and are offering the following discount with a code to select customers only...
1 Free Sweatshirt (any size)
1 Free Polo (any size)
1 Free Fleece (any size)
1 Free Coat (any size)
1 Free PE Polo or Rugbyshirt (any size)
any quantity above 1 will be charged at full price. The issue I have is that if they add a small then a medium in to the cart it see's it as a different product and applies the discount to both instead of one. example below...

This i have got working...
1 Free Sweatshirt Small £10 each
1 Free Polo Small £8 each
1 Free Fleece Small £12 each
1 Free Coat Small £20 each
1 Free Rugbyshirt Small £18 each
Total for cart £68.00
With discount £0.00

This isn't working...
1 Free Sweatshirt Small £10 each
1 Free Polo Small £8 each
1 Free Fleece Small £12 each
1 Free Coat Small £20 each
1 Free Coat Medium £20 each <-Second item should be charged for!!!
1 Free Rugbyshirt Small £18 each
Total for cart £88.00
With discount £20.00 <-should be
With discount £0.00 <-Actually

This is Magento 2.2.2
I have setup an attribute on the products with the following...
Sweatshirt (all sizes) = SS
Polos (all sizes) = PO
Fleeces (all sizes) = FL
Coats (all sizes) = CO
PE Polo & Rugbyshirts (all sizes) = PE
I was hoping to set quantity as 1 in the rule for each attribute ie SS,PO,FL,CO,PE and when it detects a second SS it would charge full price but because the SKU is different it see's this as a different row and reaplies the SS rule and the second one also goes free. Hope this all makes sense.

Current Rule is setup as follows...
If ANY  of these conditions are TRUE :

If ALL  of these conditions are TRUE :
    Discount Helper  contains  SS
    Quantity in cart  is  1

If ALL  of these conditions are TRUE :
    Discount Helper  contains  PO
    Quantity in cart  is  1

If ALL  of these conditions are TRUE :
    Quantity in cart  is  1
    Discount Helper  is one of  CO

If ALL  of these conditions are TRUE :
    Discount Helper  contains  FL
    Quantity in cart  is  1

If ALL  of these conditions are TRUE :
    Discount Helper  contains  PE
    Quantity in cart  is  1

Regards
Alan


texts: Amazon Sales Channel extension for Magento 2.3.3

texts:
Does the Amazon Sales Channel extension version 4.1 work on Magento 2.3.3? It doesn't seem to. I installed the extension per the documenation, added the Production API Key from my Magento Marketplace account to the System and when I go to Marketing -> Channels -> Amazon I get the error Unexpected network error  "please try again later".
Further inspection in the console shows the error: Error: GraphQL error: Internal server error
And when I click on Add Amazon Store it pops a window saying: Connection error Unable to create a new store. Please try again later.
I'm on Magento 2.3.3 with PHP 7.1.33


texts: Adding validation to shipping field on the checkout

texts:
I am editing this file

  RootFolder\vendor\magento\module-checkout\view\frontend\layout\checkout_index_index

To add new validations to the checkout.

For fields like telephone I just need to edit it like this:

<item name="telephone" xsi:type="array">
<item name="config" xsi:type="array">
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">For delivery questions.</item> </item> </item>

<!-- Validation starts -->
<item name="validation" xsi:type="array">
<item name="validate-email" xsi:type="boolean">true</item> </item>
 <!-- Validation ends -->
 </item>

But I can't find where to add a validation to one of the address fields

Does somebody know how to add a validation to one of the address fields?


texts: Adding PHP to a Magento Block or Magento Page

texts:
I am new to Magento and have been reading all of the answers on how to add PHP to a Magento block or page.  Seems that just adding  doesn't work.  I have seen answers like this
{{block type="core/template" name="my_distributors_block" template="page/distributors.phtml"}}

My challenge is trying to determine where to put the phtml file.  I have tried putting it in a php directory off of root directory of the server like:
{{block type="core/template" template="**php/test.phtml**"}}

If I just want to add custom php

What are the exact steps
Is there any documentation that describes what each attribute means, that is what is type, what is name and what is template

Where does phtml files need to reside?  Working with Magento 2


texts: How to display youtube videos in customer reviews

texts:
I want to display youtube videos in customer reviews.

Is there any possible to enable iframe in customer's review block? I want to modify the review module to fix this issue ?


texts: Magento 1.x - plugin Rest API extension?

texts:
I am new in Magento environment and wanted to ask you folks, if you can help me with this problem. I have a client that doesn't allow me to access his magento sourcecode and alter it. The only way for them is to develop by me a plugin/module for Magento, to enable cart and checkout for mobile users as Rest API. I wanted to ask you is this possible and could you please point me out some tutorials for that task?
Thanks in advance!


texts:
How to fix the header in Magneto2. Can any one tell me how it work.
require([ "jquery" ], function($){

$(window).scroll(function () {
    if( $(window).scrollTop() > $('#header').offset().top && !($('#header').hasClass('sticky'))){
    $('#header-2').addClass('sticky');
    } else if ($(window).scrollTop() == 0){
    $('#header').removeClass('sticky');
    }
});
});

and then add some css to this sticky class like this
header.sticky {
background: #fff none repeat scroll 0 0;
border-bottom: 4px solid #325052;
margin: 0 auto;
max-width: 100%;
position: fixed;
top: 0;
width: 100%;
z-index: 99;

}


texts: How tell if root category exists or is defined via database in Magento 2?

texts:
I have access to a database in a dev environment for Magento EE 2.1.7. I'm currently not seeing any categories on the frontend and I get a very strange "too many redirects" error when I attempt to navigate to Catalog > Categories within the admin.

Put simply: I have a suspicion that the client accidentally deleted the root category from the database but I can't view categories with any GUI to determine this. Is there a way to determine if a root category exists or is defined via the database?


texts:
When I run the bin/magento command on my Magento 2.3.4 site, the message logs appear everywhere and it's hard to track my command progress.

Can you please let me know how to get rid of them?


texts: Remove product attributes for a custom product type

texts:
I created a new product type, but doesn't need to have all product attributes - like price, stock, weight, etc. How can i remove the attributes only for one product type?

Here is a solution for Magento 1(no biggie to adjust it to Magento 2) by updating apply_to for the attribute. But that could make a lot of problems later on(for example, if you need to install a third party module which has a new product type and you forgot to add it into apply_to list).

My question: It there other way to remove product attributes for a specific product type?


texts: need to display popup message during merge cart

texts: I have to create a popup message as "Want to merge the cart" while guest user login to the their customer account ,if user respond with yes the cart will be merged otherwise it won't.


texts: Magento 2 : how can i add notice below state/province field in shipping address in checkout page

texts:
how can i add notice or lable in checkout page below the state field just like notice below the email address in blow image,

state input element is created by region_id field in vendor\magento\module-checkout\view\frontend\layout\checkout_index_index.xml

<item name="customEntry" xsi:type="string">shippingAddress.region</item>


texts: How to add footer template in Magento 2?

texts:
How to add footer template only for product view page in Magento 2?

Thanks.


texts: getAssociatedProducts - override function but numeric field ordering alphabetically

texts:
I am extending  Mage_Catalog_Model_Product_Type_Grouped  with a function similar to  getAssociatedProducts()  called

getAssociatedProductsWithSort($product = null,$sortField="name",$direction="ASC")

so to order the simple products under a grouped product.  The difference is this:

<?php
public function getAssociatedProductsWithSort($product = null,$sortField="name",$direction="ASC",$defaultSort="capacity_grams",$defaultDirection="ASC"){

        $associatedProducts = array();

        if (!Mage::app()->getStore()->isAdmin()) {
            $this->setSaleableStatus($product);
        }

        $collection = $this->getAssociatedProductCollection($product)
            ->addAttributeToSelect('*')
            ->addFilterByRequiredOptions()
            //->setPositionOrder()
            ->addStoreFilter($this->getStoreFilter($product))
            ->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product)))
            ->addAttributeToSort($sortField,$direction)
            ->addAttributeToSort($defaultSort,$defaultDirection)
            ;

        foreach ($collection as $item) {
            $associatedProducts[] = $item;
        }

        $this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts);

    return $this->getProduct($product)->getData($this->_keyAssociatedProducts);

} //end-o-func
?>

However, the problem is that the values in my chosen field (Created via the admin) are numbers but the ordering is happening alphabetically:  e.g.

1,10,2,3,4,5,6,7,8,9

Can I force addAttributeToSort() to do it numerically?  I have tinkered with using a CAST in the call but to no avail.  I have also tried doing but this didn't work either.

<?php
    $collection->reset("order")
        ->getSelect()->order(new Zend_Db_Expr("CAST( ".$sortField." AS SIGNED ) ".$direction))
                ;
?>


texts: How to call admin form field renderer in magento 2

texts:
Question is very clear. I want to display custom drop-down options which are collection of other custom module in admin form.

I did something like this after @Sohel Rana suggested This question.

form.xml (From 1st module):

<field name="category">
    <argument name="data" xsi:type="array">
        <!-- Call to collection of 2nd module -->
        <item name="options" xsi:type="object">Namespace\Modulename\Block\Item\ItemList</item>
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">text</item>
            <item name="label" xsi:type="string" translate="true">Category</item>
            <item name="formElement" xsi:type="string">select</item>
            <item name="source" xsi:type="string">mode</item>
            <item name="dataScope" xsi:type="string">category</item>
            <item name="sortOrder" xsi:type="number">30</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

ItemList.php (From 2nd module):

<?php

namespace Namespace\Modulename\Block\Item;

use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Namespace\Modulename\Model\Item;
use Namespace\Modulename\Model\ResourceModel\Item\CollectionFactory as ItemCollectionFactory;
use Namespace\Modulename\Api\Data\ItemInterface;

class ItemList extends Template
{

    protected $itemCollectionFactory;

    public function __construct(
        Context $context,
        ItemCollectionFactory $itemCollectionFactory,
        array $data = []
    ) {
        $this->itemCollectionFactory = $itemCollectionFactory;

        parent::__construct($context, $data);
    }

    public function getAllOptions()
    {
        if (!$this->_options) {
            $this->_options = $this->itemCollectionFactory->create()->load()->toOptionArray();
            array_unshift($this->_options, ['value' => '', 'label' => __('Please select a category.')]);
        }
        return $this->_options;
    }

    public function toOptionArray()
    {
        return $this->_toOptionArray('id', 'title');
    }

}

I am getting following error on form page of first module.

  Warning: array_values() expects parameter 1 to be array, object given
  in
  /var/www/magento-2/vendor/magento/module-ui/Component/Form/Element/AbstractOptionsField.php
  on line 54

  #1 /var/www/magento-2/vendor/magento/module-ui/Component/Form/Element/AbstractOptionsField.php(54):
  array_values(Object(Namespace\Modulename\Block\Item\ItemList))


texts: How to display Attribute Group Name on Product page?

texts:
I want to show the Attribute Group names, not only the attributes in additional tab of product page.
I try this solution but nothing change in product page.
Why it doesn't work? Is it possible this solution have problem?
EDIT:
I try below code but it show all the attributes group name but I want for attributes that they are in one group, show the group name of these attributes once. For example one product just have one attribute and should show one group name but when I use below code it show all group's name that they don't show.
How can I correct this code?
<?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct()
?>
<?php if($_additional = $this->getAdditionalData()): ?>

<?php echo $this->__('Additional Information') ?>

        <col width="25%" />
        <col />

<?php foreach ($_additional as $_data): ?>
    <?php
    $_attribute = $_product->getResource()->getAttribute($_data['code']);
    if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
    <?php
        $attributeGroupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection');
        foreach ($attributeGroupCollection as $attributeGroup) {
            echo "\n\nGroup Name: " . $attributeGroup->getAttributeGroupName();
            $attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection')
            ->setAttributeGroupFilter($attributeGroup->getAttributeGroupId());
        }
    ?>

        <?php echo $this->htmlEscape($this->__($_data['label'])) ?>
        <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>

    <?php } ?>
<?php endforeach; ?>

<?php endif;?>


texts: Magento avoid use custom customer attributes in forms

texts:
I have a custom customer attribute. I have assign it to the forms using used_in_forms.

'used_in_forms' => array('adminhtml_customer','adminhtml_checkout','customer_account_edit', 'customer_account_create', 'checkout_register'),

But now I do not want to use this attribute in forms. How can I remove above setting?


texts:
I have tabs on product page like Details, Reviews etc. so how can I change the label of this default tabs in Magento 2. I use Magento 2.2.

How can I archive this task?


texts: How to specify skin image path in Knockout HTML template?

texts:
I'm trying to add an icon image in the Magento_Paypal/web/template/payment/paypal-express.html template. The icon is located in web/images. I would like to use the equivalent of the following code, which works in email HTML templates, but not this particular template:

<img src="{{view url='images/icon-paypal.png'}}">

Since curly brace variables do not work in this HTML template, how do you reference an image that exists in the theme's web/images directory?


texts: Multi store with different domains, cookie store is causing problem

texts:
Please note that it's not another "how to setup multistore". I've read other questions and it seems that my problem is not described.

Following are not answering my question:

set default page to Particular store view
How to create Multiple Store with different domain in Magento
Multiple Domains, multiple Store View and redirect
How to set up second store in multi-domain configuration?
Optimise URL when changing Store and language switcher to maintain SEO standards

I think this question describes the same issue but the answer is kind of workaround Separate store view which reverts back to the default store view

I want to have different store views with different domains. I've created all store views like below:

START OF STANDARD SETUP, NOTHING FANCY, YOU CAN SKIP READING THIS

base
---- store
-------- polish (default)
-------- german
-------- ...

And I've set web_[un]secure_base_url for each and put them in index.php.

switch ($_SERVER['HTTP_HOST']) {
    case 'polishstore.pl':
        $mageRunCode = 'polish';
        $mageRunType = 'store';
        break;
    case 'germanstore.de':
        $mageRunCode = 'german';
        $mageRunType = 'store';
        break;
    // ...
    default:
        $mageRunCode = 'polish';
        $mageRunType = 'store';
}

Note that I've also set in configuration:

Add Store Code to Urls: No
Auto-redirect to Base URL: No

END OF STANDARD SETUP, NOTHING FANCY

Description of the problem

It works pretty good, but I faced some issues:

When going to http://polishstore.pl/?___store=german it sets cookie store=german and loads german store. From now http://polishstore.pl/ loads incorrectly german store.
When going to http://germanstore.de/?___store=polish it doesn't set cookie store because this store view is default. But it loads polish store. Consecutive visits without ___store loads correctly german store.

// app/code/core/Mage/Core/Model/App.php:562
if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) {
    $this->getCookie()->delete(Mage_Core_Model_Store::COOKIE_NAME);
}

In such situation it is not possible to access polish store anymore, because of cookie. Helps only deleting that cookie or accessing http://polishstore.pl/?___store=polish.

Alternative scenarios that I've tried

Please note that setting Auto-redirect to Base URL to Yes doesn't help, because then it works as described below:

http://polishstore.pl/?___store=german -> http://germanstore.de cookie store=german
http://germanstore.de/?___store=polish -> http://polishstore.pl no cookie -> http://germanstore.de (because of cookie from step 1)

I would like to make it that domain name tells which store view to load, no matter if cookie is set. It may be that the parameter ___store overrides it but it's not required.

Possible soultions

Delete cookie store or don't set it at all. Deleting cookie in index.php is not working correctly, it works on the second pageload.
Ignore ___store parameter. Use only domain names to determine which store to load.

In both situations it is needed to modify Mage_Core_Model_App (copy it to local). Maybe you have better idea. Please comment or post your answer.


texts: Magento EE : optionsPrice.formatPrice is not working correctly

texts:
I am getting issue with magento format price by JS. This is not rounding correctly.

For example: A product has price $69.95 and catalog rule also applied on this. New special price comes after applied price rule is  54.955.

Now when i format this new special price using optionsPrice.formatPrice(54.555). It returns $54.55 instead $54.56.

When I changed the value 54.556 or 54.5555, It is rounding correctly.


texts:
Actually I wanted to know the complete flow of a magento view. Suppose i am viewing the home page, can I ask how the flow of control goes through the PHTML, XML and PHP files , in order to view the home page? Basically wanted to know the flow of control of magento.
  If you  have a doubt in understanding my query , please let me know.

Regards


texts: Configurable Swatches wont change the picture on configurable product

texts:
I have a fresh install of Magento 1.9.1.0

Enabled Cofigurable Swatches:

Created attribute set with color attribute options:

Added configurable product and associated products with this picture set and lables:

So everything is by the book but the images are not switching.

Check it here: http://test.musicshop-no1.hr/index.php/gitare/korg-guitar-tuner.html

What am I doing wrong?


texts: Magneto 2.4.1 Collection: __construct() must implement interface Magento\Framework\DB\Adapter\AdapterInterface

texts:
I have a custom module with a few tables. I have the model, resource model and collection classes in place. If I try to access the contents of the table, I am getting this error
Type Error occurred when creating object: Vendor\ModuleModel\ResourceModel\AddressGroups\Collection\Interceptor, Argument 5 passed to Vendor\Module\Model\ResourceModel\AddressGroups\Collection\Interceptor::__construct() must implement interface Magento\Framework\DB\Adapter\AdapterInterface or be null, string given, called in /home/user/magentoTest/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

I'm getting this error only in production mode. If I switch to developer mode, everything seems to be working fine.
This is my collection.php
<?php
namespace Vendor\Module\Model\ResourceModel\AddressGroups;

class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection{

    public function _construct(){
        $this->_init('Vendor\Module\Model\AddressGroups', 'Vendor\Module\Model\ResourceModel\AddressGroups');
    }
}


texts: Where will i get Magento( 1.9 ) Project base Tutorial for beginner?

texts: I know php. Now i want to learn Magento( 1.9 version) top to bottom. But I did not find any believable source which i can follow and go ahead step by step. I need suggestions. How can i get started with Magento 1.9 ? Where will I find project base tutorial which is for a actual beginner.


texts: Add Minimum Order Total to a shipping method

texts: How to add Minimum Order Total price to a shipping method just like payment methods?


texts:
Does Magento (EE or CE) have a way of partially restricting catalog access for maintenance? For example, having a user who can only manage products that they personally add OR products in particular categories?

I have a situation in mind where a user might be really effective at managing a particular brand or product genre but I wouldn't want to give full access with all the pricing details for 100% of the store.


texts: How To Validate Image Height And Width Magento Admin Form Upload Field

texts:
I want To validate Image Height And Width on Submit in Magento Admin Back-end.
I want to upload & different Sizes Of Images by magento admin...So For That I want to validate image Height and Width In magento admin form upload field...

$fieldset->addField('image_1', 'file', array(
            'label' => Mage::helper('frontlayout')->__('Layout Image'),
            'required' => true,
            'name' => 'image_1',
            'class' => 'required-entry',
        ));


texts: Override template file to theme vendor/amzn/amazon-pay-module/view/frontend/templates/widget/resetpassword.phtml

texts:
I want to override this template file to my theme

  vendor/amzn/amazon-pay-module/view/frontend/templates/widget/resetpassword.phtml

here is my theme path :

  app/design/frontend/Custom/luma_child/

can anyone help here how to override this file.

Thanks in advance.


texts: How to fix the error "Notice: Undefined variable: storeId in /catalog/product/special.phtml"

texts:
My system.log file filled with full of the error "Notice: Undefined variable: storeId  in /catalog/product/special.phtml on line 26"

See the line 26 here:

$_product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($_product->getId());

How can I fix the issue?

Note: the error came up after I installed the following patches: SUPEE-6285-1.9.1v2, SUPEE-6482-1.9.1.1, SUPEE-6788-1.9.1.1, SUPEE-7405-1.9.1.1


texts: How to change widgets from one theme to another theme?

texts:
I am having magento site with more then 80 widgets, now i am looking  to change theme , with new package name and theme(here i have two themes for mobile and desktop). what is the best way to copy widgets to current two themes?

Thanks in advance!!!


texts: Available Inventory not showing with product info

texts:
So I am trying to get the available inventory to show in the product info on the product list. So like it would have the price then Available inventory right below it. I was looking for solutions online but not of them seemed to work (whenever i tried an example it wouldn't show and product or would just show an error message).

I noticed that people were saying if you set 'Display products availability in stock in the frontend' in system->configuration->inventory to YES then it would displays an availability message indicating the product stock status. I have it set to yes, however it does not say if it is ever in stock, only if it is out of stock.

People were also saying that this was all programmed in /app/design/frontend/XXX/YYY/template/catalog/product/list.html. I looked in there and none of the code looks like it would do this. So if anyone has a way to display the Available Inventory it would be much appreciated.

Update:
I found a code that used getQty() but it did not work (it printed 0 for every product).

Update: The answer below works but has decimal places. To remove those decimals I used round(). So the final code I used was:

$num= Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
$num = round($num);
echo "Remaining products: ".$num;


texts: Reload "Custom Option" to original Price

texts:
For custom option - text field, a "if" is used so that price update only when more than 9 characters is input.

 <input type="text" onchange="if(this.value.length>9) opConfig.reloadPrice()" id="options....>

It is working fine, but, when i reduce the characters to less than 10, it won't change back to original price.
Is there another "reloadPrice" function so to get back the original price; or other ways to clear the price update when characters is reduced.

Any help is appreciated! thanks!


texts: Two instances on one server, can't log into admin on both at the same time?

texts:
I have one web server where we have a staging instance and a live instance running at the same time.  Up until recently, we have been able to stay logged into both at the same time.  We have only made a few minor changes recently:

We changed the maximum cookie lifetime from one hour to one day - I undid this and the problem still exists.

We changed the php memory limit to import some products as the import would fail due to out of memory error, but that was changed back after the import was done.

we added a third instance for development, but I don't see how that could be causing problems (could it?)

The problem is, now, when logged into the admin panel in live or staging or dev, logging into the admin on one of the other instances causes us to have to re-login to the one we were previously logged into.  What would cause this behavior to suddenly happen after we had no problems for years?


texts: Magento undefined variable this in custom block template

texts:
I have created a custom block and when I try to access a method from my block I get:

  exception 'Exception' with message 'Notice: Undefined variable: this  in /Applications/XAMPP/xamppfiles/htdocs/mag19/app/design/frontend/vish/default/template/Vish/sizecheck/sizecheck.phtml on line 2' in /Applications/XAMPP/xamppfiles/htdocs/mag19/app/code/core/Mage/Core/functions.php:232

My sizecheck.phtml:

    <?php
$products = $this->igetText();
?>

<div id="product_list">
  <?php echo($products);?>
</div>

The block:

    <?php
class Vish_SizeCheck_Block_Size extends Mage_Core_Block_Template {
      public function igetText()
    {
        return "I am inside `" . get_class(). "` block and it is my first custom block ever !";
    }
}

config.xml:

    <?xml version="1.0"?>
<config>
  <modules>
    <Vish_SizeCheck>
      <version>0.0.1</version>
    </Vish_SizeCheck>
  </modules>
  <frontend>
       <routers>
          <sizecheck>
              <use>standard</use>
              <args>
                 <module>Vish_SizeCheck</module>
                 <frontName>sizechecker</frontName>
              </args>
           </sizecheck>
       </routers>
       <layout>
            <updates>
                <vish_sizecheck>
                    <file>sizecheck.xml</file>
                </vish_sizecheck>
            </updates>
        </layout>
    </frontend>
  <global>
          <blocks>
      <vish_sizecheck>
        <class>Vish_SizeCheck_Block</class>
      </vish_sizecheck>
    </blocks>
    <models>
       <vish_sizecheck>
            <class>Vish_SizeCheck_Model</class>
        </vish_sizecheck>
    </models>
    <helpers>
      <sizecheck>
        <class>Vish_SizeCheck_Helper</class>
      </sizecheck>
    </helpers>
  </global>
</config>

my sizecheck.xml:

    <?xml version="1.0"?>
<layout version="0.1.0">
    <sizecheck_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="core/template" name="sizecheck.form" as="sizecheck_form" template="Vish/sizecheck/form.phtml"/>
        </reference>
    </sizecheck_index_index>
</layout>

My block declaration in CMS Page:

{{block type="vish_sizecheck/size" name="sizecheck" template="Librex/sizecheck/sizecheck.phtml"}}

I can see the class is correctly inherited by:

echo get_class($this);


texts: Magento - Add 'Customer Account Navigation' to custom module page

texts:
I have a custom module in my magento store. It is currently using the default 2 column layout with magento's left nav as the lefthand sidebar.

How can i go about having the customer account navigation in my left sidebar instead? My current xml file for my module is:

earnings.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <earnings_index_index>
        <reference name="content">
            <block type="earnings/earnings" name="earnings" />
        </reference>
    </earnings_index_index>
</layout>


texts: Add product and/or coupon to cart via link (query string) is not working

texts:
As described on Magento's website: http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/adding_a_product_to_the_cart_via_querystring

Background: Performed an upgrade from CE 1.7 to 1.9.0.1. Everything else seems to be working fine after following standard procedures (http://www.magentocommerce.com/knowledge-base/entry/ce18-and-ee113-upgrading).

Tried to setup a few links that takes the user to the shopping cart and automatically adds the product to cart. Nothing outside of that; our old methods (e.g. www.website.com/checkout/cart/add?product=8&qty=1&coupon=save25) have stopped working and the user is redirected to an empty cart. I'm not even sure how to troubleshoot this problem. Any advice?


texts: Failed to Open Stream Error with OAuth token exchange example

texts:
I am following the OAuth token exchange example here running on Magento 2.4.1 on MAMP
I created an integration and copied the 4 PHP files at the root of the server. I create an integration and set it with:
Callback URL : http://magento2:8888/endpoint.php
Identity link URL : http://magento2:8888/login.php
Then upon activation it opens a pop up and I click login then immediately see this error:

Fatal error: Uncaught
OAuth\Common\Http\Exception\TokenResponseException:
file_get_contents(http://magento2:8888/oauth/token/request): failed to
open stream: HTTP request failed! HTTP/1.1 400 Bad Request in
/code/MAMP/magento2/vendor/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php:73
Stack trace: #0
/code/MAMP/magento2/vendor/lusitanian/oauth/src/OAuth/OAuth1/Service/AbstractService.php(52):
OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri),
'', Array) #1 /code/MAMP/magento2/checklogin.php(26):
OAuth\OAuth1\Service\AbstractService->requestRequestToken() #2 {main}
thrown in
/code/MAMP/magento2/vendor/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php
on line 73

What am I missing??