texts: Check whether customer is loggedin in Magento 2 model class

texts:
I have to write code in Magento 2 model class's method with a condition that

if (the customer is loggedin){
    //fetch customer detail
}else{
    // else do something else
}

I followed many posts from this site and other sites but nothing worked for me.

Method 1: Fetch details from your customer session in your model class method.

File: app/code/Your_Vendor/Your_Module/Model/Product.php

<?php
namespace Your_Vendor\Your_Module\Model;
use Your_Vendor\Your_Module\Api\ProductInterface;

class Product extends \Magento\Framework\Model\AbstractModel implements ProductInterface{
    public function __construct(
        ....
        \Magento\Customer\Model\Session $_customerSession
    ){
        ....
        $this->_customerSession = $_customerSession;
    }

    public function checkCustomer(){
        /*
        //The below did't work
        if ($this->_customerSession->isLoggedIn()) {
            $data = ' Customer is logged in ';
        } else {
            $data = ' Customer is not logged in';
        }
        */

        /*
        //Then I tried the below. But it also did't work.
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customerSession = $objectManager->get('Magento\Customer\Model\Session');
        if($customerSession->isLoggedIn()) {
            $data =  'Customer is logged in ';
            //$customerSession->getCustomer()->getName(); //Loggedin customer Name
            //$customerSession->getCustomer()->getEmail(); //Loggedin customer Email
            //print_r($customerSession->getCustomer()->getData());//Loggedin customer detail data
        } else {
            $data = 'Customer is not logged in';
        }
        */

        /*
        //Then I tried the below. But it also did't work.
        $om = \Magento\Framework\App\ObjectManager::getInstance();
        $context = $om->get('Magento\Framework\App\Http\Context');
        $this->_logger->info(json_encode($context));
        $isLoggedIn = $context->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
        if($isLoggedIn){
            $data = 'Yes Customer loggedin';
            //print_r($context->getData());
        }else{
            $data = 'No Customer loggedin';
        }
        */
    }
}
?>

But the above didn't work

Method 2: Wrote an observer for customer_login event. Now set logged in customer detail in your session.
Then in your model class, check your session whether has set or not.
If set then retrieve detail from the session and do your task if not then do something else.

<?php
namespace Your_Vendor\Your_Module\Observer;

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

class CustomerAfterLogin implements ObserverInterface {
    public function __construct(
        \Psr\Log\LoggerInterface $_logger,
    ){
        $this->_logger = $_logger;
    }

    public function execute(Observer $observer) {
        $customer = $observer->getCustomer();
        $res = $customer->getId();
        $this->_logger->info($res);$this->_logger->debug($res);// customer id is logged successfully.
        // Can anyone share the code to set logged in customer detail in the session here?
    }
}

// Code to fetch that session detail in the model?


texts: How to get order details in a Magento2 custom controller action?

texts:
I want to get the customer order details in a custom controller in Magento2.
I have created following directory structure and a basic controller.

I have also registered it by following command.

php bin/magento setup:upgrade

.

app
   code
       Muk
          Frontcontrollerpage
                            Block
                            Controller
                                    Index
                                        Index.php
                            etc
                            view
                            registration.php

I have following code in Index.php

<?php

namespace Muk\Frontcontrollerpage\Controller\Index;

class Index extends \Magento\Framework\App\Action\Action
{
    protected $resultPageFactory;
    /**
     * @param \Magento\Framework\App\Action\Context $context
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory
    )
    {
        parent::__construct($context);
        $this->resultPageFactory = $resultPageFactory;
    }

    public function execute()
    {
        return $this->resultPageFactory->create(); // How do I get customer order detail(total, items (sku, item_id, price)) using the order Id?
    }
}

How do I get customer order detail(total, items (sku, item_id, price)) using the order Id?


texts:
creating new quote on page reload when empty cart in magento2

I have add a item in cart.....after that remove that item from cart.Now I'm reloading cart page ,it creating a new quote for every page reload when empty cart.

How to fixed new quote creating issue when cart empty in magento2


texts: Magento 2 - Use Product Image for Swatch if Possible BUG!

texts:
I am new to magento2, I'm testing fresh copy of Magento 2.1.7.

I want to display Product image in place of color swatches on product detail page for Color Attribute. In the admin section, i choose (Use Product Image for Swatch if Possible) to YES.

But Product detail page still showing color swatches rather than Product image. If I run reindex and clean command in CLI Product image appear on the first load and disappear if I refresh the page again.

Website URL:

http://staffordtest.com.au/women/tops-women/jackets-women/neve-studio-dance-jacket.html

IS THIS MAGENTO BUG?


texts: Magento 2 programatically reindex using custom extention controller file

texts:
How to set the re-index process automatically in Magento 2 site.

We have one custom extension.
We want to set cone in controller files.
So when we run this controller URL; re-index function work.
Anyone helps me to set this functionality.

My code is here.

protected $_pageFactory;

public function __construct(
    \Magento\Framework\App\Action\Context $context,
     \Magento\Indexer\Model\IndexerFactory $indexerFactory,
        \Magento\Indexer\Model\Indexer\CollectionFactory $indexerCollectionFactory,
    \Magento\Framework\View\Result\PageFactory $pageFactory)
{
    $this->_pageFactory = $pageFactory;
    $this->_indexerFactory = $indexerFactory;
    $this->_indexerCollectionFactory = $indexerCollectionFactory;
    return parent::__construct($context);
}

public function execute()
{

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager
    $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
    $connection = $resource->getConnection();
    $tableName = $resource->getTableName('mp2_agtech_productstockupdate'); //gives table name with prefix
    $sql = "Select * FROM " . $tableName;
    $result = $connection->fetchAll($sql); // gives associated array, table fields as key in array.

    foreach($result as $updateresult){

        $agtech_productid = $updateresult['productstock_id'];
        $agtech_productqty =  $updateresult['productstock_qty'];
        $tableNameqty = $resource->getTableName('mp2_cataloginventory_stock_item'); //gives table name with prefix
        $sql = "Update " . $tableNameqty . " Set qty = ".$agtech_productqty." where product_id = ".$agtech_productid;
        echo "Quantity Update of  Product Id => ".$agtech_productid."<br/>";
        $connection->query($sql);

    }

}

$indexerCollection = $this->$indexerCollectionFactory->create();
$indexerFactory = $this->$objectManager->get('Magento\Indexer\Model\IndexerFactory');
$indexerIds = array(
    'design_config_grid',
        'customer_grid',
        'catalog_product_flat',
        'catalog_category_flat',
        'catalog_category_product',
        'catalog_product_category',
        'catalogrule_rule',
        'catalog_product_attribute',
        'cataloginventory_stock',
        'catalog_product_price',
        'catalogrule_product',
        'catalogsearch_fulltext'
);
foreach ($indexerIds as $indexerId) {
    echo " create index: ".$indexerId."\n";
    $indexer = $indexerFactory->create();
    $indexer->load($indexerId);
    $indexer->reindexAll();
}


texts: how to add banner slider in magento 2 without using any extention

texts:
I am new to magento 2 .

can any buddy help me out for this ,

how to add a banner slider in Magento 2 without using any extension.


texts: Magento 2.1 set group ID on a custom registration form

texts:
I have a custom phtml file that contains a copy of the customer registration form in my Magento 2.1 site.  Now in this form I have

<input type="hidden" name="group_id" id="group_id" value="3" />

I also created a file located in app/code/Magento/Customer/Model called CustomerExtractor.php and the contents of the file is below but now when I creat a test customer using the new registration for the user is not assigned to the group_id that is set in the form?

<?php
   /**
     *
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
      namespace Magento\Customer\Model;
      use Magento\Customer\Api\CustomerMetadataInterface;
      use Magento\Customer\Api\Data\CustomerInterface;
      use Magento\Customer\Api\GroupManagementInterface;
      use Magento\Framework\App\RequestInterface;
      class CustomerExtractor
      {
       /**
         * @var \Magento\Customer\Model\Metadata\FormFactory
         */
        protected $formFactory;
        /**
          * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory
          */
        protected $customerFactory;
       /**
         * @var \Magento\Store\Model\StoreManagerInterface
         */
        protected $storeManager;
        /**
          * @var GroupManagementInterface
          */
        protected $customerGroupManagement;
        /**
          * @var \Magento\Framework\Api\DataObjectHelper
          */
        protected $dataObjectHelper;
        /**
          * @param Metadata\FormFactory $formFactory
          * @param \Magento\Customer\Api\Data\CustomerInterfaceFactory
        $customerFactory
          * @param \Magento\Store\Model\StoreManagerInterface $storeManager
          * @param GroupManagementInterface $customerGroupManagement
          * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
        */
        public function __construct(
    \Magento\Customer\Model\Metadata\FormFactory $formFactory,
    \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    GroupManagementInterface $customerGroupManagement,
    \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
) {
    $this->formFactory = $formFactory;
    $this->customerFactory = $customerFactory;
    $this->storeManager = $storeManager;
    $this->customerGroupManagement = $customerGroupManagement;
    $this->dataObjectHelper = $dataObjectHelper;
}
/**
 * @param string $formCode
 * @param RequestInterface $request
 * @param array $attributeValues
 * @return CustomerInterface
 */
public function extract(
    $formCode,
    RequestInterface $request,
    array $attributeValues = []
) {
    $customerForm = $this->formFactory->create(
        CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
        $formCode,
        $attributeValues
    );
    $customerData = $customerForm->extractData($request);
    $customerData = $customerForm->compactData($customerData);
    $allowedAttributes = $customerForm->getAllowedAttributes();
    $isGroupIdAllow = isset($allowedAttributes['group_id']);
    $customerDataObject = $this->customerFactory->create();
    $this->dataObjectHelper->populateWithArray(
        $customerDataObject,
        $customerData,
        \Magento\Customer\Api\Data\CustomerInterface::class
    );
    $store = $this->storeManager->getStore();
    if (!$isGroupIdAllow || ($isGroupIdAllow &&(is_null($customerDataObject->getGroupId()))) ) {
        $customerDataObject->setGroupId(
            $this->customerGroupManagement->getDefaultGroup($store->getId())->getId()
        );
    }
    $customerDataObject->setWebsiteId($store->getWebsiteId());
    $customerDataObject->setStoreId($store->getId());
    return $customerDataObject;
}

}


texts: Display sales_flat_order custom columns front end

texts:
Trying to display a custom column from sales_flat_order in client´s panel order history.
I already created two columns in sales_flat_order with tracking no. and carrier, but I intend to show them in order history. So the clients could easily  track their orders by clicking on the tracking no..

My early appreciations for any kind of help. Honestly I got stuck.
Thank you.


texts: Try to install magento migration tool fails

texts:
When i try to install the migration tool from magento i get errors. ( see image )

Hope some one can help me out.

Now i have it installed and frond end and backend gives error :

There has been an error processing your request

Exception printing is disabled by default for security reasons.

If i check the log i see this.

I have used bin/magento setup:upgrade and php bin/magento cache:clean
php bin/magento indexer:reindex
php bin/magento setup:static-content:deploy

Nothing helped.


texts: Magento 2 integration with vue-storefront : When Installing the vue-storefront-api locally, it throws error for npm on Ubuntu

texts:
To install vue-storefront, i have followed the steps as per documentation guide
https://docs.vuestorefront.io/guide/installation/linux-mac.html#requirements, but while installing vue-storefront-api backend locally, it throws error as shown in image

  I have checked install.log file and you can also check this log.

Cloning into '../vue-storefront-api'...
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1569392153518-0.7983839484530655/node but npm is using /home/user/.nvm/v12.10.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> sharp@0.21.3 install /home/user/roc/pwa-project/vue-storefront-api/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /home/user/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.10.0 runtime=node arch=x64 libc= platform=linux)
make: Entering directory '/home/user/roc/pwa-project/vue-storefront-api/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:27:0:
../src/common.h:78:16: error: ‘Handle’ is not a member of ‘v8’
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);


texts:
I want to show price exclude and include in custom product slider in Magento home page. For this, I have tried almost all things but could not success below is my approach

In XML part I have added code:

<block type="catalog/product_view" name="product.tierprices" template="productslider/best-seller.phtml">
    <action method="setTierPriceTemplate">
        <template>catalog/product/view/tierprices.phtml</template>
    </action>
</block>

And in code I have echo:

$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->sku);
$price = $_product->getPrice();
$prices = $this->getTierPrices($_product);

or:

$this->getPriceHtml($_product, true);

But it doesn't show right price ex.vat and incl.vat

Please help me


texts:
So I am using Paypal Standard as my payment method for Mage ver 1.8. For now the method is in Sandbox Mode.

The issue is when I click on place order from Checkout page, it redirects me to Paypal Payment page. Now when I click on Cancel and return to Merchant's store, it redirects me to the store but my cart is empty and the order is placed in admin with the status Canceled.

Is this the default behavior for Paypal Standard Payment Method or is there any issue ?

Please Help.

Thanks!!!


texts:
Thinking about setting up Cloudflare for a Magento instance but not quite too sure how to handle caching with dynamic content. As every page has a basket total I cant see how page caching can be used.

Therefore the only real benefits of Cloudflare with Magento would be the added security and the CDN for the assets. However if the customer base is in the same country and the hosting solution the CDN for assets might not be that beneficial.

Am I missing something or is that correct?


texts: Bundle Product (Bundle Items option is missing in Admin )

texts:
I been using Magento 2.1.9 i usually use simple product mostly. today I wanted to bundle a product - I just noticed that Bundle Items option is missing from the list. so I logged into a generic Magento 2 demo store and I see when I select Bundle Product (bundle Items Tab is there). can some one please help get that to work please on my store

here is what I see when I choose Bundle Product in my magento 2.1.9


texts: Magento 2.1.4 Fails Readiness Check due to Cron - gitignore not writable

texts:
I have a Magento 2.1.4 community site that is failing the readiness check to be able to install an extension via Magento Marketplace.

Normally we install extensions by downloading the zip file and installing via FTP or SSH and doing everything from the command line.  But we want to make sure that it's easy for a client to install something via the Magento Marketplace.

I was able to get to this step in the readiness check, but it's saying that the Cron script is not installed / not ready.  Here's a screenshot:

The error is a non-writable path to the .gitignore file (although the file exists and it is writable).

I saw a write up on GitHub about making a core modification to the setup script.  However, I'd rather solve the issue if possible.


texts: Magento 2 UPS API estimated delivery date

texts: How can I add estimate delivery date for UPS shipping method. I searching over google but not luck and I try to following link for magento 1 UPS estimate delivery date but not work. I also check ups inTransit api but not convert in magento 2 any one know how can I achieve this.


texts:
I have a custom quantity which I insert into the sales_flat_quote table with this code:

    $quote = Mage::getSingleton('checkout/session')->getQuote();
    $item = $quote->getItemById($itemID);
    $item->setQty((double) $qty);

The above code works fine but it affects my custom price which sets back to the magento price after I save.

I currently have my code placed in the view shopping cart page which may be what is causing the problem. Where can I place my code so that the qty updates at the onestepcheckout page instead?


texts: php startup: intl: unable to initialize module

texts:
Actual problem - Magento - No images (might be css too)
I checked for image paths. The "adminhtml" directory inside pub/static is empty.
I tried reinstallation of magento, xampp and all. But nothing is working.

To get the adminhtml folder contents, i am using following method.

I was trying to run "php bin/magento dev:source-theme:deploy" command through command prompt. But i got this error.

Current System :-
PHP 5.6.15,
magento 2.x,
windows 8

Please give me the solution. Any help would be appreciated.
Thanks.


texts: How to create simple module in magento 2

texts:
I'm new to magento2.

I want to create simple Hello World module in magento 2.

How to create this module?


texts: How can I import the images of the configurable product in simple product?

texts:
I need to send my products for Amazon but I created simple products through configurable products. So simple products are no images.
How can I assign the images of configurable products to simple products to send them the Amazon?


texts:
For instance we have 3 products in the cart. Two of them are on sale, the last one is not. The rule is: apply 10% discount on not discounted products only if the the subtotal amount of NOT discounted products exceeds $50.

So if we have 3 products, where two of them are already discounted, we don't care about them. Since, we have the only one not discounted product, then we check if it's price is not less that $50 and only then apply 10% to this product.

If we had 4 products, two of which are not discounted, (assume their prices are $20, $35, respectively), then we check if $20 + 35$ is greater than $50 and apply $2 and $3.5 discount to them.

The bit I struggle is how to get this subtotal of not discounted products?


texts: After Create Luma Child Theme The Customer Login Register Not Working Also No Any Error Display in Magento 2.3.5

texts:
I Created Luma Chield Theam In That I over ride the Only Magent_Theme
in that customer login register not working

And Also Add To Cart Throw Me 404 like That


texts:
In the CHECKOUT page, there are 2 options

checkout as guest    2. Register

When a new user registers

After clicking the continue button the page is redirected to the page shown below

and from here when we click "proceed to checkout" the page again is redirected to the checkout page (shown in the 1st screenshot) from where the user can login.

But after adding required data in the email and password fields when login button is pressed it tells its invalid.

Can anyone help me to resolve this issue related to LOGIN !!


texts: How to properly use Model Collection in Magento 2

texts:
I'm using Magento 2.3.4 , and i kinda confuse with how to use Magento 2 model correctly or follow the code standard. I have a model collection with database structure like this:

brand_id | name | type | manufacturer | priority | created_at | updated_at

I'm using Mage2gen.com to generate model, and got the following files:
https://mage2gen.com/load/33e2b596-8220-4434-b852-b55c2c95293a?main_version=3

when i want to add new or get record i do it like this:

public function __construct(
  \Vendor\Module\Model\BrandFactory $brandFactory,
){
  $brandFactory = $this->brandFactory;
}

//add new record to the table
function addNewBrand($data){
  $this->brandFactory->create()->setData($data)->save();
}

//update new record to the table
function updateBrand($data){
  $this->brandFactory->create()->load($data['id'])->setData($data)->save();
}

//get data by name
function getBrandByName($name){
  return $this->brandFactory->create()->getCollection()->addFieldToFilter('name',$name)->getFirstItem();
}

//update data by name
function updateBrandByName($data){
  $model = $this->getBrandByName($data['name']);
  if(!$model->getId()) $model = $this->brandFactory->create();
  $model->setData($data)->save();
}

function getBrands(){
  return $this->brandFactory->create()->getCollection();
}

i always use the model factory to crud the data , but i just read in the documentation that this model is depecrated , what is the Correct way for me to do above functionality ?


texts: Magento 2: Change links html class in customer account navigation

texts:
I'm trying to change the html classes for my customer_account_navigation block.
What I actually want to achieve is to display different icons for every single link.

I tried the following in the customer_account.xml but without success:

<referenceBlock name="customer-account-navigation-account-link">
    <arguments>
        <argument name="css_class" xsi:type="string">test</argument>
    </arguments>
</referenceBlock>

Any hints?


texts:
I have tried to load js asynchronously in Magento 2 following a recommendation from the Google PageSpeed Insights tool. Unfortunately my updates in the relevant layout file break the page.

CURRENT LAYOUT XML

<head>
 <script async src="js::myown.js"/>
 <script async src="js::another.js"/>
 <script async src="js::afinal.js"/>
</head>

Can someone please recommend a solution to the above to get the async loading working?


texts: Transactional Emails Logo showing wrong URL https:/=/ but i want URL https://

texts:
Current URL

But I want

Mean I want URL https:// instead of https:/=/ in Transactional Emails when customer received order email.


texts: M2: What's the difference between the view/frontend/email and the view/frontend/templates/email directory?

texts: I get frequently confused with those directories. Yesterday, I copied an email template file in the wrong one of the two folders, - and a colleague was quite upset. How can I avoid making such mistakes, and which files go into the frontend/email vs. the frontend/templates/email directory?


texts: Sort(Rearrange) your customer my account navigation link

texts:
I was struggling to sorting the customer account navigation link out of the box.But was unable to find out proper solution to rearrange this navigation.

So i google and get some idea to make it possible.

I got some idea from the suggestion of @marius from this Link


texts: Apply customize patch to magento/framework

texts:
Have installed "cweagans/composer-patches": "^1.7",
and
"extra": {
        "magento-force": "override",
        "composer-exit-on-patch-failure": true,
        "patches": {
            "magento/module-framework": {
                "Render refresh meta": "m2-hotfixes/render_refresh_meta.patch"
            },
            "magento/module-customer": {
                "Render refresh Customer": "m2-hotfixes/my_test_patch.patch"
            }
        }
    }

when run composer install, only patch for customer applied. How to apply patch for framework?
diff --git a/vendor/magento/framework/View/Page/Config/Renderer.php b/vendor/magento/framework/View/Page/Config/Renderer.php
index bc4fe6718..b2613d916 100644
--- a/vendor/magento/framework/View/Page/Config/Renderer.php
+++ b/vendor/magento/framework/View/Page/Config/Renderer.php
@@ -9,6 +9,7 @@
 use Magento\Framework\Exception\LocalizedException;
 use Magento\Framework\View\Asset\GroupedCollection;
 use Magento\Framework\View\Page\Config;
+use Magento\Store\Model\StoreManagerInterface;

here is file for render_refresh_meta.patch


texts:
We are experiencing problem with DHL module for magento. When we set up the merchant address in Bulgaria we receive zero shipping charges for different shipping addresses in EU and international as well. When ew change the merchat address to a different country, for example Paris, France or Italy we get charges. Are shipping addresses from Bulgaria supported by DHL system or there is ? We have used the test service with or without entering the account number and setting up different configuration options. None worked.

This is the request: http://pastebin.com/0bNECcWZ


texts: The catalog inventory stock item unique hase changed

texts:
I am working on a new Magento 2.1.4 projet. We have a single store. And we need to manage the inventory for a large amount of shops belonging to this store.

I was thinking about using the cataloginventory_stock tables. We did it on a Magento 1.x version. But since Magento 2, the unique index of the cataloginventory_stock_item table has changed. It is now on the product_id and website_id. Which allow only one line of stock per product and website.
In version 1.x the unique index was on product_id and stock_id which would be more suitable.

Is this a bug that the stock_id disapeared from the cataloginventory_stock_item? Or is it something planned?

Thanks for your help


texts: Magento config xml multiple layout updates

texts:
Can I define more than one layout update file in my config.xml for the adminhtml?

I want something like this:

<adminhtml>
    <layout>
        <updates>
            <blog_admin>
                <file>flinders_blog.xml</file>
            </blog_admin>
            <another_module>
                <file>another_module.xml</file>
            </another_module>
        </updates>
    </layout>
</adminhtml>

But this is not working. How can I achieve this?


texts: Hide company field on checkout step based on customer group in Magento 2.3?

texts:
I am working on checkout step for hiding the company field on the basis of customer group.
can anyone help me to solve this ?
Thanks


texts: Magento 2 - Show catalog product image changes on mouse over

texts: I would like to show product image changes on mouse over. I mean to call a second image during mouse over in magento2.


texts:
While accessing the search url (http://localhost/mage2/catalogsearch/result/ or http://localhost/mage2/catalogsearch/result/index) infinite loop. Is it possible  redirect to home page?
Thanks.


texts: Magento 2 grunt watch is not pre-processing LESS for main locale

texts:
My core_config_data table has general/locale/code set to en_IE. When I run grunt exec:<theme-name> and then grunt less:<theme-name>, CSS is generated in two separate locale folders, en_GB and en_IE. Both have the correct output CSS.

However, when I run grunt watch and then change a LESS file, the change is registered and the page refreshes, but the change doesn't take effect in the browser. I can see that this is because the CSS is only updated in one locale (en_GB) and not the other (primary, en_IE).

Is there a way to tell grunt watch to refresh CSS for all locales at the same time?


texts: Getting an error: Fatal error: Call to a member function getCollection() on a non-object in template/checkout/cart/item/default.phtml on line 32

texts:
I'm getting an error on the checkout cart page

  Fatal error: Call to a member function getCollection() on a non-object
  in template/checkout/cart/item/default.phtml on line 32

When I check the line in question its the following

$collection = Mage::getModel('file/file')->getCollection();

The whole chunk of code is

<?php
$_item = $this->getItem();
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
$cart = Mage::getModel('checkout/cart')->getQuote();
$collection = Mage::getModel('file/file')->getCollection();
  $resource = Mage::getSingleton('core/resource');
  $readConnection = $resource->getConnection('core_read');
  $sql = "select * from quote_file where quote_id = '{$cart->getId()}' and item_id = '{$_item->getProduct()->getId()}'";
  $fileData = $readConnection->fetchRow($sql);
?>

How can I fix this?


texts: Magento 2 Argument 1 passed getProductFromLocalCache() must be of the type string, null given, called

texts:
After migration Magento 1 to 2.3.4, I have facing an error on some product edit.

  Argument 1 passed to
  Magento\Catalog\Model\ProductRepository::getProductFromLocalCache()
  must be of the type string, null given, called in
  /srv/public_html/vendor/magento/module-catalog/Model/ProductRepository.php
  on line 270

Can you please help me to resolve this error ?

Thank you


texts: Static files seems to be present but returns 404

texts:
I have just installed Magento to my webserver and deployed static files. However, when I access the site it is shown without any styling, and I get a lot of 404 errors for the static files:

/pub/static/frontend/Magento/luma/da_DK/mage/calendar.css Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/requirejs/require.js Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/css/styles-m.css Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/mage/requirejs/mixins.js Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/css/styles-l.css Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/_requirejs/frontend/Magento/luma/da_DK/requirejs-config.js Failed to load resource: the server responded with a status of 404 (Not Found)
styles-m.css:24 Uncaught ReferenceError: require is not defined
styles-m.css:26 Uncaught ReferenceError: require is not defined
/pub/static/frontend/Magento/luma/da_DK/images/logo.svg Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/css/print.css Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/mage/requirejs/mixins.js Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/_requirejs/frontend/Magento/luma/da_DK/requirejs-config.js Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/requirejs/require.js Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/css/print.css Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/mage/calendar.css Failed to load resource: the server responded with a status of 404 (Not Found)
/pub/static/frontend/Magento/luma/da_DK/css/styles-l.css Failed to load resource: the server responded with a status of 404 (Not Found)

When accessing the FTP I have verified that most of the files are there, however some of them are looking a little weird:

Apache rewrites are turned on, and the presence of the following line in .htacess should be enoug to enable it, I belive? (CentOS/WHM)

RewriteEngine on

Any suggestions to what might be going on?


texts: Custom option templates (radio, checkbox, etc) for a single product)

texts:
I've got a Magento site full of Bundle Products, and I'm now looking to add one single product which pulls a different view.phtml, and then a different radio.phtml, checkbox.phtml, etc. So far I've added the following to the 'Custom Layout Update' section on my new product:

<reference name="product.info">
     <action method="setTemplate">
         <template>catalog/product/customview.phtml</template>
     </action>
 </reference>

And it's loading customview.phtml instead of view.phtml, but this still loads the standard radio.phtml, checkbox.phtml files. I'm not sure how to direct options.phtml to different radio and checkbox files. I did consider creating a different theme with these files, but the problem arises with the mobile version of the site. Normally when viewing on a mobile, packagename/mobile loads, and then it falls back to packagename/default. So if I create a new theme 'customtheme' and apply it as the 'Custom Design' on the new product, then this product won't have a mobile layout.

Does anyone know how to tell options.phtml to find a custom radio.phtml, checkbox.phtml etc (possibly with a custom options.phtml file?) and keep everything within the default theme?


texts: Magento : How to hide or remove "add to cart" button in Grouped products

texts:
I Created grouped product . I alter the position of Grouped product. So how i can  remove

"ADD TO CART" button  in magento?

In which folder, which code i have to delete?


texts: Using Factory get product collection with product name in Magento 2

texts:
I get product collection using \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory in block( dependency injection), the result doesn't have name attribute,

The similar Q&A(ObjectManager) here  Product collection has no name attribute how can I get it magento2? doesn't work.

The detail codes is below, my question is "how to add name attribute in the block collection"?

Detail codes

In block:

<?php
namespace Vendor\HelloWorld\Block;
class HelloWorld extends \Magento\Framework\View\Element\Template
{
    protected $_productCollectionFactory;

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

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

In template (.phtml) file:

<?php
$productCollection = $block->getProductCollection();
echo "<pre>";
print_r($productCollection);
echo "</pre>";

Result:

Array
(
    [0] => Array
        (
            [entity_id] => 1
            [attribute_set_id] => 15
            [type_id] => simple
            [sku] => 24-MB01
            [has_options] => 0
            [required_options] => 0
            [created_at] => 2017-08-14 07:07:01
            [updated_at] => 2017-08-14 07:07:01
        )

    ...

)


texts:
I am not sure if this question can be asked here. Though i am am asking after doing some research on google.

Basically i want a search like Ebay, Amazon or Flipkart. Which should be faster and easy to maintain(Might be if possible).

I have around 10000k products on the store. And using sphinx search at this moment. But its not very good in terms of speed or maintenance.

I need to reindex for around 8-10 hours after adding products on the store and search is also not fast.

Can you guys please suggest how i can get a better search which will be lightening fast for products, categories etc and easy to maintain.

Again this question should not belong here may be but i think as my site is based on Magento then you guys are the best ones to ask.

Any suggestion will be appreciated.


texts:
Does magento offer any way to sell products by weight/length such as in the case of selling Apple,Meat...etc. I have to sell them by weight. I have 1000kg of apples in my stock. Customers should be able to order any weight from my store (1.5 kg, .5 Kg, 3kg ...etc), price will be calculated as per weight. Suppose a customer buys 3.5 kg of apples the stock after selling should be 996.5 kg.

Can the same can be done with length also ?


texts: which one is the main category of product

texts:
I need to take the main category . i try the following code

$product = $objectManager->create('Magento\Catalog\Model\Product')->load($itemid);
$cats = $product->getCategoryIds();
print_r($cats) // It returns  more than 1 category id
foreach ($cats as $category_id)
{
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    echo "
categoryid". $category_id;
    $collection = $this->_categoryFactory->create()->load($category_id);
    echo "
 Category Name ". $collection->getName();
    echo "
 Parent category name" . $collection->getParentCategory()->getName();

}

I have a doubt which one is the main category of the product ... I am not have much knowledge in ecommerce. I am struggle which one i need to choose.


texts: Difference between Configurable vs Grouped Product?

texts: What is the difference between configurable and grouped product, it has similar functionality have child and associated products, but i want to know the core difference.


texts: How to add a custom field depends on back order option in product edit page(under advance inventory) in magento 2 admin


texts: Magento 2.3.0 How to get product image from order item collection

texts:
I would like to get a product image from order items collection. How can I get a product thumbnail image?

Below is my custom order item collection code :

public function getEmailLogOrders() {
   $logCollection =  $this->customColectionFactory->create()->getCollection();
   $logCollection->addFieldToFilter('mail_status',array('eq' => 1));

   foreach($logCollection as $logItem){
        /*** Order Increment id's ***/
        $orderID = $logItem->getOrderNumber();
        /*** Load order items by Increment ID's ***/
        $orders = $this->order->loadByIncrementId($orderID);
        $items = $orders->getAllItems();
        $itemQty = array();
        /*** loop for get all order items ***/
        foreach ($items as $oItem) {
           $itemQty[]=array(
               'quantity'=>$oItem->getQtyOrdered(),
               'name'=>$oItem->getName()
            );
        }
    } //echo '<pre>';print_r($itemQty);die;
    return $itemQty;
}

Using the above code I am able to get Product Name & Qty. But I just want to know how can I get a product image within this collection.

Above collection, OutPut is like below.

Array
(
[0] => Array
    (
        [quantity] => 1.0000
        [name] => Push It Messenger Bag
        //Image parameter will be here
    )

[1] => Array
    (
        [quantity] => 1.0000
        [name] => Driven Backpack
        //Image parameter will be here
    )

)

Any help would be appreciated!


texts: Issue with email variables in custom template

texts:
I created custom email template with notification buyer about new order:
working:
{{trans "%vendor_name" vendor_name=$vendor.name }}

no working:
({{trans 'Placed on %created_at' created_at=$order.getCreatedAtFormatted(2) |raw}})

working:
{{trans "%increment_id," increment_id=$order.increment_id }}

I also created a custom attribute in the store. When I try to view it, it also doesn't work
{{trans "%public_name" public_name=$public.name }}

Can anyone give a hint who is wrong?


texts: How to add custom inline javascript to Magento head?

texts:
I want to add this javascript to the head of all Product Pages in Magento 2. Problem is, I'm not sure where to begin with that. I know, there's built in Google Analytics settings in Magento 2, however, this is some highly custom tracking it seems.
I know on other platforms this would be a piece of cake. Slap the JS into the head and call it a day. But this IS Magento we're talking about...
<!--
Event snippet for All Pages_Standard on https://www.tests.com/: Please do not remove.
Place this snippet on pages with events you’re tracking.
Creation date: 09/13/2019
-->
<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'u1': '[Page URL]',
    'u6': '[Product ID]',
    'u7': '[Product Name]',
    'send_to': 'DC-957'
  });
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=957;type=test;cat=test;u1=[Page URL];u6=[Product ID];u7=[Product Name];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=1?" width="1" height="1" alt=""/>
</noscript>
<!-- End of event snippet: Please do not remove -->


texts: HTML title tag empty for categories and products with custom theme

texts:
I'm having a strange problem where the <title> element has no content for category or product pages.

Other pages work as expected.

On product pages the social graph tags (eg, og:title) do contain the correct values.

Where this gets confusing for me is the <title> element has a value if I use the Blank or Luma themes - it is only empty in my custom theme.

If I fill in SEO attribute values for a product that will show up for the <title> element for my theme, but that's not practical as there are over 8000 products to update. It works for the pre-provided themes anyway, so I feel like there is something else going on...

Has anyone else seen anything like this before?


texts: Magento 2 Customer Scope Global and shipping countries

texts: I have a Magento 2.3 website that has many websites created, and I want to set the Customer Scope to Global so they can log into all websites with one login. But I still want to limit the shiping counties to each country. Is this possible? it seems like when I change customer scop til Global, then all countries are available from the dropdown list on the checkout page.


texts: How to get base URL in my custom Java script  file i have to call my controller its working for static URL i want to get dynamic base URL how to get it in Java script file


texts:
My vue-storefront is installed succefully. then I have changed hostname from local.json in vue-storeofront & vue-storeofront-api folder, but frontned is not open:https://prnt.sc/syzkfw

I have run the command :
1. yarn run build
2. yarn install
3. yarn start
But there is error in last step yarn start:https://prnt.sc/syzltv

Anyone know about this issue..?


texts: Magento 2.3.0: Create product attribute (yes/no) using db_schema.xml

texts: How can we create new product custom attribute of type boolean(yes/no) using db_schema.xml(of custom extension) as InstallData or InstallSchema file is not being used in Magento 2.3.0 ?


texts: How to add a static block above top link area in Magento 1.9

texts: I want to add a CMS static block above top links section.


texts:
Is there any magento plugin that has the features below:

force the user changed password in every 90 days.
change password must required min 8 char


texts: Get all product images on product view page separately

texts:
I want to change the design  product image section on view page.

Trying to fetch all three Images seprately.

 $ImageAll = $_product->getMediaGalleryImages();
        $mainImg = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(163, 10);
        $thumbNailImg = Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(400, 400);
        $smallImg = Mage::helper('catalog/image')->init($_product, 'image')->resize(60,60);

One more thing if we change the position of above variable then the last variable is only used

But it gives me the same image in all the three images tags.

<img src="<?php echo $mainImg; ?>" alt="<?php echo $_product->getName()?>" />
<img src="<?php echo $thumbNailImg; ?>" alt="<?php echo $_product->getName()?>" />
<img src="<?php echo $smallImg; ?>" alt="<?php echo $_product->getName()?>" />

BUt if i use this way all works perfectly

<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'image')->resize(100,160); ?>" alt="<?php echo $_product->getName()?>" />

 <img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(200, 200); ?>" alt="<?php echo $_product->getName()?>" />
 <img src="<?php echo Mage::helper('catalog/image')->init($_product, 'thumbnail')->resize(400, 400); ?>" alt="<?php echo $_product->getName()?>" />

Can anyone help me to understand the difference between them?


texts: How to get category ids from product collection

texts:
I have an array of product ids now i want to get all categories where these products belongs in magento2.

For example

we have categories cat_1, cat_2 ,cat_3, cat_4, cat_5, cat_6, cat_7

  product_id_1 exist in cat_1, cat_2

  product_id_2 exist in cat_3, cat_4

  product_id_3 exist in cat_1, cat_5

Now i want a collection of category having categories cat1, cat_2, cat_3, and cat_5


texts:
I need to get cart id using the following api
http://localhost/rest/V1/carts/mine
but when I run that api using the following code

   $headers = array("Content-Type: application/json",
       'Authorization: Bearer token'
   );
   curl_setopt($ch, CURLOPT_URL, $url.'/rest/V1/carts/mine');
   //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

I get the following error

 [message] => %fieldName is a required field.
[parameters] => stdClass Object
    (
        [fieldName] => customerId
    )

although I know that that request sent with empty body


texts: Disconnect & Reconnect MySQL core_read / core_write Connections

texts:
We have a process that runs within our Magento installation that:

Bootstraps Magento
Performs some actions which involve writing to a
table in mysql
Connects to a remote API, which takes a long time to
respond (20mins +)
Attempts to write more information to a table in
mysql

The problem is, that due to the long time taken for the remote API to respond, the MySQL server has sometimes 'Gone Away' by the time we attempt to perform step 4. The simplest solution to this is to simply increase the wait_timeout for MySQL, but this feels like a hacky solution.

Is there a way from within Magento to close then reopen the database connection? Or even just force a reconnect after step 3? I tried to dig into it, but the actual instantiation of the connection seems (as with many things in Magento) deeply buried. I'm therefore unsure exactly how I might force a reconnect.


texts: Permit manual sales emails when automatic are disabled

texts:
I'm trying to figure out how to send out emails from the order view when the automatic emails are disabled through the configuration.
When pushing the send email buttons for the Invoice it confirms that an email is being sent, but nothing happens.
Is there a possibility to send the mails manually when the automatic sales emails are disabled.
When I enable them, all emails are sent, so there is no issue with mails in general.

Anyone an idea?


texts: Magento 1.9 - How to rewrite magento cms page to custom url with query parameter

texts:
I want to rewrite CMS page url to custom url.
For eg. CMS page url is "/result/?q=test" and rewrite url should be "/demo/test"
For this I'm trying to below htaccess rule
RewriteRule ^demo/?$ /result/?q=$1 [QSA,L]

Url "/result/?q=test" is working, but the url "/demo/test" is showing 404 not found.
What rule should I use this?


texts: Programmatically create a category in Magento 2

texts:
I am not able to create a category using below code, Also I can't get website id, Anyone knows explain me

use \Magento\Framework\App\Bootstrap;

include('../app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$url = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $url->get('\Magento\Store\Model\StoreManagerInterface');
$mediaurl= $storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
$state = $objectManager->get('\Magento\Framework\App\State');
$state->setAreaCode('frontend');
/// Get Website ID
$websiteId = $storeManager->getWebsite()->getWebsiteId();
echo 'websiteId: '.$websiteId." ";

/// Get Store ID
$store = $storeManager->getStore();
$storeId = $store->getStoreId();
echo 'storeId: '.$storeId." ";

/// Get Root Category ID
$rootNodeId = $store->getRootCategoryId();
echo 'rootNodeId: '.$rootNodeId." ";
/// Get Root Category
$rootCat = $objectManager->get('Magento\Catalog\Model\Category');
$cat_info = $rootCat->load($rootNodeId);

$categorys=array('Levis','Wranglers','Basics'); // Category Names
foreach($categorys as $cat)
{
    $name=ucfirst($cat);
    $url=strtolower($cat);
    $cleanurl = trim(preg_replace('/ +/', '', preg_replace('/[^A-Za-z0-9 ]/', '', urldecode(html_entity_decode(strip_tags($url))))));
    $categoryFactory=$objectManager->get('\Magento\Catalog\Model\CategoryFactory');
    /// Add a new sub category under root category
    $categoryTmp = $categoryFactory->create();
    $categoryTmp->setName($name);
    $categoryTmp->setIsActive(true);
    $categoryTmp->setUrlKey($cleanurl);
    $categoryTmp->setData('description', 'description');
    $categoryTmp->setParentId($rootCat->getId());
    $mediaAttribute = array ('image', 'small_image', 'thumbnail');
    $categoryTmp->setImage('/m2.png', $mediaAttribute, true, false);// Path pub/meida/catalog/category/m2.png
    $categoryTmp->setStoreId($storeId);
    $categoryTmp->setPath($rootCat->getPath());
    $categoryTmp->save();
}


texts:
I tried PWA on my localhost it works perfectly but the issue is when I open Venia it do not show all the images and also when I click on the Menu then it do not show me any categories it just showing me Data Fetch Error as you guys can see from the images

as you guys can see that it shows Gear n training n its works perfectly but if I click on Women or any other category then it just start loading...
now in the last image it shows me these errors in console.


texts: How to change the column in core table in magento 2

texts: I need to change the existing column (title to be null) in review_detail table in Review module in magento.Please provide me a solution


texts: Reset the product id to 1 after deleting the product

texts:
To reset the product id to 1 after deleting the product, I tried the following SQL command but it's not working.

  ALTER TABLE catalog_product_entity AUTO_INCREMENT =1

The message is showing  :

MySQL returned an empty result set (i.e. zero rows)


texts: Sample php code to programmatically check SOAP connection in Magento 2

texts:
I tried the below code though I am not sure whether these are the required set of scripts, but it didn't work and gives

  SOAP-ERROR: Parsing WSDL: Couldn't load from  : Start tag expected,
  '<' not found

$wsdlUrl = 'http://localhost/magento20_0407/soap/default?wsdl_list=1';
$apiUser = 'testUser';
$apiKey = 'admin123';
$token = 'xioxnuuebn7tlh8ytu7781t14w7ftwmp';

$opts = array('http' => array('method' => "GET", 'header' => "Accept-language: en\r\nConnection: close\r\n"));
$context = stream_context_create($opts);
stream_context_set_option($context, "http", "protocol_version", 1.1);
fpassthru(fopen($wsdlUrl, 'r', false, $context));
$opts = array('http'=>array('header' => 'Authorization: Bearer '.$token));
$serviceArgs = array("id"=>1);

try{
    $context = stream_context_create($opts);
    $soapClient = new SoapClient($wsdlUrl, array('version' => SOAP_1_2, 'context' => $context));
    $soapResponse = $soapClient->customerCustomerAccountServiceV1($serviceArgs);
}catch(Exception $e){
    $e->getMessage();
}
    var_dump($soapResponse);exit;

Can anyone share the code to make SOAP connection in Magento2.x

In Magento1.x the below code works fine to connect SOAP

$apiUrl = 'http://localhost/magento_28_03/index.php/api/soap?wsdl';
$apiUser = 'testUser';
$apiKey = 'admin123';

ini_set("soap.wsdl_cache_enabled", "0");
try{
    $client = new SoapClient($apiUrl, array('cache_wsdl' => WSDL_CACHE_NONE));
} catch (SoapFault  $e) {
    echo 'Error in Soap Connection : '.$e->getMessage();
}
try {
    $session = $client->login($apiUser, $apiKey);
    if($session) echo 'SOAP Connection Successful.';
    else echo 'SOAP Connection Failed.';

} catch (SoapFault  $e) {
    echo 'Wrong Soap credentials : '.$e->getMessage();
}

But the above doesn't work for Magento1.x. Can anyone say, what changes the above code need to work fine for Magent2.x ?

I copied the view source code and pasted in a text file. Checked it thoroughly. There is no space at all.


texts: Disable TAX on a specific shipping method

texts:
Hi we are using Webshopapps Premium Rates for shipping options, the issue we are having is that all shipping methods at the moment have TAX added by Magento on top of what we set.

Some options we have in there we don't want tax adding onto! How can I disable tax for a specific method and not all?

has anyone come across this problem? Is there something I can do on the cart page to check what shipping method has been used a remove VAT before checkout?


texts:
I've created a widget, this widgets has a CMS block chooser on the block class I have the following function:

public function getCmsBlock()
{
    $blockId = $this->getData("block_id");
    $storeId = $this->_storeManager->getStore()->getId();
    $block   = $this->_blockFactory
                ->create()
                ->setStoreId($storeId)
                ->load($blockId);

    return $block;
}

The $this->_storeManager class variable is an instant of Magento\Cms\Model\BlockFactory I realised that the load function is deprecated and the setStoreId doesn't really work.

What is the alternative for loading a CMS block programatically where I would be able to set the store ID and check if the CMS is active?


texts: How to add custom dropdown on customer address checkout in Magento2

texts:
How can we add custom dropdown field on the checkout page in customer address. Also, it should be reflected in the backend and in Customer my account section.

For example:-

Customer primary business

Dropdown options like

Technician
Business
End user

I have created for Magento-1.9 using this solution But not having much information for Magento 2.1.x


texts:
I use to have a message displaying if the customer is not over the free delivery amount just to see if they want to top their cart up to get free delivery.

This is the code i am using and i want it to pop out of the screen but instead it is just appear in the page, what am i doing wrong?

 <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('checkout')->toHtml()?>

 <button type="button" title="Proceed to Checkout" class="button btn-proceed-checkout btn-checkout" onclick="return showForm('popup_form')" >Proceed to Checkout</button>

Any ideas of why it isnt poping out of the screen, I must have made a mistake in the javascript

Thanks


texts: Magento 2: How to solve the message "Unable to send email"?

texts:
My Magento 2 send an email when I register in the newsletter, but I receive that exception all time:

How can I solve it?
Thanks


texts: Magento Payment Gateway Configuration Issue with more than one Model

texts:
I've been looking for documentation that explains this in details, but alas i can't find anything that covers config.xml and payment definitions.

I would like to know what is the relation between config.xml and $_code inside a payment module?

This is the config.xml in my module:

```

<modules>
   <ACME_Corporation>
     <version>xxx</version>
   </ACME_Corporation>
</modules>

<global>
    <blocks>
        <acme>
            <class>ACME_Corporation_Block</class>
        </acme>
    </blocks>

    <models>
        <acme>
            <class>ACME_Corporation_Model</class>
        </acme>
    </models>

    <helpers>
        <acme>
            <class>ACME_Corporation_Helper</class>
        </acme>
    </helpers>

    <payment>
        <groups>
            <acme>ACME</acme>
        </groups>
    </payment>
</global>

<default>
    <payment>
        <acme_gold>
            <model>acme/gold</model>
        </acme_gold>
        <acme_silver>
            <model>acme/silver</model>
        </acme_silver>
     </payment>
</default>

```

And this are my two models:

class ACME_Corporation_Model_Gold extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'acme_gold';
}

class ACME_Corporation_Model_Silver extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'acme_silver';
}

However upon checkout neither of them is visible.

If i change $_code variable, on one of the Models:

class ACME_Corporation_Model_Silver extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'acme';
}

I can see the option in the Checkout form, but this makes naming inconsistent and the second Option is still missing.

I appreciate all the help, thanks!


texts: How to create a custom product tab in admin panel of Magento 2.1?

texts:
I want to create a custom tab in back-end product edit module of Magento 2.1. Like this

I tried this and tried to know how Magento adds these tabs. But didn't find a solution.

Please help me find the correct solution.


texts: Single Sign-On extension for Magento and Socialengine

texts: We have created a community website built in socialengine and an online store built in magento. Now I want to integrate the magento and socialengine using single sign on process. Is there any magento extension available for Single Sign-On between Magento and Socialengine ?


texts:
I'm trying to add a js file to the head section of my file and am not sure if I'm following procedure here. What I have done is gone into the head.phtml file and placed the path to the js file below this block of code as follows:

<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
<?php echo $this->getIncludes() ?>
<script type="text/javascript" src="HoverAlls/js/jquery-1.11.1.min.js"></script>

In chrome develop tools, I see that it is in the head section but I'm getting a 404 on the path. I have double checked that the path is correct, so I'm wondering if there is another way to do this?

Sorry, I'm a noob!


texts: Magento2: How to include js library + assets into static cms page via template?

texts:
i have a static page which was created via cms -> page.
I include a custom phtml template within the cms page

{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::test.phtml"}}

Now i want to include a masonry gallery for example (https://vodkabears.github.io/galereya/)

How can i include css, jss files from within the phtml file to the bottom of the theme where all the other assets like jquery, etc are?

I tried several ways, i do not want the library to include in the whole theme, but only on the specific page. When i include the js/css files within the phtml file it gets included too early, before any jquery was loaded.

I hope to find someone who can help me.

Thank you very much


texts: I would like to change default wishlist behaviour in Magento CE 1.9. By default item is removed from wishlist if quantity value set to 0. I would like to keep it in the wishlist. I would also like that when items are added to wishlist, default quantity is 0 not 1. Is this possible, any ideas?


texts:
I'd like to translate a line in checkout > payment information but I dont' find the CSV file. I tried to add the translation on mage_sales.csv but it didn't work.
Can you help me?


texts: In Jquery, How to capture the data within product_price in the event of a change in the product price?

texts:
Below is the code written to capture the updated price from within Price as the price changes on one choosing a variant of a product from the drop-down. I find the event handler below is not even being called when change event happens. Please show me what is not right in it or an alternative to achieve my goal? Thank you.

jQuery(".price-box .normal-price .price-wrapper span.price").on("DOMSubtreeModified", function() {
  alert('Just an alert');
  console.log('Hello, I am changed from old price');
  // Get the value of the span element
  var price = $(".price-box .normal-price .price-wrapper span.price").html();

  // Clean and Convert the value to cents
  var priceCents = parseInt(parseFloat(price.replace(/[^\d.]/g,'')) * 100);

  // If value is different from existing Klarna product placement value, update it.
  // and then call Klarna with refresh-event to refresh the placement.
  var oldPurchaseAmt = $(".product-add-form klarna-placement").attr("data-purchase-amount");
  if (priceCents != oldPurchaseAmt) {
    $(".product-add-form klarna-placement").attr("data-purchase-amount", priceCents);

    // Trigger event to refresh
    window.KlarnaOnsiteService = window.KlarnaOnsiteService || [];
    window.KlarnaOnsiteService.push({ eventName: 'refresh-placements' });
  }
});


texts: Magento 2.2.5 configurable product is not open in admin?

texts:
I have created configurable product which has almost 2000 products associated.

I want to edit some attribute but it is not opening and showing an warning:

  Warning: DOMDocumentFragment::appendXML(): Entity: line 1: parser error : internal error: Huge input lookup in /vendor/magento/framework/View/TemplateEngine/Xhtml/Template.php on line 60

How can I fix the issue? Can anyone suggest?


texts: How to customize the customer account after login according to user group

texts:
I need to show the different options according to group of the customer in MY ACCOUNT section.

For example, I need to show only My profile, Account Information, social media accounts link in the MY ACCOUNT section of the customer dashboard. Some of links will be custom controller actions so how I can show these link and manage the session so that all this happened only when the customer is login.


texts: How to find out all insecure pages (http) in both fronted & admin ? magento 1.9.3.4

texts:
SSL is successfully installed in my website. I have installed some modules when I click the setting of those modules, In admin, urls page showing notification.

  your connection to this site is not fully secure

I want to find out all my insecure pages in frontend and admin so that i can modify them and make them secure.


texts: What is use of Critical.css file in Magento 2?

texts:
I want to know what is use of critical.css file in Magento 2. I enable configuration for that. But, how that file will create ?
Note : After enable configuration, CSS not loading in network.
Can anyone please guide me?
Anyhelp would be appreciated.
Thanks.


texts: How to add multiple products on clicking add power button

texts:
I want to know how to add multiple products as a popup on clicking addpower button.. The process we select a frame and then add a power to it . So, once we click on add to power a popup displays with different quality lens that will be added to the frame price and we will have 6 to 8 lenses we can only select one lense at a time which will be added to the frame price. Please help me. I have aattavhed the screenshot as well or if there are any paid plugins you can recommend me.

Please find the link for add power button
http://www.lenskart.com/vincent-chas...unglasses.html


texts: Magento2: Default to sort by price descending not ascending

texts:
Ok so I have my categories sorting by price. Magento 2 defaults this to price ascending. But I would prefer it to be by price descending.

Pretty sure I can do this by customising catalog_category_view.xml in my theme and putting an argument to product_list_toolbar but I just can't quite figure it out. Any help?


texts:
Under System > Configuration > General > Design > Header > Logo Image Src with http the following worked perfectly:
images/media/my_shiny_logo.png

However, after successfully activating SSL (setting secure Base URL to https://www.example.com/) everything except the site logo works as expected.

The source code of https://www.example.com/store1/index.php/checkout/onepage/ reveals:

<img class="large" alt="" src="https://www.example.com/skin/frontend/store1/default/images/media/my_shiny_logo.png">

Should Magento not automagically redirect the https request? It's another Magento Mystery...

Any suggestions? Thanks!


texts: Creating a dynamic row file upload and drop down option in system config

texts:
I've checked the example here: https://devdocs.magento.com/guides/v2.3/ext-best-practices/tutorials/dynamic-row-system-config.html

Which add text inputs, But how to add other types of input such as drop down and file upload?


texts: Magento 2: How to show Prices for OUT of stock products

texts:
I'm pretty new to Magento in general and just started working with Magento 2.

Here is my question - How to show prices for all out of stock products?

There is this topic: Magento 2 : How To Show Price of "out of stock" Products

And apparently it works, but half of the instructions don't make sense to me.
After creating custom module, what should I do with it? Should I change anything else anywhere?

Thanks!


texts: Overwriting the cart page layout in Magento 2.1.7

texts:
I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank.

I want to change the layout of the page visible at the URL

  www.mysite.com/checkout/cart/

I could not find the checkout_cart_index.xml in my Magento 2.1.7 instalation.

What file shall I copy to my custom theme and where in order to overwrite the default?


texts: Magento 2.3.4 and OAuth 1 oauth_problem=Consumer+key+has+expired

texts:
I'm going crazy with OAUTH1 and Magento 2.3.4 (Ubuntu + Nginx 1.14 + PHP 7.3)

I get always

oauth_problem=Consumer+key+has+expired

My Backend configs:

I've configured an Integration (System -> Integrations -> Add New Integration)
I've set Available Api: "Orders" and "Customers"
I've Activate the Integration
I've set a Postman Test with Token Request Url, Consumer Key, Consumer Secret but I get always oauth_problem=Consumer+key+has+expired

I've also tried to:

(Stores -> Configuration -> Services -> oAuth) to try several values for Consumer Settings -> Expiration Period: 0, 300 (default), 1000000
to reactivate several time the Integration
to generate new Integrations
to erase all Integration and create New one again

Nothing!

Any ideas where I'm wrong? I've read a lots of posts about it but mosts are about all

Best Regards,
Francesco


texts: Magento 1 - Newsletter subscription - send additional email

texts:
We have two newsletter tools in use (don't ask me why). The "old" one and the default one from Magento. For the old one to receive subscribers, we want to send an email with the address of the subscriber to a specified email address.

Hence, I need this:
When the user is subscribing and his data is added to Magento, it should als trigger an email to that specified email address (hardcoded, we will remove it later).

Where in the code can I achieve this, so that it covers all possible subscriptions (directly from page, when registering etc.)?


texts: Get order/shipment details by tracking number magento 2

texts:
Is there anyone has experience to get order or shipment details by tracking number?

I saw few rest apis available in magento 2.

http://devdocs.magento.com/guides/v2.1/rest/list.html

POST   /V1/returns/:id/tracking-numbers
GET    /V1/returns/:id/tracking-numbers

Thanks


texts: Magento 2 : Import product image with sku

texts:
I have a CSV file product image with SKU, I did import all product SKU in admin but not have an image.
here is the CSV file I need import.


texts: Magento 2 translation file not working in app/code

texts:
im using magento 2.4.0 and I currently have an app/design/frontend/vendor/theme/i18n/en_US.csv
"sample_trans","Sample Trans"
my problem is when i try to call this inside the app/code. im calling it inside a plugin using __('sample_trans') and its not being translated.
i needed to create an app/code/vendor/module/i18n/en_US.csv to make it work.
Im just wondering if theres a way to create a global translation file to be used by a theme so i wont be needing to keep 2 translation file for app/code and app/design or maybe make app/code retieve the translaion from the current theme.


texts: How to add a new theme? I am trying to add in localhost.


texts: what would cause the updated_at attribute time stamp to change?

texts: I'm wondering if anyone could share some information regarding the "updated_at" field in Mangento. What would cause this to change? Is it any update to the product, including category changes?


texts: Enterprise Target Rule - Attribute Values Must Have Store ID of 0 (zero)

texts:
A Magento EE 1.14.0.1 site I'm working on was having problem with target rules. The rule would be something very simple, like this:

Products to Match:
If ALL of these conditions are TRUE:
Category is 10

Products to Display:
If ALL of these conditions are TRUE:
Product Collection contains Matched Product Collection

Now "Collection" is a custom attribute that we created (attribute code is collections.) It's a multiselect, with a scope of "Store View". We also imported the nearly 1000 options for that attribute, and over 10,000 attribute-to-product values. When we imported these values, we set the store_id to 1.

I should note that we only have one website (ID: 1) one store group (ID: 1) and one store view (ID: 1) so setting the store_id to 1 in catalog_product_entity_value seemed okay.

We noticed that the subselect that the Target Rule module creates has store_id = 0 in it though, and that no products ever matched based on this collections attribute. It wasn't until we changed all of the values in catalog_product_entity_value to have store_id = 0 that this Target Rule started working.

There isn't even a means to select a store view in the admin because we only have one on the site, and there are thousands of attribute values in catalog_product_entity_value with a store_id of 1, so why must I set this particular attribute to 0 to get it to work?


texts: I have grid at admin section. I want to add ajax-pagination to stop reloading page. Any way code or module to achieve this?


texts: Magento 2.3.5: Showing Invalid Form key on every page

texts:
We are facing an issue after upgrading Magento version to 2.3.5.

Invalid form key. Please refresh the page.

is showing on every page only on safari browser.


texts:
Inside of my custom module I have added the file

Vendor/Theme/view/layout/default.xml

which I am using to override a lot of the site's global templating with templates/blocks/layouts from the custom module. I am also attaching my own global styling that exist in the view/web directory in that module.

Should I be using a theme for this instead? Is there a good argument for one design pattern over the other? Eg. using app/design over app/code?


texts: Import shows changes on product, but not front of site

texts:
Trying to upload an excel sheet to update products for upcoming sales, and the changes are being placed on the product, but not on the front end.

I have one product that I set to have a 15% discount. Uploading the CSV shows that the 15% is in the back end of the product, but on the front of site it does not list it as for sale.

Sale coming up is going to have over 500 products and I do not want to go in to each one and hit save just so the sale is enabled on the product.

Anyone know a solution?


texts: Table coupling the product attributes and the orders in magento

texts:
Which table couples the orders and the product attributes of the related orders such as size, color and price?

For example, if my order contains a shirt, I need to get the color and size of the shirt through a query.

magento version 1.6.11


texts:
I enabled the /var/debug/db.log with this:

bin/magento dev:query-log:enable

With two page loads in front end it generated 128025 lines. Is that normal?


texts: Magento 2: How to get secure category URL programmatically?

texts:
I have a custom category indexer which grabs Magento categories and index them to a search service. Within each category I need to index it's URL which I do by code

$url = $category->getUrl();

where $category is instance of Magento\Catalog\Model\Category.

The issue is when the store is set to use Secure URLs in front end. Then this code always return the not-secure URL. Do you know how to get the secure one?

With product I solved it with code

$url = $product->getUrlModel()->getUrl($product, ['_secure' => true]);

because simple $url = $product->getProductUrl(); returned a not-secure URL as well.

However from Category I don't have access to any UrlModel or any way how to pass _secure parameter to getUrl() method.

My current configuration:

Thanks for any help!


texts:
I am trying to mask the urls in magento related to a specific module.

  http://www.example.com/modulename/controllername/methodname/id/32

to

  http://www.example.com/special/id/32

This should only apply when the module is modulename and controller is controllername and method is methodnameAction as shown in the above url.

I tried:

<global>
    <rewrite>
        <special>
            <from>
                <![CDATA[#^/special/id/#]]>
            </from>
            <to>
                <![CDATA[modulename/controller/methodname/id/]]>
            </to>
            <complete>1</complete>
        </special>
    </rewrite>
</global>

This is working fine but I strongly think this is not the better way to solve this issue. (BTW, It has many issues though)


texts: CE 1.9 - Configurable product "As low as" price wrong

texts:
I'm using CE 1.9.2.1 and have tested this on a vanilla installation of Magento. This issue only occurs when my products are associated to multiple websites.

I have applied a price adjustment to two of the three associated products. On the front-end category view, the "As low as" price shows twice the intended adjustment (-£3.00, not -£1.50).

** UPDATE **

I have checked the catalog_product_index_price table of my database and found that the min_price value for my configurable product is incorrect, even here.

I dug a little deeper and found protected function _applyConfigurableOption() in
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Configurable.php

Looking at line 221 it shows:

$select->columns(array(
    'min_price'   => new Zend_Db_Expr('i.min_price + io.min_price'),
    'max_price'   => new Zend_Db_Expr('i.max_price + io.max_price'),
    'tier_price'  => $write->getCheckSql('i.tier_price IS NOT NULL', 'i.tier_price + io.tier_price', 'NULL'),
    'group_price' => $write->getCheckSql(
        'i.group_price IS NOT NULL',
        'i.group_price + io.group_price', 'NULL'
    ),
));

By trial and error, I changed the second line to the following (removed i.min_price):

    'min_price'   => new Zend_Db_Expr('io.min_price')

I then went back into my product and saved it again which forced a reindex of the database. The catalog_product_index_price table showed that the min_price value was now -3.0000 so this shows the issue is io.min_price.

Now I need to know what to do with the io.min_price value so that it doesn't create a double discount when saving to the database.


texts:
I've started to call this async endpoint POST /async/V1/products/base-prices with a proper payload. All requests have worked in the right way.  I've provided a missing SKU and starting from this moment, all requests are accepted and processed but never applied to products. If I call details-status endpoint, with different bulk_uuid, I'll always get the same response like this below:
{
    "operations_list": [
        {
            "id": 2920900,
            "bulk_uuid": "5392ff26-210f-48ae-9058-1d4a2807ab50",
            "topic_name": "async.magento.catalog.api.basepricestorageinterface.update.post",
            "serialized_data": null,
            "result_serialized_data": "[{\"message\":\"Invalid attribute %fieldName = %fieldValue.\",\"parameters\":[\"SKU\",\"hen892532\"]},{\"message\":\"Invalid attribute %fieldName = %fieldValue.\",\"parameters\":[\"SKU\",\"hen892532\"]},{\"message\":\"Invalid attribute %fieldName = %fieldValue.\",\"parameters\":[\"SKU\",\"hen892556\"]},{\"message\":\"Invalid attribute %fieldName = %fieldValue.\",\"parameters\":[\"SKU\",\"hen892556\"]}]",
            "status": 1,
            "result_message": "Service execution success Magento\\Catalog\\Model\\Product\\Price\\BasePriceStorage::update",
            "error_code": null
        }
    ],
    "user_type": 1,
    "bulk_id": "5392ff26-210f-48ae-9058-1d4a2807ab50",
    "description": "Topic async.magento.catalog.api.basepricestorageinterface.update.post",
    "start_time": "2020-11-08 09:10:53",
    "user_id": 2,
    "operation_count": 1
}

In this case the original request is not related to this SKU hen892556. I can't understand how to solve this.
Any suggestion to avoid this issue?


texts: Facing issue with catalogsearch_query table when using Magento search

texts:
I have a Magento 1.4.1.1 setup on production server. When we search any term on the site it should be stored in the catalogsearch_query table.

But for me some search terms are not being saved in this table.

Similar issue was on local system with production DB but when I truncated this table everything started working fine.

On production I did full re-indexing, checked for the class overrides and custom modules also but nothing helped.

So is there any way to fix this table without truncating and loosing the search terms?

I know there there is foreign key dependency on catalogsearch_result table also, with query_id field.


texts: Magento 1.9.2. - Update in real time Tier Price when i change quantity

texts:
I'm trying this code because I want to see the price of the product change dynamically when in the input field of the quantity exchange the number (this only for the products that have the tier price).
For example if I write in the input of quantity 50, in the product page I want to see the first final price written, otherwise if I write 100 I want to see the updated price of the product.
This is the code that I tried to use but without success:

span class="tierprice">/span>
                    input type="text" name="qty" id="qty" value="getProductDefaultQty() * 1 ?>" title="__('Qty') ?>" class="input-text qty" />

                <script type="text/javascript">
                var $j = jQuery.noConflict();

                jQuery(function($j){
                    // probably you want a custom method in your block for getting a better and safer tierPrices array here
                    // for example with formatted prices
                    var tierPrices = <?php echo json_encode($_product->getTierPrice()) ?>;
                    var getPrice = function(qty){
                        qty = Number(qty);
                        var i = tierPrices.length;
                        while(i--)
                        {
                            if(qty >= tierPrices[i]['price_qty']){
                                return tierPrices[i]['price'];
                            }
                        }
                        return null;
                    };
                    var updatePrice = function(price){
                        $('.tierprice').html(price);
                    };
                    // you can use more events here if you want a live response while the user is typing
                    $j('#qty').change(function(){
                        var price = getPrice(this.value);
                        if(price !== null){
                            updatePrice(price);
                        }
                    });
                });
                </script>

Where is the error?


texts:
I have installed Magento 2.3.5-p1 and also tried 2.3.4-p2 on Centos 7, with Nginx & PHP-FPM, maria DB with following commands.
1. /var/www/magento < owner by MAGENTO:NGINX user (I have created a pool for magento:nginx)
2. find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
3. find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
4. chmod u+x bin/magento
6. su magento

7.  bin/magento setup:install --base-url='https://www.example.com/' \
--base-url-secure='https://www.example.com/' \
--backend-frontname='' \
--db-host='localhost' --db-name='' --db-user='' \
--db-password='' --admin-firstname='example' \
--admin-lastname='Admin' --admin-email='' \
--admin-user='admin' --admin-password='' --language='en_US' \
--currency='USD' --timezone='UTC' --use-rewrites=1 --use-secure-admin=1 --use-secure=1

Once completed, my FRONTEND (home page) works absolutely fine, i just have 2 errors in the javascript console log:
[Error] Failed to load resource: the server responded with a status of 404 () (requirejs-config.js, line 0)
[Error] Refused to execute https://www.example.com/pub/static/version1594092941/frontend/Magento/luma/en_US/requirejs-config.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

But when I open admin panel, I can login into it. However, after logging in it keeps loading. I have tried several methods available online such as:

1. rm -rf pub/static/* (except .htaccess) refresh page
2.
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
3.
vi app/etc/di.xml <-- Change Symlink to Copy
rm -rf pub/static/*
refresh page
4.
rm -rf var/*
bin/magento setup:static-content:deploy -f
bin/magento c:c
5. bin/magento cache:enable

I have tried to install it under both php-fpm and nginx group, also as nginx:nginx. Nothing works, admin panel just keeps loading.
What am I missing here?
The errors i get on admin panel JS console logs


texts: Magento 2: Create a Page with Dynamic URL with Same Controller

texts:
I posted a question earlier but didn't able to understand the answer,

Magento 2: How to create a dynamic url with the same controller

i want to create a page with the dynamic url but with same controller to handle the requests,

for example: http://192.168.1.108/magento2/profile/id/jatin123 and http://192.168.1.108/magento2/profile/id/amit123

just able to get the id and display the results accoring to the id = "jatin123" display this user profile and id="amit123" display this user profile.

Please suggest a solution.


texts: Creating elements in magento backend menu issue

texts:
I have a problem in /etc/adminhtml.xml file. This is its content:

<config>
    <menu>
        <attin_exportdb translate="title">
            <title>Export-DB</title>
            <sort_order>99</sort_order>
            <children>
                <export_attributes>
                    <title>Export Attributes</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/exportdb/index</action>
                </export_attributes>
                <export_products>
                    <title>Export Products</title>
                    <sort_order>2</sort_order>
                    <!-- <action>adminhtml/adminhello/index</action> -->
                </export_products>
                <export_categories>
                    <title>Export Categories</title>
                    <sort_order>3</sort_order>
                    <!-- <action>adminhtml/adminhello/index</action> -->
                </export_categories>
                <export_sells>
                    <title>Export Vanzari</title>
                    <sort_order>4</sort_order>
                    <!-- <action>adminhtml/adminhello/index</action> -->
                </export_sells>
            </children>
        </attin_exportdb>
    </menu>
</config>

and this is the controllers/AttributesController.php content:

  <?php
class Attin_Exportdb_AttributesController extends Mage_Core_Controller_Front_Action{

    public function IndexAction() {

        $this->loadLayout();
        echo "Test";
        $this->renderLayout();

    }
}

config.xml file :

<?xml version="1.0"?>
<config>
    <modules>
        <Attin_Exportdb>
            <version>0.1.0</version>
        </Attin_Exportdb>
    </modules>
    <global>
        <helpers>
            <exportdb>
                <class>Attin_Exportdb_Helper</class>
            </exportdb>
        </helpers>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <use>admin</use>
                <args>
                    <module>Attin_Exportdb</module>
                    <frontName>admin</frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

So my problem is with the action in xml (export/adminhtml/attributes/index) , when i clicked on the Export Attributes it redirects me to 404? What am i doing wrong ?


texts: How do you maintain checkout data and state after a failed payment in Magento 2?

texts:
We use a payment gateway that goes redirects offsite and then returns to the success or failed controllers.

Once there is a failed payment (and it goes to the payment failed controller) the user is redirected to the shopping cart and the error message is shown.

We want the user to instead be redirected to the payment part of the checkout process. We also want all checkout information such as shipping and billing address and customer email to stay.

So far I am saving the shipping details in a session variable on the Fail controller:

$order = $this->checkoutSession->getLastRealOrder();

if ($order) {
    $shipping = $order->getShippingAddress();
    if ($shipping) {
        $shippingData = $shipping->getData();
        $shipAr = array('firstName' => $shippingData['firstname'],
        'lastName' => $shippingData['lastname'],
        'region' => $shippingData['region'],
        'postcode' => $shippingData['postcode'],
        'street' => $shippingData['street'],
        'city' => $shippingData['city'],
        'company' => $shippingData['company'],
        'telephone' => $shippingData['telephone'],
        'country_id' => $shippingData['country_id'],
        'fax' => $shippingData['fax'],
        'email' => $shippingData['email']);

        $this->checkoutSession->setFailedPaymentShippingInfo($shipAr);
    }
}

Then I redirect to the checkout shipping section with:

$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('checkout', ['_fragment'=>'payment']);
return $resultRedirect;

On the checkout page I am overriding LayoutProcessor::afterProcess()
and updating the $jsLayout with the values from the session variable.

It is not working too well. How can I do this?


texts: Magento2 custom _typography.less gives error

texts:
I'm attempting to build a theme using Magentos UI library. Per the instructions on http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/using-fonts.html I have created a _typography.less file for my custom fonts. This fails with the following error.

  Compilation from source:

  frontend/mytheme/theme/en_US/css/styles-m.less

  .font-face is undefined
  in
  /var/www/html/magento2/var/view_preprocessed/css/frontend/mytheme/theme/en_US/css/source/_typography.less

the _typography.less file includes

.font-face(
    @family-name: 'latoregular',
    @font-path: '@{baseDir}fonts/lato/lato-regular-webfont',
    @font-weight: normal,
    @font-style: normal
);

.font-face(
    @family-name: 'latomedium',
    @font-path: '@{baseDir}fonts/lato/lato-medium-webfont',
    @font-weight: normal,
    @font-style: normal
);


texts: Google Indexing pages generated by URL Parameters

texts:
So, my robots.txt explicitly says not to crawl any URLs containing a URL Parameter. And that works as expected.
However, Google Search Console is moaning with the following issue:

Indexed, though blocked by robots.txt
Affected Pages 1.88k

I would like to know if I missed a setting in Magento that allows me to set auto-generated pages based on URL Parameters and Page Numbers to NOINDEX, NOFOLLOW whilst leaving the rest of the site set to INDEX, FOLLOW.
If Magento doesn't support this out-the-box, what options do I have?


texts: Add jQuery plugin without for whole site without a module (Magento 2)

texts:
How can I add a jQuery plugin without a module for use in the whole site.

I found things about how to add it in modules:
Adding a jQuery Library to Magento 2

But can I add it without a module and if yes in which should requirejs-config.js be placed?


texts:
I'd like to hook into the save process of an order, so that I can execute my own code once the order is completed.

So far I've done similar things with the Customer and CustomerAdress Objects using the Plugin Pattern and a aroundSave method.

I'd like to do the same for the order object on checkout, but I can't seem to get an overview on how the mechanisms work. There are just too many new design patterns and methods stacked over each other (Knockout, Component, Rest, Zendframework).

I've tried making a Plugin for Magento\Sales\Model\ResourceModel\Order but it has no effect.

Does anybody have an idea how I can find the correct class to hook up with the plugin class?


texts: How to get all product images in modal slider?

texts:
    <a class="product-image" href="<?php echo $item->getProductUrl(); ?>">
        <img src="<?php echo $this->helper('catalog/image')->init($item, 'thumbnail')->resize(500); ?>" alt="<?php echo $this->escapeHtml($item->getName()); ?>">

Currently I am getting only one image of that product in my modal, but I want all of that product's images in modal as slider.


texts: validating is_unique property for custom attribute in customer registration form

texts:
I've followed this answer@stackexchange to create a new attribute (called mobile) for the customer entity.

I was able to create an input field in the registration form(customer_account_create) and able to save the entered value in customer_entity_varchar table associated with the attribute_id (mobile)

Now, I wanted like to make this attribute unique i.e no user can register for another account using same mobile number. To achieve this, I modified the msql4-install-0.1.0.php file at
(app/code/local/MyCompany/MyModule/sql/customerattribute_setup/...php)

<?php
$installer = $this;
$installer->startSetup();

$installer->addAttribute("customer", "mobile",  array(
    ....
    "unique"     => true,
    ...

    ));

By changing the property from false to true.
The new customer attribute has is_unique=1 in the eav_attribute table.

However, the unique constrain does not apply for some reason when I try to create a new user from the registration form using different email ID but same mobile number (associated to attribute - mobile).

Do I have to do something else so that I can allow users creation only if the said attribute is not associated to any other user ??


texts: Customer name is missing in welcome message after login

texts:
In header, there is a welcome message which can be configured in the Magento backend.

However after login, i found that the customer fullname is not insert into the welcome message,(i.e. always showing the Default message only) and i am not sure where to update & debug this kind of js in magento 2.

Can anyone give some advice on it?


texts: How to make size charts popup for different products category..?

texts:
I have created an attribute with identifier -->size_chart_template. with two option men and women. and printing it in swatch.phtml but no pop up is coming. button is showing in front end

      <?php
      $sizeChartIcon= Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."size-charts/size-chart.gif"; ?>
      Size-Chart

 <?php echo  Mage::app()->getLayout()->createBlock('cms/block')->setBlockId($_product->getAttributeText('size_chart_template'))->toHtml(); ?>


texts: Magento 2: How to hide the price for guest user only wholesale group user can see price

texts:
How to hide the price for guest user only wholesale group user can see price in
is there any script or code or some free extension please suggest ?


texts: can anyone suggest me how can i handle thousands of color?

texts: I have 3000 color and i want to use these color with color swatches and i uploaded all color in color attribute option. but the site is being very slow and sometimes crashed. can anyone suggest me how can i handle thousands of color.


texts: Fatal error: Call to a member function getTelephone() on a non-object in Observer.php while payment using payUmoney

texts:
I am using Magento 1.9.2.4 version. I am using SMS module for receiving SMS after placing the order .While selecting option as "Pay Using Credit Card / Debit Card / Net Banking" it is redirecting to payUmoney money page and amount deducting but order placing time error getting like this

   Fatal error: Call to a member function getTelephone() on a non-object in  model/Observer.php on line 125

My observer code:

        public function salesOrderPlace(Varien_Event_Observer $observer)
          {
       try{
        Mage::log("New Order Placed");

        $order = Mage::getModel('sales/order');

        $incrementId = Mage::getSingleton('checkout/session')->getLastOrderId();
        Mage::log("Order ID:".$incrementId);

        $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);

        if ($order instanceof Mage_Sales_Model_Order)
        {
          if($this->getHelper()->issalesOrderPlace())
          {

            $mobilenumbers = $order->getBillingAddress()->getTelephone();

            $message = $this->getHelper()->getOrderMessage($order); //enter Your Message
            $customerName = $order->getCustomerName();
            //curlApicall : this method will return tru or fale.
            $retunValue = $this->getHelper()->curlApiCall($message,$mobilenumbers,$customerName,"New Order");

          }
          if($this->getHelper()->issalesOrderPlaceForAdmin())
          {
            $mobilenumbers = $this->getHelper()->getAdminMobileNumber();
            $message = $this->getHelper()->getOrderMessageForAdmin($order); //enter Your Message
            $customerName = $order->getCustomerName();
            //curlApicall : this method will return tru or fale.
            $retunValue = $this->getHelper()->curlApiCall($message,$mobilenumbers,$customerName,"New Order");

          }
        }

    //return false;
  }catch(Exception $e) {
         Mage::log($e->getMessage());
  }
}


texts: Which class/function is responsible for indexing of cataloginventory_stock?

texts:
As per Magento's document , function responsible for indexing of cataloginventory_stock is Magento\CatalogInventory\Model\Indexer\Stock::execute($ids).

For debugging purpose, I have modified this function and added var_dump($ids);exit; at the top and ran command php bin/magento indexer:reindex cataloginventory_stock but my code wasn't fired and indexing was completed successfully.

Which class is actually responsible for the re-indexing of cataloginventory_stock ?


texts: Customization mistakes and changing the layout type of a core page configuration xml

texts:
In the official M2 docs we have this quote

  Changing handle inheritance. For example, you should not change the page type parent handle.

Pulled from here M2 Frontend Dev Docs

By this I understand you should not make changes like 1column -> 3columns. If this means something else please correct me. If I'm right, what are the reasons for which this is bad practice?

What is the recommended way to change the layout of a page? If this is considered a bad practice?


texts: Session error message from observer not showing after redirect

texts:
I created an observer to add rule before customer can access one page checkout, the code for checking my rule before proceed to one page checkout page is working fine, but the problem is i want to add the error message if i redirect to checkout/cart but it only redirect to checkout cart not showing the error message, here's my code:

class Namespace_Module_Model_Observer
{
    public function checkAction(Varien_Event_Observer $observer)
    {
        $exist = Mage::helper('module')->check();
        if ($exist['key'] == 1) {
            if ($exist['total'] > 0) {
                return true;
            }
        } elseif ($exist['key'] == 0) {
            if ($exist['total'] > 0) {
                Mage::getSingleton('core/session')->addError('You need to configure Logo Branding first to proceed');
                Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getBaseUrl().'checkout/cart');
            }
        }
        return true;
    }
}