texts: Magento 2: Property does not have accessor method in class "Magento\Checkout\Api\Data\ShippingInformationExtensionInterface

texts:
I'm working on get extension attribute through checkout page
And i did it correctly(i thing), check this image below, the extension_attribute is rendered.

But when i click on "Next" button, it appear an error:

  Property "AmdeliverydatePo" does not have accessor method
  "getAmdeliverydatePo" in class
  "Magento\Checkout\Api\Data\ShippingInformationExtensionInterface

I don't know how to fix this error or have any solution for this, i've searched a lot but still no hope :(

Here is what i've done:

  extension_attributes.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Checkout\Api\Data\ShippingInformationInterface">
        <attribute code="amdeliverydate_po" type="string"/>
    </extension_attributes>

    <extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
        <attribute code="amdeliverydate_po" type="string"/>
    </extension_attributes>
</config>

  default.js

define(
    [
        'jquery',
        'underscore',
        'ko',
        'Magento_Checkout/js/model/quote',
        'Magento_Checkout/js/model/resource-url-manager',
        'mage/storage',
        'Magento_Checkout/js/model/payment-service',
        'Magento_Checkout/js/model/payment/method-converter',
        'Magento_Checkout/js/model/error-processor',
        'Magento_Checkout/js/model/full-screen-loader',
        'Magento_Checkout/js/action/select-billing-address'
    ],
    function (
        $,
        _,
        ko,
        quote,
        resourceUrlManager,
        storage,
        paymentService,
        methodConverter,
        errorProcessor,
        fullScreenLoader,
        selectBillingAddressAction
    ) {
        'use strict';

        return {
            saveShippingInformation: function () {
                var payload;

                if (!quote.billingAddress()) {
                    selectBillingAddressAction(quote.shippingAddress());
                }

                payload = {
                    addressInformation: {
                        shipping_address: quote.shippingAddress(),
                        billing_address: quote.billingAddress(),
                        shipping_method_code: quote.shippingMethod().method_code,
                        shipping_carrier_code: quote.shippingMethod().carrier_code,
                        extension_attributes:{
                            amdeliverydate_comment: $('[name="amdeliverydate_comment"]').val(),
                            amdeliverydate_po: $('[name="amdeliverydate_po"]').val()
                        }
                    }
                };

                fullScreenLoader.startLoader();

                return storage.post(
                    resourceUrlManager.getUrlForSetShippingInformation(quote),
                    JSON.stringify(payload)
                ).done(
                    function (response) {
                        quote.setTotals(response.totals);
                        paymentService.setPaymentMethods(methodConverter(response.payment_methods));
                        fullScreenLoader.stopLoader();
                    }
                ).fail(
                    function (response) {
                        errorProcessor.process(response);
                        fullScreenLoader.stopLoader();
                    }
                );
            }
        };
    }
);

Thanks for reading :)


texts: Category layered navigation include searchable products

texts:
I have a Magento (1.9.2.1) store I am working on where I have few categories (just 10), but each category has 1000's of single products. I only want a selection  of products (sort of featured but more of a selection) to display on any category page by default, but if the user then uses the layered navigation to filter down the products, then it will include all the products in that category as criteria are applied.
My first approach was the single product visibility setting choices of "catalog,search" and "search" but the layered navigation will only include the items which are marked as "catalog" or "catalog,search".
I need the layered navigation (including it's product count) to include everything in the category.
Does anyone know if it is possible (without a core hack) to get the layered navigation to include items which have a visibility set to "search" within that category? Or an alternative way of achieving this?
Any extension suggestions would also be welcome!


texts: Where is bar-code product attribute column in database?

texts: Hi, I make a dump of my database than search for the value of barcode in my sql file but it doesn't give me any record , i want to know in my database in which table barcode number is saving ? please guide.


texts: how to show 'coming soon' message on category pages

texts:
I am working on a project where client wants to have 'coming soon' message on some category pages. I am not sure how to put this message.

Any idea would be appreciated.


texts: Magento 2 Shopping Cart add Images and Text below Proceed to checkout button

texts:
I want to add some text and images below proceed to checkout button on cart page but I am not able to find the file so that I can add my classes and images as well as text.

Please suggest me in which file I will need to update.

Below is attached screenshot please check it:


texts: Magento 2.3 How to configure Multiple website with different domain

texts:
i have magento 2.3 store and i want to two website setup with in 1 magento admin

  my website url like: www.xyz.com  and another one is www.abc.com

but here i need also in both website different theme use so here i have confusion so i need another directory for another website ya in one directory i will do this  and which condition i will add in index.php or htacess file

any one help me anyone in this case

Advance Thanks!!


texts: How to pass view model class argument when call block from static block

texts:
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml">
<arguments>
<argument name="view_model" xsi:type="object">Magento\Store\ViewModel\SwitcherUrlProvider</argument>
</arguments>
</block>

I just want to call the above block via Static block (From Admin), but it gives an error due to ViewModel class.

I don't know how to pass view model argument when we call block via static block

Does anyone have any idea?


texts: Staging server does not recognize email template

texts:
I have created a email template named: order_new_guest.html.

This is placed in my custom theme Magento_Sales/email directory. On my local dev server it properly overwrites magento standard email template.

But on the staging server it does not find it and instead of that it uses the standard template.

Neither it is found in the loadable templates, when managing email templates in admin.

I have redeployed static, recompiled etc but still nothing.

Does anyone have an idea on how to fix this?


texts: Having a small issue with Magento CSV import

texts:
ive managed to use the profiler for CSV import on magento - when i run and execute the file i get this

http://imgur.com/UlyPREu

So the data processes 100% (i dont think images are crucial for products going live) but the new products do not import despite processing.

When i run the CSV against the regular import and data check, i get this:

Column names: "" are invalid

this is a screenshot of the data i am trying to import, i want to keep column headers if possible:

http://i.imgur.com/XNJPBdN.png

many thanks


texts: Magento Product Export: Use price and image of configurable product for linked simple products

texts: I am trying to find a way to export all my simple products with correct prices and images. For this I would also like to export all simple products linked to configurable ones. Since prices for these linked products are not always up to date, I need to find a way to fetch the configurable products price and use that for all linked simple ones. Same goes for the product image. Is there any way to do this?


texts: Checking Nginx log on Docker local environment on Cloud version?

texts:
I'm working on Magento Cloud version, but I'm having an error with 502 Bad Gateway on nginx.

502 Bad Gateway
nginx/1.9.15

My question is that how to check the nginx log on Docker local environment?


texts:
1 exception(s):
      Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'MGS_Mmegamenu::active_menu.phtml' in module:
  '' block's name: 'active.megamenu.script'

I'm getting this error only on product pages?

Any idea how to resolve this?

layout:

/public_html/waverunnerball.com/app/code/MGS/Mmegamenu/view/frontend/layout/catalog_category_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="page.wrapper">
            <block class="Magento\Framework\View\Element\Template" name="active.megamenu.script" template="MGS_Mmegamenu::active_menu.phtml" after="footer-container"/>
        </referenceContainer>
    </body>
</page>


texts:
I have created a custom shipping module following this tutorial adeptasoftware.co.uk/blog/magento-delivery-date-extension-part-1/.

But when I edit the order, the shipping price is not passed to the new order.

Anybody has an idea where to look?

Thanks a lot!


texts: Enable zoom feature in custom template in Magento 2

texts:
I am creating zoom feature on images in my custom template,

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
 paths: {
        'custom_zoom': 'Vendor_Module/js/jquery.zoom.js'
 },
shim: {
    'custom_zoom': {
        deps: ['jquery']
    }
 }
};

and in app/code/Vendor/Module/view/frontend/templates/custom.phtml


texts: Magento2: Set NOINDEX, NOFOLLOW for 404 page not found

texts:
How to set NOINDEX, NOFOLLOW for 404 page.

I've added below xml from admin no-route page.

 <reference name="head">
        <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
    </reference>

But it will only work for domain.com/no-route but it should work for all pages which not available on site ex. domain.com/psdfsdf


texts: Observer problem failed to open stream: No such file or directory

texts:
My Observer file is actually in the local code pool but it tries to open it from Warning: include(Mage/Schott/CurrencyDetector/Model/Observer.php): failed to open stream: No such file or directory. I don't know why it is trying to open the file from the wrong path.

Caches and compiler are disabled. Here is my config.xml. Can anyone help? Thanks!

<config>
<modules>
    <Schott_CurrencyDetector>
        <version>1.0.0</version>
    </Schott_CurrencyDetector>
</modules>
<global>
    <models>
        <schott_currencydetector>
            <class>Schott_CurrencyDetector_Model</class>
        </schott_currencydetector>
    </models>
</global>
<frontend>
    <events>
        <customer_login>
            <observers>
                <Schott_CurrencyDetector_Observer>
                    <type>model</type>
                    <class>Schott_CurrencyDetector/observer</class>
                    <method>customerLogin</method>
                </Schott_CurrencyDetector_Observer>
            </observers>
        </customer_login>
    </events>
</frontend>


texts: Overriding core controllers adminhtml issue

texts:
This is my xml:

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <mynamespace_mymodule before="Mage_Adminhtml">Mynamespace_Mymodule_Adminhtml</mynamespace_mymodule>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

and this is my controller:

require_once 'Mage/Adminhtml/Sales/Order/controllers/CreateController.php';

class Mynamespace_Mymodule_Adminhtml_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{
    public function loadBlockAction(){
        echo 1; exit();
    }
}

I didn't get the echo 1 . What did I do wrong ? thx


texts: Is it possible to extend the Magento XML-RPC API To Retrieve a list of attributes used in layered navigation, or is this a limitation of this API?


texts: Mage_Core_Model_Config - need a non-cacheable config

texts:
I'm using Mage_Core_Model_Config() to store and read some persistent data I need. I use it like this:

// init model config
$this->_config = new Mage_Core_Model_Config();

// set value
$this->_config->saveConfig($key, $value);

// get value
return Mage::getStoreConfig($key);

However, I noticed that even if I set new value, when I get it the data only update every couple of hours, and that's probably due to Magento cache. But I need my data to be immediate and change every couple of minutes.

Since I'm writing an extension I can't just turn the cache off at my clients servers.

So how do I put non-cacheable data in the config? or how do I force magento to drop the cache for a specific key?

If that's not possible, I'd also appreciate alternative suggestions to use something else instead of Mage_Core_Model_Config. All I need is basic key-value persistent storage mechanism.

Thanks!

Edit: is custom variables a good choice for me requirements?


texts: How to make stock quantity of another product decrease, when another product is bought?

texts: I am having trouble in finding ways of making other products quantity decrease, when a person buys a different item. This is because the item they buy will use quantities of other items listed.


texts:
I would like to create mobile app for my magento site for that I have created REST consumer and I got consumer key and consumer secrete.. Then I create rest.php file inside rootdirectory/api/rest. When I call http://localhost/magento/api/rest/ on my postman getting an error like

{"messages": {
"error": [
  {
    "code": 401,
    "message": "oauth_problem=nonce_used"
  }
] }}

What I will do? I am new to magento webservices..


texts: Magento 2 - Checkout loader keeps loading

texts:
Issue: Loader won't stop loading after page loading is finished.

In this question Irene891 gave this as an answer:

  "looks like problem caused by missed "checkoutLoader" configuration. Try to to add for div with id = "checkout-loader" data-mage-init='{"checkoutLoader": {}}'"

This is what I currently have:

<div id="checkout-loader" data-role="checkout-loader"
    class="loading-mask" data-mage-init='{"checkoutLoader": {}}'>

I've checked the file onepage.phtml in module-checkout on line 10 data-mage-init='{"checkoutLoader": {}}' is present.

When I check the page http://[url]/checkout/ with the developer tools, I can see when the page is loading data-mage-init='{"checkoutLoader": {}}' is present, but when the page is almost finished, it dissapears.

I'm looking for a good solution for this problem. A solution that doesn't include to remove the whole loader on the checkout page.


texts: Can't edit existing terms and conditions

texts:
I created a terms and conditions entry in my Magento 2.1.8 installation. It's showing up in the checkout and works as expected (on the frontend).

But...

When I attempt to edit the existing terms of use, I'm given a blank screen, with only the option to delete or save the terms.

Is this intended behavior? It seems counter-intuitive to have to delete the TOS and recreate it every time a change is made.


texts: Magento 2.3 Export not working | temando.CRITICAL: "accountId" is required

texts:
I am unable to "Export" any products on my Magento ver 2.3.3 site.
The error in the log file:
[2020-01-10 15:12:40] temando.CRITICAL: "accountId" is required. Enter and try again. {"exception":"[object] (Magento\\Framework\\Exception\\InputException(code: 0): \"accountId\" is required. Enter and try again. at /domains/staging.domain.co.uk/http/vendor/magento/framework/Exception/InputException.php:91)"} []

I tried to disable the module but I am getting the following error when trying to export:
Fatal error: Uncaught Error: Cannot instantiate interface Temando\Shipping\Model\ResourceModel\Repository\PackagingRepositoryInterface

I have removed the caches and content of the "generated" directory. Still the same error.
Any ideas on how to fix it?


texts: Facing error when importing downlodable product in magento2

texts:
I want to import downloadble product
when i was importing catalog_product.csv it's giving me below error:

  Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1
  Error move file in row(s): 1
  General system exception happened
  Additional data:
  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'website_id' cannot be null, query was: INSERT INTO downloadable_link_price (price_id,link_id,website_id,price) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE price_id = VALUES(price_id), link_id = VALUES(link_id), website_id = VALUES(website_id), price = VALUES(price)


texts: Notice: Array to string conversion in Escaper.php on line 261 after Upgrade from 2.3.5 to 2.4.0

texts:
System: PHP 7.3, MySql 5.7, Magento 2.4
After Upgrade
Exception: Notice: Array to string conversion in Escaper.php on line 261

This effect is only while displaying a Product grid with Image other works correctly. Same Effect in Widget new Product.
What can I do?


texts: How to manage cache issue on toplink in mageno 2?

texts:
I am showing logged in username in Magento2 toplink. But due to Magento full page cache, it showing another username. I tried using

  cachable="false"

for toplink block. It works on the MyDashboard page but it slows down my home page and other cms pages due to its make cachable false for the full page. Anyone, guide me on how to achieve it?

default.xml

<block class="Magento\Framework\View\Element\Template" name="top_link" template="Magento_Theme::html/toplink.phtml" cachable="false"/>

Code for reference(toplink.phtml)

    <?php if ($this->helper('Vendor\ModuleName\Helper\Data')->isLoggedIn()) : ?>

<a
            href="<?php echo $this->helper('Vendor\ModuleName\Helper\Data')->getBaseUrl('customer/account/logout'); ?>"><?php echo __('Logout'); ?>

<a
            class="name"
            href="#"
            title="<?php echo $this->helper('Vendor\ModuleName\Helper\Data')->getFirstname(); ?>"
        ><?php echo 'Hi, '.$this->helper('Vendor\ModuleName\Helper\Data')->getFirstname(); ?>
            &#9662;

<a
                    href="<?php echo $this->helper('Vendor\ModuleName\Helper\Data')->getBaseUrl('customer/account/'); ?>">My
                    Account

<a
                    href="<?php echo $this->helper('Vendor\ModuleName\Helper\Data')->getBaseUrl('returns/rma/list/'); ?>">Return
                    Order

    <?php endif ?>


texts: Snapshot param in Collection - null given error

texts:
I am trying to list some records using the listing UI-Component and i have a Collection like:

class Collection extends \Magento\Sales\Model\ResourceModel\Order\Shipment\Track\Collection
{

    public function __construct(
        \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot $entitySnapshot,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
         $mainTable,
        $eventPrefix,
        $eventObject,
        $resourceModel,
        $model = 'Magento\Framework\View\Element\UiComponent\DataProvider\Document',
        $connection = null,
        \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
    ) {
        $this->entitySnapshot = $entitySnapshot;
        parent::__construct(
            $entityFactory,
            $logger,
            $fetchStrategy,
            $eventManager,
            $connection,
            $resource
        );
        $this->_eventPrefix = $eventPrefix;
        $this->_eventObject = $eventObject;
        $this->_init($model, $resourceModel);
        $this->setMainTable($mainTable);
    }

The above class is instatiated in my di.xml:

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="shiptracker_tracking_listing_data_source" xsi:type="string">Vendor\MyModule\Model\ResourceModel\Tracking\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
<type name="Vendor\MyModule\Model\ResourceModel\Tracking\Grid\Collection">
            <arguments>
                <argument name="mainTable" xsi:type="string">sales_shipment_track</argument>
                <argument name="eventPrefix" xsi:type="string">sales_shipment_track_collection</argument>
                <argument name="eventObject" xsi:type="string">sales_shipment_track_collection</argument>
                <argument name="resourceModel" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Shipment\Track</argument>
            </arguments>
        </type>

My problem is that when i am trying to access the listing page, i am getting the following error:

  Recoverable Error: Argument 5 passed to Magento\Framework\Model\ResourceModel\Db\VersionControl\Collection::__construct()
  must be an instance of
  Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot, null
  given, called in
  /var/www/html/magento2/app/code/Vendor/MyModule/Model/ResourceModel/Tracking/Grid/Collection.php
  on line 56 and defined in
  /var/www/html/magento2/lib/internal/Magento/Framework/Model/ResourceModel/Db/VersionControl/Collection.php
  on line 32

The same constructor seems to be used by other collections without any issue.


texts: What is the difference between the customer attribute properties user_defined and system and what are they used for?

texts:
How to create a customer attribute is explained in various answers such as this or this. What they all have in common, is that when creating the attribute its properties user_defined and system are always defined like this:

'user_defined' => true,
'system' => false,

For me this doesn't work. When setting the properties as seen above the attribute is not visible in the adminhtml customer edit form. When setting user_defined => false and system => true it is shown but now saved. It only works (showing in form and saving) when both properties are set to false.

So my question is what is the difference between the two properties and what are they used for?

I am aware that these properties are used to mark "system attributes" which cannot be deleted easily like describes in this answer. I am looking for a more in depth answer what the difference between user_defined and system is. In addition what are both properties used for individually?


texts: Magento 2 option products of bundle are not showing in my orders magento core

texts:
I need the Qty of bundle options that I have ordered.

I can see getChildrenItems() on getting the count it returns me 1, it doesn't include child products.

  Bundle/templates/sales/order/items/renderer.phtml

  $items = array_merge([$parentItem], $parentItem->getChildrenItems());

renderer.phtml loads for both my orders and print order, For print I can see child product.

My Order

Print Order

How can i get the list of child products and the Qty ordered.


texts: Credit Memo - 'Email Copy of Credit Memo' how to set default ON

texts:
How to set the 'Email Copy of Credit Memo' checkbox to a default value of checked?

(So to negate the requirement to check the box every time)

Is there anyway to override the single input line within items.phtml, and not override the whole items.phtml template file?

Eg:


texts: Magento Credit memo before invoice captured

texts:
The client I am working with has a requirement that they are able to give credit memos before either full or partial capture of an invoice (i.e. money is authorized but not paid).

The idea being that no stock is being managed by magento, and magento has no way of knowing if something is in stock at a given time. The stock is managed by a 3rd party system. Generally they will receive new stock within days, but it may not necessarily match the items ordered. They want to be able to refund a part of any order.

Is there any way of doing this? Are there any extensions that offer this functionality?

The other way to look at it is, we need to be able to amend an order after its been authorized. In order to adjust the amount of money that is taken from the customer, specifically omitting any unavailable items. This must appear to be a refund from the customer's perspective as per our client's requirements.

All of this will be managed using a 3rd party integration that leverages the Magento API.


texts: cart empty after payment fail issue in magento 2

texts:
My cart is empty after payment fail. I want the cart quantity in quote after payment fail.

I'm using the PayUMoney Payment Method.
How can I do this?

Please share the quick solution.


texts: Magento - Programming updating/adding cross sell products

texts:
A site I'm building is migrating product information which includes cross sells (which may be more than one). In a local database I have put information on product sku and entity ids. My script takes this information and creates the cross sells association. The problem I'm having is some cross sells on these products have been done manually and when running this script it will over write all of the existing cross sells.

My code is:

umask(0);
require_once '../app/Mage.php';
Mage::app('admin');

$sql = "SELECT * FROM books2";
$query = mysql_query($sql);

while($row = mysql_fetch_array($query)){

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

    $collection->addAttributeToSelect('*');
    $collection->addFieldToFilter(array(
    array('attribute'=>'sku',   'eq'=>$row['assocIsbn']),

    ));

    echo "Looking at ".$row['assocIsbn']." relation prod id=".$row['magid']."
";

    foreach ($collection as $product) {

        $magentoID = $row['magid'];

        $param = array(
               $magentoID=>array(
                      'position'=>1
                )
        );
        $product->setCrossSellLinkData($param);

        $product->save();

        echo "Updated ".$row['assocIsbn']." with rel3 product of ".$magentoID."
";

        echo "
";
    }

}

What I really need is for the cross sells products to be updated but not overwrite the existing cross sells products.

Any help is much appreciated.


texts: Magento2 Get parent image from a simple product (configurable)

texts:
How can I get parent image from a simple product if the simple product has no base image?

The following code gets the simple product image in a template file.

$_imagehelper = $this->helper('Magento\Catalog\Helper\Image');
$productImage = $_imagehelper->init($product, 'category_page_list')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(400)->getUrl();


texts: Magento 2 - Mismatched anonymous define()

texts:
I've added a lot of RequireJS code, but know suddenly it does not work anymore. I get an error 'Mismatched anonymous define()' for code that's added from phtml files. This is the code where the error is thrown:

This is the error is thrown:

How can this suddenly not work anymore?
Update
I think there's something completely off with my JS loading. I get different JS errors each time I load the page:

Update 2
Thanks to Siarhey Uchukhlebau I found the answer. The real error was thrown by an external script (Tawk.to, a chat client). This error caused all kind of weird errors. I will investigate this problem further to check if we can isolated these kind of script to prevent them from messing with our main script.


texts:
I was trying to do something like this in my theme folder's default.xml

<referenceBlock name="footer_social_links">
    <block class="Magento\Framework\View\Element\Html\Link" name="social.link" after="">
    <arguments>
        <argument name="label" xsi:type="string" translate="true">Contact Us</argument>
        <argument name="class" xsi:type="string" translate="false">contact</argument>
        <argument name="path" xsi:type="string">contact</argument>
    </arguments>
    </block>
</referenceBlock>

It isn't working at the moment.  What I'm wanting to do is add some facebook icon and twitter icon linking to a specific page (pretty normal?).
I couldn't find other answers on the stackexchange here for Magento 2.

This was using XML code.  Do I need to do in PHTML?  I changed the "footer_links" to add custom links already with XML so I thought this was very similar that it would also be done in XML.

I want to add it along the right, under the subscribe section.  How do I implement, and then where do I put the styles?  _theme.less only and it links by just the class name?


texts: Vagrant (Magestead) & Modman symlink issue

texts:
I'm using Vagrant & Magestead to set up a testing environment for a module. The module has been symlink'ed on my machine (so, not in the VM) into the magento/ directory that is shared with the VM.

If I vi the linked module XML file on my machine, I can see it has the correct content.

If I vagrant ssh into the box though and do the same, the file is empty. I can also see none of the module files are showing in the VM; even though the / directory is present - it's empty.

Has anyone set something like this up before?


texts: Configurable product with multiple color variations

texts:
I have one product that comes in 12 colors and 4 sizes of each color. The problem is it comes in navy blue and royal blue. The color for each of these is listed as blue, to make our layered navigation easier for the customer to use. In doing so magento won't let me attach both colors to the configurable. If I use a third option for color swatch when creating a configurable there are 3 dropdowns on the buy page where there should be 2. If I use color swatch/size to create, then the layered navigation doesn't work.

Is there another solution, maybe to make the configurables not require a unique value for color?


texts: Why are my product images showing in a new tab?

texts:
I am very new to Magento and taking over this site from someone else who built it, so be kind in your answers!

Check out any product at ktmbikeindustries.com and you'll see that any additional photos besides the main photo open in a new tab, rather than scrolling through right there on the product page. I have checked the theme setup and theme design but after that, I'm not sure where to look to fix this, or what code might be needed to do so (and where to put that code).


texts: How to disable/enable a product programatically in Magento2?

texts:
I am trying to emulate the same behavior as when you use the admin panel to disable a product. I am trying to do something like this:

$product = $this->productRepository->get($sku);
$product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED);
$this->productRepository->save($product);

But I still see it as enabled in the admin panel.

Thanks.


texts: Magento 2 - Install extension using composer error - Plugin class Searchanise\SearchAutocomplete\Plugins\Toolbar doesn't exist

texts:
After install extension using composer, extension installed successfully but not visible on back-end how to solve this issue.
Screenshot :

extension : https://marketplace.magento.com/searchanise-search-autocomplete.html

Install cmd : composer require searchanise/search-autocomplete:1.0.10

module installed : https://snipboard.io/xOQR3i.jpg

Run proper commands

Not visible on back-end https://snipboard.io/tRUph5.jpg

How to solve the issue.
Log Error : [2020-08-22 06:49:36] main.ERROR: Plugin class Searchanise\SearchAutocomplete\Plugins\Toolbar doesn't exist [] []


texts: Translate wish list, add to cart, Please specify the product required option(s) for

texts:
I can't seem to find the word 'for' and translate it in the message:
Please specify the product required option(s) for "product name".

Does anyone know where it comes from?

Thank you,

Eran


texts: Magento 2 : Out-of-stock not selectable option

texts: I display out-of-Stock in my configurable products. But it is selectable, I like to set as not selectable option for only out of stock. Please let me know.


texts: One product with more SKUs depending on colour choices

texts:
Help with this one guys...

I'm using Magento 1.9.3.0 - I have one product that has two different product codes depending on panel finish (M - magnolia and W - white) but also adds two letters of colour choice to the end of the SKU that users can choose from - what I mean is this -

One product -

SKU - EEM55**

SKU - EEW55**

Colour choices - (these colour choices are added to end of SKU where * is)

Blue - BL

Green - GR

Can anyone please suggest how I would set this up?


texts:
Im trying to work out how magento validates forms and returns any errors to the form page, if javascript is turned off?

Any tutorials seem to cover only the javascript side of things. So I took a look at

  Mage_Customer_AccountController and Mage_Customer_Model_Customer

Mage_Customer_Model_Customer::validate() shows errors array is returned with the messages set in a helper and I see the validate function is called in Mage_Customer_AccountController::createPostAction() but what I don't understand is how I would take those error messages and apply them to the relevant input fields when they are required.

Also on line 266 I saw

  $session->setEscapeMessages(true); // prevent XSS injection in user input

I know filtering user input is of paramount importance, but I thought magento did it by default, do I need to do more input validation before passing it on to the database? (so far i'm only making sure a field has a value, due to my previously mentioned assumption).

===EDIT===

After about three hours of searching for an answer and playing around with options I came up with the below code (please note: I have not put this as an answer as I am guessing its not the best way to output errors to the form).

namespace/module/indexController extends Mage_Core_Controller_Front_Action

protected function _validation($data)
{
    $errors = array();

    $valid = new Zend_Validate_NotEmpty();
    $validEmail = new Zend_Validate_EmailAddress();

    if ( !$valid->isValid( trim( $data['f_name'] )) ){
        $errors[] = Mage::getSingleton('core/session')->addError('First name must be provided');
    }

    if ( !$validEmail->isValid( $data['email'] ) ){
        $errors[] = Mage::getSingleton('core/session')->addError('Invalid email address');
    }

    return $errors;
}

public function saveAction()
{
    if ( $this->getRequest()->getPost() ) {

        try {
        $postData = $this->getRequest()->getPost();
        $model = Mage::getModel('prefs/prefs');
        $formData = $model->setData($postData);

        $valid = $this->_validation($formData);

        if( $valid == 0){
            if( $formData['email'] === $formData['emailAddressCheck'] ) {
                $model->load('email');
                $model->save();
                $this->_redirect('*/*/edit');
            } else {
                Mage::getSingleton('core/session')->addError('Emails do not match');
                $this->_redirect('*/*/signup');
            }
        }else {
            $this->_redirect('*/*/signup');
        }

        } catch (Exception $e) {
            Mage::getSingleton('core/session')->addError($e->getMessage());
        }
    } else {
        //some error message
    }
}


texts: Magento 2.3 File uploader issue at frontend

texts:
I am using file upload control at frontend using below code:

<div class="upload-wrapper" data-bind="scope: 'uploader'">
    <!-- ko template: getTemplate() --><!-- /ko -->
</div>
<script type="text/x-magento-init">
    {
       ".upload-wrapper": {
           "Magento_Ui/js/core/app": {
               "components": {
                   "uploader": {
                       "component": "Magento_Ui/js/form/element/file-uploader",
                       "template": "ui/form/element/uploader/uploader",
                       "previewTmpl": "MyCompany_Module/form/element/uploader/preview",
                       "dataScope": "custom.image",
                       "isLoading": true,
                       "maxFileSize": <?php echo $fileSize; ?>,
                       "isMultipleFiles": true,
                       "uploaderConfig": {
                       "url": "<?php echo $block->getUrl('router/image/upload', ['_current' => true, '_use_rewrite' => true]); ?>"
                       }
                   }
               }
           }
       }
    }
</script>

It was working fine with earlier Magento versions but creating issue with Magento 2.3.0. It shows attached error in console (Uncaught ReferenceError: Base64 is not defined)

I checked the same and found that in earlier versions, the processFile method in file-upoader.js (Magento_Ui/js/form/element/file-uploader) having below code:

processFile: function (file) {
    file.previewType = this.getFilePreviewType(file);

    this.observe.call(file, true, [
        'previewWidth',
        'previewHeight'
    ]);

    return file;
}

but its updated as below in Magento 2.3:

processFile: function (file) {
    file.previewType = this.getFilePreviewType(file);
    console.log(file.name);
    if (!file.id && file.name) {
        file.id = Base64.mageEncode(file.name); //Base64 is globally defined
    }

    this.observe.call(file, true, [
        'previewWidth',
        'previewHeight'
    ]);

    return file;
}

Please help me if someone has any idea on it.


texts: Magento 2 + Get customer default billing address in custom module js

texts:
Is there any way I can get a customer default billing address in custom js ?

var defaultBillingAddresses = addressList().filter(function (address) {
                console.log(address.getType());
                return  address.getType() == 'customer-address' && address.isDefaultBilling();
            });

Above is mine code with inject

'Magento_Customer/js/model/address-list'

but it's not retrieving any thing.


texts: how to remove from price value and to price value in magento

texts:
From: $xxxx.00
To: $xxxx.00

PRICE AS CONFIGURED: $xxxx.00

I want to remove it from bundle product.


texts: Let admins sort products in a template arbitrary

texts:
I want to let the admin of a Magento site I'm developing to sort the products in a category arbitrary, this is that Magento shouldn't order them by price, name or anything else. Ideally, the admin would see a list of products and drag n' drop products to sort them.

The best approach I could think of is to create a custom numeric attribute and then sort by that attribute on the template file, but that would be pretty annoying for the user. Any other ideas?


texts:
I'm new to the Magento 2 REST API (this is also my first post in this forum, hi all), but during the past day have been able to retrieve information using it to my backend system. GET -requests are easy enough, but I'm struggling with getting a correct PUT request together.

What I need to do next is to update the order status from pending to processing, but just cannot figure out how to create a proper array to encode. I've endlessly Googled this up to the point where I've all but given up. There are a million examples on how to retrieve information from Magento, but pretty much NOTHING on how to make updates.

Here's my code:

(authentication part omitted - that works great)

        $icrement_id = "000000003";
        $requestUrl='http://www.example.com/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=increment_id&searchCriteria[filter_groups][0][filters][0][value]='.$increment_id;
            $ch = curl_init($requestUrl);
            // Set status to processing
        $data_json = [
          "items"=> [
              "state"=> "processing"
          ]
        ];
        $data_json = json_encode($data);
        print '<br>JSON data: '.$data_json;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $headers, 'Content-Length: ' . strlen($data_json)));
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
        curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response  = curl_exec($ch);
        curl_close($ch);
        // Execute the query
        $result = curl_exec($ch);
        // Decode the result
        $result=  json_decode($result);
        print_r($result);

Questions:

How to formulate $data, so that it would be correct (items[0] -> status from pending to processing)
Is my PUT request correct otherwise? (f.ex. can I use a search as the requestURL)

So just to be crystal clear, I'm not trying to create a new order, but change an existing order. Examples that would give a 'for dummies' example of a REST API PUT -request would be appreciated also. Thanks.


texts:
I have a js

How can I write it in a phtml file in Magento 2
i have try
 requirejs([
    'jquery'
], function($) {
    var CaptchaCallback = function() {
    grecaptcha.render('RecaptchaField', {
        'sitekey': '6Ldo38kZAAAAAJqvMJMI2R79PHy0fjVDU3QMVHKC'
    });
};
$('body').load(CaptchaCallback );
})


texts: Add Captcha to customer registration form

texts:
i have one extesnion for vendor. when customer create account it shows this vendor register form in which i want to use captcha.

i used this reference link for capthca. captcha shows bt not working.

Config.xml

<events>
        <controller_action_predispatch_multivendor_vendor_captcha>
             <observers>
                <multivendor>
                    <class>multivendor/Captchaobserver</class>
                    <method>checkCaptcha</method>
                </multivendor>
            </observers>
        </controller_action_predispatch_multivendor_vendor_captcha>
    </events>

multivendor.xml

<multivendor_vendor_signup>
     Customer Account Registration Form

    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="customer/form_register" name="multivendor_customer_form_register" template="multivendor/form/register.phtml">
            <action method="setShowAddressFields"><value>true</value></action>
            <block type="page/html_wrapper" name="multivendor.customer.form.register.fields.before" as="multivendor_form_fields_before" translate="label">
                Form Fields Before

            </block>

            <block type="captcha/captcha" name="captcha">
                    <reference name="head">
                        <action method="addJs"><file>mage/captcha.js</file></action>
                    </reference>
                    <action method="setFormId"><formId>contact_form</formId></action>
                    <action method="setImgWidth"><width>230</width></action>
                    <action method="setImgHeight"><width>50</width></action>
            </block>
        </block>
    </reference>
</multivendor_vendor_signup>

Observer.php

class CompanyName_MultiVendor_Model_Captchaobserver
{

    protected function _getCaptchaString($request, $formId)
    {
        $captchaParams = $request->getPost(Mage_Captcha_Helper_Data::INPUT_NAME_FIELD_VALUE);
        return $captchaParams[$formId];
    }

    /**
     * Break the execution in case of incorrect CAPTCHA
     *
     * @param Varien_Event_Observer $observer
     * @return Your_Module_Model_Observer
     */
    public function checkCaptcha($observer)
    {
    $formId = 'contact_form';
    $captchaModel = Mage::helper('captcha')->getCaptcha($formId);
    if ($captchaModel->isRequired()) {
        $controller = $observer->getControllerAction();
        if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) {
            Mage::getSingleton('customer/session')->addError(Mage::helper('captcha')->__('Incorrect CAPTCHA.'));
            $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
            Mage::getSingleton('customer/session')->setCustomerFormData($controller->getRequest()->getPost());
            $controller->getResponse()->setRedirect(Mage::getUrl('*/*/signup'));
        }
    }

    return $this;
}

}


texts: How to enable error and exception logging in Magento2?

texts: I am unable to see any type of error in magento2. i am implementing custom payment gateway but when i add a dropdown list in backend admin panel of magento2 At that time its shows blank page and when i console it shows only 500 internal server error.


texts: Newsletter subscribtion confirmation email are going in spam

texts:
All transaction mails are working fine except newsletter confirmation link.

I already checked the markup and talked to my hosting provider which told me that the email header looks good. I think the link is the problem but without the confirmation link the email is of course useless.

Looking for help to fix this.


texts: Godaddy email not working to sent order emails in Magento2

texts:
My Magento2 ecommerce website is hosted on DigitalOcean Server.  I have made the following changes to send orders and other emails to customers.

Add all the GoDaddy emails to Magento2 -> Configuration -> Email Addresses.
Made Email Communication to Yes in Stores -> Configuration -> System
Enables end order email and in Stores -> COnfigiration -> Sales -> Sales Email

I have done all the settings properly but still, my emails are not delivering to the customers. Not even reset password email is delivering. I wonder that there is no option to setup SMTP email properly with password in Magento2 then how it will be connected? Not sure at what point I am wrong.
Please help.


texts: Magento 2 : Insert Records in Multiple Table

texts:
I have created 2 table :

table_1 :

id (Primary key)
name
status

table_2 :

sub_id (Primary key)
id (Foreign key table_1 id)
description

How to save records in both table using single model file?


texts: How can I write this code to execute directly

texts:
I want to synchronise M2epro inventory with Magento 2.

Tutorial link - https://docs.m2epro.com/display/BestPractice/Programmatic+Possibilities+to+work+with+Extension

M2epro Git Location - https://github.com/m2epro/magento2-extension

Original Code -

    $this->modelFactory instanceof \Ess\M2ePro\Model\Factory
    $model = $this->modelFactory->getObject('PublicServices\Product\ObjectChange');
    $model->observeProduct(561);
    $model->applyChanges();

How can create above objects ?

Below is my code

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
//$helperFactory = $objectManager->create('\Ess\M2ePro\Helper\Factory');
$modelFactory = $objectManager->create('\Ess\M2ePro\Model\Factory');
$model = $modelFactory->create('\Ess\M2ePro\PublicServices\Product\ObjectChange');
$model->observeProduct($id);
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($id);
$model->observeProduct($product);
$model->applyChanges();

Now here when I am trying to write tutorial code by creating object I am getting error that Uncaught Error: Call to undefined method Ess\M2ePro\Helper\Factory::create()

Can anyone please suggest how we can solve this ?


texts: I want to rank my magento website top on the first page of Google!

texts: I am building the new Magento website named "Bookslab.in" & now this website is on the 7th position on the first page of the Google. I want to rank this website top on the first page of Google, so how to do this is there any website or any method to do this within one or two days. Website name is bookslab.in


texts:
why my BT4 isn't working on IE11 ?

In default_head_block.xml I have this :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <css src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" src_type="url"/>
    </head>
    </body>
</page>

In my inspector, I have this (without the space between "<" and "meta"):

  < meta name="" content="IE-Edge"/>


texts: No confirmation order email or any other email on magento 1.9

texts: I am using Magento community edition 1.9 and installed it to smarterasp.net. Whenever I try purchasing something and complete the process, I receive no email order notification. Nothing at all. Even when I try to invoice it, there is no invoice email. By the way, I already tried the fix available on the Internet, nothing works.


texts: Source code is empty in shipment observer magento2

texts:
I am trying to get source_code from the shipment_id
Have used below event.
Vendor/Module/etc/events.xml
<event name="sales_order_shipment_save_after">
    <observer name="sales_order_shipment_after"
              instance="Vendor\Module\Observer\SalesOrderShipmentAfter" />
</event>

Then Vendor\Module\Observer\SalesOrderShipmentAfter.php
<?php
namespace Vendor\Module\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\InventoryShipping\Model\ResourceModel\ShipmentSource\GetSourceCodeByShipmentId;
use Magento\InventoryApi\Api\Data\SourceInterface;
use Magento\InventoryApi\Api\SourceRepositoryInterface;
class SalesOrderShipmentAfter implements ObserverInterface
{
 protected $shipmentNotifier;
 protected $_logger;
 protected $_httpClientFactory;
 protected $orderRepository;
 protected $_customerRepository;
 protected $sourceRepository;
 public function __construct(
    \Psr\Log\LoggerInterface $logger,
    \Magento\Shipping\Model\ShipmentNotifier $shipmentNotifier,
    \Magento\Framework\HTTP\ZendClientFactory $httpClientFactory,
    \Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
    \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
    GetSourceCodeByShipmentId $sourceCodeByShipmentId,
    SourceRepositoryInterface $sourceRepository
) {
    $this->_logger = $logger;
    $this->shipmentNotifier = $shipmentNotifier;
    $this->_httpClientFactory   = $httpClientFactory;
    $this->orderRepository = $orderRepository;
    $this->_customerRepository = $customerRepository;
    $this->sourceCodeByShipmentId = $sourceCodeByShipmentId;
    $this->sourceRepository = $sourceRepository;
}

 public function execute(\Magento\Framework\Event\Observer $observer)
  {
    try{
        $shipment = $observer->getEvent()->getShipment();
        $shipmentId = $shipment->getId();
        $this->_logger->info('--shipmentId--'.$shipmentId);
        if(isset($shipmentId) && $shipmentId != ''){
            $sourceCode = $this->getSource($shipmentId);
            $this->_logger->info('--sourceCode--'.$sourceCode);

            $sourceInfo = $this->sourceRepository->get($sourceCode);
            $this->_logger->info('--sourceInfo--'.json_encode($sourceInfo));
        }
     }catch (\Exception $e) {
        $this->_logger->info('--shipment observer--'.$e->getMessage());
     }
   return $this;
 }
  public function getSource($shipmentId)
   {
    return $this->sourceCodeByShipmentId->execute($shipmentId);
   }
}

from the above code i am getting the shipment Id but not the source_code,
Can anyone help me how to get this.


texts: Magento 2 catalog search for SKU with dot not working

texts:
our SKU's have dot's like: "120.00085"
If I search this string I get all products with "120.XXXX".
But the product with exact this SKU is not at the first position in the results.

Is there any solutions? I use Magento 2.2.4 version.

Best regards
Michael


texts: How to get two different search forms in Magento one fulltext and one title search?

texts:
I want to do two different search types in two different search forms.

I got the head search in fulltext and i created a quicksearch.phtml to edit this as a title only search.

Is there a way to set the "title only search" settings in my quicksearch.phtml or the form.mini.phtml?

Code of quicksearch.phtml:

<?php
/* @var $this Mage_Core_Block_Template */
/* @var $catalogSearchHelper Mage_Catalogsearch_Helper_Data */
$catalogSearchHelper =  $this->helper('catalogsearch');
?>
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">

            <input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text form-control" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>">

                <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Search')) ?>" class="btn btn-default"></button>

</form>

by the way i got Magento 1.9.2.4


texts: Add stock data on product programatically in Magento 2

texts:
I want to add stock data on a product but it doesn't work. In my function, I have a product created by :

$product = $objectManager->create('Magento\Catalog\Model\Product');

Then, I set some data like price, status, name, ... And eventually, I add a code for the stock :

$product->setStockData(array(
            'use_config_manage_stock' => (bool)0, //'Use config settings' checkbox
            'manage_stock' => (bool)1, //manage stock
            'min_sale_qty' => 0, //Minimum Qty Allowed in Shopping Cart
            'max_sale_qty' => 0, //Maximum Qty Allowed in Shopping Cart
            'is_in_stock' => (bool)1, //Stock Availability
            'qty' => 0 //qty
            )
        );

I don't want that the product inherit the config settings and I absolutly want a quantity different of null (0 or greater).

But, when the function is launched, the product is created, every data is ok exept the stock data.


texts: Inject element to left, right, before/after content, ... without layout changes in m1

texts:
I am creating an extension that will add dynamic content to different parts of page depends on selection. Admin user can add elements to left sidebar, right sidebar, before/after content, ...

So far I found one way of doing it:
Define all 8 positions inside layout file, then check inside module block if user selected this specific position and display content if yes, otherwise skip it.

<default>
   <reference name="right">
     <block type="company/module" name="company_module_right" template="company/module.phtml" />
   </reference>
</default>

<default>
   <reference name="header">
     <block type="company/module" name="company_module_header_before" template="company/module.phtml" before="-" />
   </reference>
</default>
....

This would work fine, but it is not perfect solution because I will need to load the same block and go through the same collection 8 times, each time for each position to check if user selected this section to inject elements into.

I was thinking about using observer:

<controller_action_layout_load_before>
    <observers>
        <inject_content>
            <type>singleton</type>
            <class>company_module/observer</class>
            <method>addBlock</method>
        </inject_content>
    </observers>
</controller_action_layout_load_before>

Observer.php:

public function addBlock(Varien_Event_Observer $observer)
{
  $layout = Mage::getSingleton('core/layout');
  $collection = Mage::getModel('company_module/blocks')->getCollection();
  foreach($collection as $col){
    $content = $layout->getBlock($col->getData('parentBlockName'));
    $newBlock = $layout->createBlock('core/template', $col->getData('injectedBlockName'));
    $newBlock->setTemplate('company_module/blocks.phtml');
    $content->append($newBlock);
  }
}

But $layout->getBlock('content') or $layout->getBlock('left') or other blocks always return false. I tried also controller_action_layout_load_before, in this way it won't return false but it also won't inject block. Any idea how to make this work?


texts:
Hi I am using magja which is Java Connector for magento api. https://github.com/magja/magja I am not getting any response of the issue I posted on their issues list.

And I am not expert in java and I am newbie to eclipse too, can anyone guide me how I can debug my code, and what type of error is this, below is the error I am getting currently

Exception in thread "main" java.lang.RuntimeException: org.apache.axis2.AxisFault: Procedure 'login' not present
    at com.google.code.magja.soap.MagentoSoapClient.<init>(MagentoSoapClient.java:104)
    at com.google.code.magja.soap.MagentoSoapClient.getInstance(MagentoSoapClient.java:84)
    at com.google.code.magja.soap.MagentoSoapClient.getInstance(MagentoSoapClient.java:60)
    at com.google.code.magja.magento.Connection.<init>(Connection.java:24)
    at com.google.code.magja.magento.Connection.main(Connection.java:27)
Caused by: org.apache.axis2.AxisFault: Procedure 'login' not present
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:435)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
    at com.google.code.magja.soap.MagentoSoapClient.login(MagentoSoapClient.java:185)
    at com.google.code.magja.soap.MagentoSoapClient.<init>(MagentoSoapClient.java:101)
    ... 4 more


texts:
I'm updating the images of my products. I'm using Import menu to do it.
I would need to replace the old image by the new. The new image is indicate in a csv file by product sku. The name of the images are different.
The problem is that the old images doesn't delete.
I want to replace the old image(old_image.jpg) by the new image(new_image.jpg)
Could you help me?
Thanks!


texts: Magento 2.2 add to wishlist, how to show child products sku

texts: I have grouped products in my magento 2.2 application, after adding product to add to wishlist. How can i show sku for a child products.


texts:
I have a big problem. After I have upgraded my Shop from Magento 1 to Magento 2.1.7 I am not able to run TCPDF.
I installed TCPDF via composer in the Vendor folder as described, but when I try to generate - even an empty pdf - nothing works.

I hope, somebody can help me.

Christian


texts: Magento2 API Product Repository API "saveOptions": true

texts:
In magento2 - I am not able to find anything on the internet that explains what

magento2 api "saveOptions": true

is good for.


texts: Magento 1.9: Remove Category Filter in Layered Nav

texts:
After a few minutes of search, I found the solution that I'm looking for, and it's here:
How can I disable filter "category" from Sidebar

I followed this method by editing the catalog.xml by @PandaWebStudio

<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>

with

<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
<action method="unsetChild"><child>category_filter</child></action>
</block>

But sadly, It didn't work. I then scrolled down and found another solution by @Maurice

The (currently) recommended way to make layout changes is using a theme's local.xml. So when using local.xml, add the following:

<catalog_category_layered>
     <reference name="catalog.leftnav">
        <action method="unsetChild"><child>category_filter</child></action>
    </reference>
</catalog_category_layered>

And if you want, you can add the regular (non-filterable) category menu above the filters like by adding the following to your local.xml:

<catalog_category_layered>
    <reference name="left">
        <block type="catalog/navigation" name="catalog.leftnav.categories" after="currency" template="catalog/navigation/left.phtml"/>
    </reference>
    <reference name="catalog.leftnav">
        <action method="unsetChild"><child>category_filter</child></action>
    </reference>
</catalog_category_layered>

It worked. It removed my category filter in the layered navigation. But the problem is, the poll and mini cart appear. And the contents of the page disappeared. Only the poll and mini cart appear in my page, there are no products and static content anymore.

I wonder where did I went wrong. I tried change the after="currency" to before="-" because that's what is inside my XML, but it still didn't work. I think I just need to modify something in the after value, because I don't have a currency block in my sidebar. That's what I don't know.

I hope a Magento guru can enlighten me. :(


texts: Getting total quantity of specific product ordered between two dates

texts:
I have a requirement to get the total number of ordered items for a specific product ID during a specific time period.

I.e. - Total number of Product 123 ordered between 1st June 2014 and 30st June 2014.

I'm looking for the best way to do this.

Initially, I looked at reports/product_collection but it seems slow compared to sales/order_item_collection from tests I've carried out (simple execution time).

The code I have at the moment is (with $week being a period to search through, and $row being a reference to an internal table where product_id is stored):

$collection = Mage::getResourceModel('sales/order_item_collection')
    ->addAttributeToFilter('product_id', array('eq' => $row->getProductId()))
    ->addAttributeToFilter(
        'created_at', array("gt" => array(
            $week["from"]
         )
         )
    )
    ->addAttributeToFilter(
        'created_at', array("lt" => array(
             $week["to"]
         )
         )
    );

However, then I have to loop through the resulting collection, adding the quantities together to get the figure I want.

 $qtySold = 0;
 foreach($collection as $orderItem) {
     $qtySold += $orderItem->getQtyOrdered();
 }

I feel like I should be able to do this in the original collection call by using something like addExpressionAttributeToSelect (but this doesn't work on the Mage_Sales_Model_Resource_Order_Item_Collection object).

Any thoughts on the best, most Magento (currently the store is running 1.6) way to do this?  It's worth pointing out (I guess) that the PHP counter works, but it just doesn't feel right, especially as the collection could have thousands of orders in it.


texts:
I'm completely new to Magento but, I am a Drupal developer.  I'm currently looking into creating a site that sells products organized by their origin city.  I'd like your suggestions on how to organize the site.

Requirements:

Easily search for products across cities
Same product terms for products in all cities
Filter products(product grids/lists, etc) by city

Should I create a store per city? Or Category per city?

Any help would be greatly appreciated.


texts: Block is repeated while creating a new layout update handler

texts:
I recently start on Magento for one of my project and facing a few issues with a functionality i am trying to build. Basically, I want to create a separate section for customer profile. In this section, I'll bring Account Information, Change password and Address Book.

All worked well for Account information and Change Password but got stuck when I was trying to integrate Address Book in this new Section. Address block in main content area was repeating for /customer/address/ page.

Here are the steps i am following.

Created a new layout update handler in local.xml for customer profile

Created a layout update handler for address book which updates customer_profile.

Add Address block in customer_address_index.

What I am guessing here address block i am adding here is repeating because I am using same layout update handler name as in customer.xml, which is customer_address_index. Is that correct? and If it's true how can I make sure that address block is displayed only once in the page?


texts: magento, how correctly create sql request to database used colleciton, AND condition

texts:
i have this code

$collection = mage::getModel('purchasemanagement/purchasemanagement')->getCollection()
            ->addFieldToSelect('item_id')
            ->addFieldToFilter(
                array('title', 'content'),
                array(
                    array('like'=>'%$titlesearchtext%', 'like' => 'content2'),
                )
            )
            ->load(true);

i have this sql on result

SELECT `main_table`.`item_id` FROM `dk_purchase_management` AS `main_table` WHERE ((`title` LIKE 'content2') OR (`content` = ''))

how can i create AND condition?
for example

SELECT `main_table`.`item_id` FROM `dk_purchase_management` AS `main_table` WHERE ((`title` LIKE 'titlesearchtext' AND `content2` => 'content'))


texts: Magento 2.2.0 , Paypal Credit Issue "The payment method disallows storing objects"

texts:
I am using magento version 2.2.0 , when I try to place order using payemt method as Paypal Credit, it works fine on ckeckout/cart page, but on OnePage checkout I get the error "The payment method disallows storing objects".

I see Following in the console

HEADERS

Request URL: www.mydomai.com/rest/default/V1/guest-carts/1234f163c7f626d7d87096bcb5b622d1/set-payment-information

Request Method: POST

Status Code: 400 Bad Request

Referrer Policy: no-referrer-when-downgrade

RESPONSE

{"message":"The payment disallows storing objects."}

Please let me know where can I resolve this, without upgrading my current magento version.


texts: Get PayPal Payer Status(verified/unverified)

texts:
If you look at the "Payment Information" Tab of an order, you can see some details if it was paid with paypal like the "Payer Status"(Is the paypal verified?) or the email of the PayPal Account.

I'd like to get this informations programatically in an observer(where I have an $order), so I first looked at the fields of the $order: There is the ["additional_information"]["paypal_payer_status"] in the protected _data array, so I could possibly get it by using Reflection(maybe not so good)
I tried also using the PayPal classes: app/code/core/Mage/Paypal/Model/info.php has a Method
public function getPaymentInfo(Mage_Payment_Model_Info $payment, $labelValuesOnly = false)
which could probably provide the informations, but I was unable to create an instance of the class Mage_Paypal_Model_Info(has no constructer) containing this method(I guess the class isnt included/required while the code runs)

So I`d like to ask how to fix that or get the informations by a maybe more clean way.


texts: Installation of extensions using CLI have issues composer require

texts:
The following error are showing tho run the commad :

composer require igorludgero/outofstocklast

brasilma@a2ls18 [~/public_html]# composer require igorludgero/outofstocklast
Using version ^1.0 for igorludgero/outofstocklast
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
**Your requirements could not be resolved to an installable set of packages.**

Problem 1
- Installation request for igorludgero/outofstocklast ^1.0 -> satisfiable by igorludgero/outofstocklast[1.0.0].
- Conclusion: remove magento/framework 100.1.2
- Conclusion: don't install magento/framework 100.1.2
- igorludgero/outofstocklast 1.0.0 requires magento/framework ~100.0.4 -> satisfiable by magento/framework[100.0.10, 100.0.11, 100.0.12, 100.0.13, 100.0.4, 100.0.5, 100.0.6, 100.0.7, 100.0.8, 100.0.9].
- Can only install one of: magento/framework[100.1.2, 100.0.10].
- Can only install one of: magento/framework[100.1.2, 100.0.11].
- Can only install one of: magento/framework[100.1.2, 100.0.12].
- Can only install one of: magento/framework[100.1.2, 100.0.13].
- Can only install one of: magento/framework[100.1.2, 100.0.4].
- Can only install one of: magento/framework[100.1.2, 100.0.5].
- Can only install one of: magento/framework[100.1.2, 100.0.6].
- Can only install one of: magento/framework[100.1.2, 100.0.7].
- Can only install one of: magento/framework[100.1.2, 100.0.8].
- Can only install one of: magento/framework[100.1.2, 100.0.9].
- Installation request for magento/framework (locked at 100.1.2) -> satisfiable by magento/framework[100.1.2].

**Installation failed, reverting ./composer.json to its original content.**


texts:
I see this error

  3 exception(s): Exception #0
  (Magento\Framework\Exception\LocalizedException): Invalid block type:
  Crediya\Minicalculadora\Block\Data Exception #1 (ReflectionException):
  Class CrediYa\CrediYa\Model\CrediYa does not exist Exception #2
  (ReflectionException): Class CrediYa\CrediYa\Model\CrediYa does not
  exist

But the class does exist, if I use the command

php bin/magento setup:di:compile

I get the following error

Fatal error: Class 'CrediYa\CrediYa\Model\CrediYa' not found in /var/www/html/magento2/generated/code/CrediYa/CrediYa/Model/CrediYa/Interceptor.php on line 7

How can I solve these errors?


texts: Magento 2 Same Coupon code with different Actions

texts:
I am having 3 types of Category C1,C2 and C3. In every category there are products.

1) C1 has P1,P2 and P3 (Each P cost $38)

2) C2 has P4, P5 and P6 (Each P cost $58)

3) C3 has P7 and P8 (Each P cost $75)

The rule should be like If Cart item is of C1 then $10, C2 then $20 and C3 is $30.

Now if i add P2,P3, P4 and P8 then the total cost will be $209

But when i applied a coupon it should be $70.

How can i add multiple action for a single coupon code?


texts: Error Installing magento 2.4.2 elasticsearch-7.11.1 xampp window

texts:
Installing search configuration...
PHP Fatal error:  Uncaught Error: Wrong parameters for Elasticsearch\Common\Exceptions\ServerErrorResponseException([string $message [, long $code [, Throwable $previous = NULL]]]) in C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php:665
Stack trace:
#0 C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(665): Exception->__construct(NULL, 502)
#1 C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(320): Elasticsearch\Connections\Connection->process5xxError(Array, Array, Array)
#2 C:\xampp\htdocs\magento24s\vendor\react\promise\src\FulfilledPromise.php(28): Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(Array)
#3 C:\xampp\htdocs\magento24s\vendor\ezimuel\ringphp\src\Future\CompletedFutureValue.php(55): React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)
#4 C:\xampp\htdocs\magento24s\vendor\ezimuel\ringphp\src\Core.php(341): in C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php on line 665

Fatal error: Uncaught Error: Wrong parameters for Elasticsearch\Common\Exceptions\ServerErrorResponseException([string $message [, long $code [, Throwable $previous = NULL]]]) in C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php:665
Stack trace:
#0 C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(665): Exception->__construct(NULL, 502)
#1 C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(320): Elasticsearch\Connections\Connection->process5xxError(Array, Array, Array)
#2 C:\xampp\htdocs\magento24s\vendor\react\promise\src\FulfilledPromise.php(28): Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(Array)
#3 C:\xampp\htdocs\magento24s\vendor\ezimuel\ringphp\src\Future\CompletedFutureValue.php(55): React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)
#4 C:\xampp\htdocs\magento24s\vendor\ezimuel\ringphp\src\Core.php(341): in C:\xampp\htdocs\magento24s\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php on line 665
{"messages":{"error":[{"code":500,"message":"Server internal error. See details in report api\/696185984738"}]}}

getting this error while installing magento 2.4.2 on window elasticsearch-7.11.1


texts:
how start cronjob every day?
I'm not too strong in schedule
<crontab>
        <jobs>
            <ebayautopurchase_deleteproducts>
                <schedule><cron_expr> * * * *</cron_expr></schedule>
                <run><model>ebayautopurchase/observer::deleteEbayProducts</model></run>
            </ebayautopurchase_deleteproducts>
        </jobs>
    </crontab>


texts: I changed to developer mode, but i dont have developer options in backend PLEASE HELP

texts:
I have version 2.2.7 with nginx

I changed from Production Mode to Developer Mode. But developer settings are not available. I cleaned the cache. I removed all folder with:

sudo rm -rf pub/static
sudo rm -rf var/cache
sudo rm -rf var/composer_home
sudo rm -rf var/generation
sudo rm -rf var/page_cache
sudo rm -rf var/view_preprocessed

BUT STILL NOT WORKING.


texts: How to change background color of a link in magento 2.0

texts:
How to change vertical menu background color on hover in Magento 2
I want like this.


texts: After import, Products attributes not showing up in website

texts:
Am using magento 1.8.1 version and i have updated Manufacturers for about 400 products via CSV file. The manufacturers value is assigned correctly to their respective products.

But its not showing on the Frontend of the website. Here's a twist. When i OPEN and EDIT the product From admin and SAVE it, and then it shows up on the website in both layered navigation and in additional specs.

I cannot find the source of my problem. Can anyone guide me to solve this ?

Thanks.


texts: Products not found: multi-storeview in subdirectories

texts:
Searched to forums for hours, non of the answers works for me.

My setup:

I have a php file that maps the store URL's to the correct store views (type = store)
Each language (store view) is a subdirectory of it's language code. Subdirectories exists with the index.php file using the url mapper php file. .htaccess logic is done with nginx:

location ~ ^/(?(nl|de|fr|en)) {
    rewrite / /$uri_prefix/index.php break;
    echo_exec @phpfpm;
}

Most of the product attributes are set to "use default value" except for some text attributes that need to be translated. (description, name etc)

Everything works fine (pages / categories etc) except for the fact that no products show up anywhere. I first thought that is was a redirect problem but again, category pages etc. show up correctly for each view.

Product attributes checked and correct:

Status: All enabled correctly (store views: use default)
Visibility: Config products: Catalog, Search & Single products: not visible
Category: Config products attached correctly
Website: All good (both config and single)
Inventory: All around 100+ (nog actually used)
IsInStock: All ok!

I'm out of ideas... if anyone has one, please let me know!


texts:
Maybe this is a very silly question. I can not understand why I must run the command setup:di:compile every time I make changes to custom modules, to see the results when I am in developer mode.

Can it be disabled?


texts:
Everytime I'm switching from the English store view to the Italian's one and viceversa, it takes me to the equivalent homepage (no matters where I am) and it throws this error:

Here's my setup:

Magento 2.3.4 (fresh installation, self hosted)
Nginx reverse proxy that serves Apache webserver
1 website, 1 store, 2 store views
For each store view one different domain (English store view --> example.com, Italian store view --> example.it)
I added on top of main .htaccess these env:

SetEnvIf Host ^(.*)\.example\.com MAGE_RUN_CODE=en
SetEnvIf Host ^(.*)\.example\.com MAGE_RUN_TYPE=store
SetEnvIf Host ^(.*)\.example\.it MAGE_RUN_CODE=it
SetEnvIf Host ^(.*)\.example\.it MAGE_RUN_TYPE=store

Recap: If, for example, I'm on example.com/my-beautiful-product.html [English store view] and I'm switching to the Italian store view, it takes me to example.it and it shows that error ("The store that was requested wasn't found. Verify the store and try again.") instead of take me on example.it/my-beautiful-product.html without any errors.

Any Ideas?

What I tested:

I tried to remove the NGINX reverse proxy in front of it, just exposing Apache. Same result, it does not work.
I tried to hardcode the store view codes in /vendor/magento/module-store/Controller/Store/SwitchAction.php at row 106 and the $requestedUrlToRedirect :

...
public function execute()
{
    $targetStoreCode = $this->_request->getParam(
        \Magento\Store\Model\StoreManagerInterface::PARAM_NAME
    );
    $fromStoreCode = $this->_request->getParam(
        '___from_store',
        $this->storeCookieManager->getStoreCodeFromCookie()
    );

    $requestedUrlToRedirect = 'https://example.it/my-beautiful-product.html';
    $redirectUrl = $requestedUrlToRedirect;
    // $requestedUrlToRedirect = $this->_redirect->getRedirectUrl();
    // $redirectUrl = $requestedUrlToRedirect;

    $error = null;
    try {
        $fromStore = $this->storeRepository->get('en');
        $targetStore = $this->storeRepository->getActiveStoreByCode('it');
        // $fromStore = $this->storeRepository->get($fromStoreCode);
        // $targetStore = $this->storeRepository->getActiveStoreByCode($targetStoreCode);
    } catch (StoreIsInactiveException $e) {
        $error = __('Requested store is inactive');
    } catch (NoSuchEntityException $e) {
        $error = __("The store that was requested wasn't found. Verify the store and try again.");
    }
    if ($error !== null) {
        $this->messageManager->addErrorMessage($error);
    } else {
        $redirectUrl = $this->storeSwitcher->switch($fromStore, $targetStore, $requestedUrlToRedirect);
    }

    $this->getResponse()->setRedirect($redirectUrl);
}
...

Here a switch url example: https://example.com/stores/store/redirect/___store/it/___from_store/en/uenc/aHR0cHM6Ly9kZXYudGVjbmljbWFuLml0Lz9fX19zdG9yZT1pdA%2C%2C/

Then I switched from Italian store view to the English one and it worked! So it seems it does not able to get the correct values of $targetStoreCode, and $requestedUrlToRedirect. Any ideas?

Update

On Magento 2.2.11 (fresh installation), it works great out of the box.
On Magento 2.3.0 (fresh installation), it works partially out of the box. Url rewrite has been created just for 1 store view. So, to make it works I had to add manually the url rewrites for the other store view. Then it worked.
On Magento 2.3.1 (fresh installation), it shows the error. The behaviour is just the same as for the 2.3.4 version.

At this point I believe it's a bug. I reported it on the official Magento Github repository.


texts: Our system detected a lock condition in our database

texts:
We are getting an issue with the database.

Below is the message we are getting from the server.

Our system detected a lock condition in your database. Multiple queries were running too long. The queries were killed to maintain your site's availability. Below is a process list of running queries for your analysis.

We are getting below log.

764607 user_3775zonjvaf 10-1-84-65.kubelet.kube-system.svc.cluster.local:38450  dbm2.3.1 Query 3 Sending data SELECT /*!40001 SQL_NO_CACHE */ * FROM sales_order_address 554545 0
764608 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc:  dbm2.3.1 Query 89 Waiting for table level lock INSERT INTO search_query (store_id,query_text,popularity) VALUES ('1', 'other diesel duramax 3Fmanufacturer', '1') ON DUPLICATE KEY UPDATE popularity = popularity + 1 0 0
764610 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc: dbm2.3.1 Query 86 Waiting for table level lock INSERT INTO search_query (store_id,query_text,popularity) VALUES ('11', '23store menu', '1') ON DUPLICATE KEY UPDATE popularity = popularity + 1 0 0
764611 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc:  dbm2.3.1 Query 84 Waiting for table level lock INSERT INTO customer_visitor (customer_id, session_id, last_visit_at) VALUES (NULL, 'd82a1755183639f90d0c6d51838e0a97', '2019-07-28 02:00:30') 0 0
764612 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc:  dbm2.3.1 Query 82 Waiting for table level lock INSERT INTO customer_visitor (customer_id, session_id, last_visit_at) VALUES (NULL, '6bd54e0a314761c7bd896a875e5069f7', '2019-07-28 02:00:32') 0 0
764614 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc:  dbm2.3.1 Query 80 Waiting for table level lock INSERT INTO customer_visitor (customer_id, session_id, last_visit_at) VALUES (NULL, '1c70facf26d11c7d33ef9130ebc7be17', '2019-07-28 02:00:34') 0 0
764615 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc:  dbm2.3.1 Query 75 Waiting for table level lock INSERT INTO customer_visitor (customer_id, session_id, last_visit_at) VALUES (NULL, 'e3e6b77293b8a2ffab164f7920888985', '2019-07-28 02:00:39') 0 0
764616 user_3775zonjvaf 192-168-27-52.php-fpm.store-3775zonjvafwenb8.svc.cluster.loc:  dbm2.3.1 Query 50 Waiting for table level lock INSERT INTO customer_visitor (customer_id, session_id, last_visit_at) VALUES (NULL, '7c885091c2589782414c5f9c7000f1c3', '2019-07-28 02:01:04') 0 0


texts: Magento Iterator Vs Foreach Loop How to return an array?

texts:
I've encountered a problem where my foreach loop is causing a 504 Gateway timeout error so I did some research and found that for large collections it is better to use the core/resource_iterator and the walk() function.

This has definitely improved performance but I have lost the ability to return the array the I need from when I call my custom function.

$this->getAllDataFromTable()

Here is what I mean: This function will get all the data from the table and return the $array variable which I can do stuff with - but is very expensive and times out with a 504 error.

public static function getAllDataFromTable()
{
    $model = Mage::getModel('custom/table');
    $collection = $model->getCollection();
    $array = array();
    foreach ($collection as $item) {
        $array[] = $item->getData();
    }
    return $array;
}

Using the iterator: The iterator is more efficient but I can only do stuff with the last row, I would like a similar $array returned so I can do stuff with it.

/**
 * Mage_Core_Model_Resource_Iterator
 */
public function getAllDataFromTable()
{
    $ordersCollection = Mage::getModel('custom/table')->getCollection();
    Mage::getSingleton('core/resource_iterator')->walk($ordersCollection->getSelect(),
        array(array($this, 'orderCallback'))
    );
}

public function orderCallback($args)
{
  return $args['row'];
}


texts: Magento 2.2.6 Configurable Product How to Show Old Price and Special Price?

texts:
I have used Magento 2.2.6 version. I have one configurable product. I have added a special price to the associated product.The Special Price is Display but the old price is not displayed on how to show them?
Please refer the following screenshot:
In Frontend:

In admin Special Price:

In admin Product add/edit area:


texts: Magento 2.3.4 - Call phtml file within CMS block

texts:
I'm trying to call the following phtml file into a CMS block.

Phtml file location

app/design/frontend/{Package}/{theme}/Magento_Newsletter/templates/subscribe_footer.phtml

I tried using

{{block class="Magento\Newsletter\Block" template="Magento_Newsletter::subscribe_footer.phtml"}}

And it doesn't show up on the page.

How do I get it to show on the page?


texts: How to use Split or explode Function in Observer?

texts:
Observer File :

<?php
  class Gta_MatchProductOrder_Model_Observer
  {
    public function checkproductinorder($Observer)
    {
      $order = $Observer->getEvent()->getOrder();
      $items = $order->getAllItems();
      $skus = array(
                    '654568',
                    '600_1',
                    '757657685',
                    '65786785'); //product SKUs

      $skuList = array();
      foreach ($items as $item)
      {
        if(in_array($item->getSku(), $skus))
        {
          $orderid = $Observer->getEvent()->getOrder()->getIncrementId();
          $skuList[] = $item->getSku();
        }
      }
      Mage::log('The order Id ' . $orderid . ' contains amazon list SKU : '.implode(',',$skuList), null, 'matchorder.log');

      ### start test observer ###
      // $order = $Observer->getEvent();
      // Mage::log($order->getName(),null,'orderproduct.log');
      ### end test observer ###
    }
  }
?>

From above code how to use split or explode function for my sku's.
my sku combination : 654568, 757657685, 65786785, 600_1.

fyi = sku 654568, 757657685, 65786785  have 654568_01, 654568_02 & 654568_01, 654568_02 & 65786785_1, 65786785_2   here underscore is unique.

As of now if order contains the product 600_1 return log message, if order contains  654568_01 how can i print in log?


texts: magento 1.9: How should I use Magento's API

texts:
I am implementing a program that communicates with magento 1.9 using JavaScript. We only need to obtain the product information on the system and display it. Does not operate the database (for example: add and delete),

what should I do? Appreciated your help, Thanks in Advance :)


texts:
I've noticed our grids have filters applied whenever going onto Manage Products, if I reset filter and refresh the page the filter is reapplied

Checked the logs and couldn't find any errors...


texts:
I am working on magento enterprise  1.14.2.0 and we installed all patches that required.

I am facing issue with cache or session

when customer login to his/her account, Customer name display wrong on top link cart-item count  order and customer profile are ok but name in top link is wrong.

I am using customize template

<?php
     $session = Mage::helper('customer');
     if($session->isLoggedIn()) {
        $customer = $session->getCustomer();
        echo "<p>".$customer->getName()."</p>";
     }
 ?>


texts: Show related products on category view - Magento 2

texts: Is it possible to call out the related products on category pages? So within each product in the grid, it would also display the full list of that product's related products.


texts: Magento 2 : custom template file for different categories

texts:
I want to set custom template file for different categories.

How to set custom phtml file for different categories using XML file?

Any help would be appreciated.


texts: Need to generate the invoice automatically once the shipment is created. [Magento 2.3.3 EE]

texts:
I want to generate the invoice automatically once the shipment is created. [Magento 2.3.3 EE]
More details as follows:

Automatically create an invoice based on orders with shipment created

Automatically send invoice emails to customer

Create an automatic invoice for each shipment created in the order(s) against each sub order created

Discounts, shipment, COD charges, etc should be divided appropriately in each sub-order & invoice for the order


texts: Magento 1.9: Add custom text box on invoice page for partial capture

texts:
I have created a payment module with auth-capture option and its working properly in Magento 1.9. The requirement is to capture a portion of the amount without changing the quantity. For this I have added a custom button "Partial Capture" on invoice page. Now how can I add a custom field on invoice page to enter a partial amount? How can I validate this custom field while clicking on "Partial Capture" button? Now "Partial Capture" button is showing on all invoices. How to show this button only on invoices with status "pending"? Any help will be appreciated.

Function in observer:

public function addButtons(Varien_Event_Observer $observer)
{

    $block = $observer->getBlock();
    if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Invoice_View) {
        $message = Mage::helper('core')->__('Are you sure you want to do this?');
        $block->addButton('custom_button', array(
            'label'     => Mage::helper('core')->__('Partial Capture'),
            'onclick'   => "confirmSetLocation('{$message}', '{$block->getUrl('onlinepayment/noply/partialcapture')}')",
            'class'     => 'go'
        ));
    }
}

Event in config.xml:

<adminhtml>
    <events>
        <adminhtml_widget_container_html_before>
            <observers>
                <custombuttons>
                    <class>onlinepayment/observer</class>
                    <type>singleton</type>
                    <method>addButtons</method>
                </custombuttons>
            </observers>
        </adminhtml_widget_container_html_before>
    </events>
</adminhtml>


texts: Adding custom fields on to frontend forms

texts:
I am trying to learn how to add fields onto a form and store them in the database. I am using the registration form for this exercise.

So far I have:

displayed an additional field
located relevant table in the db that stores the label (eav_attribute), names (customer_entity_varchar) and email (customer_entity)
set is_required to 1
displayed label next to field

My problem is that when I input data that field is not saved to the database, also I can leave it blank and the form will still be accepted. I assume this is because I added the data directly to my database (therefore bypassing other functions Magento needs to run).

I have looked around for an answer and found this, which seems to confirm my thought about needing to use a setup script for this task and I also came across this. Between the two of them I was pretty confident I could overcome this issue without any further help but I can't work out:

from link 1

how customer_account_edit and customer_account_create are identified as being needed?

from link 2

what do the first and second parameters do in $this->addAttribute() in the setup script, I can see the third parameter is the values for each column?
how is the first parameter of setData() decided?

*snippet from link 2*

<address_setup>
    <setup>
        <module>Excellence_Address</module>
        <class>Mage_Customer_Model_Entity_Setup</class> <!-- This is the important thing-->
    </setup>
    <connection>
        <use>core_setup</use>
    </connection>
</address_setup>

Setup

$installer = $this;

$installer->startSetup();

$this->addAttribute('customer_address', 'govt_id', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'Govt ID No#',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'visible_on_front' => 1
));
Mage::getSingleton('eav/config')
    ->getAttribute('customer_address', 'govt_id')
    ->setData('used_in_forms', array('customer_register_address','customer_address_edit','adminhtml_customer_address'))
    ->save();
$installer->endSetup();


texts: Magento 2, how to get list of product by item_id?

texts:
Using Magento 2.2, REST API. What URI of api for get list of product by item_id?

  This below get all item without defined item_id

GET /index.php/rest/V1/carts/mine/items HTTP/1.1
Content-Type: application/json

[
    {
        "item_id": 2094,
        "sku": "Food with option 6-AS-----",
        "qty": 2,
        "name": "Food with option 6",
        "price": 0,
        "product_type": "configurable",
        "quote_id": "1173",
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": "2",
                        "option_value": "4"
                    },
                    {
                        "option_id": "3",
                        "option_value": "7,9"
                    },
                    {
                        "option_id": "4",
                        "option_value": "10,11,12"
                    }
                ],
                "configurable_item_options": [
                    {
                        "option_id": "155",
                        "option_value": 57
                    }
                ]
            }
        }
    }
]

--- ANSWER ---

I use quote_id instead of item_id then use URI

  GET {{url}}/index.php/rest/V1/carts/{{quote_id}}/items


texts: Magento set data to block in magento way?

texts:
I'm studying Magento and I'm interested to know how to rewrite my code in "Magento way":

echo Mage::app()->getLayout()->createBlock('...')
   ->setData('shipment', $this->getShipment())
   ->setData('order', $this->getOrder())
   ->toHtml();

So the question is about: How I can call setData from my config.xml files to get in my layout.phtml file something like this:

echo $this->getChildHtml('block_name')

Or my current code is correct and there is nothing to refactor?


texts: How to add View Model to a Custom Widget?

texts:
I am extending ProductList widget and I want to call a View Model from another module testing\ProductFeatures\ViewModel in my own custom template.
I have tried researching on how to use the View Model but it seems like there is no resources that tells me how can I use View Model in another module. How can I do that?


texts: Magento 2 .3.3 installation is stuck at 99 percent?

texts: Installation is incomplete error at 99 percent but when i login to admin panel its working fine .what i next to do ?any one kindly state the issue?


texts: how to get inclusive and exclusive price in products collections magento 2?

texts:
Here i am trying to get the inclusive and exclusive price in products
  collections magento 2.If anyone any have idea please help me.


texts: Magento 2 Migration Error customer_eav_attribute and index_process_event

texts:
I am getting error during migration from Magento 1.9.3.1 to Magento 2.2.4.

[2018-01-09 09:01:32][ERROR]: Foreign key (FK_CSTR_EAV_ATTR_ATTR_ID_EAV_ATTR_ATTR_ID) constraint fails on source database. Orphan records id: 185,186,187 from `customer_eav_attribute`.`attribute_id` has no referenced records in `eav_attribute`

and

[2018-01-09 09:01:32][ERROR]: Foreign key (FK_INDEX_PROCESS_EVENT_EVENT_ID_INDEX_EVENT_EVENT_ID) constraint fails on source database. Orphan records id: 36788 from `index_process_event`.`event_id` has no referenced records in `index_event`

Can you guys help me to resolve this issue?


texts: What exactly is a multi-tenant compiler in Magento as referred in this link: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-compiler.html?


texts:
In magento2 how can we Overwrite Controller ?

Any help will be appreciated

Thank you


texts: how to use controller code in template .phtml file

texts:
after visit this url : sitename.com/example/module/createSimpleProduct ,
we are displaying link : "create products" ,  once we click on link, it will create new products in Database.

app/code/local/module/Example/controllers - Modulecontroller.php

class Module_Example_ModuleController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
        {
            echo 'This is index controller.

                Create Simple Product';

        }

    public function createSimpleProductAction()
        {
            $product = $this->_createProduct(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
            echo 'See getId() . '">create products';
        }

we want to display this link & achieve same feature in product view page, so we added below code & gave href link to the button in addtocart.phtml file , but its giving fatal error :

 <button type="button" >

    <?php echo 'See getId() . '">created simple product' ?>

    </button>

Edit

protected function _createProduct($type, $doSave=true)
    {

        Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

        $product = Mage::getModel('catalog/product');

        // set madatory system attributes
        $rand = rand(1, 9999);
        $product
            ->setTypeId($type)     // e.g. Mage_Catalog_Model_Product_Type::TYPE_SIMPLE
            ->setAttributeSetId(17) // default attribute set
            ->setSku('CDSB_sku' . $rand) // generate some random SKU
            ->setWebsiteIDs(array(1))
        ;

        // make the product visible
        $product
            ->setCategoryIds(array(2,3))
            ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
            ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) // visible in catalog and search
        ;
        // configure stock
        $product->setStockData(array(
            'use_config_manage_stock' => 1, // use global config ?
            'manage_stock'            => 0, // shoudl we manage stock or not?
            'is_in_stock'             => 1,
            'qty'                     => 50,
        ));

        // optimize performance, tell Magento to not update indexes
        $product
            ->setIsMassupdate(true)
            ->setExcludeUrlRewrite(true)
        ;

        // finally set custom data
        $product
            ->setName('Test Product #' . $rand) // add string attribute
            ->setShortDescription('Description') // add text attribute

            // set up prices
            ->setPrice(599)
            //->setSpecialPrice(19.99)
            ->setTaxClassId(2)    // Taxable Goods by default
            ->setWeight(1)
        ;

        // add product images
        $images = array(
            'thumbnail'   => 'image.png',
            'small_image' => 'image.png',
            'image'       => 'image.png',
        );

        $dir = Mage::getBaseDir('media') . DS . 'example/amasty/';

        foreach ($images as $imageType => $imageFileName) {
            $path = $dir . $imageFileName;
            if (file_exists($path)) {
                try {
                    $product->addImageToMediaGallery($path, $imageType, false);
                } catch (Exception $e) {
                    echo $e->getMessage();
                }
            } else {
                echo "Can not find image by path: `{$path}`
";
            }
        }

        if ($doSave)
            $product->save();

        return $product;
    }