texts: Configurable "simple product" having visibility to "not visible individually” be visible once a filter is set

texts:
I edited my question with the almost solution, but I need a bit of help to finish it off.
Hope someone can help.

--

I only want the “Configurable Products” to appear in the grid and list view. This is really easy by setting the Associated Products to “Not Visible Individually”.

What I actually would like to do is that as soon as the customer starts to “filter” on "Size or Colour" attributes the Associated Products DO show up at that point.

Is this at any way possible?

For instance:
T-shirt is main configurable product

Large in Yellow is a simple Associated Product
XLarge in Yellow is a simple Associated Product
XXLarge in Yellow is a simple Associated Product
Large in Green is a simple Associated Product
XLarge in Green is a simple Associated Product
XXLarge in Green is a simple Associated Product

As soon as you view the category you just see:

“T-shirt” product.

When someone clicks a on the “Green” filter, the category show:

T-shirt main product
Large in Green is a simple Associated Product
XLarge in Green is a simple Associated Product
XXLarge in Green is a simple Associated Product

OR if someone clicks the XLarge filter, the category show:

T-shirt main product
XLarge in Yellow is a simple Associated Product
XLarge in Green is a simple Associated Product

Anyone who can help?

EDIT!!!

I just got an Idea! Maybe someone can fill me in on this?

Maybe I should just add ALL the child (simple) products also to category.

I can check if a filter is set using:

$this->getRequest()->getParam('colours')

If the filter is set I can us the standard code:

$_productCollection=$this->getLoadedProductCollection();

If the filter is NOT set I only want to get the configurables

$_productCollection=$this->getLoadedProductCollection()->addAttributeToFilter('type_id', 'configurable');

Can anybody maybe fill me in on that last issue, how to ONLY get the configurable products? It seems that it this one doesn't work properly.


texts:
in my database I saw tables which start on m2_cl.
I deleted them, but my project stopped working, so I brought them back to life.

if i delete table m2_cl_log_visitor i have this error

Base table or view not found: 1146 Table 'dd.m2_cl_log_visitor' doesn't exist, query was: INSERT INTO `log_visitor` (`session_id`, `first_visit_at`, `last_visit_at`, `last_url_id`, `store_id`) VALUES (?, ?, ?, ?, ?)

How do I delete these tables correctly? They are not needed, but take up a lot of space

and why, after removing them, the site does not work?


texts:
I get the following error when running the indexer:reindex command for Magento 2.2.6

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'DB.catalog_category_product_index_store1_replica' doesn't exist,

query was: CREATE TABLE IF NOT EXISTS `catalog_category_product_index_store1_replica`

Any suggestion how to fix this?


texts: Why magento 2 Setup/Uninstall Script ONLY deletes modules installed through Composer?

texts: Why Magento 2 Setup/Uninstall Script ONLY deletes modules  installed through Composer? I am not able to understand the reason behind this!


texts: How to use getGroupChildNames() in custom module Magento 2

texts:
I am trying to get the all tab names and respective contents which are uses in product detail page.

Please explain how this code line works and how to use it our custom module to get the all child html of a particular node name?

<?php $detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml'):?>

  Location:
  vendor/magento/module-catalog/view/frontend/templates/product/view/details.phtml


texts: Can we backport Magento 2.3.x code to Magento 2.2.x and 2.1.x

texts:
I have an extension that works on 2.2.x and 2.1.x and 2.3.x.
Magento recently has added MSI support in 2.3.x. I wanted to support this new feature in the extension. But some 2.3.x relate classes are not present "Source" related classes.
Is there a way I can still use the extension with MSI related changes in magento <2.3.x.
e.g. this class

Class Magento\\InventoryApi\\Api\\Data\\SourceItemInterface

Currently we may have to release two extension for different magento versions which is not ideal.


texts: Magento 2 “Recoverable Error: Argument 2 passed” when trying to define model in constructor

texts:
Hi I have problem in Define model constructor,
This is my code:

<?php
namespace Retailers\Company\Model\Category;
use \Magento\Framework\Option\ArrayInterface;
class CategoryList implements ArrayInterface
{
protected $_categoryCollectionFactory;

public function __construct(
    \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $collectionFactory,
    array $data = []
) {
    $this->_categoryCollectionFactory = $collectionFactory;
}
public function toOptionArray($addEmpty = true)
{

    /** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
    $collection = $this->_categoryCollectionFactory->create();
    $collection->addAttributeToSelect('name');//->addRootLevelFilter()->load();
    $options = [];
    if ($addEmpty) {
        $options[] = ['label' => __('-- Please Select a Category --'), 'value' => ''];
    }
    foreach ($collection as $category) {
        $options[] = ['label' => $category->getName(), 'value' => $category->getId()];
    }
    return $options;
}
}


texts: How to add cart as a step in checkout in Magento 2?

texts: Could you please help me add cart page as step 1 in checkout page in magento 2.


texts: Trouble Shooting : Warning: Invalid argument supplied for foreach()

texts:
We are having a log build up of errors starting with the title error:

2017-07-12T16:32:09+00:00 ERR (3): Warning: Invalid argument supplied for foreach()  in /chroot/home/apollode/apollooutlet.com/html/app/code/local/Mage/Core/Model/Config.php on line 870
2017-07-12T16:32:10+00:00 ERR (3): Notice: Undefined index: Enterprise_Search  in /chroot/home/apollode/apollooutlet.com/html/app/code/local/Mage/Core/Model/Config.php on line 851
2017-07-12T16:32:10+00:00 ERR (3): Warning: array_merge(): Argument #2 is not an array  in /chroot/home/apollode/apollooutlet.com/html/app/code/local/Mage/Core/Model/Config.php on line 851
2017-07-12T16:32:10+00:00 ERR (3): Warning: array_merge(): Argument #1 is not an array  in /chroot/home/apollode/apollooutlet.com/html/app/code/local/Mage/Core/Model/Config.php on line 851

Looking in the Config.php file at 870 returns this code
protected function _sortModuleDepends($modules)
{
    foreach ($modules as $moduleName => $moduleProps) {
        $depends = $moduleProps['depends'];
        foreach ($moduleProps['depends'] as $depend => $true) {
            if ($moduleProps['active'] && ((!isset($modules[$depend])) || empty($modules[$depend]['active']))) {
                Mage::throwException(
                    Mage::helper('core')->__('Module "%1$s" requires module "%2$s".', $moduleName, $depend)
                );
            }
            $depends = array_merge($depends, $modules[$depend]['depends']);
        }
        $modules[$moduleName]['depends'] = $depends;
    }
    $modules = array_values($modules);

    $size = count($modules) - 1;
    for ($i = $size; $i >= 0; $i--) {
        for ($j = $size; $i < $j; $j--) {
            if (isset($modules[$i]['depends'][$modules[$j]['module']])) {
                $value       = $modules[$i];
                $modules[$i] = $modules[$j];
                $modules[$j] = $value;
            }
        }
    }

    $definedModules = array();
    foreach ($modules as $moduleProp) {
        foreach ($moduleProp['depends'] as $dependModule => $true) {
            if (!isset($definedModules[$dependModule])) {
                Mage::throwException(
                    Mage::helper('core')->__('Module "%1$s" cannot depend on "%2$s".', $moduleProp['module'], $dependModule)
                );
            }
        }
        $definedModules[$moduleProp['module']] = true;
    }

What could be causing this issue? Is this a known issue with Magento? Please help.


texts: Add Customer Note (comments) on billing Address and Save it

texts:
I have installed Magebase Extension for add order comment.

It is working fine, But the comment is showing on Shipping method section.

I have successfully added the comment on billing address by:

  magentoRoot}/app/design/frontend/rwd/default/layout/magebase/checkoutcomment.xml

<reference name="checkout.onepage.billing">
    <block type="checkout/onepage_shipping" name="mbcomments.billing" template="magebase/checkoutcomment/shipping_comment.phtml" />
</reference>

By calling below code at:

  {magentoRoot}/app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml

<?php echo $this->getChildHtml('mbcomments.billing') ?>

Problem: How to Save this field in Customer_note as it is currently doing for Shipping method.

Please suggest any observer which can save above value.

Thanks in Advance!


texts:
When logging into Magento 2 for the first time following install, I am getting this error:

Exception #0 (SodiumException): This is not implemented, as it is not possible to implement Argon2i with acceptable performance in pure-PHP.

Can anyone help with this?


texts:
I am trying to change the image on hover for product in listing page for one of our Magento Eshop. I can change the image on hover. What i did was i used small and thumbnail image for it and changed it using mouseenter and mouseleave event.

But now i want to change it based on sort order. Say the image with Sort Order 2 should be visible on hover.

I am not sure how to do it ? Could anyone please guide me on this. From where shall i start ?

Thanks


texts: How to add custom template in Admin Order

texts:
I am currently creating a button for a single order in Magento(next to invoice, ship, reorder etc.). I would like the button to be inside a template to allow for php variables from that order and external js files to be added.

I am currently trying to override the sales order view page and add code from their, this seems to be the best/simplest way. It's reading the new template, but everything else is getting messed up. How do i fix this?

app\code\local\MyApp\OrderButton\etc\config.xml

<config>
<modules>
    <MyApp_OrderButton>
        <version>0.0.1</version>
    </MyApp_OrderButton>
</modules>
<global>
    <models>
        <myapp_orderbutton>
            <class>MyApp_OrderButton_Model</class>
        </myapp_orderbutton>
    </models>
    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_view_info>ShipRush_OrderButton_Block_Sales_Order_View_Info</sales_order_view_info>
            </rewrite>
        </adminhtml>
    </blocks>
</global>
</config>

app\code\local\MyApp\OrderButton\Block\Sales\Order\View\info.php:

class MyApp_OrderButton_Block_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
{
    protected function _construct()
    {
       $this->setTemplate('myapp/sales/order/view/myinfo.phtml');
    }
}

Potential template, php, and js:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
function connect() {
    var allsongs = '<?php echo $x ?>';
    lib = {
        songs: allsongs,
        albums: 20
    };
    alert(lib);
}
</script>

This is read by magento, but it messes up the whole page:


texts: Shipping Region ID is missing in checkout after upgrading from Magento 2.3.4 to Magento 2.4.1

texts:
After i upgrade from Magento 2.3.4 to Magento 2.4.1 after choosing the shipping address in the checkout page, i got this error:

Please specify regionId in shipping address

then i see the region is missing from the address in checkout page:

after i add new address, the region was not there either

before in Magento 2.3.4 it's showing fine like this:


texts:
I have a problem adding a custom option to product. When I click on the "Add New Option" button nothing happens? And I have no clue why its happening. Any help would be highly appreciated.

The bug exists on all products, magento 1.9


texts:
I want an accordian in the leftside layered navigation filter. I tried this but it's not working:

<?php if($this->canShowBlock()): ?>

        <?php echo $this->__('Shop By') ?>

        <?php if($this->canShowOptions()): ?>

<?php echo $this->__('Shopping Options') ?>

                <?php $_filters = $this->getFilters() ?>
                <?php foreach ($_filters as $_filter): ?>
                <?php if($_filter->getItemsCount()): ?>

                        <?php echo $this->__($_filter->getName()) ?>
                        <?php if ($removeUrl = Mage::helper('layerednavigation')->getRemoveUrl($_filter)): ?>
                            <a class="btn-remove" href="<?php echo $removeUrl ?>" title="<?php echo $this->__('Clear All') ?>"><?php echo $this->__('Clear All') ?>
                        <?php endif ?>

<?php echo $_filter->getHtml() ?>

                <?php endif; ?>
                <?php endforeach; ?>

        <?php endif; ?>

<?php endif; ?>


texts:
I am need of making a change to the Magento function _checkBaseUrl found within:

app/code/core/Mage/Core/Controller/Varien/Front.php

As best practice I am trying to extend it with my own module so I am not editing the core code and files but it is not working. If I make the change in the core file i get the desired response but when using this it doesn't work. My module is showing up as Enabled in Configuration > Advanced > Advanced

Files are as below:

etc/modules/Me_Coreextend.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Me_Coreextend>
            <active>true</active>
            <codePool>local</codePool>
        </Me_Coreextend>
    </modules>
</config>

app/code/local/Me/Coreextend/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Me_Coreextend>
            <version>1.0</version>
        </Me_Coreextend>
  </modules>
    <frontend>
        <routers>
            <core>
                <args>
                    <modules>
                         <Me_Coreextend before="Mage_Core">Me_Coreextend</Me_Coreextend>
                    </modules>
                </args>
            </core>
        </routers>
    </frontend>
</config>

app/code/local/Me/Coreextend/Controller/Varien/Front.php

I am including only the _checkBaseUrl function in this file not the whole contents of app/code/core/Mage/Core/Controller/Varien/Front.php - is this correct? (I have tried to include it all as well but that still doesn't work either)

include_once('Mage/Core/Controller/Varien/Front.php');
class Me_Coreextend_Controller_Varien_Front extends Mage_Core_Controller_Varien_Front
{
    protected function _checkBaseUrl($request)
    {
        // custom changes...
    }
}

Is there anything I am doing wrong?


texts: Magento 2 widget doesn't show - how to debug?

texts:
I have a module that is installed in other sites. In one site it doesn't show up when inserted into CMS Pages.

{{widget type="Company\Modulename\Block\Widget\Test" template="widget/newsletter/test.phtml"}}

app/code/Company/Modulename/Block/Widget/Test.php:

namespace Company\Modulename\Block\Widget;
class Test extends \Magento\Framework\View\Element\Template implements \Magento\Widget\Block\BlockInterface
{
    protected function _construct()
    {
        parent::_construct();
    }
}

app/code/Company/Modulename/view/frontend/templates/widget/newsletter/test.phtml:

<?php
echo 1;

app/code/Company/Modulename/etc/widget.xml:

<?xml version="1.0" encoding="UTF-8"?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget id="test" class="Company\Modulename\Block\Widget\Buttons">
        <label translate="true">some text</label>
        <description>some text</description>
        <parameters>
    ...

It will show just empty string, no matter what I try. I enabled developer mode but no info about that is inside system.log. Any idea what could be wrong or at least how I can debug this problem?


texts: Magento 2 use of frontend_input_renderer for product custom attribute

texts:
I have created one attribute (CategoryPath) at product level using installer script, which holds the value of category full path of the product. This will update through the observer when we do some changes in category assignment on product page and save the product. It's working fine.

Now if I change the category hierarchy in admin from category screen and check the same product then that attribute won't display the updated category path fetching from DB, so I come to know that we could use "frontend_input_renderer" attribute property to display the value dynamically instead of saving into DB, but I could not able to find out how to use use it for the custom product attribute.

Can anybody help me on it.


texts: Where did i paste php code of rest Api in magento

texts:
I have not idea where did i paste the php code of rest API in Magento folder or in which folder and how to execute that file in local server because i have installed magento in local server like xampp.please kindly help me.
Code is given below

    public function indexAction() {

        //Basic parameters that need to be provided for oAuth authentication
        //on Magento
        $params = array(
            'siteUrl' => 'http://magento.loc/oauth',
            'requestTokenUrl' => 'http://magento.loc/oauth/initiate',
            'accessTokenUrl' => 'http://magento.loc/oauth/token',
            'authorizeUrl' => 'http://magento.loc/admin/oAuth_authorize',//This URL is used only if we authenticate as Admin user type
            'consumerKey' => '13f79c195f2a0679f4a376addcf098b8',//Consumer key registered in server administration
            'consumerSecret' => '89af03a4f3d1de93c9d9a84ababadc14',//Consumer secret registered in server administration
            'callbackUrl' => 'http://magento.loc/restconnect/test/callback',//Url of callback action below
        );

        // Initiate oAuth consumer with above parameters
        $consumer = new Zend_Oauth_Consumer($params);
        // Get request token
        $requestToken = $consumer->getRequestToken();
        // Get session
        $session = Mage::getSingleton('core/session');
        // Save serialized request token object in session for later use
        $session->setRequestToken(serialize($requestToken));
        // Redirect to authorize URL
        $consumer->redirect();

        return;
    }

    public function callbackAction() {

        //oAuth parameters
        $params = array(
            'siteUrl' => 'http://magento.loc/oauth',
            'requestTokenUrl' => 'http://magento.loc/oauth/initiate',
            'accessTokenUrl' => 'http://magento.loc/oauth/token',
            'consumerKey' => 'h7n8qjybu78cc3n8cdd5dr7ujtl33uqh',
            'consumerSecret' => '2smfjx37a6e4w23jlcrya6iyv5v32fxr'
        );

        // Get session
        $session = Mage::getSingleton('core/session');
        // Read and unserialize request token from session
        $requestToken = unserialize($session->getRequestToken());
        // Initiate oAuth consumer
        $consumer = new Zend_Oauth_Consumer($params);
        // Using oAuth parameters and request Token we got, get access token
        $acessToken = $consumer->getAccessToken($_GET, $requestToken);
        // Get HTTP client from access token object
        $restClient = $acessToken->getHttpClient($params);
        // Set REST resource URL
        $restClient->setUri('http://magento.loc/api/rest/products');
        // In Magento it is neccesary to set json or xml headers in order to work
        $restClient->setHeaders('Accept', 'application/json');
        // Get method
        $restClient->setMethod(Zend_Http_Client::GET);
        //Make REST request
        $response = $restClient->request();
        // Here we can see that response body contains json list of products
        Zend_Debug::dump($response);

        return;
    }

}


texts: Salable quantity of 0 but still showing in stock?

texts:
I have a big issue with Magento 2.3.2. When products reach a salable quantity of 0 they still appear in stock. These products still have a physical quantity of more than zero as they haven't shipped yet, but they can still be selected on the frontend, although they won't add to basket, leading customers to think that the website is not functioning correctly. (Which I suppose it isn't). Why would my products still be selectable on the frontend even though salable stock is zero? Can anyone please shed some light?

I do have the 'inventory_stock_1' database view, but products with zero salable quantity are still listed as 'is_salable=1' in this view.

Product doesn't actually go 'Out of Stock' until 'Quantity' reaches zero (all are shipped). Something is not right.

Thank you.


texts:
I have this store running on Apache, Magento 1.7.0.2

Then I decided to clone the application on a test server, running Nginx.

I first tried mine, naive rewrite:

rewrite ^(.*index\.php)\/(.*) $1?$2 last;

This worked, although not in the entire store. Recent viewed product pages didn't. They resulted in 404 by nginx.

Then I followed the steps outlined in: http://www.howtoforge.com/running-magento-1.6.0.0-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04

My server configuration was updated. Then, nothing worked, and the 404 error was from Magento in every link (instead of nginx 404).

Can you please confirm that the above link configuration is good ? Notice that I just cloned the files from production server to the test server (didn't install Magento). It will be really nice if re-install isn't necessary.

I already updated web/unsecure/base_url and web/secure/base_url on the database.


texts: Magento 2 : User Role and Permission Issue (ACL Issue)

texts:
In my magento2, I have created one user role with custom permission in which I give permission only for "Shipping Methods" to user.

When I login with this user, it also show me other custom extension configuration section as well.

Check screen-sort.

This is acl code of that custom extensions :

app->code->Company->Customext->etc->acl.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Magento_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Company_Customext::config_customext" title="Custom 1" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

This is acl code of that another custom extensions :

app->code->Company->Customextnew->etc->acl.xml

    <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
  <acl>
    <resources>
      <resource id="Magento_Backend::admin">
        <resource id="Magento_Backend::stores">
          <resource id="Magento_Backend::stores_settings">
            <resource id="Magento_Config::config">
              <resource id="Company_Customextnew::config_customextnew" title="Custom 2" />
            </resource>
          </resource>
        </resource>
      </resource>
    </resources>
  </acl>
</config>

Can any one have idea about this?

Thanks in advance.


texts:
I need to set a value to the cookie in a phtml file and I need to get it's value in another phtml file.

Is it possible to set and get the values using jQuery?


texts: Magento 2 - add simple product programstically to specific web site

texts:
My Store has 3 web sites: UK (default), USA, GER.
In my module, I'm adding product programatically to specific web site
Apart from the specified country, the Product is also always added to default web site.

EXAMPLE:

When I add product to USA, it is automatically being added to UK too.

How do I prevent it?


texts:
I need to get data from core_config_data table in xml nodes,
For example I have a value * /5 * * *. I want get this value in xml like following,

    <crontab>
            <jobs>
            <stock_setcron>
                    <schedule>
                    <cron_expr>*/5 * * * *</cron_expr>
                    </schedule>
                    <run><model>stock/cron::setcron</model></run>
                </stock_setcron>
            </jobs>
     </crontab>

How to do that..Please help me guys ..


texts:
I wrote code like this...

<?php
class SmashingMagazine_LogProductUpdate_Model_Observer
{
    public function logUpdate(varien_Event_Observer $observer)
    {
        $product=$observer->getEvent()->getProduct();
        $name=$product->getName();
        $sku=$product->getSku();
        magic_quotes_runtime()->log ("{$name} ({$sku}) updated", null, 'product-updates.log');
    }
}

And this is the error which I got.
Fatal error: Call to a member function log() on a non-object in C:\wamp\www\magento\app\code\local\SmashingMagazine\LogProductUpdate\Model\Observer.php on line 9.
Help me.


texts: Simple custom attribute or textfield for categories

texts: I would like to add a textfield or an attribute for my categories in Manage Categories. What is the best & simplest way to achieve this? I am open to the idea of adding a custom module to achieve this however, am not sure if this is actually possible without making a setup script and/or by doing changes to the database.


texts: How can I edit the attributes of a product in the cart?

texts:
I defined a couple of attributes for a product.
e.g. Project
Before Checkout I want the user to let change the Projectname
and store it in the database (quote_item),
which will be done by an observer-routine.

Or is there another method to add additional information to the cart line?

Thank you


texts: coupon code applying only one one product instead of whole cart

texts:
we created shopping cart price rule to give 50 % discount for all cart subtotal.

but coupon code is applying only for one product.

in cart 2 items,

Product 1 [ price - 100] ,
Product 2 [ price - 400] ,
total price = 500

when we applied coupon code, it should give 50 % discount and display as "250" , but now its displaying as "50" as discount is applying only for one product.

same coupon code working fine in another site [1.9.2.0], i am 100 % sure both have same configuration.


texts: Magento customers shopping cart contents being seen by other customers

texts:
I sometimes see shopping carts of others whilst navigating my site.

Some say that there is a bug that if one is logged in via admin you can see customer shopping carts if you then nivigate on the frontend.

Today one of my customers reported that when trying to checkout he saw some random product of high value (£250) appear in his cart after refreshing his browser.

I am running varnish cache. Persistent shopping cart is off.

Here are my varnish cache settings.


texts:
I wanted to redirect user to "Home" page instead of "My Account" page after login, and i was successful to achieve this making use of

  <customer_login>

event.

But I was also redirected to home page while i login from onepage checkout which i don't want.

Below is my observer function

public function setRedirectOnLogin(){
    $session = Mage::getSingleton('customer/session');
    if (strpos($session->getBeforeAuthUrl(), 'checkout') === false)
        $session->setAfterAuthUrl(Mage::getBaseUrl());
    $session->setBeforeAuthUrl('');

}

Can any one please guide how can i stop user from redirecting it to homepage after login from onepage checkout?

Thank You.


texts:
How can I change title of Homepage?

I have crated one cms page and set it as homepage. Now I need to change default title of magento for only my homepage.

All other pages will have default title but I need something different title for homepage only.

I added title in cms page but it didn't work.

I tried in config -> Design  settings. But it work for all pages. I need to modify title only for homepage specifically.
Let me know if any other solution is suggested.


texts: Override cart controller twice or only override /checkout/cart/delete

texts:
In a shop using Idev_OneStepCheckout I need to override the deleteAction. OSC doesn't do this, but it does override Mage_Checkout_CartController, only for the _goBack() method. The shop also has a storeview that uses the standard OnePage checkout from Magento.

So, unfortunately, I can't do:

<frontend>
  <routers>
     <checkout>
       <args>
         <modules>
           <MyNameSpace_MyModule before="Idev_OneStepCheckout">MyNameSpace_MyModule_OneStepCheckout</MyNameSpace_MyModule>
           <MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule</MyNameSpace_MyModule>
         </modules>
       </args>
     </checkout>
   </routers>
 </frontend>

Well, I can, but my module isn't called in the OSC case. Disabling either makes it work for the checkout in question, so I know my code is correct.
Do I have to resort to a rewrite of /checkout/cart/delete for the onepage case or is there a more elegant solution?


texts: Magento2 - How to get Product Id in FinalPriceBox Plugin

texts:
How to get Product Id in FinalPriceBox Plugin in magento 2

Using FinalPriceBox Plugin to hide price in all page how to get a product id within this plugin.

  /app/code/Vendor/Module/etc/di.xml

<type name="Magento\Catalog\Pricing\Render\FinalPriceBox">
     <plugin name="vendor_module_finalpricebox" type="Vendor\Module\Plugin\FinalPriceBox"/>
</type>

  /app/code/Vendor/Module/Plugin/FinalPriceBox.php

<?php
namespace Vendor\Module\Plugin;

use Vendor\Module\Block\Button;
use Vendor\Module\Helper\HidePrice;
use Magento\Catalog\Pricing\Render\FinalPriceBox as FinalPriceBoxRenderer;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

use function strstr;

/**
 * Class FinalPriceBox
 */
class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
{
    /** @var ScopeConfigInterface */
    private $config;
    private $buttonBlock;
    private $hidePriceHelper;
     protected $productRepository;
    /**
     * FinalPriceBox constructor.
     * @param ScopeConfigInterface $config
     * @param Button $buttonBlock
     * @param Data $hidePriceHelper
     */
    public function __construct(
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
        ScopeConfigInterface $config,
        HidePrice $hidePriceHelper,
        Button $buttonBlock
    )
    {
        $this->config          = $config;
        $this->buttonBlock     = $buttonBlock;
        $this->hidePriceHelper = $hidePriceHelper;
        $this->productRepository = $productRepository;

    }

    /**
     * @param FinalPriceBoxRenderer $finalPriceBox
     * @param $result
     * @return string
     */
    public function aroundToHtml(FinalPriceBoxRenderer $finalPriceBox, $result)
    {

        //How to get Product id in this plugin
        $template = 'button.phtml';
        return $this->buttonBlock
                    ->setTemplate('Vendor_Module::' . $template)
                    ->toHtml();
    }
}


texts: Why is my module not working? Trying to modify the $block element on success page

texts:
I have written a module that should extend the \Magento\Checkout\Block\Success-Block. My modules structure is the following:

Vendor
- Namepsace
- - Block
- - - Checkout
- - - - Success.php
- - etc
- - - frontend
- - - - di.xml
- - - module.xml
- - registration.php
- - composer.json

Success.php:

<?php

namespace Vendor\Namespace\Block\Checkout;

class Success extends \Magento\Checkout\Block\Success
{
    /**
     * @return string
     */
    public function getSuccessTrackingCode()
    {
        /** @var \Magento\Sales\Model\Order $order */
        $order = $this->_orderFactory->create('Magento\Sales\Model\Order')->load($this->getLastOrderId());
        $orderID = $order->getOrderID();
        $total = $order->getGrandTotal();
        $shipping = $order->getShippingAmount();
        $tax = $order->getTaxAmount();
        //$store = Mage::app()->getStore();
        $storeName = "Shopname";

        $items = $order->getAllItems();
        $item_details = array() ;

        foreach($items as $item):
            $det = array() ;
            $det['sku'] = $item->getSku();
            $det['name'] = $item->getName();
            $det['price'] =  number_format($_product->getPrice(), 2, ',', '.') . "€";
            $det['quantity'] = number_format($item->getQtyOrdered(), 0);
            $det['id'] = $item->getID();
            array_push($item_details, $det);
        endforeach;

        $html = "<script type='text/javascript'>";
        $html .= "ga('require', 'ecommerce', 'ecommerce.js');"
        $html .= "ga('ecommerce:addTransaction', {";
        $html .= "'id': '" . $orderID . "',";
        $html .= "'affiliation': '" . $storeName . "',"
        $html .= "'revenue': '" . $order->getGrandTotal . "',";
        $html .= "'shipping': '" . $shipping . "',"
        $html .= "'tax': '" . $tax . "'";
        $html .= "});";

        // ITEMS

        foreach($item_details as $item):

            $product = $this->_productFactory->create()->load($item['id']);
            $cats = $product->getCategoryIds();
            if(count($cats) ){
               $firstCategoryId = $cats[0];
               $_category = $this->_categoryFactory->create()->load($firstCategoryId);
                  $catName = $_category->getName();
            }

            $html .= "ga('ecommerce:addItem', {";
            $html .= "'id': '" . $orderID . "',";
            $html .= "'name': '" . $item['name']. "',";
            $html .= "'sku': '" . $item['sku'] . "',";
            $html .= "'category': '" . $catName . "', ";
            $html .= "'price': '" . $item['price'] . "', ";
            $html .= "'quantity': '" . $item['quantity'] . "'";
            $html .= "});"

        endforeach;

        $html .= "ga('ecommerce:send');";
        $html .= "</script>";
        return $html;
    }
}

di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Checkout\Block\Success"
                type="Vendor\Namespace\Block\Checkout\Success"/>
</config>

in the success.phtml I'm now trying to get the aboves $html via

$block->getSuccessTrackingCode();

But its empty, theres no return of $html.

What am I doing wrong here?


texts: Deleting from minicart items causing issue

texts:
I am trying to delete from top minicart
and getting this strange error:

  Recoverable Error: Argument 1 passed to
      Magento\Framework\Exception\InputException::__construct() must be an instance
      of Magento\Framework\Phrase, string given,
      called in /home/pocketgrocery/public_html/vendor/magento/module-
      quote/Model/ShippingAddressManagement.php
      on line 121 and defined in /home/pocketgrocery/public_html/vendor/magento/framework/Exception/InputException.php
  on line 51

Any suggestion?


texts: How can I get the products which have a specific value in the multiselect field?

texts:
I need to fetch all the products which have selected a specific item in the multiselect option.

Looking at the HTML in the admin area, I see the ID of the option I want, but I don't know how to filter the collection.


texts: Magento 2 admin how to change product price when adding product to cart

texts:
Can any one please suggest me how to change the product price when adding product to cart through admin.

I want to change the price of the product programmatically when adding product to cart.


texts: Separate the shipping address data & Billing Address data

texts:
In email templates Magento makes the shipping address & Billing address as one line,

How to make the shipping address data to be separated like

Shippping City
Shipping Region
Shipping Country
Billing City
Billing Region

Also this for Billing Address data.

Can you help us?


texts: Upload more than one image with .csv for thumbnail galley

texts:
I have been looking for way to do this and i can't seem to work it out?

Basically i want to be able to add the images into the spreadsheet that will display in the thumbnail section of the product under the base image.

One post mentioned "_media_gallery" along with other attributes to set the position of them etc and i tried this but nothing happened?

Anyone have any info on this?

Might i add i am talking about multiple images to be added to one single line?
Like "/image1.jpg|/image2.jpg" and so on.


texts:
I want to call a helper in the main layout of my website.

I added this within the  part of the layout :

<action method="addLink" translate="label title">
    <label>About us</label>
    <url helper="myModule/getAboutUsUrl" />
    <title>About us</title>
</action>

And defined my module in the /etc/config.xml this way :

<helpers>
    <myModule>
        <class>My_Module_Helper</class>
    </myModule>
</helpers>

I created my helper My_Module_Helper_Data at the root of includes/src/.

There is no error raised, but it seems that it doesn't work. Any ideas ?


texts: Magento 2.2.2 How to set/save customer group in backend?

texts:
I have set the customer group in the frontend on customer signup form. When we create an account all the fields are saved and the customer group is saved i.e General. When we choose the customer group to be Retailer. I the backend its shows the General.

How to save the customer group in backend???

See the Screenshot:
https://prnt.sc/jthrui


texts: Most view product collection with Filter Magento 2.3.3

texts:
Here, product_type is my custom product attribute.

  This is custom script for getting most view product collection and
  working well

<?php

use Magento\Framework\App\Bootstrap;

require __DIR__ . '/app/bootstrap.php';

$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);

$obj = $bootstrap->getObjectManager();

$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
$mostViewedCollectionFactory = $obj->get('\Magento\Reports\Model\ResourceModel\Product\CollectionFactory');
$viewed = $obj->get('\Magento\Reports\Block\Product\Viewed');

$productType = "925";
$collection = $mostViewedCollectionFactory->create()
    ->addAttributeToSelect('*')
    ->addViewsCount()
    ->setPageSize(10)
    ->addAttributeToFilter('product_type', array('eq' => $productType))
    ->addAttributeToFilter('visibility', array('neq' => '1'))
    ->addAttributeToFilter('is_saleable', 1, 'left');

foreach ($collection as $product) {
    $productData = $product->getData();
}

  But not working on block file :-

<?php

namespace Vendor\Module\Block\Product\ProductList;

use Magento\Framework\View\Element\Template;

/**
 * Class Related
 * @package Vendor\Module\Block\Product\ProductList
 */
class Related extends Template
{
    protected $mostViewCollectionFactory;

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $mostViewCollectionFactory,
        array $data = []
    )
    {
        $this->mostViewCollectionFactory = $mostViewCollectionFactory;
        parent::__construct($context, $data);
    }
    public function getRelatedProduct()
    {
        $current_product = $this->registry->registry('current_product');

        $productTypeId = $current_product->getProductType();

        $mostView = $this->mostViewCollectionFactory->create()
            ->addAttributeToSelect('*')
            ->addViewsCount()
            ->setPageSize(10)
            ->addAttributeToFilter('product_type', array('eq' => $productTypeId))
            ->addAttributeToFilter('visibility', array('neq' => '1'))
            ->addAttributeToFilter('is_saleable', 1, 'left');

        $alsoview_product_collection = [];
        foreach ($mostView as $item) {
            $product_id = $item->getEntityId();
            $product = $this->_productCollectionFactory->create()->load($product_id);
            $alsoview_product_collection[] = $product;
        }
        return $alsoview_product_collection;
    }

}

I don't know why this not working in my module and working well on script


texts: Magento 2.3.3 - When minify the js getting the issues

texts:
We're getting a lot of error messages on the console about missing JS libraries after minify the js in Magento 2.3.3 (on both frontend and admin). Apparently they are all related to jquery/ui-modules.
e.g.:

pub/static/adminhtml/Magento/backend/en_US/jquery/ui-modules/timepicker.js
pub/static/version/frontend/theme/en_IE/jquery-ui-modules/resizable.min.js
net::ERR_ABORTED 404 (Not Found)
pub/static/version/frontend/theme/en_IE/jquery-ui-modules/slider.min.js
net::ERR_ABORTED 404 (Not Found)
pub/static/version8/frontend/theme/en_IE/jquery-ui-modules/timepicker.min.js
net::ERR_ABORTED 404 (Not Found)


texts:
user can upload image and text on product image,  after that user muct click on custom button "save design" , after that only onclick "Add to cart" button will add item to cart. but we want to remove that validation for add to cart button.

What i need is Once user upload image or text and if user click on "Add to cart", it should add item to cart.

We have below code for "save design"

_getControlPanelHtml: function()
    {
        if (this.config.editorEnabled) {
            return '
' +
                '<button id="submit-editorApply-{{rand}}" >SAVE DESIGN</button>' +
                '<button >Reset</button>' +
                '
';
        }
        return '';
    },

    initObservers: function()
    {
        if (this.config.editorEnabled) {
            $('submit-editorApply-' + this.config.rand).observe('click', this.submitApply.bindAsEventListener(this));
            $('submit-editorReset-' + this.config.rand).observe('click', this.submitReset.bindAsEventListener(this));
        }
    },

    submitApply: function(event)
    {
        Event.stop(event);
        this.option.apply();
    },

I tried below code , now "Add to cart" is working without clicking "save design", but after clicking "save design", than "Add to cart" is not working.


texts: How to get All Active Categories in Custom Module Admin Form(UI-component) Dropdown in Magento 2?

texts:
I need to get all categories in a dropdown in admin ui form. So Please provide me a solution

Form.xml

<field name="category_name" sortOrder="10" formElement="select">
            <argument name="data" xsi:type="array">

                <item name="options" xsi:type="object">namespace\xxx\Model\Sources\Categories</item>
                <item name="config" xsi:type="array">
                    <item name="dataScope" xsi:type="string">category_name</item>
                </item>
            </argument>
            <settings>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">true</rule>
                </validation>
                <dataType>string</dataType>
                <label translate="true">Category Name</label>
            </settings>
        </field>


texts: Adding an attribute to a configurable product

texts:
When adding new configurable products, I want to enter two prices. The normal price, plus a cost price (the price the item cost me).

I've added a product attribute for costprice. When I create a new configurable product, I can enter the new cost price for the item. However I want to add the cost price for the configurable products as each configuration can have a different cost price.

For example, image creating a t-shirt as the product and having different colours as the configurable items. I can enter a cost price for the t-shirt, but not for each configurable item. When the configurable items are generated, I can edit each of these 'virtual items' and enter a cost price, but I would like to enter the cost price when I enter the configurable item price.


texts:
<?php $price_rules = Mage::getModel('startupready_priceRules/quantitybreaks');
    $price_rules->load($priceRuleList);
    $price_rules->getPricingTables(); ?>

Is there any way to use model like this in magento 2?


texts: Magento 2 online refund for custom payment method

texts:
I am developing a Magento 2 custom payment module for one of my  clients, yet I am now totally blocked in finding a way to process an online refund for any of the created orders. I can't locate the Online refund button and all I found was the offline refund button, so I tried to trigger the refund by adding canRefund throw the config.xml file and add it in the payment module but there is something still missing so if any one can help i will be appreciated?
config.xml
<active>1</active>
<can_refund>1</can_refund>
<can_capture>1</can_capture>

payment.php
    namespace magento\payment\Model;

    class Payment extends \Magento\Payment\Model\Method\AbstractMethod
    {

        protected $_isInitializeNeeded      = false;
        protected $redirect_uri;
        protected $_code = "mycode";
        protected $_canOrder = true;
        protected $_isGateway = true;
        protected $_canCapture = true;
        protected $_canCapturePartial = true;
        protected $_canRefund = true;

        public function getOrderPlaceRedirectUrl() {
           return \Magento\Framework\App\ObjectManager::getInstance()
                                ->get('Magento\Framework\UrlInterface')->getUrl("mycode/redirect");
       }
       public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
       {
          // some code

          return ;
       }
    }


texts: Magento 2: Checking an Admin User's Access Level

texts:
In Magento 2, you can create access control rules for admin users at

System -> User Roles

As a backend Magento programmer, how can you check which rules the currently logged in admin user has assigned?  i.e. which object(s) do you need to inject, and which methods do you need to call on them?


texts:
I have followed the dev docs on 2.2 to create an admin theme.
http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/admin_theme_create.html
When I run php bin/magento setup:upgrade I receive the following error, but I even checked my module against the admin theme dev docs again.

Module 'Magento_Theme':
Running data recurring...Field title can't be empty

my app/design/Snow/wonderland/theme.xml file
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Wonderland</title> <!-- your theme's name -->
    <parent>Magento/backend</parent> <!-- the parent theme. Example: Magento/backend -->
</theme>

my registration.php file
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'adminhtml/Snow/wonderland', // Example: 'adminhtml/Magento/backend'
    __DIR__
);

my /etc/adminhtml/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <!-- Admin theme. Start -->
    <type name="Magento\Theme\Model\View\Design">
        <arguments>
            <argument name="themes" xsi:type="array">
                <item name="adminhtml" xsi:type="string">Snow/wonderland</item> <!-- Example: "Magento/backend" -->
            </argument>
        </arguments>
    </type>
    <!-- Admin theme. End -->
</config>

My /etc/module.xml
<module name="Snow_wonderland" setup_version="2.0.1"> <!-- Example: "Magento_Backend -->"
    <sequence>
        <module name="Magento_Theme"/>
    </sequence>
</module>


texts: Minimum order subtotal for customer group

texts: Whats the best way to set a minimum subtotal for customer group? Is this even possible in native Magento?


texts: Magento 2: Static images returns 404 after refresh

texts:
This is driving me crazy.

I added a couple of images to my theme. They are on my theme_name/web/images folder.

The images are returning a 404.

I delete the folder pub/static/frontend/vendor/theme_name/en_US and on the first access they load. As soon as I try to load the images again they return 404 again.
The images are in the correct path.

Any ideas on what could be causing this? Permissions?


texts: Magento 2.1 adjusting memory_limit on shared hosting

texts: I have Magento 2.1.3 setup on Godaddy shared hosting and after much struggling around with php.ini files, the web host has decided that Magento is showing the global memory limit (512MB) on the server rather than the local memory limit (2048MB). Obviously, the host is unwilling to change the global memory limit, so my question here is how can I force Magento to look at the local php.ini file within my hosting? If it is not possible, please suggest me another way to proceed.


texts: Magento 2.2.7 - Issue With Configurable Product Details Page having more than 20 associated products - MageMojo, Nginx

texts:
We are receiving this error on opening a configurable product in the frontend.
The configurable product having 20+ associated products. The issue is not there with other products having less number of associated products.
But It started happening after moving to MageMojo and upgrading Magento to 2.2.7. The issue is not there with our old development server and with Magento 2.1.8.
We tried contacting MageMojo support but they denied saying that there is no issue with the server.

Please suggest a way to debug as this error seems to be very generic
   and we don't have any other details at this moment.

Error:

  *396 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.xx.xxx.xxx, server: example.mojostratus.io, request: "GET url-of-product-page.html HTTP/1.1",$ host: "example.mojostratus.io"


texts: determine if user is logged in via ajax call and proper return values (Magento 1.4)

texts:
We have a product setup where a user may spend some time configuring a product. The configuration is done via an API and in theory they could be logged out due to inactivity.

I want to implement the following logic when the click "share"

send a request to the controller that returns a simple {login:1} or {login:0}
if logged in, save the product to their wishlist and popup a modal saying that it's been added
if not logged in, redirect them to the login page with a return url specified.

I thought it helpful to give a strategic overview. but specific question is two parts:

what is the best controller url to use (something like /customer/session/checklogin) to route the request to.
Is there a method in a class that already checks this in some way?  If so let me know.  I don't mind copying from app/core to app/local and creating a new simple method


texts: I need to change the product name in cart and checkout page - magento 2.3

texts:
Note : I need changes when using the configurable product.
I need to change the product name in the in the checkout and cart pages according to SKU because in the cart and check-out it shows the configurable product name but i need to show the name of the product variation and also i need to show the SKU in all three pages (minicart, cart, checkout) Iam using the magento2.3.4.
The name of the product which we select after the options

But in cart and checkout page it shows as its configurable product name

I tried the using observer [event name : checkout_cart_product_add_before] but i don't know how to implement this is please get any solution for this situation
Thanks in advance :)


texts: Magento deployment on multiple AWS EC2 Instances with ELB

texts: What is the best way to manage multiple Magento based instances behind a load balancer? How do i manage the replication between the instances. How do i replicate the new products/images or any other changes in the code base.


texts: PayPal NVP CURL connection error #77: Problem with the SSL CA certificate (path? access rights?)

texts:
I am running Magento CE 1.9.0.1. So far I have been using Paypal Integral but now need to switch to Paypal Express Checkout (to handle recurring profiles). So I have activated Paypal Express Checkout in Magento Admin and filled in my Paypal API signature.

But when customers try to proceed to checkout, they see the following error message: Unable to communicate with the PayPal gateway.

In /var/log/exception.log I can see the following error message:

exception 'Exception' with message 'PayPal NVP CURL connection error #77: Problem with the SSL CA cert (path? access rights?)' in /app/code/core/Mage/Paypal/Model/Api/Nvp.php:983
Stack trace:
#0 /app/code/core/Mage/Paypal/Model/Api/Nvp.php(616): Mage_Paypal_Model_Api_Nvp->call('SetExpressCheck...', Array)
#1 /app/code/core/Mage/Paypal/Model/Express/Checkout.php(381): Mage_Paypal_Model_Api_Nvp->callSetExpressCheckout()
#2 /app/code/core/Mage/Paypal/Controller/Express/Abstract.php(108): Mage_Paypal_Model_Express_Checkout->start('https://www.tic...', 'https://www.tic...', false)
#3 /app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->startAction()
#4 /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('start')
#5 /app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 /app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#7 /app/Mage.php(684): Mage_Core_Model_App->run(Array)
#8 /index.php(87): Mage::run('', 'store')
#9 {main}

Following some recommendations I found on the web, I tried to restart Apache, to disable "Enable SSL verification" in Admin... but nothing has changed.

And yet, I do have a valid SSL certificate, so my only guesses are:

either Paypal does not look for my SSL certificate in the right directory — but I do not know how to check / fix that;
or I should change the SSL certificate files' permissions in Filezilla?

Your help will be much appreciated! Thanks in advance.

PD: using CentOS Linux 6.5.


texts: Payment Shipping option does not show on checkout express and incorrectly on default checkout

texts:
Im having trouble with the checkout process. It tells me:
"Sorry, no quotes are available for this order at this time"

Im trying to do the checkout in Sweden and there should not be any "price check" on addresses, since we have Free shipping enabled.

I have filled in all the fields in the address.

And when using Single page checkout it only says:
"Sorry, no quotes are available for this order at this time"

A bit frustrating. Googled alot and read several suggestions but none has worked.


texts:
I am working on Magento ver. 2.1.7 and my document root is /var/www/magento2/ and site URL  http://172.16.60.52/magento2/

In the admin menu Stores -> Settings -> All Store
I have created One Main Website and two store for Electronic and Fashion . Also I have created store view
for each store having code electronic and fashion respectively.

In the admin section I have set the following configurations

Stores - > Settings -> Configuration -> General -> Web -> (Store View:  Default Config) Add Store Code to Urls - > Yes

Stores - > Settings -> Configuration -> General -> Web -> (Store View: Electronic)

Base URL -> http://172.16.60.52/magento2/electronic/

Base Link URL -> http://172.16.60.52/magento2/electronic/

Secure Base URL -> http://172.16.60.52/magento2/electronic/

Secure Base Link URL -> http://172.16.60.52/magento2/electronic/

Stores - > Settings -> Configuration -> General -> Web -> (Store View:  Fashion)

Base URL -> http://172.16.60.52/magento2/fashion/

Base Link URL -> http://172.16.60.52/magento2/fashion/

Secure Base URL -> http://172.16.60.52/magento2/fashion/

Secure Base Link URL -> http://172.16.60.52/magento2/fashion/

I have created two directories electronic & fashion in document root, copied index.php and .htaccess files from magento2 directory to electronic and fashion directory

I have change the /var/www/magento2/electronic/index.php file as code given below...

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'electronic';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

Also, I have change the /var/www/magento2/fashion/index.php file as code given below...

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'fashion';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

While accessing url http://172.16.60.52/magento2/electronic/ we got the following error

There has been an error processing your request

Exception printing is disabled by default for security reasons.

  Error log record number: 876098939040

Log file info :

  a:4:{i:0;s:15:"No such entity.";i:1;s:4915:"#0
  /var/www/magento/ehgsdigi/vendor/magento/module-store/Model/StoreResolver/Website.php(46):
  Magento\Store\Model\WebsiteRepository->get('electronic')

...................

Please advice me


texts: Magento 2 Get selected simple product id in configurable product

texts:
We have a configurable product on the front-end with two drop-downs (size and color)

How can I get the final simple product id once the user has made their selections

We have done this in Magento 1 but don't know how to do this in Magento 2.
Any suggestion will be appreciated.


texts: Magento & ElasticSearch- Issue on SKU search

texts:
I'm reading tons of Google search, but I cannot reach my goal.

I've a M1.9.x website with ES.

I've a custom module based on Smile Elastic Search (found on GitHub).

I need to search with PARTIAL sku.

I modified my mapping using the "copy_to" function to copy the value of SKU field on my multifield field.

I've a sku like 'ABC123' and i need to find it with "ABC12" query. How can I do this? Many thanks!


texts: Dropdown Values Option with Multi Store Issues

texts:
I have some dropdowns I'm using on a mobile form using getSelectValues. However, if I use Frontend Options as well, in this case I'm using values
Yes/No for Admin and C/B for Store 2, it changes the value when I save. Strange. See below.

Here is the Select values getting called.

  $missing_charger_values = $this->getSelectValues('missing_charger');

  $missing_battery_values = $this->getSelectValues('missing_battery');

Before save

After Save

Here is the code populate the values. If I refresh is goes back to normal until I save again.

            *<?php echo $this->__('Missing Charger') ?>
            <?php if(!empty($missing_charger_values)):?>
            <select name="product[missing_charger]" id="product[missing_charger]" required="required">
                <?php foreach($missing_charger_values as $value): ?>
                    <option value="<?php echo $value['value']?>" <?php if($product->getData('missing_charger') == $value['value']) echo "selected='selected'"?>><?php echo $value['label']?></option>
                <?php endforeach; ?>
            </select>
            <?php else: ?>
            <?php endif; ?>

            *<?php echo $this->__('Missing Battery') ?>
            <?php if(!empty($missing_battery_values)):?>
            <select name="product[missing_battery]" id="product[missing_battery]" required="required">
                <?php foreach($missing_battery_values as $value): ?>
                    <option value="<?php echo $value['value']?>" <?php if($product->getData('missing_battery') == $value['value']) echo "selected='selected'"?>><?php echo $value['label']?></option>
                <?php endforeach; ?>
            </select>
            <?php else: ?>
            <?php endif; ?>


texts: Magento 1.9 - Error getChildHtml with content Javascript

texts:
I tried to insert a getChildHtml in view.phtml file but half page is empty. The file that i would insert is a file with javascript/php/html code otherwise if i insert only html or php code the file is showing.

So...i declared my block in catalog.xml in this way:

block type="page/block"  name="product.info.calculator" as="calculator" template="catalog/product/view/calculator.phtml"

and in the view.phtml:

echo $this->getChildHtml('calculator');

Where is the problem?


texts: Many products with various colors, different colors & different amounts of colors

texts:
I created an attribute for size since all the shirts come in the same seven sizes.

Each shirt comes in a wide variety of colors per style, ranging from two to fourteen different colors. Some have 5 colors, some 8, some 10 and so on.

Examples of products:
All shirts come in sizes as follows: XS, SM, MED, LG, XL, XXL, XXXL

The shirts come in different colors and amounts of colors:

These two have six colors, but the colors are different:

Flag shirt - aqua, baby blue, black, grey, red and white. (6 colors)

Leaf shirt - aqua, baby blue, black, bright pink, white and yellow. (6 colors)

Magento Version 1.9.2.2

What is the best solution to handle this, please?


texts: Magento 2 error upon setup:upgrade command

texts:
I am trying to upgrade a Magento 2 extension. When I run setup:upgrade,

I get the following error,

Upgrading data.. No such entity with cartId = 356670

How can I debug where exactly this error is happening? Is there any sort of log file created by setup:upgrade that will help me identify what SQL query is causing this error?


texts: The following abstract class don't have any abstract method?

texts:
Mage_Catalog_Block_Product_Abstract

this class don't have any abstract method, what is the use of declaring this class as abstract?

is there any coding standard/genetic involved?


texts: wishlist not working for guest user in magento 2?

texts:
please anyone help me

<a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) ?>' class="action towishlist" data-action="add-to-wishlist" id="hasitem-wish">

<a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) ?>' class="action towishlist" data-action="add-to-wishlist">


texts: how can i call helper function of other module in my custom module?

texts:
I have two modules (amodule, bmodule) and want to use an existing logic of bmodule in my current module amodule

I tried to use dependency injection in constructor, but i got an error on during runtime, because the parameter needed was the helper of the other module, but given was none.

class NewAction extends \Magento\Newsletter\Controller\Subscriber\NewAction
{

    private $_bhelper;

    public function __construct(
        Context $context,
        SubscriberFactory $subscriberFactory,
        Session $customerSession,
        StoreManagerInterface $storeManager,
        CustomerUrl $customerUrl,
        CustomerAccountManagement $customerAccountManagement,
        \MyModule\bmodule\Helper\Data $bhelper
    )
    {

        $this->_bhelper = $bhelper;

        parent::__construct(
            $context,
            $subscriberFactory,
            $customerSession,
            $storeManager,
            $customerUrl,
            $customerAccountManagement
        );
    }

    ...
}

   [message] => Uncaught TypeError: Argument 7 passed to MyModules\amodule\Controller\NewAction::__construct() must be an instance of Mymodules\bmodule\Helper\Data, none given, called in

How can i make a cross call of another module logic?

In magento1 it was simply

Mage::helper('bmodule')->doMyStuff();

How can i do this correctly in Magento2?


texts: Canonical way to get static asset version

texts: I can write a function easily enough to file_get_contents('pub/static/deployed_version.txt'), but I'm curious, is there an M2 class that provides this behavior already?


texts: Get Configurable Parent from simple product in quote when simple product has multiple parents

texts:
So I have a client that has about 14 Configurable products that are basically the same thing (logo item). Then they have created a simple product for each base color(Blue, Pink, Black)[3 total simple products]. They have then taken the 3 simple products and assigned each of them to the 14 configurable products so that the logo from the configurable products gets the base color simple product selected.

In their setup the configurable products house the images for these products. However, since you can only purchase the simple product the image that is being select is ALWAYS coming over as the image from product 1 of 20 (lowest product_id), no matter which selection is chosen.

The code im going to be trying to update is in a custom block that is being used on the checkout_onepage_index reference.

My question is:

  From the sales/quote_item Model, how can I determine exactly which parent the
  child item was selected from?

or

  From the checkout/cart Model, can something be achieved?

Things I have already seen but are not really helpful.

Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId())

result

Array
(
    [0] => 45207
    [1] => 45209
    [2] => 45210
    [3] => 45211
    [4] => 45212
    [5] => 45213
    [6] => 45214
    [7] => 45215
    [8] => 45216
    [9] => 45217
    [10] => 45218
    [11] => 45219
    [12] => 45220
    [13] => 45222
)

This just returns an array of all parentIds for the child item. Which is great, but there is no indication of which Parent Product this simple product was selected from.


texts: Error: Strict Notice: Only variables should be passed by reference

texts:
My log file show error:

2016-02-19T04:20:31+00:00 ERR (3): Strict Notice: Only variables should be passed by reference  in /home/..../controllers/IndexController.php on line 17

2016-02-19T04:20:31+00:00 ERR (3): Warning: explode() expects parameter 2 to be string, array given  in /home/.../controllers/IndexController.php on line 18

$path=explode('index/index/path/',array_shift(explode('?',@$_SERVER['REQUEST_URI'])));<br>
$ex = explode('/id/', $path);

Please tell me how can fix!


texts: Magento 2: PayPal gateway has rejected request. Payment has already been made for this InvoiceID

texts:
I'm using Paypal Sandbox Account. I'm facing below issue

[2017-03-15 03:32:20] main.CRITICAL: Exception message: PayPal gateway has rejected request. Payment has already been made for this InvoiceID (#10412: Duplicate invoice).
Trace: #0 D:\wamp\www\magento\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(89): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#1 D:\wamp\www\magento\vendor\magento\framework\ObjectManager\ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#2 D:\wamp\www\magento\var\generation\Magento\Framework\Exception\LocalizedExceptionFactory.php(43): Magento\Framework\ObjectManager\ObjectManager->create('\\Magento\\Framew...', Array)


texts: How to find where the controller action is called ? Magento 1

texts:
I can see that there is a controller
with saveitemAction()
/app/code/local/Web/Popup/controllers/IndexController.php

How do i find from where this controller action is called ?
i.e (saveitemAction())


texts:
A lot of tutorials online show us what the flow is when ordering through the Magento2 Api.
Unfortunately, alot of these tutorials only display "Cash on delivery".
Magento DevDoc: https://devdocs.magento.com/guides/v2.4/rest/tutorials/orders/order-create-order.html
Other resource: http://magento2restapi.blogspot.com/
When posting the final request, The order gets created and all the required data is received in the backend. But how do we process payments trough the API system of magento.
I understand it's not easy to explain this in a reply to this post, but if you could point me towards the location where I can read more about this subject, that would be great.


texts: Magento customer grid _prepareCollection() override is not working

texts:
I had override _prepareCollection() method of Mage_Adminhtml_Block_Customer_Grid and added following lines

->addAttributeToSelect('cus_city')
->addAttributeToSelect('cus_country')
->addAttributeToSelect('cus_state')

to:

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel('customer/customer_collection')
                ->addNameToSelect()
                ->addAttributeToSelect('email')
                ->addAttributeToSelect('created_at')
                ->addAttributeToSelect('group_id')
                ->addAttributeToSelect('cus_city') // added
                ->addAttributeToSelect('cus_country') // added
                ->addAttributeToSelect('cus_state') // added
                ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
                ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
                ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
                ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
                ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');

    $this->setCollection($collection);
    return parent::_prepareCollection();
}

and add these 3 columns in the _prepareColumns() as follows

$this->addColumn('cus_city', array(
    'header'    => Mage::helper('customer')->__('City'),
    'width'     => '100',
    'index'     => 'cus_city'
));

$this->addColumn('cus_country', array(
    'header'    => Mage::helper('customer')->__('Country'),
    'width'     => '100',
    'index'     => 'cus_country'
));

$data_array=array();
$statearray = Mage::getModel('directory/region')->getResourceCollection() ->addCountryFilter('IN')->load()->toOptionArray();
foreach($statearray as $states){
    $data_array[$states['value']] = $states['label'];
}

$this->addColumn('cus_state', array(
    'header'    => Mage::helper('customer')->__('State'),
    'width'     => '100',
    'type'   => 'options',
    'index'     => 'cus_state',
    'options' => $data_array,
));

Issue is this 3 columns are not populating with the data when it is in the overriden module and if i add same code in the core this 3 columns are populating with the values


texts: Created a credit memo... can i revert this?

texts:
I had to create a credit memo for an order that was returned. Accidentally I did this for the wrong order.

Can I rectify this?
And how should I do this?

Can I just remove the corresponding line in database in:

sales_flat_creditmemo
sales_flat_creditmemo_comment
sales_flat_creditmemo_grid
sales_flat_creditmemo_item

I have no stock management in store.


texts: Class 'Magento\Setup\Mvc\Bootstrap\InitParamListener' not found when running CLI

texts:
I have a VM running Magento 2 with the sample data that was installed not using composer - I grabbed the latest version from the Magento site). The site itself runs fine, but when I try to run anything for the command line, I get this error:

PHP Fatal error:  Uncaught Error: Class 'Magento\Setup\Mvc\Bootstrap\InitParamListener' not found in /var/www/html/public/setup/config/application.config.php:24
Stack trace:
#0 /var/www/html/public/vendor/magento/framework/Console/Cli.php(57): require()
#1 /var/www/html/public/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI')
#2 {main}
  thrown in /var/www/html/public/setup/config/application.config.php on line 24

I built the VM on another machine using build scripts, and then used those to build it on this machine, and it worked for a bit, but I suspect I left something out of source control that would be causing this.


texts: Last 5 search terms on my store shows strange malicious looking search strings

texts:
The last 5 search terms used on my magento store per my shop dashboard has some malicious looking strings. I was wondering if anyone had any insight on how these could affect my store. Is it possible to run malicious queries or strings through the on site varien search form?

This is a list of the search terms in question with the most recent first:

fz1' aND BeNChMaRK(2999999,Md5(NoW())) AnD '1
fz1'&&BeNChMaRK(2999999,mD5(NOW()))&&'1
fz1'&&sLEEp(3)&&'1
fz1' AnD sLeep(3) ANd '1


texts: Unable to install Magento B2B extension for Magento 2.2.0 Community Edition

texts: I am working with Magento community edition 2.2.0. It gave this error when I executed composer require magento/extension-b2b


texts: Use of __desctruct() in classes to free memory

texts:
I have a suspected memory leak - I am reading from and writing to files within one class - perhaps the data isn't being released - not sure I need to run some tests.

However, I am looking into using a destructor in my class which I will use to set all injected objects in my constructor to null.

I am also going to use finally after my try {} catch {} blocks, so I can ensure all locally created objects have been freed - and any file connections have been closed.  This will ensure (I hope) that all objects have been cleared.

Does anyone have any objections to this?  I am just asking because I haven't really seen any of this type of thing in core Magento.


texts: change default homepage in magento2 url only for mobile theme

texts:
I have a module with 2 themes for mobile and desktop.

In the mobile theme I want to change the default homepage to another url.

So when the mobile detection it is activated instead to go to the default page to go to my module route magento.com/mylink

I can put a redirect in the a block and define this block in cms_index_index.xml but looks a bit "dirty".

Is it a way to reroute the mobile theme homepage directly ?


texts: Why does a free shipping promotion make all shipping options free?

texts:
I made a shopping cart promotion that allows products with the "free shipping" attribute set to "yes" to be shipped for free. But for some reason, instead of just showing the free shipping option at checkout it, it shows the free shipping option and then shows all other options at a cost of $0.00. How do I make it so that it only shows the free shipping option but keeps the others the same?

I should clarify I am trying to add free shipping to a single item.

Also, the problem is that all shipping types turn out to be free. Overnight and 37 day ground are the same cost.


texts: Category Navigation suddenly disappeared

texts:
Sorry in advance I'm not very familiar with Magento.

I am working on a Magento Web Shop and one day the top navigation, where you can open the categories, just disappeared. I tried searching in the vendor folder for the Block or templates for it but no success there. Didn't find a solution in the Admin panel as well. Searched in Google, but the only thing I found was about Varnish, which I'm not using.

I'm open to any suggestions and questions.


texts: Magento 2.1 : How to remove copyright from within the Admin panel (in the footer)?

texts:
How would one change the Copyright in the Admin panel? Just to clarify - I'm speaking about the copyright notice on the bottom of the page inside the admin panel and on the login page into the admin panel.

Magento 2.1.0


texts:
In my custom theme for product/list.phtml file and list mode i use the following code for gallery images:

<?php $images = $product->getMediaGalleryImages(); ?>

<?php foreach($images as $child): ?>

        <img src="<?php echo $child->getUrl(); ?>" >

<?php endforeach; ?>

In Magento 1.x, I used:

<?php echo Mage::helper('catalog/image')->init($product, 'image', $image->getFile())->resize(100, 100); ?>

How i can resize the images in Magento 2 ?


texts:
require(['naeem'], function($){
 $(document).ready( function() {
   alert("Page loaded.");
  });
});

File Save in magento2\app\design\frontend\new\customtheme\web\js\naeem.js

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

File Save in magento2\app\design\frontend\new\customtheme\require.js


texts: Discounting configurable product in Magento 2

texts:
How am I supposed to discount configurable products in Magento 2.1?

Price is gone from the configurable, so I can't do it there. Applying catalog rules to subproducts is not a option anymore either.

So do I really have to update 35 variants individually if I want to reduce the price for an item?


texts: Add new field to shipment grid (with items price incl tax) - Magento 2

texts: I need to add a new field to shipment grid and this field must contain items price incl tax. So I also should plug into the shipment saving prosess to calculate and save this field value.


texts: Two of Magento 2 indexers not running on a scheduled cron

texts: Product categories and Catalog product rule indexes are not running on a scheduled cron. Is this normal?


texts: Magento 2 add Ui-comopnent into not Ui form

texts:
I need to add categories tree like this one

into Magento target Rule tab -

  the problem is - magento target rule edit form is not a ui-form.

Can I add this with something like $form->addElement() or similar method?


texts: Magento 2 : Filter is not showing in front end in my custom module

texts:
i'm creating filter for Frontend in custom module.

I'm following this module grid

https://belvg.com/blog/ui-grid-component-on-the-front-end-in-magento-2.html

But it's not showing in Front end.

How i can inherit the back end filters Grid to Front end

and use for my module.


texts:
Does anyone know how to remove the space after the € symbol in the price? It's defined in the price.phtml file but i can't find a way to remove the space...

I tried formatting the price and got this now:

    <?php
        $sym = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
        $price = $_product->getPrice();
        $specialprice = $_product->getFinalPrice();
        if($price != $specialprice){
           if($price != ''){
                echo '
';
                echo $this->__('Regular Price'). ': ';
                echo ''.$sym.''.number_format($price,2).'
';
            }
            if($specialprice != '')
            {
                echo '

                    Special Price
                    '.$sym.''.number_format($specialprice,2).'

 ';
            }
            }else {
                echo '

                        getId().'" class="regular-price">
                            '.$sym.''.number_format($price,2).'

';
        }
    ?>

But now it's display €99.95 instead of €99,95 with a comma, how can i change it to show a comma?


texts: Magento2 Layout move element only for desktop view?

texts:
I'm trying to adapt the Luma Theme for my needs and move some elements in layout.
I add a default.xml file in my Child Theme and add those lines :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
      <move element="minicart" destination="header.container" before="-" />
      <referenceBlock name="top.search" remove="true"/>
    </body>
</page>

The minicart is now on the header container but is there a directive to apply these changes only for Desktop and not for Mobile view ?


texts:
Emails are being sent correctly (subsription, registration, etc...), but the share wishlist email is not being sent.

Email is not present in admin panel system/tools/SMTPPro - Email Log.

Where I should begin to look to find what's not working? Which are the best steps to find the origin of the problem?

If I go to magento_path/app/design/frontend/theme/template/wishlist/sharing.phtml

I see that the share wishlist button is in a form, and the action form is <form action="<?php echo $this->getSendUrl() ?>" id="form-validate" method="post">.

So I look into magento_path/app/code/core/Mage/wishlist/Block/Customer/Sharing.php where getSendUrl() method is. And I place a log in this method:

Mage::log($this->getUrl('*/*/send'), Zend_Log::INFO, 'email_send.log', true);

The log in the file after trying to send the share email is:

2018-01-29T09:16:02+00:00 INFO (6): https://myweb.com/en/wishlist/index/send/

Once I see this I look into the wishlist index controller, the sendAction. And I place some logs there:

$emails  = explode(',', $this->getRequest()->getPost('emails'));
Mage::log($emails, Zend_Log::INFO, 'email_send.log', true);
$message = nl2br(htmlspecialchars((string) $this->getRequest()->getPost('message')));
Mage::log($message, Zend_Log::INFO, 'email_send.log', true);

the $emails var is:

2018-01-29T09:28:47+00:00 INFO (6): Array
(
    [0] => pim@youremail.cf
)

That is the email in entered

and the $message var is:

2018-01-29T09:28:47+00:00 INFO (6):

foo sunset eclipse/ natural

Product view
            | Add to Cart

that is the email template I'm trying to send.

Edit: Solution

I find the wishlist email sending code from the wishlist indexcontroller commented. I uncomment it and now emails are sent:

//this code was commented. So it prevented wishlist emails from being sent
foreach ($emails as $email) {
            $emailModel->sendTransactional(
                Mage::getStoreConfig('wishlist/email/email_template'),
                Mage::getStoreConfig('wishlist/email/email_identity'),
                $email,
                null,
                array(
                    'customer'       => $customer,
                    'salable'        => $wishlist->isSalable() ? 'yes' : '',
                    'items'          => $wishlistBlock,
                    'addAllLink'     => Mage::getUrl('*/shared/allcart', array('code' => $sharingCode)),
                    'viewOnSiteLink' => Mage::getUrl('*/shared/index', array('code' => $sharingCode)),
                    'message'        => $message
                )
            );
        }


texts: Magento 2 | Adding pagination on custom collection to display «per page» limiter

texts:
I have followed this link to show «per page» limiter on frontend. I have done so far is:

My Collection:

public function getInvoicesCus()
{

    //get values of current page
    $page=($this->getRequest()->getParam('p'))? $this->getRequest()->getParam('p') : 1;
     //get values of current limit
    $pageSize=($this->getRequest()->getParam('limit'))? $this->getRequest()->getParam('limit') : 1;

    $orderCollection = $this->_orderCollectionFactory->create()->addAttributeToSelect('*');
    $orderCollection->addAttributeToFilter('customer_id',$this->getCustomerId());
    $orderCollection->setPageSize($pageSize);
    $orderCollection->setCurPage($page);
    $orderCollection->load();
    //echo "
";

    $invoices_data = array();
    foreach($orderCollection as $orderData)
    {
        $order_id = '';
        $order_id = $orderData->getData('increment_id');

        foreach ($orderData->getInvoiceCollection() as $invoice)
        {
            $invoices_all_data = $invoice->getData();
            $invoices_data[] = $invoices_all_data;
        }
    }
    return $invoices_data;
}

Added Collection to Pager as:

protected function _prepareLayout()
{
    parent::_prepareLayout();
    $this->pageConfig->getTitle()->set(__('Invioices'));
    if ($this->getInvoicesCus()) {
        $pager = $this->getLayout()->createBlock(
        'Magento\Theme\Block\Html\Pager',
        'magecomp.category.pager'
        )->setAvailableLimit(array(5=>5,10=>10,15=>15))->setShowPerPage(true)->setCollection(
        $this->getInvoicesCus()
        );
        $this->setChild('pager', $pager);
        $this->getInvoicesCus()->load();
    }
    return $this;
}

Getting the Child Block of the Pager as:

public function getPagerHtml()
{
return $this->getChildHtml('pager');
}

and to call the pager in phtml:

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

<?= $block->getPagerHtml() ?>

<?php endif ?>
<?php else: ?>

<?= /* @escapeNotVerified */ __('You have placed no orders.') ?>

<?php endif ?>

But when I am always getting this messege in output:

"You have placed no orders."

Can anybody spot the issue ? Thanks

N.B : I am getting order invoices as output if comment pagination code.


texts: Magento 2 - cannot insert block inside another block from the core

texts:
im trying to insert a custom block inside another block from the core. but for some reasons i cannot do it using referenceBlock. though its working if i use referenceContainer on the 'content', im trying to do it in checkout_cart_index.xml. heres my layout.xml.
<body>
    //this one is working
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template"
               name="sample.name"
               before="-"
               template="My_Module::template.phtml" />
    </referenceContainer>

    //this one is not working.
    //i also tried using renderer.list as reference block name. still not working
    <referenceBlock name="checkout.cart.item.renderers">
        <block class="Magento\Framework\View\Element\Template"
               name="another.sample.name"
              template="My_Module::template.phtml"/>
    </referenceBlock>

</body>

i have no idea whats wrong since the referenceContainer is working


texts: How to Remove assigned tags if the product becomes out of stock

texts: When any product's quantity becomes 0 or out of stock i need to remove all the tags assigned to that particular product.


texts: How do we keep the products with NULL value at the end of listing

texts: On product listing page if i apply sort by color ,i need the products which have the color value as NULL ,should be displayed at the bottom of the listing page


texts: How to getSku for configurable products in magento 2

texts:
I want to get Sku for selected options.

Above image i have select blue and M. So this options product sku get in magento 2.
Please Help me.
THANKS.


texts: A way to have comment box as pop up, everywhere in shop?

texts:
Is there a way, to have a comment box (for customers), always available, where they can add comments for their order, instead of having a static comment box at the checkout, product or cart page?

I prefer to have a little 'chat' a-like pop-up, available after clicking the 'comment' link, floating right at the screen. Here the customer can fill in their comments any time, and will be saved automatic to the order they will place.

Hope you can help?


texts:
I have a scenario where i need to place two blocks one after the other in default handle.
One block make use of template file while other use static block. Issue i am facing is ordering of the block. I want block with template file first and then static block.

code for layout file is as below

<layout version="0.1.0">
    <default>
        <reference name="content">
            <block type="core/template" name="practiceblock" after="page_content_heading"
                   template="blockpractice/newblock.phtml"/>
            <block type="cms/block" name="practiceCMSBlock" after="-">
                <action method="setBlockId">
                    <block_id>practiceCMSBlock</block_id>
                </action>
            </block>
        </reference>
    </default>
</layout>

I have used after="-" for static block but is still show as below

Any clue for above?


texts: How to extend / duplicate Sales Order Grid in Magento 2

texts: I want to make a copy of the default Sales Order grid in Magento 2 to my own module.


texts:
Trying to add a Slick(http://kenwheeler.github.io/slick/) slider to homepage.  It looks simple enough, but I have been banging my head against the wall for the last 2 days.

Here's what I have done:

1) Created home_slider.phtml in app/design/frontend/pkg/default/template to create a custom block that displays the banners and load the slider js. alert() to let me know at least it's loading.  I have tested the code on jsfiddle to know it works.

home_slider.phtml

<img src="<?php echo $this->getSkinUrl('images/media/web-banner_2015_1.png')?>" />

<img src="<?php echo $this->getSkinUrl('images/media/web-banner_2015_2.png')?>" />

<img src="<?php echo $this->getSkinUrl('images/media/banner3.jpg')?>" />

2) Modified local.xml in app/design/frontend/pkg/default/layout to insert the slider block on homepage right at the top.

local.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <remove name="top.container" />
            <remove name="welcome" />
        </reference>
        <reference name="top.links">
            <remove name="checkout_cart_link"/>
        </reference>
    </default>
    <cms_index_index>
        <reference name="content">
            <block type="core/template" name="home_slider" template="home_slider.phtml" before="-">
            </block>
        </reference>
    </cms_index_index>
</layout>

The banners load, but Slick is not working (alert didn't fire) and I can't figure out why.  Do I need to create a custom module?


texts: I want to show the topmenu only when logged in

texts:
I want to show the topmenu only when a customer is logged in and I need to use the FPC.
When I try to retrieve the customer id with function to create a if statement to see if the customer is logged in, the topmenu.phtml is cached by Magento's FPC.
How can I check if a customer is logged in and display only the topmenu ?


texts: What causes this odd Uncaught Reference error when adding product to cart Magento

texts:
Since today, adding products to cart has stopped working on our site with the following error.

Uncaught ReferenceError: jquery172016024149750625072_1490834796904 is not defined
    at ajaxcartsuper/ajaxcart/add/uenc/ahr0cdovl2luzhvjdg9ylmnvbs9jdhrmmdiwmwhjzi0…4&options%5b295%5d=&qty=0&product=18244&related_product=&_=1490834978446:1

What could be causing this error? I checked everything. Nothing new has been added other than mysql settings.

Any help would be greatly appreciated.


texts: Magento 2: Call to a member function setState() on array

texts:
I want to change the order Status programmatically but when I run the function realTest() as I mentioned below then it gives me an error Call to a member function setState() on array in the below function it mentions line number 5. I also tried function use Magento\Sales\Model\Order; in place of other class as I mentioned in my code but in both scenarios, it gives me the same error also when I tried the array to print_r($orderState) then it returns me null array.

use \Magento\Sales\Api\OrderRepositoryInterface;
public function realTest(){
        try{
            $orderId = 000256076;
            // obtain the order with the order ID
            $order = $this->_orderRepository->get($orderId);
            $orderState = \Magento\Sales\Model\Order::STATE_PROCESSING;
            $order->setState($orderState)->setStatus(\Magento\Sales\Model\Order::STATE_PROCESSING);
            $this->_orderRepository->save($order);
            return true;
        } catch (\Exception $e){
            echo 'Message: ' .$e->getMessage();
            // add some logging here
            return false;
        }

    }


texts: Magento 2 : Show category with images in homepage

texts:
I want to display all category list on home page.

Show categories details like categories name with categories page link, categories image and categories description.

Thanks.


texts: How to add a custom attribute to a category using the API?

texts:
Is there a way to add a custom attribute to a category?

I only see these options in the swagger documentation:

GET    /V1/categories/attributes/:attributeCode
GET    /V1/categories/attributes
GET    /V1/categories/attributes/:attributeCode/options

I don't see any way to create an attribute or attribute group for the category.

Thank you


texts: Magento 2: buy X items Get Y cheapest items from X free

texts:
I am using extension Amasty Special Promotions https://amasty.com/special-promotions-for-magento-2.html .

I need one promotion Like this

Rule Name: Buy 15 get 5 free
Details: If I buy the 15 items then from those 15 the 5 cheapest should be free. And next it should apply on the qty 30 and then 45 and so on.

Current Rule Configurations:

Conditions:

If cart total quantity >= 15 & category is 342

Actions:

Apply: The Cheapest, also for Buy 1 get 1 free
Discount Amount: 100
Discount Qty Step (Buy X): 3

In the current implementation, I get 5 cheapest free items when total quantity is 15 but after that on 18 get one more free and 21 one more free and so on

Question: Is there any way in the current module to get the discount on 15, 30, 45 ... and on each step get 5 cheapest?

Note: I am working on it and my purpose to share here if someone had the same solution then we can share else after I implement I will share here.

Here is the example

Promotion rules

If the customer will buy the X items then he will get Y cheapest items free
The rule should be calculated on buy X,2X,3X,...

Run time Example

Rule: Buy 15 get 5 free

Cart:

Stage 1:

Item A

    qty: 4

    Price per item: 5

Item B

    qty: 10

    price per item: 10

Discount: 0

Stage 2:

Item A

    qty: 4

    Price per item: 5

Item B

    qty : 11

    price per item: 10

Discount: 25

Stage 3:

Item A

    qty:  7

    Price per item: 5

Item B

    qty : 11

    price per item: 10

Discount: 25

Stage 4:

Item A

    qty:  19

    Price per item: 5

Item B

    qty : 11

    price per item: 10

Discount: 50

Thank You!


texts:
By default way of magento, while creating a order order number starts with 10000.. I would like to change the order number starting sequence.

I studied from other answer Custom Order, Invoice, and Shipping Starting Numbers I understood that we can modify table eav_entity_store


texts:
On the product page how can you activate a tab and then scroll to its position.

I have a hyperlink near the select boxes that I would like the visitor to click on and have it active a tab which the visitor is then scrolled to.


texts: How to make 'sign in' during checkout go to checkout instead of 'my account'?

texts:
In Magento 2, during the checkout process how do you change it so when someone signs into their account it logs them in and continues on with the checkout, rather than to re-direct them away from the checkout and into the 'My Account' page as it currently does.

Thank you


texts: Magento 1.9, get category tree for export

texts:
I need to export all products and their categories into an XML file.

I've managed to get everything I need apart from the category tree, I need to import the exported data into WooCommerce so I need every category that a product is in printed out in tree, e.g:

Products > Golf > Balls
Products > Golf > Balls > White
Sports > Golf

I've got the following code, but it doesn't produce exactly what I need:

function getCategoryPath($sku)
{
    $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);

    $pathArray = array();
    $collection1 = $product->getCategoryCollection()
        ->setStoreId(Mage::app()->getStore()->getId())
        ->addAttributeToSelect('path')
        ->addAttributeToSelect('is_active');

    $i = 0;
    foreach($collection1 as $cat1){
        $pathIds = explode('/', $cat1->getPath());
        $collection = Mage::getModel('catalog/category')->getCollection()
            ->setStoreId(Mage::app()->getStore()->getId())
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('is_active')
            ->addFieldToFilter('entity_id', array('in' => $pathIds));

        $pahtByName = '';
        foreach($collection as $cat){
            $catName = $cat->getName();
            if($catName !== 'Root Catalog') {
                if($catName !== 'Default Category') {
                    if($catName !== 'Category') {
                        $pathArray['cat_'.$i] = $catName;
                    }
                }
            }
        }
        $i++;

    }
    $data = array_filter($pathArray, function($value) { return !is_null($value) && $value !== ''; });
    return $data;

This returns what I need, just not in the right format.


texts: No errors shown/logged beyond shell script

texts:
I have a strange issue where no errors are shown or logged if it occurs beyond the shell script. I have a Magento shell script (... extends Mage_Shell_Abstract), which serves as an entry point for a module that does some backend stuff (update database records, etc.).

The problem is that, while syntax, fatal, parse, etc. errors are displayed if they're from the shell script itself, no errors are shown or logged in the terminal if they arise from the module files.

I have all the options enabled for logging and displaying errors, but errors are not showing, and it's really hard to debug. I have enabled..

// At the beginning of the shell script
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 'On');
ini_set('error_reporting', 'On');

// php.ini
error_reporting  =  E_ALL|E_STRICT

Any ideas?


texts: Call to a member function getBackend() on a non-object admin blank page after trying to upgrade

texts:
I get this error

"Call to a member function getBackend() on a non-object admin blank page"

Also the admin page is blank, so what could be the issue.
I tried deleting all cache from /var/cache folder already! Tried disabling all the modules by renaming all those xml files.

I tried to check the magento installation by using magento-check.php and it shows http://prntscr.com/6v3ny3

PHP version: http://prntscr.com/6v3och