texts: how can i add shipping carrier column in admin page

texts:
i'd like to add Carrier (shipping method_ column on magento admin pate
under magento > sales > shipments

i put this code in Grid.php

protected function _prepareCollection()

{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->getSelect()->join('sales_flat_order', 'main_table.entity_id =

  sales_flat_order.entity_id',array('shipping_method'));
          $this->setCollection($collection);z
          return parent::_prepareCollection();
      }

  $this->addColumn('shipping_method', array(
              'header'=> Mage::helper('sales')->__('Shipping Method'),
              'width' => '80px',
              'type'  => 'options',
              'index' => 'shipping_method',
              'options' => $shippingmethods,
              ));

but What i want to be shown is carrier title....like UPS, USPS, DHL
that code show me bit different result tThx
n


texts: Best way to move block created by extension

texts:
I have a 3rd party extension creating a block like so in block class:

class Namespace_Modulenam_Block_Custom extends Mage_Core_Block_Template
{
protected function _construct()
{
    parent::_construct();
    $this->setTemplate("amasty/amlanding/custom.phtml");
}

and assigning it to layout in a controller:

class Namespace_Modulename_PageController extends Mage_Core_Controller_Front_Action {
....
public function viewAction(){
....
$this->getLayout()->getBlock('content')->insert(
            $this->getLayout()->createBlock(
                'modulename/custom'
                )
        );
}

I just want to move the placement of the block (i.e. out of 'content', to a text/list block that i've created in a layout.xml file.
If I edit this module to:

$this->getLayout()->getBlock('my_block')

the object is empty, presumably becuase the layout.xml defined block has not been created when the controller executes.

If i try adding a name to the block i.e.

 $this->getLayout()->getBlock('content')->insert(
            $this->getLayout()->createBlock(
                'modulename/custom',
                 'my_name'
                )
        );
}

I can't edit it in layout.xml. So to test:

<remove name='my_name'/>

...does nothing.

What is the correct method to interact with this dynamic block? Should I be using event observers?
Is there a simple way to do this in my layout.xml?

EDIT BASED ON fschmengler's ASNWER:

I've implemented fschmengler's solution and I am successfully assigning the block name and then unsetting it from the 'content' block.

However in Step2, moving the block:

$layout->getBlock('name.of.new.parent')->append(
    $layout->getBlock('modulename.custom.name')
);

gives
     Call to a member function append() on a non-object

this would be because (as you fschmengler points out), this parent block is presently defined in layout.xml:

<reference name="root">
    <block type="core/text_list" name="name.of.new.parent" as="name.of.new.parent" translate="label" />
</reference>

Do I need to define this block parent block in another way?


texts: Add an Element on the top of header.panel.wrapper

texts:
I need to place an element ot the most top of page. the position is exactly on the top of header.panel.wrapper.

My objection is to have some elements on the the most top of header.

Any help regarding this issue would be very appriciated


texts: Magento Varnish cache: How to find route name of module to exclude from cache?


texts: How to use luma classes in custom theme which is inherite form luma?

texts: Basically I have created a custom theme  .In custom theme I want to use grid class like col-sm-3 and col-md-4 without using Bootstrap.


texts: Magento 2: How to check inarray ids in minicart.js

texts:
getCartItems: function () {
                var items = this.getCartParam('items') || [];
                _.each(items, function (item, key) {
                    console.log(item.product_id);
                 // i have 1,2,3 product ids and need to add a check with minicart product ids and if
                   exists then show custom popup.
                }, this);
                items = items.slice(parseInt(-this.maxItemsToDisplay, 10));
                return items;
            }

Anyone have any idea for this?
Thanks


texts: stickyClass is not defined in magento 2.2.0

texts:
knockout.js:3012 Uncaught ReferenceError: Unable to process binding "css: function (){return stickyClass }"
Message: stickyClass is not defined
    at css (eval at createBindingsStringEvaluator (knockout.js:2624), <anonymous>:3:56)
    at update (knockout.js:3803)
    at ko.dependentObservable.disposeWhenNodeIsRemoved (knockout.js:3004)
    at evaluateImmediate (knockout.js:1737)
    at Object.ko.computed.ko.dependentObservable (knockout.js:1946)
    at knockout.js:3002
    at Object.arrayForEach (knockout.js:151)
    at applyBindingsToNodeInternal (knockout.js:2974)
    at applyBindingsToNodeAndDescendantsInternal (knockout.js:2854)
    at Object.ko.applyBindings (knockout.js:3065)


texts:
I am unable to find any solution that will work for my issue so I need to post the question.

I recently upgraded to 1.9.3.3 and now the Browse button does nothing when clicked when trying to upload product images.

I also tried the Maven HTML5 uploader and it throws a Disallowed file type error (file type is a jpg).

Just not sure what do do next. Please help


texts: I've found topics about enabling sorting by date, this being one example but on 2.4 this does not work, even manually typing ?product_list_order=created_at in url does not get any results, is there some change implemented in 2.4 which has an issue with this, tried to debug collection load for products but not much luck.


texts:
In Form I have added code for checkbox as follows.

$fieldset->addField('title', 'checkboxes', array(
    'label'     => Mage::helper('custommodule')->__('Title'),
    'class'   => 'validate-one-required-by-name',
    'name'      => 'title[]',
    'values' => array(
        array('value'=>'aaa','label'=>'Checkbox1'),
        array('value'=>'bbb','label'=>'Checkbox2'),
        array('value'=>'ccc','label'=>'Checkbox3'),
    ),
    'onclick' => "",
    'onchange' => "",
    'disabled' => false,
    'tabindex' => 1
));

I got 3 checkbox field. If I dont choose any option and if then i click Submit. My form submitted. I want to add validation to these checkbox that one of the checkbox must select before submit. As per This link. I have tried to add class validate-one-required for validation but it doesnt apply to checkbox. I want magento system to validate. Please help me anybody know. Thanks in advance.


texts: I wish to add a dynamic attribute to products. I am looking to add an attribute "Calorie" associated with food products and wish to add them in bundled products much in the same way as their price add up.For eg, if I have a platter of fruits and fruit A is 40 calories and food B is 30 calories. When I keep both of them in my platter the total calorie of the platter should be 70, i.e. the sum of both individual products. Is there a way to add a dynamic attribute or is there any other way to approach this ?


texts: Hidden tax summary from sales mail and order summary/review

texts: we running Magento 1.8.1.0 , we need to hidden the following lines (marked in red in the picture) from order summary and sales mail/pdf : Tax and Grand Total to be Charged.


texts:
The main question would be, how do you people get advanced understating of core Magento?

In particular there are a few subjects that preoccupy me the most:

Cart/payment/checkout process. Quote/order entities and related, their processing on front and admin.
Core models: product, customer, order, quote and related.

There is always the good old resort of going into Magento code and learn from it. But because Magento is a highly complex and abstract platform this takes lots of time.

How could you speed this up?

By example there is this nice book from Magento themselves "Magento for Developers: Product Configuration and “Composite Products” Functionality" by Andrey Tserkus that gives good understanding on composite products and custom options. This is golden!

Learning Magento went like this for me:

First start with a bunch of internet tutorials that always take you from beginner level and get the basics.
When I need to resolve a certain problem find lots of articles that give you some info and a few code snippets. These code snippets sometimes they work sometimes they don't. When using these it usually goes by trial and error.
The last solution, dive into Magento code, reverse engineering, look for how Magento does things and try reproduce functionality. However, this takes lots and lots of time.

Question, is there any "reference level" documentation for Magento?
Books, articles, sites or whatever to give understating of core Magento?
Resources of advanced level to explain the principles of the core?

Of course, I don't want to pay thousands of $ for that, the free stuff is best.

Any help would be appreciated.


texts:
I have a custom module for generate random keys. The concept is when admin clicks the add new button it will automatically creates the random codes, at the time of editing i have removed all buttons and added extra field button to send mail. Upto this i have no problem, but at the time of clicking send mail button i am facing problem,

I have written some scripts for onclick event,
Edit/Tab/Form.php:

$fieldset->addField('promo_email', 'text', array(
                            'label' => Mage::helper('promogenerator')->__('Send Mail'),
                            'name'  => 'promo_email',
                            'after_element_html' => '<button type="button" onclick="sendmail()">Send Mail</button>'
                        ));

I have written the scripts at,
Edit.php:

$this->_formScripts[] = "

    function sendmail(){
        var email = jQuery('#promo_email').val(),
        code = jQuery('#promocode').val();
        window.location.href = '{$this->getUrl(`*/*/send`, array(`id` => $this->getRequest()->getParam(`id`)))}';
    }
";

the problem is in url, the script function not redirect me to the send url, it redirects me to the index page.

I really don't know how to give the url in scripts. Can someone point me the correct solution.


texts: Removing leading zeros in order number, Magento 2

texts:
I am trying to remove the leading zeros from the order numbers.  I have figured out how to set the sequence just fine.  We want to set the orders to start in the 275000 range.

Right now its in the database, visually, etc at 0000275000.

I'd like it to show just 275000.

Any guidance is appreciated.  I thought this could be solved via database, but I am not seeing it.


texts: Update Order Status after Order is placed

texts:
I'd like to update the status if an order has any backordered items.
I have a custom status setup called "quarantined" and I'd like this set if an order is found.
I have tried a few ways to get this working but I am having no luck.
This is my observer, I hope someone can point me in the right direction.

$order = $observer->getEvent()->getOrder();
$items = $order->getAllItems();
$hasBackorderedItems = false;
foreach ($items as $item) {
     if ($item->getQtyBackordered() > 0) {
        $hasBackorderedItems = true;
        break;
     }
}

if ($hasBackorderedItems) {
    // I'm Stuck here. I need to change the current order status to quarantined (which is mapped to the state processing)
}


texts: Security: Patched 1.7.0.2 versus 1.9.2.2

texts:
I have three sites running 1.7.0.2 all fully patched and updated.  Modules all written the 'proper' way (with a couple of small exceptions).  The sites are all pretty much clones of each other.

There is a new site coming - I'm wondering whether I should upgrade them all to the latest version of 1.x (1.9.2.2 at time of writing) and build the new site on that too.  It will mean a lot of testing, the sites do brisk business.

I also wondering whether it's worth that effort or whether I should just use our existing codebase and launch the new site on patched 1.7.0.2. Then focus the development effort on the migration to v2 (I'm aware that will be a much more serious project of course). The real question then is -

Is a fully patched 1.7.0.2 less secure than 1.9.2.2?

I'm not interested in any new features of 1.9.2.2, just whether running on patched 1.7.0.2 buys me enough time to re-develop these sites on v2.

I'm interested to know any thoughts.


texts: Apply catalog price rule on all products of one category

texts:
i have different cataloge price rules for different products of different categories.

Now i want to add a new minus discount to a category with 60 products (-5%), which i implemented successfully. But only 1 product (that has already a discount) gets a new price. The other products arent affected and i dont know why.
I want a new catalog price rule that affect ALL products of one category and increase the price by e.g 5%, whether they have a discount or not.


texts: Magento 2 - Slick slider function not working

texts:
Slick slider function is not working after ajax response, This is the order of my code. Firstly I got a product collection response, Then I wrote a slick slider function. but slider function is not working.

This is dom element in phtml file in which ajax response appear

    <ol class="products list items product-items featured-collector featured-collector_<?php echo $categoryid; ?>">

This is my js code

require([
    'jquery'
    ], function($){
    jQuery.ajax({
        url: "/manufacturerpages/index/collection",
        type: "POST",
        data: "id= <?php echo $manpagedataarr['page_id']; ?>&categoryid=<?php echo $categoryid; ?>&carouselorder=<?php echo $manpagedataarr['carouselorder']; ?>&collection_type=<?php echo $manpagedataarr['collection_type']; ?>&product_ids=<?php echo $manpagedataarr['product_ids']; ?>&manufacturer=<?php echo $manpagedataarr['manufacturer']; ?>",
        success: function (res) {
            //console.log(res);
            var result = jQuery('.product-items', res).html();
            var undefined = false;
            if(typeof result === 'undefined'){
                result = res;
                undefined = true;
            }

            jQuery(".featured-collector_<?php echo $categoryid; ?>").html(result);
            jQuery(".landing-featured .ajax_loading").hide();
            jQuery( "form[data-role='tocart-form']" ).catalogAddToCart();
        }

    });
});

require([
    'jquery',
    'magiccart/slick',
        'alothemes'
    ], function($, slick){
    jQuery('.featured-collector_<?php echo $categoryid; ?>').slick({
        dots: false,
        infinite: true,
        slidesToShow: 6,
        slidesToScroll: 2,
        arrows: true,
        autoplay: false,
        draggable: true,
        speed: 300
    });
});


texts: Couldn't reindex stock of one item programmatically

texts:
I'm trying to reindex one product only programmatically:

$product = Mage::getModel('catalog/product')->load($_productId);
$product->setForceReindexRequired(true);
Mage::getSingleton('index/indexer')->processEntityAction(
    $product,
    Mage_CatalogInventory_Model_Stock_Item::ENTITY,
    Mage_Index_Model_Event::TYPE_SAVE
);

However, nothing is inserted to cataloginventory_stock_status_idx table. But if I reindex using command line:

php indexer.php --reindex cataloginventory_stock

The table is populated.


texts: magento readiness php error during module installation

texts:
I am facing issue with Magento, module installation, same error showing like the beginning of Magento installation.

Here is a screenshot:


texts: How to copy one quote (only cart items) to other quote (only items )

texts:
i want to copy one quote (only cart items) to other  quote (only items ).
Only want to copy cart products to  other new quote.

Suppose: i have old quote,which id is 5,have 4 items

 i have another quote which id 77, have 1 item, i want to copy  4 items of quote id  5 to
quote id  77.

I have try below blog;
Programmatically add items to cart and assign to guest user


texts: How to check when shipping methods was loaded in checkout in Magento 2?

texts:
At checkout the shipping methods are loaded by AJAX. After loaded I need to call a new .js method.

How can I do this?

Thank You!


texts: Frontend Customer Registration newsletter not subscribe magento

texts:
I have issue with newsletter subscription on customer registration process. even i have select "Sign Up for Newsletter" checkbox on registration form.

I got user confirm email but didn't get confirm massage on newsletter as well as newsletter subscription not successful. And not even mention i have subscribe to newsletter. But After I login to account then select newsletter subscription is shows unchecked checkbox. if I checked that and save, I got email to confirm newsletter subscription.

In Back-end I have set "Allow Guest Subscription" and "Need to Confirm" to "Yes"

So anyone have idea about that. Thanks


texts: Search $block->getData('configProvider') in form.mini.phtml returns null after upgrade to 2.3.6

texts:
In 2.3.6, the following line was added to form.mini.phtml:
$configProvider = $block->getData('configProvider');
Since the upgrade, this returns null and causes a fatal error due to this subsequent call on the null object:
$configProvider->isSuggestionsAllowed()
"Uncaught Error: Call to a member function isSuggestionsAllowed() on null"
My site uses a custom module that adds notices during shipping and checkout using blocks.  This module is causing the fatal error, but it shouldn't have anything to do with the search block.
I need to change the module di.xml file or custom class to return a configProvider for search, or tell it to use the default class.  Can anyone point me the right direction?   Many thanks.
Here is my code:
/app/code/Port80/CIBC/etc/frontend/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\CompositeConfigProvider">
        <arguments>
            <argument name="configProviders" xsi:type="array">
                <item name="cms_block_config_provider" xsi:type="object">Port80\CIBC\Model\ConfigProvider</item>
            </argument>
        </arguments>
    </type>
    <preference for="Magento\Customer\Model\Vat" type="Port80\CIBC\Model\Customer\Vat" />
</config>

/app/code/Port80/CIBC/Model/ConfigProvider.php

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\View\LayoutInterface;

class ConfigProvider implements ConfigProviderInterface
{
    /** @var LayoutInterface  */
    protected $_layout;

    public function __construct(LayoutInterface $layout)
    {
        $this->_layout = $layout;
    }

    public function getConfig()
    {
        return [
            'payment_notices' => $this->_layout->createBlock('Magento\Cms\Block\Block')->setBlockId('checkout_payment_notices')->toHtml(),
            'shipping_notices' => $this->_layout->createBlock('Magento\Cms\Block\Block')->setBlockId('checkout_shipping_notices')->toHtml()
        ];
    }
}


texts: how to redirect user to a custom store after login

texts:
I want to redirect a user after sign in to a store after checking customer group type. Now in login.phtml file, where should i make change?
Where should i apply my condition of checking of customer type in the code?
please help.


texts: Magento 2 - Block in footer doesn't show

texts:
I'm trying to add a block to a template built from scratch.
Using template-hints I can see that in the footer the following template is rendered

app/design/frontend/Merchant/merchant/Magento_Theme/templates/html/footer-cms.phtml

with some search I fount that the template is configured in app/design/frontend/Merchant/merchant/Magento_Theme/page_layout/1column.xml :

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <!-- REMOVE MAGENTO HEADER & FOOTER -->
    <referenceContainer name="header.container" remove="true"/>
    <referenceContainer name="footer-container" remove="true"/>
    <referenceContainer name="page.top" remove="true" />
    <!-- INCLUDES TYPO3 HEADER & FOOTER -->
    <referenceContainer name="page.wrapper">
      <block class="Magento\Framework\View\Element\Template" name="t3header" as="t3header"
        before="main.content"
        template="Magento_Theme::html/header-cms.phtml"/>
      <block class="Magento\Framework\View\Element\Template" name="t3footer" as="t3footer"
        before="before.body.end"
        template="Magento_Theme::html/footer-cms.phtml"/>
    </referenceContainer>
</layout>

as I would like to add a newsletter subscription and terms checkbox in the footer, I am trying to do it in app/code/Myvendor/Newsletter/view/frontend/layout/1column.xml

but it doesn't show up even after clearing the cache and I can't figure out why

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <referenceContainer name="t3footer">
      <block class="Magento\Framework\View\Element\Template" name="wf.newsletter2" as="wf.newsletter2"
        before="-"
        template="Myvendor_Newsletter::newsletterprivacy.phtml"/>
    </referenceContainer>
</layout>

I've also tried to put it in the shop/app/code/Myvendor/Newsletter/view/frontend/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="footer_links">
            <block class="Magento\Framework\View\Element\Template" name="wf.newsletter" as="wf.newsletter"
            before="-"
            template="Myvendor_Newsletter::newsletterprivacy.phtml"/>
        </referenceBlock>
    </body>
</page>

but nothing happened

Can someone help please?


texts: Custom product type Configurable does not change the name of the new product when saving

texts: I created a new product type based on the configurable product, but when I save my product it gets the name of the configurable product and not the name of the new product. How can I change the name of my new product? I'm using magento 2.4


texts: Product Description vs. Meta Description - Do I need both?

texts:
I'm currently optimising my products to better rank on search engines. I previously didn't have unique product descriptions but I'm slowly getting through them, removing the manufacturer descriptions, and adding my own.

Now- what is the best way to approach meta-descriptions for these products?

Should I copy and paste a portion of the product descriptions into the meta description? Or, should I write a separate meta description? (which essentially means describing the same product twice). Or, should I leave the meta-description blank and hope that Google pulls my product description and uses that in the search results?

Thanks as always, you guys have always been super helpful.


texts: Can you apply filters to variants in products query?

texts:
I'm using graphql to load Magento products. The problem is that when I filter the products, filters are not applied to product variants.
Is it possible to apply GraphQl filters to variants as well?


texts: Is there a way to change the position of a product for all attributes it belongs to?

texts:
So if you sort with best value it uses the products position attribute in the category to decide the position.

The lower the higher it appears on the catalog page and search page.

We have a custom sold-out attribute that on some products is yes.

On those products we would like the position to be 9999 for all categories it belongs to.

Is there a way to change it on a per product level or do you have to change it on each category?

If there is a programmatic way that would also be the next best prize.


texts: Magento 2.3.6-p1 underscore.js error after fresh install

texts:
So my site is on Siteground hosting and is also running through Ezoic but as far as siteground are concerned it's not a server error and ezoic doesn't believe it's an issue on their end either.
I run the install through composer and everything goes through correctly. I then use the web setup which also works correctly. However once I visit the shop, the admin panel in particular I get the following error which is preventing  some features from working correctly.
underscore.js:1443 Uncaught SyntaxError: Unexpected token 'if'
at new Function (<anonymous>)
at Function._.template (underscore.js:1443)
at template.js:73
at $.<computed>.<computed>._renderModal (modal.js:390)
at $.<computed>.<computed>._renderModal (jquery-ui-1.9.2.js:432)
at $.<computed>.<computed>._create (modal.js:132)
at $.<computed>.<computed>._create (jquery-ui-1.9.2.js:432)
at $.<computed>.<computed>._createWidget (jquery-ui-1.9.2.js:597)
at new $.<computed>.<computed> (jquery-ui-1.9.2.js:396)
at HTMLScriptElement.<anonymous> (jquery-ui-1.9.2.js:541)

I've tried clearing static content but that didn't work. Does anyone have any ideas what it might be or what I can do to further diagnose the issue?


texts: My Search result not showing relevance products properly Magento 2

texts:
When i search for any string, the relevance search result not working properly.Can you guys please look into in the attached image?

I have enable name and sku for the search.

To reproduce this issue I have exported my products and import in fresh Magento and still facing the same problem. so now there are no any extensions and design there.

My Magento version is 2.2.3


texts: Magento 2.4: Custom Block not return values to custom phtml file

texts:
I want to get my wishlist product list on my custom phtml file,
My block:

\app\code\vendor\module\Block\WishlistProducts.php

<?php
namespace Vendor\Module\Block;

    use Magento\Framework\View\Element\Template\Context;
    use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
    use Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory as WishlistCollectionFactory;
    use Magento\Customer\Model\Session;

    class WishlistProducts extends \Magento\Framework\View\Element\Template
    {
        protected $_wishlistCollectionFactory;
        protected $_customerSession;
        protected $_productCollectionFactory;

        public function __construct(Context $context,
            CollectionFactory $productCollectionFactory,
            WishlistCollectionFactory $wishlistCollectionFactory,
            Session $customerSession
        ) {
            $this->_productCollectionFactory = $productCollectionFactory;
            $this->_wishlistCollectionFactory = $wishlistCollectionFactory;
            $this->_customerSession = $customerSessio;
        }

        public function getWishlistProductCollection()
        {
            $collection = [];
            if ($this->_customerSession->isLoggedIn()) {
                $wishlist = $this->_wishlistCollectionFactory->create()
                    ->addCustomerIdFilter($this->_customerSession->getCustomer()->getId());

                $productIds = null;
                foreach ($wishlist as $product) {
                    $productIds[] = $product->getProductId();
                }

                $collection = $this->_productCollectionFactory->create()->addIdFilter($productIds);
                $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter($this->getStoreId());
            }
            return $collection;
        }
    }
    ?>

app\code\vendor\module\view\frontend\wishlistitems.phtml

<?php
    echo("hello");
?>

The hello not return on my custom phtml file,
I am using to call:
<?php echo $this->getLayout()->createBlock("Magento\Framework\View\Element\Template")->setTemplate("vendor_module::wishlistitems.phtml")->toHtml(); ?>

It's not return the values.


texts: Can't finish checkout, Failed to load resource: the server responded with a status of 400 (Bad Request)

texts:
I don't know what i do wrong, but when i tried to do checkout, there's an error and i can't finish the checkout. See the picture below for the detail.

After click Place Order :

Error on inspect element :

Error on service :


texts: Setting Configurable product select options

texts:
I have the following requirement. Shop sells varnish with litres/sheen product variations. However, not every product will have same attributes - a 5ltr can may have two sheen options, a 10ltr can may only have one sheen.

When a user selects a gallery image of a 5lt can it should

a. change the main product image to 5 ltr
b. change the litres selection option to '5'
When the user uses the select to change the litres, it should update the main product image

I have the main functionality sorted for 1 & 2, but I can't control the 'sheen' select - if I enable it the product sheen options are not firing in sync with the size changes. Hopefully you could see in the attachment what I mean (if I was allowed to post one!) - the second select is stuck on 'Select an Option', whereas it should be populated with options. Nor does changing the gallery images update the sheen select.

The code I have is as follows:

The Javascript is being deployed in template/product/view/media.phtml & uses JQuery to retrieve the clicked image & substitute, using the image alt as a map between the image & the Litre options, is as follows:

jQuery(document).ready(function()
{
    jQuery('.changer').click(function()
    {
        jQuery("#image").attr("src", jQuery(this).attr("data-main-image-src"));
        var divid = jQuery(this).attr("alt");
        changeSelectState("#attribute990");
        jQuery("#attribute989 option").each(function () {
        if (jQuery(this).html() == divid) {
            jQuery(this).attr("selected", "selected");
            return;
        }
       });

    });
    jQuery("#attribute989").change(function(){

         jQuery("#attribute989 option").each(function () {
         changeImage(jQuery('#attribute989 :selected').text());
         changeState();
         return false;
       });
    });
    function changeImage(obj){
        jQuery('.changer').each( function(idx,img) {
         var pAlt = img.alt;
         if(obj == pAlt)
            jQuery("#image").attr("src", jQuery(this).attr("data-main-image-src"));
        });
    }
    function changeSelectState(obj){
         changeState();
         //jQuery(obj).attr('disabled', false);

    }

});
  function changeState(){
    // simulate firing a DOM event
    if (typeof fireEvent !== 'function') {
        document.fireEvent = document.createEventObject ? // IE
        function(element, event) {
        var evt = document.createEventObject();
        return element.fireEvent('on' + event, evt);
    } : // FX
        function(element, event) {
            var evt = document.createEvent('HTMLEvents');
            evt.initEvent(event, true, true); // event type, bubbling, cancelable
            return !element.dispatchEvent(evt);
        };
    }
    // preselect the 1st option of the 1st-maxPreselectedAttributeOptionCount
    window.maxPreselectedAttributeOptionCount = 2;
    Event.observe(window, 'load', function() {
        if (!spConfig) {
        return;
    }
    for (var i = 0; i < Math.min(maxPreselectedAttributeOptionCount, spConfig.settings.length); ++i) {
        var attr = spConfig.settings[i];
            attr.selectedIndex = 1;
            Event.observe(attr, 'change', Prototype.emptyFunction);
            fireEvent(attr, 'change');
            spConfig.reloadPrice();
        }
    });
  }

This issue comes when simulating the user selecting an option from the Litres dropdown. I'm sure I'm doing something very wrong here! Any suggestions most welcome. Thanks


texts: Migrate 1.6.0.0 to 2.0.7 - admin 404 after migrating settings

texts:
I just installed a fresh Magento 2.0.7 (web installer) on a local server (Apache/2.4.12 (Ubuntu), PHP 5.6.11-1ubuntu3.4, mysql  Ver 14.14 Distrib 5.6.30)

After the installation Magento frontend and backend have been working fine.
I created a mysql dump and a backup of the whole folder.

Then I went on:

sudo -u www-data composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool
sudo -u www-data composer require magento/data-migration-tool:2.0.7
sudo -u www-data php bin/magento migrate:settings /var/www/html/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/1.6.0.0/config.xml

Migration ran smooth:

[INFO][mode: settings][stage: volume check][step: Stores Step]: Migration completed

Then I reloaded my admin panel with F5 and I get a 404.
dev.url.com/index.php/admin
results into a 404 as well.
dev.url.com/search/term/popular
etc. are all working, so I assume it's not .htaccess - still, my virtual host directory settings:

<Directory /var/www/html/dev.url.com>
  Options Indexes FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>

In the database table core_config_data of Magento 2.0.7 now, I can see the settings from 1.6.0 - so I assume the migration ran smooth and now I need to figure out why I can't access my admin panel anymore.

admin/url/custom is set to admin as well as in app/etc/env.php

So I tried those:

rm -rf var/di var/generation
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:static-content:deploy

But I still can't access my admin panel.

The apache log isn't helpful:

  "GET /admin HTTP/1.1" 404
  "GET /index.php/admin HTTP/1.1" 404
  "GET /index.php/admin/ HTTP/1.1" 404

and there is nothing in var/log/system.log or var/log/debug.log

That problem doesn't seem to be uncommon but what I found online is mostly related to .htaccess / mod_rewrite - but both seem to be working fine here (before the migration I was able to access all pages and in the frontend I still am).


texts: Using Googe Search form on checkout page with HTTPS

texts:
I am running Magento, with Google Search - and its setup in the header of every page and works perfectly, except on the one page checkout page - because its an SSL page, and the search box sends results to an unsecure page. I need to make the code send the results to a secure page. This is the code in form.mini.phtml that sends:

<form id="search_mini_form" action="<?php echo Mage::helper('cms/page')->getPageUrl( searchresults ) ?>" method="get">

Its calling for page "Searchresults". How can i get it to call the HTTPS version?


texts:
How to make Brand not a Required Field when Creating a New Product in Admin? Image Below.
How would I make this not a required field?


texts: Shipping Not Calculating for Bundled Product

texts: I have created a new bundle product and everyone looks great until I put it into the shopping cart.  Once it's there I cannot get a quote or calculate the shipping costs.  I have FedEx configured and working correctly for individual/simple products. Unfortunately it does not give me any error messages.  I'm looking for any suggestions of how I can troubleshoot this.  Thanks!


texts: Magento2 add submenu in the top navigation menu

texts:
I need to add submenu in top navigation menu
I am using below code but it is adding in top & not sub menu.
$menu = $observer->getMenu();
        $tree = $menu->getTree();
        $data = [
            'name'      => __('Menu item label here'),
            'id'        => 'some-unique-id-here',
            'url'       => 'url goes here',
            'has_active' => false,
            'is_active' => false //
        ];

        $node = new Node($data, 'id', $tree, $menu);
        foreach ($menu->getChildren() as $node) {
            if ($node->getName() == 'Carpet') {
                // echo "<pre>";
                // print_r($node->getId());
            }
        }
        //die();

        $menu->addChild($node);
        return $this;

I want to add submenu based on condition like for 1 top menu category I want to add 1 link e.g.  color & 2nd link in another top menu category e.g. size
I have a category top navigation menu by default of magento. Now I need to add color filter for each menu item.
For e.g. Shoes is the main menu & when we hover shoes it should display colors like White, black etc.. & on click of white I want to add redirection URL of filter. So in short white will be like a submenu


texts: Why Adobe sensei recommended products don't show products?

texts:
I configured the Adobe Sensei Recommended products as the documentation said, then I navigated some minutes through many products and try to see some product in my recommendations, but just one shows up.
How could I solve it?


texts: Magento 2 System Configs and Deployment Process

texts:
I desire the following method for making system configuration changes and deploying them to our Production server, but I am having a hard time making this happen. From my prospective, a system configuration change can have a huge impact on application behavior, and therefore it should go through UAT just as if it was a code change. Our infrastructure includes a Production server, a Testing server, a Build/RC server and multiple local dev machines.
I wish for our QA/UAT team to be able to make configuration changes as-needed in the Magento admin panel on our Testing server. Once the team is happy with system configuration, a developer will export the configuration (app:config:dump) and thus the exported config.php file will get piped over to the Production server during deployment and result in app:config:import being run, thus applying any (tested and approved!) configuration changes to the Production server.
However, after executing app:config:dump, all configurations are of course "locked" and the UAT team can no longer modify them in the admin panel. The only recourse here is to manually wipe the config.php file and run setup:upgrade or app:config:import on the testing server. This puts the config.php file into an undesirable state. It is important to version this file because, aside from system configurations, it also defines which Modules are enabled.
From the documentation, describing config.php :
This is the shared configuration file for all your Magento instances. Include this in your source control so it can be shared between the development, build, and production systems.
How does the Magento team expect for System Configurations to be effectively managed through VCS? Is this simply not possible? Is it expected that the config.php file remains largely untouched (thus, app:config:dump is never executed, this seems wrong??) and instead, changes are always made via the Magento admin panel? This also seems wrong and quite dangerous to do on a heavily trafficked web store.
I would love to hear what your team is doing to version config.php and how to transport configuration changes made on a testing server to your Production server. Thank you!


texts: CSS is not applying & images are not loading properly after moving to new server - Magento 1.9

texts:
I have just moved a Magento ( v 1.9 ) store to a new server. Everything started working after changing database and base_url in core_config_data table. But theme is not applying.

Though I can see stylesheet is loaded in the resources tab in chrome and I can access the file by entering the url in browser.

like http://abcd.com/skin/frontend/default/em0089/css/styles.css

Here is the screenshot of the store

Thank you.


texts:
I need to restrict Shipping Method options based on custom collection data in Magento 2.

I have added a condition to the below file:

But I want to add another condition:

if($customerlevel >= $targetlevel){
  # free shipping
}else{
  # no free shipping
}

How can I get custom collection data in knockout HTML template to put condition like above?

/vendor/magento/module-checkout/view/frontend/web/template/cart/shipping-rates.html

<form id="co-shipping-method-form" data-bind="blockLoader: isLoading, visible: isVisible()">
    <p class="field note" data-bind="visible: (shippingRates().length <= 0)">

    <fieldset class="fieldset rate" data-bind="visible: (shippingRates().length > 0)">

                    <input type="radio"
                           class="radio"
                           data-bind="
                                click: $parents[1].selectShippingMethod,
                                checked: $parents[1].selectedShippingMethod,
                                attr: {
                                        value: carrier_code + '_' + method_code,
                                        id: 's_method_' + carrier_code + '_' + method_code
                                        }
                                "/>

                        <each args="element.getRegion('price')" render="" />

    </fieldset>
</form>


texts: Blank admin login page with Security titled empty field set

texts:
We have a working Magento 2.2.9 installation in production. Everything was fine and working and no one touched the code or the settings for weeks now. Today we suddenly could not log in to admin panel any more. Instead of the login screen this is what we saw when trying to access the login page:

The markup is this:

        <fieldset class="fieldset admin__fieldset " id="mp_tfa_security">
                <legend class="admin__legend legend">
            Security
        </legend>

We tried it from two different computers from completely different external IP addresses and the result was the same. After some time spent googleing and not finding anything about such issue, I tried to access it from a private window and it worked. So clearly, as soon as I clear the website data from the browser it will work from the non-private window as well (Option+Cmd+R does not help), but I'm wondering what could cause this?

Only the login screen works from private mode. After login I still get this white page with Security title. Tried with Safari and Chrome. Results are the same so it's not related to browser cache or previously saved website data.

Any ideas?


texts: How to add text layer on images in the CMS editor?

texts: If I add an image to a cms page, Is it possible to add a layer of text to sit on the the image?  For example,


texts: Calling newsletter short code in static block stop showing the form

texts:
I am calling newsletter in static block by below sort code

{{block type="newsletter/subscribe" name="footer.newsletter" template="newsletter/subscribe.phtml" }}

its was working, but suddenly stopped to show the form. I have checked the permission for newsletter/subscribe in permission section where it is set to "allow" as well.


texts: Getting many Fake Customers and Newsletter Subscribers

texts:
I have been getting around 10 to 20 Fake customers in my magento 1.9.3.

Does anyone know how to block them?


texts: Magento 2: How to set meta description/keywords with observer?

texts:
I need to generate meta tags for the page based on its data.

I succeeded in doing that by overriding one of the blocks & changing the page config object during _prepareLayout(), but I'm not so happy with that & prefer to use an observer instead.

The thing is I don't know what event to listen for, any idea?

UPDATE:

I tried a few events & found out that 'view_block_abstract_to_html_before' is working for my case (unless someone has a better idea).


texts:
I am trying to add a link into the HTML head from (content/configuration/html) head section in the backend(admin) to a file that's located in my pub/static/version*****/frontend/ folder.

How can I link to this folder without using an absolute path?

Thanks


texts: How to get access token programmatically in Magento 2 Using SOAP API

texts:
I am trying to get Order details using SOAP API in Magento 2.

I used the access token which is provided by Integration in Backend.

Now I want to fetch that access token programmatically. Can any one please help me. Below is the code which I am currently using.

Thanks.

 <?php

$request = new SoapClient('http://192.168.1.49/magento2/index.php/soap/default?wsdl&services=salesOrderRepositoryV1',
            array(
                'soap_version' => SOAP_1_2,
                'stream_context' => stream_context_create(array('http'=> array('header' => 'Authorization: Bearer yqtd86y0tm56tfe5dqtqmevqfn4qtld3')
                    )
                )
            )
        );
        $response = $request->salesOrderRepositoryV1Get(array('id'=>'000000001'));
        print_r($response);

?>


texts: Get Current URL, With Modified Parameters

texts:
Problem

I'm trying to come up with a consistent way to get the current URL of the page, including parameters from both the key/value/key/value structure and the ?key=value&key=value structure.

What I've tried

The simplest method that I've found works like this:

$params = $this->getRequest()->getParams();
$params = array_merge($params, $newParams);
$url = $this->getUrl('*/*/*', $params);

However, this doesn't escape parameter values at all. So I do that myself like this:

$params = $this->getRequest()->getParams();
$params = array_merge($params, $newParams);

foreach ($params as $k => &$v) {
    $v= urlencode($v);
}

$url = $this->getUrl('*/*/*', $params);

Okay great, now I have encoded parameters. But what if the parameters include the / character? You end up with a URL like this: my_module/my_controller/my_action/FromEntryDate/12%2F06%2F2014/ToEntryDate/06%2F04%2F2015/

But if you do Zend_Debug::dump($this->getRequest()); you get this:

array(5) {
  ["FromEntryDate"] => string(2) "12"
  ["06"] => string(4) "2014"
  ["ToEntryDate"] => string(2) "06"
  ["04"] => string(4) "2015"
}

So clearly the / aren't being interpreted correctly, even though they are encoded. So I end up with this work around instead:

$r = $this->getRequest();

$params = $r->getParams();
$params = array_merge($params, $newParams);

$url = implode('/', array(
    $r->getBaseUrl(),
    $r->getRouteName(),
    $r->getControllerName(),
    $r->getActionName()
)).'?'.http_build_query($params);

Questions

Is there no way to encode / characters so that Magento will parse the param value correctly?
Is there not a built in function to do this already!?


texts: How to load facotry model load best practice?

texts:
class Product extends \Magento\Framework\View\Element\Template {

    protected $_productloader;

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Model\ProductFactory $_productloader

    ) {
        $this->_productloader = $_productloader;
        parent::__construct($context);
    }

    public function getLoadProduct($id) {
        return $this->_productloader->create()->load($id)
            ;
    }

}

I get "Reference Entity Deprecated" on load() method so what is the best practice to use load() functionality.


texts: How to add custom payment module development logs?

texts:
I am attempting to build a custom payment module but as far as I got I get the error message sh: -t not found when checking out a test order
I saw this question but the link in the answer is broken, I cannot place comments and didn't feel appropriate to answer with a question so here I am.
If there are some pointers to how Magento module should be debugged in these cases, usually there get a big dump of a log it hard to see what I'm looking for
EDIT: taking the code from this answer the log file created but is empty, putting it after all operations of the of an particular variable is executed results in some output. It appears i need to figure out which variable to debug, as well as the point where i should put the code


texts: Magento 2.2.5 page and block module not displaying grid and button

texts:
I just installed Magento 2.2.5 but in admin > content > page the page grid and the button are not displaying. Even in the block the same issue happens, records grid and button is not displaying. Remaining things are working well.

I checked in console but no error is displaying.

Please check the following screenshot for more details.


texts: Blogging Tool - AW Blog or WordPress Integration?

texts:
I am looking into changing my current blog platform, which is the free AW blog edition. I have been quite disappointed with the level of customization and features with the free AW blog.

However, I have read a lot of horror stories with the Wordpress integration, where the blog stops working after a Magento update.

The Magento forum is down for maintenance, so I figured I would start the conversation here.

The other thing to keep in mind is that I have about 100 posts on the current AW blog platform, that I would need to transition over to Wordpress... Seems like a huge drag and potential SEO disaster with on-site links and changing URLs....

Has anybody else done this before? Is WP Blog integration worth the trouble?


texts: Add placeholder and remove all labels in Magento 2 Checkout

texts:
Searched a lot but didn't found anything removing the

Lables like "First Name, Last Name, City, Address, Email, Phone etc"

Add Placeholders in all "shipping fields" and "sign In" places.
After Login Placeholders in "new add address popup"

https://imgur.com/Wm3aQNj

Please help me struggling from so many days didn't found any exact thing.


texts: How to get all attributes list with details that assigned to Used in product Listing-> Yes in magento 2

texts: How to get all attributes list with details that assigned to  Used in product Listing-> Yes in custom.phtml file in Magento2


texts: Unable to change the customer group in magento2

texts:
I created the customer at time group is assigned correctly. but after login into admin I try to change the group, it is not changing but message is coming like 'You saved the customer'.
Customer group is not changing. Anyone please help me.


texts: RabbitMQ - Why I see only async.operations.all in queue list?

texts:
I'm a little bit frustrated with Magento 2 queue for RabbitMQ.
I have setup RabbitMQ, my env.php has such lines
'queue' => [
    'consumers_wait_for_messages' => 1,
    'amqp' => [
        'host' => 'rabbitmq',
        'port' => '5672',
        'user' => 'magento',
        'password' => 'magento',
        'virtualhost' => '/'
    ]
],
'cron_consumers_runner' => [
    'cron_run' => true,
    'max_messages' => 20000,
    'consumers' => []
],

but I see only async.operations.all in rabbitmqctl list_queues:
/ # rabbitmqctl list_queues
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name    messages
async.operations.all

Looks like queue is working, but why I don't see any other Magento 2 records in queue? Like
product_action_attribute.update
product_action_attribute.website.update
Strange that I see new queue messages in queue_message table in Magento DB. I see that some of items have connection="db" in queue_topology.xml. Are they executed using RabbitMQ or using Magento own queue implementation?


texts:
I want to open new window when I click "Add Product" button in Catalog->Manage Products grid.

I want to enter new product details in new window not in existing window.

How to do that in Magento..?


texts: Function mcrypt_module_close() is deprecated in magento 2.3.1

texts:
Array
(
    [type] => 8192
    [message] => Function mcrypt_module_close() is deprecated
    [file] => /vendor/magento/framework/Encryption/Adapter/Mcrypt.php
    [line] => 94
)

PHP Version 7.1.27
This Issue facing after upgrade Magento 2.1 to Magento2.3.1 with Porto theme version 3.7.1

Anysolution for that?


texts: Custom collection sort module returning collection but not sorting

texts:
I've created a module that is intended to allow me to add custom sort features to my catalog pages (my product collection). For whatever reason, it returns my collection no problem but fails to honor any form of sort that I apply to it. Here is my Observer.php code

//File: app/code/local/MyExtensions/Attsetfilter/Model/Observer.php

<?php
class MyExtensions_Attsetfilter_Model_Observer
{
    public function load_productsby_attributesetid($observer) {
        $collection = $observer->getCollection();
        $collection->addAttributeToSort('attribute_set_id', 'asc');
        echo "Extension is being called";
        return $collection;
    }
}

I know my product collection is being passed through here because if I comment out the first line of my public function ("$collction = ...") it returns nothing. I've attempted to add filters to the function like so

        $collection->addAttributeToSort('attribute_set_id', 'asc');

But it never seems to honor them. I've seen other methods of filtering a product collection such as:

$collection = $this->getCollection()
        ->setOrder('fieldname', 'asc')
        ->setOrder('fieldname2');

But that snippet won't work in my extension code either. Is there something obvious that I am doing wrong? Thanks in advance.

EDIT: Here is my modules config.xml file as well:

<?xml version="1.0"?>
<config>
  <modules>
    <MyExtensions_Attsetfilter>
      <version>0.1.0</version>
    </MyExtensions_Attsetfilter>
  </modules>
  <global>
    <events>
    <catalog_product_collection_load_after>
      <observers>
        <product_load_before>
          <type>singleton</type>
          <class>MyExtensions_Attsetfilter_Model_Observer</class>
          <method>load_productsby_attributesetid</method>
        </product_load_before>
      </observers>
    </catalog_product_collection_load_after>
    </events>
    <helpers>
      <attsetfilter>
        <class>MyExtensions_Attsetfilter_Helper</class>
      </attsetfilter>
    </helpers>
  </global>
</config>


texts: Magento1 to Magento2 data migration ignore orders, invoice, shipping, creditmemo

texts:
I want to migrate all data without orders, invoice, shipping, creditmemo.
How can i ignore it in config file? Is it possible?


texts: Magento grid filter showing wrong result for date

texts:
I have created a Custom Module to add Datetime on Newsletter Subscriber grid,
Datetime is storing correct entry on database and filter is also working correct except one case, if i filter result as date '25/05/2018' to '25/05/2018' it showing the record of date 25/05/2018 + few records of 2018-05-24 23:49:11 , 2018-05-24 23:36:05 , 2018-05-24 23:04:23 , 2018-05-24 23:43:48

it taking anything after time 23:00:00 to next day

public function addGridColumn(Varien_Event_Observer $observer)
{
    $block = $observer->getBlock();
    if ($block && $block instanceof Mage_Adminhtml_Block_Newsletter_Subscriber_Grid) {
        $block->addColumnAfter('subscription_date', array(
            'header'    => 'Subscription Date',
            'type'      => 'datetime',
            'index'     => 'subscription_date',
        ), 'status');
    }
}

How can I fix it, thanks


texts: Where to get accesses for the DHL shipping method?

texts:
To enable it, I need:

Access ID

Password

Account Number


texts: Magento 2 add new Button in admin Controller

texts:
I am working on module which will work for sync product from Third party Api.I have already created admin controller page but don't have Idea how to add button Sync Products whose action will call a controller file .
Have anyone idea how to add new custom button with action controller?

I have added menu in admin section with Parent Catalog->

Admin menu is

  app/code/Vendorname/Syncfromshopify/etc/adminhtml/menu.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Vendorname_Syncfromshopify::sync_product" title="Sync From Shopiofy" module="Vendorname_Syncfromshopify" parent="Magento_Catalog::catalog" sortOrder="30"  resource="Vendorname_Syncfromshopify::sync_product" action="syncproductshopify/syncproduct/" />
    </menu>
</config>

My controller is

  app/code/Vendorname/Syncfromshopify/Controller/Adminhtml/Syncproduct/Index.php

namespace Vendorname\Syncfromshopify\Controller\Adminhtml\Syncproduct;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\ResultPageFactory;

class Index extends \Magento\Backend\App\Action

{
    /**
    * @var PageFactory
    */
    public function execute()
    {
        $this->_view->loadLayout();
        $this->_view->renderLayout();
    }

}

My above controller is working fine and redirecting to admin page.

Now I want to add a button (ABC name) and in action of another controller which will responsible for sync data from third party and Insert in Magento.

So How we will create new button in admin controller and give action?


texts: Magento 2: Cookies expiration time is not extended for customer

texts:
I have increase cookies lifetime for the customer but it not working.
After customer login, 1 to 2-hour customer stay login if he/she close browser then again start browser at that time customer need to log in again is anyone have an idea how to set cookies lifetime for a customer?

https://www.awesomescreenshot.com/image/3139974/13996c6bb53071581243f1695d6e80bb


texts: Need to make the visible currency is different from the real currency

texts:
My bank is accepting only Turkish lira(currency) and the visible currency of store is on Dollars. However, when a customer makes the payment I want the currency (as hidden process) switch to Turkish lira .

How can I achieve this ?


texts: Assigning a disabled/non-existent shipping code to order

texts:
I am working on an integration between Magento and a third-party ERP system. This ERP handles all payment and shipping on each order and tracking information is passed back to Magento for later use.

All orders will be shipped for free, so I only have Free Shipping enabled in Magento. When the order arrives in the ERP for processing, a CSR will determine the best shipping method for that particular order and this info gets pushed back to Magento when an order is ready to be invoiced/shipped.

When this info gets back to Magento, I need to update the order's shipping method with a new description and (optionally) a new shipping code. In order for customers to be able to view tracking information, I'd like to assign a shipping code to an order and this code might match up with generic shipping codes in Magento (FedEx, UPS, USPS, etc) though it might not.

Am I safe assigning a disabled shipping method to an order?

My assumption is that it should be fine, as it seems entirely plausible that in a typical Magento store, a shipping method might have been enabled in the past but disabled currently as the store owner decided to switch carriers. In this case, the now disabled method on the order should still continue to provide requested info to the user.


texts: Magento2: How can create individually custom dropdown of categories and subcategories?

texts:
I want to search products by parent categories and sub categories via search box. for example there is two dropdown "search by categories" and "search by sub categories". when we will select first dropdown value then according to first dropdown value, subcategories will be show in second dropdown and after then we can search item in search box.

I have tried with example of State city dropdown, but not getting good success.
we need to do by PHP.
Anyone have an idea for that, how can we implement that?


texts: Add category as filter in all other categories in layered navigation?

texts: Is there any way to make a category appear in all other categories as the filter in layered navigation?


texts: Magento2 - Filter product collection by SKU is not affecting layer navigation

texts:
I am filtering the product collection in ListProduct.php using below code

// Sample sku array
$skuarray=array('sku1', 'sku2', 'sku3');

$this->_productCollection = $layer->getProductCollection()->addAttributeToFilter('sku', array('in' => $skuarray));

Now i am getting a list of products filtered by SKU in my view but, Layer navigation is still displaying the all filters(attributes) which is in category.

For example:
Category having 20 products,
i am filtering only 3 products by using sku filters,
Products are displaying filtered 3 products
But Left side Layer Navigation Displaying filters for 20 products i.e category is having


texts: Magento 2: display yes/no in order grid instead 0/1 (Custom column value)

texts:
I needed a custom column to be displayed in order Grid (Yes/No) Type. So I followed below steps:

I created a new column in table "sales_order_grid"

$installer->getConnection()->addColumn(
        $setup->getTable('sales_order_grid'), 'is_prebook', [
    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
    'length' => 11,
    'default' => '0',
    'nullable' => true,
    'comment' => 'Prebook'
        ]
);

Then created sales_order_grid.xml app/code/Akhil/Prebook/view/adminhtml/ui_component/sales_order_grid.xml

<?xml version="1.0"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="sales_order_columns">
    <column name="is_prebook">
        <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="label" xsi:type="string" translate="true">Prebook</item>
                </item>
        </argument>
    </column>
</columns>
</listing>

Column added successfully but value showing '0' How to display as 1=>Yes & 0=> No

Tried below code. Is this should make sense here?

<item name="dataType" xsi:type="string">select</item>
<item name="options" xsi:type="object">Akhil\Prebook\Model\Source\Prebookstatus</item>

File: Akhil\Prebook\Model\Source\Prebookstatus

class Prebookstatus implements \Magento\Framework\Option\ArrayInterface {

    /**
     * Retrieve status options array.
     *
     * @return array
     */
    public function toOptionArray() {
        return [
            ['value' => 0, 'label' => __('No')],
            ['value' => 1, 'label' => __('Yes')]
        ];
    }

}


texts: Transactional email templating syntax - calling a helper or model method and assign to variable

texts:
In the email templating syntax.  Is it possible to assign a return value of a magento helper to a variable?

For example this would be perfect:

{{var myVar = helper(myhelper).helperMethod }}

i.e. i want to assign the return value of a helper method to a variable in the template.


texts: Injecting eventPrefix and eventObject to Grid Collection in Magento 2

texts:
I've created a simple grid collection which has constructor as follows:

/**
     * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory
     * @param \Psr\Log\LoggerInterface $logger
     * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
     * @param \Magento\Framework\Event\ManagerInterface $eventManager
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
     * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
     * @param string $mainTable
     * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $eventPrefix
     * @param mixed $eventObject
     * @param mixed $resourceModel
     * @param string $model
     * @param string|null $connection
     * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
     *
     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
     */
    public function __construct(
        \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\EntityManager\MetadataPool $metadataPool,
        $mainTable,
        $eventPrefix,
        $eventObject,
        $resourceModel,
        $model = 'Magento\Framework\View\Element\UiComponent\DataProvider\Document',
        $connection = null,
        \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
    ) {
        parent::__construct(
            $entityFactory,
            $logger,
            $fetchStrategy,
            $eventManager,
            $storeManager,
            $metadataPool,
            $connection,
            $resource
        );
        $this->_eventPrefix = $eventPrefix;
        $this->_eventObject = $eventObject;
        $this->_init($model, $resourceModel);
        $this->setMainTable($mainTable);
    }

My problem is that $eventPrefix and $eventObjects are not being resolved by DI. The code above results with error:

Missing required argument $eventPrefix of Vendor\ModuleName\Model\ResourceModel\Field\Grid\Collection

What strange is $mainTable and $resourceModel are all right and everything work fine when error making lines are commented out. My di.xml looks like that:

<type name="Vendor\ModuleName\ResourceModel\Field\Grid\Collection">
    <arguments>
        <argument name="mainTable" xsi:type="string">vendor_module_name_fields</argument>
        <argument name="eventPrefix" xsi:type="string">vendor_module_name_grid_collection</argument>
        <argument name="eventObject" xsi:type="string">field_grid_collection</argument>
        <argument name="resourceModel" xsi:type="string">Vendor\ModuleName\Model\ResourceModel\Field</argument>
    </arguments>
</type>

Do I need to add something more elsewhere to make those two strings work?

I've tried clearing var/generation, all cachers are off, I'm working in developer mode.


texts:
I got a custom module where I load the images for the product.
You can select a image, now I want that this specific image is selected in the Gallery Fotorama.

So say for example standard it is showing a yellow mug, but you select in the custom module a green mug, the active image in the Fotorama has to change to the green mug.

Is this possible? So yes how should I do this?

I tried to set the classes through JavaScript, but this is a lot of hassle.

Is there a way that I can tell Fotorama what image has to be active?


texts: Layered Navigation for Custom Product Collection filtered via Custom Attribute

texts:
I have a filtered product collection using custom attribute. How do I implement layered navigation for the same?

I have extended Mage_Catalog_Block_Product_List in my block to and override _getProductCollection() to update $this->_productCollection variable filtering it through a custom attribute. It gets nicely displayed.

But the layered navigation section appears to be unchanged. It appears to show all products. I want to show only $this->_productCollection products in layered navigation.

How do I do it? I feel that I may have to extend Mage_Catalog__Model_Layer and I even tried to but I couldn't produce the desired result.


texts: Custom Module overlaps magento default theme

texts: I have a Sliding contact us module.This module overlaps with the navigation menu of default magento luma theme. How do i fix this issue?


texts: FEATURED and BEST SELLING product show on homepage more than listed in category

texts:
Previously i am using without  "Use Flat Catalog Category
" so, everything is correct , but due to slow performance o moved on Use Flat Catalog Category, problem is started from here. now FEATURED and BEST SELLING product homepage block have more than 1k product on homepage.
Please help me .
Thanks in advance for your help.


texts: Show out of Stock Configurable products magento2

texts:
I am trying to show out of stock child item of configurable product.

referred below link

Magento2.2 configurable products out of stock issue

As the answer is accepted there. Used same module in my case.

Still the child products which are out of stock are not being shown.

Can anybody help me please. Thanks

I have set in Configuration to show out of stock products.


texts: Categories pages showing different layout

texts:
I am trying to figure out 2 catalogs which has different layout, one uses a static block and one nothing (normal). I tried disabling the block but now my category on front end is blank. Shouldn't it fallback to default view if i disabled the block? How can i get my category view back when i click on it.
Edit: upon searching, i found this that is loading the block, how can i remove it to simply output the page for that catalog.

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('men-landing-page')->toHtml(); ?>


texts:
Where are front end values for Visibility stored in the database? Such as Catalog, Search, etc?

Attribute code is stored in, eav_attribute

and the product's value is stored in,

catalog_product_entity_int

But where are the full text names for each visibility option stored?

Not visible individually

Catalog

Search

Catalog, Search


texts: I have a scheduled cron job that is set to run every day at 12:00am. The job runs correctly as per scheduled time, but the same job is again created at 12.01am. So technically the cron is run twice. The job is scheduled to send out emails every day, but each email is sent out twice and it's not a great experience. What should I do to stop the second job from getting created?


texts: How to add telephone number to the Sales Order Grid using an observer

texts:
In the Order Grid, I want to add the telephone number which customers used in order -> shipping or billing. I can add the title in the grid but I don't know how get the phone number.

The event that I am using for this is sales_order_grid_collection_load_before however I can't get order id using this.

Here is my code.

config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Elavarasan_OrderGrid>
      <version>0.1.0</version>
    </Elavarasan_OrderGrid>
  </modules>
  <global>
    <helpers>
      <ordergrid>
        <class>Elavarasan_OrderGrid_Helper</class>
      </ordergrid>
    </helpers>
    <models>
      <ordergrid>
        <class>Elavarasan_OrderGrid_Model</class>
        <resourceModel>ordergrid_mysql4</resourceModel>
      </ordergrid>
    </models>
    <events>
      <core_block_abstract_to_html_before> <!-- identifier of the event we want to catch -->
        <observers>
          <core_block_abstract_to_html_before_handler> <!-- identifier of the event handler -->
            <type>model</type> <!-- class method call type; valid are model, object and singleton -->
            <class>ordergrid/observer</class> <!-- observers class alias -->
            <method>getGrid</method>  <!-- observer's method to be called -->
            <args></args> <!-- additional arguments passed to observer -->
          </core_block_abstract_to_html_before_handler>
        </observers>
      </core_block_abstract_to_html_before>

      <sales_order_grid_collection_load_before> <!-- identifier of the event we want to catch -->
        <observers>
          <sales_order_grid_collection_load_before_handler> <!-- identifier of the event handler -->
            <type>model</type> <!-- class method call type; valid are model, object and singleton -->
            <class>ordergrid/observer</class> <!-- observers class alias -->
            <method>addPhoneNo</method>  <!-- observer's method to be called -->
            <args></args> <!-- additional arguments passed to observer -->
          </sales_order_grid_collection_load_before_handler>
        </observers>
      </sales_order_grid_collection_load_before>
    </events>
  </global>
</config>

Observer.php

<?php
class Elavarasan_OrderGrid_Model_Observer
{

            public function getGrid(Varien_Event_Observer $observer)
            {
                $block = $observer->getEvent()->getBlock();
                if ($block->getId() == 'sales_order_grid') {
                    $block->addColumnAfter(
                            'telephone',
                            array(
                                    'header'   => Mage::helper('sales')->__('Telephone No'),
                                    'align'    => 'left',
                                    'type'     => 'options',
                                    'options'  => $paymentMethods,
                                    'index'    => 'telephone',
                                    'filter_index' => 'telephone.telephone'
                            ),
                            'shipping_name'
                    );

                    //$block->sortColumnsByOrder();

                }

            }

            public function addPhoneNo(Varien_Event_Observer $observer)
            {
              echo $phone = $observer->getOrder()->getCustomer()->getPrimaryBillingAddress()->getTelephone();

            }

}


texts:
We are running magento but we need to have the Store View Code in our url i.e:

www.mydomain.com/shop/ if shop is our store view code.

Do I need to reflect this in our robots.txt.

For example at the moment I have:

Disallow: /review/
Disallow: /sendfriend/
Disallow: /tag/
Disallow: /wishlist/

etc but I keep getting bots crawling our wishlist. See the below example from our logs.

"GET /shop/wishlist/index/add/product/2765/form_key/PSS5nZ8XUWUVfn15/ HTTP/1.1" 302 - "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

Is it simply a case of adding "shop" to all our Disallow rules? How do I stop the bots crawling these pages?


texts: magento add product to cart and checkout from email id

texts:
i am working on php code that will programatically add product to cart and do checkout from email id

For example email id is abc@f.com

and product id is 1,2,4

Now i want php code to checkout product ids with using email .

i am using hint from below url
http://inchoo.net/magento/programming-magento/programatically-create-customer-and-order-in-magento-with-full-blown-one-page-checkout-process-under-the-hood/

Mage::getSingleton('customer/session')->loginById($customer->getId());
    $product->load(1,2,3);
    $cart = Mage::getSingleton('checkout/cart');
    /* We want to add only the product/products for this user and do so programmatically, so lets clear cart before we start adding the products into it */
    $cart->truncate();
    $cart->save();
    $cart->getItems()->clear()->save();
    try {
        /* Add product with custom oprion? =>  some-custom-option-id-here: value to be read from database or assigned manually, hardcoded? Just example*/
        //$cart->addProduct($product, array('options'=> array('some-custom-option-id-here' => 'Some value goes here');
        $cart->addProduct($product,1);
        $cart->save();
    }
    catch (Exception $ex) {
        echo $ex->getMessage();
    }
    unset($product);

    // proceed order
    $storeId = Mage::app()->getStore()->getId();
    $checkout = Mage::getSingleton('checkout/type_onepage');
    $checkout->initCheckout();
    $checkout->saveCheckoutMethod('register');
    $checkout->saveShippingMethod('flatrate_flatrate');
    $checkout->savePayment(array('method'=>'checkmo'));
    try {
        $checkout->saveOrder();
    }
    catch (Exception $ex) {
        //echo $ex->getMessage();
    }
    /* Clear the cart */
    $cart->truncate();
    $cart->save();
    $cart->getItems()->clear()->save();
    /* Logout the customer you created */
    Mage::getSingleton('customer/session')->logout();


texts:
I am using geoip2/geoip2:~2.0 but need to access the GeoIP data from within a magento Model Class.

use GeoIp2\Database\Reader; gives an error. I am not sure how to call this in order to be able to use GeoIP.

I know the answer will be easy but 2 hours of Google has not helped.

** Edit **
My module sets the currency based on the geo location, it extends Mage_Core_Model_Store

class Module_Currency_Model_Store extends Mage_Core_Model_Store
{

    public function getDefaultCurrencyCode()
    {

The current code uses a server variable $_SERVER["GEOIP_COUNTRY_CODE"]

I would like to replace with the composer install of GeoIP.

This requires the following code:

require_once $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
use GeoIp2\Database\Reader;

$reader = new Reader($_SERVER['DOCUMENT_ROOT'].'/geoip/GeoLite2-Country_20171205/GeoLite2-Country.mmdb');
$record = $reader->country( $_SERVER['REMOTE_ADDR'] );

$country_iso_code = $record->country->isoCode ;

The autoloader is called in Mage.php so I don't think this is needed, but I cannot use

use GeoIp2\Database\Reader;

I don't know how to call this from within the class file.

** EDIT **
Old and new broken code requiring the USE statement
https://bitbucket.org/solvemyproblem/testmodule_currency/overview


texts: Magento not sending emails - Version 1.9.1.0

texts:
In some conditions email's are working properly.

Email is working on user registration.
Reset password etc..

But not working in some cases

New order creation
Sending emails from the order page in the admin panel.

Is this something related to server, I've tried to log the errors but it is empty.

Server: Ubuntu

Magento Version: 1.9.1.0

Please suggest if someone had the same issue, I can see someone had the same issue in some other community but no one answered for that question.


texts: Extending Mage_Shipping_Model_Carrier_Freeshipping causes odd behavior

texts:
When the module is enabled, refreshing the cart page will sometimes return Fatal error: Call to a member function setStore() on a non-object in /var/www/html/site-magento19/public_html/app/code/core/Mage/Shipping/Model/Shipping.php on line 424
Though it seems to be trying to rewrite the class (guessing by the error above) I cannot get any results.

Most Recent: Module/Enhancedshipping/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Module_Enhancedshipping>
            <version>0.2.0</version>
        </Module_Enhancedshipping>
    </modules>
    <global>
         <models>
           <shipping>
             <rewrite>
                  <carrier_freeshipping>Module_Enhancedshipping_Model_Shipping_Carrier_Freeshipping</carrier_freeshipping>
             </rewrite>
           </shipping>
         </models>
    </global>
</config>

Module/Enhancedshipping/Model/Shipping/Carrier/Freeshipping.php

<?php

class Module_Enhancedshipping_Model_Shipping_Carrier_Freeshipping extends Mage_Shipping_Model_Carrier_Freeshipping {
   public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
        die('Because I want results');
    }
}


texts: Validate customer login without redirecting or refreshing

texts:
I'm trying to see how to do this for the customer login process. After a customer enters the login credential, I'd like Magento to do the following. The login page is a custom page.

If login works, Magento logs in the customer and directs the page (or wherever).
If login fails, Magento does not redirect. Instead, it displays an error message on the current login page.

Note: I'm not familiar with Javascript, subsequently AJAX, and I just need high-level processing steps.

What are the proper procedures required for this? I think I need to make an AJAX request, but if I submit an AJAX request to log in, the returned response is just the HTML output string. So, that doesn't help to determine whether or not the login was successful. I don't want to encode a hidden string in the returned HTML and look for it in the HTML output.

Or, do I create a new controller action that the AJAX request that returns a page with a string (true or false, for example) that can subsequently be used to display error messages on the current login screen?

Or, do I need use some kind of customer login API that returns true or false, depending on the login result?

Let me know if I need to clarify.


texts: how to add custom validation to product options field?

texts:
I'm trying to add custom validation to the product option, I'm following the tutorial
 and here it says to add custom validation element to the attribute data-validate like data-validate="{required:true, 'validate-custom-name':true}"

so far I've tried this:

require(['jquery'], function ($) {

    var rowId = $('#options_<?php /* @escapeNotVerified */ echo $rowOpId ?>_text');

    $(document).ready(function(){

        var data = $(rowId).data("validate"); // default object value

        if (!("validate-custom-name" in data)) {
            $(rowId).extend($(rowId).data("validate"), {"validate-custom-name": true});
        }
    });
});

nothing happened so far. it only shows:

<input type="text" value="" name="options[1]" data-validate="{required:true}" class="input-text product-custom-option" id="options_1_text" aria-required="true">

this is the source code of the html element, here you can see that data-validate option is not being updated.


texts:
I am using this carousel...

http://www.magentocommerce.com/magento-connect/all-category-product-carousel.html

My home pages is here... www.indigomeadowscrafting.com

I can't for the life of me figure out why it is in a vertical row instead of horizontal.

Any clues?

FYI: I did email the developer but wanted to see if anyone here knew anything!


texts: Dark Overlay over my PDP (Product Description Page) Magento2

texts:
I am using Magento 2.3.2 for my Ecommerce and whenever i open a PDP in my magento 2.3.2, i get overlay on the screen, Please check attachment Image.

I have tried with CSS to remove this or to disable the quick view but nothing is working for me.

Any Suggestion is Helpful.


texts: Magento 2 : How to show special price and regular price in cart page?

texts:
I want to show base price and special price both in cart page, right now, by default it just shows special price.
How to show exactly like product page or list page.
Version 2.1x


texts:
So the official Magento marketplace is out.

I was wondering what does that imply for developers ?

do developers have to move all their extensions to Magento marketplace (when will Magento Connect be shutted down?)
should developers keep their extensions on both platforms before Magento Connect is shutted down?
will customers still be able to install extensions from the marketplace via the Magento Connect Manager ?


texts:
I am calling the below function in controller to check whether adding row to a table works or not.

public function urlAction(){
    echo "hello";
    $_orderId = "32" ;
    $enc_key = "somekeyhere";
    $model = Mage::getModel('softcopy/softcopy');
    $model->setData(
        array( 'order_id' => $_orderId,
        'key' => $enc_key,
        'downloads_count' => 0
    ))->save();
}

In the above function, I can see "hello" text for a millisecond then the page is redirecting to error reporting page.

The error states as follows:

  a:5:{i:0;s:59:"The URL key contains capital letters or disallowed symbols.";i:1;s:1298:"#0 C:\xampp\htdocs\xyz\app\code\local\Efk\Softcopy\Model\Resource\Softcopy.php(210): Mage::throwException('The URL key con...')

FYI, I created the module using Ultimate module creator.

PS: The softcopy_softcopy table has the following fields:

 entity_id
 order_id
 key
 downloads_count
 date (current_time_stamp)


texts: Magento 2: load product collection of another website

texts:
Magento 2.2.9:

I have a multiwebsite-setup. Site 1 is a normal webshop. Site 2 is a satellite page that links to site 1. So I would like to create a product collection from site 1 starting like this:

$products = $this->_collectionFactory->create();

The resulting SQL points to the site we are currently on (site 2):

SELECT 1 AS `status`, `e`.`entity_id`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`created_at`, `e`.`updated_at`, `e`.`sku` FROM `catalog_product_flat_2` AS `e`

As you can see the query points to catalog_product_flat_2. How can I create a collection specifically pointing to a specific website?

Setting store or website in the returned object does not have any effect:

$products = $this->_collectionFactory->create();
$products
    ->addAttributeToSelect('*')
    ->addStoreFilter(1) // does not work
    ->setStoreId(1) // does not work
    ->addWebsiteFilter(1) // does not work
    ->addAttributeToFilter('status', array('in' => $this->_productStatus->getVisibleStatusIds()))
    ->setVisibility($this->_productVisibility->getVisibleInSiteIds())
    ->addAttributeToFilter('sku', array('in' => $skus))
;

EDIT: This only fails when using catalog flat tables. Without them there is no issue.


texts: How do I remove customers middle initial/name from the checkout page?

texts:
Since upgrading to the latest version of Magento, I noticed that a new entry has appeared on the checkout page asking for the customers middle name/initial.

How do I remove the entry "Middle name/initial" from the checkout page?


texts: Magento 2 How to disable admin menu based on configuration?

texts:
xcz

I want to hide my custom module menu based on configuration. If in configuration it set to "yes" then the menu should display and if set to "no" then menu should not appear at admin.

I have below code for add menu:

<menu>
 <add id="Name_Module::parent" title="title" module="Name_Module" sortOrder="51" resource="Name_Module::parent"/>
 <add id="Name_Module::shippinglocation" title="Manage title" module="Name_Module" sortOrder="40" parent="Name_Module::parent" action="controller/action" resource="Name_Module::module"/>
</menu>

How can i achieve this?

Thanks


texts: Get current page title in observer (Magento 2)

texts: Is their any way we can get current page title in magento 2 ?


texts: Want to show all sales/order/view/order_id/XXX into sales/order/history/ by default Magento shows view order items in another page. I want to show them all in main my-orders page


texts: get category name from products 'reports/product_collection'

texts:
I've to list the best selling products and their category name. For this I'd used

$_storeId = Mage::app()->getStore()->getId();
$_products = Mage::getResourceModel('reports/product_collection')
        ->addOrderedQty()
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('visibility', array(
            Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
            Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH
        ))
        ->setOrder('ordered_qty', 'desc');

and for getting individual product:

foreach ($_products as $_product) {
//code need to be added here
}

but I'm not getting any way around to get the category name from $_product.

I've tried

$_product->getCollection()->getCategoryIds();

but my script dies and do not execute further.


texts: Magento 2 : How to Create Simple Product by UpgradeSchema?

texts: How do I create a simple product programmatically using UpgradeSchema?


texts: How to add phtml page on shipping page in magento2

texts:
i am adding a phtml page on shipping page but its also adding on payment page

checkout_index_index.xml.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="2columns-left">
    <body>
        <referenceContainer name="content">
            <block class="SY\Avatar\Block\Customer\Account\Avatar" name="customer_account_avatar" as="customer.account.avatar" before="customer_account_dashboard_info" template="customer/account/Otp.phtml" />
            <action method="setPosition">
                  <argument name="position" xsi:type="string">checkout-content-top</argument>
              </action>
              <item name="sortOrder" xsi:type="string">1</item>
        </referenceContainer>
    </body>
</page>

but its on also payment page. what should i do ? anyone can help me


texts: There are no printable documents related to selected orders. [Magento 2.2.5]

texts:
I imported all orders into my Magento 2.2.5 from Magento 1.9, there are a few things that did not set properly, one is order status

All of my order status are blank.  I am looking for 1 of 2 things.

Mass edit order status to completed, pending, cancelled, etc
ability to "print shipping labels" so that the order automatically changes status

When I try and print any document (Invoice, Packing, Credit, Shipping, All) I get the error message There are no printable documents related to selected orders.

When I search this error on SO, there are 4 results, all 1.9, none seem to have this specific issue

Anyone have any idea's on how to do either of the processes I would like to do?

I am open to plugins/modules that will allow to set status, db edit that will manually set, custom php code that will do the job, anything, as long as it will let me set a large number of order status in a short period of time


texts: Mangeto 1.9.1 - PHP can not devide the subtotal by half

texts:
I have a really strange problem.

Take a look:

When i do that:

$HalfSubtotal  = $address->getSubtotal() - 100; // It's calculating everything right

When i do that:

$HalfSubtotal  = $address->getSubtotal() / 2; // It's NOT calculating. I tried *0.5 and the result is the same. It's just not allowing me to devide this variable or multipile it.

Why i can not devide it and how i can make it?


texts: What is the best way to add a product to cart from phtml

texts:
I have created a new page in phtml in Magento 2 and have listed there some products and from there want to add a product to cart with php/ajax , and wan't to know which is the best way to do it.

P.S. It's not duplicated, because I dont get checkouturl in the right way.


texts: Sort products by alphabets first and numbers last on listing page

texts:
By default Magento has sorting by Name ASC OR DESC.

In my case, I have products names starting with numbers and Alphabets like Below and currently my product listing page lists products in this order.

.8" stand for all
07" to 09" stand for all
Madame First
Alexander First

I Need my output on the Product listings page to be like below.

Alexander First
Madame First
.8" stand for all
07" to 09" stand for all

After searching for a way in MYSQL, I have found that we need to use REGEX in ORDER BY.

I don't know how to use this in Magento 1.8.1. Can Any one suggest a good solution please?


texts:
How can i make Quantity and Salable quantity having same value in magento 2.3.3.
https://prnt.sc/xf5mlb
Here it is showing different
Please help


texts: Magento 1.9 - How to apply handling fees if selected products available along with other products in the cart?

texts:
If the cart contains any one of the selected products along with other products that should be applied handling fees and cart contains only the selected products no need to apply handling fees.

Here I am using Extra fees module

Using the shopping cart price rule,

Here how to add a condition like if a customer tries to add other products to the cart but cart have already selected products then should be applied to handling fees.

Now, if more than one special products (all special listed in https://i.stack.imgur.com/MRGD9.png ) exist in cart handling charge applied, i need this for other products.

How to do that? thanks.


texts: Magento 2: How to save form data to sales_order_item table from .phtml file of adminhtml in magento 2?

texts:
Have created form in .phtml file which is display in sales_order_view page in admin. So how  to save the form values in sales_order_item table from .phtml file?
[Vendor]/[module]/view/adminhtml/layout/sales_order_view.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

       <referenceBlock name="order_additional_info">
           <block class="Magento\Sales\Block\Adminhtml\Order\View\Tab\Info" name="sales_custom_view" template="Vendor_Module::order/view/tab/info.phtml"/>
       </referenceBlock>

</page>

[Vendor]/[module]/view/adminhtml/templates/order/view/tab/info.phtml
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var $block \Magento\Sales\Block\Adminhtml\Order\View\Tab\Info */
?>
<?php $_order = $block->getOrder() ?>

   <form id="custom_info_form" action="<?php echo $this->getUrl(''); ?>">

                <?=__('Product') ?>
                <?= __('Item Status') ?>

    <?php foreach($_order->getAllItems() as $_item):?>

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

               <?php $shippingStatus= "Complete"; ?>

               <select class="admin__control-select" name="shipping_status[<?php echo $_item->getItemId()?> ]" id="shipping_status" value="" title="shipping_status">

                <option selected="selected"><?= __('Choose one') ?></option>
                    <?php $options = array("Pending","Confirmed","Complete","Dues 7 – 10 days","Dues 2 – 3 weeks","Dues no date","Refunded","Cancelled","Failed");?>

                    <?php foreach($options as $option) : ?>
                <option value="<?php echo strtolower($option); ?>"><?php echo $option; ?></option>
                    <?php endforeach; ?>
               </select>

       <?php endforeach; ?>

            <button type="button" name="button_shipstatus" value=""  onclick="submitCustomform()" class="action-default scalable action-save action-secondary">
          <?= __('Submit') ?>
        </button>

    </form>

[Vendor]/[module]/etc/adminhtml/routes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route frontName="orderitem" id="order_item_manager">
            <module before="Magento_Backend" name="Vendor_Module"/>
        </route>
    </router>
</config>


texts: Magento2 : Call Block Methods from Script area of .phtml

texts:
I am able from call block function using php code from phtml like below :

<?php
  $blockObj= $block->getLayout()->createBlock('Inchoo\Helloworld\Block\Helloworld');
  $myArr = $blockObj-> getTag();
  echo $myArr;
?>

But now I got a onclick function from a checkbox as below

 <script>function functionSubCatCB(cb){
    var favorite = [];
            jQuery.each(jQuery(".SubCatCB:checked"), function(){
                //alert("Hi Checked");
                favorite.push(jQuery(this).val());
            });
            var valCB =favorite.join("', '");

            alert(valCB);

            //var blk = "$blockObj= $block->getLayout()->createBlock('Inchoo\Helloworld\Block\Helloworld');$myArr = $blockObj-> getTag(".valCB."); echo $myArr; ?>";
            //alert(blk);
            //jQuery("#ShortDescription").val(<? php blk);}
  </script>

  Now I need to pass the value of valCB to the function getTag

I cannot do like $block->getTag(valCB);

Do I have any other option to do this ???


texts: How to save local date in custom datetime field

texts:
I have been doing this in Magento 1 to save my local date like this:

//in my custom controller
$data = $this->_filterDateTime($this->getRequest()->getPost('my_name'), array("date"));

Now, is there similar way to do this in Magento 2?

What I have done so far:

//in constructor
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timeZoneInterface,
\Magento\Framework\Stdlib\DateTime $dateTime,

$this->_timeZone = $timeZoneInterface;
$this->dateTime = $dateTime;

/////////////
//in my function
/////////////

//format d/m/y
//timezone Australia/Sydney
$date = $this->dateTime->formatDate(('17/08/18 2:16:35 pm');

//this also didn't work
$date = $this->_timeZone->convertConfigTimeToUtc('17/08/18 2:16:35 pm');

Error thrown:

  date. DateTime::__construct(): Failed to parse time string (17/08/18
  2:16:35 pm) at position 0 (1): Unexpected character

If I change 17/08/18 2:16:35 pm to 12/08/18 2:16:35 pm then it works perfectly.

I am unable to tell Magento that my format is d/m/y.


texts: Get rule condition and other details in checkout

texts:
Not getting description and condition, can you help me in this if there is any way to get rule condition and other details

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$rule=$objectManager->create('Magento\SalesRule\Model\RuleRepository');
$rule = $this->ruleRepository->getById(1);

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


texts: Payment transaction failed -email items -variable

texts:
The email message shows items in cart like this:

Items
Item name x 2 EUR 2
Item 2 name x 1 EUR 3
Item 3 name x 30 EUR 4

How to add the product sku there? Like:

Items
Item name (sku1) x 2 EUR 2
Item 2 name (sku2) x 1 EUR 3
Item 3 name (sku3) x 30 EUR 4

In email template it is done like this:

    Items

    {{var items}}

But how to edit the way the {{var items}} -part prints out?


texts:
When I upload  my extension  in magento marketplace it show  "Failed to open file composer.json. Please verify the archive".

  composer.json

{
  "name": "magento/sample-module-newpage",
  "description": "A Magento 2 module that creates a new page",
  "type": "magento2-module",
  "version": "1.0.0",
  "license": [
    "OSL-3.0",
    "AFL-3.0"
  ],
  "require": {
    "php": "~7.1.3|~7.2.0",
    "magento/framework": "~100.0.4"
  },
  "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "Magento\\SampleNewPage\\": ""
    }
  }
}


texts: Wrong data returned getting sold products per store

texts:
I'm trying to get all sold products for a specific store view using the following code.

$_productCollection = Mage::getResourceModel('reports/product_collection')
        ->addOrderedQty($fromDate, $toDate, true)
        ->setStore(4)
        ->addStoreFilter(4)
        ->setOrder('ordered_qty', 'desc');
echo '<pre>';
echo ($_productCollection->count());

This only returns 2 products, but If I look in the backend at orders for that given date range there are a total of 4 products.

What am I doing wrong?

UPDATE :

I found that if I create an order from the backend using a configurable product then it's not visible using my code, is it possible to get that data?


texts: Magento 2 - Cross mark not showing for out of stock product

texts:
I'm using Magento 2.3.4 and on the PDP Cross mark is not showing for out-of-stock product swatch and I'm also able to click it. Attaching the screenshot for reference

Here 200 GM product is out of stock but still, I'm able to click it and cross mark is also not visible.


texts: Configurable Swatches: Uncaught Error: Call to a member function provide() on null

texts:
Uncaught Error: Call to a member function provide() on null in
  /vendor/magento/module-swatches/Helper/Data.php:350

I'm using Magento 2.1.8 with the Ethan theme from MGS. When I added swatches to configurable product and view the catalog this error appears and breaks the layout/styling of the page.

The single view page for the product doesn't load anything and display white screen.

I've looked all over for a solution, has anyone experienced this before?

Is there a fix?