texts:
i used System" > "Configuration" > "Customer Configuration" section "Login Options" not does that when set to "no"

it work's fine in top link. But if i used in view page but it redirect to my account

<a class="c-login" href="<?php echo Mage::getUrl('customer/account/login'); ?>"> Login/ Create Account

What is problem here?


texts: How to add quantity increment and decrement button with catalog widget product Magento 2

texts: I want to add custom quantity increment and decrement button with catalog widget product.


texts:
I have a website with about 200 accessories for a certain type some cars, the accessories are set up as normal products within Magento. However, the cars are stored in a new table within our Magento 2 database and we wish to list these within the website through the CMS pages.
. . I've created 7 empty categories to run alongside my shop:

Cars (ID 1)

SUV’s (ID 2)

Brand A (ID 3)
Brand B (ID 4)

4X4 (ID 5)

Brand A (ID 6)
Brand B (ID 7)

Within design/frontend/myvendor/mytheme/Magento_Catalog/layout, I've then created xml files for those categories to call:

catalog_category_view_id_3.xml
catalog_category_view_id_4.xml
catalog_category_view_id_6.xml
catalog_category_view_id_7.xml

Each file contains code similar to this:
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
    <referenceContainer name="main.content">
            <block class="Magento\Framework\View\Element\Template"
                   name="guns.ddcat1"
                   before="-"
                   template="Magento_Catalog::html/all-cars.phtml"
            />
        </referenceContainer>
</view>

Within design/frontend/myvendor/mytheme/Magento_Catalog/templates/html we have a file called all-cars.html whereby it connects to the external database and then displays all the cars for that category at the following URL’s

example.com/cars/suv/brand-a/
example.com/cars/suv/brand-b/
example.com/cars/4x4/brand-a/
example.com/cars/4x4/brand-b/

That works fine up to this point and all cars are displayed on the correct pages. The following part is where I’m stuck…
I now need to view each car in detail. As the car list changes on a daily basis, we need dynamic pages, so I was going to make each car clickable…

example.com/cars/suv/brand-a/car1
example.com/cars/suv/brand-a/car2
example.com/cars/suv/brand-a/car3

I struggled with this, so as a simpler (but ugly) approach, I thought I could append the category with a variable:

example.com/cars/suv/brand-a/?carID=111
example.com/cars/suv/brand-a/?carID=112
example.com/cars/suv/brand-a/?carID=113

Then in all-cars.phtml, we could then listen out for it using the following code:
if(isset($_GET[‘carID'])) {
    //connect to database and show specific car
} else {
    //connect to database and show all cars
}

However, when I try this, the carID= is treated as a new sub-category, hence catalog_category_view_id_3.xml is not listened to and as a result, all-cars.phtml is not called whatsoever.


texts:
Please help! I have created a custom login form at https://cashino.kellyseye.com/ using the following code:

Store Login

<form
action="https://cashino.kellyseye.com/customer/account/loginPost/"
method="post">

<input id="mini-login" class="input-text"
spellcheck="false" type="email" placeholder="Email:" name="login[username]"
/> <input id="mini-password" class="input-text" type="password"
placeholder="Password:" name="login[password]" /> <input type="hidden"
value="&lt;?php echo Mage::getSingleton('core/session')-&gt;getFormKey() ?
&gt;" name="form_key" />

<button class="button" type="submit">
Login  </button>

</form>

The issue is, when I enter my email and password, I am redirected to the login page and NOT logged in. Does anyone know why?

I have used the same code at https://beaconbingo.kellyseye.com/ and it works fine.


texts: How to add my custom script/block to \Magento\Catalog\Block\Product\View\Options

texts:
I'm new to Magento. In Magento 2, the product page, I would like to add a script to do something (show/hide some customized elements) associate with this option block:

\Magento\Catalog\Block\Product\View\Options

I have a child-theme of Blank to customized the website and try to extend the product view:

app/design/frontend/Vendor/mytheme

 |_/Magento_Catalog/
          |_/layout/
          |_/templates/
               |_/products/view/options.phtml
          |_/web/

 |_/web/js/do_something.js

What is the best way to add additional block of code and the script to this options.phtml?

<div>
   This is the block of code need to be added before product variations.
   For more information, please <button>[ click here ]</button>
</div>

And clicking on the button would open the so_something.js script.
Such as before #product_addtocart_form?

Can I create a separate file for the block only, then how to code them to locate it before #product_addtocart_form, so the options.phtml kept intack? I don't want to overwrite it.

I learned from Magento2 Unit Three (Core Principles for Theming in Magento 2). We can extend page layouts. Can I add it by adding an extending page layout file (catalog_product_view.xml), such as:

app/design/frontend/Vendor/mytheme
 |_/Magento_Catalog/
           |_/page_layout
                  |--catalog_product_view.xml


texts: How to install Elastic Search and configure on Magento 2.2.X?

texts: I want to install Elastic Search on Magento 2.2.X Community Edition. Can anyone help me on this?


texts:
In Magento2.2. I saw it in Extension Manager and then install..but can't.. someone faced this problem?

Check Component Dependency
We found conflicting component dependencies.
Command "update" failed: Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1

  Installation request for magento/module-shared-catalog 100.0.0 -> satisfiable by magento/module-shared-catalog[100.0.0].
  - magento/module-shared-catalog 100.0.0 requires magento/module-advanced-checkout 100.2.* -> no matching package found.


texts:
I'm trying to get my custom 'category_short_description' to appear within my loop but struggling to get this to appear. Anyone know how I can get this to display?

Product name is displaying but short description isn't? Where am I going wrong?

<?php
if (!$block->getCategory()) {
    return;
}
$_categories = $block->getCategory()->getChildrenCategories();
$_count = is_array($_categories) ? count($_categories) : $_categories->count();
if ($_count) {
?>

            <?php
            foreach ($_categories as $_category) {
                if ($_category->getIsActive()) {
                    //print_r($_category);
                    ?>

                        <?php echo $block->escapeHtml($_category->getName()) ?>

<?php echo $_category->getData('category_short_description'); ?>

                    <?php
                }
            }
            ?>

<?php
}
?>


texts: OnePage Checkout Page Error - Free Shipping error : “Please specify a shipping method”

texts:
My condition, free shipping for selected zip-code/postal code,
range is, from 600003 to 600151

I am using Shopping Cart Price Rule, my workout

Note : Shopping Cart Price Rule condition Matching still alert open

I am using Multistore

How can i solve this error.

Note: Log Error

2018-05-17T10:48:21+00:00 ERR (3):
Mage_Core_Exception: Please specify a shipping method. in /home/abc/public_html/app/Mage.php:595
Stack trace:
#0 /home/abc/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(303): Mage::throwException('Please specify ...')
#1 /home/abc/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(222): Mage_Sales_Model_Service_Quote->_validate()
#2 /home/abc/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(238): Mage_Sales_Model_Service_Quote->submitNominalItems()
#3 /home/abc/public_html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(812): Mage_Sales_Model_Service_Quote->submitAll()
#4 /home/abc/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php(604): Mage_Checkout_Model_Type_Onepage->saveOrder()
#5 /home/abc/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->saveOrderAction()
#6 /home/abc/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#7 /home/abc/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#8 /home/abc/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#9 /home/abc/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#10 /home/abc/public_html/index.php(87): Mage::run('', 'store')
#11 {main}


texts: How to add a weight option to the magento simple products product options

texts:
I have a setup where I'm using shipping on basis of product weight, using Magento CE 1.9. I have setup a simple product with some custom options, now my issue is that Magento does not support a weight per custom option.

I've now modified the code by adding a text input for the weight and when submitting the form, it does send the data to the database, the table is catalog_product_option_type_weight which is a copy of the catalog_product_option_type_title. My problem is when going back to edit the product options, the values from the database do not get populated in the newly created field.

I debugged also the frontend and seems that the weight is missing from the product object also there. Could anyone point me to the correct direction, which files to modify and how to get also the weight populated like the other fields (title, price, price type)?

I've modified the core files, I know that is not recommended but in this case I'm not intending to upgrade Magento.


texts: Magento 2.3 Dynamic comment in system.xml group?

texts:
I need a way of adding a group comment that is dynamic, as I need to pass the stores URL (it gets added as a return URL for a 3rd party service)

It seems like it used to be possible, using a model for the comment, but that is no longer possible due to the system.xsd and system_file.xsd schemas.

Is there a way to achieve this in Magento 2.3?


texts: Creating reorder giving grand total in double price

texts:
I am creating a reorder functionality in magento.
It is creating with same info of order but showing the grand total double.
Last order  subtotal price $10 and shipping $5 so grand total is $15
but in new reorder it is giving 25$
Below is the code for reodering process.

$order = Mage::getModel('sales/order')->load($order_id);
        $order->setReordered(true);
         $newQuote = new Mage_Sales_Model_Quote();
        $newQuote->setStoreId($order->getStoreId());
        $newQuote->assignCustomer(Mage::getModel('customer/customer')->load($order->getCustomerId()));
        $newQuote->setUseOldShippingMethod(true);
        $model = Mage::getSingleton('adminhtml/sales_order_create');
        $model->setQuote($newQuote);
        $reorder = $model->initFromOrder($order);
        $reorder->getQuote()->getShippingAddress()
             ->setShippingMethod($order->getShippingMethod())
             ->setCollectShippingRates(true)
            ->collectShippingRates()
             ->collectTotals()
            ->save();
        $reorder->createOrder();


texts: How to reserve qty for magento in cart for a specific time?

texts: Let say Product A has 1 qty left in inventory, If a customer add to cart that product, it should be reserved for 10min or specfied, If he clear checkout while that time otherwise it should back into stock.


texts: Netbeans plugins for development in magento 2

texts: Does anyone know what are the best netbeans plugins to develop in magento 2? It would be very useful to have a list of the best plugins and to know what they do, since I haven't found a guide on google that explains everything step by step.


texts: Change Shipping label on all summary section in Magento 2

texts:
In a Magento 2 project, I would like to change the label "Shipping" to "Shipping & Surcharge" on all the summary section on both frontend and backend.

Is there any easy way and one step to do for this like in Magento 1.x.

In Magento 1.x we can update the CSV file for this.

Please suggest your ideas to implement the change


texts: How can i add location of customer to admin Online Customers grid?

texts:
I have seen There is grid in magento admin for see online customer on store at Customer->Online Customers

Now I want to add location here in grid. Is it possible to add location ? If Yes. How to add? I can see ip of customer here.


texts:
I'm exporting Magento products data for a non-Magento site. In this new site, I need to display product-wise sold quantity.

Eg. 23 sold out of 50

With Magento products table, I can get product current quantity. To fulfill my above need, I need another quantity which may be product original quantity or product sold quantity at this stage. I was not able to find an answer for my exact problem.

I guess this is something really simple. However I need some help and I don't have any Magento experience.


texts: Does magento2 use r.js optimization for require.js when deploying static files

texts:
I see that javascript contributes a lot to my magento2 page weight (1 mb).

I wonder if it could be optimized with r.js when deploying static content or magento2 already uses an optimization tool.

Does anyone have any experience with that?


texts: Remove merged css and js from layout in magento2

texts:
I have enabled js and css merging and bundling from the configuration.
we can remove particular js or css using below code.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <remove src="name.css"/>
        <remove src="js/name.js"/>
        <remove src="Vendor_Module::js/name.js"/>
    </head>
</page>

But when i try same for removing merged js or css file it is not working,
is there any other way to remove that merged css and js files from layout or any other way.


texts: How to Get product id and Sku By product name magento 2..?

texts: How to get Product id and Sku By using the product Name in a phtml file?


texts:
I have made a lightbox in jQuery, and I want to convert it to a module in Magento. With this module, I want a dropdown option under CMS, and be able to add galleries.

Then, I want to create a shortcode, to call these galleries inside a cms page or static block.

But I can't find any tutorial that can help me with that. I know the base of making a module, but now I want to upload images, make them into a gallery and display them on a CMS page.

If someone knows a good tutorial, I would love to hear it!


texts: How to get category detail along with subcategories and products in PHP file not PHTML?

texts:
I have looked over internet but can't find a solution to get detail in my controller or block file i have tried

Registry
Tried get id of category from param
Also tried from Magento\Catalog\Model\Category by injecting it.


texts:
I am using the Soap api's of the Magento. While using the webservices i am getting the below issue

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't find

I have made all the extensions enable on the server.

I have used the below code to make the Soap api as the client api.

require_once('../app/Mage.php');

Mage::app();
$store_url =Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
$store_url=$store_url.'index.php/api/soap/?wsdl';
$options = array(

                'soap_version'=>SOAP_1_1,

                'exceptions'=>0,

                'trace'=>1,

                'cache_wsdl'=>0,

       //'features' => SOAP_USE_XSI_ARRAY_TYPE,

       );

$proxy = new SoapClient($store_url,$options);

Guide me where i am doing something wrong. Any help is appreciated.


texts: How to get paid invoice collection filter by payment method

texts:
How can I get invoice collection filter by status paid & payment method ?

I know how to filter order collection by payment method

$orders = Mage::getModel('sales/order')->getCollection();
$orders->getSelect()->join(
    array('payment' =>  $orders->getResource()->getTable('sales/order_payment')),
    'payment.parent_id = main_table.entity_id',
    array('*')
);
$orders->addFieldToFilter('method','ccsave');

But I can't make it work with

Mage::getModel("sales/order_invoice")->getCollection();

where invoice status is also paid


texts: How to full reindex in Magento via backend admin page?

texts:
I am using latest version of Magento enterprise 1.14, however it doesnt allow to do full reindex in admin "index management".

Our staff need to import products frequently and he is not technical enough to run shell command to reindex.
Is there any quick fix or hack to make it enable in backend?

Thanks!


texts:
So we are running Magento 2.3 & we would have the following issue:
Sell Multiple of a Single SKU on a single product using the original SKU with a discounted price.
We sell single products at a set price (SKU1: £30.00)
We also sell a pallet of a single product, for example 24x single SKU at a lower price.
We want to create a product, that uses the single product SKU in the config with an order qty of 24. (SKU1: £22.99 x 24)
We can for example create a bundled product and this allows us to enter the SKU and QTY of SKU, however the product shows "configure and add to cart" and does not seem to work with a single option entered.
I'm not sure if this can be configured within a configurable? I cant seem to work it out.
If someone could help with this it would be much appreciated.


texts:
When working with the rwd theme and the configurable product image swatches on some products the product images are not changing when changing options.

Sadly this does not happen on all products or even with all product options.

There are no JavaScript errors and this is with the default template and clean Magento install.


texts: Magento 2.1.0 --) STORES - CONFIGURATION - GENERAL - Design --) shows "Search Engine Robots"

texts:
I installed Magento version 2.1.0. When I go into STORES -> CONFIGURATION -> GENERAL -> Design -> it shows "Search Engine Robots" just as here:

Magento2 In Store/Configuration/General/Design I can only see Search Engine Robots section

Is there something wrong with my installation/configuration? It seems not logical. What do I need to do to fix this?


texts: How to display the current time in .phtml with caching enabled?

texts:
I created a really simple block in my child theme:

/Magento_Theme/layout/default.xml:

<referenceContainer name="content">
    <block class="Magento\Framework\View\Element\Template" name="custom_time_block" template="Magento_Theme::html/custom-time-block.phtml" before="-"/>
</referenceContainer>

/Magento_Theme/templates/html/custom-time-block.phtml:

                 <?php
                 $now = new DateTime();
                 echo $now->format('H:i:s');
                 ?>

So when I clear the cache, the time that is displayed, is the time when I cleared the cache. The time is not the current time. So how can I get this working without:

cacheable="false" (because this block is going to be dislayed everywhere, so each page will not be cached)
Javascript: I want to display the server time, not the client time

Thank you in advance!


texts: Page view layout bug on one site of multisite using same code

texts:
I am absolutely stumped on this one. I run a mutlisite installation which has several websites.

2 of the websites use exactly the same template (ultimo) but for some reason on product view one of the websites tabs, add to cart and sticky menu have broken.

There has been no recent changes to any code or upgrades either that would affect this and as I said they use exactly the same code and have been working find up until this point. The only difference between the 2 sites is you must log in to see pricing and buy on one of the two sites.

Here is exactly the same product on each site to compare:

http://satsecure.uk/maxx-digital-round-junction-box-size-80-x-50mm-ip44-white.html
http://shopmassive.com/store/maxx-digital-round-junction-box-size-80-x-50mm-ip44-white.html

It's almost like javascript has stopped working on shopmassive product pages. I've had a look in exceptions log but there's nothing in there and also flushed the cache and reindexed the sites.

Update:

I have discovered that the probable cause of this is due to the fact that one of the websites is trying to load 2 versions of jQuery whilst the other is not and I have no idea how to track down where this additional jQuery code is originating from. The extra code being inserted is after product data and cookie info but before footer:

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

Anyone know how I can find where this is coming from?


texts: Order has discount but the discount was not applied in the item level

texts:
Can someone help me understand why my order has a discount but the discount is not divided into each of the items accordingly. In most of the orders, the discount amount is divided into each item accordingly but this order is not and there's around 3 or more orders like this.
Is this a known Magento bug? Or it's just how it is.
Thank you!


texts: get array of a product's assigned/used attributes?

texts:
what is the easiest way to start from a product instance and get a list of the attributes both standard and custom, set for that particular product ?
thank you.


texts: Alternative Product image when page loads

texts:
OK this may sound like a very strange question but here I go.

Our inventory and product listings are managed outside of magento (Linnworks) to be exact.

Apparently there is no API connection for the sort order of the product images and therefore the main product image show randomly. this can be annoying when we have images of product parts and the image looks nothing like the actual product.

As a work around I was thinking that I could show an alternative image over the main image which will be the default product image? as the category page shows the defaul image fine.

Then on click of an alternative thumbnail image the first image(overlay) will dissapear and you will see the actual image the customer selects, if that makes sense.

Or is there another way to show the default image as it always changes when there is other images associated with the product

Help is hugely appreciated.


texts: How to create Product list widget with owl carousel on Magento 2?

texts:
My steps:

Copy magento-2-directory/magento/vendor/magento/module-catalog-widget/view/frontend/templates/product/widget/content/**grid.phtml** to magento-2-directory/app/design/frontend/Agestor/default/Magento_CatalogWidget/templates/product/widget/content/**grid.phtml**

Create requirejs-config.js to magento-2-directory/app/design/frontend/Agestor/default.

Widjet not work and I have errors in consol.


texts: How run unittest using EcomDev_PHPUnit module?

texts:
Here is described old version: http://www.ecomdev.org/2011/02/01/phpunit-and-magento-yes-you-can.html

And they wrote that I need call phpunit UnitTests.php

But I have magento v.1.7. I downloaded newest version:
https://github.com/IvanChepurnyi/EcomDev_PHPUnit

But there are not any files like UnitTests.php

How I should run unit test then?


texts: How to add save button in a form magento 1.9

texts:
How can I add save button as in the container for each form and not one for all forms (as we have in magento by default)? I share with you this image is what I have.
And I want something like that
I get a button without word like

using this code

   $fieldset->addField('yourfield', 'button', array(
    'label' => Mage::helper('thorleif')->__('Button Labels'),
    'value' => Mage::helper('thorleif')->__('Button Caption'),
    'name'  => 'yourfield',
    'style' => 'width:64px; height:21px;',
    'class' => 'form-button',
    'onclick' => "setLocation('{$url}')",
));


texts: Is It Possible To Move An Admin Menu Node?

texts:
We're using Fishpig's Attribute Splash module which inserts a node "Splash" at the top level of the admin menu.  We'd prefer it to live under the Catalog menu though.  Here's the original XML the module uses to insert the menu node (in adminhtml.xml):

 <menu>
    <attributeSplash translate="title" module="attributeSplash">
        <title>Splash</title>
        <sort_order>31</sort_order>
        <children>
            <pages translate="title">
                <title>Manage Pages</title>
                <action>attributeSplash_admin/adminhtml_page</action>
                <sort_order>11</sort_order>
            </pages>
            <groups translate="title">
                <title>Manage Groups</title>
                <action>attributeSplash_admin/adminhtml_group</action>
                <sort_order>6</sort_order>
            </groups>
        </children>
    </attributeSplash>
</menu>

I've created a separate module with the following in it's adminhtml.xml.  This disables the original menu node and creates a new one with the same children under the catalog menu:

<menu>
    <!-- Disable default menu node -->
    <attributeSplash>
        <disabled>1</disabled>
    </attributeSplash>
    <!-- Create replacement -->
    <catalog>
        <children>
            <attribute_splash translate="title" module="attributeSplash">
                <title>Attribute Splash (Brands)</title>
                <sort_order>100</sort_order>
                <children>
                    <pages translate="title">
                        <title>Manage Pages</title>
                        <action>attributeSplash_admin/adminhtml_page</action>
                    </pages>
                    <groups translate="title">
                        <title>Manage Groups</title>
                        <action>attributeSplash_admin/adminhtml_group</action>
                    </groups>
                </children>
            </attribute_splash>
        </children>
    </catalog>
</menu>
<!-- Access control nodes so non-administrators can be given access -->
<acl>
    <resources>
        <admin>
            <children>
                <catalog>
                    <children>
                        <attribute_splash translate="title" module="attributeSplash">
                            <title>Attribute Splash (Brands)</title>
                            <sort_order>100</sort_order>
                            <children>
                                <pages translate="title">
                                    <title>Manage Pages</title>
                                </pages>
                                <groups translate="title">
                                    <title>Manage Groups</title>
                                </groups>
                            </children>
                        </attribute_splash>
                    </children>
                </catalog>
            </children>
        </admin>
    </resources>
</acl>

This will work fine for now, but if the Fishpig Attribute Splash module is updated with different menu nodes I'll need to make sure to change this xml to match.  What I'm wondering if if anyone knows of a cleaner solution.  Is there a way to simply move a menu node rather than disabling it and creating a new one?  I wouldn't be too surprised if there isn't, but if there is I'd like to know about it since it would be slightly more upgrade proof.


texts: Magento 2.0(Current) to Magento 2.0.2(Latest) Version Upgrade

texts:
Today I tried my to upgrade magento 2.0 to latest version but it shows magento 2.0.2(latest) , i think it should be 2.0.4. still if i continue to upgrade for 2.0.2 it shows readiness check fails with number of reasons like :

Check Cron Scripts
PHP Version Check
PHP Settings Check
PHP Extensions Check

I am using windows 7 ,Xampp and trying toupgrade on my local pc.


texts:
I would like to add a new function to Product Model which be accessible each time I create Product.

Below, my code :

  src/app/code/Project/Catalog/Model/Product.php :

<?php

namespace Project\Catalog\Model;

class Product extends \Magento\Catalog\Model\Product
{
    public function newFunction()
    {
     // myfunction
    }
}

  src/app/code/Project/Catalog/etc/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">
    <preference for="Magento\Catalog\Api\Data\ProductInterface" type="Project\Catalog\Model\Product" />
</config>

  src/app/code/Project/Catalog/Block/Block.php

<?php

namespace Project\Catalog\Block;

use Magento\Backend\Block\Template;

class Block extends Template
{
    public function newFunction()
    {
        return $this->_currentProduct->newFunction();
    }
}

But I got the following exception :

  Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid
  method Magento\Catalog\Model\Product\Interceptor::newFunction

Why my new function is not find ? Where am I wrong ?


texts: Magento 2 + Varnish + Nginx + Multiple Order Placed from IPs

texts:
I am having a similar problem. the "Placed from IP" for all of my sales emails looks like this : 127.0.0.1 (XX.XXX.XX.XX, yy.yyy.yy.yy, 127.0.0.1)
I believe the correct IP is the one marked as xx.xxx.xx.xx. I also suspects this has something to do with my varnish configuration with Nginx. But I'm not sure how to fix it. Below is my Varnish setup. Any help would be appreciated.
location / {
    proxy_pass http://127.0.0.1:6081;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-Port 443;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
}


texts: Pub/static js path wrong in magento2 after install ebizmarts mage monkey plugin

texts:
Recently i have tried to install Ebizmarts_MageMonkey plugin in magento2. After install frontend not working properly. Got an error like some js missing.

  404 not found error
  http://test.com/pub/static/frontend/xxx/xxx/en_US/cookiejs.js

But that cookiejs.js exist under pub/static/frontend/xxx/xxx/en_US/js folder

Called that file path from wrong folder. If i installed that plugin in fresh  magento2 project, That plugin was working fine. Can't able to find the reason why is it call that js file from wrong folder path.

Please let me know how to solve this


texts: Magento 2 - Get custom attribute within .phtml file using Magento\Catalog\Block\Navigation class?

texts:
I am trying to get a custom attribute value within my phtml file but struggling to get this to work? getData() & getCustomAttribute() doesn't seem to work. I believe this is because I am using the Magento\Catalog\Block\Navigation class to loop through my categories?

Can anyone advise how I can get my custom attribute value within my loop in my product-categories.phtml?

  default.xml within my theme

<block class="Magento\Catalog\Block\Navigation" name="product.categories" template="Magento_Theme::html/product-categories.phtml"></block>

  product-categories.phtml

<?php
if (!$block->getCategory()) {
    return;
}
$_categories = $block->getCategory()->getChildrenCategories();
$_count = is_array($_categories) ? count($_categories) : $_categories->count();
if ($_count) {
    ?>

        <?php
        foreach ($_categories as $_category) {
            if ($_category->getIsActive()) {
                ?>

                    <a href="<?php /* @escapeNotVerified */ echo $block->getCategoryUrl($_category) ?>" title="<?php echo $block->escapeHtml($_category->getName()) ?>"><?php echo $block->escapeHtml($_category->getName()) ?>
                    <?php
                    //$short_description = $_category->getData('short_category_description');
                    //$short_description = $_category->getCustomAttribute('short_category_description');
                    //$short_description = $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($_category, '', 'short_category_description');
                    ?>

<?php // echo $short_description; ?>

                <?php
            }
        }
        ?>

    <?php
}
?>

UPDATE:

namespace Autosmart\CategoryAttributes\Model;

class Category extends \Magento\Catalog\Model\Category
{
    public function getShortCategoryDescription()
    {
        //return "working";
        return $this->_getAttribute('category_short_description');
    }
}

I've created a modal with custom function getShortCategoryDescription() which I can call by $_category->getShortCategoryDescription() however I am unsure how to get this to return my short description attribute. The above code gives me an error:

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid method Module\CategoryAttributes\Model\Category\Interceptor::_getAttribute


texts: How to update safely Magento 2.0.4 to Magento 2.2.2?

texts:
I want to update from Magento 2.0.4 to latest version. I want to know commands, and which folders are going to modify in the update process. all I want command line based update process.

Note: I directly override some file in vendor, is it safe to update? and how to manage those override files.


texts: Creating XML RPC method in customer module

texts:
I am creating a rpc method in the local customer module. But I am getting invalid path error. After hours of debugging also I am not able to figure out the missing portion. I was able to create in my local sales module but somehow its failing here.

In local/Mycompany/Customer/etc/api.xml :

<config>
<api>
    <resources>
        <customer translate="title" module="mycompany_customer">
            <model>mycompany_customer/customer_api</model>
            <title>Customer API</title>
            <acl>customer</acl>
            <methods>
                <setCustomerWhatsappStatus translate="title" module="customer">
                    <title>Set whatsapp status for customer</title>
                    <acl>customer/setCustomerWhatsappStatus</acl>
                </setCustomerWhatsappStatus>
            </methods>
            <faults module="mycompany_sales">
                <data_invalid>
                    103
                    <message>Invalid data given. Details in error message.</message>
                </data_invalid>
            </faults>
        </customer>
    </resources>
    <acl>
        <resources>
            <customer translate="title" module="mycompany_customer">
                <title>Customer</title>
                <sort_order>1</sort_order>
                <setCustomerWhatsappStatus translate="title" module="mycompany_customer">
                    <title>Set whatsapp status for customer</title>
                 </setCustomerWhatsappStatus>
            </customer>
        </resources>
    </acl>
</api>

And in my local/Mycompany/Customer/Model/Customer/Api.php :

<?php

class Mycompany_Customer_Model_Customer_Api extends Mage_Customer_Model_Customer_Api
{
    public function setMethod($phone) {
       Mage::log($phone);
    }
}

And I am calling this method with dbaux_customer_customer.setCustomerWhatsappStatus but get Invalid Path error meaning that its not able to reach the method mentioned.

Please let me know if I missed something.


texts: folder writen issue come on website after updating setup of magento 2

texts:
Its come many time after upgrading setup

Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/home/soft/public_html//var/cache/" is not writable in /home/soft/public_html//vendor/magento/zendframework1/library/Zend/Cache.php:

I have already used setup:static-content, setup:di-compile, only error log show on website.

How to resolve it?


texts: Cannot get customer session in Controller

texts:
I am just trying to get the customer session in my custom controller class and it always returns NULL.

What is wrong with Magento? It doesn't work as expected, I am spending days not minutes for a small changes...

Here is my custom controller class.

class Referral extends \Magento\Customer\Controller\AbstractAccount {

    protected $customerRepository;

    protected $dataObjectHelper;
    protected $session;
    protected $resultPageFactory;

    public function __construct(
        Context $context,
        \Magento\Customer\Model\Session $customerSession,
        PageFactory $resultPageFactory,
        CustomerRepositoryInterface $customerRepository,
        DataObjectHelper $dataObjectHelper
    ) {
        $this->session            = $customerSession;
        $this->resultPageFactory  = $resultPageFactory;
        $this->customerRepository = $customerRepository;
        $this->dataObjectHelper   = $dataObjectHelper;
        parent::__construct( $context );
    }

    public function execute() {
        $resultPage = $this->resultPageFactory->create();

        $block = $resultPage->getLayout()->getBlock( 'customer_account_dashboard_referral_edit' );
        if ( $block ) {
            $block->setRefererUrl( $this->_redirect->getRefererUrl() );
        }

        $data = $this->session->getCustomerFormData(true);
        $customerId = $this->session->getCustomerId();
        var_dump($customerId);
        exit;

        $customerDataObject = $this->customerRepository->getById( $customerId );
        if ( ! empty( $data ) ) {
            $this->dataObjectHelper->populateWithArray(
                $customerDataObject,
                $data,
                \Magento\Customer\Api\Data\CustomerInterface::class
            );
        }
        $resultPage->getConfig()->getTitle()->set( __( 'Referral Settings' ) );

        return $resultPage;
    }
}

In that case it returns NULL, I have found only one way to get real id

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$customerSession = $objectManager->create("Magento\Customer\Model\Session");

In this case it works, and I can get customer id, but why??? What is the purpose of all these dependency injections and other features, it even doesn't work in a simple case...

Please explain what is wrong ?


texts: 1.9 - Shopping Cart Price Rule - Buy any x + y + z Reduce total price to $399

texts:
Could anyone please help me to setup up below price rule?

Apply if any category1 + category2 + category3 + category4 in cart. Reduce total price to $399.

Quick reply will be much appreciated.


texts: Admin Grid in Catalog/category do a filter

texts:
I want to have a filter to show push_ahead product in the respective category and a button to push_ahead and desactivate the push_ahead.
But it's just display all the product of the category...

Here is my code :

<?php

class MyCompany_Tetegondole_Block_Adminhtml_Catalog_Category_Tab_Pushahead extends Mage_Adminhtml_Block_Catalog_Category_Tab_Product {

protected function _prepareCollection()
{
    $collection = Mage::getModel('catalog/category')->load((int) $this->getRequest()->getParam('id', 0))->getProductCollection()
        ->addAttributeToSelect('name')
        ->addAttributeToSelect('sku')
        ->addAttributeToSelect('price');

    $this->setCollection($collection);

    if ($this->getCategory()->getProductsReadonly()) {
        $this->getCollection()->addAttributeToFilter('push_ahead', true);
    }

    return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
}

protected function _prepareColumns()
{
    if (!$this->getCategory()->getProductsReadonly()) {
        $this->addColumn('is_push', array(
            'header_css_class' => 'a-center',
            'type'      => 'checkbox',
            'name'      => 'is_push',
            'values'    => $this->_getSelectedProducts(),
            'align'     => 'center',
            'index'     => 'entity_id'
        ));
    }
    $this->addColumn('entity_id', array(
        'header'    => Mage::helper('catalog')->__('ID'),
        'sortable'  => true,
        'width'     => '60',
        'index'     => 'entity_id'
    ));
    $this->addColumn('name', array(
        'header'    => Mage::helper('catalog')->__('Name'),
        'index'     => 'name'
    ));
    $this->addColumn('sku', array(
        'header'    => Mage::helper('catalog')->__('SKU'),
        'width'     => '80',
        'index'     => 'sku'
    ));
    $this->addColumn('price', array(
        'header'    => Mage::helper('catalog')->__('Price'),
        'type'  => 'currency',
        'width'     => '1',
        'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
        'index'     => 'price'
    ));

    return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
}

protected function _addColumnFilterToCollection($column)
{
    // Set custom filter for in category flag
    if ($column->getId() == 'is_push') {
        $productIds = $this->_getSelectedProducts();
        Zend_Debug::dump($column);die;
        if (empty($productIds)) {
            $productIds = 0;
        }
        if ($column->getFilter()->getValue()) {
            $this->getCollection()->addFieldToFilter('push_ahead', array('in'=>$productIds));
        }
        elseif(!empty($productIds)) {
            $this->getCollection()->addFieldToFilter('push_ahead', array('nin'=>$productIds));
        }
    }
    else {
        return Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection($column);
    }
    return $this;
}

 protected function _getSelectedProducts()
{
    $productIds = $this->getRequest()->getPost('is_push');
    if (is_null($productIds)) {
        $productIds = $this->getCategory()->getProductsPosition();
        return array_keys($productIds);
    }
    return $productIds;
}

}

<?php

class MyCompany_Tetegondole_Block_Adminhtml_Catalog_Category_Tab extends Mage_Adminhtml_Block_Catalog_Category_Tabs{

/**
 * Prepare Layout Content
 *
 * @return Mage_Adminhtml_Block_Catalog_Category_Tabs
 */
protected function _prepareLayout()
{
    parent::_prepareLayout();
    $this->addTab('pushahead', array(
        'label'     => Mage::helper('catalog')->__('Produits Mis en avant'),
        'content'   => $this->getLayout()->createBlock('tetegondole/adminhtml_catalog_category_tab_pushahead', 'category.pushahead')->toHtml(),
    ));
    return $this;
}

}


texts: How do you display attributes for different products?

texts:
i want to add a attribute to products in the cart of my magento-shop.
The problem is not all of the products have the attribute color. If a product has no attribute "color" the value of the previous product will be displayed - so f.e. the first product is white, the second has no color. Now there will be displayed PRODUCT 1 Color: white and PRODUCT 2 Color: white (actually this isn't right, it has no color at all).

Help would be appreciated!

The code i use in default.phtml:

<?php $_item = $this->getItem() ?>
<?php $_product= Mage::getSingleton('catalog/product')->load($_item->getProductId()) ?>
<?php echo 'Color: '.$_product->getResource()->getAttribute('color')->getFrontend()->getValue($_product).'<br>'; ?>


texts: Magento 2: How to change Contact Us Email Type?

texts:
magento\vendor\magento\module-contact\etc\email_templates.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
    <template id="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="text" module="Magento_Contact" area="adminhtml"/>
</config>

I have followed Magento 2: how to declare a custom email template for your module

Can we override in app\design or need to create custom module in app\code? If we can override using design then it will be better, because don't want to create new module for this.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
    <template id="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="html" module="Magento_Contact" area="adminhtml"/>
</config>

Tried using magento\app\code\Custom\Module\etc\email_templates.xml But still not working. It's still taking Type as Text.


texts: Multi store shop on same domain in combination with ssl

texts:
i want to setup a multi store magento.
Currently i have www.domain1.com and i want the new store to be on www.domain1.com/outlet/

This way i can use the same SSL certificate for both stores.

When i set this up in magento, and change the base url's i get a 404 error on www.domain1.com/outlet/

What am i missing?

I have magento 1.7.0.2 CE.

UPDATE 10-12-2013
This helped me a lot ... but i have got an extension the runs on www.domain1.com/facebookstore/ but www.domain1.com/outlet/facebookstore/ doesn't work ...

Am i missing something again?


texts: Magento 2: Carrier with such method not found

texts:
When I'm on Checkout Page. Sometimes I'm facing below error.

Carrier with such method not found: null, null

I have selected by Shipping Address, Not selected any Shipping Method & Clicked on "Next"
I'm using DHL Shipping Method. I have to override the DHL Shipping Method Model as per my requirement.
Magento 2: How to change Weight field for DHL Shipping Method [SOLVED]
Not sure if anyone comes across this issue.


texts: How to check whether at least one product is in-stock for a given attribute?

texts: I need to check whether at least one product is available (in-stock) for a given attribute. This is for the main navigation brand display. I need to hide brands which are currently have no in stock products associated to the particular brand. As I have hundred of brands if I load product collection for each and check, it crash the site due to the heavy load. So is there any other efficient way to do this ?


texts: how to change custom option price by query in magento?

texts:
I have 32000 products in Magento,

When I added them I have set custom option attribute to products they work perfectly, but now I want to change the price of custom option attribute of all products.

Is there any way to change price by query or any other tricks ??


texts: Magento 2 - Disable Page cache for login/register page

texts:
I am facing issue with FPC, login and register pages, are adding in Page Cache, I need to disable it.

I have idea that if we add cacheable="false" in any one of block that is used in login/register page then whole page would be excluded from Page Cache.

Is it a good way of disabling cache on specific page or is there any other way around to do this?


texts: How to disable the loading gif in first load of product list page

texts:
I'm having a problem.
In product list page, such as "Category" page.
I choose Color = Orange and it will reload the page.
For every next reload page, the product image will show the loading gif for a few mili-seconds before it show the real picture.

So how to disable this loading gif?
Thanks


texts: What function is called to save order comments/status in the backend

texts:
What function is called to save new comments and update the order status, when viewing the order in the backend.

The addComment function in app/code/core/Mage/Sales/Model/Order/Api.php looks to be what I need but that's not the case. Altering this function is having no effect here.


texts: Can't see existing product attributes in backend

texts:
There's an attribute which has been assigend to an attribute set and there's a product using that set.

I have successfully created attributes and added them to attribute sets. However, when I create a new product, those attributes aren't visible in the backend. Also, I can set and retrieve data programmatically, but I cannot see the attributes in the backend.

I have cleared all caches and reindexed everything

EDIT This is what I'm doing at the moment to create the attribute

            /* @var $attributeModel Mage_Catalog_Model_Entity_Attribute */
            $attributeModel = Mage::getModel('catalog/resource_eav_attribute');
            $attributeModel->setEntityTypeId($entityTypeId);
            $attributeModel->setAttributeCode($propName);
            $attributeModel->setBackendType('varchar');
            $attributeModel->setName($propName);
            $attributeModel->setFrontendLabel($propDesc);

            $attributeModel->save();


texts: Sales order email is not working in magento2. Remaining mails working fine only customer not able to receive email after placing order.


texts: Removing Welcome message from magento 2 - just xml

texts:
I've started to work on Magento 2 and get my head around it, I'm really familiar with Magento 1 and removing the welcome message was no big deal.

However all I've found the location of the welcome message in the header, but can't seem to find the XML to remove the block from the header.

Is it possible to remove the welcome message with the XML or do I need to simply comment out the switch inside of the header.phtml file?


texts: upload porto theme with existing database in Magento 2.3.5

texts:
can I upload the porto theme and use my old products hence the dummy data will be removed and my old data will be shown... is this possiable
furthermore will my old categories appear in the theme or will I have to make new ones. I've read the documentation it did say its possible but the method and definition was ambiguous. so pleas let me know so that i could change my magento theme.
thank you


texts: Magento 2 : How to get selected simple product Id on checkout_card_add_after observer?

texts: I want to get selected associated product id after an checkout_cart_add_after triggered. If any helps would be appreciable.


texts:
I have a common problem but the usual solutions are not working so apologies for what on first appearance may seem like a previously asked question.

I have the following error when trying to view my site on my local

    Access denied for user 'sitename'@'localhost' (using password: YES)

The credentials being used wrong but I don't know where they are coming from.
I have checked app/etc/local.xml and it has all correct credentials.
I have removed all other xml files from the directory (except config.xml).
I have deleted the contents of the var folder (numerous times)

I have other magento sites working on my local so my server settings should be fine. I'm really stumped on this and don't know what next step I should take. Any help would be appreciated.


texts: Layered navigation filters for grouped products only

texts:
Well,
I'm having a category filled only with grouped products and I want these ones to be filtered by their associated ( and simple ) products's attributes.

Until now I've used a dirty workaround : I've left only one simple product to be visible to catalog but hidden by html & css. That way the attributes were appearing and I could use them for the grouped products also, but I've noticed that layered navigation dissapears if that hidden simple product is not appearing when I filter by price.

Any ideas or workarounds?

Thanks.


texts: Magento 2 URL to call custom controller not working

texts:
This is the default magento URL:

<base URL>/magento2/multishipping/checkout/billing

Now i have a custom controller i want to call this.

<base URL>/magento2/multishipping/checkout/billing/test

where test is my controller file.
if i even hit the URL directly in browser than also it is going to this

<base URL>/magento2/multishipping/checkout/billing


texts: Attributes did't selected in backend after changed from dropdown to multi-select

texts:
we converted dropdown attribute to muti-select attribute using following queries:

step1)

UPDATE eav_attribute SET
entity_type_id = '10',
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
WHERE attribute_id = '1244';

step 2)

INSERT INTO catalog_product_entity_varchar ( entity_type_id, attribute_id, store_id, entity_id, value)
SELECT 10, 1244, 1, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = 1244;

step 3)

DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 10 and attribute_id = 1244;

Now what values we gave before for dropdown attribute is displaying in frontnend. but it did't selected those values in backend after we changed to multiselect attribute we done reindex many times.

credits : http://swarminglabs.com/how-to-change-a-product-dropdown-attribute-to-a-multi-select/


texts:
we are using this code for displaying shipping charges in magento site :

<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>

<?php echo "Selling Price + " . $_excl . " Delivery "; ?>

where $_excl will return the value.

its displaying results as 10.00, 20.00...etc.

I want to remove .00 from "10.00" & display only 10.

I checked here1 & here2

I tried below codes :

echo "Selling Price + " . number_format($_excl, 0) . " Delivery ";
echo "Selling Price + " . (int)$_excl . " Delivery ";
echo "Selling Price + " . ($_excl + 0) . " Delivery ";
echo "Selling Price + " . (int)$_excl . " Delivery "  .  "\n";
echo "Selling Price + " . number_format($_excl,0) . " Delivery "  .  "\n";
echo "Selling Price + " . round($_excl,0) . " Delivery "  .  "\n";
echo "Selling Price + " . intval($_excl,0) . " Delivery "  .  "\n";
echo "Selling Price + " . ($_excl + 0) . " Delivery ";
echo "Selling Price + " . round($_excl,0) . " Delivery ";
echo "Selling Price + " . round($_excl) . " Delivery ";
echo "Selling Price + " . $_excl + 0 . " Delivery ";

most of above code gave this as output: Selling Price + 0 Delivery, means result in zero, correct values did display as 10,  20...


texts: Remove or manipulate parameters in controller

texts:
I am trying to remove a parameter under certain conditions when it is passed to my controller.  The var_dump of the request contains all the parameters.  The parameter I want to remove is called super_attribute.  Let's take a look at that var_dump shall we?

[product] => 10
[form_key] => XXYY
[related_product] =>
[super_attribute] => Array
    (
        [220] => 1141
    )

I am able to set the product parameter to another figure using:

$this->getRequest()->setParam('product', $product->getId());

However, I would like to know a way to altogether remove the super attribute or null it's array, heck, or even just change the values contained within!  For starters:

$this->getRequest()->setparam('super_attribute', null);

nor

$params = $this->getRequest()->getParams();
unset($params['super_attribute']);

hold any water.


texts: Get custom data in item collection array

texts:
This is somewhat confusing.. I hope my explanation is clear.

As we all know magento converts a php object(I don't know what it is exactly) to an Array by using:

$item->getData();    // Where $item is an item from a product collection

The above code does covert the object to an Array, but I want to add my own custom fields to it.

So, I tried the following while preparing the collection

foreach($collection as $item){
    $item->setData('custom_field', $value);  // Also tried $item->setCustomField($value);
}

By doing the above, I can get the custom_field value by doing $item->getCustomField() or $item->getData('custom_field'); but I can't see this custom_field key in array when I am doing

$item->getData();

For Example:

Let us say, If I do

echo $item->getData();

I can see the following array in dump:

array(4) {
  ["entity_id"] => string(3) "623"
  ["type_id"] => string(12) "configurable"
  ["created_at"] => string(19) "2012-07-30 22:14:09"
  ["updated_at"] => string(19) "2014-01-04 02:02:08"
}

But I want to see the following Array:

array(5) {
  ["entity_id"] => string(3) "623"
  ["type_id"] => string(12) "configurable"
  ["created_at"] => string(19) "2012-07-30 22:14:09"
  ["updated_at"] => string(19) "2014-01-04 02:02:08"
  ["custom_field"] => string(5) "Hello"
}


texts: Magento 2.2  not working to override a model class

texts:
I want to override a model call (Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector).

We used preference to override a model call inside di.XML like magento 2.1.x But it is not working on Magento 2.2

etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
     <preference for="Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector" type="MyModule\CustomShippingTax\Model\Sales\Total\Quote\CommonTaxCollector" />

</config>

app\code\MyModule\CustomShippingTax\Model\Sales\Total\Quote\CommonTaxCollector.php

 <?php

  namespace MyModule\CustomShippingTax\Model\Sales\Total\Quote;
    /**
     * Tax totals calculation model
     * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
     */
    class CommonTaxCollector extends \Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector
    {

        public function mapAddress(QuoteAddress $address)
        {
            $customerAddress = $this->customerAddressFactory->create();
            $customerAddress->setCountryId($address->getCountryId());
            $customerAddress->setRegion(
                $this->customerAddressRegionFactory->create()->setRegionId($address->getRegionId())
            );
            $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

    var_dump($address->getPostcode());
    exit;

            $customerAddress->setCity($address->getCity());
            $customerAddress->setStreet($address->getStreet());

            return $customerAddress;
        }

    }

Please, can you help me on above issue?Any reference and suggestion is highly appreciated.

Thanks


texts: Strange error when attempting to update product (GoogleShopping related)

texts:
Modifying simple product in an older version of Magento CE (1.5.0.0).

Not sure what would have brought this on but am getting an error message when I attempt to save:

Fatal error: Call to a member function setConfig() on a non-object in
/chroot/home/firstaid/firstaidandsafetyonline.com/html/app/code/core/Mage/GoogleShopping/Model/Service.php
on line 66

I attempted to investigate that specific line in the file but couldn't understand why it would have an effect on saving simple products. Here are the surrounding lines:

// Create an authenticated HTTP client
        $errorMsg = Mage::helper('googleshopping')->__('Unable to connect to Google Content. Please, check Account settings in configuration.');
        try {
            if (!Mage::registry($this->_clientRegistryId)) {
                $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
                    Varien_Gdata_Gshopping_Content::AUTH_SERVICE_NAME, null, '', $loginToken, $loginCaptcha,
                    Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, $type
                );
                $configTimeout = array('timeout' => 60);
                $client->setConfig($configTimeout);
                Mage::register($this->_clientRegistryId, $client);
            }
        } catch (Zend_Gdata_App_CaptchaRequiredException $e) {
            throw $e;
        } catch (Zend_Gdata_App_HttpException $e) {
            Mage::throwException($errorMsg . Mage::helper('googleshopping')->__('Error: %s', $e->getMessage()));
        } catch (Zend_Gdata_App_AuthException $e) {
            Mage::throwException($errorMsg . Mage::helper('googleshopping')->__('Error: %s', $e->getMessage()));
        }

        return Mage::registry($this->_clientRegistryId);
    }

Any ideas?


texts: Faster Way to Assign Products to Categories

texts:
In Magento there is a great model Mage_Catalog_Model_Product_Action which allows you to quickly update product attributes. You just pass it the IDs that the change should apply to, and an array of key/value pairs for attribute-code/value.

I was able to easily copy this and create Mage_Catalog_Model_Category_Action (along with Mage_Catalog_Model_Resource_Category_Action and Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Action). It just required changing the entity type to 'catalog_category' in a few places, (plus changing a view event names,) and it works great.

The problem though is that a category's list of product IDs isn't an attribute. Though there is a catalog_category_product table, there is no matching entity type, or even a model (!?) for this table.

So I'm left wondering how I can mass-update the category to product association. Obviously I could load each product via it's model, and update the 'category_ids' attribute, but this involves a ton of overhead. (I should note, I'm looking to be able to mass update thousands of category->product associations.)

The only method left available to me is direct query manipulation, and I'm hoping to avoid that.

I do know that the API has an assignProducts method, but I don't want to make thousands of SOAP calls back to my own server, and I'm not sure how to use the API models directly in my code.

Any help appreciated.

Edit: The class Mage_Catalog_Model_Category_Indexer_Product and method _registerProductEvent and/or _registerCategoryEvent might hold some clues. However these are protected methods and I'm not sure how to build or spoof the Mage_Index_Model_Event object correctly.


texts:
I updated "Use Custom Admin URL" by mistake.
after that my Admin page is showing 404 and Css paths also take /newpath/../../cssname.css

I checked core_config_data and set admin/url/use_custom to 0.
but still problem persists.


texts: After upgrading 2.0.9 to 2.1.2 Product data is not displayed in admin panel when i edit a product

texts:
I have upgraded magento using Magento web setup wizard from 2.0.9 to 2.1.2 latest.

Now on front-end products are displayed properly, but when I trying to edit any product all details displayed blank.

It means that in backend showing no data.

Please help me to solve this issue.

In theme magento luma is used.


texts: How do I change the word as "out of stock" in sidebar filter magento 2?

texts: See attached image, out of stock word change in filter sidebar magento 2? I want to change the word as "Out of stock" to "Back to back" Please send me the theme file path so its help me.


texts: How to call magento 2 validation with using button type is button?

texts:
I have custom form with 3 fields i.e Name, Email Id, Mobile No.

require([
   'jquery',
    'mage/validation'
], function($){

var dataForm = $('#product_addtocart_form');
var ignore = null;

dataForm.mage('validation', {
    ignore: ignore ? ':hidden:not(' + ignore + ')' : ':hidden'
}).find('input:text').attr('autocomplete', 'off');

$('button#estimate').click( function() { //can be replaced with any event
    dataForm.validation('isValid'); //validates form and returns boolean
});
});

But function is not validating?


texts: On OnepageController.php how I can check checkout method is checkout as guest

texts:
I want to check checkout method of user on OnepageController.php

eg if checkout as guest then value will be guest

I tried the following:

$this->getRequest()->getPost('method')

...but it's not working.


texts: Memcached causing Web Setup Wizard Error

texts:
I have a Magento 2 store that I just configured memcached on.  Everything seemed to be working well and using the guide on the magento site I was able to verify it was working via telnet.

However, when I tried to access the Web Setup Wizard section from the Magento back end I received this error

  Fatal error: Uncaught Exception: Warning: SessionHandler:1(): open(127.0.0.1:20000/sess_19qiu342pfd61u99a14t054m22, O_RDWR) failed: No such file or directory (2) in /home/vanscosu/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 in /home/vanscosu/public_html/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/home/vanscosu/...', 22, Array) #1 /home/vanscosu/public_html/vendor/magento/framework/Session/SaveHandler/Native.php(22): SessionHandler->read('19qiu342pfd61u9...') #2 /home/vanscosu/public_html/vendor/magento/framework/Session/SaveHandler.php(93): Magento\Framework\Session\SaveHandler\Native->read('19qiu342pfd61u9...') #3 [internal function]: Magento\Framework\Session\SaveHandler->read('19qiu342pfd61u9...') #4 /home/vanscosu/public_html/vendor/magento/framework/Session/SessionManager.php(189): session_start() #5 /home/vanscosu/public_html/var/generation/Magento/Backend/Model/Auth in /home/vanscosu/public_html/vendor/magento/framework/App/ErrorHandler.php on line 61

That is the only thing I've found that doesn't work, but I obviously need it to manage various plugins and extensions.  I've disabled memcached and returned session storage to the file system for now, but I would like to solve this.

Magento 2.1.5
PHP 7.0.19


texts: Magento 2 : Change Product Default Image

texts:
I am trying to change the default images on products that haven't got an image.

I've uploaded the images within:

Stores > Configuration > Catalog > Catalog > Product Image Placeholders

I've flushed my cache and reindexed and my placeholder image is showing on the category listings but it is still showing the Magento logo default image on the product page?

How can I update this image to my own?


texts:
I recently started using jquery widgets in magento and come to know that magento extends jquery-ui widgets through the use of widget factory and customises them according to need and then again return them.

So far according to theory all looks good but as soon as I started using them, I found little timing issue in collapsible widget.

I am trying to use collapsible widget of magento inside one of my cms-block through data-mage-init. Here is how my structure looks.

Trigger element

        This is the element that should be collapsed and expanded.

Now when I cleared the cache and then reload the frontend, I noticed the element with attribute data-role="content" remains open by default and hides after whole page completes loading which is not very good user experience at all.

Now my question is how to solve this timing issue despite using magento jquery widget with proper way?

Should we use our custom jquery despite having collapsible widget?

Thanks in advance.


texts: Magento 2 search page product name,image, price not displaying

texts: Magento 2 search page product name not displaying


texts: Contact Form Not Sending Emails to example@domain.com

texts:
I've created a Custom Transactional Email for contacts page.
It sends out an email if I use a example@gmail.com email, which goes to spam folder.

But if I use an example@domain.com email as contact, it does not receive any message. These mailboxes don't have a spam folder.

How can I prevent emails going to spam or how can receive these emails?


texts: Add same plugin to all public methods of a type

texts:
Is there any chance to add a plugin to all public methods of a type without writing a separate method for all of them?

I would like to use that to log method calls. The original method is always called with unmodified parameters.

As it is intended for development/debugging, any dirty hack is appreciated.


texts: how to set base image after removing all image magento 2

texts:
I have to set Base Image,Thumbnail and small image after removing all image programmatically.

I am trying this code to remove all image from product

$productRepository = $this->_objectManager->create('Magento\Catalog\Api\ProductRepositoryInterface');
$product = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($proPaint->getProductId());
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
foreach ($existingMediaGalleryEntries as $key => $entry) {
        unset($existingMediaGalleryEntries[$key]);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
$productRepository->save($product);

and this code for add image as base,small and thumbnail

$product->addImageToMediaGallery($imagePath, array('image','small_image','thumbnail','swatch_image'), false, false);

but it is not save as base,small or thumbnail

How can i set base image small and thumbnail after removing all image


texts: How to write direct link of js in magento

texts:
In magento 1 in xml

<script src="http://www.abc/aa/abc.js"></script>

In magento 2 i am trying to ad like this in my xml but its not adding how can i add js using link without download and save it. I want this js only in my custom page


texts: Can I change a Product Attribute Property of an existing attribute without removing the associated simple products from configurable products?

texts:
I wish to change the "Add to Column Options" and "Use in Filter Options" properties in the Advanced Attribute Properties section of an existing Attribute that is used by all the products on our site.

However, when I try this locally all the simple products are no longer associated with their Configurable parents. Is this normal/expected? Is there a way round it?

From research it appears that adding or removing an entire attribute can have this affect, but I was hoping that I could change the property of an existing attribute without this happening.

I'm using Magento 2.1.3


texts:
I'm building a tree view for my magento site. Its all working fine. But the only problem is that When I go into 4th level categories the URL path of the category is not coming properly.

for example.

Lets say I have the following url path

testsite.com/index.php/accessories/interior-accessories/electronic/

this is my 3rd level category url. The problem is that I would have another sub category under  electronic like,

testsite.com/index.php/accessories/interior-accessories/electronic/sub-cat

, but magento does not give me this path. it will only give upto the 3rd level category.

This is the code that I am using.

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

any ideas?


texts: Magento1.9 after login Redirection event

texts:
I want to redirect the customer after successful login to home page and not redirect in checkout page login i have used the following event and its not worked for me is there any other event to take place this

app/code/local/Cusredirection/Customer/Model/Observer.php

 /**
  * Run couple of 'php' codes after customer logs in
  *
  * @param Varien_Event_Observer $observer
  */
 public function customerLogin($observer)
 {
     Mage::log(__METHOD__ . '() Hello!'); // Remove afterwards. Check your var/log/system.log to see if came to this point
     $customer = $observer->getCustomer();
     $session = Mage::getSingleton('customer/session');
    if (strpos(Mage::helper('core/http')->getHttpReferer(), 'checkout') !== false){
        Mage::log("Checkout Page",null,"mylog.log");
        $session->setAfterAuthUrl(Mage::getBaseUrl());
    }
    else {
        Mage::log("Other Pages",null,"mylog.log");
        $session->setAfterAuthUrl(Mage::helper('core/http')->getHttpReferer());
    }
    $session->setBeforeAuthUrl('');
     // "run couple of 'php' codes"
 }

}

app/code/local/Cusredirection/Customer/etc/config.xml

<?xml version="1.0"?>

            0.1

                Cusredirection_Customer_Model

                        model
                        cusredirection_customer/observer
                        customerLogin


texts: Selling event tickets where the attendance is limited and people can attend multiple or single days

texts:
I want to be able to sell tickets for an event that runs over two days. Ideally people should be able to buy a ticket for a single day or for both days but the total places available for each day is set at a finite number.

I have set up three products (ticket-day-1, ticket-day-2, ticket-both-days) but having each ticket as a simple product doesn't work because if someone purchases a 2-day ticket it won't reduce stock on the single days. When ticket-both-days is purchased it needs to reduce stock on both ticket-day-1 and ticket-day-2.

Is there some way of doing this?

(Or am I just going to have to manually change stock levels of the single day tickets when a 2-day ticket is purchased?)

Using Magento CE 1.9.2


texts:
I have been having an issue with my magento 2.1.8 webstore in which the styles.less for the admin pages is not being generated.

I am receiving this error when i try to do a static-content:deploy

adminhtml/Magento/backend/en_GB/css/styles.less
Unable to get content for 'adminhtml/Magento/backend/en_GB/Magento_Checkout/css/                    source/module/_checkout.less'

The Magento_Checkout module has been overwritten in my current theme, and i have placed the _checkout.less from the original module in the overwritten module in css/source/module/ but the error is still occurring.

What would be the correct location to place this file?

EDIT:

it seems I am missing a folder:

adminhtml/Magento/backend/en_GB/Magento_Checkout

This folder is not appearing at all in the static/adminhtml/magento/backend/en_GB directory when i run static-content:deploy

How do i make this folder appear?

Thanks

EDIT 2:

after commenting out the line:

@import '../Magento_Checkout/css/source/_module.less';

in styles.less I have found that the issue is not with the magento checkout, it is with the imports for all the modules:

// @import '../Magento_Checkout/css/source/_module.less';
// @import '../Ess_M2ePro/css/source/_module.less';
// @import '../Magento_AdminNotification/css/source/_module.less';
// @import '../Magento_AdvancedCheckout/css/source/_module.less';
@import '../Magento_Backend/css/source/_module.less';
@import '../Magento_Banner/css/source/_module.less';
@import '../Magento_Braintree/css/source/_module.less';
@import '../Magento_Catalog/css/source/_module.less';
@import '../Magento_CatalogPermissions/css/source/_module.less';
@import '../Magento_Config/css/source/_module.less';
@import '../Magento_ConfigurableProduct/css/source/_module.less';
@import '../Magento_CurrencySymbol/css/source/_module.less';
@import '../Magento_Customer/css/source/_module.less';
@import '../Magento_CustomerBalance/css/source/_module.less';
@import '../Magento_Downloadable/css/source/_module.less';
@import '../Magento_GiftCard/css/source/_module.less';
@import '../Magento_GiftRegistry/css/source/_module.less';
@import '../Magento_GiftWrapping/css/source/_module.less';
@import '../Magento_Marketplace/css/source/_module.less';
@import '../Magento_ProductVideo/css/source/_module.less';
@import '../Magento_Review/css/source/_module.less';
@import '../Magento_Reward/css/source/_module.less';
@import '../Magento_Rma/css/source/_module.less';
@import '../Magento_Sales/css/source/_module.less';
@import '../Magento_Shipping/css/source/_module.less';
@import '../Magento_Staging/css/source/_module.less';
@import '../Magento_Tax/css/source/_module.less';
@import '../Magento_Translation/css/source/_module.less';
@import '../Magento_Ui/css/source/_module.less';
@import '../Magento_Vault/css/source/_module.less';
@import '../Magento_VersionsCms/css/source/_module.less';
@import '../Magento_VisualMerchandiser/css/source/_module.less';

When saving and uploading this file, i get the same error message but for the Magento_Backend module:

Compilation from source:
adminhtml/Magento/backend/en_GB/css/styles.less
Unable to get content for 'adminhtml/Magento/backend/en_GB/Magento_Backend/css/source/_module.less'

I have a feeling this may be an issues with the permissions? has anyone had this issue before?


texts: In custom payment method how to get a submitted credit card number in magento2?

texts: How to retrieve a credit card number and other details  in magento 2?


texts: Duplicated theme not displaying correctly?

texts:
I'm trying to duplicate a Magento theme from one Magento install to a fresh install on another server however the theme appears to load the default luma theme.

I have removed /pub/static/frontend/ and have ran the following command however it still isn't working.

  php bin/magento setup:static-content:deploy -f

Is there anything I need to bear in mind when duplicating the theme. I can confirm that both installs are using the same version of Magento and are using the exact same theme files so its confusing me as to why they look different.

It appears that the default.xml and default_head_block.xml isn't having any affect on the theme.

Any help would be appreciated :)


texts:
We have a B2B website and all our customers are approved to be on the site. No public or guest checkouts. Typically they all use credit cards. Some of the transactions are being marked as fraud. We don't know why.

Magento 2 - Fraud Protection is not enabled. I can't get the orders to go to a pending state or processing state. We have to call the customer and take everything over the phone which is causing delays and backing up customer service.

The credit cards are authorizing and nothing is wrong with the data from the merchant services. How can I stop this?


texts: How to write new line with drawText() in magento?

texts:
I am trying to new line with magento function drawText(); I was tried below code but it showing all statement like Line 1! \n Line 1!

can any body tell me how do i print multiple new lines using below code.

 $page->drawText(Mage::helper('sales')->__('Line 1! \n Line 1!'), 35, $this->y, 'UTF-8');


texts: Magento: Dynamically generated css class changes when changing language from English to Arabic

texts:
I have used some class name in category page that are dynamically generated and used that class name to write css in style.css page.
Now the problem is when I change the store from English to Arabic, all the dynamically generated class name changes to Arabic.
How to keep these class name in English even if I change the store.


texts: How to upload bulk images in magento 2 and store name in custom table

texts: I am trying to upload bulk images using dropzone.js, In  controller files are listing, so How can I upload and store image details in custom table using magento 2 way ?


texts: Get product from configurable attributes array using getConfigurableAttributesAsArray?

texts:
I'm trying to get the associated products using the method $p->getTypeInstance(true)->getConfigurableAttributesAsArray($p) which results in an array like this:

Array
(
    [0] => Array
        (
            [id] => 13
            [label] => Size
            [use_default] => 0
            [position] => 0
            [values] => Array
                (
                    [0] => Array
                        (
                            [product_super_attribute_id] => 13
                            [value_index] => 7
                            [label] => S
                            [default_label] => S
                            [store_label] => S
                            [is_percent] => 0
                            [pricing_value] =>
                            [use_default_value] => 1
                        )
[...]

What I'm trying to get is the product that's representing [value_index] => 7 which is an associated simple product.

Any ideas?


texts: Where to write parameters to create order programmatically in Magento 2?

texts:
I want to create order programmatically in Magento 2:
 I have followed this link https://www.mageplaza.com/devdocs/magento-2-create-order-programmatically.html

  Now, My questions are:
   1. Where I will put the temp order code.At  which path  in my custom module ?
   2. And how I will run the function to create the order programmatically?


texts:
I am using this code to filter products by min and max price

updated code

     $collection = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('status', 1)
            ->addAttributeToFilter(array(array('attribute'=>'visibility', 'eq'=>"4")));
     }
        if(sizeof($years)>0){
            $collection->addAttributeToFilter('year', array('in' => $years));
        }
        if(!empty($minprice) && !empty($maxprice)){
                $collection->addFieldToFilter('price',array('gteq'=>$minprice))
                           ->addFieldToFilter('price',array('lteq'=>$maxprice));
        }

But if products have special price it  works wrong. I need to use final price here. How can I do this?

Answer that I found while exploring magento native layered navigation

$collection->addFinalPrice();
$select = $collection->getSelect();
$select->where('price_index.final_price >= ' . $minprice);
$select->where('price_index.final_price < ' . $maxprice);


texts: Preview custom product options with image overlay

texts:
I'm currently working on a store selling on-order products. These products need to be customized by the client. I'd like to preview the custom options chosen by the client by graphically showing them placed on the item.

I'm imagining making a seperate transparent image for each option, making them the same size as the entire preview image size, and then placing them on top of each other.

If my intentions aren't clear, please let me know. I'll create a graphical representation of what I mean.

Are there any known extensions doing this? Paid for or free.


texts: Fixed Price for child item of bundle product in magento

texts:
I am trying to create a bundle product with fixed price and give a discount to them.

Then add more items on this bundle while few item will have some extra charges (fixed price).

For example: A bundle product fixed price is $500 and discount percent is 50%.
Now, in bundle item I will add

1. Item 1 (fixed price: 0)

2. Item 2 (Fixed price: 100)

This gives me a bundle item obviously of $250 (500- 500*50%). However, price of my dropdown item no. 2 will also have $50 ($100- 100*50%).
But, I want to have $100 (fixed) of my dropdown item no. 2's price.

I have tried looking in to following file:

app/code/core/Mage/Bundle/Model/Product/Price.php

I am not sure which file is the right one to achieve this..

Anyone knows the answer, please.


texts: Magento dropdown group selection customer registration

texts:
I am trying to make a group selection dropdown on the Magento customer registration page work. I have done all of the following:

Inserted the following code into template/persistent/customer/form/register.phtml:

<?php echo $this->__('Which group do you belong to? (select "Pet Owner" if you are uncertain)') ?>*

Note: DVM/DACVO and Institution accounts require administrative approval.

                    <select style='border:1px solid gray;' name="group_id" id="group_id" title="<?php echo $this->__('Group') ?>" class="validate-group required-entry input-text" />
                        <?php $groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
                        <?php foreach($groups as $group){ ?>
                            <?php if ($group['label']=="Pet Owner" || $group['label']=="DVM / DACVO" || $group['label']=="Institution"){?>
                                <option value="<?php print $group['value'] ?>"><?php print $group['label'] ?></option>
                            <?php } ?>
                        <?php } ?>
                    </select>

Then the following in /app/code/local/Mage/Customer/controllers/AccountController.php in the createPostAction():

$customer->setGroupId($this->getRequest()->getPost('group_id'));

Finally the following in /app/code/local/Mage/Customer/etc/config.xml where group id was added:

  <fieldsets>
            <customer_account>
                <prefix>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </prefix>
                <firstname>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </firstname>
                <middlename>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </middlename>
                <lastname>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </lastname>
                <suffix>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                </suffix>
                <email>
                    <create>1</create>
                    <update>1</update>
                </email>
                <password>
                    <create>1</create>
                </password>
                <confirmation>
                    <create>1</create>
                </confirmation>
                <dob>
                    <create>1</create>
                    <update>1</update>
                </dob>
                <group_id><create>1</create><update>1</update></group_id>
                <taxvat>
                    <create>1</create>
                    <update>1</update>
                </taxvat>
                <gender>
                    <create>1</create>
                    <update>1</update>
                </gender>
            </customer_account>

I have tested it several times and every customer is still being added as the default customer group. Can you see what I am doing wrong?


texts: Class does not exits - issue on Magento 2

texts:
This is my error that i receive on the production server:

[2020-02-20 14:43:34] main.CRITICAL: Class Mynamespace\Mymodule\Ui\Shipments\PrintAllButton does not exist {"report_id":"28e61f38d5a7de991c74b0bae7bb6efab93aef812fd824e94d0e5238d7b8c157","exception":"[object] (ReflectionException(code: -1): Class Mynamespace\\Mymodule\\Ui\\Shipments\\PrintAllButton does not exist at /home/..../vendor/magento/framework/Code/Reader/ClassReader.php:26)"} []

and this my code from the ui component:

<settings>
    <buttons>
        <button name="print_all_shipments" class="Mynamespace\Mymodule\Ui\Shipments\PrintAllButton"/>
        <button name="print_last_x_shipments" class="Mynamespace\Mymodule\Ui\Shipments\PrintButton"/>
    </buttons>
    <spinner>shipments_columns</spinner>
    <deps>
        <dep>custom_shipments_grid.custom_grid_data_source</dep>
    </deps>
</settings>

and my class is:

class PrintAllButton implements ButtonProviderInterface
{
...
    public function getButtonData() : array
    {
...
    }
}

I'm 100% sure that my class exits. Especially since on my local is working. If I remove the buttons, I am getting my grid. For some reason I get that error on production. Not sure why ? The production runs a clean install of Magento, no other 3parties module being installed, instead the one that I made :)

Is there a way to debug this ? if Yes, how ?


texts:
I need to put this in the head section

BUT only for the CMS pages that I have running under a custom theme.- and only in the blank layout if possible
been through a few locations and I am unsure where to put. I tried header.phtl in the theme folder but that didnt seem to work.

Hope to help thanks


texts: Magento 2 getUrl is generating a different security key

texts:
I am trying to generate the following url, in the adminhtml area:

$this->url->getUrl('adminhtml/system_config/edit', ['section' => 'mysection']);
// where $this->url is an instance of \Magento\Framework\UrlInterface

and the url is being generated correctly.

The only thing is that another security key is being generated as part of the url (I'm getting "Invalid security or form key. Please refresh the page." on the next page after I click the generated link).

How can I preserve the current key?


texts: Magento 2: how can i clear cart using javascript?

texts: Please, how can I clear cart using javascript on Magento 2?


texts: What would be the proper way to overwrite returnAction() in app/code/core/Mage/Paypal/Controller/Express/Abstract.php

texts:
I am trying to extend default PayPal Express functionality.
I have successfully rewritten app/code/core/Mage/Paypal/Model/Config.php like

 <global>
        <models>
            <paypalexpressconfirmation>
                <class>Namespace_PayPalExpressConfirmation_Model</class>
            </paypalexpressconfirmation>
            <paypal>
                <rewrite>
                    <config>Namespace_PayPalExpressConfirmation_Model_Config</config>
                </rewrite>
            </paypal>
        </models>
 </global>

But cannot find the way to overwrite

public function returnAction()
{
    try {
        $this->_initCheckout();
        $this->_checkout->returnFromPaypal($this->_initToken());
        $this->_redirect('*/*/placeOrder');
        return;
    }
    catch (Mage_Core_Exception $e) {
        Mage::getSingleton('checkout/session')->addError($e->getMessage());
    }
    catch (Exception $e) {
        Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
        Mage::logException($e);
    }
    $this->_redirect('checkout/cart');
}

in app/code/core/Mage/Paypal/Controller/Express/Abstract.php

I have tried using an observer in the event controller_action_predispatch_paypal_express_return and its triggered when customer come back from PayPal page but I don't see anything that allows me to intercept this method and rewrite it.

Thanks


texts: How to add SKU in the attribute list in the More Information tab of the product view page?

texts:
I have added the following code to catalog_product_view.xml to show the SKU in the list of attributes inside the "More information" tab

<referenceBlock name="product.info.details">
  <referenceBlock name="product.attributes">
      <arguments>
        <argument name="at_call" xsi:type="string">getSku</argument>
        <argument name="at_code" xsi:type="string">sku</argument>
        <argument name="css_class" xsi:type="string">sku</argument>
      </arguments>
    </referenceBlock>
</referenceBlock>

The other customizations in the file are visible, but not this one. Any idea?


texts:
I want to add a field in back-end that when I set it, will show in front-end in product page under product name, like picture.

I define new attribute but in front-end it will show in a table that is in Extra information about product, not under product name.

How can I add this field?


texts: Unable to add Custom column in customer Grid

texts:
I'm using magento 2.3.5 below is my code
Custmergrid/view/adminhtml/ui_component/customer_listing.xml
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="customer_columns">
        <column name="my_column" class="Shruti\Custmergrid\Ui\Component\Listing\Column\Mycolumn">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" translate="true" xsi:type="string">My column</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

Custmergrid/Ui/Component/Listing/Column/Mycolumn.php
<?php
namespace Shruti\Custmergrid\Ui\Component\Listing\Column;

use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Customer\Api\CustomerRepositoryInterface;

class Mycolumn extends \Magento\Ui\Component\Listing\Columns\Column
{
    protected $_customerRepository;
    protected $_searchCriteria;

    public function __construct(
        ContextInterface $context,
        UiComponentFactory $uiComponentFactory,
        CustomerRepositoryInterface $customerRepository,
        SearchCriteriaBuilder $criteria,
        array $components = [],
        array $data = []
    ) {
        $this->_customerRepository = $customerRepository;
        $this->_searchCriteria  = $criteria;
        parent::__construct($context, $uiComponentFactory, $components, $data);
    }

    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {
                $customer  = $this->_customerRepository->getById($item["entity_id"]);

                $customer_id = $customer->getId();
                $item[$this->getData('name')] = 'Here';
            }
        }
        return $dataSource;
    }
}


texts: Magento 2 installing 2 instance of same module

texts: I want to use 2 instance of Braintree module at different setting. Anyway by which it can be achieved? Or any way to configure it with 2 settings?


texts:
we're having a problem that an error message shows after enabling and disabled the Compiler in Magento (at least we think that's the reason).

The error message reads as follows:

Warning: include(Mage.php): failed to open stream: No such file or directory in <absolute path to Magento>/lib/Varien/Autoload.php on line 93 Warning: include(): Failed opening 'Mage.php' for inclusion (include_path='<absolute path to Magento>/app/code/local:<absolute path to Magento>/app/code/community:/<absolute path to Magento>/app/code/core:/<absolute path to Magento>/lib:.:/usr/share/php:/usr/share/pear') in /<absolute path to Magento>/lib/Varien/Autoload.php on line 93 Fatal error: Class 'Mage' not found in /<absolute path to Magento>/app/code/core/Mage/Core/functions.php on line 244

For whatever reason the error didn't show up ever before. As said, we were enabling the compiler but disabled it right after.

What we did next was to clear the compiler files through the shell:

php -f compiler.php clear

We did check all the file's location and permissions and they seem fine. We do not have any ideas anymore what could be causing this.

Any idea on what could be causing the error? Thanks a lot!


texts: Magento 2: Required files to create a module

texts: I'm aware that the only required files for creating a module are registration.php and module.xml. But I'm seeing some of the popular blogs mentioning composer.json file in addition to the above. Any suggestions?


texts: Credit memo gives: Total model should be extended from Mage_Sales_Model_Order_Total_Abstract

texts:
Credit memos always worked fine on my friends store, he tried a few plugins, which he cannot recall also in specfic order/detail. They all got deleted off the server and yes, he did this in the live environment.

Problem is: Now all goes well until a credit memo is needed, We then get: There has been an error processing your request ... Exception printing is disabled by default for security reasons.

With a log ID number. Here is the full log:

a:5:{i:0;s:74:"Total model should be extended from Mage_Sales_Model_Order_Total_Abstract.";i:1;s:1885:"#0 /home/robbshop/public_html/app/code/core/Mage/Sales/Model/Order/Total/Config/Base.php(70): Mage::throwException('Total model sho...')
#1 /home/robbshop/public_html/app/code/core/Mage/Sales/Model/Config/Ordered.php(83): Mage_Sales_Model_Order_Total_Config_Base->_initModelInstance('Mage_Fee_Model_...', 'fee', Object(Mage_Core_Model_Config_Element))
#2 /home/robbshop/public_html/app/code/core/Mage/Sales/Model/Order/Total/Config/Base.php(88): Mage_Sales_Model_Config_Ordered->_initModels()
#3 /home/robbshop/public_html/app/code/core/Mage/Sales/Model/Order/Creditmemo.php(329): Mage_Sales_Model_Order_Total_Config_Base->getTotalModels()
#4 /home/robbshop/public_html/app/code/core/Mage/Sales/Model/Service/Order.php(208): Mage_Sales_Model_Order_Creditmemo->collectTotals()
#5 /home/robbshop/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php(138): Mage_Sales_Model_Service_Order->prepareCreditmemo(Array)
#6 /home/robbshop/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php(222): Mage_Adminhtml_Sales_Order_CreditmemoController->_initCreditmemo()
#7 /home/robbshop/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Sales_Order_CreditmemoController->newAction()
#8 /home/robbshop/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('new')
#9 /home/robbshop/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#10 /home/robbshop/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#11 /home/robbshop/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#12 /home/robbshop/public_html/index.php(84): Mage::run('nl')
#13 {main}";s:3:"url";s:96:"/index.php/beheer/sales_order_creditmemo/new/order_id/1465/key/b33de54d5125a4cfa9a7302dea027a0b/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}

Anybody else seen this before ? We cannot find the answer here and we'd like to use credit memo's still.

What I have tried: clearing all cache files in the backend and on the ftp server, but it is starting to feel like sql corruption :S And I looked at folder/file rights, all is okay.


texts: I want to clear Reports->Marketing->Products in Carts,Abandoned Carts from admin panel in magento-2.1.How to achieve it?

texts:
I have deleted all customers, orders from admin panel.

But I also want to delete "Reports >> Marketing >> Products in Carts, Abandoned Carts" from admin panel in "Magento 2.1".

How can I do that?

Please guide me!!!


texts: Magento 2 - Pendent Payment status in orders

texts:
in the back-office of Magento I have a lot of orders with the status 'Pending payment'. I have revised the transactions and there are done.
I'm not sure how to change it and the most important why it happens?
Maybe somebody can help me.
Thanks.