texts:
This is my config.xml content:

<?xml version="1.0"?>
<config>
    <modules>
        <Attin_Exportdb>
            <version>0.1.0</version>
        </Attin_Exportdb>
    </modules>
    <global>
        <helpers>
            <exportdb>
                <class>Attin_Exportdb_Helper</class>
            </exportdb>
        </helpers>
        <blocks>
            <exportdb>
                <class>Attin_Exportdb_Block</class>
            </exportdb>
        </blocks>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <attin_exportdb before="Mage_Adminhtml">Attin_Exportdb_Adminhtml</attin_exportdb>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

This is the content of my controllers:

<?php
class Attin_Exportdb_Adminhtml_AttributesController extends Mage_Adminhtml_Controller_Action{

    public function IndexAction() {

        $this->loadLayout();
        $this->getLayout()->getBlock("head")->setTitle($this->__("Export Attributes"));
        $this->getLayout()->createBlock('export/adminhtml_attributes');
        $this->getLayout()->getBlock("'export/adminhtml_attributes");
        $this->renderLayout();

    }
}

and this is the content of my block file:

<?php
class Attin_Export_Block_Adminhtml_Attributes extends Mage_Adminhtml_Block_Widget_Grid_Container{

    public function __construct(){
        echo "<script type='text/javascript'>alert('test')</script>";
    }
}

The problem is I didn't get any alert. So what am i doing wrong ? thx


texts: Magento 2 Braintree Module How Do You Handle Credit Card Errors In Your Cart?

texts: I am using the Braintree Module that comes with M2.1.3 but it doesn't deal with CC errors with any sort of useful messaging. I wondered if other's had found a way to pass on useful error messages to the customer e.g. Expiry Date or Insufficient Funds etc.


texts: How to create a reorder button outside the client panel?

texts:
How can I create a Reorder button outside the client panel (/customer/account/)?

I tried to copy and paste the code on my home page but got the error:

Fatal error: Call to a member function getStore() on a non-object in /var/www/html/app/code/core/Mage/Sales/Helper/Reorder.php on line 57

The code that I copied is this one:

<?php if ($this->helper('sales/reorder')->canReorder($_order)) : ?>
| <a href="<?php echo $this->getReorderUrl($_order) ?>" class="link-reorder"><?php echo $this->__('Reorder') ?>
<?php endif ?>

This page is only loaded if the user is logged in.

Thanks :)


texts: How to read Customer from Magento to .Net app

texts:
I have installed magento 2 in my local system, my requirement is to read customer from Magento to one .NET application.

Please suggest me how do I proceed to achieve the same.

Thanks
Gautam


texts: Magento 2.3 version Shipping address add company name

texts: Want to add company name in shipping information in magento 2.3 version. On checkout page company name are not shown in shipping information section.


texts: Get stock values for bundled product in product grid

texts:
We use several bundled products, and I'm having trouble displaying the stock value on the product grid. I don't even need values, just in stock or out of stock.

Take the following example:

iPhone, Black, $400, 2 in stock
iPhone, White, $410, 0 in stock
iPhone, Blue, $420, 1 in stock

With the following code I can get the prices of the bundled products and select the lowest price ($400). I thought I could use this to get the available quantities as well. I found the value of stock items in the field qty, so I tried getQty() instead of getPrice(). That returns the stock for the bundle product, the container, which is 0. I need the sum of the stock (3), or the stock value of the bundle item with the highest stock (2).

How can I get the stock value for each bundled product?

if ($_product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
    $optionCol= $_product->getTypeInstance(true)->getOptionsCollection($_product);
    $selectionCol= $_product->getTypeInstance(true)
        ->getSelectionsCollection($_product->getTypeInstance(true)->getOptionsIds($_product),$_product);
    $optionCol->appendSelections($selectionCol);
    $price = $_product->getPrice();

    foreach ($optionCol as $option) {
        if($option->required) {
            $selections = $option->getSelections();
            $minPrice = min(array_map(function ($s) {
                return $s->price;
            }, $selections));
            if($_product->getSpecialPrice() > 0) {
                $minPrice *= $_product->getSpecialPrice()/100;
            }

            $price += round($minPrice,2);
        }
    }
}


texts: Region field is not working on country change

texts: I am facing an issue in magento 2.3.4.Whenever I tried to change country, region field hidden and gives required error. Therefore, Place order is not happening.  If i have not changed country and just fill other fields other fields and click on place order, Then it is working fine.


texts: Adding bundle product to basket - prices are zero

texts:
I know this problem is common, but the answers on the internet has not helped me, so I turn to you.

I'm adding simple products to my basket and that works fine, but I also want to be able to add bundled product, I've come this far (see code below). It adds the products nicely, but the price is not updated properly. If I press update item in the "mini cart" (an ajax cart) or go to the checkout page, it recalculates the prices fine and shows them in the cart and on the checkout page.

I'm thinking, is't a flag that I'm missing, but I cannot seem to figure this bit out.

// Initialize cart
$cart = Mage::getSingleton('checkout/cart');
$cart->init();

// If the items already is in the basket, delete them to avoid duplicates
$cart->truncate();
$cart->save();

foreach($entries as $entry){

    $quantity = $entry->getQuantity();
    $productId = intval($entry->getProductId());
    $product = Mage::getModel('catalog/product')->load($productId);

    // Resetting $params
    $params = [];

    // Setting default params (quantity)
    $params['qty'] = (float)$quantity;

    // If current item is of type bundled product
    if($product->getTypeId() == "bundle"){
         $isBundle = true;

        // Getting all the default options for the product
        $bundled_items = [];
        $optionCollection = $product->getTypeInstance()->getOptionsCollection();
        $selectionCollection = $product->getTypeInstance()->getSelectionsCollection($product->getTypeInstance()->getOptionsIds());
        $options = $optionCollection->appendSelections($selectionCollection);

        /**
         * Looping through and creating the bundled options array for passing
         * the addProduct()
         */
        foreach($options as $option) {
            $_selections = $option->getSelections();

            foreach($_selections as $selection) {
                $bundled_items[$option->getOptionId()][] = $selection->getSelectionId();
                $bundled_items_option[$option->getOptionId()] = $selection->getSelectionQty();
            }
        }

        // Setting all the options for the bundle
        $params['bundle_option'] = $bundled_items;
        $params['bundle_option_qty'] = $bundled_items_option;
        $params['related_product'] = null;
        $params['product'] = $productId;
    }

    /**
     * Don't know why this has to be here, but every tutorial online has
     * it. I think it's because the quantity can be a decimal and there
     * is a difference between countries on how to do that.
     */
    if(isset($params['qty'])){
        $filter = new Zend_Filter_LocalizedToNormalized([
            'locale' => Mage::app()->getLocale()->getLocaleCode()
        ]);
        $params['qty'] = $filter->filter($params['qty']);
    }

    /**
     * Get the product by id
     */
    $product = Mage::getModel('catalog/product')->load($productId);

    // Finally added the product to the cart
    $cart->addProduct($product, new Varien_Object($params));

}

// Set a flag to inform the cart to recalculate cart prices
$cart->getQuote()->setTotalsCollectedFlag(false);
$cart->save();

// Set a flag to indicate, that the cart has been updated.
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);

I have tried to set some flags for allowing the bundle options to be saved, but that did not do the trick. I also tried to add a custom price to the product before adding it to cart, but no luck.

I would be really pleased to get some inputs on how to solve this problem.

I should say, that all my bundled products have a fixed price, that the parent has. All prices on children are zero.

// Ulrik


texts: Override SCP (Simple Configurable Products) Block

texts:
Hi I try to override getAllowProducts() method from Mage/Core/Block/Product/View/Type/Configurable.php with local module to show Out of stock products in configurable attribute dropdown.

I use Magento CE 1.9 and Simple Configurable Products (SCP) extension. Product_View_Type_Configurable class is already overriden by SCP so I rewrite SCP class using depends.

When I activate my module, configurable attribute dropdown and product data desappear from template catalog/product/view.phtml.

Is anybody help for this issue ?

Here is the code of my module :

etc/modules : app/etc/modules/Mycompany_SimpleConfigurableProducts.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mycompany_SimpleConfigurableProducts>
            <active>true</active>
            <codePool>local</codePool>
                    <depends>
                        <Mage_Catalog />
                        <OrganicInternet_SimpleConfigurableProducts />
                    </depends>
        </Mycompany_SimpleConfigurableProducts>
    </modules>
</config>

config.xml in app/code/local/Mycompany/SimpleConfigurableProducts/etc

<?xml version="1.0"?>
<config>
    <modules>
        <Mycompany_SimpleConfigurableProducts>
            <version>1.0.0</version>
        </Mycompany_SimpleConfigurableProducts>
    </modules>
    <global>
        <blocks>
            <catalog>
                <rewrite>
                    <product_view_type_configurable>Mycompany_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable</product_view_type_configurable>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

Configurable.php in /app/code/local/Mycompany/SimpleConfigurableProducts/Catalog/Block/Catalog/Product/View/Type

<?php
class Mycompany_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable extends OrganicInternet_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable{

    public function getAllowProducts()
    {
        if (!$this->hasAllowProducts()) {
            $products = array();
            $skipSaleableCheck = Mage::helper('catalog/product')->getSkipSaleableCheck();
            $allProducts = $this->getProduct()->getTypeInstance(true)
                ->getUsedProducts(null, $this->getProduct());
            foreach ($allProducts as $product) {
                // Get Out of stock simple products
                //if ($product->isSaleable() || $skipSaleableCheck) {
                    $products[] = $product;
                //}
            }
            $this->setAllowProducts($products);
        }
        return $this->getData('allow_products');
    }

}


texts:
(Using magento 1,9).

I have made my own sidebar, with my own custom minicart. The minicart must be able to update the quantity of each product there's in the cart. Below is my code and what i have tried (short version):

<?php $cart = Mage::getModel('checkout/cart')->getQuote() ?>
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
<?php foreach($cart->getAllItems() as $item): ?>

<input type="text" class="minicartQty" name="cart[<?php echo $item->getId() ?>][qty]" id="minicartQty" value="<?php echo $item->getQty(); ?>" />

<button type="submit" name="update_cart_action" value="empty_cart" class="button btn-update"><?php echo $this->__('Update cart'); ?></button>
<?php endforeach; ?>
</form>

But when i hit the update button, it perfectly redirects to the cart, but it has not updated the quantity of the chosen product. Maybe i am missing something here? :)

//Simon


texts: Create custom extra new field in Magento 1.9 admin panel

texts:
I'm trying to add one more one more field to upload aadhaar card image. I tried doing it by adding attribute but it didn't work,

And also I tried to duplicate the below code in /app/code/local/customfolder/Customer/sql/codolin_customer_setup/mysql4-install-0.0.1.php but it didn't work out.

This is the admin panel image I need to add one more field to upload the image

$pCustomerEntityType = $installer->getEntityTypeId('customer');
$pCustAttributeSetId = $installer->getDefaultAttributeSetId($pCustomerEntityType);
$pCustAttributeGroupId = $installer->getDefaultAttributeGroupId($pCustomerEntityType, $pCustAttributeSetId);

$installer->addAttribute('customer', 'upload_pan_image', array(
        'label' => 'Upload PAN Image',
        'input' => 'file',
        'type'  => 'varchar',
        'forms' => array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'),
        'required' => 0,
));

$installer->addAttributeToGroup($pCustomerEntityType, $pCustAttributeSetId, $pCustAttributeGroupId, 'upload_pan_image', 0);

$cAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'upload_pan_image');
$cAttribute->setData('used_in_forms', array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'));
$cAttribute->save();

How can I achieve one more field, same as above?


texts: Magento 1.9.3 Command Line Not Available

texts:
I have a quick question regarding the command line tool seen in Magento 2. I've been using it and it's amazing cool.

However now I'm working on an older version of Magento 1.9.3 and I see there isn't a command line tool. Am I wrong, or is there one? I can't seem to figure it out. I do see however a folder called /shell in my default directory that allows some basic reindexing commands. Is the command line tool a new feature for Magento 2 only?


texts: Edit Data is not coming selected with Ui component grid

texts:
We have created one grid with UI component for our custom module.

Add New, Delete and Mass delete functionality is working fine.

I have also added Edit data functionality.

I can get the data while I am doing print_r which I want to edit but it will not come as selected in UI form.

Do you have any idea how to resolve?


texts:
I received this in my Magento 1.9.2.3 error.log file just one time.
I have been searching and reading but I'm still not sure I have a handle on what this means:

  [11-Feb-2016 08:08:52 America/New_York] PHP Warning:  shell_exec() has
  been disabled for security reasons in /MyServer/public_html/500.php on
  line 13

I see line 13 in 500.php is: echo$fixer;

with line 10-12 being: <?
  echo "URL: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."<br>\n";
  $fixer = "checksuexec ".escapeshellarg($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']);

I see in php.ini the line:

  disable_functions =
  proc_open,phpinfo,show_source,system,shell_exec,passthru,exec,popen

So, I think I get that something in my set-up tried to do something, shell_exec, that this line disallows.

I have no idea how to figure out what tried to do that, and also, I'm not clear if I need to do anything in response to this error at this point.

It has only appeared the 1 time. But once it appears, has that disabled some function that I need to re-enable or respond to in some way or is it just that something in my set-up tried to execute this function, this line in php.ini did not allow it to do it, and that's the end of it at this point?

I'm just trying to understand. If I've left out any details/info, let me know and I will update.

Thanks in advance!!


texts: How to assign a group to user programmatically on registration

texts:
I would like to assign role to users on registration from my module.

I checked the createPostAction() method of Mage_Customer_AccountController class where i found these lines:

$customer->save();
Mage::dispatchEvent('customer_register_success',
    array('account_controller' => $this, 'customer' => $customer)
);

Can i use event/observer ['customer_register_success'] to assign the group?
Should i create an event observer class in my module or there are better approaches?


texts:
i need to override the Mage_Index module to reindex data in a different database. I can't find where can i override the current connection. I need to execute it via shell through "php shell/indexer -reindexall". Anyone could help me?

EDIT (info from comments):

It is needed to get an import of >900000 Products done, where the reindex kills the Shop.


texts: How to make the images in magento visible in local server which are broken state?

texts: I am doing a project in magento.I downloaded all its files and databse onto local server.The images in the website and also in the admin panel is in broken state in local server are in broken state.Can anyone tell a way to fix it ?


texts: I want to add a product with a bunch of options in the current cart via controller. How should I do this? And then what do I need to do if I want to remove it later on?


texts: Moving the checkout progress bar in magento2

texts:
Attempting to move the progressBar within magento's checkout to the header of the page. I thought something simple like creating a move element within checkout_index_index.xml would do the trick however this doesn't seem to work.

<move element="progressBar" destination="header.content" before="-"/>

Any help is appreciated.


texts: Magento 2 custom module - get media base url

texts:
I use this module and I create a image upload field in my custom module. Everything is okay but I want to get the full url of image in the frontend. How I can do this?

if I use this in the Data.php

public function getImageUpload() {
    return $this->scopeConfig->getValue('module/general/image_upload', ScopeInterface::SCOPE_STORE);
}

and this in phtml:

<?php echo  $config->getImageUpload(); ?>

is return only default/image.png in frontend and I need to ger the full path (include store url and media folder). And I don't add that acl.xml in my module because I don't understand very well what is mean. Can be this the problem?

Thank you
    UPDATE: Image.php file

namespace MageVision\Blog4\Model\Config\Backend;
class Image extends \Magento\Config\Model\Config\Backend\Image
{
    /**
     * The tail part of directory path for uploading
     */
    const UPLOAD_DIR = 'blog/post4';
    /**
     * Upload max file size in kilobytes
     *
     * @var int
     */
    protected $_maxFileSize = 2048;

   /**
     * Return path to directory for upload file
     *
     * @return string
     * @throw \Magento\Framework\Exception\LocalizedException
     */
    protected function _getUploadDir()
    {
        return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR));
    }
    /**
     * Makes a decision about whether to add info about the scope.
     *
     * @return boolean
     */
    protected function _addWhetherScopeInfo()
    {
        return true;
    }
    /**
     * Getter for allowed extensions of uploaded files.
     *
     * @return string[]
     */
    protected function _getAllowedExtensions()
    {
        return ['jpg', 'jpeg', 'gif', 'png', 'svg'];
    }
    /**
     * @return string|null
     */
    protected function getTmpFileName()
    {
        $tmpName = null;
        if (isset($_FILES['groups'])) {
            $tmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'];
        } else {
            $tmpName = is_array($this->getValue()) ? $this->getValue()['tmp_name'] : null;
        }
        return $tmpName;
    }
    /**
     * Save uploaded file before saving config value
     *
     * Save changes and delete file if "delete" option passed
     *
     * @return $this
     */
    public function beforeSave()
    {
        $value = $this->getValue();
        $deleteFlag = is_array($value) && !empty($value['delete']);
        $fileTmpName = $this->getTmpFileName();
        if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) {
            $this->_mediaDirectory->delete(self::UPLOAD_DIR . '/' . $this->getOldValue());
        }
        return parent::beforeSave();
    }

the module url: https://github.com/magevision/blog/tree/master/ImageUploadConfigurationField


texts: Magento2: Product that you are trying to add is not available

texts:
I got following error in magento2, Product that you are trying to add is not available .This product is out of stock and in admin we changed the following settings.

"Display Out of Stock Products" as Yes
"Backorders" as Allow Qty Below 0

Thanks


texts: How to trigger an event for select onselect

texts: I have a drop down select options. How to trigger an event when an option is selected.


texts: Magento2 : After enabled the cache home page condition not working on the footer?

texts:
<?php
$objectManagerCms = \Magento\Framework\App\ObjectManager::getInstance();
$cmsPage = $objectManagerCms->get('\Magento\Cms\Model\Page');
if($cmsPage->getIdentifier() == "home"){ ?>
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('home_remains_content')->toHtml(); ?>
<?php  } ?>

I am using the above code on the footer. and the added block is showing on all pages instead of the home page.

Meant on the list and detail page $cmsPage->getIdentifier() is showing Identifier "home" .if after cache refreshed first we are review home page.


texts: How to add other language translation in magneto 2 programmatically

texts:
I have two languages with website one is English and second is danish.
When I add product programmatically into Magento 2. I am adding meta title

Example meta title :plakater på tilbud

By doing

$categoryTra->setMetaTitle($row["meta_title"]);

However its break with special character "å" ,

It only saves the title:plakater p in meta title and skips the words after special character "å tilbud"

Any idea how to handle this?


texts: Can you login an admin user on the front end at the same time, automatically?

texts:
I would like to be able to login admin users to their corresponding frontend accounts when they log in to admin. This is so that internal orders can be placed with people correctly logged in.

I have managed to get the admin login event observer working and from there I have tried to set the default store to the frontend store, then tried to create a frontend session, looking up the frontend user by email, the email address retrieved from the admin user object. I can load customer by email to get an id and nothing complains when I try and make the frontend session.

If I then try and browse the frontend in a different tab I would expect to be 'logged in' but this is not the case.

Does anyone have any ideas on how to do this?


texts: Moving customer account links in magento 2 just like attached picture.... can you please let me know about it better


texts: Magento 1.x How to get customer paid amount in my custom module file?

texts: How to get customer paid amount for the order? i want to validate the Order total amount and customer paid amount. can anyone please help me to solve this. Thanks in advance


texts: How to select Related product random collection Magento 2.1.2

texts:
How to get a random collection of related products, using the below code,

protected function _prepareData()
{
    $product = $this->_coreRegistry->registry('product');
   /* @var $product \Magento\Catalog\Model\Product */

   $this->_itemCollection = $product->getAlsoboughtProductCollection()->addAttributeToSelect(
        'required_options'
    )->setPositionOrder()->setPageSize(3)->addStoreFilter();
    $this->_itemCollection->getSelect()->order('rand()');
    if ($this->moduleManager->isEnabled('Magento_Checkout')) {
        $this->_addProductAttributesAndPrices($this->_itemCollection);
    }
    $this->_itemCollection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());

    $this->_itemCollection->load();

    foreach ($this->_itemCollection as $product) {
        $product->setDoNotUseCategoryId(true);
    }
    return $this;
}


texts: What EXACTLY happens to db tables when I Flush Categories, or Index Products?

texts: Specifically, what tables are created and/or affected by these two actions (re-indexing products or flushing categories), and what visibility elements specifically depend on this.  I.e., what will re-indexing products and/or flushing categories NOT have an effect on?


texts: Recommendation for Free Lazy Loading Extensions Magento 2

texts:
I'm looking for a recommendation for free lazy loading extension that is likely works for Magento 2.2.9 with infortis ultimo theme.

here are some list i found:

  -welt MAGENTO 2 LAZY LOAD PRODUCTS AND IMAGES.

  -bss Magento 2 Lazy Load

  -magezon Magento 2 Lazy Load Extension

  -Magento 2 Image Lazy Load Extension

have anyone try any of them, and recommended or not recommended?


texts: how to remove customer prefix and suffix from paypal and credit card- magento 1.9

texts:
How i can to remove prefix and suffix from heading payment paypal and credit card.

Thanks!


texts: What's the difference between di.xml in the different etc folders?

texts:
Looking at the core Magento2 modules in the vendor folder, I notice that there are di.xml placed in different folders etc/adminhtml/di.xml, etc/frontend/di.xml and etc/di.xml.

The Magento_Cms module itself has di.xml in all 3 different folders!

What's the effect of placing the di.xml in the 3 different folders? How can I know when I should place my di.xml in which folder?


texts: How do I save images properly in Magento?

texts:
I want to show a image in the footer. I saved the image on my own PC. This is how I tried it: <img alt=" Logo" src="C:\xampp\apps\magento\htdocs\media\images\Logo.png" height="16" width="16" />

All I get is a white 16x16 Block


texts: Magento2 info inserted from custom module how to find?

texts:
In the cart page for the products as well as order confirmation mail I get some additional info for example -

Details

vendor name: name

I want to get rid of this text, I have run through most of the pages in the module to find from where it is injected.
also looked into the plugins for the related module, but didn't get any relevant info.

Also I enabled the front-end template and block hints but for that part I don't get an hint.

How I can find the info, I have run out of Idea, how to go about it.


texts: getChild method in a module doesn't seem to refer to a child(?)

texts:
I am using the Meanbee Infinite Scroll module in my project. I have it working for normal category product listings. But now I'm attempting to have it activate on my custom made module.

However I am stumped over line 68 in Script.php:

 66       return (
 67           $block !== false &&
 68           $block->getChild('toolbar') !== false && // <-- This line
 69           $this->_getPagerBlock() !== false &&
 70           $this->_getPagerBlock()->getCollection()
 71       );

There is no xml element that has the name of toolbar. Even in the normal category xml that is working. So what is "toolbar" refering to?

A var_dump($block->getChild('toolbar')); returns false on my page but not on the normal category product listing page.

My XML is as follows (for clarity):

        <block type="mynamespace/mymodule" name="mymodule.view" template="mynamespace/mymodule/view.phtml">
            <block type="catalog/product_list" name="product_list" template="toxicfox/giftfinder/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>

And the core XML (which works with the Infinite Scroll module) is:

        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>

As you can see, neither block of XML has any element with an attribute name of "toolbar". The only difference is line 1.

Any help is appreciated.


texts: Magento 2: Get Product Stock status details in Category List Product details Rest API

texts:
I have checked Category Products list API and gives list of the categories products. But don't get stock item details in products details. I want to need stock item details in products details.

Categories list products default API.

  Method: GET

  Using API URL:
  http://localhost/magentosample230/rest/V1/products?searchCriteria[pageSize]=10&searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=4&searchCriteria[filter_groups][0][filters][0][condition_type]=eq

If any have idea how to get stock item details in Category Products list page using Rest API.

Any help would be appreciated. Thanks!


texts: Magento 2 : How to invoke soap wsdl request for magento2 in Postman?

texts:
When i am giving url in postman using get method.

http://127.0.0.1/magento/2.1/soap/default?wsdl&services=taxTaxRateRepositoryV1

then it showing Consumer is not authorized to access %resources
is there anything which i have to done to see core soap api's of Magento.


texts: magento2 catalogsearch block override layer

texts:
How to override my custom catalogsearch block?
and what is the equivalent class for below in magento2? and how to override in di?

   <catalogsearch>
      <rewrite>
        <layer>Vendor_Module_Block_CatalogSearch_Layer</layer>
      </rewrite>
    </catalogsearch>

My custom catalosearch override is as:

 <preference for="Magento\LayeredNavigation\Block\Navigation" type="Vendor\Module\Block\CatalogSearch\Layer" />

is that correct class?
cause in magento1x , we do by

class Vendor_Module_Block_CatalogSearch_Layer extends Mage_CatalogSearch_Block_Layer {}

But in magento2, thr is no such Layer in CatalogSearch.
Please suggest


texts:
I want to add a warning message on the product page but it's not working if full page cache is enabled.
I'm using the following event

<event name="controller_action_predispatch_catalog_product_view">
        <observer name="product_view_custom_action" instance="My\Module\Observer\Custom"/>
</event>

And in observer execute I have the following

$this->messageManager->addWarningMessage(__('My warning message'));

Is there a method that I could do this to show the warning message every time. Even after the page is cached?


texts: how to display minicart dropdown dialog click at some button in magento 2

texts: I want to display Magento 2 Minicart dropdown dialog box by clicking some button or link in the header. Is that possible using jQuery?


texts: Magento 2 - Prevent customer to see any page before setting the attribute

texts: the community! I'm trying to implement a module that will prevent the customer from doing anything on the website before he'll set the value on the specific page. So until the customer didn't set that value - I want to redirect him only to my custom page. Do any of us implement something like this? Can you share your thoughts and give me an idea of how to move forward on that? I've built everything around that - attributes, page, and other stuff. I just don't know how to exactly prevent the customer to see anything once he logged in.


texts: I have a script that I want to execute directly from URL like www.websitename.com/myscript.php. How can I do that? When I try to run my script i get 404 site. Is there any other way I could execute this script?


texts:
I have to import customers from Magento import customer feature and at the time of import there should be the email sent to customer and template should be registered_no_password so customer can set the password.

Any Idea?


texts: Magento - "created_at" field does not set automatically with the rest of the data

texts:
I have created a module which saves some data into the custom tables. Both tables have "created_at" and "updated_at" fields in them. But when I save the data into any if these tables "created_at" field does not set automatically.

Here is my code:
Sql script:

->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
        'nullable' => true,
    ), 'Created At')
    ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
        'nullable' => true,
    ), 'Updated At')

Model.php

class my_Module extends Mage_Core_Model_Abstract
{
        public function addMyList($customerId, $name)
        {
            $this->setData(
                array(
                    'b2b_customer_id' => $customerId,
                    'name' => $name,
                )
            );
            $this->save();
            return;
        }
}

I have looked into other posts but most of them set this "created_at" filed along with the rest of the data in the function. Which is not what exactly I want because I think Magento should handle it itself.

But please let me know if I am thinking wrong or the code is wrong somehow.


texts: how can I add custom csv customer export and export only email and customer group? I need put this code to the own module.


texts: Check Out In Magento 2 Rest API Using Paypal

texts: How can we check out using the Magento 2 Rest API with the Paypal payment method?


texts:
When i upload a plug-in, i get the error below. At other plug-ins, i get different fatal error. My release is 1.9.2.3 and I cant upload plug-ins.

Fatal error: Class 'SSTech_Ordertracking_Helper_Data' not found in /home/jellysepeti/public_html/app/Mage.php on line 547


texts: In Magento Product Detail Page Pagination, I want to show prev next pagination in Magento 1. How I can do that?


texts: Upgrade Magento 2.4.1-ee to Magento 2.4.2-ee return 404

texts:
I upgraded Magento 2.4.1-ee to Magento 2.4.2-ee and after that, I execute the command for upgrade and deploy.
Commands run successfully. But, the front URL and admin URL return the 404 page.
How to solve it?


texts: Magento 2 - RequireJS config file not importing JS files, no error thrown

texts:
In my requirejs-config.js file placed under [MyModule]/view/frontend, I include all my JS files like this:

var config = {
    paths: {
        "jquery.min": "MyVend_MyModule/js/jquery.min",
        "bootstrap": "MyVend_MyModule/js/bootstrap.min",
        "bootstrap-datepicker": "MyVend_MyModule/js/bootstrap-datepicker.min",
        "bootstrap-select": "MyVend_MyModule/js/bootstrap-select.min",
        "jquery.smoothState": "MyVend_MyModule/js/jquery.smoothState",
        "moment": "MyVend_MyModule/js/moment.min",
        ...
    },
    shim: {
        // 'libname' : ['dependency']
        "bootstrap": [ "jquery"],
        "bootstrap-datepicker": [ "jquery"],
        "bootstrap-select": [ "jquery"],
        "jquery.smoothState": [ "jquery"],
        "moment": [ "jquery"],
        ...
    }
};

My JS files are placed under [MyModule]/view/frontend/web/js and the file names match up, I can assure you.

Okay, so I do bin/magento setup:static-content:deploy and bin/magento setup:upgrade and such. The files are mirrored to /pub/static/... so I know they are there. When I refresh the page, the requirejs-config.js under /pub/static/_requirejs/... includes the content of my config file, so I know that is there as well. However, the javascript isn't being imported into the page, and I can confirm this by refreshing while looking at the Network tab (I am using Chrome). All it imports are the CSS files, which I declare under my layout xml files by:

<css src="MyVend_MyModule::css/bootstrap-select.min.css"/>
<css src="MyVend_MyModule::css/animate.min.css"/>
<css src="MyVend_MyModule::css/famfamfam-flags.css"/>
<css src="MyVend_MyModule::css/magnific-popup.css"/>
...

Those get imported correctly and they are there on the page. However, my JS files are not being imported, even though the files are there under /pub/static and it's in the requirejs-config.js file. Is there something I'm doing wrong? There is no error, which confuses me even more.

I will be posting this on StackOverflow as well, please do not mark as duplicate.


texts: How do I create a configurable product using the REST API v2?

texts:
I am trying to create a configurable product called "Kudos Configurable" with options for the user to select from small green, large green, small orange and large orange.

I have got to the stage where a configurable product has been created via the API using the following JSON in a PUT request to /rest/V1/products/KudosConfig.

    {
      "product":{
        "sku":"KudosConfig",
        "name":"Kudos Configurable",
        "price":30.00,
        "status":4,
        "type_id":"configurable",
        "attribute_set_id":4,
        "weight":1,
        "extension_attributes":{
          "stock_item":{
            "qty":10,
            "is_in_stock":true
           }
         }
       }
     }

The child products have been created using the API using the following JSON for each of 4 items with attributes for size and colour set via the same method.

    {
      "product":{
        "sku":"KudosConfigGreenSmall ",
        "name":"Kudos Configurable Green Small",
        "price":30.00,
        "status":0,
        "type_id":"virtual",
        "visibility":1,
        "attribute_set_id":4,
        "weight":1,
        "extension_attributes":{
          "stock_item":{
            "qty":10,
            "is_in_stock":true
          }
        },
        "custom_attributes":[
          {
            "attribute_code":"kudos_colour",
            "value":"328"
          },
          {
            "attribute_code":"kudos_size",
            "value":"330"
          }
        ]
      }
    }

This is working fine and the products are created with the attributes set correctly.

I had thought the last stage was to use the configurableProductLinkManagementV1 service to link the child products but using a POST request to /rest/V1/configurable-products/KudosConfig/child with the following JSON returns HTTP 400 bad request error.

    {
      "childSku":"KudosConfigGreenSmall"
    }

I am thinking there might be something else I need to do on the parent product but I'm struggling to work out what. Within the catalogProductRepositoryV1 service you can add in an array of configurable_product_options, I've tried playing with this but have only got bad request errors back.

Any light anyone can shed on this would be very much appreciated, already spent way too long on this.

EDIT:

Have now tried adding the configurable_product_options into the configurable product PUT request, this now looks like this.

    {
      "product":{
        "sku":"KudosConfig",
        "name":"Kudos Configurable",
        "price":30.00,
        "status":4,
        "type_id":"configurable",
        "attribute_set_id":4,
        "weight":1,
        "extension_attributes":{
          "stock_item":{
            "qty":10,
            "is_in_stock":true
          },
          "configurable_product_options":[
            {
              "attribute__id":"kudos_colour",
              "label":"Colour",
              "values":[
                {
                  "value_index":340
                },
                {
                  "value_index":341
                }
              ]
            },
            {
              "attribute__id":"kudos_size",
              "label":"Size",
              "values":[
                {
                  "value_index":343
                },
                {
                  "value_index":342
                }
              ]
            }
          ]
        }
      }
    }

When I try this I get a 400 response back with the message:

  Something went wrong while saving option.

Not particularly helpful...

Quick bit of Googling suggests that this is the issue https://github.com/magento/magento2/issues/5580.

Next step is to see if the customer is happy to do the hack on the configurable.php file.

EDIT:
Have now tried changing the configurable.php file but doesn't seem to have made a difference, still getting the same error so stumped again.


texts: How to round the cart total without the decimal values in magento

texts:
I want to show the cart total value as rounded values i.e., if cart total is 12.62 then it should show 13, and if cart value is 12.15 then it should show 12 only in cart. I have done this in Mage/Sales/Model/Quote/Address/Total/Grand.php file collect() method. The code is as follows

public function collect(Mage_Sales_Model_Quote_Address $address)
{
    $grandTotal     = $address->getGrandTotal();
    $baseGrandTotal = $address->getBaseGrandTotal();

    $store      = $address->getQuote()->getStore();
    $totals     = array_sum($address->getAllTotalAmounts());
    $totals     = round($totals);
    $baseTotals = array_sum($address->getAllBaseTotalAmounts());
    $baseTotals = round($baseTotals);

    $address->setGrandTotal($grandTotal+$totals);
    $address->setBaseGrandTotal($baseGrandTotal+$baseTotals);
    return $this;
}

But the issue us that when I place this order using paypal it shows

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

error. How can I resolve this problem. I want to use the rounded value for all the operations. How this possible.


texts: Database -- What are log_url + log_visitor ? Can I truncate them?

texts:
I've to move a 9.8GB database from a live server to local so I can fix stuff without going offline. But, I just noticed that there are

log_url_info     = ~23,039,809 = 2.1 GiB
log_url          = ~22,131,158 = 2.9 GiB
log_visitor      = ~17,249,673 = 2.1 GiB
log_visitor_info = ~17,720,546 = 2.4 Gib

so I have few question about this tables;

1) What info are stored in those tables? What Am I going to lose?

2) Can I truncate them? If yes, can I do it live? Won't it block the system or take too much time?!


texts: 404 not found error while creating custom group and fields in system configuration

texts:
I am trying to create a group and some fields for my custom section under custom tab

Tab and section is getting created.But when i click on the section in the content area it shows 404 not found error

my system.xml file is as follows

<config>
    <tabs>

        <animala translate="label" module="training_animal">
            Training
            <sort_order>1</sort_order>
        </animala>
    </tabs>
    <sections>
        <animals translate="label" module="training_animal">
            <class>seperator-top</class>
            Training

            <tab>animala</tab>
            <frontend_type>text</frontend_type>
            <sort_order>100</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>

            <groups>
                <training_animal_group translate="label">
                    My Custom Group
                    <comment>Some comment about my group</comment>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <training_animal_field translate="label tooltip comment">
                            My Custom Field
                            <comment>Some comment about my field</comment>
                            <tooltip>Field ToolTip</tooltip>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <frontend_type>text</frontend_type>
                        </training_animal_field>
                    </fields>
                </training_animal_group>
            </groups>
        </animals>
    </sections>
</config>

The url of my section is

http://localhost/mage2/index.php/admin/system_config/edit/section/animal/

module config.xml

<modules>
    <Training_Animal>
        <version>0.2.0</version>
    </Training_Animal>
</modules>

            Training_Animal_Block

    <training_animal>
        <class>Training_Animal_Helper</class>
    </training_animal>

</helpers>


texts: Magento 1.8 : Cannot disable cache through cache storage management

texts:
I want to disable all cache storage in Magento.

But, When trying using the Admin Panel Cache Management nothing is disabled.

Is there another way to disable the cache besides the Admin panel?


texts: Magento2: How to modifiy http header of page?

texts:
I am trying to modify HTTP header for current URL. I want to set 410 status if current page header is 404.

below code I used but I have created new controller so it always set 410 for that controller but I want to set for current URL.

    $resultPage = $this->resultPageFactory->create();

    $resultPage->setStatusHeader(410, '1.1', 'Gone');
    $resultPage->setHeader('Status', '410 Gone');

    return $resultPage;

I am not sure which function used to set Http header. Has anyone idea?


texts: Magento1 - tests - phpunit compatibility

texts:
I am currently working on a project (magento 1.9) where tests are developed using PHPUnit 4.8, ECOMDev and TechDivision/magento unit testing (https://packagist.org/packages/techdivision/techdivision_magentounittesting).

Testsuites are running without problems but yeah, PHPUnit 4.x is not supported since a long time now and that's quite annoying : that's why I would like to migrate to a stable PHPUnit version...

Issue : it seems ECOMDev and TechDivision are not maintained anymore and not compatible to newer PHPUnit versions... I tried with last stable (6.x) and with 5.5.7 and I have some troubles to run testsuites...

My question is : Does anyone of you know 1) if it is possible to use last stable/5.x PHPUnit version with ECOMDev &/or TechDivision magento unittesting 2) how to do it if 1) is positive ?

Thanks for your answers/advice :)


texts: How to Rerender a uiComponent (insertForm) after first render?

texts: I have created a uiForm and inserted another UI Form using insertForm. And It is rendered on fieldset open. But after the main form data update, I want to re-render the form. I am not able to re-render the form with updated data and content.


texts:
About the problem: I have problems with magento cron jobs not working properly using default Magento cron settings on Configuration -> System. I have reverted most of the files to previous version because it used to be fine (i just added few comments on files). This problem occured after successfully running for two weeks and it stopped before two ~ three days. This problem is from demo server version while in other hand i have no problem running this on my localhost development version by calling cron jobs manually via 'demoshop.com/cron.php' url. Differences between dev/demo environments is Win/Linux OS.

How it should work On demo server Magento cron job file 'cron.php' executes every minute(by server admin info). It populates cron_schedule table without any problem. It starts by executing its default jobs but it  feels like ''laggy''. For testing purpose I used to delete all default jobs and leave only my jobs and it just happen to pick up in no time without any problem. Now it sits there and nothing happens. I haved checked cron file permissions, added logging when cron file gets executed, added logging when my fuction is called. Cron file gets executed, table is populated, some of the default magento jobs starts but my tasks is never called. I sometimes get 'Too late for the schedule.' error, i tried to increase 'Missed if Not Run Within' Value on magento cron job settings but it sits there anyway and nothing.

On my localhost server as i mentioned it just starts probably instantly when i run cron.php file and goes through without any problems, warnings, errors. Im starting it by running cron.php file. Same code, same database.

My functions takes about 5-10 minutes to execute. It is basically product data update/send functions. Can it be that i have a typo error or something somewhere ? Can it be that Win/Linux OS understand my config files differently(like upper-lower case) and cant find my functions to execute or something ? I do not have any problems on windows. I currently dont have access to demo server SSH and OS processes of course.

Cron settings:

cron_schedule table:

It would be very nice if i get any reference where should i start looking. I will repeat myself that i have no trouble by running it on localhost by executing cron.php file. Magento is community edition.


texts: How extract vat number into page products?

texts:
I want to extract the vat number into product page.

For customer email or customer name I used:

$customer = Mage::getSingleton('customer/session')->getCustomer()
echo $customer->getEmail();

It is working work.

But for vat I used:

echo $customer->getTaxvat();

It is not working


texts: Registration form show blank screen after submit

texts:
when customer put information and click on submit button it show blank screen after refresh it looks fine customer registration complete and take to customer account page,
URL show after submit button
domain.com/customer/account/createpost/


texts:
I need help on how to install SSL certificates. I have a backend developer but he's new to magento. We hang on how to get the certificates installed so we can enable the ssl.

We only need help on the process on how to get the files needed and installing them.


texts: I need some pointers to get started with customizing the frontend of a Magento 2 webshop. I know very litle about this stuff but since we might have a custommer that wants us to make a magento webshop they gave me the task to figure out how Magento works. I tried to do this but that didn't do anything. If you have any good tips, tricks, guides or anything else useful please send it my way.


texts: What is equivalence class for 'Mage_Core_Helper_Http' and 'Mage_Core_Helper_Data' in Magento 2

texts: In Magento 1, I can have return Mage::helper('core')  which is object of Mage_Core_Helper_Data. I wonder what the equivalent class for Magento 2.


texts: Drop Down Multi-select category Ui Component

texts:
I am using this code to create a multi-select category option in a form.
It saves the data in the table correctly but when I try to edit it, it shows the selected category name in the field but doesn't show a checkbox(checked) in the drop down list. Instead It shows the Default Category box checked.

        <field name="category_id">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\Catalog\Ui\Component\Product\Form\Categories\Options</item>
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Category</item>
                <item name="componentType" xsi:type="string">field</item>
                <item name="formElement" xsi:type="string">select</item>
                <item name="component" xsi:type="string">Magento_Catalog/js/components/new-category</item>
                <item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
                <item name="dataScope" xsi:type="string">category_id</item>
                <item name="filterOptions" xsi:type="boolean">true</item>
                <item name="showCheckbox" xsi:type="boolean">true</item>
                <item name="disableLabel" xsi:type="boolean">true</item>
                <item name="multiple" xsi:type="boolean">true</item>
                <item name="levelsVisibility" xsi:type="number">1</item>
                <item name="sortOrder" xsi:type="number">30</item>
                <item name="required" xsi:type="boolean">true</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">false</item>
                </item>
                <item name="listens" xsi:type="array">
                    <item name="${ $.namespace }.${ $.namespace }:responseData" xsi:type="string">setParsed</item>
                </item>
            </item>
        </argument>
    </field>

Here is the screenshot.


texts: Variable widget to ckeditor - url is undified

texts:
So i follow this tutorial -https://github.com/magento/devdocs/blob/master/src/guides/v2.3/ui_comp_guide/components/wysiwyg/extension-points/index.md
But im getting a Uncaught TypeError: Cannot read property 'url' of undefined. Has anyone fixed this bug?


texts:
In my webshop I have two shipping methods, free shipping (for orders above 200 euro) and flat rate shipping (5 euro). I do not have other shipping methods for other countries or something.

I want to show the flat rate shipping if the order is under 200, else the free shipping method. I want to show this in the cart (not the estimate function, but as soon as the user goes to the cart it will see the appropriate shipping).

I created a plugin for the file: vendor/magento/module-tax/Block/Checkout/Shipping.php. This class has a function called displayShipping. This is called from the cart page to check if shipping should be displayed.

I created a before method for this function, so before Magento does the check it executes my function:

$shippingAddress = $this->getQuote()->getShippingAddress();
if (!$shippingAddress->getCountryId()) {
    $this
        ->getQuote()
        ->getShippingAddress()
        ->setShippingMethod('flatrate_flatrate')
        ->setCountryId('NL')
        ->save();
}

Now, shipping cost does show up in the cart, but the shipping amount is set to 0 instead of the 5 euro.

How can I fix this?


texts:
I want to upgrade my Magento store from 2.3.0 to 2.3.2.
I am doing the upgrade thing for the first time.
Can anyone please guide me.


texts: Can't send any email from Magento 2.0 admin panel

texts:
I was tried to send custom email through admin panel but
Not even send email while clicking forget password at admin panel.

So how can i solve this problem.


texts: I was wondering does magento store somewhere 404 requests by default?


texts: How to load image from default skin if image does not exist in custom skin?

texts:
I have a custom skin

/skin/frontend/venedor/myskin/

this skin has a default folder:

/skin/frontend/venedor/default/

I have a css file /skin/frontend/venedor/myskin/css/stlye.css where an image is loaded:

.test { background-image: url(../images/test.png); }

How can I load the fallback image in the default theme (/skin/frontend/venedor/default/) if the image can't be loaded? Is this even possible?


texts: Magento 2: Set product stock programmatically

texts:
I have to setup Product 'in stock' and update Quantity programmatically. Here is my code I am trying:

$product->setData('is_in_stock', 1);
$product->setData('qty', 5);
$product->save();


texts: How can I prevent my cart form being empty after checkout payment failure?

texts:
I want user to keep its shopping cart after payment failure.
Cart becomes empty when cancel the payment transaction in checkout.

How should I change the Failure.php in Magento checkout module?


texts: How to get from orders how many of selected product was sold - programatically?

texts:
Trying to get number of sold product from orders within range of time.
How can I do it ... easiest possible method ?

I can get a whole collection of orders from selected range of time, then get all the items from each order and then loop trough so at the end i'll get what I want but this seems to be a bit complicated and code will be probably quiet big :).
Is this the only way ?


texts: unable to insert images and use wysiwyg properly

texts:
i am working on magento website which is based on magento 1.9.
all of sudden am facing a wierd issue that wysiwyg editor is not working properly as when am trying to insert any image same is not getting inserted and even unable to use editor for other purposes too
request if anyone can please help in this.

url : https://i-ranu.com


texts: add 6x taxes price for a 6-month-product-subscription

texts:
We have gift/subscription where you pay once and get "the bear of the month"
delivered once each month.

It is currently configured as a single product (with a average price),
but the problem is the Delivery tax is added just once on checkout...

Is there a way to add delivery tax multiplier or some way to configure the product such that they get 6x taxes in the checkout ?

(we can not simple include the delivery price in the total because, based on the location the delivery tax may be from 0$ to 30$)


texts: Is there a better way to add layout updates to a category rather than using the "Custom Layout Updates" field?

texts:
Here's the issue in a nutshell; I have a module adding custom templates that can be used for CMS Pages or Categories. The layout I'm using has updates in local.xml referencing the layout_handle declared in the module's config.xml.

If I apply the template to a page, the updates in local.xml work fine. If I apply that same template to a category, the layout updates do NOT work and are ignored.

Here's some of the code so you can get an idea of what I'm talking about:

Module config.xml adding the layouts

<global>
    <page>
      <layouts>
        <tf_homepage translate="label">
          Homepage
          <template>page/homepage.phtml</template>
          <layout_handle>tf_homepage</layout_handle>
        </tf_homepage>
        <tf_categorytoplevel translate="label">
            Category: Top Level
            <template>page/2columns-left.phtml</template>
            <layout_handle>tf_categorytoplevel</layout_handle>
        </tf_categorytoplevel>
      </layouts>
    </page>
</global>

This is the snippet from local.xml doing the updates

<tf_categorytoplevel>
    <reference name="root">
        <action method="setTemplate">
            <template>page/2columns-left.phtml</template>
        </action>
        <action method="addBodyClass"><className>catalog-category-layered</className></action>
    </reference>
    <reference name="product_list">
        <action method="setColumnCount">
            <count>3</count>
        </action>
    </reference>
    <reference name="product_list_toolbar">
        <action method="setDefaultGridPerPage"><limit>12</limit></action>
    </reference>
</tf_categorytoplevel>

As a simple test, when the layout is applied to a CMS page, the body class is added properly and the layout changes. When applied to a Category page, the body class is not added and the layout does not change.

If I add the local.xml snippet to the Custom Layout Updates field on the category page, the Category page shows up the way I expect -- there has to be a better way to do it, though.

I've even tried adding <update handle="tf_categorytoplevel" /> to the Custom Updates Field (also didn't work).

This has been driving me crazy -- Do any of you know a better way to have a custom layout work properly with minimal interaction by the user? I want them to be able to choose the layout and just be done with it.


texts: Magento 2.3.X to 2.4.X Readiness cron check non writable paths that don't exist

texts:
Im having the same problem with the readiness checkup on magento 2.3.5p1 with php 7.3 (can be changed easily if needed on both CLI and webserver).
It gives me a filepath for a subdirectory that doesnt exist For ex: x/public_html/Magento/app/etc/design/frontend/magento
When the documentroot is on the public_html not in the magento folder, this is not defined anywhere so i have no idea where its coming from. Creating the folder manually also doesnt work, permission are correct for other folders, but for some reason it keeps throwing this error


texts: how to call the observer after checkout and store the orderid in my custom collection?

texts:
I want to save the order id and quote id in my custom table(collection).Give me some solution.
My observer function is

public function placeOrderAfter($event) {

        try {

            $order_id = $event->getEvent()->getOrder()->getId();
            $order = Mage::getModel('sales/order')->load($order_id);
            $quote_id = $order->getQuoteId();
           Mage::helper("comp/connection")->updatesaveorder($order_id,$order->getCustomerId());

        } catch (Exception $e) {
            Mage::log($e->getMessage());
        }

}`

after putting this code order is not placed .


texts: How we can add anothere ColumnsControls component in the Grid

texts:
How we can add another ColumnsControls component on the same grid with a different configurations.
I have checked Dev Docs Magento
But there isn't an understandable documentation how to add provider and all settings.
I would like to make ajax request on all checkbox selection on each column.


texts: Allowed memory size exhausted, trying to select specific pages from widget

texts:
I am completely new in Magento and trying to create a widget that will simply display the selected pages on the frontend.
That's what I have for now in my block class:
public function getPages() {

    // 'selectedpages' is a string with page identifiers: 'no-route','cookie-consent',...
    $selectedPages = explode(',', $this->getData('selectedpages'));

    $pages = array();

    foreach($selectedPages as $singleSelectedPage) {
        // Adding a filter
        $searchCriteria = $this->searchCriteriaBuilder
            ->addFilter('identifier', $singleSelectedPage)
            ->create()

        // Putting all the results into array;
        $pages[] = $this->pageRepositoryInterface->getList($searchCriteria)->getItems();
    }

    return $pages;
}

In my template:
<?php foreach($block->getPages() as $pageItem) : ?>
    <?php echo $pageItem ?>
<?php endforeach; ?>

The problem is that once I call for the $pages[] array somehow, it throws me a 500 error stating that Allowed memory size of 2147483648 bytes exhausted (tried to allocate 1474314240 bytes).
My memory limits are set to 2G - in nginx configuration, as well as in php.ini, .user.ini, /pub/.user.ini and in all .htaccess (yeah, I know that nginx won't listen to .htaccess).
Doing memory_usage() shows that I am using only about 12Mb BEFORE calling this array.
Update: Converting $pages[] to $pages solves the problem, but only displays the last page, since this all is inside of the foreach loop.
Where the problem may be?
Kind regards


texts: Running the Magento REST API php example

texts:
I'm trying to run the Magento REST API example for fetching item information. This is the code I have:

<?php
/**
 * Example of products list retrieve using Customer account via Magento REST API. OAuth authorization is used
 */
$callbackUrl = "http://localhost/oauth_admin.php";
$temporaryCredentialsRequestUrl = "http://localhost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://localhost/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://localhost/oauth/token';
$apiUrl = 'http://localhost/magento/api/rest';
$consumerKey = 'mykey';
$consumerSecret = 'mysecret';

session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
    $_SESSION['state'] = 0;
}
try {
    $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
    $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
    $oauthClient->enableDebug();

    if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
        $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
        $_SESSION['secret'] = $requestToken['oauth_token_secret'];
        $_SESSION['state'] = 1;
        header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
        exit;
    } else if ($_SESSION['state'] == 1) {
        $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
        $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
        $_SESSION['state'] = 2;
        $_SESSION['token'] = $accessToken['oauth_token'];
        $_SESSION['secret'] = $accessToken['oauth_token_secret'];
        header('Location: ' . $callbackUrl);
        exit;
    } else {
        $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
        $resourceUrl = "$apiUrl/products";
        $oauthClient->fetch($resourceUrl);
        $productsList = json_decode($oauthClient->getLastResponse());
        print_r($productsList);
    }
} catch (OAuthException $e) {
    print_r($e);
}

Now, when I try to run this example using php <filename>.php, I get the following error:

PHP Notice:  Undefined index: state in /Desktop/magento.php on line 18
PHP Notice:  Undefined index: state in /Desktop/magento.php on line 22

I do not get any other output / errors. What is the problem here? When I try to access Magento using Java / Scribe, I'm able to get the access token. I'm having Magento CE 1.9.

Thanks.


texts:
I have a template file that 'gets' the product url so that I can produce a link to the product. However, the url called is not the SEO friendly version. Can anyone suggest an edit to the code below so that I can get the preferred SEO friendly URL instead?

Current URL

example.com/catalog/product/view/id/419/category/252

Preferred SEO Friendly URL

examples.com/my-product.html

PHTML - My Current Code

<?php $product = $categoryProducts->getFirstItem();?>
 <a href="<?php echo $product->getProductUrl()?>">Product Link
<?php endif;?>


texts: Magento 2 : Need to redirect on custom menu page instead of dashboard after login in admin panel

texts:
I want to redirect on custom page instead of dashboard in magento 2 admin panel.

How to redirect that?

Any help would be appreciated.

Thanks.


texts: Magento 2 : SMTP email not received in LIVE site but working in localhost

texts: Am using this extension for SMTP email- https://www.mageplaza.com/magento-2-smtp/ .This extension work perfectly in my localhost but live site its not working and no email are received for forget password. I am using Magento version 2.2.5 .


texts: Remove item from category collection in Magento 1.9

texts:
I have a category collection in Magento 1.9

This is my code :-

    $categories = Mage::getModel('catalog/category')
    ->getCollection()
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('parent_id', array('eq' => 4))
    ->addIsActiveFilter()
    ->addAttributeToSort('name', 'ASC');
    foreach ($categories as $cat) {

       $category = Mage::getModel('catalog/category')->load($cat->getId());

       $categories->removeItemByKey($cat->getId);
       echo '<pre>';
       //echo $cat->getIsActive();
       print_r($categories->getData());
       exit;
    }

I need to remove the element corresponding to the current categoryId from the collection in the current loop so that when I use the same collection anywhere after the first loop I do not get the same category again.

But when I do $categories->removeItemByKey($cat->getId) it does not work. It does not remove the corresponding id element from the categories collection.

Am I doing something wrong or does removeItemByKey() not work for category collection and I have to do something else.

I am trying to find this for 5 hours but to no avail.


texts: Programatically creating products with custom attributes

texts:
I'm creating a product with a set of attributes using a cli script.

First of I'm setting the session for \Magento\Framework\App\State with setAreaCode('adminhtml') in the constructor. Then calling to a function which will create the product using the following:

public function __construct(
    \Magento\Catalog\Api\Data\ProductInterfaceFactory $productFactory,
    \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
) {
    $this->productFactory = $productFactory
    $this->productRepository = $productRepository
}

public function saveProduct(array $data): void
{
    $product = $this->getProduct($data['sku']);

    $product->setVisibility(self::DEFAULT_VISIBILITY);
    $product->setStatus(Status::STATUS_DISABLED);

    $product->setName($data['name']);
    $product->setSku($data['sku']);
    $product->setPrice($data['price']);
    $product->setAttributeSetId($product->getDefaultAttributeSetId());

    $product->setCustomAttribute('hardiness', $data['hardiness']);
    $product->setCustomAttribute('name_latin', $data['name_latin']);
    $product->setCustomAttribute('store_aisle_table', 1);
    $product->setCustomAttribute('store_aisle', $data['store_aisle']);

    $this->productRepository->save($product);
    $this->productRepository->save($product);
}

private function getProduct(string $sku): ProductInterface
{
    $product = null;

    try {
        $product = $this->productRepository->get($sku);
    } catch (NoSuchEntityException $e) {
        $product = $this->productFactory->create();
    }

    return $product;
}

So first of all the weirdness with using $this->productRepository->save() twice. It appears to me that some data cannot be set before the product exists in the database. e.g. the 'price' field doesn't appear until I've used the save() function twice. However some of the attributes such as 'price' are required and as a result it won't save the first time if this value hasn't already been set.

The trouble is that the values set in the setCustomAttribute() function never appear in the admin.

From what I could discern from the database, once I do the second save() some other extra fields also appear in the database, specifically I was looking at the catalog_product_entity_varchar table, and the dummy values I had assigned to store_ailse had appeared in relation to the correct entity_id, however when I look at the product from the admin panel they don't show up though.

Through some digging it appears that there is a bug in Magento 2.3 with the setCustomAttribute() function, however if I save the fields using the form in Catalog > Products to create a new product these fields get correctly filled in, so how is this form achieving it then.

Any pointers would be appreciated.


texts: Simple query: group by customer & specific product attribute (shirt size) but how?

texts:
we sell shirts. Now I would like to create  quick query that results in the following

customer id | name | email | shirt size (grouped)

I think we can get the orders through collection sales/order_grid_collection

but how can I then add the shirt size that is hidden in the simple products attribute   belonging to the order
and ideally group by customer id + the size (to get a working list)

many thanks, Sean

======================

I now have this code that I am trying to debug ... our table prefix SOF also makes it a little hard

$data->getSelect()->reset()
        ->from(
            array('order_items' => $this->getTable('sales/order_item')),
            array(
                'ordered_qty' => 'soforder_items.qty_ordered',
                'order_items_name' => 'soforder_items.name',
                'vendor' => 'sofattrval.value',
                'base_cost' => '(SUM(soforder_items.qty_ordered) * soforder_items.base_cost)',
                'sku' => 'soforder_items.sku'
            ))
        ->joinLeft(array('p' => 'sofcatalog_product_entity'), 'soforder_items.product_id = p.entity_id')
        ->joinLeft(array('eav' => 'sofeav_attribute'), 'p.entity_type_id = eav.entity_type_id')
        ->joinLeft(array('attr' =>'sofeav_attribute_option'), 'attr.attribute_id = eav.attribute_id')
        ->joinLeft(array('attrval' =>'sofeav_attribute_option_value'), 'attrval.option_id = attr.option_id')
        ->where("sofeav.attribute_code='shirt_size'")
        ->where('parent_item_id IS NULL')
        ->group('soforder_items.product_id')
        ->having('SUM(soforder_items.qty_ordered) > ?', 0)
        ->order(
            array(
                'SUM(soforder_items.qty_ordered) DESC'
            ));


texts: How to tell which layout handle a block method is called from

texts:
I have a little module that compiles JavaScript modules. I want to add a feature so that it compiles JavaScript files that are added to the default handle separately. I want to know if this will make performance better, because the modules common to every page can be cached, and only the modules specific to each page loaded on every request.

The best way I can think of to do this, is to use the same interface (my block has a method addModule), but to somehow work out whether it was called in the default handle or not.

Is this even possible? I feel like it ought to be, but I'm having some trouble knowing where to look, and the internet isn't being entirely helpful in this.


texts: Discount coupon is not working for minimum subtotal

texts:
I have created a new "Shopping Cart Price Rule" for discount coupon of 20% off on minimum shopping cart subtotal of Rs. 2000.
For this I set values as under:
Rule Information

Status: Active
Websites: Main Website
Customer Group: (selected all groups)
Coupon: Specific Coupon
Coupon Code: DWL20
Uses per Coupon: (tried both  and )
Uses per Customer: (tried both  and )
From Date: 8/25/14
To Date: 8/30/14
Priority: (tried both 0 and 1)

See settings image here
Conditions

If ALL  of these conditions are TRUE :

Subtotal  equals or greater than  2000

See settings image here
Actions

Apply: Percent of product price discount
Discount Amount: 20
Maximum Qty Discount is Applied To: 10
(leaved blank "cart items matching" rules )

See settings image here
And here is the output of the cart:

What can be an issue here?


texts: Magento2 How to show wholesale price for product, if customer is logged in as wholesale customer group?

texts:
I have the setup of Magento2 Store. We are using tier pricing for customer groups. So if the customer is associated with the (wholesale group) and logged in, the customer must see the only wholesale price on the product listing page & product details page.

We have the same wholesale price for all sizes, so we need to just pull in the wholesale price for that product.

Please find the screenshot for your reference.

Thanks


texts:
I am trying to process a transaction through code, in some ways it goes fine, but when i actually interact with it from a frontend controller something strange happens:

    var_dump($quoteObj->getSubtotal(), false);

    $ccInfo = array();
    // assign payment method
    if ($payment_method == "authorizenet")
    {
        $quotePaymentObj = $quoteObj->getPayment();
        $quotePaymentObj->setMethod('authorizenet');
        $quoteObj->setPayment($quotePaymentObj);
        $quoteObj->getPayment()->setCcNumber($cc_number);
        $quoteObj->getPayment()->setCcType($this->returnCardType($cc_number));
        $quoteObj->getPayment()->setCcExpMonth($details['expiry-month']);
        $quoteObj->getPayment()->setCcExpYear($details['expiry-year']);
        $quoteObj->getPayment()->setCcLast4(substr($cc_number,-4));
        $quoteObj->getPayment()->setCcCid($details['cvv']);
    }
    else {
        $quotePaymentObj = $quoteObj->getPayment();
        $quotePaymentObj->setMethod($payment_method);
        $quoteObj->setPayment($quotePaymentObj);
    }
    //$quoteObj->collectTotals()->save();
    $quoteObj->save();

    var_dump($quoteObj->getSubtotal());

    $quoteObj->collectTotals()->save();

    var_dump($quoteObj->getSubtotal());exit;

    The results of the var_dumps are as followed:
    string '660.0000' (length=8)
    string '660.0000' (length=8)
    float 0

Any one any idea how collectTotals resets it to 0?
 I have looked in the method, but cannot get a clear answer.

I also followed some advice and started disabling all modules that touch the sales_quote_collect_after, when that didn't work, i also tried to remove the event configs from their xmls, which resulted in the same (meanwhile flushing my caches).

So the result of this problem is that i cannot capture, there is a 0 amount. And even when i don't manually trigger the collectTotals, it is done somewhere else and results in 0.

Any insights, or pointers in the right direction will be appreciated.


texts: How do I clear all tasks queued in the Magento Cron, specifically emails?

texts:
I inherited a Magento project from the previous developer, and the Cron is broken on that server, so no transactional emails are being sent. There are 3-4 months of backed up emails that never sent; if I nuke the old server and migrate to a new instance then it will send 3 months of backed up confirmation and shipping emails. How can I clear all these without sending the emails? The cron_schedule table only has 26 records in it as of right now, all from orders placed today. As I monitor it the records in the table go up and down between about 20 to 30.

Is there any way I can clear all the cron tasks, so when I migrate the project to a new instance I won't spam all our customers with old emails?

Magento 1.9.2.3


texts:
See the following scenario.
I have some custom module that allows the frontend user to perform some actions on some custom entities. (details are not really important).
The request is that an admin should be able to login on the frontend with the customer account (without having the password) and be able to perform those actions for the customer.
Since you cannot use the the frontend session from the backend and I don't want to create a permanent autologin link for frontend since is might be a big security hole this is what I did so far.

add an empty attribute for the customer entity. (let's call it login_key)
add a button in the backend on the customer edit page that redirects to an admin page where a random string is generated and saved in the attribute login_key.
in the same action I redirect the admin to a frontend url like this autologin/index/index/customer_id/7/login_key/ajkshdkjah123123 (value generated in previous step).
at the frontend url, if the customer id and login_key match for a specific customer then I set the customer object in session (as logged in) and delete the login_key so the url won't work in the future.

This seams to work. I mean, I get logged in as the selected customer and the link used for autologin does not work a second time.
The down side is that if 2 admins click on the "autologin" button around the same time, one will fail to login, but this is an acceptable risk.
My main concern is that this may also be a (not that) big security issue. Can someone see something wrong with this approach? or suggest a better one?
Ignore the fact that the customer accounts can be separated by website. This is not important and also can be managed easily.


texts: Question moving from Magento 1.x to 2.x - what to do with extensions

texts:
i am moving from Magento 1.x to 2.x - I have a lot of custom build extensions from which my business is dependent on - without them I can not work...

So, obviously when we are going to migrate to 2.x, these extensions will stop functioning properly...

Is there any possibility to fix these extensions with little recode? Or they must be totally rewritten to work ?

Is there any 3rd party support that would make these extensions work on new Magento version?

Please, help. Thanks.


texts: Send Credit card details to another server after customer enters card details in checkout

texts: How to send credit card details to another url outside of magento and get response token, after customer enters credit card details in checkout page.


texts: forbiden | You don't have permission to access /pub/static

texts:
I have this error:

"Forbidden
You don't have permission to access /pub/static/adminhtml/Magento/backend/en_US/Magento_Ui/templates/collection.html on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."

I run thoses commands on root:

find var vendor pub/static pub/media app/etc -type f -exec chmod u+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod u+w {} \;
chmod u+x bin/magento

then those on bin:

php magento setup:upgrade
php magento setup:di:compile
php magento setup:static-content:deploy
php magento cache:clean

Everything is ok. The issue that after few minutes I have the same error message
"Forbiden..."


texts: "URL key for specified store already exists" when updating an existing product?

texts:
I am getting the above error on a limited number of products, when loading and saving them with this code:

$product = $productRepo->get($_sku);
$product->setStockData(['qty'=>$new_qty,'is_in_stock'=>($new_qty > 0 ? true : false)]);
$product->save();

I can't identify anything unusual with this (simple) product, but of course something must be amiss, has anyone come across this on their site?


texts: Cant Override Bundle Product Xml on Custom Theme

texts:
I have a custom theme in Magento 2.1.7 and I want to override the bundle product xml. I have created the xml in my theme in the following path

  app/design/frontend/{vendor_name}/{theme_name}/Magento_Bundle/layout/catalog_product_view_type_bundle.xml

I have added a line to remove the breadcrumbs but it won't work. The same line although work great if I put it in the same xml in the vendor/magento/module-bundle folder.

I have cleared cache but the problem persists.


texts: Sort products by color in the cart in Magento2

texts:
I have configurable products with virtual variations by color and size.

In the cart, I am trying to arrange them in the order of priority, by configurable parent, then by color, then by size.

In my ovverriden cart template, I am calling the cart items like this :

if ($block->getItemsCount()) {
    if($cartItems = $block->getQuote()->getAllItems()){
        if($confId = $product->getId()){
            $configQty = $v->getQty();
            if($product){
                /* the logic */
            }
        }
    }
}

In the admin "Stores >> Configuratin >> Sales >> Checkout >> Configurable Product Image"  I have activated "Product Thumbnail Itself", to have the individual image Swatches of each virtual Variation.

Could you tell me what I should do in order to get the products collection sorted by 'color', please?

Here is the code that I have in a separate file at the root of my project:

<?php
require __DIR__ . '/app/bootstrap.php';
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SortOrder;
class TestApp
    extends \Magento\Framework\App\Http
    implements Magento\Framework\Api\SearchCriteriaInterface, \Magento\Framework\AppInterface{
    public function __construct(
            \Magento\Framework\App\State $state,
            SortOrder $sortOrder,
            SearchCriteriaInterface $searchCriteriaInterface
    ){
        $state->setAreaCode('frontend'); // or 'adminhtml', depending on your needs
        $this->_sortOrder = $sortOrder;
        $this->_searchCriteriaInterface = $searchCriteriaInterface;
    }
    public function getCurrentPage(){}
    public function setCurrentPage($currentPage){}
    public function getFilterGroups(){}
    public function setFilterGroups(array $filterGroups = NULL){}
    public function getSortOrders(){}
    public function setSortOrders(array $sortOrders = NULL){}
    public function getPageSize(){}
    public function setPageSize($currentPage){}
    protected function getSearchCriteria(){
        $searchcriteriaint = $this->_searchCriteriaInterface;
        $searchcriteriaint->setSortOrders(array($this->getSortOrder()));
        return $searchcriteriaint;
    }
    protected function getSortOrder(){
        $sortorder = $this->_sortOrder;
        $sortorder->setField('color')->setDirection(SortOrder::SORT_ASC);
        return $sortorder;
    }
    public function launch(){
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $cart = $objectManager->get('\Magento\Checkout\Model\Cart');
        // // get quote items collection
        // $itemsCollection = $cart->getQuote()->getItemsCollection();
        // // get array of all items what can be display directly
        $items = $cart->getQuote()->getAllVisibleItems($this->getSearchCriteria());
        foreach($items as $key => $item) {
            $productId = $item->getProductId();
            $_product = $item->getProduct();
            $product = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
            echo 'Type: '.$item->getProductType().'
';
            echo 'ID: '.$item->getProductId().'
';
            echo 'Name: '.$item->getName().'
';
            echo 'Sku: '.$item->getSku().'
';
            echo 'Quantity: '.$item->getQty().'
';
            echo 'Price: '.$item->getPrice().'
';
            echo "
";
        }
        // return $this->_response;
    }
    public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
    {
        return false;
    }
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('TestApp');
$bootstrap->run($app);

Don't hesitate to point out good vs bad practice.

Many thanks!


texts: Magento 2 Stop Product Image Compression

texts:
compression on Magento 2.x is very strong, so that the quality of product images get really bad in Catalog and Product view.

How can i disable or stop product image compression ? currently, Magento 2 have 2 type composition (PGP GD2 & ImageMagick). I want to disable both types.


texts:
I'm trying to add a simple tab to the system configuration in Magento CE 1.8.0.0. It's not showing at all with my code, as follows:

File: app/code/community/Test/Module/etc/adminhtml.xml

<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <test_module translate="title" module="test_module">
                                        <title>Test Tabs Section</title>
                                        <sort_order>999</sort_order>
                                    </test_module>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

File: app/code/community/Test/Module/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Test_Module>
            <version>0.1.0</version>
        </Test_Module>
    </modules>
    <global>
        <helpers>
            <test_module>
                <class>Test_Module_Helper</class>
            </test_module>
        </helpers>
    </global>
</config>

File: app/code/community/Test/Module/etc/system.xml

<?xml version="1.0"?>
<config>
    <tabs>
        <test_module translate="label" module="test_module">
            <label>Test Module</label>
            <sort_order>999</sort_order>
        </test_module>
    </tabs>
</config>

File: app/code/community/Test/Module/Helper/Data.php

<?php
class Test_Module_Helper_Data extends Mage_Core_Helper_Data
{}

File: app/etc/modules/Test_Module.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Test_Module>
            <active>true</active>
            <codePool>community</codePool>
            <depends>
                <Mage_Adminhtml />
            </depends>
        </Test_Module>
    </modules>
</config>

I'm expecting an empty tab in the admin's system configuration section, but nothing shows at all. I have emptied the cache and re-logged several times. What am I doing wrong? Thanks!


texts: After data migration it is happening when i click on any product link in magento 2.2.0?

texts:
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'reference': This element is not expected.
Line: 1309


texts: while call function from another controller " should be compatible with "

texts:
I am trying to call function from other controller . I am using version 2.2.6 . While call it is working properly without arugument. If i send argument it provide error should be compatible with

First controller

<?php
namespace Namespace\Module\Controller\Index;

use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\Context;
use Vendor\Module\Model\ModuleFactory;
use Magento\Sales\Api\OrderRepositoryInterface;

use Magento\Framework\Setup\SchemaSetupInterface;

class Fetchorder extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;
    protected $_orderCollectionFactory;
    protected $_categoryFactory;
    protected $_order;
public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory,
    \Namespace\Module\Controller\Index\Order $order
    )
{

    $this->_orderCollectionFactory = $orderCollectionFactory;
    $this->_categoryFactory = $categoryFactory;
    $this->_order = $order;

    return parent::__construct($context);
}
public function execute($)
{

    $orderCollection = $this->_orderCollectionFactory->create()->addFieldToSelect(array('*'));
    $orderCollection->setOrder('entity_id', 'DESC');
    $orderCollection->setPageSize(10);

    foreach($orderCollection as $order)
    {

    $this->_order->getrecord($order->getId());  // without passing arugument it works.
     }
}

}

Second controller

<?php

namespace Namespace\Module\Controller\Index;

use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\Context;
use Vendor\Module\Model\ModuleFactory;
use Magento\Sales\Api\OrderRepositoryInterface;

use Magento\Framework\Setup\SchemaSetupInterface;

class Order extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;
    protected $_orderCollectionFactory;
    protected $_categoryFactory;
public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory
    )
{

    $this->_orderCollectionFactory = $orderCollectionFactory;
    $this->_categoryFactory = $categoryFactory;

    return parent::__construct($context);
}

public function getrecord($order_id = "") // without order id it call properly
{
    echo "I am in <br/>";
}

}

How do i pass the arugument .


texts: mutli option attribute filter on product collection not working

texts:
I trying to filter a product collection based on an attribute which is a multi-select attribute. here is my code,

$collection2 = Mage::getModel('catalog/product')->getCollection();

$collection2->addAttributeToSelect('name');
$collection2->addAttributeToSelect('manufacturer');
$collection2->addAttributeToSelect('printer_family');
$collection2->addAttributeToSelect($attributeCode);

$collection2->addFieldToFilter(array(
array('attribute'=>'manufacturer','eq'=>$ctname),
));

$collection2->addFieldToFilter(array(
array('attribute'=>'printer_family','eq'=>$value), //this filter is not working
));

the variable $value is retrieved as follows

$product->getAttributeText($attributeCode);

can anyone tell me what i am doing wrong?


texts: Magento 2: How to Show method if not applicable Country Wise?

texts:
I'm using DHL Shipping Method. I have set Show Method if Not Applicable to Yes.

Displayed Error Message will be displayed, when it's applicable.

I would like to show this Error Message by Specific Country.

Example: If it's Singapore then this message will be not displayed. For other countries, it will be displayed.


texts: Magento: Admin login not working for main admin login

texts:
My main admin login is not working though sub-admin are working well.

Error produce: I have created few sites and store views as well as few sub-admin with limited access. I deleted a website from admin and after that admin login display below error message. Other sub-admin can login to admin of site but Main administartor is not able to login to admin.

Error message:

There has been an error processing your request
Invalid website id requested.

  Trace:   0  /app/code/core/Mage/Core/Model/App.php(950):
  Mage::exception('Mage_Core', 'Invalid website...')   1
  /app/code/core/Mage/Core/Model/Store.php(465):
  Mage_Core_Model_App->getWebsite('3')   2
  /app/code/core/Mage/Tax/Block/Adminhtml/Notifications.php(150):
  Mage_Core_Model_Store->getWebsite()   3
  /app/design/adminhtml/default/default/template/tax/notifications.phtml(31):
  Mage_Tax_Block_Adminhtml_Notifications->getWebsitesWithWrongDiscountSettings()   4  /app/code/core/Mage/Core/Block/Template.php(241):
  include('/home/develop/d...')   5
  /app/code/core/Mage/Core/Block/Template.php(272):
  Mage_Core_Block_Template->fetchView('adminhtml/defau...')   6
  /app/code/core/Mage/Core/Block/Template.php(286):
  Mage_Core_Block_Template->renderView()   7
  /app/code/core/Mage/Adminhtml/Block/Template.php(81):
  Mage_Core_Block_Template->_toHtml()   8
  /app/code/core/Mage/Tax/Block/Adminhtml/Notifications.php(196):
  Mage_Adminhtml_Block_Template->_toHtml()   9
  /app/code/core/Mage/Core/Block/Abstract.php(919):
  Mage_Tax_Block_Adminhtml_Notifications->_toHtml()   10
  /app/code/core/Mage/Core/Block/Text/List.php(43):
  Mage_Core_Block_Abstract->toHtml()   11
  /app/code/core/Mage/Core/Block/Abstract.php(919):
  Mage_Core_Block_Text_List->_toHtml()   12
  /app/code/core/Mage/Core/Block/Abstract.php(637):
  Mage_Core_Block_Abstract->toHtml()   13
  /app/code/core/Mage/Core/Block/Abstract.php(581):
  Mage_Core_Block_Abstract->_getChildHtml('notifications', true)   14
  /app/design/adminhtml/default/default/template/page.phtml(55):
  Mage_Core_Block_Abstract->getChildHtml('notifications')   15
  /app/code/core/Mage/Core/Block/Template.php(241):
  include('/home/develop/d...')   16
  /app/code/core/Mage/Core/Block/Template.php(272):
  Mage_Core_Block_Template->fetchView('adminhtml/defau...')   17
  /app/code/core/Mage/Core/Block/Template.php(286):
  Mage_Core_Block_Template->renderView()   18
  /app/code/core/Mage/Adminhtml/Block/Template.php(81):
  Mage_Core_Block_Template->_toHtml()   19
  /app/code/core/Mage/Core/Block/Abstract.php(919):
  Mage_Adminhtml_Block_Template->_toHtml()   20
  /app/code/core/Mage/Core/Model/Layout.php(555):
  Mage_Core_Block_Abstract->toHtml()   21
  /app/code/core/Mage/Core/Controller/Varien/Action.php(390):
  Mage_Core_Model_Layout->getOutput()   22
  /app/code/core/Mage/Adminhtml/controllers/DashboardController.php(43):
  Mage_Core_Controller_Varien_Action->renderLayout()   23
  /app/code/core/Mage/Core/Controller/Varien/Action.php(418):
  Mage_Adminhtml_DashboardController->indexAction()   24
  /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250):
  Mage_Core_Controller_Varien_Action->dispatch('index')   25
  /app/code/core/Mage/Core/Controller/Varien/Front.php(172):
  Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
  26  /app/code/core/Mage/Core/Model/App.php(354):
  Mage_Core_Controller_Varien_Front->dispatch()   27
  /app/Mage.php(684): Mage_Core_Model_App->run(Array)   28
  /index.php(90): Mage::run('', 'store')   29 {main}

How to fix this issue. Urgent help required.