texts: how customers check their orders if they use guest checkout?

texts: i'm going to enable the guest checkout, but how the customers can get their invoice without an account? How shop owner identify the buyer when he came to the shop pickup the goods?


texts: Magento 2: get customer().lastname in header.phtml

texts:
I don't get how this works. I'm trying to edit the header of my Magento 2 store (Magento_Theme/templates/html/header.phtml) and I'm trying to retrieve my customers lastname like this:

<span data-bind="text: new String('<?php echo $block->escapeHtml(__('Welcome %1', '%1'));?>').replace('%1', customer().lastname)">

It works fine when it says 'fullname' instead of lastname: this shows my full name. It also works fine when I replace it with 'firstname': this shows my first name. Why doesn't it work with last name and what is the right way to get all the customer data here?


texts: How to improve product inventory daily updates from CSV file?

texts:
I'm working on a 10000 products Magento store. I scheduled a cronjob to run everyday at 7am to read a CSV file and update each product inventory and set it out of stock if new QTY is less than 1.

Currently, the update process takes around an hour (more/less) to update all 10000 products. My code as follow:

 $csv = new Varien_File_Csv();
 $csvData = $csv->getData('products.csv');

 foreach($csvData as $k => $v){
     // code to store product_id and new_qty into a temporary table
 }

 $stock_item_model = Mage::getModel('cataloginventory/stock_item');
 $stock_item_collection = $stock_item_model->getCollection();

 foreach($stock_item_collection as $stock_item) {

     // load new_qty from temporary table based on product_id
     $new_qty = Mage::getResourceModel('custom/temp')->getQty($stock_item->getProductId())

     // set new QTY
     $stock_item->setQty($new_qty);

     // check if in stock or out of stock
     if($new_qty < 1) {
         $stock_item->setIsInStock(0);
     } else {
         $stock_item->setIsInStock(1);
     }
 }

 // save all
 $stock_item_collection->walk('save'); // this takes around an hour to finish.

So, is there any other way to decrease the update time? Do I need to change the way I'm saving stock items?


texts: Redirect "Continue Shopping" Button to the Current Product Category it was added from?

texts:
I know how to redirect Magento's Continue Shopping button to the first and last categories from the array of all categories for the last product added to the cart but I want to redirect to the first page of the 'CURRENT CATEGORY' that the product was added from for the last product added to the shopping cart. Our catalog is too many levels deep for first or last categories from the array to work as needed.

Here is an example. So if someone adds a product from category (Sub-Sub-Category: 2A) the continue shopping button would need to take them back to the first page of (Sub-Sub-Category: 2A). How do I do this with arrays?

Category: A
Sub-Category: 1A
Sub-Sub-Category: 2A
Sub-Sub-Sub-Category: 3A

app/design/frontend/yourpackage/yourtheme/template/checkout/cart.phtml

Code

<?php
    $lastProductAddedToCartId = Mage::getSingleton('checkout/session')->getLastAddedProductId();
    if($lastProductAddedToCartId) {
        $productCategoryIdsArray = Mage::getModel('catalog/product')->load($lastProductAddedToCartId)->getCategoryIds();
        $continueShoppingCategoryUrl = Mage::getModel('catalog/category')->load($productCategoryIdsArray[0])->getUrl();
    }
?>

Shopping Cart Button

   <?php if($this->getContinueShoppingUrl()): ?>
        <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button2 btn-continue" onclick="setLocation('<?php echo (isset($continueShoppingCategoryUrl)) ? $continueShoppingCategoryUrl : $this->getContinueShoppingUrl(); ?>')"><?php echo $this->__('Continue Shopping') ?></button>
    <?php endif; ?>


texts: Set HTTPS-only for secure pages - No data received error

texts:
We only need to set HTTPS for secure pages:

Account pages, login pages, checkout and shopping cart pages.

We are using it as in the following image.

Is everything fine in the image? Because sometimes we will get a no-data-received error on the site.


texts: Custom Variable Plain Value in Email template

texts:
I'm aware that it's possible to call the HTML value by:
{{customVar code=custom_variable_code}}

Question is simple:
Is it possible to receive plain value of custom variable in email template (Magento 1.9.2.0) with some statement like:
{{customVar code=custom_variable_code|plain}}?
If it's not, are there any tips to get something like that to work?


texts: We run 5 site on the same Magento platform (2.1.6) and I have recently been trying to optimize the speed of our site using the parameters outlined by Google Page Speed Insights. Having struggled to really eliminate any of the things google dislikes I wanted to see how other Magento 2 site performed. They ALL seem to perform poorly on the PSI analysis. This includes sites developed by Magento Gold developer partners. Any comments would be most appreciated....


texts:
I have installed Price Rounding plugin to my Magento site.

It works good, but I need to round price like that:
131.26 -> 131.25

The plugin gives me that:
131.26 -> 131.00

I know that it uses PHP math functions, but I don't know is there some PHP math functions that can give me 131.25 result.

Maybe there is another way to round price?


texts: Magento2 B2B whole Seller Extension recommendation

texts:
Currently I have B2C website where a customer can place order as a guest
Now I want to integrate B2B there where a whole-seller or retailer can only see a product when He is logged in.
Do I need to create a different store view for it?
Also I need recommendation for whole-seller B2B Extension which is not much costly?


texts: Magento Observer not firing in order when using

texts:
The problem I'm having is that when observing customer_save_after, I try and get the customer's newsletter subscription status, and it gets the value before the newsletter subscription status is saved.

Example: I click subscribe in the account dashboard and save, when I look at the logs, it says I am unsubscribed (from the last time I saved it), when I save it again, it will grab the previously saved status. Then I uncheck the box and click save, it will say I am subscribed as that was the last status before I unsubscribed.

I saw that Mage_Newsletter is also observing the same event. I set a depends in XML on Mage_Newsletter to ensure the configuration is loaded after that module, however this doesn't seem to fix the issue. I've refreshed my cache and even tried setting the depends to Mage_XmlConnect, as to ensure it is loaded much later in the xml stack. I'm all out of ideas here. Any help is greatly appreciated.


texts: getStatus() returns wrong value from configurable product child

texts:
I'm looping through some products using the following:

public function getAllowProducts()
{
    if (!$this->hasAllowProducts()) {
        $products = array();
        $allProducts = $this->getProduct()->getTypeInstance(true)->getUsedProducts(array('status'), $this->getProduct());

        foreach ($allProducts as $product):
            $status = $product->getStatus();
            Mage::log($product->getSku() . ' status: ' . $status, null, 'debug.log');
            if(Mage::getStoreConfig('custom_stock/configurableproducts/configoutofstock', Mage::app()->getStore()->getId()) && $status != 2):
                $products[] = $product;
            else:
                $qty=(int)$product->getStockItem()->getQty();
                $backordered = $product->getStockItem()->getBackorders();
                $isOutOfStock = $product->getStockItem()->getIsInStock();
                if ($qty > 0 && $status != 2):
                    $products[] = $product;
                elseif(($backordered == 1 || $backordered == 2) && $isOutOfStock == 1 && $status != 2):
                    $products[] = $product;
                endif;
            endif;
        endforeach;
        $this->setAllowProducts($products);
    }

My issue is, that the value returned by $product->getStatus() is wrong. It is returning 1 (enabled) in all cases, even though a direct query to the product shows that many has status 2 (disabled).

Can anyone help me to get the correct status on the products?

I'm using magento 1.9.1.1


texts: How to flush/rebuild config cache on High-Performance sites?

texts:
If we flush the config cache, the cache is build up by the customer in the frontend. The problem is that a lot of customer build the same cache and it took a lot of server resources.

Is there a smart way to build the config cache?
Something like, build a parallel config cache and switch it with the real cache keys?
Or just rebuild every config cache key in the adminhtml without flushing it?

We are using Redis as backend cache.

Edit: I figured out, that it's just the case if the cache key CONFIG_GLOBAL_STORES_[A-Z]_[A-Z] is flushed.


texts: Password reset updated but still able to login with old password in magento2

texts:
I have reset my password.

It shows as Password updated. But still i can able to login with old password. Newly updated password is not working.

My magento version is 2.2.6.

Note: I am using Store session In DB instead of files.

Can anyone look into this issue please.


texts: Magento 2 How to open custom login popup when click of 'Proceed to Checkout'

texts:
How to add custom login popup when click on 'Proceed to Checkout' button in minicart as well as in checkout/cart.
Thanks in advance.


texts:
I am trying to connect Mongo Doctrine ODM to Magento.
I have successfully connected zend with mongodb. and I dont know how to Connect the both. I have placed Mongodb odm in "lib" folder of magento and i am having the Issue of linking the lib to magento.
I am trying to "include" the library base class.
But the library contains many namespaces.
I dont think magento supports namespace. so its showing error.
.
Helps are highly appreciated.
Thanks in advance.


texts:
I need to set up a this Price Rule:

(a selected category, for example a Brand)

  100-299 $ = 10% Discount
  300-499 $ = 12% Discount
  500-999 $ = 15% Discount
  over 1000 $ = 20% Discount

I tried in Magento 1.6, but in Catalog Price Rule its not possible to set the PRICE and in the Cart Price Rule its not possible to choose the CATEGORY.


texts: Magento 2 Free Shipping Over 499 Excluding some product

texts:
I am integrating shipping conditions in my website.Currently it Flat rate is enabled with 140 Rs per order and it is working fine.Also I have created one cart rule coupon type where condition is if order more than 499 then shipping cost should free.Everything working fine.

Now there is a condition where looking a condition that some brand product have shipping cost and if these items are in cart than there should be extra price same as Amazon shipping.

So how to integrate shipping method that fulfill both condition if order is above 499 then shipping cost should free and if cart item have brand items that who have extra shipping cost.

Please give me an idea to fulfill this condition.


texts:
Setting up a Magento store is not only a matter of developing self-installable extensions but requires also a lot of "manual entry" operations such as creating end editing attributes, categories, products, price rules CMS pages and so on, not to mention all the changes to the System Configuration.

I'd like your help to outline the best strategy when it comes to deploy a Magento store from development to staging and production environment.

One strategy of mine is that of writing a "deploy module" which programmatically creates the entities mentioned above but it's a very time consuming task and sometimes it seems to me to be a little overkill.

Recently I started using Selenium IDE to reproduce Admin tasks but the time required to set up all the test suites is not far from the one mentioned above.

Maybe an optimal solution could be the usage of a module capable of doing a snapshot of a Magento System letting you choose what to deploy.

So:

what is your strategy for deploy?
is there a module capable of doing a snapshot of a Magento System letting you choose what to deploy?
if such a module doesn't exist and provided such a module is a reasonable solution, is there anyone interested in giving his/her contribute to develop it?

Thank you!


texts:
I'm designing a jewelry site and I'd like gold weight/carat and diamond karat based pricing apart from base price (making/design charges) of the jewel.

The jewel price is completely decided based on how much it weighs and how much the diamond weighs. How do I set the pricing based on that

For example, a ring could have multiple customisation options like what purity of gold should it have (18k or 22k) or what kind of diamond to be used, based on diamond purity ranging from A to Z, diamond color from white to yellow. All these parameters decide the final price of the jewel.

Also I need to be able to update the gold per gram price on a day to day basis in the admin side so the price gets affect all over the site. The gold price may not be the same everyday, I want to able to give that flexibility to reduce prices when the prices fall. MANDATORY FEATURE

So there could be 3 grams of 22 carat gold or 5 grams of 18 carat gold. so 1 carat of 18k gold has so much percentage of gold and rest copper in it. How do I price these? I have option buttons for choosing category at the product page and I'd want the pricing to change as they are customizing their jewels.


texts: Overriding Magento sensitive configuration variables using environment variables

texts:
According to Magento docs, one can override Magento Configuration variables using ENV variables.
see https://devdocs.magento.com/guides/v2.3/config-guide/prod/config-reference-var-name.html

I'm trying to do that with some custom extension: https://github.com/magepal/magento2-gmail-smtp-app.git
 Basically I'm trying to feed SMTP configuration/credentials from ENV variables.

I do know that variables are formatted correctly, cause I put this in the pub/index.php

var_dump($_ENV);
die();

and I clearly see my ENV variables there.

I inject them using following snippet in php-fpm-pool config:

; magepal/magento2-gmail-smtp-app config
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__ACTIVE] = $MAGENTO_SMTP_TRANSPORT_ACTIVE
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__NAME] = $MAGENTO_SMTP_SENDER_HOST
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__AUTH] = $MAGENTO_SMTP_AUTH
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__SMTPHOST] = $MAGENTO_SMTP_HOST
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__SMTPPORT] = $MAGENTO_SMTP_PORT
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__USERNAME] = $MAGENTO_SMTP_USERNAME
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__PASSWORD] = $MAGENTO_SMTP_PASSWORD

All values except CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__PASSWORD or system/gmailsmtpapp/password seem to be visible in Magento backend under Stores -> Configuration.

Once I take the same value that I push into CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__PASSWORD and save it in the database - extension starts to work.

Magento version is:

"magento/product-community-edition": "2.3.4",

Recently we had similar problems with other extension and I'm starting to think that there is a bug in Magento core regarding reading sensitive vars from ENV.

Before I pull out debugger and start going through Magento guts, is there something that I'm missing here? Is there a known bug in magento that prevents reading ENV vars?


texts: Possible issues after updating from Magento 2.1.X to Magento 2.2?

texts:
If I will upgrade Magento 2.1.0 to Magento 2.2 then is there any possible issues which I have to take care after upgrade process?

Will site work smoother or do I have to compromise with some functionality?

Any help will be appreciated.


texts: Magento 2 - Add additional DIV in sub menu

texts:
I'm using Magento 2.1.6. I want to add an extra wrapper <div> around the submenu items in Top menu.
When we Hover over a menu item, the submenu shows up, submenu is a <ul>, I want to wrap this <ul> inside an external <div> i.e. "submenu-wrapper" so there will be multiple <ul> in the submenu-wrapper.
Please guide me how can I get this structure. thanks.


texts: Hide other shipping methods when free shipping is enabled

texts:
I'm trying to create a module that lets me disable other shipping modes when free shipping is available.

I understand how to create a module and such, I can understand php relatively well I'm just lost as to how to filter this in regard to magento. I'm aware that you someone overwrite some existing rules within the module I'm making.

If someone could guide me as to how I do this within the xml file and the functions I need to use I'd be very grateful.

I've taken some steps into creating one myself after bits of googling.

<?xml version="1.0"?>
    <config>
        <modules>
            <Shipping_Onepage_Method>
                <version>1.0.0</version>
            </Shipping_Onepage_Method>
        </modules>

                    <blocks>
                        <checkout>
                            <rewrite>
                                <shipping_onepage_model_method>Shipping_Onepage_Model_Method</onepage_shipping_model_method>
                            </rewrite>
                        </checkout>
                    </blocks>

    </config>

Then I've got located in /public_html/app/code/local/Markshust/Helloworld/model/available.php

I've got the following code which I'm led to believe will filter the shipping prices as I wish.

 <?Php
class Shipping_Onepage_Model_Method extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
{
    public function getShippingRates()
    {
        $rates = parent::getShippingRates();
        if (array_key_exists('freeshipping', $rates)) {
            $rates = array('freeshipping' => $rates['freeshipping']);
        }

        return $rates;
    }
}

?>

This doesn't seem to work, I've made amends on my xml file since made aware of the faults in the latest awnser.

Thanks


texts: Magento 2.2.2 GetCacheKeyInfo() Error getId() on Null

texts:
Fatal error: Uncaught Error: Call to a member function getId() on null in .../htdocs/vendor/magento/module-backend/Block/Menu.php:233
 Stack trace: #0 .../htdocs/generated/code/Magento/Backend/Block/Menu/Interceptor.php(37):
 Magento\Backend\Block\Menu->getCacheKeyInfo() #1
 .../htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(1035):
 Magento\Backend\Block\Menu\Interceptor->getCacheKeyInfo() #2
 .../htdocs/generated/code/Magento/Backend/Block/Menu/Interceptor.php(778):
 Magento\Framework\View\Element\AbstractBlock->getCacheKey() #3
 .../htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(1093):
 Magento\Backend\Block\Menu\Interceptor->getCacheKey() #4
 .../htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(660):
 Magento\Framework\View\Element\AbstractBlock->_loadCache() #5
 .../htdocs/generated/code/Magento/Ba in
 .../htdocs/vendor/magento/module-backend/Block/Menu.php on line 233


texts:
After much trouble, we have been trying to upgrade our Magento to version 2.2.5 for a plugin we require to function.
We have ran the upgrade commands and updated to the latest version, however when you go to the front end you are greeted with this error:

https://pastebin.com/GPsja4cP

We are still able to access the admin panel of magento it is just the frontend website.


texts: Save and display ui_component's custom field

texts:
I've added custom text box to source form using below code.

<field name="delivery_time" formElement="input" sortOrder="70">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Delivery Time</label>
            </settings>
</field>

To save this field value I'm observing event controller_action_inventory_populate_source_with_data.

I tried below in observer,

$request = $observer->getEvent()->getRequest();
$requestData = $request->getParam('general', []);
$deliveryTime =  $requestData['delivery_time'];

I tried below code but it's not working,

$request->setParam('delivery_time',$deliveryTime);

$request->setPostValue('delivery_time',$deliveryTime);

I've created new column with delivery_time to table.

None of above is working Any idea ?

Any help will be appreciate. Thanks in advance.


texts:
I want to display the products according to the categories and make them list of all the products related to that category.

So far I have tried using this code:

{{block type="catalog/product_list" category_id="18" template="catalog/product/list.phtml"}}

And in this category there are 10 products.

But the output gives me There are no products matching the selection.

Can anyone please help me to achieve this. Thank you.


texts:
I've create a custom attribute for the customer_address.

It is at backend:

$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
$customerSetup->addAttribute('customer_address', 'my_id', [
    'label' => 'My label',
    'input' => 'text',
    'type' => 'int',
    'source' => '',
    'required' => false,
    'position' => 1000,
    'visible' => false,
    'system' => false,
    'is_used_in_grid' => false,
    'is_visible_in_grid' => false,
    'is_filterable_in_grid' => false,
    'is_searchable_in_grid' => false,
]);
$attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'my_id')
        ->addData([
            'used_in_forms' => ['adminhtml_customer_address']
]);
$attribute->save();

But the textbox is still appears on the forms where Address is.

Why?

I thought this will solve my problem:

'visible' => false,


texts:
when I try to apply coupon code in server its showing 403 forbidden error . But its working on local machine. below the error. please check it.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

     <title>403 Forbidden</title>

Forbidden

You don't have permission to access
     /Amberly/rest/default/V1/carts/mine/coupons/AMBIBSBHTTP
      on this server.

Additionally, a 403 Forbidden
       error was encountered while trying to use an ErrorDocument to handle the request.

how can i solve this issue?.


texts:
define([
    'jquery',
    'domReady!'
], function ($) {
    'use strict';

    /* Form with auto submit feature */
    $('form[data-auto-submit="true"]').submit();
});

I am getting undefined error


texts:
On checkout page spinner spins continuously and unable to do checkout process

I have used magento 2.2 and created custom theme

In my theme i have magento_theme, web, media, etc folders and composer.json, theme.xml and registration.php files.

Can anybody help me.


texts: How to count the number of rows and insert if not or update in magento 2?

texts:
I have counted the total number of rows in Magento. But, i have to set a condition that if no records found need to insert if it is there have to update. how to check this?

public function execute(){

      $params = (array)$this->getRequest()->getPost();

     $collection_count = $this->_doccountfactory->create()->getCollection()->count();
     echo $collection_count;

     if($collection_count>1){

     }
}


texts: How to change field order in checkout and change label names

texts:
I need to change magento 2 checkout field order and rename existing input field labels in default shipping address form.
How can I change field order in checkout page?
I've tried from editing checkout_index_index.xml but have no luck. I need to change order fields like Name company, Street address, City. Have no luck with checkout_index_index.xml  and also I couldn't find some fields like zip code, city fields in xml file.
Is there any way for me to change the order and rename fields?
my checkout_index_index.xml file is pasted below. Can someone help me?
xml file here
Update
I've renamed the corresponding labels using inline translation. (uing csv files per locale). I've put en_US.csv and en_GB.csv files with following content and following locations.
Locations
app/design/<custom_vendor_name>/<custom_theme-Name>/Magento_Checkout/i18n/en_US.csv

app/design/<custom_vendor_name>/<custom_theme-Name>/Magento_Theme//i18n/en_US.csv

app/design/<custom_vendor_name>/<custom_theme-Name>/i18n/en_US.csv

Content
State/Province,County
"Zip/Postal Code","Post Code"
"State/Province","County"
Zip/Postal Code,Post Code


texts: Magento 1.9.2.3 deadlocks from core_cache table

texts:
We have deployed the site in ELB with 2 instance and cache & session are stored in Database, but we often getting deadlock issue in core_cache table

a:4:{i:0;s:469:"SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO core_cache (
                    `id`,
                    `data`,
                    `create_time`,
                    `update_time`,
                    `expire_time`)
                VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE
                    `data`=VALUES(`data`),
                    `expire_time`=VALUES(`expire_time`)";i:1;s:827:"#0 /var/app/current/citygoo/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_exe$

#1 /var/app/current/citygoo/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/app/current/citygoo/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/app/current/citygoo/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO cor...', Array)
#4 /var/app/current/citygoo/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO cor...', Array)
#5 /var/app/current/citygoo/lib/Varien/Cache/Backend/Database.php(211): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO cor...', Array)
#6 /var/app/current/citygoo/lib/Zend/Cache/Core.php(390): Varien_Cache_Backend_Database->save('";s:3:"url";s:34:"/api/rest/v3/pentalog/reservations";s:11:"script_name"$

We are facing this issue in Production, please help us.

Hosted in AWS


texts: Magento 1.9 - JS block content of above-the-fold

texts:
My site with Magento in PageSpeed of Google is not fast. My problem is with code of JS and CSS because block content above the fold. I try to:

- add async parameter to js/css files in xml
- add defer parameter to js/css files in xml
- insert "ExpiresByType text/javascript "access plus 1 month"" in .htaccess
- insert "ExpiresByType text/css "access plus 1 month""
- Merge JS and CSS files

All this without results. At this point, what could I do now?

Thanks for any help


texts: Different Title for Product view pages and other pages

texts:
I need to have output in a way that all the other pages should get the default title but for product detail page I need a specific title.For this so far I tried adding this code

<?php echo $this->getLayout()->getBlock('head')->getTitle();?>
-->>This is for common title
<?php if(Mage::registry('current_product')) ?>

<?php echo "Feaured Products";?>
-->>this if for product detail page title.
<?php endif; ?>

but doing in this way crashing my page.


texts:
I need to redirect to ('hello/Test/Customer') page but observer is not working.

<?php
namespace SimpleMagento\Custom\Observer;

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

class Addinfo implements ObserverInterface
{
    protected $redirect;
    protected $url;
    protected $responseFactory;

    public function __construct(
        \Magento\Framework\UrlInterface $url,
        \Magento\Framework\App\Response\Http $redirect,
        \Magento\Framework\App\ResponseFactory $responseFactory
    ) {
        $this->url = $url;
        $this->redirect = $redirect;
        $this->_responseFactory=$responseFactory;
    }

    /**
     *
     *
     * @param Observer $observer
     */
    public function execute(Observer $observer)
    {
        $customRedirectionUrl = $this->url->getUrl('hello/Test/Customer');
        $this->_responseFactory->create()->setRedirect($customRedirectionUrl)->sendResponse();
        die();
    }
}


texts: Magento 2: Show out-of-stock products in search results?

texts:
We have disabled out-of-stock products from showing on the frontend, but would like to override this for search results only.

How would we accomplish this?

Note: this store has thousands of products that go in and out of stock regularly. We need them to reappear in the catalog when they're back in stock, but always be visible in the search results.


texts: Product collection shows out of stock configurable products

texts:
I made this query to show related products by Manufacturer.

It works perfectly with simple products, but it shows configurable products that are not available.

I would like to show only available configurable products in that list.

$manu = $product->getManufacturer();
            $brand_name = $product->getAttributeText('manufacturer');
            $brand = Mage::getSingleton('catalog/product')
                ->getCollection()
                ->addAttributeToSelect('*')
                ->addAttributeToFilter('visibility', array(
                    Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
                    Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
                ))
                ->addAttributeToFilter('manufacturer', $manu)
                ->addAttributeToFilter('is_in_stock', 1)
                ->addAttributeToFilter('qty', array("gt" => 0))
                ->addAttributeToFilter('status', 1)
                ->setOrder('updated_at','DESC')
                ->setPageSize(5);
            Mage::getModel('cataloginventory/stock')->addInStockFilterToCollection($brand);

            if ($product) {
                $brand->addAttributeToFilter('entity_id', array(
                        'neq' => Mage::registry('current_product')->getId())
                );
            }


texts: Please set available and/or protected paths list(s) before validation. | Create sitemap

texts:
I'm trying to create a Google Sitemap through: Catalog > Google Sitemap.

Filename: sitemap.xml
Path: /sitemap
Store View: Nederlands

(I have two store views).

The path /sitemap is writable (chmod -R 777).

The problem is when I want to save & generate I get the following error:

Please set available and/or protected paths list(s) before validation.

Trace:
#0 /home/company/domains/companyit.be/public_html/app/code/core/Mage/Adminhtml/controllers/SitemapController.php(138): Mage_Core_Model_File_Validator_AvailablePath->isValid('/sitemap/sitema...')
#1 /home/company/domains/companyit.be/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_SitemapController->saveAction()
#2 /home/company/domains/companyit.be/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('save')
#3 /home/company/domains/companyit.be/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#4 /home/company/domains/companyit.be/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#5 /home/company/domains/companyit.be/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#6 /home/company/domains/companyit.be/public_html/index.php(87): Mage::run('', 'store')
#7 {main}

UPDATE :

In my app/local/Mage folder I have the following: (no configuration files)


texts:
Magento 2

After running: grunt clean and then grunt exec:myTheme I get the following

error: >> [InvalidArgumentException]

There are no commands defined in the "dev:source-theme" namespace.
Exited with code: 1.

Warning: Task "exec:myTheme" failed. Use --force to continue.

Anyone know what this could relate to?


texts: Facing error when importing virtual product in magento2

texts:
I want to import virtual product when i was importing catalog_product.csv it's giving me below error:

1.Data validation failed. Please fix the following errors and upload the file again.
2.Options for downloadable products not found in row(s): 1


texts: Circular dependency: CustomerGroupPlugin depends on Model\Authorization\CustomerSessionUserContext

texts:
Circular dependency: Magento\SharedCatalog\Plugin\Source\CustomerGroupPlugin depends on Magento\Customer\Model\Authorization\CustomerSessionUserContext and vice versa. {"report_id":"eae0559822ca428b0a16dd3994d1d4290adc372c6b21381970c5fb48ed31cecf","exception":"[object] (LogicException(code: 0): Circular dependency: Magento\SharedCatalog\Plugin\Source\CustomerGroupPlugin depends on Magento\Customer\Model\Authorization\CustomerSessionUserContext and vice versa.

I am getting the above error after installing b2b extension for the magento2 commerce edition while hitting any of the URL in the front store


texts: How to manually change/limit the amount of order items in the shopping cart?

texts:
How can I manually change/limit the amount of order items in the shopping cart?

For instance, the max items for France is 120, Switzerland is 12, while the rest of available countries is 60.

This is the input field for getting the total order from the cart's session.

<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>"/>

Below is what I am currently doing but it does not effect the number of $this->getQty()

<?php if($shippingCountry === 'FR' || $shippingCountry === 'MC' || $shippingCountry === null):?>120<?php elseif($shippingCountry === 'CH'):?>12<?php else:?>60<?php endif;?>

I still get 120 for Switzerland for instance with $this->getQty() but it should be 12.

is it possible to change that?


texts: Optimize Magento Cached Images (Magento 1.9) extension Kraken

texts: I have my product images optimized very well, but magento cached images are very poor and larger (already cleared cache, it's what magento is doing to the optimized images which is making them larger). I have tried Kraken.io's plugin but it's so resource hungry and slows down page load for some reason on the front end more than it's worth because it is auto-optimizing images. Is there an alternative extension out there that will let me just optimize the cached images once in a while? I'd prefer Kraken's API as I already have a (paid) account with them, but I don't want anything automated, I'd rather do that myself when the website is not busy to reduce server load. Alternatively, would there be any issues with just downloading the cached directory now and again, optimizing it and re-uploading it to the server?


texts: how to override a Core Customer Model in a local module in magento 1.9.2

texts:
I am try to override Function public function validate() in app/code/core/Mage/Customer/Model/Customer.php

To Restrict user registration by email domain i can do this by change directly in Function public function validate() in app/code/core/Mage/Customer/Model/Customer.php but I need to override it in codepool.

With Creating module in codepool :

  /app/code/local/Codefire/Customer/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Codefire_Customer>
            <version>0.1</version>
        </Codefire_Customer>
    </modules>
    <global>
       <models>
          <customer>
              <rewrite>
                  <customer>Codefire_Customer_Model_Customer</customer>
              </rewrite>
          </customer>
       </models>
    </global>
</config>

  /app/etc/modules/Codefire_Customer.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Codefire_Customer>
            <active>true</active>
            <codepool>local</codepool>
        </Codefire_Customer>
    </modules>
</config>

  /app/code/local/Codefire/Customer/Model/Customer.php

<?php
/**
 * Overrite Customer model
 */

class Codefire_Customer_Model_Customer extends Mage_Customer_Model_Customer{

    /**
     * Validate customer attribute values.
     *
     * @return bool
     */
    public function validate() {
     echo 'I am here'; die;
   }

I need call this function when do new registration.


texts: How to set default value to magento short description?

texts:
Currently my store has around 20000+ products. And each product's short description section contains product title at this moment.

I want to replace every product's short description section with following image instead of product title.

How to bulk replace above image code to magento product Short description section?


texts: How to avoid js issue after installing new modules

texts: Although var $j = jQuery.noConflict(); is included in the head, installing new module can make js problem in other 3rd-party module. How to avoid this?


texts: Magento products disappear from Category

texts:
We're having an issue with usually just one product disappearing from a category in Magento.

We will add products to a category, and they will be there, and then when we get a lot of traffic, one item will disappear.

I traced the sql that pulls the products on the category page:

SELECT 1 AS `status`, `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`
, `cat_index`.`position` AS `cat_index_position`, `e`.`name`, `e`.`short_description`
, `e`.`price`, `e`.`special_price`, `e`.`special_from_date`, `e`.`special_to_date`
, `e`.`small_image`, `e`.`thumbnail`, `e`.`news_from_date`, `e`.`news_to_date`
, `e`.`tax_class_id`, `e`.`url_key`, `e`.`required_options`, `e`.`image_label`
, `e`.`small_image_label`, `e`.`thumbnail_label`, `e`.`price_type`, `e`.`weight_type`
, `e`.`price_view`, `e`.`shipment_type`, `e`.`links_purchased_separately`
, `e`.`links_exist`, `e`.`is_imported`, `e`.`ugiftcert_amount_config`
, `e`.`msrp_enabled`, `e`.`msrp_display_actual_price_type`, `e`.`msrp`
, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`
, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`
FROM `catalog_product_flat_1` AS `e`
    INNER JOIN `catalog_category_product_index` AS `cat_index`
        ON cat_index.product_id=e.entity_id AND cat_index.store_id=1
            AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '908'
            AND cat_index.is_parent=1
    INNER JOIN `catalog_product_index_price` AS `price_index`
        ON price_index.entity_id = e.entity_id AND price_index.website_id = '1'
        AND price_index.customer_group_id = 0
ORDER BY `cat_index_position` ASC, `cat_index`.`position` ASC LIMIT 99

I exported the data from those three tables when I saw a product missing, and the product was in catalog_product_flat_1 and catalog_category_product_index, but was not in catalog_product_index_price.

The way I fix this is just by saving the product in the back end, which fixes the table, and product shows in Category.

So obviously this is an indexing issue. I am having trouble tracking down where catalog_product_index_price gets updated and/or created? And also what causes the reindex?

I found this post: Magento EE: Missing products in catalog_product_index_price But that is for configurable products, the ones that disappear for me are simple.

Any help would be greatly appreciated. Thanks!


texts: Magento catalog index.php/admin/catalog_product/ page displays blank

texts:
When I log into the backend and navigate to Catalogue > Manage Product everything is working fine. When I click on a product I get a blank page, with a link to 'Create new video' and 'Add an attribute'.

Our setup is: ubuntu 12.04, nginx php5-fpm and varnish.

My nginx log is displaying this error:

  *6711 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Call to a member function __toString() on a non-object in
  /var/www/clients/client1/web2/web/app/Mage.php on line 859" while
  reading response header from upstream, client: 82.71.243.141, server:
  www.example.com, request: "GET
  /index.php/admin/catalog_product/edit/id/801/key/918d6b60004194117d8783613d066922/
  HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web2.sock:",
  host: "www.example.com", referrer:
  "https://www.example.com/index.php/admin/catalog_product/index/key/bcc1f51a9f74e1f425be8d93903f0949/"

Can anyone help with problem as I'm really stuck?


texts: magento2 phtml image productpage location luma theme

texts:
which file in magento 2 controls the img alt description for the productpage?

i already looked at:

magento_root_directory/vendor/magento/module-catalog/view/frontend/templates/product/image.phtml
magento_root_directory/vendor/magento/module-catalog/view/frontend/templates/product/gallery.phtml
magento_root_directory/vendor/magento/module-catalog/view/frontend/templates/product/image_with_borders.phtml

But they don't control the img alt on the productpage.
My image code starts with:
<img class="fotorama__img magnify-opaque" aria-hidden="false" id="magnifier-item-0" ...


texts: Magento 2: Why my static content for languages are not generated after migration?

texts:
I made a backup of Magento 2 and copied the whole site to another host. I extracted files and created a database. Now I get no CSS loaded. They all are "missing".

First I thought that it was caching or rewrite module problem, but now I found that if I deploy the static content, only en_US is deployed, although my default is ru_RU (this is where the CSS files are attempted to be loaded from).


texts: Is there an API for retrieving information about search terms (e.g. zero-result searches, etc)?

texts:
Couldn't find any information on this. Only v1/search, but that seems to be for simulating searches on the site.

I'm wondering if there is a way (outside of using Google Analytics) to retrieve the search terms in the dashboard.. i.e. 'Top Search Terms', 'Last Search Terms' etc..


texts: How to retrieve data from generated block

texts:
On catalog page there is a block that adds paging navigation - Mage_Page_Block_Html_Pager. It has very useful methods - getPreviousPageUrl and getNextPageUrl.

Is there any way to get values from these functions outside of this block scope, without recreating it second time?


texts: Magento Custom Collection breaks Admin grid

texts:
I do have following code below for a Grid in Admin

protected function _prepareCollection()
{
    $pimage_collection = new Varien_Data_Collection();
    $pimage_array = array();

    $product_collection = Mage::getModel('catalog/product')->getCollection();

    foreach($product_collection as $product) {

        $prod =  Mage::getModel('catalog/product')->load($product->getId());

        foreach ($prod->getMediaGalleryImages() as $image) {
            $pimage_object = new Varien_Object();
            $pimage_object->setData('id',$prod->getData('entity_id').'-'.$image->getData('id'));
            $pimage_object->setData('product_name',$prod->getData('name'));
            $pimage_object->setData('image_path',$image->getData('file'));
            $pimage_object->setData('label',$image->getData('label'));
            $pimage_array[] = $pimage_object->getData('id');
            $pimage_collection->addItem($pimage_object);
        }
    }

    $this->setCollection($pimage_collection);

    return parent::_prepareCollection();
}

Now what I want there is to create a grid showing all the images of all products in my catalog.

It seems to work fine as it show all the images already and all the products.

But it breaks the pagination. How can i fix this?


texts: How do I get a list of all class rewrites?

texts:
Is there a way to list all rewrites and maybe other potential conflicts besides reviewing all configuration files? I have to analyse some projects with lots of extensions and custom modifications and would like to automate as much as possible of this.

The most important thing is to detect extensions that rewrite the same class, but I'd like to have a list of all rewrites in place too, to keep an overview. At the moment I maintain this list manually in a spreadsheet.

I found this extension ("Extension Conflict") on Magento Connect but judging by the reviews and release notes it seems to be outdated.


texts: Magento2.1.5: Login and registration form on login page

texts:
Is there any way to show both forms login and Registration on the login page?

  http://example.com/customer/account/login/

Which .xml layout I need to overwrite. I have done many searches on google for this but can't get a solution.


texts: How to get the product list data through magento 2 API

texts: when i am calling API through Postman. Only sku, position and category id is coming but How i want more detail like product name price and other details


texts: Authorize.net payment failes but order created anyway

texts:
When authorize.net payment fails - order still being generated(with status cancelled but anyway). How to prevent this?

They do it with two different calls. First - create order, then - request to authorize. Why?

In Magento1 this was in one function with try-catch. And on error - transaction with order just rolled back


texts: How to add custom field in catalog price rule and cart price rule?

texts:
I've custom module of banner.

I want to add banner id as drop-down in price rules to select as custom field.

When, I select banner Id during sales rule then the particular banner must be activated on the website.

How can I do?


texts: multiple session of httpd and Mysql connection

texts:
we have started using magento for one of our store,
each time we test the site with ab(Apache bench-marking) testing tool,
and it we set concurrent users as 20,
magento starts 20 sessions on httpd and 20 connection in MySQL

is this behavior normal ?


texts:
I have wrote the pagination functionality,in the below code i set the pagination 4 for each page,but unfortunately i got all the records in first page itself,and even the second page also the entire records display, the only good thing is page size is working fine(i means page count). see the below code for better understanding.

block file code

class Federallawyer_Flpackage_Block_List extends Mage_Core_Block_Template {

    public function __construct() {
        parent::__construct();
        $collection =  Mage::getModel('flpackage/packages')->PackageCollection();
        //$collection->getSelect()->limit(4);
        //echo $collection->getSelect()->__toString(); exit;
        $this->setCollection($collection);
    }

    public function getPagerHtml() {
        return $this->getChildHtml('pager');
    }

    protected function _prepareLayout() {
        parent::_prepareLayout();
        $pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
        $pager->setAvailableLimit(array(4=>4)); //Now you can get 4 items in a page.
        $pager->setCollection($this->getCollection());
        $this->setChild('pager', $pager);
        $this->getCollection()->load();
        return $this;
    }
}

see the attached screens


texts: Sales Order Grid Set Predefined filter of 30 days

texts:
I need to set predefined filter on Purchase Date on 30 days from current date and load the orders for that filter only. Any time should be able to load all orders if we remove the filter
I tried filterUrlParams as in image attached,but this only shows the collected with the filter data mentioned above,and it will not satify my case.
Can anyone help in finding the solution.

  [1]: https://i.stack.imgur.com/ZKUt7.png


texts:
This is my first question, I'm sorry if this problem has been solved or if I am doing anything wrong.

My problem is that every time I try to activate an extension, in Extension Manager,  i get the error:

  [ErrorException]

  chdir(): Permission denied (errno 13)

I am not sure what directory that needs permission?
Thank you

EDIT:
I am posting this here, because it is not only 1 extension, but all extensions that give this error


texts: Magento 2.3 sortOrders not working in search rest API

texts:
I tried to pass sort order in V1/search API as below but the sorting is not working in the result.

searchCriteria[sortOrders][0][field]=price
searchCriteria[sortOrders][0][direction]=DESC

Anyone has idea for the same?


texts: Map primary colour with multiple supplier colours

texts:
I am currently working for large retailer's Magento project. Retailer has two colour attributes. One is for primary colour and second one is for supplier colour which is actually acts as separate sku (simple) on configurable product view page.

We have created two attributes. primary_colour which is filterable, and supplier_colour which is configurable.

It is hard for client to manage huge number of supplier colours. So they want to map their primary colour attributes with supplier colour attributes. E.g. blue maps to Navy Blue and Sky Blue

Challenge 1:
Now client want to show colour swatches for both attributes however want to show same swatch for supplier_colour as primary colour one. As they dont want to create hundreds of swatches for different supplier colours which are same but named differently by different suppliers

Challenge 2:
When customer choose pimary colour from LHS layered navigation, then configurable product change its image to corresponding mapped supplier colour (It is quite easy if we use same configurable attribute (supplier colour) in layered navigation. However we have two separate attributes)

I am wondering if someone shed some light on this particular scenario. What is the best approach to achieve it.


texts:
I have a traditional slider on the homepage and I need one of the slides to link to a list of products that contain the same attribute. In this case I have a manufacturer called Zodiac that goes by the ID 17 and I need the link to go to the products made by such brand. I need to add the link in the backend so I cannot use php, I just have a text input to fill it in. How is the best way to do this?

I tried this:

{{config path="web/secure/base_url"}}catalogsearch/result/index?manufacturer=17

But didn't work


texts: Magento Case Sensitive addFieldToFilter search result

texts:
How to get case sensitive search result using addFieldToFilter() of collection object in magento.

I want to get search result based on case sensitive search results.
Like ABCDE12 is not equal to ABCde12.
I am trying to get case sensitive search result from collection.

$couponCode = 'ABCde12';
$getCoupon = $this->couponFactory->create()->getCollection()
                ->addFieldToSelect(array('coupon_code','description'))
                ->addFieldToFilter('coupon_code',array('eq' => $couponCode))->getFirstItem();

In database ABCde12 and ABCDE12 both entry are created.
I just want to fetch case sensitive record from table.

Any help would be Appreciated.


texts: Magento 2 Custom command Area Code note set exception

texts:
I have created a command for my module which calls a class Model/Importer from https://github.com/firegento/FireGento_FastSimpleImport2 extension. but i think it requires admin session.

I have tried to add area code by referring  to this  question 'Area code not set' issue in custom CLI commands in Magento 2

But still after clearing everything from var folder, i am getting the same exception.


texts: MAGENTO - Specific characters (Thai Alphabet) are not always displayed properly

texts:
I am faced to a problem I can't undertand and can't fix.
My website, an online supermarket develo) has two different languages English and Thai
Products name are in both language and we've also start to translate all english descritpion in Thai. Then the problem appears:

On the Product page in Thai view, everything is fine http://delishop.co.th/home/groceries/pasta-dry-food/couscous-epices/
But When we navigate in a category in grid view the Thai characters are not displayed well : http://delishop.co.th/home/groceries/pasta-dry-food/?___from_store=default&___store=thai&mode=list

In the DB all characters are properly displayed.
Do you know what I should do to fix this problem ?

Thanks for your help!


texts: container after instruction doesn't work for some elements

texts:
I have created a custom theme from scratch, everything works perfectly except one thing, in my home page

Vendor/Theme/Magento_Theme/layout/default.xml

I can't place my 'main' container after my 'header' container

Here is the code:

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <container name="header.container.panel.nav" htmlTag="header" before="main.content">
            //Some stuff
        </container>
        <container name="main.content" htmlTag="main" after="header.container.panel.nav">
            //Some stuff
        </container>
    </body>
</page>

What I have tried:

Using dash instead of container name in the before and after instruction
Moving the definition of the main.content container before header
adding

<move element="main.content" destination="body" after="header.container.panel.nav"/>

Even if I'm not sure that the instruction destination="body" work as intended.


texts: Change "add to cart" text for not registered users

texts:
What the best way to change text add to cart only for not registered users?

Documentation recommend change dictionary file. https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/translations/translate_practice.html but this solution works for all users
Create some plugin/observer for Magento\Framework\Phrase\Renderer\Translate.


texts: Magento/SOAP API needs to delimit street 1 and street 2 in sales order

texts:
As per SOAP API need we want's to delimit street into street 1 and street 2 fields for result.

I have override info method of Mage_Sales_Model_Order_Api Class

    public function info($orderIncrementId)
    {

        $result = parent::info($orderIncrementId);
        $order = $this->_initOrder($orderIncrementId);

        $streetLines = $order->getBillingAddress()->getStreet();
       // unset($result['billing_address']['street']);
        foreach ($streetLines as $i=>$line) {
            $result['billing_address']['address_street'.($i+1)] = $line;
        }

        $streetLines1 = $order->getShippingAddress()->getStreet();
       // unset($result['shipping_address']['street']);
        foreach ($streetLines1 as $i=>$line) {
            $result['shipping_address']['address_street'.($i+1)] = $line;
        }

        return $result;
    }

And also added below code in wsdl.xml of custom module in local

<?xml version="1.0" encoding="UTF-8"?>
<definitions>
    <types>
        <schema>
              <complexType name="salesOrderAddressEntity">
                <all>
                     <element name="address_street1" type="xsd:string" minOccurs="0" />
                     <element name="address_street2" type="xsd:string" minOccurs="0" />
                </all>
            </complexType>
            </schema>
        </types>
</definitions>

Also below code in wsi.xml in custom module

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             name="{{var wsdl.name}}"
             targetNamespace="urn:{{var wsdl.name}}">
        <wsdl:types>
            <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
                  <xsd:complexType name="salesOrderAddressEntity">
                    <xsd:sequence>
                          <xsd:element name="address_street1" type="xsd:string" minOccurs="0" />
                      <xsd:element name="address_street2" type="xsd:string" minOccurs="0" />
                    </xsd:sequence>
                </xsd:complexType>
                </xsd:schema>
        </wsdl:types>
 </wsdl:definitions>

Below code in api2.xml:

<?xml version="1.0"?>
<config>
    <api2>
      <resources>
            <order translate="title" module="api2">
                <attributes   module="api2">
                  <order_type>Order Type</order_type>
                </attributes>
            </order>
             <order_address translate="title" module="api2">
                <attributes translate=" address_street1 address_street2 "   module="api2">
                     <address_street1>Street1</address_street1>
                 <address_street2>Street2</address_street2>
                </attributes>
             </order_address>
        </resources>
   </api2>
</config>

Is anything else i need to modify to show street as street1 & street2 in result of API method salesOrderInfo?

If I print $result in info(), it is showing street1 & street2 field values in shipping_address and billing_address array, but when I print SOAP API response then it is not displaying it's value.


texts: How to call custom attribute value from back-end code in Magento

texts:
I have create a custom attribute call manufacturer_email from the backend and assign the values for the products.

The main reason for this is i need to fire an email to its manufacturer when an customer place a order through the web site. I found the observe for this and also how to  fire the email.

The problem is the custom attribute returns an empty result without the email address.
can anyone tell me how to get the value for this attribute???

Backend Code

public function logUpdate(Varien_Event_Observer $observer)
{
  $order = $observer->getOrder();

  $email_stacks = array();
  foreach ($order->getAllItems() as $item)
  {
     // only add simple products to email, not a configurable product for example
     if ($item->getData('product_type')!=Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)
        continue;

     $manufacturer = $item->getData('manufacturer_email');
     $sku = $item->getData('sku');
     Mage::log(" {$manufacturer} and {$sku} updated", null, 'manufacturer-email.log');

Result

2014-09-08T12:35:32+00:00 DEBUG (7):   and SKU5001 updated

Attribute and inputs


texts:
I have to update 50000 stock levels from a csv file.  I am running 2 SQL queries.  One to obtain the productID from an EAN barcode and the other to update the stock.  When iterating through a small batch of 1000 this completes in approx 1 second. When trying to run the full update (which I thought would run for approx 50 seconds) it runs for minutes until the server times out.

Is there any way I can optimise the sql or code?

The following 2 functions perform the update.

function _getIdFromEAN($ean){
    global $conn;
    global $db;

    //Get product id from EAN
        $sql            = "SELECT entity_id FROM ".$db['pref']."catalog_product_entity_varchar WHERE attribute_id = 147 AND value = ". $ean;

        if ($result = $conn->query($sql)):

        if ($result->num_rows):
            $row = $result->fetch_assoc();
            return $row['entity_id'];
        endif;
    endif;

    return false;

}

function _updateStocks($data){

    global $conn;
    global $db;

        $ean                    = $data[0];
    $newStockQty        = $data[1] <= MIN_STOCK_LEVEL ? 0 : $data[1];
    $isInStock          = $newStockQty > 0 ? 1 : 0;

        $productId              = _getIdFromEAN($ean);

    if ($productId):

        $sql                    = "UPDATE ".$db['pref']."cataloginventory_stock_item csi,
                                           ".$db['pref']."cataloginventory_stock_status css
                    SET csi.is_in_stock = ".$isInStock.", csi.qty = ".$newStockQty."
                    WHERE csi.product_id = ".$productId ." AND csi.product_id = css.product_id";

            if ($result = $conn->query($sql)):
            return true;
        endif;

    endif;

    return false;

}


texts: Magento 2.2.8 | setup:static-content:deploy gives errors | Cannot read contents from file jquery.fileupload-ui.css No such file or directory

texts:
I can't deploy static content on my production site. Running command:

php bin/magento setup:static-content:deploy en_GB

Gives me following error:

  [Magento\Framework\Exception\FileSystemException]   Cannot read
  contents from file
  "magento2/http/pub/static/adminhtml/Magento/backend/en_US/Magento_ConfigurableProduct/product/product.css"
  Warning!file_get_contents(magento2/http/pub/static/adminhtml/Magento/backend/en_US/Magento_ConfigurableProduct/product/product.css):
  failed to open stream: No such file or directory

For some reason, when not specifying the locale, it went through fine.

What could be causing the problem?

UPDATE:

The file permission of the aforementioned file looks a bit weird?

lrwxrwxrwx 1 xxx xxx  113 May  8 15:08 product.css -> magento2/http/vendor/magento/module-configurable-product/view/adminhtml/web/product/product.css

UPDATE 2:

Found out that this is a symlink that points to a file somewhere else on my server. These are the file permissions of the file where the symlink is pointing to:

-rw-r--r-- 1 xxx xxx 3863 May  7 06:35 product.css

Should I change these file permissions? If so, what would I changed them to to keep me site secure?


texts: Magento 2 - Import works but take toooo long - Any thoughts?

texts:
I have to import more than 100k products to my store, I have split the CSV files and I'm importing one by one (each one has about 1000 lines).

It is working, but for each file takes about 1 hour and 30 minutes.

Is there anything that I could do to speed it up?

Cloud Server:

CPU 4 vCPUs
RAM 4 GB
System Disk 80 GB
CentOS 7 (PVHVM)

Performance when importing: (You can see that the platform is not using all the resources in the server)

Ram 1.1 GB of 3.5 GB

CPUs 37%

Top 2 processes in execution and RAM usage while importing.

mysqld - 318.3 MB

httpd - 156.9 MB


texts:
Upgraded magento 1.8 to 1.9.2.2 and having this error:

  Package community/Lib_Varien 1.9.2.2 depends on PHP extensions: Array

Anyone could know how solve this ? What Exactly need to be done? Also I'm installing the upgrade on root httpdoc/ is it the correct root?


texts: Custom popup message while add to compare on product list page

texts:
while add to compare on product listing page I want to add a popup for success message instead of Magento 2 default success message.

Help would be appreciated.


texts:
I've been noticing the Magento cron job running for over 10 hours now. An strace only shows polls. However I do see the following query running

SELECT
    `e`.*, `at_visibility`.`value` AS `visibility`
FROM
    `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_entity_int` AS `at_visibility` ON (
    `at_visibility`.`entity_id` = `e`.`entity_id`
)
AND (
    `at_visibility`.`attribute_id` = '95'
)
AND (`at_visibility`.`store_id` = 0)
WHERE
    (at_visibility. VALUE = '4')
LIMIT 10 OFFSET 329420

Any ideas what Magento is doing right now? How can I debug this further?


texts: magento2 knockoutjs custom ship-to template binding

texts:
There are some questions need your help.

Could you explain the following code?
Can any one have idea how address() object works?
At least Where can I find definition of address()?

            <button class="action action-edit" data-bind="click: back">

            </button>

            <button class="action action-edit" data-bind="click: backToShippingMethod">

            </button>

,


texts: Add item from another page to checkout in Magento 1.9.x

texts:
I have a singlepage (php) with any items (loaded in Magento), the idea is:

The user access to singlepage.magentodomain.com.
User press click on "buy now".
User sees the magento checkout page, with item selected.

The HTML can contain the ID product and send it to Magento from HTTP verbs (POST, GET, etc.) or something else, but I not found information about this.

My Magento version is: 1.9.2.4.

Update (2016-03-9)

I found the next questions:

Magento 1.9.0.1 add a product to the cart by URL? - Magento Stack Exchange
magento 1.9 - Unable to add product in cart with custom option via querystring - Magento Stack Exchange
Adding a Product to the Cart via Querystring using SKU in magento 1.9 - Magento Stack Exchange
How can I call a block method from a script file? - Magento Stack Exchange

Based on this and @St0iK's answer, I developed the following:

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

$_product = Mage::getModel('catalog/product')->load(11);
$formKey = Mage::getSingleton('core/session')->getFormKey();

The next code get the "submit url":

Option 1

$submitUrl = Mage::app()
                ->getLayout()
                ->createBlock('catalog/product_view')
                ->getSubmitUrl($_product);

Option 2

$submitUrl = Mage::helper('checkout/cart')->getAddUrl($_product);

HTML

<form action="<?php echo $submitUrl; ?>" method="post">
    <input type="hidden" name="related_product" id="related-products-field" value=""/>
    <input type="hidden" name="form_key" value="<?php echo $formKey; ?>">
    <input type="hidden" name="product" value="11">
    <input type="hidden" name="qty" value="1">
    <button type="submit">Buy now</button>
</form>

Request information (after submit)

Request URL: http://domain.dev/checkout/cart/add/uenc/aHR0cDovL21kci5kZXYvc2luZ2xlLnBocA,,/product/11/form_key/Md2JmzgTZLzWiX9l/
Request Method: POST
Status Code: 302 Found
Remote Address: 127.0.53.53:80
Response Headers
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Keep-Alive
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Date: Wed, 09 Mar 2016 16:21:29 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=100
Location: http://domain.dev/checkout/cart/
Pragma: no-cache
Server: Apache/2.4.12 (Ubuntu)
Set-Cookie: frontend=5umonnllqprpt57a6vd6lapvb2; expires=Wed, 09-Mar-2016 17:21:30 GMT; Max-Age=3600; path=/; domain=domain.dev; HttpOnly
X-Frame-Options: SAMEORIGIN
Request Headers
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: es-ES,es;q=0.8,en;q=0.6
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 59
Content-Type: application/x-www-form-urlencoded
Cookie: __atuvc=17%7C10; PHPSESSID=cn17rnrbf1h2va76edb1iqmoq5
Host: domain.dev
Origin: http://domain.dev
Pragma: no-cache
Referer: http://domain.dev/single.php
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36
Form Data
related_product:
form_key: Md2JmzgTZLzWiX9l
product: 11
qty: 1


texts:
How to hide notification messages like success message after adding product to cart or any error messages or notices after few seconds after they appear on the the frontend using knockout js.

Example : When I am adding a product in the cart, a success message appear saying "product has been added to your cart". I want to hide this success message after 5 seconds after it appear on the screen.


texts: How to get pricing_value for Super Attribute Option

texts:
Somehow I can't figure out how to get the pricing values for a configurable  product's super attribute options.

Currently I have an array of attribute id and attribute option id which looks like this:

2013-08-24T15:35:01+00:00 DEBUG (7): Array Combination :Array
(
    [135] => 3
    [139] => 19
    [138] => 6
    [140] => 20
    [141] => 22
    [142] => 24
    [143] => 26
    [144] => 28
    [145] => 34
)

Now I want to calculate the total price for the configurable product with all the super attributes additional prices added.

I spend hours looking through the configurable product templates and javascript and still haven't figured out how the new price is calculated.

Through this link http://www.ayasoftware.com/content/magento-update-fly-super-product-attributes-configuration I figured out how to get the configurable options for my product. The data also contains a field "price_value" for each attribute option, but I totally don't know how to simply access the right object values.

I would love to just do something like:

$price = $configurableProductBasePrice;

foreach ($attributeCombination as $attribute => attributeOption)
{
   $attributeOptionPrice = $attribute->getAttributeOption($attributeOption)->getPrice();

   $price = $price + $attributeOptionPrice;
}

Thanks in advance for every hint :)


texts: Display problem for my custom tab in ADD/EDIT product page (admin)

texts:
I have implemented a new tab in the ADD/EDIT product page in admin using this tutorial: http://www.magentothemess.com/archives/1267

It is working, but in the ADD product case, my tab is displayed in the 2 steps:
- the one were you select the product type (generally only 1 tab is displayed called Options)
- the second step were you have all the tabs (general, prices, etc..)

How can I do to display my custom tab only at the second step?

here is my .xml

<layout>

    <adminhtml_catalog_product_new>
        <reference name="product_tabs">
            <action method="addTab">
                <name>Formula_price_tab</name>
                <block>quotemodule/adminhtml_catalog_product_tab</block>
            </action>
        </reference>
    </adminhtml_catalog_product_new>

    <adminhtml_catalog_product_edit>
        <reference name="product_tabs">
            <action method="addTab">
                <name>Formula_price_tab</name>
                <block>quotemodule/adminhtml_catalog_product_tab</block>
            </action>
        </reference>
    </adminhtml_catalog_product_edit>
</layout>


texts: How to make all the filters active in layered navigation?

texts:
By default in Luma theme all the filters come in closed state and to make active all the filters in layered navigation I have tried this solution Open category filters by default in Magento 2 and hopefully got succeed in same.

But Now I see some strange behavior, Like few of filters are active by default and few are in closed state. On different categories it behave differently.

anyone with same problem kindly tell the solution if have any


texts:
In my Carrier class for my custom shipping method, I have tried calling $request->getAllItems() as well as injecting an instance of Magento\Checkout\Model\Session and calling getAllItems as well. All that is returned is an array of empty objects. No matter what I do, they are empty. I am just trying to get the items in the cart to send to our shipping rate service to calculate the rates.

I referred to this as well to guide me: Magento 2 - How to get all items in cart?


texts: Magento 2: how to move shipping-information from order summary to billing-step in checkout?

texts:
How do I move the "Ship to:" and "Shipping Method:" sections from the order summary sidebar into the "Review & Payments" step of the checkout in Magento 2?

I know that as they are UI Components I'm not able to use <move element="" /> as I would with a normal block.


texts: How to override root.phtml template in my custom theme for product view page

texts:
I'd copying root.phtml (from vandor/magento/module-theme/view/base/) in to my theme (app/design/frontend/Vendor/MyTheme/Magento_Theme/templates/root.phtml).
All pages root templates  is override except product page.
I am using Magento v 2.2.2
The Parent theme is "blank".
I will be grateful for help.


texts:
How i can change checkout steps Label in magento 2?
http://prntscr.com/nr9rrr


texts: Error with SOAP API when using a different domain for admin access

texts:
We have configured our Magento installation so that the admin panel is accessible using a different domain from the main website i.e.

admin.thewebsite.com

Accessing the the SOAP API using

www.thewebsite.com/api/v2_soap?wsdl=1

Results in the WSDL being displayed, however the the soap:address location
value in here references the admin.thewebsite.com domain

Which is where the problem lies, as this URL can not be accessed, and simply redirects to the admin panel.

I have switched off the 'Redirect to Base URL' setting in Magento, as suggested in another stack overflow post.

Is there a way to resolve this so Magento does not need to access the admin.thewebsite.com domain for the SOAP API to work?


texts: How to solve confilict with jquery-1.10.2.min.js

texts:
I write a vertical tab in my store home page, and I should use jquery-1.10.2.min.js. but it has confilict with other scripts and somethings showing wrong in store.

DEMO of vertical tab.

How can I fix it?


texts: Magento2 hide custom option from frontend that are used for storing id's

texts:
I have my project in Magento 2.1.3

It requires to have some courses (products), that have some trainings associated to them, each training has some details

like Learner Email
Date of birth
Training Id etc.

In my form I have used the trainingId options as hidden input. But when the values are saved , along with other options the trainingId option is also visible to the user. I want to hide trainingId option along with its value from frontend. Does anyone have any suggestions regarding it?

Thanks


texts: Magento 2.2.5: Error when trying to update any category

texts:
Whenever i try to update anything in a category being: description, design, seo etc. i get greeted with this nice error:

  Element 'referenceBlock': This element is not expected. Expected is one of ( referenceContainer, container, update, move, head, body ).Line: 1

This has only just started appearing for an unknown reason.
I havent updated magento recently since it stopped working. And am on 2.2.5 running php 7.1.


texts: Magento 2: How to implement method _saveSection() of vendor\magento\module-config\Controller\Adminhtml\System\Config\Save.php

texts:
The definition of function says it further checks the method _saveVendorModule in the current class ($this) for custom logic.

Does anyone has used this before to add or override some logic?

/**
 * Custom save logic for section
 *
 * @return void
 */
protected function _saveSection()
{
    $method = '_save' . $this->string->upperCaseWords($this->getRequest()->getParam('section'), '_', '');
    print_r( $method );  //This will print _saveVendorModule
    if (method_exists($this, $method)) {
        $this->{$method}();
    }
}

system.xml

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
        <system>
            <tab id="vendor_module" translate="label" sortOrder="10">
                Vendor Name
            </tab>

                <class>separator-top</class>
                General
                <tab>vendor</tab>
                <resource>Vendor_Module::dimension_configuration</resource>
                <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    General
                    <field id="dimension" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                        Dimension Text
                        <comment>Dimension Text will display on the storefront.</comment>
                        <backend_model>Vendor\Module\Model\Config\Backend\Dimension</backend_model>
                    </field>
                </group>

        </system>
    </config>


texts: Magento 2 : After Data Migration(Indexer issue)

texts:
After successfully migrated from Magento 1.x to 2.x I am getting issues with Indexer, Check below screen.

(I need to Show products on frontend So, re-indexing is must)

Please Help Thanks in Advance.


texts: Easiest way to determine if product is part of a configurable in an observer?

texts:
I am working on some code that makes a call to some azure functions that sync product data to our CRM / Inventory system.  One thing that magento does when an admin user makes a change to a configurable product and saves it is that it fires the save event for the configurable product, as well as all of the child products.

We have configurable products AND simple single products in our store.  I want to avoid making 5 or more calls per product by consolidating the json.

Long story short, is there any built-in way to get if a product is part of a configurable product, and also, is there a way to get if a product is NOT part of a configurable.

My goal is to load all the children of the configurable, combine the json, and make one call to Azure. At the same time I still want those single simple products that aren't configurable to still be able to send.

For instance, I can't filter on $product->getTypeId() !="configurable" or something like that.

FYI I'm using PhpStorm + xdebug to get the job done.

The data I was looking for is found here in this link. Its not the same question though.

Magento 2.0 Get POST data inside Productsaveafter Observer


texts: Images on custom module are not copied on pub/static

texts:
I did a custom module and added a custom css. All worked fine, but this css has some images linked directly like: background-image:url(./img/digit-sm.png);. And obviously has its folder img on the same level.

So I decided to change these path to ./../images/digit-sm.png and put the img folder on (renaming it):

app/code/vendor/module/view/frontend/web/images

The problem is magento can't find these images, but the url is correct:

http://vmagento.box/pub/static/frontend/Magento/luma/es_ES/images/digit-sm.png

So I looked inside this folder and there aren't these images. Why? I tried everything, every command, upgrade, compile, static-deploy, cache and nothing. I need to do something more? How can I indicate magento to copy these files on pub/static?

If I put manually these images everything works like a charm.


texts: How do you set the special_price of product in magento via direct SQL query?

texts:
I need to mass update special price from a CSV File (which tells me the sku, the special price, to/from date).

At the moment I do it using magento models method like this (after parsing the CSV rows) in a foreach loop:

$p = Mage::getModel('catalog/product');
$product_id = $p->getIdBySku($product['SKU']);
if (!$product_id) {
    throw new Exception('Product Does Not Exists');
}
$p->setStoreId($store_id)->load($product_id);
$p->setSpecialPrice(floatval($product['Price']));
$p->setSpecialFromDate($product['FromDate']);
$p->setSpecialFromDateIsFormated(true);
$p->setSpecialToDate($product['ToDate']);
$p->setSpecialToDateIsFormated(true);
$p->save();
$p = null;

This is okay when a handful of product needs updating. However when you update 100+ products, this becomes incredibly slow and it affects the site performance also.

Is there anyway I can mass import special price and also set the dates via a direct SQL Query?

Whilst researching this issue, I have found a possible solution (based on this article http://fishpig.co.uk/magento/tutorials/update-prices-sql) with setting the special_price in the database directly like this:

Note: bd_ is my table prefix

UPDATE bd_catalog_product_entity AS CPE
INNER JOIN bd_catalog_product_entity_decimal AS CPED ON CPED.entity_id = CPE.entity_id
SET CPED.`value` = 2.99 -- New Special Price
WHERE
    CPED.attribute_id = (
        SELECT
            attribute_id
        FROM
            bd_eav_attribute eav
        WHERE
            eav.entity_type_id = 4
        AND eav.attribute_code = 'special_price'
    )
AND CPED.store_id = 1   -- Retail Store
AND CPE.sku = 'ABS049'  -- Sku Being Updated

This appears to be working (i can see the value in magento UI updated). I am not yet sure if this is the correct way to go about setting the special price in the database directly.

Also, I've not yet worked out how to set the from/to dates.

Any help on this will be much appreciated.


texts: Custom module to add a 3rd customer address type

texts:
I'm stumped by the following:

I'm creating a custom storefinder that uses addresses of a 3rd type in the Mage_Customer_Model_Address_Abstract class:

eg:

class Mage_Customer_Model_Address_Abstract extends Mage_Core_Model_Abstract
{
    /**
     * Possible customer address types
     */
    const TYPE_BILLING  = 'billing';
    const TYPE_SHIPPING = 'shipping';
    // add a 3rd
    const TYPE_STOREFINDER = 'storefinder';

However, I'm not sure how exactly this can be done, as it also requires an eav attribute:

I want this option to be available in the admin backend only, by displaying it with a checkbox - here is a quick photoshop:

the file to duplicate and edit for this checkbox and then place in ones module is: design/adminhtml/default/default/customer/tab/addresses.phtml

        <input type="checkbox"  <?php if ($this->isReadonly()):?> disabled="disabled"<?php endif;?> value="<?php echo $_address->getId() ?>" id="address_item_storefinder<?php echo $_address->getId() ?>" name="account[storefinder]" title="<?php echo Mage::helper('customer')->__('Set as Storefinder Address') ?>"<?php if($_address->getId()==$customer->getStorefinderAddress()): ?> checked="checked"<?php endif; ?>/>
        &nbsp;<label for="address_item_storefinder<?php echo $_address->getId() ?>"><?php echo Mage::helper('customer')->__('Default Storefinder Address') ?>

I've created a frontend page block which should then grab all customer addresses of type 'storefinder' and display them on a google map.

-> define $customer->getStorefinderAddress() function - maybe done something like this:

/**
 * Get default customer storefinder address
 *
 * @return Mage_Customer_Model_Address
 */
 public function getStorefinderAddress()
 {
    $addresses = Mage::getResourceModel('customer/address_collection');
    foreach ($addresses as $address) {
      if($address->getAddressType() == 'storefinder') {
         $storefinderaddresses[] = $address;
      }
    }
    return $storefinderaddresses;
 }

I need to know how to:

-> define a 3rd address type and know if the function getStorefinderAddress() work to query these addresses by using:

$address->getAddressType() == 'storefinder'

-> save the value of the added checkbox in the database from the edit customer address in the adminhtml

Alternatively:

I've thought of an alternative way of doing this if adding a 3rd address type is too complex:

add an INT column to the customer/address table which simply stores true/false (0/1) for the checkbox field in the customer/tab/addresses.phtml

...

->addColumn( // Alter table to add column

    $installer->getTable('customer/address'), // get the customer address modules table

    'in_storefinder', // column name

    array( // column info
        'type'      => Varien_Db_Ddl_Table::TYPE_INTEGER,
        'length'    => null,
        'unsigned'  => true,
        'nullable'  => true,
        'default'   => '0',
        'comment'   => ' added by the Storefinder',
    )
 );
 $installer->endSetup();

Any help would be greatly appreciated.


texts: Magento 2 : How to get all the attributes of a product added to the cart?

texts:
I am developing an extension for Magento 2 and would like to get all the properties/attributes of the products in the cart. The code needs to be generic so that it can adapt to any kind of product.

For example, if a T shirt is added, I need to get color & size and if a Ring is added, I need to get MetalType, Purity and similar attributes. I am able to get all possible options, but not the attributes of the selected product.


texts:
I want a overview of used payment methods for the pas 6 month
i.e. 200 orders: 100 creditcard, 70 paypal, 30 bank transfer

Is there a handy way to get this kind of information in php, mysql or ....


texts: How to redirect Magento 2 Website to open through www.?

texts: My Magento 2 website is not displaying .when using www.  before the domain name. any solution for this .?


texts: It does not show the button to continue with Paypal

texts: I successfully added paypal to magento, but it doesn't show the Continue to paypal button


texts:
In Magento 2, it is possible to extend themes by inheritance.

Is it possible to have more than 1 parent theme?


texts: Abusing discount code by entering fake information

texts: We have the promotion rule "Uses per Customer =1". Today, we noticed one customer (based on payment information) uses the discount code several times, since he is entering fake info. Is there any way to prevent such scenario.


texts: Magento 2.4.1 Error Current customer does not have an active cart. & Something went wrong with your request. Please try again later

texts:
I have a new install and I get two errors after I click on Place Order. I am using the Payment Method  Check/Money order The following two red boxes say the following.

Something went Wrong with your request. Please try again later.
Current customer does not have an active cart.

I have tried many things and continue to get this error.


texts: Error 'Mismatch of data types....' printed during data migration to Magento 2

texts:
The following error was output during data migration to Magento 2.

If you receive such an error, which file would you like to edit?

Also, please tell me how to write.

Mismatch of data types. Source document: paygent_last_id. Fields: payment_notice_id
Mismatch of data types. Source document: sales_flat_order. Fields: shipping_description

Mismatch of data types. Destination document: paygent_last_id. Fields: payment_notice_id
Mismatch of data types. Destination document: sales_order. Fields: shipping_description


texts: magento 2 : Enable maintenance mode frontend only?

texts:
How to enable maintenance mode for frontend only.

I used php bin/magento maintenance:enable

but it close both frontend and backend .


texts: Difference between Free Shipping field options in Cart Price Rule

texts:
I have to apply free shipping over 1000. For this, I'm creating catalog price rule according to this but it's not working.

In conditions, I have set Subtotal greater than 999.

https://www.mageplaza.com/kb/how-setup-free-shipping-promotion-in-magento-2.html

But when I have changed Free shipping option to For matching items only then it's working.

I'm not understanding what is an issue. Can anyone please explain the difference between For matching items only and **For shipment with matching items **?


texts: PHPUnit testing a Method Internally calling a Helper Method

texts:
Testing in magento 1.9 is painful. But somehow I am trying to figure out using PHPUnit.

I have a method which I want to test. And for unit testing I want to mock all the dependency that this method has.

In PHPUnit, there is a way to mock another class method using dependency injection. But the problem comes when my another class which I am trying to mock is my helper class itself.

I call my helper class method like this : Mage::helper('ClassXMLname')->getMyMethod().

So, my problems are :

Is there any way apart from dependency injection so that I can mock my helper class method, and my method takes that mocked method while testing?
If going in dependency injection, how can we dependency inject a helper class in our class?

Any answer on this will really help people still struggling with magento 1.9 . Thanks in advance.

Edit : Similar thing could be said about Models, which we call using Mage::getModel('Module/classname').


texts: Empty Attributes show up as N/A or No how do i hide them?

texts:
How do i stop the empty attributes on my website from showing up on the products page with the section showing "N/A" or "No" see below for image: (i want it to just be a blank empty box if there is nothing entered into the attribute )

I looked up the option for hiding via edditing the attribute.phtml file but it doesn't exist for me see screenshot below:


texts: Add custom option to configurable product M2

texts:
I wrote a plugin to add custom option while adding the product to cart

public function beforeAddProduct($subject, $productInfo, $requestInfo = null) {
        $additionalOptions['setting_style'] = [
            'label' => "Unique Product",
            'value' => $productInfo->getId() . "_" . rand()."_".$productInfo->getQty()
        ];
        //additional option for showing the items uniquely
        $productInfo->addCustomOption('additional_options', $this->_serializer->serialize($additionalOptions));
        return [$productInfo, $requestInfo];
    }

It's working well for a simple product but for a configurable product, it's not working.

My simple objective is to add line items irrespective of quantity.  If two products already added to cart, it should be the separate line item in the cart.


texts: getChildHtml - remove specific block after call

texts:
I want to output a specific child block at a specific place in a template.  I am using:

echo $this->getChildHtml('block_name')

Obviously this works.

However, in the same template there is a later call:

echo $this->getChildHtml()

with no parameter

Clearly this outputs the block twice.

Is there any way to avoid this and make the block only possible to output once and still retain the same functionality as above - i.e. output a specific block at a specific place and then all other children later in the template?


texts: Is there a way to add foreach loop in email template?

texts:
I am trying to trigger a mail to customer after they place an order. This email will carry all the cross sell products of the products ordered.

I used the following links as reference:

send email using event observer

Advanced Transactional Email Templates

All is working well.

But now my doubt is, will I be able to use foreach loop inside the html file put inside the locale directory?

So that I could iterate and print all the product info in the mail template. Can anyone help?


texts: SUPEE-8788 (V2) patch is not install on magento 1.8.1.0 version

texts:
When we install SUPEE-8788 (V2) patch on magento 1.8.1.0 version then shows

ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
patching file app/code/core/Mage/Adminhtml/Block/Cms/Wysiwyg/Images/Content/Uploader.php
patching file app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php.rej

We have install previously 7405 patch on my site.


texts:
I followed this tutorial http://www.bubblecode.net/en/2012/02/08/magento-create-your-own-admin-controller-in-a-new-tab/. And my objective is the admin go to one of this pages and it asks some input. How can I do that ? Everytime I click on one of those pages 'Index Action' and 'List Action' I get page not found. Please need help doing this :/

CustomController.php

<?php

class Curiosidade_CreateAdminController_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('mycustomtab')
            ->_title($this->__('Index Action'));

        // my stuff

        $this->renderLayout();
    }

    public function listAction()
    {
        $this->loadLayout()
            ->_setActiveMenu('mycustomtab')
            ->_title($this->__('List Action'));

        // my stuff

        $this->renderLayout();
    }
}
?>

I need help where // my stuff is, because I don't know what to do next ?


texts: Magento 2: What are the "top level tags" in a Module Layout Handle XML File Called?

texts:
In Magento 2, layout handle XML files introduced  a few new top level tags (body, head, etc)

<page>
    <body>
        <!-- ... -->
    </body>
    <head>
        <!-- ... -->
    </head>
</page>

These tags trigger extra programatic node processing when Magento is loading and parsing the layout update XML files.  For example, the body tag's extra processing happens in the following files

./lib/internal/Magento/Framework/View/Page/Config/Generator/Body.php
./lib/internal/Magento/Framework/View/Page/Config/Reader/Body.php

From the point of view of a module or theme developer using the system -- what are these new top level tags called?  i.e. in Magento 1, the top level tags (under the root tag) were layout handles, and handles contained block and reference instructions.

i.e. In Magento 2, each individual module layout handle XML file name is a handle, each top level tag (under the root page tag) is called a [BLANK], and [BLANK] tags contain referenceBlock and referenceContainer instructions.

What, in Magento 2 parlance, is "[BLANK]"


texts: Magento2: HTML tag is not working in custom email template

texts:
HTML tag is not working in the custom email template.

HTML file

{{template config_path="design/email/header_template"}}

{{trans "Csr Name: %name" name=$data.csrname}}
{{trans "Email: %email" email=$data.csremail}}
{{trans "Product Name: %pname" pname=$data.productname}}
{{trans "Sku: %sku" sku=$data.productsku}}
{{trans "Product Price: %pprice" pprice=$data.productprice}}
{{trans "Authorized Price: %authorizedprice" authorizedprice=$data.authorizedprice}}
{{trans "Approve Price: %approveprice" approveprice=$data.approveprice}}
{{trans 'Please Click here for approve price.' approveurl=$data.approvelink|raw}}

{{template config_path="design/email/footer_template"}}

Genrated email template


texts: I cant reindex manually most of index options, how can I do to enable it ?


texts: Creating a URL to direct from one package to another

texts:
I have a page in a custom module that gives an admin user the option to view an order's details. When the user clicks the option, I capture their decision in a controller:

public function viewAction()
{
    $this->redirect($this->getUrl('*/second_controller/action'), array('id'=>$id) );
}

The problem is that I get a URL resembling this:

http://webserver/index.php/module_one/second_controller/action/...

but what I need to get is

http://webserver/index.php/module_two/second_controller/action/...

I have tried using

$this->redirect($this->getUrl('module_two/second_controller/action'), array('id'=>$id) );

but with no luck. Does anyone have any idea how this could be done?


texts:
I use Magento 1.9.2.4 and have a theme installed on it, but it was another developer that install that and we don't have the original files anymore.

Is there a way to "extract" the theme files using FTP or something?

Looks like the theme files are located in the folders: app, js and skin in the folder with the respective theme name; but I am not sure if I am missing something or if this structure can be different from a theme to another.


texts: How do i display Sub Categories as Images on category page?

texts:
Im trying to display Sub categories as images on my Category page the page im talking about is here:

What i did at this point is i created a PHTML file with the following code:

<?php
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$categories = $category->getCollection()
        ->addAttributeToSelect(array('name', 'image'))
        ->addAttributeToFilter('is_active', 1)
        ->addIdFilter($category->getChildren())
?>

      <?php foreach ($categories as $category): ?>

              <a href="<?php echo $category->getUrl() ?>"><img src="<?php echo Mage::getBaseUrl('media') . 'catalog' . DS . 'category' . DS . $category->getImageUrl() ?>" alt="<?php echo $this->htmlEscape($category->getName()) ?>" />
              <?php echo $category->getName() ?>

      <?php endforeach; ?>

I created a static block with the following information:

Name: Subcategories
Code: subcategories
Status: Enabled
Content:

{{block type="core/template" template="catalog/category/sub.phtml"}}

So as you can see i have a few problems, one is that the images dont show up the link i get when i inspect it is

http://websiteurl.co.uk/media/catalog/category/http://websiteurl.co.uk/media/catalog/category/construct2_7.jpg

When it should actually be:

http://websiteurl.co.uk/media/catalog/category/construct2_7.jpg

The second problem i have is that every single page is showing the same 4 Categories no matter what page i go into. When i go into the category 'Floor Tile' It should show different subcategories but instead it shows the same 4 again.

I read somehwere that magento caches your current category and thats why the 4 categories dont change but even when i flush my cache it doesn't change.

Please Help!


texts: I cant get a custom field for some categories

texts: In the category view I have a field "banner_image", for some categories it is included in the collection, and for others not, I have 3 stores, and I've tried assign the image for all sites, but didn't works. I've checked many times and all seems to be ok. I've reindexed. cleared cache. maybe I have overlooked something else ?