texts: Magento 2: How can I store my original REST request in a file on the server?

texts:
I need to store my REST request within the file system - I have tried serializing the request object, but obviously the file size is quite a lot larger than the original.

I have run a test that allows me to store the payload as an object, then retrieve the data and un-serialize it.  But as mentioned, not happy with the 10MB+ file size for a small payload of a few KB.

Is there any way I can get the original payload without extending the core?  The only ways I can think to do it is either to BASE64 encode the original JSON data and pass it as a string - seems like a hack - perhaps enclose JSON in an XML field - but then it'd be an XML only REST method, which wouldn't be ideal.

Any ideas would be appreciated.


texts: Magento2 lake of baseurl in image src shows broken images in Magento2 backend Edit form

texts: I have added a new file uploader field to magento admin form. It saves image correctly.But image is not showing in backend form due to absence of baseurl. Can you suggest showm solotion to it.


texts: Customer after save event not triggered if admin add a customer

texts:
I would like to trigger an event when admin add a new customer, I created a new module under local code pool. It is listed in admin->system->configuration->advanced also.

But after save event is not triggered.

Below is my code:

config.xml

 <config>
   <global>
    <adminhtml>
        <events>
            <customer_save_after>
                <observers>
                    <My_WebService_customer_register_success>
                        <type>singleton</type>
                        <class>My_WebService_Model_Observer</class>
                        <method>customerRegisterSuccess</method>
                    </My_WebService_customer_register_success>
                </observers>
            </customer_save_after>
        </events>
    </adminhtml>
   </global>
 </config>

Observer.php

<?php
class My_Module_Model_Observer {
    public function customerRegisterSuccess() {
        Mage::log('I came inside', null, 'beta_version.log');
    }
}
?>

When no log created I checked my log settings enabled or not, it is enabled also. But event not triggered,


texts: Magento + Cloud Computing (AWS,GCP) problem

texts:
I am trying to install Magento on Ubuntu 16.04 on a GCP and AWS server. For some reason it doesn't work http://35.166.35.15/

As you can see the css doesn't work well. Full permissions. Installed perfectly well. Locally on lamp stack it works fine. But for some reason it doesn't on the cloud. What would be a possible reason for this issue?


texts: How to retrieve individual discount split up (shopping cart price) on Cart page

texts:
We have created multiple shopping cart price rules and they have been applied to the user.

In a single cart for a user, multiple shopping cart price rules have been applied. By default Magento can retrieve the total discount amount. But I would like to retrieve the individual discounts (name, amount) for a cart.

Example: in one cart, 3 discounts applied ( 10% offer, 20% offer on bikes, 25% offer), we can only get the total discount after those discounts have been applied. I would like to retrieve the values of each individual discount, i.e. the amount for the 10% discount and so on.


texts: Magento 2: How to align column in sales order template

texts:
i wanted to align the column for items qty and price so that they can be space out and not grouping together as it is now. Can I know which file shall I edit ( which path ) and how to make the column space out between each other? I only see the last script on my email template is :

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

Please advise.


texts:
The newsletter remain in the "not sent" state.
Cron Job is up and running and all mails work accordingly.
newsletter subscribtion mails are sent as well.

magento/var/log/exception.log shows this obscure error:

main.CRITICAL: Error when running a cron job {"exception":"[object] (RuntimeException(code: 0): Error when running a cron job at /var/www/magento/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php:327, Error(code: 0): Call to a member function appendChild() on null at /var/www/magento/vendor/pelago/emogrifier/src/Emogrifier.php:1419)"} []

Any hints to solve the problem?
thanks!


texts: Magento 1.9 - Totally email not working in my store

texts:
another critical problem when going to send email from my store.can't send any email through the store site.Also i checked core_email_queue table & email-queue _recipient ,no records there. I'm using magento 1.9.4.3. How email settings should be?

Here is email template have change code as below.
[![enter image description here][2]][2]

Here is my cron -  * * * * * sh /var/www/m2/cron.sh
can anybody help me to resolev this please.
Thank you.


texts: How to Remove cart products if a specific product is added in cart

texts:
This is my onpage.phtml page to get product id. I need to remove all other products in cart except the mention product id below if this product is on cart.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');

// retrieve quote items collection
$itemsCollection = $cart->getQuote()->getItemsCollection();

// get array of all items what can be display directly
$itemsVisible = $cart->getQuote()->getAllVisibleItems();

// retrieve quote items array
$items = $cart->getQuote()->getAllItems();

foreach($items as $item) {// product id
    $it[] = $item->getProductId();
}
if (in_array(483, $it)){
  //What logic to make here?
}


texts: Create Dirty Playground In Magento 2.1.6

texts:
The method outlined here to create a dirty playground doesn't work in magento 2.1.6: https://magento.stackexchange.com/a/40848/55108

It generates the error:

  Uncaught TypeError: Argument 2 passed to Magento\Framework\App\Http::__construct() must be an instance of Magento\Framework\Event\Manager, none given

The TestApp class in the example extends \Magento\Framework\App\Http. This is the Http classes constructor:

public function __construct(
    \Magento\Framework\ObjectManagerInterface $objectManager,
    Event\Manager $eventManager,
    AreaList $areaList,
    RequestHttp $request,
    ResponseHttp $response,
    ConfigLoaderInterface $configLoader,
    State $state,
    Filesystem $filesystem,
    \Magento\Framework\Registry $registry
) {
    $this->_objectManager = $objectManager;
    $this->_eventManager = $eventManager;
    $this->_areaList = $areaList;
    $this->_request = $request;
    $this->_response = $response;
    $this->_configLoader = $configLoader;
    $this->_state = $state;
    $this->_filesystem = $filesystem;
    $this->registry = $registry;
}

So I guess it is failing because $eventManager doesn't exist within the playgrounds context?

How does the code need to be updated to work with 2.1.6?


texts: Making edits to core controllers OnepageController.php

texts:
I have attempted my first rewrite module since i needed to make some edits to a core controller. For whatever reason it is not working as the edits are not taking effect. Here are my files:

app/code/local/PaypalExtended/Checkout/controllers/OnepageController.php

<?php
# Controllers are not autoloaded so we will have to do it manually:
require_once 'Mage/Checkout/controllers/OnepageController.php';
class PaypalExtended_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
/**
 * Save payment ajax action
 *
 * Sets either redirect or a JSON response
 */
  public function indexAction(){

echo 'Hello World';
}

}

I am actually only editing a small section in this code, I tried to highlight it, I added an if operation. Not sure if there is a way to only edit this portion or if I need to replace the entire function?

app/code/local/PaypalExtended/Checkout/etc/config.xml and its code is

<?xml version="1.0"?>
<config>
<modules>
    <PaypalExtended_Checkout>
        <version>0.1.0</version>
    </PaypalExtended_Checkout>
</modules>
<!--
 If you want to overload an admin controller this tag should be <admin> instead,
or <adminhtml> if youre overloading such stuff (?)
-->
<frontend>
    <routers>
        <checkout>
            <args>
                <modules>
                <PaypalExtended_Checkout before="Mage_Checkout">PaypalExtended_Checkout</PaypalExtended_Checkout>
                </modules>
            </args>
        </checkout>
    </routers>
</frontend>
</config>

app/etc/modules/PaypalExtended_All.xml

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

I have tried numerous edits including moving my controller out of the checkout folder into the controllers folder. I have made edits to my config.xml file to reference different locations and files. I have followed most of the guides/answers on here and none have worked so far.

Can anyone help me get this working? Is there any suggestions to clean my code up, make them shorter? Thanks!

---EDITS MOVED FOLDERS AND CHANGED NAMES/CODE TO MAKE IT SIMPLER TO GET WORKING---

---------------------------------ANSWER--------------------------------------

So the problem ended up being that i had a leading empty line in my config.xml file... After that was removed both methods listed below worked perfectly. BIG thanks to Amit for his assistance!


texts: Proper method to remove products no longer carried (Disabled products or deleted products) SEO

texts:
When products are disabled or deleted from a store, this makes these pages disappear from the website and then Google will begin throwing error 400 messages in WebMaster Tools.

I also checked my site on google and there has been a 98% drop in the pages I carried after setting a large number of products as Disabled.

Are products that are no longer carried better off being set to Out Of Stock or Disabled and/or Deleted and allow Google to reindex?

I was thinking of exporting these disabled / deleted products to a CSV file and then manually put a redirect in my .htaccess file.

What is the best method for SEO purposes to deal with Disabled or Deleted products in a store?

EDIT: Just read in the Google Webmaster forums that a 410 redirect for pages that are no longer exist is the recommended method but there was no real difference between 404 and 410.

I've made a backup of my database, exported the URL keys for these products and created Redirect gone entries with a 410 page that is a blurred out CMS page that looks like my standard product page showing that the product is no longer available.

I'm still interested in the proper way of handling this is though or if my method is an acceptable way to handle this.


texts: Programmatically set and unset event triggering for a custom module

texts:
So here is the scenario that I need to achieve. I have a custom module. In it's controller, I am setting a cookie when some conditions are met. I need to check the status of this cookie if any other url request is made through an observer (event using is controller_action_predispatch). When some conditions are met, I will delete this cookie and then I don't want to trigger the event any more (or till next time when the cookie sets through my controller.).

An example shown below. My custom controller looks like this

File: app\code\local\Namespace\Module\controllers\CustomController.php

public function someAction()
{
      if (<some_condition_met>) {
          Mage::getModel('core/cookie')->set('cookiename', 'value', 7200);
          $this->activateObserver($eventname, $modulename, $methodname); // I need this. Later for all action it should observer the event that is specified inside `activateObserver()`
      }
}

activateObserver() will starts event triggering. Now onwards, for every action, it should observe to my custom obsever method.

Now my observer method looks like this.

File : app\code\local\Namespace\Module\Model\Observer.php

public function myObserverMethod($observer)
{
        if (<some_condition_met>) {
             Mage::getModel('core/cookie')->delete('cookiename');
             $this->deactivateObserver($eventname, $modulename); //this should deactivate event observation. Now onwards I dont need to observe this event
        }
}

Now here deactivateObserver() deactivate event triggering from my module.

Why I need this ?

This is because, I am observing to controller_action_predispatch. I just want to observe this event during the life time of my cookie. This cookies life time is 2 hours maximum. Since the event that I am observing occurs for every action, it would be definitely a burden and I need to avoid this.

Is it possible in Magento ? Share your thoughts.


texts: Magento 2 minicart does not clear items after checkout

texts:
I am facing this annoying issue in Magento 2.0.7 where, after checking out, the items are not cleared from the mine cart.

Those items in the mini cart are loading from the cache storage.

Is there any way we can clear that cache?

I checked the local storage in my browser, and it has data stored in "cart":{} parameter of the JSON string. Which if I manually clear, the mini cart gets empty.


texts: How to Refresh image shown in home page by static CMS with same name and location

texts:
I have a CMS block that shows three images, top.jpg, mid.jpg, and bottom.jpg.

The CMS block contains:

  ..and so forth..

My idea was to keep the same names so someone in charge of the content could  just ftp the files with new content as necessary.. but then I found out about the issue that they are not refreshed by the browsers after the first time they showed the page, because the browsers understand that they already have the files in cache.

What is the best way to manage a need this in Magento?   I am running M2 ver 2.1.    Any help will be appreciated.

Thanks!
AC


texts: added form from ui_component not showing save button magento 2

texts:
i am adding form through ui_component but not save and back button are not showing

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/Ui/etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">sampleform_form.sampleform_form_data_source</item>
            <item name="deps" xsi:type="string">sampleform_form.sampleform_form_data_source</item>
        </item>
        <item name="label" xsi:type="string" translate="true">Sample Form</item>
        <item name="layout" xsi:type="array">
            <item name="type" xsi:type="string">tabs</item>
        </item>
    </argument>

    <dataSource name="sampleform_form_data_source">
        <argument name="dataProvider" xsi:type="configurableObject">
            <argument name="class" xsi:type="string">Magento\SampleForm\Model\DataProvider</argument>
            <argument name="name" xsi:type="string">sampleform_form_data_source</argument>
            <argument name="primaryFieldName" xsi:type="string">entity_id</argument>
            <argument name="requestFieldName" xsi:type="string">id</argument>
        </argument>
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
            </item>
        </argument>
    </dataSource>

    <fieldset name="sample_fieldset">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Sample Fieldset</item>
            </item>
        </argument>

        <!-- This field represents form id and is hidden -->
        <field name="entity_id">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="visible" xsi:type="boolean">false</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">sampleform</item>
                </item>
            </argument>
        </field>

        <!-- This field has data type 'text' and standard 'input' form element and looks like input -->
        <field name="title">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string">Some text</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">sampleform</item>
                </item>
            </argument>
        </field>
     </fieldset>
 </form>


texts: Magento 2 data migration errors how to solve

texts:
We have installed migration tool in the Magento 2.3.1 EE (composer require magento/data-migration-tool:2.3.1
)  would like migrate M1 commerce edition (1.14.3.1) to Magento 2.3.1 EE.

When we execute data:migrate getting below errors could you please suggest and advise how to to resolve these?

php bin/magento migrate:data --reset vendor/magento/data-migration-tool/etc/commerce-to-commerce/1.14.3.1/config.xml

Mismatch of datatypes.Sourcedocument:sales_flat_order.Fields:party_number
Destination fields arenotmapped.Document:quote_address_item.Fields:carriergroup_idcarriergroupcarriergroup_shipping
Sourcefieldsarenotmapped.Document:tax_class.Fields:op_avatax_code
[2019-08-05 10:06:35][ERROR]: Foreign key (FK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_ID_EAV_ATTRIBUTE_ATTRIBUTE_ID) constraint fails on source database. Orphan records id: 0 fromeav_entity_attribute.attribute_idhas no referenced records ineav_attribute`
[2019-08-05 10:06:35][ERROR]: Destination fields are not mapped. Document: catalog_eav_attribute. Fields: is_displayed_in_autocomplete,is_used_in_spellcheck,facet_min_coverage_rate,facet_max_size,facet_sort_order,display_pattern,display_precision,sort_order_asc_missing,sort_order_desc_missing
Incompatibility in data. Source document: eav_attribute. Field: source_model. Error: Class privatesales/attribute_source_customergroup is not mapped in record attribute_id=206
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-Migration_Default' for key 'EAV_ATTRIBUTE_SET_ENTITY_TYPE_ID_ATTRIBUTE_SET_NAME'
[2019-08-06 08:00:47][INFO][mode: data][stage: volume check][step:

Inventory Step]: started
100% [============================] Remaining Time: < 1 sec
[2019-08-06 08:00:47][WARNING]: Mismatch of entities in the document: inventory_source_item Source: 1576 Destination: 5923
[2019-08-06 08:00:47][WARNING]: Volume Check failed


texts:
I am using the following condition and its print one value,
if(self.options.nearestlocationsBlock) {
    var firstStore = _.first(locations.items);

    var newContent = '

'+firstStore.address+','+firstStore.city+','+firstStore.state+','+firstStore.zip+'

';

    self.storeListIdentifier.html(newContent);
}

I want to print the next three values, how to do that?
eg: I am print first value, i want to print next three values in second condition, how to do that?
Workout:
I am trying following script, its return but keep page loading,
  if(self.options.nearestlocationsBlock) {
                    var firstStore = locations.items;

                    firstStore.foreach(function(firstStore){
                        var newContent = '

'+firstStore.address+','+firstStore.city+','+firstStore.state+','+firstStore.zip+'

';
                        self.storeListIdentifier.html(newContent);
                    });


texts: Magento 2 Workflow and Development Tools

texts:
I am curious what other members of the community are using and suggest for M2 development:

"What are some suggested Magento 2.X workflows?"
"What tools/configurations/plugins are being used for Magento 2.X Development?"

This is subjective, but I would still like to solicit community feedback.

Thank you!


texts: Magento 2 and VES theme. Site front and back shows corrupt? PHP version issue?

texts:
I have installed via Quick install a VES Magento 2 free theme. I had to set PHP to version 7.0, 7.1 doesn't work. When I opened first time the site after installation it looked OK but on the second time (no changes are done) it collaps. pls have a look at iamyorda.com. I believe it might have to do with the index file and how it set its page. See below the index.page. Hopefully, you see the error immediately. Thx for the support!

try {
    require DIR . '/app/bootstrap.php';
} catch (\Exception $e) {
    echo <<

        Autoload error

    {$e->getMessage()}

HTML;
    exit(1);
}

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);


texts: Change default homepage template in new Magento theme

texts:
I'm creating a new magento theme. The theme is almost ready, but their is one problem. Currently when the theme is applied to a new installation of magento, the default homepage template is 2-columns layout, whereas I want it to have 1-column layout.
I know it can be changed from admin panel, but want to apply 1-column layout to every new theme install, without changing the admin panel.


texts: Image upload problem in Magento Ver. 1.9.3.7

texts:
After upgrading to Magento Ver. 1.9.3.7  image upload to product does not work. Buttons are there, but when I click browse files, or upload image, nothing happens. No file upload form, and no error in console .
I tried everything, google has offered: cleaning magento cache, reindex data, clear browser cache, try different browser. Nothing helps.
Anyone has an idea, where to start looking for a problem? I guess, Uploader instance is not initialised properly, but console give me no errors.


texts: 1.9 - Extending catalog/product controller breaks catalog/category

texts:
I'm trying to add an action "sample" to the product controller which was going fine. I wanted the url domain.com/catalog/product/sample/sku/{sku}/ so here's what I did:

Added file Org_Catalog.xml in app/etc/modules/

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

Added config.xml in app/code/local/Org/Catalog/etc/

<?xml version="1.0"?>

<config>
<modules>
    <Org_Catalog>
        <version>0.1.0</version>
    </Org_Catalog>
</modules>

<frontend>
    <routers>
        <Catalog>
            <use>standard</use>
            <args>
                <module before="Mage_Catalog">Org_Catalog</module>
                <frontName>catalog</frontName>
            </args>
        </Catalog>
    </routers>
</frontend>
</config>

Added ProductController.php in app/code/local/Org/Catalog/controllers/

<?php
require_once 'Mage/Catalog/controllers/ProductController.php';

 class Org_Catalog_ProductController extends Mage_Catalog_ProductController{

    public function sampleAction(){
        Mage::Log("reached sample action");
    }
}

Everything here was working fine but then I noticed the category page has stopped working. All category pages now go to 404 pages. The url translates to domain.com/catalog/category/view/id/4 for one of the category. I didn't touch any of the CategoryController.php files or anything else. I can't tell why it's not working.

Edit: Just for a try, I added CategoryController.php in app/code/local/Org/Catalog/controllers and filled it with

<?php

require_once(Mage::getModuleDir('controllers','Mage_Catalog').DS.'CategoryController.php');

class Org_Catalog_CategoryController extends Mage_Catalog_CategoryController{

}

This made the category page load. It seems that what I did has completely disabled the original catalog module, not extended it. Magento is not looking for the files in the core even though it didn't find it in the local folder. I just wanted to add an action so is there another way of doing it?


texts: how to upgrade schema to create new table in existing module in magento 1.9?

texts:
I need to create a table having  id,customer_id,in_time,out_time,in_coordinates,out_coordinates where customer_id will be primary key.
please tell what are the steps after creating sql file in sql folder.?

my file name is :
mysql4-data-upgrade-0.1.15-0.1.16.php

$installer = $this;

$installer->startSetup();

$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('sm_tracker')};
CREATE TABLE {$this->getTable('sm_tracker')} (
  `id` int(11) NOT NULL COMMENT 'Inc Id',
  `customer_id` varchar(30) NOT NULL COMMENT 'Customer Id',
  `punch_in_time` varchar(30) NOT NULL COMMENT 'Punch-In Time ',
  `punch_out_time` varchar(30) NOT NULL COMMENT 'Punch-Out Time',
  `in_coordinates` varchar(30) NOT NULL COMMENT 'Punch-In Coordinates',
  `out_coordinates` varchar(30) NOT NULL COMMENT 'Punch-Out Coordinates',

  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;");

$installer->endSetup();

?>

config.xml --> version

 <modules>
    <Test_Manager>
      <version>0.1.16</version>
    </Test_Manager>
  </modules>

and defined : in config

.....
     <smtracker>

sm_tracker

                  </smtracker>
            </entities>


texts: Magento2: Conditionally replace block template and class the right way

texts:
This rather trivial requirement turns out be quite a pain for us in recent days, as we couldn't find a satisfying existing solution, yet.

The Task

We are trying to replace certain blocks with a custom template accompanied with a custom block class. Our extension has a system configuration with a couple of boolean inputs (Yes/No), if certain predefined custom blocks should be used. Each custom block replaces one or more default blocks.

If the Merchant selects "No", nothing should happen to these default blocks.

Example

The search box in the container header-wrapper in the Luma theme has a block named top.search. We wand to replace this block with the my-search.phtml template and the MySearch block class, which inherits from the default search block class. In this case \Magento\Framework\View\Element\Template.

Current solutions

A) Using deprecated <action>-Tag with ifconfig-Attribute

My most favorable way was using layout xml files with basic layout definitions to fix our problem. We altered the layout as follows:

<referenceBlock name="top.search" class="Test\MyApp\Block\MySearch">
    <action ifconfig="myapp/components/searchbox" method="setTemplate">
        <argument name="template" xsi:type="string">Test_MyApp::my-search.phtml</argument>
    </action>
</referenceBlock>

  Disadvantage: Magento2 documentation discourages from using <action>-Tag. If the search box feature is not used, it still overwrites the default block class.

B) Event-based block exchange using ObserverInterface

  Disadvantage: It seems a bit hacky to me to use the event system in Magento2 to replace blocks on a certain condition. I get the feeling that this might also impact the performance, if a lot of blocks need to be replaced.

C) Insert a new and invisible block on every page that replaces default blocks on demand

// pseudocode
$layout = $this->getLayout();
$block = $layout->getBlock('top.search');
if ($block) {
  // todo only unset on condition
  $layout->unsetElement('top.search');

  $newBlock = $layout->createBlock('Test\MyApp\Block\MySearch', 'top.search', []);
  $layout->setBlock('top.search', $newBlock);
}

  Disadvantage: Possible (unverified) performance and caching issues in the future. Similar to solution B.

The last solution (C) resembles our current pick. However, we are looking for a satisfying solution that works without using any PHP and is written in the Magento2 layout definition (XML). Any ideas?


texts: New Product Alert / Send Email Notification

texts: I would like to send an email notification to the admin whenever a new product is created.


texts: Magento 2 - Using UI Component as input for widget

texts:
So far, in all the documentation and tutorials for UI Components that I've come across (Like the documentation here:
 https://devdocs.magento.com/guides/v2.3/ui_comp_guide/bk-ui_comps.html, or in this sample module:  https://github.com/magento/magento2-samples/tree/master/sample-module-form-uicomponent), you can only create UI Components as a separate page/route in the backend.

I want to create a UI Component that functions as a parameter in a widget.  Is there a way to do this?  Specifically, I want to do something along these lines:

In widget.xml:

<widget class="MyWidgetClass">
    <label>My Widget</label>
        <parameters>
            <parameter name="product" xsi:type="SOME_UI_COMPONENT">
        </parameters>
    </label>
</widget>

Is there a way to make something like this happen?  If I do create a UI component as a parameter, how do I get the parameter values to save in the widget?


texts: Best Practices: Where should I put an API connection class?

texts:
Although the question appears subjective, I suspect there is a right way and wrong way to do this. I will explain.

The practice at my company has been to haphazardly mingle cURL calls to external APIs into a Magento Module's model folder.

A better way of handling this is to abstract API connection to an external class. It is the external classes job to "know" how to connect to the actual service, when to use a different URL for testing and so on.

My question is where in a Magento module should such a class live? It's clearly not part of the data model, nor is it a Block or Controller.

Should I create an "Api" folder and put whatever classes I need in there, named "Company_Module_Api_Zendesk"?
If yes, and I do that, will the autoloader be able to handle it? Can I instantiate such a class by using "new Company_Module_Api_Zendesk()" or do I have to require() it myself?

If this question must be closed due to excessive subjectivity, could someone point me towards a relevant guide or tutorial?


texts: Can I get more specifics on changing the Continue Shopping URL in Magento?

texts:
I have seen the following answer to my specific question, but as a NEWBIE, I need a little more information

Someone said
...
create your own helper that has a method getContinueUrl that returns the desired url and modify the markup above to

<action method="setContinueShoppingUrl"><url helper="helper_alias/getContinueUrl" /></action>

Or you can create an observer that set's the url on the block:

Mage::app()->getLayout()->getBlock('checkout.cart')->setContinueShoppingUrl('URL HERE');

The second option is to create an observer that sets the url in session. This can be used if you want a dynamic continue url. Add this in your observer.

Mage::getSingleton('checkout/session')->setContinueShoppingUrl('URL HERE')

...

Most of that doesn't make enough sense to me so I need a little more direction please.  I tried changing my checkout/cart.phtml file to show the hard url but nothing is changing.  Can someone please tell me exactly which file path to use to find exactly the right file and what bits I need to change and what I need to change them to?

Many thanks


texts: Proxy object - when should I use them in fact

texts:
I have yesterday read great tutorial about Proxy objects:
http://alanstorm.com/magento_2_object_manager_proxy_objects/

I understand that I should use them to lazy load object which have can be slowly loaded, so for example:

they have a lot of dependencies by themselves
they make a complex db query
they have a lot of code lines?
for objects, which won't be used in every class class (for example if class

Are there any practical advices when they really should be used or where they shouldn't. Do anyone has any good practices. For me it seems it is good to declare most of classes as lazy loaded, juz in case, but I bet it is not a good idea.


texts: Magento 2 Add 'Remove out of stock' filter in category page and search results page

texts:
I have to add 'Remove out of stock' filter on the category page and search results page.

By default i m displaying all products which is in stock or out of stock.

Any suggestions please? i m not getting proper solution and m new with magento 2.


texts: Product being categorized a certain way causes SQL to print on product page

texts:
An odd issue I keep running into:

Sometimes when adding a new category to a product, some SQL query prints on the top of the product page. An example:

SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`,
`stock_status_index`.`stock_status` AS `is_salable` FROM
`catalog_product_entity` AS `e` INNER JOIN
`catalog_category_product_index` AS `cat_index` ON
cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND
cat_index.visibility IN(3, 2, 4) AND cat_index.category_id='2' INNER
JOIN `cataloginventory_stock_status` AS `stock_status_index` ON
e.entity_id = stock_status_index.product_id AND
stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1
WHERE (stock_status_index.stock_status = 1) AND (`e`.`entity_id`
IN('200', '201', '205', '206', '207', '213', '214', '215', '216',
'219')) ORDER BY FIELD(e.entity_id, ) LIMIT 3

This goes away if I take the product out of the category. Any ideas on what could be causing this?


texts:
I'm using magento 2.3.1 with porto theme.

I would like to change the number of pages which are display in category page. I need all the pages be visible and no the near 4 of current page

Is anybody knows how can change this?


texts:
This is the content of layer/cms.xml file:

<layout version="0.1.0">
    <default>
        <reference name="footer">
            <block type="cms/block" name="cms_footer_links" before="footer_links">
                <action method="setBlockId"><block_id>footer_links</block_id></action>
            </block>
        </reference>
    </default>

    <cms_page translate="label">
        CMS Pages (All)
        <reference name="content">
            <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
            <block type="page/html_wrapper" name="cms.wrapper" translate="label">
                CMS Content Wrapper
                <action method="setElementClass"><value>std</value></action>
                <block type="cms/page" name="cms_page"/>
            </block>
        </reference>
        <reference name="left">
            <block type="menubuilder/menu" name="cms_menu" before="-">
                <action method="setMenuCode">
                    <menu_code>cms_menu</menu_code>
                </action>
            </block>
        </reference>
    </cms_page>

    <cms_index_index translate="label">
        CMS Home Page
    </cms_index_index>

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

        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="core/template" name="default_home_page" template="cms/default/home.phtml"/>
        </reference>
    </cms_index_defaultindex>

    <cms_index_noroute translate="label">
        CMS No-Route Page
    </cms_index_noroute>

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

        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="core/template" name="default_no_route" template="cms/default/no-route.phtml"/>
        </reference>
    </cms_index_defaultnoroute>

</layout>

This is the content of my cms page design:

<reference name="content">
<block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml">
   <action method="setCategoryId"><category_id>3</category_id></action>
</block>
 </reference>

I am trying to display the navigation layer using the category id, 3, but nothing happens. Can someone give me some idea what should I try ? thx


texts: API SOAP V2 CatalogProductList Complex Filter with OR

texts:
I need to set up a filter with a OR clausule and I don't know how to. Any Help?.

I need to set up the filter manufacturer to filters manufacturer number 34 and 37.

Dim pws As New MagentoService.MagentoService
Dim sesionID = pws.login("xxxxxxx", "xxxxxxxxxxx")
Dim result

Dim filters As New MagentoService.filters
Dim complexFilter(2) As MagentoService.complexFilter
complexFilter(0) = New MagentoService.complexFilter
complexFilter(0).key = "manufacturer"
Dim assEnt As New MagentoService.associativeEntity
With assEnt
    .key = "in"
    .value = ¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿"34" OR "37"?????????????????
End With
complexFilter(0).value = assEnt

complexFilter(1) = New MagentoService.complexFilter
complexFilter(1).key = "set"
Dim assEnt2 As New MagentoService.associativeEntity
With assEnt2
    .key = "eq"
    .value = "9"
End With
complexFilter(1).value = assEnt2

filters.complex_filter = complexFilter
result = pws.catalogProductList(sesionID, filters, "0")

I think I must use the key in and use an array on value, but I can't.

Thanks


texts: Magento 2 save product custom attribute in order to retrive them on sales information and otder email

texts:
I have created a custom attribute that shows in product detail page like colour and size attribute, I want them to be saved on order placement so that i can retrieve them in order information, order email.

I am not sure how to achieve this, Right now I am displaying the  custom attribute of product in order but the value changes when i change the value in product backend, I must show the value which is saved during order placement.


texts: move existing magento 2.3 website to RKE

texts:
I am new to Magento, currently, I make a Magento website using 2.3.1 and one droplets. and everything works very well. i wanna try to move it to a K8s. how can i choose a Magento docker image to start work with it? hope someone gives me a good way to set it up.

plan to use Rancher 2 with ubuntu 18.04 as host OS


texts: Magento Observer for Admin Sales order Address update

texts:
Does Magento have any observer or event that trigger when the Order Address is updated by the admin? Is there any Observer or alternate way to find out when the order address is changed..

i tried using the observer
controller_action_predispatch_adminhtml_sales_order_addressSave but i cannot get any order related information and sales_order_address_save_after is being triggered when the order is placed too ..


texts: magento how to change the default store in multi store setup

texts:
I have a multi store setup and i want to change the default shop domain to one of the other stores
ie the default domain is abc.com and i have bcd.com as a store and efg.com as a store.

I want to drop abc.com and make efg.com the default store leaving only efg.com and bcd.com as the stores.


texts: Execute custom Javascript code in Frontend/Admin on sales_order_place_after event

texts:
I need to execute some custom JavaScript right after the sales_order_place_after event is fired for collecting analytic data.

I know how to make an observer and do something in the relevant method. But how do I load and execute a custom JavaScript on the frontend/admin depending on how the order was placed?

Right now, I have created the module, added the config.xml, and have created an observer with following code.

<?php
class Namespace_module_Model_observer
{
    public function doSomeThing($observer)
    {
        $order = $observer->getEvent()->getOrder();

        //do something here to load the custom javascript and execute it
        //whether the order was placed from backend or frontend
    }
}

The observer method is getting executed when the order is placed. What should be the correct approach to achieve my custom functionality?

Note: I have to keep in mind that my observer code doesn't interfere with the checkout steps as the customer might/might not be redirected to payment gateway for further processing depending on the payment method chosen.


texts: Attribute bands name displaying double time?

texts: I have created attribute BANDS. Apothic bands option is not there in my attribute list but still its showing double time.


texts: Google TAG MANAGER extension impossible located

texts:
I have installed via composer extension Google Tag Manager from Yireo:
https://www.yireo.com/software/magento-extensions/googletagmanager2
After install I have enable module (on below  screenshot can see that it is enable):

despite this, he is nowhere in my backend. Where can I find ?


texts: How to add date filed in admin & show on front in magento2

texts:
I get below error when we check custom grid collection in admin.
How to solve this

  Recoverable Error: Argument 6 passed to Namespace\Module\Model\ResourceModel\Notification\Collection::__construct() must be an instance of Magento\Framework\Stdlib\DateTime\DateTime, null given, called in /var/www/html/magento24/app/code/Namespace/Module/Model/ResourceModel/Notification/Grid/Collection.php on line 54 and defined in /var/www/html/magento24/app/code/Namespace/Module/Model/ResourceModel/Notification/Collection.php on line 62


texts: How Create New Rest Api In My Module Magento 1.9.2

texts:
I have a new module CRUD Banner Android

and New Database

How create new Rest API in new My Module Magento ?


texts: Magento 2 : Trying to Override ListProduct.php Block File for Custom Product Collection

texts: I am trying to override ListProduct.php Block File Using Preference method But InitialiseProductCollection() being a protected function does not give me result. I need to know how can I override a protected function of ListProduct.php


texts: Magento2 PayPal Payflow Pro not redirected to success page

texts:
In my magento2 website the PayPal Payflow Pro not redirected to success page like after clicking on place order button the order successfully placed in admin and payment also processed but in checkout the loader keep loading and not redirected to checkout success page.

its only happen sometime not always and I have also checked this magento2 bug link
https://github.com/magento/magento2/issues/7159

and above link's solution loader issue code already updated on my website.
and I have checked the log data also and not any error related to payment gateway and payment log also showing Ok.


texts:
I have custom table register_otp, in that column name is_verify
Table like this

        id   random_code   customer_id  is_verify

         1     Abs            15          0
         2     cfd            18          1

How to get value of is_verify based on customer id


texts: Set blogue page as the default page in Magento

texts:
I am using Magento WordPress Integration (Fishpig).

I am trying to set the Default page of Magento as the main blog page.

Right now I have to force a redirect.

So how can I have the main page of Magento as the blog without a redirect?


texts: Php max_input_vars prevents attribute options saving in M2

texts:
Magento 2.2.1. PHP 7.0.26 Nginx

After 2 days struggling around with attribute options in M2, I found out where the problem was.

I have several custom dropdown attributes with hundreds of options. I created them via REST API and everything was fine, all options created and all values correct. The problem arose as soon as I tried to update/save these attribute again, changing any value, like for example, the "Is filterable".

What happened was that Magento says that the attribute is saved, but in fact, in the above mentioned case, the "use in layered navigation" was simply set to "no".

Nothing in log files, nothing anywhere.

I found out is a PHP memory problem and that I should have increased the

max_input_vars

value in php.ini, from 1000 to something else.
I arrived, to try, to 10000000 but I managed to save only 720 options, whereas I need to save at least 1300 options and this is not said to be the limit over time.

Do you have any clue about how to properly set this value?
Or what other values?

I also increased

max_execution_time = 3600
max_input_time = 600
post_max_size = 512M


texts: How to replace \Magento\Catalog\Block\Product\Context since it's deprecated?

texts:
In a custom module we extend \Magento\Catalog\Block\Product\ListProduct, so we need \Magento\Catalog\Block\Product\Context in our constructor.

But as I can see, it has now been marked as deprecated in MAGETWO-71174.

namespace Magento\Catalog\Block\Product;

/**
 * Constructor modification point for Magento\Catalog\Block\Product\AbstractProduct.
 *
 * All context classes were introduced to allow for backwards compatible constructor modifications
 * of classes that were supposed to be extended by extension developers.
 *
 * Do not call methods of this class directly.
 *
 * As Magento moves from inheritance-based APIs all such classes will be deprecated together with
 * the classes they were introduced for.
 *
 * @deprecated 101.1.0
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */

Here is our constructor:

public function __construct(
    \Magento\Catalog\Block\Product\Context $context,
    \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
    \Magento\Catalog\Model\Layer\Resolver $layerResolver,
    CategoryRepositoryInterface $categoryRepository,
    \Magento\Framework\Url\Helper\Data $urlHelper,
    array $data = [],

    PriceCurrencyInterface $priceCurrency,
    ProductRepositoryInterface $productRepository
) {
    parent::__construct(
        $context,
        $postDataHelper,
        $layerResolver,
        $categoryRepository,
        $urlHelper,
        $data
    );

    $this->priceCurrency = $priceCurrency;
    $this->productRepository = $productRepository;
}

How do we replace it and with what?


texts: I want to add qty filter same as price filter in layered Navigation in Magento 2

texts:
In this i want to develop functionality in which qty filter is added and in that range is displayed in layered navigation as price filter.

qty range as below:

1 - 50,
50 - 100,
100 - 150, ...
so can anyone have idea then please share with me.


texts: After Add custom option in store level shows html in magento 2

texts: In Store level custom option display as a attach my screenshot. Why.? In All Storeview Custom Option Working Fine. But In Multistore When I choose perticular store custom option display as screen shot.


texts:
I need to show step by step guide.

I have checked for this and found introjs

https://github.com/usablica/intro.js/

How to use this for demo purpose?


texts: why the tables not deleted when we uninstall the module?

texts:
why developer does not use UninstallInterface for every modules they develop so module can uninstall completely. is there any problem to delete tables from database after uninstall modules?

app/code/Vendor/Module/Setup/Uninstall.php

<?php

namespace Vendor\Module\Setup;

use Magento\Framework\Setup\UninstallInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;

class Uninstall implements UninstallInterface
{
    /**
     * Module uninstall code
     *
     * @param SchemaSetupInterface $setup
     * @param ModuleContextInterface $context
     * @return void
     */
    public function uninstall(
        SchemaSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $setup->startSetup();
        $connection = $setup->getConnection();
        $connection->dropTable($connection->getTableName('your_table_name_here'));
        $setup->endSetup();
    }
}


texts:
I want to Stop sending contact form emails to consumer in magento2.2.5?

Any help would be appreciated.


texts: Can't access the Shipping Methods page in the admin panel

texts:
I am trying to access the (Shipping Methods) page in the admin panel of my Magento website.

Every time I click to access the shipping methods I get a blank page!
Because of this issue, I can't set the flat rate, FedEx, DHL or other options listed there.

Shipping Methods can be found in the admin panel at System > Configuration > Sales.


texts: How can I move custom menu inside mobile menu in magento2?


texts:
I want to echo Meta description which will also pull the name of the product.

So far I have:

<?php echo '<meta name="xxx" />' ?>

I want the "xxx" to be  the product name but unsure of how to do this.

I have tried this:

<?php echo '<meta name="description" content="'.$_helper->productAttribute($_product, $_product->getName(), 'name').'" />' ?>

this is clearly wrong :(


texts: I have information I imported from eBay but the descriptions are HTML and can't be imported through CSV data flows. I'm wondering if there's a way to do it through Magento ORM.


texts: Impact of Google Chrome blocking Flash at the end of the year

texts:
As some of you may know Google Chrome will start blocking Flash in December

I know that the backend uploaded of M1 is using Flash.

What is the impact of no flash for Magento ? What other features are using flash and can't work without it ?

I'd like to get answers for both M1 and M2

Update: according to one of the Magento developer, a 1.x update that drops flash support is coming soon


texts:
I'm getting below JS Error on Product Detail Page which is from

paypalobjects.com/api/checkout.js

Anybody faced this kind of JS error on Local WAMP (Windows 10)?

It's related to Paypal.


texts: Retrieving Selected store id from backend

texts:
On a magento site I've been working on a seperate store was set up for certain users (limited access etc). One function allows the user to create an order for a customer. Before they do this they must select which store they are using. This determines the list of products that are returned in the manually create order section.

From here one option that is available is to give a discount. I basically want to create a condition that if store-id != x display this. The trouble I'm having is getting the selected store id. In the backend the store-id is always 0 so I can't pull that. I need a way to find what option was selected.

I assume it's in the session somewhere but I haven't been able to find it.


texts: Magento2 change Category-Product position to string

texts:
I would like to change the category-product position to be a string.
Because I have an exploded view for spare parts and they are numbered with strings (1a, 1c, 605,...). The customer should see the position to select the right parts based von the image.

I will update this only with the API:
https://devdocs.magento.com/redoc/2.3/admin-rest-api.html#operation/catalogCategoryLinkRepositoryV1SavePut

In Magento 1.x I changed the database field to string and something in the magento core Code Category Model from (int) to (string).

But I know, that this is not the correct way to do this.
Creating an extra plugin to extend the database and modify the API seems a bit "too much" in this case.
Where can I start?


texts: Hide carrier title on checkout page. Magento 2

texts:
I need to hide carrier title on checkout page only when price is 0.00.

Or even the js file from where this carrier title is displayed will be really helpful


texts: How to get list of overridden controllers?

texts:
Is it possible to get list of all overridden controllers ?

How do I get a list of all class rewrites? mainly applies for blocks, helpers and models.


texts:
I'm trying to layout my product page. My XML is below. However, They are not showing up in that order. Is there a way to force that?

<move element="page.main.title" destination="product.info.main" before="-"/>
<move element="product.price.final" destination="product.info.main" after="-" />
<move element="product.info.simple" destination="product.info.main" after="-" />
<move element="product.info.social" destination="product.info.main" after="-" />
<move element="product.price.tier" destination="product.info.main" after="-" />
<move element="product.info.sku" destination="product.info.main" after="-" />
<move element="product.info.review" destination="product.info.main" after="-" />
<move element="product.info.overview" destination="product.info.main" after="-" />
<move element="product.info.addtocart" destination="product.info.main" after="-" />


texts: Call custom section on page load customer/section/load/?sections=customsection

texts:
I would like to call
customer/section/load/?sections=customsection on page load. Similar how the cart is being called on page load.

I've already added section data in the frontend/di.xml

 <type name="Magento\Customer\CustomerData\SectionPoolInterface">
    <arguments>
        <argument name="sectionSourceMap" xsi:type="array">
            <item name="customsection" xsi:type="string">{Class}</item>
        </argument>
    </arguments>
</type>

However, the "customsection" is not being called unlike with "cart" and "quotecart"


texts: Install page running in live environment

texts:
A couple of weeks ago we moved a Magento (1.9) to another server. Everything works well untill suddenly we experienced the shop throwing the install page back. Going to the homepage would temporarily redirect to the /install instance which was actually a bit shocking. In an attempt to solve this we emptied the caches immediately and after a few minutes the normal page came back (with some switch the first 5 minutes between the homepage and the install page).

To be honest I really don't know if this actually solved the problem or if it even has some relation between eachother. As said, I haven't experienced anything like this before and I'm very curious on how to prevent this in the future.


texts: Display downloadable product URL for order success page for Guests

texts:
Ok so i have got the page working fine for displaying the download links for the downloadable products when the customer is registered and signed in, however when checking out as a guest they are not seeing the links (emails work fine however)

This is my downloadable/block/checkout/list.php

public function __construct()
{
parent::__construct();
$items = $this->getItems();
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
if (!$orderId) {
    return;
}
$orderItems = Mage::getModel('sales/order_item')
          ->getCollection()
          ->setOrderFilter($orderId)
          ->getAllIds();
$itemsToRemove = array();
foreach ($items as $key => $item) {
    if (!in_array($item->getOrderItemId(), $orderItems)) {
    $itemsToRemove[] = $key;
    }
}
foreach ($itemsToRemove as $key) {
    $items->removeItemByKey($key);
}

}

/**
 * Return url to download link
 *
 * @param Mage_Downloadable_Model_Link_Purchased_Item $item
 * @return string
 */
public function getDownloadUrl($item)
{
return $this->getUrl('downloadable/download/link', array('id' => $item->getLinkHash(), '_secure' => true));
}

}

If anyone can give any pointers or want to see any other code please let me know


texts: Please clarify cross-sells and up-sells with more Magento friendly definition and examples. What is functionality in real life of this taxonomy? How should we use these features correctly to increase sales? Give me more rules to relate/link products with each-other as cross or up-sells. Thanks much.


texts:
Is it possible to display on the product page in  block "Related Products" products descriptions?

The name of the related products displayed:

<?php echo $this->escapeHtml($_item->getName()); ?>

Description related products I tried to take:

<?php echo $_item->getDescription(); ?>

didn't work


texts: Add a new column of "Customer Group" in a Customer grid during order creation

texts:
I want to add a Customer Group in a Customer grid during order creation For Magento2. I  made

[vendor]\[module]\view\adminhtml\layout\sales_order_create_customer_block.xml

like this:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="adminhtml.customer.grid.container">
            <arguments>
                <argument name="dataSource" xsi:type="object">\[vendor]\[module]\Model\ResourceModel\Order\Customer\Collection</argument>
            </arguments>
        </referenceBlock>
        <referenceBlock name="adminhtml.customer.grid.columnSet">
            <block class="Magento\Backend\Block\Widget\Grid\Column" as="group" after="name">
                <arguments>
                    <argument name="header" xsi:type="string" translate="true">Group</argument>
                    <argument name="index" xsi:type="string">customer_group</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

This creates new empty column after column "Name". But I don't know how I can get value of "Customer Group" in this file:

\[vendor]\[module]\Model\ResourceModel\Order\Customer\Collection.php


texts: How to show Prices for OUT of stock products in Magento 2

texts:
Here is my question - How to show prices for all out of stock products?
Here pic http://prntscr.com/krhurk

I created the module from here https://magento.stackexchange.com/questions/160145/magento-2-how-to-show-prices-for-out-of-stock-products
enabled but still, nothing :/ any suggest? Version Magento 2.2.5

    You need to create your custom module using below code

Let say module name Custom_Outofstock

So create folder in app/code

Create registration.php file at app/code/Custom/Outofstock/registration.php

Add blow code to it

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Custom_Outofstock',
    __DIR__
);

Create module.xml at app/code/Custom/Outofstock/etc/module.xml

Add below code to it

<?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="Custom_Outofstock" setup_version="2.0.0">
    </module>
</config>

Now create file suggested in this answer given By Sohel Rana as below

Crate di.xml at app/code/Custom/Outofstock/etc/di.xml

add below code to it

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Pricing\Render\FinalPriceBox" type="Custom\Outofstock\Pricing\Render\FinalPriceBox" />
</config>

Create Price render file FinalPriceBox.php at app/code/Custom/Outofstock/Pricing/Render/FinalPriceBox.php

Add below code to it

<?php
namespace Custom\Outofstock\Pricing\Render;

use Magento\Msrp\Pricing\Price\MsrpPrice;
use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox;

class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
{
    protected function _toHtml()
    {
        $result = parent::_toHtml();

        if(!$result) {
            $result = BasePriceBox::_toHtml();
            try {
                /** @var MsrpPrice $msrpPriceType */
                $msrpPriceType = $this->getSaleableItem()->getPriceInfo()->getPrice('msrp_price');
            } catch (\InvalidArgumentException $e) {
                $this->_logger->critical($e);
                return $this->wrapResult($result);
            }

            //Renders MSRP in case it is enabled
            $product = $this->getSaleableItem();
            if ($msrpPriceType->canApplyMsrp($product) && $msrpPriceType->isMinimalPriceLessMsrp($product)) {
                /** @var BasePriceBox $msrpBlock */
                $msrpBlock = $this->rendererPool->createPriceRender(
                    MsrpPrice::PRICE_CODE,
                    $this->getSaleableItem(),
                    [
                        'real_price_html' => $result,
                        'zone' => $this->getZone(),
                    ]
                );
                $result = $msrpBlock->toHtml();
            }

            return $this->wrapResult($result);
        }

        return $result;
    }
}


texts: How to correct insert this in phtml file?

texts:
Help me please format this block to insert in a phtml file?

{{block type="filterproducts/latest_home_list" name="featured_list" product_count="12" template="filterproducts/list.phtml"}}


texts: Not getting Country name by geo location

texts:
I am trying to get country name by Geo-location. so i used Geo plugin but not working good. its show all good by browser url. but when i am trying to set response by php its not return anything.

I don't know what is issue with my code.

Geoip Url : http://www.geoplugin.net/php.gp?ip=xx.xx.xx.xx

  require_once('geoplugin.class.php');

 $geoplugin = new geoPlugin();
    $geoplugin->locate();
    if($geoplugin->countryCode){
        $_SESSION['cCode'] = $geoplugin->countryCode;
    }else{
        $_SESSION['cCode'] = "US";
    }


texts: Magento 2 Rest api to create order not adding shipping address

texts:
I am trying to create an order using magento 2 rest api.But the
  shipping address is not adding with order details.Because of no
  shipping address the order is in incomplete format

  http://127.0.0.1/netmeds_mage/rest/V1/orders/create

Method : PUT

  This is the json request :

    {"entity":{"base_currency_code":"INR","base_discount_amount":0,"base_grand_total":38,"base_shipping_amount":5,"base_shipping_incl_tax":5,"base_shipping_tax_amount":0,"base_shipping_discount_amount":0,"base_subtotal":33,"base_subtotal_incl_tax":33,"base_total_due":38,"base_to_global_rate":1,"base_to_order_rate":1,"discount_tax_compensation_amount":0,"base_discount_tax_compensation_amount":0,"shipping_discount_tax_compensation_amount":0,"customer_is_guest":0,"customer_dob":"Jan
    18,
    1987","customer_email":"sharvesh@gmail.com","customer_firstname":"Sharvesh","customer_gender":1,"customer_group_id":1,"customer_id":4,"customer_lastname":"CP","customer_note_notify":1,"discount_amount":0,"email_sent":1,"global_currency_code":"INR","grand_total":38,"order_currency_code":"INR","remote_ip":"127.0.0.1","shipping_amount":5,"shipping_tax_amount":0,"shipping_description":"Flat
    Rate -
    Fixed","shipping_discount_amount":0,"shipping_incl_tax":5,"state":"pending","status":"pending","store_currency_code":"INR","store_to_base_rate":0,"store_to_order_rate":0,"store_id":1,"subtotal":33,"subtotal_incl_tax":33,"total_due":38,"total_item_count":1,"total_qty_ordered":1,"tax_amount":0,"weight":1,"items":[{"base_original_price":33,"base_price":33,"base_price_incl_tax":33,"base_row_total":33,"base_row_total_incl_tax":33,"name":"Endeavor
    Daytrip
    Backpack","original_price":33,"price":33,"price_incl_tax":33,"product_id":11,"product_type":"simple","qty_ordered":1,"row_total":33,"row_total_incl_tax":33,"sku":"24-WB06","store_id":1,"weight":1}],"billing_address":{"address_type":"billing","city":"Chennai","company":"Netmeds","country_id":"IN","customer_address_id":4,"email":"sharvesh@gmail.com","firstname":"Sharvesh","lastname":"C","postcode":"600117","region":"Tamilnadu","street":["6A,4th
    street,Keelkattalai"],"telephone":"9840626148"},"payment":{"amount_ordered":38,"base_amount_ordered":38,"base_shipping_amount":5,"method":"checkmo","shipping_amount":5},"status_histories":[],"extension_attributes":{"shipping_assignments":[{"shipping":{"address":{"address_type":"shipping","city":"Chennai","company":"Netmeds","country_id":"IN","customer_address_id":4,"email":"sharvesh@gmail.com","firstname":"Sharvesh","lastname":"C","postcode":"600117","region":"Tamilnadu","street":["6A,4th
    street,Keelkattalai"],"telephone":"9840626148"},"method":"flatrate_flatrate","total":{"base_shipping_amount":5,"base_shipping_incl_tax":5,"shipping_amount":5,"shipping_incl_tax":5},"extension_attributes":[]},"items":[{"base_original_price":33,"base_price":33,"base_price_incl_tax":33,"base_row_total":33,"name":"Endeavor
    Daytrip
    Backpack","original_price":33,"price":33,"price_incl_tax":33,"product_id":11,"product_type":"simple","qty_ordered":1,"row_total":33,"row_total_incl_tax":33,"sku":"24-WB06","store_id":1,"weight":1}],"extension_attributes":[]}],"applied_taxes":[],"item_applied_taxes":[],"converting_from_quote":true}}}

whether am missing anything or i need to add anything.


texts: How can i remove index.php from magento url?

texts:
I have tried everything I found in the different post related to this.

I already review:

• The magento setting is correct.
• That the rewrite module is enabled.
• The rules and conditions in it .htaccess.

But magento keeps sending me the 404 error every time I try to navigate, only the home page works.

This is the Magento Config

Go to System > Configuration > Web > Search Engine Optimization

Use Web Server Rewrites: YES
And the Unsecure and Secure too.

This is the configuration on my .htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Is there anything else I should do?


texts: Some of my custom cms pages chaging there url key automatically

texts:
I have number of cms pages but three of which (about-us, contact-us, gallary) changing there url key automatically after some time to (about-us.html, contact-us.html, gallary.html).

I dont know why this happening.

I change that url key many times from admin panel but I think its not permanent solution.

Can anyone tell me permanent solution.

Is anyone having same problem.

Please help me.


texts: Products with Multiple Categories throwing error in Cart

texts:
My client is having an issue where they have products assigned to multiple categories, and the Shopping Cart page throws an error when you add one of these products to the cart.

I'm aware that these category assingments are probably not optimal, however, I was under the impression it shouldn't be causing a problem like this.

the error we get back is from this file

/lib/Varien/Db/Statement/Pdo/Mysql.php :

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s), query was: SELECT `catalog_category_flat_store_1`.* FROM `catalog_category_flat_store_1` WHERE (`catalog_category_flat_store_1`.`entity_id`='4', '11', '19', '26')

which shows me that the WHERE clause us designed to accept only one ID value, but it is being given a list of IDs

My impression is that having multiple categories is not normally an issue. Does anyone here recognize this issue and where I might go to rectify it?

note: we are using a Shipping Rules plugin from Amasty, I can't say for sure this isn't the problem


texts: I want to display only TAX value beside the price in product detail page magento2

texts: I want to display only TAX which i apply for all product..i want to display tax without including price in product detail page magento2


texts: how to adjust Magento 1.9.0.1 to accept an unsusual emaildomain for a customer's email?

texts:
I want to add a new customer to our Magento 1.9.0.1 store, but am rejected to save it due to the email domain of that customer's email address info@[domain].zone. I couldn't reproduce the problem in a 1.9.1.0 teststore we are having, so it may be a sepcific 1.9.0.1 issue

I can't post the exact error message but it seems Magento doesn't know about the .zone domain and I was wondering where I can add it to something like "acceptable mail domains" in the magento backend?

disclaimer: I'm fairly new to Magento and likewise may miss some of the basics  yet. Sorry if I may use incorrect terms (which is also due to little experience)


texts:
can seems to move wishlist from top.link; i was able to move or remove all the link including compare link after hours of searching online, this code only work for the rigister link and account link is not working for the wishlist, if anyone know how to remove kindly share: below is the code i have tried

    <referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->
</referenceBlock>


texts: Mailchimp 2 for Magento 2 not sync users - permissions?

texts:
I have upgraded my mailchimp extension from ebizmarts to mailchimp 2 for magento 2. And quess what? It stopped working.
1. The plugin is installed.
2. The api key returns follwing mailchimp list

Account Details
Username: username
Total Subscribers: 10
Ecommerce Data uploaded to MailChimp
Total Customers: 0
Total Products: 0
Total Orders: 0
Total Carts: 0
Synced since

On my magento backend I have 98 newsletter subscribers. Right now it does not sync the users from magento newsletter module, and also, it is not adding new users when I enter the email through the website email field.

Is it possible to have some permission issues, and which would those folders be?

Or maybe I am missing some step?


texts: Magento2: How to return grouped products in search?

texts: How does Magento handle Grouped Products in search? For example, if a site has products 1, 2, 3 inside of grouped product 4, when searching for a search term that is contained it product 3's description, would product 4 be returned by the search? If not, is there a way to alter this behavior?


texts: Magento 2: How to add color picker in ui form

texts:
I am developing new extension in which I need to add color picker and date picker as well in an admin form. I am developing form using a component. Please check sample screenshot of the form field. I want to implement in UI Form. Could any one help me for that?

Thank You in Advance


texts: Custom category collection not rendering correct results in layered navigation and toolbar in magento 2

texts:
I am displaying a custom product collection in a block that extends the category block.

I have overriden catalog_category_view in my custom module.  The custom filter yields renders proper collection in the category page, but the layered navigation and the toolbar doesnot render the proper collection.

catalog_category_view.xml

<page 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="Namespace\Module\Block\Category\Form" name="custom_category_collection" before=
                "-" template="category/filter.phtml">
            </block>
        </referenceContainer>
    </body>
</page>

app/code/namespace/module/Block/Category/Form.php

<?php
namespace Namespace\Module\Block\Category;

class Form extends \Magento\Framework\View\Element\Template
{
    protected $_catalogLayer;

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
        array $data = []
    ) {
        $this->_catalogLayer = $layerResolver->get();
        parent::__construct($context, $data);
    }

    protected function _prepareLayout()
    {
        parent::_prepareLayout();

        $collection = $this->_catalogLayer->getProductCollection();

        $select = $collection->getSelect();
        $select->where("e.entity_id = 18");
        return $this;
    }
}

Strange thing is, i noticed that the toolbar and layered navigation worked well with the custom collection when the module CatalogSearch was disabled. But otherwise, it doesnt work.

Can anyone suggest a solution. Thanks.


texts: How we can archive Magento 2 orders programmatically / CLI?

texts:
Can anyone please mention how the Magento EE's order archiving feature works.
Does it require the default Magento CRON enabled? And how do we know that orders are archived after we enable the setting?
Also how it will look e.g sales order admin page after the archive.
Does it improve the loading performance of the sales order grid?
In my grid, there are more than 1 lakhs orders right now.


texts: How to add more than one frontname for same Module in Magento 2

texts:
We need a module to function differently and show different UI if its comes with different frontname

i.e

If Externalvendor/Module1 has routes like

    <router id="standard">
        <route id="routing1" frontName="routing1">
            <module name="Externalvendor_Module1"/>
        </route>
    </router>

For above routing I tried adding routing alias under Custom/Module1 routes like

   <router id="standard">
        <route id="routing2" frontName="routing2">
            <module name="Externalvendor_Module1"/>
        </route>
    </router>

So here I was expecting when I access domain.com/routing2 it will load same front pages like domain.com/routing1 but currently it shows white page and I am not seeing any exception or no error log. How should be this done?


texts:
This is my current checkout page:

I want to move Order Summary area above Shipping Address. I try to add this code

<move element="sidebar" destination="steps" before="shipping-step"/>

in checkout_index_index.xml but it doesn't work. Is there any way I can do to move the summary area?


texts: How to create a new layout to divide into 4 columns in magento 2?

texts:
I am a newbie to magento .I have created a custom layout page & it appears in admin dropdown as well. But I don't know what code to put to divide it into 4 columns ?Can anyone explain me how html is generated ?

<container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>

What is header.container ?Where is it located

This is my default.xml.

<page layout="4columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_file" xsi:type="string">images/custom-logo.jpg</argument>
            <argument name="logo_img_width" xsi:type="number">100</argument>
            <argument name="logo_img_height" xsi:type="number">100</argument>
        </arguments>
    </referenceBlock>
    <referenceContainer name="fouth.column">
<block class="Magento\Cms\Block\Block" name="home-page-block">
<arguments>
   <argument name="block_id" xsi:type="string">home-page-block</argument>
<arguments>
</block>
</referenceContainer>
</body>
</page>


texts: Magento2 - Checkout page store credit auto selected

texts:
I want to make store credit option auto selected on checkout page.
If I click on the "Use Store Credit" button using jQuery, it works perfectly. But I am not able to make it work.
To achieve this, I need to extend or mixin the store credit but not sure that gonna work.
Can anyone help How can I make store-credit option auto selected when customer land on checkout page?
Any help would be appreciated.


texts: Magento 2 get Subcategories of a category

texts:
I want to get all the subcategories of a category(including subcategories of subcategories). I want to display it as per the structure.
The below code display as

Array
(
    [121] => Array
        (
            [0] => Array
                (
                    [122] => Antibiotics
                    [127] => Pet Apparel
                )
        )

    [122] => Array
        (
            [1] => Array
                (
                    [123] => Fish/Bird
                    [124] => Injectables
                    [125] => Pill Helpers
                    [126] => Powders
                )
        )

    [127] => Array
        (
            [1] => Array
                (
                    [128] => Dog Clothing
                )
        )

    [128] => Array
        (
            [2] => Array
                (
                    [129] => Dog Jackets
                    [130] => Dog Costumes
                    [131] => Dog Apparel
                    [132] => Dog Hoddie
                )
        )

)

Here is my code

public function getParentCategory()
    {
        $parent_category_id = 0;
        if($this->getCurrentCategory()){
            if($this->getCurrentCategory()->getParentCategories()){
                foreach ($this->getCurrentCategory()->getParentCategories() as $parent) {
                    if ($parent->getLevel() == 2) {
                        $parent_category_id = $parent->getId();
                    }
                }
            }
        }
       return $this->getSubCategories(121,0);

        }
    public function getSubCategories($id,$level)    {

        $objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
        $categoryRepository = $objectManager->get('\Magento\Catalog\Model\CategoryRepository');
        $categoryObj = $categoryRepository->get($id);
        $subcategories = $categoryObj->getChildrenCategories();
        foreach($subcategories as $subcategorie) {
            $this->categoryArray[$id] [$level][$subcategorie->getId()] = $subcategorie->getName();
            if($subcategorie->hasChildren()){
                $this->getSubCategories($subcategorie->getId(),$level+1);
            }
        }
        return $this->categoryArray;

    }


texts: all transcational email are going to junk in Magento ver. 1.9.1.0

texts: All transcational email from the Magento ver. 1.9.1.0 is going to junk in gmail


texts: Varnish purge is not working when clean the magento cache

texts:
We have successfully configured varnish in our magento website, it's working great. But the problem is varnish is not purging when we clear the cache either via admin panel or ssh command. We restart varnish server every time. We have also configured CDN (It may be reason for this cache issue).
We have tried to set http_cache_hosts using the command

bin/magento setup:config:set --http-cache-hosts=xx.xx.xxx.xxx:6081

Also tried with ports 8080,6082

In our .vcl file

acl purge {
    "xx.xx.xxx.xxx";
}

Above configurations is not at all working. We are missing something to make it work. Can anyone help on this?


texts:
I've migrated a store from M1 to M2 and on the M1 store MSRP is used extensively. Problem I have is when I open advanced pricing on a product I don't see the field MSRP on any of the products.

I've seen some posts saying that you have to enable MAP, but that doesn't enable msrp


texts: Magento 2.3.0 from Backend Product Edit not working

texts:
I have Magento 2.3.0. I have an issue while updating the product from backend.
It's giving me an error message "Invalid input DateTime format of value 'Invalid date' ".

I am not finding any solution to why this thing happen.

If anyone has a solution please guide me.


texts:
I want to remove the decimals and replace this with a symbol on the list and product view.

I only want to edit those two files.

I want to edit the price.phtml and I need to modify this line especially for this:

<?php echo $_coreHelper->formatPrice($_price, true) ?>

How can I edit the price from €1.100,00 to €1.100,-?


texts:
I have the following code to get the tax rate of a product

$store = Mage::app()->getStore();
$taxCalculation = Mage::getModel('tax/calculation');
$request = $taxCalculation->getRateRequest(null, null, null, $store);
$taxClassId = $product->getTaxClassId();
$percent = $taxCalculation->getRate($request->setProductClassId($taxClassId));

But I need the tax rate for the shipping costs for this product. Is there a way to get it?


texts: Collection join to diffrent databases table

texts:
My Magento project has 2 connetions: default,whmanager.
        $joinConditions = 'main_table.product_id = catalog_product_entity.entity_id';
    $collection->getSelect()->join(
        ['catalog' => $collection->getTableName("catalog_product_entity")],
        'main_table.product_id = catalog.entity_id',
        []
    );

This code isnt working because (whmanager hasnt catalog_product_entity table)
main.table(whmanager database) catalog_product_entity(default database)


texts: Adding external javascript link in static blocks

texts:
I'm creating a static block to show custom menus and calling this static block inside topmenu.phtml. Now I want to write some javascript code which will be applied on the ids/classes present in that static block. How I can link my static block to js file where I can write my js/jquery code? I've tried this way but it didn't work.

<script  src="<?php echo $this->getSkinUrl('js/jquery-1.4.4.min.js');?>"></script>
<script  src="<?php echo $this->getSkinUrl('js/myfile.js');?>"></script>


texts: How to get product via attribute value or label?

texts:
Can I retrieve a product using an attribute code and/or attribute value?
No product ID, no product name, just an attribute code and value.


texts: What is the best way to generate html in Magento2?

texts:
Is it a what to generate html in blocks to render in templates.

Working in other php frameworks there always some kind of html helper with in the framework but the only thing I can see is the is the UI library that it is so complex that I will be one our to add a simple field in the template.

Is it an easier way to create html ?

For example in Yii2 or Laravel to generate an html image tag you can use:

<?= Html::img('images/test.jpeg');?>


texts: Magento 2: State and city auto Fill when zip code entered?

texts: I want to auto fill state and City. When i enter zip code in magento 2 checkout shipping address.


texts: Show custom payment option value at backed order detail page and invoice

texts:
I have created some custom options for payment. Like this article has suggested.

http://excellencemagentoblog.com/blog/2011/10/28/magento-create-custom-payment-method/

Now I want to show these custom column values to back-end order detail page and at invoice too.

Please guide How can I do this.


texts:
I have a module that print filters, but it loads before that magento catalog, and when I do
 $activeFilters = $this->_catalogLayer->getState()->getFilters(); $activeFilters is NULL.

I can load this module after than magento catalog?


texts:
Looking for the best way to add the SKU field on the category list page in Magento 2 using the Luma theme ?
(Please note the Luma theme is the default theme that ships with Magento2)


texts: Magento 2.3.1 Override vendor/magento/theme-frontend-blank/Magento_Theme/web/js/theme.js

texts:
I need to override vendor/magento/theme-frontend-blank/Magento_Theme/web/js/theme.js to my custom theme in app/design/frontend/[vendor]/[theme]/

I found that I need to do it through requirejs-config.js with map but I didn't find the way to do it.

Where should I create the requirejs-config.js and what I have to write in it?


texts: Magento2 not able to get customer data in observer

texts:
I am using Magento 2.4.1, made observer. Event name is checkout_submit_all_after. I want to
update order data, customer data, customer address data. Updating Order data is succeeded, but Other data failed. I use "$customer = $this->customerRepository->getById($customerId);" to get customer data, but returned nodata.
Please teach me I can't get customer data.
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;

class OrderCreateObserver implements ObserverInterface
{
    protected $request;
    protected $customerRepository;

    public function __construct(
        RequestInterface $request,
        CustomerRepositoryInterface $customerRepository,

    ){
        $this->request = $request;
        $this->customerRepository = $customerRepository;
    }

    public function execute(Observer $observer)
    {
        $params = $this->request->getParams();

        $customerId = $order->getCustomerId();

        $customer = $this->customerRepository->getById($customerId);
        $customer->setCustomAttribute('updatecolumn', $params['updatecolumn']);

        $this->customerRepository->save($customer);

    }
}

updated
$customer->getCustomAttribute('updatecolumn')->getValue()
was worked, after
$customer->setCustomAttribute('updatecolumn', $params['updatecolumn']);
but data was not saved


texts: Hello I search an example of API SOAP module, maybe someone can send an example of SOAP API in Magento 2


texts: Retrieve Quote Item ID after added to the cart

texts:
I am running an observer on Magento 1.9 on the following event:

sales_quote_merge_after

This event occurs when a guest customer with items in their cart logs into their account. When doing this the quote item IDs are dropped from the current session and the products are re-added with new IDs. What I need to know (using an observer or otherwise), is what each quote item ID was before, and what it has changed into.

I have tried countless observers on the Mage_Sale_Model_Quote::addItem method, but Magento does not return the new quote item ID on any method I have seen.

In the observer above I have managed to make it pass the original quote and new quote into the observer, but there's no way of matching the quote item IDs.

I have tried adding the original quote item ID as an option to the quote item which works, but as soon as the merge is carried out the options are wiped!

$item->addOption(array(
                'code' => 'original_quote_item_id',
                'product' => $item->getProduct()->getId(),
                'value' => $item->getId()
            ));

I'm left perplexed on where to try next - any advice or suggestions would be greatly appreciated!


texts:
I have trouble upgrading to 1.13 from 1.12 in the first step it is telling me you should install fresh copy of magento, I installed magento 1.12 and then I want to import the database from my 1.12 to this new fresh one. in the next steps we have the script url_migration_to_1_13 so that to migrate to 1.13.
my question is that shoud I install fresh copy of 1.13 or 1.12?
I am really dissatisfied with magento documentation.
Upgrading From EE 1.12 or Earlier
Following is a high-level roadmap to upgrade to EE 1.13.0.2 or later from EE 1.12 or earlier. This upgrade involves tasks not required for other Magento upgrades; these new tasks are indicated in the roadmap.
Install Magento in a different directory:
Recommended. Set up a new system (that is, another host) on which to install Magento.
The system should be identical to, if not better than, your current system. The new system must meet the Magento system requirements.
Install Magento in a new, empty root installation directory on the same server.
Important: Do not upgrade Magento in the same directory on the same server because post-upgrade errors are likely to occur.
they are telling identical so I guess it should be 1.12 and not 1.13 but I don't know


texts: Assigning user role in custom module redirect to no route

texts:
In my custom module i have created ACl

<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
    <resources>
        <resource id="Magento_Backend::admin">
            <resource id="ABC_CustomReports::top_level" title="TECNO" sortOrder="10" >
                <resource id="ABC_RecommendedOffer::data" title="Recommended Offer" sortOrder="20">
                    <resource id="ABC_GuestRecommendedOffers::guestrecommendedoffersgrid" title="Guest" sortOrder="30" />
                </resource>
            </resource>
        </resource>
    </resources>
</acl>

menu.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
    <add id="ABC_GuestRecommendedOffers::guestrecommendedoffersgrid"
         resource="ABC_RecommendedOffer::guestrecommendedoffersgrid"
         title="Guest Offers"
         action="guestoffers/"
         module="ABC_GuestRecommendedOffers"
         sortOrder="20"
         parent="ABC_RecommendedOffer::data"/>
</menu>

and controller

<?php

namespace ......;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Framework\View\Result\PageFactory;

class Index extends Action
{

protected $resultPageFactory;

/**
 * Grid constructor.
 * @param Context $context
 * @param Registry $coreRegistry
 * @param PageFactory $resultPageFactory
 */
public function __construct(
    Context $context,
    PageFactory $resultPageFactory
) {
    $this->resultPageFactory = $resultPageFactory;
    parent::__construct($context);
}

public function execute()
{

    $resultPage = $this->resultPageFactory->create();
    $this->initPage($resultPage)->getConfig()->getTitle()->prepend(__('Manage Guest Offers'));
    return $resultPage;
}
protected function initPage($resultPage)
{
    $resultPage->setActiveMenu('ABC_GuestRecommendedOffers::guestrecommendedoffersgrid')
        ->addBreadcrumb(__('Tec'), __('Offers'));

    return $resultPage;
}

protected function _isAllowed()
{
    return $this->_authorization->isAllowed('ABC_GuestRecommendedOffers::guestrecommendedoffersgrid');
}

}

when i assign a new user to this module its redirect me to

  abc.com/admin/admin/noroute/denied/key/a4e87d5a8d025664311af3048c6904e59cd20509406fd933727fd8637c6d946c/


texts: Custom price of product not getting applied in cart in Magento 2

texts:
I am trying to set the custom price of product to cart using Magento2 but unable to do that. For that I have created a module TW - as namespace Cart- as Module name . So under TW/Cart I have created 2 folders etc and Observer. Below is the code in respective folders. Do i need to register this module by putting registration.php file under this module ? Please help me what am I doing wrong?

Code for 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="checkout_cart_product_add_after">
        <observer name="cart_observer_customprice" instance="TW\Cart\Observer\CustomPrice" />
    </event>
</config>

Code for Observer/CustomPrice.php

namespace TW\Cart\Observer;
 use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
use Psr\Log\LoggerInterface;

class CustomPrice implements ObserverInterface
{
    protected $logger;
    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }
    public function execute(\Magento\Framework\Event\Observer $observer) {

        $item = $observer->getEvent()->getData('quote_item');
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
        $price = 120; //set your price here
        $this->logger->debug("Hello I am here", [
            'price' => $price,
        ]);
        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);
        $item->getProduct()->setIsSuperMode(true);
    }

}


texts: How do I send a email from the cron job? Magento 2 Unable to send mail

texts:
I did create a cron job with custom sql query.  It will send an email notification to our support email. Can someone tell me what's wrong my email coding, from the log it said I am unable to send mail? I had mageplaza SMTP setup, I am able to send testing email by using gmail SMTP
            <?php
            namespace ABC\CheckAddress\Cron;

            use Psr\Log\LoggerInterface;

            class Test {
                protected $logger;

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

               /**
                * Write to system.log
                *
                * @return void
                */
                public function execute() {
                    //$this->logger->info('Cron Works');

                     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                     $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
                     $connection = $resource->getConnection();
                     $tableName = $resource->getTableName('sales_order_payment');
                     $attribute_information = "SELECT sales_order_payment.additional_information FROM sales_order LEFT JOIN
                        sales_order_payment ON sales_order.entity_id = sales_order_payment.parent_id
                        WHERE sales_order_payment.method = 'ABCpayment' AND sales_order.updated_at >= NOW() - INTERVAL 1 MONTH";

                    $results = $connection->fetchAll($attribute_information);

                foreach ($results as $result) {
                    $json_array = implode($result);
                        $data = json_decode($json_array);
                        $address_verification_json = $data->shipping_address_verification;
                        $data2 = json_decode($address_verification_json);
                        $postal_code = $data2->postal_code;

                    if ($postal_code < 1) {

    /* How I send ?
    SEND EMAIL TO CUSTOMER SERVICE  */

    $body = 'test';
    $from = 'Paul';
    $nameFrom = 'paul@gmail.com';
    $to = 'Paul';
    $nameTo = 'paul@gmail.com'';

$email = new \Zend_Mail();
$email->setSubject("Feedback email");
$email->setBodyText($body);
$email->setFrom($from, $nameFrom);
$email->addTo($to, $nameTo);
$email->send();

/* it show unable to send mail
 am I missing something?    */
                    }

                }
                }
            }

this is the error
   [2020-11-25 23:52:03] report.CRITICAL: Unable to send mail.  {"exception":"[object] (Zend_Mail_Transport_Exception(code: 0): Unable to send mail.  at /var/www/html/Magento2/vendor/magento/zendframework1/library/Zend/Mail/Transport/Sendmail.php:111)"} []


texts: Magento 2 After migration layer navigation not show on category page

texts: After done magento 1.7.0.2 migration to magento 2.3.1 layer navigation not show on category page.


texts: Magento 2.3.3 - Changing default header size for an image

texts:
First of all, I'm fairly new to Magento. And my question is how do I change the default header size for an image? The site I'm working on is upgrading from Magento version 2.3.2 to 2.3.3. And in version 2.3.2, the size of the image we used was not specified for the header. There the image was fine and at its normal size. So, when I tried using the same image in Magento version 2.3.3, the image is "squished"/compacted because the default header size seems to be half the size in the new Magento version.

Thanks in advance for your help.


texts: Magento2 admin order history editor issue

texts:
I have added tinyMCE editor in Order status history for comment field, the issue is when i get ajax response, editor disappears instead its showing normal textarea field, please find below screenshots of tinyMce editor field and ajax response field respectively:

I have used below code in this page to use tinyMCE editor:

<textarea name="history[comment]"  id="history_comment" class="textarea" cols="80" rows="20"></textarea>
                <script>
                 require([
                    'jquery',
                    'mage/adminhtml/wysiwyg/tiny_mce/setup'
                ], function(jQuery){

                var config = {},
                    editor;

                jQuery.extend(config, {
                    settings: {
                        theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
                                                    'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
                        theme_advanced_buttons2: null,
                        theme_advanced_buttons3: null,
                        theme_advanced_buttons4: null
                    }
                });
                editor = new tinyMceWysiwygSetup(
                    'history_comment',
                    config
                );
                editor.turnOn();
                jQuery('#history_comment')
                    .addClass('wysiwyg-editor')
                    .data(
                        'wysiwygEditor',
                        editor
                    );
            });
                </script>


texts: Is there a way to force the install scripts to run for every new deployment? When I deploy a new git branch to our QA servers, the install scripts are not kicking off since magento thinks they already ran. I can fix it manually by removing the necessary rows from the core_resource table and refresh the page. I would like to be able to do this programmatically as a part of our deployment process without specifying core_resource rows that can be added or changed by our developers.


texts: How to add tooptionsarray in this argument layout grid magento2? What code need to be added in this argument to show as disable and 1 as enable

texts:
<block class="Magento\Backend\Block\Widget\Grid\Column" as="request_status">
                        <arguments>
                            <argument name="header" xsi:type="string" translate="true">Status</argument>
                            <argument name="index" xsi:type="string">request_status</argument>
                            <argument name="type" xsi:type="options">text</argument>
                            <argument name="column_css_class" xsi:type="string">col-id</argument>
                            <argument name="header_css_class" xsi:type="string">col-id</argument>
                        </arguments>
                    </block>


texts: set attributes to 'use default value' for a list of products

texts:
I want to set the images to 'use default value' for a list of product, and for a list of store view. I know how to do it individually for each product : setData(attributeName,false), and so i can do a loop over my list of product. Problem: it's really too slow.

$attrArray=array('thumbnail','small_image','image');
$products = array(170,171,172);
$stores = array(17,18,19);
foreach ($stores as $store_id) {
    foreach ($products as $product_id) {
        foreach ($attrArray as $attr) {
            $product = Mage::getModel('catalog/product')
            ->load($product_id)->setStoreId($store_id)
            ->setData($attr, false)
            ->save();
        }
    }
}

So i've try to use Mage::getSingleton('catalog/product_action')->updateAttributes($products, $attrArray, $store_id); instead, which is supposed to do the same thing but over a list of products.
It actually do something : all my images are now set to 'no images', but not to 'Use default value' as expected.

$attrArray = array('thumbnail'=>false,'small_image'=>false,'image'=>false);
$products = array(170,171,172);
$stores = array(17,18,19);
foreach ($stores as $store_id) {
    Mage::getSingleton('catalog/product_action')
    ->updateAttributes($products, $attrArray, $store_id);
}

If someone around here have an idea, it could really help me to save some time ! Thanks.