texts: Permanent redirection when there are parameters in the url

texts:
I'm on magento Magento 2.2.11 and Magento automatically redirects my product listing to a url without the parameters.
example: mywebsite.com/product-listing/?price=10 to mywebsite.com/product-listing/
I also tried it without the slash and the result is the same.
I wish I could remove this permanent redirection because it prevents some filters from working, but I don't know where to look.


texts: Changing the product position in a category programatically

texts:
|I have this script that I want to use to change the product position in a category programatically  but I want like it to get SKUs from a csv

<?php
 require_once './app/Mage.php';
Mage::app('default');
Mage::app ()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
umask(0);

$resource = Mage::getSingleton('core/resource'); //get an instance of the core resource
$connection = $resource->getConnection('core_write'); //get an instance of the write connection

$tableName = $resource->getTableName('catalog/category_product'); //this should add the prefix if you have one

$io = new Varien_Io_File();
$io->streamOpen('./var/import/importpositions.csv', 'r+');
//$file = fopen('./var/import/importCats.csv', 'r');
while($csvData = $io->streamReadCsv()){
    if (isset($csvData[0])){ //get the first column - sku
         $sku = trim($csvData[0]);
         //get id by sku
         $id = Mage::getModel('catalog/product')->getIdBySku($sku); //get the product id.
         $sql = "UPDATE {$tableName} SET `position` = 0 WHERE `product_id` = {$id}"; //set the position to 0 for the product in all the categories.
         $connection->query($q); //run the query

    }
}
$io->streamClose();
?>

How to I set it to get a list of SKus in a CSV

I get this error when I run the script

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in /var/www/html/lib/Zend/Db/Statement/Pdo.php:228 Stack trace: #0 /var/www/html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1 /var/www/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #2 /var/www/html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #3 /var/www/html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) #4 /var/www/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('', Array) #5 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('', Array) #6 /var/www/html/importposition.php(24): Varien_Db_Adapter_Pdo_Mysql->query(NULL) #7 {main} Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in /var/www/html/lib/Zend/D in /var/www/html/lib/Zend/Db/Statement/Pdo.php on line 234


texts: Verify OTP for shipping mobile number in checkout page in Magento 2

texts: I need to verify the OTP for the mobile number(in the shipping address) on the checkout page. How can I programmatically achieve?. Please, can u guide me which module to be overridden to achieve the functionality?


texts: I have custom attribute and its "global" and product listing "yes" i want to add this attribute in minicart this attribute show in product view page but not show in minicart . basically i checked it by using debug minicart not load the custom attribute because its not show in inspect element (network section) help me please my question is how i get attribute without reload the product


texts: Layout getOutput() return different if cache enabled or disabled

texts:
UPDATE :

it actually return the right value as long as the "Layouts cache" is disabled, but when I enable it the output is becomes incorrect.

I have this very simple piece of code which is supposed to return html code
(located in my controller):

<?php
protected function _refreshDdateHtml(){
        $layout = $this->getLayout();
        $update = $layout->getUpdate();
        $update->load('checkout_onepage_refreshddate');
        $layout->generateXml();
        $layout->generateBlocks();
        $output = $layout->getOutput();
        return $output;
    }

However, the value of $output is not the same depending on the server where I run the code.
However, the value of $output is not the same depending on if the layout cache is enabled or disabled.

I tried to find the source of the issue without result. Both the database and the file system can be different from one server to the other, but I can't know for sure where.

Here are more details:

Controller class definition:

class Something_Deliverydate_Checkout_OnepageController extends Mage_Checkout_OnepageController

The handle in the layout file:

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

        <block type="checkout/onepage_deliverydate" name="root" output="toHtml" template="deliverydate/checkout/onepage/refreshddate.phtml" />
</checkout_onepage_refreshddate>

The loaded handles seem to be the same on both servers though as this line give the same result:

var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());

Do you have an idea why the template called is different from one server to the other ?
Do you have any idea why the output is changing depending on the cache status, even if the cache folder is empty ?


texts: Develop a mobile app with Magento 2 REST API.?

texts:
I couldn't find some needed API functions in Magento 2 REST API Document . I am very doubted. Is it possible to develop a mobile application with current Magento REST API.?

I couldn't find methods to do following functions.

login customer
Get all products under a category
add shipping address
add products to cart
etc


texts: I want to add a drop-down option on my registration page

texts:
I want to add a Drop-down option on my Magento E-commerce website's registration page.I  have already seen a post here showing the steps to add a licence option on the registration page, I copied the same steps but in the end I failed as because I am not getting any drop-down option + I am getting a field name licence on my Magento admin Panel > Customer section.

Please if some one can guide me with the proper steps, as in how to add a new option on my registration page saying "where did you hear about us" and giving a drop-down option of like Facebook, Instagram, Google, Twitter, Others, etc.  Please can some one help me with this.


texts:
How override a default phtml in Magento 2?

I want to update/improve the theme "magento_plushe".
I add a file on app\design\frontend\magento_plushe\Magento_Theme\html\header.phtml
But Magento ignore this file and load app\code\Magento\Page\view\frontend\html\header.phtml

Configuration:
-Magento 2.0.0.0-dev55
-Cache disabled


texts:
I'm having some emails been sent by my Magento 2, and others not, I'm suspecting that the Magento has sent just the transactional emails sent immediately, not the emails by cron schedule, even with my cron configured.

Which are the transactional emails send via cron schedule and immediately (eg. contact email)?


texts: Help with product bundles where the bundles are mutiples of the same product

texts:
I have no idea if this is actually possible but I'll ask anyway.

I have 5 x products with different SKUs
eg butX01,butX02,butX03,butX04,butX05

Each product costs 0.50

But what I want to do is sell multiple quantities and have different prices for that.

Eg 5x butX01 costs 1.90 etc.

I could have mutiple skus with different quantites, but it would be easier to just have the base sku with quantity.

Ie I want a sku which defines quantity of a different sku.

EG butX10 = 5 x butX01 etc.

Is this possible?

Thanks


texts: Is Mage_Checkout_Block_Cart_Item_Renderer_Grouped ever used?

texts:
There's a cart rendered for grouped products in Mage_Checkout_Block_Cart_Item_Renderer_Grouped, but it doesn't appear to ever be used.  Am I wrong on this one?  Anyone got the back story here?

Edit:
@oleksii.svarychevskyi pointed out that the block appears in the layout XML files.  Still, I have the question - since grouped products are added to cart as their individual simple components, and not presented as members of a grouped product, is this block ever used?


texts:
Mage registry key "_singleton/belvgall/observer" already exists

Trace:

#0 app\Mage.php(223): Mage::throwException('Mage registry k...')
#1 app\Mage.php(477): Mage::register('_singleton/belv...', false)
#2 includes\src\__default.php(22026):Mage::getSingleton('belvgall/observ...')
#3 app\Mage.php(448): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#4 includes\src\__default.php(14361): Mage::dispatchEvent('controller_acti...', Array)
#5 includes\src\Mage_Adminhtml_Controller_Action.php(160): Mage_Core_Controller_Varien_Action->preDispatch()
#6 includes\src\__default.php(14241): Mage_Adminhtml_Controller_Action->preDispatch()
#7 includes\src\__default.php(18698): Mage_Core_Controller_Varien_Action->dispatch('login')
#8 includes\src\__default.php(18228): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#9 includes\src\__default.php(21056): Mage_Core_Controller_Varien_Front->dispatch()
#10 app\Mage.php(684): Mage_Core_Model_App->run(Array)
#11 index.php(84): Mage::run('', 'store')
#12 {main}

after i installed a extension then i got these error on magento 1.9.1


texts: What is custom.css in the default admin theme for?

texts:
I've just been adding my own css file to the admin section of Magento 1.9, which I have done via creating a bespoke module - as suggested by other users on this site.

However, when doing so I noticed that there is a file located under skin\adminhtml\default\default\custom.css

This file contains no CSS.

My initial thought was that it could be there with the intention of developers to add bespoke css to it, but it has the following disclaimer:

 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.

So.. what's it for?


texts: Magento2 : Image is visible in Back-End Side, but not visible at Front-End Side

texts:
Tried with all suggestions even though issue have not rectified.

Actually my issue is in backend image is reflecting but in front end images is not reflecting in website. instead of image its showing loading process. Is there any way to resolve this issue?

Thanks


texts: Logic for uses per customer in cart price rule

texts:
If the uses per customer was limitated with only one time with specific coupon code and a login customer placed an order with this code but canceled, will the customer still be able to use the code?

When I test, it doesn't allow to use again even if the order was canceled.

And if the code is "specific coupon" with "use auto generation", it seems the customer can still use the code after an order canceled with the same code. Is that correct?


texts: What is the equivalent of the config node category/collection/attributes in Magento 2 to add an attribute to the category collection

texts:
I am porting a Magento 1 module, which adds a custom category attribute, to Magento 2.

The product is already created in Magento 2 - but now it does not appear in the inside \Magento\Catalog\Helper\Category::getCategoryUrl.

In the Magento 1 version config.xml I had:

<config>
        <frontend>
          <category>
              <collection>
                  <attributes>
                      <redirect_url />
                  </attributes>
              </collection>
          </category>
      </frontend>
</config>

This solved the problem.

What is the equivalent of this in Magento 2 ?

Sure, I could load the full category item again in the above method, but this would slow down the site.


texts: In a Clustered environment, can a Magento Frontend webserver use readonly harddrive?

texts:
I have clustered Magento in Google Cloud, and i have 2 frontend webservers, 1 admin + nfs server (here it goes mystore/admin session) and 1 database.

Since files on frontend webserver are delivered from nfs to then via nfs share (only /var and /media) and lsyncd for rest of files, i was wondering if anyway admin people works only on /admin dedicated VM, frontend webserver only needs to read Magento files, correct?
Session and cache is inside Redis dedicated instaces on database VM

If answer is yes (and i asking this question here becouse i think is more a developer/magento question rather then ServerFault) i could just mount the NFS (/admin vm) vm harddisk where Magento is located in Read only mode directly to webservers.

thank you


texts: I have Magento 2.1.4 with Luma theme. Is there any way for logo / yellow banner to resize accordingly on mobiles altering the css? This is what it looks right now


texts: how to get custom attribute data in product afterGetPrice in cart page in magento 2

texts: in cart page i want to display custom msrp price for non loggedin user when i get custommsrp in afterGetPrice function for one item will return correctly but for other items display 0.00


texts:
Is there a problem with PayPal on Magento 2.1.9?

The error I keep on getting is

  Transaction has been Declined

even if I have everything set up right. I've looked at my PayPal Manager to see the authorized transaction. Everything looks good and approved, but when it comes back to Magento, that's when the error shows up.


texts: Non-cacheable Javascript snippets using UI components?

texts:
I'm asking this question as I'm unsure about the best way to proceed.

I've ported a module from Magento 1 to Magento 2, and it includes some Javascript tracking snippets that contain a small amount of dynamic data, e.g. an extra line or two if you've just added a product to your cart.

I'm concerned that the full page cache in Magento 2 will get in the way of the dynamic nature of some of these snippets.

Questions:

Do I need to worry about the FPC here?
Should I be using a UI component for this?
Would this be the recommended approach for implementing these kinds of things in Magento 2?


texts: Magento 2 and Client Side Less Compilation

texts:
I have stock Magento 2 installed and running with a custom theme that uses the 'blank' theme as its parent.

My custom theme is active on my store and it works, I can create my own styles and template files and all is good.

I am at the point where I am trying to style my theme and I want to make use of Live CSS/LESS Updates.

I am using Chrome as my development browser.

Now, when I set Magento 2 to Client Side LESS Compilation, my page loads correctly as expected, however, when I inspect an element in the devtools of the browser, instead of seeing which file has the active styles, instead I am seeing style tags.

This is my first time using LESS, how do I go about fixing this so that the file names appear when inspecting elements.


texts: Color swatches show up as text on frontend?

texts:
I created some color swatches, assigend a color from the color picker and saved, that seems to be ok (https://prnt.sc/pi9bm8). After that I assigned the colors to the products.

Now on the frontend, the swatches show the text only, like 010 offwhite. I reindex, cleared the cache, but nothing works.

Any ideas what I might also try?

Magento 2.2.3

PHP 7.1.3


texts: What is the best guide to start developing Magento 2 modules?

texts:
I'm starting to develop modules for Magento 2, but the main documentation seems a little confusing...

Since I know that are many experienced developers here, has come to me an idea to ask what tutorials or articles did you follow to develop modules for Magento 2? I know that are many blogs and websites (including StackExchange), but from your perspective, what helped you most?

Maybe some articles get a different perspective that can help to better understand some things on Magento 2... my question not just for me, but for everyone who is trying to increase their skills on Magento 2.

You can cite articles from others languages too, it doesn't need to be only in English.


texts: Magento 2 How find css in theme for changes and apply also in pub/static

texts:
I want to apply css in ced_vpanel.css file which is located in pub/static.

  /pub/static/frontend/Ced/ced_2k18/en_US/Ced_CsMarketplace/css/ced/csmarketplace/ced_vpanel.css

want changes in css file according to my requirement

how to find css in theme for changes and apply also in pub/static  ?


texts: Add files to core or to local? (Not override)

texts:
I am installing the RedSys module http://www.redsys.es following their guide.
At some point of their guide they say the following:

  4.Se deben colocar los ficheros de la carpeta “Source”, incluido en el
  módulo de pago de REDSYS, en el siguiente directorio del módulo de
  Magento: (TRANSLATION: The Source folder's files must be included in the following Magento's module directory:)

your_domain/magento/app/code/core/Mage/Adminhtml/Model/System/Config/Source

The thing is that they are writing new files in the core, so I wonder whether or not it would be the same if I write these files in local in the folder:

your_domain/magento/app/code/local/Mage/Adminhtml/Model/System/Config/Source

I ask this because I want to avoid problems in future Magento upgrades and I think that if they work the same way then the second approach would be better.


texts: Cannot enable Template Path Hints for specific store view in magento 2

texts:
In the admin panel Template Path Hints can be enabled at the store view level at all store views except one. In that particular store view the options are greyed out, including the "Use Website" checkbox.

How to troubleshoot this? The site is in developer mode and cache has been cleared. I have also tried manually setting the values (and unsetting) directly in the database. The path hints are shown on those other store views on the frontend but not this one store view - and despite being set in the DB they still show the wrong value and are greyed out in the admin panel.

It is Magento 2.2


texts: Products are not showing in child stores in magento

texts:
I am creating website in magento. I've created child stores in it.

 1. Main Website Store
 2. Shop 1
 3. Shop 2

Products are showing in main store in front-end but in child stores, products are not showing, it's giving me message We can't find products matching the selection.
Here is the screenshot:

Please help me


texts:
I have an image stored in media/images. I have a .phtml file that includes the following code:

but the image is not loading. I also tried

img src ="media/images/Bocadillos.png"

but it's also not working.

Which is the correct way to reference an image here?


texts: Magento 2 google recaptcha not working for china store

texts: Magento 2 default google recaptcha not working for china store only but it works other stores,any idea to fix this ,because china blocked https://www.google.com/recaptcha/ how to implement google recaptcha for china in magento 2 kindly advise me


texts: Has anyone installed an extension that doesn't error out from the marketplace using the extension manager? If so what am I doing wrong? It seams pretty straight forward. click module click install backup and thin install. But errors every time.


texts: Magento 2: Good way to modify a custom attribute field dynamically from admin

texts:
I have added a custom customer attribute.

I need to enable backend validation for this field in registration form, edit customer form, etc. It needs to be required and unique field. Or not, depending on choices made in admin. I thought of a few possible solutions but they seem difficult to pull off and I am new to Magento development. What approach would you recommend to doing this?

I was thinking I could try and edit attribute options is_required and is_unique in afterSave() of the system.xml BackendModel. This option is not easy as it seems, since doing it outside Setup can cause problems. ( Magento2 - programmatically add product attribute options )

Perhaps another option might be adding some backend validation in a plugin that would execute before the data in the registration and edit forms is saved, but this would take a lot of plugins I suppose.

Help? How would you approach this task?


texts:
I can access admin panel without any issue.
My admin panel URL looks like this: http://domain.com/admin/adminhtml/
By submitting forgot password link i received bellow in in email to reset my admin password:
http://domain.com/admin/admin/auth/resetpassword/?id=13&token=HJ3ybFrE3v0K5nXIMvDULEHkn63UUDtE
This reset password link it's not working. It's redirect to admin login page instead of reset password page.
When I put resetpassword condition then it's keep reloading and if i remove that condition it redirect to admin login page.

vendor/magento/module-backend/Controller/Adminhtml/Auth/Login.php

$requestUrl = $this->getRequest()->getUri();
        $backendUrl = $this->getUrl('*');

        /*if (strpos($requestUrl,'resetpassword') !== false) {
            return $this->getRedirect($requestUrl);
        }*/
        // redirect according to rewrite rule
        if ($requestUrl != $backendUrl) {
            return $this->getRedirect($backendUrl);
        }

I found this issue only at admin side, customer side it's working good.
Any help will be appreciated, Thanks.


texts: How to override customer AccountController in magento1.9

texts:
I was used below code but not work in-effect it removes my login and registration link from the top links.

Config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Mage_Customer>
      <version>0.1.0</version>
    </Mage_Customer>
  </modules>
   <frontend>
        <routers>
            <customer>
                <args>
                    <modules>
                    <mage_customer before="Mage_Customer">mage_customer</mage_customer>
                    </modules>
                </args>
            </customer>
        </routers>
        <layout>
            <updates>
                <mage_customer>
                    <file>customer.xml</file>
                </mage_customer>
            </updates>
        </layout>
    </frontend>
  <global>
    <helpers>
      <customer>
        <class>Mage_Customer_Helper</class>
      </customer>
    </helpers>
  </global>
  <admin>
    <routers>
      <customer>
        <use>admin</use>
        <args>
          <module>Mage_Customer</module>
          <frontName>admin_customer</frontName>
        </args>
      </customer>
    </routers>
  </admin>
</config>

AccountController.php

require_once "Mage/Customer/controllers/AccountController.php";
class Mage_Customer_Customer_AccountController extends Mage_Customer_AccountController{

}

Modules/Mage_Customer.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Mage_Customer>
      <active>true</active>
      <codePool>local</codePool>
      <version>0.1.0</version>
    </Mage_Customer>
  </modules>
</config>


texts:
I need to save an uploaded file to the database preferrably in the table core_file_storage as a blob and retrieve it later. I want this connected to a customer. Currently the files are being saved in the file system and this needs to be discontinued.

Solved:
I used the model mage/core/file/Model/storage/database.php methods to write into the table core_file_storage


texts: Default uploading image size in Magento 2

texts:
I met one strange issue in Magento 2 - I’m trying to change default uploading image size from 800x1200 to 934x1400.

I modified view.xml and now uploaded images going straight to folder media/catalog/product/cache/1/image/934x1400/

<image id="product_page_main_image" type="image">
                <width>934</width>
                <height>1400</height>
</image>
<image id="product_page_main_image_default" type="image">
                <width>934</width>
                <height>1400</height>
</image>
<image id="product_page_image_large" type="image">
                <width>934</width><!-- 800 -->
                <height>1400</height><!-- 1090 -->
</image>
<image id="product_page_image_medium" type="image">
                <width>934</width><!-- 800 -->
                <height>1400</height><!-- 1090 -->
</image>

But their actual size is still 800x1200

Any ideas how to solve this issue? I can’t find any settings to modify default uploading image size.


texts: Magento 2 using Redis Cluster and occur error 500 when start website

texts:
My company platform team have deployed redis cluster on 3 nodes (10.193.1.1, 10.193.1.2,10.193.1.3) for port 6379.

I have update the env.php to redis as following
......
....
array (
'backend'=> 'Cm_cache_backend_Redis',
'backend_options' =>
array (
'server' => '10.193.1.1',
'port'=>'6379',
......),
array (
'server' => '10.193.1.2',
'port'=>'6379',
......),
array (
'server' => '10.193.1.3',
'port'=>'6379',
......),

Then it show error on /etc/httpd/logs/ssl_error_log
CredisException: ERR select is not allowed in cluster mode
The website could not open ERROR 500

Any suggestion?


texts: Magento 2: Hide Add to cart button in all products

texts:
I created a custom attribute for hiding add to card button, it is working only for simple product.
I want Hide to add to cart button for all product.

Create product attribute for hide_add_to_cart and placed below code in

  addtocart.phtml

<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php if($_product->getData('hide_add_to_cart')) :?>

                <button type="submit"

                        class="action primary tocart"
                        id="product-addtocart-button" disabled>
                         <?php //echo $_product->getData('hide_add_to_cart'); ?>
                </button>
                <?= $block->getChildHtml('', true) ?>

    <?php else : ?>

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

            <?php if ($block->shouldRenderQuantity()): ?>

                <?= /* @escapeNotVerified */ __('Qty') ?>

                    <input type="number"
                           name="qty"
                           id="qty"
                           value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>"
                           title="<?= /* @escapeNotVerified */ __('Qty') ?>"
                           class="input-text qty"
                           data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
                           />

            <?php endif; ?>

                <button type="submit"
                        title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
                        class="action primary tocart"
                        id="product-addtocart-button">
                    <?= /* @escapeNotVerified */ $buttonTitle ?>
                </button>
                <?= $block->getChildHtml('', true) ?>

    <?php endif; ?>
    <?php if ($block->isRedirectToCartEnabled()) : ?>

    <?php else : ?>

    <?php endif; ?>

    <?php endif; ?>


texts: Magento - 2.2.7 City missing on checkout page address section

texts:
I have use extension https://github.com/EaDesgin/Magento2-City-Dropdown to show city in dropdown but when I enable this extension, city is showing blank in address section of checkout payment page.

If I tap on "Place order" button then it shows below error:

Please check the billing address information. city is a required field


texts: Magento salerule really slow query 2 minutes to execute

texts:
We run Magento with many sales rules as each user has a referral promo code that he can share with his friends. However this impact the performance of our magento server as it is really slow when customer create a cart or add item to cart.
We have New relic setup which gave us insight why our magento is slow.
New relic has pointed us that this query is taking an average 2 minutes to execute. In high load.
SELECT `main_table`.*, NULL AS `code` FROM `salesrule` AS `main_table` INNER JOIN (SELECT DISTINCT `salesrule_website`.`rule_id` FROM `salesrule_website` WHERE (website_id IN (?))) AS `website` ON main_table.rule_id = website.rule_id INNER JOIN `salesrule_customer_group` AS `customer_group_ids` ON main_table.rule_id = customer_group_ids.rule_id AND customer_group_ids.customer_group_id = ? WHERE (from_date is null or from_date <= ?) AND (to_date is null or to_date >= ?) AND (`is_active` = ?) AND (main_table.coupon_type = ?) AND (`is_active` = ?) ORDER BY sort_order ASC

and this one
SELECT `t`.* FROM (SELECT `main_table`.*, NULL AS `code` FROM `salesrule` AS `main_table` INNER JOIN (SELECT DISTINCT `salesrule_website`.`rule_id` FROM `salesrule_website` WHERE (website_id IN (?))) AS `website` ON main_table.rule_id = website.rule_id INNER JOIN `salesrule_customer_group` AS `customer_group_ids` ON main_table.rule_id = customer_group_ids.rule_id AND customer_group_ids.customer_group_id = ? WHERE (from_date is null or from_date <= ?) AND (to_date is null or to_date >= ?) AND (`is_active` = ?) AND (main_table.coupon_type = ?) UNION ALL SELECT `main_table`.*, `rule_coupons`.`code` FROM `salesrule` AS `main_table` INNER JOIN (SELECT DISTINCT `salesrule_website`.`rule_id` FROM `salesrule_website` WHERE (website_id IN (?))) AS `website` ON main_table.rule_id = website.rule_id INNER JOIN `salesrule_customer_group` AS `customer_group_ids` ON main_table.rule_id = customer_group_ids.rule_id AND customer_group_ids.customer_group_id = ? INNER JOIN `salesrule_coupon` AS `rule_coupons` ON main_table.rule_id = rule_coupons.rule_id AND main_table.coupon_type <> ? AND rule_coupons.code = ? WHERE (from_date is null or from_date <= ?) AND (to_date is null or to_date >= ?) AND (`is_active` = ?) AND (main_table.coupon_type = ? AND rule_coupons.type = ? OR (main_table.coupon_type = ?) AND ((main_table.use_auto_generation = ? AND rule_coupons.type = ?) OR (main_table.use_auto_generation = ? AND rule_coupons.type = ?)))) AS `t` WHERE (`is_active` = ?) ORDER BY sort_order ASC

can you please advice on how to optimize Magento regarding this.


texts: Magento2 transfer module from local to stage

texts:
Magento2 How can I transfer module from Local to stage via FTP.
In short, I have installed a module via composer in my local system & now I want to transfer this data to Stage site. I don't want to run composer cmd over there. How can I achieve this?

COMPOSER_MEMORY_LIMIT=-1 composer require thaiphan/magento2-s3


texts: How to check if there are block in getChildHtml in Magento 2?

texts:
In my code, there are many blocks that will be rendered but is there a product page that isn't rendering because there are no custom options.

  How can I check if it'll return some blocks in my phtml?

<?php echo $block->getChildHtml('', true);?>

Today I'm using like that:

$_getChildHtml = $block->getChildHtml('', true);
$_hasOptionsPersonalize = strpos($_getChildHtml, 'class="field"') ? true : false;


texts: Magento 2 - Change shipping price amount when access payment page on checkout not working

texts:
I want to change or update the shipping price when I access the payment page on checkout.
I have try event sales_quote_address_collect_totals_before and sales_quote_collect_totals_before, shipping price success changing but the total on the summary box not changing, I think order total can't re calculate
$address = $quote->getShippingAddress();
$address->setShippingAmount(1000);
$address->setBaseShippingAmount(1000);
$address->setCollectShippingRates(true);
$address->save();

any clue for this?


texts:
My intention is to send the sku as a hidden variable when applying for the contact form but only after having visited a product.

It works fine with localhost, where the cache is disabled, but not with the online website because it only gets the information the first time I access to the contact page and when I access from another product it maintains the previous sku. It only works when I refresh the cache but it's really strange in my opinion.

Here is the code I have for form.phtml

<?php
    if(isset($_GET['sku']))
    {
        $print_text = $_GET['sku'];
    }
    else
    {
        $print_text = "";
    }
?>
<input type="hidden" value="<?php echo $print_text ?>" name="sku" id="sku" title="<?php echo Mage::helper('contacts')->__('Sku') ?>"/>

And this for view.phtml

Para cantidades inferiores o informaci&oacute;n <a href="http://example.com/contacto/?sku=<?php echo $_product->getSku() ?>">consultar

And I get the information from the admin panel, transactional emails. Adding this at the end of the contact form:

Sku: {{var data.sku}}

How can I get the information without having to refresh cache the whole time?


texts: What is the difference between getData('name') and getName()

texts:
I am using magento 1.8

And I am facing problem when I use below methods

$product->getData('name');

$product->getName();

Is they are same,
I sure that they return same value[answer].
When I am using I am getting error

Fatal error: Call to a member function getData() on a non-object in

So may i know the exact difference between these two function.

Thank You,


texts: magento 1 update or change advance search filter ordering

texts:
I would like to move country of manufacture element at the bottom
see screenshot https://i.imgur.com/nRbJyTs.png
I am unable to do that by changing the positions of the attribute group.
Please suggest or guide me further thanks


texts: how we add a field in for taking csv file as a input in this form form link is given

texts: how we add  a field in  for taking csv file as a input  in this form (How to create custom Module Development in magento 2 from Scratch? )then submit that file in database


texts: How to add a script to all product descriptions

texts:
How to create a js widget that will add the current date on the product page to the description on the

 element?
Or which will insert a p tag with a date at the end of each product. maybe there is an easier way?
app/design/frontend/Qwe/qwerty/Magento_Catalog/requirejs-config.js
var config = {
    map: {
        '*': {
            nowDateDescription: 'Magento_Catalog/js/qwe_now_date_description'
        }
    }
};

app/design/frontend/Qwe/qwerty/Magento_Catalog/web/js/qwe_now_date_description.js
define([
    'jquery'
], function ($) {
    'use strict';

    return function (config, element) {
        function setCurrentYear() {
            return new Date().getFullYear();
        }
    }
});

app/design/frontend/Qwe/qwerty/Magento_Catalog/templates/product/qwe_now_date_description.phtml

app/design/frontend/Qwe/qwerty/Magento_Catalog/layout/catalog_product_view.xml
        <referenceContainer name="product.info.description">
            <block class="Magento\Framework\View\Element\Template"
                   name="qwe.now.date.description" template="Magento_Catalog::product/qwe_now_date_description.phtml"/>
        </referenceContainer>


texts: Is there a way to extend lib/web/mage/validation/validation.js? I want to add my own logic on 'validate-grouped-qty' section. I know (I think) that you can just copy the whole file and add it to your custom theme but is there a way to extend it?


texts: Magento 2 : No products displaying on sub category pages

texts:
On sub category listing pages there should be a grid view of all products in that sub catagory, however the page is not displaying any of the products. The parent categories are set to not show products, but the sub categories were working, so I'm not sure if something's been switched in the admin settings or an update to the code has caused an issue.

I've tried clearing cache and reindexing but still just get header,footer, title and description for the sub category page I'm on.

Magento version is 2.1.7


texts: How to show sku in text box when type productId in the field using js magento2?

texts: I want to fill sku filed when type of productId


texts: 403 forbidden on magento admin category url

texts:
I am getting the below error on the admin category index page.

You don't have permission to access /index.php/admin/catalog_category/index/key/24a39b3ae8b57eb5a73ab617d8de3be3/ on this server.

Tried the folder file permission thing but that is all set properly.

Took the site to debug mode but nothing specific.

Can anyone help how to start debugging this one. note only category url is breaking and everyone else is working in admin area. frontend is also working fine.


texts: Magento 2 checkout payment method add subtitle

texts:
In our Magento 2.3 store, I want to add a subtitle to the payment method in the checkout.

Currently only the title of the payment method is displayed. But now I want to add a subtitle on each payment method, to show if the payment method is free or charged.

How can I change this?

I already checked the template:

  /vendor/magento/module-checkout/view/frontend/web/template/payment-methods/list.html

But the payment method title is not loaded there.


texts: Get configurable option and value if parent and child known

texts: If I have a configurable product id and an associated child product id, how can i determine the specific attribute id and options used for that combination?


texts: Continue to next step on click of Ship Here button

texts:
I am working on a project where I have to customize the checkout process. So I need a functionality where I want to move to the next step on selection of the shipping address.
Below is my shipping-address page. And I want, when I click on "Use this address" button, it should select the address and take the customer to the next step. Basically onclick on "Use this address" button, it should do the functionality of next button.

Please let me know, if anyone done this before.


texts: setup:upgrade SQL error after update from 2.2.8 to 2.3.1

texts:
What could be the reason for this error on bin/magento setup:upgrade after updating from 2.2.8 to 2.3.1?

  SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key
  name 'WISHLIST_CUSTOMER_ID', query was: ALTER TABLE wishlist ADD
  CONSTRAINT WISHLIST_CUSTOMER_ID UNIQUE KEY (customer_id)

The db_schema.xml of the wishlist module contains this definition:

        <constraint xsi:type="unique" referenceId="WISHLIST_CUSTOMER_ID">
            <column name="customer_id"/>
        </constraint>

But it should not try to create the constraint if it is already there?

SHOW CREATE TABLE whishlist shows me:

CREATE TABLE `wishlist` (
  `wishlist_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Wishlist ID',
  `customer_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Customer ID',
  `shared` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Sharing flag (0 or 1)',
  `sharing_code` varchar(32) DEFAULT NULL COMMENT 'Sharing encrypted code',
  `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Last updated date',
  `name` varchar(255) DEFAULT NULL COMMENT 'Wish List Name',
  `visibility` smallint(6) DEFAULT '0' COMMENT 'Wish List visibility type',
  PRIMARY KEY (`wishlist_id`),
  KEY `WISHLIST_SHARED` (`shared`),
  KEY `WISHLIST_CUSTOMER_ID` (`customer_id`),
  CONSTRAINT `WISHLIST_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=34412 DEFAULT CHARSET=utf8 COMMENT='Wishlist main Table'

The entry in the setup_module table:

+------------------+----------------+--------------+
| module           | schema_version | data_version |
+------------------+----------------+--------------+
| Magento_Wishlist | 2.0.2          | 2.0.2        |
+------------------+----------------+--------------+


texts: Magento 2: How to use Grunt properly for CSS changes

texts:
I'm trying to figure out the clusterf-ck which is the Magento 2 front-end theming workflow. And I've read and understood all documentation, read all the blogs about it and are up to date on the latest developments. I know it's a hassle to make changes to the styles, and that is the reason Magento decided to implement Grunt, to make this a easier process. But here is where things go wrong;

I use grunt watch:theme; it registers and compiles all my changes just lovely. But it doesn't clear out the pub/static files, so no changes are visible (in other words; a useless function?)

Then there's grunt clean:theme which cleans "everything" to apply made changes. But whenever I make changes and use this command; no changes!
This one only works in combination with rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/ so what's the idea here?

And when I try grunt less:theme I get an error, which is the first lead I've had so far but no idea what to do with it;

Running "less:theme" (less) task
Destination pub/static/frontend/vendor/theme/en_EN/css/source/_extend.css not written because no source files were found.

Some further info; I've setup a child-theme of the blank default, added my _extend.less in the vendor/theme/web/css/source/ folder. As said before, grunt sees my changes and eventually if I use the grunt clean and clear out the var they do get applied. But this is really time consuming and I simply can't believe there isn't a quicker way to do this. I figure it's something to do with the aformentioned error. Anyone has an idea?


texts: Create customer address using magento soap API in android

texts:
I am able to create a customer using customerCustomerCreate api, and getting the customer id. Now my requirement is to create the address of the customer, for that i am calling the customerAddressCreate api. but somehow i am not able to create the customer address. I tried with the code below:

try {

                SoapSerializationEnvelope env = new SoapSerializationEnvelope(
                        SoapEnvelope.VER11);

                env.dotNet = false;
                env.xsd = SoapSerializationEnvelope.XSD;
                env.enc = SoapSerializationEnvelope.ENC;

                SoapObject request = new SoapObject(NAMESPACE, "login");

                request.addProperty("username", "user");
                request.addProperty("apiKey", "apikey");

                env.setOutputSoapObject(request);

                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

                androidHttpTransport.call("", env);
                Object result = env.getResponse();

                Log.e("sessionId", result.toString());

                String sessionId = result.toString();

   request = new SoapObject(NAMESPACE, "customerAddressCreate");
            request.addProperty("sessionId", sessionId);

            request.addProperty("customerId",custId);

            SoapObject customerEntity = new SoapObject(NAMESPACE, "customerAddressEntityCreate");

            customerEntity.addProperty("city", "bangalore");
            customerEntity.addProperty("company", "outthinking");
            customerEntity.addProperty("country_id", "01");
            customerEntity.addProperty("fax", "08012345");
            customerEntity.addProperty("firstname", "amit");
            customerEntity.addProperty("lastname", "chandra");
            customerEntity.addProperty("middlename", "raj");
            customerEntity.addProperty("postcode", "560007");
            customerEntity.addProperty("prefix", "a");
            customerEntity.addProperty("region_id", 03);
            customerEntity.addProperty("region", "karnataka");
            customerEntity.addProperty("street",Arrays.toString(myStrings));
            customerEntity.addProperty("suffix", "ac");
            customerEntity.addProperty("telephone", "+91-9962025341");
            customerEntity.addProperty("is_default_billing", false);
            customerEntity.addProperty("is_default_shipping", false);

            request.addProperty("addressdata", customerEntity);
             } catch (Exception e) {
                e.printStackTrace();
            }

where myStrings is array of string of street. But i am getting the following error:

SoapFault - faultcode: '100' faultstring: 'Please enter the first name.
Please enter the last name.
Please enter the street.
Please enter the city.
Please enter the telephone number.
Please enter the zip/postal code.
Please enter the country.' faultactor: 'null' detail: null

Can anyone tell me what is wrong with my code and please provide any solution for this. Thanks in advance.


texts: There has been an error processing your request after importing "theme sql file" to magento2 site

texts:
I have following error after importing "demo data sql file of theme" in magento 2. I don't know how to resolve this issue. Please help me.
There has been an error processing your request
Please update your modules: Run "composer install" from the Magento root directory.
The following modules are outdated:
Magento_GoogleShoppingAds schema: code version - 3.0.1, database version - 4.0.1
Magento_GoogleShoppingAds data: code version - 3.0.1, database version - 4.0.1
Amazon_Core schema: code version - 3.4.1, database version - 3.4.1-p3
Amazon_Core data: code version - 3.4.1, database version - 3.4.1-p3
Amazon_Login schema: code version - 3.4.1, database version - 3.4.1-p3
Amazon_Login data: code version - 3.4.1, database version - 3.4.1-p3
Amazon_Payment schema: code version - 3.4.1, database version - 3.4.1-p3
Amazon_Payment data: code version - 3.4.1, database version - 3.4.1-p3
Dotdigitalgroup_Email schema: code version - 4.4.0, database version - 4.4.1
Dotdigitalgroup_Email data: code version - 4.4.0, database version - 4.4.1
Dotdigitalgroup_Chat schema: code version - 1.0.1, database version - 1.0.1-p1
Dotdigitalgroup_Chat data: code version - 1.0.1, database version - 1.0.1-p1
Klarna_Core schema: code version - 5.2.3, database version - 5.3.2
Klarna_Core data: code version - 5.2.3, database version - 5.3.2
Klarna_Ordermanagement schema: code version - 5.0.7, database version - 5.1.1
Klarna_Ordermanagement data: code version - 5.0.7, database version - 5.1.1
Klarna_Kp schema: code version - 6.4.0, database version - 6.5.3
Klarna_Kp data: code version - 6.4.0, database version - 6.5.3
Error log record number: 0fe30834a991ec325a4f5b8a3e7a1367fe668b891cc6aaa78e400438f4793b32


texts: Magento 2 - How to enable bank transfer only for admin order creation?

texts: We have only one online payment service for the customer, how to enable bank transfer only for admin order creation?


texts: CRON Alert stock is not working, but cron_schedule show success

texts:
I'm using cron to send product stock alerts, and currently using magento 1.9.1. I have already changed the file config.xml in the path app\code\core\Mage\ProductAlert\etc

<jobs>
   <catalog_product_alert>
      <run>
         <model>productalert/observer::process</model>
      </run>
   </catalog_product_alert>
</jobs>

To

<jobs>
   <catalog_product_alert>
      <schedule>
         <cron_expr>* * * * *</cron_expr>
      </schedule>
      <run>
         <model>productalert/observer::process</model>
      </run>
   </catalog_product_alert>
</jobs>

When I run cron.php, the table cron_schedule is populated with five (5) catalog_product_alert rows. Then I run cron.php again in the appropriated time, and both columns "executed" and "finished" are updated and the status is flagged as success, but the table product_alert_stock was not updated and no e-mail was sent. Cron table show me the job was run, but it wasn't. It's just flagged as success.

Now, if I run www.mydomain.com/productalert/add/testObserver/, the email arrives, the table is updated and all works fine.

I've already gave 777 permission to cron.php and cron.sh, but it not works too. I know this isn't a good security practice, but it's for tests purposes.

Why the cron service can't run this job? What I'm missing?


texts: M1 accessing sales/order_grid_collection in foreach loop and printing it

texts:
I am accessing sales/order_grid_collection and trying to print its contents in a php script but this is not working. How an we do this correctly ... now we see some object error
[03-Sep-2020 08:12:55 UTC] PHP Fatal error:  Uncaught Exception: Warning: implode(): Invalid arguments passed  implode('\t', Object(OrderEmail_Model_Sales_Order))
question: how can we do this properly and print the data in foreach
$instance = Mage::getResourceModel("sales/order_grid_collection")
    ->addAttributeToSelect('increment_id')
    ->addAttributeToSelect('status')
    ->addAttributeToSelect('grand_total')
    ->addAttributeToSelect('created_at')
    ->addAttributeToSelect('updated_at');

foreach ($instance as $order) {
    echo implode("\t", $order); echo "\n";
}


texts: How do I properly debug the root cause of 503 errors produced by Varnish?

texts:
I'm using Magento 2.3.5 with Apache 2.4 and Varnish 6 and seeing constant 503 errors ("Backend Fetch Failed" or sometimes "Service Unavailable") in the browser's network panel when page assets are loading.
The 503 errors don't affect all requests; on a typical page load in developer mode, when a Magento page might require about 200 external assets (JS/CSS/template files etc.) about 80-90% of requests are successful but 10-20% are not.
The errors do not always affect the same files; it is quite random although anecdotally I would say that larger files are affected moreso than tiny files.
If I manually request the problem URL in the browser, or click Resend in the browser's network panel to retry the request, the request almost always succeeds with a 200 OK response straight away.
In this way, I am usually able to load a page fully without any 503 errors by a process of refreshing the page 4, 5, or 6 times until all the 503 are "exhausted" and "turn into" 200 OK responses.
Obviously this is not OK, and something is wrong; pages should load first time every time.
Debugging
I have debugged extensively trying to find the root cause of this. Things I have tried:

varnishlog output is not particularly helpful. It simply states that the backend fetch failed without saying why (e.g. did it time out? etc.)

    > -   VCL_return     pass
    > -   VCL_call       HASH
    > -   VCL_return     lookup
    > -   VCL_call       PASS
    > -   VCL_return     fetch
    > -   Link           bereq 720946 pass
    > -   Timestamp      Fetch: 1593622218.746588 0.461734 0.461734
    > -   RespProtocol   HTTP/1.1
    > -   RespStatus     503
    > -   RespReason     Backend fetch failed

I've tried increasing the first byte and connect timeouts in Varnish as per the VCL configuration below:

VCL Configuration
backend default {
    .host = "localhost";
    .host_header = "mysite.example.com";
    .port = "8080";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .probe = {
         .url = "/pub/health_check.php";
         .timeout = 2s;
         .interval = 5s;
         .window = 10;
         .threshold = 5;
    }
}

I also tried removing Magento's health check probe as per this answer


texts: Invalid form key. please refresh the page. Discount code and Paypal review

texts:
This one seems different to all the previous questions about this error message.

I'm getting the following message "Invalid form key. please refresh the page." when trying to enter a discount code or when getting to the paypal review step.

Also had a couple of admin logins fail where it just appears to refresh the page, no error given.

I'm on magento 2.3.1.

This is where it's happening when trying to use a discount code:


texts: Magento 2 - How to use pattern validation

texts:
I'm using a plugin to validate the street field (based on https://magento.stackexchange.com/a/158101/28803) and I want to use the validation method 'pattern' to test for the following regex:

.*[0-9].*

Complete code:

```

public function afterProcess(
    \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
    array  $jsLayout
) {
    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
    ['shippingAddress']['children']['shipping-address-fieldset']['children']['street'] = [
        'component' => 'Magento_Ui/js/form/components/group',
        'label' => __('Street Address'),
        'required' => true,
        'dataScope' => 'shippingAddress.street',
        'provider' => 'checkoutProvider',
        'sortOrder' => 60,
        'type' => 'group',
        'additionalClasses' => 'street',
        'children' => [
            [
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [
                    'customScope' => 'shippingAddress',
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input'
                ],
                'dataScope' => '0',
                'provider' => 'checkoutProvider',
                'validation' => ['required-entry' => true, 'pattern' => '.*[0-9].*'],
            ],
            [
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [
                    'customScope' => 'shippingAddress',
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input'
                ],
                'dataScope' => '1',
                'provider' => 'checkoutProvider',
                'validation' => ['required-entry' => true, 'pattern' => ".*[0-9].*"],
            ]
        ]
    ];
    return $jsLayout;
}

}
```

However validation' => ['required-entry' => true, 'pattern' => ".*[0-9].*"], doesn't work (it generates a blank page on checkout). What am I doing wrong?

I'm using Magento 2.1.2 with vagrant.


texts:
In Magento 1 it was possible to conditionally add class to body tag through layout. It could be done with addBodyClass action with an additional condition in the ifconfig. For example:

<reference name="root">
    <action method="addBodyClass" ifconfig="yoursection/yourgroup/yourfield_value"><className>big-font</className></action>
</reference>

Without any additional conditions, in Magento 2 a class can be added like this:

<body>
    <attribute name="class" value="big-font" />
</body>

Is there any way to add similar condition in Magento 2?

This of course does not work, ifconfig is ignored:

<body>
    <attribute name="class" value="big-font" ifconfig="yoursection/yourgroup/yourfield_value" />
</body>


texts:
I want to add one column in the Magento image grid. Is it feasible to add one column which is called gallery order.

How can I do this grid customization without updating core files?

Please suggest me how to do it


texts: Update custom attribute value via script

texts:
I'm trying to write a script that will be run by a cron that updates a custom attribute. The attribute is defined by a 3rd Party Module and has a value of "Blank, Yes or No" as a dropdown selection on the frontend. The corresponding values for the attribute in the table catalog_product_entity_int are 1 for Yes and 2 for No.

So far I have the following code. It separates out all the child products for each configurable product and it should assign them a value of "No" for the attribute.

<?php
include_once '../app/Mage.php';
Mage::app()->setCurrentStore( Mage_Core_Model_App::ADMIN_STORE_ID );

// Get all configurable and grouped products
$products = Mage::getModel('catalog/product')
    ->getCollection()
    ->addAttributeToSelect('name')
    ->addAttributeToFilter('type_id', array('in' => array('configurable', 'grouped')));

// Loop each configurable product
foreach ($products as $_product) {
    // testing single product only
    if ($_product->getId() == 981 ){

    // Get the child products for this product
    if ($_product->getTypeId() == 'configurable') {
        $simpleProducts = $_product->getTypeInstance(true)->getUsedProductIds($_product);
    } elseif ($_product->getTypeId() == 'grouped') {
        $simpleProducts = $_product->getTypeInstance(true)->getAssociatedProductIds($_product);
    }
    printf("Setting children of Product ID %s\r\n", $_product->getId());

    // Loop each child product
    foreach($simpleProducts as $_simpleID) {
        try {

            $_simple = Mage::getModel('catalog/product')->load($_simpleID);
            $attrCode = 'webpos_visible';
            $valueText = 2;
            $valueId = Mage::getModel('catalog/product')->getResource()->getAttribute($attrCode)->getSource()->getOptionId($valueText);
            $_simple->setData($attrCode, $valueId);

            printf("Product ID %s saved as 'Webpos Disabled'\r\n", $_simple->getId());

        } catch ( Exception $e ) {
            print_r($e);

           }
        }
    }
}

This script seems to run successfully but the attributes are not updated in the backend

Please help


texts: Problem during translations in return view of an order

texts:
I've a multilanguages site in Magento 1.9. In return section there's a table and code of its head is the following:

                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />

                            <?php echo $this->__('Product Name') ?>
                            <?php echo $this->__('SKU') ?>
                            <?php echo $this->__('Condition') ?>
                            <?php echo $this->__('Resolution') ?>
                            <?php echo $this->__('Request') ?>
                            <?php echo $this->__('Qty') ?>
                            <?php echo $this->__('Status') ?>

'SKU' translation in the other languages don't shown and I don't know why. I inserted "SKU","Product" into translate.csv but the string that I see is "UGS". This don't happen for other attribute of tale head.
Can you help me please?

Thanks!


texts: How to show total price on product page when change of qty of product?

texts: How to show total price on product page when change of qty of product ?


texts:
In Magento 1 Mage::getBaseUrl();, but in Magento 2 I have to pass responsible class object type in constructor.

I don’t have the idea which class I have to pass?


texts: MFTF Dependency Conflict After Magento 2.4 Update

texts:
After I updated to Magento 2.4 I am getting this error when I try to update any module via composer:

Your requirements could not be resolved to an installable set of
packages.
Problem 1
- The requested package magento/magento2-functional-testing-framework (locked at 2.4.5,
required as 3.0) is satisfiable by
magento/magento2-functional-testing-framework[2.4.5] but these
conflict with your requirements or minimum-stability.

How can I unlock the 2.4.5 version? Can I create a new conflict if I do that?


texts: Magento 2 Remove SORT BY Relevence and add default on search page for Elastic search

texts:
I am looking for solution to remove Relevence sort by from search page when using Elastic search and I want to add  Default sort by optio in place of Relevence.
I have searched on the forum but ot found anywhere. Please help me if anyone have any idea.
Thanks,
Adesh Kumar


texts: Magento2 2.2.5 installed in centos7 server version when installation successfully completed and use my ip in browser it loading but magento setup page is not opening. I have set up a server with Nginx, PHP 7.1 and Mysql.


texts: Magento 2 Some item options or their combination are not currently available

texts:
We have installed Magento ver. 2.1.6. using composer with sample data.

We have call event checkout_cart_product_add_after for adding addition information with item. The event observer code is given below.

$item = $observer->getQuoteItem();

    $additionalOptions = array();

    if ($additionalOption = $item->getOptionByCode('additional_options')){
        $additionalOptions = (array) unserialize($additionalOption->getValue());
    }

    $post = $this->_request->getParam('info');

    if(is_array($post)){
        foreach($post as $key => $value){
            if($key == '' || $value == ''){
                continue;
            }

            $additionalOptions[] = [
                'label' => $key,
                'value' => $value
            ];
        }
    }

    if(count($additionalOptions) > 0){
        $item->addOption(array(
            'code' => 'additional_options',
            'value' => serialize($additionalOptions)
        ));
    }

When we add the configurable product with addition information in the cart then in shopping cart page display additional information with error  Some item options or their combination are not currently available


texts: How-to just show order total on checkout page cart order summary

texts: Looking for a solution that shows the order total in the cart order summary on the right side of the checkout page, without the product items. I have played around with altering checkout_index_index.xml but couldn't find a working solution. Any help is appreciated.


texts: jit-grunt: Plugin for the "clean" task not found

texts:
After running grunt clean in magento 2.1.3 root folder I get error

 If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings

Warning: Task "clean" failed. Use --force to continue.

Aborted due to warnings.

I tried npm install clean & npm install clean --save-dev but get the same error.  I looked at the url they sent but it is not clear what I should add where?

How do I solve this error?


texts: why after lock_expire_time customer account is not unlocked in magento2.1.12?

texts: When a customer entered incorrect email and password 6 times, customer account is locked.That time api is showing error Unauthorized access. After lock_expire_time customer account is not unlocked, why? Anybody tell me.


texts: How to upgrade magento 2.2.4 to 2.2.5 version?

texts: How to upgrade magento 2.2.4 to latest version ie., 2.2.5


texts: Magento 2 UI Form datepicker, default date and strange behaviour

texts:
I created a UI Form with a datepicker field. In the XML I set required-entry to false. It keeps returning 'This is a required field'.

In the XML the definition is thus:

<field name="begin_datum">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">string</item>
            <item name="component" xsi:type="string">Blah_BlahToo/js/form/element/date</item>
            <item name="label" xsi:type="string" translate="true">Schedule From</item>
            <item name="formElement" xsi:type="string">date</item>
            <item name="source" xsi:type="string">block</item>
            <item name="sortOrder" xsi:type="number">230</item>
            <item name="dataScope" xsi:type="string">begin_datum</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">false</item>
            </item>
            <item name="options" xsi:type="array">
                <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
                <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
                <item name="showsTime" xsi:type="boolean">false</item>
            </item>
        </item>
    </argument>
</field>

My Blah_BlahToo/js/form/element/date component is this:

define([
    'Magento_Ui/js/form/element/date'
], function(Date) {
    'use strict';

    return Date.extend({
        defaults: {
            options: {
                showsDate: true,
                showsTime: false,
                required: false
            },
        }
    });
});

I thought, well let's give it a default value with

 <item name="class" xsi:type="string">Blah\BlahToo\Ui\Component\Form\Element\BeginDatum</item>

The code for this class is :

namespace Blah\BlahToo\Ui\Component\Form\Element;

class BeginDatum extends \Magento\Ui\Component\Form\Element\Input
{
    /**
     * Prepare component configuration
     *
     * @return void
     */
    public function prepare()
    {
        parent::prepare();
        $config = $this->getData('config');

        if(isset($config['dataScope']) && $config['dataScope']=='begin_datum'){
            $config['default']= date('Y-m-d', strtotime('-1 month'));
            $this->setData('config', (array)$config);
        }
    }
}

Now whenever I try to pick a value, return is something like +00020201021-12-04 or an invalide date. For as before, when I did NOT preset the value with a default by that class, any returned value from the datepicker would be in the proper format.

How should I tame this wretched datepicker? Preferably I would like to do without the setting of a default and simply have Magento 2 allow a null value ( or whatever it is ) but then I keep getting that stupid "This is a required field" )


texts: Magento 2 Down: replica Tales not found when reindexing!

texts:
My server went down because the disk was full, after fixing it, I noticed that the magento 2 website never came back:
(Magento 2.2.4, PHP 7.0.30)

When re-indexing, i get the following error:

  Table "cataloginventory_stock_status_replica" does not exist Table
  Table "catalog_product_index_eav_replica" does not exist Table
  Table "cataloginventory_stock_status_replica" does not exist

Exception Logs only shows this:

  [2018-10-07 10:00:58] main.CRITICAL: SQLSTATE[HY000]: General error: 3
  Error writing file
  './databse_mag2/catalogrule_product__temp30fd3506.frm'
  (Errcode: 28 - No space left on device), query was: create table
  catalogrule_product__temp30fd3506 like catalogrule_product
  {"exception":"[object] (Zend_Db_Statement_Exception(code: 0):
  SQLSTATE[HY000]: General error: 3 Error writing file
  './databse_mag2/catalogrule_product__temp30fd3506.frm

System logs shows this:

  [2018-10-08 15:01:05] main.WARNING: Memory size allocated for the
  temporary table is more than 20% of innodb_buffer_pool_size. Please
  update innodb_buffer_pool_size or decrease batch size value (which
  decreases memory usages for the temporary table). Current batch size:
  100000; Allocated memory size: 200000000 bytes; InnoDB buffer pool
  size: 134217728 bytes. [] []

The website is loading in vain, I've no idea where or how to fix it, anyone has an idea how to fix this, please?


texts: don't display disabled options Magento 2 REST API

texts:
i have crazy question, i don't know if there is anyone face this issue before.
my issue related to Configurable products attributes in Magento 2.3.6 REST API.
in WEB if we disabled some options, it will appear like this.
when select an option, you only could add enabled options to cart

but in REST API we couldn't know if this option is disabled or not!
so when try to add disabled option it's will return error message.
So my question here, what is the best scenario we could use to check if this option is enabled or not.
NOTE: the disabled option are linked with another option from another attribute :|
Thanks for you help.


texts:
How to access one Model data functions in another model inside function in magento 2

Below is my override function Model
NameSpace\modulename\Model\Rewrite\Quote

 public function createEmptyCart()
        {

            $storeId = $this->storeManager->getStore()->getStoreId();
            $quote = $this->createAnonymousCart($storeId);

            $quote->setBillingAddress($this->quoteAddressFactory->create());
            $quote->setShippingAddress($this->quoteAddressFactory->create());

            try {
                $this->quoteRepository->save($quote);
            } catch (\Exception $e) {
                throw new CouldNotSaveException(__('Cannot create quote'));
            }
            //return $quote->getId();
            // die('helloss');
            return parent::createEmptyCart();

        }

I want to get that return functionality in below model

NameSpace\modulename\Model

public function customcart($point1, $point2) {
//here i want to get that above function quote Data how to get
}

Below is my Constructor

 public function __construct(PointInterfaceFactory $pointFactory) {
        $this->pointFactory = $pointFactory;
    }


texts: Remove Forgot Password Link Based on Customer Group

texts:
I am trying to figure out how I can stop certain customer groups from changing their password. I was able to easily remove the link from the dashboard page but I can't figure out how to replicate this idea for the Forgot Password link on the login page. I attempted to create a custom block for the Forgot Password email, but it is not working. This is what I have in the block phtml template:

<?php $groupId = Mage::getSingleton('customer/customer')->getCustomerGroupId() ?>
  <?php if ($groupId != 4): ?>
    Show link
  <?php else :?>
    Don't show link
  <?php endif ?>

How can I get this to work so the customer group 4 doesn't receive an email with the option to change their password?


texts: How to validate dynamically created forms on same page with VarienForm?

texts:
I'm creating onepage customer account and I need to validate dynamically created additional address forms, all on same page.

I understand that in Magento you should use new VarienForm to validate your forms.
to do that you just call following line

var dataForm = new VarienForm('form-id', true);

But what if forms are created dynamically like additional customer addresses and all forms are on same page and you need to check whether the form validated or not

if(dataForm.validator.validate())

Isn't this var dataFrorm get overwriten with next generated form? So now if you try to check if first form got validated, it actually checks last? Yes I could generate form id dynamically, but then I would need to do same thing with JS variable name? That does not sound right, or is it? Is there better approach to achieve the same goal?


texts: Magento 2 admin getting error "not allowed to edit the product's design attributes" during product save!

texts:
I have admin user account with limited access. When I am saving a product it is showing an error: not allowed to edit the product's design attributes like this screenshot:

What is the issue & how can it be fixed?


texts: Want to override Magento 2 Contact Form Block

texts:
I have created a custom module app/code/Demo/Mymodule and I want to override Contact Form Block.

After configuration and registration of module, I have Created di.xml in app/code/Demo/Mymodule/etc

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Contact\Block\ContactForm" type="Demo\Mymodule\Block\ContactForm" />
</config>

Then, I have created ContactForm.php in app/code/Demo/Mymodule/Block

<?php
namespace Demo\Mymodule\Block;
use Magento\Framework\View\Element\Template;
class ContactForm extends \Magento\Contact\Block\ContactForm{
public function getFormAction()    {
echo "Demo Text";
return $this->getUrl('contact/index/post', ['_secure' => true]);
}
}

I have run all the commands like:

php bin/magento setup:upgrade
php bin/magento cache:clean

But, I am not getting output (Demo Text) on contact page


texts: Magento 2 : How to send data from controller to block and display on front end

texts:
I have used the following code

<?php

namespace Inchoo\Helloworld\Controller\Index;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Inchoo\Helloworld\Model\PostFactory;

class View extends Action
{

    protected $_modelPostFactory;

    public function __construct(
        Context $context,
        PostFactory $modelPostFactory
    ) {
        parent::__construct($context);
        $this->_modelPostFactory = $modelPostFactory;
    }

    public function execute()
    {

        $postModel = $this->_modelPostFactory->create();

        // Load the item with ID is 1
        $item = $postModel->load(1);
      //  var_dump($item->getData());

        // Get news collection
        $postCollection = $postModel->getCollection();
        // Load all data of collection
         var_dump($postCollection->getData());

    }
}

I have collected the database table field values using the above code. Now i need to send the to block. And need to display in front end

please help me


texts: Auto Add Product Attribute Options when Creating a new Product by Rest API

texts:
Is there a way to tell Magento 2 to:

Send custom_attribute Label instead of Value;
Auto create option in case the Label doesn't exist yet.

I was able to do it with Magento 1 API, but I can't find a way to do the same using Magento 2.

Rest API endpoint I'm using: PUT http://localhost/rest/V1/products/123456

Body:

    {
      "product": {
        "attribute_set_id": 4,
        "sku": "123456",
        "name": "Name Example",
        "price": 9.99,
        "weight": 5,
        "created_at": "10/3/18, 1:03 PM",
        "updated_at": "10/11/18, 9:55 PM",
        "extension_attributes": {
          "stock_item": {
            "qty": 1,
            "is_in_stock": true,
            "is_qty_decimal": false
          }
        },
        "custom_attributes": [
          {
            "attribute_code": "warranty",
            "value": "6 Months"
          }
        ]
      }
    }


texts: Would there be any way to remove cart products from your id on page load? I'm working on it, I researched a lot too, but I found almost nothing that could help me to do a function to remove products from the cart according to its id in loading or reloading the page, since this was something specific, since only you can have a product of a category in each request and I wish I could handle that exception that exists. Thanks in advance.


texts:
I want to create pagination on my Category pages. I have added this too the footer and configured it via the config and it shows up as expected.

Looks great at first sight, however when I select a different page, for example the 4th page. I get redirected to a link like. https://www.example.com/en/mycategory/where/p/4/

This page gives a 404 error. https://www.example.com/en/category4?p=4

Works fine, I can't seem to be able to change the URL structure anywhere. The first idea which comes to mind is to use htaccess rewrites. But this will get nasty very soon if I am also going to add filters.

Which generate links such as https://www.example.com/en/mycategory/where/dir/asc/order/price/

And changing the amount of products per page generate a link like
https://www.example.com/en/mycategory/where/limit/30/
Which all give 404 errors.

This will become a mess to do via htaccess if I ever want to make these combinable.

What place should I look to figure out the URL structure, or where should I activate to accept this url structure? (I prefer to be able to change it because this looks like bad SEO)

Since categories can have subcategories, a link can also have more subdivision before the "/where/" making htaccess even worse.
URL: https://example.com/en/mycategory/mysubcategory/where/p/5

Edit: I tried the following htaccess code, which is supposed to be recursive, but I get 500 internal server errrors.

Turn the slashed URL into query strings

RewriteRule ^(.*)/where/([^/]*)/([^/]*)(/.*)?$ $1/where/$4?$2=$3 [L,QSA,R=301]

Remove the "/where/" from the url

RewriteRule ^(.*)/where/?$ $1 [L,QSA,R=301]

(I'd prefer a 301 redirect because of SEO reasons, don't want my pagerank splitting up.)


texts: How to resolve the "Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento 2"?

texts:
I am getting warning as

  "Direct object instantiation (object of \Zend_Db_Expr) is discouraged
  in Magento2"

when I did MEQP2.

Please anyone can help me to resolve this warning.

I am getting issue in below line.

  $Qry = $connection->select()
              ->from($this->resourceConfig->getTable($tableName), [new \Zend_Db_Expr('COUNT(*)')])
              ->where('store=?', $storeId);

Thanks in Advance


texts: Unable to login admin panel after installing better blog extension

texts:
I've downloaded the better blog extension and am also getting module details when i put the following command in command prompt

php bin/magento setup:upgrade

But when I have tried to login my admin panel, I'm getting an error and it says:

"Specified invalid parent id (Mageplaza_Core::menu)","1":"#0 C:\\xampp\\htdocs\\magento2\\vendor\\magento\\framework\\Interception\\Interceptor.php(58): Magento\\Backend\\Model\\Menu\\Builder->getResult(Object(Magento\\Backend\\Model\\Menu))\n#1 C:\\xampp\\htdocs\\magento2\\vendor\\magento\\framework\\Interception\\Interceptor.php(138)


texts: magento 2 override block \Magento\Theme\Block\Html\Header

texts:
I am trying to override block \Magento\Theme\Block\Html\Header
But it is not working at all no error.
Any suggestion?

Created new module.
Header.php code

/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Webkul\MagentoTheme\Block\Html;

/**
* Html page header block
*/
class Header extends \Magento\Theme\Block\Html\Header
{
public function HelloWorld()
{
    echo "Hello World Dear Hamza ......................................";
    die();
}
}

etc/di.xml code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Theme\Block\Html\Header" type="Webkul\MagentoTheme\Block\Html\Header" />
</config>


texts: How to add filter for categories in Magento?

texts: There is a category of goods Sale. It is empty. There are no items added through the admin panel. When we go to the Sale category, it dynamically populates the products with special price. As to this category to apply filter? For example color, size. Please help.


texts:
I'm trying to save the attachment file in my custom module using $.ajax({}) request. But it's not working for me. For these, I tried the below code.

In cart page having below code.

        Add File to Item

        <?php
            $uName = "itemUploadFile_" . $itemId . "_" . "[]";
            $id = "upload_" . $quote_id . "_" . $itemId;
        ?>
        <input id="<?php echo $id; ?>"  name="<?php echo $uName ?>" multiple="" type="file" class="input-text"/>

And javascript code is below

When I send file data using e.target.files[j] it's not working for me.

Can you please suggest us how can I send attachment file details to ajax request?


texts: Adding UPC in New Order Transactional Email template

texts:
I've been trying to simply add the product field: UPC to new order transactional emails, in addition to SKU that's the default.

I'm pretty sure I found the template to make the modifications from another help article on making changes to the template. But can't find the right way to pull the actual UPC to show.

I'm making modifications to the template:
/store/app/design/frontend/MYTHEME/default/template/email/order/items/order/default.phtml

The table cell next to SKU, I have tried all of the following calls for UPC:

<?php echo $_item->getUpc()
<?php echo $_item->getData('upc') ?>
<?php echo $this->getData('upc') ?>
<?php $this->getUpc($_item)  ?>

I'm pretty much just taking stabs at it, but didn't think it would be this difficult considering it's pretty much a key product field, if you want to use an additional code other than an internal SKU.

Help?
Thanks


texts: 2.3.0 - Custom Payment Method - Invalid Form Key. Please refresh the page

texts:
I have a custom payment method that uses the cc-form to take debit/credit card payments.

After the user has entered their card details, they are re-directed to my controller with a hidden form, then to the 3dsecure page.

After 3dsecure, they are re-directed to the same controller and various logic is checked.

After the logic is valid, they are re-directed to the checkout success page.

This was working with Magento 2.2, but in 2.3.0 this is not working.

After placing order, I am re-directed to 3dsecure as normal, but on returning from 3dsecure, I am re-directed to the home page with

  "Invalid Form Key. Please refresh the page."


texts: Text field attributes in layered navigation

texts:
I'm currently setting up a Magento for some friend of mine that sells wines.
He would like to have a quick search somewhere where he can filter out all wines by grape or wine house or region or country. Unfortunately you can't filter wines in layered navigation by text fields. Or can I somehow.

I would really appreciate any help on this guys!
Thanks


texts: how to change the product video in magento

texts: I am using  Magento ver. 1.9.2.3. Here how to change the product videos. I am not seeing the any video_url attributes in the admin panel.please advise me. Thanks


texts: Provide sub-admin menu accessibility for whole module and a number of modules in a single go

texts:
I am running Magento CE 1.9.2.1 in my site which has many third-party modules installed having ton of admin menu items of their own.

Now I have created a sub-admin role, which is not as control-freak as Main admin role, but now I want to assign access to every third-party module I have installed, to the newly created "SubAdmin" role.

I have already provided the "acl" tags in my config.xml files of all third-party modules. Now I have to add following code to every adminhtml controller of every thirdparty module for making it accessible for every subadmin roles:

protected function _isAllowed() {
    return Mage::getSingleton('admin/session')->isAllowed('module/menualias');
}

Now I want to provide access to all modules from one Admin Observer file so I don't have to edit every controller of all modules. How can I do that or Can I even do that ?


texts: Magento site automatically and frequently enters maintenance mode. How to resolve?

texts:
Seemingly out of nowhere my Magento keeps entering maintenance mode and brings my site offline. It's happened 4 times in the last 3 or so weeks and the only temporary fix thus far  is to delete the maintenance.flags file via ftp.

First, what could cause this and how can I go about finding it?


texts: Show this text only when customer fills in new address in checkout

texts:
* Indicates required field.

I want this text to be shown only when customer fills in new address form in one page checkout.

Otherwise if customer chooses address from dropdown this text should be hidden.

Can someone pls help me with this.


texts: How to get Shipment Id in order page View.php

texts:
I am using the partial shipment case for multiple shipments and multiple tracking number against one order. For this i have added the new button (Leopard TN) on order view page. Actually when we click on this button its will send the shipment id and order id to the external page by using query string.

I have the order id in the external page by using the below code but i also need to get the shipment id in the next page.

$url = "http://www.exportleftovers.co/leopardmagento/api_call_get.php?order_id={$order->getId()}";
$this->_addButton('get_review_payment_update', array(
    'label'     => Mage::helper('sales')->__('Leopard TN'),
    'onclick' => "window.open('".$url."')"

));

Is anyone know how can i get the shipment id and send to the external page?


texts: Magento 2 home page issue - 1 exception(s): Exception #0 (InvalidArgumentException): Required parameter 'theme_dir' was not passed

texts:
How to solve the home page issue,
1 exception(s):
Exception #0 (InvalidArgumentException): Required parameter 'theme_dir' was not passed
Exception #0 (InvalidArgumentException): Required parameter 'theme_dir' was not passed
#1 Magento\Framework\View\Design\Fallback\Rule\Theme->getPatternDirs(array('area' => 'frontend', 'locale' => 'en_US', 'file' => 'i18n/en_US.csv', 'theme_dir' => NULL)) called at [vendor\magento\framework\View\Design\FileResolution\Fallback\Resolver\Simple.php:125]


texts: Uncaught Error: Call to undefined method Magento\Quote\Api\Data\AddressExtension in magento 2

texts:
I have try to add custom field(textbox) in shipping and billing section on checkout page. I have create extension attribute like this :
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\AddressInterface">
        <attribute code="countrycode" type="string"/>
    </extension_attributes>
</config>

and below code is 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\Quote\Model\BillingAddressManagement">
        <plugin disabled="false" name="Checkoutattribute_Plugin_Magento_Quote_Model_BillingAddressManagement" sortOrder="10" type="vendor\extension\Plugin\Magento\Quote\Model\BillingAddressManagement"/>
    </type>
    <type name="Magento\Quote\Model\ShippingAddressManagement">
        <plugin disabled="false" name="Checkoutattribute_Plugin_Magento_Quote_Model_ShippingAddressManagement" sortOrder="10" type="vendor\extension\Plugin\Magento\Quote\Model\ShippingAddressManagement"/>
    </type>
</config>

plugin target file
<?php

 namespace vendor\extension\Plugin\Magento\Quote\Model;

 class ShippingAddressManagement
{

    protected $logger;

    public function __construct(
        \Psr\Log\LoggerInterface $logger
    ) {
        $this->logger = $logger;
    }

    public function beforeAssign(
        \Magento\Quote\Model\ShippingAddressManagement $subject,
        $cartId,
        \Magento\Quote\Api\Data\AddressInterface $address
    ) {

        $extAttributes = $address->getExtensionAttributes();
        if (!empty($extAttributes)) {

            try {
                $address->setCountrycode($extAttributes->getCountrycode());
            } catch (\Exception $e) {
                $this->logger->critical($e->getMessage());
            }

        }

    }
}

But its showing error like this

Fatal error: Uncaught Error: Call to undefined method
Magento\Quote\Api\Data\AddressExtension::getCountrycode() in
app/code/vendor/extension/Plugin/Magento/Quote/Model/ShippingAddressManagement.php:30

Once remove generated folder and try to place order

its showing error like  {"message":"Property "Countrycode" does not
have accessor method "getCountrycode" in class
"Magento\Quote\Api\Data\AddressExtensionInterface".","trace":"#0
/home/php73dev/public_html/mobelaris-upgraded/Source/server/vendor/magento/framework/Reflection/NameFinder.php(59):

Ref from :  Magento 2 : Add extra text field in checkout billing address and save it in order
Thanks.


texts: Redirect to specific controller from observer without changing my current browser Url

texts:
I had written a observer to trap product view page event and it is working fine.Now in that code i want to call a controller and pass the product id in it and render the custom view.phtml file, so how can i call that controller without changing my current browser url and render the view.phtml file on same url.

My Observer Code is Given Below

public function getProductView(Varien_Event_Observer $observer)
{
      $resp = $observer->getEvent()->getFront()->getAction()->getRequest();
      $requestUri = $resp->getRequestString();
       if ($resp->getActionName() == 'noRoute'){
           $requestUri = $resp->getRequestString();
           $requestUri = ltrim($requestUri, '/');
           $this->db = Mage::getSingleton('core/resource')->getConnection('core_write');
           $sql = "SELECT * FROM core_url_rewrite WHERE request_path like '%".$requestUri."%'";
           $data = $this->db->fetchAll($sql);
           // header("Location: " . Mage::getBaseUrl() . "customproduct/prodId=".$data[0]['product_id'], 301);
           // exit;

           //header('location:'.MAGE::getBaseurl()."customproduct",301);

           //Edit: action not passed in to this event; passed in generic generate_blocks event
             //Mage::getUrl('customproduct');
           exit;
       }
    }


texts: Alignment of subcategories on category page if more than 4

texts:
It displays four subcategories in single line, if i add minimum 4 in magento main-category pages,,... but if i add one more subcategory, then it takes only 3 per row. How to debug this. I want to display 4 subcategories per row
I have add static block to display subcategories.

    Ludo

        Paraolympic

        Travel-Game

        Carrom

            Fishing

            Chess

            Dart


texts: CONNECT ERROR: The 'local' channel is not installed. Please use the MAGE shell script to install the 'local' channel

texts:
I am kind of new to magento and php. I am getting the below error

I found many solutions which says that in order to fix the above error we should do following steps:

chmod 777 mage
./mage mage-setup

when I try to run mage command in ubuntu I get

 No command 'mage' found, did you mean:
 Command 'mago' from package 'mago' (universe)
 Command 'make' from package 'make' (main)
 Command 'make' from package 'make-guile' (universe)
 Command 'mpage' from package 'mpage' (universe)
 Command 'mag' from package 'texlive-binaries' (main)
 Command 'page' from package 'tcllib' (universe)
 Command 'mame' from package 'mame' (multiverse)
 mage: command not found

Please help me in order to fix the issue.


texts: Modman - 500 error after module installation - how to fix it?

texts:
After module installation Server error 500.
Is there any way to check what is causing this issue ?
How to restore to the state before installation ?
Tried modman repair, no success, tried remove module manually, repair, still no luck, any ideas ?


texts:
In Magento 2.1 When I enable Ajax on add to cart on Product detailed Page by "bindSubmit": true in add-to-cart.phtml

<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "catalogAddToCart": {
                "bindSubmit": false
            }
        }
    }
</script>

to

<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "catalogAddToCart": {
                "bindSubmit": true
            }
        }
    }
</script>

Now after clearing cache, I added a simple product to cart which was perfect, but on product with Option(Configurable option) when I add to cart without selecting the option, It show error "This is a required field.", but the ajax starts already and refresh the page giving error "Please specify product's required option(s).". Meaning Ajax add to cart don't wait for me to select the option, when I do not select option.

Hope you understand, what I am trying to say.


texts: Magento Admin not working - after deleted store from admin panel

texts:
I have created two store in magento and one store deleted by mistake without backup. Now showing this error

Please Help me how to solve.


texts: Magento 2 - Different menu for Mobile theme

texts:
I have new custom theme that has default menu. I need to build mobile menu separately.

I can do it easily by media query (CSS) but I don't think this is a good approach to hide desktop menu from mobile and hide mobile menu from desktop, since this is not a good approach if you focus on optimization.

Is it possible to check in PHP tha user is coming from mobile and do not show desktop menu, and wise versa for desktop menu.

Code would be something like this:

if(Mobile){
    //Mobile menu code here
}
else{
    //Desktop menu code here
}


texts: How to add address field in the registration form

texts:
To enable the address field in Registration form, I added

<action method="setShowAddressFields">

  <param>true</param>

</action>

in base/default/layout/customer & in base/default/layout/persistent
Also i tried giving this piece of code in local.xml. But none worked. Can anyone please tell me what should be done or where i went wrong?


texts: How magento split the discount amount on each ordered item in case of shopping cart rule having fixed amount of discount on whole cart

texts:
I'm struggling to figure out how Magento do that, split the discount amount on each ordered item in case of shopping cart rule having a fixed amount of discount on the whole cart
For example, In the cart, I have 3 items and there is coupon code "test5" after applied this coupon will get a discount of $5.00. In admin on order details page, Magento distribute discount amount.
So I want to know the logic of how Magento distributes the discount amount on each ordered item.

Thanks in advance!


texts: Add to cart by URL and Error Handling on 1.9

texts:
So I have managed to get rudimentary add to cart links working from external sources. Using the following sources:

Official & out of date Wiki

This StackOverflow post

Here is the working code

As long as the item is in the database, and is in stock, then it works. However as soon as you try to add an item that doesn't exist, or an item is out of stock, one of a number of errors are thrown:

Fatal error: Uncaught exception 'Mage_Core_Exception' with message 'This product is currently out of stock.' in /var/www/domain.com/app/Mage.php:595 Stack trace: #0 /var/www/domain.com/app/code/core/Mage/Checkout/Model/Cart.php(284): Mage::throwException('This product is...') #1 /var/www/domain.com/add-to-cart.php(50): Mage_Checkout_Model_Cart->addProduct('2', '1') #2 {main} thrown in /var/www/domain.com/app/Mage.php on line 595

Since there seems to be other people having issues with adding out of stock products to the cart, how can I catch this error either outside of or inside of magento and then continue to the cart? With error printing disabled the script just returns a blank white page and does nothing.


texts: Full Page Cache - Hole punch for timestamp

texts:
Many of my templates require a timestamp (for timers), when implementing full page cache (using nitrogento) the timestamp gets cached too which ends up showing wrong timestamp.

What methods can I employ to still keep most of my page cached yet hole punch the timestamp part


texts: Magento 2: How to edit existing product tab

texts:
Please guide there are tabs on product page named Details, More information, Reviews. Can you please tell me how to add attributes in these tabs. and please tell me if I want to change tab name "Details" to "Description", "MORE INFORMATION" to "SPECIFICATIONS".

The first tab is for Details in product how to add/edit from admin.

The second tab is for MORE INFORMATION in product how to add/edit attributes from admin.


texts: Magento 2 Error while import bulk product image programmatically

texts:
I am using magento 2.1.11. I am trying to fetch almost 4000 product with product image.Using below code.

$mediaDir = BP.'/pub/media/';
$tempcatimg = $mediaDir.'/tempcatimg';
$count = 0;
foreach($images as $image){
  $path = $this->saveImage($domain.$image->url , $image->id, $tempcatimg );
   if ($count == 0){
        $product->addImageToMediaGallery( $path , array('image', 'small_image', 'thumbnail'), true, false );
    }else {
        $product->addImageToMediaGallery( $path , null, true, false );
    }
}

Save function as below:

public function saveImage($img, $imgId, $mediaDir)
{
    $imageFilename      = basename($img);
    $image_type         = substr(strrchr($imageFilename,"."),1);
    $filename           = $imgId.'.'.$image_type;

    if (!file_exists($mediaDir)) mkdir($mediaDir, 0777, true);
    else chmod($mediaDir, 0777);

    $filepath           = $mediaDir . '/'. $filename;
    if(@getimagesize($img)){
        $ggh=file_get_contents(trim($img));
        $fp = fopen($filepath, "w");
        fwrite($fp, $ggh);
        fclose($fp);
        return $filepath;
    }else{
        return;
    }
}

But getting error

  Warning: Error while sending QUERY packet. PID=14131 in
  /vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php
  on line 316

I have search for above error got this solution

I have increased max_allowed_packet to 512M

But no luck every time getting error. If I comment addImageToMediaGallery code then all products are created.


texts: Is there a way to define a class of prices for products, so that I can create a discount across all of them at once? For example my store has chain chokers, of which there are single chain chokers and double chain chokers. The single chain chokers vary in price, but the double chain chokers are all the same price. Is there a way to define a price class for all double chain chokers to share, so that later if I change the price I only need to change it in one place?


texts: Data migrations from virtuemart to magento

texts: We are using Joomla 1.5.24 with Virtuemart 1.1.9 and we are looking for best way to migrate our data to magento enterprice latest version (1.9) . Is there any how-to guide?


texts: How to display subcategory list in static blocks of Magento 2

texts:
I am making static block and listing products like this

{{block class="Magento\Catalog\Block\Product\ListProduct" template="Magento_Catalog::product/list.phtml"}}

but i want to display subcategory in my static block for magento 2.


texts:
My client has recently moved server and Paypal is not returning the customers anymore to the site for review in the middle of the order and return ( to confirm a successful tx) like it used to. What are the factors which control this? What URL should we give to paypal so that the customer gets a this return at the end saying there was a successful transaction. A bit confused because if we give for instance the home page then the customer would not get the successful transaction message but there was no CMS page set up to achieve this either, so it must have been generated by paypal.

We are using Paypal standard.

Also there is the use SSL setting in the Paypal standard settings. Is this supposed to be yes or not. Client has an SSL cert.


texts: How do I change the main column on 2 column layout in Magento ver. 1.9.3.1

texts: MT Ghost Theme - we had a 3rd party start the website because of time.  The problem is, I am not able to change anything.  There is a lot of "white space" on the product detail page that makes the main image small, the right column "related products" images are actually bigger than the main product image.  The image cloud zoom is small.  I can go into the configurations and change the swatches size, but nothing else seems to change anything.  How do I override there CSS upload they originally did without doing another CSS upload to change the column sizes?  I look all through these discussions and anything I tried on the product design tab or on the category custom design tab has worked. Any ideas?


texts: how to stop creating multiple url of product

texts:
Product URL created for all stores even I have  disable the stores 1,2,3,4. I just need store 2. but while uploading the product the nos of product URL created for all stores(in url_rewrite table). If deleted those store 1,3,4 the store not found error getting.

Kindly help as i am new in magento 2


texts: Magento 2: Right folder to upload images

texts: I'm having product listing in CSV file. Please let me know right folder to upload product images.