texts: Efficient Collection Calling, Filtering, and Loading

texts:
Right now im reusing a lot of collections that are nested within foreach loops.  Is it possible to move these things up a few levels?
Currently Im forced to reload collections that have 51k + entities over and over again which slows things down tremendously.  Specifically the kitinventory collections.

<?php
class Codespace_Module_Helper_Item extends other_one{

function functionOne($collection){
    ...
    $data = $collection->getData();
    foreach($data as $item){
        $this->_functionTwo($item);
    }
    ...
}

function _functionTwo($item){
    $model = Mage::getModel('catalog/product');
    $id = $model->getIdBySku($item['sku']);
    $inventoryStatus = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($id, 'product_inventory_status', 1);
    $invStatus = $model->getResource()->getAttribute('product_inventory_status')->getSource()->getOptionText($inventoryStatus);
    if ($invStatus && $id) {
        if ($invStatus !== 'Z') {
            $stockItem = Mage::getModel('cataloginventory/stock_item');
            $stockItem->setData(array());
            $stockItem->loadByProduct($id);
            if ($stockItem->getQty() != $item['quantity']) {
                $stockItem->setQty(item['quantity']);
                $stockItem->save();
                $this->functionThree($item['sku']);
            }
        }
    }
}

function functionThree($sku){
    $collectionOfKits = Mage::getModel('kitinventory/kitinventory')->getCollection()->addFieldToFilter('related_sku',$sku);
    if($collectionOfKits->getSize()){
        foreach($collectionOfKits as $kit){
            $kitSku = $kit->getSku();
            $kitCollection = Mage::getModel('kitinventory/kitinventory')->getCollection()->addFieldToFilter('kit_sku',$kitSku)->setOrder('related_sku','ASC');
            ...
            foreach($kitCollection as $component){
                $componentSkus[] = $component->getRelatedSku();
                $componentRequiredQuantity[] = $component->getRequiredQuantity();
            }
            $componentProductCollection = Mage::getModel('catalog/product')->getCollection();
            $componentProductCollection->joinField('qty',
                'cataloginventory/stock_item',
                'qty',
                'product_id=entity_id',
                '{{table}}.stock_id=1',
                'left');
            $componentProductCollection->addAttributeToFilter('sku', array('in' => $componentSkus));
            foreach($componentProductCollection as $component){
                $quantity = $component->getQty();
                ...
            }
            $kitId= Mage::getModel('catalog/product')->getIdBySku($kitSku)
            $kitStockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($kitId);
            $this->functionFour($kitStockItem,$kitSku,$amountOfKitsPossible);
        }
    }
}

function functionFour($kitStockItem,$kitSku,$amountOfKitsPossible){
    ...
    $kitStockItem->setQty($quantity);
    $kitStockItem->save();
    ...
}

EDIT: this is the current functionality i've come up with, I still think there is a better way to handle these collections.


texts: Magento CMS Page showing odd site link on google search result

texts:
When you search for our domain name on Google you will see site links under the description. Usually the site links would be named after the page however now one of them is saying "Viagra Online Echeck". None of the site content has changed. Literally nothing was touched.

Does anyone know how you can change this? I heard there is a way to add meta tags to the CMS pages but I cannot find how to do this.


texts: Out of stock message in ajax without page loading in Magento 2.1

texts: I am trying to show the out of stock message in Product details page without page loading. But by default, the message is showing after page load. I know how to add products to cart in ajx without page load, but out of stock message is only showing after page load. Kindly suggest me a way to do this.


texts: Magento 2.3 - Add shipping carrier in dropdown to ship order

texts:
I want to add a new carrier to the dropdown menu inside the shipment tab of a order, to select a custom carrier.

I already tried this https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout-add-custom-carrier.html but that is adding a custom shipping method in the checkout, not to select a carrier inside a order.

How can I achieve that?


texts: Magento Speed issue google PageSpeed Insights Eliminate render-blocking JavaScript and CSS in above-the-fold content

texts:
I tried this methods link
to speed site, but still not working. please suggest me how to speed up the site for mobile version.


texts:
we are creating new row in DB table when user click on button & we are saving product related informations with created date.

protected function _createProduct()
{
 $product->setCreatedByCustomerId($customerId);
$emaildate = Mage::getModel('core/date')->date('Y-m-d H:i:s');

$data = array('product_id'=>$product->getId(),
        'customer_id'=> $customerId , 'created_at' => $emaildate);
$model = Mage::getModel('example/mydesign')->setData($data);

}

full function : http://pastebin.com/LuMhy7K9

Issue :  in backend time is showing 5:30 hours ahead than time present in DB table.

our site [IST] timings is 5:30 hours ahead than GMT


texts: First Name and Last Name not allowing to use Latin letter

texts:
I am Using Magento 1.9.1

Gómez
nº

these letters are not allowing in my customer form. please help.


texts: Multiple Cart or Split Quote in Magento2

texts:
I want to show two cart for normal products and vendor products.

I don't think it possible to create multiple cart either by splitting quote or creating multiple quote.

Because Magento 2 separate module for Quote. Can anyone tell me how can i achieve my requirement?

thanks


texts: Any issues if we disable locking for Cm RedisSession read?

texts:
We had an issue whereby our pages took a long time to load. Upon dissecting the time taken by various layers to service the request on NewRelic, we found that the method Cm_RedisSession_Model_Session::read took around 30 seconds to complete.

That is also the default timeout to wait for the lock.

/* Try to break the lock after this many seconds */
const DEFAULT_BREAK_AFTER           = 30;

We look at the writes that take place once the lock is acquired, and it's more towards storing the PID and the request details.

    // This process has the lock, save the pid
    if ($this->_hasLock) {
        $setData = array(
            'pid' => $this->_getPid(),
            'lock' => 1,
        );

        // Save request data in session so if a lock is broken we can know which page it was for debugging
        if ($this->_logLevel >= Zend_Log::INFO) {
            if (empty($_SERVER['REQUEST_METHOD'])) {
                $setData['req'] = $_SERVER['SCRIPT_NAME'];
            } else {
                $setData['req'] = "{$_SERVER['REQUEST_METHOD']} {$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
            }
            if ($lock != 1) {
                $this->_log(sprintf(
                    "Successfully broke lock for ID %s after %.5f seconds (%d attempts). Lock: %d\nLast request of broken lock: %s",
                    $sessionId, (microtime(true) - $timeStart), $tries, $lock, $this->_redis->hGet($sessionId, 'req')
                ), Zend_Log::INFO);
            }
        }
        $this->_redis->hMSet($sessionId, $setData);
    }

Upon searching, we found several articles describing the same issue, and that one of the solutions is to simply disable the locking.

https://astrio.net/blog/redis-slow-session-magento/

https://willparsons.tech/redis-session-locking/

Our question is simply - would we encounter issues if we we're to disable locking for Cm RedisSession read?

Our setup consists of multiple, load balanced, auto-scalable Magento frontend nodes operating on a single Magento instance having multiple stores.


texts: How to add Jquery code snippet in the HTML editor for footer_cms_content

texts:
When I place this code :-

$(".social-icons").after('');
$.getScript("https://seal.godaddy.com/getSeal?sealID=beP8DWYRCbG8YIK0Chdr8BKQQsmmOG3jEF1rddbw106hSZicW0fWglZgVTRQ",function(){"";
});

at the end of the HTML for footer_cms_content, it just displays the the code itself instead of the Godaddy Trust Seal. Is it possible to place it in this cms block for footer?

Thanks.


texts:
I have a problem with a custom theme in Magento. I am trying to change some variables for less. But nothing that i change has any effect on the output css.

I followed https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/css-guide/css_quick_guide_mode.html or https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/css-topics/css-overview.html to change the variables. But is has no effect.

I cleared all the caches (cache:clean & cache:flush), deleted all fiiles in pub/static/* and did re-deploy all static files for the theme.

Basically i have a simple theme inheriting from Luma theme (<parent>Magento/luma</parent>). All my other changes, custom js, css and a custom of layout changes in Magento_Theme/layout/default.xml appear just fine. The files i created:

<theme_dir>/web/css/source/_extend.less:

.action {
    &.primary {
        color: red;
    }
}

<theme_dir>/web/css/source/_theme.less:

@button-primary__color: @color-white;
@button-primary__hover__color: @color-white;
@button-primary__background: @color-orange-red1;
@button-primary__hover__background: @color-orange-red4;
@button-primary__border: 1px solid @color-orange-red2;
@button-primary__hover__border: 1px solid @color-orange-red2;

I have Magento 2.2.6, Server-Side Less Compilation is set.

EDIT SOLVED: Sorry to bother you guys. Somehow i needed to manually remove var/view_preprocessed directory in order to make changes appear. That's only half documented in the links i provided...


texts: SOAP - unable to invoke since upgrade to 1.9.3.1 (timeout), how to debug?

texts:
I've recently upgraded a Magento installation from 1.9.0.1 to 1.9.3.1. Ever since, the various apps I use to communicate with Magento via SOAPv2 have timed out with error 504.

When I attempt to load the WSDL in .NET WebService Studio I can see a complete listing of all the services, but when I attempt to invoke any of the services the process times out.

I've attempted using the SOAPv1 API and I'm getting exactly the same issue.

I've also tried installed a completely fresh copy of Magento, and the result is exactly the same; WSDL loads but times out when any invoke is attempted.
The only log I can find which is even vaguely helpful is PHP-FPM's slow process log, which reveals this trace:

SoapServer() /web-root/lib/Zend/Soap/Server.php:814
_getSoap() /web-root/lib/Zend/Soap/Server.php:880
handle() /web-root/app/code/core/Mage/Api/Model/Server/V2/Adapter/S$
run() /web-root/app/code/core/Mage/Api/Model/Server.php:138
run() /web-root/app/code/core/Mage/Api/controllers/V2/SoapControlle$
indexAction() /web-root/app/code/core/Mage/Core/Controller/Varien/A$
dispatch() /web-root/var/cache/ew/files/69/b9/Mage/Core/Controller/$
match() /web-root/app/code/core/Mage/Core/Controller/Varien/Front.p$
dispatch() /web-root/app/code/core/Mage/Core/Model/App.php:365
run() /web-root/app/Mage.php:684
run() /web-root/index.php:116

How can I debug what the problem might be?

What might have changed between 1.9.0.1 and 1.9.3.1 which would clash with the server?


texts: Want to trigger some event on swatch click in catalog page

texts: I want to trigger some event on the swatch click but not on page load in the category page.


texts: Conditionally show/hide blocks in layout XML

texts:
How to conditionally add a block (depending on the configuration in the admin panel) in Magento's layout XML?
We can check if config is true on actions. In the example below, if sample/config/show_toplinks config from the admin panel (in System->Configuration) is true, then the template file links.phtml will be used to render Top Links. If sample/config/show_toplinks is false, then the default template will be used.
<reference name="top.links">
    <action method="setTemplate" ifconfig="sample/config/show_toplinks">
        <template>page/template/links.phtml</template>
    </action>
</reference>

I found this workaround somewhere in the web. We can set an empty template as a default template for Top Links, like this:
<reference name="top.links">
    <action method="setTemplate" ifconfig="sample/config/show_toplinks">
        <template>page/template/links.phtml</template>
    </action>

    <!-- OR set completely empty template -->
    <action method="setTemplate">
        <template>page/template/empty_template_for_links.phtml</template>
    </action>
</reference>

In this case, if sample/config/show_toplinks is true, then the template links.phtml will be used and Top Links will be displayed. but if sample/config/show_toplinks is false, then the empty_template_for_links.phtml template will be used and that template is completely empty, so it doesn't return any HTML and the Top Links will not be visible.

Is there any other way to conditionally show or hide blocks depending on the configuration in the admin panel?
Is this workaround safe?
Can this cause any unexpected errors?

EDIT:
Based on all answers I think that Rick Kuipers' solution looks the most convenient for my case. But I have another related question:
    <block type="core/template" name="my_block" template="my/block.phtml" />
    <!-- ...add more blocks here -->

    <reference name="footer">
        <action method="append" ifconfig="sample/config/show_toplinks">
            <block>my_block</block>
        </action>
        <!-- ...append more blocks here -->
    </reference>

If I have many blocks to add like this (using append method and ifconfig), let's say 50,
does it affect the performance? Only some of the blocks will be really displayed (that depends on the user's setting in the System -> Config), but I need to add all those blocks before I conditionally append them inside <reference name="footer">...</reference>.
Does Magento instantly process all blocks added like this?
    <block type="core/template" name="my_block" template="my/block.phtml" />

Or blocks are processed only if they have to be finally displayed in the template? So will Magento have to process all my 50 blocks despite the fact that only some of those blocks need to be displayed?


texts: Why there are commands missing in bin/magento?

texts:
I need to set the application mode to developer, but when I tried doing so I got the exception

[InvalidArgumentException]
There are no commands defined in the "deploy:mode" namespace.

Running bin/magento list, I notice that many of the commands that I need to use, including all deploy: commands do not show.

What can be the cause of this?

I am using Magento CE 2.1.3.


texts:
How To Set Font Awesome Icon in Magento Top Links? In Magento Customer.xml

app\design\frontend\mytheme\default\layout\customer.xml


texts: How to create a copy of catalog-> manage products in a new menu?

texts:
Magento version 1.9

I want to create a copy of manage product in a new menu in magento admin.
I created the menu and i am struck with copying the product view grid and rest of the thing.Can any one help me please to achieve this task.

My config.xml file

<config>
<modules>
    <Eight25media_Tproducts>
        <version>0.1.0</version>
    </Eight25media_Tproducts>
</modules>
<global>
    <helpers>
        <tproducts>
            <class>Eight25media_Tproducts_Helper</class>
        </tproducts>
    </helpers>
</global>
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <tproducts>Eight25media_Tproducts_Adminhtml</tproducts>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

My adminhtml.xml file

<config>
<menu>
    <tproducts translate="title" module="tproducts">
        <title>Products - Training</title>
        <sort_order>100</sort_order>
        <children>
            <manage_tproducts>
                <title>Manage Products(Training) </title>
                <sort_order>1</sort_order>
                <action>adminhtml/catalog_product/</action>
            </manage_tproducts>
        </children>
    </tproducts>
</menu>

For now, i just called the catalog_product link. But i want to call in my own frontend name.

How can i implement this?


texts:
I'm having difficulties in exporting all products with their categories from Magento v2.1.9 installation for importing them to Magento v2.3.0.

Because I don't need all other tables I don't want to use the same database and actually I'm not sure even if I use the old database for the new installation I wouldn't miss some tables that are introduced in v2.3.0.

What I have tried so far is exporting tables matching the pattern catalog* and try to import them to the new database but doing so it complains about some foreign keys that are related to product attributes.

So how can I cleanly export all products, their categories and attributes and all data related to this entity?

More details

The error is:

ERROR 1005 (HY000) at line 154: Can't create table `****`.`catalogrule_customer_group` (errno: 150 "Foreign key constraint is incorrectly formed")

that by gathering more information from show engine innodb status;:

2019-03-13 11:25:45 0x7f6a74069700 Error in foreign key constraint of table `****`.`catalogrule_customer_group`:
    FOREIGN KEY (`customer_group_id`) REFERENCES `customer_group` (`customer_group_id`) ON DELETE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Rules To Customer Groups Relations'
....

I found that catalogrule_customer_group's customer_group_id column data type differs from customer_group's customer_group_id column. The former is unsigned int and the latter is unsigned smallint.

So up to now I'm ensured the differences between both versions isn't tied to tables to be less or more but also tables structures. There are two problems here:

Resolving the given error wouldn't guarantee no further errors while importing.
I shouldn't import catalogrule_customer_group because I don't have customer* tables of old database in place.

So the question remains as is. How could someone export products and all their related data to be used for a future import (into v2.3.* to be more specific)?


texts: Magento specific Categories are not displaying in layered Fiter Navigation

texts:
I am working on a Magento website 1.9.3.7 and there is an issue in category display in navigation filter.

Only some category is displaying in layered navigation filter but newly categories are not displaying in the filter. Also, some old categories are not coming in the filter.

I have already followed all possible option which is necessary for the filter.

Please advise what could be the problem?

Thanks.


texts: Magento 2 - Site not loading properly in Developer mode

texts:
I am working on M2 and I've set M2 developer mode. My site home page works fine but the other pages are not loading. They just show errors and warnings on inner pages.

Screenshot:


texts: To add information about the customer to a shopping cart in android using soap api

texts:
I am getting an error such as SoapFault - faultcode: '1045' faultstring: 'Customer's mode is unknown' faultactor: 'null' detail: null
      Please anyone could help me.

           SoapObject customerEntity = new SoapObject(NAMESPACE,"shoppingCartCustomerEntity");

       // customerEntity.addProperty("entity_id","23");
        customerEntity.addProperty("firstname","Deepti");
        customerEntity.addProperty("lastname","D");
        customerEntity.addProperty("email","abcd@gmail.com");

        customerEntity.addProperty("website_id", 0);
        customerEntity.addProperty("store_id",0);
        customerEntity.addProperty("mode","guest");

        request = new SoapObject(NAMESPACE, "shoppingCartCustomerSet");
        request.addProperty("sessionId", sessionId);
        request.addProperty("quoteId", quoteId);
        request.addProperty("customerData", customerEntity);
        env.setOutputSoapObject(request);
        (new MarshalHashtable()).register(env);

        androidHttpTransport.call("", env);
        Boolean customerAddressAdded = (Boolean) env.getResponse();

        Log.d("Customer Info ", customerAddressAdded.toString());


texts:
I try to delete product but it returns exception can not delete product and sku
my code is here

 $productcollection = $this->collectionFactory->create()->addAttributeToSelect('manufacturer','LG')->load();

        foreach ($productcollection as $product) {
            try {

                $this->productRepository->delete($product);
            } catch (StateException $e) {
            }
        }

how can I solve this error ?


texts: Is it safe to truncate the catalogindex_* tables?

texts:
My Magento installation (1.4.1) contains the following tables:

catalogindex_price
catalogindex_minimal_price
catalogindex_eav
catalogindex_aggregation
catalogindex_aggregation_tag
catalogindex_aggregation_to_tag

Since there is an index in their name, will they be rebuilt by a re-index, that is, may I safely truncate them?

I can not find any of them in the list of tables that are safe to truncate here.

I'm on Magento 1.4.1, although this might apply to other versions as well, provided these tables exist.


texts: How to remove .html from Magento 2catergory url and product URL

texts: How can I remove .html from Magento 2catergory URL and product URL. I'm getting a Unique constraint violation issue.


texts: Why not using a protocol relative Base Url

texts:
Using https https://example.com/ for Shops gets more important and there are a lot of good reasons to force it for secure URLs in Magento.

But, why use http http://example.com for unsecure URLs as default. Would there be a good reason to not use //example.com/ as unsecure Base URL?


texts: How Magento2 stores the Full page cache?

texts:
I'm trying to find out how Magento 2 handles the storage of the response. I know that it stores the raw data in /var/page_cache/ folder, but I would like to know which part of the code handles the storage of a page?

I looked every file in the PageCache module with no luck. Could you point me into the right direction?

Page cache module:
https://github.com/magento/magento2/tree/develop/app/code/Magento/PageCache


texts: Magento 2 custom module gives list page blank

texts:
I have custom module the news_index_index file is as bellow.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
       <block class="Custom\News\Block\Frontend\News" name="newscoll.collall" template="Custom_News::news.phtml" />
       </referenceContainer>
    </body>
</page>

In footer i have called it there it works file with

{{block class="Custom\News\Block\Frontend\Newsslide" template="news_slide.phtml"}}

But news_index_index.xml it doesn't load list file.


texts: Output all categories down to the third level in the template

texts: How can I retrieve the main categories and all subcategories three levels deep and display it in the template?


texts: Magento2.3 Product Add to Wishlist Invalid Form Key. Please refresh the page?

texts:
I am using php 7.2.13 version and magento 2.3 latest version in xampp.
When i do add to wishlist and save anything am getting Invalid Form Key. Please refresh the page? this error.


texts: Element with ID '.history.pager' already exists

texts:
i got this error while load new product collection in my custom cms page

protected function _prepareLayout()
   {
      parent::_prepareLayout();
       $this->pageConfig->getTitle()->set(__('Best Seller'));

       if ($this->getCollection()) {
            $pager = $this->getLayout()->createBlock('Magento\Theme\Block\Html\Pager','newproduct.history.pager')->setAvailableLimit(array(5=>5,10=>10,15=>15,20=>20));
            $pager->setLimit(5)->setShowPerPage(true);
            $pager->setCollection($this->getCollection());
            $this->setChild('pager', $pager);
            $this->getCollection()->load();
        }
        return $this;
   }
   public function getPagerHtml(){
        return $this->getChildHtml('pager');
    }

    public function getCollection(){
      $page=($this->getRequest()->getParam('p'))? $this->getRequest()->getParam('p') : 1;
      $pageSize=($this->getRequest()->getParam('limit'))? $this->getRequest()->getParam('limit') : 100;
        $collection = $this->_productsFactory->create()
        ->addAttributeToSelect('*')
        ->setOrder('entity_id','desc')
        ->setPageSize(20)
        ->setPageSize($pageSize)->setCurPage($page);
        return $collection;
   }

Error

Error filtering template: Element with ID 'newproduct.history.pager' already exists.

How to fix this issue


texts: Customer session issue for login users in magento1.9.4.4

texts:
I have problems with front end customer login, I have  checked it with same system and login with two different different customer detail on to the different-2 browsers.

On chrome  I have login with user X details and on Firefox I have login with Y user details.

But on chrome browser  it is showing Y user is login on  some of the pages and some of pages it is showing  loge-din X user.

same for firebox  login with Y but some of pages user showing X and some of page it is showing Y user in magneto 1.9.4.4.

How to fix please give me solutions.


texts: Indexers invalid and cron job notification

texts:
I installed Magento but in admin panel it is giving system message as:

  One or more indexers are invalid. Make sure your Magento cron job
  is running

If I am adding categories or products from admin panel It shows no effect on front-end and not even menu and categories are displayed.


texts: Magento 1 - Are recently viewed products unique to the current user only?

texts:
I've been using the recently viewed block on the majority of Magento 1 websites I've created and I always thought the recently block was unique to the current user (guest or registered).

A client has noticed the recently viewed block is showing random products and it's got me thinking the block is showing other customers recently viewed which would make it site wide instead of unique to the user.

Can anyone confirm whether it's unique or site wide as I cannot see any issues with the setup (v1.9.3.6).


texts: Magento uses  for the logo on EVERY page - Duplicate h1 tags

texts:
I used onpage.org for an SEO analysis and it told me I have a lot of pages with double h1 tags on my Magento shop.
I checked this and it seems my logo is h1 on every page, probably due to the theme, while this should only be on the home page.

I have searched in app/design/frontend/default/theme/template/page/html/header.phtml and found a reference to the h1 tag on the logo, but am not sure what to do, delete this entire code?

      <?php if ($logoStatus == 0): ?>

<?php echo $this->getLogoAlt() ?><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" />

     <?php else:?>

<?php echo $logoAlt; ?><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $logoAlt; ?>" class="logo"><img src="<?php echo $mediaUrl.$logo; ?>" alt="<?php echo $logoAlt; ?>" />

     <?php endif; ?>


texts: Make Tax/VAT number field required for orders more than x

texts:
Is it possible to make the Tax/VAT number field required in checkout page, if order total was more than x? How?

Thanks


texts: Magento 2 : How to display swatches in related products?

texts:
I added related products list in product details page.
I see there all related products list are display but now i need to display swatches in this list. How can it possible for related products list.

If any one know please give me answers.


texts: Magento 2: Update qty in product list page like on cart page

texts: I added qty input on product list (list.phtml) is any way to implement solution with update qty like on cart page or minicart? not just add to cart but update qty in product list.


texts: Magento 2.1: Markup language in order confirmation email

texts:
I made an order in my Magento store and received the order confirmation in my mailbox. However, the markup didn't converted to normal text. It keeps {{htmlescape var=$order.getCustomerName()}} as text and the email also contains some HTML tags.

What should I do to fix this?


texts:
I want to set an array in registry in controller_action_predispatch_checkout_cart_add event observer and read this in a phtml page.

The following code will give blank result
.

=> Code :

namespace NameSpace\Module\Observer;

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

class RestrictAddToCart implements ObserverInterface
{
    protected $_request;

    protected $_product;

    protected $_responseFactory;

    protected $_url;
    protected $_registry;

    public function __construct(
        RequestInterface $request,
        \Magento\Catalog\Model\Product $product,
        \Magento\Framework\App\ResponseFactory $responseFactory,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\UrlInterface $url
    )
    {
        $this->_request = $request;
        $this->_product = $product;
        $this->_registry = $registry;
        $this->_responseFactory = $responseFactory;
        $this->_url = $url;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $this->_registry->register('slct_options', $observer->getRequest()->getParams());
        $customRedirectionUrl = $this->_url->getUrl('my-page');
        $this->_responseFactory->create()->setRedirect($customRedirectionUrl)->sendResponse();
        die();
        return $this;
    }
}

=> phtml :

<?php
print_r( $block->getRegisterData());
 ?>

=> Block :

namespace Namespace\Module\Block;

use \Magento\Framework\View\Element\Template;

class Customblock extends Template
{
    protected $_registry;

    public function __construct(
        Template\Context $context,
        \Magento\Framework\Registry $registry,
        array $data = [])
    {
        $this->_registry = $registry;
        parent::__construct($context, $data);
    }
     public function getRegisterData()
    {
        return $this->_registry->registry('slct_options');
    }
}


texts: Display a custom navigation block instead of the default one

texts:
I am working on a Magento 2.1.7 shop and  I have
created a child-theme of Magento Blank.

In the back-end, I have created a block with a custom, hard-coded, navigation like:

Home

About

Blog

Contact Us

By default, Magento displays links to the product categories in the top menu:

<block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-"/>

How do I, instead, display my custom links block?


texts: Where magento 2 render the url for products and catalog?

texts:
I would like to app prefix like my-product to the view product, for example using magento 2 sample product we can view one of the product using this link :

http://localhost:8000/desiree-fitness-tee.html

I would like to add my-product before desiree so it becomes :

http://localhost:8000/my-product/desiree-fitness-tee.html

I can do the hack way to achieve this, like change the request_path column in the table url_rewrite. But I'm pretty sure this is not the right way to do it.

So what I want to do is finding the module that generate all this url for products and categories, so I can add a prefix to that url before magento 2 render or showing the page.

Where can I find the module that handle this ?


texts: Magento 2: UpgradeData duplicates static blocks when I try to update them

texts:
My code looks like this:

/**
 * @var \Magento\Cms\Model\BlockFactory
 */
private $_blockFactory;

...

$this->_blockFactory
        ->setStoreId(0)
        ->load('some-identifier', 'identifier')
        ->setData([
            'title' => 'Some Title',
            'identifier' => 'some-identifier',
            'is_active' => 1,
            'stores' => [0],
            'content' => 'Some Content...',
        ])->save();

Everytime I run this code, it creates a new static block with the same identifier.
Any idea?


texts: Wanted to know , what does getChildHtml() does .need to know the flow of control?


texts: REST Api product creation with global attributes

texts:
I'm trying to add new products to a Magento 2.1.7 and noticed some strange behaviours when it comest to global attributes (special_price for this example), found a workaround (kind of...) and was looking for a confirmation from the community if what I'm seeing in there is correct.

So, scenario: Magento 2.1.7 installation, only 1 store.
The endpoint used is rest/V1/products/, but using it like that, although it assigns the product to the one store I have in the installation, it also creates a row in the catalog_product_entity_decimal table having store_id as 1, when a global attribute should have only 0 - is that correct?

Now, that attribute ends up in being a rogue row in there because no matter what I'm trying in the admin to do with it, being a global attribute, the admin's not touching that at all. The problem on the frontend after that is that the product in question will always show the special_price, because it finds an attribute with the current store_id, doesn't matter if it's global or not, it just shows it (now this is an assumption, haven't checked that, must admit, but it kinda makes sense).

If I am changing the endpoint to rest/all/V1/products/ it doesn not create the store_id=1 attribute in that table, but the product is not assigned to the store front either, and although now the special_price is not an issue anymore, I have to go in the admin for all products created like that and assign them to the only default website in order to be visible on the front-end.

Doing a bit more 'light reading' through http://devdocs.magento.com/swagger/index_20.html
I found that I can follow up the initial API call when I create the product with the /all/ endpoint that eliminates the special_price problem with another call for rest/all/V1/products/webites with the following JSON payload:

{
    "productWebsiteLink": {
    "sku": "<newly-created-product-sku>",
    "websiteId": 1
    }
}

It assignes the product to the only available website, shows in the front-end and all my problems are solved.

Now, the 'million dollars question': is this normal? Is that how it should be done? Create the product unassigned to a website and follow that up with another API call to assign it? If so, is there somewhere in the documentation that tells you the exact steps to follow?

The closest thing I could find about this problem (although it states it's about getting products) is this: https://github.com/magento/magento2/issues/8121 and I got there following Magento2: Save Product Data for global scope using Rest API

Any opinions/links/advice will be greatly appreciated.

Thanks


texts: How to output and filter collection using "->where" filter?

texts:
I trying to get output from collection using 'where'
filter but no result.
This is my code:

$collection = Mage::getModel('my_work/datanews')
            ->getCollection()
            ->getSelect()
            ->where('menu_id = ?', '1');

        foreach ($collection as $item) {
            echo $item->getData('collection');
        }

What are the problems?


texts: how to display a multiselect customer attribute on frontend

texts:
I added a multiselect attribute to customers. It works fine in the backend.
Now I would show it in fronted customer edit template, so that customer can display or change options.

Is there any magento function to show it or I need to create it?


texts: The image MIME type is not valid or not supported

texts:
I am not able to add media from URL to Product

{
 "entry":{
 "id": 0,
 "label": "ZYXEL USG 300 ICARD CONTENT FILTER 1 YIL-210011129",
 "position":0,
 "disabled":true,
 "types":[
"image","small_image","thumbnail","swatch_image" ],
 "file": "http://img.bayinet.com.tr/Content/ProductImages/210011129/images/210011129.jpg",
 "content":{
 "base64_encoded_data": "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAICAgICAgICAgIDAgICBAUEAgIEBQYFBQUFBQYHBgYGBgY",
 "type": "image",
 "name": "ZYXEL USG 300 ICARD CONTENT FILTER 1 YIL-210011129.jpg"
}
}
}

Any help will be appreciated


texts:
I have made the following changes:

1) System > Configuration > Web > “Use Web Server Rewrites” to Yes

2)  System > Configuration > Catalog > “Use Categories Path for Product URLs” to YES

3) System > Configuration > Catalog > “Use Canonical Link Meta Tag For Categories” to Yes

4) System > Web > Search Engine Optimization -> Use Web Server Rewrites to Yes

5) System > Catalog -> Search Engine optimizations -> Use Categories Path for Product URLs -> to NO

Now I have the situation, when i click on product a get the following friendly url: www.domain.com/name-of-the-product, which is what I want to archive.

Also I use the following code on my view page to display related products from same category.

    <?php $categories = $_product->getCategoryIds(); ?>
    <?php $result = array();
    foreach($categories as $cat_id) {
    $category = Mage::getModel('catalog/category');
    $category->load($cat_id);
    $collection = $category->getProductCollection();
    foreach ($collection as $product) {
    $result[] = $product->getId();
    }
    }
    ?>

        <?php if(sizeof($result) >= 5)
        {
        $ourneed = array_rand($result,5);
        foreach($ourneed as $cc)
        {
        $thisproduct= Mage::getModel('catalog/product')->load($result[$cc]);
        ?>

                    <a href="<?php echo $thisproduct->getProductUrl()?>"><img class="thumbnail" src="<?php echo Mage::helper('catalog/image')->init($thisproduct, 'thumbnail')->resize(150, 150)?>" alt="<?php echo $thisproduct->getName()?>">

                    <a href="<?php echo $thisproduct->getProductUrl()?>">

                            <?php echo $thisproduct->getName()?>

                    <?php
                    $product_block = new Mage_Catalog_Block_Product;
                    echo $product_block->getPriceHtml($thisproduct);
                    unset($product_block)
                    ?>

                    <?php echo $this->_reviewsHelperBlock->getSummaryHtml($thisproduct, short); ?>

        <?php } ?>
        <?php }else {
        foreach($result as $cc)
        {
        $thisproduct= Mage::getModel('catalog/product')->load($cc);
        ?>

        <a href="<?php echo $thisproduct->getProductUrl(); ?>" title="<?php echo $thisproduct->getName(); ?>" ><img src="<?php echo $this->helper('catalog/image')->init($thisproduct, 'small_image')->resize(200) ?>" width="200" height="200" alt="<?php echo $thisproduct->getName(); ?>" />

        <?php }
        }
        ?>

Above code works just fine, but when I click on the product which is displayed by above code, a I'm getting the following link: www.domain.com/catalog/product/view/id/234/s/name-of-the-product

I would like to display it as www.domain.com/name-of-the-product

thanks


texts: How to Sort the categories alphabetically?


texts:
What is the difference between an Extension and a Module?

Just curious to know that what is the right term to use when we extend Magento's functionality by creating our custom code in local folder.


texts: I can't change the product thumbnail programmatically

texts:
Somehow I am unable to change the thumbnail of an Product and it drives me crazy.

Setup

$product = $this->objectManager->create('Magento\Catalog\Model\Product')
    ->setStoreIds([0,1,$this->store_other_website->getId()])
    ->setWebsiteIds([1,$this->website->getId()])
    ->setDescription('Store description')
    ->setName("testproduct") // Use default
    ->setPrice("99.99") // Store price
    ->setSku("TEST-1") // Store price
    ->setVisibility(null) // Use default
    ->setCountryOfManufacture(null) // Use default
    ->setImage('/m/a/magento_image1.jpg')
    ->setSmallImage('/m/a/magento_image1.jpg')
    ->setThumbnail('/m/a/magento_image1.jpg')
    ->setData(
        'media_gallery',
        [
            'images' => [
                [
                    'file' => '/m/a/magento_image.jpg',
                    'position' => 1,
                    'label' => 'Image Alt Text 1',
                    'disabled' => 0,
                    'media_type' => 'image'
                ],
            ]
        ]
    )
    ->setCanSaveCustomOptions(true)
    ->save();

$imagePath = "new_image.jpg"; // path of the image
$mediaGalleryProcessor = $this->objectManager->create(\Magento\Catalog\Model\Product\Gallery\Processor::class);
$mediaGalleryProcessor->addImage($product, $imagePath, array('image', 'thumbnail', 'small_image'), true, false);

What should work

$thumbnail = "/n/e/new_image.jpg";
$product->setThumbnail($thumbnail);
$product->save();
$product->getData('thumbnail') // = "/n/e/new_image.jpg"

What actually happens

$thumbnail = "/n/e/new_image.jpg";
$product->setThumbnail($thumbnail);
$product->save();
$product->getData('thumbnail') // = "/m/a/magento_image1.jpg"

as soon as i save the product the thumbnail gets reverted to the old one.


texts: Magento 2: Clicking on menu always goes to index dashboard page

texts:
I have created a submenu in Magento 2 back end and want to show grid on clicking on it.

app\code\Tutorial\SimpleNews\etc\adminhtml\menu.xml

<?xml version="1.0"?>

 config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 ="../../../Backend/etc/menu.xsd">
  <menu>
    <add id="Tutorial_SimpleNews::main_menu" title="Simple News"
        module="Tutorial_SimpleNews" sortOrder="20"
        resource="Tutorial_SimpleNews::simplenews" />
    <add id="Tutorial_SimpleNews::manage_news" title="Manage News"
        module="Tutorial_SimpleNews" sortOrder="2" parent="Tutorial_SimpleNews::main_menu"
        action="simplenews/news/index" resource="Tutorial_SimpleNews::manage_news" />
 </menu>
</config>

app\code\Tutorial\SimpleNews\etc\adminhtml\routes.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/
 Framework/App/etc/routes.xsd">
 <router id="admin">
    <route id="simplenews" frontName="simplenews">
        <module name="Tutorial_SimpleNews" />
    </route>
</router>
</config>

app\code\Tutorial\SimpleNews\Controller\News\Index.php

 <?php

 namespace Tutorial\SimpleNews\Controller\Adminhtml\News;

 use Tutorial\SimpleNews\Controller\Adminhtml\News;

 class Index extends News
 {
 public function execute()
 {
   if ($this->getRequest()->getQuery('ajax')) {
        $this->_forward('grid');
        return;
    }

    /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
    $resultPage = $this->_resultPageFactory->create();
    $resultPage->setActiveMenu('Tutorial_SimpleNews::main_menu');
    $resultPage->getConfig()->getTitle()->prepend(__('Simple News'));

    return $resultPage;
 }
 }

app\code\Tutorial\SimpleNews\view\adminhtml\layout\simplenews_news_grid.xml

 <?xml version="1.0"?>

  <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/
  Framework/View/Layout/etc/layout_generic.xsd">
  <update handle="formkey"/>
  <update handle="simplenews_news_grid_block"/>
   <container name="root">
      <block class="Magento\Backend\Block\Widget\Grid\Container"
        name="tutorial_simplenews_news.grid.container"
        template="Magento_Backend::widget/grid/container/empty.phtml"/>
   </container>
  </layout>

When ever I click on submenu "Manage News" it redirects to admin dashboard instead of grid section created by me.

Here is the url I followed:

First Part: http://www.mage-world.com/blog/adding-new-menu-item-in-magento-2-custom-module.html

Second Part: http://www.mage-world.com/blog/grid-and-form-in-magento-2-admin-panel-part-1.html

Please help me.


texts: How to get shipping address by invoice number?

texts:
When i print multiple invoices, i add new PDF page and on that page i print Invoice number, order number, and Total amount.
And to do this i did code
`foreach ($invoices as $invoice) {

        array_push($this::$invs,$invoice);
    }
    $grandtotal = 0;
    for($i=0;$i<sizeof($this::$invs);$i++){

        $order = $this::$invs[$i]->getOrder();
        $amount = $order->getGrandTotal();
        $grandtotal = $grandtotal + $amount;
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));

        $page->drawText('Inc#: '.$this::$invs[$i]->getIncrementId().'        Ordr#: '.$this::$invs[$i]->getOrderId().'      Total Amount: '.$amount, 20, $this::$p, 'UTF-8');
        $this::$p=$this::$p-15;
    }`

in app/code/local/Mage/sales/Model/order/pdf/invoice.php and it's working fine.
Now i want to add shipping address of every order with it. As you see that i got invoice Id's not Order Id's. If any one can help please.


texts: Why do magento2 cronjobs need to be ran every minute?

texts:
As the title says, I'm really curious if I could set the cronjobs to execute a bit more rare. For example every 10 minutes or so. Is there any specific requirement on why do the magento 2 cronjobs need to be ran every minute?

Thank you!


texts: delete products with a specific attribute

texts:
I have an attribute which is called manufacturer (attribute code: manufacturer)
and I want to delete all sku's that are from a specific manufacturer.

However I am not sure how to write the SQL (I want to do this via Mysql)
I know the basic query to delete a product would be like

  SELECT * FROM magento.catalog_product_entity where sku='abc';

any suggestions?
thank you!


texts: Does magmi can able to download remote images?

texts:
In this link:

http://sourceforge.net/apps/mediawiki/magmi/index.php?title=Image_attributes_processor

To set base image values

image
small_image
thumbnail

To set base image labels

image_label (label to use for image)
small_image_label (label to use for small_image)
thumbnail_label (label to use for thumbnail image)

A) Whats the differnece between '*image values' and 'image labels'*

B)  All I have a productsFeed.csv file what image columns should keep in it..?

C) Does Magmi can able to download remote Images from URL? sinc ein my csv i have all remote images


texts: Magento 2, How to get Payment infoInterface from order?

texts:
I am working on a custom payment method.
I am stuck in between where one of my methods required Payment object of \Magento\Payment\Model\InfoInterface

But I am getting Magento\Sales\Model\Order\Payment\Interceptor

from order object.

How Can I get this Payment object of \Magento\Payment\Model\InfoInterface?

Thanks


texts: tier_prices.phtml with custom script not render on product detail page - Magento 2.2.6

texts:
I have made a wholesale tier price table for the B2B group customers according to this (tier price table), but I cannot make the new script in tier_prices.phtml render on the product page. Instead, it still renders the phtml file from vendor / magento module directory.

Here is the path: <theme_dir>/<Magento_Catalog>/<templates>/<product>/<price>/tier_prices.phtml

I am not sure how to move the templates file under base to child theme. Do I need anything else than just moving the phtml to templates?


texts:
My homepage is showing my domain (www.domain.com) as prefix before title. I didn't put the prefix in cms homepage but on google it is showing as (www.domain.com then title). How can i remove that prefix from homepage title? can anyone help?

thanks


texts: Megamenu using same category URL for all categories on front-end

texts:
I'm using the Magedelight Megamenu for Magento 2.2.7

I have a range of product categories listed under the "Default Category", about 8 or 9. The Megamenu is using the URL of the first category in the list on the front-end for the URL for all of the other links, does anyone know why this could be?

Many thanks


texts: Extra Add to Cart Button for simple Product

texts:
I have a website, sell a products with and without installation service. I want two add to cart buttons, one with and one without installation on a product page. The price for installation is variable for each product.

I write the code below in {theme}/template/ajaxcart/catalog/product/view/addtocart.phtml near Add to Cart button. The price that is displayed add the button is € 0,00 it should be € 350,00 and when you use this button the totaal page refresh.

<?php
if($_product->getSampleProductId()):
    $_price = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_product->getSampleProductId(), 'price', Mage::app()->getStore());
    $_formattedPrice = Mage::helper('core')->currency($_price, true, false);
    $_buttonTitle = "Order Sample @".$_formattedPrice;?>
<button type="button" title="<?php echo $_buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add/product/'.$_product->getSampleProductId()) ?>')"><?php echo $_buttonTitle ?></button><?php endif; ?>

How can I make this extra add to cart button to work? Thanks


texts: variable for shipping tracking no in email

texts:
I want to add the tracking no to an email, just the number not url.

what is the tracking # variable ?

update

I have modifed the code in track.phtml to this

?>
<?php $_shipment=$this->getShipment() ?>
<?php $_order=$this->getOrder() ?>
<?php if ($_shipment && $_order && $_shipment->getAllTracks()): ?>
<?php $i=0; foreach ($_shipment->getAllTracks() as $_item): $i++ ?>
<?php echo $this->escapeHtml($_item->getNumber()) ?>
<?php endforeach ?>
<?php endif; ?>

but I don't want to have all tracking #, I only want the last added one

how can I do that ?


texts: Magento 2 how to setting Billing Address qty

texts:
i'm using magento 2.3.x , how can i setting Billing Address qty to 1 only? it just can give custumer to add one address or 2, thank you!
i want customer only can setting one or two upper limit billing and shipping address, can not setting three or more address, included account dashboard address and checkout page.


texts:
I have a problem to rewrite/override Mage_Catalog_Block_Product_List_Toolbar.

Here is my code:

  etc/modules/Codesky_CatalogProduct.xml

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

  config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Codesky_CatalogProduct>
            <version>0.0.1</version>
        </Codesky_CatalogProduct>
    </modules>
    <global>
        <blocks>
            <catalogproduct>
                <class>Codesky_CatalogProduct_Block</class>
            </catalogproduct>
            <catalog>
                <rewrite>
                    <product_list_toolbar>Codesky_CatalogProduct_Block_Product_List_Toolbar</product_list_toolbar>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

  Codesky_CatalogProduct_Block_Product_List_Toolbar.php

class Codesky_CatalogProduct_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar
{
    /**
     * Retrieve available limits for current view mode
     *
     * @return array
     */
    public function getAvailableLimit()
    {
        return array(30 => 30, 60 => 60, 90 => 90);
    }
}

Why it's not working. Magento still use method getAvailableLimit() from core file.


texts: How to take order id form url in Magento 1

texts:
I have this link from backend /sales_order/view/order_id/44/key/6d81f4104dc5d2a72a8e16f709f61990/

Here I have the order id which it's 44. I want to take this id in a controller.
I try like this: $id = $this->getRequest()->getParam('order_id'); but it dosen't work. I recive null.

It's any method to take this value?


texts:
What is the best way to get a collection of product reviews, and retrieve the name and rating number from this collection?

thx.


texts: What is the best way to edit your Magento site's toplinks block in the top right hand corner, WITHOUT editing core files?

texts:
This is the block which contains "My Account", "Log In/Log Out" etc by default.

I've seen a few suggestions on how to do this, but I haven't seen anything complete that doesn't involve editing core Magento files that will be overwritten in the next Magento update. Can a suggestion be mode on the best way to do this? I would imagine creating some files in the local folder pool to over ride the default file that would include a local.xml file? A full complete answer that details this step by step would be great, as this doesn't seem to exist. Almost looking for a "dummies guide" to be honest :)


texts:
after recent announcement of Google to rank https/ssl site higher we are investigating how to do this.

Situation: we run Magento 1.8.1 multistore on 1 IP with 4 stores & in total 12 storeviews. Every storeview has one domain. Server is VPS on CentOs 6.5 & Direct Admin 1.45

Question: Now what would we the steps to set-up https/ssl?

(maybe we can collaborate and make it a wiki question)

Things I can think of

Buy certificate [where is best & what type for multistore that makes Google smile]
Correct way of installing on DA
Config steps in Magento (for multistore)
Config step in htaccess? (for multistore)
Method to secure SEO juice from htp site?
Correct all "This page contains both secure and nonsecure items""
Server caching issues?

There is probably a lot of information that can be found "in parts" - but what about aggregating it here

Many many thanks


texts:
I am making an extension that filters each order and send out an e-mail to each drop shipper in order.

Example

Order with 3 products. 2 products from drop shippers A and 1 product from drop shipper B.

Dropshipper A with should receive email containing only their 2 products and drop shipper B should receive email containing just their 1 product.

I want to maintain default Magento e-mail template functionality, so email is easy to update.

This is what i have so far.

Observer model that listen for <sales_order_place_after>

<events>
    <sales_order_place_after>
        <observers>
            <sales_order_place_after_handler>
                <type>model</type>
                <class>dropshipperemail/observer</class>
                <method>sendEmail</method>
            </sales_order_place_after_handler>
        </observers>
    </sales_order_place_after>
</events>

A method in observer that filter products and build array containing correct data.

public function sendEmail(Varien_Event_Observer $observer)
{
    $order = $observer->getOrder();
    $orderItems = $order->getAllVisibleItems();

    foreach($orderItems as $item):
        $product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($item->getProductId());
        if($dropshipper = $product->getAttributeText('dropshipper')):
            $list[$dropshipper][$product->getSku()] = array(
                'name' => $product->getName(),
                'sku' => $product->getSku(),
                'qty' => $item->getData('qty_ordered'),
                'price' => $item->getPrice()
            );
        endif;
    endforeach;
}

I can pass variables to transactional email and send fine.

But what i would like to do and i think is more elegant solution is to somehow rewrite queueNewOrderEmail and pass params with it (recipient email and product attribute to filter) like queueNewOrderEmail(false, $dropshipper, $recipient). Then i can do the actual filtering in render file

  /app/design/frontend/base/default/template/email/order/items/order/default.phtml

Will this be working solution or am i missing something important?


texts: Please specify the product's required option(s) Custom Option type file

texts:
I got only one custom option, which is file type, I tried to add product to cart programmatically like this:

$logoSku = 'lg-brnd01';
$productLogo = Mage::getModel('catalog/product')->loadByAttribute('sku',$logoSku);
$logoOptions = $productLogo->getOptions();
$opts = Mage::getSingleton('catalog/product_option')->getProductOptionCollection($productLogo);
$i =0;
$cart = Mage::getModel('checkout/cart');
$cart->init();
$params = array(
    'product' => $productLogo->getId(),
    'qty' => 1,
    'form_key' => Mage::getSingleton('core/session')->getFormKey(),
);
foreach ($opts->getData() as $data) {
    $optionId = $data['option_id'];
    $image = $paths[0]['name'];
    $options =  array(
    $optionId => array(
        'type' => $paths[0]['type'],
        'title' => $image,
        'quote_path' => DS.'media'.DS.'uploads'.DS.'logo-branding'.DS.$quote_id.DS.$image,
        'order_path' =>  DS.'media'.DS.'uploads'.DS.'logo-branding'.DS.$quote_id.DS.$image,
        'fullpath' => $path.$image,
        'secret_key' => substr(md5(file_get_contents($path.$image)), 0, 20)),
    );
    $params['options_'.$optionId.'_file_action'] = 'save_new';
}
$params['options'] = $options;
print_r($params);
$request = new Varien_Object();
$request->setData($params);
try {
    $cart->addProduct($productLogo->getId(), $request);
    $cart->save();
    $i++;
} catch (Exception $e) {
    print_r($e->getMessage());
}

but I got an error like this:

  Please specify the product's required option(s)


texts: Applying Shopping Cart Rule According To Shop and/or currency

texts:
I want to create a shopping cart rule which has a condition based on currency and/or store.
For example, 10% off only if the currency is USD.
Have searched thoroughly and can't find any info on how to attempt doing this or if there is an extension that may do it.
I am unable to do it according to category due to the way that the stores have been set up.
So, to ask as a more general question, is there a way to add conditions to a shopping cart rules that are based on chosen fields.


texts:
I need to send order details once order is created using SOAP API,

Now i am storing all the orders that are creating in the gap of 5 mins in a link and making the link refresh every minute using cron job and passing the values to external application , is this the right approach

How to send order details instantly once order is created


texts: How to completely disable cache for development?

texts:
I am developing a script which is in the skin folder.
I lost many hours because of the weird caching mechanism of Magento.

I already disabled all the caches in the backend, but it still caches.
I opened the developer console and enabled "disable cache" in the browser, but it makes no difference.

It does not use the latest script file, even if I empty the var/cache folder.

I also cleared the Javascript/CSS cache and every possible cache.

How on earth should I develop if it caches so hard? I always have to wait about 1-2 minutes until the file is loaded instead of the cached one.

Is it possible to completely turn it off?


texts: AddattributetoFilter not working in list.phtml

texts:
Friends,

I have a situation,  I get the search results when I seaerch for e.g.  "Sunrise", but after I get the results I want to refine it further with another ATTRIBUTE value which is a TEXT field. IT is called att_eby_orientation and it has values "Portrait" and "Landscape", so in the URL can I add it like

http://crowdedgallery.co.uk/catalogsearch/result/index/?q=sunrise&orientation=Landscape

where the last varialbe is the Attribute with the Value "Orientation".  I have a few more attributes to Filter like "Size",
 "color" etc,  so, I will be greatful if someone can help me to solve this issue


texts:
How do you grab text fields from the Magento ORM back end?

Such as :

($_product->getCaseMeasurement()) ? $_product->getCaseMeasurement() : '';

Which grabs a text field of attribute code "case_measurement" or attribute label "Case Measurement"

If I had a text field of attribute code "clasp" and attribute label "Clasp".


texts: REST API and setting the quotes Billing & Shipping addresses

texts:
In Magento 2.2 there is an API endpoint of:

/V1/carts/mine/billing-address

And this accepts JSON in a POST request like this:

{
  "address": {
    "region": "somewhere",
    "country_id": "GB",
    "street": [
        "a street"
    ],
    "telephone": null,
    "postcode": null,
    "city": null,
    "firstname": "test",
    "lastname": "testing",
    "email": "test@example.com"
  }
}

This will correctly update the billing address, and if the shipping address is the same I can add this flag:

"useForShipping": true

But how do I save a shipping address to the quote that is not the same as the billing address?

I have found this endpoint:

/V1/carts/mine/shipping-information

Which accepts the billing and shipping addresses but also requires a shipping carrier and method - which we cannot possibly know yet without first saving the shipping address?

This must work for both logged in customers and guest carts.

I found a number of GitHub issues related to this, such as this one, but none of them seem to provide an actual answer.


texts: How to override order sales model in magento 1.9

texts:
I have stuck with this. I am trying to override sales/ order model _saveafter function with my custom module. I have the following code

\app\code\local\Rkt\SalesNew\etc\config.xml

<modules>
    <Rkt_SalesNew>
        <version>0.0.1</version>
    </Rkt_SalesNew>
</modules>
<global>
    <models>
 <salesnew>
      <rewrite>
        <method>Rkt_SalesNew_Model_Order</method>
      </rewrite>
 </salesnew>
    </models>
</global>

\app\code\local\Rkt\SalesNew\Model\Order.php

class Rkt_SalesNew_Model_Order extends Mage_Sales_Model_Abstract

{

   protected function _afterSave()
{
    if (null !== $this->_addresses) {
        $this->_addresses->save();
        $billingAddress = $this->getBillingAddress();
        $attributesForSave = array();
        if ($billingAddress && $this->getBillingAddressId() != $billingAddress->getId()) {
            $this->setBillingAddressId($billingAddress->getId());
            $attributesForSave[] = 'billing_address_id';
        }

        $shippingAddress = $this->getShippingAddress();
        if ($shippingAddress && $this->getShippigAddressId() != $shippingAddress->getId()) {
            $this->setShippingAddressId($shippingAddress->getId());
            $attributesForSave[] = 'shipping_address_id';
        }

        if (!empty($attributesForSave)) {
            $this->_getResource()->saveAttribute($this, $attributesForSave);
        }

    }
    if (null !== $this->_items) {
        $this->_items->save();
    }
    if (null !== $this->_payments) {
        $this->_payments->save();
    }
    if (null !== $this->_statusHistory) {
        $this->_statusHistory->save();
    }
    foreach ($this->getRelatedObjects() as $object) {
        $object->save();
    }
    return parent::_afterSave();
}

}

I am unable to override this function. Can any one please help me out.


texts: Magento2 - where the admin console user preferences stored?

texts:
I have logged into the admin panel of Magento 2, gone to products->catalog and have set the 'per page' limit to 900.

My Magento instance can't return 900 records in one page so it crashes, and a div with a spinner remains active after an error message appears saying 'Attention: Something went wrong' - so I can't revise the 900 to a more suitable number.

I've tried clearing cache/client cookies, etc - but nothing is happening.  I can't seem to find where the catalog product grid limit value is being stored.

Please if someone can assist, it would be good.

Thanks,


texts:
how do I get subscriber information, base on the subscriber ID?
I would like to grab their email address, name ...etc by the subscriber ID. or even their customer ID

Thanks


texts: Magento 2 - How to filter on multiselect product attribute?

texts:
I want to filter multiselect product attribute which has backend type Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend. So when I save attribute it gets saved as the comma-separated values in the database. So at the time of Product filtering, I applied filter by 2 values as like this
 $this->collection->addAttributeToSelect('*');
 $this->collection->addAttributeToFilter( 'concerns', array('finset' => 'concerns_1,concerns_4'));

It's not filtering with the above code (means collection size returning zero) but when I filter on a single value its working fine. Please suggest me how can I filter on multiple values. Thanks in advance.


texts: Save a simple text input form to database from custom admin controller

texts:
In my extension I've created a custom adminhtml controller with a custom layout and template.

In the indexAction I've created a page with a simple form containing a text input. I just need to save this string to database.

How can I achieve this?


texts: Magento 2.2 : _theme.less file override not working

texts:
I am new to magento2 development and  have tried every possible senario's but still unable to reproduce the issue why my _theme.less file is not overriding existing styles.I have put my less file inside source folder.

Please find below senario's.

In my parent theme

.header . content have max-width:1280px

In my theme.less file

.header .content have max-width:1100px


texts: I see Magento hasn't changed the default of the suffix in Magento 2 so my question is really why does Magento default to .html? I know you can change it but there must be a reason why its still a default. It just seems weird as modern websites don't have .html suffixes


texts:
After Migration from Magento 1.9.2.4 to Magento 2.3.4 when I go to create a customer and fill all the information and click on submit(on front-end), it shows me an error

We can't save the customer.

After debugging I found the error below:

Class Magento\Eav\Model\Attribute\Data\Datetime does not exist

I tried to search the class on the database and also in files, with no results.
However, I found something similar in the table eav_attribute:

Magento\Eav\Model\Entity\Attribute\Backend\Datetime

How can I solve it?


texts: Magento 2: FedEx shipping method throwing error on frontend

texts:
I have setup FedEx shipping method using test development credentials in Magento 2. I obtained these credentials by signing up for web services on fedex.com. After entering these details from the Magento 2 admin panel, still on the checkout page, an error message is displayed below the shipping method as -

"This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us."

Please see the error screenshot -

I am using Magento 2.01 version. What might be the problem?

Any help would be greatly appreciated as I am stuck on this since a couple of days :)


texts:
In Magento 2.3 I have installed the theme porto and it is successfully installed
I already tried and run the following commands:

  setup:upgrade
  static-content:deploy

Every thing is done and fine.

Theme is activated every page is working on porto theme but the homepage is using luma theme what could be the possible reasons let me know I will try it that is the weird thing I have ever seen in Magento 2 .

I need some suggestions thanks


texts: Can Virtual Types be used as controllers?

texts:
This is more of a curiosity than a "need".
I have a few controller actions that do exactly the same thing, just some parameters differ.
I'm trying to reduce the amount of code I write and have one single controller class and via di.xml configure that class using virtual types.
I know I can just create empty classes for each controller that extend a main controller action and configure them via di.xml, but I want to skip those too if possible.
I got from here that virtual types can be used as source models because they are instantiated via object manager.
Controllers are also instantiated via Object Manager, but I think things happen a little different.

I'm expecting an answer like:

this is not possible because...
yes, it's possible, here is how you can do it...
not sure it is possible but here is how you can test....


texts: Magento2 Update layout Using Observer on Product page

texts:
I want to Update XML using observer on Product Page when page load.
I want to set there condition with product Attribute there.
How can I do that?


texts:
I am overriding Magento\Catalog\Block\Product\ListProduct
In function _getProductCollection I have added some extra code.

public function _getProductCollection()
{
 $collection = parent::_getProductCollection();
 $collection->addAttributeToFilter('attribute', array('operator' =>
        'value'))
    return $collection
}

But my collection in not attaching this attribute. I am getting only default collection except adding operator attribute

Any idea ??


texts: Filter out Items in product collection with find in set

texts:
My product has an attribute conditions which contains nothing, one value or a set of values seperated by an comma

product examples:

Product A: condition = ''
Product B: condition = '1'
Product C: condition = '1,2,3'
Product D: condition = '2'

Example queries

If i want to get all products which contain value 1 in field conditions i can do something like this:

$productCollection = Mage::getModel('catalog/product')->getCollection()
  ->addAttributeToSelect('conditions')
  ->addAttributeToFilter('conditions', array('finset' => '1'));

This will return product B and C

If i want to get all products which contain value 1 or 2 in field conditions i can do something like this:

$productCollection = Mage::getModel('catalog/product')->getCollection()
  ->addAttributeToSelect('conditions')
  ->addAttributeToFilter('conditions', array(array('finset' => '1'), array('finset' => '2')));

This will return B, C, and D

Question:

How can i filter out a Product which contains value 3 to only get Product B and D the magento way?

This means how to add another filter which does:

show only products where find in set returns 0 for value 3 in field conditions


texts: Magento 2 Create Product Swatch Attribute via API

texts:
Is it possible to create a swatch attribute via the API endpoint? Swatch product attributes are seemingly created programatically by setting swatch_input_type data to the attribute, as demonstrated here:

https://magento.stackexchange.com/a/173528/61629

From debugging, it seems this flag is then used to save swatch configuration data to the additional_data field in the catalog_eav_attribute table:

{
  "swatch_input_type": "visual",
  "update_product_preview_image": "0",
  "use_product_image_for_swatch": "0"
}

However, there seems to be no relative POST options for swatch_input_type in the swagger documentation of the product attribute endpoint - and also no way to set swatch configuration JSON to additional_data field of the catalog_eav_attribute table:

https://devdocs.magento.com/swagger/#/catalogProductAttributeRepositoryV1/catalogProductAttributeRepositoryV1SavePost

I can deduce that this is because there are no relative methods in the product attribute interfaces to get/set this data:

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php

The closest I've been able to get to creating a swatch attribute via the API is by setting the following string to the frontend_input field in my request body:

"frontend_input": "swatch_visual"

This seems to create the attribute, but in a malformed state. Product swatch attributes should have a frontend_input type of "select". It seems Magento will actually reformat attributes with frontend_input type of "swatch_visual" but only when manually saved via the admin panel.


texts:
A new M1 version was released with the following General Fixes. Now there's 1.9.3.4 and all the issues that I needed to be fixed are already fixed in this update.

Restored missing strip_tags functionality in the checkout JavaScript.
Changed how Magento validates form keys during the generic five-step checkout process. Previously, customer registration failed during standard checkout processing if form key authentication was enabled.
Magento now displays the Allow_symlinks message in the Admin message area as expected.
Magento now preserves the background transparency of uploaded images as expected. In 1.9.3.3: there's a black background in all PNG images including favicons. Haha!
Multiple Addresses when checkout form validation is enabled is now fixed. Before, you cannot check out.

Any possible issues in 1.9.3.4 that wasn't fixed yet?


texts: Magento 2 Configuration add Enabled Or Disable extension option

texts:
I would like to add option in Configuration for module Enabled Yes/No.

I have tried below code but not working. Can you please suggest me any change on it or need to add any anther file.

<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
        <label>Enabled</label>
        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>


texts: Removing left and right Structural Block on one Page

texts: i'm trying to remove left and right blocks for one page, basically making it into 1 column page. But the page i'm making is not through the cms. Forex: it's from Company_Demo page with my own xml and phtml file (making a page through code). I've override the content block at my xml but i've got no idea to make the page into 1 column page.


texts: Magento2 : What is the default table used by Bestsellers in the admin?

texts:
In the database, I know that there are 3 aggregated bestseller tables

  sales_bestsellers_aggregated_daily,
  sales_bestsellers_aggregated_monthly,
  sales_bestsellers_aggregated_yearly

but which one of them is the
default?

See attached screencast image:https://monosnap.com/file/5N7Q0kR95cDKvjpAeD29MDEAdfxmn6


texts: CSV Import simple products with multiple custom options

texts:
So I have an import CSV (http://www.sharecsv.com/s/5565cf6cf17e0a2cfce2e9eaf50f8023/compiledBundle.csv). I have a few simple products that have a LOT of custom options. When importing some of the custom options will upload to the simple product and others won't. We will reset the database and do it again and this time DIFFERENT custom options will make it through. I can only think that the importer is having issues with how many options some of the simple products have.

Please refrain from giving me the "Have you tried Magmi" answer as it is not an option for multiple reasons that I will not go into here.


texts: Where to upload PHP files that query data tables in Magento

texts:
I have noticed that when exporting customer information through the admin panel it doesn't include all of the customers from the orders area.

I have been searching around for PHP code that does the job, although what I first need to understand is where I need to upload these PHP files for them to run successfully.

I am basically just wanting to export customer names and email addresses from the orders table so that I can import them into our email marketing application (and yes we do have permission to contact these people).

Do I need to upload PHP files to a specific folder in Magento for the queries to be able to access the data tables?


texts: Magento2 - More than 80 product cant able to import

texts:
I have total 1280 proudcts in my csv file in my csv only qty and sku column is there and I try with that in my live server at a time 80 products are imported successfully but more than 80 products is gives the 504 timeout error

Can anyone suggest me the solution?

I have set the all possible solution in php.ini file :

max_execution_time = 350000
max_input_time = -1
max_input_vars = 50000
memory_limit = -1
post_max_size = 4800M
upload_max_filesize = 3800M

If any one know the solution for this or any other setting from server side then please let me know.

Is there no any CDN server.direct hosting of project.


texts: Is it possible to get products in the shopping cart using Magento API?

texts:
I've already written custom payment gateway for example.
How can I get products properties in the shopping cart, when customer reaches payment details page (before he redirect to the bank page as final step of this procedure)? Is it possible to get products information with Magento API in simple "home-made" php application for further use?


texts: On product import/cron my tax class field in admin is not being updated

texts:
I have this method inside of:

parser/product.php

These fields are what i'm targeting in the admin panel. Everything updates properly, if a product gets imported with a different price matching the sku it updates. The only field that doesn't update is "Merch Tax Category Code which the field in the db is "tax_class_id". See screenshots of inspect element.

protected function _getFieldNames()
{
    return array(
        'Company Number' => 'company_number',
        'UPC Code' => 'sku',
        'Product Code' => 'style_number',
        'Description' => 'name',
        'Size' => 'size',
        'Price' => 'price',
        'Merch Tax Category Code' => 'tax_class_id'
    );
}

Inside of my Adapter folder it contains (Adapter/Product.php):

protected $_attributesToUpdate = array(
    'name'           => 1,
    'description'    => 1,
    'company_number' => 0,
    'style_number'   => 0,
    'color'          => 0,
    'size'           => 0,
    'inseam'         => 0,
    'price'          => 1,
    'weight'         => 1,
    'tax_class_id'   => 1
);

Not all the fields matter but price and tax is important. Price already works so now i'm just configuring tax_class_id. I believe it's set to default on Taxable goods based on this code below.

Also in Adapter/Product.php:

protected function _getTaxClassId($importData)
{
    return '2'; //Taxable goods
}

The only other field that would identify anything to do with tax is also in the same file.

//Set Tax Class
if (empty($importData['tax_class_id'])) {
    $importData['tax_class_id'] = $this->_getTaxClassId($importData);
}

return $importData;

I've tried so many options so I'm now reaching out to you guys. Any help would be appreciated. Thank you.


texts: EAV duplicate entry while migrating Magento 1.X to 2.X

texts:
I'm currently in the process of migration a Magento 1.7.0.1 project to Magento 2.2.2.

During Data migration I get this error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '21-152' for key 'EAV_ENTITY_ATTRIBUTE_ATTRIBUTE_SET_ID_ATTRIBUTE_ID'

My understanding is that there are 2+ duplicate entries 21-152 in the eav_entity_attribute table for columns attribute_set_id and attribute_id - so I thought to just delete the duplicate.

But there is no duplicate entry with that value in the source database...in fact, there is no such value in that table (in any column).

While in the destination database, this table is completely empty.

So I'm really not sure what the problem is or how to fix it...

Does anyone know what Duplicate entry 21-152 means exactly?

Or if someone could suggest an approach how to handle this issue?


texts:
I wanted to Override this
app\code\core\Mage\Catalog\Model\Product\Type\Price.php

First I created Module MyModule_Catalog.xml Under etc/modules

<config>
    <modules>
        <MyModule_Catalog>
            <active>true</active>
            <codePool>local</codePool>
        </MyModule_Catalog>
    </modules>
</config>

and under app/code/local/MyModule/Catalog/etc
my config.xml file

<config>
    <global>
        <models>
            <catalog>
                <rewrite>
                    <product_type_price>MyModule_Catalog_Model_Product_Type_Price</product_type_price>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>

and under app/code/local/MyModule/Catalog/Model/Product/Type/
my Price.php File

and I've tried overriding _applyOptionsPrice() function but it didn't work

Heres my Price.php:

<?php

class MyModule_Catalog_Model_Product_Type_Price extends Mage_Catalog_Model_Product_Type_Price
{

    protected function _applyOptionsPrice($product, $qty, $finalPrice)
    {
        Mage::log("Hello", null, 'optionsLog4.log');

        if ($optionIds = $product->getCustomOption('option_ids')) {
            $basePrice = $finalPrice;
            foreach (explode(',', $optionIds->getValue()) as $optionId) {
                if ($option = $product->getOptionById($optionId)) {
                    $confItemOption = $product->getCustomOption('option_'.$option->getId());

                    $group = $option->groupFactory($option->getType())
                        ->setOption($option)
                        ->setConfigurationItemOption($confItemOption);
                    $finalPrice += $group->getOptionPrice($confItemOption->getValue(), $basePrice);
                }
            }
        }

        return $finalPrice;
    }
}


texts:
I try to develope a js script but I always have to clear the cache and wait about a minute until the changed file is loaded. Even emptying the folder /var/cache does not help.

Is it possible to disable js/css cache?


texts: Mass password reset after Importing customers via CSV

texts:
I'm performing a large import of an existing customer base from a different platform.

I've exported their DB and written a script to make a CSV to import into Magento 1.9. Unfortunately, we do not have a password. Is there a way to have Magento generate one and send each customer, as we add them, an email to perform a reset? I couldn't find any links on a strategy here.


texts: What is different between SimpleDataObject and ExtensibleDataObject in magento 2

texts:
Magento has 2 classes

  \Magento\Framework\Api\ExtensibleDataObjectConverter

and

  \Magento\Framework\Api\SimpleDataObjectConverter

What are the differences and scenario for using them?


texts: Magento 2: Catalog price rule not expiring

texts:
I have created a Catalog price rule with 10% discount and expiry date. Even after the expiry date, I'm still seeing the discount value on the selected category. I tried below things

I ensured catalog price is expired.
I have set discount percent to 0.
I have cleared cache and re indexed twice

Note: I have even deleted the catalog price rule and re-indexed but still discount is showing.
Any suggestion would he helpful.


texts: Magento 2 : How to add URL rewrite to static HTML file

texts:
I have a static HTML content that is used as a promotional landing page for our website, so it doesn't need to have Magento headers, footers, etc. Just a static landing page.

I put the whole landing page folder mylandingpage/ into pub/ folder and can access it by going to www.mysite.com/mylandingpage/index.html

However i want to modify the URL to make it more SEO friendly, so i went to Marketing/SEO & Search/URL Rewrites and create a new custom URL Rewrite with 'Request Path' as 'newlanding' and 'Target Path' is 'mylandingpage/index.html'. But www.mysite.com/newlanding is throwing 404.

Am i missing anything else?


texts:
I am using this MageREST Framework in PHP for Magento 2.1.3 Installation.

But I am getting this error-

401 Unauthorized` response:
{"message":"You did not sign in correctly or your account is temporarily disabled."}


texts: Simplify Estimate Shipping Form in the Shopping Cart in Magento 1.8

texts:
On the Magento shopping cart, there is always a default form for estimating your shipping cost on the shopping cart page, and these fields are always required,

Country
State/Province
Poscode

How can I simplify this form by requiring Country input only?

This is the Estimate Shipping code form list,

                    <?php echo $this->__('Country') ?>*

                        <?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>

            <?php if($this->getStateActive()): ?>

                    <label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '*' ?><?php echo $this->__('State/Province') ?>

                        <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
                            <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
                        </select>

                       <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>"  title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />

            <?php endif; ?>
            <?php if($this->getCityActive()): ?>

                    <label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '*' ?><?php echo $this->__('City') ?>

                        <input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />

            <?php endif; ?>

                    <label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '*' ?><?php echo $this->__('Zip/Postal Code') ?>

                        <input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />

if I remove the fields of State/Province and Poscode manually, this form will not be working.

Any idea what I can do so there is only Country field is required?

But I need State/Province and Poscode to be required on my Checkout page though...


texts: How to link to product's admin Edit Page from within the admin Order View page?

texts:
When viewing an order, my employees would like to be able to click on the product's name or SKU, and for that to be a link to that product's Product Info edit page.

I figured out how to change the product name into a link, with that link being the url of the product page on Front End, but I don't want the link going to the front end, I need it to link to the products edit page in Admin Dashboard.

This is the code I used in:

app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

<?php $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getData('sku')); ?>
<a target="_blank" rel="external" href="<?php echo Mage::getUrl() . $_pullProduct->getData('url_path'); ?>"><?php echo $this->getColumnHtml($_item, 'name') ?>

...and this properly links me to the product frontend page. Now, as I said, that's not what I want, so how do I get this to be a link to the product's admin dashboard edit page?

I attempted at changing the above code in the same file to:

<?php $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getData('sku')); ?>
<a target="_blank" rel="external" href="<?php echo Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/catalog_product/edit', array('id' => $this->getProduct()->getId()))?>"><?php echo $this->getColumnHtml($_item, 'name') ?>

...however that's not right, and the Order View page breaks when I try this. I feel like I'm getting close, can any of you help me in the right direction, please?


texts: How to get product rating collection in magento 2

texts: I need to get product rating collection in block, and need to display it in template.Please provide me a solution


texts:
I would like to know the best way of getting the final price of a configurable option. I can get the price by looping around eg:

$productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
$basePrice = $product->getPrice();

foreach($productAttributeOptions as $productAttribute)
{
    foreach($productAttribute['values'] as $valuesKey => $valuesVal)
    {
        $combinedPrice = $valuesVal['pricing_value'] + $basePrice;
        $_priceIncludingTax = Mage::helper('tax')->getPrice($product, $combinedPrice, true, null, null, null, null, false);
    }
}

But is the the best way? So is there a magic function to call to get the final prices (inc tax) of each option?


texts: how can I create my “dirty playground” file for admin area in Magento 2

texts:
with the help of How can I bootstrap Magento 2 in a test.php script?

i created files its working fine, but when i try to access admin code it through error  "Area code is not Set"

<?php
require dirname(__FILE__) . '/../app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
require dirname(__FILE__) . '/abstract.php';

class Getapp extends AbstractApp
{

    public function run()
    {
        $this->_objectManager->get('Magento\Framework\Registry')
            ->register('isSecureArea', true);

        $datas = $this->_objectManager->create('Magento\ImportExport\Model\ResourceModel\History\Collection');

        foreach($datas as $data){
            print_r($data->getData()); //.'<br>';
        }

    }
}

/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Getapp');
$bootstrap->run($app);

how to access admin level code in magento2


texts:
How to get parameters value in string from post url in rest api in magento 2.
(I need username and password in my custom module).
http://.../Magento2/index.php/rest/V1/authorize?username=Arjun&password=2.
I am getting o as value and not string.


texts: Magento 1.9: Opinions about my real-time form validation check

texts:
I have created a "real-time" form validation check like so:

 var validstreet1 = function(){
 Validation.validate($('street_1'));
  };

$('street_1').on('focus',function() {

interval1 = setInterval(validstreet1, 1500);

});

$('street_1').on('blur',function() {
  clearInterval(interval1);
});

So basically, when the address field is in focus, the form validation gets updated every 1.5 seconds (as opposed to only when "save" button is clicked). this creates a really nice " real-time " effect.

I am wondering if this won't create too much stress on the system.


texts: Add same product for different-2 category in cart

texts:
I am new in Magento, Using version 2. I am adding a same product to many different-2 categories.
I need to track orders which product was added to cart from each of these categories or was it added outside of these categories.

how can i pass category id (as a hidden input ) in add to cart function.
and want to add product as new in cart if category is different.
something like that :-

If anyone have solutions appreciate that. Thank you.


texts:
I have two tmp tables that started generating long time queries.

(See attached)

I would like to truncate these. Is this possible?


texts: Upgrading 1.9.3 with latest stables - Internal server error 500

texts:
The upgrade went ahead with no errors however I now have internal server errors anywhere beyond home page including the admin area.
I have checked the server error log and it appears to be related to file.php (see below).  Just wondering if there is a quick fix.  I set all files to 644 and folders to 755 as suggested in another post.

Server error log one of the line entries which just repeats on different date/time stamps:

2017-01-29T17:13:41+00:00 DEBUG (7): is_readable() expects parameter 1 to be a valid path, string given/homepages/3/d541438922/htdocs/clickandbuilds/Magento/Dogcrafts_Retail_Shop/lib/Varien/Io/File.php
2017-01-29T17:13:58+00:00 DEBUG (7): is_readable() expects parameter 1 to be a valid path, string given/homepages/3/d541438922/htdocs/clickandbuilds/Magento/Dogcrafts_Retail_Shop/lib/Varien/Io/File.php
2017-01-29T17:14:16+00:00

and so on and on !


texts: New Tabs into product details and strings - Luma theme

texts:
How can I add new tabs in Luma theme to show more information about created attributes?

In the small description in the Italian view I leave the string "none", with code inspection the class is "type".

I tried to change the text of the product in the Italian view but it does not work.

Please help me.


texts: How do I manually add a permission for a Static Block to the Database?

texts:
My Static Blocks aren't displaying in my cms pages when I add them to the content tab with

  {{block type=”cms/block” block_id=”product_view_block_3”}}

BUT it's not showing. Apparently I have to add the Static Block I want to use however my Admin Interface isn't working because of a Theme I use that I have ALWAYS had issues with SO I can't get into permissions because it's just a blank screen

Responsive Admin Template by CMSMART if anyone is interested (It REALLY SUCKS)
We are just waiting to upgrade to Magento 2 so we can ditch the Admin Theme WITH EXTREME PREJUDICE ... but I digress

Anyway
I've found the permission list in the Database BUT I can't find the name of my static block - this would normally be added by the Magento Admin Interface
SO
How can I add it manually (My static block identifier is product_view_block_3)
I tried 'product_view_block_3/view' but nothing happened....have I got the 'block_name' wrong?

I also tried Mage_Core_Block_Template because it displayed this name with hints switched on but again nothing happened.


texts: Product export download is not working in magento 2.1.15

texts: I am using AWS server. I tried to export the product from the back-end. But while downloading it showing Failed- Server Unreachable in chrome browser. Is that related to owner permission issue? Because in inside the var folder that exported CSV is present but while downloading it's not working. If I hit direct URL with that CSV file means it's working fine. Please tell me any idea to fix this issue...


texts:
I've been asked to look at a store with version 1.7.0.0 reported in the footer of the admin. The store received a patch notification and I am attempting to apply the patch and get messages about missing files. Indeed, I check for files at:

/app/code/core/Mage/Oauth

Those files are not there. Suspicious, I checked the database for entries in core_resource and that the tables oauth_token, oauth_nonce, and oauth_consumer exist. They did not, suggesting that the Oauth module was never loaded with this install. Additionally, frontend and admin layout files oauth.xml do not exist.

Checking the release at https://github.com/OpenMage/magento-mirror/tree/magento-1.7 as well as the download from the official archive, this module should be included.

Does this essentially mean the store is running a Magento release that was prior to 1.7.0.0 despite the version reported in admin?


texts: Simple Product Thumbnail in minicart/checkout

texts:
In Sales => Checkout => Shopping Cart

I have set "Grouped Product Image" and "Configurable Product Image" to "Product Thumbnail Itself"

This works fine in the cart page.

But in the minicart and checkout its trying to display the simple item thumbnail instead of parent, is there a configuration I have missed?


texts: Large product collection and optimization

texts:
I wrote this piece of code. This method takes as an argument name and price of the item. Data are taken from the file line by line. There is 20k rows so this method is called 20k times. What is your suggestion to optimize this code? beacuse import takes about 2,5 hours.

protected function saveProductPrice($singleProduct) {

        $productCollection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToFilter('name', $singleProduct['PRODUCT_NUMBER'])
            ->getFirstItem();
        $websiteID = $this->determineStoreID((int)$singleProduct['ERP_PRICE_LIST_ID']);
        $productCollection->setWebsiteId($websiteID);
        $productCollection->setUrlKey(false);
        $productCollection->setStoreId($websiteID)
            ->setPrice($singleProduct['LIST_PRICE']);

        try {
            $productCollection->save($productCollection);
            echo $singleProduct['PRODUCT_NUMBER'] . " price updated and added to website " . $websiteID . "\n";
        } catch (Exception $ex) {
            Mage::logException($ex);
        }
        unset($productCollection);
    }


texts: How to switch product quantity's (non-managed stock) text from numerical value to text

texts:
The below code works well for products who's stock is being managed, but it displays "0" if "Manage Stock" is selected as "No" in the Magento backend. There's probably at least a few hundred products where the stock isn't currently managed, so going through them all isn't feasible. So, is it possible, when the product's stock isn't managed, to swap the "0" it places there with some sort of text like "call us about inventory"?

This is in app/design/frontend/{theme}/default/template/catalog/product/view/type/default.phtml :

<?php if ($_product->isAvailable()): ?>

   <?php echo $this->__('Qty Available:') ?> <?= (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?>

<?php else: ?>

   <?php echo $this->__('') ?> <?php echo $this->__('Out of stock') ?>

<?php endif; ?>

Some extra context: The "0" appears because Manage Stock is set to "No", Qty is set to "0", and the Stock Availability set to "In Stock". Even though the Manage Stock is set to "No", the code above still seems like it ignores that & grabs whatever is in the Qty field anyway.


texts: How do add custom option fixed price on cart for special country?

texts:
I have idea is create custom option fixed price is "customs document" for special country like image(attached) below. Anybody have idea help me do that?

Many thanks!