texts: Magento2 - Custom Admin Module with Grid Serializer - how to post more than 1 input fields

texts:
I have successfully implemented serialized grid in my custom module. Steps are same as this - Grid serialization in magento 2

However there is only 1 input field - position. I need 2 input fields - position and qty. But when i write 2 input_names only 1 field gets posted in POST data. I want data of both.

Here is what I have tried so far:

File:  /app/code/Vendor/Modulename/Block/Adminhtml/Customgrid/Edit/Tab/Gridfile.php

_prepareColumns function:

$this->addColumn(
            'qty',
            [
                'header'       => __('Qty'),
                'name'         => 'qty',
                'type'         => 'number',
                'validate_class'   => 'validate-number',
                'index'        => 'qty',
                'editable'     => true,
                'edit_only'    => false,
                'header_css_class' => 'col-qty',
                'column_css_class' => 'col-qty'
            ]
        );

    $this->addColumn(
            'position'
            [
                'header'       => __('Position'),
                'name'         => 'position',
                'type'         => 'number',
                'validate_class' => 'validate-number',
                'index'        => 'position',
                'editable'     => true,
                'edit_only'    => false,
                'header_css_class' => 'col-position',
                'column_css_class' => 'col-position'
            ]
        );

File: /app/code/Vendor/Modulename/view/adminhtml/layout/frontname_controller_action.xml

WAY 1

     <argument name="input_names" xsi:type="array">
            <item name="position" xsi:type="string">position</item>
            <item name="qty" xsi:type="string">qty</item>
     </argument>

WAY 2

      <argument name="input_names" xsi:type="string">position,qty</item>
       </argument>

WAY 3

      <argument name="input_names" xsi:type="string">position</item>
       </argument>

None of these work. First way only posts qty. Second way gives a blank page. Third way only posts position and not qty.

Any ideas as to what the correct syntax is ?

I have checked core files but all of them only use one input field.


texts:
This is sort of a follow up to another thread, since the issue is kind of its own issue compared to how I discovered the error.

I'm testing Fedex for Sandbox, but when I enter the sandbox account # and meter # . .  .they don't save.   I can see this is in the shipping log, where my original production account and meter number are being used with the NEW key and password.  I am entering all of these at the same time and of course saving, though obviously the meter and account # are NOT saving, or somehow it is defaulting back to my actual production account and meter #.

Not surprisingly fedex says that the account number is wrong.

So, I figure if I can get the account number saved properly I will have the issue licked.   Anyone heard of anything like this?


texts: Uncaught ReferenceError: optionsPrice is not defined

texts: After adding product.options.js in catalog product view i still get the error relating this. I am using configurable swatches with magic tool zoom.


texts:
I am searching for a way to make a  brand tree. I want to have a

  Manufacturer -> Brand -> Product line

For every single level I need to store a description and logo. Task will be easy to implement with categories, if there was no logo. I have been searching for some extension, there is a lot of extension for Shop by brand, but they do not support a tree structure.


texts: How to clear up the Dashboard stats in Magento 1.9, which shows a lot of total sales? I got hold of some mysql statements, but in Magento 1.9 the table names don't match.


texts:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

$_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;
require_once "app/Mage.php";
Mage::app();
umask(0);

try {

    echo('
Completed Order Info
');
    // M100210170 | M100210167 | M100210149
    $orderId = '10006-L4'; // this is entity id
    $order = Mage::getSingleton('sales/order')->loadByIncrementId($orderId);

    // To get some basic order details, subtotal, shipping cost, discount, tax and grand total.

    echo "order number: ".$orderId."
";
    echo "order subtotal: ".$order->getSubtotal()."
";
    echo "shipping: ".$order->getShippingAmount()."
";
    echo "grand total: ".$order->getGrandTotal()."

";

    $orderItems = array();
    $getTotal=0;
    foreach($order->getItemsCollection() as $item)
    {
        //$product = Mage::getModel('catalog/product')->load($item->getProductId());
        $parentIds = Mage::getSingleton('catalog/product_type_configurable')->getParentIdsByChild($item->getSku());
        echo "SKU = ".$item->getSku()."
# of Items in \$parentIds = ".count($parentIds)."
";
        if(count($parentIds)>0) {
            echo "
\$parentIds
";
            echo print_r($parentIds);
            echo "
";
        } else {
            echo "no items to return...

";
        }

        $row=array();
        $row['sku'] = $item->getSku();
        $row['price'] = $item->getPrice();
        $row['qty_ordered']= (int)$item->getQtyOrdered();
        $row['subtotal']= (int)$row['qty_ordered'] * $row['price'];
        $row['item_total']= $item->getRowTotal();
        $getTotal = $getTotal + floatval(((int)$row['qty_ordered'] * $row['price']));
        $orderItems[]=$row;
    }
    echo "\$getTotal = ".$getTotal."
";
    echo "All items in the order:

".print_r($orderItems,true)."

";

} catch (Exception $e) {
        Mage::logException($e);
}


texts: Adding a Block between Menu and Breadcrumbs

texts:
Going a bit nuts trying to get my head around this. Debug mode doesn't help me.

I'm trying to add a block just before the </header> on only Product Pages. I've created a phtml file with my content (banner). And I've added the below code to:

<theme>/<child>/Magento_Catalog/templates/layout/catalog_product_view.xml

<referenceContainer name="root">
        <block class="Smartwave\Porto\Block\Template" name="banner" template="Magento_Catalog::product/view/banner.phtml"/>
</referenceContainer>
<move element="banner" destination="header" after="-"/>

In my head, the above:

Loads Block in the root of the page with <referenceContainer name="root">
Then moves the Block to the header container: <move element="banner" destination="header"...
And puts it at the very bottom: ...after="-"/>

Clearly though, it does not. I've used a ton of trial-and-error with varying results. It either loads in places I don't want or doesn't appear at all.

Edit

It appears that </header> is part of header.phtml and so I cannot accomplish what I set out to to do.

However, I'd also be happy with the block loading BETWEEN </Header> and <div class="breadcrumbs">. This seems more achievable having looked closer at the code.


texts: How to detect product quantity change using observer in Magento 2.4.1?

texts:
We are using Magento 2.4.1 and we want to update the values of some custom attributes in the product whenever the product quantity is changed in the admin. Which events can be used to detect the quantity change?
One more question. If incase we create an observer event to change custom attribute values based on quantity changes then will the salable quantity/Magento's default MSI modules affect those custom observer events in any way?


texts: Magento API customer.create -> cart_product.moveToCustomerQuote

texts:
I created a User using the Magento API.
I then created a shopping cart and want to move this cart to the created costumer, but this errors as Customer's quote does not exist.

Moving the cart to an existing customer works fine!
If I login to the API created customer once and move the cart with its CustomerId it works too.

So is there an solution to create the Customer's quote over the API?


texts:
I have the following design below, in which it has plus and minus on the cart page and mini cart page.

I have achieved it in minicart but couldn't achieve it on the cart page.

can someone help to achieve this solution?


texts: Magento 2 :- Date Rang Filter modification in UI components

texts:
I used below code to display the delivery date now i want to call my custom file to filter the admin side grid section in sales order grid section.

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="sales_order_columns">
        <column name="delivery_date" class="Magento\Ui\Component\Listing\Columns\Date">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="visible" xsi:type="boolean">false</item>
                    <item name="filter" xsi:type="string">dateRange</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
                    <item name="dataType" xsi:type="string">date</item>
                    <item name="label" xsi:type="string" translate="true">Delivery Date</item>
                    <item name="dateFormat" xsi:type="string">MMM dd, YYYY</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>


texts: Varied Cart Discounts By Item based on Order Size

texts:
We have a "bulk discount" structure across our site as follows:
Spend $110 $249.99 - Get 5% Off
Spend $250 - $499.99 - Get 7% Off
Spend $500 - $1000 - Get 10% Off
Spend $1000+ - Get 15% Off
We have some items we want to only give the maximum discount of 7% to - I'm able to exclude these products from the 10% and 15% off rules above, and I created a new Rule to give these items a 7% discount on orders $500 and higher.
The problem I'm having is that the rules above are not giving the 10% discount at $500 if the excluded items are also in the cart.
For example, I have an order total of $600 and

$300 of the items on this order are to receive a 7% discount
$300 of the items on this order is to receive the 10% discount

In this instance, the rules apply the 7% discount to both items, although the items that qualify for the 10% discount should be receiving the discount due to the cart value.
What is odd is that the items that earn the 10% discount receive the discount UNTIL I add the items that receive only the 7% pricing - EVEN if the 10% discount item qualifies for a 10% discount on it's own - it receives a 7% discount once the 7% items are added to the cart.


texts: How to add custom zoom in magento 1.9.3.0

texts:
i've customized media.phtml to get all images in a grid of one column:
but in mouse hover only the base image is showed in zoom.
this is my code :


texts: How to Remove all tier prices from product and Add new tier prices in Magento 2.3.4

texts:
Currently I have a custom API to live feed the product tier prices with data like this:

[
   {
    "sku":"X772A5",
    "customer_group_id":"1",
    "website_id":"2",
    "qty":"5",
    "price":"500"
   },
   {
    "sku":"X772A5",
    "customer_group_id":"2",
    "website_id":"2",
    "qty":"2",
    "price":"450"
   },
   {
    "sku":"X772A5",
    "customer_group_id":"1",
    "website_id":"1",
    "qty":"5",
    "price":"490"
   },
   {
    "sku":"X8911V",
    "customer_group_id":"2",
    "website_id":"1",
    "qty":"2",
    "price":"120"
   }
 ]

The data contains the product ski , customer group ID, website ID, product qty for the tier price, and product price. I want to remove all the product tier prices and then I can insert this new tier prices data, how can I achieve this?

public function execute(){
  $datas = $this->getInputDatas();
  $this->removeTierPrices($datas);//???
  foreach($datas as $data){
    $product = $this->getProductBySku($data['sku']);
    $this->addTierPrice($product,$data);//??
  }
}


texts: Missing localisation modules? version 1.9.2.1

texts:
I’m working in a store with 2 views – EN and PT.

When I try the recover password, I receive a message in English on the screen in both views (If there is an account associated with abc@abc.pt you will receive an email with a link to reset your password.)

Where and how can I find this message to translate it?


texts: array of associated product with price in asc order

texts:
Code below gives me all associated products.

$this->getProduct()->getTypeInstance()->getUsedProducts()

what should I do in order to get sorted valued based on price in ASC order ?


texts:
I´m still figuring out how to not "reset" all catalog price rules every night.
As far as i read now the cron.php should be executed every night - it still isnt working.

When I´m executing the cron.php I´m receiving 27 Emails:

Cron error while executing magemonitoring_uberdog:

exception 'Mage_Core_Exception' with message 'Too late for the schedule.' in /www/htdocs/***/***/***/app/Mage.php:595
Stack trace:
#0 /www/htdocs/***/***/***/app/code/community/Aoe/Scheduler/Model/Observer.php(47): Mage::throwException('Too late for th...')
#1 /www/htdocs/***/***/***/app/code/core/Mage/Core/Model/App.php(1338): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#2 /www/htdocs/***/***/***/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#3 /www/htdocs/***/***/***/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#4 /www/htdocs/***/***/***/cron.php(74): Mage::dispatchEvent('default')
#5 {main}

All these 27 E-Mails got this exact content. I´ve googled it - seems no one got this problem. Could someone tell me anything about that? I dont even know what to ask exactly. Any tip would help me.


texts:
I need to create 200-300k orders with bogus information so that I can test some functionality of a Magento Connect module that I am creating. I need the purchased products to be products from my store, with registered customers from my store.

I have yet to find a tool to create orders en-masse. Any pointers would be welcomed!


texts:
I need some advice,

Is it safe to run php 5.3.3 on Magento 1.7.0.2.? How critically important to update to higher php? Given that all latest patches are installed on Magento.
I am concerned about updating to 5.4 or higher since I am not sure about compatibility.
What is the suggested php version for 1.7.0.2 ?

Please add your thoughts.


texts: how to enable disabled products via query?

texts:
Hi I want to enable all products I have in my Magento 2 store, is there any query to enable all products we have using a single sql query ?
Thanks


texts: Migrate customer accounts from Magento1 to Magento2

texts: I would like to migrations customer accounts from Magento1 to Magento2 so that customers can login with their account on the new shop. I tried the migration tool but it migrates everything. Is it possible to migrate accounts only ?


texts: Is Magento the right platform to sell individual files/serials?

texts:
I'm looking to set up a store that sells unique items. I'm looking to sell virtual downloadable items, however, I'd like each item to have a quantity but each item sold to come with a different file to download.

For example, I'm selling serial keys for my product, along with other things.

If a user buys the item, they should be emailed or send a download link to their serial key. However, I DONT want two people to get the same serial.

Would Magento be able to handle this? Or should I look for a different platform (if so, any suggestions?)


texts: How to save data from **System->Configuration->Section** Custom Moule in table(custom database))

texts:
I need some urgent information, I want to save data from my custom module in my database. I did some part but i don't know further Process. Please Help Me Guys.

This Is my system.xml file-

<config>
  <sections>
    <earthfedex translate="label">
      <class>separator-top</class>
      Fedex
      <tab>catalog</tab>
      <sort_order>400</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <groups>
                <settings translate="label">
                    General Settings
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>

                    <fields>

                        <active translate="label">
                            Enable Fedex Extension
                            <frontend_type>select</frontend_type>
                            <config_path>fedex/fedex_acc/active</config_path>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                       </fields>
                    </settings>

                     <fedex_acc translate="label">
                    Fedex Account Details
                    <frontend_type>text</frontend_type>
                    <sort_order>2</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <key translate="label" >
                            Key
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>

                    </key>

                      <pass translate="label">

                            Password
                        <frontend_type>password</frontend_type>

                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>

                   </pass>

                     </fields>
                 </fedex_acc>
             </groups>
         </earthfedex>
     </sections>
 </config>

I want to store values from 2 fields
1.Fedex Account Password
2.Password

How to do this?
If you want any information please let me know.
Thank You


texts: Install layouts and templates from the theme divante

texts:
I installed the theme https://github.com/DivanteLtd/magento2-rapid-theme, the theme got up, everything is in order, I don’t understand how to set the main page to make it as an example.

The topic has a folder Magento_Cms, and in it the layout folder and phtml blocks. How to add them to the main page?

Added while blocks in this way:

{{block class="Magento\Framework\View\Element\Template" template="Magento_Cms::new-collections.phtml"}}

But I have a suspicion that the layout file cms_index_index.xml is not used and maybe these phtml can be applied at once and just?


texts: How the cart price rule is applied in custom module?

texts:
I followed mageworx blog to add Conditions fieldset in my custom module and I added it successfully.

https://blog.mageworx.com/2016/09/magento-2-module-with-conditions-model-fieldset/

Now, how can I apply it to order complete observer?

Would anyone please help me?


texts: Uploading product csv error in magento 2

texts:
When I was uploading csv I got these two errors . Any one have any idea about it ? my csv is

  https://sheet.zoho.com/sheet/editor.do?doc=96cde2e067cfd3fb600a6fe212400e8f2dc9ec7b015954c9e13df329e60dbb813744b9f2db179ce26e228cc99bc7c6a5600a158559017002da05add882594b62

We can't find required columns: sku.

Column names: "Sku", "Highlights_internal (JB Team to incorporate into the "additional_attributes" column", "Benefits_Internal (JB Team to incorporate into the "additional_attributes" column", "Benefits Emojis_internal (JB Team to incorporate into the "additional_attributes" column", "How To Use_internal (JB Team to incorporate into the "additional_attributes" column)" are invalid


texts:
I've already enabled the "Product thumbnail itself" setting inside the configuration page, but the images inside my simple products are still being overridden by the configurable product.

I'm taking a look in
\template\1.9.1.x\checkout\cart\item\default.phtml and I see that on line 20 it has this

echo '<img '. $_item->getProduct()->getProductMediaResized(480, 'thumbnail')

I've tried changing it to small_images, images, along with different sizes but the only thing it's caching is the main configurable product picture.

The only extension that I have installed that could have any affect on this may be One page checkout but I've yet to see how...

So basically I want the simple product thumbnail to be displayed inside the cart. It does work when I'm adding it into the cart (the popup) but within the cart itself its only displaying the parent.


texts: Magento v2 -> Buy an item (virtual) and get voucher code via E-mail

texts:
I have a question regarding Magento v 2.
Do you know (default or addon) a functionality to have a virtual item (lets say, 100 dollar voucher) and after the customer's check-out he gets directly an email sent with voucher code?
Thank you!
Rosi


texts: What file has the array that outputs the magento version (Magento ver. 1.13.1.0) in the admin panel

texts:
I've seen the file before but i can't seem to find it atm. I just upgraded from 1.13 to 1.14 but the version didn't change in the admin panel footer area. Now when i did this upgrade on my staging site a month ago it all went smoothly and it updated the admin footer section aw well.

I followed all the same steps i did on stage for production and when i check the stable software running in the magento connect manager it's identical to stage in what's running. 1.14.

it's driving me crazy that the footer didn't update in admin. Thanks in advance.


texts: Unable to manage product images in catalog

texts:
Although product images appear normal on the front-end, I'm unable to manage photos on the back-end.  In the product catalog it appears as if none of the products have images!

Also, when I upload a new image, the upload appears to work successfully.  However, no images appear in the image list after upload.


texts: Magento 2: Shipping Extension - WebShopApps Matrix Rate issue

texts:
I have a rule :
Country,Region/State,City,"Zip/Postal Code From","Zip/Postal Code To","Order Subtotal>","Order Subtotal<=","Shipping Price","Shipping Method"
GBR,,,*,,0.0000,49.9900,4.9500,"Standard delivery"
It is working well, but if the user gets any discount from a coupon or any other discount then it is not working properly as subtotal is not considering discount amount.
If user purchases £50 products then he/she will get the free shipping in the checkout page. But when he uses the coupon that gives £10 discount then the amount will be £40 then also the free shipping is applying.
In stores->settings->configuration->sales->shipping option
flat rate is off
free shippin is off
table rates is off
magebto shipping is off
only WebShopApps Matrix Rate is enabled
magento version 2.2.5
Is there any solutin for this ?
Regards


texts: Coupon code auto generation unable to find

texts:
I have a coupon code that exists in magento (version 1.9.2.3). I think it it was created with auto generation. At least that is what I guess, because I cannot create a new one and I cannot find it using the filter in the admin panel.

My question is: how can I find out which coupon that is? How can I search/filter them in the admin panel?


texts: Simple HTML code to display phone number and enable click to call on iOS

texts:
Does anyone know how to fix simple html code that displays a phone number but ipad and iphone will not display the numbers?

I did a bit of Google and I found out that the below meta tag makes the number to be displayed with a problem but now the click to call feature is not working. I want to click to call feature on iOS to be working as well.

Thank you in advance!

Cheers


texts: custom setup has been not installed in magento

texts:
I have custom module which is OneStepCheckout, in that I have added 2 fields to existing table. But it's not installed in core_resource and tables also fields are not installed.

my code is:

magento\app\etc\modules\Easylife_OnestepCheckout.xml

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

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

<?xml version="1.0" encoding="utf-8"?>
<config>
    <modules>
        <Easylife_OnestepCheckout>
            <version>0.1.0</version>
        </Easylife_OnestepCheckout>
    </modules>

    <global>
        <models>
            <onestepcheckout>
                <class>Easylife_OnestepCheckout_Model</class>
            </onestepcheckout>
            <onestepcheckout_adminhtml>
                <class>Easylife_OnestepCheckout_Adminhtml_Model</class>
            </onestepcheckout_adminhtml>
        </models>
        <blocks>
            <checkout>
                <rewrite>
                    <links>Easylife_OnestepCheckout_Block_Links</links>
                </rewrite>
            </checkout>
            <onestepcheckout>
                <class>Easylife_OnestepCheckout_Block</class>
            </onestepcheckout>
        </blocks>
        <helpers>
            <checkout>
                <rewrite>
                    <url>Easylife_OnestepCheckout_Helper_Url</url>
                </rewrite>
            </checkout>
            <onestepcheckout>
                <class>Easylife_OnestepCheckout_Helper</class>
            </onestepcheckout>
        </helpers>
    </global>
</config>

magento\app\code\local\Easylife\OnestepCheckout\sql\onestepcheckout_setup\install-0.1.0.php

<?php

$installer = $this;
$installer->startSetup();

$installer->addAttribute(
    'sales_flat_order',
    'giftwrap',
    array(
        'type' => 'int',
        'grid' => false,
        'required' => false,
    )
);

$installer->addAttribute(
    'sales_flat_order',
    'giftwrap_price',
    array(
        'type' => 'decimal',
        'grid' => false,
        'required' => false,
    )
);

$installer->endSetup();

Can I know where I went wrong?

thanks.


texts:
I've had issues with CRON before and I usually get it fixed by following the typical troubleshooting techniques.

Setup: LAMP
OS: Ubuntu
Cron: Enabled with the following line: */5 * * * * wget -q http://exampledomain.com/cron.php

When I query the table I get the following results and running the CRON job manually isn't working.

select message_id, entity_type, created_at, processed_at from core_email_queue;
+------------+-------------+---------------------+--------------+
| message_id | entity_type | created_at          | processed_at |
+------------+-------------+---------------------+--------------+
|          1 | order       | 2015-11-15 20:28:02 | NULL         |
|          2 | order       | 2015-11-15 21:15:02 | NULL         |
|          3 | order       | 2015-11-15 22:00:37 | NULL         |
|          4 | order       | 2015-11-15 22:18:08 | NULL         |
+------------+-------------+---------------------+--------------+


texts:
I am using magento 2 , and i created many store and store view. i am getting trouble in setup like:

1. how to assign one product to multiple store and store view at the time of create product.
2. how to set different price per store view.


texts: Find all Product root categories of a store (Magento 1.7)

texts:
I have two websites and am looking to create a dynamic Nav Bar that works across both store fronts.

Because I'm trying to make it dynamic I'll most likely load the current store_id then find the collection related to that.

Is there a way I can list the names of all the Product root categories for a given website?

and is there a way to get all the sub categories of the website?

Here is a picture of the categories I'm talking about as an example:

Let me know if you have any questions or need clarification!


texts: Magento 2: Get custom attribute in catalog category view page

texts: I created a custom attribute for hiding add to cart button. I want to get attribute in the list.phtml file.


texts:
I'm using Magento 1.9.1.2 and I have bundled products, now I understand that when editing this bundled product you can only insert discount % and not actual price breaks, so when viewing a bundled product on the product view page it shows

  Buy 6 with 5% discount each
  Buy 20 with 20% discount each
  Buy 50 with 30% discount each

With simple products you actually get displayed the price including the discount like so

  Buy 12 for £1.07 each and save 5%
  Buy 50 for £0.96 each and save 15%
  Buy 100 for £0.90 each and save 20%

Is there any way I can get the bundled products to display the same information with the price for each like the simple products?


texts:
I have a problem with download function from frontend.
I make a simple Download function in my block.

Practice/Attachment/Block/Frontend/Attachment.php:

protected function DownloadFile() {

    $file = 'media/attachment/Doc1.pdf';

    if (file_exists($file)) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="'.basename($file).'"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        readfile($file);
        exit;
    }

}

This is my template design/frontend/rwd/default/template/catalog/product/view/attachement.phtml:

    <?php
    foreach ($this->getCollection() as $status)
    {
        $image_of_download_button = 'Doc1.pdf';
        $value = $this->getCollection()->getItemById($status->entity_id)->getData('title');
        $link  = $this->getCollection()->getItemById($status->entity_id)->getData('uploaded_file');
        $link2 = 'media/attachment/Doc1.pdf';
        $elo = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'attachment/'.$image_of_download_button;
        ?>
        <a href="<?php echo $linkModel?> ">
            <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'attachment/'.$image_of_download_button?>" width=1200px height="100px" align="center" style="margin-left: 20px">

 AAAAAAAA

        <button name="button_download" onclick=" <?php  $this->DownloadFile(); ?> ">Click me</button>
        <?php
    }
    ?>

But if i reload the page the file is autodownloaded and if i click the button nothing is happening.
I wanna download the file when i press click on button, this is the reason for use oneclick.
Why i do wrong?

I just wanna make a function for frontend to download a file (pdf for exmaple) for a product.


texts: magento 1.9 special offer timer for first time user

texts:
For my  Magento 1.9 website, I want to set the special offer timer. In which I want to display this timer to first time user (new visitor) only and it will use this offer within an hour only. After an hour this offer will be expired for the customer.

Can anyone let me know how to handle/add this type of timer and coupons in Magneto backend and setting up in Magneto front-end.


texts: Magento 2.2:Fails Readiness Check due to Cron - Found non-writable path(s):

texts:
Magento 2.2 Error from Updater Application Cron Script: Found non-writable path(s):

  /home/jon/as/.htaccess
  /home/jon/as/.htaccess.sample
  /home/jon/as/.php_cs.dist
  /home/jon/as/.travis.yml
  /home/jon/as/.user.ini


texts:
Is it possible to make the postcode required on signup? I've taken a look under the customer configuration in admin panel and cannot find an option to make the postcode required.
I have created a module that adds a Customer EAV to request the postcode, but I want to do this without having to create a module; from the Magento Admin panel.
Is this possible without having to create a module?


texts: Magento 1.9 : I have a very strange Magento problem

texts:
Error :

  SQLSTATE[42S02]: Base table or view not found: 1146 Table
  'i1115580_mg3.sales_flat_shipment_track' doesn't exist

Query:

SELECT track_number FROM sales_flat_shipment_track


texts: Change default shipping-information renderer template

texts:
I am having the following issue:

I am trying to edit the default renderer template of shipping-information.

The default component is loading correctly and the custom template also, but i can't access the knockoutjs variable's like address(), is there any possibility i only add the custom template and use the default js file, or do i have to wrap or extend the js?

My layout processor:

<?php
class LayoutProcessor implements LayoutProcessorInterface
{
    /**
     * @param array $jsLayout
     * @return array
     */
    public function process($jsLayout)
    {
        $sidebarElements = $jsLayout['components']['checkout']['children']['sidebar']['children']['shipping-information']['children'];
    $jsLayout['components']['checkout']['children']['sidebar']['children']['shipping-information']['children'] = $this->setupSidebar($sidebarElements);

        return $jsLayout;
    }
    private function setupShipTo($sidebar)
    {
        $shipTo = [
            'ship-to' => [
                'config' => [
                    'template' => 'Guapa_Extension/shipping-information/address-renderer/default'
                ]
            ]
        ];

        return array_replace_recursive($sidebar, $shipTo);
    }
}


texts: Magento 2: How to get order information using REST API?

texts:
I want to get order,customer information by using REST API.

Anyone have idea about this?


texts: how i get the order status in the magento 2?

texts:
public function getStatusOptions()
{
    $options = $this->statusCollectionFactory->create()->toOptionArray();
    return $options;
}

How I can get the order status in the custom shipping method?


texts: Logo is not showing in Magento2 mobile responsive view

texts: I am facing issue in mobile responsive view.In desktop view Logo is showing but in mobile the image is not showing please help to find this issue.


texts:
If I put all files and folders permission as 777

sudo chmod -R 777 ./

Magento2 would be worked without any issue?
I know that it's not good to have 777 on all files and folders.
But I want to know Magento2 will work without any issue.
Thank you.


texts: Magento2: Cannot update wishlist list items with xml in module

texts:
I am trying to add a 'low stock' banner to wishlist items that are low stock.

This works if I add my block to the theme xml file but doesn't if I add in a module wishlist_index_index.xml file.

I know my module layout update file is in the right place as I can add to the content (e.g. a footer block) but it does not want to update customer.wishlist.items.

My XML:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer.wishlist.items">
            <block class="Company\Module\Block\Product\Renderer\LowStock" name="customer.wishlist.stock" template="Company_Module::product/lowstock.phtml" cacheable="false"/>
        </referenceBlock>
    </body>
</page>

In my module composer.json I added:

"suggest": {
    "magento/module-wishlist": "*"
},

But that has not helped.

Any ideas or do I just have to be resigned to this not working?


texts: Magento2 error while fetching configurable product data

texts:
I have written custom wishlist which will display its items when customer logins.
If customer adds product other than config products, my wishlist is working fine,
but when customer adds configurable product, I am getting error.

Fatal error: Call to undefined method Magento\Catalog\Model\Product\Type\Virtual::getConfigurableAttributes() in C:\xampp\htdocs\cw1\campingworld2\vendor\magento\module-configurable-product\Model\Plugin\AfterProductLoad.php on line 66

I checked with this file, this line is getting Configurable product attributes. My code is

<?php echo $block->escapeHtml($product->getSku()); ?>
<?php
//  $priceBlock =  $block->getLayout()->createBlock('Magento\Catalog\Block\Product\ListProduct');
//  getting $product object, passed $product object inside function
//  echo $priceBlock->getProductPrice($product);

$priceHelper = $objectManager->get('Magento\Framework\Pricing\Helper\Data'); // Instance of Pricing Helper
//$finalPrice = $block->getItemPrice($product->getFinalPrice());
$finalPrice = $priceHelper->currency($product->getFinalPrice(), true, false);
$oldPrice = $priceHelper->currency($product->getPrice(), true, false);
echo __("SALE ");
echo $block->escapeHtml($finalPrice);
?>

<?php if ($product->getFinalPrice() < $product->getPrice()): ?>

            <?php $oldPrice = $priceHelper->currency($product->getPrice(), true, false);
            echo $block->escapeHtml($oldPrice);
            ?>

        <?php if ($finalPrice && $oldPrice): ?>
            <?php echo __("SAVE ") ?>
            <?php $priceOff = $block->getPriceOff($product->getPrice(), $product->getFinalPrice());
            $priceOff = $block->escapeHtml($priceHelper->currency($priceOff, true, false));
            echo substr($priceOff, 1);
            echo __("%") ?>
        <?php endif; ?>

<?php endif; ?>

I debug it and found, If i will use $Product->getSku();

I am getting error, but if used $Product->getData('sku');
its working.
Please tell me how to get configurable product data.


texts: Magento 2 Redirect and display error in all admin page after click on "sign in"

texts:
I am trying to login in admin but it display "There has been an error processing your request".
It generate error in like "Undefined offset: 2 in C:\xampp\htdocs\m24\lib\internal\Magento\Framework\Encryption\Encryptor.php on line 591"
Also try to create new user and login but that solution is not working in my case. Note that I am using magento 2.4. Thanks in advance.


texts:
I am trying to speed up my Magento 2.3 CE store with no much success. I have installed Varnish and followed all instructions that I could find on web.

I have fast dedicated server, 2 core 8G ubuntu 18.04 apache 2.4 PHP7.2 Varnish 5.2 all dependencies and I can only get 3.6s load time on product page.  I am chasing ghosts or there is fast M2 store out there?

Please give me example store so I can have something to look up to.

Can someone please advise how fast magento can be? is 2s page load achievable?

Could someone please share a link to fast magento store that achieve good result on PageSpeed Insights


texts: Where to create custom extensions for Magento2?

texts:
Some articles encourage to create custom extensions in app/code and some other encourage to create them under vendor. Are both these two methods fine?

What if I want to override a module in vendor? Do I need to write my custom module also inside vendor folder or app/code?

Do they act as codepools as in Magento 1.x?

Please anyone clarify the purpose of each directories.


texts: not saving "add rows" or adding a custom option Magento 1.9.2.3

texts: it appears it is saving and even says it saved, when in fact it is NOT saving when I add a row or even a custom option when editing my product. No matter what changes I make to this product it won't save. This is any NEW things I am saving or adding to the product. Weird how this is affecting only some product and "not" other products too.


texts: Get update data in cart with checkout_cart_update_items_before event

texts:
I tried to get the update data when cart item qty is updated. I used event checkout_cart_update_items_before because i want to check it before the item updated. How can i get the update data?

Example data i want to take :

 1. Item A change qty from 10 to 5.
 2. Item B change qty from 1 to 3.


texts:
In my header section I have user name and if user have access to different location then he has button saying click me. I want to send ajax call on this button. But JS is not working. Can anybody help me how can I trigger click event on this?

            (
            click me
        )

`


texts: how to show a label in admin grid in magento 2

texts:
grid using block (.xml file)

 <block class="Magento\Backend\Block\Widget\Grid\Column"
   as="customer_group">
   <arguments>
         <argument name="header" xsi:type="string" translate="true">Customer
         Groups</argument>
         <argument name="index" xsi:type="string">customer_group</argument>
    </arguments>
 </block>


texts: Configurable Products into Grouped Product

texts:
I want to add Configurable products inside Grouped product.  Example  like http://www.mitrelinen.com/products/savoy .

Here all prodcuts (Duvet cover, fitted sheet etc) are configurable products under under one grouped product. So this thing is possible as it was already developed.

There is extension to add configurable products inside bundle product (https://www.wizkunde.nl/magento-2-configurable-bundle.html) but that doesnt meet our requirement.

Here is post where this thing explained by Magento Genius @marius : https://magento.stackexchange.com/a/6653/29175 and i am looking for this feature to build on.

Any guidance would be appreciated.


texts: Add class name for anchor Params in Magento2 via XML

texts:
My memories in M1x, From xml use aParams tag can add class name for anchor. But in M2 seem this tag have removed. Where can i find this params in code
Anyone have experience on this case

@Marius top links from M1 i can use xml to add class name to anchor

xml you can see below linkhttp://pastebin.com/raw.php?i=wWLmXEnW
I want to do that in M2 but seem this way not work. Any idea on this case
What class name will render top links in M2?

Many thanks


texts: M2: How to add store address to transactional email / invoice email?

texts:
In M1, our invoice email templates contained the store address:

{{config path='general/store_information/address'}}

In M2, this does not work, because store information / address is split into multiple fields.

Is there an easy way how to insert the store address into transactional emails? Best with only one variable instead of an entire variables section? I would prefer a one-fits-all approach; one email template for all countries.


texts: How to show values from database in adminform

texts:
I have created a custom module to save fields in database now want to get all the fields value into the form so they will be shown in admin:

Here is my adminform:

<?php

  class OptFirst_ReviewMyCompany_Block_Adminhtml_Form_Edit_Form extends
Mage_Adminhtml_Block_Widget_Form
      {
/**
 * Preparing form
 *
 * @return Mage_Adminhtml_Block_Widget_Form
 */
protected function _prepareForm()
{
    $form = new Varien_Data_Form(array(
        'id' => 'edit_form',
        'action' => $this->getUrl('*/*/save'),
        'method' => 'post',
        ));

    $form->setUseContainer(true);
    $this->setForm($form);

    $helper = Mage::helper('optfirst_reviewmycompany');
    $fieldset = $form->addFieldset('display', array('legend' => $helper->__('Select Social Icons'),
            'class' => 'fieldset-wide'));

    $fieldset->addField('facebook', 'text', array(
        'name' => 'facebook',
        'label' => $helper->__('Facebook'),
        'value' => 'facebook.com'
        ));
    $fieldset->addField('google', 'text', array(
        'name' => 'google',
        'label' => $helper->__('Google'),
        ));
    $fieldset->addField('twitter', 'text', array(
        'name' => 'twitter',
        'label' => $helper->__('Twitter'),
        ));
    $fieldset->addField('linkedin', 'text', array(
        'name' => 'linkedin',
        'label' => $helper->__('Linkedin'),
        ));
    $fieldset->addField('yelp', 'text', array(
        'name' => 'yelp',
        'label' => $helper->__('Yelp'),
        ));

    if (Mage::registry('optfirst_reviewmycompany')) {
        $form->setValues(Mage::registry('optfirst_reviewmycompany')->getData());
    }

    return parent::_prepareForm();
}
}

This is the form in admin:

I want to create a view where all the form fields will be shown there database value.. is that can be done?

Thanks!


texts: How to add custom attribute (manufacturer) to product name in My Account - My Product Reviews

texts:
<?php echo $_product->getAttributeText('manufacturer') ?>

This code works fine to display the manufacturer name is other places such as a product page, but not for adding the manufacturer name to the product name in the My Review section of the customer account.

Please share how to accomplish showing the custom attribute in app\design\frontend\mytheme\custom\template\review\customer\list.phtml


texts:
Is it possible to install n98-magerun modules that are project specific with a project's composer.json?

It seems with the reading I have done that modules can be placed in the users home directory, or system wide in the /usr/local/share directory:

/usr/local/share/n98-magerun/modules
~/.n98-magerun/modules
MAGENTO_ROOT/lib/n98-magerun/modules

I have certain projects that use a specific n98-magerun module with additional commands that I want to make required, so I want to use composer to handle the dependency.


texts:
Currently, time for Holiday time picker is
[from] => 2021-03-24 00:00:00
[to] => 2021-03-24 00:00:00
Need to change to
[from] => 2021-03-24 00:00:00
[to] => 2021-03-24 23:59:59
The following is the code I have used
 $fieldset->addField('to', 'date', [
            'name'        => 'to',
            'label'       => __('To Date'),
            'title'       => __('To Date'),
            'date_format' => 'M/d/yyyy',
            'timezone'    => false,
            'value'       => $this->_dateTime->date('m/d/Y')
        ]);


texts: Magento 2.1.2 problem with instantiating TotalsItemExtensionInterface

texts:
I have a problem with instantiating \Magento\Quote\Api\Data\TotalsItemExtensionInterface

Below is my code

<?php

namespace Vendor\Module\Model\Checkout;

class ShippingInformationManagement extends \Magento\Checkout\Model\ShippingInformationManagement
{
    private $totalsItemExtensionInterfaceFactory;

    /**
     * @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
     * @param \Magento\Checkout\Model\PaymentDetailsFactory $paymentDetailsFactory
     * @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
     * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
     * @param \Magento\Quote\Model\QuoteAddressValidator $addressValidator
     * @param Logger $logger
     * @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository
     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
     * @param \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector
     * @codeCoverageIgnore
     */
    public function __construct(
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement,
        \Magento\Checkout\Model\PaymentDetailsFactory $paymentDetailsFactory,
        \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository,
        \Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
        \Magento\Quote\Model\QuoteAddressValidator $addressValidator,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector,
        \Magento\Quote\Api\Data\TotalsItemExtensionInterfaceFactory $totalsItemExtensionInterfaceFactory

    ) {
        parent::__construct(
            $paymentMethodManagement,
            $paymentDetailsFactory,
            $cartTotalsRepository,
            $quoteRepository,
            $addressValidator,
            $logger,
            $addressRepository,
            $scopeConfig,
            $totalsCollector
        );

        $this->totalsItemExtensionInterfaceFactory = $totalsItemExtensionInterfaceFactory;
    }

    /**
     * {@inheritDoc}
     */
    public function saveAddressInformation(
        $cartId,
        \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation
    ) {
        $paymentDetails = parent::saveAddressInformation($cartId, $addressInformation);
        $extensionAttribute = $this->totalsItemExtensionInterfaceFactory->create();
    }
}

But i have an error:

  Fatal error: Cannot instantiate interface
  Magento\Quote\Api\Data\TotalsItemExtensionInterface in
  /var/www/project/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php
  on line 73

Where is the problem? I see that interface TotalsItemExtensionInterface is generated correctly in directory var/generation/Magento/Quote/Api/Data
Below is what has been generated there

<?php
namespace Magento\Quote\Api\Data;

/**
 * ExtensionInterface class for @see \Magento\Quote\Api\Data\TotalsItemInterface
 */
interface TotalsItemExtensionInterface extends \Magento\Framework\Api\ExtensionAttributesInterface
{
}


texts: Is it possible magento 2 + wordpress integration without third party extension?

texts:
Can we do integration of Magento 2 + WordPress  without using of third
  party extension like Fishpig or any other?


texts: How do i hide products on the home page only that have no image

texts: I am looking for a way to hide all products that have no images on the home page only, whilst i do have image place overs setup with my logo, it just does not look right. I use a data content provider where products get imported on a daily basis and when new products are imported it takes some time for the data and images to show.


texts: How to switch the main domain on multi-website Magento 2.1.0 installation?

texts:
Magento 2.1.0
    Magento 1.9.3.7
    Porto theme

We had so much trouble with Magento 2.1.0 that I am giving up. We had 18 websites setup on top of the main website/domain on Magento 2.1.0. Now we installed a fresh install of Magento 1.9.3.7. I put the products in manually into the new install of 1.9.3.7. Next thing I will need to do is re-route the main domain from the Magento 2.1.0 setup to the new Magento 1.9.3.7 (to be like a 2nd website on that install) but that means that I will loose access to the Admin panel of the Magento 2.1.0 install. It would be nice to still be able to get into the Admin panel so I wonder how I could use one of the other websites/domains in there to be the main website/domain so that I could still access the old Admin? (just to make it clear - I am going from Magento 2.1.0 TO Magento 1.9.3.7.)


texts:
While Stock Status index is processing,some of the products' stock_status field in cataloginventory_stock_status table becomes 0. Why is it happening.?

Any Observer event available for after reindex process for stock status in Magento 1.9 ?


texts: How do I pass the product ID and attribute to Gallery.php block?

texts:
How do I get product ID and product attribute at
magento/module-catalog/block/product/view/gallery.php?

Please help, I need to do some image filtering by product custom attribute with the image caption.

thanks


texts: Error Upgrade Magento in 2.3.4 --> 2.4.1

texts:
After upgrade with composer in magento 2.4.1
I launch command after clean cache : php -d memory_limit=-1 bin/magento setup:upgrade
But i have this error :
Upgrading data.. Type Error occurred when creating object: Magento\Catalog\Model\Product\Filter\DateTime, Argument 1 passed to Magento\Catalog\Model\Product\Filter\DateTime::__construct() must be an instance of Magento\Framework\Stdlib\DateTime\Filter\DateTime, instance of FernandoFauth\DateTime\Framework\Stdlib\DateTime\Filter\DateTime given, called in /var/www/vhosts/vedelbois2.quatrys.fr/httpdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

I don't understand this error i can't found a answer on the web.
Anyone can help me ?
Please ?


texts: Magento 2: Forgot Password mail not receiving to any customers

texts: I am facing issue any of customer not receive password resetting email (not a spam also ) I used magento 2.2.5 versions . I setup store using custome theme


texts: Magento, RWD, Form Styles, and Dynamic Content

texts:
If I'm using Magento RWD theme, and I render a form select in the HTML source of a page,

<select><option>Hello!</option></select>

it looks like this when the page loads

However, if I insert the exact same HTML into the page via javascript (after the page has loaded), the select looks like this

That is -- the form is NOT styled.

From what I can tell, something in the ./skin/frontend/rwd/default/js/lib/enquire.js file runs after the page had loaded, and modifies the DOM nodes around the select to give it its styles.  However, I'm not familiar enough with enquire.js to know how I can apply this after a page had loaded.

What can I do to style a form select to match the RWD form elements if I've manually inserted that form select into the page?


texts: magento2.1 dropdown attribute list.phtml

texts:
How to get a dropdown attribute value on the category page, i set the show in listing to yes and added this attribute to product.
any suggestion?


texts: How to show total quantity on front end product page?

texts:
Sorry I am totally new to Magento and cannot seem to figure out where exactly to add this code. I added on top and got the following result. It just shows the code. Can you please help?

https://merchantscanada.biz/hp-6300-pro-core-i5-desktop.html


texts: magento 2 how to enable money order Payment from Specific Customer(B to B Customers)


texts: How to apply shipping charges if order is below X amount?

texts:
I have enable free shipping from System -> Configuration.

If order is greater than 50 then it's Free Shipping.

But i want to charge if order is below 50 for X amount.

http://www.magentocommerce.com/wiki/3_-_store_setup_and_management/shopping-cart-price-rule-recipes

I gone through above link.

I want to set if order is above 50 then free shipping. If less then 50 then X delivery/shipping charges.

Thanks.


texts: Magento 2: How to define Scope For Router.php

texts:
I have created Custom Module. As it requires some front-end routing, have to create Router.php

Whenever I'm accessing Magento eCommece Frontend other pages, say Category/Product Page. It will call my custom module's Router.php

So how can I limit that this Router.php, so it will be called only when I access my Custom Module (App\Code\Custom\Module)

In Addition, Due to this Router.php, my other custom module pages are not working, which is already working fine before.

I'm using this module as a reference for creating my custom module. https://github.com/tzyganu/Magento2SampleModule/tree/master/Controller

Due to this, my module's other pages are not working. Help needed Urgently.

[UPDATE]

Have issue with app\code\Alphanova\ETrade\etc\frontend\routes.xml

<?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
      <router id="standard">
          <route id="mymodule" frontName="mymodule">
              <module name="Custom_Module" />
           </route>
      </router>
</config>

So other pages are working fine now. But now detail page is not working.

http://localhost/magento2/mymodule => Working

http://localhost/magento2/mymodule/test.html => Not Working.

Previous it's working when i have <route id="custom_module" frontName="custom_module"> in routes.xml

app\code\Custom\Module\etc\frontend\di.xml

  <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="Custom_Module" xsi:type="array">
                    <item name="class" xsi:type="string">Custom\Module\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">22</item>
                </item>
            </argument>
        </arguments>
    </type>
    <virtualType name="CustomModuleRoutingEntityPosts" type="Custom\Module\Model\Routing\Entity">
        <arguments>
            <argument name="prefixConfigPath" xsi:type="const">Custom\Module\Model\Posts\Url::URL_PREFIX_CONFIG_PATH</argument>
            <argument name="suffixConfigPath" xsi:type="const">Custom\Module\Model\Posts\Url::URL_SUFFIX_CONFIG_PATH</argument>
            <argument name="factory" xsi:type="object">Custom\Module\Model\PostsFactory</argument>
            <argument name="controller" xsi:type="string">posts</argument>
        </arguments>
    </virtualType>
    <type name="Custom\Module\Controller\Router">
        <arguments>
            <argument name="routingEntities" xsi:type="array">
                <item name="posts" xsi:type="object">CustomModuleRoutingEntityPosts</item>
            </argument>
        </arguments>
    </type>
</config>

app\code\Custom\Module\Controller\Posts\View.php

  public function execute() {
    echo "1111<pre>";
    exit;
  }

It's not going to controller & gives 404 page error.

[Solved]

It's issue with $request->setModuleName('mymodule'); in Router.php, previously it's $request->setModuleName('custom_module');

Still question is why Product/Catalog routes go to my custom Router.php? How can i set that Router.php file only called for some Module & Controller otherwise not. Because we have configuration in di.xml so that's why it's calling


texts: Stock status and back orders in Magento 2

texts:
I want to enable customers to be able to place backorders

In the docs its states for stock status of "Out of Stock" the following

  Unless Backorders are activated, prevents the product from being
  available for purchase and removes the listing from the catalog."

This then implies I should set my products to be "Out of Stock" but enable backorders so I have the following settings as shown in the screenshot below:

The issue is that on the frontend the customer still is not able to purchase the product. See screenshot below:

I have tried to reindex and flushed all the caches but still no luck. Could any one advise?


texts: Delete collection item through console command

texts:
My goal is to delete the default shipping address of all customer.
The code looks something like this:

foreach ($customerCollection as $customer) {

        $customer->load($customer->getId());
        $shippingAddress = $customer->getDefaultShippingAddress();
        $shippingAddress->delete();

        $output->writeln("<info>{$id} Has been deleted..</info>");
    }

I always get "Area code is not set" error. I already set the area on the constructor of the object. The weird part is this error only occurs when calling the delete method. The save() method works fine without any error. The command will work fine if I remove:

         $shippingAddress->delete();

Anyone can enlightened what's happening here?


texts: How to count order item by order status?

texts:
If in order #1 is product "a" with qty = 10 [ status: complete ] and product "b" with qty 2 [ status: closed ],
  order #2 is product "a" with qty = 13 [ status: complete ] and product "b" with qty 3 [ status: closed ]
  => count order by status = 23 [ status: complete ]
  or
  => count order by status = 5 [ status: closed]

My config:

public function toOptionArray()
{
    $options = $this->statusCollectionFactory->create()->toOptionArray();
    return $options;
}

My controller:

$orderItems = $this->orderItemCollection->create();
        $orderItems->addAttributeToFilter('sku', $sku);
        $orderItems->getSelect()->reset(\Zend_Db_Select::COLUMNS);
        $orderItems->getSelect()->columns(array('count' => 'SUM(qty_ordered)'));
        $countOrders = $orderItems->getFirstItem()->getData('count');
        $availableQty = $qty - $countOrders;


texts: CatalogSearch - add weight to different attributes

texts:
I have my fulltext catalogsearch working fine for now, but I still see some not-so-relevant results. Before telling me that Magento's built-in search is terrible I'll tell you that I know there are free extensions out there etc etc, but I don't want to cripple my site with any more extensions.

What's happening is that the "relevance" (which is the score) only gets to 2.0 (from 0), and thus I have say 10 products with the same 2.0 relevance, while I should only have about 3.

My question is : is there a way in which I could tell Magento to add a better score for say name than sku(programmatically or not)?
A bit like Prestashop handles it (see picture below)

Thanks for your insight.


texts: How to refresh shipping and billing address after checkout page load just like shipping Rates refresh using Knockout Js magento 2

texts:
Hi guys, i want to refresh shipping and billing address after checkout
  page load using Knockout Js magento 2.

  If you guys have any idea please guide me.

  Please check the code i tried below

  app\code\Vendor\Module\view\frontend\web\js\view\shipping-address\address-renderer\default.js

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

    define([
        'jquery',
        'ko',
        'uiComponent',
        'Magento_Checkout/js/action/select-shipping-address',
        'Magento_Checkout/js/model/quote',
        'Magento_Checkout/js/model/shipping-address/form-popup-state',
        'Magento_Checkout/js/checkout-data',
        'Magento_Customer/js/customer-data',
        'Magento_Checkout/js/model/shipping-rate-registry'

    ], function ($, ko, Component, selectShippingAddressAction, quote, formPopUpState, checkoutData, customerData,rateRegistry) {
        'use strict';

        var countryData = customerData.get('directory-data');

        return Component.extend({
            defaults: {
                template: 'Vendor_Module/shipping-address/address-renderer/default'
            },

            /** @inheritdoc */
            initObservable: function () {
                this._super();
                this.isSelected = ko.computed(function () {
                    var isSelected = false,
                        shippingAddress = quote.shippingAddress();

                    if (shippingAddress) {
                        isSelected = shippingAddress.getKey() == this.address().getKey(); //eslint-disable-line eqeqeq
                    }

                    return isSelected;
                }, this);

//My code start here
                var address = quote.shippingAddress();

                address.trigger_reload = new Date().getTime();

                rateRegistry.set(address.getKey(), null);
                rateRegistry.set(address.getCacheKey(), null);

                quote.shippingAddress(address);
                console.log("shipping address renderer");
//My code end here
                return this;
            },

            /**
             * @param {String} countryId
             * @return {String}
             */
            getCountryName: function (countryId) {
                return countryData()[countryId] != undefined ? countryData()[countryId].name : ''; //eslint-disable-line
            },

            /** Set selected customer shipping address  */
            selectAddress: function () {
                selectShippingAddressAction(this.address());
                checkoutData.setSelectedShippingAddress(this.address().getKey());
            },

            /**
             * Edit address.
             */
            editAddress: function () {
                //formPopUpState.isVisible(true);
                //this.showPopup();
                this.redirectUrl();
            },

            /**
             * redirect to Cpp address edit page click on addredd edit button.
             */
            redirectUrl: function () {
                window.location.href = '';
            },

            /**
             * Show popup.
             */
            showPopup: function () {
                $('[data-open-modal="opc-new-shipping-address"]').trigger('click');
            }
        });
    });


texts: Issues with .css changes back to original settings

texts:
I am nearing the end of my M2 dev site and ready to go live however I keep having one main issue. We have made some changes to some of the text on the home page, menu and my shop by brands page. We changed some of the text colors, sizes, alignment, and capitalized in the place of uppercase (and vice versa). These changes were made in .css files (styles-1.css, settings default.css) and also in Static > _cache > merged. The files located in the static > merge directories are long numbers example:
(045a82f864904fb393b1d9ac0992df53.css). These files keep changing almost daily. Not sure if the settings are changing each time these files change.
Can someone help me figure out what is going on and why my changes keep defaulting back to the original settings.


texts: Product url rewrite not working when product import using csv from admin in magento2?


texts: I am getting Uncaught ReferenceError: wysiwygSetup is not defined

texts:
Please anyone can help me here, I am getting the require undefined in js, below is my code. Thank you

My code:

          <script>
        require([
            "jquery",
            "mage/translate",
            "mage/adminhtml/events",
            "mage/adminhtml/wysiwyg/tiny_mce/setup"
        ], function(jQuery) {
            wysiwygCompanyDescription = new wysiwygSetup("company_description", {
                "width": "100%",
                "height": "200px",
                "plugins": [{
                    "name": "image"
                }],
                "tinymce4": {
                    "toolbar": "formatselect | bold italic underline | alignleft aligncenter alignright | bullist numlist | link table charmap",
                    "plugins": "advlist autolink lists link charmap media noneditable table contextmenu paste code help table",
                }
            });
            wysiwygCompanyDescription.setup("exact");
        });
    </script>

and the error is:

(index):725 Uncaught ReferenceError: wysiwygSetup is not defined
    at (index):725
    at Object.execCb (db2cfb207124dfa2df050f1ef1a6e743.js:1650)
    at Module.check (db2cfb207124dfa2df050f1ef1a6e743.js:866)
    at Module.<anonymous> (db2cfb207124dfa2df050f1ef1a6e743.js:1113)
    at db2cfb207124dfa2df050f1ef1a6e743.js:132
    at db2cfb207124dfa2df050f1ef1a6e743.js:1156
    at each (db2cfb207124dfa2df050f1ef1a6e743.js:57)
    at Module.emit (db2cfb207124dfa2df050f1ef1a6e743.js:1155)
    at Module.check (db2cfb207124dfa2df050f1ef1a6e743.js:917)
    at Module.<anonymous> (db2cfb207124dfa2df050f1ef1a6e743.js:1113)


texts: Magento 2: How to define scope in di.xml & Router.php

texts:
I'm using Magento 2 CE Version 2.1.0.

app\code\Custom\Module\etc\frontend\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="custom_module" xsi:type="array">
                    <item name="class" xsi:type="string">Custom\Module\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">22</item>
                </item>
            </argument>
        </arguments>
    </type>
    <virtualType name="CustomModuleRoutingEntityPosts" type="custom\module\Model\Routing\Entity">
        <arguments>
            <argument name="prefixConfigPath" xsi:type="const">Custom\Module\Model\Posts\Url::URL_PREFIX_CONFIG_PATH</argument>
            <argument name="suffixConfigPath" xsi:type="const">Custom\Module\Model\Posts\Url::URL_SUFFIX_CONFIG_PATH</argument>
            <argument name="factory" xsi:type="object">Custom\Module\Model\PostsFactory</argument>
            <argument name="controller" xsi:type="string">posts</argument>
        </arguments>
    </virtualType>
    <type name="Custom\Module\Controller\Router">
        <arguments>
            <argument name="routingEntities" xsi:type="array">
                <item name="posts" xsi:type="object">CustomModuleRoutingEntityPosts</item>
            </argument>
        </arguments>
    </type>
</config>

For Defining Scope there will be <argument name="defaultScope" xsi:type="string">posts</argument> Global, Frontend, Primary i have seen.

I would like to put condition in di.xml if there is particular URL http://localhost/magento2/mymodule/test.html then only it will call this di.xml file otherwise not.

I have created custom Router.php, when i call Magento 2 Default Category/Product List then also it goes to my custom Router.php, So what's the best way so it's limited to my Custom Module Only.

I'm following https://github.com/tzyganu/Magento2SampleModule/blob/master/Controller/Router.php

When i do

 public function match(\Magento\Framework\App\RequestInterface $request) {
     echo 1;exit;
 }

Each & every Request call this custom router. Which i think not correct. So that's why it needed to define Scope for Router.php via di.xml or Any other Magento Standard way.

Thanks


texts:
[M1]

I created a custom attribute with name 'Warranty'. we have over 2000 products listed and we would like to mass update 'warranty' attribute as the warranty for all products is the same, however, when I'm going to Catalog > Products > Select All > Update Attributes, I cannot see warranty attribute in the list of attributes that could be mass updated. I need to bring this custom attribute in that list so that I can bulk update it. How could I do this?


texts: Create advanced shopping cart rule in Magento 2

texts:
I want to create a shopping cart rule in Magento 2.
I have 6 products (range product A -> product F) to keep it simple.
Those products cannot be ordered without a valid discount code.

if cart has one product from range A->F, client cannot add another product from that range into cart (other products are possible).
products from range A->F can only be ordered with valid discountcode (if valid, product is free)
if cart has only one item and it is from range A->F, shipping is free
if cart has more products (other than range A->F) normal shipping, but only product from range A->F is free a order)

What is the best way to accomplish this?


texts: Display best selling products in home page

texts: How to display best selling products on the home page?


texts: Help, we have upgraded to Magento 1.9 and when customers use Paypal on there mobile or tablet the payment wont go through. It works fine on the desktop but not on mobile, please help, we are at a loss as we have had to disable the mobile site and don't want to get penalised by google for not being mobile friendly.


texts:
I want get path of image of cms-block and here is code:

$yourPageIdentifier   = 'home_banner';
$cmsPage              = Mage::getModel('cms/block')->setStoreId($store_id)->load($yourPageIdentifier,'identifier');
$array['title']       = $cmsPage->getTitle();
$array['identifier']  = $cmsPage->getIdentifier();
$array['content']     = htmlentities($cmsPage->getContent());

Help me get this.


texts: Custom Order, Invoice, and Shipping Starting Numbers

texts: What's the safest approach to change the next starting numbers for order, invoice, and shipment on a live site?


texts: Multiple Website, When change the customer group from admin that "customer_tax_class_id" Dose not change in Magento 2

texts:
When change the customer group from admin that the "customer_tax_class_id" dose not change in quote table

in normal defaul web site they working fine but in other store they not working


texts: Get Name and Value of only frontend attributes of a product

texts:
How to get all attribute of a product. I try to manage this line of  code from internet or some other sources where i can easily able to fetch Product name,image,price and description but I failed to fetch all product Frontend and FrontendLabel like color,brand etc.I am new to php.So any help would be appreciate.

<?php
    // Get products in category
    require_once('../app/Mage.php');//Path to Magento umask(0);

    if(isset($_GET["categoryId"])){
      $categoryId=$_GET["categoryId"];
        $proxy = new SoapClient('http://www.prashant.com/index.php/api/v2_soap/?wsdl'); // TODO : change url
        $sessionId = $proxy->login('prash', 'prashant123@'); // TODO : change login and pwd if necessary

        $products= $proxy->catalogCategoryAssignedProducts($sessionId,$categoryId);

        $itemDetails=array();
        Mage::app();

      foreach ($products as $item) {

        $product2 = Mage::getModel('catalog/product')->load($item->product_id);
        $productMediaConfig = Mage::getModel('catalog/product_media_config');
        $baseImageUrl = $productMediaConfig->getMediaUrl($product2->getImage());
        $price2=0;
        $price2=$product2->getFinalPrice();
        if($price2==0){
        $price2=$product2->getPrice();
        }

        $desc=$product2->getDescription();
               if($desc==""){
                $desc="blank";
               }

                $attributes=$product2->getAttributes();
                foreach ($attributes as $attribute) {
                        if ($attribute->getIsVisibleOnFront()) {
                        $attributeCode = $attribute->getAttributeCode();
                        $label = $attribute->getFrontend()->getLabel($product2);
                        $value = $attribute->getFrontend()->getValue($product2);
                        echo $attributeCode . '-' . $label . '-' . $value; echo "
";
        }
    }

               $baseImageUrl = $productMediaConfig->getMediaUrl($product2->getImage());
               if($baseImageUrl=="http://www.prashant.com/media/catalog/product/"){
                $baseImageUrl="http://www.prashant.com/customApi/icon.png";
               }

               //"desc"=>$desc,

               $statusp=$product2->getStatus();
        $statusen= Mage_Catalog_Model_Product_Status::STATUS_ENABLED;

        if($statusp==$statusen){
             $itemDetails[]=array(
          "productId"=>$item->product_id,
          "name"=>$product2->getName(),
          "price"=>$product2->getPrice(),
          "spprice"=>$price2,
          "desc"=>$desc,
          "attributes"=>$attributes,
          "imageurl"=>$baseImageUrl,
          );
        }

      }
      //return array of products
      //echo "
";
      //print_r($itemDetails);
      //echo "
";
      echo json_encode($itemDetails);
      exit();
    }else{
      echo "error";
      exit();
    }
    ?>


texts:
Paypal express checkout stopped working.
I found in firebug net panel
400 bad request for url rest/default/V1/carts/mine/selected-payment-method
with response json {"message":"The requested Payment Method is not available."}
Even payment method is enabled and showing in checkout page.

I have no debug log for this.
Paypal express is working fine in staging with sandbox account.

Anyone have any clue why this happening and how can i debug this.


texts:
I paid someone that developed the my website for me. He provided me the magento login info to access my website. Currently, the person cannot be reached and I need to know how to install 3 patches to my website. My websited was hosted via JustHost and I will like to know how to install these security patches. can somebody please guide me on how to do this. I use apple computer, I have access to JUSthost, cpanel, ftp, etc. I need to know what to do please. I don't have any coding or programming knowledge. So please, i will appreciate it if the explanation is easy.

A million thanks :)


texts: Theme XML and CSS has stopped working (default_head_blocks.xml)

texts:
Working on a custom theme, has been working fine all day.
I did make an alteration earlier in the day (folder name change) and yes, everything did blow up.
I since reverted that change, reloaded everything and all was fine.
Then a few hours later, all custom theme CSS failed to load (for example, the theme's default_head_blocks.xml is no longer working at all).
I came across the bug on loads of posts online about needing to change the theme type from 1 to 0 and mine has indeed changed to 1 but resetting this back to 0 has made no difference.
I have since ran the upgrade, compiled and cleared cache commands etc (numerous times).
(Bear in mind, that this was working fine all day and even after I reverted the folder name change).
I am absolutely stumped right now on what else to try as this has now cost me about 2 hours.


texts: Redirect to login with add cart button for guest user

texts:
I'm trying to redirect guest users to the login page when they click on the Add to Cart button and they are not registered. But I can't do it. I am using an Observer with the following event

<event name="controller_action_predispatch_checkout_cart_add">

Below code is for /app/code/vendor/module/etc/frontend/event.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch_checkout_cart_add">
        <observer name="restrict_sales_model_cart_add_before" instance="vendor\module\Observer\ForceLogin" />
    </event>
</config>

And below code is for Observer /app/code/vendor/module/Observer/ForceLogin.php

<?php

namespace vendor\module\Observer;

use Magento\Framework\Event\ObserverInterface;

class ForceLogin implements ObserverInterface
{
    protected $_responseFactory;
    protected $_url;
    private $scopeConfig;
    private $customerSession;
    private $customerUrl;
    private $context;
    private $contextHttp;
    protected $redirect;

    public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Framework\App\Action\Context $context,
        \Magento\Customer\Model\Session $customerSession,
        \Magento\Framework\App\Http\Context $contextHttp,
        \Magento\Customer\Model\Url $customerUrl,
        \Magento\Framework\App\ResponseFactory $responseFactory,
        \Magento\Framework\App\Response\RedirectInterface $redirect,
        \Magento\Framework\UrlInterface $url
    ) {
        $this->scopeConfig     = $scopeConfig;
        $this->context         = $context;
        $this->customerSession = $customerSession;
        $this->customerUrl     = $customerUrl;
        $this->contextHttp     = $contextHttp;
        $this->messageManager = $context->getMessageManager();
        $this->_responseFactory = $responseFactory;
        $this->_url = $url;
        $this->redirect = $redirect;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $isLoggedIn = $this->contextHttp->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);

        if (!$isLoggedIn ) {
            $this->messageManager->addError(__('Loggin First.'));
            $customRedirectionUrl = $this->_url->getUrl('customer/account/login');
            $this->_responseFactory->create()->setRedirect($customRedirectionUrl)->sendResponse('200');
            exit();
        }
        return $this;
    }
}

Any idea why guest users are not redirecting to the login page?


texts: Load Google Maps External Javascript Before Skin Javascript

texts:
I'm trying to add the Google Maps Javascript API to my Magento module.

The problem I'm having is that the core/text block that I am including, that contains the external Javascript inclusion tag, only ever appears after all of the addJs actions.

This means the script I have in pvtl_stores.js that targets the google object doesn't work as the google object hasn't been initialized yet.

Here is my local.xml file:

<layout>
<default>
    <reference name="head">

        <block type="core/text" name="google.maps" before="root">
            <action method="setText">
                <text><![CDATA[<script src="//maps.googleapis.com/maps/api/js"></script>]]></text>
            </action>
        </block>

        <action method="addItem">
            <type>skin_js</type>
            <name>js/pvtl_stores.js</name>
        </action>

    </reference>
 </default>
</layout>

Is there a way to have the core/text block load before the addJs actions?

By the way, if it isn't obvious by the question, I'm new to Magento programming!


texts:
I'm doing some Magento 2 certification test questions. There's one question I do not understand.

The question is as the screenshot. My answer is D, but the correct answer from the test is B

I've been working a lot with layout xml, and I'm quite convinced D is the correct way to declare a custom layout. But if B is the correct answer, can anyone explain why?


texts: Magento : Fatal error: Call to a member function setTemplate() on boolean in /app/code/core/Mage/Catalog/Block/Product/View/Tabs.php on line 60

texts:
On Product detail page i got Fatal error i don't know why this error coming. what should i do to fix it. Every time got this error

  Fatal error: Call to a member function setTemplate() on boolean in /app/code/core/Mage/Catalog/Block/Product/View/Tabs.php on line 60

thanks


texts: Issue overwriting a third party extension?

texts:
I'm trying to overwrite only this file but I'm having no luck in it working, am I doing something wrong?
vendor/mageplaza/module-lazy-loading/Plugin/Model/Template/Filter.php

app/code/MySite/LazyLoading/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Mageplaza\LazyLoading\Plugin\Model\Template" type="MySite\LazyLoading\Plugin\Model\Template"/>
</config>

app/code/MySite/LazyLoading/etc/module.xml
<?xml version="1.0"?>
  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
  <module name="MySite_LazyLoading" setup_version="1.0.0">
  </module>
</config>

app/code/MySite/LazyLoading/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'MySite_LazyLoading',
    __DIR__
);

app/code/MySite/LazyLoading/Plugin/Model/Template/Filter.php
namespace MySite\LazyLoading\Plugin\Model\Template;

use Magento\Cms\Model\Template\Filter as CmsFilter;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Filesystem\Io\File;
use Mageplaza\LazyLoading\Helper\Data as HelperData;
use Mageplaza\LazyLoading\Helper\Image as HelperImage;
use Mageplaza\LazyLoading\Model\Config\Source\System\LoadingType;
use Mageplaza\LazyLoading\Model\Config\Source\System\PlaceholderType;

etc...

Afterward a setup:upgrade and cache:clean is done but no updated changes are showing


texts: How to show only first 3 products in whislist

texts: I am showing wishlist in my cart page. But I want to show only first 3 wishlist product in my cart page in Magento 2


texts: Send an Email with Button Click in cms page magento?

texts: I was confused how to do it. Need to send all the details on the admin's email from a custom cms page where the form fields can be added/edited. After clicking submit button the form details will be sent to my email id. IS IT POSSIBLE TO DO CMS PAGE IN MAGENTO?????? Please help me urgent


texts: add data from custom table to order items

texts:
I have the following query running in a controller, that I use to retrieve orders:

$orders = Mage::getModel('sales/order')
   ->getCollection()
   ->addAttributeToSelect('*')
   ->addAttributeToSort('created_at', 'desc');

I need to add extra data from a custom table (shipping_dates) to each order's product and I'm doing the following (which works but it runs a query for each single product):

foreach($order->getAllVisibleItems() as $item){
     $query = 'SELECT * FROM shipping_dates where product_id = "'. $item->getProductId().'"';
     ...
     }

How can I avoid doing queries for each single product? So far I tried using left join w/o any success.


texts: How to dynamically change page title in head?

texts:
we're trying to dynamically add the SKU to the page's  tag in each product page's .

Our approach so far has been to override the Magento\Catalog\Block\Product\View class:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Block\Product\View" type="Brock\ProductTitles\Block\Product\View" />
</config>

And then in the module:

class View extends \Magento\Catalog\Block\Product\View{

  public function _prepareLayout()
  {

      $product = $this->getProduct();
      if (!$product) {
          return parent::_prepareLayout();
      }
      $title = $product->getMetaTitle();
      $sku = $product->getSku();
      if ($title) {
        echo $title;
        echo $sku;
          $this->pageConfig->getTitle()->set($title." - ".$sku);
      }
  }

}

Any ideas why this wouldn't be working? Or better/different ways of achieving this?

Worth nothing that when we make the above changes to the _prepareLayout function in the core file, it works, just having issues with the override.


texts: Magento2 unable to load theme error with Custom Admin theme

texts:
I have created new admin theme and used in my custom module di.xml file like below:

<type name="Magento\Theme\Model\View\Design">
        <arguments>
            <argument name="themes" xsi:type="array">
                <item name="adminhtml" xsi:type="string">Newtheme/backend</item>
            </argument>
        </arguments>
    </type>

but when i send any email from admin order, it throws error in system.log file like below:

Unable to load theme by specified key: '' [] []

Can anyone let me know what could be issue?i have done upgrade,compile,deploy and cache flush all the things.


texts: How to arrange the blocks in magento2 checkout page

texts:
I need to arrange the block below.
if anyone know please sugguest the way how to change the blocks in checkout_index_index.xml file
order is 1. order summary then 2. shipping form.


texts:
Magento version - Community Edition 2.1.1

Machine - AWS EC2

OS - Ubuntu - 14.04

Php - 5.6

MySql - 5.6

Theme - Default Luma

I have installed magento 2 without sample data.
Everything is working smoothly but I could not see any blocks under this tab.

Admin Login -> Content -> Blocks

It shows ' We could not found any records'

Is this the expected behaviour ? How can I add default blocks?

I have already explored this https://community.magento.com/t5/Theming-Layout-Design-Questions/No-default-Content-Elements-Blocks-listed-in-admin-backend-e-g/m-p/41872#M598 , but this is not exactly I am looking for.

Even my database cms-block table is empty.

I am new to magento2 and really stuck here.
Any help is really appreciated.


texts: CE1.9 - Compatibility of MariaDB 10.1 (MySQL 5.7)

texts:
I'm developing locally on Arch Linux, and just began setting up my local dev environment. I installed mysql using pacman -S mysql which according to the AUR package details lists it as mysql 5.7.17. I know from previous sites, that I don't have any issues running a CE1.9 site in MySQL 5.7, but Arch Linux does not give me the option to choose Oracle MySQL as the provider when I initially install it (only mariadb or percona-server).

I've already received a compatibility warning when I opened MySQL Workbench about MariaDB (although I just feel that this is just merely a warning due to not finding an Oracle MySQL database), and just wonder if I may run into any foreseeable issues?

So I'm a bit confused as the Package Details page states:

  Conflicts:    mariadb
  Provides: mariadb=5.7.17

Are any of you running any CE1.9 sites with MariaDB 10.1 without any issues?

Many thanks!


texts: How to insert data into my new create table in any method?

texts:
Clear like the title.
I want to insert data into my new create table.
How to write code, with what method?

Please help me, thanks!


texts: Magento Category Custom Design changes does not work from admin

texts:
I have to change design change only for one category. I have changed the design from admin panel for a particular category, but it does not update in the frontend.

Does anybody have the same problem?

there are so many modules, all are useful.
Does this can effected by any module?


texts: Magento 1.9 - Observer condition not working for Guest Customer

texts:
My condition: Selected Payment Gateway Eligible only for a selected customer group, id 9.
My observer:
<?php
class Gta_FilterPaymentGateway_Model_Observer
{
    public function paymenter(Varien_Event_Observer $observer)
    {
        $currentCustomerGroup = (int)Mage::getSingleton('customer/session')->getCustomerGroupId();
        if(Mage::getSingleton('customer/session')->isLoggedIn())
        {
            if (($observer->getMethodInstance()->getCode() == 'paytm_cc') && ($currentCustomerGroup !== 9))
            {
                $result = $observer->getResult();
                $result->isAvailable = false;
            }
        }
    }
}

Here i can set PayTM payment Gateway only for customer group 9, but guest customer also eligible to pay via PayTM payment gateway, how to restrict for guest customer also?


texts: Different storeviews or websites in subfolders

texts:
A client wants his multistore shop to be set up like this:

http://www.domain1.org/de/ -> website 1, store view 1
http://www.domain1.org/en/ -> website 1, store view 2
http://www.domain1.ch/de/  -> website 2, store view 3
http://www.domain1.ch/fr/  -> website 2, store view 4
http://www.domain1.ch/it/  -> website 2, store view 5
...

This is an example but there may be many more different subfolders.
What is the best approach to handle different subfolders for different store views / websites?

I know that one solution is to create subfolders called de, en etc. and copy the index.php and .htaccess into the corresponding subfolders.

There also may be some workarounds (symlinks for index.php, vHost configuration instead of using .htaccess) to minimise file duplication but I'd like to find a solution where I don't have to do any changes in the file system but just handle everything by configuration.

UPDATE

We verified with Enterprise support that the best way to do this is by creating subfolders.

We ended up doing it like this:

Create a "languagefolders" directory
Created a copy of index.php inside the directory along with an adjusted .htaccess and symlinks to the Magento folders (app/, errors/, ...)
Created symlinks "de", "en" etc. inside the Magento root directory pointing to the "languagefolders" directory

This way we can add a new language by creating a new symlink (e.g. "fr").


texts: Mage2 - Building a custom product collection if a cookie is present

texts:
I have a vehicle parts site and you can choose your vehicle model, so when you browse the site (for example) breaks. I only want to show breaks specific to the vehicle model stored in the cookie.

So the sudo code is something like this, when I go to any category or search:

If cookie is present

  Show custom product collection which has been filtered by Attribute stored in cookie

else

  Show normal product collection for category

end

I've tried to extend the ListProduct block to add another custom method although I can get the method to work i.e. pass data between, when I try to load a product collection it doesn't work.

Can you please point me in the correct direction for this solution. Am I doing the correct thing or is there a more simple route to take.

I've been puzzled by this for a while now and every resource on the internet i've found always uses the same example of collection and factories. Building a module to display a custom collection i.e. posts.

I really don't need that, what I need is fairly simple... in theory. Any help would be amazing.

[Edit]

Struggling to get the plugin working. Getting this error.

Exception #0 (InvalidArgumentException): Plugin class Plan2pixel\VehicleChoice\Plugin\Product\NewCollectionPlugin doesn't exist

But the file is here: /app/code/Plan2pixel/VehicleChoice/Plugin/Product/NewCollectionPlugin.php'

This is the di.xml file:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Model\Layer">
        <plugin name="plugin_newcollection" type="Plan2pixel\VehicleChoice\Plugin\Product\NewCollectionPlugin" />
    </type>
</config>

NewCollectionPlugin.php

namespace Plan2pixel\VehicleChoice\Plugin\Productcollection\NewCollectionPlugin;

use Magento\Catalog\Model\Layer as CatalogLayer;
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;

class NewCollectionPlugin {
    public function aroundPrepareProductCollection(CatalogLayer $subject, \Closure $proceed, $collection)
    {

        $cookie_helper  = $this->helper('RoughTrax\Session\Helper\Cookie');

        $stored_vehicle = $cookie_helper->get("roughtrax_store_vehicle_date_set");

        $proceed($collection);

        if ($stored_vehicle) {

            $collection->setPageSize(3); // fetching only 3 products just to prove the code works, will adjust after.

        }
        return $this;
    }
}


texts: Multiple variables in email subject : Magento 2

texts:
I would like to add multiple variable in email subject but the problem only one is taking into consideration.
<!--@subject {{trans "%name, see the hint from %sender" name=$name, sender=$sender_name}} @-->

Any idea how to implement it correctly?


texts: How to override (vendor/magento/module-gift-card/Model/Plugin) Magento\GiftCard\Model\Plugin\QuoteItem afterConvert() function Magento 2

texts: override a function (vendor/magento/module-gift-card/Model/Plugin) Magento\GiftCard\Model\Plugin\QuoteItem afterConvert() function Magento 2


texts: How to create shipment and add tracking number through API in Magento 2?

texts:
I have a csv file with 3 columns with list of (increment_id, carrier_code, tracking_number). How do I Post POST these values to existing magento 2 order using API? I have managed to load the values from csv into a data array and into $incrementid, $carrier, $tracking. i'm new to API, please be detailed as possible.

<?php
$file = fopen('track.csv', 'r', '"'); // set path to the CSV file
if ($file !== false)
{
    // add logging capability
    $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/import-update.log');
    $logger = new \Zend\Log\Logger();
    $logger->addWriter($writer);

        public function execute()
        {
        // enter the number of data fields you require the product row inside the CSV file to contain

            $required_data_fields = 3;  //number of column in csv

            while (($row = fgetcsv($this->_file, 100, ",")) !== FALSE)
            {
                $data_count = count($row);
                if ($data_count < 1) {
                    continue;
                }

                $data = array();
                //$data = array_combine($header, $row);
                $data = array($row);

                $ponumber = $row[0]; //$data['ponumber']; // column A
                if ($data_count < $required_data_fields) {
                    $logger->info("Skipping Order Number " . $ponumber . ". Not enough data to import.");
                    continue;
                }

                $shipvia = isset($row[1]) ? $row[1] : null;
                $trackingnumber =  isset($row[2]) ? $row[2] : null;

                switch ($shipvia) {
                    case "FEDEX":
                        $shipvia = "fedex";
                        break;
                    case "UPS":
                        $shipvia = "ups";
                        break;
                    case "USPS":
                        $shipvia = "usps";
                        break;
                    default:
                        $shipvia = "fedex";
                }
            }

    fclose($file);
}