texts: Magento2 Show Store Purchase Point as 1 line instead of old   spaced multiline

texts:
So we've been using Magento since 1.3 and now working with M2. Why is the Store Purchase Point still a multiline spaced with   rubble?
I would expect

Spacing being tackled by css
 or some form of html around the 3 store levels (site, name and view)
The ability to show all data (like now), only storename, or only storeview as an option

The grid is now taking up 3 lines!!! of data when this is completely unnecessary.
Question: how can we make a core change to add some improvements here? Where do we edit this &nbsp; repeat addition and add some span elements?
This must have bee noticed by other users and admins!


texts: Is it possible to install Magento 2.x on Windows Server?

texts:
I have to install Magento for a client, but que wants to use his server and it runs over Windows Server 2016.

I've previously installed Magento on local in a Windows 10 machine. But, the official documentation says it has to be under a Linux distribution.

So, it  is possible? or any recomendation?


texts: Coupons - How to disable for some products

texts:
Our customers are able to use a Discount Coupon - we do not want to apply it to a particular - Category - our Clearance Category.

Can you tell me how?


texts:
My AjaxController

class AMBit_Product_AjaxController extends Mage_Core_Controller_Front_Action{

        public function getdataAction(){

            echo 'PRODUCTS IN THIS CATEGORY';
            echo 'temporarily removed content ....';

        }
}

and the code:

jQuery(document).ready(function(){

    jQuery('.level1').on('mouseover',function(){

        var url="<?php Mage::getUrl('attributor/controller/getdata'); ?>";

        var catName = jQuery(this).find('span').text();

        console.log(url);

        jQuery('#prod').html(catName);

        jQuery.ajax({
            url: url,

            type: "POST",

            dataType: "JSON",

            data: catName,

            success: function(result){
                    jQuery("#prod").html(result,function(){
                        alert(result);
                        die();
                    });
            },
            error: function(result){
                console.log('no response !');
                },
        })
    })
 })

and "No response" ...
What  am I doing wrong ?

UPDATE (controller bit):

<frontend>
  <routers>
        <attributor>
          <use>standard</use>
          <args>
             <module>AMBit_Attributor</module>
             <frontName>attributor</frontName>
          </args>
        </attributor>
  </routers>
</frontend>


texts: Add class to checkout input when order below €30

texts:
I'd like to disable the deliver (bezorgen) checkout radiobutton when the order is below €30.There is an other option to pickup yourself and order below 30,- so I think I have to do this with custom script.

The input has id="s_method_flatrate_flatrate" and should be hidden with css (only when below 30 in cart).

Is there a way to do this with JS?
(version 1.7.0.2)

Example of the checkout:


texts: How to Get Weight Attribute in Totals Cart REST API Magento 2.X

texts:
How Can i Get Weight Attribute in Cart REST API.

End Point: /rest/V1/carts/mine/

Response Default:

{
  "id": 8,
  "created_at": "2019-09-16 13:51:25",
  "updated_at": "2019-09-18 12:07:31",
  "is_active": true,
  "is_virtual": false,
  "items": [
    {
      "item_id": 7,
      "sku": "Test",
      "qty": 2,
      "name": "Test",
      "price": 100,
      "product_type": "simple",
      "quote_id": "8"
    },
    {
      "item_id": 8,
      "sku": "Test Bundle",
      "qty": 1,
      "name": "Test Bundle",
      "price": 200,
      "product_type": "bundle",
      "quote_id": "8"
    }
  ],
  "items_count": 2,
  "items_qty": 3,
  "customer": {
    "id": 4,
    "group_id": 1,
    "created_at": "2019-09-16 13:48:02",
    "updated_at": "2019-09-21 15:01:53",
    "created_in": "Default Store View",
    "email": "test@testmail.com",
    "firstname": "elantest",
    "lastname": "m",
    "store_id": 1,
    "website_id": 1,
    "addresses": [],
    "disable_auto_group_change": 0,
    "extension_attributes": {
      "is_subscribed": false
    },
    "custom_attributes": [
      {
        "attribute_code": "mobile_number",
        "value": "+910000000000"
      }
    ]
  },
  "billing_address": {
    "id": 248,
    "region": null,
    "region_id": null,
    "region_code": null,
    "country_id": null,
    "street": [
      ""
    ],
    "telephone": null,
    "postcode": null,
    "city": null,
    "firstname": null,
    "lastname": null,
    "customer_id": 4,
    "email": "test@testmail.com",
    "same_as_billing": 0,
    "save_in_address_book": 0
  },
  "orig_order_id": 0,
  "currency": {
    "global_currency_code": "INR",
    "base_currency_code": "INR",
    "store_currency_code": "INR",
    "quote_currency_code": "INR",
    "store_to_base_rate": 0,
    "store_to_quote_rate": 0,
    "base_to_global_rate": 1,
    "base_to_quote_rate": 1
  },
  "customer_is_guest": false,
  "customer_note_notify": true,
  "customer_tax_class_id": 3,
  "store_id": 1,
  "extension_attributes": {
    "shipping_assignments": [
      {
        "shipping": {
          "address": {
            "id": 53,
            "region": null,
            "region_id": null,
            "region_code": null,
            "country_id": null,
            "street": [
              ""
            ],
            "telephone": null,
            "postcode": null,
            "city": null,
            "firstname": null,
            "lastname": null,
            "customer_id": 4,
            "email": "test@testmail.com",
            "same_as_billing": 0,
            "save_in_address_book": 0
          },
          "method": null
        },
        "items": [
          {
            "item_id": 7,
            "sku": "Test",
            "qty": 2,
            "name": "Test",
            "price": 100,
            "product_type": "simple",
            "quote_id": "8"
          },
          {
            "item_id": 8,
            "sku": "Test Bundle",
            "qty": 1,
            "name": "Test Bundle",
            "price": 200,
            "product_type": "bundle",
            "quote_id": "8"
          }
        ]
      }
    ]
  }
}

I need to Get Weight Attribute for each item.


texts:
i am using sales_order_save_after event and getting this error

  Fatal error: Uncaught Exception: User Error: Some transactions have
  not been committed or rolled back in
  D:\wamp64\www\qsdev\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php
  on line 3774


texts: Magento2 move the block from right to left without removing

texts:
I need to move the Compare products and My Wish list blocks to the left of the page.

I have my page like, where my Compare products should come to the right:

I did something like :

<?xml version="1.0"?>
<page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <body>
       <move element="category.product.addto" destination="product.info.media" />
   </body>
</page>

But im not sure if destination element is proper, but the Compare product block is not moving!


texts:
Good evening. I just recently started learning magento 2 and faced the following problem. I have an XML form that contains information, such as "Name, address, telephone"
I need to create a block that will return which fields will be in the fieldset, but I dont know how
I think that I'm calling the wrong class, I ask for help.
Ty
my code:

form.xml

<fieldset class="[Vendor]\[Module]\Block\Adminhtml\[Module]\Edit\Tab\Checkbox" />

di.xml

<preference for="Magento\Tax\Block\Adminhtml\Rate\Form" type="[Vendor]\[Module]\Block\Adminhtml\[Module]\Edit\Tab\Checkbox" />

[Vendor][Module]\Block\Adminhtml[Module]\Edit\Tab\Checkbox.php

class Checkbox extends \Magento\Tax\Block\Adminhtml\Rate\Form
{

    protected $_taxData = null;

    /**
     * @var \Magento\Tax\Block\Adminhtml\Rate\Title\FieldsetFactory
     */
    protected $_fieldsetFactory;

    /**
     * @var \Magento\Directory\Model\Config\Source\Country
     */
    protected $_country;

    /**
     * @var \Magento\Directory\Model\RegionFactory
     */
    protected $_regionFactory;

    /**
     * @var \Magento\Tax\Api\TaxRateRepositoryInterface
     */
    protected $_taxRateRepository;

    /**
     * @var \Magento\Tax\Model\TaxRateCollection
     */
    protected $_taxRateCollection;

    /**
     * @var \Magento\Tax\Model\Calculation\Rate\Converter
     */
    protected $_taxRateConverter;

    /**
     * @param \Magento\Backend\Block\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Framework\Data\FormFactory $formFactory
     * @param \Magento\Directory\Model\RegionFactory $regionFactory
     * @param \Magento\Directory\Model\Config\Source\Country $country
     * @param \Magento\Tax\Block\Adminhtml\Rate\Title\FieldsetFactory $fieldsetFactory
     * @param \Magento\Tax\Helper\Data $taxData
     * @param \Magento\Tax\Api\TaxRateRepositoryInterface $taxRateRepository
     * @param \Magento\Tax\Model\TaxRateCollection $taxRateCollection
     * @param \Magento\Tax\Model\Calculation\Rate\Converter $taxRateConverter
     * @param array $data
     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
     */
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Data\FormFactory $formFactory,
        \Magento\Directory\Model\RegionFactory $regionFactory,
        \Magento\Directory\Model\Config\Source\Country $country,
        \Magento\Tax\Block\Adminhtml\Rate\Title\FieldsetFactory $fieldsetFactory,
        \Magento\Tax\Helper\Data $taxData,
        \Magento\Tax\Api\TaxRateRepositoryInterface $taxRateRepository,
        \Magento\Tax\Model\TaxRateCollection $taxRateCollection,
        \Magento\Tax\Model\Calculation\Rate\Converter $taxRateConverter,
        array $data = []
    ) {
        parent::__construct($context, $registry, $formFactory, $regionFactory, $country, $fieldsetFactory, $taxData, $taxRateRepository, $taxRateCollection, $taxRateConverter, $data);

    }

    /**
     * @return void
     */
    protected function _construct()
    {
        parent::_construct();
    }

    public function _prepareForm()
    {
        parent::_prepareForm();

            $form = $this->getForm();
            $fieldset = $form->п('new_fieldset',
                array('legend'=>'GST Tax Rate Information')
            );
            $fieldset->addField('hsn_title', 'text',
                array(
                    'label' => 'HSN Code',
                    'class' => 'input-text',
                    'name'  => 'hsn_title',
                    'required' => false
                )
            );

            $this->setForm($form);
            return $this;
    }


texts: Why are some of my region names in checkout garbled?

texts:
I am using Magento ver. 1.9.1.1 and venustheme
For some reason some of my region names in checkout are shown garbled. I uncommented these but no use
 AddDefaultCharset Off
 AddDefaultCharset UTF-8
It doesn't look like typical encoding issue, because not only the special characters are garbled,  so what is going on there?


texts:
How to set zero after Decimal

<?php
$layer = Mage::getSingleton('catalog/layer'); $category = Mage::getModel('catalog/category')->load($this->getCategoryId()); if ($category->getId()) { $origCategory = $layer->getCurrentCategory(); $layer->setCurrentCategory($category); } $collection = $layer->getProductCollection(); $collection->getSelect()->reset('order'); $collection->getSelect()->order('minimal_price','asc'); $collection->getSelect()->limit(1);
$cur_code = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();?>

            <?php
            $catIds = explode(',', $this->getIds());

              $categories = array();
            foreach ($catIds as $catId) {
                $category = Mage::getModel('catalog/category')->load($catId);

    /* new code started */
    //get products from category ID
    $products = $category //Mage::getModel('catalog/category')->load($catId)
     ->getProductCollection()
     ->addAttributeToSelect('*') // add all attributes - optional
     ->addAttributeToFilter('status', 1) // enabled
     ->addAttributeToFilter('visibility', 4) //visibility in catalog,search
     ->setOrder('price', 'ASC'); //sets the order by price

   $largeNumber = 9999999999;
   $minPrice = $largeNumber; //set to higher number
   $maxPrice = 0;
   foreach($products as $product){
     if($product->getFinalPrice() < $minPrice){
         $minPrice = $product->getFinalPrice();
     }
     if($product->getFinalPrice() > $maxPrice){
         $maxPrice = $product->getFinalPrice();
     }
   }

   if($minPrice == $largeNumber){
       $minPrice = 0;
   }

   //echo "
".$minPrice."
";
  // echo "
".$maxPrice."
";

   /* new code finished */

                $categories[$category->getName()] = array(
                    'url' => $category->getUrl(),
                    'img' => $category->getImageUrl(),
                    'minPrice' => $minPrice,
                    'maxPrice' => $maxPrice
                );
            }

            ksort($categories, SORT_STRING);
            ?>
                <?php if ($category->getIsActive()): ?>
                    <?php foreach ($categories as $name => $data): ?>

                            <a href="<?php echo $data['url']; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>">
                                <img id="cat-image" src="<?php echo $data['img']; ?>" class="img-responsive"/>

<a href="<?php echo $data['url']; ?>"><?php echo $name; ?>

                              <?php $minimum = $data['minPrice'];
                              $maximum = $data['maxPrice'];;?>

<?php echo $cur_code . $minimum ?>

<?php echo $cur_code . $maximum ?>

                            <button type="button" title="<?php echo $this->__('SELECT BOUQUETS') ?>" class="btn btn-default custom-btn" onclick="setLocation('<?php echo $data['url']; ?>')"><?php echo $this->__('SELECT BOUQUETS') ?></button>

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

Now it showing $173.0000


texts: How to define variable in system configuration field and update them in controller?

texts:
In system.xml I've a field 'twilio/general/message' which saves following message:

Use {{otp}} as otp to verify your mobile number.

In controller I'm getting field's value as

$message = $this->scopeConfig->getValue(
            'twilio/general/message', ScopeInterface::SCOPE_STORE, $storeId
        );

{{otp}} will be generated programatically in controller. How I can replace {{otp}} in $message with generated otp?


texts: Magento 2 - Mass update of value of custom EAV attribute

texts:
We've got custom EAV attribute for product entity, which needs to be updated regurarly (once a day). We have about 1000 products for now, but amount of products will be growing up quickly.

How to mass update the value of this attribute for all products without killing the web server?

At the moment we are using $product->setData(...,...) and save product through Product Repository. The server terminates execution after about 250 products though.

Thanks


texts: How to Install Packages for manually added magento2 extension using composer

texts:
I have a magento2 extension, In that composer.json requires extra packages other than the default magento2 packages. How to Install those packages.

composer.json

"require": {
    "php": ">=5.5",
    "guzzlehttp/guzzle": "^6.3"
}


texts:
How I can filter Magento order by any customer email id?
I'm doing  something like but I'm not getting the result.

$customer_email ='abc@gmail.com';
$orders = Mage::getModel('sales/order')->getCollection()
    ->addFieldToFilter('customer_email', $customer_email);


texts: Installed module not visible in admin - Magento 2.3.2

texts:
I've installed a module and while the CLI says that the module is installed, the schema in the db has been created and the module has a record in setup_module it doesn't show up in the admin. When looking at the module in the module manager it shows as off, enabling it via the module manager doesn't change this.

I've then installed another module as a test (webshopapps matrixrates), exactly the same thing happens, shows as installed, schema created, shows as off in module manager even if you enable it.

So far I've done a full uninstall of the modules (disabled the module, ran php bin/magento setup:upgrade, removed the db entries, deleted the module files and then cleared the cache / re-ran php bin/magento setup:upgrade and confirmed the module no longer shows up in the cli or mod manager) and then reinstalled and still no joy.

It feels like something got stuck but I can't figure out whats going on...

Ideas?


texts:
I have Magento 2.3.3 I created store views French, English, Turkish. I want to change url,.
 for  example http://localhost:8080/magento/fr for French store
              http://localhost:8080/magento/tr for Turkish store

but after edit, the page in not load. This for Turkish store

how I can specify custom URL  for store


texts: Extension not installs it's database tables

texts: I am installing extension to magento ("AheadWorks RMA"). But module not showing up on backend or frontend. And there are no any tables that should be there for this extension. What should I do to fix that to make this module work? Is it okay to copy/paste queries from sql folder files to database?


texts:
My magento website is one of a multistore on magento 1.6.2 on a shared server. Suddenly today the URLS (SEO friendly) in subcategories stopped resolving. Querying this with the hosting company, they told me that they had upgraded their litespeed version on the server which coincided with the errors.  They have promptly rolled back to the previous litespeed version which has fixed the issue. However, this is to give me some breathing space to get it properly resolved. This was their advice:
"You might want to get your dev team to check the installation to ensure it isn't set up in a way where it works only with older versions of LiteSpeed. You might want to get them to ensure the site is set up so it works with the newer versions too".

Does anyone have any insight into what I should check first? Advice greatly appreciated.
Thanks Darren.

edit: I've just been told by the hosts that the Litespeed version is currently 5.2.2 and the update version is 5.3.6


texts: How to replace knockout with old school layout xml and phtml

texts:
Let me be straight: knockout.js is a pain in my sitting device. It creates yet another layer of abstraction, is hard to debug, creates enormous overhead (more files, more code, more possibilities for errors) slows down the frontend and worst of all it makes the frontend feel jerky. After HTML is done loading knockout starts it's magic and modifies the DOM. Some HTML elements are not functional from the start or show up after a delay (how can this be desirable???).

I have read a lot about knockout and all the praises but not a single argument was really convincing. The gains always come at a great cost. Everything knockout does can be achieved with pure HTML and well crafted custom javascript. I have been building stores this way for years and they are lean and quick.

So here is my question: given a particular part of the store using knockout.js (e.g. the layered navigation filters) how could that functionality be reversed the old school way of building HTML and Javascript using XML layouts and phtml files? It all seems to be so deeply entangled into the core.


texts: How to filter the search results collection using the category id?

texts: I had added a category dropdown in form.mini.phtml file and submitted the search form. I tried modifying the collection of the list.phtml file which is in Magento_Catalog module but hard luck. Kindly advice how to filter the search result product collection using the category id.


texts:
Hi I'm fairly new to Magento so this might be a stupid question.

I'm using default/carparts theme for my website. The problem is that the product reviews page is always blank like this:

Previous reviews and review form are not showing.
I believe this is a bug of this theme because I tried other themes and this page all works well.
Could somebody tell me what files should I check to fix this?


texts: Magento dataflow profile export - duplicate sku´s

texts:
after I updated my magento store to the latest version 1.9.2.1 I get into trouble regarding to the export of products with the dafalow profile export.

With every export I got duplicate entries in my csv file and don´t know why. In my product database I have no duplicate entries.
If I use the normal export mechanism with "export -> export products" I don´t get duplicate sku entries.

Does someone has the same issue with the dataflow profile?

I just created a new profile with only the sku in it.

<action type="catalog/convert_adapter_product" method="load">
    <var name="store"><![CDATA[0]]></var>
    <var name="filter/type"><![CDATA[simple]]></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="sku"><![CDATA[sku]]></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[test.csv]]></var>
</action>

At the moment I have no idea how to solve this...

Small example with my csv export:

Sample CSV File


texts: Magento 2 Create custom 404 page for not-found products

texts:
In Magento 2 I am looking to create a module that adds a custom 404 page specifically for not-found products in the catalog, however keep the default 404 page for all other pages.

My initial thoughts are to create a controller with di on \Magento\Catalog\Controller\Product\View that checks if the product does not exist and changes the template to a custom 404 response if returned true.

Something like (not actual code)

public function execute()
{
    if (!$this->productExists()) {
        $this->setTemplate('custom-404');
    }
}

Is there a better way to do this? Let me know if you need additional info.


texts: Magento 2 : Invalid Form Key. Please refresh the page

texts:
I get this error when I try to save a category,

  Invalid Form Key. Please refresh the page.

I tried the following solutions from various other posts

Increase php_value max_input_vars 75000
Try to clear the cache from var/cache directory.
Then clear browser cache. Especially clear or delete cookies.

But no success for me, what other reasons could cause this issue?


texts: Magento 2 - Custom module file upload configuration and save in custom module table

texts:
File upload in Magento 2 store configuration

    Custom
    <tab>sales</tab>
    <resource>Magento_Sales::config_sales</resource>
    <group id="custom_group" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" >
        Security
        <field id="custom_file_upload" translate="label" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="6" showInDefault="1" showInWebsite="1" >
            Upload custom file
            <backend_model>Magento\Config\Model\Config\Backend\File</backend_model>
            <upload_dir config="system" scope_info="1">test</upload_dir>
        </field>
    </group>

This gives below upload option in Magento admin custom module configuration and the file is also getting uploaded at specified path.

Just like we import tablerates.csv which also inserts data into shipping_tablerate, how do I make sure that the file content also gets inserted into custom table?


texts: Varien_Profiler and _redirect in Adminhtml

texts:
I want to profile a particular slow admin action that we have, but it calls _redirect at the end, is there an in-built way of seeing this profile information, or will I have to manually create an event to listen to something like controller_front_send_response_after and output the information into a log file?

Incidentally, Mage::run calls Varien_Profiler::stop('mage'); seemingly as the last thing the application does. Surely this call actually does nothing because the block is already rendered at that point, or did I miss something?


texts: Issues while developing vertical menu bar

texts:
I had made a vertical menu bar in project by using the following link

http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/how_to_create_a_vertical_left_hand_menu

but now the issue is vertical menu does not provide sub menu and even if I add code for sub category i.e submenu also making required changes in css it does not work.
Secondly, the vertical menu bar is in home page so user cannot view it throughout while browsing so please help me where the changes is to be done (header.phtml or navigation.phtml or left.phtml or left_vert.phtml in page.xml).


texts:
We have multiple stores. How can we apply store wise CSS? We have all store has a different home page and all pages.

I am thinking to add store code in body class to identifies store.

Like:

<body data-container="body" class="<store-code> customer-account-login page-layout-1column ajax-loading" aria-busy="true">

Is it a proper method?


texts:
Magento2 I want to reduce TTFB of my site. In google page optimization the highest priority is of TTFB.

My home page contains
1. Logo, search, Menu, Banner Image, Popular items block, brand slider & footer with normal links.

From all of these how can I reduce TTFB

I have already merged CSS, merged JS, minified them etc.. Production mode.

Any suggestion are welcome. Thanks.


texts: Magento add stock qty in backend new order creation

texts:
I was wondering how we could add a stock value in the 'backend new order creation' ... see image below

What we see now is that we enter an order, but in the next step are warned that ther is no stock ... so why not add the stock value as a column. Also we would very much like to filter on configurable products.

I was looking at app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid.php

and wanted to add this code

if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
    $this->addColumn('qty',
        array(
            'header'=> Mage::helper('catalog')->__('Qty'),
            'width' => '30px',
            'type'  => 'number',
            'index' => 'qty',
    ));
}

and the field itself in collection

 protected function _prepareCollection()
    {
        $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
        /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
        $collection = Mage::getModel('catalog/product')->getCollection();
        $collection
            ->setStore($this->getStore())
            ->addAttributeToSelect($attributes)
            ->addAttributeToSelect('sku')
            ->addStoreFilter()
            ->addAttributeToFilter('type_id', array_keys(
                Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()
            ))
            ->addAttributeToSelect('gift_message_available');

        Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);

        if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
            $collection->joinField('qty',
                'cataloginventory/stock_item',
                'qty',
                'product_id=entity_id',
                '{{table}}.stock_id=1',
                'left');
        }

but now the problems is that the 'order quantity' (most right column in image) is also called qty ... and now they are conflicting. Question: How would I get the stock qty as 'alternate name' and show it?

And could we also easily add configurable/simple product selector?


texts: Magento2 display price in 2.5 lac, 3.5 crore, 25 lac etc

texts:
How to display product price on listing page, product detail page in numbers & letters combination.

For example  2.5 lac, 3 crore etc.
In PHP I can get price using following logic, but how to implement it in Magento2?

<?php

namespace Dcw\Search\Helper;
use Magento\Framework\App\Helper\Context;
class Price extends \Magento\Framework\App\Helper\AbstractHelper {

    public function __construct(
    Context $context
    , array $data = []
    ) {
        parent::__construct($context);
    }

    /**
     *
     * @return type
     */
    public function getPrice($num) {

    $ext="";//thousand,lac, crore
    $number_of_digits = $this->count_digit($num); //this is call :)
      if($number_of_digits>3)
        {
            if($number_of_digits%2!=0)
              $divider=$this->divider($number_of_digits-1);
            else
               $divider=$this->divider($number_of_digits);
        }
        else
         $divider=1;

        $fraction=$num/$divider;
        $fraction=number_format($fraction,2);
        if($number_of_digits==4 ||$number_of_digits==5)
         $ext="k";
        if($number_of_digits==6 ||$number_of_digits==7)
          $ext="Lac";
        if($number_of_digits==8 ||$number_of_digits==9)
            $ext="Cr";

        return $fraction." ".$ext;
    }

protected function count_digit($number) {
  return strlen($number);
}

protected function divider($number_of_digits) {
    $tens="1";

  if($number_of_digits>8)
    return 10000000;

  while(($number_of_digits-1)>0)
  {
    $tens.="0";
    $number_of_digits--;
  }
  return $tens;
}

}


texts:
I'm trying to remove the currency switcher from the header in Magento 2 with little luck. I've tried this in my theme's default.xml file

<referenceBlock name="store.settings.currency" remove="true"/>

But that doesn't seem to do anything. Plan B is to hide it with CSS but I feel like I should be able to remove it with a layout update.


texts: Adding custom option while creating order programmatically is not working

texts:
I need to create an order programmatically.

I tried this code:

$params = array(
    'product' => $productId,
    'qty' => 1,
    'options[99]' =>time(),
    );
    $cart = Mage::getSingleton('checkout/cart');
    $product = new Mage_Catalog_Model_Product();
    $product->load($productId);
    $product->setSpecialPrice(250);
    $cart->addProduct($product, $params);
    $cart->save();

But it is not adding custom option value.

Also I tried this code:

$params = array(
        'product' => $productId,
        'qty' => 1,
        'options_99' =>time(),
        );

But no luck, can someone suggest?


texts: How to add frontend header and navigation to custom layout

texts:
We have a Marketplace extension which has admin dashboard in marketplace layout no frontend now my client wants to add frontend header how can I do this
directory for seller dashboard is
Vendor\Module\view\marketplace\layout\marketplace_seller_dashoard.xml

Need help


texts: magento 2 errors : General error: 1205 Lock wait timeout exceeded; try restarting transaction

texts:
I am getting below error every second or third day.

  Exception #0 (Magento\Framework\DB\Adapter\LockWaitException):
  SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try
  restarting transaction, query was: INSERT INTO customer_visitor
  (customer_id, session_id, last_visit_at) VALUES (?, ?, ?)
  Exception #1 (Zend_Db_Statement_Exception): SQLSTATE[HY000]: General
  error: 1205 Lock wait timeout exceeded; try restarting transaction,
  query was: INSERT INTO customer_visitor (customer_id,
  session_id, last_visit_at) VALUES (?, ?, ?) Exception #2
  (PDOException): SQLSTATE[HY000]: General error: 1205 Lock wait timeout
  exceeded; try restarting transaction

I see table customer_visitor have above 22000 records. Can we clear this table?

I also check in my staging site for same table having 12 records and it never increase records of customer visitor.

How can I cleaning up customer_visitor table log. is it creates any problems if cleaning up this table


texts: Magento 2 Custom template content will not shown in graphql response of CMS page

texts:
I have a CMS page in which I want to show the date e.i Current date OR Date after 5 days etc. So for that I have created a template file and call inside the CMS page.
It will show content in Front but in GraphQl response, it will not available.
https://www.awesomescreenshot.com/image/7156601?key=f19c0b7a0aebdc1fe91ef37c79085e5a
https://www.awesomescreenshot.com/image/7156679?key=66c833a0c044b5e7738b4efd6c6fc565
https://www.awesomescreenshot.com/image/7156696?key=e448522e6ef5d584d19e2c396cef11c1
https://www.awesomescreenshot.com/image/7157210?key=ac2f2a2d431ee1cadb762e46184d4a44
graphQl Request(Query):
{
        cmsPage(identifier: "home") {
        url_key
        title
        content
        content_heading
        page_layout
        meta_title
        meta_description
        meta_keywords
      }
    }

Current Response:
{
  "data": {
    "cmsPage": {
      "url_key": "home",
      "title": "Home Page",
      "content": "
Hi, DD/MM/YYYY ''
\r\n

",
      "content_heading": "Home Page",
      "page_layout": "1column",
      "meta_title": "",
      "meta_description": "",
      "meta_keywords": ""
    }
  }
}

Expected Response:
{
  "data": {
    "cmsPage": {
      "url_key": "home",
      "title": "Home Page",
      "content": "
Hi, DD/MM/YYYY 'Today is 04/08/2021'
\r\n

",
      "content_heading": "Home Page",
      "page_layout": "1column",
      "meta_title": "",
      "meta_description": "",
      "meta_keywords": ""
    }
  }
}

CMS page Content:

Hi, DD/MM/YYYY '{{block class="Magento\Framework\View\Element\Template" template="Vendor_Module::current_date.phtml"}}'

Template file(/Vendor/Module/view/frontend/templates/current_date.phtml):
<?php
    echo "Today is " . date("m/d/Y") . "<be>";
?>

Do I need to create a resolver?
Thanks in advance.


texts: Magento 2.2 problem with .phtml overwriting using module

texts:
I want to overwrite gallery.phtml block from single product page.
Magento 2 file catalog_product_view.xml

    <?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Catalog\Block\Product\View" name="product.detail.info" as="product_detail_info" template="product/view/detail_layout.phtml" after="-" >
                <block class="Magento\Catalog\Block\Product\View\Gallery" name="product.info.media.image" template="Magento_Catalog::product/view/gallery.phtml"/>
            </block>
        </referenceContainer>
    </body>
</page>

I want to replace gallery.phtml file.
Here's my two method:

1st - layout.xml method
catalog_product_view.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
<referenceBlock name="product.info.media.image">
    <arguments>
        <argument name="template" xsi:type="string">UNBXD_ProductAttributes::catalog/product/view/gallery.phtml</argument>
    </arguments>
</referenceBlock>
    </body>
</page>

2nd method - di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Block\Product\View">
        <plugin name="custom_widget_name" type="UNBXD\ProductAttributes\Plugin\Catalog\Block\Product\View\Gallery" />
    </type>
</config>

Gallery.php

<?php
namespace UNBXD\ProductAttributes\Plugin\Catalog\Block\Product\View;
class Gallery
{
    public function after_construct(\Magento\Catalog\Block\Product\View $result)
    {

        $result->setTemplate('UNBXD_ProductAttributes::catalog/product/view/gallery.phtml');
        return $result;
    }
}
?>

Nothing seems to work. I know this block in nested in another block. Is referenceBlock name 'product.info.media.image' correct in this case?


texts: I have recently inherited a Magento site that has n98-magerun.phar sitting, publicly accessibly, on the site's home directory. I know that this is a command line tool, but I wonder if it should be publicly accessible, and it if it should be below web root. (This might be an issue if, for instance, it accepts query string parameters or can otherwise be run by a web request.)


texts: Magento 2.4 EE - Consumers or RabbitMQ Consumers are not working, it should work automatically after deployment

texts:
Summary of the issue

Queue Consumers are not working, it should work automatically after deployment.

Information on your environment

Magento EE 2.4 ,
RabbitMQ 3.8,
Composer version- 1.10.16
Configuration -
.magento.env.yaml

deploy:
       CRON_CONSUMERS_RUNNER:
           cron_run: true
           max_messages: 0
           consumers:
               - codegeneratorProcessor

Steps to reproduce

Admin panel > Marketing > Cart Price rules > Add new rule > choose                       Coupon > Drop Down > Auto > Save
Admin panel > Marketing > Cart Price rules > Edit Auto Tupe Rule > Manage Coupon Codes > Enter Coupon Qty > Generate > See                            Message is added to queue, wait to get your coupons soon
bulk coupon not generated.

Expected and actual results

codegeneratorProcessor queue should process and be able to generate bulk                              coupons.


texts: Magento 1.7 : All PAge White after start Compilation

texts:
After start Compilation i got white screen. IF i will disable compilation website working good.

I don't want to disable compilation so please don't suggest this type of answer.
Thanks


texts: In Magento 2.2.0 after disable the template path hint the some pages still show the path hint

texts:
In Magento-2.2.0 after disable the template path hint some pages still show the path hint,

I clear all the caches and but still same result.


texts:
How can I remove .html prefix from Venia Concept Product URL Suffix and Category URL Suffix as my magento instance doesn't have an sufix set and I thought it would pick it up from the settings but it looks like it isn't ?
Thanks


texts: Override Component\Filters\Type\Range for custom grid column

texts:
I created custom admin grid with filters. But when I enter 0 in "from field" in filter - in the results it shows items with negative values also, so it does not work right.

I found this function in magento core

vendor\magento\module-ui\Component\Filters\Type\Range.php

protected function applyFilterByType($type, $value)
{
    if (!empty($value) && $value !== '0') {
        $filter = $this->filterBuilder->setConditionType($type)
            ->setField($this->getName())
            ->setValue($value)
            ->create();

        $this->getContext()->getDataProvider()->addFilter($filter);
    }
}

If I comment this "if" statement it works right.
How can I fix this in my module? How can I override Range class for my column?


texts: Where I Can Paste Piwik JS Code In Magento

texts:
I need to integrate piwik for my Site. where i can paste my piwik java-script to my magento.

Work-Out :: Copy and paste to SYSTEM->CONFIGURATION->GENERAL->DESIGN->Miscellaneous Scripts-> here

But its not working

How can i properly insert js to my magento.


texts: Implementation of attribute moving to the selected group, selected set attribute

texts:
Tell me how to implement attribute transfer to the desired group.

I have attribute set

            $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);

            $attributeSet = $this->attributeSetFactory->create();
            $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
            $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
            $data = [
                'attribute_set_name' => 'Bed Attribute Set',
                'entity_type_id' => $entityTypeId,
                'sort_order' => 200,
            ];
            $attributeSet->setData($data);
            $attributeSet->validate();
            $attributeSet->save();
            $attributeSet->initFromSkeleton($attributeSetId);
            $attributeSet->save();

and attribute

            $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

            $eavSetup->addAttribute(
                \Magento\Catalog\Model\Product::ENTITY,
                'Bed Left Image',
                [
                    'type' => 'text',
                    'label' => 'YOUR ATTRIBUTE LABEL',
                    'backend' => '',
                    'frontend' => '',
                    'input' => 'textarea',
                    'wysiwyg_enabled'   => true,
                    'source' => '',
                    'required' => false,
                    'sort_order' => 19,
                    'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
                    'used_in_product_listing' => true,
                    'visible_on_front' => true,
                    'attribute_set_id' => $attributeSet->getId(),
                    'is_html_allowed_on_front' => true,
                    'visible' => true,
                    'user_defined' => true,
                    'searchable' => false,
                    'filterable' => false,
                    'comparable' => false,
                    'visible_in_advanced_search' => false,
                    'unique' => false,
                    'apply_to' => ''
                ]
            );

and I want to make it so that the created attribute was available only in this attribute set set and was added to the 'Content' group.

I add the attribute to the attribute set

'attribute_set_id' => $ attributeSet-> getId ()

and to the group

'Group' => 'Content'

but after that the attribute is available on all products and atribute set.

I tried not to add the attribute to the group, so that it would appear in my admin panel in unussigned attributes and I could add it manually to the desired group through the admin interface, and it worked as needed.

But now i'am need to do this programmatically, tell me how plz


texts: Shipping Method - call method only when specific condition is met

texts:
I have an option on a web store to order a sample of a product/s and it is shipped for free via the default Free Shipping option. Only samples alone are free shipping, if a product & a sample is ordered, then it is not free.
Right now, when Free Shipping is enabled, the below works fine:
if ($onlySample === true && $carrierCode == 'freeshipping') {
if (false !== $result) {
foreach ($result->getAllRates() as $resultMethod) {
if ($carrierCode == $resultMethod->getMethod() && $carrierCode == 'freeshipping') {
$resultMethod->setMethodTitle('Free Shipping');
$resultMethod->setCarrierTitle('Free Shipping');
$resultMethod->setTitle('Free Shipping');
}
}
} else {
return $this;
}
}
if ($onlySample === true && $carrierCode != 'freeshipping') {
return $this;
}
$this->getResult()->append($result);
}
return $this;
}

The problem I have is, if Free Shipping is enabled, but a non-sample product is ordered. The default Magento backend Free Shipping Method,Title and message is STILL shown. This obviously causes confusion.
When Free Shipping is NOT enabled, this function doesn't work at all.
Any help would be great on this, I don't want to disable the method of free shipping but I don't want to hide it either as when it's hidden, the customer can't proceed to checkout.
I am thinking perhaps programmatically enable free shipping if condition is Sample and/or OnlySample is met but how would I achieve this?


texts:
I need to allow users to add a string before putting a product in the cart, like a configurable product (for example colors [white, black, yellow, ...]) but without pre-defined strings.

How can I insert a text-input field in the product page and making automatically store these data in the order?


texts: How to set a default value for the city field in checkout shipping address - magento 2

texts:
I just need to set a default value (with readonly attribute) to the city field in the shipping address section. because the delivery is limited to a particular city at the moment.But the user is free to type any city name in billing address.

In the LayoutProcessor,  getBillingAddressComponent() method i have added :

....

....

....

'city' => [
    'readonly' =>'readonly',
    'config' => [
    'value' =>'My Custom Value',
    'readonly' =>'readonly',
     'elementTmpl' => 'ui/form/element/textC',
        'tooltip' => [
            'description' => __('We deliver items only in selected cities at the moment.'),
        ],
    ],
],

....

....

TextC.html

<input class="admin__control-text" type="text" value="My Custom Value" readonly
data-bind="
    value: value,
    hasFocus: focused,
    valueUpdate: valueUpdate,
    attr: {
        name: inputName,
        placeholder: placeholder,
        'aria-describedby': noticeId,
        id: uid,
        disabled: disabled,
        maxlength: 255
        readonly: readonly
}"/>

Mean time i don't care about editing the core files. Iam working in Magento 2.2

Iam familiar with copying and editing templates in magento 1.X. But i can't find a way to achieve this in Magento 2. Im not sure that im in a right path.


texts: How to write a test for custom router and plugin in magento 2?

texts:
I have created a module in magento 2 for adding prefix to the url of all product and category.

here is the snippet code for the router :

   /**
     * Match route pages for handling cp / ip
     *
     * @param \Magento\Framework\App\RequestInterface|\Magento\Framework\App\Request\Http $request
     * @return bool
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     */
    public function match(\Magento\Framework\App\RequestInterface $request)
    {
        $pathInfo= trim($request->getPathInfo(), '/');
        $requestUri = trim($request->getRequestUri(), '/');

        $requestUriParts = explode('/', $requestUri);
        array_walk($requestUriParts, function (&$value) {
            $value = trim($value);
        });

        $pathInfoParts = explode('/', $pathInfo);
        array_walk($pathInfoParts, function (&$value) {
            $value = trim($value);
        });

        if ($requestUriParts[0] == $this->prefixCp || $requestUriParts[0]==$this->prefixIp) {
            // remove the cp or ip
            $requestUriFinal = '';
            unset($requestUriParts[0]);
            foreach ($requestUriParts as $r) {
                $requestUriFinal .= $r . '/';
            }

            // remove cp or ip
            unset($pathInfoParts[0]);
            $pathInfoFinal = '';
            foreach ($pathInfoParts as $p) {
                $pathInfoFinal .= $p . '/' ;
            }

            $request->setRequestUri($requestUriFinal);
            $request->setPathInfo($pathInfoFinal);
        } else {
            // No route math here
            return;
        }

        /*
         * We have match and now we will forward action
         */
        return $this->actionFactory->create(
            'Magento\Framework\App\Action\Forward',
            ['request' => $request]
        );
    }

How to test the logic in this match function ?
and also for the plugin :

/**
 * this will modify the class Product in vendor/magento/module-catalog/Model/Product.php
 */
class ProductPlugin extends \Magento\Catalog\Model\Product
{
    /**
     * Returns request path
     *
     * @return string
     */
    public function afterGetRequestPath(\Magento\Catalog\Model\Product $subject, $result)
    {
        return 'ip/' . $result ;
    }
}

I just want to test a simple test case where my custom route handle the request. any idea ?


texts:
I'm trying to display content for admins only on the frontend (product view), however, with FPC enabled, once an admin opens that product, all the other users will see that same content.
I have the method below on my Helper, which returns true/false to the .phtml file in question.

public function isAdmin(){
        $customerId = $this->_customerSession->getId();

        if($customerId == 3){
            return true;
        } else return false;

        return false;
    }

I know I can't get customer session when the FPC is enabled and I'm looking for a solution. What should be my approach?
Should I create a custom http variable, if so, how can I achieve that?


texts: Customizable options for Virtual Products

texts:
I am trying to access the customizable options of a virtual product whose visibility is set to 'Not Visible Individually' through the GQL query,
{
  products(filter: { sku: { eq: "sample_sku" } } ) {
    items {
      id
      ... on CustomizableProductInterface {
        options {
          __typename
          ... on CustomizableFieldOption {
            uid
            title
            option_id
          }
        }
      }
    }
  }
}

But the custom options are not being fetched. But if the visibility is set to 'Catalog&Search' the options are being fetched.
Are there any ways to fetch the custom options information for a virtual product without having it's visibility changed from 'not visible individually'?


texts: Delete all orders older than specific date by db query

texts: I need to delete about 7500 orders and keep the orders from 26.08.2016 and onward. I would like to do it through db query. Is it possible or I have to stick with admin panel?


texts: How to add a custom PHP page in Magento ?

texts:
Details

I already have the .phtml file
The actual path = /var/www/html/store/app/design/frontend/base/default/template/page/distributors.phtml

After doing some research I found that I will have to add this

{{block type="core/template" template="/var/www/html/store/app/design/frontend/base/default/template/page/distributors.phtml"}}

Where exactly are we suppose to add this ?

I logged in to Mogento Admin.
Go to CMS > Pages > Add New Page, and then I don't know what else to do ?

Can someone help shed the light on this ?

Thanks.


texts:
I've this really strange issue with form js validation error.

I've never edited anything related to it and there are no js errors in the console.

The problem is that an error like "This is a required field" appear for 1 - 2 seconds and then disappear.

Looking the console I can see that the opacity of the div .validation-advice goes from 0 to 1 and the again from 1 to 0 without stopping.

And also the display property remains "none".

This happens in every situation where js validation is required.

This is a screenshot of login page

I'm going crazy I really don't know where to check.


texts: PHP Fatal error When compiling Magento 2

texts:
PHP Fatal error:  Class 'Magento\Catalog\Model\Product\Attribute\Backend\Media' not found in /home/public_html/app/code/LitExtension/Core/Model/Preference/Product/Media.php on line 7

Full Code

<?php

namespace LitExtension\Core\Model\Preference\Product;

use Magento\Framework\Exception\LocalizedException;

class Media extends \Magento\Catalog\Model\Product\Attribute\Backend\Media
{
    public function addImage(
        \Magento\Catalog\Model\Product $product,
        $file,
        $mediaAttribute = null,
        $move = false,
        $exclude = true,
        $label = ''
    ) {
        $file = $this->mediaDirectory->getRelativePath($file);
        if (!$this->mediaDirectory->isFile($file)) {
            throw new LocalizedException(__('The image does not exist.'));
        }

        $pathinfo = pathinfo($file);
        $imgExtensions = ['jpg', 'jpeg', 'gif', 'png'];
        if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), $imgExtensions)) {
            throw new LocalizedException(__('Please correct the image file type.'));
        }

        $fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']);
        $dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName);
        $fileName = $dispretionPath . '/' . $fileName;

        $fileName = $this->getNotDuplicatedFilename($fileName, $dispretionPath);

        $destinationFile = $this->mediaConfig->getTmpMediaPath($fileName);

        try {
            /** @var $storageHelper \Magento\MediaStorage\Helper\File\Storage\Database */
            $storageHelper = $this->fileStorageDb;
            if ($move) {
                $this->mediaDirectory->renameFile($file, $destinationFile);

                //If this is used, filesystem should be configured properly
                $storageHelper->saveFile($this->mediaConfig->getTmpMediaShortUrl($fileName));
            } else {
                $this->mediaDirectory->copyFile($file, $destinationFile);

                $storageHelper->saveFile($this->mediaConfig->getTmpMediaShortUrl($fileName));
                $this->mediaDirectory->changePermissions($destinationFile, DriverInterface::WRITEABLE_FILE_MODE);
            }
        } catch (\Exception $e) {
            throw new LocalizedException(__('We couldn\'t move this file: %1.', $e->getMessage()));
        }

        $fileName = str_replace('\\', '/', $fileName);

        $attrCode = $this->getAttribute()->getAttributeCode();
        $mediaGalleryData = $product->getData($attrCode);
        $position = 0;
        if (!is_array($mediaGalleryData)) {
            $mediaGalleryData = ['images' => []];
        }

        foreach ($mediaGalleryData['images'] as &$image) {
            if (isset($image['position']) && $image['position'] > $position) {
                $position = $image['position'];
            }
        }

        $position++;
        $mediaGalleryData['images'][] = [
            'file' => $fileName,
            'position' => $position,
            'label' => $label,
            'disabled' => (int)$exclude,
        ];

        $product->setData($attrCode, $mediaGalleryData);

        if ($mediaAttribute !== null) {
            $this->setMediaAttribute($product, $mediaAttribute, $fileName);
        }

        return $fileName;
    }
}

Please let me know if I am missing something? Thanks for your help.


texts: In Magento 2, how to bypass cache for a custom block template extended from \Magento\Swatches\Block\Product\Renderer\Listing\Configurable?

texts:
Recently I customized category listing page to auto-select the color swatch in listing page when a color swatch is selected in the layered navigation filter.

Everything is working fine with cache disabled. If the cache is enabled, even though the filters are cleared, the previously selected swatches remain selected.

I know this is because the template is getting cached. I tried using cacheable="false" but no use. Can anyone please help me to resolve this, I just want a block not to be cached or any other better way to achieve this.

For your reference here is the piece of code I added in the "renderer.phtml" template. Added "colorOptionId: '<?php echo $colorOptionId ?>'" to pass it to swatch-renderer.js.

<script>
require([
    'jquery',
    'jquery/ui',
    'Magento_Swatches/js/swatch-renderer',
    'Magento_Swatches/js/catalog-add-to-cart',
    'priceBox'
], function ($) {
    var jsonConfig = <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>;

    $('.swatch-opt-<?= /* @escapeNotVerified */ $block->getProduct()->getId() ?>').SwatchRenderer({
        selectorProduct: '.product-item-details',
        colorOptionId: '<?php echo $colorOptionId ?>',
        colorOption: '<?php echo $color ?>',
        onlySwatches: true,
        enableControlLabel: false,
        numberToShow: <?= /* @escapeNotVerified */ $block->getNumberSwatchesPerProduct() ?>,
        jsonConfig: jsonConfig,
        jsonSwatchConfig: <?= /* @escapeNotVerified */ $block->getJsonSwatchConfig() ?>,
        mediaCallback: '<?= /* @escapeNotVerified */ $block->getMediaCallback() ?>'
    });

    var dataPriceBoxSelector = '[data-role=priceBox]',
        dataProductIdSelector = '[data-product-id=<?= $block->escapeHtml($block->getProduct()->getId()) ?>]',
        priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

    priceBoxes.priceBox({
        'priceConfig': {
            priceFormat: jsonConfig.priceFormat,
            prices: jsonConfig.prices
        }
    });
});


texts:
This is driving me insane :(

I need to redirect from one category to another existing category in Magento 1.9

I've tried to add a rewrite in magento's module but of course get the error Request Path for Specified Store already exists.

I've deleted it out and replaced it but then when it gets reindexed it get replaced by magentos behavior (yeah thanks magento)

Then if I add it to .htaccess file or Apache rewrite but its like magento is just ignoring it :(

What an awful behaviour this is in magento


texts: Error: DDL statements are not allowed in transactions while running setup:upgrade. Running Data Patch

texts:
Magento 2.3.1

After making the data patch @ following location

vendor/ModuleName/Setup/Patch/Data/AddMyColumnPatch.php

code given below for AddMyColumnPatch.php. When I run bin/magento setup:upgrade to get this patch installed I get following error at cli.

  DDL statements are not allowed in transactions

I have used following file as reference to add column to my table using data patch.

  vendor/magento/module-quote/Setup/Patch/Data/InstallEntityTypes.php
  Follow lines from 47 to 65

My AddMyColumnPatch.php code is:

<?php
namespace Vendor\ModuleName\Setup\Patch\Data;

use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\PatchRevertableInterface;

use Magento\Quote\Setup\QuoteSetupFactory;
use Magento\Sales\Setup\SalesSetupFactory;

use Psr\Log\LoggerInterface;

/**
 */
class AddressSuburbPatch implements DataPatchInterface, PatchRevertableInterface
{
    /**
     * Attribute Code of the Custom Attribute
     */
    const CUSTOM_ATTRIBUTE_CODE = 'my_column';

    /**
     * @var \Magento\Framework\Setup\ModuleDataSetupInterface
     */
    private $moduleDataSetup;

    /**
     * @var \Magento\Quote\Setup\QuoteSetupFactory
     */
    private $quoteSetupFactory;

    /**
     * @var Magento\Sales\Setup\SalesSetupFactory
     */
    private $salesSetupFactory;

    /**
     * @var \Psr\Log\LoggerInterface
     */
    private $logger;

    /**
     * @param \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
     */
    public function __construct(
        ModuleDataSetupInterface $moduleDataSetup,
        QuoteSetupFactory $quoteSetupFactory,
        SalesSetupFactory $salesSetupFactory,
        LoggerInterface $logger
    )
    {

        $this->moduleDataSetup = $moduleDataSetup;
        $this->quoteSetupFactory = $quoteSetupFactory;
        $this->salesSetupFactory = $salesSetupFactory;
        $this->logger = $logger;
    }

    /**
     * {@inheritdoc}
     */
    public function apply()
    {
        $this->moduleDataSetup->getConnection()->startSetup();

        $this->logger->debug('DDL Statements error');

        $quoteSetup = $this->quoteSetupFactory->create(['setup' => $this->moduleDataSetup]);

        $quoteSetup->addAttribute('quote_address', self::CUSTOM_ATTRIBUTE_CODE, ['type' => 'text']);

        $salesSetup = $this->salesSetupFactory->create(['setup' => $this->moduleDataSetup]);
        $salesSetup->addAttribute('order_address', self::CUSTOM_ATTRIBUTE_CODE, ['type' => 'text']);

        $this->logger->debug('Script working');

        $this->moduleDataSetup->getConnection()->endSetup();

    }

    /**
     * {@inheritdoc}
     */
    public static function getDependencies()
    {

        return [

        ];
    }

    public function revert()
    {
        $this->moduleDataSetup->getConnection()->startSetup();

        $this->moduleDataSetup->getConnection()->endSetup();
    }

    /**
     * {@inheritdoc}
     */
    public function getAliases()
    {

        return [];
    }

}


texts:
I have a Magento development environment setup on a virtual box server with a git repo in the root web directory. I've been using this setup for almost a year. Yesterday I checked out master and now if I go to the home page I get a blank white page (view source shows nothing is returned). No errors are in var/log or var/report. I've cleared var/cache and verified my permissions pare properly set. The same branch is checked out on our live site and QA, and both work just fine.

If I go to a product page, the bulk of the page is there, but lots of CSS and JS is missing. I have found that it's trying to load http://example.com/mage/translate.js instead of http://example.com/js/mage/translate.js. So it appears that the config value for the js folder isn't being loaded.

If I go to the admin the login page loads the inputs and dies with this error

Warning: include(Mage/Captcha/Model.php): failed to open stream: No such file or directory

This is caused by these lines

$type = $this->getConfigNode('type');
$this->_captcha[$formId] = Mage::getModel('captcha/' . $type, array('formId' => $formId));

in Mage_Captcha_Helper_Data (lines 71 & 72). The issue is that $type is coming back as null when it should get the default from the Captcha config.xml. I've checked that the config file is there and its loaded by Varien_Simplexml_Config::loadFile().

Can anyone offer any suggestions as to what I may have done to my server to mess it up this badly?


texts: Run a function before a specific page load

texts:
I need to run a function that changes a database table value before a specific page loads, this page would be: mysite/index.php/mymodule/account/list/.

public function updateTable(){
     $id = Mage::getSingleton('customer/session')->getCustomer()->getId();
     $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
     $connection->query("UPDATE my_table SET value = 0 WHERE customer_id=". "$id");

}

I tried to make it work calling the function in mymodule.xml as a helper function but it runs after the page loads. I also tried to call the function in my block.phtml file that is loaded in the account/list page with php, but it also changes the table after the page load.

<?php Mage::helper('productquestions')->updateTable() ?>

There's someway to make it work using Observer.php? If not, there is another way?

Thanks a lot!


texts: Magento 2.3 product attribute and ui component

texts:
First, I created the UI component:
Vendor/Module/view/adminhtml/ui_component/product_form.xml

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="product-details">
       <container name="fieldname_container">
           <argument name="data" xsi:type="array">
               <item name="config" xsi:type="array">
                   <item name="sortOrder" xsi:type="number">160</item>
               </item>
           </argument>
           <field name="fieldname" formElement="multiselect">
               <argument name="data" xsi:type="array">
                   <item name="config" xsi:type="array">
                        <item name="dataScope" xsi:type="string">fieldname</item>
                        <item name="filterOptions" xsi:type="boolean">true</item>
                        <item name="showCheckbox" xsi:type="boolean">true</item>
                        <item name="disableLabel" xsi:type="boolean">false</item>
                        <item name="multiple" xsi:type="boolean">true</item>
                   </item>
               </argument>
               <settings>
                   <validation>
                       <rule name="validate-field" xsi:type="boolean">true</rule>
                   </validation>
                   <dataType>varchar</dataType>
                   <label translate="true">Field label</label>
                   <dataScope>fieldname</dataScope>
               </settings>
               <formElements>
                   <multiselect>
                       <settings>
                           <options class="Vendor\Module\Model\Backend\Product\Source\FieldName"/>
                       </settings>
                   </multiselect>
               </formElements>
           </field>
       </container>
   </fieldset>
</form>

however when I save product the values of the custom attribute are not saved.

Created attribute and added it to product but now I have that field twice in product form. ( values are being saved )

If I remove created field from attribute set values are not being saved.

what is wrong here ?


texts:
how get product's category in

Product id :1
Product Url :http://127.0.0.1/magento/emarsy-catalogfeed.php/t-shirt.html
product Name:T-shirt
product Image:http://127.0.0.1/magento/media/catalog/productno_selection
category :
Product Price :340.0000
Product Description :T-shirt
Msrp :
Avaliable:1
brand :


texts: Magento 2 PWA Update  in custom component

texts:
How to update the title tag in the Head ?

Really don't want to mess around with the DOM updating with javascript!


texts: Magento 2: disable system warning messages in Admin Panel for some user

texts: Is there a way to disable system warning messages popups for some specific user (or for all users also) in Magento 2?


texts: Recompile the store is necessary after applying the patch 7405?

texts:
I need your help to figure out something which I should do or not.
Recently I applied the latest patch 7405 on my Magento store - CE 1.8.1.0 and as per the online PDF doc I did "Flash Cache Storage" from admin as step 9. There is further step 10 which says about "Run Compilation Process".

Is this really necessary to run that step? I'm worried because there is some custom work done on my store so after performing this step is there any possibility to get ruined any of my custom work done?

Please advice.

Thank you very much in advance.


texts: Unable to get quote items programmatically

texts:
In order to send all user quote items to my other middle ware database I am getting quote items, but I am not getting it

I placed a .php file in my Magento root as send.php and then Included below script.

<?php
require_once("app/Mage.php");
Mage::app('default');

$cart = Mage::getSingleton('checkout/session')->getQuote();

foreach ($cart->getAllItems() as $item) {
    echo '<pre>'; print_r($item);
    /*if ($item->getParentItemId()) {
        continue;
    }*/
}

But I am not getting any quote items.


texts:
I just received this email from USPS

    "September 7, 2014 USPS will be implementing changes and additional features to the Web Tools APIs. Detailed release notes are available
    on the USPS Web Tools home page at www.usps.com/webtools.

  The CAT/staging environment is now available to developers for
  testing using your Web Tools user ID and the following URLs:

Secure APIs: https://stg-secure.shippingapis.com/ShippingApi.dll
Non-secure APIs: http://stg-production.shippingapis.com/ShippingApi.dll

  To ensure we have the best contact information for you, please take a
  few moments to complete our four-question contact form by clicking the
  following link: Web Tools Customer Contact Form

  Please email us at WebTools@usps.gov if you have any issues or
  questions. You can also reach us on twitter @USPSWebTools for updates
  and announcements.

  Thank you,"

I have CE v 1.7.0.2 is there a Magento CE USPS API patch or update that must be done or will it not effect us like the Jan 26, 2014 USPS update had no effect...but this one appears to have more to it...if anyone knows the answer please respond...hopefully someone from Magento or they will post a message here.
Thanks


texts: Magento 2: change shipping address form fields order

texts:
Magento 2 having checkout shipping form fields order as its in below image. I need to change fields order in to Country->State/Province->Zip/Postal Code as mentioned in same image.

Do you have any idea?


texts: Displaying all sub categories of parent category on sub category page

texts:
I am using Magento CE 1.9.2.2 what I am trying to do is
I have category structure like the below

- Party
     - Balloons
     - Bags
     - Streamers

Now if you click on the category "party" on the left side Magento shows the "browse by" category/sub category list. However if I click on Balloons I want the same browser by block to be displayed so that even when you are on a sub category page you will be able to see the links to the other sub categories in the left side column in a browser by box.

Hope this is clear what I want to achieve because I am not able to get anything to be displayed on the sub categories?  So what I have done is in Magento manage categories I went to the "balloons" category and changed Display Mode to static block and products. I then changed the drop down CMS Block and selected the block I made called Sub Category Listing.

Then in my Sub category listing block I added the below in code view
{{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}

I then opened ftp and created the subcategory_listing.phtml and added the below code

       $layer = Mage::getSingleton('catalog/layer');
       $_category   = $layer->getCurrentCategory();
       $_categories = $_category->getCollection()->addAttributeToSelect(array('url_key','name','image','all_children','is_anchor','description'))
           ->addAttributeToFilter('is_active', 1)
           ->addIdFilter($_category->getChildren())
           ->setOrder('position', 'ASC')
           ->joinUrlRewrite();
     ?>

                <?php foreach ($_categories as $_category): ?>
                <?php if($_category->getIsActive()): ?>
                <?php Mage::log($_category->debug(), null, 'mylogfile.log'); ?>

                        <a class="now-from-container" href="<?php echo $_category->getURL() ?>">

                            <a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                                <img src="<?php echo $this->htmlEscape($_category->getImageUrl()) ?>" width="190" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />

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

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


texts: Overriding admin .phtml files not showing up in magento2 backend?

texts:
I have overridden the admin .phtml files

  vendor/magento/module-sales/view/adminhtml/templates/order/view/items/renderer/default.phtml

but nothing shows.

This is my module.xml

  app/code/TemplateMonster/Orderitem/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="TemplateMonster_Orderitem" setup_version="1.0.0" active="true">
    <sequence>
            <module name="Magento_Sales"/>
        </sequence>
        </module>
</config>

This is my sales_order_view.xml file

  app/code/TemplateMonster/Orderitem/view/adminhtml/layout/sales_order_view.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="sales_order_items_renderer">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">TemplateMonster_Orderitem::order/view/items/renderer/default.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

This my file path fordefault.phtml(

  app/code/TemplateMonster/Orderitem/view/adminhtml/templates/order/view/items/renderer/default.phtml

I don't know what is the mistake. Please someone help me


texts: Magento 2 need to upgrade compile and deploy everytime

texts:
For every change that I do related to database I have to upgrade the code.

On upgrading it when I load the page, Css and Js are not applied.

I tried giving permissions to it as well. Only when I upgrade, compile and deploy and then give permission I can see Css and Js loaded.

I am running it in developer mode. This is time consuming and also tiresome.

Any way I can avoid this?

  FYI: I have set Admin->Stores->Config->Advanced->Developer->Static
  Files Settings->Sign Static Files->No

I had to this because immediately after installation my css and js files were not loading and the only way that worked out was this.


texts: How to use Database as slow_backend instead of Files in Magento EE 1.12?

texts:
In Magento EE 1.12.0.0 It would seem that no matter what configuration changes I make to app/etc/local.xml, the default file cache continues to be used (which is evidenced by var/cache/ always filling).

Expectation

Memcached is used as fast_backend.
Database is used as slow_backend.
File cache is not used at all (i.e. var/cache/ should always be empty).

Actual Output

Memcached is used as fast_backend.
Database is not used at all.
File cache is being used.

Testing Procedure

Make configuration change to app/etc/local.xml.
Restart Memcached and Apache (just for good measure and it's on my local dev box so I may as well).
Clear the file cache (rm -rf var/cache/*).
Refresh the home page.
Check the contents of the file cache (ls var/cache).
Become saddened and return to #1 with a different config change.

The Config

The contents of my app/etc/local.xml is as follows:

<config>
    <global>
        <install>
            <date><![CDATA[{{actual_data}}]]></date>
        </install>
        <crypt>
            <key><![CDATA[{{actual_data}}]]></key>
        </crypt>
        <disable_local_modules>false</disable_local_modules>
        <resources>
            <db>
                <table_prefix><![CDATA[]]></table_prefix>
            </db>
            <default_setup>
                <connection>
                    <host><![CDATA[{{actual_data}}]]></host>
                    <username><![CDATA[{{actual_data}}]]></username>
                    <password><![CDATA[{{actual_data}}]]></password>
                    <dbname><![CDATA[{{actual_data}}]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>
            </default_setup>
        </resources>
        <session_save><![CDATA[db]]></session_save>
        <cache>memcached</cache>
        <slow_backend>database</slow_backend>
        <slow_backend_store_data>1</slow_backend_store_data>
        <memcached>
            <servers>
                <server>
                    <host><![CDATA[{{actual_data}}]]></host>
                    <port><![CDATA[{{actual_data}}]]></port>
                    <persistent><![CDATA[0]]></persistent>
                    <weight><![CDATA[2]]></weight>
                    <timeout><![CDATA[10]]></timeout>
                    <retry_interval><![CDATA[10]]></retry_interval>
                    <status><![CDATA[]]></status>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[admin]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>


texts:
Im currently having a problem with ajax and magento. I'm trying to get the current amount of items in a cart, after the user has clicked on the "put in cart"-button of an product, without reloading the page.

So far I've tried it with a poorly written Ajax, which hasn't worked, because I'm an absolute beginner with Ajax.

The process should be following:
User clicks on "add to cart" -> script requests new cart quantity with ajax -> jquery adds the current amount into another DOM-Element (lets name it #cartqty)

My current non-ajax solution doesn't work, which looks like this:

$( '.product-add-btn' ).click(function() {
    $( '#cartqty' ).html('<?php echo $this->helper('checkout/cart')->getSummaryCount(); ?>');
});

The problem is NOT how to add a product with ajax to the cart. The problem is how to get the current amount of items in the cart with ajax after a product has been added to the cart, just for clarification.

My current code just gives back the first known cart item quantity, which is say 4. When I add something again, the quantity doesn't update, it just stays at 4, even if there are 5 products in the cart.

I really hope some can help a beginner.


texts:
I'm working for displaying the clock in the logo. it must display the current time.

I had modified logo.phtml and put the js for clock in pub/static/fronend/theme/js folder. All are went well.

And I had declare the js files on app/design/front_end/theme/Magento_theme/layout/default_head_blocks.xml

while seeing the output al my js files are automatically merged in a single js file in dynamic so, my clock logo is failed to load and also an error in required.js

How can i avoid automatic merge of js files in dynamic ?

my js code is below,

var hands = [];
hands.push(document.querySelector('#secondhand > *'));
hands.push(document.querySelector('#minutehand > *'));
hands.push(document.querySelector('#hourhand > *'));

var cx = 100;
var cy = 100;

function shifter(val) {
 return [val, cx, cy].join(' ');
}

var date = new Date();
var hoursAngle = 360 * date.getHours() / 12 + date.getMinutes() / 2;
var minuteAngle = 360 * date.getMinutes() / 60;
var secAngle = 360 * date.getSeconds() / 60;

hands[0].setAttribute('from', shifter(secAngle));
hands[0].setAttribute('to', shifter(secAngle + 360));
hands[1].setAttribute('from', shifter(minuteAngle));
hands[1].setAttribute('to', shifter(minuteAngle + 360));
hands[2].setAttribute('from', shifter(hoursAngle));
hands[2].setAttribute('to', shifter(hoursAngle + 360));


texts: Magento 2.3 Web Setup Wizard Fatal Error compact()

texts:
Im working on a fresh install of Magento 2.3 and wanting to install an extension from market place.

When I try to do it via the web setup wizard I just get this error:

  Fatal error: Uncaught Exception: Notice: compact(): Undefined
  variable: extras in
  /home/darkpeak/public_html/vendor/zendframework/zend-view/src/Helper/HeadLink.php
  on line 413 in
  /home/darkpeak/public_html/vendor/magento/framework/App/ErrorHandler.php:61
  Stack trace: #0 [internal function]:
  Magento\Framework\App\ErrorHandler->handler(8, 'compact(): Unde...',
  '/home/darkpeak/...', 413, Array) #1
  /home/darkpeak/public_html/vendor/zendframework/zend-view/src/Helper/HeadLink.php(413):
  compact('rel', 'type', 'href', 'media', 'conditionalStyl...',
  'extras') #2
  /home/darkpeak/public_html/vendor/zendframework/zend-view/src/Helper/HeadLink.php(178):
  Zend\View\Helper\HeadLink->createDataStylesheet(Array) #3
  /home/darkpeak/public_html/setup/view/layout/layout.phtml(16):
  Zend\View\Helper\HeadLink->__call('appendStyleshee...', Array) #4
  /home/darkpeak/public_html/vendor/zendframework/zend-view/src/Renderer/PhpRenderer.php(506):
  include('/home/darkpeak/...') #5
  /home/darkpeak/public_html/vendor/zendframework/zend-view/src/View.php(207)
  in
  /home/darkpeak/public_html/vendor/magento/framework/App/ErrorHandler.php
  on line 61

Can anyone help?


texts: Is there a maximum limit on the number of customer groups?

texts: Is there any upper limit on the number of customer groups in Magento CE?


texts: Magento 2 - Error processing your request

texts:
anyone can help me why I am getting this error ? This error coming again and again on my website.
The configuration file has changed. Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration.

Thanks


texts: how we can get product name , image, price and url in magento 2 product factory collection

texts:
How we can get product Name,
               image,
               price
               url

in magento2 product factory collection


texts:
I have set a pre-dispatch observer like this:

\etc\frontend\events.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  <event name="controller_action_predispatch">
      <observer name="Custome_controller_action_predispatch" instance="Namespace\Module\Observer\PreDispatch" shared="false" />
  </event>
</config>

\Observer\PreDispatch.php

public function execute(\Magento\Framework\Event\Observer $observer)
    {
      if($this->isLogin()){
        $customerId = $this->customerSession->getCustomer()->getId();
        $customer = $this->_customerRepositoryInterface->getById($customerId);
        $addresses = $customer->getAddresses();
        if(empty($addresses)){
          $url = $this->helper->getBaseUrl() . 'custom/action/';
          $this->_responseFactory->create()->setRedirect($url)->sendResponse();
          exit;
        }
      }
    }

the problem is i always got an error like this:


texts: Add to cart configurable products using magento soap api V1

texts:
Trying to add configurable product in magento cart using magento soap api V1 but not able to add the products. can anyone please let me know the way how to do it.
Any help would be appreciated.


texts: Additional Shipping Fee on COD for Specific Country Magento 2

texts:
I've a store setup on Magento 2.2.3

I use two payment methods: COD, Credit Card Payment

There are 2 allowed countries (for example A and B)

For Country:A shipping is flat (i.e. 10 USD)

For Country:B shipping is calculated according to weight table

What I want: For Country:A when user selects COD as payment method, additional shipping charges (5 USD) should be charged (i.e. 10 USD + 5 USD = 15 USD)

How do I achieve this in Magento 2.2.3 so that I could set additional shipping charges from admin and User is shown additional charges at front?

Kindly tell me if there's any free existing module/extension available for this.


texts: Magento 2.1 update special price dates programmatically

texts:
I have a problem updating the special price dates of a simple product.
I've tried 2 versions of code, but without results. In both cases the special price will be update, but no affect to the start and end dates.

Version 1

$set_product = $objectManager->create('Magento\Catalog\Model\Product')->load($idSimpleProduct);
$set_product->setSpecialPrice(120.00); // this work
$set_product->setSpecialFromDate('1-1-2018'); //also tried with d/m/Y, m/d/Y, Y-m-d
$set_product->setSpecialToDate('2-2-2018');
$set_product->getResource()->saveAttribute($set_product, 'special_price');
$set_product->getResource()->saveAttribute($set_product, 'special_from_date');
$set_product->getResource()->saveAttribute($set_product, 'special_to_date');
$set_product->save();

Version 2

$set_product = $objectManager->create('Magento\Catalog\Model\Product')->load($idSimpleProduct);
$set_product->setCustomAttributes(array(
            'special_from_date' => date("m-d-Y", strtotime($promoFromDate)),
            'special_to_date' => date("m-d-Y", strtotime($promoToDate)),
            'special_price' => $promoPrice
       )
);
$set_product->save();

Where I wrong? Thanks in advance


texts:
I am trying go create a custom Magento 2 theme. Within this theme I want to add a custom block to the default header.container. This is what I have so far:

app/design/frontend/Vendor/Theme/templates.header.phtml

Custom Header Content

app/design/frontend/Vendor/Theme/Magento_Theme/layout/default.xml

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

        <referenceContainer name="header.container">
            <block class="Magento\Framework\View\Element\Template" name="vendor.theme.header" template="Vendor_Theme::header.phtml" />
        </referenceContainer>

</page>

app/design/frontend/Vendor/Theme/registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/Vendor/Theme',
    __DIR__
);

However, in the front end I get the following error message:

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Vendor_Theme::header.phtml' in module: '' block's name: 'vendor.theme.header'

Whenever I search how to create custom blocks within Magento I always come across module implementations, i.e. within app/code/Vendor/Module/….

Since the error message says

in module: ''

I am now beginning to wonder if you aren't really supposed to define blocks within a theme at all?


texts: How to get custom Featured product collection in magento 2

texts:
I have created one custom attribute and also i have added some product under that attribute now i need product collection of that attribute. Below is my block code for collection but it's not working

public function getCustomProduct()
{
        $collection =  $this->_productCollectionFactory->create()
                        ->addAttributeToSelect('*')
                        ->addAttributeToFilter('status', '1')
                        ->addAttributeToFilter('featured_product', '1')
                        ->addFieldToFilter('visibility', $this->_productVisibility->getVisibleInSiteIds());

    return $collection;
}

i need all products in template file those have under featured_product attribute. Please help me. Thanks in Advanced


texts: Can no longer login to Magento, Customers cannot place orders

texts: doodle-bag.com is no longer functioning, customers cannot complete their purchases, however I cannot login to our Magento account to diagnose the problem. Any help would be appreciated. Thanks.


texts: Magento 2.4 installation through command line

texts: I have tried installing magento 2.4 through command line. But it is showing error like encryption key not specified. Can anyone please help? I am using windows 10


texts: Magento does not display all imported products within the categories

texts:
I have set up the categories and imported the products CSV into Magento, which all worked fine. Each category is display the correct amount of products within the backend. However on the frontend, Magento does not display all of the products in the categories, only the first few. All products are set to be in stock and all have a quantity of at least 1.

As you can see the category 'Bloch' has 2233 products. However on the frontend, Magento is only display 6. Screenshot below.

I have re-indexed the site multiple times as well making sure all products are in stock and visible.

Can anyone help as to why this might be happening?


texts: How to get Extension Attribute in a model in Magento 2?

texts:
I have added an extension attribute by creating extension_attributes.xml file in etc. Its content is:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
   <extension_attributes for="Magento\Quote\Api\Data\AddressInterface">
      <attribute code="custom_field" type="string" />
   </extension_attributes>
</config>

Now when I try to get extension attribute in model I use following code:

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $address = $objectManager->get('\Magento\Quote\Api\Data\AddressInterface');
 echo $address->getExtensionAttributes()->getCustomField();

But the problem is $address->getExtensionAttributes() return NULL. What am I doing wrong here?


texts: Unable to access controller using AJAX in magento 2

texts:
I Have a very basic ajax function, where i want to access to the controller using AJAX.Below is the code.

<script type="text/javascript">
require(['jquery', 'Magento_Customer/js/customer-data', 'jquery/jquery.cookie'], function($,customerData){

    $(".verifybtn").click(function() {
        jQuery.ajax({
            url: "<?php  echo $block->getUrl('cartamount/checkzip/index'); ?>",
            method: "POST",
            data: 1,
            success: function (response) {
                alert(response);
            }
        });
    });
});
</script>

My controller file location is ( app/code/Ayakil/CartAmount/Controller/Checkzip/Index.php)

<?php
namespace Ayakil\CartAmount\Controller\Checkzip;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;

class Index extends Action {
protected $request;
public function __construct(Context $context,array $data = [])
{
    parent::__construct($context,$data);
}
public function execute() {
    echo "I am here";

}
}

Whenever i click the button i am getting a 404 not found error message.Something very basic, but i am unable to figured it out.
Great hep if some one find the issue.


texts: There has been an error processing your request product

texts:
I import my products via Magmi, when I created my configurable product, and I'll find it on my site it shows me this error :

There has been an error processing your request
Exception printing is disabled by default for security reasons.

Error log record number: 303608032


texts: M1: How to invalidate the fpc manually for a product page?

texts:
I need to investigate an issue around full page cache (fpc) in M1, because we sometimes receive 404 errors on product pages when the cache is invalidated - and no 404 pages anymore after the cache has been refreshed.

I know that it is invalidated, because Admin > System > Cache Management shows "invalidated":

When I refresh the cache via the controls at the top of the same page, everything is fine; no "INVALIDATED" anymore, and no 404 pages. But I want to automate this. For automation, I need to be able to test it. I can only test it, if I can reproduce it.

Therefore, my first question around this topic is:

How can I manually make the fpc "INVALIDATED"?

And, as an advanced question: How can I manually cause the fpc to be marked as "INVALIDATED", and a specific product page to return a 404, which will be no 404 any more once the fpc is refreshed?


texts: What kind of concepts and questions asked in Magento Solution Specialist Certification?

texts:
What Magento looks for in candidate who clears the exam ?

  Like a perspective from a Magento Business Model to Client's
  requirement gathering.

EDIT

This is not duplicate of this question or any other question I have done research and I didn't find any stratified answer that's why I asked a new question, so please read the question's description carefully.

I want to know from Business perspective what Magento looks in to candidate of Solution specialist on behalf of Customer.


texts:
Is it possible in Magento to allow for cache to be cleared in a custom code by using regular expression to target cache tags?

The scenario I have is I am know of a list of cache tags I will be cleaning but they will each have a different suffix on them.


texts: 302 redirect issues. Page header shows 302 for all pages

texts:
If I use an online redirect checker like redirect-checker or seobook.com
I do get a "SERVER RESPONSE: HTTP/1.1 302 Moved Temporarily" for all pages, even for the homepage.

I tried to fix it by modifying .htaccess:

#RewriteRule .* index.php [L]
RewriteRule .* index.php [R=301,L]

But this results in a "broken" redirect like:

http://www.example.com/www/sites/www.example.com/files/html/index.php

Further I changed

  System -> Configuration -> Web -> Url Options

and set "Auto-redirect to Base URL" to 301 (before 302). Cleared ALL caches in backend and var/cache - The online checker still show the same - 302.

Any ideas how to fix the issue? Thanks!


texts: Magento 2.3 Merging dl.xml file when installing new extension

texts:
I have Magento 2.3.5 and am trying to install an extension. The quick of it is, how do I merge dl.xml files or add the argument from one to the existing? When copying the argument from one to the existing didn't work and broke the site until reverted to original dl.
I cannot figure out how to add the argument for the one dl to the other and I did not have a "merge" option in the ftp software that I am aware of when uploading the extension package. I am a novice with such things, but the ways I tried to add the argument to the existing dl.xml files all shut down the website until the original was placed back in. I did review the magento 2 doc on dl.xml but it's beyond me.
Much appreciated, happy holidays to everyone.
-Sean
existing dl.xml reads:

and ends after many lines
</type>

The new dl.xml reads this in total:


texts: Mobile Theme CSS doesn't load correctly. CSS fetched from media/css folder instead?

texts:
I run magento 1.9.1.0 and my main theme is located at

skin/frontend/rwd/maintheme

now I want to use a mobile theme which is located at

skin/frontend/mobile/newtheme

I have added the appropriate exceptions in Design but the CSS for the mobile theme is fetched as

media/css/newtheme/css/style-ssl_1_cp.css

and not from the

skin/frontend/mobile/newtheme/css/style.css.

This causes some elements of the theme to break. Fonts etc are not displaying correctly.

I have verified the folder permissions and the actual file style.css is present as well.

Merge CSS is set to NO as well.

How can I make the CSS load from skin/frontend/mobile/newtheme/css and not from media/css/newtheme

Here is a screenshot of current settings:


texts: What's a hard dependency and what's a soft dependency?

texts:
In Magento 2 (any stable version) you can run this command bin/magento info:dependencies:show-modules and you will get a csv file in the root of your application called modules-dependencies.csv with all the module dependencies that looks like this:

What is a Hard dependency and what is a Soft dependency? An example of each would help.


texts: Magento 1.9. - Third party payment gateway

texts:
For our Magento website we currently have no payment methods enabled. There simply is only an e-mail order being generated in our system.
However we would now like for customers to be able to pay with their credit cards. For that we would like to use a third party solution.

We have Magento version 1.9.3.2.

I'm looking for a possible solution. Any recommendations on what works well?


texts: I would like to setup the backend of my Magento 2 install on a different server, can you guide me with the steps ?


texts: Magento - Random text on 'Shopping cart' page

texts:
Im having a magento online shop in Australia. Im try to add a text line right before the "proceed to checkout" button. I have tried to look for the phtml that controls this page, but couldn't find one.
The main reason that im doing that is becouse i want to let customer know that they are paying with AU$ and not US$.
Anyone idea how to do this? or even a better way for solving that?
will be much appritiated!


texts: How to apply two shopping cart rule on cart

texts:
I have two shopping cart price rule. One has 5% discount on product with sku product1 and second has 7% discount on product with sku product2.

These rule working seperatly. But when cart has both products then calulation is different as I want.

For example :

product1's price is 500 and product2's price is 700.
when product1 is in cart 1st rule will apply and (500*5)/100 = 25 is my discount on cart.

similarly when product2 is in cart then discount is 49.

But when both product is in cart then discount is (500 - (500*5)/100)*7/100 = 33.25 showing but I want to add discount 25+49=74.

How to do this, Is there any setting for this?


texts:
I'm looking for an extension that allows Recurring Billing and that works with Authorize.Net's Automated Recurring Billing (ARB). Meaning that subscriptions are send directly to authorize.net as recurring billing.

Right now all the extension we have tested send the subscriptions orders to authorize.net as new orders every time a billing occurs.

this might be an advantage over ARB as u can control everything from Magento, but still we would like to find an extension that sends subscription orders directly as ARB.


texts: how to include custom methods in Custom observer magento2

texts:
I have a custom observer with different method definitions:

Should the observer include only execute method?
If i can include all the methods, how?

Vendor\Module\Observer\SyncObserver.php

<?php
namespace Vendor\Module\Observer;

use \Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class SyncObserver implements ObserverInterface
{
 protected $_queue;

/**
 * @var \Vendor\Module\Model\QueueFactory
 */
protected $syncQueueFactory;

/**
 * @var \Psr\Log\LoggerInterface
 */
protected $logger;

function __construct(
    \Vendor\Module\Model\QueueFactory $syncQueueFactory,
    \Psr\Log\LoggerInterface $logger
)
{
    $this->syncQueueFactory = $syncQueueFactory;
    $this->logger = $logger;
    $this->_queue = $this->syncQueueFactory->create();
}

public function execute(\Magento\Framework\Event\Observer $observer)
{
    //echo 'Sync obssrexe';die;
    $event = $observer->getEvent();
    //$this->tglssearchEngineFactory->getCatlogSearchResult();
}

//How to include these methods here... if i just put it here, they are no getting called

public function method1(\Magento\Framework\Event\Observer $observer)
{...}

public function method2(\Magento\Framework\Event\Observer $observer)
{...}

UPDATED

Can i use something like this?

function __construct(
    \Vendor\module\Model\QueueFactory $syncQueueFactory,
    \Psr\Log\LoggerInterface $logger
)
{
    $this->syncQueueFactory = $syncQueueFactory;
    $this->logger = $logger;
    $this->_queue = $this->syncQueueFactory->create();
}

public function execute(\Magento\Framework\Event\Observer $observer)
{
    //echo 'Sync obssrexe';die;
    $event = $observer->getEvent();
    $this->syncQueueFactory->productUpdate();
}

My QueueFactory:

public function productUpdate(\Magento\Framework\Event\Observer $observer)
{...}