texts: How to handle multiple-currency and custom quote item price on Magento?

texts:
I have a magento store with two currency, and my items in cart have a dynamic price. I succesfully calculate my quote_item price, with an observer and setCustomPrice and setOriginalCustom price.

$quoteItem->setCustomPrice($price);
$quoteItem->setOriginalCustomPrice($price);
$quoteItem->getProduct()->setIsSuperMode(true);
$quote->save();


texts: I am just curious to know about magento 2 performance and how it is better than magento 1.x versions. Recently I started learning magento 2 and found that it is a whole new set of theory based on pure zend architecture. So I just want to know if it is better than Magento 1.x versions.


texts: How to change the Magento 2.2 Session location from Redis back to File

texts:
I use Magento 2.2.

Changed session destination from file to Redis.

Is there a command to save back to a file?


texts: How to make last name optional in Magento 1.8

texts:
I've updated database directly to make is_required on  lastname = 0.

Removed the js validator for lastname in core.

Removed required field in frontend in widget/name.phtml.

However, The "Last name is required field" message still popups in 3 places:

During onepage checkout
When creating an order in admin for billing/shipping address
When inputing billing/shipping address for a customer in admin

Could some one help me please? We're doing wholesale and use only Purchase Order and COD. Thus, customer normally only puts in their outlet name in First Name field. Last Name is just optional for them.


texts:
I want change the width from the Product Tabs to 100% width. The problem now is that the tabs are inside the #maincontent and i can't move it to other reference container.
Have anyone a idea how i can do it?


texts:
I added new thumbnail grid in UI grid.

<column name="mimage" class="Vendor\Slider\Ui\Component\Listing\Column\MobileImage">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/thumbnail</item>
            <item name="sortable" xsi:type="boolean">false</item>
            <item name="altField" xsi:type="string">name</item>
            <item name="has_preview" xsi:type="string">1</item>
            <item name="label" xsi:type="string" translate="true">Mobile Image</item>
        </item>
    </argument>
</column>

Then I try folowing argumnets but it's not work

<item name="resizeEnabled" xsi:type="boolean">true</item>
<item name="resizeDefaultWidth" xsi:type="string">60</item>

Also try

<argument name="width" xsi:type="string">150px</argument>

But it displays default width.

Any help appreciated.


texts: How to use jQuery in setAfterElementHtml

texts:
I add script tag in my admin form like this:

$field->setAfterElementHtml('<script>
    //<![CDATA[

    jQuery( document ).ready(function($) {
       alert( "ready!" );

    });

   //]]>
</script>');

but i got an error like this:

  Uncaught ReferenceError: jQuery is not defined


texts: Magento 2 - Add/Remove Sections in admin catalog_product_new for a specific product type

texts:
I am trying to modify sections for specific product types.
How can I add or remove sections like "Design" or "Search Engine Optimization"?


texts: Magento 2.2.5 extensions conflict (Solved)

texts: I've a problem with two extensions. One is for add custom registration fields, another is for customer approval. When new customer try to create new account and click on create account, account will be created but on page get http error 500. How can i do to fix this problem?


texts: How to Update Products Details using sku in magento 2

texts:
How to Update product details using sku via script??
for example update description , short desc, price etc.. for a configurable product or a simple product


texts: Magento 2 - Creating admin page error 404

texts:
I have create an admin page but i get 404 error. What i'm wrong?

  etc/adminhtml/routes.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route id="blog" frontName="blog">
            <module name="Altravista_Blog"/>
        </route>
    </router>
</config>

  etc/adminhtml/menu.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
      <add id="Altravista_Blog::blog" title="Blog" translate="title" module="Altravista_Blog" parent="Magento_Backend::content" sortOrder="50" dependsOnModule="Altravista_Blog" resource="Altravista_Blog::blog"/>
      <add id="Altravista_Blog::blog_posts" title="Posts" translate="title" module="Altravista_Blog" parent="Altravista_Blog::blog" sortOrder="10" dependsOnModule="Altravista_Blog" action="blog/posts" resource="Altravista_Blog::blog"/>
    </menu>
</config>

  Controller/Adminhtml/Posts/Index.php

<?php
  namespace Altravista\Blog\Controller\Adminhtml\Posts;

  class Index extends \Magento\Backend\App\Action
  {
    /**
    * @var \Magento\Framework\View\Result\PageFactory
    */
    protected $resultPageFactory;

    /**
     * Constructor
     *
     * @param \Magento\Backend\App\Action\Context $context
     * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory
    ) {
         parent::__construct($context);
         $this->resultPageFactory = $resultPageFactory;
    }

    /**
     * Load the page defined in view/adminhtml/layout/blog_posts_index.xml
     *
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {
         //return  $resultPage = $this->resultPageFactory->create();
        die('Hallo Admin');
    }
  }
?>

  this is the admin url /admin/blog/posts/index/key/


texts: Add block after sidebar on checkout page

texts:
For accesibility reasons I want to move checkout button after the sidebar. I am able to move checkout button to sidebar but I want to move it after the sidebar in the html layout. I am able to add blocks to #checkout container but it always appears before the sidebar even if I place it in web/js/template/sidebar.html after the sidebar div.

........
........

Edit 1:

Following is what I tried. It adds a div before aside but not after aside.

onepage.phtml

sidebar.html

...

Edit 2

I tried to extend the checkout module and used sortOrder attribute but still my block loads before aside in html.

checkout_index_index.xml

<item name="sidebar" xsi:type="array">
    <item name="sortOrder" xsi:type="string">900</item>
</item>
<item name="afterSidebar" xsi:type="array">
    <item name="sortOrder" xsi:type="string">9999999999</item>
    <item name="component" xsi:type="string">MyModule_helper/js/summary/sidebar/buttons</item>
    <item name="displayArea" xsi:type="string">afterSidebar</item>
    <item name="config" xsi:type="array">
        <item name="template" xsi:type="string">MyModule_helper/summary/sidebar/buttons</item>
    </item>
</item>

onepage.html

Thanks in advance..


texts: What is the attribute to check if products are sold in incrememts?

texts:
I have the below HTML that I need to wrap in a PHP IF Statement. I need the statement to check if Enable Qty Increments = Yes (set in Inventory settings of Magento) however, I'm not sure what the attribute to check is.

<?php if($_product->getAttributeText('INSERT ATTRIBUTE HERE')=='Yes'): ?>

Only available in box quantities

<?php else: ?>

Buy as much as you want

<?php endif; ?>


texts: Override TableRates if StoreView not Default

texts:
I want to override the TableRate values, if the StoreView is not the default one.
So I wrote a plugin for Magento\OfflineShipping\Model\Carrier\Tablerate.php.
The code is not working...

class Shipping2
{
public function __construct(
    \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
) {
    $this->_rateMethodFactory = $rateMethodFactory;
}

public function afterCollectRates(\Magento\OfflineShipping\Model\Carrier\Tablerate $subject, $result) {
    /** @var \Magento\Shipping\Model\Rate\Result $result */
    //$result = $collectRatesResult->getResult();

    /** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
    $method = $this->_rateMethodFactory->create();

    /*$method->setCarrier('tablerate');
    $method->setCarrierTitle('Best Way');
    $method->setMethod('bestway');
    $method->setMethodTitle('Table Rate');*/

    $amount = 100;
    $method->setPrice($amount);
    $method->setCost($amount);

    $result->append($method);

    return $result;
}

}

I do not know what is wrong with it...
Can someone push me into the right direction?


texts: magento 2 override a functionality compared with magento 1

texts:
In magento 1 we have local - community - core areas inside app->code folder. When you want to override a functionality placing code with same names in local or community will do the job.

working in magento 2,
I saw only one folder inside the app->code and it is magento. If we want to create an adjustment in price (eg: calculator.php ) do we have to re-write core files or we have to work in another way?.

If I create a module in app->code->magento->vendorname to rewrite pricecalculation in catalog, which structure do I have to create in order to change the value and give magento 2 the parameter to let the application know that I want to override the catalog price?.


texts:
Recently, we noticed there are 4 files being constantly exported to var/export. It contains what appears to be billing/payment info for customers - even though our Magento store doesn't store any credit card information.

We've confirmed with our host that these files haven't been accessed by anyone via the logs, but no matter what we do - deleting them, renaming var/export - they are still being constantly generated with the same file name and new entries are being recorded into it.

We didn't notice any recently modified php or phtml files that would indicate a hack, not sure how to trace to the source of the problem.

Does anyone have an idea on how to check what is causing these csv files to be generated? Could it possibly be some bug or something?


texts: not getting associated product's sku in export CSV Magento 1.9.2

texts:
I am trying to get associated product's Sku of configurable products in exported CSV file but not getting.

Here is my Action XML in "Dataflow-Advanced profiles" -

<action type="catalog/convert_adapter_product" method="load">
    <var name="store"><![CDATA[0]]></var>
    <var name="filter/type"><![CDATA[configurable]]></var>
    <var name="filter/sku"><![CDATA[]]></var>
    <var name="filter/status"><![CDATA[1]]></var>
    <var name="filter/attribute_set"><![CDATA[20]]></var>
</action>

<action type="catalog/convert_parser_product" method="unparse">
    <var name="store"><![CDATA[0]]></var>
    <var name="url_field"><![CDATA[0]]></var>
</action>

<action type="dataflow/convert_mapper_column" method="map">
    <var name="map">
        <map name="store"><![CDATA[store]]></map>
        <map name="websites"><![CDATA[websites]]></map>
        <map name="attribute_set"><![CDATA[attribute_set]]></map>
        <map name="type"><![CDATA[type]]></map>
        <map name="status"><![CDATA[status]]></map>
        <map name="visibility"><![CDATA[visibility]]></map>
        <map name="sku"><![CDATA[sku]]></map>
        <map name="name"><![CDATA[name]]></map>
        <map name="config_attributes"><![CDATA[config_attributes]]></map>
        <map name="associated"><![CDATA[associated]]></map>
    </var>
    <var name="_only_specified">true</var>
</action>.

<action type="dataflow/convert_parser_csv" method="unparse">
    <var name="delimiter"><![CDATA[,]]></var>
    <var name="enclose"><![CDATA["]]></var>
    <var name="fieldnames">true</var>
</action>

<action type="dataflow/convert_adapter_io" method="save">
    <var name="type">file</var>
    <var name="path">var/export</var>
    <var name="filename"><![CDATA[product-Export.csv]]></var>
</action>

When I'm running profile, it's exporting a configurable product's CSV file but the last two columns (config_attributes, associated) are always coming out blank.

I checked map() of app/code/core/Mage/Dataflow/Model/Convert/Mapper/column.php and print returning data of a product via $row = $batchExport->getBatchData();, but the printed array doesn't have the required fields.

Please let me know what I am missing or doing wrong.


texts: Recommended continuous integration tools for Magento 2

texts:
For companies deploying Magento 2, what CI (continuous integration) tools do you recommend? We use GitHub and commonly deploy to AWS Beanstalk instances, but some of our clients use Linux VMs on Microsoft Azure.

In the past, we have configured Jenkins on our own servers, but we're considering alternatives, including:

Deploy HQ
Beanstalk - Seems like you need DeployBot for GitHub integration.
Codeship
Others?

Requirements

Must work with Magento 2. Other frameworks like Drupal 8 are nice to have.
Must work with GitHub.
Should integrate with servers on AWS (either EC2 or AWS Beanstalk) and Microsoft Azure running Linux.

Helpful Links

What is the easiest way to deploy from GitHub to a web server?

https://www.quora.com/What-is-the-easiest-way-to-deploy-from-GitHub-to-a-web-server

How to deploy your code (compares Beanstalk to DeployHQ)

http://surprisehighway.com/article/how-to-deploy-your-code


texts:
Catalog category images don't appear after upload.

Steps:

upload an image or choose one from the gallery.
Image preview shows.
I save the catalog category.
The image doesn't appear when the page refreshes.

Actions taken:

I have re-indexed and cleared caches.
Checked for module conflicts - none.
I removed all modules - no change.
I upgraded site from Magento 2.3.2 -> 2.3.3 -> 2.3.4 and no change.
Deleted all vendor files and reloaded with composer install/upgrade - no change.

The uploaded works and the image file for the catalog category is located in/pub/media/catalog/tmp/category/2020-04-09.jpg

Magento is NOT adding the image url to the database.

I tried manually adding the image URL to catalog_category_entity_varchar but the image never appears or becomes replaced.

Extra Notes:

My local has permission set to 777 on all files and directories. The development server has regular permissions. The local and the development server have the same issue. So not a permission problem.

There are no JavaScript errors.

Does anyone know how to fix this or what the Magneto file is so I can debug?


texts: Call custom phtml on success page without override

texts:
In Magento 2 I want to call my custom phtml file order success page, but without overriding block. Is there any way to achieve this ?

I don't want to edit Magento success.phtml as I am creating module.

Any help will appreciated

Thanks.


texts: My site is very slow.While using ced commerce modules it die.Almost it takes 40 sec to load to open home page and other also.Without it it takes near about 12 sec.I am using lazy loading also.As well as cdn is used for to access images. Then why it is tooooooooo slow.Please let me know any solution.


texts: Magento 2.2.3 + PHP 7.1.32 results in "Function mcrypt_module_close() is deprecated" error

texts:
I am running Magento 2.2.3 together with PHP 7.1.32. The M2E Pro extension throws the Function mcrypt_module_close() is deprecated error.

I tried adding @ in front of any mcrypt calls, did not work. The strange thing is, it complains about line 112 in vendor/magento/framework/Encryption/Crypt.php but the line has the @ in front of the call, like this:

 @mcrypt_module_close($this->_handle);

So any idea what I might try?


texts: Magento 1 StoreView ignores StoreScope configuration

texts: Magento 1 On storeScope flatrate shipping method is disabled but when accessing site in checkout it is still possible to choose it to complete order. What could be the problem? There are no hardcodes in code for this.


texts: I need to use Chosen in magento instead of "select " for multi select.I didn't find any thing about it. How should I add jquery for it. I am trying to solve Following issue


texts: Magento 2: How can I add custom attribute in order summery for checkout page?

texts:
I am trying to display a product attribute value

I have found the template where it is displayed:

vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html

How can I get the value of an attribute to display?


texts: showing product from specific categories in homepage!

texts: I am wondering how do I display products from chosen category in my homepage?


texts: Magento Call a function of Model in Controller

texts:
I have a function abc in a model. I want to call that function abc in the controller.
I am new to Magento and don't have any idea regarding this.
Can anybody tell me how to do this?


texts: loop through products collection each time print 3 products

texts:
i have a foreach loop to print a loop through a product collection

foreach ($productCollection->getItems() as $_product): ?>

                            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(161,123); ?>" width="161" height="123" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

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

                            <?php if($isShowDescription == 1):?>

                                    <?php $_description = nl2br($_product->getShortDescription())?>
                                    <?php $short_desc = substr($_description, 0, 200);  ?>
                                    <?php if(substr($short_desc, 0, strrpos($short_desc, ' '))!='')
                                        $short_desc = substr($short_desc, 0, strrpos($short_desc, ' '));
                                        $short_desc = $short_desc.'...';
                                    ?>
                                    <?php echo $short_desc;?>

                            <?php endif; ?>
                            <?php echo $this->getPriceHtml($_product, true) ?>

                                <?php if($_product->isSaleable()): ?>
                                    <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><?php echo $this->__('Add to Cart') ?></button>
                                <?php else: ?>

<?php echo $this->__('Out of stock') ?>

                                <?php endif; ?>

                <?php endforeach?>

This only print one product each time, how to make it that can print 3 products each time then go to next loop?


texts: How to post data to a payment provider when placing an order in Magento 2

texts:
The issue

I'm trying to integrate an online credit card payment service in Magento 2.2, but it's tough to understand all the docs on this topic at first, so I'm looking for some guidance.

What I need to achieve is to post several parameters like shop ID, secret_key order ID, order value, success url, error url etc. to the payment providers URL (form), where the customer can complete the credit card payment.

The provider handles all the security related stuff like storing and processing CC data.

This needs to happen when the customer presses the "Place order" button on checkout if this payment method is selected.

After the payment is complete, the customer should get redirected to the success URL or error URL.

My attempts & research

I've created a working payment method so far and I've created a simple payment gateway based on:

the official docs http://devdocs.magento.com/guides/v2.2/payments-integrations/payment-gateway/payment-gateway-intro.html on how to create a payment gateway.
the official sample payment gateway https://github.com/magento/magento2-samples/tree/master/sample-module-payment-gateway

And I've looked at Paypal Express to see how they do it -> As far as I can tell, it calls a controller in Module_Paypal/Controllers/Express/AbstractExpress/Start.php with the "Continue to Paypal" button.

Haven't gone into the details of Paypal's approach cause I'm just not sure if this is the right way to go about this...

Questions

What is the recommended way to post data and redirect customer to an external Payment processor/provider after an order is placed?
Should I go about it as per the official docs - to create a payment gateway? Or is there a better/easier approach?
If I need to create a payment gateway, do I need to use an authorize or capture command? (taking into account that I only need an order placed, no invoice processing is necessary)
Depending on the approach, I would like some guidance as to how to call the payment provider's payment-form URL, post data to it and redirect the customer to it after the "Place order" button is clicked.
Also any suggestions on how to call checkout/onepage/success if the transaction was successful for the customer? Or should I redirect to a custom controller if the payment was (un)successful?

EDIT

There is no complex API documentation, all I have to do is call the payment provider's URL with the post method and pass some parameters to it.

For example, a simple html form would do the trick like this:

<form name="payment-provider-authorize-form" action="https://payment-provider.com/authorize-form" method="post" >
    <input type="hidden" name="shop_id" value="$shop_id" />
    <input type="hidden" name="order_id" value="$cart_id" />
    <input type="hidden" name="amount" value="$total" />
    <input type="hidden" name="success_url" value="$success_url" />
    ...
    <input type="submit" value="Buy with Custom Payment provider" />
</form>

I'm currently thinking of:

redirecting the customer to the payment provider's url with $.post() inside the afterPlaceOrder function and getting the post data from system config through window.checkoutConfig
or redirecting to a custom controller with the afterPlaceOrder function, getting all post parameters there and somehow redirecting to payment provider's url (if this is the way to go, a small code example on how to do this in the controller would be very helpful)

And again I'm still not sure where Magento's Payment gateway commands like authorize fit into all of this. Do I even need them? Seems like they are meant for more complex integrations and aren't necessary in this situation...

@Joni Jones, could you please expand on your answer to question 4?

How would I post data with $.mage.redirect(window.checkoutConfig.payment...)? My first thought was using $.post().

Also is the Web API set-payment-information call really necessary even if I use the placeOrderAfter function?


texts: Catalog price rule doesn't apply overnight and possible incorrect time zone

texts:
Every time I update Magento I have got this probem: I have to manually applicate the catalog price rule, otherwise they don't work.

I have done the following changes:
File app/Mage.php:

date_default_timezone_set('Europe/Rome');//Instead of UTC

File Mage/CatalogRule/Model/Action/Index/Refresh.php(local copy and none):

$timestamp = $coreDate->gmtTimestamp('Today');

with this line:

$timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);

Source: https://stackoverflow.com/questions/25280095/magento-catalog-price-rule-disappears-at-night

Reading this question: Catalog price rule from today does not apply

The time zone set inSystem/Configuration/Genral/Locale options is correct, but if I run this script:

include('app/Mage.php');
Mage::app('admin');

echo date('Ymd His', Mage::getModel('core/date')->gmtTimestamp('today'));

it output 2015-11-07 23:00:00 instead of 2015-11-08 11:19:ss, basically a gap of twelve hours.

Cron Job Setting

File: /app/code/core/Mage/CatalogRule/etc/congif.xml

<jobs>
    <catalogrule_apply_all>
        <schedule>
            <cron_expr>0 1 * * *</cron_expr>
        </schedule>
        <run>
            <model>catalogrule/observer::dailyCatalogUpdate</model>
        </run>
    </catalogrule_apply_all>
</jobs>

File /app/code/core/Mage/Catalog/etc/config.xml

<jobs>
    <catalog_product_index_price_reindex_all>
        <schedule>
            <cron_expr>0 2 * * *</cron_expr>
        </schedule>
        <run>
            <model>catalog/observer::reindexProductPrices</model>
        </run>
    </catalog_product_index_price_reindex_all>
</jobs>

Value in cronjob setting:

EDIT
Using this:

date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));

it outputs the time without considering the daylight save, basically one hour in advance
EDIT 2
Reverting the changes in app/Mage.php: has solved the daylight save problem


texts: 'Mage_Core_Model_Resource_Db_Abstract' not found in shop\app\code\core\Mage\Core\Model\Mysql4\Abstract.php

texts:
I get an error when attempting to run my site on my localhost server.  I've done this many times in the past:  extract my site from git, point to my local copy of the database, configure localhost database in local.xml, and clear the 'var' directory to remove cache, sessions, etc.

However, now, I get the following error. Any clues to help my track down my configuration local hosting issue?

  Fatal error: Class 'Mage_Core_Model_Resource_Db_Abstract' not found in
  D:\Ampps...\shop\app\code\core\Mage\Core\Model\Mysql4\Abstract.php on line 36

Note: the file path is edited (with ...) to obfuscate the website details.   And, the file definitely does exist at the path reported in the error message.


texts: General System Exception Magento 2 UTF-8 BOM

texts: I have been uploading products to Magento 2 for some time using import via CSV. The first chunk worked fine and the second is throwing a general system error. UTF-8 BOM is being used... very challenging and rather frustrating. I am not sure what could be causing this to run as a general error. These two chucks are from the same exact file that I had separated out. Does anyone know of any other errors that can cause a general system exception to occur? UTF-8 BOM should compensate for any special characters. This is very odd that half of an upload will not work, on the same file and the other half would.


texts: Catalog promotions - Discount appear in product list but not in product view

texts:
I’ve applied some promotions to my products. After few days applied the promotions disappear in the product view page but remains in the product list.

For example, in the list, the promotions appear:

http://195.77.172.19/magento/index.php/smartphones

But in the product view, the promotions don’t appear:

http://195.77.172.19/magento/index.php/apple-iphone-5

The version it’s a clean magento 1.8.0.0. The problem appear few days after applying the promotion.

Any help would be apreciated, thanks!!!!


texts: How does product count on layered navigation in Magento 2.4 is being rendered?

texts:
i'm using magento 2.4.1 and successfully overriding the product collection for layered navigation by overriding the getProductCollection method. The problem is the layered navigation sidebar showing incorrect product count (the correct count is 3):

i want to try for this solution however i can't find Magento\CatalogSearch\Model\Search\IndexBuilder in Magento 2.4.1


texts: Upgrading mariadb on a running magento 1.9

texts:
I have a running magento 1.9 webshop. (nginx, mariadb 5.5, php-fpm)

I'm thinking about upgrading mariadb 5.5 to mariadb 10.

Is there anything I should be prepared for?

I have a staging site where I will test the upgrade, but it's better to be informed first instead of going by trail and error.

Edit:

To be clear; This is a question about what effect the upgrade it would have on my running webshop. I need minimal downtime.


texts: Call to a member function getId() on null in /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php

texts:
This error appears when I try to go to the frontend of the Server web. The admin works perfectly.

And even further, if I use the local files and the local installation of Magento everything works fine.

I'm getting a HTTP error 500, and in the logs appears this code:

  Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /var/www/vhosts/a//vendor/magento/framework/View/Model/Layout/Merge.php:751\nStack trace:\n#0
   /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php(684): Magento\Framework\View\Model\Layout\Merge->_getPhysicalTheme(Object(Magento\Theme\Model\Theme))\n#1
  /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php(633): Magento\Framework\View\Model\Layout\Merge->_loadFileLayoutUpdatesXml()\n#2 /var/www/vhosts//vendor/magento/framework/View/Model/Layout/Merge.php(527): Magento\Framework\View\Model\Layout\Merge->getFileLayoutUpdatesXml()\n#3 /var/www/vhosts///vendor/magento/framework/View/Model/Layout/Merge.php(506): Magento\Framework\View\Model\Layout\Merge->_fetchPackageLayoutUpdates('default')\n#4 /var/www/vhosts///vendor/magento/frame...\n'

The code that fails is this one:

protected function _getPhysicalTheme(\Magento\Framework\View\Design\ThemeInterface $theme)
{
    $result = $theme;
    while ($result->getId() && !$result->isPhysical()) {
        $result = $result->getParentTheme();
    }
    if (!$result) {
        throw new \Magento\Framework\Exception\LocalizedException(
            new \Magento\Framework\Phrase(
                'Unable to find a physical ancestor for a theme \'%1\'.',
                [$theme->getThemeTitle()]
            )
        );
    }
    return $result;
}

I run the commands:

rm -rf pub/static/*;
/opt/plesk/php/7.0/bin/php bin/magento setup:upgrade;
/opt/plesk/php/7.0/bin/php bin/magento setup:static-content:deploy;
/opt/plesk/php/7.0/bin/php bin/magento setup:static-content:deploy es_ES;


texts:
Trying to export the full grid data of a custom module. The function itself works but there's a limit of 20 (well a limit of how many rows are visible on the page). I need to export the full data from the button. I tried adding: $grid->setDefaultLimit(4000) but I realised that 4000 isn't always going to be correct. So I need something to say do all data. Here's my current function:

<?php
    class Namespae_Module_Adminhtml_GridController extends Mage_Adminhtml_Controller_Action {
        protected function _createSerializerBlock($inputName, Mage_Adminhtml_Block_Widget_Grid $gridBlock, $productsArray) {
            return $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_ajax_serializer')
                ->setGridBlock($gridBlock)
                ->setProducts($productsArray)
                ->setInputElementName($inputName);
        }

        public function indexAction() {
            $this->loadLayout();
            $this->_setActiveMenu('adminhtml/grid/index');
            $this->_addContent($this->getLayout()->createBlock('namespace_module/adminhtml_grid'));
            $this->renderLayout();
        }

        public function exportCsvAction() {
            $filename = 'inventory_report-' . date('d-m-Y') . '_' . date('H:i:s') . '.csv';
            $grid     = $this->getLayout()->createBlock('namespace_module/adminhtml_grid');
            //$grid->setDefaultLimit(4000);

            $this->_prepareDownloadResponse($filename, $grid->getCsvFile());
        }
    }

As I said, it all works but I need it for all data, not just what's visible on the screen.

How can I go about doing this??


texts: Is there any way to replace first name and last name with full name in magento 2 checkout form?

texts:
how to replace the first name and last name with Full name field in checkout form.
i couldn't find any extensions, code for solving this.


texts: I have a flow where I need to verify if user has verified their phone number, if not I have redirected them to verification page in my module, once the user verify their OTP sent to their number I need to auto login user, likewise it is done in the case of email verification, once user click to verification code they are auto logged in into their account


texts: RequireJs magento2 loading custom js plugin results in DOMException: Failed to execute 'querySelectorAll'

texts:
Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object HTMLDocument]' is not a valid selector.

this is my code in main.js file.

require([ 'rellax'], function ($) {
    $(document).ready(function () {
    console.log("entered the function rellax");
    var rellax = new Rellax('.rellax', {
        callback: function (position) {
            console.log(position);
            }
        });
    });
});

This is my requirejs-config.js

var config = {

    deps: [
        "js/main"
    ],
    map: {
    '*': {
        slick: 'js/slick.min',
        rellax: 'js/rellax.min'
        }
    },
};


texts: Magento 2: How can I deploy my theme only

texts:
I was using this for deploy the content but it is taking too much time.

php bin/magento setup:static-content:deploy

then I figure out adding the language make fast but it still deploy all the themes.

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

How can i  deploy only my theme content only?


texts: input_renderer does not come in action - Widget_Form

texts:
Taking example from this link

http://inchoo.net/magento/adding-magento-attribute-with-custom-input-renderer/

I create my renderer and associate it to a attribute in setup.php file:

                'price_increase' => array(
                    'group' => 'General setting',
                    'type' => 'decimal',
                    'backend' => '',
                    'frontend' => '',
                    'label' => 'Decimal element',
                    'input' => 'text',
                    'class' => 'validate-number',
                    'source' => '',
                    'global' => 0,
                    'visible' => true,
                    'required' => true,
                    'user_defined' => true,
                    'default' => 1,
                    'searchable' => false,
                    'filterable' => false,
                    'comparable' => false,
                    'visible_on_front' => false,
                    'unique' => true,
                    'input_renderer' =>'my_module/adminhtml_setting_render_percentage'
                ),

<?php

Percentage.php:

class My_Module_Block_Adminhtml_Setting_Render_Percentage extends Varien_Data_Form_Element_Text{

    public function getElementHtml()
    {
        $html = parent::getElementHtml();
        return $html."%";
    }
}

I use a Widget_Form_Container with Widget_Form to render my attribute, this is the code:

class My_Module_Block_Adminhtml_Setting_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm() {

        $setting=Mage::getModel('my_module/setting')->load(1);
        $form = new Varien_Data_Form(array(
            'id' => 'my_module_form',
            'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
            'method' => 'post',
            'enctype' => 'multipart/form-data'
        ));
        $form->setUseContainer(true);

        $form->setDataObject($setting);
        $fieldset = $form->addFieldset('registry_form',
            array(
                'legend'=>Mage::helper('my_module')->__('Generel option'),
                'class'=>'fieldset-wide',
            )
        );

        $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
            ->setEntityTypeFilter($setting->getEntityTypeId());
        $attributes->addFieldToFilter('attribute_code', array('nin'=>array('meta_title', 'meta_description', 'meta_keywords')));

        foreach ($attributes as $attribute) {
            $attribute->setEntity(Mage::getResourceModel('my_module/setting'));
        }
        $this->_setFieldset($attributes, $fieldset, array());

        $formValues = $setting->getData();
        $form->addValues($formValues);

        $entityTypeId=Mage::getResourceModel('my_module/setting')->getEntityType()->getId();

        $form->setFieldNameSuffix('setting');
        $this->setForm($form);
    }

The problem is My_Module_Block_Adminhtml_Setting_Render_Percentage does not come into action.


texts:
I tried to insert a new product

<?php
require_once("../app/Mage.php");
error_reporting(E_ALL);
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product = Mage::getModel('catalog/product');
try{
$product
//    ->setStoreId(1) //you can set data in store scope
    ->setWebsiteIds(array(1)) //website ID the product is assigned to, as an array
    ->setAttributeSetId(9) //ID of a attribute set named 'default'
    ->setTypeId('simple') //product type
    ->setCreatedAt(strtotime('now')) //product creation time
    ->setUpdatedAt(strtotime('now')) //product update time
    ->setSku('testsku61') //SKU
    ->setName('test product21') //product name
    ->setWeight(4.0000)
    ->setStatus(1) //product status (1 - enabled, 2 - disabled)
    ->setTaxClassId(4) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)
    ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) //catalog and search visibility
    ->setManufacturer(28) //manufacturer id
    ->setColor(24)
    ->setNewsFromDate('06/26/2014') //product set as new from
    ->setNewsToDate('06/30/2014') //product set as new to
    ->setCountryOfManufacture('AF') //country of manufacture (2-letter country )
    ->setPrice(11.22) //price in form 11.22
    ->setCost(22.33) //price in form 11.22
    ->setSpecialPrice(00.44) //special price in form 11.22
    ->setSpecialFromDate('06/1/2014') //special price from (MM-DD-YYYY)
    ->setSpecialToDate('06/30/2014') //special price to (MM-DD-YYYY)
    ->setMsrpEnabled(1) //enable MAP
    ->setMsrpDisplayActualPriceType(1) //display actual price (1 - on gesture, 2 - in cart, 3 - before order confirmation, 4 - use config)
    ->setMsrp(99.99) //Manufacturer's Suggested Retail Price
    ->setMetaTitle('test meta title 2')
    ->setMetaKeyword('test meta keyword 2')
    ->setMetaDescription('test meta description 2')
    ->setDescription('This is a long description')
    ->setShortDescription('This is a short description')
     ->setMediaGallery (array('images'=>array (), 'values'=>array ())) //media gallery initialization
    ->addImageToMediaGallery('IMG_0339.JPG', array('image','thumbnail','small_image'), false, false) //assigning image, thumb and small image to media gallery
     ->setStockData(array(
                       'use_config_manage_stock' => 0, //'Use config settings' checkbox
                       'manage_stock'=>1, //manage stock
                       'min_sale_qty'=>1, //Minimum Qty Allowed in Shopping Cart
                       'max_sale_qty'=>2, //Maximum Qty Allowed in Shopping Cart
                       'is_in_stock' => 1, //Stock Availability
                       'qty' => 999 //qty
                   )
    )
    ->setCategoryIds(array(3, 10)); //assign product to categories
$product->save();
//endif;
}catch(Exception $e){
Mage::log($e->getMessage());
echo $e->getMessage();
}
?>

but the error:

  SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
  update a child row: a foreign key constraint fails
  (db_db.catalog_product_entity, CONSTRAINT
  FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID FOREIGN KEY
  (attribute_set_id) REFERENCES eav_attribute_set
  (attribute_set_id)), query was: INSERT INTO catalog_product_entity
  (entity_type_id, attribute_set_id, type_id, sku, created_at,
  updated_at) VALUES (?, ?, ?, ?, '2015-10-08 08:09:50', '2015-10-08
  08:09:50')

What is the problem? I have setting the sku code and the other fields.


texts:
I have add a custom link to main menu in this way Adding a non-category link to the navigation links in magento 2

but how can i put this link BEFORE catalog menu link position?


texts: remove total excl tax in checkout, order invoice emails in magento2

texts:
In Store > Configuration > Shopping Cart Display Settings I set next configuration:

But in checkout and cart, order total incl. and excl. tax both are displayed.

How I can remove total exclude tax from checkout page and order invoice emails?


texts:
Maybe something is amiss with my Theme - but when I go into Wishlist and choose "add to cart" next to the item in the wishlist, nothing happens. No error or anything like that. You just click it and nothing happens.

Is this a form-key issue? Add to cart works everywhere else on the site it is just from the wishlist that this does not work. Also the "Add all to cart" function in the Wishlist works perfectly.

Thanks!

(source: premierlightbulbs.com)


texts: How do I add universal analytics to my magento store?

texts:
I set up a new Magento store, and a new analytics profile, and it asked if I wanted to use universal analytics or the original google analytics. After doing some checking, I found out I can create a new profile to track along side the original one so I have both now.

But the universal analytics profile isn't tracking anything and the original one is. It doesn't have traffic or goals. The tracking code is different. Is there a way to have Magento store to use universal analytics as well?


texts: Magento 2 model for adding images to media folder (not for products)?

texts:
When not working with products, is there a magento2 model/function that can be used for reading/writing images to the media folder? (like addImageToMediaGallery / getMediaGalleryProcessor()->addImage used when working with products).

I've made a module that loads data from an api/json link into to a custom table where one column is an image URL.
I wan't to save the image from the link to the local media folder.

I know I can do this with PHP (file_put_contents, fwrite, curl), but I'm thinking there must be a "Magento way" to do this?

I get the image url by
$image = $this->myRepository->getImageUrl($data['image_url']);


texts:
I have added header and footer in checkout page by changing layout into 1column
in onepage_index_index.xml.

I need footer only in checkout page.

I used IWD free extension for one step checkout.


texts: restrict some quantity for adding to cart

texts:
we needed "pre-order/Back order" feature [ user can buy out-of-stock Products ]

so we wrote custom module. how it works is , if we set value

"yes" to pre order attribute, it will  allow for pre-order,

for "NO", it will not show "Pre order" button in view page.

but problem is user can enter any number of quantity & add to cart items.

what we need is what quantity we enter in backend, only it should allow that much quantity to add-to-cart.

<?php $_collectionSize = $_productCollection->count() ?>
    <?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_productCollection as $_product): ?>
        <?php if ($i++%$_columnCount==0): ?>

        <?php endif ?>
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

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

                    <?php if($_product->isSaleable()): ?>
                        <?php if($_product->getPreOrder()): ?>
                        <button type="button" title="<?php echo $this->__('Pre-Order') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><?php echo $this->__('Pre-Order') ?></button>

                        <?php endif; ?>
                    <?php else: ?>

<?php echo $this->__('') ?>

                    <?php endif; ?>

        <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>

        <?php endif ?>
        <?php endforeach ?>

    <?php endif; ?>

complete code : http://pasted.co/8c8e0763


texts:
Right now I am facing very strange issue on magento setup. In my webshop some randomly admin user created with unknown username,and email . Whenever I try to delete that unknown user it automatically created with-in some days. Please check below screenshot.

Is there any way to prevent this type of issue ? I am too curious know about this, how this type of user created in admin without admin details?

Is Any one facing this of issue ?

Any help will be appreciated.

Thanks.


texts: How can i change order of Details tab to first in product detail page?

texts: I want to change order of Details Tab  to very first in product detail page. How can achieve this?


texts: Include all states except one in Tax Rate

texts:
Is there a way to exclude only one state from my tax rate rule? I need to apply 2% to all US states except New York. Do I need to create a rule for each state?

Thanks!


texts: overriding/extending price-options.js does not work

texts:
I need to override/extend the file price-options.js.
But it does not work, I always get the error

  TypeError: undefined is not a constructor

on this line

 $.widget('myCompany.mypriceoptions', $.mage.priceOptions, {

Here are my files:

myCompany\myModule\view\frontend\requirejs-config.js

var config = {

    map: {
        '*': {
            priceOptions: 'myCompany_myModule/js/price-options',

        }
    }
};

myCompany\myModule\view\frontend\web\js\price-options.js

define([
    'jquery',
    'underscore',
    'mage/template',
    'priceUtils',
    'priceBox',
    'priceOptions'
], function ($, _, mageTemplate, utils) {
    'use strict';
    var globalOptions = {
        qtyFieldSelector: 'input.qty',
    };
    $.widget('myCompany.mypriceoptions', $.mage.priceOptions, {
        options: globalOptions,

        _onOptionChanged: function onOptionChanged(event) {
            console.log('TEST!');
            var changes,
                option = $(event.target),
                handler = this.options.optionHandlers[option.data('role')];
            option.data('optionContainer', option.closest(this.options.controlContainer));

            if (handler && handler instanceof Function) {
                changes = handler(option, this.options.optionConfig, this);
            } else {
                changes = defaultGetOptionValue(option, this.options.optionConfig);
            }
            $(this.options.priceHolderSelector).trigger('updatePrice', changes);
        },

    });

    return $.myCompany.mypriceoptions;

});

EDIT:

I tried to use mixins:

myCompany\myModule\view\frontend\requirejs-config.js

var config = {

    config: {
        mixins: {
            'Magento_Catalog/js/price-options': {
                'myCompany_myModule/js/price-options': true
            }
        }
    }

};

myCompany\myModule\view\frontend\web\js\price-options.js

define([
    'jquery',
    'underscore',
    'mage/template',
    'priceUtils',
    'priceBox',
    'priceOptions'
], function ($, _, mageTemplate, utils) {
    'use strict';
    return function (priceOptions) {

        return $.widget('mage.priceOptions', priceOptions, {

            _onOptionChanged: function onOptionChanged(event) {
                console.log('TEST!');
                var changes,
                    option = $(event.target),
                    handler = this.options.optionHandlers[option.data('role')];
                option.data('optionContainer', option.closest(this.options.controlContainer));

                if (handler && handler instanceof Function) {
                    changes = handler(option, this.options.optionConfig, this);
                } else {
                    changes = defaultGetOptionValue(option, this.options.optionConfig);
                }
                $(this.options.priceHolderSelector).trigger('updatePrice', changes);
            }

        });
    }
});

The Result is that the .js file appears in the browser, but still the magento function is used instead of the costume one.


texts:
I've got a big issue with Magento 2.3.1, and translations on checkout, for store made in two langs - EN and PL. (PL set as default store)

I've got a custom template, with elements that override Luma, and PL lang pack from Mageplaza (https://github.com/mageplaza/magento-2-polish-language-pack) installed in copy&paste method, because of need to override some translations (placed correctly in app/i18n/Polish/pl_PL/ with adjusting Vendor to that directory). Besides one payment gateway, no more plugins that can influence those views.

On all of the places, translations work correctly, but on the checkout page, it seems like most translations were switching back to EN ones - step titles, minicart, some form fields like auth

What I've checked to make this work:

known issue with older versions of Magento 2 - Json\PreProcessor and Area::PART_DESIGN
redeploying everything (like setup:static-content:deploy pl_PL) with cleaning caches, cleaning manually cache and pub dirs
changing translate="'Shipping methods'" to data-bind="i18n: 'Shipping methods'"
defining theme translations
defining module translations
checking localStorage for mage-translation-storage - which surprised me, cause it contains correct dictionaries
toggling inline translations, and repeating cache clear, etc.
finding out, what we have got in generated js-translations.json - that seems to be correct.

The issue was found on my local env, same as on dev and pre-prod envs (deployed with deployer.org, with default M2 recipe)

Have anyone some other ideas, what I can try to get this working? :)


texts:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in lib/Zend/Db/Adapter/Pdo/Abstract.php:129

I get the following error on my local machine. (Mac OSX running Apache/MySQL natively) I can run Magento from the frontend, but I can't reindex at the command.


texts: Redirect to selected Dropdown options url

texts:
We are Displaying Drop-down options here using values Present in Backend

After selecting dropdown options & if we click on "See Cases", we are redirecting to particular product [ id : 44 ] using below code.

local/Company/Brand/Block/Frontend/View.php

public function getProduct()
    {
        $product =  Mage::getModel('catalog/product')->load(44);
            $p=Mage::registry('product');
            if ($p=='') {Mage::register('product', $product);}
            return  $product;
        }

But we want to do some ajax coding [ or any other way] & we have to redirect to Particular Brand & Model selected in Dropdown options as here

Custom Cases

Make Your Own design

<?php

$resource = Mage::getSingleton('core/resource');

$readConnection = $resource->getConnection('core_read');

$writeConnection = $resource->getConnection('core_write');

$readConnection = $resource->getConnection('core_read');

$query = 'SELECT category_id, category_name FROM ' . $resource->getTableName('outthink_advance_brand_category');

$categories = $readConnection->fetchAll($query);

$brandsArr = array();

$brandSelect = '<select id="brand_select">';
$brandSelect .= '<option value="">My Brand</option>';
foreach ($categories as $category){
$cat_id = $category["category_id"];

$brandSelect .= "<option value='".$category["category_id"]."'>".$category["category_name"]."</option>";

$query = 'SELECT `outthink_advance_brand`.brand_id, `outthink_advance_brand`.bmodel FROM `outthink_advance_brand` ';
$query .= ' inner join `outthink_advance_brand_category_item` on
(`outthink_advance_brand`.brand_id = `outthink_advance_brand_category_item`.brand_id )';
$query .= ' where `outthink_advance_brand_category_item`.category_id = '.$cat_id;

$brands = $readConnection->fetchAll($query);

$bArr = array();

foreach ($brands as $brand){
$bArr[$brand["brand_id"]] = $brand["bmodel"];
}
$brandsArr[$cat_id] = $bArr;
}
$brandSelect .= '</select>';

echo $brandSelect;
echo '<select id="model_select"><option value="">My Model</option></select>';
?>

 See Cases >

    <img height="200px;" width="2000px;" src="<?php echo $this->getSkinUrl('images/custom.png'); ?>" >

i will give 50 bounty if it works for me.


texts: Hide certain filter from layered navigation top category

texts:
I have the following question:

Add the layerend navigation of a top category, all the filters of all underlying subcategories are shown. In top categories, we only want to show two filters: product type and brand.

We experimented in view.phtml based on other topics, but haven't found the exact result.

It would be great if you could point us towards the solution!


texts: Unable to Download downloadable products

texts:
I was notified by one of my customer that he was unable to download the file that he bought recently. Whenever he clicks the link, website gives this error message-"An error occurred while getting the requested content. Please contact the store owner."

I tried checking this and found that he's true! I'm not able to figure out the exact reason for this.


texts: Calling phtml in _construct() in magento2

texts:
How to call the template in the construct() in Magento 2 as we used to call in Magento1.

protected function _construct()
{
    $this->setTemplate('custom_folder/myfile.phtml');
}

protected function _toHtml() {
    return parent::_toHtml();
}

Can we call the myfile.phtml in layout file?

or is there way to call in _construct()?


texts: Magento 2 extend $.mage.quickSearch Widget

texts:
I don't seem to be able to extend quick search module widget form-mini.js found in module/path: ../vendor/magento/module-search/view/frontend/web/form-mini.js

How can I extend in my custom module $.mage.quickSearch Widget?

Already tried in Vendor_Module/js/search:

define([
    'jquery',
    'underscore',
    'mage/template',
    'matchMedia',
    'jquery/ui',
    'mage/translate',
    'mage/menu'
], function($){

    $.widget('custom.quickSearch', $.mage.quickSearch', {
        _init: function () {
            alert("I'm here");
        }
    });

    return $.custom.quickSearch;
});

in requirejs-config.js

var config = {
    "map": {
        "*": {
            "quickSearch": "Vendo_Module/js/search"
        }
    }
};

I've previously successfully extended $.mage.menu Widget using the same technic as above but struggling with quick search does anyone know? help appreciated!


texts:
We are using our Magento site in webhosting company but due to traffic we facing low performance so we planning to install on VPS so i am confused and need some suggestion.

1) Which Linux OS need to use (Centos or Ubuntu) for best performance ?
2) 32bit or 64bit make any effect on performance ?
3) Which web server use apache2 or nginx ?
4) Which Mysql version ?
5) As i know .htaccess not support on nginx so if we use nginx we need to edit nginx.conf but any change required on nginx.conf if we add any extension on Magento ?


texts:
/checkout/cart page is working properly without any product in the cart.

But, when any product is added to cart, it shows nothing

[View source] of the page is as follows :-

Pl. guide.


texts: I need to show the magento poll to any of the pages of magento website. What code should I add to the PHTML files?


texts: Best method to filter out an item from custom model

texts:
I have a custom module using which we can add banner images in admin. I have implemented this module in the admin successfully. Now I want to display banner in the front end.

My custom table is given below

table name : banner
     fields: banner_name  |  store_ids  |  images  |   img_path  |  status

Store ids and Images are stored as comma-seperated-values. Now I want to select a banner item which corresponds to the current store view. Here is my code that I have tried to display banner module in the frontend.

<?php
    //get all active banner items as array
    $bannerItems = Mage::getModel('banner/banner') -> getCollection()
                -> addFieldToFilter('status',1) -> getItems(); //select only enabled items
    $curStoreId = Mage::app() -> getStore() -> getId(); //get current store id
    $banner = "";
    foreach($bannerItems as $item)
    {
         $data = $item -> getData();
         /*
             Store ids are saved as `comma separated values`. Hence making
             all store_ids as an array
         */
         $storearray = explode(",",$data['store_id']);
         foreach($storearray as $store)
         {
             if($store == $curStoreId) //check for matches, if yes load the item
             {
                 $banner = $item;
                 break;
             }

         }
         if($banner != "") // ensure to store the first matched item to load
         {
             break;
         }

     }
     //output
     if( empty($banner) )
     {
         die("no banner exist for this store.Please add a banner !!!");
     }
     else
     {
         die( print_r( $banner->getId() ) );
     }
?>

This provide me banner model correspond for the current store view. However I feel that this code is lengthy. So I need to know how i can achieve this at its best. Please provide your suggestions. Thanks in advance


texts: sort associated products of a configureable product

texts:
I have several configurable products with multiple associated products.  I want to sort the associated products in the drop down on the product page.  For example I have a size, I want to order them by 7/16, 9/16, 11/16...  etc.

I have ordered them in the attribute, and it doesn't change anything.  They remain sorted by "ID" no matter what I change.

Now, before you go marking this as a duplicate question....

I found this article - Magento 1.9.1 configurable product attribute sorting
which states that it doesn't work for version 1.9.2.1

I found this article which strangely is marked as duplicate and refers back to the first article, which doesn't work for 1.9.2.1!  Sorting associated products (configurable) in 1.9.2

So, how do I sort these attributes in my version?  Is this in a fix somewhere?


texts:
I was looking into a way of setting an EcoTax on products and I noticed that the way people seem to be doing it is by setting a Fixed Product Tax.

My problem with that approach is that it is time consuming. I set up all the settings correctly to enable FPT but my understanding is that now i have to walk through all the products and add a line for FPT to set country, state and tax value? There's gotta be a faster way than that...

So i'm actually wondering if it is possible to set that value onto a category instead and have the products in a given category inherit the value by default (like have it auto filled) but still keep the possibility to change it afterwards on a per product basis.

Is there any way to accomplish that?

And what happens in an import scenario? Let's say i'm importing 4000 products, is it possible to include the FPT as part of the import?


texts:
I'm having an issue regarding the checkout my online shop using Safari. When the user clicks to proceed with the checkout, the message that appears before the payment gateway redirection is: invalid session or temporary cookies disabled.

Note that this issue happens only at safari, at firefox and chrome is all ok. Thanks in advance for any help.


texts: Magento 2 Show/Hide Minicart based on customer group

texts: I want to show a minicart only for a specific customer group but I am unable to find the exact solution. If anyone knows please let me know. Thanks


texts:
How I can load cart page as Ajax?
I create a controller and try to show cart block like below

  echo   $block=$this->_view->getLayout()
        ->createBlock('Magento\Checkout\Block\Cart')
        ->setTemplate('Magento_Checkout::cart.phtml')
        ->toHtml();

but it does not show any thing
how i can load cart block with all chaild blocks ?


texts: Adding get and set methods for increment_id of customer_entity table

texts:
How to add get and set methods for increment_id of customer_entity table in magento2.

i have added in extension_attribute and added plugin for customerinterface class but it is not effecting core file


texts: How to refresh the cache programatically in magento 1 EE

texts:
What is the code for clean or refresh the cache programmatically because I have got lots of snippets but all are not working in Magento 1 enterprise edition.

Does anyone know how to solve it? Thanks in advance.


texts:
Out of despair, I ask question here.

I have a phtml (top_links.phtml) file that is cached when I am not logged in but not cached when I am logged in. I need it to be never cached as I display the geolocation there.

I tried

<?php echo $this->getChildHtml('topLinks',false); ?>

in the header.phtml

I tried

<block type="page/html" name="top.links2" as="topLinks" template="page/html/top_links.phtml">
            <action method="unsetData"><key>cache_lifetime</key></action>
            <action method="unsetData"><key>cache_tags</key></action>
        </block>

in my layout.xml

I tried to do as recommended there.

none worked. Then I realized that when logged in, it is not cached...

Can somebody give me some pointers?

Thanks already


texts:
When querying through a web browser the old SOAP API of a magento 1.9, Apache get mad, with the following:

http://www.fld.fr/index.php/api/soap/index/?wsdl=1

[negotiation:error] [pid 9289] [client 127.0.0.1:58231] AH00687: Negotiation: discovered file(s) matching request: /my/magento/root/api (None could be negotiated).
[negotiation:error] [pid 9286] [client 127.0.0.1:58232] AH00687: Negotiation: discovered file(s) matching request: /my/magento/root/api (None could be negotiated).
[negotiation:error] [pid 9281] [client 127.0.0.1:58233] AH00687: Negotiation: discovered file(s) matching request: /my/magento/root/api (None could be negotiated).
[negotiation:error] [pid 9290] [client 127.0.0.1:58234] AH00687: Negotiation: discovered file(s) matching request: /my/magento/root/api (None could be negotiated).

Atop of these line is a similar one, showing the external IP that triggered the SOAP call, all the others dealing 127.0.0.1 (and some PID changes).
Did the soap api v1 become a fork bomb when queried in web browser?

This has been only seen on Magento 1.9; it works fine on 1.7.


texts: How to export all products(simple.configurable,etc) with all variant and image from Magento1.9?

texts:
all I want to export all products from Magento 1.9.4.1.
So, Is there any script available?
We have 15000 total products.
Please if you have please let me know.

Thanks.


texts: Magento 2: How to change order status of Pending to Payment Received?

texts: Hi i'm new at magento 2 and i want to simulate the order status change of Pending to Payment Received. How can i do this? And which event can i observe to when the order status get changed to Payment Received?


texts: Magento 2.2: Problem with varnish.vcl generated

texts:
I have installed Magento 2.2.0-rc23 and now try to setup varnish FPC.

I generate VCL on BE System -> Advanced -> System -> Full Page Cache -> Varnish Configuration -> Export VCL for Varnish 5.

VCL was mounted to Varnish but during service start I getting the error:

Error:
Message from VCC-compiler:
Symbol not found: 's' (expected type DURATION):
('/etc/varnish/default.vcl' Line 203 Pos 23)
        if (obj.ttl + s > 0s) {
----------------------#--------

Running VCC-compiler failed, exited with 2
VCL compilation failed

Full section

sub vcl_hit {
    if (obj.ttl >= 0s) {
        # Hit within TTL period
        return (deliver);
    }
    if (std.healthy(req.backend_hint)) {
        if (obj.ttl + s > 0s) {
            # Hit after TTL expiration, but within grace period
            set req.http.grace = "normal (healthy server)";
            return (deliver);
        } else {
            # Hit after TTL and grace expiration
            return (fetch);
        }
    } else {
        # server is not healthy, retrieve from cache
        set req.http.grace = "unlimited (unhealthy server)";
        return (deliver);
    }
}

Software:

Varnish 5.1.3
Magento 2.2.0-rc23

EDIT:

I look for other examples and when we add 0 to s varnish work properly

sub vcl_hit {
    if (obj.ttl >= 0s) {
        # Hit within TTL period
        return (deliver);
    }
    if (std.healthy(req.backend_hint)) {
        if (obj.ttl + 0s > 0s) {
            # Hit after TTL expiration, but within grace period
            set req.http.grace = "normal (healthy server)";
            return (deliver);
        } else {
            # Hit after TTL and grace expiration
            return (fetch);
        }
    } else {
        # server is not healthy, retrieve from cache
        set req.http.grace = "unlimited (unhealthy server)";
        return (deliver);
    }
}


texts: Magento 2 static content deploy command shows error

texts:
php -f magento setup:static-content:deploy

While running this command after making css changes in the theme file of the magento 2 I got the below error

ubuntu@tlttvmd42:/opt/lampp/htdocs/ecom/bin$ php -f magento setup:static-content:deploy
PHP Fatal error:  Uncaught Error: Call to undefined function Composer\Json\json_decode() in /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Json/JsonFile.php:152
Stack trace:
#0 /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Factory.php(269): Composer\Json\JsonFile->validateSchema(1)
#1 /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Factory.php(532): Composer\Factory->createComposer(Object(Composer\IO\BufferIO), '/opt/lampp/htdo...', false)
#2 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerFactory.php(47): Composer\Factory::create(Object(Composer\IO\BufferIO), '/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerInformation.php(362): Magento\Framework\Composer\ComposerFactory->create()
#4 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerInformation.php(375): Magento\Framework\Composer\ComposerInformation->getComposer()
#5 /opt/lampp/htdocs/ecom/vendor/magento/framework/Composer/ComposerInformation.php(242): Magento\F in /opt/lampp/htdocs/ecom/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 152

And I googled it and there are some suggestion to install Php json and I found in the phpinfo Json is already enabled

I used the suggessted command to install the json

sudo apt-get install php-json

Once installing I restarted the Lampp and i tried to deploy the static Magento command and I still face the same issue, Any help would be appreciated. Thanks in advance.

I use Ubutu Os and Lampp server


texts: SQL Syntax error or access violation: 1142 TRIGGER command denied to user

texts:
If I want to update a configurable product I do get an error message:

SQLSTATE[42000]: Syntax error or access violation: 1142 TRIGGER command denied to user 'dbadmin_magento'@'localhost' for table 'catalog_product_entity_url_key', query was: INSERT INTO `catalog_product_entity_url_key` (`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`)

I already checked the grants:

mysql> show grants;
+------------------------------------------------------------------------------------------------------------------------+
| Grants for dbadmin_magento@localhost                                                                                |
+------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dbadmin_magento'@'localhost' IDENTIFIED BY PASSWORD '*1234556789012345678912345678234567234563' |
| GRANT ALL PRIVILEGES ON `dbadmin\_magento\_prod`.* TO 'dbadmin_magento'@'localhost'                                    |
+------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Does anyone has an idea how to fix it? I ran out of ideas.


texts: How to debug in ko template in magento 2?

texts:
Here is the code in \vendor\magento\module-checkout\view\frontend\web\template\shipping-address\custom-method-item-template.html

        <input type="radio"
               class="radio"
               ifnot="method.error_message"
               ko-checked="element.isSelected"
               ko-value="method.carrier_code + '_' + method.method_code"
               attr="'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code,
                    'checked': element.rates().length == 1 || element.isSelected" />

        <each args="element.getRegion('price')" render="" />

    12312

            <input type="radio"
                   attr="'value' : method.method_code, 'id': 's_method_' + method.method_code" />

I want to show method.method_code either console.log or alert, how can i do that?


texts: How to Get Custom Message Based on Total for free Delivery like Jet.com?

texts:
I am using Custom Message Based on Total for free Delivery, It is working very good but I need appearance should be like jet.com

FYI: Video and Image


texts:
I have already override the theme page layout with below files:-

app\design\frontend\[package]\[theme]\Magento_Theme\page_layout\override\base\2columns-left.xml

code is like:-

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="1column"/>
    <referenceContainer name="columns">
        <container name="div.sidebar.main" htmlTag="div" htmlClass="col-02" after="main">
            <container name="sidebar.main" as="sidebar_main" label="Sidebar Main"/>
            <container name="main" label="Main Content Container"/>
        </container>
        <container name="div.sidebar.additional" htmlTag="div" htmlClass="col-01" after="div.sidebar.main">
            <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>
        </container>
    </referenceContainer>
</layout>

now all pages showing in 2column left bar.

Now I have installed the magefun blog in my store, all blog pages are also in 2column left bar instead of 2column right bar as defined in the blog's default.xml.

blog's default.xml code:-

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

So Now I want to show all blog page with their default page layout 2column-right and other theme page as their default layout 2column-left.

Please advice.


texts: How to override .js file in Magento 2 via require-JS?

texts: I need to override Magento\Sales\view\adminhtml\web\js\order\create\scripts.js via requirejs-config.js in Magento 2?


texts: How to prevent empty cart after failed payment and how to manage the empty of cart according to condition

texts: I want to prevent the behavior of the cart when a payment is failed and other things i want to manage empty of cart according to some condition: after palcing order i want to change to empty cart after two days for example if the order placed using checkmo method will be cancled or if i change the status of the order so how to proceed in this two problemes and thanks in advance


texts: Which LESS files do you compile in a child theme?

texts:
I'm trying to create a theme based on Pixtron. I'm using Gulp rather than Grunt, but everything I've read about compiling LESS files has the same instructions: you have point to the source file(s) (e.g. styles-m.less or styles-l.less) in app/design/frontend/<Vendor>/<Theme>/web/css and point the destination files in pub/static/frontend/<Vendor>/<Theme>/<locale>/css.

Pixtron uses Magento/blank as its parent theme. So, I think because of that, there are no overarching theme files directly in the css folder. There are files inside the source subfolder to extend/override the blank theme. Here's the folder structure:

<Theme_Dir>
|  |-- web/
|  |  |-- css/
|  |  |  |-- source/
|  |  |  |  |-- _custom.less
|  |  |  |  |-- _extends.less
|  |  |  |  |-- _navigation.less
|  |  |  |  |-- _theme.less

So, I guess my question is which files should I be compiling when there aren't any main theme files for me to use? Should I be using the styles-l/m files from the parent theme? Hopefully, my question makes sense.


texts: Issue when change the password via admin account

texts:
When I go to the admin -> System -> My Account and change the password when save it show the error

Fatal error: Call to undefined method Mage_Adminhtml_System_AccountController::_validateCurrentPassword() in app/code/core/Mage/Adminhtml/controllers/System/AccountController.php on line 73
Please help me resolve this issue.
My Magento Version: Magento ver. 1.9.0.1.

Many Thanks.


texts: How to load tier price table on category page

texts: I want to display tier price table on my site's category page, but I have no idea regarding this at all. I have surf a lot but couldn't get any satisfactory solution. If any guy have an idea regarding this then please guide me. Your help would be appreciate a lot for me.


texts: Magento Backend create order get blank white screen

texts: I have created magento website in version Magento ver. 1.9.2.4. From manage customer=>edit customer=>create order at that time just white blank screen appear how can i solve this issues. I have attache page screenshot.


texts:
I'm troubleshooting an admin issue for a 3rd party's Magento CE 1.9.?. They "renamed" their admin URL, but they also secured their admin using .htaccess to restrict access to specific IP.

I'm trying to find the .htaccess file that does this in FTP, but can't find an /admin or /new-admin-URL directory.

What folder does the admin live in?
What .htaccess would contain the restricted IPs? I can't see those restrictions in the web root's .htaccess.


texts: Custom module, checking variable in observer

texts:
I'm new in making modules, considering below code wondering how would be possible to verify if the checkbox has been selected:

my observer.php:

public function execute(\Magento\Framework\Event\Observer $observer) {
        $item=$observer->getEvent()->getData('quote_item');
        $product=$observer->getEvent()->getData('product');
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
            if (???) {
                // do this if checbox is selected
            } else {

                // do this if not selected
        }
}

my viewfile.phtml

<?php

/** @var $block \Magento\Catalog\Block\Product\View */
?>
<?php $_product = $block->getProduct(); ?>
<?php if ($_product->isSaleable()):?>
        <div id="rent>
           <input id="my_checkbox" type="checkbox" name="vehicle" value="Rent">I want to rent this product
        </div>
        <script type="text/javascript">
        require([
            'jquery'
        ], function ($) {
            $(document).ready(function () {
                if($('#my_checkbox').prop('checked')) {
                    //checkbox is checked
                } else {
                    //checkbox is NOT checked
                }
            });
        }

        });
    </script>

<?php endif; ?>


texts: Get product collection in product detail page in magento 2.1

texts:
I have created new phtml page in product/view folder

xml

 <block class="Magento\Catalog\Block\Product\View" name="other.products.category" template="product/view/relatedproduct.phtml" after="require-cookie"></block>

I need to load product listing in same category in product custom phtml page

I tried below code but its not working

$objectManagerr = \Magento\Framework\App\ObjectManager::getInstance();
$curentProduct = $objectManager->getCurrentProduct();
echo $currentProduct->getName();


texts:
Can anybody explain the purpose of this two files in Setup folder? When should I use it?
I know, that it fires every time when I run setup:upgrade

But I want to know at least one example of usage. Thanks in advance.


texts: Is it possible to edit a saved address on the checkout page?

texts:
Is it possible to add an edit button to a saved address on the checkout page and edit it here without going to the my addresses page? Like the way Magento lets you edit the new address you created on the checkout.
I can't find a way to do it.
Thanks!


texts: Totals block missing from confirmation mail?

texts:
The totals block below the item table is missing from my confirmation mail. I checked the mail template and the

{{layout handle="sales_email_order_items" order=$order}}

line is in there so that can not be the problem. The totals block is there in print outs so it is working in general, just missing from that mail.

I have no idea where to look and what to do. Any ideas?

Thanks!


texts: Get product attribute value in magento REST API XML

texts: I want to get the product's attribute value in Magento 1.9 REST API XML, currently it shows the ID. I have attached the image to better understand my problem. Where to start?


texts: Allow multiple billing and shipping addresses only for backend

texts:
We currently use only 1 country for the billing and shipping addresses.
I want to add some other countries to apply, when adding an order trough the backend.

But that should only be possible in the backend, not on the frontend.

How can I achieve that?


texts: Is product repository in Magento the optimal way to read product url

texts:
I am reading a core function in Magento 2.3, the function is

  \Magento\Wishlist\Helper\Data::getProductUrl

         * Retrieve URL to item Product
         *
         * @param  \Magento\Wishlist\Model\Item|\Magento\Catalog\Model\Product $item
         * @param  array $additional
         * @return string
         */
        public function getProductUrl($item, $additional = [])
        {
            if ($item instanceof \Magento\Catalog\Model\Product) {
                $product = $item;
            } else {
                $product = $item->getProduct();
            }
            $buyRequest = $item->getBuyRequest();
            if (is_object($buyRequest)) {
                $config = $buyRequest->getSuperProductConfig();
                if ($config && !empty($config['product_id'])) {
                    $product = $this->productRepository->getById(
                        $config['product_id'],
                        false,
                        $this->_storeManager->getStore()->getStoreId()
                    );
                }
            }
            return $product->getUrlModel()->getUrl($product, $additional);
        }

I am surprised to see the function calls the product repository to load the product url. I'd like to hear from people who perform code reviews/optimisation and understand whether this practice to call product repository is recommended or to be cautiously practised?

In this function, we see 2 use cases and one does not call repository. But yet this function can be called in a loop and my question is very much whether we potentially could run into page load issue or whether the cache does the rest?

thanks for looking into this


texts: Add a CMS Block to the main column for a Category in Magento 2

texts:
I want my cms block in the column.main area of a category page in Magento 2.

This is a 2 column left page.  I want my left menu to still show up on the left and my cms to show up in the main area to the right.  Currently, it's easy to get the cms on top with the left column below.

Here is what I tried in Category Design Update

<referenceContainer name="columns.main">
            <block class="Magento\Cms\Block\Block" name="Example-Block">
                <arguments>
                    <argument name="block_id" xsi:type="string">Example-Block</argument>
                </arguments>
            </block>
</referenceContainer>

Of course, it didn't work.

I also tried adding
<referenceContainer name="columns"> to the top of this code and that made my cms block show up in the main area but it was still lower than my category navigation "shop by" area on the left.

Any help is greatly appreciated.


texts: #1062 - Duplicate entry '3-285-42-0' for key 'UNQ_CAT_CTGR_ENTT_INT_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID'

texts:
I am picking up a site from a predecessor and I am creating a dev version of a live site.
After exporting the site via sequel pro or phpmyadmin (seperate attempts), the import process always bulks at the catalog_category_entity_int table.
Here is the error:
Error
SQL query:
-- -- Dumping data for table `catalog_category_entity_int` -- INSERT INTO `catalog_category_entity_int` (`value_id`, `entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1, 3, 34, 1, 2, 1), (2, 3, 105, 0, 1, 1), (3, 3, 105, 0, 2, 1), (11, 3, 34, 0, 4, 1), (12, 3, 105, 0, 4, 1), (13, 3, 42, 0, 4, 6), (14, 3, 43, 0, 4, 1), (15, 3, 106, 0, 4, 0), (16, 3, 107, 0, 4, 0), (18, 3, 34, 0, 5, 1), (19, 3, 105, 0, 5, 1), (20, 3, 42, 0, 5, NULL), (21, 3, 43, 0, 5, 1), (22, 3, 106, 0, 5, 0), (23, 3, 107, 0, 5, 0), (26, 3, 43, 0, 2, 0), (27, 3, 107, 0, 2, 0), (43, 3, 34, 0, 8, 1), (44, 3, 105, 0, 8, 1), (45, 3, 42, 0, 8, NULL), (46, 3, 43, 0, 8, 1), (47, 3, 106, 0, 8, 0), (48, 3, 107, 0, 8, 0), (57, 3, 34, 0, 10, 1), (58, 3, 105, 0, 10, 1), (59, 3, 42, 0, 10, 6), (60, 3, 43, 0, 10, 1), (61, 3, 106, 0, 10, 0), (62, 3, 107, 0, 10, 0), (64, 3, 34, 0, 11, 1), (65, 3, 105, 0, 11, 1), (66, 3, 42, 0, 11, 21), (67, 3, 43, 0, 11, 1), (68, 3, 106, 0, 11, 0), (69, 3, 107, 0, 11, 0), ([...]

MySQL said: Documentation
1062 - Duplicate entry '3-285-42-0' for key 'UNQ_CAT_CTGR_ENTT_INT_ENTT_TYPE_ID_ENTT_ID_ATTR_ID_STORE_ID'
Information:
I have tried exporting the site with Disable foreign keys checked (or adding the lines SET FOREIGN_KEY_CHECKS=0; to start and SET FOREIGN_KEY_CHECKS=1; to end)
I know that site was upgraded from 1.6 to 1.7.0.2 at start of the year, other than that the site has not been touched until I have arrived on the scene.
Before the site was exported I had re-indexed the live site, flushed the cache and cache storage, I had also rm -rf removed contents of var/cache and var/session
My question is:
what do I do?
Do I remove the duplicates in sql? (I know its very bad to touch magento db and should be avoided at all costs)
Can I clean the db up with sql query to remove these duplicates?
If I remove these duplicates, will this table have a knock on affect to other tables?
I have asked all my magento pals that I know and each and everyone has been unable to help and I have exhausted my knowledge so far.
If anyone can provide insight, answer my questions or point me in right direction, I would be forever grateful and of course learn how to solve a very peculiar problem.


texts: Magento 2 : Add Duplicate of Block or Button Somewhere Else

texts:
I have an extension for quote in my store, which displays a request a quote button in the cart, when there is content in it.

I want the exact same Button at the top in my menu bar.

Tried to copy the block call from extensions xml and put it in the default.xml from my custom theme with reference container header.panel

  This works but is broken(js not working).

Also I would need to check if there is content in cart before.

Im kinda new to this. Would appreciate a hint in the right direction on how to do this.


texts: Magento - include multiple external libraries to Admin Controller actions

texts:
I am working on import price of products using xls, xlsx, ods and csv files.

For that i need to read these file, i had use seperate external library files to read those files.

It works well in my local machine, when i move it to server my admin controller doesn't work, it displays blank page.

I found that is because i have included external library files in my admin controller.(when i command those lines controller works fine in server)

so then i have used below format to include lib files :

require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/easyODS.php');
require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/simplexlsx.class.php');
require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/reader.php');

after this change xlsx, ods and csv(i didn't use lib file for csv) working fine but xls doesn't.

kindly give me suggestion to do this stuff.


texts: how to Duplicate xml node using Varien_Simplexml_Element in magento

texts:
I am creating xml file programmatically. Where I am converting array to xml using following code:

 $xml = new Varien_Simplexml_Element('<MagentoOrder></MagentoOrder>');
 $this->array_to_xml($data,$xml);
 print_r($xml);
 $xmlData = $xml->asNiceXml();

 if(!file_exists($file)) {
     file_put_contents($file, $xmlData);
 }

Below is array_to_xml function:

protected function array_to_xml( $data, &$xml_data ) {
    foreach( $data as $key => $value ) {
        if( is_array($value) ) {
            if(is_numeric($key)){
                foreach($value as $k => $v){
                    if(is_array($v)){

                        $subnode = $xml_data->addChild($k);
                        $this->array_to_xml($v, $subnode);
                    }else{
                        $xml_data->appendChild("$k",htmlspecialchars("$v"));
                    }
                }
                continue;
            }
            $subnode = $xml_data->addChild($key);
            $this->array_to_xml($value, $subnode);
        } else {
            $xml_data->addChild("$key",htmlspecialchars("$value"));
        }
    }
}

Below is my array

 $s = array(
        "item" => array(
            "id" => 1
        ),
        "item" => array(
            "id" => 2
        )
    );

I want "item" should convert two times  as node. But output is following:

[item] => Array
            (
                [0] => Varien_Simplexml_Element Object
                    (
                        [id] => 1
                    )

                [1] => Varien_Simplexml_Element Object
                    (
                        [id] => 2
                    )

            )

Expected output is:

        [item] => Varien_Simplexml_Element Object
            (
                [id] => 1
            )

        [item] => Varien_Simplexml_Element Object
            (
                [id] => 2
            )

How to achieve this in magento?


texts: Step By Step Tax Information On Magento 2

texts:
To start with the Magento Tax,
For New User: You should know the following,

Basic setting for Tax/Vat Configuration

1.Customer Tax Class
2.Product Tax Class
3.Shipping Tax Class
4.Tax Rates
5.Tax Zones

Combine them all and Create Tax Rule, Once done, set default destination.

Brief of above settings:

Customer Tax Class: Customer tax classes are useful to apply the different tax rate to different types of Customer Groups. You can create as many customer tax classes as you need, and assign them to Customer Group.

For Eg: In some Administration, wholesale transactions are not taxed, but retail transactions are. You can associate members of the Wholesale Customer group with the Wholesale tax class.

Setting up the Customer tax Classes:
Login in Magento Admin Panel
Create the Customer Tax class
Link it with the customer Group here Store> Other Settings > Customer Group

Product Tax Class: Product Tax Classes are used in calculations to determine the correct tax rate is applied in the shopping cart. When you create a product, it is assigned to a specific tax class. Taxable Goods is a default class in Magento.
For example, food might not be taxed, or be taxed at a different rate.
That is, You could have different Tax rates on different products such as Clothes, Cosmetics, Medicines, Food Items, home appliances.

Setting up the Product Tax class:
Login in Magento Admin Panel
Go to Stores > Tax Rules > Add new Rules > Additional Settings

Tax rates and Zones: There is a facility in Magento to define tax according to Country, States, Zip codes.

Setting up the Tax Rates and Zones:
Login in Magento Admin Panel
Store > Configuration > Tax Rates and Zones

Tax Rule:
Important fields to set a Tax Rule
1. Tax Rate: Defines the rate percentage (%) of Tax applied.
2. Customer Tax Class: Defines Tax for Customers.
3. Product Tax Class: Defines Tax for Product.
4. Priority: Prioritize the Tax Rules as in which one to be applied on top of every other one. Tax rates at the same priority are added, others are compounded.

Default Destination/ Country
You need to set up default destination here
Store > Configuration > Sales > Tax > Default Tax Destination Calculation.

Tax Configuration

Store > Configuration > Sales > Tax

Calculation Setting:
As per the requirement of your client, you can change the calculation settings here, There is the various combination to calculate/ the tax here.

Price Display Setting:
You can set up, what price you want to show on you Catalog pages (Including Tax, Excluding Tax, Including Tax and Excluding Tax)

Shopping Cart Display Setting:
You can set up, what price you want to show on you Cart pages (Including Tax, Excluding Tax, Including Tax and Excluding Tax)

Order, Invoices, Credit Memos Display Setting:
You can set up, what price you want to show in Magento Admin Order, Invoice and Credit Memos (Including Tax, Excluding Tax, Including Tax and Excluding Tax)

Thanks!


texts: Sorting fields in customer address form edit admin section

texts:
I'm very confused by sorting some fields in customer address edit form.

I want to move City after State/Province and Subdistrict after City. How can I do that ?


texts:
I have override page Module means changes the footer pages. So that I have created Page module. but it's displaying empty page.

my code is:

magento\app\etc\modules\Page.xml

<?xml version="1.0"?>
<config>
    <modules>
<Easylife_Page>
            <active>true</active>
            <codePool>local</codePool>
           <depends>
                <Mage_Page/>
            </depends>
        </Easylife_Page>
 </modules>
</config>

magento\app\code\local\Easylife\Page\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Page>
            <version>0.1.0</version>
        </Easylife_Page>
    </modules>
    <frontend>
        <layout>
            <updates>
                <easylife_page>
                    <file>page.xml</file>
                </easylife_page>
            </updates>
        </layout>
    </frontend>
</config>

magento\app\design\frontend\easylife\default\layout\page.xml

<?xml version="1.0"?>
<layout version="0.1.0">

    <default translate="label">
        All Pages

        <block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
            <block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
                Page Footer
                <action method="setElementClass"><value>bottom-container</value></action>
            </block>
            <block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
            <block type="page/template_links" name="footer_links" as="footer_links" />
        </block>

    </default>

</layout>

magento\app\design\frontend\easylife\default\template\page\html\footer.phtml

        <address><?php echo $this->getCopyright() ?></address>

<?php echo $this->__('Frequently Asked Questions') ?> - <a href="faq" onclick="setLocation('<?php echo Mage::getUrl('faq/index/index'); ?>')"><?php echo $this->__('FAQ') ?>

Is this steps are correct or wrong? Please suggest/guide me how to override like all files in page Module?

Can any one tell me where I went wrong?

thanks.


texts: Can anyone explain to me the reason why Magento no longer recommend the use of catalog flat table. As per the official documentation, it's degrading the performance because of the slow/long SQL queries, but, why now? not in M1. Please give me any logical reason


texts: Why isn't Magento 2 recognizing my library in requirejs-config.js?

texts:
This is Library location

  app\design\frontend\user\theme\web\js\owl.carousel.min.js

this is my config js file

  app\design\frontend\user\theme\requirejs-config.js

var config = {
deps: [
    "js/main"
],

map: {
    '*': {
        owlCarousel:'js/owl.carousel.min'
    }
},

shim: {
    jquery: {
        exports: '$'
    },

    'Magento_Catalog/js/price-box':
        {
            deps: ['jquery']
        },

    owlCarousel: ["jquery"]
}

};

Inside

  app\design\frontend\user\theme\web\js\main.js

define([
"jquery",
"owlCarousel"
],

function($) {
"use strict";

if(typeof owlCarousel === 'function') {
  console.log('owlCarousel is loaded');
}else{
  console.log('owlCarousel is NOT loaded');
}

});

Inside phtml

require(['jquery', 'owlCarousel'],function($, owlCarousel){
    jQuery(document).ready(function() {
        jQuery('.owl-carousel').owlCarousel({
            margin:10,
            nav:true,
            mouseDrag:false,
            navText : ["",""],
            rewindNav : true,
            responsive:{
                0:{
                    items:3
                },
                600:{
                    items:3
                },
                1000:{
                    items:3
                }
            }
        });
    });
});

Result

owlCarousel is NOT loaded

(index):1175 Uncaught TypeError: jQuery(...).owlCarousel is not a function


texts: Checkout billing and shipping address checkbox uncheck sometimes

texts:
I am facing a very weird issue, when I add the product to the cart and then from the mini cart, if I click to Proceed to Checkout from there and when it lands on the checkout page. I can see the "My Billing and Shipping address are same" checkbox remains to uncheck and it shows, me a blank address.
I am using Magento 2.3.4, not sure what could be the cause of an issue?
Please Provide me some help.
Thanks,


texts: Problems with loading data from subdomains

texts:
After rebuilding my Magento I realised that there is a few missing things like css(missing icons, characters) and some jQuery/Javascripts don't work.

After a little bit of a research I found that (everything works fine on dev site)
it is related to the cdn configuration:

  unsecure server => http://cdn1.xxx.xxx/js, http://cdn2.xxx.xxx/css ...
  and so on.

everything works fine as a secure (almost) but have some problems with unsecure content.
Is it really better to have it like that or if I change everything to www.xxx.xxx/js, ...css etc will it be much slower ?


texts: Magento2 : Admin is not working, Showing error doesn't redirect properly

texts:
I tried to setup memcached to my Magento 2 website.

After setup setting in env.php magento admin not working(not able to see admin login page)  or some time infinite loading

I remove setting for memcache from env.php , remove cache , upgrade setup , di compile. Every command I run but still site now working. Even no log generated


texts:
How to get the VAT value into checkout page from my account information
when customer register they enter the VAT number that will save in account information page but same VAT number not shown in checkout page
can anyone please help me.


texts: How to get FedEx Shipping Price based on weight for multiple services at the page of checkout of my website when customer go to purchase the products

texts: How can i get Shipping Price based on weight for multiple services at the page of checkout of my website when customer go to purchase the products. I am using Magento, and my requirements are https://snag.gy/CnJ8BA.jpg


texts: what are realistic reasons to create a custom product type

texts: I'm trying to wrap my head around when/why I would create a custom product type.  I have to imagine there have been opportunities in the past where I probably could have benefited from this, but I'm having a hard time thinking when this would be a beneficial solution.  Can anyone explain where and why I would/could take advantage of programming a custom product type?


texts: cron to update product attribute running out of memory

texts:
I am trying to have a cron to update a custom product attribute for configurable products,

public function updateReport() {
    Mage::app()->getStore()->setConfig('catalog/frontend/flat_catalog_product', 0);
    $configurableIds = Mage::getResourceModel('catalog/product_collection')->addFieldToFilter('type_id', 'configurable')->getAllIds();
    foreach ($configurableIds as $id) {
        $product = Mage::getModel('catalog/product')->load($id);
        $stock =0;
        $simpleProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);
        foreach ($simpleProducts as $prod) {
            $qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($prod);
            $stock += (0 + $qty->getQty());
        }
        if ($product->getSubProdQty() != $stock) {
            $product->setSubProdQty($stock)->save();
        }
    }
}

i have > 3000 configurable products my memory seems to run out after about 2000 products how can i fix this so my memory does not run out? (my memory is set to 512MB, this is magento 1.9.3.0)


texts: How to display Bestseller and Most Viewed Section product display in admin grid in magento2?

texts: Hello I am using magento2.3.5 in my admin panel Best seller product and Most viewed product not showing the product list , it shows "We couldn't find any records.", please help me there is any setting to do turn on or off. i am attach the image for reference.


texts: Will updating or patching Magento break my website?

texts:
We use Magento for our ecommerce, and have a security patch outstanding.  I can probably implement this myself, but my question is, how likely is it to break our website?

We have had it designed by another company, and if I implement patches, and some functions stop working etc, we will have to pay for designers to sort the problems out.  They've quoted £200 for implementing all outstanding upgrades and patches etc and to test them all - they have said that applying updates will require code changes from their side, which is included

Is it quite unlikely that patches and updates won't have any effect on the website?  Should I do it myself or will it be best to pay to get it all sorted by our designers?