texts: Adding a variable for each Simple product within a Bundle in Magento 1.9 CE

texts:
In our Magento store (1.9 CE) we have some Simple products which fit multiple applications.
So we want to create a Bundle product for each application and include the Simples in them.
The problem lies that we need a layer of data to explain the position/info for that part in that application. This varies depending on the Bundle so we can't store this data in the Simple product.
eg: Simple 'A' goes into Bundle '1' and '2'
In Bundle '1', 'A' is 'Front' but in Bundle '2', 'A' is 'Rear'
So we need a way of storing a value for each instance of a Simple product within a Bundle.

So if it's practical we need a way of adding this data in to each instance of a Simple product in a Bundle

then we can pull that on the front end

Is it practical to input and store data at this level of the bundle? Would it end up in catalog_product_bundle_selection ?


texts: Magento SUPEE-6788 Breaks email body in all email templates

texts:
When I enable this security patch, all emails sent have no body. When I look at the email header I see this inside all of them dkim=neutral (body hash did not verify)

I have an exception log:

http://pastebin.com/JPCY6qfZ

I'm not much of a Magento/PHP guy to begin with, so any help would be greatly appreciated. I want to re-apply the security patch, but I need email functionality otherwise our store is useless.


texts: Adding custom options in to cart through API in magento2.1

texts: I have custom options like 'booking_from' and 'booking_till' in my custom module, everything works in the backend is fine. But how can I add those options in a cart through REST API in magento2.1.7? Or did I need to create custom extension_attributes for those options .? Hope some experts will here to clear this.


texts:
I use MageSetup to configure German taxes.

Extension allows to set up customer tax classes:
Customers (EU - 19%, Other - 0%)
Companies with VAT (EU - 19%, Other - 0%)
Companies without VAT (All countries 0%)

But my Client wants that Companies with VAT should have taxes only in DE(19%) and other countries(including EU) 0%.

The thing is that customer should work according to general laws. I have a link to new law description.

Shouldn't MageSetup be updated according to this law?

Otherwise:
The problem is that I did not found how(using extension and not manually) to configure tax rule only for one country.

I can first set up everything that allows extension and after write upgrade script. But it should be executed only after MageRun (manualy) configure store.


texts: Why does the core not configure preferences for many of the interfaces?

texts:
There are many interfaces in the Magento 2 core that not configured as di.xml preferences.
Examples are

\Magento\Checkout\Model\Cart\CartInterface
\Magento\Catalog\Model\Layer\FilterableAttributeListInterface
\Magento\Catalog\Model\Layer\ContextInterface
...

All of these interfaces have implementations, there just is no preference.

Because no preferences are configured for these interfaces they need to be explicitly supplied to the object manager when it is creating the object graph for integration tests.

I understand that in many cases there can be no preference that fits all cases, but just choosing one of the available implementations more or less randomly when writing the tests seem to work.

If possible, I would like to know the reasoning behind choosing not to configure a preference for an interface. It would be great if someone from the core team maybe could elaborate. Thanks!


texts: Deprecated Classes and Methods in Magento 2.3

texts:
Using a module from Magento 2.2 to Magento 2.3, I notice the code has several deprecated Magento Core Classes and Methods.
For example, the Registry (\Magento\Framework\Registry).

Is there any guide/article which says which classes and methods we should use instead?


texts: Selected Options not available to cart Programmatically

texts:
I am adding a product to cart programmatically and it says

Some of the selected options are not currently available. while adding to cart

Any solution to that?

I have written this code:

public function execute()
    {
        $current_product_sku = $this->getRequest()->getParam('current_product_sku');
        $optionid = $this->getRequest()->getParam('optionid');
        $optionvalue = $this->getRequest()->getParam('optionvalue');
        $qty = $this->getRequest()->getParam('qty');

        $params = [
            'form_key' => $this->formKey->getFormKey(),
            'product' => $current_product_sku,
            'qty'   =>$qty,
            'options' => [
                $optionid => $optionvalue,
            ],
        ];
        $product = $this->product->load($current_product_sku);
        $this->cart->addProduct($product, $params);
        $this->cart->save();
    }

If I try to add any other option like I have 3 options 1,2,3 but if I add only 1 as an option it works good. Any solution?


texts: I want the " Add gift options" and "Add gift options for the Entire Order" checked by default

texts:
In the order process - when customers come up to the "Do you have any gift items in your order?" section of the order --) they have to click the check-mark into " Add gift options." first and then - ANOTHER check-mark into "Add gift options for the Entire Order" under the "Gift Options for the Entire Order." section.

This makes no sense for us because all of our customers will have to leave a Message card so this clicking and clicking again to put 2 check-marks in there is really unnecessary!

Any ideas on how to make it show up by default without the need to put any check-marks anywhere?

Magento 1.9.1.0
just installed the Porto Theme #11

Updated on March 22nd, 2019:

I am trying to set this up on Magento 1.9.4 but I don't have any luck. I have modified both the

/public_html/app/design/frontend/base/default/template/giftmessage/inline.phtml

(as mentioned here: How to remove the 2 checkboxes from the Gift Messages on Order Level? )

I found the code mentioned by Anil Suthar in the answer below in the:

/public_html/skin/frontend/smartwave/porto/css/custom.css file.

I uploaded the same file to the same directory on Magento 1.9.4 but it does not work! Any ideas?


texts: Change page layout dynamically depending on url parameter

texts:
The standard layout of my categories is 2-columns-left so that the layered navigation is visible in my shop. What I want is, to use the same categories to display content.

This is an example for my shop link:
products/chemicals.html
If I click this link my products are shown in my list.phtml

This is an example for my "cms" link:
products/chemicals.html?cms_id=123
If I click this link my "cms" content is displayed in my list.phtml

What I want now, is to display my content without the left sidebar.
By CSS I can set the sidebar display:none, that works, but the page loads my products.

I would prefer to change the page layout when I call my "cms" category page.

Any idea?

Christian


texts: Password Strength Meter - Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

texts:
I have an issue where the password strength meter on the reset password page isn't working and just says "Password Strength: No Password".

I receive the following console error when I enter text into the password input.

  Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

I haven't edited the reset password template.

Would anyone be able to advise why I receive this error and how I can resolve so that the password strength meter works?

The error appears within password-strength-indicator.js

_calculateStrength: function () {
    var password = this._getPassword(),
        isEmpty = password.length === 0,
        zxcvbnScore,
        displayScore,
        isValid;

    // Display score is based on combination of whether password is empty, valid, and zxcvbn strength
    if (isEmpty) {
        displayScore = 0;
    } else {
        this.options.cache.input.rules('add', {
            'password-not-equal-to-user-name': this.options.cache.email.val()
        });

        if (password.toLowerCase() === this.options.cache.email.val().toLowerCase()) {
            displayScore = 1;
        } else {
            isValid = $.validator.validateSingleElement(this.options.cache.input);
            zxcvbnScore = zxcvbn(password).score;
            displayScore = isValid ? zxcvbnScore : 1;
        }
    }

    // Update label
    this._displayStrength(displayScore);
},


texts:
I just created a a new "theme" for my maintaince mode by copy and rename the defult folder under /pub/error/ and renamed local.sample.xml to local.xml.
In the 503.pthml file under the "mytheme" folder i created I'm trying to add a picture:

How ever when i load the maintenace page the picture is broken. anyone who knows why? is there anything do wrong?


texts: How to correct create a multilingual store Magento 2 with nginx?

texts:
I have server: ubuntu 16.04, nginx 1.10, MySQL 5.7, one installation Magento 2. And 2 domains: primary domain.com and domain.in for "in Store View".
My actions:
Create Store View "in".
Change my host config nginx insert:

map $http_host $MAGE_RUN_CODE {
    domain.com default;
    domain.in in;
}

And insert to nginx.conf.sample:

fastcgi_param  MAGE_RUN_TYPE store;
fastcgi_param  MAGE_RUN_CODE $MAGE_RUN_CODE;

So, now I have config:

upstream fastcgi_backend {
    server unix:/var/run/php/php7.0-fpm.sock;
}

map $http_host $MAGE_RUN_CODE {
    domain.com default;
    domain.in in;
}

server {
    listen 80;
    server_name www.domain.com;
    return 301 $scheme://domain.com$request_uri;
}

server {
    listen 80;
    server_name www.domain.in;
    return 301 $scheme://domain.in$request_uri;
}

server {
    listen 80;
    server_name domain.com domain.in;

    set $MAGE_ROOT /var/www/domain.com/html;
    set $MAGE_MODE default;

    location = /robots.txt {
        alias /var/www/domain.com/html/robots.txt;
    }

    location = /sitemap.xml {
        alias /var/www/domain.com/html/sitemap.xml;
    }

    include /var/www/domain.com/html/nginx.conf.sample;
}

Result: not correct works, problem: closed access to the admin panel, when you change the language, it throws to the wrong domain.


texts:
container name="header.panel" label="Page Header Panel" - (welcome message area) - on the far left I want to call a cms block. I tried the widget but that block appears below the the welcome message. I want it the same line.

I am using Magento 2 Luma, how do I add add a custom CMS block there?


texts:
As described in the title i want to change the position of 2 static blocks but i don't want to mess with their css.
I present my xml below:

  <reference name="tops1">
              <block type="cms/block" name="jmslideshow">
                <action method="setBlockId"><block_id>jmslideshow</block_id></action>
              </block>
            </reference>
            <reference name="tops2">
              <block type="joomlart_jmtabs/core" name="jmtabs" >
                  <action method="addTabs_staticblock">
                    <title>Trending</title>
                    <identifier>trending</identifier>
                  </action>
                  <action method="addTabs_staticblock">
                      <title>best seller</title>
                      <identifier>best-seller</identifier>
                  </action>
                  <action method="addTabs_staticblock">
                      <title>New arrival</title>
                      <identifier>new-arrival</identifier>
                  </action>
              </block>
            </reference>
            <reference name="tops3">
              <block type="cms/block" name="collections">
                <action method="setBlockId"><block_id>collections</block_id></action>
              </block>
            </reference>
            <reference name="mass-bottom">
              <block type="cms/block" name="gift">
                <action method="setBlockId"><block_id>gift</block_id></action>
              </block>
            </reference>
            <reference name="bots1">
              <block type="cms/block" name="advantage">
                <action method="setBlockId"><block_id>advantage</block_id></action>
              </block>
              <block type="cms/block" name="testimonials">
                <action method="setBlockId"><block_id>testimonials</block_id></action>
              </block>
            </reference>

and to be more specific i want to change positions between jmtabs and gift in the mass-bottom.
Actually to be more specific i want jmtabs to show after gift in the mass-bottom.
How can that be done?


texts: zoom is not function in porto magento 2 demo 1 theme

texts: I'm frontend developer. I'm using Smartwave porto magento 2 demo 1 theme. Suddenly, on product detail page zoom on hover function not working. I have uploaded old pub - static folder where zoom was working properly. But still getting error in console zoom is not function. Even, I copied whole zoom function code where zoom function is called. Still no luck. Please let me know what I'm missing or where to check?. Thank you.


texts:
I was wonder if there is any extension available that would let me create filterable product collections where the collection is built by sku fro the url. So the url would be something like:

/products/custom_collection/sku1/sku2/sku3/sku4/sku5

or

/products/custom_collection?skus=sku1,sku2,sku3,sku4,sku5

And then the page would act like a product category that is filterable by product attributes just like a regular product category.


texts: I am overriding Catalog/Product/View/options.phtml template in my custom module but its not working, I am using below code in catalog_product_view.xml file.


texts: How can I override the registration page?

texts:
I'm trying to add phone and address fields to the account registration form, as per this SO post.

To override the core functionality, I copied app/design/frontend/base/default/template/customer/form/register.phtml to  app/design/frontend/{package}/{theme}/default/template/customer/form/register.phtml, as would be expected.

The problem is that no changes are detected when added to the new template, not even simple changes such as editing field labels.  Stranger still, not even changes made to the core template are detected.

I have verified the file paths are correct, including namespace, and made sure file ownership and permissions are correct.

I have cleared the Magento cache many times (all of it), and even tried viewing the page in incognito mode and with other browsers to rule out browser cache.  Also, there is no caching at the server level.

Am I missing something?  I've successfully overridden core template files numerous times before, but is there something more that I need to do for the registration form templates?


texts: Magento 2 : How to validate email or mobile number in a textbox validation

texts:
<input type="text" class="input-email-mobile " id="customer-email-mobile">

I need to validate Mobile number or email  in the above text box using magento validation.! maybe the user enter mobile number or email in the same input  data-validate="{required:true,'validate-email':true,'validate-number':true}this code only validate email. how can i achieve both in a text box using magento validation In Checkout Shipping Address page ??


texts: Magento 1.9 - How to apply shopping cart price rule for Total Weight?

texts:
Condition: Actually I have applied free shipping, and I need to add a condition like if total weight equal or greater than 10 not apply free shipping.

My workout:

https://snag.gy/Ttsyx6.jpg

Condition not working.


texts: Add a custom block after category products price section in magento2

texts:
I would like to add a custom block in category landing page, after the product price section,

Iam using the below code but it is adding after the add to cart but i wants to add after price section,

  <referenceContainer name="category.product.addto.compare">
    <block class="Magento\Framework\View\Element\Template" template="Vendor_Module::category/banner_category.phtml" name="banner_category_ptk" after="category.products.list"/>

Please help me how to do this, what is proper container name i have to use in magento2


texts:
I want to Hide breadcrumbs on specific category page in magento2.

I applied this type of changes:

referenceBlock name="breadcrumbs" remove="false"

But it hide from all the pages.

I need to some specific category page.

Anyone Guide me what types of changes in layout file.

Thanks.


texts:
I am bit confused magento price data formating is done, I am working on custome module whete I need to display order amount in grid, I done it, its working fine but I am getting 4 places of decimal points for example 14.0000, I need it display like 14.00 only,

my grid add column function that print order amount is as below.

$this->addColumn('order_amount', array(
          'header'    => Mage::helper('manoreport')->__('Order Amount'),
          'width'     => '100px',
          'type'=>'price',
          'index'     => 'subtotal_invoiced',
        ));

but it still looks like this only

Any Suggestions.?
Thanks in Advance:)


texts: How to disable Braintree Payment Method for Admin but enabled on Frontend?

texts:
I have to disable Braintree Payment Method for Admin but it will be enabled on Frontend as the Client's requirement.
I am not able to figure out as the IsAvailable method to disable payment solution is not working in the Braintree payment method.
Please Help!


texts: how to align multiple static blocks on a cms page

texts:
I'm revamping my home page to include 4 static blocks with text content. To test my layout I've created 1 standard static block and inserted it 4 times as a widget within my CMS homepage. The problem I'm having is to get them aligned properly.

I suspect I am going about this the wrong way.

I know how to create a phtml file that will call each static block and align them via CSS, I just don't know if I need to add this to a layout file or to call it within the CMS page.

What is the best method to insert and align 4 static blocks on a CMS page?


texts: How to give file permissions while uploading my code move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);


texts: Magento 1 - Add VAT NUMBER column in Manage Customers Grid

texts:
I want to add a column in Manage Customers Grid

  app/code/core/Mage/Adminhtml/Block/Customer/Grid.php

with the VAT Number of customers.

Now i have ID, Name, Email, Telephone, Country etc.

I need to add the attribute in prepare collection and the column in prepare columns.

Help please!


texts:
I want to get all information of user(admin) and I find this answer for M1:
To get an admin user role try (assuming that user is log in)

$admin_user_session = Mage::getSingleton('admin/session');
$adminuserId = $admin_user_session->getUser()->getUserId();
$role_data = Mage::getModel('admin/user')->load($adminuserId)->getRole()->getData();

Now I want get this for Magento 2.0. And how to do ?


texts: Display (Sort by, compare product block) to the left?

texts: I use magento 1.7 and I wish to change the position of my "sort by" block and "compare" block to left. What should I do to accomplish that?


texts: Composer require | You must be using the interactive console to authenticate

texts:
I'm trying to run a composer require worldpay/magento2-module-payments on Magento ver 2.1.8 and get this error:

[http]$ composer require worldpay/magento2-module-payments

  [Composer\Downloader\TransportException]
  The 'https://repo.magento.com/packages.json' URL required authentication.
  You must be using the interactive console to authenticate

In Magento devdocs I read that I need run this: composer update, however, I get the same error. It starts to load the repositories and then  throw the error again:

[http]$ composer update
Loading composer repositories with package information

  [Composer\Downloader\TransportException]
  The 'https://repo.magento.com/packages.json' URL required authentication.
  You must be using the interactive console to authenticate

Anyone had a similar problem or know how to solve it?


texts:
I like to add a block on top order creation page, in /Vendor/Module/view/adminhtml/layout/sales_order_create_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <css src="Amanweb_Custcomment/css/custcomment.css"/>
</head>
<body>
    <referenceBlock name="content">
        <block class="Vendor\Module\Block\Adminhtml\Order\View\Custcomment" before='-' name="items"  ifconfig="custcomment/general/enable" template="order/view/custcomment.phtml" />
    </referenceBlock>
</body>
</page>

But nothing is shown.

PS: I successfully added the same block in order view page
In Vendor/Module/view/adminhtml/layout/sales_order_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <css src="Amanweb_Custcomment/css/custcomment.css"/>
</head>
<body>
    <referenceBlock name="content">
        <block class="Vendor\Module\Block\Adminhtml\Order\View\Custcomment" before='-' name="custcomment"  ifconfig="custcomment/general/enable" template="order/view/custcomment.phtml" />
    </referenceBlock>
</body>
</page>


texts: how to check an array with cart price rule ID magento 2

texts:
I am trying to get Cart_Price_Rule.

   public function test()
{
    $ruleArray = $this->adventCollectionFactory->create()->getData();
    $ruleArray = array_column($ruleArray,'promo_rule_id');
    return implode($ruleArray);
}

This allows me to see the 2 rule id i have pased in a collection

But how would I check it with rule repository individually
My results are 1 and 2
and I have a cart price rule which has the ID of 1 and 2 I am trying to grab the description and code in phtml

\Magento\SalesRule\Model\RuleRepository $ruleRepository
$rule = $this->ruleRepository->getById($this->test()); //how do i pass it individually the id's

$rule->getDescription();
$rule->getCondition();


texts: unable to add google captcha into custom frontend form

texts:
I followed this URL https://magently.com/blog/recaptcha-in-magento-custom-form/ to add google captcha. I created secret keys in google account but unable to see on custom page
    <?= $block->getChildHtml('form.additional.info') ?>


texts: Magento 2 Wishlist product add not working when user should in before login

texts:
I am facing issue adding product in wishlist (magento version 2.2.3).

Here is scenario,

Step 1 :- Make sure customer not logged in.

Step 2 :- Go to product list page and click "Add to wishlist"

Step 3 :- it will redirected to login page.

Step 4 :- Now after login you can check product not added in wishlist.


texts: Magento2: What is the function of attribute_id?

texts:
I have installed Magento CE 2.1.7 with sample data.

In the table catalogsearch_fulltext_scope1 of my magento database. I see

The entity id, I believe is unique for every product. The attribute_id for every product has three values, 73, 74 and 75.

Clearly, we have

product name for attribute_id 73
SKU id for attribute_id 74, and
product description for attribute_id 75

I have the following questions regarding attribute_id

What's the exact role of attribute_id?
Why the values of product name, SKU id and product description are stored in this way inside the database?
Why the numbers 73 , 74 and 75? Why not 1 , 2 , 3 ?


texts: Custom Product Type: Prevent cart aggregation

texts:
I have set up a custom product type for my configurator in magento. Now everything seems to be fine. If I do a second conf with the existing product, not a second "row" is added to the cart. It does sum up the cart item to be an amount of 2.

How can I prevent this?

This is the code in config.xml:

<product>
            <type>
                <econfigurator translate="label" module="econfigurator">
                    <label>Econfigurator Product</label>
                    <model>econfigurator/product_type</model>
                    <price_model>econfigurator/product_price</price_model>
                    <is_qty>1</is_qty>
                    <composite>1</composite>
                    <can_use_qty_decimals>0</can_use_qty_decimals>
                </econfigurator>
            </type>
        </product>

Thank you!


texts: What is difference between creating custom attribute programmatically and via admin in magento 2?

texts:
Creating an attribute in the back end is easy, then why to create it as programmatically?

I like to know what is the difference between these two.


texts: Magento 2 User Permission Denied for Admin user

texts: I was creating user roles & permission as an admin in Magento 2, then I mistakenly denied myself permission to add roles and permission. Now It's showing "Access denied". I can't add or change my roles, and I know this is not an error or bug but a silly mistake from me. Please, how can go about that?


texts: How do I add tracking number to current order shipment in Magento 2?

texts:
I did find sample codes for Magento 1.x. But I have no idea how to do this on Magento 2.

Can anyone describe how to implement this using Dependency Injection (DI)?

Thanks.

$trackingDetail = array(
    'carrier_code' => 'ups',
    'title' => 'United Parcel Service',
    'number' => 'TORD23254WERZXd3', // Replace with your tracking number
);

$track = Mage::getModel('sales/order_shipment_track')->addData($trackingDetail);
$shipment->addTrack($track);

$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($shipment)
->addObject($shipment->getOrder())
->save();


texts: Show only Specific Order Status by user in magento 2

texts:
I need to show only pending order by users I follow this link

They used sales_order_grid_collection_load_before in magento 1, what exact event in magento 2

and

How to Collect only pending Orders from Order collection and Show for specific users.


texts: Display new attribute in related Products

texts:
I have a new attribute,
and I want to display the new attributes, those related to the product, why this code does not work ?? What is wrong?

<?php echo $this->escapeHtml($_item->getData('condition')) ?>

why, to display the SKU, this works?

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


texts: Looking for easy, unintrusive, free entry user survey

texts:
I'm asking for this specifically for a Magento installation, so that magento specific solutions could potentially solve this (i.e. extensions).

I'd like to do user surveys, but I find the way Magento does it pretty heavy handed. On the one hand, the structure is pretty rigid, on the other hand the answers must be specified beforehand.

What I'd like to do is ask probably one simple question, where I'm only interested in the answer. No other data necessary. Something like this:

Q: If you had one wish for THISSITE, what would it be?
A: <a simple text field, answer finalized through the enter key or through leaving the field>

The answers would need to go somewhere, I'd accept even a text file with all answers, one after the other.

Something like Stomt is close, but it's linked as a social network/tell others kind of service, which is more for the social interaction and less for the site owner.


texts: How to get current instock product count for each active category

texts: I need to display categories in header main navigation but only categories which has at least one instock product (configurable) , currently I tried by checking whole product collection for each category and check weather they have at least one instock product but it kills the mysql server and taking much time as my catalog is almost more than 50,000+ . Second option I thought is running a cron but it will also not give realtime result. So is there any other way to do this ? perhaps using model_save_after event or something


texts:
How to set data in table
quote_address after placing an order? ty for answer


texts: M2 Import customers with API with hashed passwords?

texts:
I can import customers with the API using /rest/all/V1/customers endpoint. I can also supply a password.
But is it possible to import a customer with a hashed password with the M2 API? If possible, how would I do that? To be clear, I just want to supply a hashed password in the request. It's coming from Magento 1 and is MD5 hashed (which M2 supports).
I tried password_hash (named like the field in the table) instead, but that doesn't work. The field stays NULL.
TL:DR
How can I import customers with hashed passwords with the API?


texts:
I set up the Braintree payment method on Magento following [this][1] article.
My braintree account is a production account, not sandbox.
I use Magento 2.0.10 Community edition and this is what i see in the console:

And i really do not understand why it doesen't show up as a payment method.
Any help is appreciated.

My Braintree settings in magento.


texts: Magento custom module adds HTML to header

texts:
I try below code is working for add a phtml file in header of Magento.

 <reference name="header">
    <block type="your_module/yourblockclass" name="yourblockname" template="your_module/yourtemplate.phtml"/>
 </reference>

Add the code above to the -layou-handle in your custom layout.xml file. Fetch the block via.

$this->getChildHtml()

from within the header.phtml file.This way it's working fine.

But Suppose you have some custom theme.

you install module and it will create the header.phtml file in app/design/frontend/default/default/page/html/header.phtml in this folder, so the custom theme header.phtml file called this file is not called.

so how to add any phtml file in header for any theme with out use of $this->getChildHtml().


texts:
How to add 2 or more validation in $fieldset when create.
Example:

        $fieldset->addField(
        'tax_class_id',
        'select',
        [
            'name' => 'tax_class',
            'label' => __('Tax Class'),
            'title' => __('Tax Class'),
            'class' => 'required-entry',
            'required' => true,
            'values' => 'test',
        ]
    );

And how to know which is the first validation will check. Thanks all.


texts: Magento - set default filter in layered navigation

texts:
I need some help with the following issue. I use an attribute in the layered navigation which is connected to stock values. The attribute has two options - In stock and All products (which includes out of stock products as well).

Is there any way I can have the In stock option selected by default when an user enters a category page? This way users would view only products which are in stock, but if they want they can select all products and also view the others.


texts: Google analytics showing Paypal as transaction source

texts:
I have google analytics set up with my magento store and I have the ecommerce feature enabled.

However when a customer purchases a product using paypal. Google analytics shows that the traffic source of the sale was paypal. I am assuming this is because the customer is going off the website to complete the transaction using paypal then they come back to the site and see their order number on the success page. How can I fix this to show the real traffic source? A screenshot can be seen here http://screencast.com/t/4RGvMuME


texts: images displaying in a site is not looking responsive

texts:
we are using follwing code to display images in this site:

http://demo1.kidsdial.com/

you can see 4 images below "slideshow" images but it's not looking responsive.

means in mobiles and tabs it's not arranged properly

means in smaller screen monitors, it's not displaying properly.

please help me what code changes I have to do to make it responsive?


texts:
I tried to call the class using construct method.

    <?php
namespace Vendor\Module\Helper;

class Data extends AbstractHelper

{

/**
 * @var \Magento\Framework\App\Config\ScopeConfigInterface
 * */
protected $scopeConfig;

/**
 * @var \Magento\Framework\App\Filesystem\DirectoryList
 * */
protected $_directorylist;
/**
 * @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress
 * */
protected $remoteAddress;
/**
 * constructor
 * \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
 * \Magento\Framework\Data\Form\FormKey $formKey
 * \Magento\Framework\App\Filesystem\DirectoryList $_directorylist
 * */
public function __construct(
    \Magento\Framework\App\Helper\Context $context,
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
    \Magento\Framework\App\Filesystem\DirectoryList $directorylist,
    \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
)
{
    parent::__construct($context);
    $this->_directorylist = $directorylist;
    $this->scopeConfig = $scopeConfig;
    $this->remoteAddress = $remoteAddress;
}

/**
 * @param $config_path
 * @return config_value
 * */
public function getConfig($config_path)
{
    return $this->scopeConfig->getValue(
        $config_path,
        \Magento\Store\Model\ScopeInterface::SCOPE_STORE
    );
}

/**
 *
 * @return media_path
 * */
public function getMediaPath()
{
    return $this->_directorylist->getPath('media');
}

/**
 *
 * @return string
 * */
public static function getMagentoFormKey()
{
    // @codingStandardsIgnoreStart
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    return $objectManager->get('Magento\Framework\Data\Form\FormKey')->getFormKey();
    // @codingStandardsIgnoreEnd
}

//function to get the current user ip
public static function get_user_ip()
{
    return $this->remoteAddress->getRemoteAddress();
    // @codingStandardsIgnoreStart
    //$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    //return $objectManager->get('Magento\Framework\HTTP\PhpEnvironment\RemoteAddress')->getRemoteAddress();
    // @codingStandardsIgnoreEnd
}

}

I got this error Uncaught Error: Using $this when not in object context in /Applications/MAMP/htdocs/magento/app/code/Vendor/Module/Helper/Data.php:95

Can anyone please help to me for this?

Thanks


texts: Adding a block to login onepage checkout

texts:
I try to add an additional login option during the checkout process. At the moment, you have the username/password way. I want to add a button image to login via an OAuth process (in my case Github).

I found a way but it's not the best way. There is in the checkout/onepage/login.phtml template file, a call to get a block child named form.additional.info.

I tried to insert my own block in it in this way but it didn't work.

<checkout_onepage_index>
        <reference name="form.additional.info">
            <block type="core/template" name="login_github_button" as="login.github.button">
                <action method="setTemplate" ifconfig="github/config/enabled">
                    <template>github/customer/login.phtml</template>
                </action>
            </block>
        </reference>
</checkout_onepage_index>

I found a different way like it is done by the captcha module:

<checkout_onepage_index>
    <reference name="checkout.onepage.login">
        <block type="core/text_list" name="form.additional.info">
            <block type="core/template" name="login_github_button" as="login.github.button">
                <action method="setTemplate" ifconfig="github/config/enabled">
                    <template>github/customer/login.phtml</template>
                </action>
            </block>
        </block>
    </reference>
</checkout_onepage_index>

In this case, it works BUT the captcha won't be displayed.
How can I insert several blocks into form.additional.info block?

Thanks for your help

EDIT:

I found some reasons why the button is not displayed under the login fields when using the reference form.additional.info method. It is displayed in the checkout billing view instead.

The block form.additional.info is created by the captcha module
for the block checkout.onepage.login then it is also created for the
block checkout.onepage.billing
While generating the block in
Mage_Core_Model_Layout::_generateBlock() it searches the parent
block object of the block login_github_button. Instead of finding
the one of checkout.onepage.login, it finds one of the latest created: checkout.onepage.billing. The block is attached to this last one, instead of the log in one. Then I find my login button in the billing address view instead of the login view!!!
If I comment into the layout captcha.xml file the part about
checkout.onepage.billing my first solution works.

It's still not ok but I begin to find the reasons.


texts: Need to change the wording of an error message

texts:
i need to change the wording of a error message which is displayed in the edit information page in accounts  but i dont really know what file to find this error message in. I tried changing the message in validation.js but it didn't apply it to this page.

If you know what file I have to change in order to change the error message please let me know.


texts: Upgrade Magento while keeping all order data, sales data, ect

texts:
Is there a definitive way to upgrade Magento while keeping all order data, sales data, ect?

After setting up a staging environment and ensuring all extensions, ect. are working properly there will inevitably be orders placed, orders processed, ect. Is there a proper way to sync the data with the production installation?

An alternative way I've read about is to set up a staging area and essentially practice the upgrade while taking notes on all the fixes that need to be completed. Then put the site into maintenance mode and do the upgrade on in the production environment. Is this a viable solution?

Any insight is appreciated.


texts: Magento 2 - Use \Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser with multiple selections?

texts:
Using this code

$chooser = $this->_layout->createBlock('\Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser');
        var_dump(get_class_methods($chooser));

        $configChooser = [
            'button' => [
                'open' => __('Select Products'),
                'type' => '\Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser',
            ]
        ];
        $chooser->setConfig($configChooser)
            ->setFieldsetId($fieldsetData->getId())
        ->prepareElementHtml($productChooser);

I can get a pretty nice product selector for my custom field in my custom form, but i need it to be able to select several product. There is a chooser config that i can be able to set?


texts: Configurable product does not have sub-products magento 2

texts:
I am facing one problem with the configurable product.
I am using Magento 2.1.1 and when i open category page than it throws me below error.

  1 exception(s):
      Exception #0 (Magento\Framework\Exception\LocalizedException): Configurable product "red-wine-liqueur-vinegar" does not have
  sub-products

  Exception #0 (Magento\Framework\Exception\LocalizedException):
  Configurable product "red-wine-liqueur-vinegar" does not have
  sub-products
      #0 D:\xampp\htdocs\m2migration\demo\vendor\magento\module-configurable-product\Pricing\Price\ConfigurableRegularPrice.php(71):
  Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver->resolvePrice(Object(Magento\Catalog\Model\Product\Interceptor))
  When i am edit this configurable product from admin than it shows
  "Requested product doesn't exist".

Let me know if by using any query or programmatically we can resolve the issue.


texts:
I want to add some info text to every option under the attribute Color.

For example in Color with label Red I want to add the text "Color red is a color that we are using under the products...etc"

Can anyone help me how can I do that?

Thanks!


texts: Category not saving in back end after Migration from 1.9.3.2 to 2.2.3

texts:
I have migrated magento from 1.9.3.2 to 2.2.3.

I don't have more product but still i am not able to save category changes in magento 2.

After Press Save buttton "You saved the category." message displays but not changes are saved, even category name is not changing.

Please anyone knowing how to resolve this issue then let me know.

Thanks in advance.


texts: how to display a new root category except default category in magento 2.1?

texts: I got to display the same menu as the header menu on sidebar and I created another root category in admin. now I want to display the new root category's subcategories in the main menu(header menu).I am new to Magento and PHP programming. I would really appreciate it if someone tells me what to do step by step. I know I need to override some php classes for Mageno_Theme module which creates the header menu but I do not know how to do that.


texts: Image path not saving in database with Custom Module

texts:
I've created a custom grid module and now I am trying to create and upload image for the Form.php. When I save it the image it gets uploaded to the right location which is  but it does not save the path in the database.

I am following this thread Marius's Answer

Sorry I can not comment on Marius's post, I don't have enough reputation.
Can anyone help me with this please? Thank you in Advance.


texts: cannot get product collection via dependency injection in version Magento: 2.2.1

texts:
I am using Magento 2.2.1. I cannot get the product collection when i use dependency injection. I wonder if I have left out something that needs to be done. for example, do I need to feed the product object into the injection?

This is the code:

namespace Test\HelloWorld\Block;
class HelloWorld extends \Magento\Framework\View\Element\Template
{
    protected $_productCollectionFactory;

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        array $data = []
    )
    {
        $this->_productCollectionFactory = $productCollectionFactory;
        parent::__construct($context, $data);
    }

    public function getProductCollection()
    {
        $collection = $this->_productCollectionFactory->create();
        $collection->addAttributeToSelect('*');
        $collection->setPageSize(3);
        return $collection;
    }
}

?

Then on my phtml page I do this:

$productCollection = $block->getProductCollection();
foreach ($productCollection as $product) {
    print_r($product->getData());
    echo "<br>";
}

The page comes back with a black, no error messages, just a blank page.

However, if i use the object manager to get the product collection it works:
THE CODE BELOW WORKS

public function getProduct()
    {
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

        $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');

        $collection = $productCollection->create()
                    ->addAttributeToSelect('*')
                    ->load();

        return $collection;

    }


texts:
I was adding a new magento extension to our website.
After the install, this error happened.

The website and admin panel is now unusable.
We need to get our website back up ASAP.

Why did this error happen ?

And is this bad ?

Is there an easy fix ?

I am not very good at web, so any information and support would be appreciated.


texts: publish a new product or a new block on a certain date?

texts:
We need to publish a new product with some blocks on the home page on a certain date. can we do that with Magento? Any extension that would help it?

thanks


texts: add icon to tab in backend edit page magento 1.9.3

texts:
I'm using this to add tab:

$this->addTab('sliders_section_new', array(
            'title'     => Mage::helper('sm_cameraslider')->__('New Sliders'),
            'label'     => "".Mage::helper('sm_cameraslider')->__('New Sliders'),
            'content'   => $this->getLayout()->createBlock('sm_cameraslider/adminhtml_sliders_edit_tab_main')->toHtml()
        ));

I want to show an icon in the tab so I added below code:

""

but it not work. now it's showing

is there any way to add icon in the tab? thank for helping me.


texts: Magento resave all products that are in in price table

texts:
We face an issue that not all products with prices are saved in the catalog_product_index_price table.

So we want to resave all products that are not in the catalog_product_index_price.

How can we achieve that?

My current code just resave all products:

<?php

require_once 'abstract.php';

class Resave_Products extends Mage_Shell_Abstract
{
    public function run()
    {
        $collection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('*')

        foreach ($collection as $product) {
            $product = Mage::getModel('catalog/product')->load($product->getId());
            echo $product->getSku() . '';
            $product->save();
        }
    }
}

$shell = new Resave_Products();
$shell->run();?>


texts: Custom price in cart not working in Magento 2.3.1 observer

texts:
I am developing a magento site for furniture sale. I have some grouped products.

If a customer add 1 piece of any product of the group to cart, the special price will be added to cart.

If the customer add more than 1 piece of any product of the group to cart, the cost price will be added to cart.

Suppose, in grouped product, Product A has

regular price: $989.99
special price: $732.99
cost price: $669.99

If a customer add 1 quantity to the cart, the subtotal price will be $732.99 and if the customer add 3 quantity to the cart, the subtotal price will be 2009.97 ($669.99 * 3).

To do the funtionality, I have created a observer and set the custom price as cost price but it always add special price, not the cost price. Can anyone help me to figure out the issue?

Here is the events.xml:

**app/code/vendor_name/module_name/etc/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="customprice" instance="Vendor_name\Module_name\Observer\CustomPrice" />
    </event>
</config>

Here is the observer file: app/code/vendor_name/module_name/Observer/CustomPrice.php

<?php

namespace Vendor_name\Module_name\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;

class CustomPrice implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer) {

        $item = $observer->getEvent()->getData('quote_item');
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );

        $price = $item->getProduct()->getCost(); //set your price here

        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);
        $item->getProduct()->setIsSuperMode(true);
    }

}


texts:
I need to create a simple grid in admin section, which contains all orders filtered by customer's email. I can't figure it out how I can fill the grid with custom data. All the examples found online create a custom table and then populate the grid with the data retrieved by that table. I don't need it. I just want to get all orders filtered by customer's email as I mentioned before.
Thank you in advance.


texts: Cannot import customers with the right fieldvalue website/website_id

texts:
I cannot import a customer-csv if the ‘website’ field is missing, or empty or containing ‘ETK-shop’. This field has to contain the value ‘ADMIN’ Then the import goes well, without errors.

However, if the field ‘website’ contains 'ADMIN', the customer cannot log in. I need to change the value of ‘website’ field to ETK-shop for the customer to be able to log in. But this cannot be done via ‘Manage Customers’ (?). So I need to alter the field website_id in the table ‘mage customer entity’:

UPDATE `etkm01_mage1`.`mage_customer_entity` SET `website_id` = '1' WHERE `mage_customer_entity`.`entity_id` =8201;

This does not seem the right way to get it to work. So what am I doing wrong? How can I import customers with the right website/-id?


texts: User choosable mandatory (negative) surcharge

texts:
I wish to define a mandatory product with options which has a negative (percentual) price.

The "discount" should be visible in the cart.

Just to be specific: customers can choose a "product delivery time" (which is the time needed to actually "create" the product which is 100% personalized + the shipping time); let's say:

48h delivery you pay 100%
4 days you own a 20% discount
7 days 30% discount
...

Do you know a way to configure magento, an existing extension or a way to develop one for this?


texts: Magento 2 Programmatically stop decreasing stock qty while placing an order

texts: I don't want to decrease stock qty when order is placed. I know this can be done in admin by setting decrease stock to NO. But I want to change the update stock logic, so I need to know where can I programmatically stop decreasing stock qty in code.


texts:
I try (for a special site) to filter the product collection by access group.
The attribute is set in the backend by selecting one group or more, hence I have an array of the access group names available for the product.

How can I filter the collection, only leaving me with the products of the access group of the user accessing the site?

I get the current users group:

$roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
$role = Mage::getSingleton('customer/group')->load($roleId)->getData('customer_group_code');

and then try to filter:

$item_set = Mage::getModel('catalog/product')->getCollection()
        ->addCategoryFilter($category)
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('status', array('eq' => 1));
        ->addAttributeToFilter('access_group',  array('in' => array($role)));

Somehow I realise my approach might be wrong... but I'm a bit stuck :(
Any ideas how to achieve this?

[EDIT:]
Here's the full code:

<?php

$_category = $this->getDownloadsCategory();
$_helper = Mage::helper('catalog/category');

function getAccessGroupID($name){
    $data = Mage::getResourceModel('catalog/product')
    ->getAttribute('access_group')
    ->getSource()
    ->getOptionId($name);
    return $data;
}

function getItemsForCategory($catID){
    $roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
    $role = Mage::getSingleton('customer/group')->load($roleId)->getData('customer_group_code');
    $category = Mage::getModel('catalog/category')->load($catID);
    $item_set = Mage::getModel('catalog/product')->getCollection()
        ->addCategoryFilter($category)
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('status', array('eq' => 1))
        ->addAttributeToFilter('access_group',  array('finset' => $role))
        ->load();
    return $item_set;
}

function DrawTree($category) {
    $hlp = Mage::helper('vietload');
    foreach($category as $_category){
        $catId = $_category["entity_id"];
        $catName = $_category["name"];
        $category = Mage::getModel('catalog/category')->load($catId);
        print '
';
        print 'getUrl() .'">'. $catName .'';
        $items = getItemsForCategory($catId);
        if($items->count()>0) {
            print '
';
            foreach ($items as $item) {
                //var_dump($item->getAttributeText('access_group'));
                print '
getFullUrl($item) .'">'. $item->getName() .'
';
            }
            print '
';
            print '';
        }
        print '
';
    }
}

?>

        <?php echo $this->__("Downloads");?>

            <?php DrawTree($_category); ?>


texts: Local admin in xampp is redirecting to live site

texts: I have downloaded the live site and setup a local host in xampp. The localhost frontend is fine, but when I go to the admin (local) the browser redirects to the live site. What do I need to fix?


texts:
The answers that I found on Google was only available for the Catalog with a setPage($pageNum, $pageSize).

That didn't work on any other collections.

Any help Will be Appreciated


texts:
everyone, I am trying to get data in compare product using below class
Magento\Catalog\Helper\Product\Compare
It gives data on the customer account section, Cart, etc but not at the category listing page OR product detail page.
Did anyone face this before? Can anyone help me to resolve this issue? Any help would be appreciated. Thanks in advance


texts:
When trying to update some modules I'm getting this

$ sudo -u mysudouser ./mage list-upgrades

PHP Warning:  array_combine(): Both parameters should have at least 1 element in /chroot/home/conairin/conairindustries.com/html/downloader/lib/Mage/Connect/Rest.php on line 242
PHP Warning:  ksort() expects parameter 1 to be array, boolean given in /chroot/home/conairin/conairindustries.com/html/downloader/lib/Mage/Connect/Rest.php on line 243

list-upgrades: Access denied for @https://connect20.magentocommerce.com/enterprise/packages.xml

When I run

$ sudo -u mysudouser ./mage list-installed

I get quite a few extensions installed under

Installed package for channel 'enterprise' :


texts: Fatal Error - While upgrading magento 1.9.3.4 from 1.9.3.3

texts: Magento 1.9.3.4 is not upgrading, showing this fatal error. I've tried many times.


texts: How to close the current tab in magento 2 custom page?

texts: I have created one custom page .In this page one link is there ,while clicking the link I need to close the custom  page .how can we achieve this?


texts: Magento is randomly resetting product inventory to 0

texts:
We have a client who has mentioned that inventory on certain items is randomly and magically getting reset to 0, even though it might have had an inventory level of 20 the day before. No, they're not getting 20 orders in one day to set the inventory to 0.

Has anyone experienced similar behavior before? What areas of the code should we look at that might cause such an issue? They only have stamps.com using the API, no other external apps are connecting to the site (aside from CC and shipping APIs).


texts: Magento 2 hide sidebar only in category view for mobile

texts:
I am trying to hide sidebar in my magento 2 instance with css only for mobile view and only in category view pages.
I tried:
@media (max-width: 767px) {
    .category-view .sidebar .sidebar-main {
        display: none;
    }

or
@media (max-width: 767px) {
        .category .sidebar .sidebar-main {
            display: none;
        }

but these don't work. Sidebar is still there
The only thing it works is :
@media (max-width: 767px) {
        .sidebar .sidebar-main {
            display: none;
        }

but this remove sidebar for whole site.
And I only need to remove the sidebar only in category pages.
Any ideas please?
Is there a way to define classes for define category page sidebar only?


texts: Get data from Quote_items table in Magento 2

texts:
I am new to Magento 2 so I do not understand much about select data from the table in Localhost also which file I need to create

I want to display data from Quote_item table

in the .phtml file, and What I need to do in Block and xml file

If anyone can help me step by step, it's very useful for me


texts: Magento 2 Countdown timer with background image

texts:
I´m using magento 2.1 and I want a countdown timer with a custom background image but I can´t find any FREE countdown timer that actually do what I want.

I want exactly like this:

If someone know how can I do this please comment !
Thank you


texts: Magento 2 integration test in admin context

texts:
I'm writing an integration test for Magento 2 where I have to emulate the admin area.

To do so, I use the @magentoAppArea annotation:

/**
 * @magentoAppArea adminhtml
 */

However, some things did not work as expected and I found out that the current store id is set to "1" (default store) instead of "0" (admin store)

Here's a failing test as minimum example:

/**
 * @magentoAppArea adminhtml
 */
public function testAdminarea()
{
    $storeManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
        ->get(\Magento\Store\Model\StoreManagerInterface::class);
    $this->assertEquals(0, $storeManager->getStore()->getId());
}

How do I set up this test correctly?

What I found during debugging:

Magento\TestFramework\Application::loadArea('adminhtml') is triggered correctly.
The store id is first initialized in Magento\Store\Model\StoreResolver::getStoresData():

$cacheKey = 'resolved_stores_' . md5($this->runMode . $this->scopeCode);
$cacheData = $this->cache->load($cacheKey);

Where $this->runMode is "website" and $this->scopeCode is "null".


texts:
I have a bundle product, with 10 of the same simple product in, i.e. a 10 pack of SKU.
This is set up as dynamically priced as we need the prices to be written to the flat_order_item table for the SKU line, not the bundle line.

I have set up a tier price for 10 in the simple product.

Everything works fine apart from the price in the category listing does not display properly - it displays a price of 10 x the original price, not the tiered price.

The parameters for the bundled item are set to required, quantity of 10 and ticked as default.

To confirm, the correct price displays on the product view page, but not the category page.

Any help appreciated.


texts: How to turn off/disable cache tag programmatically

texts:
When I disabled block_html cache tag then my code works fine.

I want to know how I can disable block_html programmatically in Magento for footer.phtml file?


texts: Customer able to select Package of product

texts:
How to give a option to customer, to select package option?

Options like

Normal Package
Extra Package [5% of product price]


texts:
I am looking at the concept of the object manager, but I didn't get any proper explanation about that. I also have gone through the below link, but they are just explaining the usage, etc..

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/object-manager.html

But I want to know what is the object manager in magento2.
Thanks in advance for your better support


texts: How to call Pre dispatch event on all front side pages in magento 2?

texts:
How to call pre dispatch event before all the front-side pages and it's action.

Let's say Before front side index page or product detail page is load. i want a event before all the front-end action.

  Even before Index page load.

How to achieve that ?

Note :

I want to call my dispatch event before all the front end actions, whenever any front action calls - it should call my dispatch event first.

Eg- Before Index page, CMS pages, every single front-end pages.


texts: not showing last sub category on left sidebar.


texts: Observer: Use of die language construct is discouraged

texts:
I have submitted one module in the Magento Marketplace. I got error:

  "Use of die language construct is discouraged".

Module is written by another programmer, I don't know how to change it to fix the problem.

I tried to find solution. Standard recommendation is using setBody(). But the Observer class does not have this method.

Code of invalid class:

use Magento\Framework\Event\Observer as EventObserver;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\DataObject as Object;

class RenderPopup implements ObserverInterface
{
    protected $_request;

    public function __construct(
        \Magento\Framework\View\Element\Context $context
    ) {
        $this->_request = $context->getRequest();
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if ($this->_request->getParam('quickview')) {
            if ($observer->getEvent()->getElementName() == 'main') {
                print_r($observer->getEvent()->getTransport()->getData('output'));
                die;
            }
        }

    }
}


texts: On account pages , In My order section Print order page not showing order detail

texts: In  Customer account . All order are showing correctly and And when I get on specific order it aswell showing its detail but  when I click on print my order . Page is shown like this. Item order record and amount is not showing.  Why this happening any idea ? or where is this file I can get to check ?


texts: Override base empty.xml file to rename the page-wrapper class

texts:
I am creating a magento theme based on the magento/blank theme, and I am trying to change the opening div's class from page-wrapper to container.

Attempt
I tried to create a file in /app/code/myvendor/theme/Theme/view/layout/override/base/empty.xml with the intention it would replace the file in /app/code/Magento/Theme/view/base/page_layout/empty.xml allowing me to change the class but nothing happened.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <container name="root">
        <container name="after.body.start" as="after.body.start" before="-" label="Page Top"/>
        <container name="page.wrapper" as="page_wrapper" htmlTag="div" htmlClass="container">
            <container name="global.notices" as="global_notices" before="-"/>
            <container name="main.content" htmlTag="main" htmlId="maincontent" htmlClass="page-main">
                <container name="columns.top" label="Before Main Columns"/>
                <container name="columns" htmlTag="div" htmlClass="columns">
                    <container name="main" label="Main Content Container" htmlTag="div" htmlClass="column main"/>
                </container>
            </container>
            <container name="page.bottom.container" as="page_bottom_container" label="Before Page Footer Container" after="main.content" htmlTag="div" htmlClass="page-bottom"/>
            <container name="before.body.end" as="before_body_end" after="-" label="Page Bottom"/>
        </container>
    </container>
</layout>

How can I achieve this? Thanks in advance!


texts: Magento 2 URL rewrite appending .html.html

texts:
I've migrated my store from version 1.9 to 2.1.1 using a tool.

However all the old products are appending html.html at the end of the URL. I basically truncate the url_rewrite table and saved all the categories. That created new URLs.

It looked good for few days, but now slowly I am noticing that some URLs are changing again to html.html.

This is not good for any business. It looks like when I create a new category or edit an existing category, all the products are being affected.

The new products entered into 2.1.1 are not affected by this bug — only the old ones I migrated from 1.9.


texts:
i have my custom menu of my cutom module.

I have this:

<menu>
   <holamundo module="holamundo">
    <title>Hola Mundo</title>
    <sort_order>71</sort_order>
    <children>
     <items module="holamundo">
      <title>Gestionar</title>
      <sort_order>0</sort_order>
      <action>holamundo/adminhtml_web</action>
     </items>
    </children>
   </holamundo>
</menu>

The menu appears but when I give the submenu, I forwarded to another page where the content is blank.
Can anyone tell me how to do something to show on this page?


texts: Dropdown quantity option, but only for specific product intervals

texts:
We're trying to sell items in packs of 10, but the inventory is managed as individual items, not packs. The client wants users to be able to select their order quantity via a dropdown that only displays multiples of 10. Any idea how to do this? I'm totally lost.

It's set up as a simple product if that matters.


texts: Missing Core Bundle Extension - Magento Integrity Scan?

texts:
I am missing a core module bundled with magento 2.4.X
I have failed to find anything that magento may offer like an integrity scan or verify core modules command that would let me resolve this issue in a simple manner. Due to it being a CBE, I am also not finding a composer or other command that will attain, in my case, the 2FA extension. I hope I can keep this generalized enough to help others by asking if there is a way to do an integrity check of magento core modules that leads to a repair?
My specific case is the 2FA module missing, where the Magento documentation declares the installation step is "you should already have this":

The 2FA extension installs when you install or upgrade to Magento Open Source or Commerce 2.4.X. The extension installs like a Core Bundled Extension (CBE).
https://devdocs.magento.com/guides/v2.4/security/two-factor-authentication.html


texts: Grid view column count for mobile devices

texts:
For desktop websites I've configured Magento to have 3 columns on category pages due to which when I see it on mobile devices, it shows 2 products in a row and 1 product in next row and it repeats the same again.

In list.phtml <?php $_columnCount = $this->getColumnCount(); ?> I can update $_columnCount with 2 but again it will affect desktop devies.

I want to set 2 columns for mobile devices and 3 columns for desktop. How I can achieve it?


texts: Magento 1.9.1 After changing the order address from admin notification, mail is not going to customer

texts:
In Magento 1.9.1, I have placed an order for a wholesale customer from the admin. The customer receives an email of new order placement. After placing the order I notice the shipping address which I have selected is wrong.

I edit the shipping address and check on all the 3 checkboxes (Recalculate, Notification[customize],confirm update) below the update button. I have written a note on Notification [customize] section also. After clicking on update the message display “Order update, not yet applied. Customer has been sent an email with a confirmation link. Updates will be applied after confirmation.”

But the customer didn’t get any mail related to address change. We have used mandrill for sending a mail. I have checked is mandrill outbound but seems that the mail is not triggered from the Magento. Other than this all the other mail is going to customer. Can anyone please tell me what is the problem? Why the address change/notification mail is not triggered from Magento ?


texts: How to get simple product by attribute IDs

texts:
I have been searching and cannot find the answer to this!

I have the following data being sent to my controller:

{
  "93":"52",
  "142":"173",
  "product":"1799"
}

The product key is the configurable product ID. The 2 numeric keys are attribute_id: atrribute_value_id.

How do I go about loading the simple product based on these details?

Using version 2.1.5

Update

This is actually the same (minus a couple of irrelevant details) as what Magento uses to add a configurable product to the cart from the category listing page. So what I am asking is definitely possible!

I have tried tracing the steps that Magento goes through from /checkout/cart/add but I am not seeing HOW Magento does this.

Another Update as there is no activity on this question

I have got the following code working to get the attribute codes and child IDs from the configurable parent. Can anyone come up with a way to filter these children by the attributes?

$attr = $this->eavAttribute->get('catalog_product', 93);
$attributeCodes[] = $attr->getAttributeCode();

$attr = $this->eavAttribute->get('catalog_product', 142);
$attributeCodes[] = $attr->getAttributeCode();
$product = $this->productRepository->getById($productId, false, $storeId

if ($product->getTypeId() == 'configurable') {
    $ids = $this->configurable->getChildrenIds($productId);
}

PS

I hate to complain but my questions on here hardly ever get any attention at all and this is no different. I am starting to lose hope in magento.stackexchange as it seems like nobody comes on here to answer questions. I know there are Magento 2 gurus out there, but where are you?


texts: Cannot get get sub category to auto expand?

texts:
when I click on a menu, on the left side that has category that the user can expand however I would like to expand automaticall.  I'm using a template from template monster and found a file under app\design\frontend<your_company><your_theme>\Magento_LayeredNavigation\templates\layer\
there is file there called, view.phtml. I'm trying to understand the code and I think this chunk here might be the key.  I tried changing "active": false to true but that does not seem to do anything. Anybody have a hint as well?  thanks!
<?php foreach ($block->getFilters() as $filter): ?>
                <?php if ($filter->getItemsCount()): ?>
                    <?php if (!$wrapOptions): ?>
                        <?php /* @escapeNotVerified */ echo __('Shopping Options') ?>

                    <?php  $wrapOptions = true; endif; ?>

<?php /* @escapeNotVerified */ echo __($filter->getName()) ?>

<?php /* @escapeNotVerified */ echo $block->getChildBlock('renderer')->render($filter); ?>

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


texts:
Can anyone explain me the memcache session parameters used to save Magento sessions in Memcache?

tcp://XX.XX.XX.XX:11211?persistent=1&weight=2&timeout=10&retry_interval=10

Also are there any more parameters allowed besides these 4 general?


texts: Magento 1 script to get customers wishlist

texts:
I want to create a script to get a list of all customers and their items inside their wishlist.

How can we achieve this in our Magento 1.9.4.1 store?


texts: How to remove only Total Tax from invoice pdf?

texts:
I am using Magento 1.9.3

I have enabled Display Full Tax Summary and its working fine. I can see my VAT and TAX both in totals area.

But now I need to remove only Total Tax data from invoice PDF. (Screenshot)

Is it possible to remove Total Tax data only form PDF?


texts: Magento 2: How can I overwrite Zend_Validate_Hostname class

texts:
How can I overwrite zendframework1/library/Zend/validate/Zend_Validate_Hostname class?
I need to overwrite to add hostnames in

$_validTlds

The reason is the following error:

"Email" no es un nombre de host válido.
'sfr.fr ' parece ser un nombre de host DNS, pero no podemos coincidir con el esquema de nombre de host para TLD 'fr '.
'sfr.fr ' no parece ser un nombre válido de red local.


texts: Product attribute not visible in admin , when creating configurable product

texts:
I have created select type product attribute programmatically and set it source option custom from another model. it is working fine, options are visible in attribute detail. But when creating the configurable product then this attribute is not visible there.

I have set all possible options.


texts: How to deal with variable weights on invoicing?

texts:
Imagine that a webshop is selling bulk paper and that a customer wishes to purchase 50,000 sheets. However, when the supplier completes their production the final quantity may actually be 54,000 sheets.

This can affect weight and therefore the cost of delivery.

The webshop will invoice on final quantity/weight so sometimes the invoice quantity may vary to the order and order acknowledgment.

I was wondering if anyone had any advice or experience of dealing with such a challenge?

I thank you greatly in advance for your kind help.


texts: Magento:products images are not displaying on New store

texts:
I created sub-store and displayed all products on all new stores as:
Go to your manage products page, click select all, change the action dropdown to say "Change Attributes" and click submit. Then, on the websites tab, make sure your new site is checked in the "Add Product to Websites" area, and click save.

Requirement: All set well but products images are not displaying same like main website.Hoe to display images on product-list and product-detail pages?


texts: i am unable to open the admin login panel in chrome ,but the admin login panel is working in Firefox ,  thanks in advanve.


texts: Magento 2 Custom customer address field save issue

texts: I've created new module for add custom address attribute. It looks getting me required validation error when i click place order button. This issue due to not assign custom attribute value in customer address model. Does anyone know how to set this custom value in customer address attribute?


texts: gmap store locator shows NoApiKeys found

texts:
I already have a magento and drupal website having gmap store locator and was working fine but from last two day, it is showing error. If i will generate a new api key does it will effect the existing module

Google Maps API warning: NoApiKeys ??

any guess ???


texts: How to update the layout file in observer

texts:
public function CodeOrdeStatus(Varien_Event_Observer $observer)
        {
            $order = $observer->getEvent()->getPayment()->getOrder();
            $order=Mage::getModel('sales/order')->load($order->getEntityId());
            $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true);
            $order->setStatus("canceled");
            $order->save();
            Mage::log($order->getState(),true,'cancelorder.log');

        }

i want to update the my custom layout file inside this event

<checkout_cart_index>
    <reference name="content">
      <block type="orderscancel/index" name="orderscancel_index" template="orderscancel/cart.phtml"/>
    </reference>
</checkout_cart_index>

I tried

Mage::app()->getLayout()->getUpdate()->addUpdate('Mage::app()->getLayout()->getUpdate()->addUpdate('<reference name="head">
            <action method="addJs">
                <js>path/to/rahul.js</js>
            </action>
        </reference>
    </default>');
    Mage::app()->getLayout()->generateXml();

I have used the event sales_order_payment_cancel in config.xml

<events>
    <sales_order_payment_cancel>
        <observers>
            <change_order_status>
                <class>Ipp_Orderscancel_Model_Observer</class>
                <method>CodeOrdeStatus</method>
            </change_order_status>
        </observers>
    </sales_order_payment_cancel>
</events>

But it didn’t worked, please help me.
Thanks


texts: magento2 get custom product attribute on order success page

texts:
I have a magento 2.2.5 based website and i need to get a custom product attribute on my order success page for each product. The custom attribute is called site_owned_buy any suggestions how to get it on the below code for each product I loop through

<?php
      $ga_data = [];

      foreach ($order->getAllVisibleItems() as $item) {
          $ga_item = array(
              'name' => $item->getName(),
              'sku' => $item->getSku(),
              'qty' => $item->getQtyordered(),
              'price' => $item->getPrice()
          );

          array_push($ga_data, $ga_item);
      }

      $subtotal = $order->getSubtotal();
      $order_id = $block->getOrderId();
      $gtotal = $order->getGrandTotal();
      $address = $order->getBillingAddress()->getData();
      $city = $address['city'];
      $state = $address['region'];
      $country = $address['country_id'];
      $shippingVal = is_null($order->getShippingAmount()) ? 0 : $order->getShippingAmount();
      $taxAmount=$order->getTaxAmount();

    ?>

  <script type="text/javascript">

   dataLayer.push({
        'event': 'purchase',
        'ecommerce': {
          'purchase': {
            'actionField': {
               'id': '<?php echo $order_id; ?>',                      // Transaction ID. Required for purchases and refunds.
               'revenue': '<?php echo $gtotal;?>',            // Total transaction value (incl. tax and shipping)
               'tax':'<?php echo $taxAmount;?>',                     // Total tax value
               'shipping': '<?php echo $shippingVal;?>',          // Total shipping value
               'coupon': ''                           // Optional field and may be set to empty string

        },
        'products': [
            <?php foreach ($ga_data as $item)
                  {
            ?>
              {
                'name': '<?php echo $item['name']; ?>',                      // Name or ID is required
                'id': '<?php echo $item['sku']; ?>',                          // Name or ID is required
                'price': '<?php echo $item['price']; ?>',                    // Insert product price
                'brand': '',                    // Insert product brand
                'category': '',              // Insert product category
                'variant': '',                // Insert product variant (e.g. red, black, etc.)
                'quantity': '<?php echo $item['qty']; ?>',                      // Insert product quantity
                'coupon': '',                          // Optional field and may be set to empty string
                'site': ''
            },
  <?php
    }
?>
           ]
    }
}
});


texts: How to add default value for attribute of configurable product

texts:
My configurable product have 2 attributes (size, color).
When customer visit product detail page, I want to set default value (first value) for size and color.

Example:
Product1: size(X,M, L), color (RED, BLUE, WHITE).

Customer access to product detail page -> Size M and color RED are selected.


texts:
I don't want any of Magento's banners to appear on my site.  Without altering the core theme, how do I remove all banner blocks?  I assume this is another magical Magento xml layout incantation?

This doesn't work: <remove name="banner" />


texts: Using different table alias with getCollection()

texts:
I'm trying to build a subquery using Zend/Magento's way to build queries.

I'm getting the collection this way: $collection = Mage::getModel('sales/order_item')->getCollection();

This will generate the SQL similar to this one:

SELECT `main_table`.* FROM `sales_flat_order_item` AS `main_table`

It there any way to set a different table alias instead of main_table?

In other words, is there any way to specify the custom alias for the table in collection.


texts: Magento 2 - I am facing this every time I run upgrade and deploy command after applying changes

texts:
Each time I deploy some changes and  run,

upgrade
compile
deploy
reindex
cache clean

commands I face these issues?

Anyone ??

I have deployed child theme and after that, I have run these commands


texts:
How to change max-width in the product gallery in Magento 2 by using below code.

<div class="fotorama__stage__shaft fotorama__grab" tabindex="0" data-gallery-role="stage-shaft" style="width: 684px; margin-left: 0px; transition-duration: 0ms; transform: translate3d(0px, 0px, 0px); max-width: 572px;"

Any advice?


texts: Magento 2: Work Around for Loading Static Assets from Symlinks?

texts:
I just discovered that the official Magento 2.0 release (post public beta) doesn't support loading static assets from a symlinked folder.  The root of the problem appears to be here

#File: vendor/magento/framework/View/Design/FileResolution/Fallback/Resolver/Simple.php

if ($this->rootDirectory->isExist($this->rootDirectory->getRelativePath($path))) {
    return $path;
}

The call to $this->rootDirectory->getRelativePath fails if the file doesn't exist under the root Magento directory.  So, if you've created a symlink for your module folder

lns app/code/My/Module /path/to/my/other/repository/My/Module

the static file loader application won't be able to find your file.

Does anyone know a workaround for this that doesn't involve

running php bin/magento setup:static-content:deploy whenever you change a file
hacking some code directly into vendor/magento/framework/View/Design/FileResolution/Fallback/Resolver/Simple.php to specifically handle your symlink-ed files


texts:
In view file what does this stand for :

<?= $block->getChildHtml('', true) ?>

From where this get the child html


texts: Magento2.3: Price slider without using extension

texts:
Has anyone customized the price slider without using the extension?

If yes, please help me.

I'm using Magento2.3 enterprise edition.


texts: magento 2 popup model need to open only one time on whole webiste after login or subscribe

texts:
I created a magento 2 pop-up it is working great. I have included a newsletter form in this pop-up .Problem is that pop-up is repeated after refers button.Problem is this ,

I want open pop-up only one time .

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

Subscribe for Our exclusive offer

Be the first to know about new arrivals exclusive offers and promotions

    <?php echo $block->getLayout()->createBlock('Magento\Newsletter\Block\Subscribe')->setTemplate('subscribe.phtml')->toHtml();?>


texts: each() function deprecated php 7.2 , magento 2

texts:
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /vendor/magento/zendframework1/library/Zend/Cache/Backend.php on line 79

this function showing on this line

   while (list($name, $value) = each($directives)) {
        if (!is_string($name)) {
            Zend_Cache::throwException("Incorrect option name : $name");
        }
        $name = strtolower($name);
        if (array_key_exists($name, $this->_directives)) {
            $this->_directives[$name] = $value;
        }

    }


texts: Magento 2.2.4: Could not save product "3395" with position 1 to category 1882

texts:
I am using Magento 2.2.4. Assigned a product to two categories. One of the categories is a child of the other. Following error is thrown while saving the parent category after removing the product association from it.

  Could not save product "3395" with position 1 to category 1882

Can you please suggest how to resolve this issue?


texts: How to set filter_index for a column which is not in the database table?

texts:
My code is as follows. Everything works fine except the filteration of new column which shows abandoned cart item names comma separately.

I have overridden the block Mage_Adminhtml_Block_Report_Shopcart_Abandoned_Grid.

protected function _prepareCollection()
    {
$collection = Mage::getResourceModel('reports/quote_collection');

        $filter = $this->getParam($this->getVarNameFilter(), array());
        if ($filter) {
            $filter = base64_decode($filter);
            parse_str(urldecode($filter), $data);
        }

        if (!empty($data)) {
            $collection->prepareForAbandonedReport($this->_storeIds, $data);
        } else {
            $collection->prepareForAbandonedReport($this->_storeIds);
        }

        $this->setCollection($collection);
        Mage_Adminhtml_Block_Report_Grid_Shopcart::_prepareCollection();
//------------------ my modifications---------------
// This was done to show item names comma separately in the abandoned cart grid as a new column.
foreach($collection as $col)
       {
           $itemcollection = $col->getItemsCollection();
           $products = array();
           foreach ($itemcollection as $item)
           {
               $products[] = $item->getName();
           }
             $productname = implode( " , ", $products);
             $col->setQuoteItemName($productname);
       }
//------------------ my modifications---------------

   return $this;
}

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

    $this->addColumnAfter('quote_item_name', array(
            'header'    =>Mage::helper('reports_abandonedcart')->__('Item(s) Name'),
            'index'     =>'quote_item_name',
            'filter_index'=>'sales_flat_quote.quote_item_name', // What should be here
            'sortable'  =>false
        ),'items_qty');

        return Mage_Adminhtml_Block_Report_Grid_Shopcart::_prepareColumns();
}


texts: Magento 2: Update Multiple Tables At Once

texts:
In Continue with

Magento 2: How many tables required to change Order Status Programmatically?

I have below code

$orderIds = array();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderCollection = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\Grid\Collection');
$update = $orderCollection->update('sales_order_grid', ['status' => 'complete',], ["entity_id", ["in" => $orderIds]]);

$orderCollection = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\Collection');
$update = $orderCollection->update('sales_order', ['status' => 'complete',], ["entity_id", ["in" => $orderIds]]);

Can i update at both tables at 1 time or one go like https://stackoverflow.com/questions/8765490/mysql-update-two-tables-at-once

Looking for answer in Magento 2 Way, if above is possible


texts:
i'm new with magento 2. I want to load products by id, and then change the price for each products.

Phtml :

for ($i=0; $i < count($csv3); $i++) {
    $product=$this->getLoadProduct($csv3[$i][0]);
    $product->setPrice($csv3[$i][1]);

    try {
        $product->save();
    } catch (Exception $e) {
        echo "<pre>" .$e. "</pre>";
    }
}

Block :

public function getLoadProduct($id)
{
    return $product = $this->productRepository->getById($id);
}

$csv3 is a variable contain data from reading csv file, csv3[x][0] is id, and csv3[x][1] is price.
I'm trying to update the price of each product with code above, but nothing happen.
Is there any solution for updating multiple product by id?


texts:
Why my block admin show 2 grid view in magento 1.9.2

<?php

class Ig_Tobi_Block_Adminhtml_Page extends
Mage_Adminhtml_Block_Widget_Grid_Container
{
    public function __construct()
    {
        $this->_blockGroup = 'ig_tobi';
        $this->_controller = 'adminhtml_page';
        $this->_headerText = Mage::helper('ig_tobi')->__('Page');
        parent::__construct();
    }
}


texts: magento get bundled product if from its product id

texts:
i want to get bundled product id made using product ids.

suppose there is bundled product A made using product B and product c

i want to get product A , given ids of Product B and C.

How can i proceed


texts: redirect to the product url from observer or controller magento 2

texts:
i want to redirect from observer to the default magento product url from observer.

public function __construct(
            \Magento\Framework\App\ResponseFactory $responseFactory
        ) {

              $this->_responseFactory = $responseFactory;
        }

        public function execute(Observer $observer) {

                $productUrl = $currentProduct->getProductUrl();
                //$RedirectUrl= $this->_url->getUrl('chennaievent\index\index');
                return $this->_responseFactory->create()->setRedirect($productUrl)->sendResponse();

            }

        }


texts: Empty Cart and Add the Selected Product/Item

texts: I want that the all product/item on the cart will be empty and add the current selected product/item on the cart. Could the be possible?


texts: Products not displaying on categories after Reindex confirms

texts:
Setup Magento 2.4
Using a service to import products from an magento 1.9 site into magento 2.4, all products (including test product before the import) is no longer showing on the categories. Look at the database I can see that the reindex has the correct information and elasticsearch is up and running.
Using https://github.com/Itonomy/magento2-product-visibillitygrid, I can confirm that everything setup correctly for the product to show on the fronend.


texts: Magento 2 - How to integrate Wordpress into Magento 2 system

texts:
In Magento 2, how to integrate Wordpress? And create new menu for the posts.
I found this solution (here and here) for magento1.x. Please show me step by step.Thanks!


texts: Magento 2: Get the qty of products before added to cart

texts:
I'm trying to get the qty of products in a plugin with a method called beforeAddProduct, with this method I can manipulate things before being added to cart.

I need to check that the qty added to cart is 24 or 7, not less not more, in a Bundle product.

This is my code:

class Plugin
{
    protected $_attributeRepository;
    protected $logger;
    protected $cart;
    /**
     * @var \Magento\Quote\Model\Quote
     */
    protected $quote;

    /**
     * Plugin constructor.
     *
     * @param \Magento\Checkout\Model\Session $checkoutSession
     */
    public function __construct(
        \Magento\Checkout\Model\Session $checkoutSession,
        Logger $logger,
        AttributeSetRepositoryInterface $attributeRepository,

    ) {
        $this->quote = $checkoutSession->getQuote();
        $this->logger = $logger;
        $this->_attributeRepository = $attributeRepository;
    }

    /**
     * beforeAddProduct
     *
     * @param      $subject
     * @param      $productInfo
     * @param null $requestInfo
     *
     * @return array
     * @throws LocalizedException
     */
    public function beforeAddProduct($subject, $productInfo, $requestInfo = null)
    {

        $attributeSetRepository = $this->_attributeRepository->get($productInfo->getAttributeSetId());
        $attributeSetName = $attributeSetRepository->getAttributeSetName();

        if($attributeSetName == "7barrios-packs-personalizados"){

            $items = $this->quote->getAllItems();
            $totalProducts = 0;
            foreach($items as $item) {
                $this->logger->info("Name: ".$item->getName());
                $this->logger->info("Quantity: ".$item->getQty());
                $totalProducts += $item->getQty(); //THIS IS WHAT I NEED TO GET
             }

             if ($totalProducts < 24) {
                throw new LocalizedException(__('Add 24 products from bundle!'));
            }
        }

        return [$productInfo, $requestInfo];
    }
}

I only can get the qty of products when they are in cart, but nof before in this method, what can I do?

Can $subject or $productInfo give me the qty of products?

UPDATE

I'm still not able to get the qty products but found that the original method uses getQtyRequest() for getting qty.

I'm trying this, but I'm getting nothing, any ideas?

   public function beforeAddProduct(Cart $subject, $productInfo, $requestInfo = null){

       $product = $subject->getProduct();
        $request = $subject->getQtyRequest($product, $requestInfo);
        $this->logger->info("Product QTY REQUEST BEFORE: ".$result);

        return [$productInfo, $requestInfo];
    }

Greetings!


texts: Which is the event when product is clicked

texts:
I want to create observer ,when a product is clicked ,can you tell me which is the event and how can I see in my observer code which product was clicked and to get information about it ?

This is my config.xml :

<?xml version="1.0" encoding="UTF-8"?>
<config>
        <modules>
        <Solvingmagento_OrderExport>
            <version>0.1.0</version>
        </Solvingmagento_OrderExport>
        </modules>
        <global>
        <events>
            <catalog_controller_product_view>
            <observers>
                <custom_catalog_controller_product_view>
                    <class>solvingmagento_orderexport/observer</class>
                    <method>observerProductClicked</method>
                </custom_catalog_controller_product_view>
            </observers>
        </catalog_controller_product_view>
        </events>

        <helpers>
            <orderexport>
            <class>Solvingmagento_OrderExport_Helper</class>
            </orderexport>
        </helpers>
        </global>
    </config>

and my Observer.php :

class SolvingMagento_OrderExport_Model_Observer{

public function observerProductClicked(Varien_Event_Observer $observer)
{
    $product = $observer->getProduct();
    // Do what you want with the product
    echo $product;
    var_dump($_SERVER);
    die('chekc');
}

}


texts: Magento 2.4.2 Root Plugin and Composer 2 Question

texts:
We ran to following command in Magento 2.4.2 $ composer require magento/composer-root-update-plugin=~1.0 --no-update to install the plugin, just to be prepared for upcoming Magento releases. Composer version is 2.0.11.
Then we ran: $ composer update
Now composer outdated shows the following, should we take action in some way on the red highlighted?

Thank you,


texts: How to hijack a button's click event with my own ajax get function? Magento 2

texts:
I am tying to add a new button to an existing admin page.
I want to call an ajax get() function on this button click.
I created a main.js script file which I see is loading on this page since when I do a console.log the code gets here.
Though there's another script file that is "hijacking" this button's click.
Instead of my ajax function being triggered from main.js, another JS function is being triggered from a require_js.phtml file.

The code in require_js.phtml file:

<?php
?>
<script>
var BASE_URL = '<?=/* @noEscape */$block->getUrl('*')?>';
//var FORM_KEY = '<?=/* @noEscape */$block->getFormKey()?>';
var require = {
    "baseUrl": "<?=/* @noEscape */$block->getViewFileUrl('/')?>"
};
</script>

This is the JS ajax function I am trying to trigger from main.js but is getting "hijacked". Though console.log("jivet click"); is being logged.

$("#jivet").click(function() {
    console.log("jivet click");
    $.get(
        "https://online.jivet.com/api/index.aspx?action=GetAllDIDs",
        function(data) {
            console.log("page content: " + data);
        }
    );
});

I see in the network tab in chrome that the ajax get call is being cancelled and the call from require_js.phtml is overtaking it.
Screenshot below
https://gyazo.com/f2a47526c6eaacffec72a7f075ba74ce


texts:
I have looked and tried methods in other topics but I cannot find anything that will work.

I want to keep my homepage organized and I would like to add "sections" like about us and contact section to the home page.

I tried adding the the code like

   {{block type="cms/block" block_id="about_us"}}

But isnt showing the content fromt he block. I tried doing it with a widget and it did show but it was stuck in the container and the bg image was not going full width.

Any help would be appreciated.


texts: Magento2 Create Order in Backend always same store

texts:
I have a Magento2 Installation with multiple Stores. Each Store has its own countries which are allowed to be selected. E.G. The Countries in Store 1 are disabled in store 2, and same behaviour the other way around.

So when i want to create a new order in the backend, i first have to select a store as you know, afterwards the address form is loaded, with the options delivered by the selected store (e.g. allowed countries, products whithin selected store etc.)

But there's one big issue: nomatter which store i choose, the form has always the same allowed countries even if they are explicitly disabled for the selected store.

So i started debugging the HTML generated on this page and found the problem.
The "selected" Store ID in this Form is always 0 Nomatter which store i choose. And i don't even have a Store with ID 0. I just know that in Magento2 Store ID 0 is some kind of imaginary Store, like for default values etc. but i am not really sure.

The Bug is on the following backend url:

test.com/admin/sales/order_create/

Has anyone of you experienced this bug or has an idea how to solve this problem?


texts: What is the best way to transfer Magento setup to another folder?

texts:
I have Magento in the store/ folder on my server. I want to be able to put it at the root. So that users don't have to see in the URL store/. I have already configured Magento.

So how can I bring my Magento setup to the root of my server?

Also is it the best idea? Or should I keep it in the store/ folder and use .htaccess to point to the store/ folder to remove the store/ from the URL?


texts:
Is there a callback that can be used (where a mixin can be added) for when a checkout step is displayed?
For example, there is the navigate function for each step that is called when the checkout is loaded directly to that step.
So if you access directly the url checkout/#some-step and there is a step with the code some-step then the function navigate from that step js file is called.

Is there similar for when a step becomes active?
Note: need this for a custom step, so I can change the code in that step without restrictions.


texts: How to display a phtml in a backend custom menu

texts:
I've created a new menu on the backend, called "X" with an item called "Y". When I click on this item, it appears nowhere because I don't know how to display it. Let me show you what I have done.

In the cotroller.php I have put this:

public function indexAction()
    {
 $block = $this->getLayout()
        ->createBlock('core/text', 'example-block')
        ->setText(‘Hello’);
        $this->_addContent($block);

        $this->renderLayout();
    }

For this code, if I click on the menu "Y", I get the output "Hello". Ok, but now I don't know how to call a phtml or something in order to display whatever I want.

I don’t know how to call another cms/block or something like that to watch it there. Using this code snippet:

$this->getlayout()->createBlock('cms/block')->setBlockId('my-cms')->to
Html();

(where my-cms is a cms page that I created before)

the output appears at the top, so it doesn’t work the way I want it to work.


texts: Changing Login text to Image + creating drop down for My account, Wishlist, Sign out and more.

texts:
A similar question was asked for Magento 1.9, trying it for Magento 2.0 broke my site. Looking for a more specific answer.

I am using Magento 2.1.5 -- I want to remove the Top links from all pages. Then using a block, i want to place a User Image(.png) or Icon next to shopping cart to create a drop down to login. If the customer is logged in, i want the drop down to have a list showing "My account", "My wishlist", "Other random links", and "Logout".

How would i go about doing this? Can i use CSS to dress this pop up?

Heres a picture of what i am looking to create. Any help would be greatly appreciated!


texts: set default value to field in customer information form

texts:
I'm using Magento 1.6.2 and I have a function that create a random unique email address placed at

app\design\adminhtml\default\default\template\widget\form\renderer\fieldset\element.phtml.

It's value set by default in email field when I create a new customer from Admin by adding that on elemant.phtml. Now I'm moving to magento 2 and looking for that page location on magento 2 so I can put the random uniqe email address and set the value once I click on add new customer. Any solution?