texts: Filter collection by existence of attribute

texts:
I'm working on an e-commerce site populated with products that depend heavily upon having well-populated spec sheets.  Unfortunately quite a few of the products are somewhat less complete than I'd like, so I'm trying to find a way to get lists of products that have a given attribute but with no value.

So far I've got the following:

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

$collection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('name')
                ->addAttributeToSelect('noise_at_1m')
                ->addAttributeToSelect('noise_at_7m');

echo "

Model name	Noise at 1m	Noise at 7m
";
$numcomplete = 0;
$numhalfcomplete = 0;
foreach($collection as $_product){
    $name = $_product['name']; $noise1m = $_product['noise_at_1m']; $noise7m = $_product['noise_at_7m'];
    echo "
$name	$noise1m	$noise7m
";
    if(strlen($noise1m) > 1 &&  strlen($noise7m > 1)){$numcomplete++    ;}
    if(strlen($noise1m) > 1 XOR strlen($noise7m > 1)){$numhalfcomplete++;}
}
echo "
\n";
echo "
$numcomplete products with complete data\n";
echo "
$numhalfcomplete products with partially complete data\n";
echo "
" . (count($collection) - ($numcomplete + $numhalfcomplete)) . " products with no noise data at all";
?>

Which does exactly what it looks like - spits out a big ugly table with every product on the site along with whatever values are set for the attribute I'm searching.  Not a big problem since the site only carries a few hundred products.  Since it brings up every product in the site though I don't actually have a very good idea of how many products are actually supposed to be populated.

To try and get a better idea of how many products have missing data, I'd like to be able to filter the collection down to just products whose attribute sets include the attribute I'm checking.  I don't need to be able to check multiple attributes in one shot since in this case although I'm checking two attributes, anything that has one will have the other.  Anyway.  I've tried swapping

$collection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('name')
                ->addAttributeToSelect('noise_at_1m')
                ->addAttributeToSelect('noise_at_7m');

for

$collection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToFilter('noise_at_1m','*')
                ->addAttributeToSelect('name')
                ->addAttributeToSelect('noise_at_1m')
                ->addAttributeToSelect('noise_at_7m');

I expected this to filter the collection to just products which had the attribute I'm looking for, regardless of whether it was set or what it was set to.  Nope.  This just empties the collection, so clearly I can't filter by a field like that.

Which leaves me with the simple question:

Is it possible to filter a collection to just products which have a given attribute, whether the value is set or not?


texts: Magento2 3 2 : How to Upload Product images To Amazon S3 Server After Product Save

texts:
Does anyone know how can we upload product images to amazon s3 server
after Product save?


texts: How do I decide a value for MAGE_INDEXER_THREADS_COUNT?

texts:
Can anyone suggest to me how to decide a value for MAGE_INDEXER_THREADS_COUNT?

I am managing a website that has 5 websites, 10 stores, 6 customer groups. I know adding this environment variable can increase indexer performance but I am not able to decide what should be the correct value for the website.

Thanks in advance.


texts:
I am trying to migrate a magento1 shop to magento2 on another server.
I did install the migration tool and configure everything correctly.
Here is an example of my config.xml:

<source>
            <database host="mymagento1.com" name="magento1db" user="magento1user"
    password="mypassword"/>
            </source>
            <destination>
            <database host="localhost" name="magentodb2" user="magento2user"
password="mypassword"/>
            </destination>

after executing this command:

php bin/magento migrate:settings --reset vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.3.7/config.xml

i get the following error:

[Zend_Db_Adapter_Exception]
  SQLSTATE[HY000] [1045] Access denied for user 'magento1user'@'localhost' (using password: YES)

It seems the migration tool is trying to connect to the Magento2 database with the magento1 user. I also tried with the magento2 server IP instead of localhost but I get the same error. I triple checked the DB credentials, everything is correct...
I found mutiple posts with the same issue but no solution.


texts: Magento 2 - How to create attribute with images on product page

texts:
I want to recreate this in magento 2:

It's an image slider with attribute icons.
I currently have it in magento 1 as a multiple select value:

This is the Magento 1 code:

<?php if ($multiSelectArray = $this->getProduct ()->getAttributeText('care_instructions')) : ?>

                <?php
                    if (is_string($multiSelectArray)) {
                        $multiSelectArray = array($multiSelectArray);
                    }

                    foreach ($multiSelectArray as $multiSelectItem):

                        $multiSelectItemImage = str_replace(" ", "_", $multiSelectItem);

                        ?>

<img src="<?php echo Mage::getBaseUrl('media'); ?>wysiwyg/careinstructions/<?php echo $multiSelectItemImage ?>.jpg" /><?php echo $multiSelectItem ?>

                    <?php endforeach;?>

<?php endif; ?>

How do I assign the images to the attributes? Will the above code work in Magento 2?


texts: different inventory levels for same SKU multi store

texts:
We have a Canadian website and a US website. All products are shared. But we have two warehouses, one in each country. Therefore we need different stock levels for our websites.

Any ideas?


texts: How to remove description tab and make additional info open by default

texts: I am trying to remove the product description tab entirely, and I would like the Additional info tab to be opened by default.  Previous answers to this question are for different versions of magento, and the catalog.xml file seems to have changed.  Currently using 1.9.  I've looked through all the template files and can't find anywhere to get rid of description and add the active class to additional into, any ideas?


texts:
I have ajax cart from porto theme.
But when I am add more product than stock, the ajax cart crash (wheel is just rotating) and I got no message
How to fix this issue?


texts: How can I override an admin e-mail template using my design folder?

texts:
I'm trying to override module-user/view/adminhtml/email/user_notification.html in my Magento 2 installation. I know how I can do this in the admin by creating a new template that gets stored in the database, but I want the file to be in my app/design-folder. So how can I do this?

I already tried copying the file to the following locations, but none seem to work:

app/design/adminhtml/Magento/Magento_User/email/user_notification.html
app/design/adminhtml/Magento/default/Magento_User/email/user_notification.html
app/design/adminhtml/Magento/backend/Magento_User/email/user_notification.html

Can anyone point me in the right direction?


texts: Why does the second product dynamically added to the cart lose its options in Magento2

texts:
I am dynamically adding products to the cart in Magento2 with some custom options. Every product has the same base product id with different options. RepresentProduct has been properly overridden so that all products added to the cart are separate. However with this code, the second product added will lose it's custom options:

$magento_product = $this->productRepository->get('simple-product-1');
$params = array(
    'product' => $magento_product->getId(),
    'qty'     => intval(5),
    'options' => array(
        'cr_price' => 12.0,
        'Product' => "Test P",
        'cr_XML' => '<root></root>'
    ),
);
$this->cart->addProduct($magento_product, $params);
$params = array(
    'product' => $magento_product->getId(),
    'qty'     => intval(10),
    'options' => array(
        'cr_price' => 14.0,
        'Product' => "Test P2",
        'cr_XML' => '<root></root>'
    ),
);
$this->cart->addProduct($magento_product, $params);
$this->cart->save();

Only the first product has an entry in the quote_item_option table.

Any thoughts on why or how to fix would be appreciated.

Magento 2.2.


texts: Changing Title of Crossell's and Gaps Products Block

texts:
I implemented the extension development from Crosssell Products on Product Page with Magento 2 on Magento 2.2.0. It is currently running, but there are several modifications needed.

The gap between the previous block content and next content (either margin or padding)
The title said "More Choices" need to change with "You May Also Like?"

I attached this screenshot here:

I'm using Unero Theme for additional information (I put the XML block in the Theme frontend of Magento Catalog -> catalog_product_view.xml ) and I still in an early stage of understanding Magento codes and devs. Thanks before.


texts: How to generate formkey in Magento and send a POST request?

texts: Magento uses some sort of form key to send POST data. I want to send POST data to a controller in Magento and receive it.  How do I do that?


texts: Linnworks and Consumer is not authorized

texts:
Linnworks report the issue with error message:

  Consumer is not authorized to access %resources

Here is response from there request:https://www.example.com/rest/V1/stockItems/lowStock?scopeId=0&qty=100000000&pageSize=2000&currentPage=1

<response>
<message>Consumer is not authorized to access %resources</message>
<parameters>
<resources>Magento_CatalogInventory::cataloginventory</resources>
</parameters>
</response>

We have not developed API but only created Admin-User required for linnworks and they are coming with these issues and here are few of them:

https://www.example.com/rest/V1/stockItems/lowStock?scopeId=0&qty=100000000&pageSize=2000&currentPage=1
it is returned with an error message stating 'object moved'.
All permission seems to be granted and can you please check if Is Token authorize is  set to true?
List item

I have checked these threads already: Stack , akamai, Git Issue, mag2 and magento docs.

PS:
I am not developing api/script and its all-about Linnworks and magento version: 2.1.3.

Please guide if someone face same issue with Linnworks or other platforms and what could be cause of this issue.


texts: Magento 2. How to add new text field in block ''ship to' in check out?

texts: I need to add some text by programmatically in 'ship to' in check out step in magento 2.2.1.


texts: Find all products in Magento 2 with more than 1 product image

texts:
Looking for some SQL which would list all SKU's with more than 1 product image attached to it.

Ideally I would also like to delete all images which are not used as base/small/thumbnail, but happy to do that that in the backend if that's easier.

The relevant tables seem to be catalog_product_entity_media_gallery, catalog_product_entity_media_gallery_value and catalog_product_entity_varchar.


texts: "Read more" link in short description in product page

texts:
I used below code to limit the short description in product page:

1) it truncates all other attributes with text field in product page not only if ($_product->getData('short_description')). How make the if to check if this attribute is short_description then do the task?

2) what should be in Read More that after clicking on read more it expands the text?

<div class="value" <?php /* @escapeNotVerified */ echo $_attributeAddAttribute;?>>
        <?php  if ($_product->getData('short_description')) {
            $string = strip_tags($_product->getData('short_description'));

            if (strlen($string) > 50) {
                // truncate string
                $stringCut = substr($string, 0, 50);
                $string = substr($stringCut, 0, strrpos($stringCut, ' ')).'... Read More';
            }
            echo $string;
        }else {?>
        <?php /* @escapeNotVerified */ echo $_attributeValue; }?>


texts:
I'm having an issue with Magento 2. basically we have 3 currencies with the base currency set as USD. These are converting from the base currency which we just don't need happening, we have our prices set in these areas so say $200 needs to equate to £200 & 200 Euros . So, how the heck do i stop this conversion as the prices set in the backend are being converted.

Removal of the function completely would be nice even if it's a core file manipulation, whatever it takes I need it stay consistent to what I've set.


texts: Configurable product price not changing on click

texts:
Configurable Products price is not changing on click action at Product List page when  we scroll to
Page 2
It works fine on page 1
The Infinite Scroll function takes a lot of time
Please suggest any solution ???


texts: Getting an error when i click on edit customer in the admin panel

texts:
Here is the log for the error

   a:5:{i:0;s:123:"Source model "customeractivation/resource_attribute_source_customeractivation" not found for attribute "customer_activated"";i:1;s:3149:"#0 /home/allholde/public_html/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php(387): Mage::exception('Mage_Eav', 'Source model "c...')
#1 /home/allholde/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Form.php(201): Mage_Eav_Model_Entity_Attribute_Abstract->getSource()
#2 /home/allholde/public_html/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php(75): Mage_Adminhtml_Block_Widget_Form->_setFieldset(Array, Object(Varien_Data_Form_Element_Fieldset), Array)
#3 /home/allholde/public_html/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php(58): Mage_Adminhtml_Block_Customer_Edit_Tab_Account->initForm()
#4 /home/allholde/public_html/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Adminhtml_Block_Customer_Edit_Tabs->_beforeToHtml()
#5 /home/allholde/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#6 /home/allholde/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#7 /home/allholde/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#8 /home/allholde/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#9 /home/allholde/public_html/app/design/adminhtml/default/default/template/page.phtml(58): Mage_Core_Block_Abstract->getChildHtml('left')
#10 /home/allholde/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/allholde/...')
#11 /home/allholde/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#12 /home/allholde/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#13 /home/allholde/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#14 /home/allholde/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml()
#15 /home/allholde/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#16 /home/allholde/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#17 /home/allholde/public_html/app/code/core/Mage/Adminhtml/controllers/CustomerController.php(151): Mage_Core_Controller_Varien_Action->renderLayout()
#18 /home/allholde/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_CustomerController->editAction()
#19 /home/allholde/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('edit')
#20 /home/allholde/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 /home/allholde/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#22 /home/allholde/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#23 /home/allholde/public_html/index.php(130): Mage::run('', 'store')
#24 {main}";s:3:"url";s:79:"/index.php/admin123/customer/edit/id/2388/key/989271bfd789f6f13c18fb5c9969f707/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}


texts: Magento 1.9.3.4 compiler is disabled but the compiler status is always shown as enable. How to resolve it?


texts: How to have front end and back end use different language?

texts:
I am making a Japanese magento store.  The front end should be Japanese locale.

The back end (admin area) should be in English, at least for my admin user.

It looks like this is not possible to do?  The locale setting seems to affect both front and back end.

(Ideally, I think each admin user should be able to set which language the admin interface appears in to them, as part of their user account settings.)


texts: Upgrade from Magento CE 1.5.1 to Enterprise Edition 1.12 or later

texts:
I have Magento community edition 1.5.1 and I want to upgrade to Enterprise Edition 1.12 or later.

Is it possible to upgrade from CE to EE directly without any intermediate step?

Thanks


texts: Migrate Data from Ver 2.1.2 to new with Ver dev-2.3-develop

texts:
I have new website Ver dev-2.3-develop and i want to migrate the data of the products and media file from the old one
the old one is Ver 2.1.2
so is there any way to do this ?


texts: product details page still have product gallery issue image are not showing sometime in magento 2.4

texts: Now i added image back-end but still have product gallery issue image are not showing sometime in product details page magento 2.4


texts: I am unable to update currency automatically on Magento 2

texts: Automatic updates of foreign currency does not happen


texts: Is it possible to migrate from Magento 1 Enterprise to Magento 2 Open Source?

texts:
I'm looking to migrate from Magento Enterprise 1.14.2 to Magento Open Source 2.2.2.

Having looked at Magento's data-migration-tool, I noticed an absence of any "commerce to open source" migration paths, for obvious reasons (Magento doesn't want paying customers to downgrade).

So is it possible to directly migrate from v1 Enterprise to v2 Open Source? Has anyone successfully done this?


texts: Magento 2: Translate knockout template html text with variables

texts:
Currently i have a knockout template for minicart like this:

The text will generate a text like this:
There is 1 item or There are 3 items the number is the variable i get from getCartParam('summary_count') , the problem arise when i need to translate it, for example into this:
Hanya ada 1 barang
Terdapat 2 barang
Terdapat 5 barang

Using php or phtml file i can easily translate like this:
__('There is %1 item in the cart',$item->getQty())


texts: How to connect ERP to magento store via Soap?

texts: I want to create a login for ERP in my magento store. I have created a user and role in web services->soap/xml-RPC how can login via soap?


texts: Cannot get Magento 2 catalog price incl tax to work

texts:
I have a problem with Magento 2, I have configured a tax class and settings for including it in catalog and entered price in admin. Still when I get priceinfo I get this price:

For a product of price 119:

$prices = $product->getPriceInfo()->getPrices();
var_dump($prices->current()->getAmount());

Outputs:

object(Magento\Framework\Pricing\Amount\Base)[2082]
   protected 'amount' => float 148.75
   protected 'baseAmount' => null
   protected 'totalAdjustmentAmount' => null
   protected 'adjustmentAmounts' =>
     array (size=1)
       'tax' => float 29.750001
   protected 'adjustments' =>
     array (size=0)
       empty

Why is magento adding the tax on top of 119 despite my settings?

I have done some further research in this, it seems magento2 has a problem counting taxes backwards?

When running \Magento\Catalog\Helper\Data function getTaxPrice I set price at 119 to include tax and to return price without tax:

https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Helper/Data.php#L515

Should not this function return 119 * 0.8 = 95.2 in this case? As my tax is 25% and backwards tax that is 20%.

I run the function as this:

$catalogHelper->getTaxPrice($product, $product->getPrice(), false, null,null,null,null,true,true)

It returns 119 to me which seems weird.


texts: Magento 2 : Create custom sticky admin system messages

texts:
I need to create custom sticky admin system messages.

  Here is my code, But not working

class StickyMessages implements \Magento\Framework\Notification\MessageInterface
{
  public function getIdentity() {
   echo 'testing';
  }

  public function isDisplayed() {
    // write code to decide if this message should be shown or not
    // return true to show it, false otherwise

    echo 'testing';
  }

  public function getText() {
    // output a static text or dynamically generate one
  }

  public function getSeverity() {
    // if you return self::SEVERITY_MAJOR the sticky box on top will be empty
    // if you return self::SEVERITY_CRITICAL the sticky box will always show your text
    return self::SEVERITY_CRITICAL;
  }
}

I am getting admin to distort on loading

enter image description here

I want to show an open message on top. So that when we login then simply show the mesaage


texts:
How can I get the options of a custom shipping method. I couldn't really find anything useful. Only that:

$shippingmethods = Mage::getSingleton('shipping/config');
        foreach($shippingmethods as $code =>$carrier) {
            if ($code == 'my_shipping_metho')
                //do something1
        }

But $shippingmethods is always empty and therefore I never enter the foreach.

and that:

$shippingMethods = Mage::getSingleton('shipping/config')->getActiveCarriers();
        $shippingMethods['my_shipping_method'];

But here I don't have any useful data. Just ID and store.

So, I have a shipping method, which has options for certain kilograms. And I want to get the minimum weight of that method. I know the code of the method.


texts: Magento 2.2.6 - Custom modue setup version for module is not specified

texts:
I try with this but my local system is working fine but the same module when I upgrade in live site then is not working it gives the exception please let me know what I have to do?

Please see below error which I face,


texts: Magento 2.x How to apply rule only for single custom options not for all options

texts:
I have create on rule to apply discount while subtotal goes over 100. It's working fine with all the custmizable options but I want to apply only selected customizable options not for all the options.
Thanks in advance.


texts:
I have used paytrace extension from gitlab public repo but having issue while creating invoice. Here is the screenshot:

Kindly take a look at gitlab repo and assist how can I create invoice for this.
Thanks.


texts:
I have tried to look for previous solution and couldn't find any relevant topics. So I guess I should post a new question here. We are trying to toggle the WYSIWYG editor (Which is turned by default) and it is not responding. I inspected the element and it shows these errors:

Uncaught TypeError: tinyMceWysiwygSetup is not a constructor

I tried to compare the tiny_mce folder under the js directory with another working magento website. Their respective sum is the same so I think the problem doesn't occur at this place.

Any clue or idea to resolve this issue?

Thank you very much in advance!


texts: How to generate custom xml and download it on button click in custom module?

texts: I am creating a custom product feed module so I need to generate a Custom xml file which populate store products and also get download on button click.


texts: Product images are uploaded in admin panel but cant be seen in the front view

texts: I have magento 1.8.1.0, when adding products the images are uploaded in the admin panel but can't be seen in front view of shop. Have checked the images are stored in media/catalog/product/ folder. Have refreshed the cache and checked, removed the .htaccess file in media folder, checked folder permission is set to 777. Please help.


texts: Error in installing an extension via setup wizard in Magento admin 2.1.7

texts:
We are trying to install a fooman/emailattachments-m2 extension ( or any extension) from Magento marketplace using system -> web setup wizard ->component manager. It successfully completed the readiness check and backup steps during installation, The maintenance mode also successfully enabled for frontend.

During the next step (new purchase status page) it started installation and show the text update pending.

When we access the frontend after 2 mins (After next cron job ran) the maintenance mode will automatically disabled, the extension also successfully installed and our site also working fine.

The Console.log also shows there is no error everything working fine.

We have noticed the update flag files (.update_in_progress.flag, .update_error.flag) also not generated in var folder.

Since, The setup wizard page (new purchase status page) still showing the following error.

The buttons also not working (Roll Back , Next buttons), Even the menu links also not working on this page.

We have checked in browser console there is a error like angularjs is not defined.

Kindly anyone suggest me to resolve the issue, Thanks.

enter image description here


texts: How to show price(including tax) in the basket page?

texts:
In my cart page (i.e checkout/cart.phtml) each added product with price and total product price(subtotal) is shown as following...

<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
    <fieldset>

            <?php
                foreach($this->getItems() as $_item): ?>
                    <?php echo $this->getItemHtml($_item) ?>
            <?php endforeach ?>

                    SUBTOTAL :

                    <?php
                        $totals = $this->getQuote()->getTotals();
                        $formattedPrice = Mage::helper('core')->currency($totals["subtotal"]->getValue(), true, false);
                        echo $formattedPrice;  ?>

                        <a href="<?php echo Mage::getBaseUrl()."checkout/cart/login"; ?>" name=" " title="<?php echo $this->__('Secure Checkout'); ?>" class="button btnPrimary" id=""><?php echo $this->__('Secure Checkout'); ?>

                        <a href="<?php echo Mage::getBaseUrl(); ?>" name=" " title="<?php echo $this->__('Continue Shopping'); ?>" class="button" id=""><?php echo $this->__('Continue Shopping'); ?>

    </fieldset>
</form>

The below code shows the product image and its price(excluding tax), But I want to show the price(including tax)  .

<?php
     foreach($this->getItems() as $_item): ?>
         <?php echo $this->getItemHtml($_item) ?>
<?php endforeach ?>

Then the below code shows the total price (excluding vat) of the added products in the cart.

<?php
     $totals = $this->getQuote()->getTotals();
     $formattedPrice = Mage::helper('core')->currency($totals["subtotal"]->getValue(), true, false);
     echo $formattedPrice;
?>

I want to display all the price (i.e each product and also "SUBTOTAL") inlcuding tax in the cart page.
How can I get the price (including tax) in the cart page ?


texts:
We have imported products to our website. For most of products salable quantity shows 0.
https://prnt.sc/tosm8b
We try run reindex but still salable quantity shows 0.
Any solution?


texts: How to Edit Layout Update Xml for CMS Page in Magento 2?

texts:
I just migrated from Magento 1.9.3.4 to Magento 2.3.4, I noticed some of the page content is missing when I accessed the page that was created from cms page.

Then I look at the cms page edit page, in M1 I can update the Page layout XML like this:

But in M2 I can't find this section:


texts: Magento 2: how to set an element to disappear when viewing in mobile device?

texts:
In Blank theme, the header account links disappear from header when viewing in mobile device.
Since I moved those links to another area of my store, I want to set the CSS rules to do the same.

I tried the following code in my custom theme which overrides Blank but didn't work:

@media only screen and (min-width: @screen__m) {
    .header.content .links {
        display: inline-block;
    }
}
.header.content .links {
    display: none;
}

I want the links display when screen is 768px or wider but disappear otherwise.

Why are those CSS rules duplicated?


texts: Create image category attribute on magento 2.1

texts:
I have created category image attribute according to the this post. Images are also saving successfully. But I cannot preview or delete image as default category image. I had written code in category_form.xml, content of this file.

<field name="homebanner">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">category</item>
                <item name="label" xsi:type="string" translate="true">Home Banner</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">fileUploader</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                <item name="required" xsi:type="boolean">false</item>
                <item name="sortOrder" xsi:type="number">30</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="categoryattr/index/homebanner"/>
                </item>
            </item>
        </argument>
    </field>


texts: Changing number of products in a row on category view page using local.xml

texts:
I know there are more than a way to change the number of products in a row on category view page.

One way to do so is to open catalog.xml and changing the number in following code:

<action method="setColumnCount"><count>4</count></action>

However as I am learning Magento, I learned that you shouldn't change Magento XML files and instead you should create a local.xml file and put all your changes inside it.

Following this logic I added following code to my local.xml file to change the number of products in a row to 3:

<catalog_category_layered translate="label">
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="core/text_list" name="product_list.name.after" as="name.after" />
                <block type="core/text_list" name="product_list.after" as="after" />
                <action method="setColumnCount"><count>3</count></action>
            </block>
    </block>
</reference>
</catalog_category_layered>

This works, however the problem is that as the same code (however with number 4) also excists in catalog.xml if you open any of catalog view pages the product grid is showing twice!

What is the right way to change the number of products in a row?
Is it ok if I just replace 4 with 3 in catalog.xml?

Thanks


texts: Magento 2.4.1 - 3D Secure with braintree (handling special chars)

texts:
I've enabled 3D Secure within Braintree but I'm having an issue where if the name of the customer has special chars 3D Secure won't work.
I found this post online but I can't override find a way to pass the customer name and surname into brinatree without special chars, can anybody help please?
https://github.com/magento/magento2/issues/25483
Thanks !


texts:
I want to override

vendor/magento/module-customer/Address/AbstractAddress.php

for remove lastname validation.How to override this?

di.xml

<preference for="Magento\Customer\Model\Address\AbstractAddress" type="Xxx\Lastname\Model\Address\AbstractAddress" />

AbstractAddress.php:

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

namespace Xxx\Lastname\Model\Address;

class AbstractAddress extends \Magento\Customer\Model\Address\AbstractAddress
{
   public function validate()
    {
        $errors = [];
        if (!\Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'firstname']);
        }
//
//        if (!\Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
//            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'lastname']);
//        }

        if (!\Zend_Validate::is($this->getStreetLine(1), 'NotEmpty')) {
            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'street']);
        }

        if (!\Zend_Validate::is($this->getCity(), 'NotEmpty')) {
            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'city']);
        }

        if ($this->isTelephoneRequired()) {
            if (!\Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
                $errors[] = __('%fieldName is a required field.', ['fieldName' => 'telephone']);
            }
        }

        if ($this->isFaxRequired()) {
            if (!\Zend_Validate::is($this->getFax(), 'NotEmpty')) {
                $errors[] = __('%fieldName is a required field.', ['fieldName' => 'fax']);
            }
        }

        if ($this->isCompanyRequired()) {
            if (!\Zend_Validate::is($this->getCompany(), 'NotEmpty')) {
                $errors[] = __('%fieldName is a required field.', ['fieldName' => 'company']);
            }
        }

        $_havingOptionalZip = $this->_directoryData->getCountriesWithOptionalZip();
        if (!in_array(
            $this->getCountryId(),
            $_havingOptionalZip
        ) && !\Zend_Validate::is(
            $this->getPostcode(),
            'NotEmpty'
        )
        ) {
            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'postcode']);
        }

        if (!\Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'countryId']);
        }

        if ($this->getCountryModel()->getRegionCollection()->getSize() && !\Zend_Validate::is(
            $this->getRegionId(),
            'NotEmpty'
        ) && $this->_directoryData->isRegionRequired(
            $this->getCountryId()
        )
        ) {
            $errors[] = __('%fieldName is a required field.', ['fieldName' => 'regionId']);
        }

        if (empty($errors) || $this->getShouldIgnoreValidation()) {
            return true;
        }
        return $errors;
    }

}


texts:
When I run php bin/magento setup:upgrade and when task finished, at the last line, it shows

This also happened if I run

php bin/magento indexer:reindex customer_grid

and reindex always failed with

dummy view does not exist

If I go to Admin -> system -> index management, I'll see this error,

1 exception(s):
Exception #0 (InvalidArgumentException): dummy view does not exist.

Exception #0 (InvalidArgumentException): dummy view does not exist.
#0 /public/vendor/magento/module-indexer/Model/Indexer.php(238): Magento\Framework\Mview\View->load('dummy')
#1 /public/vendor/magento/module-indexer/Model/Indexer.php(276): Magento\Indexer\Model\Indexer->getView()
#2 /public/vendor/magento/module-indexer/Model/Indexer/DependencyDecorator.php(180): Magento\Indexer\Model\Indexer->isScheduled()
#3 /public/vendor/magento/module-indexer/Ui/DataProvider/Indexer/DataCollection.php(51): Magento\Indexer\Model\Indexer\DependencyDecorator->isScheduled()
#4 /public/vendor/magento/framework/Data/Collection.php(688): Magento\Indexer\Ui\DataProvider\Indexer\DataCollection->loadData(false, false)
#5 /public/vendor/magento/framework/Data/Collection.php(284): Magento\Framework\Data\Collection->load()
#6 /public/vendor/magento/module-backend/view/adminhtml/templates/widget/grid.phtml(51):

Magento\Framework\Data\Collection->getSize()
.......


texts: WHY does Magento deactivate FPC for SSL?

texts:
Ok we know that Magento deactivates the FPC for SSL pages. Also how to fix it and that we anyway should use an alternative. ;)

But for what reasons is it deactivated? The only one which I can think of that SSL is per default (almost?) only activated for the checkout which might contain sensible data. To prevent from a possible flaw these sensible data would not be cached at all. But in this case it would be a lot better to just deactivate FPC for the Checkout controllers and not for all SSL sites, especially as Google now also cares about SSL and you might activate it for all pages.

Are there any other and even better reasons?


texts: How to Remove Magento Folder name from URLs?

texts:
I have a directory store in which magento files and folders reside. Therefore if I want to access the site, I need to specifically type the complete URL www.example.com/store to access.

I use avrixe hosting and have little idea about php stuff.

To counter the issue, I tried logging into cpanel and in website settings tried following
Folder in hosting Space - \expamle.com\www\store , This yielded 403 error. Please tell me how can this be achieved without fuss. Should I just chage the Redirect to URL in website settings to the complete URL


texts: Extend/Override .phtml file in Magento 2

texts:
I have a third party module, and I'm trying to override the third party .phtml file but it's not working for me. For these, I tried below ways.

Third-Party Layout module:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="quotation_item_price_renderers"/>
    <body>
          <referenceBlock name="quotation.quote.item.renderers">
               <block class="Magebees\QuotationManager\Block\Checkout\Cart\Item\Renderer" as="default" template="Magebees_QuotationManager::quote/item/default.phtml">
                    <block class="Magebees\QuotationManager\Block\Checkout\Cart\Item\Renderer\Actions" name="quotation.quote.item.renderers.default.actions" as="actions">
                        <block class="Magebees\QuotationManager\Block\Checkout\Cart\Item\Renderer\Actions\Edit" name="quotation.quote.item.renderers.default.actions.edit" template="Magebees_QuotationManager::quote/item/edit.phtml"/>
                        <block class="Magebees\QuotationManager\Block\Checkout\Cart\Item\Renderer\Actions\Remove" name="quotation.quote.item.renderers.default.actions.remove" template="Magebees_QuotationManager::quote/item/remove.phtml"/>
                    </block>
                </block>
        </referenceBlock>
    </body>
</page>

Now I want to Override quote/item/default.phtml file.

I tried 2 Ways.

1) Extended luma theme

Copied default.phtml file and pasted in design/frontend/Magento/luma/Magebees_QuotationManager/templates/quote/item/default.phtml

After the above step I executed the upgrade, compile, static-content: deploy commands, still not working.

2) Tried with di.xml

created di.xml in etc/frontend/di.xml and written below code.

<?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="Magebees\QuotationManager\Block\Checkout\Cart\Item\Renderer"  type="ABCSolutions\CQWCProduct\Block\Checkout\Cart\Item\Renderer" />
</config>

And I set the template in the Block file see below code.

<?php

namespace ABCSolutions\CQWCProduct\Block\Checkout\Cart\Item;

use Magebees\QuotationManager\Helper\Quotation;
use Magebees\QuotationManager\Model\QuoteFactory;
use Magento\Catalog\Block\Product\ImageBuilder;
use Magento\Catalog\Helper\Product\Configuration;
use Magento\Checkout\Model\Session;
use Magento\Framework\Message\ManagerInterface;
use Magento\Framework\Module\Manager;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Url\Helper\Data;
use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
use Magento\Framework\View\Element\Template\Context;

class Renderer extends \Magebees\QuotationManager\Block\Checkout\Cart\Item\Renderer{

    public function __construct(
        Context $context,
        Configuration $qproductConfig,
        Quotation $quoteHelper,
        Session $checkoutSession,
        ImageBuilder $imageBuilder,
        Data $urlHelper,
        ManagerInterface $qmessageManager,
        PriceCurrencyInterface $priceCurrency,
        Manager $moduleManager,
        InterpretationStrategyInterface $qmessageInterpretationStrategy,
        QuoteFactory $quoteFactory,
        array $data = []
    ){
        parent::__construct($context, $qproductConfig, $quoteHelper, $checkoutSession, $imageBuilder, $urlHelper, $qmessageManager, $priceCurrency, $moduleManager,
            $qmessageInterpretationStrategy, $quoteFactory, $data);
        $this->setTemplate("ABCSolutions_CQWCProduct::quote/item/default.phtml");
    }

}

In default.phtml file pasted the code from the Magebees module & added extra content with "Extended".

Still not getting the updated design.

Please suggest me if I went wrong?


texts: Add Google Fonts using Google's new URL format

texts:
Guides I have seen as to how to add Google Fonts to Magento 2 tend to require adding the font link via your XML such as

<link src="fonts.googleapis.com/css?family=Montserrat:300,400,500,700" src_type="url" rel="stylesheet" />

However, Google have recently updated their URL format, which would mean something such as

<link src="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,400;0,700;1,400;1,700&amp;display=swap" src_type="url" rel="stylesheet" />

However, this returns an invalid format error.  Whilst the ampersand can be encoded, the issue is down to their use of a semi-colon.

I've got around this by including the link four times, ie

<link src="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,400&amp;display=swap" src_type="url" rel="stylesheet" />
<link src="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,700&amp;display=swap" src_type="url" rel="stylesheet" />
<link src="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@1,400&amp;display=swap" src_type="url" rel="stylesheet" />
<link src="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@1,700&amp;display=swap" src_type="url" rel="stylesheet" />

I assume I could also still use the old URL format, but I'd wary of that becoming invalid in future.

This approach doesn't feel very tidy, which is why my question is whether there is a more professional way of doing it.

I also tried an @import in my _theme.less, but the compilation failed, saying the file could not be found.


texts: Magento 2: Difference between Model and Factory

texts:
In Magento 2, When to use Factory and Model?

What is the difference between them?

Can we use our Custom Module's model as Factory?


texts: How to get product's comparable attributes list by product id

texts:
I would like to know, the process to get list of comparable attributes of a product with their label/name and their values.

i'm using this, but it's not working.

$attributes = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection');
            $attributes->getComparableAttributes();

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

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

foreach ($attributes as $attribute)
            {
                $collection->addAttributeToSelect($attribute->getAttributeCode());
            }
           $collection->load();
            $collection->setPageSize(1);

can anyone know. thanks in advance.


texts: Accessing a JS UI Component's members from another JS module

texts:
I take it we're all accustomed with the omnipresent

// js-module1.js
define(
    ['Magento_Module/js/someComponent'],
    function (Component) {
        return Component.extend({property: 123});
    }
);

But how can you access members (properties, methods) of the Component in another JS module (public access I mean)? For example, another js-module2.js requiring the first one:

// js-module2.js
define(

    ['Magento_Module/js/js-module1'],

    function (Component) {
        var prop = Component.property;
        // expecting "123", but it's an error, as Component is a function
    }
);

From what I understand, the returned value is actually this one here, as that's the base "class" of the JS Component, but that code is so confusing right now.

What is that thing? Can its members be accessed publicly? Some of the native view models have really nice properties/methods which could help me, but I can't get to them.


texts: How to get custome token in PHTML magento 2

texts:
I need to add products in the cart using rest api in javascript.

Code is below:

var data = JSON.stringify({
  "cartItem": {
    "sku": "240-LV08",
    "qty": 1,
    "quote_id": "4"
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "http://host/rest/V1/rest/default/V1/carts/mine/items");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization bearer", "wew3dfdfsaffff");
xhr.setRequestHeader("cache-control", "no-cache");

xhr.send(data);

Here just I need to pass user token by the customer session in PHTML file.

How to get customer token in phtml using object manager.


texts: child themes style not apply in magento2

texts: I have create child themes and select child themes, have style(style-l.css,style-m.css) not able to apply for this theme and site has been messed up.


texts: How to upgrade from magento 1.4.1.1 to 1.6?

texts: Can anyone tell me easy step to upgrade magento from 1.4.1.1 to 1.6 ?


texts: Magento Navigation Menu - Sub Navigation

texts:
I have a template that I'm trying to edit the navigation menu for. I'm able to create sub-menu by this code of line (which is located in topmenu.html
">#">
            Knowledge

                <?php echo $_menu ?>

That links the menu to my category, which then I'm able to edit in magento and add sub-menu category. I'm trying to create another submenu that links to my category in Magento, but does not duplicate the same submenu in Knowledge. Not sure if I explained that correctly, but any help or questions to further understand would be appreciated.


texts: Fixing a module with incorrect namespacing for Patch 6788

texts:
I am trying to fix the admin route issue for a 3rd party module, as required for patch 6788.

The module code sits in a directory directly below 'community' rather than in a namespace directory

i.e

community/TheModule

Upon changing the admin router in the config xml to the following,

  <admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <themodule_admin before="Mage_Adminhtml">Themodule_Adminhtml</themodule_admin>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

the admin routes no longer work, and I can see that this is because the filename Magento is odd

i.e. with debugging logs in the from the _validateControllerClassName method in Mage_Core_Controller_Varien_Router_Standard I can see Magento is looking for files in paths like the following

app/code//TheModule/Adminhtml/controllers/

Ideally the module should be sitting under a namespace, but is there a quick fix I can apply to this module in order to get it patched for 6788?


texts: How to update all prices in quote item table in magento2

texts:
I have quote id I want to update price , base_row_total & other prices related field in quote should i want to set price only rest field should automatically update is this possible or i am thinking wrong .
please help thanks in advance

I am using the below Code but its shores only sku,name,store_id,i checked default magento cart Api its storing all vales in quote Table i want to do the same but its not working for me:

 $product = $this->product->get($this->sku);

        $quoteItem = $this->quoteItemFactory->create();

        $quoteItem->setProduct($product);


texts: Magento_Paypal - Error 404 on Customer Section load

texts:
After executing composer update, we were unable to use the minibasket and customer links on our frontend.

Investigating in the developer console showed a 404 for the url /customer/section/load.

The response is {"message":"The element with the &quot;root&quot; ID wasn&#039;t found. Verify the ID and try again."}.

It seems like the Paypal buttons in the Magento backend are responsible for the problem as i tried to comment out the shortcuts in Magento_Paypal/Observer/AddPaypalShortcutsObserver.php:55 - 62 and the basket was fully functioning again.

This now leaves us with the issue of not having Paypal on our shop and i'm at a loss on how to fix this issue.


texts: how to get parent category collection dependency injection magento 2.3.1

texts:
How can I get a first category level from Magento 2.3, my category setup looks like this now.
root_catalog
    |-First  |-Shoes
             |-T-shirts
    |-Brands
    |-Demo
    |-Test

Now First category click open sub category like shoes and T-Shirt in magento 2.3 dependency injection


texts: Out of Stock Inventory showing as In Stock

texts: I have a Configurable Product which has many Simple Products as variations of it. Some of the Simple Products are Out of Stock however when selected in the product listing, the product still displays as In Stock. What is causing this?


texts: Create orders / quotes of non catalog products

texts:
is Magento 2 Open source version (maybe with an extension) able to create orders and quotes for non catalog products. I only want to make use of the admin tool and not of a shop function.
So can i handle individual products with Magento? For example if I want to provide a custom produced 3D print part for a special customer.
Thank you very much


texts: What is faster - getting raw attribute value or use collection?

texts:
I need to load one attribute value(weight) for many product IDs.

Say list of the product ids is in array $productIDs.

In general case, which approach is faster,

Loading raw attribute value for each product, without loading products:

foreach ($productIds as $productId) {
    $weight[$productId] = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'weight', $store_id );
}

Using collection:

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('id', array('in' => $productIds));
foreach ($collection as $product) {
    $weight[$product->getId()] = $product->getWeight();
}


texts: How can I edit user registration email of Magento2 ? I need to know the location of the email template which is send after an User registration.


texts: How to create multi store/branches for showing products?

texts:
I want to create website for one shop who is having two branches in different areas. Once the user visit the site, they have to select the branch of the shop. Products have to display according to each store.

Can anyone give me suggestions how to do this?


texts: How to get discount amount for each item from order id / item id

texts:
How can I get the discount amount for each item in an order?
using its order id/item id.

I am not able to retrieve the discount amount from its order id/item id.


texts:
I'm trying to develop a module to show a list of categories' name and image, my controller send an array contains names and images url to my block, i want to show a default image if no image assign to any category:

-so my questions where is the better place to check if  the image url is null and assign the default image url (in controller or in block).

-my second part of the question where to save this image in media or in skin folder as im planning to use it in defferent themes and i dont want to change the code every time i move it


texts: Home blank screen - File failed to include not mentioned anywhere

texts:
Getting this inclusion error. This seems to cause home to die now. Blank screen and this is the only error I am getting. Was not the case before. Perhaps me dumping all the cache caused this but doubt it. Here is the error:

    tail -n 20 prelaunch.domain.com/var/log/system.log
    2017-02-04T18:08:51+00:00 ERR (3): Warning: include(): Failed opening 'TCurrencySwitcher.php' for inclusion (include_path='/home/user/prelaunch.domain.com/app/code/local:
 /home/user/prelaunch.domain.com/app/code/community:/home/user/prelaunch.domain.com/app/code/core:/home/user/prelaunch.domain.com/lib:.:/usr/local/lib/php:/usr/local/php5/lib/pear')  in /home/user/prelaunch.domain.com/lib/Varien/Autoload.php on line 94

Seems that it looks for the file TCurrencySwitcher.php in multiple locations, but cannot find it. And that makes two of us. Cannot locate it nor do I see it included anywhere. grep -rnw 'prelaunch.domain.com/' -e "TCurrencySwitcher.php" only showed the same error multiple times in the /var/log/system.log.

When I do a
grep -rnw 'prelaunch.domain.com/' -e "TCurrencySwitcher" --exclude-dir prelaunch.domain.com/var/log

I do find some legacy code (done by previous developer) here:

prelaunch.domain.com/app/design/frontend/rwd/default/template/directory/currency.phtml:32:if(!class_exists('TCurrencySwitcher')) {
prelaunch.domain.com/app/design/frontend/rwd/default/template/directory/currency.phtml:33:  class TCurrencySwitcher {
prelaunch.domain.com/app/design/frontend/rwd/default/template/directory/currency.phtml:58:              <?php echo TCurrencySwitcher::codeToIcon($_code); ?>

That file has

if(!class_exists('TCurrencySwitcher')) {
    class TCurrencySwitcher {

        function codeToIcon($_code) {
            if($_code == 'BND') {
                $_code = 'usd';
            }
            return "";
        }
    }
}

if($this->getCurrencyCount()>1): ?>

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

    <?php foreach($this->getCurrencies() as $_code => $_name) {
        $currencyClass = $_code;
        if($this->getCurrentCurrencyCode() == $_code) {
        $currencyClass .= " current";
        }
        ?>

            <a href="<?php echo $this->getSwitchCurrencyUrl($_code); ?>"
               class="<?php echo $currencyClass; ?>">
                <?php echo TCurrencySwitcher::codeToIcon($_code); ?>

        <?php
    }; ?>

    <?php /*
    <select id="select-currency" name="currency" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Your Currency')) ?>" onchange="setLocation(this.value)">
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
        <option value="<?php echo $this->getSwitchCurrencyUrl($_code) ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
            <?php echo $_name ?> - <?php echo $_code ?>
        </option>
    <?php endforeach; ?>
    </select>
     *
     */ ?>

<?php endif; ?>

But not the specific include.
Any ideas how I can debug this?


texts: How to set thumbnail image programmatically in Magento 2?

texts:
How can I set main product image as thumbnail image programmatically in Magento 2?

Scenario:

I have a loop running trough all products and each product has a main image, only some products have not defined an image for thumbnail. So I want to set the main image also as the product thumbnail for each product.


texts: How to hide Select from gallery button in Ui Component Form Magento 2

texts: I have create A Image upload field Using UI Component. Now  I want to Hide or Delete Button. Any help would be appreciated.


texts:
I'm trying to show the order comments history on the invoice (Magento 2.2.6)

I've written the following override:

app/code/Denial/InvoiceComments/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="Magento\Sales\Block\Order\Comments" type="Denial\InvoiceComments\Block\Rewrite\Order\Comments" />
</config>

And

app/code/Denial/InvoiceComments/Block/Rewrite/Order/Comments.php

<?php

namespace Denial\InvoiceComments\Block\Rewrite\Order;

class Comments extends \Magento\Framework\View\Element\Template
{

public function getComments()

{
if ($this->_commentCollection === null) {
        $entity = $this->getEntity();
        if ($entity instanceof \Magento\Sales\Model\Order\Invoice) {
            $this->_commentCollection = $this->_invoiceCollectionFactory->create();
            $this->_commentCollection = $this->_orderCollectionFactory->create();

     }
}
return $this->_commentCollection;

}

}

Is this right? Have I missed any steps? I ran di:compile but the order comments aren't showing up, only the invoice comments. Am I adding to the commentCollection correctly?


texts:
After I upgraded Magento manually (copied the files of 1.7 into my Magento 1.6) I had some errors coming from Code in app\code\local\Mage.

For example:
Fatal error: Undefined class constant 'TYPE_BILLING' in [...]/app/code/core/Mage/Sales/Model/Quote.php on line 547

In this case the problem was in: app/code/local/Mage/Customer/Model/Address/Abstract.php
I copied the new version of Abstract.php and put the changes into the new file.

There where some other similar errors that I fixed the same way.

Now I dont get any bugs anymore by clicked around, but how can I be sure I found everything? There is quite a lot in the app\code\local\Mage folder and to check all files manually will take forever.

So how do you check the custom adaptations in app\code\local\Mage?


texts: Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory not work in observer

texts:
$category = $this->categoryFactory->create()->load($categoryId);
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $collection = $objectManager->create('Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection');
    if ($category->getIsVirtualCategory()) {
        $queryFilter = $category->getVirtualRule()->getCategorySearchQuery($category);
        $collection->addQueryFilter($queryFilter);
    } else {
        $collection->addCategoryFilter($category);
    }

    echo "<pre>";
    print_r($collection->getData());

This piece of code is work in every where but i past this code on category save after event catalog_category_save_after it through exception

No such entity with id = 0 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with id = 0 at /var/www/html/vendor/magento/framework/Exception/NoSuchEntityException.php:50)"}

I don't understand why it through exception on observer.
I also try this code in plugin
<type name="Magento\Catalog\Model\Category">
    <plugin name="categoryaftersaveplugin" type="TM\WhiteListEmails\Model\CatgeoryAfterSave" />
</type>

But it not working.
I have also try to replace object manager with argument contructor
<type name="Vendor\ModuleName\Cron\GetVirtualCategory">
        <arguments>
        <argument name="collectionFactory" xsi:type="object">Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory</argument>
        </arguments>
    </type>

but the same result does not work In the observer
any suggestions about this?


texts: How to get Magento 1.9 CE's events list and which event is called when?

texts:
Need a list of Magento 1.9.2.2 latest events, along with specification of which event is called when.

For example "sales_order_payment_place_end".


texts: how to remove header links class with ul tag in magento 2?

texts:
I'm on Magento 2.1.6. The header links are rendered with this structure:

...

...

  ...

My HTML structure is like this:

How can I remove ul tag?? I do not require ul tag.


texts:
I applied SUPEE-10266 patch earlier but now I found changes in Mage_Core_Model_File_Validator_Image file, Due to these changes Image size is getting bigger than actual size after upload. Can anyone please suggest the solution?

Thanks


texts: How can we interchange the display of tax in magento 2

texts:
At the product detail page, we need to interchange the position of 'Excl. Tax' and 'Incl. Tax'.
Please check the image.


texts: How to make a field required on product edit page only if another filed is checked

texts:
I have creaed two product attributes "show member price" and "member price".  By default the field Member price is non mandatory. But when the admin checks the "show member price(checkbox)" filed than the field "member price(text)" should become mandatory but for now the filed remains non mandatory in both the conditions.

Please help.
Thanks in advance.


texts: add extra field with product on cart.phtml magento

texts:
I want to show attachment link with every product which is in cart. I only need product id on cart.phtml, but product are rendering with this code

   <?php foreach($this->getItems() as $_item): ?>
       <?php echo $this->getItemHtml($_item) ?>
    <?php endforeach ?>`

and I am unable to fetch product Id, how can I get product Id so that I can show link with every product in cart.

I am working with configurable product and $productID = $_item->getProductId(); returns always parent id. Is any way to get child product id in cart ?


texts: I can't understand , how url rewrite module work in magento 2 ? Can we regenerate all products & category url in magento 2 like magento 1 ? or is there any specific any other method for that.


texts: Minicart no update with custom add to cart in magento 2.2.4

texts:
I created my custom module for add a product to my cart, if I use my controller with this form :

<form action="http://*********/mycart/cart/add/uenc/*******/product/1/" method="post">

My product is in my cart, but minicart is not update, and change page not resolve this problem.

But, if I change my form link with magento controller like this :

<form action="http://*********/checkout/cart/add/uenc/*******/product/1/" method="post">

It's work fine

In my controller, I have just change this

namespace Magento\Checkout\Controller\Cart

to this

namespace Test\Mycart\Controller\Cart;


texts: How to get attribute lable in observer, for creating json file of product details?

texts:
public function productDataToJson(Varien_Event_Observer $observer)
{
  $category = Mage::getModel('catalog/category');
  $tree = $category->getTreeModel();
  $tree->load();
  $ids = $tree->getCollection()->getAllIds();
  $jsonFilePath = Mage::getBaseDir().'/jsondata';
  foreach ($ids as $id) {
    $array = array();
    $products = $category->load($id)
        ->getProductCollection()
         ->addAttributeToSelect('*')
         ->addStoreFilter(Mage::app()->getStore()->getId());
    foreach ($products as $_product) {
        $array[] = array_merge($_product->getData(), array('category_ids' => $_product->getCategoryIds()));
    }
    $jsonData = Mage::helper('core')->jsonEncode($array);
    file_put_contents($jsonFilePath.'/c_' . $id . '_node.json', $jsonData);
  }
}

Currently I am getting attribute id's but not getting attribute lables.
eg. Color:23,Size:345. But I want Color:Red, Size : XL etc.


texts: How to hide from builtwith.com like websites?

texts:
Is it possible to be hiden from builtwith.com such websites (i.e) hide what type of ecommerce platform we are using.
Ref: http://builtwith.com/giftease.com

Thanks.


texts:
I updated my module by composer and it works fine but I still have an incoming message when I log into my admin panel.

And you can see in my code the module is updated

I do setup: update cache: fush but no change, the message is present
Can someone help me to deactivate this message?


texts: Magento2 add tab in admin Product Details

texts:
how do I add a tab in the admin panel under the Product Details, assuming that I already made a module and enabled it. I just can't find the right place Screenshot applied:

Just like add a tab from anywhere and attach the tab to template file, block, etc. Thank you.


texts: Custom Attribute Product - Checkout Page - Shipping Module - ObjectManager Instance

texts:
I'm trying to get custom attribute from product, I've make 3 news attributes (width, height, length). I want get it to quote shipping value.

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

foreach($items as $item){
$width = $item->getData('width');
//NOT WORKING
}


texts: Injecting and calling custom knockout component in another component

texts:
I am using 2 components for multi-select and select input fields.

Multiselect component -

define([
    'underscore',
    'uiRegistry',
    'Magento_Ui/js/form/element/multiselect',
    'Magento_Ui/js/modal/modal',
    'Namespace_Modulename/js/selectoptions'
], function (_, uiRegistry, multiselect, modal,selectoptions) {
    'use strict';

    return multiselect.extend({

        /**
         * On value change handler.
         *
         * @param {String} value
         */
        onUpdate: function (value) {
            console.log(selectoptions.myNew());
            return this._super();
        },
    });
});

Select Component -

define([
    'underscore',
    'uiRegistry',
    'Magento_Ui/js/form/element/select',
    'Magento_Ui/js/modal/modal'
], function (_, uiRegistry, select, modal) {
    'use strict';

    return select.extend({

        myNew: function () {
            console.log('In my new function');
        },
    });
});

I have injected selectoptions component in multi-select component and calling its myNew method onUpdate of multi-select. But I am getting below error.

selectoptions.myNew is not a function

UPDATE

I was able to call the function now using

selectoptions.prototype.myNew();

But still not getting why we need to use prototype here.


texts:
We're using Authorization, then Capture method for Credit Card payments. After we've quickly glanced over a batch of orders we'd like to invoice them all at once.

Step 1: Invoicing is easy. "Sales" -> "Orders". Click on the orders you'd like to invoice. Go to "Actions [Invoice]". "Submit". Multiple orders have just been invoiced!

Step 2 (Capturing) is the problem -- none of the invoices get Captured and the created invoices are given the status "Pending". From the "Sales"->"Invoices" lists, we can manually click into each Invoice, we can click the option "Capture" and that works . We can also go to "Sales" -> "Orders" and click "Invoice" and that will capture as well. But clicking into the orders manually kind of defeats the purpose of Step 1.

Is there some sort of Pending Invoice scheduler that captures pending CC invoices and I'm not aware of it??


texts: How to correctly call for `Mage.php` in the root folder

texts:
I need to access store config from Magento root folder.

If the file is in the root folder I can do this by: require_once(__DIR__ . '/app/Mage.php');

Although, if I would have my file in, for example *root folder*/Jurgis/Twilio/file.php I get an error No such file or directory,how do I then properly call the Mage.php?


texts: Correct admin menu location for an "Order Attributes" extension for Magento 2

texts:
I recently purchased the Order Attributes for Magento 2 extension from Amasty which I'm happy with, however, I believe the extension menu location is incorrect but Amasty tell me it's not.

They've placed the Order Attributes configuration in the "Sales" menu under a new sub-heading "Amasty Order Attributes".

I believe they should be placed under the "Stores > Attributes" menu.

We use Magento every day and consider the sales menu for everything related to a specific order e.g. orders, invoices, shipments, credit memos.

Order attributes are a setting that only needs to be configured once not for every order. Once an order attribute is created we can use it on every order we create. Just like product attributes which one created can be used for all new and existing products.

I emailed Amasty with my concern and they replied:

  We developed the module Order Attributes according to our customers'
  requirements.

  And according to them the order attributes tab should be placed in
  'Sales', as it directly connected with Orders processing.

  From the technical point of view, it is also necessary to be placed
  there as our order attributes table is kept with Magento orders table.

  So to avoid any conflicts with Magento, the tab was necessary to be
  placed in Stores.

  We deeply apologize if it is not very comfortable for you, but the
  module was developed according to the logic I have described.

I then responded:

  Do you have any link to the Magento 2 developer guidelines for menu
  items? I'm curious to learn more about what you are saying but I can't
  find the info anywhere.

  I still think it is impossible that Magento suggest the sales menu for
  order attributes so I'm eager to see for myself

They replied:

  You cannot find this guidelines as it is the internal documentation
  and we cannot share it, unfortunately.

  As I have said previously, you see that the tab 'Orders' (which is the
  default Magento tab) is situated in the tab 'Sales' and to avoid any
  conflicts with Magento functionality, our developers placed the tab
  with Order Attributes also in the tab 'Sales'.

  These two functionalities 'Orders' (Magento) and 'Order Attributes'
  (Amasty) are closely connected with each other and their tables (from
  which the information is taken) should be placed in one and the same
  place from the technical point of view.

So I come to Stack Exchange to ask who is right here? Me or Amasty? And is there any Magento 2 developer documentation that anyone can link me to that confirms the "technical point of view" that Amasty have described.

As a user it just doesn't make sense to have "Order Attributes" in a sales menu.


texts: Magento2 2.3.3 not creating symlinks for static files anymore

texts:
After a lot of searching on google, I hope someone can help me out.

Magento2 version 2.3.3 is running on nginx with the sample config from Magento. PHP 7.1.33 is running via fcgi.

The developer mode is set through the cmd tool and also through the nginx ENV params.
Unfortunately for pub/static all files are copied, which leads to the annoying fact, that I have to rerun bin/magento setup:static:deploy for every change to see it in the frontend (which takes a lot time).

I already checked app/etc/di.xml for the <item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item> part.
I checked permissions.
But Magento is only copying the files - no symlinks.

Hope somebody can help!


texts: Magento 2.3.1 How to hide out of stock products from frontend?

texts:
I have Magento setup version 2.3.1
in normal Magento flow if salable qty is > 0 then the product will show in frontend else hide it. This functionality is working correctly after Magento version 2.3.3 but in Magento 2.3.1 it is not working.
In Magento2.3.1 if salable qty is 0 and qty is 1 still the product showing on the frontend is wrong. Need to hide that product from the front end.
I found some solutions like "Disable the MSI module", "upgrade the version", etc.
I can't update the version or not able to disable the module of MSI.
Is there any other solution? anyone has then please share.


texts: Export Magento 1.8 category list with product name and sku

texts:
I'm looking at the post here:

Create CSV list of all products & their categories

and the instructions to "put the script in a file on the same level as index.php and run it in the browser or command line."

I'm new to Magento. Does this mean to create a .bat file and place it in same file level as index.php?  Where is index.php located?


texts:
I created image attribute and also create image in media custom folder. While form submit i save imgae url in Database it's working fine. I want to show in grid how i show

my output

http://localhost/Test/media/Custom/Yellow.png

Here Yellow is attribute name it dynamically change based on user select


texts: Magento 2 wysiwyg editor does not load folder

texts:
I have issue with magento 2 wysiwyg editor it does not load folder even storage root folder. I have check for permission pub/media/wysiwyg its showing with 777 permission.
Also I have checked for ajax request for loading folder and images.
I show only one ajax eg.

http//:your-site.com/admin/cms/wysiwyg_images/index/key/fce7ea57790a8af9e04f9fa7ab30e4497b34daeb28de37dc406eb0fdecdeda88/target_element_id/cms_block_form_content/?isAjax=true

But doesn't call ajax for folders and images eg.

http://your-site.com/admin/cms/wysiwyg_images/treeJson/key/624549f545378e9b2a23ad0da8bb91687a1e8a12d472784775e7bce3eaaad856/?isAjax=true
http://your-site.com/admin/cms/wysiwyg_images/contents/key/c22d1a702aef715d8a353b5954bbe9828904dc8976ddcaa18b47f24c7c3f3036/?form_key=BIU8Gw1orqmYYBvn&node=root&isAjax=true

Here is my screenshot https://prnt.sc/j0be60

Can anyone knows why it is heppens, or where can I look for the issue.
Thanks in advance.


texts: how to customise sales email in magento 1.9.x

texts:
I am designing the transactional emails for my webshop and have created new templates with custom design. However, for the sales emails I am not able to customize all content. Where can I customize the shipping description, shipping address and the order items grid?
It is called by the following 3:

{{var order.getShippingDescription()}}
{{var order.getShippingAddress().format('html')}}
{{layout handle="sales_email_order_items" order=$order}}


texts: Magento 2: How to add a new phtml(template) to a layout file so I can use it in the head section?

texts: I am trying to add a phtml template file to the layout file so that I can use this template in the head section to insert contents from an JS file. Please tell me what is the best way to do this?


texts: Magento 2 : Coding standerd Provide me Some Warnings How to solve it?

texts:
I have checking my Module`s Code using

  --standard=MEQP2

that provide me some warnings

How can i use the core function of php in Magento 2.3.1


texts: Magento 2 : Custom module - Shipping per product

texts:
I have created custom shipping method named ad My Shipping Method and have created custom attribute named my_Shipping_charge. Both are working fine without any error.
Now I want to set condition if my_Shipping_charge has any value then it will consider it as shipping charge otherwise default charges of My Shipping Method should be apply.

For example,
default charges set in My Shipping Method is 10
my_Shipping_charge for product A is null
my_Shipping_charge for product B is 15
my_Shipping_charge for product C is 5

Then total shipping charge should be 10+15+5

    private function getShippingPrice()
    {
        $configPrice = $this->getConfigData('price');
        $shippingPrice = $this->getFinalPriceWithHandlingFee($configPrice);

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

        /*To find number of items available in cart */
        $itemsVisible = $cart->getQuote()->getAllVisibleItems();
        $itemNum = count($itemsVisible);

        /*To find quantity of item */
        $items = $cart->getQuote()->getAllItems();

        $finalShippingChargeOfProduct = 0;

        foreach($items as $item) {

            $qty = $item->getQty();
            $product_id = $item->getProductId();
            $customProduct = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);
            $myShippingAtt = $customProduct->getData('my_shipping_charge');
            settype($myShippingAtt, "integer");

            if($myShippingAtt <= 0)
            {
                $finalShippingChargeOfProduct += $shippingPrice*$qty;
            }
            else
            {
                $finalShippingChargeOfProduct += $customProduct->getData('my_shipping_charge')*$qty;
            }
        }
        return $finalShippingChargeOfProduct;
    }

Everything is working fine but error in loop. custom attribute value is not correct everytime.


texts:
I have a magento website in which the store structure is:

All Store Views
Main Website
 Main Website Store
 Default Store View
 Main Website Store
 English
 Main Website Store
 English

I have accidentally created them while importing the products and order. now i am not getting how to remove them and i only want single store on my website.

Thanks in advance


texts: ProductCollection - Custom Field - addFieldToSelect

texts:
I've created a new field for products. Everything is working perfect.

However, when I call the ProductCollection I always have to add an addFieldToSelect('custom_field') to return the value of the field.

How do I get the new field to ALWAYS return ( without adding the addFieldToSelect() ) when I call the ProductCollection()?


texts:
How to upgrade new version of module code by using composer in Magento 2 from the third-party repository.

How to upgrade third-party module using composer?
If anyone knows then please help me out. Thanks.


texts: How to see all the observers currently registered?

texts:
I'm facing a problem in which I have created an observer as follows:

<?php
namespace Magento\SamplePaymentGateway\Observer;

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

class ProcessGatewayRedirect extends ObserverInterface
{
    /**
     * @param Observer $observer
     * @return void
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        //die('order lllllllllllllllllllll');
        $orderId = $observer->getEvent()->getOrderIds();
        $base_url = $this->_storeManager->getStore()->getBaseUrl();
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $order = $objectManager->create('\Magento\Sales\Model\Order') ->load($orderId[0]);
        $payment = $order->getPayment();

        $method = $payment->getMethodInstance();
        $methodTitle = $method->getTitle();

        $order_data= $order->getData();
        $status = $this->checkoutSession->getLastOrderStatus();

          $increment_id = $order_data['increment_id'];
          $redirect = $objectManager->get('\Magento\Framework\App\Response\Http');
          $redirect->setRedirect($base_url.'custompayment/index/redirect/id/'.$increment_id.'');
          return;

    }
}

  events.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
   <event name="sales_order_place_after">
       <observer name="process_gateway_redirect" instance="Magento\SamplePaymentGateway\Observer\ProcessGatewayRedirect" />
   </event>
</config>

Then when I run

  php bin/magento setup:di:compile

command I get error as follows:

  Fatal error:  Class
  Magento\SamplePaymentGateway\Observer\ProcessGatewayRedirect cannot
  extend from interface Magento\Framework\Event\ObserverInterface in
  /var/www/html/m4/app/code/Magento/SamplePaymentGateway/Observer/ProcessGatewayRedirect.php
  on line 39

  Fatal error: Class
  Magento\SamplePaymentGateway\Observer\ProcessGatewayRedirect cannot
  extend from interface Magento\Framework\Event\ObserverInterface in
  /var/www/html/m4/app/code/Magento/SamplePaymentGateway/Observer/ProcessGatewayRedirect.php
  on line 39 Segmentation fault (core dumped)

Line 39 in ProcessGatewayRedirect.php is the closing bracket of the observer class.
I'm unable to figure out the real cause.

I doubt that my observer is not properly registered, so is there any fault in my code or is there any way we can list all the observers currently in our system?


texts: How to get information about product in cart

texts:
I want to get information about product in cart such as customer_firstname, customer_email.

I use this code:

$carts = Mage::getModel('checkout/cart')->getQuote();
foreach( $carts->getAllVisibleItems() as $cart){
    var_dump($cart->getProduct()->getCustomerFirstname());
}

Its returns null although when I print $cart it returns data.


texts: after ajax load grid massaction additional form not working

texts:
i am adding the mass action from observer that are work perfectly but after the ajax load grid it is not working. cannot show the additional form.

copying this code from Mage_Adminhtml_Block_Customer_Grid

$groups = $this->helper('customer')->getGroups()->toOptionArray();

        array_unshift($groups, array('label'=> '', 'value'=> ''));
        $this->getMassactionBlock()->addItem('assign_group', array(
             'label'        => Mage::helper('customer')->__('Assign a Customer Group'),
             'url'          => $this->getUrl('*/*/massAssignGroup'),
             'additional'   => array(
                'visibility'    => array(
                     'name'     => 'group',
                     'type'     => 'select',
                     'class'    => 'required-entry',
                     'label'    => Mage::helper('customer')->__('Group'),
                     'values'   => $groups
                 )
            )
        ));

$orderstatus = Mage::helper('modulename')->getStatus();

            array_unshift($orderstatus, array('label'=> '', 'value'=> ''));
                $block->addItem('orderstatus', array(
                    'label' => 'Order Status',
                    'url' => $url,

                    'additional'   => array(
                    'visibility'    => array(
                         'name'     => 'status',
                         'type'     => 'select',
                         'class'    => 'required-entry',
                         'label'    => Mage::helper('modulename')->__('Status'),
                         'values'   => $orderstatus
                     )
                )

                ));

any help will be appreciated.


texts: Magento 1: How to verify local magento on Mage report for patches?

texts:
I am using magento 1.9.0.1 and i have applied some patches on this in my local system. Now, I want to check patches applied successfully or not on magereport.com.

How can i check my local magento on magereport.com?

Note: I know that we can check by looking in  app/etc/applied.patches.list but I am applying patches by copy/paste files so these patches details are not available in app/etc/applied.patches.list

Can anyone help me in this?


texts:
In my installation, the ship button is actually missing.

What is wrong?

I know orders must be invoiced and an email sent.I've done both.

Am I missing some other requisites?

Does cron not being set up have anything to do with this?


texts:
I have two modules:

Vendor_Module1
Vendor_Module2

In either module I'm going to extend \Magento\Directory\Model\Currency to override different methods

I noticed that only one module can override this class at the same time. The module that is placed lower in config.php will have precedence.

I guess something goes wrong. Till now I was absolutely sure that there is no any limitation on how many modules override any class. Who can tell me what I missed?

(Each module overrides its own methods. Of course every time I clear cache, delete generated/code and so on)

It's Magento 2.3.0 if it makes any difference


texts: Can't see products in categories after categorizing programmatically

texts:
Using CE 1.8.1, I've just categorized a number of products using code like this:

$product = mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
$product->setCategoryIds($cats);
$product->save();

I can't get the products to show up in their new categories on the front end. I see the results in the catalog_category_product table - the information is in the database.  I also see it when I edit individual products in the admin.  From the admin, I've reindexed everything and flushed all cache storage.

What can I do to see these new product categorizations?


texts: How to add a script attribute to addItem

texts:
I want to add an embedded MailChimp script to my Magento 1 installation. However, the script has an attribute:

<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>

(the data-dojo-config attribute)

How can I add this attribute using the addItem method?


texts: How to format weight to display 2 decimal places in Orders Grid?

texts:
Currently my Orders Grid is set up to add a Weight column with the total order weight, but it is displaying with 4 decimal places and I would like to only display 2 decimal places.

_prepareCollection

$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->joinInner(array('order_address' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order_address')),'order_address.parent_id = main_table.entity_id',array('company','telephone'))->group('order_address.parent_id');
$collection->getSelect()->join(array('sfo'=>'sales_flat_order'),'sfo.entity_id=main_table.entity_id',array('sfo.customer_email','sfo.weight'));
$this->setCollection($collection);

_prepareColumns

...
$this->addColumn('weight', array(
        'header' => Mage::helper('sales')->__('Weight'),
        'index' => 'weight',
        'filter_index' => 'sfo.weight',
        'width' => '50px',
));
...

What is the proper way to format the data in the grid?


texts: Difficulty creating a new product attribute

texts:
I am trying to create a new product attribute. I fill all of the required fields. When I click on save, I get the following message.

I'm new at this and trying to create a demo site, so I admit to being clueless. What should I enter here, or did I miss a step somewhere?


texts: Move out of stock product in category view last if qty is 0

texts:
I use a module to display out of stock products last in the category view.
That worked fine, but now I enabled the Magento option to purchase products that are out of stock. (The default Magento backorder method)

In that case I need to set all products to status "In Stock", so this code does not work anymore.

How can I edit this code, so that it will check if qty is 0, instead of status is "Out of stock"?

Default code, that works fine when set product to "Out of Stock" status:

class Outofstock_Model_Observer extends Mage_Core_Model_Abstract
{
    public function catalogProductCollectionLoadBefore(Varien_Event_Observer $observer)
    {
        $prefix = '_inventory_table'.rand(0, 10000);
        $collection = $observer->getCollection();
        $collection->getSelect()->joinLeft(
            array($prefix=>$collection->getTable('cataloginventory/stock_item')),
            "$prefix.product_id = e.entity_id",
            array('is_in_stock', 'manage_stock')
        );
        // $collection->addExpressionAttributeToSelect(
        //     'on_top',
        //     '(CASE WHEN (((_inventory_table.use_config_manage_stock = 1) AND (_inventory_table.is_in_stock = 1)) OR  ((_inventory_table.use_config_manage_stock = 0) AND (1 - _inventory_table.manage_stock + _inventory_table.is_in_stock >= 1))) THEN 1 ELSE 0 END)',
        //     array()
        // );
        $collection->getSelect()->order('(CASE WHEN ((('.$prefix.'.use_config_manage_stock = 1) AND ('.$prefix.'.is_in_stock = 1)) OR  (('.$prefix.'.use_config_manage_stock = 0) AND (1 - '.$prefix.'.manage_stock + '.$prefix.'.is_in_stock >= 1))) THEN 1 ELSE 0 END) DESC');
        $order = $collection->getSelect()->getPart('order');
        array_unshift($order, array_pop($order));
        $collection->getSelect()->setPart('order', $order);

    }
}

I already tried the code below, but that does not work perfectly. It does work, except that it does not overrule the catagory sort listing. So the sort listing is first displayed and then all products with the same sort listing are separated from stock and out of stock. I need to edit the code, so that it overrule the sort listing. So first list on stock and than on the sort listing number.
How can I fix this?

class Outofstock_Model_Observer extends Mage_Core_Model_Abstract
{
    public function catalogProductCollectionLoadBefore(Varien_Event_Observer $observer)
    {
        $prefix = '_inventory_table'.rand(0, 10000);
        $collection = $observer->getCollection();
        $collection->getSelect()->joinLeft(
            array($prefix=>$collection->getTable('cataloginventory/stock_item')),
            "$prefix.product_id = e.entity_id",
            array('is_in_stock', 'manage_stock')
        );
        $collection->joinField(
                        'inventory_qty',
                        'cataloginventory_stock_item',
                        'qty',
                        'product_id=entity_id')
                    ->setOrder('inventory_qty','desc');

    }
}


texts:
I am new with AWS. i was able to setup magento ecommerce store using E2 Instances, I am having issues with the full installation (the database aspects ), i will be glad if anybody can help me out.

Thanks in advance.


texts: Magento 2 : Modify loaded product collection

texts: Can we modify loaded product collection in list.phtml file ? And if it is achievable then how can we modify it ?


texts:
I try to create module for custom filter.phtml, but rewriting doesn't work and it show default template for layered navigation options. I tried many ways but without success and now I have no idea why this thing doesn't work.
Here is my code:

config.xml

<My_Module>

  <version>0.1.0</version>

</My_Module>

<blocks>

    <my_module>

      <class>My_Module_Block</class>

    </my_module>

    <catalog>

      <rewrite>
        <layer_filter_abstract>My_Module_Block_Layer_Filter_Abstract</layer_filter_abstract>

      </rewrite>

    </catalog>

</blocks>

Block/Catalog/Layer/Filter/Abstract.php
(I also had tried without "Catalog")

class My_Module_Block_Layer_Filter_Abstract extends Mage_Catalog_Block_Layer_Filter_Abstract
{

public function __construct()
{
    parent::__construct();
    $this->setTemplate('module/catalog/layer/filter.phtml');
}

}

Maby somebody can help me?


texts: Brand/Categorie listing on a custome cms page

texts:
I like to do the follow issue:

A custom CMS page - calling landingpage for each brands we have.

On this page we will have some images, some listing for featured products and a listing from all categories, exist in a specific brand. So for example:

We have the brand Puma:

In there all products by Puma, splitted up in different categories, eg

Men
-> Men Running Shoes
-> Men Trekking Shoes

Women
Running Shoes
Appareils
Clothes men
Clothes Women

etc.

Does it have an extension for it, or what would be the best way to do it?


texts: Add new country in default country dropdown in Magento 2.3.5

texts:
I need to add new country and its regions/states in Magento 2.3.5
I have already done this for Magento1. There are many references available and provide common solution like add entry in directory_country table and changes in vendor/magento/zendframework1/library/Zend/Locale/Data/en.xml file.
reference: https://community.magento.com/t5/Installing-Magento-2-x/How-to-add-new-country-on-Magento-2-1-1/m-p/69286/highlight/true#M2943
But solutions does not work with Magento 2.3.5
Regards


texts:
I have setup a custom Magento Rest Api at the endpoint: "https://domain-name.de/rest/V1/wawi". This Api just returns a simple json string. Have tested my Api with Postman application -> works fine.

The problem occurs, when I test it in PHP script:

 $curl = curl_init();

 curl_setopt_array($curl, array(
 CURLOPT_URL => "https://domain-name.de/rest/V1/wawi",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 30,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_SSL_VERIFYPEER => 0,
 CURLOPT_SSL_VERIFYHOST => 0,
 CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS => "{\"p\":\"test\"}",
 CURLOPT_HTTPHEADER => array(
 "cache-control: no-cache",
 "content-type: application/json",
 ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
 echo "cURL Error #:" . $err;
} else {
  echo $response;
}

RESULT:

cURL Error #:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

Any ideas on how to solve this issue ?

EDIT
Just checked my magento server is using "OpenSSL 1.0.1e-fips 11 Feb 2013 openssl version number: 268439647" and my client is using "OpenSSL 1.0.1k 8 Jan 2015 openssl version number: 268439743"


texts: SOAP-ERROR: Parsing WSDL: Couldn't load from URL Failed to load External Entity

texts:
I'm trying to get all products in $productArrarray from magento 2 API via SOAP client. I tried the below function but it throws this error:

Error:

  SOAP-ERROR: Parsing WSDL: Couldn't load from
  'https://shop.mysite.com/soap/default?wsdl&services=catalogProductRepositoryV1'
  : failed to load external entity
  "https://shop.mysite.com/soap/default?wsdl&services=catalogProductRepositoryV1"

Code:

public function getMagentoProducts() {

    $productArr = array('' => 'Select Product');

    try {
        $request = new SoapClient("https://shop.mysite.com/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));
        $token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"user", "password"=>"pass"));
        $opts = array(
            'http'=>array(
                'header' => 'Authorization: Bearer '.json_decode($token->result),
                'user_agent' => 'PHPSoapClient'
            ),
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            )
        );
        $wsdlUrl = 'https://shop.mysite.com/soap/default?wsdl&services=catalogProductRepositoryV1';

        $context = stream_context_create($opts);
        $soapClientOptions = array(
            'stream_context' => $context,
            'cache_wsdl' => WSDL_CACHE_NONE
        );
        libxml_disable_entity_loader(false);

        $soapClient = new SoapClient($wsdlUrl, ['version' => SOAP_1_2, 'context' => $soapClientOptions]);
        var_dump($soapClient);exit;
        $soapResponse = $soapClient->__getFunctions();

    } catch (Exception $e) {

      $this->forward404($e->getMessage());
    }
  }


texts: In Magento 2 how to add automatic schedules to Promo Codes.


texts: Is anyone have an idea, how to convert XML to LayoutProcessor format?

texts:
Is anyone have an idea about convert XML to LayoutProcessor format?
I have created a layout processor as given below. I need to only those sentence which is defined in XML.

  \Magento\Checkout\Block\Checkout\LayoutProcessor

<item name="shipping-address-fieldset" xsi:type="array">
    <item name="children" xsi:type="array">
        <item name="telephone" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Mobile phone number</item>
                <item name="elementTmpl" xsi:type="string">Vendor_Customer/form/element/input</item>
            </item>
            <item name="validation" xsi:type="array">
                <item name="custom-validator-phone" xsi:type="boolean">true</item>
            </item>
        </item>
    </item>
</item>

  /app/code/Vendor/Customer/Plugin/Checkout/LayoutProcessorPlugin.php

public function afterProcess(
    \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
    array $jsLayout
) {
    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
    ['shippingAddress']['children']['shipping-address-fieldset']['children']['telephone']['children'] = [

        [
            'config' => ['elementTmpl' => 'ui/form/element/input'],
            'dataScope' => '1',
            'provider' => 'checkoutProvider',
            'validation' => ['custom-validator-phone' => true],
        ]
    ];
    return $jsLayout;
}


texts: How to properly create product variations for configurable products

texts:
I am getting a broad error when trying to save a product configuration:

  Some product variation fields are not valid.

See screenshot (click for full size):

What do I need to change?


texts:
I added a link in the horizontal menu using subcategories and url rewrite. It works using this method http://www.templatemonster.com/help/magento-adding-page-links-in-the-navigation-bar.html#gref

Trying to add a second link there I had a different result with the same procedure.

In Url rewrite, in the Request Path I inserted the name of the page ("assistance") but there's no such page in the results.

The page is regularly published in CMS under url key "assistance"

How to find the page in URL rewrite menu?


texts: How to add view.xml in custom module for displaying custom gallery in magento 2

texts: I am displaying a custom gallery in a custom module and I have to resize my images. I need to know how I can use view.xml in my custom module. If you have a relevant answer then please let me know.


texts: Validate and apply coupon when create an order programmatically

texts:
I create an order programmatically like this:

$store = $this->storeManager->getStore();
$websiteId = $this->storeManager->getStore()->getWebsiteId();
$customer = $this->_customerFactory->create();
$customer->setWebsiteId($websiteId);
$customer->loadByEmail($email);
$quote = $this->quote->create();
$quote->setStore($store);
$customer = $this->_customerRepoInterface->getById($customer->getEntityId());
$quote->setCurrency();
$quote->assignCustomer($customer);

foreach ($productsOrder as $productOrder) {
  $productId = $productOrder['product_id'];
  $qty = $productOrder['qty'];
  $product = $this->_product->load($productId);
  $price = $product->getPrice();
  $product->setPrice($price);
  $quote->addProduct(
      $product,
      intval($qty)
    );
}

$quote->getBillingAddress()->addData($address);
$quote->getShippingAddress()->addData($address);

$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setCollectShippingRates(true)
  ->collectShippingRates()
  ->setShippingMethod($shippingMethod);
$quote->setPaymentMethod($paymentMethod);
$quote->setInventoryProcessed(false);
$quote->save();

$quote->getPayment()->importData(['method' => $paymentMethod]);

$quote->collectTotals()->save();

$order = $this->quoteManagement->submit($quote);

how can i apply coupon code in here and validate the coupon code?