texts: Crosssell Products on Product Pages displaying disabled products - Magento 1

texts:
I have a code snippet to display cross-sell products on the product page via catalog/product/view.phtml.

It displays the product's cross-sell items, however it also displays disabled products.

Can anyone advise how I can filter only enabled products with the code below?

<?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?>

TOP <?php echo strtoupper(Mage::getModel('catalog/layer')->getCurrentCategory()->getName()); ?> PRODUCTS

    <?php foreach ($_crossSellProducts as $_item): ?>
        <?php $_item = Mage::getModel('catalog/product')->load($_item->getId()); ?>

                <a class="product-image" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>">
                    <img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(100, 150); ?>" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" />

                <a href="<?php echo $_item->getProductUrl() ?>">
                        <?php echo $this->htmlEscape($_item->getName()) ?>

                       <?php echo $this->getPriceHtml($_item, true) ?>

    <?php endforeach; ?>

<?php endif; ?>


texts: Ideas as to why Magento crashes regularly

texts:
On one of our shared servers we have 2 Magento sites, and about 8 other sites running different CMS's. Both of these 2 Magento sites crashes almost every sunday at about 0700. The problem is solved by simply hard-restarting Apache.

Has anyone ever experienced anything like this?

It's been going on for quite some time now, and I've tried to locate what it might be.

Since it only happends at this time I've naturally looked threw all the crons on the server (via for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done) but no crons are running at the specific time of the incidents. Note that I've also doublechecked the server date.

I've got plenty of Magento sites on different aws instances, and it's only these two sites that I experience this issue with.

Does anyone have any idea about what I should look into closer? The Magento sites are running version 1.9.0.1 and 1.8.1.0.

Any help is much appreciated!

UPDATE: I moved the Magento sites to another server, and the problem stopped occouring (even though there are still a few other sites left), and it didn't happen on the new server. Still few ideas as to what caused it.


texts: Magento full screen product image zoom in and zoom out not working

texts:
I have installed Porto theme. When I visited a product page and click on the image, it goes into full screen, which is exactly as per requirements. When I try to zoom in or out of the image using the magnifier glass icons,nothing happens.

I have no clue why this is the case.

See example on this webpage:
http://34.83.184.119/lightcatcher-solar-100w-12v-mono-solar-panel.html


texts: Products are not adding in compare list in magento2?

texts:
I have to implement product compare feature in my magento2. For this i am using

<?php $this->getAddUrl($product); ?> and I am getting the compare url of the product. But after click on add to compare link, no product showing in the compare sidebar.

Please help me to do it. Thanks


texts:
I have a module which adds some catalog attributes and some sales attributes.

Usually i would extend the correct setup type for which i want to add attributes for but obviously cannot do this here since they are both different.

My setup type is defined as Mage_Eav_Model_Entity_Setup

This works fine for catalog attributes.

But i need to add to the sales table also.  How can this be achieved in the same module?

Specifically i am using addAttribute to ad product attribute and i also want to add a field to order_item


texts: For ECG you should avoid using "superglobals", but is there any Magento, Zend or Varien method to replace $_FILES? Couldn't find anything in Mage_Core_Controller_Request_Http or Zend_Controller_Request_Http or Zend docuomentation.


texts: Magento2.4 : How to setup PWA with Angular

texts: I want to setup PWA with Angular. I search but I only found Magento 2 project setup with react. I correctly set up with react but not found the best practice and correct way to setup Magento 2.4 with angular. If someone knows that Please help me.


texts: Magento 2.0 Static Content Deploy PHP Fatal Error

texts:
INSTALLED MAGENTO 2.0 IN FOLDER on UBUNTU 16.10
SAME CSS ISSUE AGAIN...

cd /var/www/html/store
sudo php bin/magento setup:static-content:deploy

PHP Fatal error:  Uncaught Error: Call to undefined function Magento\Framework\Event\mb_strtolower(
) in /var/www/html/store/vendor/magento/framework/Event/Manager.php:56

sudo apt-get install php7.0-mbstring

/var/www/html/store# sudo apt-get install php7.0-mbstring
Reading package lists... Done
Building dependency tree
Reading state information... Done
****** php7.0-mbstring is already the newest version (7.0.15-1+deb.sury.org~yakkety+1). ******
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

ALREADY INSTALLED?

sudo service apache2 restart

php bin/magento setup:static-content:deploy

PHP Fatal error:  Uncaught Error: Call to undefined function Magento\Framework\Event\mb_strtolower(
) in /var/www/html/store/vendor/magento/framework/Event/Manager.php:56

***************************************AGAIN

cd /etc/php/7.0/apache2
nano php.ini

EDITED
;extension=php_mbstring.dll
TO
extension=php_mbstring.dll

SAVE
EXIT

sudo service apache2 restart

cd /var/www/html/store
sudo php bin/magento setup:static-content:deploy

PHP Fatal error:  Uncaught Error: Call to undefined function Magento\Framework\Event\mb_strtolower() in /var/www/html/store/vendor/magento/framework/Event/Manager.php:56
*********************************** AGAIN

Multibyte String
mb_strtolower — Make a string lowercase

cd /etc/php/7.1/apache2
nano php.ini

EDITED
;extension=php_mbstring.dll
TO
extension=php_mbstring.dll

SAVE
EXIT

sudo service apache2 restart
cd /var/www/html/store
sudo php bin/magento setup:static-content:deploy

Uncaught Error: Call to undefined function Magento\Framework\Event\mb_strtolower(
) in /var/www/html/store/vendor/magento/framework/Event/Manager.php:56

EDITED BOTH PHP.INI
Both 7.0 and 7.1 Filesize upload 256M AND Uncommented ;extension=php_mbstring.dll
Thats the only thing I've changed.

****** HELP **************************** ///


texts:
I have created Attribute on category level
now I want to fetch the value of this attribute. I have tried below code
 $_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $object_manager =
 $_objectManager->create('Magento\Catalog\Model\Category')->load($cat_id);
 echo "<pre>"; print_r($object_manager->getData('google_taxonomy'));

but not result coming.


texts: Magento 1.9 ignores taxrules in cart and checkout

texts:
I have a german B2C-online-shop. The product-prices that have been inserted in the backend are incl. 19% VAT. In the shop I have defined different taxrules that represents the following cases:

If the customer is a private person (regardless of which country) or a company from germany, the price should be displayed incl. 19% VAT - .

Example: price in backend is 10 € > displayed price should be "10 € incl. 19% VAT"

If the customer is a company from an other country than germany, the price should be displayed incl. 0% VAT.

Example: price in backend is 10 € > displayed price should be "8,4 € incl. 0% VAT"

The case 1 works without problems in the whole order-process - I think this is because it is the normal behavior of the Magento-shop.

The case 2 doesn't work properly. When I look in a category-page (with the product-list) or in the product-view the prices are displayed correct: 8,4 € incl. 0% VAT. In the shopping cart and in the checkout-process the prices are wrong: 10 € incl. 19% VAT. The tax for the shipping costs are also wrong (they are inserted with 19% VAT in backend and are displayed incl. 19% VAT - but it should display the shipping cost with 0% VAT in this case). The calculated totals works also with 19% VAT and display the calculated tax-amaount for 19% VAT.

The backend-configuration for the prices in the product-view, the cart and the checkout are identical (Including Tax). So this shouldn't be the problem.

I think the problem is, that Magento use the Mage_Sales_Model_Quote_Item to handle the articles and prices in the cart and checkout. In the  product-list and product-view Magento uses the Mage_Catalog_Model_Product. It looks like Mage_Sales_Model_Quote_Item ignores the taxrules. I've tried to change the function getCalculationPriceOriginal() in Mage_Sales_Model_Quote_Item_Abstract to calculate the price with this code:

public function getCalculationPriceOriginal()
{
    $_product = $this->getProduct();
    $_taxHelper = Mage::helper('tax');
    $_store = $_product->getStore();
    $_convertedPrice = $_store->roundPrice($_store->convertPrice($_product->getPrice()));
    $price = $_taxHelper->getPrice($_product, $_convertedPrice);
    ...
}

This helped to display the correct price in the product-listing in the shopping cart but the totals are still calculated wrong. Apart from that I think it is not a good idea to change the calculations in the core-classes because I don't know which side effects this has in the whole order-process and which functions I have to change.

So the question is: What can I do to display the correct prices for case 2 in the whole order-process?


texts: Magento 2 : setup:upgrade throwing error. After Magento 2.1 to 2.3 update

texts:
I recently updated my Magento version form 2.1 to 2.3.0.

Update was successful in my local system.

Now its throwing error while running setup:upgrade like this.

Schema creation/updates:
PHP Fatal error:  Uncaught TypeError: Return value of Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder::processTable() must be an instance of Magento\Framework\Setup\Declaration\Schema\Dto\Table, boolean returned in /var/www/html/store/vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php:251
Stack trace:
#0 /var/www/html/store/vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php(148): Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder->processTable(Object(Magento\Framework\Setup\Declaration\Schema\Dto\Schema), Array)
#1 /var/www/html/store/vendor/magento/framework/Setup/Declaration/Schema/SchemaConfig.php(78): Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder->build(Object(Magento\Framework\Setup\Declaration\Schema\Dto\Schema))
#2 /var/www/html/store/setup/src/Magento/Setup/Model/DeclarationInstaller.php(57): Magento\Framework\Setup\Declaration\Schema\SchemaConfig->getDeclarationConfig()
#3 /var/www/html/store/setup/s in /var/www/html/store/vendor/magento/framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php on line 251

Checked on log files. There is no error except.

debug.log

  main.DEBUG: cache_invalidate:
  {"method":"GET","url":"http:/","invalidateInfo":{"tags":["interception","CONFIG"],"mode":"matchingTag"}}
  []


texts: How to add handler to \Magento\Catalog\Helper\Output

texts:
I'd like to display the unit of measurement after each product attribute with some dimension (mm, g, …).

To prevent duplicated code in each PHTML template file that probably displays a product with attributes, I thought it might be a good idea, to add a handler to the output helper, which could append those units.

For example attributes.phtml uses <?= $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?> to output the attributes value. I guess the sense behind using $_helper->productAttribute instead of simply outputting $_data['value'], is that the value might be translated to another format or something similar.

From the code in the Magento\Catalog\Helper\Output-helper, I figured out, that one might add handlers to the output helper. But I couldn't find any documentation on how to do so or where to add such a handler.


texts: VAT Customer shipping goods to different country with billing address VAT magneto 2.2.3

texts:
Not sure how to get this working, if anyone has any idea will be appreciated for the time.

My aim is to create a module to check if the customer passing two different countries in billing and shipping.
Example: Billing address from UK with VAT number passed and customer group = zero vat customer. When I add a new shipping address in customer account section or checkout I can pass new country and address still count as a zero vat customer. Is there any way I could stop this? if there is please advice


texts: Magento 2 Layout extend from blank theme

texts:
I am very confused by why magento is not executing the layout extension in my custom theme.

So first things first. I followed step by step the magento 2 documentation for creating a custom theme and I was able to choose on the admin the new theme as a default theme, so things were fine there. The parent of the theme is the Magento Blank Theme.

In order to make a small change - remove the sidebar from the catalog module-I extended the default layout from here:

 vendor\magento\module-catalog\view\frontend\layout\default.xml

to here:

app\design\frontend\Company\theme1\Magento_Catalog\layout\default.xml

with this code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
       <referenceContainer name="sidebar.additional" remove="true" />
    </body>
</page>

but is not working. It only works if the default.xml is placed here:

vendor\magento\theme-frontend-blank\Magento_Catalog\layout

So I know 1 thing by now, the default.xml extension file is working fine, the problem is that is not being called from the custom theme when is placed there.

Any suggestions ?


texts: SQLSTATE[42S22]: Column not found: 1054 unknown column 'e.status' after 1.9.2 Upgrade. Cannot log in in admin panel

texts: Due error I cannot log in admin panel and re-index.


texts: How to change product template for bundle products?

texts: Is the any way to have separate view.phtml for simple and bundled products?


texts: Getting the store ID when placing an admin order

texts:
I have a multisite setup with multiple custom shipping modules. Each store has different settings for free shipping etc.. (based on weight/value)

Everything works great from the front end, however on the backend the modules take the default values and do not recognize that a store has been selected.

I can detect if it is an admin order, but no idea how to detect what store has been selected and how to get the variables for that store

I am using the following

$current_cart_total_inc >=Mage::getStoreConfig('general/custom_values/free_ship_threshold');

How can I detect the store and then get the correct value based on the store ID rather than use the admin one?


texts: Difference Between online and offline payment

texts:
What is the key difference between offline and online payment method in Magento 2?

How they work and how we can decide that the payment method should be offline or online.


texts:
I was unable to install extension.
When I went to magento admin system-> magento Connect-> Magento Connect Manager, the page showed "Error 403 - Forbidden
You don't have permission to access the requested resource. Please contact the web site owner for further assistance." Therefore I can not install through magento admin.

Then I tried another way. I downloaded the extension and try to install through fileZilla. In the downloaded folder of extension, there are a fold called app and a file called package. However, when I tried to upload the app folder and package file through fileZilla to public_html, filezilla asked me to rewrite the folder app or not.

I failed to try both two ways. Is there anyone can help me out?
The extension I am trying to install is facebook pixel and my magento version is 1.9. Please help me out.


texts: Magento 2. Get value from config inside email template

texts:
I wish to retrieve value from config.xml inside email template. Is it possible? If so how? This is what I tried without success

 {{config path='path/to/value'}}


texts:
I got some strange behavior in Magento.
I ran raw sql query (SELECT) from mangento at first, then from HeidiSQL. And got different results. How can it be? Is there any way to listen to the PDO method fetchAll and modify the result? I do not know how to find an observer which can do that.

I'm running the query from magento like that:

$read = Mage::getSingleton('core/resource')->getConnection('core_read');

$rows = $read->fetchAll($sql);

Any ideas?


texts: What is the best way to remove an extension from Magento? I thought doing it via Magento Connect was the best way however the extension that I am trying to remove I do not see in my Magento connect area. Any ideas?


texts: Problems with Permissions and write access for Magento Connect when trying to install extensions

texts:
I am trying to setup Magento (community edition 1.9.1) on our shared hosting server. I am pretty new to Magento, though I did get a dummy site set up fairly easily on a local machine.

The problem that I am facing is that whenever I try to install an extension through Magento Connect I get various cannot write, cannot access etc errors.

I have set all the permissions to 777 via Filezilla, but there are certain files that are created by Magento that I cannot modify via FTP. If I log into the plesk panel for the site it says that those files/folders have the user Apache, and I can only modify them through the file manager interface. I can get it to proceed to some extent by manually creating the folders it is asking for through file manager but obviously this is slow and tedious and ultimately I still end up with a giant list of inaccessible files.

I hoped to get around this by using the FTP deployment but that give me error:

  deployment ftp error. cannot chdir after login

Is there something that I am doing wrong? I have spent the day ploughing through google searches and forum posts and none of the solutions there seem to solve the problem. Do I need to contact the hosting provider?


texts: Is there a way to search by sku with hyphen without extensions?

texts:
I have some skus that have a very short string before the hyphen, like LC-100-PI, so the search brings up around 400 results that include "100" in them but the one I am looking for is not found until the third results page.

The top results I get are: TFC-1000S50, AC-100, TFC-1000MSC


texts: How to find html/script file on server or magento admin

texts: I have a magento 1.9 e-com site - furnituretrader.com.au - and I want to change the url link to a section at the bottom, however I can't locate the html section on the admin panel or the file server - how do I use a tool to locate this html to edit?


texts: How to hide custom error message after a certain time in Magento 2?

texts:
I have redirected customer to cart from checkout in a specific scenario using observer with a custom error message. Here is the observer code.

namespace Vendor\Module\Observer;
use Magento\Framework\Event\ObserverInterface;

   public function __construct(
        \Magento\Framework\Url $url,
        \Magento\Framework\Message\ManagerInterface $messageManager,
        \Magento\Framework\App\Response\Http $http,
        // other dependencies
    )
    {
        $this->url = $url;
        $this->messageManager = $messageManager;
        $this->http = $http;
    }
    public function execute(\Magento\Framework\Event\Observer $observer)
    {

                $cartUrl = $this->url->getUrl('checkout/cart');
                $mySpecificCondition = true;
                if ($mySpecificCondition) {
                    $this->messageManager->addErrorMessage('Custom error message here.');
                    $this->http->setRedirect($cartUrl);
                }
        }
    }

This error message is shown forever if I do not refresh this page. How I can program it so that this custom error message is hidden after 5 seconds?


texts:
I deleted pub/static folder of Magento 2 Admin Panel. Now my Magento 2 Admin Panel looks like below.

I ran below commands

php bin/magento setup:upgrade

php bin/magento cache:flush

php bin/magento setup:static-content:deploy

php bin/magento indexer:reindex

But it still remains as like before. How can I get the actual look ?


texts: Magento 2.3.1 not allowing javascript code

texts:
I am setting up my store on latest Magento 2.3.1 CE edition.
Apache version: Apache/2.4.39
PHP version: 7.2.18
MySQL version: 10.1.40-MariaDB.

Also I am using Porto theme.

There is a strange problem I am facing for first time. In static block, if I use some JavaScript code like below or any other custom code

<script>document.write(new Date().getFullYear())</script>

and when I save it, I get error

  404 error: Page not found.

If I remove JavaScript code, and put simple text in para html tag, it gets saved successfully. I have used previous versions of Magento 2 and porto theme earlier also but never got such an error. Using Magento 2.3.1 for first time.

Is there any setting in this version of Magento to explicitly allow usage of JavaScript in static blocks?


texts: Magento 2 - show shipping tax cost in summary

texts:
I created a new shipping method for express shipping which costs 90€. How can I show the tax costs of the selected shipping method in the tax section, is there a setting in the backend?
Cart Summary:


texts:
On my Homepage content section CMS > Pages > Home > Content i want to have a jumbotron with a parallax effect. The Heading and text is scrolling over the background image.

I have now my Jumbotron on my homepage. But i can not set a fixed position to the jumbotron.

Can somebody point me in the wright direction to achieve this? It must be a simple jQuery parallax effect.

---- UPDATE 1 ----

I try to implement it with this extension. Does anybody know where the white margin on top of the Jumbotron is coming from?


texts: How to send wishlist frontend view via email to currently login customer?

texts:
I want to send wishlist frontend view to currently login customer through email.

In detail, there will be button send wishlist,  after clicking on that button current logged-in customers automatically receives email with wishlist frontend details.

if information can be as pdf attachment then it will be better.


texts: How to post customer firstname & lastname into database magento 2.1.1?

texts: I added two fields for customers in my website. When customer will go for PIN to verify their account that I want to post customer First-name and Last-name through the form. Now, what can I do can, anyone please help. Please check my attached image below.


texts: Magento 2 klarna payment not vizible in frontend

texts:
I Have magento 2.2.6 installed with Amazon pay and ogone  payment solution, This payments works fine, but klarna payment not visible in checkout page, seems everything is fine in backend, here is screenshot

Also I cant see any errors in console.


texts: How to extending magento 1.9 RWD template

texts:
I would like to know the best approach on how to edit frontend/rwd/default/template/catalog/product/view.phtml?

Is it possible that I don't touch this?

on the configuration "rwd" is set as a default theme


texts:
i am trying to search sku but it show product with that character in price also for example my product sku is 123, then it show product with price 2123 like that i do not want this to happen .

also it does not search product by sku means when i search (123 product sku) it does not show respective product.

how can it be fixed , from where can i modify and view what search query id fired based on out search


texts: Trying to install magento 2 and get page_cache is not writable

texts:
I'm trying to deploy magento 2.1.3 installed with composer on a CentOS 7 machine with apache 2.4 and it returns the error:

[Mon Jul 03 17:15:55.678068 2017] [:error] [pid 16315] [client 211.159.221.63:61183] PHP Fatal error:  Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/var/page_cache" is not writable in /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php:209\nStack trace:\n#0 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...')\n#1 /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/v...')\n#2 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)\n#3 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)\n#4 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(155): Zend_Cache::factory('Magento\\\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true)\n#5 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php(67): Magento\\Framework\\App\\Cache\\Frontend\\Factory->create(Array)\n#6 /var/w in /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

// * (ip and port modified)

I tryed to give the propper permissions to the folders with the commands:

sudo chown -R apache:apache /var/www/html/
// or
sudo chmod -R 775 /var/www/html/

But none of them worked, I even tried with sudo chmod -R 777 /var/www/html/ with same result.

I found this post: Install issue permission and htaccess
and tried the solution proposed there:

<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName www.example.com:80
<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

And same permissions error is there.

I can't get to work this magento 2, I always get the permissions error, even granting all the folders with 777 permission.

What am I doing wrong?

Edit: I tried umask with no result. I created the file magento_umask in <your Magento install dir>/magento_umask and placed inside 007, I also tried with `022. But still no luck.

I tryed giving permissions to apache group, and even adding the user with permissions to the apache group, but nothing worked.

Finally I've found somebody talking about SELinux modifying the permissions automatically, so I disabled the SELinux, and the everything worked.


texts: Undefined offset: 90 in /opt/lampp/htdocs/magento2_twp/vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 168 in magento 2?

texts: I am migrating my website from Magento 1.7 to Magento 2. In my backend , whenever i am trying to edit any product URL redirection , I am getting Undefined offset: 90 in /opt/lampp/htdocs/magento2_twp/vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 168


texts: Magento 2 export orders grid csv programmatically

texts:
I have been searching how to export the Orders csv that is found in Orders Grid, I have not found anything regarded to that.
This is the only file I have found about exporting orders to csv.
/var/www/html/emall_dev/vendor/magento/module-reports/Test/Unit/Controller/Adminhtml/Report/Customer/ExportOrdersCsvTest.php

But it's a test file, I don't know what Test folder means.
I need to create a cronjob to constantly export the order grid programmatically.
Thanks!


texts: Hide or Change specific banner for signed in users

texts: We have a banner on our homepage that is saying "BECOME A MEMBER TODAY". We want to hide this banner or have it changed to a different banner when customers are signed in. We are using magento 2 with porto theme. Any good suggestions?


texts: Where are media attributes/roles stored?

texts:
I was browsing through the DB, trying to find out where the media attributes of product-media-gallery-items are stored.
For clarification: They are called "Roles" in the Admin-Frontend and "mediaAttributes" when interacting with them in Code.
There is the catalog_product_entity_media_gallery table that holds all pictures and then there is the catalog_product_entity_media_gallery_value table that holds information about the pictures, such as in which store-views they are placed and their position, but I wasn't able to figure out where those "Roles" are kept.


texts:
My store gets very slow when needs to recalculate subtotal cart price.
There is a product qty limit for cart?
My memory in server, doesn't use 20%.
My scenary in print.


texts:
In M1 it was possible to add some lines to config.xml to force secure urls for certain pages ...
<?xml version="1.0"?>
<config>
    ...
    <frontend>
        ...
        <secure_url>
            <cms_newsletter>/newsletter</cms_newsletter>
            <sendfriend_product>/sendfriend/product</sendfriend_product>
        </secure_url>
    ...

What is the equivalent in Magento2?


texts: Magento 2 - How to create invoice using custom rest API?

texts:
I am trying to create invoice using customer token. But getting following error.

No such entity with orderId = 31

This error is generated after execution of following code.

$transactionSave = $this->_transaction->addObject(
                    $invoice
                )->addObject(
                    $order
                );
$transactionSave->save(); //This statement causes error

How to resolve this issue?


texts:
This is on an (almost) fresh Magento EE 1.13.02 installation. I have only one custom module, which I disabled, however the error still occurs.

The issue happens in System -> Permissions -> Roles -> Click role to edit (/admin/permissions_role/editrole/rid/1/), and started happening since I added a second role.

After checking for a bit, I found the following blocks that were included, that contain the offending code:

// Mage_Adminhtml_Block_Api_Role_Grid_User
protected function _prepareCollection()
{
    $roleId = $this->getRequest()->getParam('rid');
    Mage::register('RID', $roleId);
    // more code

And

// Mage_Adminhtml_Block_Permissions_Role_Grid_User
protected function _prepareCollection()
{
    $roleId = $this->getRequest()->getParam('rid');
    Mage::register('RID', $roleId);
    // more code

These 2 blocks are almost identical, and both are included, causing the error in the title.

Does anyone know why this is happening ? A fix would be to move one of these files in local and perform a check for RID, but it's a very nasty sollution, so is there a better fix?

Extra: I do not have the module Enhanced Admin Grids


texts: Magento 2 Filter product collection by only stock in products

texts: In Magento 2 how can we get a collection of products with only products that are in stock. Please help


texts: Add an image attribute in Magento product admin

texts:
This feels like it should be really simple - but I can't seem to find the answer. I would like to add an attribute in magento where the user can upload an image.

I do not want this to appear as a thumbnail image (which seems to happen by default if it's placed in the 'images' section of the product management panel.

Can this be done and how? I've tried adding a 'media image' attribute but it does not show in the admin panel.

Any ideas on how this can be achieved?


texts: How reindexing process is works in Magento 2?

texts:
If i have 1 lakh product in my store and i have re-index in Magento 2.
If i changed a product price so it is required to re-index in magento 2 to see the updated price.
And if it is required to re-index then Magento will re-index all the product from starting or just re-index the updated one.
Any help is appreciated.


texts: Magento 1 to 2 data migration error - cannot be null

texts:
I'm trying to migrate a Magento store from 1.8.1 to 2.3 using the Magento migration tool. I'm getting an error as follows:

  [2019-03-05 09:59:43][INFO][mode: data][stage: data migration][step:
  Map Step]: started 29% [========>-------------------] Remaining Time:
  40 secs In Mysql.php line 173:

  SQLSTATE[23000]: Integrity constraint violation: 1048 Column
  'added_at' cannot be null

There doesn't seem to be a lot of information to help find what the cause is. Has anyone else come across this or can someone suggest how to work out where to look and sort it out? Thanks


texts:
In Magento 2, How to config mail sending ? I used the gmail host to test. I set below but I try use feature forgot password on front-end and then I can't see email in client's mail box.

View "forgot password"


texts: Proper workflow to translate / work on csv files

texts:
We are developing our magento store with 3 languages with a bunch of customized modules. And the current translation workflow is slowing our project.

The current workflow is: Open each csv file with PHP's IDE and translate line-by-line. Therefore, things became more difficult while lines don't have the same length and the double-quote " is sometime skipped on editing.

We'd like to know the better way to translate magento, or a software which could help opening csv files in 2 columns and saving as csv format: separated by comma with " as text qualifier.

We tried Microsoft Excel but it messed up the files (it sometime can't specify correct , and  "). We tried Aegisub but it seems like it's not the good tool for csv files.

Thanks


texts:
I have created an extension that creates a category attribute when installed first time. But now when I disable/Uninstall the extension, I get an error message on "Manage Categories" page.

I know that when an Extension is disabled via Magento connect, only files are deleted and nothing is deleted from database.

So, In order to overcome this problem can we provide a button to delete database entries that can be placed under system configuration section along with other setting of extension. And when admin clicks on that button all database entries should be deleted along with files used by extension.

Please let me know if above solution will work? or is there any better solution in order to delete unwanted entries from database while uninstalling extension.


texts:
I have created catalog price rule of 10% for a group of login customer and applied it. It was working properly suddenly after two days there wasn't any discount on frontend. After that I reapplied it and again after 2-3 days it again reverted to same price.There aren't any other rules there.

So can anybody tell me what kind of problem is that ?


texts:
I want to configure the search to search for a SKU of a custom option.

I got different products with custom options and a related SKU. I want to get it working, that a customer can search for the SKU of a custom option, but it's not generally implemented in magento 2 and it's not set as an attribute so I can change it in the attributes to search for that particular sku.

Does somebody know how to do this to get that custom option SKU to index with the MYSQL search.

Regards


texts: Coupon Label Does not Show if discount 0%

texts:
I want a way of adding a coupon code that is basically just an identifier for a promotion e.g. Free Gift Wrapping or a free product give away.

I do not want to go the route of having to have the customer add a product to the basket however and thought it would just be simpler to have a 0% coupon code. This applied however no label shows at checkout or within transaction emails.

The email order items seems to use the block Magento\Sales\Block\Order\Totals to check if there is a discount with below code:

    /**
     * Add discount
     */
    if ((double)$this->getSource()->getDiscountAmount()) {
        if ($this->getSource()->getDiscountDescription()) {
            $discountLabel = __('Discount (%1)', $source->getDiscountDescription());
        } else {
            $discountLabel = __('Discount');
        }
        $this->_totals['discount'] = new \Magento\Framework\DataObject(
            [
                'code' => 'discount',
                'field' => 'discount_amount',
                'value' => $source->getDiscountAmount(),
                'label' => $discountLabel,
            ]
        );
    }

So i want to change this to not check if 0 but to check if a coupon code was applied instead regardless of the discount.

How can I have these coupon labels show even if there is no discount?


texts: How to check if a module is enabled/disabled in magento 2

texts:
I have 2 stores views and a custom module, lat say module X with an observerv.

public function execute(\Magento\Framework\Event\Observer $observer)
    {

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customerSession = $objectManager->get('Magento\Customer\Model\Session');

         $urlInterface = $objectManager->get('Magento\Framework\UrlInterface');

        //check if the crrent url not belong to the clubshop
        if($urlInterface->getCurrentUrl() =='https://www.storeview1.com/'){
            return true;
        }
        if(!strpos($urlInterface->getCurrentUrl(), "club_login" )){

            if($customerSession->getMyValue()==1){
                return true;

            }else{

            //redirect if sotreview 2
             $url = $urlInterface->getUrl('club_login');
                 $observer->getControllerAction()
                            ->getResponse()
                            ->setRedirect($url);
                            return false;
            }

        }

    }

For storeview no 1. this module in disabled(Storev-Config-Developer-Advanced) and for storeview no 2 this module is enabled.

Even the module is disabled on sotreview no 1, the observer still work on both stores and it redirect me.

What i tried to do, is to check if the module x is or no enabled on the storeview no 1, to avoid the extecution of this function.

Does anyone know how to do that?


texts:
I have created an XML-RPC User and I've assigned a role (with all resources) from admin panel: System/Web Services/XML-Rpc Users and Roles.

Now I want to dump all cart products and send them to an external server.

I'm using this code in app/design/frontend/default/theme/template/catalog/product/view.phtml:

$client = new Zend_XmlRpc_Client('http://mysite/api/xmlrpc/', 80);
$session = $client->call('login', array('myuser', 'myapi'));
$filterData = array('type' => array('in' => 'simple'));
$product = $client->call('call', array($session, 'category_product.list', array($filterData)));
var_dump($product);
$server = new Zend_XmlRpc_Client('/xmlServer.php','www.server-site.com', 80);
$result = $server->send($product);

The problem is that I receive this error:

Fatal error: Call to a member function getUri() on a non-object in /var/www/html/zzz/lib/Zend/XmlRpc/Client.php on line 265

This is the code from line 265:

if($http->getUri() === null) {
        $http->setUri($this->_serverAddress);
    }

I think that the problem comes from here:

$session = $client->call('login', array('myuser', 'myapi'));

But the user and api are valid. So I don't know what could it be.
What is wrong in my code?

Anticipated thanks!


texts:
Initially it looked very simple to me but now i realize that it is little more complicated then i thought it would be.

I am working on marketplace website. Where the system will have buyers as well as sellers. However, the experience is going to be seamless for buyer they will see all the product under same Quote/Order. However there will be an extra attribute with each order item for seller information.

Now, my question is moreover along the line of order creation, If we want to provide a unified view for all the product from different sellers to buyer but at the same time sellers will see only their products under the order.

My first approach was to split the order before user is redirected for payment. which i think is wrong approach because of two main reasons:

I think it's very wrong experience for buyers, as they will need to
understand why the order gets split into multiple suborders.
Also, the way payment gateways work is, it gets the information from session
order object. Which in this case captures only first order and ignores all other and so partial payment is received at our end.

Second obvious approach is to not split it, In this case Magento also provide way to split the invoice and shipping but I see a problem here when i want to show seller about their order.

To show seller their order If i have two sellers SellerA and SellerB in my shop I am showing the order to both the sellers but with condition to show only their order item under their Dashboard and same i need to do when I want to inform sellers about new order via email.

but I feel this isn't right approach as this will require changes everywhere i need to display their order information to sellers and do total calculation accordingly. There should be a better way to do it.

Any suggestion on what is the optimal or at-least better way to achieve this?


texts: External css for specific cms block not cms page

texts: I have created custom theme which is inherit from blank theme, How to add external css for specific cms block in Custom theme?


texts: On the store view frontend, how would I be best to go about hiding/showing an element based upon an inputs value? I've been considering an attempt to extend collapsible.js, but am not sure if this is the right idea.


texts: Custom stock status considering the quantity

texts:
Magento 1.9.2 Problem.
I have the code below to show me custom text depending if a product is out of stock.
The thing i want to do is to get all products in stock and if the quantity is 0 or below to get my custom text

<?php if ($this->displayProductStockStatus()): ?>
<?php if ($_product->isAvailable()): ?>

<?php echo $this->__('Availability:') ?> <?php echo $this->__('In stock') ?>

<?php else: ?>

<?php echo $this->__('Availability:') ?> <?php echo $_product->getData('customstock'); ?>

<?php endif; ?>


texts: In magento 2 How to import image from ftp server having restricted access

texts:
The ftp can be accessed only through credentials can Iget images from that ftp for magento.
Is that Possible?


texts: How Can I Print Out a Customer-Supplied Gift Message as a Separate Document or Additional Page of Packing Slip, etc?

texts:
I'v found a few "tutorials" but I just don't "get" how/where they're doing most of the coding well enough to make it work. (e.g. http://inchoo.net/magento/add-gift-message-to-magentos-pdf-packingslip/)

Found this: https://stackoverflow.com/questions/1795725/zend-pdf-word-wrapping
but haven't much luck getting it to work. (Actually not sure what to do with this code/where to put it all and have it be available, etc.)

I'm thinking that adding another page to the packing slip or pick slip might work and then including the From/To/Message stuff on that page with some artwork, maybe a fancy font or whatnot will be sufficient. Then, the "extra" page could be slipped into the box by whoever is picking the order.

Not sure at all how to "hack" the packing slip to add a page break and how to work the Zend PDF stuff at all. Any help would be appreciated.


texts: Magento2: Community edition Vs Enterprise edition

texts: I see Magento 2.0 Community edition and  2.0 Enterprise edition is launched. What's the difference between them on functionality level ?


texts:
I followed this answer to enable JS bundling with success - Magento 2 Advanced Js Bundling. However when I go to checkout, I get JS errors in console. When in developer mode everything is ok. Even in production mode without the bundling.

The error is

Uncaught TypeError: quote.getDeliveryBranchId is not a function

I have a custom component in my module js/view/checkout/shipping/form.js with this code snippet

define([
    'jquery',
    'ko',
    'uiComponent',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/model/shipping-service',
    'mage/translate',
    'Magento_Checkout/js/model/shipping-rate-registry'
], function ($, ko, Component, quote, shippingService, t, rateRegistry) {
    initObservable: function () {
        this.selectedId = ko.computed(function() {
                return quote.getDeliveryBranchId();
            }, this);
    }
})

and quote-mixin in the same module js/model/quote-mixin.js with this snippet

    define(['ko'], function (ko) {
    'use strict';

    return function (source) {

        source.isPackstation = ko.observable(false);

        source.getDeliveryBranchId = function()
        {
            if(typeof window.checkoutConfig.quoteData.extension_attributes.delivery_branch_id !== 'undefined') {
                return window.checkoutConfig.quoteData.extension_attributes.delivery_branch_id;
            }
            return '';
        };
        return source;
    };
});

In both of the files, there are more methods, but I included only these important ones.

In build.js under bundles/shared I have these 3 lines of dependencies

"[AnotherMyModule]/js/model/quote-mixin",
"Magento_Checkout/js/model/quote",
"[MyModule_with_code_sample_above]/js/model/quote-mixin",

Content of this build.js was autogenerated using m2-devtools and I just copied it.

I can see all the files in the chrome dev tool in the sources section. Also, I can see the content of all those mixins in shared.js. However if I set up a breakpoint in those files they seem not to be called at all, while other mixins (like billing-address) are called when I set up a breakpoint.

My question is. Is there any particular order these mixins have to be included in the build.js or can someone point me (explain to me how the bundling works) to the solution?

EDIT
After some javascript debugging it seems to be the problem of javascript loading order. First Magento loads require.js, then shared.js, checkout-index-index.js and mixins.js. Mixins.js is the reason why when using define() it ends up using the function in require.js (because mixin.js is not loaded yet).

So my question is. How do I tell magento to change the order of javascript loading? I want it to be

require.js,
mixins.js,
(maybe requirejs-config.js here),
shared.js,
checkout-index-index.js,
any other javascript

I noticed that in developer mode (where there are no bundles), the order is

require.js,
mixins.js,
requirejs-config.js

EDIT2
I managed to change the order of the javascript files, but it wasn't the case. The problem is that mixin module is not fully required in the browser when all the other modules (in shared.js) are being defined and therefore it uses the define method in require.js instead of the redefined method in mixins.js.

When I set up some breakpoints in require.js, everything was ok, because until the execution went all the way to quote-mixin, the original mixin.js was fully required.

So now the question is how to force browser to fully load mixin.js before defining other modules?

Something like

define('quote-mixin', ['mixins', 'other-dependency'], function(mixins, otherDependency) {
...
})

Whoever answers this question, is my hero.


texts: While saving product throws "Unable to save Stock Item" exception in magento 2.2.6

texts:
While saving product in backend,throws "Unable to save Stock Item".

I have tried after flushed the cache and reindexing but still exception throws.

I have reffered below link, but no luck

https://community.magento.com/t5/Magento-2-x-Technical-Issues/Cannot-add-products-in-Magento-2-1-11-quot-Unable-to-save-Stock/td-p/108369

In exception log throws

  [2019-04-09 11:04:50] main.CRITICAL: Unable to save Stock Item
  {"exception":"[object]
  (Magento\Framework\Exception\CouldNotSaveException(code: 0): Unable
  to save Stock Item at
  /var/www/html/vega/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:183,
  Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity
  constraint violation: 1452 Cannot add or update a child row: a foreign
  key constraint fails (vega.cataloginventory_stock_item, CONSTRAINT
  CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID FOREIGN KEY
  (stock_id) REFERENCES cataloginventory_stock (stock_id) ON
  DELETE CASCADE), query was: INSERT INTO cataloginventory_stock_item
  (product_id, stock_id, qty, min_qty, use_config_min_qty,
  is_qty_decimal, backorders, use_config_backorders,
  min_sale_qty, use_config_min_sale_qty, max_sale_qty,
  use_config_max_sale_qty, is_in_stock, low_stock_date,
  notify_stock_qty, use_config_notify_stock_qty, manage_stock,
  use_config_manage_stock, stock_status_changed_auto,
  use_config_qty_increments, qty_increments,
  use_config_enable_qty_inc, enable_qty_increments,
  is_decimal_divided, website_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) at
  /var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235,
  PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint
  violation: 1452 Cannot add or update a child row: a foreign key
  constraint fails (vega.cataloginventory_stock_item, CONSTRAINT
  CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID FOREIGN KEY
  (stock_id) REFERENCES cataloginventory_stock (stock_id) ON
  DELETE CASCADE) at
  /var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"}
  []


texts:
I have a theme installed but i wanted the Send inquiry form in New tab.
I am unable to figure out how i can do it. Looked in all the layout and catlog files.

There is a inquiry.xml with code below.

<?xml version="1.0"?> <layout version="0.1.0">
    <!--
    Product view
    -->
    <catalog_product_view>
        <reference name="product.info">
            <block type="inquiry/inquiry" name="product.inquiry" as="inquiry" template="inquiry/form/inquiry.phtml" after="reviews">
                <action method="addToParentGroup">
                    <group>detailed_info</group>
                </action>
                <action method="setTitle" translate="value">

                </action>
            </block>
        </reference>
    </catalog_product_view> </layout>

How should i create a new tab view page.
http://www.omegakart.com/security-solutions/cctv-camera/test-camera2.html#.VXRFAc-qqkr


texts: I enabling amazon payments module and if I enable this module shipping cost and tax are not displaying at the one step checkout page in magento2.2.4?

texts: I enabling amazon payments module and if I enable this module shipping cost and tax are not displaying at the one step checkout page. Could you please help me?


texts: Magento 2 API, searchCriteria usage on orders

texts:
I'm trying to retrieve recent orders from Magento 2.3.5, via REST API. I use this command:
curl -X GET "https://my_magento_site/index.php/rest/V1/orders/search?searchCriteria[filter_groups][0][filters][0][field]=created_at&searchCriteria[filter_groups][0][filters][0][value]=2021-01-01&searchCriteria[filter_groups][0][filters][0][condition_type]=gt" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-type: application/json" -g -o C:\orders.json

What I get is this error in my orders.json:
{"message":"The \"search\" value's type is invalid. The \"int\" type was expected. Verify and try again."}

I'm pretty sure REST API is working fine and authentication is OK. If I simply replace "orders" with "customers" in the above command, I get all recently added customers. Also issuing:
curl -X GET "https://my_magento_site/index.php/rest/V1/orders/1" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-type: application/json" -g -o C:\orders.json

returns my order "1" details.
What may be the problem ?


texts: I want to show all usernames and ids in drop-down

texts:
I want to show all usernames and user ids in a drop-down.
Please find my issue, where did I make a  mistake?
Here's my code:

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

namespace Learning\ClothingMaterial\Model\Attribute\Source;

class Material extends
\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
{
    /**
     * Get all options
     * @return array
     */
    public function getAllOptions()
    {
        $roleName = "merchant";
        $objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
        $roleModel = $objectManager->create('Magento\Authorization\Model\Role');
        $userModel = $objectManager->create('Magento\User\Model\User');
        $roleModel = $roleModel->load($roleName, 'role_name');
        if($roleModel->getId()) {
            $userIds = $roleModel->getRoleUsers();

            foreach($userIds as $userId) {
                $user = $userModel->load($userId);

                $usernames = $user->getUsername();
                $userid = $user->getId();

                print_r($user->getUsername());
                print_r($user->getId());
                echo "<br>";

                if (!$this->_options) {
                    $this->_options = [
                        ['label' => __($userid - $usernames), 'value' => $userid.$usernames],
                    ];
                }

            }
        }

        return $this->_options;
    }
}


texts: how to check all index of table using javavscript in magento

texts:
i have created a table in magento with two column id and zip_code. but only [0] index value is fetching. how to fetch value of all index. i am using this code

    <script language="javascript" type="text/javascript">

    function custom_save(){

         zipcode = document.getElementById('billing:postcode').value;
         //alert(zipcode);
        if (zipcode == <?php echo $cus_zip_code[0]['zip_code']; ?>) {
             //alert('We will deliver within 2-3 days');
             document.getElementById('d').innerHTML = 'We will deliver within 2-3 days!';
             billing.save();
        } else {
            //alert('We will deliver after 10 days');
            document.getElementById('d').innerHTML = 'We will deliver after 10 days!';
            billing.save();
        }
    }
    </script>
<?php
        $connection = Mage::getModel('core/resource')->getConnection('core_read');
        $sql = 'SELECT * FROM `custom_zip_code`';
        $cus_zip_code = $connection->fetchAll($sql);
        //print_r($cus_zip_code);
        foreach($cus_zip_code as $zipvalue){

        $cust_zip = $zipvalue['zip_code'];
        //echo '<pre>';
        //print_r($cust_zip);
        }

?>


texts: Passing Configurable Product ID to universal analytics on the success page

texts:
I'm using Daniel Yovchev's solution here to implement Universal Analytics:

https://stackoverflow.com/questions/22229312/universal-analytics-could-not-track-transaction-in-magento?answertab=active#tab-top

The Current Code:

protected function _getOrdersTrackingCode()
{
    $orderIds = $this->getOrderIds();
    if (empty($orderIds) || !is_array($orderIds)) {
        return;
    }
    $collection = Mage::getResourceModel('sales/order_collection')
        ->addFieldToFilter('entity_id', array('in' => $orderIds))
    ;
    $result = array("
        // Transaction code...
        ga('require', 'ecommerce', 'ecommerce.js');
    ");

    foreach ($collection as $order) {
        if ($order->getIsVirtual()) {
            $address = $order->getBillingAddress();
        } else {
            $address = $order->getShippingAddress();
        }

        $result[] = "
            ga('ecommerce:addTransaction', {
                id:          '".$order->getIncrementId()."', // Transaction ID
                affiliation: '".$this->jsQuoteEscape(Mage::app()->getStore()->getFrontendName())."', // Affiliation or store name
                revenue:     '".$order->getBaseGrandTotal()."', // Grand Total
                shipping:    '".$order->getBaseShippingAmount()."', // Shipping cost
                tax:         '".$order->getBaseTaxAmount()."', // Tax

            });
        ";

        foreach ($order->getAllVisibleItems() as $item) {

            $result[] = "
            ga('ecommerce:addItem', {

                id:       '".$order->getIncrementId()."', // Transaction ID.
                sku:      '".$this->jsQuoteEscape($item->getSku())."', // SKU/code.
                name:     '".$this->jsQuoteEscape($item->getName())."', // Product name.
                category: '', // Category or variation. there is no 'category' defined for the order item
                price:    '".$item->getBasePrice()."', // Unit price.
                quantity: '".$item->getQtyOrdered()."' // Quantity.

            });
        ";

        }
        $result[] = "ga('ecommerce:send');";
    }
    return implode("\n", $result);
}

The problem I have is that this returns the simple sku, and I need it to return the configurable to be of any benefit to us.  How can I modify this:

           sku:      '".$this->jsQuoteEscape($item->getSku())."', // SKU/code.

to serve this purpose?

Thanks ahead of time for the assistance!


texts: I want to create reusable css components/elements. For instance, when I create a new page with some elements like button, tooltip, list, breadcrumbs or any other element I want to be able to call one component css class and style that element. I know this is hard to achieve in M1 because of its structure and that is the reason I am asking it here. Google search for query "magento 1 css components" returns no results and that is one more reason to post this here. It seems unbelievable to me that no one ever try to "componentise" css elements in M1. Thanks in advance.


texts: magento 2: addErrorMessage() stripping html tags from message

texts:
I am trying to add the following error message for a custom integration:

"This email address is already associated with an account.
Please log in here."

However addErrorMessage() strips tags, preventing the anchor to appear.  I can resolve this problem by using addError() but addError is deprecated and not the solution I am looking for.

Anyone know if there is another function or argument that can be used to define something like strip_tags = false when setting error messages?

v2.1.7


texts: Google ReCaptcha is not validating: Magento 2.2.9

texts: I´ve got the Google ReCaptcha extension from Mageplaza and got the v2 keys. The extension is enabled and it is displayed on the forms accurately, but neither visible nor invisible is validating. The form can be submitted and the reCaptcha is not validating.


texts: How to show both at same time Upsell and Related Products In Product View Page Magento 2

texts:
I want to show Related and Upsell both at the same time in my product view page.

I tried to change catalog_product_view.xml many times, but it displays me only upsell products not related.

anyone, please help


texts: As Magento removed many Zend functions in v2.3, is there a way to use Zend_Debug::dump() by potentially manually installing the missing composer module?


texts: Braintree Virtual Terminal Backend User Role

texts: How can I enable the Braintree Virtual Terminal that is under the Sales tab in the backend?  I only see it for a user role that has access to everything. There needs to be an option after Transactions in the resource section.


texts:
I am pretty sure there has to be a simple way to solve, but I just cannot find it.

So, by default, there are 2 types of product rules at my store:

mystore.com/catalog/product/view/id/177
mystore.com/very-nice-product

The problem is that visitors (and robots) can access both versions and see it as duplicate content.

The solution would be to redirect (better yet remove completely) the first URL: mystore.com/catalog/product/view/id/177

Any help or guidance is much appreciated.


texts: Magento Configurable Product Export, Multiple Super Attribute Error Fix

texts:
There is a known issue affecting both the Magento Community and Enterprise Edition export system.

The issue is with the core Import/Export functionality found in System > Import/Export > Export menu item in the Magento backend.

If you have configurable products that are configurable by only 1 attribute, you won't experience difficulities. However, if you have a configurable product with multiple configurable attributes (i.e. a T-Shirt configurable by both size and color) then you will notice that your export file only contains data about one configurable attribute. This data can be found in the _super_attribute_code and _super_attribute_option columns. As in the case of my T-Shirt example, these columns would only contain data about the size attribute options, and nothing about color.

To fix this issue we must override one of Magento's core class files, at least until they come out with a newer patched version. We never touch core Magento files, so what we are going to do is replicate this file in the local code pool and make our changes there.
From your root Magento install directory, copy the file

  app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable.php

to

  app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable.php

Now, open up the Configurable.php file you just copied to the local code pool and navigate to line 223. This line should read

  $attributesOptionsData[$superAttribute->getAttributeId()] =
  $this->_getReadAdapter()->fetchAssoc($select);

You need to change this line to read

  $attributesOptionsData[$superAttribute->getAttributeId()] =
  $this->_getReadAdapter()->fetchAll($select);

Now, clear your cache and try the export again. You should see all your configurable attribute data in the file now. And now, my T-Shirts have both the size and color attribute associations in the export file. Once Magento fixes this issue in a later release, just remember to delete your local copy of Configurable.php.

Refer Source: http://razoyo.com/main/?q=blog/magento-17-configurable-product-export-fix


texts: Magento 1.9 Custom model - Fatal error on Mage::getModel -> getCollection()

texts:
I am getting fatal error while retrieving data from table by custom module.
I have the following in config.xml file.

<config>
....
<models>
            <ebayaff>
                <class>Ddevs_Ebayaff_Model</class>
            </ebayaff>
            <ebayaffms>
            <class>Ddevs_Ebayaff_Model_Mysql4</class>
            <entities>
            <ddvescore>

ddevs_core

              </ddvescore>
            </entities>
            </ebayaffms>

        </models>
...
</config>

  In app\code\local\Ddevs\Ebayaff\Model\Ddvescore.php

<?php
    class Ddevs_Ebayaff_Model_Ddvescore extends Mage_Core_Model_Abstract
    {

        public function _construct(){
             parent::_construct();
            $this->_init("ebayaffms/ddvescore");
        }

    }

  In app\code\local\Ddevs\Ebayaff\Model\Mysql4\Ddvescore.php

<?php
    class Ddevs_Ebayaff_Model_Mysql4_Ddvescore extends Mage_Core_Model_Mysql4_Abstract
    {

        public function _construct(){
            $this->_init("ebayaffms/ddvescore", "id");
        }
 }

  In app\code\local\Ddevs\Ebayaff\Model\Mysql4\Ddvescore\Collection.php

<?php
    class Ddevs_Ebayaff_Model_Mysql4_Ddvescore_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
    {

        public function _construct(){
            parent::_construct();
            $this->_init("ebayaffms/ddvescore");
        }
    }

While trying to retrieve the collection from table, by the following code..

$collections = Mage::getModel('ebayaff/ddvescore')->getCollection();

I am getting the following error

Fatal error: Call to undefined method Ddevs_Ebayaff_Model_Mysql4_Ddvescore::getCollection() in /var/www/html/....


texts:
I'm planning to do a website that opens directly on the cart page, in the cart it needs to have some products already selected and it should be ready to go to the checkout page.

What I need to do is to add, every time the user goes to the page, some products.

The thing is I've already done it one time, but it was 3/4 months ago and now I can't remember anything about it. The only thing I remember is that I've changed in dashboard->catalog->url rewrite management and there I've put the rule to redirect the homepage on this link

http://WEBSITE/index.php/checkout/cart/add?product=1&related_product=2

And on the test website it works well, I have the cart section with product 1 and 2 visible

Now I'm trying to do this step on the "official" website but every time I try to access the website I have the cart section and it tells me "No products in your cart"

So I'm thinking that I need to put the form_key somewhere but I can't find anything about it

for both the website I have Magento 1.9


texts: How to stop dummy customer registrations in Magento 1.9.3.3?

texts: Need To Stop Dummy email address registration.


texts:
I created one module for bank transfer which will collect data from customer. This is working fine when i placed an order. But when i edit an order from admin and try to add comments to order then it is giving below error message.

1 exception(s):
Exception #0 (Magento\Framework\Webapi\Exception): Request does not match any route.

Exception #0 (Magento\Framework\Webapi\Exception): Request does not match any route.
#0 /var/www/html/b2b/vendor/magento/module-webapi/Controller/Rest/RequestValidator.php(83): Magento\Webapi\Controller\Rest\Router->match(Object(Magento\Framework\Webapi\Rest\Request))
#1 /var/www/html/b2b/vendor/magento/module-webapi/Controller/Rest/RequestValidator.php(68): Magento\Webapi\Controller\Rest\RequestValidator->checkPermissions()
#2 /var/www/html/b2b/vendor/magento/module-webapi/Controller/Rest/InputParamsResolver.php(86): Magento\Webapi\Controller\Rest\RequestValidator->validate()
#3 /var/www/html/b2b/app/code/Ibnab/Additional/Observer/SaveBankInfoToOrderObserver.php(21): Magento\Webapi\Controller\Rest\InputParamsResolver->resolve()

Here is the complete code of my observer .

<?php
namespace Ibnab\Additional\Observer;
use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Event\ObserverInterface;
use Magento\OfflinePayments\Model\Banktransfer;
class SaveBankInfoToOrderObserver implements ObserverInterface {

    protected $_inputParamsResolver;
    protected $_quoteRepository;
    protected $logger;
    protected $_state;

    public function __construct(\Magento\Webapi\Controller\Rest\InputParamsResolver $inputParamsResolver, \Magento\Quote\Model\QuoteRepository $quoteRepository, \Psr\Log\LoggerInterface $logger,\Magento\Framework\App\State $state) {
        $this->_inputParamsResolver = $inputParamsResolver;
        $this->_quoteRepository = $quoteRepository;
        $this->logger = $logger;
        $this->_state = $state;
    }

    public function execute(EventObserver $observer) {
        $inputParams = $this->_inputParamsResolver->resolve();
        if($this->_state->getAreaCode() != \Magento\Framework\App\Area::AREA_ADMINHTML){
        foreach ($inputParams as $inputParam) {
            if ($inputParam instanceof \Magento\Quote\Model\Quote\Payment) {
                $paymentData = $inputParam->getData('additional_data');
                $paymentOrder = $observer->getEvent()->getPayment();
                $order = $paymentOrder->getOrder();
                $quote = $this->_quoteRepository->get($order->getQuoteId());
                $paymentQuote = $quote->getPayment();
                $method = $paymentQuote->getMethodInstance()->getCode();

                if ($method == Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE) {
                    if(isset($paymentData['bankowner'])){
                    $paymentQuote->setData('bankowner', $paymentData['bankowner']);
                    $paymentOrder->setData('bankowner', $paymentData['bankowner']);
                    }
                    if(isset($paymentData['banknumber'])){
                    $paymentQuote->setData('banknumber', $paymentData['banknumber']);
                    $paymentOrder->setData('banknumber', $paymentData['banknumber']);
                    }
                    if(isset($paymentData['banktransid'])){
                    $paymentQuote->setData('banktransid', $paymentData['banktransid']);
                    $paymentOrder->setData('banktransid', $paymentData['banktransid']);
                    }
                    if(isset($paymentData['bankname'])){
                    $paymentQuote->setData('bankname', $paymentData['bankname']);
                    $paymentOrder->setData('bankname', $paymentData['bankname']);
                    }
                }
            }
        }

       // print_r($paymentQuote);exit;
       }
    }
}

Can any one help me on how to resolve this error?


texts: Products show only in admin when adding via Magento 1.9 Custom Wishlist SOAP API

texts:
Requirement: I am a newbie in magento trying to make a custom SOAP API in Magento 1.9 for managing wishlist. I need to connect it to an android application being developed in ionic V1.
At first i tried to use this extension magento-api but could not find a way to maintain session information in android. So, i moved to developing my own API.
I am able to fetch wishlist information(wishlist_id, items etc) and add to it.
 Issue: But after adding a product in the wishlist via soap call, it is only shown in the admin area for the customer and not on the front-end of the website(User is logged in). Only products added from front-end(browser) are shown on front-end wishlist page.
After comparing the functionality from the front-end(/app/code/core/Mage/Wishlist/controllers/IndexController.php) with my Api.php(shown below) seems like my $buyRequest variable is missing some 'form-key' but i do not understand magento too much to understand this.

I have added the Api.php at /app/code/core/Mage/Wishlist/ModelApi.php.

My code to add product to wishlist is as follows:

public function create($customer_id, $product_id, $store = null){
    $return_result = array(
        'code' => 0,
        'msg' => null,
        'model' => null,
        'customer_id' => $customer_id,
        'product_id' => $product_id
    );
    $buyRequest = new Varien_Object(array());
    $params = array('product' => $product_id,
            'qty' => 1,
            'store_id' => $store,
            );
    $buyRequest->setData($params);

    $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer_id, true);
    $product = Mage::getModel('catalog/product')->load($product_id);
    $result = $wishlist->addNewItem($product, $buyRequest);

    Mage::helper('wishlist')->calculate();
    if($result){
        $return_result['msg'] = 'Product '.$product_id.' Added ';
        $return_result['model'] = $result;
    }
    return json_encode($return_result);
}

I used the following link to implement the add functionality and used some code in the from the /app/code/core/Mage/Wishlist/controllers/IndexController.php file: add catalog product in wishlist programmatically in magento

Any help would be appreciated.


texts: What is the role of the isDummy method in Magento

texts:
In the class/method \Mage_Sales_Model_Service_Order::prepareCreditmemo
There is this code

 /**
 * Prepare order creditmemo based on order items and requested params
 *
 * @param array $data
 * @return Mage_Sales_Model_Order_Creditmemo
 */
public function prepareCreditmemo($data = array())
{
    $totalQty = 0;
    $creditmemo = $this->_convertor->toCreditmemo($this->_order);
    $qtys = isset($data['qtys']) ? $data['qtys'] : array();
    $this->updateLocaleNumbers($qtys);

    foreach ($this->_order->getAllItems() as $orderItem) {
        if (!$this->_canRefundItem($orderItem, $qtys)) {
            continue;
        }

        $item = $this->_convertor->itemToCreditmemoItem($orderItem);
        if ($orderItem->isDummy()) {
            $qty = 1;
            $orderItem->setLockedDoShip(true);
        } else {
            if (isset($qtys[$orderItem->getId()])) {
                $qty = (float) $qtys[$orderItem->getId()];
            } elseif (!count($qtys)) {
                $qty = $orderItem->getQtyToRefund();
            } else {
                continue;
            }
        }
        $totalQty += $qty;
        $item->setQty($qty);
        $creditmemo->addItem($item);
    }
    $creditmemo->setTotalQty($totalQty);

    $this->_initCreditmemoData($creditmemo, $data);

    $creditmemo->collectTotals();
    return $creditmemo;
}

If the $orderItem->isDummy() is true the $qty is set to 1.

Can someone please explain the reason behind this logic?


texts:
I am trying to get attribute set in dropdown in my custom module.
I have override Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract class in my custom module.
There is one line, in the code which says

$value = (string) '#{' . $columnName . '}';

If I echo $value it displays me 10 as value but when I try to compare it in if condition

if($value == '10')

It returns false. I have tried using temp variable to store value for $value but without success. Please guide how to get value for $value in if condition.


texts:
I'm a pretty strong developer, but a total newbie to Magento and a friend has asked me to look into his Magento website being hacked.

We are using Magento 1.4.0.1.

Essentially, when the user finally clicked "Pay" at the end of filling out all their details, the browser would go, as normal, to:

[website]/paypal/standard/redirect/

But then this would ultimately redirect to a completely unknown PayPal account but with the right amount prepopulated to pay.

Looking at the PayPal configuration I was unable to reveal the configuration of the business email in the Website Payments Standard section of System -> Configuration -> PayPal as it was asterisked out, and the Website Payments Pro section was unpopulated.

I tried putting in the correct PayPal email address in the Standard section, but then the process would just error. So instead I got the API credentials and filled out the Pro section and then:

On the first attempt to make a payment the browser was redirected to an entirely new, incorrect and malicious PayPal email address
On all subsequent attempts, it appears to be going to the correct PayPal account

This worries me that perhaps some other malicious code is being run, and perhaps not on every transaction - although it may well have been some caching issue.

Other than changing all the site passwords, is there anywhere special I should look to check for PayPal hacks? I have inspected \app\code\core\Mage\Paypal\Model\Standard.php and found nothing suspect, but perhaps I am too new to Magento etc. to know where to really look.

Many thanks!


texts: Magento2 - Integrity constraint violation 1062 ALTER TABLE on setup:upgrade

texts:
Magento 2.3.5 Mariadb 10.2 PHP 7.2
We are hitting the constraint violation error below when running: php bin/magento setup:upgrade
catalog_product_entity_varchar ran out of space at 2147483647 so we increased the value_id int to Bigint.
We are able to edit and add products again. But now have the constraint error coming up when it reaches schema / update.
What is the best way to correct this, can we change the constraint rule?
SQLSTATE[23000]: Integrity constraint violation:
1062 ALTER TABLE causes auto_increment resequencing,
resulting in duplicate entry '2147483647' for key 'PRIMARY',
query was: ALTER TABLE catalog_product_entity_varchar MODIFY COLUMN
value_id int(11)  NOT NULL  AUTO_INCREMENT COMMENT "Value ID"
Thanks so much.


texts:
I am trying to get the client email from the sales_flat_order table but I am not getting this way

public function getOrderbyemail()
{
    $email = Mage::getModel('sales/order')->getCollection()
               ->addFieldToFilter('customer_email', $email);

    foreach ($email as $customer_email) {
        $customer_email = $email->getCustomerEmail();
        print_r($customer_email->getCustomerEmail());
    }
}


texts: Magento 2 - display html content in system.xml configuration

texts: i want to show some htmlContent in configuration. System.xml. how it could be?


texts: Magento 2.1.5 - Rest api media upload image not saving - Could not save the product

texts:
Working on Magento version - 2.1.5.

Hello Techies

I am working on magento 2 project and learning rest api .

I am trying to upload product image via rest api .

Url of rest api = http://127.0.0.1/megento2/index.php/rest/V1/products/{sku}/media.

Method i used POST as mention in magento 2 dev docs.

Below are the parameters :

[
  {
    "id": 0,
    "media_type": "test",
    "label": "test",
    "position": 0,
    "disabled": true,
    "types": [
      "thumbnail"
    ],
    "file": "test.png",
    "content": {
      "base64_encoded_data": "Here i have passed base64_encoded data of image",
      "type": "file/png",
      "name": "test.png"
    },
    }
  }
]

Not sure why but getting 400 Error and error message is like below :

  Product could not be saved

Your help will be appreciated .


texts:
Alright, I am just not getting my head around it.

Trying to save the only title of existing CMS Page from web API, but looks when I do that all other fields are gone null.

I am using postman:

PUT URL: http://www.example.com/rest/all/V1/cmsPage/19

Body content:

{"page":
    {
        "id":"19",
        "title": "My Title"
    }
}

This saves the title but also makes content and other fields empty.

Is there a way to save/update only title (or only one field)?


texts: like it says on the title, I want to 'customize' in a manner of speaking the reorder function that appears on the 'My Orders' section in the Customer Dashboard. What I have to do is to remove that link from that page and create a new 'sub menu' in the Dashboard (which I already have done) and list there only the last order and that's the one that will have the reorder function (this is a client's requirement). Is there any way to easily remove the 'reorder' link without tampering with Magento's core? I thought of creating a "preference" in the di.xml and do my own phtml without the link, but I think that there has to be a way to do it cleaner and more efficient, if so can anyone point me in the right direction? Also to only list the last order in the new section I created I thought of the same thing but I think that it wouldn't be efficient. Thanks in advance.


texts: My shopping cart works randomly when moving to different pages

texts:
I've spent hours and days trying to fix it but I can't figure out why when I move from one page to another my cart changes.
First of all I add a product to the cart. The cart updates itself and I can see that product on the cart. But when I click on home it switches to 0 products for no reason. A part from this, when switching to a category page it doesn't show 0 or 1 product, it shows me the products I added a couple days ago.
I have set the cookie management to 3600. I wonder if it is related to my .htaccess, which I took from internet to have a fast magento website. This is the piece of code from my .htaccess related to session:

<IfModule mod_php5.c>
    php_value memory_limit 512M
    php_value max_execution_time 18000
    php_flag magic_quotes_gpc off
    php_flag session.auto_start off
    php_flag suhosin.session.cryptua off
    php_flag zend.ze1_compatibility_mode Off
</IfModule>

It's interesting the fact that I've recently made another website with Magento 1.9.2 and same think happens. The only Magento where it works is a localhost copy, it's kinda frustrating.
Why is this happening?
EDIT:
This is what I have in my htaccess related to caching.

<ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
</ifModule>

And

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 weeks"
    ExpiresByType image/jpeg "access 1 weeks"
    ExpiresByType image/gif "access 1 weeks"
    ExpiresByType image/png "access 1 weeks"
    ExpiresByType text/css "access 1 weeks"
    ExpiresByType text/html "access 1 days"
    ExpiresByType application/pdf "access 2 days"
    ExpiresByType text/x-javascript "access 2 days"
    ExpiresByType application/x-shockwave-flash "access 2 days"
    ExpiresByType image/x-icon "access 2 days"
    ExpiresByType text/javascript "access 1 days"
    ExpiresByType application/x-javascript "access 1 days"
    ExpiresDefault "access plus 1 weeks"
</IfModule>


texts: Issue with Magento 2 generated sitemap.xml

texts:
I'm using Magento's built in sitemap generation tool and have it set to generated nightly. The issue I'm facing with it is that the urls in the sitemap do not match the ones found on the site.

To clarify, the urls I'm seeing in the sitemap match Magento's default url scheme; /catalog/category/view/id/4667 rather than the SEO friendly one's that look like /snow/fashion/outerwear.html.

Aside from the obvious SEO hit, this is also affecting our cache warmer that uses this sitemap to crawl the site since it is hitting and warming the wrong urls.

It is probably worthwhile to mention that both the links resolve to the same page, but I want the nice urls in the sitemap. Also this is happening for both products and categories.

Any ideas on what could be causing this would be appreciated!


texts: Category renders text when configurable products, product opens correct

texts:
I'm encountering a problem somewhat difficult to describe, Google and the forum seems empty in answers...

When opening a category containing configurable products, the category opens as text only with the following error:

  Fatal error: Class 'Magento\Cataloginventory\Model\Stock\Item' not found in /home/my/domains/url/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93

A product is displayed on the page as text, when clicked on the link to the product page => the product opens correct with the choices for the config options.

Recreating steps:

Category containing a configurable product:
http://www.fietsenwinkelonline.be/fietshelmen.html
When clicked on the product:
http://www.fietsenwinkelonline.be/test-fietsenwinkel-online-be.html

Creating configurable renders no error and handles perfect.

Any ideas where to look for the problem/source?

Thanks in advance!


texts: Output custom text attribute in catalog list.phtml (Magento 2)

texts:
I made a attribute set and custom text field attribute. Now I need the value of the attribute shown in list.phtml (catalog).

I tried without success:

Fail 1

<?php  echo $product->getAttributeText('catalog_description'); ?>

Fail 2

<?php echo $product->getAttributeText('catalog_description'); ?>

Fail 3

<?php $product->getAttributeText('catalog_description'); ?>

Fail 4

<?php echo $catalog_description; ?>


texts:
When order comes, there is no notification to see in default magento.
Need to get notification when orders come in magento2.1


texts: How to add custom field or attribute to customer's address and API and save it in magento2?

texts:
I have created my custom field and attribute, using following code and it is reflected in db.

$attributesInfo = [
            'state' => [
                'label' => 'State',
                'type' => 'static',
                'input' => 'text',
                'position' => 140,
                'visible' => true,
                'required' => false,
            ],
        ];

        $columns = [
                    'state' => [
                        'type' => Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                        'nullable' => false,
                        'LENGTH' =>255,
                        'comment' => 'State',
                    ],
                ];

        foreach ($attributesInfo as $attributeCode => $attributeParams) {
            $customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
        }

        $tableNames=['customer_address_entity','quote_address','sales_order_address'];

          // Declare data

        $connection = $setup->getConnection();
        foreach ($tableNames as $tableName) {
            foreach ($columns as $name => $definition) {
                $connection->addColumn($tableName, $name, $definition);
            }
        }

and i created my fieldset.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
    <scope id="global">
        <fieldset id="customer_address">
            <field name="state">
                <aspect name="create" />
                <aspect name="update" />
                <aspect name="to_quote_address" />
            </field>
        </fieldset>
        <fieldset id="sales_convert_order_address">
            <field name="state">
                <aspect name="to_quote_address" />
            </field>
        </fieldset>
        <fieldset id="sales_convert_quote_address">
            <field name="state">
                <aspect name="to_order_address" />
                <aspect name="to_customer_address" />
            </field>

        </fieldset>
        <fieldset id="sales_copy_order_billing_address">
            <field name="state">
                <aspect name="to_order" />
            </field>
        </fieldset>
        <fieldset id="order_address">
            <field name="state">
                <aspect name="to_customer_address" />
            </field>
        </fieldset>
    </scope>
</config>

and then i edited edit.phtml file and added my custom field state

but after i clicked save address  the data is not saving in db , do i need to do any thing extra to save the data in db ?


texts: Magento 2.4.1: One or more of your dotdigital cron tasks have errors: ddg_automation_customer_subscriber_guest_sync,

texts:
At the top of Magento admin page, below are the messages displayed. I'm not sure what these mean and how to fix them all. Please help me understand this.
One or more of your dotdigital cron tasks have errors: ddg_automation_customer_subscriber_guest_sync, ddg_automation_status, ddg_automation_reviews_and_wishlist, ddg_automation_catalog_sync, ddg_automation_importer, ddg_automation_campaign, ddg_automation_order_sync, ddg_automation_monitor, ddg_automation_abandonedcarts. Please go to Cron Tasks to review.


texts:
My Magento store uses the following code to view categories navigation on the side column:

<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php
    function cmpCatPosition($a, $b) {
        if ($a->position == $b->position)
            return 0;
        return ($a->position > $b->position) ? 1 : -1;
    }
    function getChildrenCategoriesHtml($_category){
        $children = explode( ",", $_category->getChildren() );
        //usort($children, 'cmpCatPosition');
        $content = '';
        $content .= '
';
        $content .= 'getUrl().'" ';
        $content .= '>'.$_category->getName().'';
        if($children[0]){
            $content .= '';
            $content .= '
';
            foreach($children as $child){
                $_subcat = Mage::getModel( 'catalog/category' )->load( $child );
                $content .= getChildrenCategoriesHtml($_subcat);
            }
            $content .= '
';
        }
        $content .= '
';
        return $content;
    }
?>
<?php if($_count): ?>

        <?php echo Mage::registry('current_category')->getName(); ?>

        <?php foreach ($_categories as $_category): ?>
            <?php
            if($_category->getIsActive()){
                echo getChildrenCategoriesHtml($_category);
            }
            ?>
        <?php endforeach ?>

<?php endif; ?>

This code only show the subcategories of the current category. How should I edit it, so that it would show all categories on every category page?


texts: Magento 2 - product image url without hash

texts:
The product image URL of a Magento 2 store is like:

  example.com/media/media/catalog/product/cache/8b8f1e61e783c045142bcb34d1e0b2a9/m/y/my-product-image.jpg

I would like to remove the “cache/8b8f1e61e783e783c045142bcb34d1e0b2a9/” from the URL, because I have a lot of 404 error in logs due to that.

As you know, each time the cache is cleaned and regenerated, the URL hash change and the search engines does not find the previews one.

Has anyone ever had this kind of situation before? Thanks in advance for your help


texts: Base table or view not found: 1146 after new extension install

texts:
I've installed a new extension using the steps below to ensure everything goes in  desired sequence

Ensured 'compilation' is disabled
Enabled cache
Copied all files
After that, did cache refresh
// Received  404 error on extension tab
Logged out & logged in to admin
Extension settings showed fine

But on front-end -- it's throwing an error & report shows the following

a:5:{i:0;s:217:"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.affiliateplus_account' doesn't exist

I've disabled the extension for now

How can I resolve this issue?
Any pointers?


texts: M2 | How to check extension attribute is working or not?

texts:
I created an extension attribute for customer as:

Vendor/Module/etc/extension_attributes.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
        <attribute code="expiring_balance" type="string" />
    </extension_attributes>
</config>

Vendor/Module/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">
    <type name="Magento\Customer\Api\CustomerRepositoryInterface">
        <plugin name="get_customer_expiring_balance" type="Vendor\Module\Plugin\CustomerPlugin" sortOrder="-1"/>
    </type>
</config>

Vendor/Module/Plugin

namespace Vendor\Module\Plugin;

use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
class CustomerPlugin
{
    /**
     * @var \Vendor\Module\Model\ResourceModel\Amount\CollectionFactory
     */
    protected $_creditFactory;

    public function __construct(
     \Vendor\Module\Model\ResourceModel\Amount\CollectionFactory $creditFactory,
     \Magento\Directory\Model\Currency $currency) {
        $this->_creditFactory = $creditFactory;
    }
   /**
     * Plugin after getById customer that obtains newsletter subscription status for given customer.
     *
     * @param CustomerRepositoryInterface $subject
     * @param CustomerInterface $customer
     * @return CustomerInterface
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function afterGetById(CustomerRepositoryInterface $subject, CustomerInterface $customer)
    {
        $extensionAttributes = $customer->getExtensionAttributes();
        if ($extensionAttributes === null) {
            /** @var CustomerExtensionInterface $extensionAttributes */
            $extensionAttributes = $this->extensionFactory->create(CustomerInterface::class);
            $customer->setExtensionAttributes($extensionAttributes);
        }
        if ($extensionAttributes->getExpiringBalance() === null) {

           $creditDetails = $this->_creditFactory->create()->setOrder('date_expires', 'asc');
           foreach ($creditDetails as $Card) {

           $renewAmount = $Card->getRedeemAmount() - $Card-
           $extensionAttributes->setExpiringBalance($renewAmount);
        }
        return $customer;
    }
}

I want to see if it is working or not, I am getting customer collection but I cannot see extension attribute here:


texts: How to resolve conflict when CMS page URL and controller rewrite URL are the same?

texts:
I have a page named stores and I have a following rewrite:

<global>
    <rewrite>
        <designer_url>
            <from><![CDATA[#^/stores/#]]></from>
            <to><![CDATA[/storescontroller/index/index/location/]]></to>
            <complete>1</complete>
        </designer_url>
    </rewrite>
</global>

So the idea is for http://mystore.com/stores to go to the cms page and for http://mystore.com/store/dallas/ to go to the controller. How can I resolve this conflict?

THanks in advance


texts:
When developing themes and modules for Magento 2 I came across a barrier, how can I debug better?
So I come here to ask, what are the best developer toolbars for Magento 2?


texts:
I created a custom layout to display only parent categories not subcategories. But I need custom css for that layout. I create custom_layout in Magento_Theme/page_layout folder and defined in layouts.xml. Which works fine. But how I add css to that custom layout.
My custom layout is

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="1column"/>
<referenceContainer name="page.wrapper">
    <referenceBlock name="breadcrumbs" remove="true" />
    <referenceBlock name="page.main.title" remove="true"/>
    <referenceBlock name="category.description" remove="true" />
</referenceContainer>

and layouts.xml as

<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
<layout id="category_level_one">
    Category Level One
</layout>

I need to add css like

<css src="css/demo.css" media="all"/>

Which is not working. How to resolve this issue? Thanks in advance.


texts:
I have encountered a weird error, after some time of development and clearing cache I am getting the following error.

SyntaxError: missing ) after argument list

I have created several modules and start getting this error, after clearing cache.

The line where error is occurred.

            setText(el, "'"
    .addAttribute('translate', {
        binding: 'i18n'
    });

Also this error occurs in other files.

How can I solve this problem ?


texts: Magento 2 Partial Authorization - Multiple Credit Card Payments Per Order

texts: I do see an answer for Magento 1 but am wondering if this is possible in Magento 2 out of the box or does it require a module?


texts:
I'm attempting to hide the "Add To Cart" button for specific stores currently and am having some issues with my lack of experience. It works in each individual store but not when using the search function because this returns results for a "default" store being used since our search function can't return results from multiple stores.

My question is when are multistore setups helpful? My company is using separate stores for each category of products on the same site and within each store there's sub-categories for the products.

It would be much easier for me to hide products if they were all in the same store in different categories. I'm wondering if I'm right about setting up the store this way and if not what the best solution to my problem is.

Once again the problem I'm trying to fix is hiding the "Add To cart" button when using the search feature.

Thanks for any help!


texts: Add button to admin page with using block

texts:
I have created an admin page using block classes but I want to add an action button like grids. I know this can be done using UI component but for this task I am not using UI Component and its not needed here. But I need the button to be added on top.
Its a layout.xml with some blocks in it. How will I add a button on top.


texts: Magento 2 : Adding static blocks to specific section of pages with custom module layout xml file

texts:
In magento 1.x it is possible to add a static block using xml layout file.

<reference name="root">
        <block type="cms/block" name="name">
            <action method="setBlockId"><block_id>static-block-id</block_id></action>
        </block>
</reference>

But, in magento 2 how we can achieve it ?


texts: In Magento observer event, how to redirect to the url "http://www.google.com/" if the url contains "www.example.com"?

texts:
By using magento observer event, I would like to know how to redirect to another url if the url contains "www.example.com" ?
For example,

if(url contains "www.example.com")
{
  redirect to "http://www.google.com/"
}

Thank you!


texts: require.js:1895 GET magento2/pub/static/version1572681098/frontend/Magento/luma/en_US/iost.js net::ERR_ABORTED 404 (Not Found)

texts:
I have developed a payment gateway module and has code  in requirejs-config.js like this.

var config = {
    map: {
        '*': {
            lazyloadScript:'Iostpay_Iostpaymagento::iost/dist/iost.min'

    }
};

But i am getting the error in console. How can i resolve this?


texts: url rewrite in setup script only applies to default store view of id 1

texts:
This method only applies the url rewrite to store of id 1 when I checked url_rewrite table.

Before I call the removeSuffix() method I also create 2 more store views in a method, but none of them are used for url rewrite.

public function removeSuffix()
{
    $this->_appState->setAreaCode('adminhtml');

    $config = $this->_configFactory->create();
    $config->setDataByPath('catalog/seo/product_url_suffix', '');
    $config->save();

    $config = $this->_configFactory->create();
    $config->setDataByPath('catalog/seo/category_url_suffix', '');
    $config->save();
}

How do I get the url rewrite to apply to all stores in the script?


texts: How to add new grid in product form in magento2

texts:
How to add custom grid exactly related products grid in admin product form Magento2.

I want to insert custom grid under related product grid. That grid is a exact copy of related product concept.


texts: Can't access backend - 404 site not found

texts:
I can't open the backend on my local project. The file app/etc/local.xml has this entry:

...
<admin>
    <routers>
        <adminhtml>
            <args>
                <frontName><![CDATA[login]]></frontName>
            </args>
        </adminhtml>
    </routers>
</admin>
...

But if I enter http://project.local/login then I get 404 page not found.

What is going on?


texts: Magento 2 - invalid form key (add/delete from cart)

texts:
I have serious problems with custom Magento 2 theme and (probably) formkey cashing. I have 2 views of exactly same e-shop.

 - View 1: Luma Theme
 - View 2: Custom Theme (Luma child) - overriding layouts, phtml, styles and javascripts

If cache is enabled and flushed everything -> adding/deleting from car works properly. After several minutes specified actions in View 2 (Custom theme) returns 302 status code and Magento redirects user to /cart page.

Now i discovered 3 ways how to "fix" this issue.

Flush cache - only temporary solution for few minutes.
Delete formKey validation from Magento core - totally inappropriate.
Disable cache - affects performance.

I'm struggling with this problem couple of days and I will be glad for any advice.