texts: What is the proper way to override the getFinalPrice method based on value of 2 customizable option text fields?

texts:
I want to change the final value on getFinalPrice in Magento\Catalog\Model\Product\Type\Price so that I can modify the price based on the value of 2 customizable option text fields. I am using "$product->getCustomOption('option_' . $option->getId())" to get the value of my options on the page.

Here are my conditions with additional amounts:

Field1: "Corn"

Field2: "2 Rows"

+$2 (add 2 dollars)
Field1: "Corn"

Field2: "3 Rows"

+$3 (add 3 dollars)
Field1: "Pesticide"

Field2: "Airplane"

+basePrice * 0.05 (add 5% of the basePrice)

Below is the picture of my test product with 2 text fields representing my 2 test fields (Field1 and Field2)

I feel like Magento 2 probably has an easy way to override this Price using plugins. I may make multiple copies of this plugin class so that I can also change by percentage and also be able to turn on/off customizations easily. Observers may not be ideal in this case because I need to take into account the order that I process these custom attribute prices.

What I have so far...

<?php

namespace Cpf\PriceAdjustment\Plugin\Product\Type;

class PricePlugin{
    public function __construct(
        \Psr\Log\LoggerInterface $logger
        , \Magento\Catalog\Model\ProductRepository $productRepository){
        $this->logger = $logger;
        $this->productRepository = $productRepository;
    }
    public function aroundGetFinalPrice(\Magento\Catalog\Model\Product\Type\Price $subject, callable $proceed, $qty, \Magento\Catalog\Model\Product $product){
        $this->logger->debug("test");
        $result = $proceed($qty, $product);

        $this->logger->debug(print_r($result, true));
        $finalPrice = $result;
        // $finalPrice = 2015.00;
        // $product->setFinalPrice($finalPrice);
        $id = $product->getSku();
        $this->logger->debug(print_r($id, true));
        $option_ids = $product->getCustomOption('option_ids');
        if($option_ids){
            $this->logger->debug(print_r("I got some options now..." . rand(), true));
            //$this->logger->debug(print_r($option_ids, true));
            foreach (explode(',', $option_ids->getValue()) as $optionId) {
                $this->logger->debug(print_r($optionId, true));
                if ($option = $product->getOptionById($optionId)) {
                    $confItemOption = $product->getCustomOption('option_' . $option->getId());

                    $this->logger->debug(print_r($confItemOption->getValue(), true));

                    $group = $option->groupFactory($option->getType())
                        ->setOption($option)
                        ->setConfigurationItemOption($confItemOption);
                    //$finalPrice += $group->getOptionPrice($confItemOption->getValue(), $basePrice);
                }
            }
        }
        return $finalPrice;
    }
}


texts: Magento2 Admin dashboard chart is broken in my all Projects

texts:
Today suddenly my admin dashboard chart is not visible.
Live and Test websites are on different server and suddenly today it's broken.
I have check in log file and found that

[2019-03-19 05:51:17] main.CRITICAL: Unable to read response, or
response is empty {"exception":"[object]
(Zend_Http_Client_Exception(code: 0): Unable to read response, or
response is empty at
/vendor/magento/zendframework1/library/Zend/Http/Client.php:1093)"} []

EDIT

My problem is suddenly fixed automatically,google chart is enable now


texts: Breakdown `composer update` to avoid php memory limit

texts:
Sounds not possible, but I will ask anyway.

When being in shared hosting, I am stuck on php memory limit exception on composer update.

Is there a way to breakdown update to smaller parts?

I am upgrading from 2.2.4 to 2.3. System requires 1035M.

My shared hosting doesn't let me increase php memory limit. It is set to max at 768M.

Editing for one more bump to top


texts:
A similar question was already asked here: Magento 2 javascript text translations, but Magento updated this translation technique in the beta version.

How can I add or update translations used by Javascript?

I figured out that Magento creates a file called 'js-translation.json' in the static folder. If I edit this file directly, I see that my translations are updated. But where is this file created, and how can I add translations so that Magento will automatically add this to js-translation.json when it's generated?

Update

The correct answer to this question is still not given, altough Mage2.PRO pointed me to the right direction, it's not the full answer. My js-translation.json is still empty when generated.

For example, I like to translate the Add To Cart button. This button has three states, Add To Cart, Adding... and Added... How can I translate these words? Another example, the 'You have no items in your shopping cart.' text in the minicart. I think all these phrases should be translated from js-translation.json, but where to add them so these file is filled with these translations?


texts:
I Followed the  tutorial  Add Free Shipping Bar In Mini Cart, Magento 2 https://kiwicommerce.co.uk/blog/how-to-add-free-shipping-bar-in-top-mini-cart/
The progress bar showing but the Title Text is white color https://prnt.sc/1384c5s  Help me


texts: How to create a link to Google Search using Product Name?

texts:
This might be a simple or difficult question, but I would like to create a button on my product pages that link to a search to online shopping. We don't sell online and I saw another website do that and thought it was great.  I copied their button code and I know where to put it but didn't know how to make the link a variable based on product name.
See Shop Online Button
<a target="_blank" href="https://www.google.com/search?q=REFLEX%20CARBON%20POLAR%20HELMET+REFLEX%20CARBON%20POLAR%20HELMET&amp;tbm=shop&amp;tbs=vw:g" class="info-grid-btn shop-online-btn">
                    SHOP ONLINE
                </a>

https://www.thormx.com/products/?productGroupId=419557&productId=592914


texts: Is there any way to add module block inside any other module's phtml file in magento 2?

texts:
I have a layered navigation module inside my Magento 2 custom created theme.

Now, I have to use this layered nav module's phtml file to another module just like catalog module's phtml file.

Can anyone please tell me how to do this?

Thanks in advanced.


texts:
I have to implement in Magento CE 1.9 a system for managing our reseller network.

In short, this is the scenario:

reseller can sell our products using our shop frontend, providing
to their customers the link of their landing page (ex.
www.shop.com/reseller-name).
The Reseller's landing pages are graphically customized, offering
the main product catalog (or a selection). There is no possibility
by    the resellers to upload/choose their products.
Product's prices and features, along resellers commissions, are
defined by the Admin. Admin can define global values or different
values for each resellers.
Resellers earn their commission only when a product is added to
cart from their landing page/catalog.
About Payment: money are sent to the Admin, that will pay later the
commission to their resellers.
About Shipping: the Admin ship the goods to the resellers, no need
to implement a different way to manage the shipment.
Reseller have a personal backend/dashboard in order to monitoring
their orders, commissions, customer's addresses, ecc.

The are some great Magento extensions that permit to obtain a Multivendor Market Place (ex. https://www.apptha.com/magento/marketplace or https://secure.unirgy.com/products/umarketplace/magento-multi-vendor-marketplace) but they are more powerful than my needs, above all permitting users to create their own shop on your platform, uploading their own products.

I have not yet found any extensions that permit to obtain the described goals, and customizing any Multivendor Market place extension is expensive and finally not an "elegant" solutions.

I also think that using the native Magento multi-store functionalities will lead to a painfull resellers management: I will have to manage a great number of resellers and I need to automatize as much as possible the Sign-Up/selling flow by the resellers.

Do you have any good idea?
Thank you!


texts:
How can I show  product quantity drop down to customer for offering quantity as follows on product view page;
 1 / 10 / 20 / 30 / 40 / 50 / 60 / 70 / 80 / 90 / 100

Any suggestion would be appreciated.


texts: Magento1.9 Connect to External Mssql Database using Pdo_dblib

texts:
I am trying to connect an external database to get few data into Magento. I am using pdo_dblib to connect to the database.

try {
$hostname = "hostname";
$port = port;
$dbname = "dbname";
$username = "username";
$pw = "pwd";
$dbh = new PDO ("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw");

}catch (PDOException $e) {
    echo "Failed to get DB handle: " . $e->getMessage() . "\n";
    exit;
  }
  echo "Passed";

I am getting the error message like SQLSTATE[01002] Adaptive Server connection failed (severity 9).

Now I am able to get a connection to database but when I try to call the stored procedure I am not getting anything. I am not able to log any errors also. Please help me on this.

Thanks in advance.


texts: What is effect on /V1/order?searchCriteria api,when i delete some customer from magento admin panel?

texts: I have some issue in rest/V1/orders?searchCriteria API.If I deleted all customer from admin panel,then what is effect on rest/V1/orders?searchCriteria API.When i call this API it give response:"Requested product doesn't exist.".Please guide me.


texts: Magento 2 > Images Background Color do not apply

texts:
On Magento 2.0.2 I edited my custom theme view.xml (app/design/frontend/XXXXX/default/etc/view.xml) and added 2 properties for each images type : transparency and background.

My file now looks like this

<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
    <media>
        <images module="Magento_Catalog">
            ...
            <image id="cart_cross_sell_products" type="thumbnail">
                <width>250</width>
                <height>165</height>
                <transparency>false</transparency>
                <background>[237,237,237]</background>
            </image>
            ...
        </images>
    </media>
    ...
</view>

Looking at my file my background color should be set as this color (RGB 237,237,237 : hex #ededed). Actually that specific color is not applied but is black. Please take a look at the screenshot below:

What did I miss can someone lend a hand?

Edit : Still working on this issue. Some suggested to run bin/magento catalog:images:resize and bin/magento cache:flush but it did not help my cause.

Edit 2016-10-27 : I could not find a fix so I decided to extend the Image.php helper in a module and did something like this. It worked.

class Image extends \Magento\Catalog\Helper\Image{
    protected function setImageProperties() {
        parent::setImageProperties();
        $this->_getModel()->setBackgroundColor([237,237,237]);
        return $this;
    }
}

Edit 2017-12-15 : Warning : This issue has been fixed long time ago by Magento. I strongly suggest you update your Magento 2 sale platform to the latest available version at the moment you read this, not only this will fix plenty of issues you have but it will also improve performance and security by a great length.


texts:
I am trying to install Magento 2 after finish install all and composer, went to the browser http://url/setup and get error:

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

if (PHP_SAPI == 'cli') {
    echo "You cannot run this from the command line." . PHP_EOL .
        "Run \"php bin/magento\" instead." . PHP_EOL;
    exit(1);
}
try {
    require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
    echo <<getMessage()}

HTML;
    exit(1);
}

// For Setup Wizard we are using our customized error handler
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);

\Zend\Mvc\Application::init(require __DIR__ . '/config/application.config.php')->run();

try to run from the command line getting:

  PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted
  (tried to allocate 8192 bytes) in
  /var/www/magento2/setup/config/states.extensionManager.config.php on
  line 66

I have change the memory_limit = 2048MB in the php.ini under
/etc/php/7.0/apache2 and made restart to the apache


texts:
I am trying to upgrade magento2.2.3 CE to 2.3.1CE on staging server (magemojo)
After upgraded getting the below errors. Please can anyone face these below issues suggest me how to fix?
1.Unable to unserialize value. Error: Syntax error
fallowed this link https://magecomp.com/blog/solved-unable-to-unserialize-value-magento-2-2/
2.Type Error occurred when creating object: Magento\Framework\Interception\Config\Config
3.PHP 7.1.27 currently using.


texts: Magento 2 create category attribute thumbnail and upload image using File Uploader Component

texts:
I've created a custom module to display category thumbnail image.
I've read magento dev doc
It is displayed in my category section using category_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="content">
        <field name="thumbnail">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="source" xsi:type="string">category</item>
                    <item name="label" xsi:type="string" translate="true">Thumbnail Image</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="formElement" xsi:type="string">fileUploader</item>
                    <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                    <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                    <item name="required" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="number">30</item>
                    <item name="uploaderConfig" xsi:type="array">
                        <item name="url" xsi:type="url" path="categorylist/category_thumbnailimage/upload"/>
                    </item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

when i upload image i showing following error

1 exception(s):
Exception #0 (BadMethodCallException): Missing required argument $baseTmpPath of Magento\Catalog\Model\ImageUploader.

Exception #0 (BadMethodCallException): Missing required argument $baseTmpPath of Magento\Catalog\Model\ImageUploader.

my controller file is

<?php

namespace Company\Categorylist\Controller\Adminhtml\Category\Thumbnailimage;

use Magento\Framework\Controller\ResultFactory;

/**
 * Class Upload
 */
class Upload extends \Magento\Backend\App\Action
{
    protected $baseTmpPath;
      /**
     * Image uploader
     *
     * @var \Magento\Catalog\Model\ImageUploader
     */
    protected $imageUploader;

    /**
     * Upload constructor.
     *
     * @param \Magento\Backend\App\Action\Context $context
     * @param \Magento\Catalog\Model\ImageUploader $imageUploader
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Catalog\Model\ImageUploader $imageUploader
    ) {
        $this->imageUploader = $imageUploader;
        parent::__construct($context);

    }
   public function execute() {
        try {
            $result = $this->imageUploader->saveFileToTmpDir('thumbnail');
            $result['cookie'] = [
                'name' => $this->_getSession()->getName(),
                'value' => $this->_getSession()->getSessionId(),
                'lifetime' => $this->_getSession()->getCookieLifetime(),
                'path' => $this->_getSession()->getCookiePath(),
                'domain' => $this->_getSession()->getCookieDomain(),
            ];
        } catch (\Exception $e) {
            $result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
        }
        return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result);
   }
}


texts: How to add custom css file specific to language or store in magento2

texts:
in my project i have 2 store one is for en other is ar_KW , i am creating new locale called ar_KW
when i run magento setup:static-content:deploy ar_KW

it will create a ar_KW folder in pub static folder which is same as en_US but i need to add new custom css file only for Arabic store that is ar_KW store but when i switch to en_US store that custom css should not load ,  in that case how to do it  ?

and also for specific language(less variable value need to change in that case how to do it? )

example :- i have two view one is en other one is Arabic that i ar when i switch store between store css class called direction value should  change from float left to right and visa-versa that is less variable value will change based on locale in that case how to do it in magento 2


texts: Magento 2 - How to add ajax tab on admin user edit page in admin section

texts:
I want to add a tab on User edit page which can be accessed from grid in section System -> All users. I have managed to add tab but it is not loading through AJAX. When I click on tab it redirects to another URL.

Please see screen shot and code below.

Code:-

/app/code/Namespace/Module/Block/Adminhtml/Edit/Tab/Customer.php

<?php
namespace Namespace\Module\Block\Adminhtml\Edit\Tab;

class Customer extends \Magento\Backend\Block\Widget\Tabs
{
    /**
     * Class constructor
     *
     * @return void
     */
    protected function _construct()
    {
        parent::_construct();
        $this->setId('page_tabs');
        $this->setDestElementId('edit_form');
    }

    /**
     * @return $this
     */
    protected function _beforeToHtml()
    {

        $this->addTab(
            'magcr_customer_section',
            [
                'label' => __('Select Customer(s)'),
                'title' => __('Select Customer(s)'),
                'url' => $this->getUrl('magcr/index/customer'),
                'class' => 'ajax',
                'active' => FALSE
            ]
        );
        return parent::_beforeToHtml();
    }
}

/app/code/Namespace/Module/view/adminhtml/layout/adminhtml_user_edit.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="left">
            <block class="Namespace\Module\Block\Adminhtml\Edit\Tab\Customer" name="adminhtml.user.edit.tabs1"/>
        </referenceContainer>
    </body>
</page>

Please help what am I doing wrong.

UPDATE

When I modify below code in constructor of block class, the tabs loads through ajax.

$this->setId('magcr_page_tabs');

But now problem is both 'User Info' and 'Select Customer(s)' load automatically on page load.


texts: Installing Magento on one server and MySQL on another server

texts: I am installing a new instance of Magento. I need all of the web files on one server and the mysql database to be on another server. Is there any documentation on how this install would work? All the install guides I have found assume the database is on the same server.


texts: porto theme css is not loading on frontend in magento 2.0.4

texts:
Installation is successfully completed but my css is not loading only html is displaying on frontend.
I am getting following error no css is loaded I have run deploy command also

GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/mage/calendar.css
(index):18 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/css/styles-m.css
(index):20 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/bootstrap/css/bootstrap-theme.css
(index):21 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/owl.carousel/assets/owl.carousel.css
(index):19 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/bootstrap/css/bootstrap.css
(index):22 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/css/animate.css
(index):23 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/icon-fonts/css/porto-icons-codes.css
(index):24 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/icon-fonts/css/animation.css
(index):25 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/css/custom.css
(index):26 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/Smartwave_Filterproducts/css/filterproducts.css
(index):27 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/css/styles-l.css
(index):31 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/requirejs/require.js
(index):32 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/mage/requirejs/mixins.js
requirejs-config.js:58 Uncaught TypeError: require is not a function(anonymous function) @ requirejs-config.js:58(anonymous function) @ requirejs-config.js:63(anonymous function) @ requirejs-config.js:601
(index):34 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/jquery.js
(index):183 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/images/logo.svg 404 (Not Found)
(index):35 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/bootstrap/js/bootstrap.min.js
(index):37 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/mage/calendar.css
(index):43 Uncaught TypeError: require is not a function(anonymous function) @ (index):43
(index):51 Uncaught TypeError: require.config is not a function(anonymous function) @ (index):51
(index):292 Uncaught TypeError: require is not a function(anonymous function) @ (index):292
(index):357 Uncaught TypeError: require is not a function(anonymous function) @ (index):357
(index):427 Uncaught TypeError: require is not a function(anonymous function) @ (index):427
(index):962 Uncaught TypeError: require is not a function(anonymous function) @ (index):962
(index):1054 Uncaught TypeError: require is not a function(anonymous function) @ (index):1054
(index):1135 Uncaught TypeError: require is not a function(anonymous function) @ (index):1135
(index):1215 Uncaught TypeError: require is not a function(anonymous function) @ (index):1215
(index):473 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/Magento_Catalog/images/product/placeholder/small_image.jpg 404 (Not Found)
(index):28 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/css/print.css
(index):474 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/Magento_Catalog/images/product/placeholder/thumbnail.jpg 404 (Not Found)
logo.svg:1 GET rootdirectory/magento204/pub/static/frontend/Smartwave/porto/en_US/images/logo.svg 404 (Not Found)


texts:
I have just setup Magento DE (from what I understood it is basically the same as standard Magento but comes with some useful extensions for german market) 1.9.0.1 and everything works fine until I get to press the checkout button. The only thing displayed is a blank window, no source code is loaded. Console output shows
GET http://domain/index.php/checkout/onepage/ 500 (Internal Server Error)

What I've tried so far:
Logging in or checking out as a guest
Using webserver rewrites or not (thought I'd give it a try)
Replacing my template with a stock one
Replacing files of the core code that made sense with the original one (haven't changed them ofcourse)
Disabling onepage checkout (only leads to "Checkout" buttons disappearing from basket)
Any other ideas? Thanks


texts: How to show all available currency prices in magento 2

texts:
All the products in my project are configurable. I managed to convert price using below code.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product1 = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($product1->getId() );
$price = $product->getFinalPrice();
$currencysymbol = $objectManager->get('Magento\Store\Model\StoreManagerInterface');
$currency2 = $currencysymbol->getStore()->getCurrentCurrencyCode();
$currency = $objectManager->create('Magento\Directory\Model\Currency')->load($currency2);
echo $price;
echo $currency2;

if($currency2 == 'SAR'){

    echo $currency->convert($price,'AED');
}
elseif($currency2 == 'AED'){
    echo $currency->convert($price,'SAR');
}

But by default when product options are selected the product price varies dynamically for a configurable product. In this situation how to pass the different products id's on different options selected.


texts:
I need to delete/truncate the Magento 1.9 core URL rewrites which are older than 3 months of core_url_rewrite table in Database.

What's the exact SQL query to achieve this?


texts: Update price in checkout page without refresh Magento 2

texts:
I have a controller where I apply some discount on the checkout page.
Now, I can see the price change just after I refresh the page.

I search for a solution, to refresh the price using a Js file.

define([
        'jquery',
        'Magento_Checkout/js/action/get-totals'
        ], function ($, getTotalsAction) {
        "use strict";

          $.ajax({
                method: "post",
                url: demoUrl, //your ajax Url
                data: {/*here post data*/},
                dataType: "html",
                success: function (resp) {
                   //below two lines refershing cart summary
                    var deferred = $.Deferred();
                    getTotalsAction([], deferred); //this function already created in Magento_Checkout/js/action/get-totals.js file
                }

            });

});

But if I insert this script in my controller, nothing happens!

Does anyone have any idea how can an update the price without refreshing the page?

I know by default Magento 2 has a function to do that. When I enter a valid coupon code the price it's updated without refreshing the page!


texts: How to add "SKU" and "Product Name" to sales order grid?

texts:
I am trying to add "sku" and "product name" to sales order grid with filtering.

I have created my joins but the columns are empty and I'm not sure what I have done incorrectly here...

Trying to get collection from sales/flat_order_item

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel($this->_getCollectionClass());

    $collection->getSelect()->joinLeft(array('sfoi' => 'sales_flat_order_item'),
        'sfoi.parent_id=main_table.entity_id', array('sfoi.sku',
        'sfoi.name'));

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

And add to the grid

protected function _prepareColumns()
{
    $this->addColumn('sku', array(
        'header'=> Mage::helper('sales')->__('Sku'),
        'width' => '80px',
        'type'  => 'text',
        'filter_index' => 'sfoi.sku',
    ));

    $this->addColumn('name', array(
        'header'=> Mage::helper('sales')->__('Product Name'),
        'width' => '80px',
        'type'  => 'text',
        'filter_index' => 'sfoi.name',
    ));
}

Can anyone see what I have done wrong here please..?


texts: Magento - get categories and subcategories in a collection

texts:
I have the following category structure in my magento store

- root
    - category 0 (ID 26)
        - category 1 (main)
            - category A (sub)
            - category V (sub)
        - category 2 (main)
            - category G (sub)
            - category J (sub)
            - category E (sub)
        - category 3 (main)
            - category L (sub)

and so on...

On a page i want to be able to output the following:

1. get each (main) category and its name and url
    2. get the first (sub) category in (main) and its icon (custom attribute)

So it would output this for each:

 main-cat-name

Giving something like:

<category 1 link><category A icon img></link>
<category 1 link><category 1 name>

<category 2 link><category G icon img>
<category 2 link><category 2 link>

<category 3 link><category L icon img>
<category 3 link><category 3 link>

What is the best way of doing so? So far I have:

<?php
$_id = 26 // category 0
$_main_categories = Mage::getModel('catalog/category')
->getCollection()
->addFieldToFilter('parent_id', array('eq'=>$_id))
->addAttributeToFilter('is_active', 1)
->addAttributeToSelect(array('id','name','url'))

foreach($_main_categories as $_main_cat)
{
    // load full main category
    $_category = Mage::getModel('catalog/category')->load($_main_cat->getId());
    // get sub category's children
    $_main_cat_subs = $_category->getChildrenCategories();

    // loop through sub catagories, get icon in first and break
    foreach($_main_cat_subs as $_sub_cat)
    {
        // load full sub category
        $_sub = Mage::getModel('catalog/category')->load($_sub_cat->getId());
        $i++;
            $_icon = $_sub_cat->getIcon();
        }
        if( $i >= 1 ){
            break; // as i only want the first one
        }
    }

    // output
    ?>
    <a href="<?php echo $_main_cat->getUrl() ?>">
        <img src="<?php echo $_icon ?>">

    <a href="<?php echo $_main_cat->getUrl() ?>">
        <?php echo $_main_cat->getName() ?>

<?php
}
?>

This works but seems very bad practice to load the full category models in a foreach loop twice and when the site grows could take a long time.

What is the best way of doing the above performance wise?


texts: Delete all product images from a specific category?

texts:
I recently uploaded some images for products and accidently duplicated them for products that are all listed within a specific category.

I've looked around and found a solution that claims to delete all images, but I want to do this for a specific category (category ID).

I can't be the first to have had this happen.

How can I delete all product images (only the images) from a specific category?


texts: Need to save custom attribute during product save grammatically in magneto 2

texts:
I have custom attribute in form of drop down and multiselect.But during product save these are not saving in database like i have a warranty dropdown attribute.

 $product->setwarranty($wholedata['product']['warranty']); // Product Warranty


texts: How to use Jquery price slider in Magento 2?

texts: I want to display price slider in category page side menu using Jquery price slider. But I don't know how to do it. Can anyone please help me?


texts: Magento2 - MSI In-Store Pickup how to enable?

texts:
I have a fresh Magento 2.3.2 installation and want to allow my customers to pick up their orders in-store.

But I can't find any configuration related to this functionality, can someone explain to me, how to configure In-Store Pickup in Magento?


texts: Include title / salutation at /order endpoint

texts:
Is there anyway of getting a customers title (mr / mrs etc) to the /rest/V1/orders/orderID endpoint? It currently doesn't appear.

https://devdocs.magento.com/swagger/index.html#!/salesOrderRepositoryV1

Seems like a bit of an oversight not to include this by default...


texts: Magento 1.9 contact form reply to address

texts:
Since upgrading to 1.9.3 and changing to the RWD theme my contact form now have a reply to of our address instead of the customers email addresses so that when I click reply, the email comes back to me instead of going back to the customer?

Does anyone know why this would have started happening and how I can fix it?


texts: Error while sudo php bin/magento setup:upgrade

texts:
Replace App And Pub Folder of Theme In Magento2.

  After that Run Following Command : **sudo php bin/magento setup:upgrade**

 Show Following error :

  > PHP Fatal error:  Cannot redeclare __() (previously declared in
  > /var/www/html/magento2/lib/internal/Magento/Framework/Phrase/__.php:15)
  > in /var/www/html/magento2/app/functions.php on line 22


texts: is it problem with respect to seo if we add same product to 5 different categories

texts:
I did this : system > configuration > catalog > seo >

Use Categories Path for Product URLs : NO

Use Canonical Link Meta Tag For Products : yes

i added same product to 5 different categories.

we have some 1000 products.

if i follow the same procedure to all 1000 products, it means

if i add all products to 5 different categories, is there any problem related to "SEO"

please help me to find solution.

thanks in advance.


texts:
I need to pass an url of an ftp to be the product image by the magento api, can I do this?
Something like
{
            "attribute_code": "image",
            "value": "https://upload.wikimedia.org/wikipedia/commons/5/5c/Alan-Walker-_Faded.jpg"
        }

I found the api to pass the image but it asks for a file and a base64 as below but this way it doesn't answer me.
{
"entry": {
"media_type": "image",
"label": "new_picture",
"types": [
  "image"
],
"file": "pic1.jpg",
"content": {
  "base64_encoded_data": "",
  "type": "image",
  "name": "pic1.jpg"
}
  }
}


texts: How to get Order in SenderBuilder class?

texts:
I override the \Magento\Sales\Model\Order\Email\SenderBuilder class in my Magento 2. I want to load some order data but I am not getting anything.

Code :

<?php
namespace Customisation\OrderEmail\Model\Order\Email;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Mail\Template\TransportBuilder;
use Magento\Framework\Mail\Template\TransportBuilderByStore;
use Magento\Sales\Model\Order\Email\Container\IdentityInterface;
use Magento\Sales\Model\Order\Email\Container\Template;

class SenderBuilder extends \Magento\Sales\Model\Order\Email\SenderBuilder
{
    protected $templateContainer;
    protected $identityContainer;
    protected $transportBuilder;
    private $transportBuilderByStore;

    public function __construct(
        Template $templateContainer,
        IdentityInterface $identityContainer,
        TransportBuilder $transportBuilder,
        TransportBuilderByStore $transportBuilderByStore = null,

    ) {
        $this->templateContainer = $templateContainer;
        $this->identityContainer = $identityContainer;
        $this->transportBuilder = $transportBuilder;
        $this->transportBuilderByStore = $transportBuilderByStore ?: ObjectManager::getInstance()->get(
            TransportBuilderByStore::class
        );
        parent::__construct($templateContainer, $identityContainer, $transportBuilder, $this->transportBuilderByStore);

    }

    public function send()
    {
        //$custom_email = 'test@gmail.com';
        $_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $this->configureEmailTemplate();

        $this->transportBuilder->addTo(
            $this->identityContainer->getCustomerEmail(),
            $this->identityContainer->getCustomerName()
        );

        $copyTo = $this->identityContainer->getEmailCopyTo();

        if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'bcc') {
            foreach ($copyTo as $email) {
                $this->transportBuilder->addBcc($email);
            }
        }

        if($email){
            $this->transportBuilder->addBcc($custom_email); // Added for add BCC for custom dynamic email address
            $logger->info($email);
        }

        $transport = $this->transportBuilder->getTransport();
        $transport->sendMessage();
    }
}

I want to get order data in this send(). How can I get order id or Order in this function ?


texts:
I'm trying to cache my menu module like this:

$cache = Mage::app()->getCache();

if(!($cachedMenu = $cache->load("super_menu_".$child->getId())))
{
   ....blah blah blah .... generating some string ...

   $cache->save("super_menu_".$child->getId(),$str);
}
else
   echo $cachedMenu;

But It seems everytime it tries to generate the menu, I'm using Redis as my caching system and it works great for other parts of my codes. I don't know if I missed something here or not.


texts: product image thumbnail didn`t work on direction:rtl

texts:
I used magento 2.3.2 ,when i used

{
direction:rtl;
}

on pub/static/frontend/Magento/luma/ar_SA/css/styles-l.css

the product image thumbnail didn`t work

any one can help me to make it work ?


texts: How to retrieve Customer ID on Create Order page

texts:
FINAL EDIT (resolved)

A big thanks to Marius for answering this question. With his help and some information from this question, I was able to piece together a working solution. Here is the final (working) code block:

public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true)
{
    $cust = $this->getCustomer();
    $custId = $cust->getId();
    $vat = $cust->getData('taxvat');

    $custAddress = Mage::getModel('customer/address')->load($cust->default_shipping);
    $custState = $custAddress->getData('region');

    $customerLoggedIn = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
    $taxRate = $taxRate / 100;

    if ($priceIncludeTax) {
        $amount = $price * (1 - 1 / (1 + $taxRate));
    } else if (strtoupper($custState) === 'FLORIDA' || strtoupper($customerLoggedIn) === 'FLORIDA') {
        if ($vat) {
            $amount = $price;
        } else {
            $amount = $price * $taxRate;
        }
    } else {
        $amount = 0;
    }

    if ($round) {
        return $this->round($amount);
    }

    return $amount;
}

Original Question

As seen in this question (self-answered), I am trying to code a custom condition into my Tax setup.

This is working perfectly on the frontend and it was working on the backend earlier. I haven't changed the code, so I'm rather at a loss to why it isn't working now.

How do I load the Customer ID when I am on the Create New Order page?

The method I was using successfully is no longer working with my error log saying:

Undefined variable: customerId  in /app/code/local/Mage/Tax/Model/Calculation.php on line 658

Line 658:

$cust = Mage::getModel('customer/customer')->load($customerId);

This is within the Tax/Model/Calculation.php file, so it references this code block:

public function getCustomer()
{
    if ($this->_customer === null) {
        $session = Mage::getSingleton('customer/session');
        if ($session->isLoggedIn()) {
            $this->_customer = $session->getCustomer();
        } elseif ($session->getCustomerId()) {
            $this->_customer = Mage::getModel('customer/customer')->load($session->getCustomerId());
        } else {
            $this->_customer = false;
        }
    }
    return $this->_customer;
}

The method I am modifying is calcTaxAmount:

public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true)
{
    $cust = Mage::getModel('customer/customer')->load($customerId);
    $vat = $cust->getData('taxvat');

    $customerLoggedIn = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
    $taxRate = $taxRate / 100;

    if ($priceIncludeTax) {
        $amount = $price * (1 - 1 / (1 + $taxRate));
    } else if (strtoupper($customerLoggedIn) === 'FLORIDA') {
        if ($vat) {
            $amount = $price;
        } else {
            $amount = $price * $taxRate;
        }
    } else {
        $amount = 0;
    }

    if ($round) {
        return $this->round($amount);
    }

    return $amount;
}


texts:
I'm using Magento 1.8.1 CE and I want change weight attribute.
How can I remove weight decimals from frontend?
My products weight is showing this way: 12.0000 and I want it to be like this: 12 without any decimal.
i followed removing price decimals but it doesn't work on weight!
I am using a custom template.


texts: How can I disable product tabs for specific categories?

texts: I'm using the extension easytabs but I don't want to show every tab in every category. What is an easy way to disable my product tabs in specifics categories?


texts: Magento2, display tax rate on product page through xml file

texts:
I'm trying to display the tax rate on product page in same container as price . Where to place  $_product->getAttributeText('tax_class_id') ?

Edit:

In myvendor/mytheme/Magento_Catalog/templates/product/view/attribute.phtmlthis
<?php echo $block->escapeHtml($_product->getAttributeText('tax_class_id')); ?>returns the value . But how to move it in product-info-price or after it?`


texts:
I'm looking for a German translation of the stock Magento 1.9 404 page.

It's so hard to find one online, only standard DE translation locale pages are available.

But definitely need this too!

The stock looks like this :

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

Whoops, our bad...

The page you requested was not found, and we have a fine guess why.

    If you typed the URL directly, please make sure the spelling is correct.
    If you clicked on a link to get here, the link is outdated.

What can you do?
    Have no fear, help is near! There are many ways you can get back on track.

    Go back to the previous page.
    Use the search bar at the top of the page to search for your products.
    Follow these links to get you back on track!
    Store Home | My Account


texts: Disable "Share Wishlist" and "email to friend"?

texts:
I would like to disable Share Wishlist with friend feature, as well as, another product sharing feature: "Email to Friend".

Is there a way to disable any of these two in the Admin Panel ?
If not, what is the other most efficient way of disabling these mailing feature?


texts: Magento ver. 1.9.3.9 After update catalog url rewrite stuck on processing

texts:
I am faced with an issue, whereby after updating magento to 1.9.3.9 from 1.9.3.8 my catalog_url_rewrite index is stuck on processing. Checking process list I cannot see anything untoward. Also, checking status via shell I see running. Why after updating a store would the reindex now be stuck on processing?

Checking the table catalog_product_index_eav there is no data in there at all. Now, I am not sure if this should be empty or not. But, this was also empty before the update.

I have also tried to reindex via shell same result.

The php error cropping up is:

  Allowed memory size of 268435456 bytes exhausted (tried to allocate 130968 bytes) in /magento/app/code/core/Zend/Db/Select.php on line 281

Now, my memory limit has not been changed whatsoever and is in fact at the 256mb I set. On my local I even set the limit to a rather massive 3GB to test, yet the same result.

What could be causing this from the update? On the same server I also have a 1.9.3.8 version, and the reindex completed within 30 seconds.

To rule out database issues I have ran the database repair tool against a fresh new install:

And, as seen there are no issues at all with database.

  "...Database doesnt require changes" (db repair tool, 2018)

I even disabled all local extensions in local.xml:

 <disable_local_modules>true</disable_local_modules>

But, the same thing occurs: It runs for awhile then blanks out, and in the php log you can see the above memory size exhausted issue. Rather perplexed as I am not sure what is happening here now.

Interestingly, when I click any product and hit save, I can see that the catalog url rewrite index has been reindex, without the aforementioned issue.

Running the following query I get 196120 rows in the table:

SELECT COUNT(url_rewrite_id) FROM core_url_rewrite;

23389 of which are defined as custom;
And 172722 of which are defined as system.

I am contemplating truncating as a solution. Thus, is it safe to do so, and what are the ramifications?


texts: Web service API SOAP v1 using java for connect?

texts:
In official site exists this faq
http://www.magentocommerce.com/api/soap/introduction.html
And in line As of v1.3, you may also use the following URL to access the Magento API v2, which has been added to improve compatibility with Java and .NET:
He says that in v2 java is more compatible. I researched and found that there are some ways to connect to java ws magento.

the first: https://github.com/webdevwilson/magento-java

the second: http://code.google.com/p/magja/

Which one do you recommend? Which is easier to implement? why did some tests and got no satisfactory result

I want to know if I can also use the V1 magento ws to connect USING only java


texts: How to fetch the image from DB and display it , to frontend in magento 2

texts:
I have created custom Backend grid and Ui form to add image slider and it is working good in Backend. In Backend I have fetched the image by getting media url.In frontend, have fetched the image name and  from database  and also fetched media url .But I need to fetch the image and show it in front end. Please suggest me a solution to do.

This is what i got using below codes.

Block\ImageSlider.php

    <?php

namespace OX\HomeSlider\Block;

use Magento\Framework\View\Element\Template\Context;
use OX\HomeSlider\Model\Post;
use Magento\Framework\View\Element\Template;

//use \Magento\Store\Model\StoreManagerInterface

class ImageSlider extends Template
{

    protected $storeManager;

    public function __construct(Context $context, Post $model, \Magento\Store\Model\StoreManagerInterface $storeManager)
    {
        $this->model = $model;
        $this->storeManager = $storeManager;
        parent::__construct($context);
    }

    public function getCollection()
    {
        $collection = $this->model->getCollection();
        return $collection;
    }

     public function getMediaUrl()
    {
        $mediaUrl = $this->storeManager->getStore()
                ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);

        return $mediaUrl;
    }

DataProvider.php

<?php

namespace namspace\HomeSlider\Model;

use namspace\HomeSlider\Model\ResourceModel\Post\CollectionFactory;
use Magento\Store\Model\StoreManagerInterface;

class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
{

    protected $collection;
    protected $_loadedData;
    protected $_storeManager;

    public function __construct(
    $name, $primaryFieldName, $requestFieldName, CollectionFactory $postCollectionFactory, StoreManagerInterface $storeManager, array $meta = [], array $data = []
    )
    {
        $this->collection = $postCollectionFactory->create();
        $this->_storeManager = $storeManager;
        parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
    }

    public function getData()
    {

        if (isset($this->_loadedData)) {
            return $this->_loadedData;
        }
        $items = $this->collection->getItems();
        foreach ($items as $item) {
            $this->_loadedData[$item->getId()] = $item->getData();

            if ($item->getImage()) {
            // replace icon to your custom field name
            $m['image'][0]['name'] = $item->getImage();
            $m['image'][0]['url'] = $this->getMediaUrl().'homeslider/'.$item->getImage();

            $fullData = $this->_loadedData;
            $this->_loadedData[$item->getId()] = array_merge($fullData[$item->getId()], $m);
            }

        }

        return $this->_loadedData;
    }

    public function getMediaUrl()
    {
        $mediaUrl = $this->_storeManager->getStore()
                        ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);

        return $mediaUrl;
    }

}

view/frontend/templates/Imageslider.phtml

<?php $collections = $this->getCollection(); ?>

<?php
    foreach($collections as $collection){
        echo $collection->getImage();
    }
?>

<?php echo $am = $this->getMediaUrl().'homeslider/'.$collection->getImage(); ?>


texts: Magento 2 Custom API: Need to create an API which gets the data from a table in database

texts:
I have a magento store for which I was using the Magestore Bannerslider module to show a simple carousel on the homepage.

But now I am experimenting with a headless approach, and there's no API to get the banner details from the database.

Any ideas how will I create a custom API module to query the table of this module

  magestore_bannerslider_banner

Thanks!


texts: Customer session autometic destroy in magento 2

texts:
Hi i m using magento 2 with multistore in my base store customer login works fine but i have problem with my another store problem is listed below:

When i try to login in customer account, and when i click on login than it works successfully and redirects to my account page but after that when i refresh my account page or click on any links than it redirect to login page.

I already try to disable all the modules.

Please help me to solve this problem


texts: Magento 2.4 Hide Price from Recently viewed products for certain products

texts:
I want to hide Price from recently viewed products for certain products only(Based on its attribute value).How can I do that? Please anyone help me to do that.
Thank you in advance.


texts: getOptionInstance()->getOptions() returning empty array

texts:
I am trying to delete custom options in a data install script. I have a list of product IDs and I am looping through them like this:

foreach ($productIds as $productId) {
    $product = Mage::getModel('catalog/product')->load($productId);
    $oldOptions = $product->getOptionInstance()->getOptions();
    foreach ($oldOptions as $key => $option) {
        $oldOptions[$key]['is_delete'] = 1;
    }
    $product->getOptionInstance()->setOptions($oldOptions);
    $product->getOptionInstance()->saveOptions();
}

The problem is, $oldOptions is always an empty array. I know for a fact that the products in question have custom options set. When I run it through a debugger, I can see that the _options property on the product is populated correctly.

I have a query I can use to delete the options from the database, but that makes me a bit nervous since I'm not 100% clear on how that will affect the product (i.e., what type of lifecycle methods may not be skipped by doing a direct SQL delete).


texts:
Is it possible to create a custom magento cron job.
The task I want it can be done by

run sql query
using php to process some logic of the sql result
send out email to customer service.
cron job running like 10 minutes each

Above is possible solution can be done by the cron job?


texts:
I am overriding the layout and adding ViewModel in that layout but when I try to fetch the ViewModel getting below error

  PHP Fatal error:  Uncaught Error: Call to a member function getCodes() on null

My XML files look life which resides under

  /app/design/frontend/Custom/Theme/Magento_Review/layout/override/base/review_product_list.xml

    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">+
   <body>
        <referenceBlock name="product_additional_data">
            <arguments>
                <argument name="view_model" xsi:type="object">Custom\ProductModel\ViewModel\LocaleInfo</argument>
            </arguments>
        </referenceBlock>
     </body>
</page>

and my ViewModel resides under

  Custom/ProductModel/ViewModel/LocaleInfo.php

and files look like

use Magento\Framework\View\Element\Block\ArgumentInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Locale\Resolver as LocaleResolver;
use Magento\Store\Model\ScopeInterface;

class LocaleInfo implements ArgumentInterface
{
    protected $scopeConfig;
    protected $localeResolver;

    public function __construct(
        ScopeConfigInterface $scopeConfig,
        LocaleResolver $localeResolver
    ) {
        $this->scopeConfig = $scopeConfig;
        $this->localeResolver = $localeResolver;
    }

    public function getCodes($storeId = null)
    {
        $configPath = $this->localeResolver->getDefaultLocalePath();
        $localeCode = $this->scopeConfig->getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId);

        return $localeCode;
    }
}

trying to fetch like below

$myViewModel = $block->getViewModel();
echo $myViewModel->getCodes();


texts: What is meaning of "Row Total" in magento?

texts:
I always get confused about Row total in Magento.

Can anyone explain what this term means and how it is calculated?


texts:
I have just installed a Magento extension for Smush.it and image optimization extension however when I go into the tool, it tells me that

The Magento CRON is not set up. Please set up your Magento CRON for Smush.it to function correctly.

Please can someone advise as to how I can enable cron for this module


texts: Custom Category attribute created but not saved

texts:
I've created a custom extension in order to add a custom attribute on product Categories.
Here's the code I've used to create it:

$installer = $this;
$installer->startSetup();
$attribute  = array(
    'type' => 'int',
    'label'=> 'Featured Author',
    'input' => 'checkbox',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => false,
    'default' => 0,
    'source' => "eav/entity_attribute_source_boolean",
    'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'featured_author', $attribute);
$installer->endSetup();

The attribute is created and it's visible on backend. I also checked eav_attribute database table and the attribute is created in there too.

But changing the attribute's value (check/uncheck) and then saving category has no effect at all. The attribute value is not updated/saved. The checkbox is always unchecked.

What should I do to fix this?


texts:
For trainings, Magento provides an VirtualBox Ubuntu VM with a version of Magento described as "Magento Enterprise Lite".

What are the key differences between EE and EE Lite?
Is this version of Magento publicly available?
Is there anything preventing developers from using this for EE development?

Edit

I know how to obtain it. Any thoughts on what the license agreement is with this version and what the limitations are?


texts:
I am using a newheader.phtml file where I am calling mini cart inside li tag.

<?php //echo $this->getViewFileUrl('img/cart_ic.png'); ?>
              <?php echo $this->getChildHtml('minicart') ?>

In my default.xml file.

 <move element="minicart" destination="custom.header" />
        <referenceContainer name="header.container">
            <container name="custom.header" htmlClass="headerSection" htmlTag="div">
                <block class="Magento\Framework\View\Element\Template" name="header.sections" before="main.content" template="Magento_Theme::html/newheader.phtml">

                </block>
            </container>
        </referenceContainer>

But when I see source code in browser changes will not reflect. I have already clear cache & deploy static content.

below is my custom header.

The last li tag is still blank, however, getchildhtml() has been called inside the custom header. But I need to display the cart icon inside the last li tag.


texts: SetCountry() does not reflect in backend

texts:
So practically, i'm importing data over API and saving it like this :

(not all the code but only the relevant)

$addressarray
    ->setCustomAttribute('exact_address_id', $contactaddress['ID'])
    ->setCustomerId($customerrep->getId())
    ->setFirstname($contact['firstname'])
    ->setLastname($contact['lastname'])
    ->setCountryId($contactaddress['Country'])
    ->setRegionId(0)
    ->setPostcode($contactaddress['Postcode'])
    ->setCity($contactaddress['City'])
    ->setTelephone($contact['account']['Phone'])
    ->setFax($contact['account']['Fax'])
    ->setCompany($contactaddress['AccountName'])
    ->setStreet(array($contactaddressstreet))
    ->setVatId($contact['account']['VATNumber']);

    if ($contact['account']['AddressLine1'] == $contactaddress['AddressLine1']) {
    $addressarray->setIsDefaultBilling(true);
    $addressarray->setIsDefaultShipping(true);
    } else {
    $addressarray->setIsDefaultBilling(false);
    $addressarray->setIsDefaultShipping(false);
    }
    try {
    $address->save($addressarray);

And everything seems to work fine , everything is filled in and in the database addresses are created.

BUT

Even though my database table customer_address_entity says 'BE' (which is id for Belgium) under country_id the field itself is empty.

Even more so when i save the customer myself with the address nothing really changes. Its still BE.

Anyone any idea?

Github : Github magento 2 report


texts: Allow customer to pay statement (arbitrary amount)

texts:
Assuming I have a business where dealers can buy on credit, what would be the best way to have them pay their statement via Magento?

In other words: how should I go about charging a customer an arbitrary amount.

One option is to have an observer create a virtual product which has the same price as the statement, this way it could just be 'added to cart', the product would then be deleted once payment is collected.

The issues with this is:

Other users could potentially see the product (not a good UX idea)
There's a lot of creation and deleting of non essential data (we really shouldn't have to create a product)
Statements are not products (and probably should not be 'added to cart')

If anyone has some other ideas, please share


texts: Keywords meta tags are not being updated

texts:
When I change the Meta Keywords in Search Engine Optimization and check the result with the Developer Tools of my browser, I can't see any change.

I tried removing the browser cache and cleaning Magento this way:

cd /var/www/html/MAGENTO_FOLDER
rm -rf var/cache/* var/di/* var/generation/* var/page_cache/* var/view_preprocessed/* pub/static/frontend/*
php bin/magento cache:clean
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento cron:run

But it doesn't solve the issue.

Is it a bug from Magento 2.2 or is there something else I should do to refresh the Meta Keywords tags ?


texts: Magento2: How to remove required validation from street field in billing address

texts:
I want to remove required validation from street field in billing address.

I am using below code that remove the validation from telephone field but not remove required validation from street field:-

        <?php
namespace Teejan\CustomBillingaddress\Plugin;

class LayoutProcessor
{
    public function afterProcess($subject, $jsLayout)
    {
        foreach ($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
                 ['payment']['children']['payments-list']['children'] as &$child)
        {
            $child['children']['form-fields']['children']['telephone']['validation'] = ['required-entry' => false];
            $child['children']['form-fields']['children']['street']['validation'] = ['required-entry' => false];
            unset($child['children']['form-fields']['children']['postcode']);
            //unset($child['children']['form-fields']['children']['street']);
        }

        return $jsLayout;
    }
}

Please help me to remove this.

I also try below format but no luck:-

$child['children']['form-fields']['children']['street["0"]']['validation'] = ['required-entry' => false];


texts: How to change the Persistent Cart time for Guest Users?

texts: Magento 2 cleans up the guest cart data under 24 mins if left idle, is there any setting which can help to persist cart data for a guest user for around 90 days?


texts: Magento223: How to Import CSV during module installation

texts:
I have custom module in which i am importing csv file upon button click.
I want to import the csv during module installation, i don't know how to implement it in install data file.

Any help will be appreciated.


texts: How Display categories and subcategories at frontend with sorting alphabetically

texts:
I don't have an idea about how can do that
Could you please help me for that?


texts: How to to render category view for my custom collection?

texts:
I am attempting to render a category view and feed that view a custom collection. The layout is rendering and the data is being passed from URL to collection but I cannot get the category to push the collection to the layout.

 require_once Mage::getModuleDir('controllers', 'Mage_Catalog').DS.'CategoryController.php';
 class Coder_Catalog_RecipesController  extends Mage_Catalog_CategoryController
{
    $design = Mage::getSingleton('catalog/design')->applyDesign();
//        $settings = $design->getDesignSettings($category);

        $update = $this->getLayout()->getUpdate();
        $update->addHandle('default');
                    $this->addActionLayoutHandles();
        $this->loadLayoutUpdates();

        $this->generateLayoutXml()->generateLayoutBlocks();

        $this->_initLayoutMessages('catalog/session');
        $this->_initLayoutMessages('checkout/session');
    $params=$this->getRequest()->getParams();
    $flavor=$params[0];
    if(empty($params)){
        return $this->_forward('defaultNoRoute');
    }else{
        $product = Mage::getModel ('catalog/product')
            ->getCollection ()
            ->addAttributeToFilter ('url_key', $flavor)
            ->getFirstItem (); //only 1 result
        if(!$product->getId()){
            echo 'fail';
        }
        $groupedParentsIds = Mage::getResourceSingleton('catalog/product_link')
           ->getParentIdsByChild($product->getId(), Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED);
    }
    $this->loadLayout()->renderLayout();
}

}


texts: how to get the local time for the orders?

texts:
i have a problem with time zone , when i make an order , the time for this  command ('created_at') is not the local time , it returns the UTC time and not local time

so for that i find the solution here magento 2 - getCreatedAt() returns UTC time and not local time

but in my case i am working with the function addColumn() to display the date

can anyone help me to implement that in my case

$this->addColumn('m_created_at', array(
            'header'       => __('Date :'),
            'index'        => 'm_created_at',
            'type'         => 'm_datetime',
            'filter_index' => 'main_table.created_at',
        ));

my local variables :

'locale' => [
                    'firstday' => '0',
                    'weekend' => '0,6',
                    'datetime_format_long' => '%A, %B %e %Y [%I:%M %p]',
                    'datetime_format_medium' => '%a, %b %e %Y [%I:%M %p]',
                    'datetime_format_short' => '%m/%d/%y [%I:%M %p]',
                    'date_format_long' => '%A, %B %e %Y',
                    'date_format_medium' => '%a, %b %e %Y',
                    'date_format_short' => '%m/%d/%y',
                    'language' => 'en',
                    'code' => 'fr_FR',
                    'timezone' => 'Europe/Paris',
                    'weight_unit' => 'kgs',
                ],


texts: Add category custom attribute with dropdown

texts:
I need to add to category a custom atribute , a select with 2 values:

0 - "No"
1 - "Yes"

I created a module and used this code in installation file:

$this->startSetup();
$this->addAttribute('catalog_category', 'top_brand', array(
    'group'                => 'General',
    'type'              => 'int',//can be int, varchar, decimal, text, datetime
    'backend'           => '',
    'frontend_input'    => '',
    'frontend'          => '',
    'label'             => 'Top Hersteller',
    'input'             => 'select', //text, textarea, select, file, image, multilselect
    'option' => array(
        'value' => array(

            'optionone'=> array(
                0 =>'No'),
            'optiontwo'=> array(
                0 =>'Yes')
        ),

    ),
    'default' => array(0),
    'class'             => '',
    // 'source'            => '',//this is necessary for select and multilelect, for the rest leave it blank
    'global'             => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,//scope can be SCOPE_STORE or SCOPE_GLOBAL or SCOPE_WEBSITE
    'visible'           => true,
    'frontend_class'     => '',
    'required'          => false,//or true
    'user_defined'      => true,
    'default'           => '',
    'position'            => 100,//any number will do
));
$this->endSetup();

Attribute appear in administration panel but value added in select for "No" is 3 and for "Yes" is 4.
How to make value 0 and 1 ?


texts:
Hi i want to select a sales_order_item by order_id

$collection=$this->orderCollection;
       $collection->getSelect()
        ->join( array('order_item'=> 'sales_order_item'),
                'order_item.order_id = main_table.entity_id'
             )
        ->where('order_item.order_id = ' . $orderId)
        ->limit(1); $element = $this->orderCollection->getItems();
        return $element;

but i get only the sales_order table content


texts:
I'm calling in a layout update from a module, from the module's config.xml file:

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

...

    <frontend>
        <layout>
            <updates>
                <cmsogdata>
                    <file>cjw/cmsogdata.xml</file>
                </cmsogdata>
            </updates>
        </layout>
    </frontend>

...

</config>

It pulls the file in fine - if I put a deliberate syntax error in cmsogdata.xml, everything breaks as you'd expect.

What I'm trying to do is add a custom block into the HTML <head> on every page via <default> and it's not working.

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

    <default>
        <reference name="head">
            <block type="core/template" name="og.general" template="page/html/og-general.phtml" />
        </reference>
    </default>

</layout>

However if I target a specific page, such as the homepage it does work, e.g.:

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

    <cms_index_index>
        <reference name="head">
            <block type="core/template" name="og.general" template="page/html/og-general.phtml" />
        </reference>
    </cms_index_index>

</layout>

What am I missing?


texts: How do I disable the fax field for customers? (preferrably using the admin, not removing code)


texts: Putting Layout Files in Module Directory

texts: Can you put module layout files within the Module's code directory in Magento 1.13?  This is as opposed to putting them in /app/design/...


texts: I am confused which observer should I use for an order placed event in magento 2?

texts:
I want to use an observer which will triggered when an order will placed on front end by the user. I am little bit confused which observer I should use for this requirement.

sales_order_place_after observer

or
checkout_onepage_controller_success_action.


texts: In magento2 b2b we need to generate invoice based on seller series. Fox example: if a customer is buying a sellerA product and creating a invoice then the invoiceid must be 1 after 2 or 3 days if any customer again bought sellerA product the invoiceid must be 2. How can we do this?


texts: Inject custom block in custom position into checkout page

texts:
I'm stuck with injecting a block from my module into checkout page. The problem is that I need my block be inserted right before closing <body> tag, this is "before_body_end" position, as I know.

As I understand, I must put name of some checkout block into <reference name=""> of my block. But I also need to put <reference name="before_body_end"> there at the same time.

How can I achieve that? Or I'm completely wrong in my thoughts? My changes must be completely independent from system and thirdparty files.


texts: magento 2 collect totals for order like quote

texts:
Is there any function to collect total like quote for orders ? or any way for this

$quote->collectTotals()


texts: Ebizmarts Mailchimp Can We Use Storewise In Magento2

texts:
I want to use Ebizmarts_Mailchimp store wise to know that which language site the subscription came from.

Also How to link the signup form in footer to Mailchimp and link checkout to record revenue.

I configure all API key in admin.

But I am confused that How it work.


texts:
I have upgraded my magento version 2.1.7 to 2.1.15. The upgrade process working fine. But the issue is my home page contents are not loading. It loada product detail page content in the home page.

Please help me to resolve the issue


texts:
Can anyone tell me where this is set?
I need to check it's value.

I've looked in admin console and in app/etc/config.xml and app/etc/local.xml


texts: Magento 2: How to change the default country in the "Estimate shipping" block in cart?

texts: I've set my default country (Spain) in admin, also set it to be the only destination country available for shipping, however in the cart the default country is United States. How can I change it?


texts:
I have added the following code to the editor:

After saving it automatically changed to :

Is there a method to avoid adding
 tag?


texts: Assign reward points on final custom order status update by admin from backend

texts:
I need to assign a rewards point after order final status (this is customized order status) update by admin. Also, the requirement to assign reward points on a % basis of custom order field in which value is filled by admin.
For example:
We are selling home services. Users can book service by ordering service as a normal product. But once final service delivery to the customer there is a service charge (differs from service to service) which added by admin into the custom field into order area and reward will calculate on the % basic of service charge.
Here I am not able to figure out how I manage the Reward assignment on order status update and custom field in order area on which reward will get calculated.
I really appreciate and Many thanks for reading my query.


texts: Default login data for Magento demo store backend?

texts:
Whats the login data for the Magento demo store backend found here: http://demo-admin.magentocommerce.com/index.php/admin/

It used to be admin and admin123 if I remember it correctly, but that doesn't work anymore.

Ideas?


texts:
I have the folowing issue:
Id like Magento2 to send an email to notify my client that the order placed is under Pending Payment, how can I do this?
Thanks


texts: Magento 2 : Fetch system.xml group id in source model

texts:
In Magento 2, I want to fetch group id from system.xml in my custom sourceModel

But I am unable to find a solution online.

Please do let me know if it's possible or not.

I know there's an alternate solution to create 2 separate source Models for this purpose but I want to use only one.


texts: Plugins for intercepting methods with a negative sort order?

texts: Within your di.xml you can add plugins to intercept methods of injectable classes. You can also specify a sortOrder. Can this ordering be negative, like -1? We guess so, but would like to know if somebody dealt with this before.


texts: Disable massaction checkbox checked on grid row click

texts:
I want to cancel default behavior on grid row click - checking massaction checkboxes. The another default action - is redirecting to an editing page, and I've disabled it in this way - add this method to my grid -

public function getRowUrl($row)
{
    return '';
}

I've also tried to use openGridRow() function, but it didn't work (I've placed it in my own js file).
But I need to disable checkbox checking too. Does anybody know, how to do it?
If it's possible to do with openGridRow(), where I need to place it?


texts: how to show order delivery date in order confirmation email in magento2.1.7

texts:
How to show order delivery date in new order confirmation email in magento2.1.7
plz someone guide me on this
thanks in advance..
i have referred this link I want to add delivery date in order email template in Magento-2.1? but could not achieve my requirement


texts:
I need to get images by its position and I need each image resized to a concrete heigh and width.

If I want a image by its position I can do it by this code:

$_product
    ->getMediaGalleryImages()
    ->getItemByColumnValue('position', 1)
    ->getUrl();

//get image at position 1

And I know how to resize an image with this code:

echo $product
        ->helper('catalog/image')
        ->init($_product, 'image')
        ->constrainOnly(true)
        ->keepAspectRatio(true)
        ->resize(900, 400);

But this code resizes the image set as image (or thumbnail, or small_image) but I don't know how to resize the image set at certain position (for example 2).

How can I merge both codes to resize the image at a certain position?


texts: How to add IMEI number to product to check waranty

texts: I want to add functionality to check product warranty using IMEI number. if a user ordered more then 1 qty then their IMEI number are also different.


texts: How to avoid millions of simple products when using configurable product for t-shirts

texts:
I have a problem.  I have 1000 T-Shirts that each have 7 size options, 10 colour options and 7 print options.  I create a configurable product and then add each simple associated product for each option.

Lucky I have an extension that creates all the associated simple products for each of my configurable products.

However, this adds up to 700 simple products for each of my 1000 T-Shirts.  or 7 million unique simple products.  Which I think you will agree is a lot. OK each of the simple products is not visible on the front end but nevertheless, that is a lot of DB records.

I know that I can use custom options for this task as I dont need to manage stock as each T-Shirt is custom made. However, I am using M2ePro to sysc my product cat with ebay and this appears to need configurable products in order to create product variations

Any ideas would be great
Thanks


texts: Where does Magento 2 Make its REST Order Call

texts:
I recently discovered that Magento 2's checkout flow does not place an order during the PHP page request.  Instead, an additional RESTFUL API request is made to the application to place the order.

Does anyone know where this REST request takes place in Magento 2's code?


texts:
I am using a function to show custom information on an invoice:  (app/code/core/Mage/Sales/Model/Order/Pdf/invoice.php)

public function customtext($page)
{
    $page->drawText(Mage::helper('sales')->__('custom text '), 35, $this->y, 'UTF-8');
}

Added at end of invoice.php, and $this->customtext($page); added to end of public function getPdf($invoices = array()) above $this->_afterGetPdf();

But I want to include in my custom text the value of 20% of my invoice Grand Total.  How is this done?


texts: Magento 2 image resize command error images are not same

texts: Magento 2.3.4 run image resize command give error images are not same  size domain/pub/media/catalog/product/m/e/megilbert.gif  @ error/layer.c/OptimizeLayerFrames/1023


texts: Magento. Quantity in checkout shopping cart doesn't work properly

texts:
I have installed Magento 1.8.0 and on localhost the cart is working correctly. I change the quantity of a product in the cart then I push the "Update cart" button and all works fine. I trasferred the site online and the cart quantity doesn't work anymore. As I change the quantity of a product and click the button the quantity remains the same. If I go back and try to add the same product to the cart, even if I specify a different quantity like 10 and not 1, in the cart only 1 item is added every time I click on "add to the cart" button and not 10 as specified. I cannot figure out where's the problem. I excluded my custom theme and rolled back to the default theme and the problem persist. I updated magento to 1.8.1 and the same problem.

No logs. Nothing.


texts: How can Customer make payment for Admin Created Order

texts:
How can a Customer make Payment if Admin has created Order on Behalf of Customer?
https://docs.magento.com/user-guide/v2.3/customers/customer-account-create-order.html


texts: Disable all modules except Mage/Core modules that are needed

texts:
I've used this script before to enable all.

UPDATE `core_config_data`
  SET `value` = '0'
  WHERE `path` LIKE 'advanced/modules_disable_output/%';

Is there an easy way to disable all except MAGE/CORE modules?


texts:
I need to add a dropdown "Type"

For example:

then

Question:
How can i add dropdown "TYPE" in QUEUE informartion like the image above and how can save it when i click "Save Newsletter"?

Question:
How can i send the newsletter to the specific subscriber that has a "Type" like "Customer" if the newsletter template name is "Customer"?


texts: Save Config Button does not work when  tag is added in system.xml file

texts:
I am adding color picker in system configuration fields.
My block class is at vendor/Module/Block/Color.php

<?php
namespace PME\SuccessPage\Block\Adminhtml\System\Config;

class Color extends \Magento\Config\Block\System\Config\Form\Field {

    public function __construct(
    \Magento\Backend\Block\Template\Context $context, array $data = []
    ) {
        parent::__construct($context, $data);
    }

    protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
        $html = $element->getElementHtml();
        $value = $element->getData('value');

        $html .= '';
        return $html;
    }

}

I have added js libraries at:
vendor/module/view/adminhtml/layout/adminhtml_system_config_edit.xml
as

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">

        <css src="jquery/colorpicker/css/colorpicker.css"/>
        <link src="jquery/colorpicker/js/colorpicker.js"/>

</page>

When I uncomment <frontend_model>vendor/module/Block/Color</frontend_model> in system.xml file save config button stops working!!
My field in System.xml is:

<group id="design_section" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="1" showInStore="1">
                Design Section
                <field id="display" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Display Fields
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="link_color" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Background Color
                    <comment><![CDATA[Background color]]></comment>
                    <frontend_model>vendor\module\Block\Color</frontend_model>
                    <depends>
                        <field id="display">1</field>
                    </depends>
                </field>
            </group>


texts: Image resize adds black bars instead of transparent

texts:
I'm trying to resize my product images so they all fit in a 1:1 square. To prevent cutting off the edges I want to add whitespace, but it adds black bars instead of transparent ones. My code:

$image->quality(90);
$image->keepAspectRatio(true);
$image->keepFrame(true);
$image->keepTransparency(true);

if($height == $width) {
    $image->resize(1000, 1000);
}

$image->save($cachedImagePath);

However, it turns out like this:

Any ideas on how to change the black bars to white? I'm running 1.9.0.1 with the latest patches installed (up to 9767). Thanks in advance!


texts: How can I make the customer's email to show up on Invoice?

texts:
I was wondering how I could get a customer's email address to appear right underneath their Telephone number on an invoice in the "Sold to:" section.

The following is how the "Sold to:" section currently looks,

John Doe
123 Fake Street
Beverly Hills, California, 90210
United States
T: (555) 555-5555

and I want it to look like,

John Doe
123 Fake Street
Beverly Hills, California, 90210
United States
T: (555) 555-5555
johndoe@johndoe.com

Edit:
After some googling I stumbled upon this gem which worked for me just in case anyone else runs into the same issue.
[broken link]


texts: Create product using SOAP API and JSON input

texts:
I need to create product with SOAP API and JSON, here is my JSON input:

  {"sku":"tsett","name":"TEST","weight":"3.0000","qty":"18.0000","brand":"sample","category_ids":["107","108","109"],"pirce":"Rs. 1,500.00","description ":"sample disc"}

here is the create product api code, how to add the json request using values of request to create the product:

    $client = new SoapClient('http://magentohost/api/soap/?wsdl');
    $session = $client->login('apiUser', 'apiKey');
    $attributeSets = $client->call($session, 'product_attribute_set.list');
    $attributeSet = current($attributeSets);
  $result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], 'product_sku', array(
'categories' => array(2),
'websites' => array(1),
'name' => 'Product name',
'description' => 'Product description',
'short_description' => 'Product short description',
'weight' => '10',
'status' => '1',
'url_key' => 'product-url-key',
'url_path' => 'product-url-path',
'visibility' => '4',
'price' => '100',
'tax_class_id' => 1,
'meta_title' => 'Product meta title',
'meta_keyword' => 'Product meta keyword',
'meta_description' => 'Product meta description'
   )));

      var_dump ($result);


texts: how to add discount and apply on order in admin

texts: I need an input field in order create in Admin can put order discount and a button to apply discount. after applying the discount will show on Order total area.


texts: How To Display Product Brand Name In Left Column In Product Page?

texts:
I want to display a product brand name in left column of product page. Can you help me to solve this ?

Thanks advance!!!


texts: Unable to find styles-l.css original path in custom theme

texts:
I want to add/modify some styles to styles-l.css, but i am unabl to identify the original path location, as i mentioned the below static content file path.

pub/static/frontend/Smartwave/porto/en_US/css/styles-l.css

Can any one tell me the original location of the styles-l.css for the above path.


texts: Fatal error after installling Kiwicommerce SMTP extension

texts: Fatal error: Uncaught RuntimeException: Source class "\KiwiCommerce\EnhancedSMTP" for "\KiwiCommerce\EnhancedSMTP\Logger" generation does not exist. in /home/ksantosh/public_html/vendor/magento/framework/Code/Generator.php:218 Stack trace: #0 /home/ksantosh/public_html/vendor/magento/framework/Code/Generator.php(124): Magento\Framework\Code\Generator->tryToLoadSourceClass('\\KiwiCommerce\\E...', Object(Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger)) #1 /home/ksantosh/public_html/vendor/magento/framework/Code/Generator.php(213): Magento\Framework\Code\Generator->generateClass('\\KiwiCommerce\\E...') #2 /home/ksantosh/public_html/vendor/magento/framework/Code/Generator.php(124): Magento\Framework\Code\Generator->tryToLoadSourceClass('KiwiCommerce\\En...', Object(Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger)) #3 /home/ksantosh/public_html/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('KiwiCommerce\\En...') #4 [internal function]: in /home/ksantosh/public_html/vendor/magento/framework/Code/Generator.php on line 218


texts: How can add image in instructions for bank transfer for frontend as well admin magento 2

texts:
I have added an image in the Bank Transfer Instructions. It is showing fine for the checkout page at the frontend. But I need to show similar to the backend. In the backend, only the image URL is showing.
I have used this URL to use HTML instructions which is working fine for checkout page.
How can I do this? Please help if anyone can?


texts: How to get the grouped product price with a quantity of added products

texts:
I'm using this code to get grouped product price in this file "Magento_GroupedProduct\templates\product\price\final_price.phtml":

<?php
$products = $block->getSaleableItem()
    ->getTypeInstance()
    ->getAssociatedProducts($block->getSaleableItem());

$priceForAll = 0;
foreach ($products as $product) {
    $priceForAll += $product
        ->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE);
}
?>

    <?php if ($priceForAll && \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW != $block->getZone()): ?>
    $<?php echo number_format($priceForAll,2,'.',',')?>
    <?php endif ?>

But this sums up the total cost of all added goods without counting the quantity. I have no problem on the product page because I'm using JS to count price dynamically

But I have an incorrect price on the category page

How can I check the quantity of all added products and show the correct price?

Thanks!


texts: Magento 2 :  is Not Working in Widget.xml

texts:
</depends> is not working in my below widget configuration inside widget.xml. Can any one help me on this. I want to display values based on pre selected value.

<parameters>
            <parameter name="available_options" xsi:type="select"  visible="true">
                Choose Style Dropdown
                <description translate="true">Image getting displayed in various sizes.</description>
                <options>
                    <option name="newsletter" value="newsletter">
                        Email subscribe
                    </option>
                    <option name="category_link" value="category_link">
                        Link to a category
                    </option>
                    <option name="product_page" value="product_page">
                        Product detail page
                    </option>
                </options>
            </parameter>
            <parameter name="id_path_product" xsi:type="block" visible="true" sort_order="10">
                Link to a Specified Product
                <depends>
                    <parameter name="available_options" value="product_page" />
                </depends>
                <block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
                    <data>
                        <item name="button" xsi:type="array">
                            <item name="open" xsi:type="string" translate="true">Select Product...</item>
                        </item>
                    </data>
                </block>
            </parameter>
        </parameters>


texts: Can't get order object in sales_order_place_after observer method in multi-shipping

texts:
Hi guys i am working in magento 1.14 enterprise. i am trying to get order id after order place in multishipping checkout for that i am using this event

  sales_order_place_after

i also tried this one as well

  checkout_submit_all_after

but i am getting nothing in this event i want to get order id

here is my code for config

        <sales_order_place_after>
        <observers>
            <Webkul_Marketplace_Model_Observer>
                <type>singleton</type>
                <class>Webkul_Marketplace_Model_Observer</class>
                <method>afterPlaceOrder</method>
            </Webkul_Marketplace_Model_Observer>
        </observers>
    </sales_order_place_after>

and this code for function

 public function afterPlaceOrder($observer) {
    $helper = Mage::helper('marketplace');
    $lastOrderId = $observer->getOrder()->getId();

}

Its giving me error in this line Call to a member function getId() to null can anyone please tell me what i am missing why my observer is giving me nothing i have checked the same scenario in onepage and its working fine there.


texts: How can i show USPS Media Mail Only For Books not for other Products?

texts:
I have different kinds of products, USPS Media mail is good for books, but not for all products. How can i restrict Media Mail Not allowed for other products.

Condition:

1) If cart consists both book and other kind products  media mail option will should not come,

2) And Show POPUP message like, If you want to use Media Mail shipping, Please be in your cart consist Books Only, and place another order for remaining products. and this popup is only for optional.


texts: Send email to particular store customer in multi store website in Magento 2

texts:
Guy's I have a multi-store website in Magento 2.2.5, in one admin side manage 7 to 8 store, so I have to install  Trustpilot review extention in one store.

But when I send customer invitation mail to send mail whole website all customers.

So how can I send mail particular store customers?

Please give suggestions for that otherwise any condition for that so send mail only this store customer.


texts: Optimize SQL Query Inside a Loop: Load customers together with reviews

texts:
In the product page i have a list of all reviews made by customers and I'm showing customer username, avatar and date with each review. The solution I'm using will result in a performance bottleneck. How can the code be improved?

<?php
    $_items = $this->getReviewsCollection()->getItems();
    foreach ($_items as $_review): ?>

            <?php
                    $customer_id = $_review->getCustomerId();
                    $customer_data = Mage::getModel('customer/customer')->load($customer_id);
                    $avatarURL = "customer" . $customer_data->getMedmaAvatar();
                    $username = $customer_data->getUsername();
                    $shortdate = $this->formatDate($_review->getCreatedAt(),'short');
                     ?>

content blablabla

<?php endforeach; ?>


texts: How to assign a product source from Event Observer

texts:
When a product is saved, I want to check if the product has an inventory source set, and if not, set one. The event name I'm observing is catalog_product_save_after.
This is the Observer code:
class validateProductSources implements ObserverInterface
{

    /**
     * @var Http
     */
    protected $request;
    protected $productRepoInterface;
    protected $sourceItemsBySku;

    protected $_sourceItemsSaveInterface;
    protected $_sourceItemFactory;

    public function __construct(
        Http $request,
        ProductRepositoryInterface $productRepoInterface,
        GetSourceItemsBySkuInterface $sourceItemsBySku,
        SourceItemsSaveInterface $sourceItemsSaveInterface,
        SourceItemInterfaceFactory $sourceItemFactory
    )
    {
        $this->request = $request;
        $this->productRepoInterface = $productRepoInterface;
        $this->sourceItemsBySku = $sourceItemsBySku;
        $this->_sourceItemsSaveInterface = $sourceItemsSaveInterface;
        $this->_sourceItemFactory = $sourceItemFactory;
    }

    public function execute(Observer $observer)
    {
        $this->request->getParams();
        $productId = $this->request->getParam('id');
        $product = $this->productRepoInterface->getById($productId);
        $sku = $product->getSku();
        $sourceItems = $this->sourceItemsBySku->execute($sku);
        if(!$sourceItems){
            $sourceItem = $this->_sourceItemFactory->create();
            $sourceItem->setSourceCode('default');
            $sourceItem->setSku($sku);
            $sourceItem->setQuantity(1);
            $sourceItem->setStatus(1);
            $this->_sourceItemsSaveInterface->execute([$sourceItem]);
        }
    }
}

The code is executed. I know this because I've tested it with the logger. The products source is not set though.
What baffles me is that if I use the same code in a controller (minus the request to get the product ID), the source is successfully set.
Could anyone tell me Why this happens, and how to fix it?


texts: Error after update to 1.9.2.0 - item detail page

texts:
I've done a update to Magento 1.9.2.0 - still after the update I get the error message at my item detail page.

Have anyone a idea to fix the problem?

    Invalid method DerModPro_BasePrice_Block_Catalog_Product_View::cacheSelf(Array
(
)
)

Trace:
#0 [internal function]: Varien_Object->__call('cacheSelf', Array)
#1 [internal function]: DerModPro_BasePrice_Block_Catalog_Product_View->cacheSelf()
#2 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Model/Layout.php(348): call_user_func_array(Array, Array)
#3 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Model/Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#6 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#7 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#8 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#9 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction()
#10 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#11 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /www/htdocs/w01325dc/oppacher-advent/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /www/htdocs/w01325dc/oppacher-advent/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /www/htdocs/w01325dc/oppacher-advent/index.php(83): Mage::run('', 'store')
#15 {main}


texts:
I have a cart price rule for free shopping.
the problem is there is no grand total in the cart price rule.
if I use subtotal then if the customer uses a 50% off discount then the free shopping will apply because the customer reaches the subtotal.
how can I solve this problem?


texts: Magento 1.9.3 : Different tax rate per country

texts:
I have to configure default tax rate which is 25% for the default country and 0 tax for other country. How do I do that?

Right now I set product tax class to all the products and so even if I'm using other country I still got tax which is 25% where it should be 0 tax.

Can anyone give me some idea on how to achieve it?

Quite similar issue/question: Different State Different Tax


texts:
We need to have secure themes, with lots of features, good support and free / freqeunt updates. Would you recommend anything?
Thanks


texts: Magento 2 Luma Theme, footers are not inside of page-wrapper on homeside

texts:
My new parent theme of magento 2 luma have problems with the "start page" (just the start / home page, the other pages are perfect).

The Elements footers, copyright.. are over the same position as page-wrapper, in all other pages like categorie view or product view the footers or copyright elements are inside the page-wrapper element.

This gives Problems with some Browsers.

Not correct on the Homeside / Startpage

Correct on the Categorie Page

Anybody can help me to fix that?


texts: Magento 2 cannot Disable 3rd party plugin

texts:
Im trying to disable Amasty\Gdpr\Block\AccountLinkPlugin from my vendor folder.
Amasty frontend/di.xml
<type name="Magento\Customer\Block\Account\Navigation">
    <plugin name="amasty-gdpr-account-navigation" type="Amasty\Gdpr\Block\AccountLinkPlugin"/>
</type>

so i tried creating a module to disable it.
module.xml
<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Namespace_AmastyGdpr" setup_version="1.0.0">
        <sequence>
            <module name="Amasty_Gdpr" />
        </sequence>
    </module>
</config>

etc/di.xml (i also tried putting it in etc/frontend/di.xml)
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Customer\Block\Account\Navigation">
        <plugin name="amasty-gdpr-account-navigation" disabled="true"/>
    </type>
</config>

already tried different approaches to make this work. like including the 'type' on the di.xml, but it didnt work. also saw a some question and solution here. but for some reasons its not working for me. im using 2.4.0.
im sure that im trying to remove the correct plugin cause when i tried to do
<type name="Magento\Customer\Block\Account\Navigation">
    <plugin name="amasty-gdpr-account-navigation" type="Amasty\Gdpr\Block\AccountLinkPlugin" disabled="true"/>
</type>

directly on the amasty module, it did work.


texts: While creating configure product it's associate product are virtual instead of simple

texts:
My magento version magento 2.0.0 when i am trying to create configure product with it's associate simple product it gives one configure product and it's associate product but it's type virtual instead of simple.

I miss any configure stuff? or having some bug with this version?


texts:
When i printed this print_r(get_class($this->getOrder()));
I got this class name
Magento\Sales\Model\Order\Interceptor
What does this actually mean ?
Where is this "Magento\Sales\Model\Order\Interceptor" class ?
Any thoughts ?