texts: getItemById($itemId) for Magento Quote Model not working as expected in Magento 2

texts:
Here is my code, where I'm calling Quote model file and getItemById function.

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

$itemId = "Quote Item ID";
$data = $this->quote->getItemById($itemId);

Above code returns FALSE - even there are 65 Quote Items are exists!

So I checked the Magento core method of getItemById in -

  /vendor/magento/module-quote/Model/Quote.php

     /**
     * Retrieve item model object by item identifier
     *
     * @param   int $itemId
     * @return  \Magento\Quote\Model\Quote\Item|false
     */
    public function getItemById($itemId)
    {
        foreach ($this->getItemsCollection() as $item) {
            if ($item->getId() == $itemId) {
                return $item;
            }
        }

        return false;
    }

If I print the $this->getItemsCollection()->getData() then it returns the 65 Item arrays.

But As Magento passing directly the collection object $this->getItemsCollection() in foreach

  So It's not going in-side the foreach loop which is expected result.

Is it a Magento bug or I am doing something wrong ?

Edited

Issue is still open for Magento Quote model file.

/vendor/magento/module-quote/Model/Quote.php

As Rohan Hapani's answer we're getting data from \Magento\Quote\Model\Quote\Item As for now.

But Magento's get getItemById still needs to be fixed.

  /vendor/magento/module-quote/Model/Quote.php

/**
 * Retrieve item model object by item identifier
 *
 * @param   int $itemId
 * @return  \Magento\Quote\Model\Quote\Item|false
 */
public function getItemById($itemId)
{
    foreach ($this->getItemsCollection() as $item) {
        if ($item->getId() == $itemId) {
            return $item;
        }
    }

    return false;
}

So open for the solutions :)


texts:
I'm using Magento 1.9 version.

I want to redirect the customer to the login page only when they click on the review button in the product view page and also redirect to the same product view page after login. But it redirects when I load product view page.

I have used this code:

if(Mage::getSingleton('customer/session')->isLoggedIn()){
//some stuff
}else{
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'))
}


texts: Invalid type error for REST function call

texts:
I have a method in my Interface which im trying to call using REST.

in webapi.xml

<route url="/V1/sync/get/sku:sku" method="GET">
    <service class="Vendor\Module\Api\QueueRepositoryInterface" method="myMethod"/>
    <resources>
        <resource ref="anonymous" />
    </resources>
</route>

In Api/QueueRepositoryInterface.php

interface QueueRepositoryInterface
{
   /**
 * Returns single product by SKU.
 *
 * @api
 * @param int $sku
 * @return
 */
 public function myMethod($sku);
}

Is my param in the comment right?

Cause when i hit (sku_test2 : is my SKU)

http://localhost/magento/rest/V1/sync/get/sku/sku_test2

I get

<?xml version="1.0"?>
<response>
  <message>Invalid type for value: "sku". Expected Type: "int".</message>
</response>


texts:
I am developing my website in Magento 2, I need URL regenerate for products after I changed the category URL.

URL's are not changing for existing products.

Ex:

Category URL's:
New URL:
 http://test.com/jewellery-collections/gold-jewellery/gold-rings
Old URL:
 http://test.com/collections/gold/rings

Product URL's:
 http://test.com/collections/gold/rings/midas-bloom

but the URL should be
 http://test.com/jewellery-collections/gold-jewellery/gold-ringsmidas-bloom

So, Product URL's should be regenerate as per new category URL


texts: is ther any option to change Product type in magento

texts:
Can i change a simple product to downloadable product in magento 1.9.3.

is there any option to purchase out of stock, downloadable products


texts: How to make a namespaced admin controller

texts:
Synopsis

I notice this is a hot topic and so I did do my research before posting this question, please read.

I wanted to create myself an admin module and found a great article by Alan Storm, which I have successfully managed to get my admin controller working.

I also didn't need a menu item, so I omitted <menu> from the adminhtml.xml which also worked perfectly whilst my controller remained accessible.

My Question

So far my module is accessible via the following url: /admin/attachment/index/.

My controller is in:
app/code/local/Vendor/ProductUploader/controllers/AttachmentController.php

How can I make my controller accessible via the following route?
/admin/product_uploader/attachment/index

I presumed since Magento is build upon Zend I could create the following class; this didn't work:
Vendor/ProductUploader/controllers/Product/Uploader/AttachmentController.php


texts: What is GD2 and ImageMagick in magento 2

texts: Can any one explain what is the use of GD2 and ImageMagick while uploading images in backend in magento 2.


texts:
Site was working fine and now i m facing this issue. Please see this and help.

a:4:{i:0;s:256:"Warning: include(/var/www/marketplace/var/view_preprocessed/html/vendor/magento/module-theme/view/base/templates/root.phtml): failed to open stream: No such file or directory in /var/www/marketplace/vendor/magento/framework/View/Result/Page.php on line 312";i:1;s:3185:"#0 /var/www/marketplace/vendor/magento/framework/View/Result/Page.php(312): Magento\Framework\App\ErrorHandler->handler(2, 'include(/var/ww...', '/var/www/market...', 312, Array)

1 /var/www/marketplace/vendor/magento/framework/View/Result/Page.php(312): Magento\Framework\View\Result\Page::renderPage()
2 /var/www/marketplace/vendor/magento/framework/View/Result/Page.php(245): Magento\Framework\View\Result\Page->renderPage()
3 /var/www/marketplace/vendor/magento/framework/View/Result/Layout.php(164): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
4 /var/www/marketplace/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
5 /var/www/marketplace/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
6 /var/www/marketplace/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-varnish-...')
7 /var/www/marketplace/vendor/magento/module-page-cache/Model/Controller/Result/VarnishPlugin.php(74): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
8 /var/www/marketplace/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\Controller\Result\VarnishPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
9 /var/www/marketplace/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-builtin-...')
10 /var/www/marketplace/vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(67): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
11 /var/www/marketplace/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\Controller\Result\BuiltinPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
12 /var/www/marketplace/var/generation/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
13 /var/www/marketplace/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
14 /var/www/marketplace/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
15 /var/www/marketplace/index.php(84): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
16 {main}";s:3:"url";s:11:"/book-store";s:11:"script_name";s:10:"/index.php";}

Thanks


texts: Programmatically restore "use default value" setting for images

texts:
How can I programmatically restore the Use Default Value option for store-view images as shown in the image below?

I would like to do this with PHP via the Magento API for a group of products in bulk.


texts: Admin > Customers > All Customers > Edit Customer: > left hand tab "Account Information"

texts:
How can I populate this field so it's filled in when a customer creates an account? The value of the field just needs to match what customer[parent_customer_id] has. It doesn't necessarily have to happen on account creation.

The name of the field is customer[account_number]
This field is a duplicate but we call it something different and it populates correctly.
The name of that input is name="customer[parent_customer_id]"
Even though it's redundant I want both fields to populate. What file and where should I be editing to populate customer[account_number] in its respective field?
I just need the same default Attribute data that populates customer[parent_customer_id] to populate customer[account_number]


texts: Magento 2: Extension Attributes for Total Model

texts: I added custom total(discount row) model in cart and checkout summary but it is not getting saved in quote and order. So how to use extension attribute for such total model that works in order, invoice etc. ?


texts: I want to upload my products via .csv files but in my Magento Backend there is no option to import the file. Normally it should be under System-Data Transfer-Import but there is no option like Import or Export. Its just empty under Transfer Import.


texts:
this is the code of the product view CODE PRODUCT VIEW

I have try to change the design but it seams i get error
i have to move related products ( look picture) i dont need text or size or something else there only the picture of the reated product)

hope someone can help


texts:
I would like what template is invoked to display product information when you click on result list of catalog search.

Search in catalog by keyword -> list of results > click on a product


texts: Error on the Search Bar: Something went wrong with processing the default view and we have restored the filter to its original state

texts: I've mistakenly pasted a large data set I've copied from the excel file on the search bar of the orders. Then, I got this error and it never went back to normal - "Something went wrong with processing the default view and we have restored the filter to its original state."


texts: How to create a category page with requested category in homepage in Magento 2?

texts:
I need to create a category page with requested category in homepage. Can anyone please help me??
(Note:- category id need to be given from backend.)


texts: How to redirect from observer in after logout in Magento 2?

texts:
I have created an observer for customer_logout event and on its observer, I want to redirect the customer to a specific page. how can be done ?
In Magento1.9.x as

   $observer->getControllerAction()->setRedirectWithCookieCheck($url);

I want replacement of above for the Magento2.x.

Thanks.


texts: Magento Cart: Show Discount excl. tax instead incl tax

texts:
We added discount rules in our cart.
Our problem: We need to show the Discount excl. tax instead of incl. tax.
Has anyone an idea how to do this? It should be shown in all cases. Such as cart, pdfs, emails and so on...

I added this as a bug or request to Magento.
https://www.magentocommerce.com/bug-tracking/issue/index/id/1465

Greets
Sven


texts: How to install Google TAG Manager (GTM) to Magento 1.9.2 without extension?

texts:
After creating an account at Google TAG Manager (GTM), it gives 2 pieces of code to add immediatly after <head> tag and another immediatly after <body> tag.
The “HTML Head” – “Miscellaneos script” or “Footer” – “Miscellaneous script” fields from Magento admin, seems to add that code in that sections but not immediatly after opening the tags.

So, is there another way to add it in both places? I find answers but all of them say different options,… some ones edit some .phtml files, some ones another files,…

I don’t like to install extensions that will need updates, etc. specially if it’s just to add a piece of code…
I want the GTM just to install the Facebook Pixel, (because Facebook gives 2 options to install the Pixel in Magento: with extensions or with GTM),… so I’m trying to install GTM to avoid installing extensions… but maybe “the best way to install the Pixel Facebook” it’s a different question…

I hope it can be an updated post about How to install manually the Google Tag Manager! :)
Thank you!


texts: Access Variables passed to a function modified/wrapped with a mixin

texts:
I want to tidy up this answer i gave here:

How to disable a swatch, once it is been selected in Magento2.2?

Instead of completely overriding the function i would like to improve it by wrapping the original function call and adding my custom code after the original function like so:

define([
    'jquery',
    'mage/utils/wrapper'
], function ($, wrapper) {
    'use strict';

    return function(swatchRenderer){

        var OnClickWrapper = wrapper.wrap(swatchRenderer.prototype._OnClick, function(originalSwatchRenderer){

            var result = originalSwatchRenderer();

            /*Custom code start*/
            console.log(this);
            //.css({"pointer-events":"none","opacity":"0.6"});
            alert("test");
            /*Custom code end*/

            return result;
        });

        swatchRenderer.prototype._OnClick = OnClickWrapper;
        return swatchRenderer;
    };
});

This is mostly functioning ok however want to access the parameters passed to the original function so i can grab the parent of the clicked element with $this:

_OnClick: function ($this, $widget, eventName)

Is it possible to access these from within the wrapper and and how to do so?


texts:
Currently, change password form is on the same page as account edit information, is there any way to separate change password to different page.

I'm new to Magento & don't know, how to create a custom page can be made in Magento.


texts: Magento - Fatal Error in Mediafallback.php - 1.9.2.4

texts:
Two categories on my website mrmobileuk.com are showing the following error:

  Fatal error: Unsupported operand types in
  app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php on line 61

These are the categories:

http://mrmobileuk.com/index.php/lcds-digitizers-spare-parts.html

http://mrmobileuk.com/index.php/lcds-digitizers-spare-parts/spare-parts.html

Rest other categories are fine.

There have been posts on this issue previously too on your site but no recommended solution has been posted in response.

@murtaza and rest who have been following this post.

There was no problem with the Mediafallback.php file.

Do not edit the core file.

I created new categories and tried to place the products in these new categories one by one. The error showed up again after moving a certain product which was the main cause. It was a configurable product but it wasn't associated with simple products. So I deleted that product and created again and was all fine after that. Because of that, the whole category was showing an error. I still do not know why that product was causing an error but deleting it solved the issue. So if you are keen to know why, you can investigate on that part.


texts: Refresh checkout cart after adding cross selling items

texts:
We have a Magento 2.3.5 with a simple custom theme. In the normal checkout card (not mini cart!) there are some cross selling items beneath. If a customer presses the .to-cart button on such a cross selling item it already reloads the mini cart and the totals with ajax.
Now we need to reload the normal cart (#form-validate) as well. So I've did some research and found this nice piece where you add a code for editing the qty of a cart product.
This also doesn't work because we don't "update" the cart but adding an item. (wrong context)
But in that example code you find this two bits:
// The mini cart reloading
customerData.reload(sections, true);

// The totals summary block reloading
var deferred = $.Deferred();
getTotalsAction([], deferred);

Is there such a code (from a default js define block) to simply refresh the cart (without update the cart data)?


texts:
I have a form like user details, when click on new record I'm calling save method in same page. It's working fine after i refresh the page again record is inserting as duplicate how I avoid this type of issue?

my code is:

mynewtemplate.phtml

<form method="post"  >

                    First Name

                    <input type="text" id="nom" name="nom" />

                    Last Name

                    <input type="text" id="prenom" name="prenom" />

                    Telephone Number

                    <input type="text" id="telephone" name="telephone" />

                        <button name="btn_submit" type="button" onclick="window.location='<?php echo $this->getUrl('practice/index/new') ?>';" class="button"><?php echo $this->__('New Record') ?></button>

    <?php

    if(isset($_POST['btn_submit'])){
        echo 'Calling Save Method';
        echo $this->Save();
    }

    ?>

</form>

and my code in block->template.php

public function Save()
    {

        $fn = ''.$this->getRequest()->getPost('nom');
        $ln = ''.$this->getRequest()->getPost('prenom');
        $tn = ''.$this->getRequest()->getPost('telephone');

        if(isset($fn)&& ($fn!='') && isset($ln)&& ($ln!='') && isset($tn)!='')
            Mage::getModel('test/test')->_save($fn,$ln,$tn);

    }

my design:

thanks in advance.


texts: Host 2 Magento websites on single instance in aws

texts:
How can I deploy my second Magento website on and instance in which already one is running

in AWS


texts: What is the best way to override _initProduct() in module-checkout\Controller\Cart\Add.php

texts:
What is the best way to override _initProduct() function
in:

vendor\magento\module-checkout\Controller\Cart\Add.php

I have this in my di.xml:

<type name="Magento\Checkout\Controller\Cart\Add">
    <plugin name="x_cart_add" type="X\Y\Plugin\Checkout\Controller\Cart\Add" sortOrder="1"/>
</type>

Method:

/**
 * Initialize product instance from request data
 *
 * @return \Magento\Catalog\Model\Product|false
 */
protected function _initProduct()
{
    $productId = (int)$this->getRequest()->getParam('product');
    if ($productId) {
        $storeId = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId();
        try {
            return $this->productRepository->getById($productId, false, $storeId);
        } catch (NoSuchEntityException $e) {
            return false;
        }
    }
    return false;
}


texts:
I need to invent gift cards as products in my store. I realized that you can do this in Magento Go,

http://www.magentocommerce.com/knowledge-base/entry/creating-a-gift-card

What about Magento Community version? Can I invent gift cards in this version?

I have seen there are a lot gift card extensions, but they all needed to be paid. Just wonder if any free gift card extensions around?


texts: Retrieve collection using limit and offset in magento 2

texts:
I want to retrieve magento 2 model collection using limit offset, like raw query like this:

$rawQuery = SELECT * FROM test WHERE test_id = '".$test_id."' and status = '1' LIMIT 600 OFFSET ".$offset;

i have tried using this,but not working,

    $collections = $model->getCollection()
    ->addFieldToFilter('test_id',array('eq'=>$test_id))
    ->addFieldToFilter('status',array('eq'=>'1'))
    ->setLimit(600)->setOffset($offset);


texts: Magento2 Plugin to remove Parent category

texts:
Referring the answer to this question - How to remove parent category from subcategory URL?
I created the file in Module Plugin folder - RemoveParentCategoryPathPlugin.php with contents like:

<?php
namespace Myweb\RemoveParentCategoryPathPlugin\Plugin;

class RemoveParentCategoryPathPlugin
{
    public function aroundGetUrlPath($subject, $proceed, $category)
    {
        if (in_array($category->getParentId(), [Category::ROOT_CATEGORY_ID, Category::TREE_ROOT_ID])) {
            return '';
        }
        $path = $category->getUrlPath();
        if ($path !== null && !$category->dataHasChangedFor('url_key') && !$category->dataHasChangedFor('parent_id')) {
            return $path;
        }
        $path = $category->getUrlKey();
        if ($path === false) {
            return $category->getUrlPath();
        }
        return $path;
    }
}

also added di.xml in etc folder with contents like:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\CatalogUrlRewrite\Model">
        <plugin name="Myweb_RemoveParentCategoryPathPlugin" type="Myweb\RemoveParentCategoryPathPlugin\Plugin\RemoveParentCategoryPathPlugin" />
    </type>
</config>

and module.xml in etc folder

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Myweb_RemoveParentCategoryPathPlugin" setup_version="1.0.1" />
</config>

and registration.php in module folder with contents:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Myweb_RemoveParentCategoryPathPlugin',
__DIR__
);

What I am missing here. as the plugin doesn't seems to have any effect.
I tried to create new category as well to see if it works on new category.


texts:
I am doing this in Magento 1.9 CE, and my objective is to log out the user as soon as the password is changed.

I registered my extension.

  app/etc/modules/Bmg_Golo.xml

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

My config.xml

  app/code/local/Bmg/Golo/etc/config.xml

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

    <config>
        <modules>
            <Bmg_Golo>
                <version>0.0.1</version>
            </Bmg_Golo>
        </modules>
        <global>
            <models>
                <bmg_golo>
                    <class>Bmg_Golo_Model</class>
                </bmg_golo>
            </models>
        </global>
        <frontend>
            <events>
                <controller_action_postdispatch_customer_account_resetpasswordpost>
                    <observers>
                        <bmg_golo>
                            <type>singleton</type>
                            <class>Bmg_Golo_Model_Observer</class>
                            <method>logout</method>
                        </bmg_golo>
                    </observers>
                </controller_action_postdispatch_customer_account_resetpasswordpost>
            </events>
        </frontend>
    </config>

I created an observer.

  app/code/local/Bmg/Golo/module/Observer.php

    <?php
    /**
    *
    */
    class Bmg_Golo_Model_Observer
    {
        public function logout($observer) {
            $session = Mage::getSingleton('customer/session');
                if ($session->isLoggedIn()) {
                    Mage::getSingleton('customer/session')->logout();
                }
        }

    }
    ?>

My customer logged out after changing the password. I doubt the event/observer in config is wrong and my method in the observer is not getting called. Please help me as I am new to Magento.


texts: Magento 2 How To add Google Map in Ui Form

texts:
I'm facing following issue while adding google map with an api key,

This site overrides Array.from() with an implementation that doesn't
support iterables, which could cause Google Maps JavaScript API v3 to
not work correctly.

Ui Form
<container name="vanuemarkers_container">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">

                </item>
            </argument>
            <htmlContent name="html_content">
              <argument name="data" xsi:type="array">
                 <item name="config" xsi:type="array">
                    <item name="additionalClasses" xsi:type="string">admin__field</item>
                    <item name="label" xsi:type="string" translate="true">Group Title</item>
                 </item>
              </argument>
              <argument name="block" xsi:type="object">Custom_Module\Block\Adminhtml\Data\Map</argument>
           </htmlContent>
        </container>

Map.php
<?php

namespace Custom_Module\Block\Adminhtml\Data;

    class Map extends \Magento\Backend\Block\Template
    {
        public function __construct(
        Context $context,
        Data $helperData,
        array $data = []
    ) {

        $this->helperData = $helperData;
        parent::__construct($context, $data);
    }

        protected $_template = 'map/googlemap.phtml';

        public function getApiKey()
    {
        return $this->helperData->getConfigValue('event/general/api');

    }

googlemap.phtml
<div class ="map">
  <script>
        require([
            "https://maps.googleapis.com/maps/api/js?key=<?= $this->getApiKey() ?>"
        ], function () {
            var latitude = '<?= $eventdata->getLatitude() ?>',
                longitude = '<?= $eventdata->getLongitude() ?>';
            alert(latitude);
            var isDraggable = true;
            //var defaultzoom = '';

            function markerMap(latitude, longitude) {
                var mapLatLng = new google.maps.LatLng(latitude, longitude);
                var mapOptions = {
                    draggable: true,
                    zoom: 10,
                    center: mapLatLng,
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    //styles: mapStyle
                };

                var map = new googleapis.maps.Map(document.getElementById("mpgooglemaps_map_<?= $block->getNameInLayout() ?>"), mapOptions);
                var marker = new google.maps.Marker({
                    draggable: true,
                    position: mapLatLng,
                   // icon: mapMarkerIcon,
                    animation: google.maps.Animation.DROP
                });
                marker.setMap(map);
            }

            markerMap(latitude, longitude);
        });
    </script>
    </div>

Let me know if anyone has solution.


texts: What events to use for update of custom prices upon "Proceed to checkout" and "Submit Order"

texts:
I have made a module that sets custom prices of quote items upon a cart update. For that I use these events:

checkout_cart_product_add_after
sales_quote_remove_item
checkout_cart_update_items_after

It works fine but the problem is that the custom prices are not recalculated if user proceeds to checkout or sends the order.

I would like them to be recalculated there as well because they are derived from data that possibly might have been changed from the last cart update (user group, product base price, etc.). Magento recalculates its prices this way if a custom price is not set so I would like to achieve the same behaviour.

Are there the appropriate events to hook in to invoke the recalculation in my module?

EDIT: In fact, it seems that Magento recalculates prices even after normal page reloads in cart. I guess I don't really need this even though it is more correct.


texts: How to update sales_flat_order table status column by checking the payment method choose by the customer?

texts:
I created a new status on admin panel for orders.

System -> order status -> create new status

I created the status for cash on delivery payment option.

While the order processing, how can i track the payment method and update the table sales_flat_order
status column   with cash on delivery as status.
My status code is cod


texts: Is It Possible to Print the Current Collection's ORDER BY information?

texts:
I've created a custom sort module that I'm attempting to debug. I'm curious if it is possible to display this information somewhere in my catalog pages (e.g. app/code/design/package/theme/template/catalog/product/list.phtml). Here is the observer portion of my custom module where I define the setOrder:

<?php

class MyExtension_CustomSort_Model_Observer
{
    public function onLoadCollection($observer)
    {
        $collection = $observer->getCollection();

        $collection->setOrder('created_at', 'desc');
            ->setOrder('name', 'asc');

        return true;
    }
}

I've tried echoing and using print_r to display my information but it seems I'm doing wrong. Any advice? The end result would be for me to see "created_at" and "name" somewhere near the top of page.


texts: Special Price Not Applying in Magento2 Cart

texts:
I am creating simple products through API call. Product is created finely and showing all attributes finely in admin part but when ever i am seeing product in frontend it is not showing any special price. It is directly displaying price.
I am using magento 2.2.4 version. Here is the API code.
   $name = $prod_data['name'];
            $price = $prod_data['price'];
            $category_id = 229;
            $qty = $prod_data['qty'];
            $desc=$prod_data['description'];
            $product->setName($name);
            $product->setTypeId('simple');
            $product->setAttributeSetId(10);
            $product->setSku($sku);
            $product->setWebsiteIds(array(1));
            $product->setVisibility(1);
            $product->setPrice($price);
            //$product->setCategoryIds(array($category_id));
            $product->setDescription($desc);
            $product->setItemCode($prod_data['name']);
            $product->setUrlKey($url_key);
            $product->setStockData(array(
                    'use_config_manage_stock' => 0,
                    'manage_stock' => 1,
                    'is_in_stock' => 1,
                    'qty' => $qty
                )
            );

            if ($product->save()) {
            /** add saved file to the $product gallery */
            $categoryLinkRepository = $objectManager->get('\Magento\Catalog\Api\CategoryLinkManagementInterface');
            $categoryIds = array('229');
            $categoryLinkRepository->assignProductToCategories($sku, $categoryIds);

            $succ = 1;
            $msg = "Product created successfully";
            $logger->info("SKU Not Existed, So Creating new SKU for ". $prod_data['sku']);
              }else{
                $succ = 0;
                $msg = "Unable to create product";
                 $logger->info("SKU Not Existed, But there is problem in creating sku ". $prod_data['sku']);

              }

For updating special price i used the following code. In admin it is updating finely but final_price in index table is not changing.
if($prod_data['special_price'] > 0){
                       $product2 = $objectManager->get('Magento\Catalog\Model\Product')->load($pid);

                      $product2->setSpecialPrice($prod_data['special_price']);
                      $productResource = $objectManager->create('\Magento\Catalog\Model\ResourceModel\Product');
                      $productResource->saveAttribute($product2 , 'special_price');
                      $product2->save();

I tried indexer:reindex but no use of it. Cleared cache, verified store id and everything is correct.
But still special price not showing in product detail page as well as cart page. How can i debug it.


texts: How can I add a body class to a page through Layout Update XML - Magento2

texts: I'm trying to add a unique body class to a category page through the Layout Update XML.


texts: Customer Login - form_key validation fails - Magento 2

texts:
Hi i am trying to login to the customer but it redirects to login page.

I checked in there is form_key validation in LoginPost.php it redirects to the same page. But the same thing is working on live site. How can i resolve it. Any help.


texts:
How to remove decimal from "Order Summary" email template?
The Order Summary box is rendered from this email template line:

 {{layout handle="sales_email_order_items" order=$order}}


texts: Is there a git repository service that is accepting bug fixes for Magento CE 1.9?

texts: I have found this https://github.com/OpenMage/magento-lts (OpenMage/magento-lts) and I am wondering if this is "official" or something.


texts: How to use bootstrap in my back-end module?

texts: I'm trying to build my first backend module and I was wondering if it is possible to use the bootstrap in the Magento Backend, or if it is only with html tags? I tried to use the bootstrap added in the default_head_blocks.xml of my module but it didn't work.


texts: this error" Err_TOO_Many_Redirect" path is admin/noroute/denide?

texts: this erro happend when user role change to denied.and whenwver you loggin to admin page it is redirect many times error.


texts: getImageUrl() returning nothing in Magento 2.3.5 -p1 version

texts:
I want to get all categories name and image URL(to show image) to show on the storefront but when I am using function getImageUrl() and getImage() returns nothing. Why this is happening can anyone help me?.I am using Magento 2.3.5 -p1 version.
I am using the following code for block-
<?php
namespace Demo\GetAllCategories\Block;
class DisplayAllCategory extends \Magento\Framework\View\Element\Template {
    protected $_categoryHelper;
    protected $categoryFactory;
    protected $_catalogLayer;

    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Catalog\Helper\Category $categoryHelper,
        array $data = []
    ) {
        $this->_categoryHelper = $categoryHelper;
        parent::__construct(
            $context,
            $data
        );
    }

    /**
     * Retrieve current store level 2 category
     *
     * @param bool|string $sorted (if true display collection sorted as name otherwise sorted as based on id asc)
     * @param bool $asCollection (if true display all category otherwise display second level category menu visible category for current store)
     * @param bool $toLoad
     */

    public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true)
    {
        return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad);
    }
}

Phtml code-
<?php
    $categorys = $this->getStoreCategories(false,false,true);

    foreach($categorys as $category){
        echo $category->getName();
        ?>

        <?php
        echo $category->getId();
        ?>

        <?php
        echo $category->getImageUrl();
        ?>

        <?php
        echo $category->getUrl();

    }
?>


texts: Why do I get "404 site not found" on products of copied project

texts:
I created a copy of my project for developement.
Everything works, but I get site not found if I click on any product. I tried all different categories.

I already compared the category, article and even url rewrite of the working live environment with my copy. Everything is exactly the same, so it should work.

Caching is disabled. I even reindexed everything and deleted the cache even though it is deactivated, to get sure.

What I've tried:

I went to "System -> Configuration -> General -> Web" and deactivated web server rewrite.
Added "index.php" to my url e.g. http://www.example.com/index.php/myproduct.html instead of http://www.example.com/myproduct.html, but it did not helped at all.
Called the product directly "http://www.example.com/catalog/product/view/id/1787"

I also checked the Rewrites in FIREGENTO, this is what I get:

What else can I try?


texts:
This is the problem.

Live site blank in frontend or keep on loading and never load

impossible solution is we have to tell to customers that please clear your browser cache and than browse our site.

We need some Permanent solution for this.

please someone help us.


texts: Create Store Programmatically on frontend

texts:
I want to create stores/store_views programmatically from the frontend. Is it possible to do that?
I have not found any useful tutorial explaining to create stores/store views.
I am using Magento 2.4.1


texts: Help interpreting magento AOE profiler results

texts:
Anything that involves loading products in my magento store is very slow. I understand that this is the case by default, but I suspect that there's a bottleneck somewhere else in my code related to products.

Here are my profiler results for editing a configurable product with template options :

I am a bit confused interpreting this. Does this mean that the bottleneck, the red part in this picture, is located in the dispatch controller? Is the solution to go through that file and figure out what is happening?

The product grid in the admin is so slow, that it doesn't even load in the profiler. It takes 10 seconds to load on the server, and the server is an optimized dedicated machine.


texts:
I have errors after the upgrade. You can see error below.

Can anyone help us to fix this error?

  1 exception(s):
  Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).
  Line: 1139


texts: Magento2 : I'm trying to install stripe extension but having the below issue

texts:
I'm trying to install stripe extension but having the below issue.
any advice highly appriciated


texts:
The latest builds of Magento 2 have done away with the Mage class.  This mean we've lost the Mage::helper method.

Is there a replacement technique (helper factory?) for instantiating helpers in Magento 2?  Or are we expected to use the new Object manager class, and just instantiate the helper as a  singleton/cached object with get (vs. create)


texts: How to tax freight in some states, not others

texts:
We have built tax rates based on ZIP codes for all 50 American states. We have since learned that we need to tax FREIGHT for the destinations states that require it, and not for the states that don't. We cannot figure a tax rule that would accommodate this or any method to add freight tax according to the destination state. Has anybody dealt with this before, or have an idea how we might accomplish this?

thank you!!


texts: Magento 2 Need to add Terms & Conditions on checkout page under Flat rate shipping

texts:
Magento2 Need to add Terms & Conditions on checkout page under Flat rate shipping.
Currently it is under payment sections & Review section


texts: My friend has been using Magento.  Now somehow some files from the hosting was deleted by him by mistake. Now if I go for a re installation, and use the existing data base will my old data be erased? I have seen that several files folders are missing.. What can be the possible solution?


texts: I'm actually trying to find a function which has to detect if the website is in maintenance mode or not do someone have the answer please? I know we can do it in the Console but I need it in one of my bloc.


texts: Customize magento newsletter subscription notification

texts: I'm sure this can be done i just don't know where it is, i have had a look to see about it but i can't really see much about it. I have attached the notification what i am on about.


texts:
I'm using the Bitnami Magento Virtual Machine.

Virtual Machine. Debian 8 ( with mariadb, php 7.0, apache2 , memcached && more )

The documentation:
https://docs.bitnami.com/virtual-machine/apps/magento/

I explain the problem:

The popup window is triggered without actually occurring an error as far as I can see in the logs, they are only notifications.

I attach only Pages but is the same for the customers, etc..

the system.log file:

  [2017-08-31 09:55:25] main.INFO: Cache file with merged layout:
  LAYOUT_adminhtml_STORE1_36f1b068ec7ccf4878f9284dd1137afd1 and handles
  catalog_product_prices: Please correct the XML data and try again.  []
  []

and more ..

the debug.log file:

  [2017-08-31 09:36:51] main.DEBUG: cache_invalidate:
  {"method":"POST","url":"192.168.1.136/admin/admin/index/index/key/1e497d0840c72302fd6a8e103fef7da02440f1fb8fd10260bf56405ff112fe6b/","invalidateInfo":{"tags":["BACKEND_MAINMENU"],"mode":"matchingAnyTag"},"is_exception":false}
  []

I read posts where I had to use varnish to fix it, others I had to modify the ui_bookmark table and remove the title with null which I accessed at that time, but nothing.

Could you give me an option to disable all these popups from the admin panel or else a code fix to fix the problem?

Anything else that is missing please tell me. Thanks for your time.


texts: Magento 2 cannot set searchCriteria to rest api for categories

texts:
Tried using the url below to get all sub-categories, but it retuns all categories without filtering.

http://127.0.0.1/magento/index.php/rest/V1/categories/?searchCriteria[filter_groups][0][filters][0][field]=level&searchCriteria[filter_groups][0][filters][0][value]=3&searchCriteria[filter_groups][0][filters][0][condition_type]=eq

Is categories not support searchCriteria?


texts: how to model One-to-many model with just 1 SQL?

texts:
One to many relation
A  parent has muitple children. Let's say we want to query all parents with its children.
Related classes
ParentModel, ChildModel , both are instance of Magento\Framework\Model\AbstractModel.
ParentCollection is an instane of \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Question
how can we get all parents that are filled with its children using just one SQL statement ?
Let's  assume 1 parent with 5 children.  the following will have 5 records which will be treated as ParentModel, but it is ChildModel.
class ParentCollection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    protected function _construct()
    {
        $this->_init(
            \Vendor\A\Model\ParentModel::class,
            \Vendor\A\Model\ResourceModel\ParentModel::class);
    }

     /**
     * Join plate_option table
     *
     * @return self
     */
    public function withOptions(): self
    {
        $this->getSelect()
            ->joinLeft(
                [
                    'child' => $this->getTable("child")
                ],
                'main_table.id= child.parent_id'
            );

        return $this;
    }
}

I check the source code of AbtrationCollection , it seems imposible to do this.


texts: How to remove Price filter section from layered navigation

texts: Iam trying hard but still not getting to remove SHOP BY and PRICE FILTER SECTIONS from layered navigation please help me in removing those items.


texts: I ran this script via php -f cache.php destroy and now it appears as though all site CSS is gone when it is loaded. How could clearing the cache of Magento remove CSS entirely and what would you do to get it back?


texts:
I am trying to create a messagequeue consumer to run a cron job manually with parameters
I have defined configuration files (see below), and I can run s:up and s:d:c successfully, but when I go to use \Magento\Framework\MessageQueue\PublisherInterface::publish it throws an error that

[2021-05-07 13:44:16] report.CRITICAL: Message queue topic "SomeProject.queue.import" is not configured. [] []

But I ran this:
$ bin/magento queue:consumers:list
quoteItemCleaner
inventoryQtyCounter
async.operations.all
---SomeProjectImportQueue---

So why do I get this error when I am trying to publish?
Currently I have the following files:
communication.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd">
    <topic name="SomeProject.queue.import" request="string">
        <handler name="SomeProject.queue.import.handler" type="SomeVendor\SomeProject\Model\Queue\ImportConsumer" method="process"/>
    </topic>
</config>

queue_consumer.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
    <consumer name="SomeProjectImportQueue"
              queue="SomeProject_parameterised_import_queue"
              connection="db" />
</config>

Model/Queue/ImportConsumer.php
<?php

namespace SomeVendor\SomeProject\Model\Queue;

use Magento\Framework\Exception\LocalizedException;
use SomeVendor\SomeProject\Model\Api\SubscriptionsImport;
use Magento\Framework\Serialize\SerializerInterface;

/**
 * Class ImportConsumer
 * @package SomeVendor\SomeProject\Model\Queue
 */
class ImportConsumer
{
    /**
     * @var SubscriptionsImport
     */
    protected $subscriptionsImport;

    /**
     * @var SerializerInterface
     */
    protected $serializer;

    /**
     * ImportConsumer constructor.
     *
     * @param SubscriptionsImport $subscriptionsImport
     * @param SerializerInterface $serializer
     */
    public function __construct(
        SubscriptionsImport $subscriptionsImport,
        SerializerInterface $serializer
    ) {
        $this->subscriptionsImport = $subscriptionsImport;
        $this->serializer = $serializer;
    }

    /**
     * @param array $markets
     *
     * @throws LocalizedException
     */
    public function process(array $markets) {
        $marketsString = $this->serializer->serialize($markets);
        $this->subscriptionsImport->import($marketsString);
    }
}

queue_publisher.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd">
    <publisher topic="SomeProject.queue.import">
        <connection name="db" exchange="SomeVendorcc-exchange"/>
    </publisher>
</config>

And finally queue_topology.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/topology.xsd">
    <exchange name="SomeVendorcc-exchange" type="topic" connection="db">
        <binding id="SomeProjectImportQueueBinding"
                 topic="SomeProject.queue.import"
                 destinationType="queue"
                 destination="SomeProject_parameterised_import_queue" />
    </exchange>
</config>


texts: Magento : Invoice : draw table on product list

texts:
I am not so good at Magento pdf, Any one who applied this please help me. In a Invoice PDF i need to draw table for the products list or item list,

it would very great if any one helps me out with this.


texts:
I am doing the following to get some orders out of the system for export:

$orders = Mage::getModel('sales/order')->getCollection()
    ->addFieldToFilter('status', $statusToExport)
    ->addFieldToFilter('store_id', $this->processingStoreId)
    ->addFieldToFilter('updated_at', array('gteq' => date('Y-m-d H:i:s', $lastSyncTime)));

I need to add something in where it doesn't export if the order entity_id is in a custom table I have. If I was using SQL, I would do:

left join myTable as mt on main_table.entity_id = mt.entity_id
where mt.entity_id is null

But I am not sure how to modify the collection query to do a similar thing.

Note: I did try

$orders = $orders->getSelect()
    ->joinLeft(
        array("t1" => $myTable),
        "main_table.entity_id = t1.entity_id",
        array("admin_field_id" => "t1.id")
    )
    ->where("t1.id is null")

but this changes it so it's a query and I want the sales/order collection returned.

I feel I am missing something simple ...

EDIT

Ok, I have tried this:

$orders->getSelect()
    ->joinLeft(
        array("t1" => $myTable),
        "main_table.entity_id = t1.entity_id",
        array("admin_field_id" => "t1.id")
    )
    ->where("t1.id is null");

When I echo (string)$orders->getSelect() it returns the query I would expect and returns no results when I run it. $orders however, still contains items. I thought this join was meant to modify the collection at this point?


texts: How to get the type of credit card from a Magento\Sales\Model\Order?

texts:
My ultimate goal is to include the type of credit card (Visa, Mastercard etc.) into order emails. Assume that customer always chooses to pay with a card.

I tried adding {{var order.getPayment().getCcType()}} in order_new.html email template, but it prints nothing. order variable is set correctly, I can get some other properties of order.getPayment() to display in the email.

In order to debug this, here is what I do in an observer that fires at email_order_set_template_vars_before event:

/** @var Payment $payment */
$payment = $observer->getData('transport')['order']->getPayment();
var_dump($payment->getCcType());
die;

Then I go to Admin panel, choose an order I placed that is to be paid with a credit card, and press "Send email" at the order page, to resend the email a test customer should have received. The observer (code above) prints NULL.

I don't know what else I can try. Why is $payment->getCcType() NULL when I chose a credit card?


texts: Magento VAT calculation issue with Price Inclusive TAX

texts:
I have product with Price 6.50 € which includes 24% VAT in it.
When I add it to cart, for 1 quantity the price shows correct.

Net value     5.24 €
VAT 24%       1.26 €
Total value   6,50 €

Now if I add 3 products to cart, the total becomes incorrect.

Net value     15.72 €
VAT 24%       3.77 €
Total value   19,49 €

Which is 0.01€ less than correct subtotal. It should be,

Net value     15.72 €
VAT 24%       3.78 €
Total value   19,50 €

Here you can see that VAT value is calculated wrong. It calculates 24% of 15.72 which is 3.77 and its correct, but it should be calculated on each product and then summed up to be 3.78

UPDATES
I have tried by setting Unit Price

  System -> Configuration -> Tax -> Calculation Settings

But it gives me results like,

Net value     15.72 €
VAT 24%       3.06 €
Total value   18.78 €

It is because we are using a module Additional Fee extension on site, which adds 1 € to each product price. So I need to use Row Total to add Additional Fee data. SO I cannot use Unit Price, it gets Product Price which is 4.24 € to calculate Tax amount
Is there any other way?


texts: What is best RDS for magento and how to migrate database

texts:
I've a storefront that run on c5d.xlarge. I need to migrate database to RDS. It's MySQL database and contains about 600 table.

Uploading csv need some processing like get range for years in following attribute: 2000-2013.

I've two questions:

1- What are the best instance RDS class for magento database?

2- How to migrate database from EC2 instance to RDS?

  Magento version is 2.1.7

Update:
Database size is 1568.22MB which is about 1.6GB and average daily checkouts range from 200 checkout/day up to 200 checkout/day


texts: How data are coming into ElasticSearch while running catalogsearch_fulltext?

texts:
I have ElasticSearch as a catalogue search engine. Whenever we are running catalogsearch_fulltext, it is pushing the data into ElasticSearch. I need to do apply a filter to those data before pushing into ElasticSearch.

can anyone point me which file I need to apply filters?

I have tried CLI xDebug with PhpStorm and unable to locate the file where the ElasticSearch gets data.

Thanks.


texts: Magento 2 Change Reset Password email template

texts:
In Magento 2, when editing a customer in the backend you have the option to Reset Password for the customer, when click on Reset Password, customer will get an email with a link to reset the password.

However, I can't find out where to edit the reset password email template.

I have tried to create a new email template in Marketing -> Email Templates. I created the new email template from Reset Password (template). And in Configuration -> Customers -> Customer Configuration, under the Pasword Options, I set Reset Password Template to the one I created in Email Templates.

But it has no effect. Magento is still using it's default email templates.

I have made sure it's the correct storeview and I also made sure the cache is cleared.

What did I miss?


texts: Magento - Can't reach shopping cart - redirect straight to checkout

texts:
I have issues with my magento. I can't reach shopping cart page because it redirects to checkout page every time.
I'm using custom template, minimum order amount and built in checkout page.
It was working until I transfered website to another domain.

Does anyone know what to do?

Thank you in advance


texts: SUPEE-10570 buggy patch 500 error after enabled compiler Magento 1.9.1.0

texts: I am having issue with this new SUPEE-10570 pathch, when I compile after installing the patch. It gives 500 error on customer login, cart and checkout. This issue not appear if compilation is disabled.


texts:
I created a new attribute: tags

here I assign example: sneakers men and set search weight 10
In second attribute I created brand and here I set weight 9

Now When I search for example: Sneakers men Nike should display only products with these tags/attributes.

But Magento displays first these products and when it displays these products with these attributes, after this it also displays a lot of other products not related to the search. How to solve it?

Any solution on how to set the correct search engine?


texts: How can i programatically filter products using attributes price,color,manufacturer in magento 2

texts: I need to filter products in a category using color,manufacturer and price.please help me to solve this.


texts:
Main site url

I have removed the index.hmtl file from root but still site is redirecting to index.html and i couldn't find any mode rewrite in the htaccess file. But site is still redirecting to index.html.

How to remove the redirection or re - redirect into index.php

Suggest me please.


texts:
I am trying to create new customer using magento soap api , here is my code :

    $client = new SoapClient('http://map.itgprojects.pw/api/v2_soap?wsdl=1');

    `$session = $client->login('mylogiin',` 'myapikey');
    $result = $client->customerCustomerCreate($session, ['email' => 'cusdtomedr-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1]);

    var_dump ($result);

I keep getting this error and I don't know why, even if the user has been added to the database :

  Uncaught SoapFault exception: [SOAP-ENV:Server] Call to a member
  function getUserId() on null in
  /home/mapitgprojects/public_html/api/customer.php:51

version of magento : 1.9

I am working on an ionic app and I'am creating a web service to do some stuff.

Thank you for your help


texts: Some of the webp images not loading Magento 2

texts: Some of the webp images not loading. Showing 404 error. How to remove this format in Magento 2.


texts: Advance Conditions for Pricing for shipping

texts:
Hello
How i can make next for pricing for shipping:

Manufacturer - items (from different manufacturers different
delivery charges)
Free Shipping:

On some items
Some manufacturers are always free
When the amount in the cart reaches a certain value, $ 1000 or more

Thanks


texts: core/session value not available on custom module page

texts:
I'm using core/session for storing values, I'm use the following code to store the value:

Mage::getSingleton('core/session')->setMyWishlist( $newmywishlist );

On category and product pages but also on cms pages I can read the value by using:

$mywishlist = Mage::getSingleton('core/session')->getMyWishlist();

But on pages from my custom modules, not a cms page, I can't get the value.

When I debug core/session I also noticed that the session_id is different on the custom module page.


texts: Magento 2.3.1 Add configurable products - all product pages show the same attributes

texts: Add configurable products, the size and color will appear on the new page of each product, which makes me very distressed.


texts:
I would like to place a website switcher in the header.
I checked this but not sure in which file to place the code..

Show Website Switcher on Header in Magento 2

Can anybody help me?


texts: Magento : Get RETURNED/EXCHANGED Items List From Database

texts:
I would like to build a report in Magento admin, where I can see all  products that have been returned or exchanged.

Does anyone know how to get a list of all the returned/exchanged products from a Magento database?


texts: Magento 2 API "self" route: pass customer ID as data parameter

texts:
Let's say I have a custom API endpoint in my module's etc/webapi.xml file that should return all the books that belong to the authenticated customer making the request. For example:

<route url="/V1/books" method="GET">
    <service class="MyVendor\MyModule\Api\BookInterface" method="getCustomerBooks"/>
    <resources>
        <resource ref="self"/>
    </resources>
</route>

The method getCustomerBooks on the interface BookInterface, implemented through the class Book require the $customerId as the one and only required parameter. The customer making the request doesn't know their customer ID, and has already received an authorization token through the V1/integration/customer/token endpoint. The token is included in the HTTP Authorization header of the request, e.g. Authorization: Bearer [token].

The core customer module's /V1/customers/me endpoint seems to be doing this by adding a data node inside the route node:

<route url="/V1/customers/me" method="GET">
    <service class="Magento\Customer\Api\CustomerRepositoryInterface" method="getById"/>
    <resources>
        <resource ref="self"/>
    </resources>
    <data>
        <parameter name="customerId" force="true">%customer_id%</parameter>
    </data>
</route>

However, when I try adding this to my route and make a request, I get an error like:

{
  "message": "%fieldName is a required field.",
  "parameters": {
    "fieldName": "customerId"
  }
}

How is the customer module injecting this customer ID as a parameter to the getById method?


texts:
Happy Holidays everyone,

I'm in a quest to develop a block that shows 3 given categories within same view block.

I have this till now in my phtml file:

<?php
/**
 * Displays multiple category view templates along with the product list for it
 */
/* @var $this Mage_Core_Block_Template */

$category_ids     = explode(',', $this->getData('category_ids'));
$current_category = Mage::registry('current_category');

if ($current_category) {
    Mage::unregister('current_category');
}

foreach ($category_ids as $it => $id) {

    $category = Mage::getModel('catalog/category')->load(trim($id));

    if (!$category->getId()) {
        continue;
    }

    Mage::register('current_category', $category);

    global ${"category_"$it} = $this->getLayout()->createBlock('catalog/product_list', 'product_list_'.$id, array('template' => 'catalog/product/list.phtml'));

    Mage::unregister('current_category');

}

foreach ($category_ids as $it => $id) {
        global array product_list ( array $product_list [, array ${"category_"$it}] );
}

Mage::register('current_category', 'category_1');

echo $this
    ->getLayout()
        ->createBlock('catalog/category_view', 'category_1', array('template' => 'catalog/category/view.phtml'))
        ->append($product_list, 'product_list')
        ->toHtml();

}

if ($current_category) {
    Mage::unregister('current_category');
}

and I have this in my cms design page:

<reference name="content">
    <block type="core/template" name="multiple_categories" template="catalog/category/multiple.phtml">
        <action method="setData"><key>category_ids</key><val>12,13,26</val></action>
     </block>
</reference>

This code is an adaptation of this answer, which successfully shows multiple categories, but with multiple blocks.

Unfortunately when I set code given above, my CMS page goes blank.

Does anyone know how to help me? Any tip is appreciated.


texts: How to check if a column filter already applied into collection

texts:
I want to check if a column entity_id filter already applied into collection.

For eg: Product collection has already applied entity_id filter where entity_id in (1,2,3)  etc.

So i want to check that if collection already has entity_id filter .


texts: How to add a single product with multiple quantities at a time to cart page in magento1?

texts:
Is it possible to add product with multiple quantities on product detail page with additional add to cart button? Same as on this site

Can you please help me?


texts:
I saw my site was checking out over http not https, so I went to config settings and under the web tab, I entered https to both secure and unsecure.

Turns out my ssl has expired and now my entire site is down, front and back end. How do I revert the settings if I can't access back end?


texts:
We have our Magento set-up to currently charge VAT to customers in the EU (we're based in the UK) and then customers outside the EU get charged the ex-VAT price. So if the item is £20 inc VAT to a UK customer then the non-EU customer gets charges £16.67

I've got a client wants customers outside the EU to pay the same price as they would in the EU - so the item is £20 regardless of where the customer is.

We want sales in the EU to still accurately reflect the VAT but someone in the US would be charged £20 with no VAT reflected in the sales invoice.

Is there a way to do this? I'm wary about doing this and messing up our VAT calculation. I also want to keep our VAT settings the same for all our other clients on the same Magento installation (we run multiple stores under one Magento) so don't want to make a change that affects the global settings.

Any thoughts would be much appreciated.


texts: Magento 2: How to check the image of product with hash cache folder used or unused?

texts: I have many images in cache folder. When I delete product or image from admin, the image is still there. How can I check that the image of product with hash cache folder used or unused to remove it? I can get unused images  but they are too much and take long time to remove. Can anyone share the workaround to check this issue?


texts: Question mark appears instead on content on calling static block

texts:
I have made a static block for korea website for korean language. In this the content is in korean language. Then i have called this static block in phtml file. The block is called but the content which should appear in korean language is appearing as question mark.

I have also attached the screenshot.


texts:
I want to show a message as a pop up on my homepage load with just a message, no email subscription, nothing.
I just want to display a message.
How can i do that?


texts:
I want to edit the standard "add to cart" button to a "CLICK TO BUY" button.

So that, once clicked will link through to the same product on another store (same magento install).

  Store 1 is a trade only site with no purchase function but would like
  to edit as above to link through to store 2 for an option to buy.

I think its relatevly simple. Some sort of get statement that looks up the URL and then changes the web address from www.store1.com to www.store2.com

Any advice would be much appreciated.


texts:
Magento ver. 1.7.0.2

Hello Magento Geeks... need some helping hand.

Story

Adding custom attribute to custom module developed by 3rd party (with no documentation).
Field is part of social media links collection, and most of them been implemented before (twitter, facebook, youtube... now trying to add instagram).

Since I have no clue about Magento structure I ran -grep command to obtain all locations where other fields been mentioned in the code and modified code by adding new field. (tested, nothing got broken).

Added new attribute in the attribute set for the module. Checked DB if everything was added - everything in place.

Grep for usage of the tables from DB with those attributes, and added file with insert/update etc to database. Now, what alerts me - in the folder with files used for all DB inserts, all files are numeric, and created same time (same minute)... which makes me think that manually added file probably won't work, there should be some sort of compiler that rewrite/reindex those files.

I ran re-index in Magento admin just in case.

Now, needed field is in admin panel, however information after entering and saving is not going to the database. If row manually added in the database with full reference to specific record, it's not being pulled out from the database too neither to admin backend, nor to frontend.

Question

What is the proper process to add new attribute in Magento? How to make it talk to database?

Thanks in advance for help.


texts: Apply free shipping coupon code only for spefic shipping method

texts:
in project i have two different custom shipping method one for 8 to 15 days delivery and 2 to 4 days delivery.
i have create coupon code for free shipping but i want to allow free shipping coupon code to only  8 to 15 days shipping method.
please help.


texts: How to get Magento 2 Customer before and after edit Customer data?

texts: I want to implement erp system in my Magento 2.3.4 website, i need to check whether customer has changed his name or dob, if the customer changed it , i need to send the updated data to the erp system, how can i achieve this?


texts: How to Add Customer Number When Any Error Occur At Customer Data Import Using CVS In Magento 2

texts:
i need to make customisation in that need customer number at row place show the customer number at error place like see the screenshot

At this place need customer number also


texts: Magento 2 : override customer grid collection

texts: I want to override customer grid collection to filter by customer group. How to add customer group filter on Customer grid?


texts: Magento Commerce 2.3 Quick order link for logged in customers only

texts:
By default the Quick order functionality of the B2B module is available for both logged in users as well as for guest users.
What can I do to hide it from guest users and make it available/visible for logged in users only? Basically It would even be sufficient to hide the Quick Order link in the top link section.
Thanks in advance!


texts: Get Product Collection based on brand parameter from cms page

texts:
I'm creating custom block to get products based on the brand name

I'd like to pass the brand name parameter from the cms page like below

{{block type="core/template" template="catalog/brand/brandprod_listing.phtml"  brand_name="mybrandname2"}}

However not sure how would i load my product collection in Block Model file dynamicallay receiving the brand_name parameter

Here is my model.

$collection = Mage::getModel('catalog/product')->getCollection();
$_productCollection = $collection->addAttributeToFilter('brand','mybrandname');

However as can be seen, how to get the parameter passed from cms page and load the results ?


texts: logo dimensions not effective in 1.9.1 e-mail

texts:
I uploaded a png logo with size 400x188px like this:
Admin panel -> Design -> I selected default config -> transactional emails

After that I selected the logo -> upload, I set width 200 and height 94 and then saved the configuration.

Now when I create an order I receive the email with the logo, but it is still large. Do i need to change the header file for emails?

2nd issue i have is that when i select password forgotten option, i get the default magento logo.

I have flushed all cache (even that it is not active at the moment) etc.

What am i missing?


texts: why function getRequiredCharacterClassesNumber() and getMinimumPasswordLength() return Null on company registration page but on register regular user can return number


texts: Magento 2 slow in developer mode with js, css merge, minimize, bundling configuration

texts:
I've found out when Developer mode is enabled with following settings

dev/css/merge_css_files
dev/css/minify_files
dev/js/merge_files
dev/js/enable_js_bundling
dev/js/minify_files

Magento 2 works really slow. Please explain why it is happens.


texts: How to add more actions to a column in Magento grid?

texts:
In Magento 1.9 I add a column to Sales Grid using an observer. I want to show more actions instead only one action.

With my code, in my column I see a select box, with the two actions. Instead I want to see the two actions, one under the other.

This is my observer:

class VendorName_ModuleName_Model_ObserverAddColumn
{
    public function addColumnToGrid(Varien_Event_Observer $observer)
    {
        $block = $observer->getEvent()->getBlock();

        if (!($block instanceof Mage_Adminhtml_Block_Sales_Order_Grid) || $block->getNameInLayout() != 'sales_order.grid')
            return $this;

        // Add a new column rigth after the "view" column
        $block->addColumnAfter('view', [
        'header' => $block->__('Header'),
        'width' => '60px',
        'index' => 'index_example',
        'type'   => 'action',
        'sortable' => false,
        'getter'   => 'getId',
        'actions'   => array(
                array(
                        'caption'   => Mage::helper('ModuleName')->__('One'),
                        'url'       => array('base'=> 'routerName/controllerName/actionName'),
                        'field'     => 'id'
                ),
                array(
                        'caption'   => Mage::helper('ModuleName')->__('Two'),
                        'url'       => array('base'=> 'routerName/controllerName/actionName2'),
                        'field'     => 'id'
                    )
        ),
        'filter' => false
        ], 'entity_id');

       return $this;
   }

}


texts: Magento 1.9 create configuratori graphic

texts: on Magento 1.9 I need something simple to create a graphical configuration page. the user must be able to upload a file and work / edit graphics. The classic options resize, move, insert text and change font sizes styles, change colors add move etc ... Then download your paper and send it. the file should be sent and received with the order in the magento backend. any suggestions? Thanks!


texts: Currently, some Magento js returned 404 error. Please check attached screenshot for the same.


texts: How to display video as second link in thumbnail images

texts:
In product details page I have video related to the product along with the thumbnail images. The video always comes at the last. I want to display the video as second link in the thumbnail images. What changes should I do to do that?

I get the video through attribute at backend. This is my code to display it in details page:

<?php if($_product->getVideoEmbeded()): ?>

<?php echo $_product->getVideoEmbeded(); ?>

<?php endif; ?>

And here is the code to change the base image with the video:

<?php if($_product->getVideoEmbeded()): ?>

<a href="javascript:void(0)" onClick="changemainimage('<?php echo $prurl  ?>','vdionly')" class="video_link " id="video_link">

<?php endif; ?>


texts: Best way to determine conversion rate per product

texts:
I want to determine the conversion rate per product in a certain time periode. I want to use this in a Magento extension. I am looking for the best way to do this. Most of all it should be reliable in terms of data validity i.e. the conversion rate must be accurate, or close.

I have been looking into Magento reports models, but I am not sure if this is reliable.
I have been think about loggin everything myself to my own db table (redundant?) with observers or a js tracking script.
Using google anylitics to pull data to my extension (overly complex?)

I am still not sure which approach to choose. Maybee another oproach? Anyone who can point me in the right direction?


texts: Magento 2 Saving store configuration programatically in upgrade script

texts:
I want to save store configuration programtically but I'm just getting one problem after another. Firstly I wanted to use Writer class but since it only updates core_config_data table it doesn't work with more complex models like the one I want to update. Since updating the config by path works via bin/magento config:set I started digging and found out that by using Magento\Config\Model\PreparedValueFactory I should be able to create object with correct backend model name I have to save. Now the problem is that when I create the PreparedValue object it doesn't have the information - the Magento\Config\Model\Config\Structure class that's being instantiated during the create() and is responsible for giving access to system.xml configurations doesn't have any data from said files, it's methods don't return anything.

I'm sure I'm providing correct config path to the Factory so it's not that, it just looks like Structure doesn't have any configurations collected during the run of PreparedValueFactory::create(), can I do something about it or just admit defeat? Or maybe is there an easier method for saving store configs by path from upgrade scripts?


texts: 5344 security patch installation error in Magento

texts:
Showing given below error, While I am installing the patch file in my Magento version 1.4.2.0. Please help me to find out the reason for the error!

Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

checking file app/code/core/Mage/Admin/Model/Observer.php
Hunk #1 FAILED at 37 (different line endings).
Hunk #2 FAILED at 44 (different line endings).
Hunk #3 FAILED at 55 (different line endings).
3 out of 3 hunks FAILED
checking file app/code/core/Mage/Core/Controller/Request/Http.php
Hunk #1 FAILED at 37 (different line endings).
Hunk #2 FAILED at 459 (different line endings).
2 out of 2 hunks FAILED
checking file lib/Varien/Data/Collection/Db.php
Hunk #1 FAILED at 421 (different line endings).
1 out of 1 hunk FAILED


texts: What observer needs to be use whenorder place

texts:
I am using Magento 1.9.

I am creating a module by using third party dropship API. I have an problem with order creation in Magento.

I am sending order details to third party website and want to save success order place in Magento after getting the true response from third party.

Here I am using sales_order_place_after Observer but it is creating order in Magento before a response comes.

If my response is false in this case Magento created the order successfully. Please suggest how can i do it.


texts: Strange error, call to undefined function

texts:
Here is my controller

class T2_Store_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

    public function registerAction()
    {
        $data = $this->getRequest()->getParams();
        //$data['root_category_id'] = createRootCategory($data);
        //$firephp->log($data);
        //var_dump($data);die();

        try {
            createNewStore($data);
        } catch (Exception $e) {
            echo $e->getMessage();
        }

        $this->_redirect('store/index');
    }

    public function createNewStore($data)
    {
        Mage::registry('isSecureArea');

        $multiWebEnable = Mage::getStoreConfig('web/multi_web_general/multi_web');

        //#add Website
        /** @var $website Mage_Core_Model_Website */
        $website = Mage::getModel('core/website');
        $website->setCode($data['store_url'])
                ->setName($data['store_name'])
                ->save();

        //#add StoreGroup
        /** @var $storeGroup Mage_Core_Model_Store_Group */
        $storeGroup = Mage::getModel('core/store_group');
        $storeGroup->setWebsiteId($website->getId())
                   ->setName($data['store_name'])
                   ->setRootCategoryId($data['root_category_id'])
                   ->save();

        //#add Store
        /** @var $store Mage_Core_Model_Store */
        $store = Mage::getModel('core/store');
        $store->setCode($data['store_url'] . '_default')
              ->setWebsiteId($storeGroup->getWebsiteId())
              ->setGroupId($storeGroup->getId())
              ->setName($data['store_name'])
              ->setIsActive(1)
              ->save();
    }

    public function createRootCategory($data)
    {
        Mage::registry('isSecureArea');

        // Create category object
        $category = Mage::getModel('catalog/category');
        $category->setStoreId(0);

        $rootCategory['name'] = $data['store_name'];
        $rootCategory['path'] = "1";
        $rootCategory['display_mode'] = "PRODUCTS";
        $rootCategory['is_active'] = 1;

        $category->addData($rootCategory);

        try {
            $category->save();
            $rootCategoryId = $category->getId();

            return $rootCategoryId;
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
}

And whenever I submit the form to registerAction() I will receive an error: Fatal error: Call to undefined function @ this line $data['root_category_id'] = createRootCategory($data);

This is the most strange error I ever met, please help.


texts: How to change custom order status through rest api in magento2

texts:
Can any one explain me or give me an example for

  changing the magento2 order status to customized status using rest API


texts: Script to update product prices for certain product types

texts:
I have a magento store (1.9.1.1).

I have a range of different product types, one of which is "Booking/reservation".

I need to update all these products, so that they have a price increase of £0.70p.

I don't want to have to manually amend each price and I hoped that someone out there had a script that I might be able to tweak?

Help advise or help would be really appreciated.


texts: Magento 2.1.8 Api merge the guest items to customer quote?

texts:
I would like to implement am Magento 2 REST api i.e

  if the customer login then we have to merge the guest items to
  customer quote.

As per the requirement i found one file in the respected path i.e

  /vendor/magento/module-checkout/Model/Session.php

public function loadCustomerQuote()
    {
        if (!$this->_customerSession->getCustomerId()) {
            return $this;
        }

        $this->_eventManager->dispatch('load_customer_quote_before', ['checkout_session' => $this]);

        try {
            $customerQuote = $this->quoteRepository->getForCustomer($this->_customerSession->getCustomerId());
        } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
            $customerQuote = $this->quoteFactory->create();
        }
        $customerQuote->setStoreId($this->_storeManager->getStore()->getId());

        if ($customerQuote->getId() && $this->getQuoteId() != $customerQuote->getId()) {
            if ($this->getQuoteId()) {
                $this->quoteRepository->save(
                    $customerQuote->merge($this->getQuote())->collectTotals()
                );
            }

            $this->setQuoteId($customerQuote->getId());

            if ($this->_quote) {
                $this->quoteRepository->delete($this->_quote);
            }
            $this->_quote = $customerQuote;
        } else {
            $this->getQuote()->getBillingAddress();
            $this->getQuote()->getShippingAddress();
            $this->getQuote()->setCustomer($this->_customerSession->getCustomerDataObject())
                ->setTotalsCollectedFlag(false)
                ->collectTotals();
            $this->quoteRepository->save($this->getQuote());
        }
        return $this;
    }

how do we implement this functionality in magento 2 REST api.

1) Is it possible to implement?

2) if it is possible, how to check with the postman?

3) is it possible to consider the session concept in REST apis?

Please suggest me and help me.

Thanks


texts:
I am trying to run CSV import using Dataflow Profiles, it shows import ran successfully and records updated, but when I check the product in admin its not updating many attributes but not giving any error, I tried to run magento's simple import, there the same CSV file says duplicate column name while I cant find any duplicate titles in my csv. I couldn't find a way to upload CSV here, so pasting just first 2 rows here

store,websites,attribute_set,prodtype,category_ids,sku,has_options,name,meta_title,meta_description,image,small_image,thumbnail,url_key,url_path,config_attributes,custom_design,page_layout,options_container,image_label,small_image_label,thumbnail_label,country_of_manufacture,msrp_enabled,msrp_display_actual_price_type,gift_message_available,no_of_solitires,solitaire_weight,solitaire_quality,setting_type,total_diamond_weight,diamond_quality,height,width,total_diamonds,length,diamond_setting_type,solitaire_setting_type,solitaire_color,solitaire_certificatetype,solitaire_certificateno,shipping_time,price,special_price,weight,msrp,status,is_recurring,visibility,tax_class_id,ringsize,metal,purity,diamond_shape,solitaire_shape,mine,chaintype,metalktcol,confmine,confmetalktcol,default_configuration_id,description,short_description,meta_keyword,custom_layout_update,special_from_date,special_to_date,news_from_date,news_to_date,custom_design_from,custom_design_to,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,low_stock_date,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,stock_status_changed_auto,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,stock_status_changed_automatically,use_config_enable_qty_increments,product_name,store_id,product_type_id,product_status_changed,product_changed_websites,product_id,gallery,minimal_price,gallery_label,stonecentercolor,associated,related,upsell,crosssell,tier_prices,bundle_options,grouped,group_price_price,downloadable_options,downloadable_sample_options,super_attribute_pricing,product_tags,old_id,recurring_profile,Ring Size:drop_down:1:0,listmine,listclarity,lay01metalktcol,lay01stntype,lay01stnshape,lay01stnsetting,lay01gender,lay01occassion,jewlength,jewwidth,jewheight,jewdiamete,prodengshankwidth,stonecentertitle,stonecentertype,stonecentershape,stonecentercolor,stonecenterclarity,stonecenterqty,stonecenterweight,stonecentersetting,stonecentersize,stonecentercertno,stonecentercerttype,metal01title,metal01type,metal01kt,metal01col,metal01ktcol,metal01weight,metal02title,metal02type,metal02kt,metal02col,metal02ktcol,metal02weight,prodneckhaintype,prodneckchainkt,prodneckchainlength,prodneckchainweight,prodneckclasptype,prodearbacking
default,base,Default,simple,"3,6,32",BD22393-14WH-SI-AG,0,BD22393-14WH-SI-AG -Try,BD22393,,/ImageAll/BD22393_WhWh-Main.jpg,/ImageAll/BD22393_WhWh-Main.jpg,/ImageAll/BD22393_WhWh-Main.jpg,,,,levelup/default,1 column,Product Info Column,,,,,Use config,Use config,No,,,,Channel Setting,0.14 carat,SI2,,,13,,,,,,,,319.99,,,,Enabled,No,Not Visible Individually,Shipping,,gold,14KT,Round,,Argyle,,,Argyle,14k White Gold,,"bridal-collection Band set in 14KT White Gold with  Diamonds (0.14 ct, SI2)",Bridal Band in 14KT White Gold with Diamonds (0.14 ct),,,,,,,,,5,0,1,0,0,1,1,1,0,1,1,,0,1,0,1,0,1,0,1,0,0,0,1,BD22393-14WH-SI-AG,1,simple,,,,"/ImageAll/BD22393_WhWh-Main.jpg,/ImageAll/BD22393_WhWh-Other.jpg,/ImageAll/BD22393_OnHand.jpg",,,H-I,,,,,,,,,,,,,,,,Argyle,SI2,14K WHITE GOLD,DIAMOND,ROUND CUT,CHANNEL SET,FEMALE,"ANNIVERSARY,WEDDING,BIRTHDAY,GIFT",,,,,,DIAMOND DETAILS,DIAMOND,ROUND CUT,HI,SI2,13,0.14 carat,CHANNEL SET,,,,METAL DETAILS,GOLD,14KT GOLD,WHITE GOLD,14KT WHITE GOLD,,,,,,,,,14KT,,,,

The attributes I am monitoring for change are:

metal01title
metal01type
metal01kt
metal01col
metal01ktcol
stonecenterclarity
stonecenterqty

Looking for help from experts here, TIA


texts:
I have magento core issue, I think

In the shopping cart Subtotal (Excl. Tax) is displayed including tax.
I did not notice this problem occurring before I installed Devsters_Gift_Cards
That I have uninstalled now, replaced with old database and files too, I think...
I have tried
deleting caches
reindexing
compiling
switching off compiler
changing tax settings
But still I get Subtotal (Excl. Tax) with tax included.

The weirdest thing
After I visit the checkout and go back to cart it is corrected and tax sum is added before grand total

What is going on there? I am in trouble. Any hints?

I am using magento 1.9.1.1
The page is here
http://oasis-solutions.ee/c/new-ray/index.php/

And an image


texts: Magento2 - How to update the value of an option of a product attribute programmatically?

texts:
I'm using the REST api and believe that we can't update the value of an option of a product attribute: we only have the POST method and no PUT.
So, what would be the best way to do it in code?
In fact, I would like to create a custom API endpoint to do that.
Thanks a lot!


texts: Magento2 multi website / store - Admin created customers are redirected to wrong store after password create & login

texts:
This is a Magento CE 2.2.5 project

We've found bug, reported here https://github.com/magento/magento2/issues/20148

Steps to reproduce

Create new customer in admin with associated website / store different than default store
Welcome mail with a link to "create password" feature is then sent to new customer
Create password works fine, and the customer is redirected to associated store login page

Expected result

After login, customer should be redirected to homepage (or dashboard, if configured... or any other page) of associated store

Actual result

After login, customer is redirected to homepage of default store

We've tried to fix this by forcing the right redirect with a plugin approach (afterExecute in \Magento\Customer\Controller\Account\LoginPost) & observer approach (controller_action_postdispatch_customer_account_loginPost event) but it still redirected to default store homepage

It seems this doesn't occur in 2.2.7 or higher versions. Any ideas to fix this without having to update the whole application?


texts:
Magento 2 installation page (step 6) freezes on 89% where in console log it stops on:

Module 'Magento_ConfigurableSampleData':
Installing data..

in my /etc/php/7.0/cli/php.ini file I have the follwing:

max_execution_time = 18000
max_input_time = 18000
memory_limit = 2G

What is wrong? why it does not continue after reaching 89% even if I wait for 1 hour?! how can I fix it?

note that the following is my php version:

PHP 7.0.5-3+donate.sury.org~wily+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

and the following is my Apache2 version:

Server version: Apache/2.4.12 (Ubuntu)
Server built:   Jul 24 2015 15:59:00

in /var/log/apache2/error.log I have the following at the time of the setup:

PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /var/www/magento2/vendor/magento/framework/Image/Adapter/Gd2.php on line 63, referer: http://[IP address]/setup/


texts: Migration: Magento CE 1.7.0.2 to Magento 2.2.0 CE

texts:
Migration process breaks due to below error:

  [system.db.CDbCommand] CDbCommand::fetchAll() failed: SQLSTATE[42S02]:
  Base table or view not found: 1146 Table 'db.catalog_product_website'
  doesn't exist. The SQL statement executed was: SHOW FULL COLUMNS FROM `catalog_product_website`. 2018/05/03 17:02:26 [error]
  [exception.CDbException] CDbException: The table
  "{{catalog_product_website}}" for active record class
  "Mage1CatalogProductWebsite" cannot be found in the database.

Magento version is CE 1.7.0.2 to 2.2.0 and I am using UB Data Migration Lite - 1.0.6.
When I checked in Magento 1 database table "catalog_product_website" is not exist.

What should I follow please suggest accordingly.


texts: Magento 2 controller override is not working

texts:
I am trying to override the "customer-edit-post" controller but am getting 500 Internal server error with following script.

di.xml :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
 <preference for="Magento\Customer\Controller\Account\EditPost" type="VestricsM2\Connector\Controller\Index\Post" />
</config>

Contoller: PackageName\ModuleName\Contoller\Index\Post.php

<?php

  namespace VestricsM2\Connector\Controller\Index;

  class Post extends \Magento\Customer\Controller\Account\EditPost{

     protected $logger;

     protected $resourceConfig;

     public function __construct(
                    \Magento\Framework\App\Action\Context $context
                   ) {

       parent::__construct($context);
     }

    public function execute(){
       echo "Testtttt"; exit;
     }
   }


texts: How can a customer choose between different format of digital products

texts:
We have two different websites that sells maps in different file format. Is there a ways or is there an extension where a customer can download a file according to their requirement on just one website.

Is there a way where we can upload different file format of a single map and sell that to the customer. It will also be easier to the customer where they can choose the file format that they want and buy it.


texts: How to Override Mage Payment Module Block Class?

texts:
I tried to override COD payment method.

I had to show COD option only if billing zipcode/postcode is one among the list I have in a table in my DB.

I had to modify the following to accomplish my task.

  Mage_Payment_Block_Form_Container --> function getMethods()
  Mage_Payment_Model_Method_Cashondelivery --> function getCODPincodes()

[getCODPincodes() is a custom method to check that pincode table and form an array to check with billing postcode]

It worked!!!

but when I try to create a module with this.

my config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Royal_Payment>
        <version>1.0.0</version>
    </Royal_Payment>
</modules>
<global>
    <models>
        <payment>
            <rewrite>
                <method_cashondelivery>Royal_Payment_Model_Method_Cashondelivery</method_cashondelivery>
            </rewrite>
        </payment>
    </models>
    <blocks>
        <payment>
            <rewrite>
                <form_container>Royal_Payment_Block_Form_Container</form_container>
            </rewrite>
        </payment>
    </blocks>
</global>

my folder structure

app\code\local\Royal\Payment\Block\Form\Container.php

<?php
class Royal_Payment_Block_Form_Container extends Mage_Payment_Block_Form_Container
{
public function getMethods()
{
    $methods = $this->getData('methods');
    if (is_null($methods)) {
        $quote = $this->getQuote();
        $store = $quote ? $quote->getStoreId() : null;
        $methods = $this->helper('payment')->getStoreMethods($store, $quote);
        $total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount();
        foreach ($methods as $key => $method) {
            $allowCOD = 1;
            if($method->getCode() == "cashondelivery"){
                $postcodes = Mage::getModel('payment/method_cashondelivery')->getCODPincodes();
                $shippingPincode = $this->getQuote()->getBillingAddress()->getData('postcode');
                if(!in_array($shippingPincode, $postcodes)){
                    $allowCOD = 0;      // don't allow cod method -- it goes to else part in next if... else... block
                }
            }
            if ($this->_canUseMethod($method)
                && ($total != 0
                    || $method->getCode() == 'free'
                    || ($quote->hasRecurringItems() && $method->canManageRecurringProfiles())) && ($allowCOD == 1)) {
                $this->_assignMethod($method);
            } else {
                unset($methods[$key]);
            }
        }
        $this->setData('methods', $methods);
    }
    return $methods;
}
}

app\code\local\Royal\Payment\Model\Method\Cashondelivery.php

<?php
class Royal_Payment_Model_Method_Cashondelivery extends Mage_Payment_Model_Method_Cashondelivery
{
    public function getCODPincodes(){
    $write = Mage::getSingleton('core/resource')->getConnection('core_read');
    $query = "select pincode from `pincode`";
    $results = $write->fetchAll($query);
    foreach($results as $result){
        $postcodes[] = $result['pincode'];
    }
    return $postcodes;
}
}

  My overriden Model is working fine.
  But block method is not invoked

Where am I going wrong? Can anyone help please?


texts: Toggle show more btn is automatically close itself in magento 2 layered navigation

texts:
I tried this jqery code and try to put "li" instead of "a"...but sometimes button works with this error in console"Uncaught error jquery is not defined"

but most of the times it's not working with no error in console.

File path: /app/design/frontend/theme/mycompany/Magento_LayeredNavigation/templates/layer/filter.phtml

    <?php foreach ($filterItems as $filterItem): ?>
            <?php if ($filterItem->getCount() > 0): ?>
                <a  href="<?= $block->escapeUrl($filterItem->getUrl()) ?>" class="term-list">

                   <?= /* @escapeNotVerified */ $filterItem->getLabel() ?>
                    <?php if ($this->helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer()): ?>
                        <?= /* @escapeNotVerified */ $filterItem->getCount() ?>
                            <?php if ($filterItem->getCount() == 1):?> <?= /* @escapeNotVerified */ __('item') ?><?php else:?> <?= /* @escapeNotVerified */ __('items') ?><?php endif;?>
                    <?php endif; ?>
            <?php else:?>
                <?= /* @escapeNotVerified */ $filterItem->getLabel() ?>
                <?php if ($this->helper('\Magento\Catalog\Helper\Data')->shouldDisplayProductCountOnLayer()): ?>
                    <?= /* @escapeNotVerified */ $filterItem->getCount() ?>
                        <?php if ($filterItem->getCount() == 1):?><?= /* @escapeNotVerified */ __('item') ?><?php else:?><?= /* @escapeNotVerified */ __('items') ?><?php endif;?>
                <?php endif; ?>
            <?php endif; ?>

    <?php endforeach ?>


texts: how to get attribute all dropdown values selected by the product in magento 2?

texts:
I am trying to show the attribute's dropdown values selected in product. For that I am using this way.

<?php $parentIds = $objectManager->create('Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable')->getParentIdsByChild($_product->getId());

if(count($parentIds)>0 && $_product->getTypeId() == "simple")
    {
        /*?><script>console.log('<?php echo $_product->getSku(); ?>')</script><?php */
    }
else {
        foreach ($_productCollection as $_product) :
            $_p = $objectManager->get('Magento\Catalog\Model\Product')->load($_product->getId());
            $productList[] = $_p;
            $priceRuleCats = $_p->getprice_rule_category();

            if(!empty($priceRuleCats)){
                $priceRuleList = array_unique(array_merge($priceRuleList,explode(',',$priceRuleCats)));
            }
        endforeach;
    // save the full list
    $fullList = $productList;

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $price_rules = $objectManager->get('Startupready\PriceRules\Model\Quantitybreaks');
    $price_rules->load($priceRuleList);
    $price_rules->getPricingTables();

    $current_table = 0;
    $size_options = array();
    $price_breaks = array();

    // use first product from loop to see what the size options are & load price breaks for those options
    $firstProduct = array_shift($productList);

    // this product's price rule category
    $price_rule_category = $firstProduct->getprice_rule_category();

    // loop through simple products
    $conf = $objectManager->create('Magento\ConfigurableProduct\Model\Product\Type\Configurable')->setProduct($firstProduct);
    $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
    foreach($simple_collection as $simple){
        echo $simple->getsize_option();
        //also i tried like this
        //echo "<pre>"; print_r($simple['size_option']); echo "</pre>";
    }
?>

but when I am putting my code inside the list.phtml file, no any products are displaying on this page.

Meanwhile I am just trying to get that product attribute inside this array so that if a product have assigned this values (doropdown values) then I'll show those values in frontend. Kindly please help me to do this. Thank in advance.


texts: Magento custom payment gateway Void invoice

texts:
I have a question about how to using the custom payment gateway to void the invoice?

After I have create the invoice with Capture Online. (it is success to capture the payment)

Copy from magento:
http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/chapter_8

Capture Online- When the Invoice is submitted, the system will capture the payment through the third party payment gateway. You will have the ability to create a Credit Memo, or Void the Invoice.

Void - If the Order’s payment is an online method, and you have captured the payment through Magento (either automatically during Order creation, during Invoice creation, or after the Invoice has been created), the Void button will appear. Pressing this will void the payment through the third party payment gateway. Unlike Cancel, the Invoiced quantity will no longer be able to be Invoiced again.

It means I can void the online payment after I have capture the payment or sales payment?!

But I cannot find out the void button on the order view page or invoice view page. How I can test the void function?

I am using the following code on my model

protected $_isGateway               = true;
protected $_canAuthorize            = true;
protected $_canCapture              = true;
protected $_canCapturePartial       = false;
protected $_canRefund               = true;
protected $_canVoid                 = true;
protected $_canVoidFlag             = true;
protected $_canUseInternal          = false;
protected $_canUseCheckout          = true;
protected $_canCreditmemo           = true;
protected $_canUseForMultishipping  = false;

public function cancel(Varien_Object $payment){

    $this->void($payment);

    return $this;
}

public function void(Varien_Object $payment)
{
   // my code
}