texts:
I have a module that I need to do a php GET action and get some informations from php file. The problem is that the returned value is the Dashboard html.

  Faturamento/Controller/Adminhtml/Ac/Index.php

<?php

namespace PereiraTech\Faturamento\Controller\Adminhtml\Ac;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;

class Index extends \Magento\Backend\App\Action
{

    protected $resultPageFactory;
    public $_storeManager;

    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,

        \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory

    ) {
        parent::__construct($context);
        $this->resultPageFactory = $resultPageFactory;
        $this->resultJsonFactory = $resultJsonFactory;

    }

    /**
     * Load the page defined in view/adminhtml/layout/exampleadminnewpage_helloworld_index.xml
     *
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {

        $params = $this->getRequest()->getParams();

        //Send response to Ajax query
        $data = 200;
        $result = $this->resultJsonFactory->create();
        return $result->setData($data);

    }
}

  Faturamento/view/adminhtml/web/js/form/element/options.js

## Heading ##define([
    'jquery',
    'uiRegistry',
    'Magento_Ui/js/form/components/button',
    'Magento_Ui/js/modal/modal'
], function ($,uiRegistry, select, modal) {
    'use strict';

    return select.extend({

    action: function(){
            var ajaxRequest;
            ajaxRequest = jQuery.ajax({
                url: "faturamento_fat/Ac/Index",
                type: 'GET',
                data: {id : 1, form_key: window.FORM_KEY}, //exemple
                beforeSend: function () {

                }
            });
                //Show successfully for submit message
            ajaxRequest.done(function (response, textStatus, jqXHR) {
                console.log(textStatus);
                console.log(response);
            });

                //On failure of request this function will be called
            ajaxRequest.fail(function (xhr, status, error) {
                console.log(status);
                console.log(error);
                console.log(xhr.responseText);
                //show error
                console.log('rou');
            });
            return this._super();
        },
    });
});

  routes.xml

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


texts:
I managed to develop a custom widget, the problem is that its not displaying in the frontend.

The goal is to add the widget to a static block and then display the block in frontend.

I created the static block and added the widget, for test purposes was added some static text after the widget so to make sure the block is displaying and it does (the static text displays, but the widget content doesn't);

In the Block class in my widget i have the following code.

    class MP_Novidades_Block_Produtos
    extends Mage_Core_Block_Template
    implements Mage_Widget_Block_Interface
{

    public function _toHtml () {
        $_data = $this->getData();
        return "Test";
    }

}

In the layout file - page.xml i added this block.

 <block type="cms/block" name="banners_block" before="-">
            <action method="setBlockId">
                <block_id>banners_block</block_id>
            </action>
        </block>

widget.xml

 <?xml version="1.0"?>
 <widgets>
<novidades_nov type="novidades/produtos">
    <name>Produtos Novidade</name>
    <description type="desc">Cria lista de produtos novidade</description>
    <parameters>
        <hyperlink>
            <required>1</required>
            <visible>1</visible>
            <value>http://www.maispormenos.eu</value>
            URL de ligação
            <type>text</type>
        </hyperlink>
        <button_text>
            <required>1</required>
            <visible>1</visible>
            <value>Ir</value>
            Texto do botão
            <type>text</type>
        </button_text>
        <image>
            <required>1</required>
            <visible>1</visible>
            <value>-</value>
            Imagem
            <type>text</type>
        </image>
    </parameters>
  </novidades_nov>
</widgets>

it's supposed to show that  tag, but it doesnt. What can be the causes for this to happen?

Thanks in advance and happy Magento programming!


texts: Magento2.3.2: How to use top links sign in instead of login popup on proceed to checkout?

texts:
I have disabled the guest checkout. So, the user must be logged in to place the order on my website. Now, when the user tried to checkout by adding the product into cart, the popup is coming for a login/register account.
I don't want to use this popup. I want to use the top links sign in instead of this popup which contains login by using a password.
How to use top links sign in instead of popup on clicking of proceeding to the checkout from cart


texts:
please visit here

click on "Buy Now" button, than you will see "Check" button in cart page.

once you enter the zip code " 560043" and enter "check" button, than you can see its calculating shipping charges

some Jquery code is the reason for this, but i want to know what jquery is there behind this feature


texts:
I am trying to upgrade Magento 2.1.1 to Magento 2.1.9 using following command.

composer require magento/product-community-edition 2.1.9 –-no-update

Following composer.json of root directory.

{
"name": "magento/project-community-edition",
"description": "eCommerce Platform for Growth (Community Edition)",
"type": "project",
"version": "2.1.1",
"license": [
    "OSL-3.0",
    "AFL-3.0"
],
"require": {
    "magento/product-community-edition": "2.1.1",
    "composer/composer": "@alpha",
    "mirasvit/module-search-ultimate": "^1.1"
},
"require-dev": {
    "phpunit/phpunit": "4.1.0",
    "squizlabs/php_codesniffer": "1.5.3",
    "phpmd/phpmd": "@stable",
    "pdepend/pdepend": "2.2.2",
    "fabpot/php-cs-fixer": "~1.2",
    "lusitanian/oauth": "~0.3 <=0.7.0",
    "sebastian/phpcpd": "2.0.0"
},
"config": {
    "use-include-path": true
},
"autoload": {
    "psr-4": {
        "Magento\\Framework\\": "lib/internal/Magento/Framework/",
        "Magento\\Setup\\": "setup/src/Magento/Setup/",
        "Magento\\": "app/code/Magento/"
    },
    "psr-0": {
        "": "app/code/"
    },
    "files": [
        "app/etc/NonComposerComponentRegistration.php"
    ]
},
"autoload-dev": {
    "psr-4": {
        "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
        "Magento\\Tools\\": "dev/tools/Magento/Tools/",
        "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
        "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
        "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
    }
},
"minimum-stability": "alpha",
"prefer-stable": true,
"repositories": {
    "0": {
        "type": "composer",
        "url": "https://repo.magento.com/"
    },
    "mirasvit-ssu": {
        "type": "composer",
        "url": "https://USERID:XXXX@packages.mirasvit.com/"
    }
},
"extra": {
    "magento-force": "override"
}
}

I am getting error as follow.

Any thing wrong while upgrading magento ?


texts:
How can i use authentication token in magento2 API?
because the dynamic generated token not working and giving a permission error and if i use the same token as static then it works. But there is one more issue that i can't use it for long because it is getting expire

I want to update inventory using API in magento2.3 and for that we need to pass token

I am using rest/V1/integration/admin/token for token and passing in rest/V1/inventory/source-items

please guide


texts: Magento 2.2.2 Prodcut quanity, color and sku not displaying under custom tab

texts:
I have created a custom tab on product page and tried to display product attributes under this tab, i am only able to display price only.

I have tried like this

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

<h1>
   <?php echo $product->getData('quantity'); ?>
   <?php echo $product->getData('color'); ?>
   <?php echo $product->getData('price'); ?>
</h1>

Quantity, Color and Sku not displaying


texts: adding Options to drop down attributes via custom code

texts:
I want to add and delete custom options to dropdown product attributes via custom code.

I have created a attribute name say myattrib, what I want to delete all it options and add my custom option how can I  do it?


texts: Magento 2 product save in store "0" instead of store "1" in single store mode

texts:
When I save my product, it saved in store view "0" (admin)
So the modification is not showing in the front-office.
But when I change the price, it directly changed in store view "1".
How can I save this product in store view "1" without change single store view mode ?
PS : I used https://github.com/magento/data-migration-tool for migrate data to 1.9 to 2.3


texts: SOLVED: Magento 2 GET 500 (Internal Server Error)

texts:
I have apache mode enabled, permissions given but im still getting the GET 500 Server error:

SOLUTION AT: Magento CSS Not Loading Error


texts: How to load bundle child product by parent product ID?

texts:
I want to load bundle child products from bundle product parent id in Magento 2.

anyone know how can we achieve this?

Thanks :)


texts: Magento CE 1.9.1.0 greek characters in configurable swatches

texts:
How should we replace common Greek characters for Magento to work on the swatches?
According to what rules should we name each png file in the swatches folder?
Thanks.


texts: Product page tabs section not showing as tabs

texts:
Looking at a stock Luma theme example, the details, more information and reviews section is tabbed

However on my site with Luma enabled, these items are not tabbed. Is there some setting to make them behave as tabs?


texts: Magento 2 : Add product to cart programmatically with custom price

texts:
I want to add product with custom price in cart/checkout only but the original price of product should not get any affect.

So far I've achieved this.I'm adding product programmatically based on some condition. Not using any observer or something I'm just passing product id to my custom controller and adding that product into cart.

public function execute(){
    ....
    $productObj->setData('_edit_mode', true);
    $productObj->setPrice(8000);
    $productObj->setFinalPrice(8000);
    $productObj->save();
    $this->cart->addProduct($productObj, $product);
    ....
    $this->cart->save();
}

Using above function only product original price get changed but not in cart so what can be done to do so?


texts: Display Custom options on right side of image

texts:
You can see text "MEN" & drop-down custom options below image

You can see text "MEN" & drop-down options on right side of image

i want to display "MEN" & drop-down options on right side of image for link1.

i am 100% sure, there is same theme and configuration for both products.


texts:
When I change the status of brands in the leftpanel extension I get this error and it doesnt change the status Line 180 is this code ->load($leftpanelId)

  Fatal error: Call to a member function load() on a non-object in
  /home/thebeau9/public_html/app/code/local/Nextgeni/Leftpanel/controllers/Adminhtml/BrandsController.php
  on line 180

public function massStatusAction()
{
    $leftpanelIds = $this->getRequest()->getParam('leftpanel');
    if(!is_array($leftpanelIds)) {
        Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
    } else {
        try {
            foreach ($leftpanelIds as $leftpanelId) {
                $leftpanel = Mage::getSingleton('leftpanel/leftpanel')
                    ->load($leftpanelId)
                    ->setStatus($this->getRequest()->getParam('status'))
                    ->setIsMassupdate(true)
                    ->save();
            }
            $this->_getSession()->addSuccess(
                $this->__('Total of %d record(s) were successfully updated', count($leftpanelIds))
            );
        } catch (Exception $e) {
            $this->_getSession()->addError($e->getMessage());
        }
    }
    $this->_redirect('*/*/index');
}

Config.xml

<global>
    <models>
        <leftpanel>
            <class>Nextgeni_Leftpanel_Model</class>
            <resourceModel>leftpanel_mysql4</resourceModel>
        </leftpanel>
        <leftpanel_mysql4>
            <class>Nextgeni_Leftpanel_Model_Mysql4</class>
            <entities>
                <brand>

leftpanel_brand

                </brand>
                <treatment>

leftpanel_treatment

                </treatment>
                <ingredient>

leftpanel_ingredient

                </ingredient>
            </entities>
        </leftpanel_mysql4>

        <paypal>
            <rewrite>

                <config>Nextgeni_Leftpanel_Model_Config</config>
            </rewrite>
        </paypal>

        <paypal>

leftpanel.php in model

 class Nextgeni_Leftpanel_Block_Leftpanel extends Mage_Core_Block_Template

 {

 public function _prepareLayout()
{
    return parent::_prepareLayout();
}

 public function getLeftpanel()
 {
    if (!$this->hasData('leftpanel')) {
        $this->setData('leftpanel', Mage::registry('leftpanel'));
    }
    return $this->getData('leftpanel');

}

}

Brand.php in model

<?php

class Nextgeni_Leftpanel_Model_Brand extends Mage_Core_Model_Abstract

{

public function _construct()
     {
             parent::_construct();
             $this->_init('leftpanel/brand');
     }
 }


texts: Convert datetime and timezone to datetime in Magento 2

texts:
How to convert datetime with timezone to datetime. I have tried multiple which are available on PHP blog. But nothing worked out. I am retrieving datetime from MySql query as 2017-01-20T13:59:19+03:00 format. But it shows the time zone separately as +03:00. Actually the correct time is 2017-01-20 16:59:19.

So how can I show the correct time with adding GMT time in the datetime stamp.


texts:
I'm using v1.9. When a customer adds products to cart, it only shows the last 3 (looking to the customer like the other products haven't been added) please could you advise?

see example


texts: Steps to move Magento CE 1.9.x to Magento 2.x?

texts:
What are the potential steps to move from Magento CE 1.9.x to Magento CE 2.x
without any data loss or issues ?


texts: Cannot disable Path Hints for Storefront

texts:
I enabled Template Path Hints for Storefront, though magento administration panel. Then, I tried to disable them, but they are stuck in enabled mode.

I have also tried the following:

php bin/magento dev:template-hints:disable
php bin/magento cache:clean
php bin/magento cache:flush

Path hints are always enabled.

ps. the setting is disabled in all store views


texts: How can I Create custom product sorting on category view page without use of product attribute Magento 2.4.1

texts:
I'm trying this
app/code/Vendore/Sorting/etc/di.xml
<type name="Magento\Catalog\Model\Config">
    <plugin name="config" type="Vendore\Sorting\Plugin\Catalog\Config" />
</type>
<type name="Magento\Catalog\Block\Product\ProductList\Toolbar">
    <plugin name="FilterInToolbar" type="Vendore\Sorting\Plugin\Catalog\Product\ProductList\Toolbar"  />
</type>

app/code/Vendore/Sorting/Plugin/Catalog/Product/ProductList/Toolbar.php
    public function aroundSetCollection(
        \Magento\Catalog\Block\Product\ProductList\Toolbar $subject,
        \Closure $proceed,
        $collection
    ) {
        $currentOrder = $subject->getCurrentOrder();
        $result = $proceed($collection);

        if ($currentOrder == 'mostviewed') {
                $this->_collection->getSelect()
                    ->joinLeft(
                        [
                            'report_event'
                        ],
                        "(report_event.object_id = e.entity_id "
                        . "AND (report_event.event_type_id = 1))",
                        [
                            'view' => "count(report_event.event_id)"
                        ]
                    )->group("e.entity_id")
                    ->order('report_event.view ' . $this->getDirection($subject));
            }
}

It's working in Magento 2.3 but not working in Magento 2.4 with Elasticsearch


texts:
I am trying to get the orders from a few conditions:

1) If order status equals 'betaald' OR 'readyforexport'

2) If payment method equals 'banktransfer' AND order status equals 'pending'

I got the first one working but I need the second one to work aswell.

My code:

$orders = Mage::getModel('sales/order')->getCollection()
->join(
    array('payment' => 'sales/order_payment'),
    'main_table.entity_id=payment.parent_id',
    array('payment_method' => 'payment.method')
)
->addAttributeToSelect('*')
->addFieldToFilter('status', 'payment.method',
    array(
        array('eq', 'betaald'),
        array('eq', 'readyforexport'),
    ),
    array(
        array('eq', 'banktransfer')
    )
)
->addFieldToFilter('created_at', array(
'from'     => strtotime('-1 day', time()),
'to'       => time(),
'datetime' => true
))
->load();

How should my addFieldToFilter be build?


texts:
How to run below linux command in Magento 1 under observer/model?

grep -n 'tracker' test.txt

which can be later used for cron?


texts:
I am new to magento. i have to indexer:reindex pragmatically and i looking for this solution. i found few source but there is no guide how and where i can use this code.
https://magecomp.com/blog/how-to-perform-reindexing-programmatically-in-magento-2/
https://meetanshi.com/blog/reindexing-programmatically-in-magento-2/?unapproved=5643&moderation-hash=53af9c0f74f9daeedd1027c1a93eaf15#comment-5643
can someone please guide me through?


texts:
After installed module we are getting one error message called

  "Error filtering template: You cannot define a correlation name
  'stock' more than once"

Mentioned with below code. Can anyone advise how to solve?

<?php
/**
 * @package Interjar_ConfigurableChildVisibility
 * @author Interjar Ltd
 * @author Josh Carter <josh@interjar.com>
 */
declare(strict_types=1);

namespace Interjar\ConfigurableChildVisibility\Model\ResourceModel\Product;

use Magento\Framework\DB\Select;
use Magento\Catalog\Model\ResourceModel\Product\BaseSelectProcessorInterface;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\CatalogInventory\Model\Stock\Status as StockStatus;
use Magento\CatalogInventory\Model\ResourceModel\Stock\Status as StockStatusResource;

class StockStatusBaseSelectProcessor implements BaseSelectProcessorInterface
{
    /**
     * @var StockConfigurationInterface
     */
    private $stockConfig;

    /**
     * @var StockStatusResource
     */
    private $stockStatusResource;

    /**
     * @param StockConfigurationInterface $stockConfig
     * @param StockStatusResource $stockStatusResource
     */
    public function __construct(
        StockConfigurationInterface $stockConfig,
        StockStatusResource $stockStatusResource
    ) {
        $this->stockConfig = $stockConfig;
        $this->stockStatusResource = $stockStatusResource;
    }

    /**
     * {@inheritdoc}
     */
    public function process(Select $select)
    {
        if (!$this->stockConfig->isShowOutOfStock()) {
            $select->joinInner(
                ['stock' => $this->stockStatusResource->getMainTable()],
                sprintf(
                    'stock.product_id = %s.entity_id',
                    BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS
                ),
                []
            )->where(
                'stock.stock_status = ?',
                StockStatus::STATUS_IN_STOCK
            );
        }

        return $select;
    }
}


texts: How to get data after ajax success in template Magento 1

texts:
I used ajax to get data, everything is fine, but I want to assign data to a php variable and foreach it to create an html select, how do I do it? please help me

My ajax

var contactUrl = '<?php echo $this->getUrl('*/*/getContact')?>';
jQuery.ajax({
    url: contactUrl,
    data: {idAddress: addrId},
    success: function(data) {
         console.log(data);
    }
});

My data


texts: User Login only in Firecheckout possible

texts:
a customer just complaint he cant login.....
When I open the Page and try to Login....it not possible, I will be redirected to the Login Page.
Amazon Login same error.

With Google Login, no Errors.
On Checkout (Firecheckout) login is also possible.....

I already did the Cookie Settings.


texts: Magento 2 - Moving Custom Options under the main image on Product Page

texts:
Greetings Stack community -
I'd like to move the first custom option group under the main image (see image). Separating the options is probably not that simple, so I think that moving the "Options with add-to-cart button" to its own row before the main description tabs will be the solution (then I could just use CSS to style it after).

How would I do this in the catalog_product_view.xml file?

<page layout="2columns-right" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="sidebar.additional">
        <block class="Smartwave\Porto\Block\Template" name="product_view_custom_block" before="-" template="Magento_Catalog::product/view/custom_block.phtml"/>
    </referenceContainer>
    <move element="product.info.stock.sku" destination="product.info.price" after="product.price.final"/>
    <move element="product.info.review" destination="product.info.main" before="product.info.price"/>
    <move element="catalog.product.related" destination="sidebar.additional" after="product_view_custom_block"/>
    <!--<referenceBlock name="catalog.product.related" remove="true"/>-->
    <move element="product.info.overview" destination="product.info.main" after="product.info.review"/>
    <referenceContainer name="after.body.start">
        <block class="Magento\Catalog\Block\Product\View" name="product_custom" template="Magento_Catalog::product/view/product_custom.phtml" before="-"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_config" after="-" template="Magento_Catalog::product/view/config.phtml"/>
    </referenceContainer>
    <referenceContainer name="columns.top">
        <block class="Magento\Catalog\Block\Product\View" name="prev_next_products" template="Magento_Catalog::product/view/prev_next.phtml" before="-"/>
    </referenceContainer>
    <move element="prev_next_products" destination="product.info.main" before="-"/>
    <move element="page.main.title" destination="product.info.main" before="-"/>
    <referenceContainer name="product.info.social">
        <block class="Smartwave\Porto\Block\Template" name="product_view_addthis_links" after="-" template="Magento_Catalog::product/view/addthis.phtml"/>
    </referenceContainer>
    <referenceContainer name="content">
        <block class="Smartwave\Porto\Block\RickSnippet" name="rich_snippet" template="Magento_Catalog::product/view/rich_snippet.phtml" before="-"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_main_custom_block" ifconfig="porto_settings/product/main_custom_block" before="product.info.main" template="Magento_Catalog::product/view/main_custom_block.phtml"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_main_custom_block2" after="-" template="Magento_Catalog::product/view/main_custom_block2.phtml"/>
        <block class="Smartwave\Porto\Block\Template" name="product.clearer" after="product.info.media" template="Magento_Catalog::product/view/clearer.phtml"/>
    </referenceContainer>
    <move element="product_view_main_custom_block2" destination="product.info.main" after="product.info.overview"/>
    <move element="product.info.main" destination="content" after="product.info.media"/>
    <referenceContainer name="columns">
        <block class="Smartwave\Porto\Block\Template" name="side_popup" after="-" template="Magento_Catalog::product/view/side_popup.phtml"/>
    </referenceContainer>
</body>

Thanks in advance for any help.


texts: Getting error: find: missing argument to `-exec' when using cron job to remove temp files

texts:
I am trying to create a cron job that deletes any temp files after certain periods of time.

In crontab I have this:

MAILTO:="my@e-mail.com"
@hourly /var/www/magento/cache.sh

And in cache.sh there is the following:

find /var/www/magento/var/cache/ -type f -mmin +120 -exec rm {} \;
find /var/www/magento/var/session/ -type f -mmin +120 -exec rm {} \;
find /var/www/magento/var/report/ -mtime +7 -exec rm -f {} \;
find /var/www/magento/var/tmp/ -mtime +1 -exec rm -f {} \;

However the e-mail output is this:

find: missing argument to `-exec'
find: missing argument to `-exec'
find: missing argument to `-exec'
rm: cannot remove `/var/www/magento/var/tmp/': Is a directory

I'm quite new to cron jobs, does anybody know what I am doing wrong here?

Thanks in advance :)


texts: Magento 2 Bug | Customer Places Order in Cart, then out of stock when checking out

texts:
On our Magento 2 page we have a bit of customers placing an item in cart (in stock) but when checking out after placing order, it gives an error saying the item is out of stock... but it places the order. No order confirmation success page provided.

Any clue on what this means and how to fix it? It has been a huge issue.


texts: Apply Special Price to SKUs with a Coupon Code?

texts:
We're using Magento 2.34.   We want to set up a shopping cart coupon where customers get a special price for a set of SKUs with different price levels if they enter the correct coupon code at checkout.
Example:

Customer receives an advertisement offering Widget 1 and Widget 2, with a coupon code listed for special pricing.
Widget 1 is normally $42.95.  Coupon should lower the price to $14.95 per unit at checkout.
Widget 2 is normally $19.95.  Coupon should lower the price to $4.95 per unit at checkout.

Three questions:

Is this possible without an extension?
If an extension is needed, which one is required/recommended?
Can this be accomplished with programming?

Thanks in advance for any help you can provide.


texts: How to list handles of each pages in Magento 2.1

texts:
How to list the various handles in a page in Magento 2.1.x.
In Magento 1 this is the code used to get the list of handles :var_dump(app()->getLayout()->getUpdate()->getHandles());.How to use it in Magento 2


texts:
Recently I switched Magento version from 1.6 to 1.9.2.4  since I am unable to place order payment method  by paypal.

If I place order by payment method by cash on delivery it's working well

Error log I found this below:

  2016-12-06T13:36:26+00:00 ERR (3):
  exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '100000001' for key 'UNQ_SALES_FLAT_INVOICE_INCREMENT_ID'' in lib/Zend/Db/Statement/Pdo.php:228
  Stack trace:


texts: How to get applied coupon code amount in the order collection in magento2

texts:
I have applied a coupon code and placed an order.I need that coupon code amount that has been applied from the order collection.

Thanks in advance.

I got the coupon with this piece of line

$order->getCouponPrice()


texts: How should I return a notification message using ajax?

texts:
I have an ajax request and I want to display a notice or an error message. I want to use the addNotice or addError function. This is my code:

$update =  Mage::getSingleton('core/session')->addNotice('Notice message');
$response = Mage::app()->getResponse();
$response->setHttpResponseCode(200);
$json = Mage::helper('core')->jsonEncode($update);
$response->setBody($json);

I know that I cannot add in the jsonEncode the addNotice function message, but is there another way to do that?  I know that I could send a simple message, but i want to use these functions: addNotice and addError.

Thx


texts: Why does magento wait for a request to complete before processing others?

texts:
I have added a script to an admin page on a magento site to initiate a long running process and periodically query the progress using AJAX (or XHR) requests so that it can update a progress bar.

The first request is to the controller function that starts a long running process:

var startfeed = new XMLHttpRequest();
startfeed.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        feedComplete(this);
    }
};
startfeed.open("GET", thisFeedUrl, true);
startfeed.send();

In the code above, the thisFeedUrl variable is the appropriate URL for the following controller action:

public function thistakesalongtimeAction()
{
    very_slow_function();
}

The very_slow_function writes it's current progress to a file, which can be accessed by the following controller action:

public function getprogressAction(){
    $progressFileName = getProgressFileName();
    echo file_get_contents($progressFileName);
}

This controller is accessed by the following javascript:

var feedProgress = new XMLHttpRequest();
feedProgress.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
        progress = JSON.parse(this.responseText);
        // Update progress bar
        setProgress(progress);
    }
};
feedProgress.open("GET", thisFeedUrl, true);
feedProgress.send();

The problem is that the requests for progress do not complete until the long running action has completed. How can I get the progress bar to update correctly while the long running process is incomplete.


texts: I need to get the current local time of the customer's location.  One method is to do it by: Mage::getModel('core/date').   But I need to extract the day number and current time from it, which can be done very nicely by Zend_Date::WEEKDAY_DIGIT and Zend_Date::TIME_SHORT, but the "current time placeholder" for Zend is: Zend_Date::now(); which takes the current time of the server and not the customer.   Is there a way I can use these Zend functions with Mage::getModel('core/date') timestamp, and if not, how do I achieve the same functionality?


texts: How to save data to database in magento 2

texts:
I Need to store form data to database, I follow, model/ResourceModel way,

This below my controller code: SetData() method not working.

<?php

namespace ChennaiBox\CustomerAccount\Controller\Profile;

 class Save extends \Magento\Framework\App\Action\Action
 {
protected $storeManager;
protected $subscriberFactory;
protected $_objectManager;
public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Customer\Model\Session $customerSession,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
    \Magento\Framework\ObjectManagerInterface $objectManager
) {
    $this->storeManager = $storeManager;
    $this->subscriberFactory = $subscriberFactory;
    $this->customerSession = $customerSession;
    $this->_objectManager = $objectManager;
    parent::__construct($context, $customerSession);
}

/**
 * Save newsletter subscription preference action
 *
 * @return void|null
 */
public function execute()
{
    $cutomerEmail =(string)$this->customerSession->getCustomer()->getEmail();
    if ($cutomerEmail === null) {
        $this->messageManager->addError(__('Something went wrong while saving your subscription.'));
    } else {
        try {

               $post = $this->getRequest()->getPostValue();
               $Format = $this->_objectManager->create('ChennaiBox\CustomerAccount\Model\Format');
               $Format->setCustomerid($cutomerEmail);
               $Format->setFormat($post['type']);
               $Format->save();
              $this->messageManager->addSuccess(__('Profile has beem saved successfully.'));

                $this->_redirect('customer/account/');

                return;

            } catch (\Exception $e) {
                $this->messageManager->addError(__('Something went wrong while saving your profile.'));
            }
    }
   $this->_redirect('customer/account/');
}

}

This is my Controller File, I defined Construct for Object manager.

My table name is "email_format" and its have two columns, 1.customerid 2. format,  Magento2 any other way to save data to database?, how to solve this problem?


texts: Incorrect plugin instalation with Magento Connect Manager on v1.9.2.4

texts:
I am testing my plugin on Magento version 1.9.2.4. Installation on Magento Connect Manager seems to be ok but when I try to find it in configuration tab in Admin Panel - it's not there (it works on earlier versions for example 1.9), so I went to directories where it should be installed and I found something strange... Magento changed every php file from my plugin package to empty directories, for example:

  app/code/community/SalesManago/Tracking/Block/Layer.php

It's now a folder with "Layer.php" name and it's empty.

I need to copy everything manually to install it correctly... Does anyone had this problem before?


texts: Bulk import of magento (community 1.8) product images

texts:
I have been working on setting up a new magento store and have found problems when bulk importing images through a csv file. I have set up the dataflow profile for importing images. The products have been importing fine but the images were first giving a ""sku" is not defined error" which was easily fixed but now they are repeatedly giving the two errors "Image does not exist." and "Skip import row, is not valid value "" for field "type"".

I need to add multiple images for each product I have currently been doing this by just adding a new line with the SKU and image path but as no images are uploading I don't know whether this is the correct way to go about it?

Any help would be appreciated.


texts: Magento 2 Product Search REST API Collection Filtering

texts:
I am using product search REST API for listing the products based on the category. Here is my search criteria V1/products?searchCriteria[filterGroups][0][filters][0][field]=category_id& searchCriteria[filterGroups][0][filters][0][value]=4&searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[filterGroups][1][filters][0][field]=status& searchCriteria[filterGroups][1][filters][0][value]=1&searchCriteria[filterGroups][1][filters][0][conditionType]=eq&searchCriteria[filterGroups][2][filters][0][field]=visibility&searchCriteria[filterGroups][2][filters][0][value]=4&searchCriteria[filterGroups][2][filters][0][conditionType]=eq&searchCriteria[pageSize]=10& searchCriteria[currentPage]=1

I am getting the response but in which 'out of stock' products also coming. I need only 'in stock' products. Since it is not an attribute I can't directly filter the collection. Is there any other way to get the response as per my need?


texts:
Hi I have a custom form where in I display configurable products with its options. The form is given validation using:

<form data-mage-init='{"validation": {}}' data-form="quick-view-form" data-role="tocart-form" action="<?php echo $this->getFormActionUrl($bundle->getId()) ?>" name="bundlediscount-option" id="bundle_product_addtocart_form_custom" method="post" enctype="multipart/form-data" class="bundle_product_addtocart_form">

The code for validation is:

The configurable options appear just like it normally does like:

            Color

            <select name="super_attribute[2045][93]" data-validate="{required:true}" id="attribute93" class="super-attribute-select" aria-required="true">

            <option value="">Choose an Option...</option><option value="58">Black</option><option value="65">Orange</option><option value="68">White</option></select>

            Size

            <select name="super_attribute[2045][145]" data-validate="{required:true}" id="attribute145" class="super-attribute-select" aria-required="true" disabled="">
                <option value="">Choose an Option...</option>

            </select>

I have a checkbox and on uncheck I need to remove validation for a particular field. Basically need to toggle validation on checkbox click.

Please help!


texts: magento switching images on both color and type option

texts:
Id like for it to switch image only on color option

<?php foreach($_attributes as $_attribute): ?>

    *<?php echo $this->__($_product->getResource()->getAttribute($_attribute->getLabel())->getData('store_label')); ?>

            <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                <option><?php echo $this->__('Choose an Option...') ?></option>
              </select>

anyone, please?


texts:
I am new to magento and i have researched this issue i am having for enough time to post it here.

My goal is to understand how require-js works with node modules.

Case:

$themeDir = app/design/frontend/<whatever>/<theme_name>

I have `$themeDir/node_modules` installed via npm
I have `$themeDir/require-config.js`

I want to include in all pages node_modules/bootstrap/js/dist/aaa.js
I also want to define node_modules/generic/four/path/bbb.js in $themeDir/Whatever_Module/require-config.js so i can call it within .phtml templates found in Whatever_Module

How would i go about doing such a thing ?
I don't have any specifics but this is a info case that i need to properly understand.


texts: Incompatible argument type error (Magento 2)

texts:
I am new in magento 2.

I am getting this error

    Total Errors Count: 1
Errors during compilation:
    Neo\Pincode\Controller\Index\Index
        Incompatible argument type: Required type: \Magento\Framework\App\Action\Context. Actual type: array; File:
/var/www/html/magento2/app/code/Neo/Pincode/Controller/Index/Index.php

I want to try logs in magento 2 so in my contructor I have added DI for log like this,

the file causing error,

<?php

namespace Neo\Pincode\Controller\Index;

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

    public function __construct(
         \Magento\Framework\App\Action\Context $context,
        \Psr\Log\LoggerInterface $logger, //log injection
    ) {
        $this->_logger = $logger;
        parent::__construct($context);
    }

    public function execute()
    {
        $this->_logger->addDebug('some text or variable');
        $this->_view->loadLayout();
        $this->_view->getLayout()->initMessages();
        $this->_view->renderLayout();
    }
}

Please help, to overcome this issue.


texts: Magento 2 Custom Module Insert Data Issue

texts:
I'm using Magento 2 CE Version 2.1.0

I'm making a custom module. For developing custom module i'm taking reference of Magento CMS Module {folder path}\magento2\vendor\magento\module-cms

I have below code while INSERT data in the database.

{folder path}\magento2\app\code\Custom\Module\Controller\Adminhtml\Posts\Save.php

public function execute() {
    $data = $this->getRequest()->getPostValue();

    $resultRedirect = $this->resultRedirectFactory->create();
    if ($data) {

        $model = $this->_objectManager->create('Custom\Module\Model\Posts');

        $id = $this->getRequest()->getParam('posts_id');
        if ($id) {
            $model->load($id);
        }

        $model->setData($data);

        $this->_eventManager->dispatch(
                'module_posts_prepare_save', ['post' => $model, 'request' => $this->getRequest()]
        );

        try {
            $model->save();
            echo "Done";
            exit;
            $this->messageManager->addSuccess(__('You saved this Post.'));
            $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false);
            if ($this->getRequest()->getParam('back')) {
                return $resultRedirect->setPath('*/*/edit', ['posts_id' => $model->getId(), '_current' => true]);
            }
            return $resultRedirect->setPath('*/*/');
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            $this->messageManager->addError($e->getMessage());
        } catch (\RuntimeException $e) {
            $this->messageManager->addError($e->getMessage());
        } catch (\Exception $e) {
            $this->messageManager->addException($e, __('Something went wrong while saving the post.'));
        }

        $this->_getSession()->setFormData($data);
        return $resultRedirect->setPath('*/*/edit', ['posts_id' => $this->getRequest()->getParam('posts_id')]);
    }
    return $resultRedirect->setPath('*/*/');
}

I have enabled DB Query Log. {folder path}\magento2\var\debug\db.log. Instead of INSERT query, it's executing UPDATE query.

It always print UPDATE query in the log file, so INSERT query is not executing. Don't know what's wrong.

Temporarily i'm doing this, but it's not perfect solution. Issue with INSERT only, Update/Edit is working fine

if ($id) {
    $model->save();
} else {
    // START MANUAL SAVE DATA
    $this->_resources = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Framework\App\ResourceConnection');
    $connection = $this->_resources->getConnection();

    $themeTable = $this->_resources->getTableName('<table_name>');
    $sql = "<INSERT QUERY>");";
    $connection->query($sql);
    // END MANUAL SAVE DATA
}


texts: I want to Validate Max-limit in system configuration field. i have used some of classes for other validation but did not found any class for max or min text limit for system configuration filed.


texts: Magento 2 Character content other than whitespace is not allowed because the content type is 'element-only'

texts:
I am getting below error when switched Magento2 site to developer mode, spent couple of hours looking at xml files and couldn't find one that has issues. I know that one or morexml file(s) have some unwanted characters somewhere but Magento will not give any clues about other than pointing to multiple line numbers in the merged xml that's generated at run time, with the same validation error.

  Character content other than whitespace is not allowed because the content type is 'element-only'

Did anyone run into similar issue since it's not specific to out of box or 3rd party extensions, and based on what I read this can happen to custom extensions as well.


texts: Custom field in payment method section in Magento checkout onpage magento1

texts:
I added a custom field on order level and want to display in payment section remember its not payment method its custom optional field but not showing this is my code

<checkout_onepage_index>
     <reference name="head">
        <action method="setTitle" translate="title"><title>Faq</title></action>
    </reference>
    <reference name="checkout.onepage.payment">
        <block type="core/template"  after="methods" template="customponumber/customponumber.phtml" />
    </reference>
</checkout_onepage_index>


texts: Magento 2: Change DB Name Without affecting core files

texts:
I'm running custom script on my Linux Server.

I don't want that script to affect my current database. Username/Password/Host will be same.

Only DB name is changed. How can I do that without changing in env.php?

// MAGENTO START
include(dirname(__DIR__) . '/app/bootstrap.php');

use Magento\Framework\App\Bootstrap;

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
$deploymentConfig = $objectManager->create('Magento\Framework\App\DeploymentConfig');
$dbName = $deploymentConfig->get('db/connection/default/dbname'); // Get Current DB Name

On server my website is already running. Don't want to affect that. So need to run script for new DB only.


texts: Customer Login to Magento2 without triggering event 'customer_login'

texts:
How to login a user with an E-mail to magento2 site without triggering event customer_login.

Actually, I am able to login with email using customer session but the customer session also triggers the customer_login events.

I don't want to use a trigger.

$customer = $this->_customer->loadByEmail("test@m2s.com");

$this->_customerSession->setCustomerAsLoggedIn($customer);


texts: Trying to override magento-customer layout XML

texts:
I want to override the layout of magento-customer in my theme.

The vendor path is

/vendor/magento/module-customer/view/frontend/layout/customer_account_index.xml

And its code is

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
    <body>
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">My Dashboard</argument>
            </action>
        </referenceBlock>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="customer_account_dashboard_top" as="top"/>
            <block class="Magento\Customer\Block\Account\Dashboard\Info" name="customer_account_dashboard_info" as="info" template="account/dashboard/info.phtml" cacheable="false"/>
            <block class="Magento\Customer\Block\Account\Dashboard\Address" name="customer_account_dashboard_address" as="address" template="account/dashboard/address.phtml" cacheable="false"/>
        </referenceContainer>
    </body>
</page>

Now I am trying to override in my theme,

app/design/frontend/Oneclout/jblashes/Magento_Customer/layout/customer_account_index.xml

and the code is

    <?xml version="1.0"?>
    <!--
    /**
     * Copyright © 2013-2017 Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <update handle="customer_account"/>
        <body>
            <referenceBlock name="page.main.title">
                <action method="setPageTitle">
                    <argument translate="true" name="title" xsi:type="string">My Dashboard</argument>
                </action>
            </referenceBlock>
            <referenceContainer name="content">

                <block class="Magento\Customer\Block\Account\Dashboard\Info" name="customer_account_dashboard_info" as="info" template="account/dashboard/info.phtml" cacheable="false"/>
                <block class="Magento\Customer\Block\Account\Dashboard\Address" name="customer_account_dashboard_address" as="address" template="account/dashboard/address.phtml" cacheable="false"/>
            </referenceContainer>
<block class="Magento\Framework\View\Element\Template" name="customer_account_dashboard_top" as="top"/>
        </body>
    </page>

I just want to override this.


texts: Magento 2 Elastic search results show different relevant results

texts: We are using Magento 2.1.8 and facing issue with elastic search results, it's returning all relevant results instead of exact results.


texts: Working on ajax wishlist- click again to remove product from wishlist

texts:
i am working on magento 1.9.2.4 wishlist, my code successfully adding product to wishlist-

what i do for adding product to wishlist is -

function ajaxWishlist(url,id){
    var messageBox = new Growler();
    url = url.replace("wishlist/index","ajaxwishlist/index");
    url += 'isAjax/1/';
    jQuery('#ajax_loading'+id).show();
    jQuery.ajax( {
        url : url,
        dataType : 'json',
        success : function(data) {
            jQuery('#ajax_loading'+id).hide();
            if(data.status == 'ERROR'){
                console.log(data.messasge)
                messageBox.warn(data.message, {
                    life: 2
                });
            }else{
                messageBox.growl(data.message, {
                    life: 2
                });
            }
        }
    });
}

This code works fine just to add product to wishlist, what i want to achieve is, as soon as the product added to the wishlist, icon for wishlist should change and when clicking on the icon again product should remove from the wishlist.

Even i am getting this scenario but that is after page.

So what i basically want now-

1: Change icon on first click and add product to wishlist.

2: If we again click on the wishlist changed icon product should get removed from wishlist with a notification

What i did so far:

write now i am using if else condition and checking for product in wishlist like this:

<?php if ($this->helper('wishlist')->isAllow()) : ?>
    <?php
    $productId = $_product->getId();
    $customerId = Mage::getSingleton('customer/session')->getCustomerId();
    $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true);
    $collection = Mage::getModel('wishlist/item')->getCollection()
        ->addFieldToFilter('wishlist_id', $wishlist->getId())
        ->addFieldToFilter('product_id', $productId);
    $item = $collection->getFirstItem();
    $hasProduct = !!$item->getId();
    ?>
    <?php if ($hasProduct == 1){ ?>
        <?php
            $_wishlistItem = Mage::getModel('wishlist/item')->loadByProductWishlist(
                $this->helper('wishlist')->getWishlist()->getId(),
                $_product->getId(),
                $_product->getStoreId()
            );
            $_wishlistRemoveUrl = $this->helper('wishlist')->getRemoveUrl($_wishlistItem);
        ?>
        <a title="<?php echo $this->__('Remove Product from Wishlist?') ?>" href="<?php echo $_wishlistRemoveUrl ?>" class="link-wishlist link-wishlist-remove fill">
            <img src="<?php echo $this->getSkinUrl("images/wishlistico_fill.png") ?>" class="img-responsive"/>

    <?php }else{ ?>
        <a title="<?php echo $this->__('Add to Wishlist') ?>" href="#" onclick='ajaxWishlist("<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>","<?php echo $_product->getId()?>");return false;' class="link-wishlist">
            <img id="wishlist_img" src="<?php echo $this->getSkinUrl('images/productWishList.png');?>" class="img-responsive"/>

    <?php } ?>
<?php endif; ?>

please help me out in the function to achieve the same..


texts: Get All Items in cart (Vendor Marketplace Extension)

texts:
I am using the VnEcoms Magento Marketplace Extension for my project
Now I want to get all the items in the cart (all vendors' items together)
I tried all the possible ways
$cart = Mage::getModel('checkout/cart')->getQuote()->getAllItems();

and
$cart = Mage::getModel('checkout/cart')->getQuote()->getItemsCollection();

and
$cart = Mage::getModel('checkout/cart')->getQuote()->getAllVisibleItems();

But when I put them in a foreach() and var_dump() the data, it says it's empty. The same code works for a fresh install of Magento. So my guess is the extension somehow changes the default magento quote.
So what is the best way to get all items in the cart, in my case?

EDIT
After doing some research I found out that the VnEcoms extension generates individual quotes for each vendor. We can get the combined list of items in the cart like this
public function getCartItems(){
    $quotes = Mage::getSingleton('vendorscheckout/session')->getQuotes();
    $allCartItems = array();
    foreach ($quotes as $quote) {
        $cartItems = $quote->getAllItems();
        array_push($allCartItems, $cartItems);
     }
     return $allCartItems;
}


texts: Update Text in credit memo email template

texts:
app\design\frontend\Theme\name\Magento_Sales\templates\email\creditmemo\items.phtml

Below script showing total related details in refund email template.

<tfoot class="order-totals">
 <?= $block->getChildHtml('creditmemo_totals') ?>
</tfoot>

How can i change text Grand Total to Refund Total?


texts: Weird behaviour of Mage::app()->getStore() in multistore configuration

texts:
In multistore magento1.9.x configuration (two stores in this case) , when I call Mage::app()->getStore()->getStoreId() , from a module's controller, it always return store Id of the store having smallest store Id.

Things that I tried:

Execute controller from https://<STORE_1_BASE_URL>/ and https://<STORE_2_BASE_URL>/.
Disabled store view of store 1 and modified index.php to redirect all request to store 2.

$_SERVER["MAGE_RUN_CODE"] = $STORE_2_CODE;
 $_SERVER["MAGE_RUN_TYPE"] = $STORE_2_TYPE;

So what is the default behaviour of Mage::app()->getStore()->getStoreId()?


texts:
I just downloaded modman using the installer script. It's now located in
/home/user/bin/modman
My root is
/home/user/html

I've tested it and I can view help and tutorial but I'm feeling special right now because I'm not exactly sure how to proceed from here.

I'm not sure if init is used to tell modman where magento root is or where the modules will be.

Then when you actually want to install I'm not sure if I'm supposed to use link or deploy.
And if I want to remove a module the remove command says deletes files so would that be used if I had installed using --copy instead of link/deploy

How else would you uninstall and remove the synlinks that were created?

Thanks


texts:
I was trying to add custom routes.
There is my di.xml:
(app/code/Aty/TestTask/etc/frontend/di.xml)

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="testTask" xsi:type="array">
                    <item name="class" xsi:type="string">Aty\TestTask\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">10</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

there is my controller:
(app/code/Aty/TestTask/Controller/Router.php)

<?
namespace Aty\TestTask\Controller;

class Router implements \Magento\Framework\App\RouterInterface
{
    protected $actionFactory;
    protected $_response;

    public function __construct(
        \Magento\Framework\App\ActionFactory $actionFactory,
        \Magento\Framework\App\ResponseInterface $response
    )
    {
        $this->actionFactory = $actionFactory;
        $this->_response = $response;
    }

    public function match(\Magento\Framework\App\RequestInterface $request)
    {
        Logic is here
    }
}

And there is my route.xml:

<?xml version="1.0"?>

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

But when I open any page I see

  Class Aty\TestTask\Controller\Router does not exist.

Where is my fault?


texts: Adding extra fields to newsletter_subscriber table not work

texts:
I try to add a type(extra field) to newsletter_subscriber table.

Following is my approach to add the field.

1.Add new column to newsletter_subscriber table(types)

2.Add types check box to subscribe.phtml file

3.Create an observer for newsletter_subscriber_save_before event

My Config.xml file is

<?xml version="1.0"?>
<config>
<modules>
    <Wired_Newsletters>
        <version>0.1.0</version>
    </Wired_Newsletters>
</modules>
<global>
    <models>
        <newsletters>
            <class>Wired_Newsletters_Model</class>
        </newsletter>
    </models>
    <events>
        <newsletter_subscriber_save_before>
            <observers>
                <newsletters_add_types>
                    <class>newsletters/observer</class>
                    <method>newsletterSubscriberSave</method>
                </newsletters_add_types>
            </observers>
        </newsletter_subscriber_save_before>
    </events>
 </global>

My observer.php file(\app\code\local\Wired\Newsletters\Model)

<?php
class Wired_Newsletters_Model_Observer extends Varien_Event_Observer
{
public function newsletterSubscriberSave($observer){
    $subscriber = $observer->getEvent()->getSubscriber();
    $types = Mage::app()->getRequest()->getParam('types');

    $subscriber->setTypes($types);
    //$subscriber->save();
    return $this;
    }
}

Did i miss any steps or my approach is wrong and please advice me how can i check the process is in the relevant observer?
Is there any alternative solution add an extra field to  newsletter_subscriber table?


texts: Show custom image if it exist else show different image

texts:
I'm trying to show a custom image and if it doesn't exist to show the regular image and not a placeholder.  No matter what I try so far I get image not found exception error. Here is one of my attempts:

    <?php $product = Mage::registry('current_product'); ?>
    <?php $custom_image = $this->helper('catalog/image')->init($product, 'custom_image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE); ?>
    <?php $regular_image = $this->helper('catalog/image')->init($product, 'image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE); ?>
    <?php if ($custom_image != ''): ?>
    <?php echo $custom_image; ?>
    <?php else: ?>
    <?php echo $regular_image; ?>
    <?php endif; ?>

As long as there is a image it works.


texts:
I am facing issue import Magento stock source importing. please check the snapshot

  Upload CSV:

  https://prnt.sc/ranqvc

and getting error snapshot:

  https://prnt.sc/ranr13

Below my CSV format please help me how to solve the issue thanks in advance

  Please check my CSV:
  https://drive.google.com/file/d/1FXhgtGK5sFo9kIXnQUKjKJ_LvHX0SLWu/view?usp=sharing


texts: extension installing after not showing admin panel

texts:
Extension installing ..it's ok...
But not showing admin panel( ↓ img and my error log)

  2016-01-12T05:50:22+00:00 ERR (3): Warning: simplexml_load_string():
  Entity: line 9: parser error : Extra content at the end of the
  document  in /var/www/html/magento/includes/src/__default.php on line
  29213

  2016-01-12T05:50:22+00:00 ERR (3): Warning: simplexml_load_string():
  <reference name="left">  in
  /var/www/html/magento/includes/src/__default.php on line 29213

  2016-01-12T05:50:22+00:00 ERR (3): Warning: simplexml_load_string(): ^
  in /var/www/html/magento/includes/src/__default.php on line 29213


texts: Magento check if customer logged in multistore

texts:
I have Magento 1.9.2.4 CE installed in one of my client's site which is multistore site.

Now I have following code in header file for checking whether a customer is logged in or not using session model and showing appropriate login/logout links as per condition.

<?php
                foreach($_storeArr as $store):
                    $storeBaseUrl = Mage::app()->getStore($store['id'])->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
                    $helper = Mage::helper('customer');
                    $custSession = Mage::getModel('customer/session'); ?>

                        <?php if ($custSession->isLoggedIn()): ?>
                            <a href="<?php echo $storeBaseUrl.'customer/account/logout'; ?>"><?php echo $this->__('Logout ').$store['name']; ?>
                        <?php else: ?>
                            <a href="<?php echo $storeBaseUrl.'customer/account/login'; ?>"><?php echo $this->__('Login ').$store['name']; ?>
                        <?php endif; ?>

<?php endforeach; ?>

But I want to show both store's login links such that if a customer is logged in any store it would show logout link only for that store.

Right now it shows logout link for both stores, even if a customer is logged in any store.

Can anyone guide on this ?


texts: Magento 2.3.4 How to replace "Main Website Store" with my store name in the order confirmation email

texts: How do I change the text of the order confirmation email to our store name from Main Website Store? The answers that were already posted on SO are for Magento 1.


texts: Magento 2: DHL API Hong Kong Address Issue Due to Quote Session

texts:
When we put Hong Kong Address as shipping. Hong Kong address is saved properly. For some time we face this issue, that it's not displaying Shipping Fee.

City as as Hong Kong.

It's already in the Cart & Quote Session may be.

Request

<?xml version="1.0" encoding="UTF-8"?>
<p:DCTRequest xmlns:p="http://www.dhl.com" xmlns:p1="http://www.dhl.com/datatypes" xmlns:p2="http://www.dhl.com/DCTRequestdatatypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com DCT-req.xsd ">
   <GetQuote>
      <Request>
         <ServiceHeader>
            <SiteID>****</SiteID>
            <Password>****</Password>
         </ServiceHeader>
      </Request>
      <From>
         <CountryCode>SG</CountryCode>
         <Postalcode>666666</Postalcode>
         <City>SINGAPORE</City>
      </From>
      <BkgDetails>
         <PaymentCountryCode>SG</PaymentCountryCode>
         <Date>2016-12-21</Date>
         <ReadyTime>PT0H00M</ReadyTime>
         <DimensionUnit>CM</DimensionUnit>
         <WeightUnit>KG</WeightUnit>
         <Pieces>
            <Piece>
               <PieceID>1</PieceID>
               <Weight>5</Weight>
            </Piece>
         </Pieces>
         <PaymentAccountNumber>610461741</PaymentAccountNumber>
         <IsDutiable>Y</IsDutiable>
      </BkgDetails>
      <To>
         <CountryCode>HK</CountryCode>
         <Postalcode />
         <City />
      </To>
      <Dutiable>
         <DeclaredCurrency>SGD</DeclaredCurrency>
         <DeclaredValue>130.00</DeclaredValue>
      </Dutiable>
   </GetQuote>
</p:DCTRequest>

Response

<?xml version="1.0" encoding="UTF-8"?>
<res:DCTResponse xmlns:res="http://www.dhl.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com DCT-Response.xsd">
   <GetQuoteResponse>
      <Response>
         <ServiceHeader>
            <MessageTime>2016-12-21T11:19:08.434+01:00</MessageTime>
            <SiteID>****</SiteID>
         </ServiceHeader>
      </Response>
      <Note>
         <Condition>
            <ConditionCode>3021</ConditionCode>
            <ConditionData>The destination country HK location postal code  or City  is invalid. Please check the destination country location details.</ConditionData>
         </Condition>
      </Note>
   </GetQuoteResponse>
</res:DCTResponse>

So in Hong Kong we don't have Zip Code. But we have put City & it's saved in Magento DB, but it's not passing to DHL API

By clicking on Shipping Address it's calling this AJAX Request

domain.com/rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id

There is something issue with Quote Session, because it's not passing needed info to DHL API

[UPDATE]

magento/vendor/magento/module-dhl/Model/Carrier.php

In _buildQuotesRequestXml()

$nodeTo->addChild('City', $rawRequest->getDestCity());

It's not getting value. It always blank for ANY country's city.

It's sometime showing DHL Shipping Fee & sometimes not. It's annonying. Hard to find what's going wrong.

Magento is saying issue is solved in Developer Branch.

https://github.com/magento/magento2/issues/3789

MAGETWO-55117

How to get fix & apply for now?


texts: I'm looking for the exact point in the codebase where Magento decreases the quantity of a product after payment. I have noticed that it happens after payment authorize and not capture, if I am correct.


texts: Mage::helper('catalog/category'); not displaying all categories

texts:
This was already asked in this thread but didn't get a correct response.

I also did the two answers in the previous thread.

I need Mage::helper('catalog/category'); to display all categories, not just those that have "Include in Navigation Menu" checked.


texts: Payment Method: Checkout convert price to cryptocurrency via API

texts:
I am trying to make a payment module via cryptocurrency.

I want to show in the success (final) page ( checkout ) the amount of crypto that clients needs to pay.

I have embedded the api and I call it with curl.

What directories should I add ? How the conversion is made?

Thank you in advance


texts:
First i make the custom module to add custom button in Order View page and its successfully added. Now i want to get the Current Order ID at my Custom Module Page. Please guide me how can i get the Current Order ID.

Basically i want to take the current order id by using query string to my next page.

Please let me know how can i get the order id at my next page?

code

addbuttoninorder($event) {
     Mage::log("adadadasd");
     $block = $event->getBlock();
     $url = "exportleftovers.co/leopardmagento/…;;
    if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
    $block->addButton('change_status', array(
      'label' => Mage::helper('sales')->__('Leopard TN New'),
      // 'onclick' => "confirmSetLocation('{$message}','{$block->getUrl('modulename/path/')}')",
      'onclick' => "window.open('".$url."')", 'class' => 'go' ));
  }


texts: How to create Declaration page in admin control panel

texts:
Am using magento 1.9 in sales>order am creating a custom url for Declaration, following image will explain you

Here am creating a link for Silver Exchange Declaration. This url like this

  http://127.0.0.1/ramesh/sliver-exchange/index.php/admin/sales_order/declaration/order_id/293/key/5589e8a0b2c3c3c5f1bd6decddfbfd05/

This my query how to create declaration page inside admin>sales>order


texts:
Magento usually offers a number of shipping options which I can choose from. In my case however, there are two shipping options (let's say standard and premium), but each one of those has sub-options if you will (for example my shop will take the packaging back if you pay an additional few bucks).

I'm thinking of something like the following:

[radio] standard - 59
[radio] premium - 79

[checkbox] take back the packaging please - 12
[checkbox] insure my package - 24
[checkbox] also, please come with two people and bring the product where I want it - 29

How can I add checkboxes to my shipping options for additional services? Is there a module for this / can I write a module for this myself without rewriting half of Magento's code base?


texts: Magento 2 Category list API with layered navigation

texts:
Is there any API we can get category product listing with Layered Navigation.

I want to use in Mobile Application.

Thanks,


texts: Uncaught TypeError: value.map is not a function in Magento 2.1.9

texts: I am getting loader spinner, am unable to edit some Cart price rule promotions, some of the old promotions are able to edit some of the unable to edit.


texts: How to create advanced custom product options in general?

texts:
It should be created a shop for eyeglasses. Therfore I want to create a product for each glasses frame and need to ask the customer for special details depending on his prescriptions.

The following dropdowns are required for each glasses frame:

The Sphere for the right eye (float values between -14.00 and +9.00 in steps of 0.25)
The Sphere for the left eye
The Cylinder for the right eye
The Cylinder for the left eye
The Axis for the left eye
The Axis for the right eye
Maybe some more...

I think advanced products will not do the trick because it makes no sense to create the glasses like i would do it with t-shirt colors for example. I have no stock of glasses, every glass will be created on request by the store owner.

I don't want to create the options for every new product manually in admin section.
It should be something like a product type glasses which implements these options.

I did some experiments with custom Input types based on this tutorial: http://magento.ikantam.com/qa/custom-input-types-custom-options

The questions are:

Is it the right way to use custom option types for that?
If not, what is the right way?
Is it possible in general to create one custom option type which results in 6 dropdowns with 6 possible values (maybe store it as serialized array in db) or do i have to create 6 custom option types?
Do you have further ideas or experience in extending magento like this?

I know the question is maybe too general and very basic. I am new to magento and cannot find anything about advanced options in the docs. Hope it is the right place here to ask this.

Thank you very much.


texts: Customizing a product page using view.phtml doesn't pull images

texts:
I am trying to create a custom product page layout inside of a CMS page. I have duplicated my view.phtml and called it view2.phtml. On the CMS editor, I have called for:

{{block type="catalog/product_view" product_id="2279" template="catalog/product/view2.phtml"}}

When I view the page, it pulls in the H1 and the description of the product but not the images. It is referencing the same media file that would pull in the flexslider images as the normal view.phtml, which work perfectly.

One would think it should be displaying the product page exactly like its carbon copy, view.phtml -- no?


texts: Payment interface extension attribute not saved in order table

texts:
I am trying to add an extension attribute in the Payment API. but value not saved in sales_order table.

etc/extension_attributes.xml

<extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="comment" type="string"/>
 </extension_attributes>

etc/di.xml

<type name="Magento\Checkout\Api\PaymentInformationManagementInterface">
        <plugin name="order_comments_save-in-order" type="Custom\Module\Plugin\Checkout\PaymentInformationManagementPlugin" sortOrder="10"/>
</type>

Plugin/Checkout/PaymentInformationManagementPlugin.php

class PaymentInformationManagementPlugin
{

    protected $orderRepository;

    public function __construct(
        \Magento\Sales\Api\OrderRepositoryInterface $orderRepository
    ) {
        $this->orderRepository = $orderRepository;
    }
     public function aroundSavePaymentInformationAndPlaceOrder(
        \Magento\Checkout\Api\PaymentInformationManagementInterface $subject,
        \Closure $proceed,
        $cartId,
        \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
        \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
    ) {
        $result = $proceed($cartId, $paymentMethod, $billingAddress);

         if($result){
            $orderComment =$paymentMethod->getExtensionAttributes();
             if ($orderComment->getComment())
               $comment = trim($orderComment->getComment());
           else
               $comment = '';
            $orderComment->setComment($comment);
         }

        return $result;
    }
}

The above code is not working.


texts: Making lastname & email optional, when creating a customer through the admin panel?

texts:
I'm working on my very first Magento project, in Magento 1.9.2.2. However I have a problem, because my client would like to be able to create customers in the Magento administration panel, without being forced to type in lastname and email, whenever he himself creates a new customer. How can I achieve this?

I found this link: http://www.douglasradburn.co.uk/how-to-make-last-name-optional-in-magento-1-9/

But I'm not sure that this will also apply for my problem, since my problem is related specifically to the administration panel.

Would be very grateful, if someone could provide me with a comprehensive guide as to how I would achieve customer creation without lastname & email being required.


texts:
Recently I changed media storage from db to files via System > Configuration > System and synchronized.

It finished successfully but seems to have reverted back to saving product images in the database.

Do I also have to change <session_save><![CDATA[db]]></session_save> to <session_save><![CDATA[files]]></session_save> in app/etc/local.xml as well?


texts: Mock dependencies in Magento 2 integration tests

texts:
Suppose the following scenario:

I have a class that makes calls to an external service
The class implements an interface and is defined as preferred implementation for this interface in di.xml
A block receives this interface as constructor parameter
I want to test a Magento request in an integration test that uses this block

I don't want to actually call the external service, so I would like to mock that class and wonder what's the best way to do so.

I know that you can define DI preferences on the fly with

$objectManager->configure(
    ['preferences' => [TheInterface::class => MockClass::class]]
);

but this requires defining a mock class MockClass yourself, I cannot use a PHPUnit mock object.

This works okay if the injected class is a factory because I can create a mock factory that creates the actual mock object.

But is this the only way or am I missing something?

Update:

The suggested method

$objectManager->addSharedInstance($mock, TheInterface::class);

looked good first, but only worked as long as there were no preferences defined. These take precedene over shared instances.

I tried to dynamically remove the preference:

$this->objectManager->configure(
    ['preferences' => [TheInterface::class => null]]
);

But unfortunately Magento calls ltrim($to, '\\') on the argument, which converts it to an empty string. This results in:

  ReflectionException: Class  does not exist


texts: updateAttributes on quantity & stock availability

texts:
I have created a custom attribute which allows me to disable products that have past a specified date. First I fetch the collection (getCollection), filter by those with an end date and with status 'enabled' and then save it in $toBeZeroedCollection. Then:

$toBeZeroedIds = $toBeZeroedCollection->getAllIds();
    unset($toBeZeroedCollection);
    if ($toBeZeroedIds) {
        Mage::getSingleton('catalog/product_action')->updateAttributes(
                     $toBeZeroedIds,
                     array('status' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED),
                     Mage_Core_Model_App::ADMIN_STORE_ID
            );

The above code disables the product. But I want to also set the quantity to zero and stock availability to 'Out of Stock'. Do you know how I can achieve this?

I tried variations of the following but have had no success, even the disabled action no longer works with these variations.

Mage::getSingleton('catalog/product_action')
->updateAttributes(
                     $toBeZeroedIds,
                     array('status' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED,
                    'is_in_stock' => Mage_CatalogInventory_Model_Stock_Status::STATUS_OUT_OF_STOCK,
                    'qty' => 0),
                     Mage_Core_Model_App::ADMIN_STORE_ID
            );

Update

I got this working using product ids, with code similar to Parassood's below.

foreach($toBeZeroedIds as $productId){

        $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
        $stockItem->setData('qty', 0);
        $stockItem->save();

    }

I also had to lengthen my cron settings as per https://stackoverflow.com/a/21202940/3779933


texts: Magento 2: Get sub-category URLs & limit amount fetched

texts:
I'm having a hard time being able to get the sub-category URLs for my navigator in my template.

UPDATE:

I've figured out my main issue, but now I'm wondering how can I limit the amount of sub-categories/child-nodes? I'd like to fetch a max of 3.

Block Code:

protected $_categoryHelper;
protected $categoryFlatConfig;
protected $topMenu;

/**
 * @param \Magento\Framework\View\Element\Template\Context $context
 * @param \Magento\Catalog\Helper\Category $categoryHelper
 * @param array $data
 */
public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Catalog\Helper\Category $categoryHelper,
    \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState,
    \Magento\Theme\Block\Html\Topmenu $topMenu)
{
    $this->_categoryHelper = $categoryHelper;
    $this->categoryFlatConfig = $categoryFlatState;
    $this->topMenu = $topMenu;
    parent::__construct($context);
}

/**
 * Return categories helper
 */
public function getCategoryHelper()
{
    return $this->_categoryHelper;
}

/**
 * Retrieve current store categories
 *
 * @param bool|string $sorted
 * @param bool $asCollection
 * @param bool $toLoad
 * @return \Magento\Framework\Data\Tree\Node\Collection|\Magento\Catalog\Model\Resource\Category\Collection|array
 */
public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true)
{
    return $this->_categoryHelper->getStoreCategories($sorted, $asCollection, $toLoad);
}

/**
 * Retrieve child store categories
 *
 */
public function getChildCategories($category)
{
    if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) {
        $subcategories = (array)$category->getChildrenNodes();
    } else {
        $subcategories = $category->getChildren();
    }
    return $subcategories;
}

Template Code:

<?php
$categorys = $this->getStoreCategories(false, false, true);
foreach($categorys as $category)
{
    echo '

'.$category->getName().'
';
            foreach($this->getChildCategories($category) as $childrenCategory)
            {
                echo '
getUrl().'">'.$childrenCategory->getName().'
';
            }

            echo '

View All

';
}
?>

Any advice?


texts:
As far as I know (/knew), the following 2 snippets were pretty much equivalent:

$collection = Mage::getResourceModel("reports/product_collection")

and

$collection = Mage::getModel("reports/resource_product_collection")

They both result in an instance of same class (Mage_Reports_Model_Resource_Product_Collection).

The problem comes when I try to rewrite the class. Here is how I did this:

<reports>
    <rewrite>
        <resource_product_collection>MyNamespace_MyModule_Model_Resource_Product_Collection</resource_product_collection>
     </rewrite>
 </reports>

This is where the difference appears, the first one isn't rewritten, while the second one is.

My questions are:

Is this the intended behavior ? Why ?
What is the difference between the 2 initial snippets ?

Note: This happens on Magento 1.7.0.2


texts: How to add custom form on checkout page below shipping address using Layout Processor?

texts:
I am following this tutorial https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_form.html but I am not able to add the form as code looks incomplete to me. I have created the below files:
 - plugin file for layout processor in Model
 - di.xml file for defining this plugin
 - checkout_index_index.xml
 - to use custom form in checkout page I override shipping.html file and added below code.

li id="opc-custom-checkout-form"
data-bind="fadeVisible: visible()"
div class="custom-checkout-form"
    div class="step-title"
         translate="'Other information'"
         data-role="title" /
    !-- ko foreach: getRegion('custom-checkout-form') --
    !-- ko template: getTemplate() -->!-- /ko --
    !--/ko--
/div

/li

It looks like there is something I am missing in the checkout_index_index.xml file.

Can someone help me out here? Thanks.


texts: Performance detriment of social media buttons

texts:
I looked into adding the ability to:

Like (Facebook)
Share (Facebook)
Tweet (Twitter)
Share (Google+)

On the product page. To do so, I used the code snippets available directly from each of the social media platforms developer consoles, namely:

Like / Share Button - Facebook
Tweet - Twitter
Share - Google +

repsectively.

I believed that this would be the most minimalistic approach to adding support for social media (as opposed to installing an extension to do so). The result though was not pleasing. :-/

Before:

Page load time: 1.96s
Total page size: 233KB
Total number of requests: 34

After:

Page load time: 3.02s
Total page size: 783KB
Total number of requests: 50

Using http://gtmetrix.com/ to analyze performance. That's horrific! Am I approaching this badly? Would appreciate some input.


texts: Why is product flat collection disabled in checkout / cart pages since CE 1.9.4.0 / EE 1.14.4.0?

texts:
Since CE 1.9.4.0 / EE 1.14.4.0 cart and checkout controllers have preDispatch method updated with the following changes:

which forces product collections to use EAV tables instead of catalog_product_flat_x one(s). Is the reason behind this known? There are no exact mentions of the change in release notes.


texts: Magento2 Dynamic System->Configuration Comments

texts:
In Magento 1.x you could have dynamic comments on system->configuration fields by declaring your field in system.xml like this:

<field_code_here translate="label">
    <label>Label Here</label>
    <frontend_type>text</frontend_type>
    <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>
    <comment>
        <model>[module]/field_comment</model><!-- this made it dynamic -->
    </comment>
</field_code_here>

Then you just need to create the [Namespace]/[Module]/Model/Field/Comment.php file with this content:

class [Namespace]_[Module]_Model_Field_Comment
{
    public function getCommentText()  //the method has to be named getCommentText
    {
        //do some calculations here
        return 'Some string based on the calculations';
    }
}

This way the field would have as comment what the  getCommentText method from above returned.
Is there an alternative for Magento 2? It seams that I cannot attach a model to a comment tag. The system.xml is not validated by Magento/Backend/etc/system_file.xsd if I do.


texts: $quote_item_option = Mage::getModel('sales/quote_item_option')->load('1')->group('item_id'); - Not working

texts:
Array
 (

    [0] => Array
    (
        [option_id] => 111584
        [item_id] => 50399
        [product_id] => 855
        [code] => info_buyRequest
        [value] => a:11:{s:4:"uenc";s:76:"aHR0cDovLzE5Mi4xNjguMS4yNDMvbmV3X2NhbmRlcmUvYWRoeWEtZGlhbW9uZC1yaW5nLmh0bWw,";s:7:"product";s:3:"855";s:15:"related_product";s:0:"";s:13:"extra_options";a:7:{s:21:"Metal Weight (Approx)";s:4:"2.09";s:3:"sku";s:7:"C003440";s:13:"Diamond Color";s:2:"GH";s:15:"Diamond Clarity";s:2:"SI";s:5:"Metal";s:11:"Yellow Gold";s:6:"Purity";s:3:"18K";s:9:"Ring Size";s:23:"4        13.8mm";}s:13:"custom_params";a:3:{s:14:"estimated_date";s:18:"September 26, 2016";s:19:"total_weight_approx";s:4:"2.13";s:24:"selected_making_discount";i:1254;}s:13:"product_price";s:5:"23317";s:15:"email1_wishlist";s:0:"";s:21:"userPassword_wishlist";s:0:"";s:17:"diamond_selection";s:8:"34066.00";s:18:"customized_product";s:0:"";s:3:"qty";i:1;}
    )

)

How to print this above value field?


texts: Magento product view observer not raised

texts:
I'm trying to develop a module to create a log for each product visited by a user.
To generate a log, I'm using event observer. But the event never is called.

What could be wrong?
My code:
C:\Users\miudo\AppData\Local\Temp\scp44107\home\sr\localhos.t\app\code\local\Bit\Itemsviewed\Model\Observer.php

<?php
class Bit_Itemsviewed_Model_Observer
{
    public function saveProductVisitHistory(Varien_Event_Observer $observer) {
        $event = $observer->getEvent();

        Mage::log('id ' . $observer->getEvent()->getProduct()->getId() , null, 'custom.log');

        return $this;
    }
}

C:\Users\miudo\AppData\Local\Temp\scp47708\home\sr\localhos.t\app\code\local\Bit\Itemsviewed\etc\Config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Bit_Itemsviewed>
            <version>0.1.0</version>
        </Bit_Itemsviewed>
    </modules>
    <global>
        <helpers>
          <itemsviewed>
            <class>Bit_Itemsviewed_Helper</class>
          </itemsviewed>
        </helpers>
        <blocks>
          <itemsviewed>
            <class>Bit_Itemsviewed_Block</class>
          </itemsviewed>
        </blocks>
        <catalog>
            <rewrite>
                <product_view>Bit_Itemsviewed_Block_Itemsviewed</product_view>
            </rewrite>
        </catalog>
        <models>
            <itemsviewed>
                <class>Bit_Itemsviewed_Model</class>
            </itemsviewed>
        </models>
    <!--/global>
    <frontend-->
        <events>
            <catalog_controller_product_view>
                <observers>
                    <itemsviewed>
                        <type>model</type>
                        <class>bit_itemsviewed/observer</class>
                        <method>saveProductVisitHistory</method>
                    </itemsviewed>
                </observers>
            </catalog_controller_product_view>
        </events>
    </global>
</config>

C:\Users\miudo\AppData\Local\Temp\scp57676\home\sr\localhos.t\app\code\local\Bit\Itemsviewed\Helper\Data.php

<?php
class Bit_Itemsviewed_Helper_Data extends Mage_Core_Helper_Abstract{
}

C:\Users\miudo\AppData\Local\Temp\scp48515\home\sr\localhos.t\app\code\local\Bit\Itemsviewed\Block\Itemsviewed.php

<?php
class Bit_Itemsviewed_Block_Itemsviewed extends Mage_Catalog_Block_Product_View{
}

Thanks

EDITED:
I had been trying to use

<itemsviewed>
  <type>model</type> also <singleton>
  <class>itemsviewed/observer</class> also <class> Bit_Itemsviewed_Model_Observer </class>
 [...]
</itemsviewed>


texts:
Our vendor is using TrueShip's ReadyShipper software to ship orders from our 1.6.1 Magento store(s). I'm not a Magento dev, but I'm not completely lost in all of this. I've also contacted support for assistance and they've been less than helpful. I've been troubleshooting an error ReadyShipper is throwing when we try to import orders:

  Magento orders download error Procedure 'salesOrderShipmentList' not
  present

Their last advice to me was "This indicates that Magento is not setup to generate the salesOrderShipmentList through the API.".

The v1 XML does not list the referenced procedure, salesOrderShipmentList, but v2 XML does. Unfortunately, their software accepts the v1 soap address http://magentohostname/index.php/api/soap/index/, but not the v2_soap address http://magentohost/index.php/api/v2_soap/index/.

I've enabled wsdl in Magento sys config. What else am I missing?


texts:
I have ann Array of urls

$arr = Array(
       'http://magento2.com/url-exist',
       'http://magento2.com/url-does-not-exist',
       'http://magento2.com/url-does-not-exist',
       'http://magento2.com/url-exist');

I've tried curl, get_headers they all failed

output is wrong:

Link-1
Link-2
Link-3
Link-4

It should return only url 1 and 4 200 status code e.g:

Link-1
Link-4

However it's returning all 200 but 2 and 3 should return 404

Anyone have any idea why ?

Thanks in advance!


texts: Home page Redirect to Customer Login Page Magento 2

texts:
i tried every solution like all commands run setup:upgrade di:compile and content-deploy but nothing effect kindly give me solution
thank u


texts: How can I change the OPC-Slide (one page checkout js)

texts:
how can I change the slider effect at the onepage checkout?

I only want to fade in/out or simple "reload" every step of the checkout process.
I'm not a Pro in javascript. It's at /mytheme/js/opcheckout.js?!

THanks for your help.


texts: How to override the blank theme by default.xml?

texts:
I tried to override the app/design/frontend/Vendor/MyTheme/Magento_Theme/layout/default.xml, but it doesn't show any changes.
I want to add custom links in top.links of parent theme (blank theme):

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="top.links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us">
            <arguments>
                <argument name="label" xsi:type="string">Contact Us</argument>
                <argument name="path" xsi:type="string">contact-us</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

Like here: http://www.webmull.com/how-to-add-custom-top-links-in-magento-2-header/

I've flushed the cache, but it doesn't show any custom link.

Thank for your help.


texts:
I have migrated from from magento 1.9.2.3 to magento 2.3.3.
previously my products in admin panel and frontend was not opening, there was some duplicate entries for product id, so i removed the duplicate entries in the database tables.
Since then the products on frontend started opening but on the admin panel it is giving 500 error, on further checking the logs i found this in exception.log file.

  [2020-01-11 09:04:06] main.CRITICAL: Path
  "/home/xxxxx/public_html/var/view_preprocessed/pub/static/" cannot be
  used with directory
  "/home/xxxxx/public_html/var/view_preprocessed/pub/static/"
  {"exception":"[object]
  (Magento\Framework\Exception\ValidatorException(code: 0): Path
  "/home/xxxxxxxxxx/public_html/var/view_preprocessed/pub/static/"
  cannot be used with directory
  "/home/xxxxxxxx/public_html/var/view_preprocessed/pub/static/" at
  /home/xxxxxx/public_html/vendor/magento/framework/Filesystem/Directory/PathValidator.php:63)"}
  []

I have also deleted the folder var_preprocessed and run the php bin/magento static-content:deploy many times and cleared the cache but the problem did not resolve.

What can be the issue and how should I resolve this?

Please help..
Thanks in advance.


texts: Shipping methods is not working in Magento 2

texts:
The Shipping methods are not working in Magento 2.

I have set all configuration settings. But, Not reflecting any changes on the checkout page or cart page.


texts: Magento 1.9 skip payment method step when grandtotal is zero

texts:
I want to skip  payment method step when Grandtotal is zero
Any help would be appreciated.
Thanks!!


texts: Magento - show different number of products on home page

texts:
I want to show all the images from category 10 on the home page, which number is 24, but the limit of the site is set to 15. How can I set it to All only for the home page?

This is the block code:

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="10" template="catalog/product/list_home.phtml"}}


texts:
I just received email saying that there's an update for 2.1.x > 2.1.10. There are also updates for 2.0.x and 2.2.x.

Is there end-of-life date for Magento 2.1.x? Do they plan to develop 2.0.x, 2.1.x and 2.2.x in parallel?

I'm wondering whether to upgrade from 2.1.9 to 2.2.1 or just keep updating to next versions of 2.1.x - when available.


texts: Magento 2: "https://packages.magento.com/packages.json" file could not be downloaded

texts:
I keep getting this warning when I run composer update in my Magento 2 install.

Loading composer repositories with package information
Your configuration does not allow connections to http://packages.firegento.com/packages.json. See https://getcomposer.org/doc/06-config.md#secure-http for details.
http://packages.firegento.com could not be fully loaded, package information was loaded from the local cache and may be out of date
The "https://packages.magento.com/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Name or service not known
failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known
https://packages.magento.com could not be fully loaded, package information was loaded from the local cache and may be out of date
Updating dependencies (including require-dev)

Still it seems like the update goes fine everytime but I wonder how can I fix this problem ?


texts: How can we get the total amount of cancel order after successful order cancellation in Magento 2

texts: Magento 2.1.10 - I want the total amount of cancel order after successful order cancellation with customer wise.


texts: HELP! Protocol "https" not supported or disabled in libcurl

texts:
Protocol "https" not supported or disabled in libcurl

This error occurs in two places:

when I try to connect Marketplace.
when I try to integrate with Paypal gateway.

In the command line, i curl a SSL site.  It returns fine. Any help will be appreciated


texts:
In magento сonfigured https for frontend and backend

But styles and js use http

How can I fix it?
on the server installed nginx


texts: How to get product collection with both in stock and out of stock products in Magento 2.1

texts:
I'm using below code to get the product collection

<?php

namespace Vendor\Module\Block\Product;

use Magento\Framework\View\Element\Template;
use Magento\Catalog\Model\ResourceModel\Product\Collection;

class Manage extends \Magento\Framework\View\Element\Template {

        public function __construct(
                Template\Context $context
                , Collection $productFactory
                , array $data = []
    ) {
        $this->productFactory = $productFactory;
        parent::__construct ( $context, $data );
    }

    public function getFilterProducts() {

        $product = $this->productFactory->addAttributeToSelect ( '*' );

        $product->addAttributeToFilter ( 'visibility', array (
                'eq' => \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
        ) );
        $product->addAttributeToSort ( 'entity_id', 'DESC' );

        return $product;
    }

}

But above code gives me only in stock products, how do I include out of stock products in this collection?


texts: Magento 2 salesrule obsersver save after & before

texts:
In Magento 1.9 i have an observer salesrule_rule_save_before and salesrule_rule_save_after for the backend area, are there any equivalent observer like this in Magento 2
?


texts: Dont allow checkout for certain pincodes

texts:
I am having some list of pincodes and i want to not to allow checkout for that pincodes if user enters that in the billing or shipping form.

Please let me know.

Thanks


texts: Retrieve custom attribute value in magento 2

texts:
I am using magento 2.1.0, I created custom attribute of customer, and add field on frontend in customer edit information form.

when I entered any value in edit form, it is saved in adimn form but not visible on frontend. means data is not retrieve on frontend.

so how to retrieve that data to show on frontend in this field:

            <?php /* @escapeNotVerified */echo __('Blood Group') ?>
            <select name="bloodgroup" id="bloodgroup">
            <?php
            $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                           $model = $objectManager->create('\xxx\xxx\Model\BGroup')->avialable();
            foreach ($model as $b)
            {
              ?>
            <option value="<?php echo $b['BloodGroup']; ?>"><?php echo $b['BloodGroup']; ?></option>

        <?php }   ?>

            </select>


texts:
/lib/Zend/Db/Statement/Pdo.php

  Fatal error: Allowed memory size of 536870912 bytes exhausted (tried
  to allocate 95 bytes) in /lib/Zend/Db/Statement/Pdo.php on line 291

How do I fix this issue, do I need to set a memory limit ?

Any suggestions would be greatly thankful.


texts: Magento2 Cronjob and Generate Schedules Every

texts:
I create a custom module, that updates prices and product stock. This is two different jobs in the same cron group.

My crontab.xml is:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="product_update">
   <job name="stock_update_cron" instance="Namespace\ModuleName\Cron\StockCron" method="execute">
        <schedule>0 3 * * 1-5</schedule>
    </job>
    <job name="price_update_cron" instance="Namespace\ModuleName\Cron\PricesCron" method="execute">
        <schedule>0 8 * * 1-5</schedule>
    </job>
</group>

I setup each job schedule, to run once a day from Monday to Friday. The stock update, should run at 3h00m from Monday to Friday, and Price update at 8h00m from Monday to Friday.

I create a cron_group.xml, but my main question is what value should I insert on "schedule generate every" so this two jobs run once a day? I did some test already and, even when I put 1 in "schedule generate every", the jobs are not begin scheduled in the cron_shedule table.

Anyone knows why? What value should go to "schedule generate every", so my jobs can run once a day?


texts: Magento 2: Need to send email to cc emails

texts:
I want to send an order confirmation email to the cc emails which are mentioned by the customer on the accounts page. I am able to store the cc emails comma(,) separated. But don't know how to send the email to the cc emails (I don't want to use the core modules for this). Need help on this.

Thanks.