texts: Magento 2 - Get Swatch Image based on swatch label

texts:
I want to use a swatch based attribute basically as an image uploader for brand logos. I already have a brand attribute which i want to remain as is so the layered navigation is text however want to just call the image from this new brand_swatch attribute based on the valueor label of the brand attribute as these will match however cannot use ID's as these will not match.

Something like below:

//get brand, this works fine
$brand = $_product->getResource()->getAttribute('brand')->getFrontend()->getValue($_product);
$swatchCollection = $objectManager->create('Magento\Swatches\Model\ResourceModel\Swatch\Collection');
//unsure from here on in but want to select the brand_swatch attribute
$optionIdvalue = 12;
$swatchCollection->addFieldtoFilter('swatch_id',$swatchIdvalue)->getSelect()
->join('eav_attribute_option_value as option', 'main_table.option_id = option.option_id')
->join('eav_attribute_option as option2', 'main_table.option_id = option2.option_id')
->group('main_table.option_id')
->where('option2.frontend_label = ' + $brand);
//here however am unsure how to filter by the item that matches the brand attribute so rather than firstItem get item where name = brand
$item=$swatchCollection->getFirstItem();#
//then build the url for image to be ready to be shown on frontend
return $swatchHelper->getSwatchAttributeImage('swatch_image', $item->getValue());

This is just an example and am unsure if the optionIdvalue is to filter swatches to the brand_swatch attribute and how from there to filter by the name of the option. Can anyone suggest how this is achieved?

Update

I have changed the addFieldtoFilter to swatch_id and used the attribute ID here hoping this should return my swatch collection.

I cannot find where the label for swatches is stored however after looking at below diagram and am therefore unable to filter by  the label. Also the query seemed to be only returning one result even without any filters for brand but I was hoping would return my list of options from the attribute.

Also using getOptionId() seems to return random numbers that do not appear to be related to my swatch so am wondering if attribute id and swatch id's are the same thing and if not where to find swatch ids.

http://anna.voelkl.at/wp-content/uploads/2016/12/ce2.1.3.png


texts:
Situation

A payment provider redirects customers back to Magento after a successful payment. At the same time the payment provider also sends a push to Magento. Both of these actions result in the same order being loaded, data being changed and the order being saved.

Problem

The above actions both load the same order, process different data and save the order. When the customer gets back to Magento at the same time as the push is sent the process that saves last overwrites the earlier process' already saved data.

flow a: load order
flow b: load order
flow a: process order (set status 'a')
flow b: process order (doesn't change status)
flow a: save order (order now correctly has status 'a')
flow b: save order (and overwrite the order data saved at step 5, reverting the status back to the old status)

Tried solutions

I have tried the following solutions without success.

Putting a sleep() in the push handling, this does not work due to the random timing of the user redirect. Anywhere between 1 second and 30 seconds of sleep and this problem still happens.
Reloading order object before save, this means I have to do all processing again and is basically an expensive sleep()

Question

The only way I can think of is setting some kind of flag file on order load and removing it on order save which would stop anything from loading the order while it's being processed. I am afraid this would cause problems elsewhere and is generally not a neat solution.

Is there a way to ensure that both sets of order data are processed without anything being lost?


texts: Plugin beforeGetUrl - not being used? (solved, facepalm)

texts:
I have grouped products "containing" simple products. I have had to make the simple products visible but while I am ok for them to appear in certain lists, I want the link to go to the parent page not to the (very incomplete) simple product page.

I started by creating a helper with a new URL function and overriding the various templates to use it , but there are a lot of templates and it will be a pain to maintain.

It seems to always be $product->getUrlModel()->getUrl($product, $additional) behind all the getProductUrl so Catalog\Model\Product\Url  I should be able to create a "before" plugin for getUrl that swaps to the parent when it detects particular conditions.

But it seems my plugin is not happening - even when I just make it log a line then pass on things unchanged. So either I am missing an understanding or it is another class that cannot be modified?

In app/code/Mystuff/FixGrouped/etc/frontend/di.xml

<type name="Catalog\Model\Product\Url">
    <plugin sortOrder="1" name="FixGroupedPluginModelProductUrl"
     type="Mystuff\FixGrouped\Plugin\Model\Product\Url" disabled="false" />
</type>

and in app/code/Mystuff/FixGrouped/Plugin/Model/Product/Url.php

namespace Mystuff\FixGrouped\Plugin\Model\Product;

use \Magento\Catalog\Model\Product\Url;

class Url
{
       public function beforeGetUrl(\Magento\Catalog\Model\Product\Url $subject, \Magento\Catalog\Model\Product $product, array $params)
     {
          $logger = \Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class);
          $logger->info('Mystuff plugin beforeGetUrl active');
          // here it would swap for parent if require
          return [$product, $params];
    }

}

So it changes nothing but puts a line in the log. No lines ever appear in the log.

So what am I missing?
 - i've not written it right?
 - getUrl is not called in a context that works with plugin?

I couldnt find any beforeGetUrl on this class out there so it is not reassuring


texts: The user can remove his products from the cart. You will get the animation and it will be removed from it. However when the User clicks on links in my webshop the removed product will apear again. It won't show up in the checkout process and the cart will be empty. How can I fix this little bug that removed products apear again in the cart?


texts: Avoid resource injection from a third part plugin

texts:
A third party plugin uses a plugin to insert a css in this way:

$config->addPageAsset("..custom-theme.css");

Where $config is Magento\Framework\View\Page\Config class.

The classic css removing from xml  doesn't work with this injection.
How can I avoid this injection without overwriting the plugin method?


texts: layer nav : add multiple value to one product attribute

texts:
Is it possible to add multiple values to one attribute in magento which will be sortable in the layered nav?

here an example :

atttribute "volt" which have : 2V, 6V and 12V

product 1
volt : 2V

product 2
volt : 2V, 12V

product 3
volt : 2V,6V, 12V

so, the layered nav shows the attribute "volt" with 2V, 6V and 12V.....and once you click on 12V, only product 2 and 3 show up. With 2V, product 1,2 and 3 shup up and so on.

do you know how I can get this result in magento?

thanks!


texts: Magento 1.9 : Need New Currency Update Module

texts:
Magento 1.9 currency module no longer works as finance.google.com doesn't return anything anymore... sigh

Does anyone know a good free module I can install which will replicate this currency update functionality?


texts: How to remove the tax on goods for a particular area, or those who make delivery to this area?

texts:
Can this be done from the admin or will I have to write the code? If with admin, then where can I set it up?

I have a delivery in Ireland and United Kingdom how to make in Ireland there was no tax on the goods, and those who ordered delivery in Ireland also did not have tax on the goods?


texts: Can't save to vertex_customer_code table

texts:
I have tried everything under the sun to save to the vertex_customer_code table but my data never winds up in the db. I have tried this in both an observer and plugin for the customer save event (both "after" type methods). I can retrieve data from the table, even update the customer_code column, I just cannot add a new record. The vertex_customer_code table has only two columns: customer_id (primary key) and customer_code (text column which should have been varchar imo). Also, imo, vertex violated the unspoken rule of letting the db manage the primary key which might be a big part of the problem, instead the primary key is a reference to the customer_entity_id. They have rigged this to be used like an extension attribute on the customer, you can update it manually at the bottom of the customer "account information" tab, but I need to automatically assign a value in certain cases when a customer is first created.
Here is one example of how I have tried to accomplish this, with no luck, using an observer on the customer_save event:
<?php

namespace {Vendor}\{Module}\Observer;
use Magento\Framework\Event\ObserverInterface;
use Vertex\Tax\Model\Repository\CustomerCodeRepository;
use Vertex\Tax\Model\Data\CustomerCodeFactory;

class CustomerSaveAfterObserver implements ObserverInterface
{
    protected $_request;
    protected $customerCodeRepository;
    protected $customerCodeFactory;

    public function __construct(
        \Magento\Framework\View\Element\Context $context,
        CustomerCodeRepository $customerCodeRepository,
        CustomerCodeFactory $customerCodeFactory
    ) {
        $this->_request = $context->getRequest();
        $this->customerCodeRepository = $customerCodeRepository;
        $this->customerCodeFactory = $customerCodeFactory;
    }

    /**
    * @param \Magento\Framework\Event\Observer $observer
    * @return void
    */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $custCode = $this->customerCodeFactory->create();
        $custCode->setCustomerId(39580);
        $custCode->setCustomerCode('TaxFreeMarketplace');
        $savedit = $custCode->save();

    }
}

If I cause event dispatch from the customer edit pages in adminhtml, I am thrown back with the error message "Something went wrong while saving the customer".
As I mentioned above, I am able to use either the repository object or the Factory object to retrieve existing data without a problem.  One other thing, Vertex\Tax\Model\Data\CustomerCode does not seem to have an API interface - in the class definition they have written:
/**
 * Model for storage of the Vertex Customer Code
 *
 * This model is used as the implementation for the vertex_customer_code extension attribute on the
 * {@see \Magento\Customer\Api\Data\CustomerInterface}
 */


texts:
I have url something like http://local.magentodemo.com/customer/index/index
is there any way to rename the route so it must look like http://local.magentodemo.com/customer/index.php

any suggestions, help would be very much appreciated.


texts: Enable newsletter subscription for orders placed in the backend

texts:
I thought this would be a fairly common need and was surprised not to find any tutorials on it from some quick searches I did.

I was looking for a way to enable a site admin to subscribe a customer to the newsletter when placing an order through the backend.


texts: How to implement magento's store select field?

texts:
Synopsis

I am implementing a small module that stores a single record in my own table, this record must relate to a store; so I decided to adopt the store visibility field from the Catalog > Products section (which is the same as Cms > Pages).

The snippet below will give me an array of store ids.  I want this field to be a singleton (i.e. only a single store to be selected)

// Check is single store mode
if (! Mage::app()->isSingleStoreMode()) {
    $field = $fieldset->addField('store_id', 'select', [
        'name'      => 'stores[]',
        'label'     => $this->__('Store View'),
        'title'     => $this->__('Store View'),
        'required'  => true,
        'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
        'disabled'  => $isElementDisabled,
    ]);
    $field->setRenderer($this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element'));
} else {
    $fieldset->addField('store_id', 'hidden', [
        'name'      => 'stores[]',
        'value'     => Mage::app()->getStore(true)->getId()
    ]);
    $model->setStoreId(Mage::app()->getStore(true)->getId());
}


texts: Best workflow to manage newsletters subscriptions/unsubscriptions?

texts:
I'm trying to figure out what's the best workflow to create and send a newsletter to my subscribers and keep control over subscriptions/unsubscriptions, either by using magento as the primary platform or a third party email marketing platform. My number of subscribers is higher than 3k.

My key point is that magento users/customers can subscribe/unsubscribe the newsletter through their account settings, so managing subscriptions/unsubscriptions should be easy as Magento default newsletter template provides an unsubscribe link.

Meanwhile if I use an email marketing provider, I'd need to create a subscribers list. In case a subscriber wants to unsubscribe, he/she will still appear as subscribed in his/her account settings, so a difference between the Magento and Provider lists will be created (I haven't found a single app in the market that is able to sync between Magento and a Provider's list).

So any ideas on how to work this out will be very welcome.
Frank


texts: Category name (title) translation issue in Magento 2

texts:
I have 2 store views (english and another language) in one of my Magento 2 projects.

The problem I'm facing is that one of the categories has the name "Role", which is also an English word.

So when I visit the category view page the category title gets translated to the other language's equivalent of the word "Role".

Shouldn't page/category headings be non-translatable through the built-in CSV translation mechanism that Magento provides?

I mean they already are translatable through the Admin store view functionality...

In any case, I've tracked this down to Magento_Theme::html/title.phtml and the function getPageHeading() in module-theme/Block/Html/Title.php

public function getPageHeading()
    {
        if (!empty($this->pageTitle)) {
            return __($this->pageTitle);
        }
        return __($this->pageConfig->getTitle()->getShortHeading());
    }

Is it possible to disable the translation via catalog_category_view.xml with a referenceBlock name="page.main.title"?

The only solution I can think of atm is to remove the page.main.title block from category view pages and add the non-translated title in Magento_Catalog::product/list.phtml.

EDIT

I fixed this temporarily by removing the page.main.title block and inserting this to list.phtml:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');

if ($category) { ?>

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

<?php } ?>

But this isn't the best solution...

Seems like a Magento 2.2. bug to me.

Any suggestions would be appreciated.


texts:
Does anyone know how to fix this issue?

Magento 1.8.1

There has been an error processing your request

Can't retrieve entity config: core/store_group

Trace:
#0 /var/www/idfr/app/code/core/Mage/Core/Model/Resource.php(272): Mage::throwException('Can't retrieve ...')
#1 /var/www/idfr/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(284): Mage_Core_Model_Resource->getTableName('core/store_grou...')
#2 /var/www/idfr/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(247): Mage_Core_Model_Resource_Db_Abstract->getTable('store_group')
#3 /var/www/idfr/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(155): Mage_Core_Model_Resource_Db_Abstract->getMainTable()
#4 /var/www/idfr/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(192): Mage_Core_Model_Resource_Db_Collection_Abstract->getMainTable()
#5 /var/www/idfr/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(135): Mage_Core_Model_Resource_Db_Collection_Abstract->_initSelect()
#6 /var/www/idfr/app/code/core/Mage/Core/Model/Config.php(1348): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Store_Group))
#7 /var/www/idfr/app/code/core/Mage/Core/Model/Config.php(1380): Mage_Core_Model_Config->getModelInstance('core_resource/s...', Object(Mage_Core_Model_Resource_Store_Group))
#8 /var/www/idfr/app/Mage.php(491): Mage_Core_Model_Config->getResourceModelInstance('core/store_grou...', Object(Mage_Core_Model_Resource_Store_Group))
#9 /var/www/idfr/app/code/core/Mage/Core/Model/Abstract.php(208): Mage::getResourceModel('core/store_grou...', Object(Mage_Core_Model_Resource_Store_Group))
#10 /var/www/idfr/app/code/core/Mage/Core/Model/Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection()
#11 /var/www/idfr/app/code/core/Mage/Core/Model/App.php(613): Mage_Core_Model_Abstract->getCollection()
#12 /var/www/idfr/app/code/core/Mage/Core/Model/App.php(466): Mage_Core_Model_App->_initStores()
#13 /var/www/idfr/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store')
#14 /var/www/idfr/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 /var/www/idfr/index.php(96): Mage::run('', 'store')
#16 {main}


texts: custom button on product page/product listing in magento

texts:
I want to show a custom button on product detail page as well as on product listing.

this button will be visible based on an attribute.(if I select an attribute to yes while creating product, only then this button should be visible.)
and I want to show a block on hover on button.
i am very new to magento so detailed instruction will be better.


texts: Magento API - most efficient way to get list of products and their name/url/image_url

texts:
I'm trying to making API calls from my other website to my magento store. If possible, I would like to get a list of products (specified by SKU) and their name/url/image_url in just one call.

Currently I find no way of doing it. The product list only gives me product name. I have to make an api call for each product to get their url/image_url. That's so not efficient. Any better way of doing this?

Running Magento 1.9.1. Thanks.


texts: How to understand which setup class do I need to use and what is it's purpose?

texts:
I just started to learn Magento 2 and I'm confused with all those setup classes (eavSetup, categorySetup, Set and so on).

Could someone explain me about those setup classes purposes and how should I know which setup class do I need to use? When should I use eavSetup or categorySetup?

Any information about that would be nice either.


texts: How to use multi blocks with single tempaltes file in magento2?

texts:
I am overriding default.phtml and remove.phtml here by using core block but i need to use my custom block also.how do i achieve?

<referenceBlock name="checkout.cart.item.renderers">
  <block class="Magento\Checkout\Block\Cart\Item\Renderer" name="checkout.cart.item.renderers.default" as="default" template="Custom_Module::cart/item/default.phtml">
       <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions">
             <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Custom_Module::cart/item/renderer/actions/remove.phtml"/>
          </block>
     </block>
</referenceBlock>

like this

 <referenceBlock name="checkout.cart.item.renderers">
  <block class="Magento\Checkout\Block\Cart\Item\Renderer" name="checkout.cart.item.renderers.default" as="default" template="Custom_Module::cart/item/default.phtml">
       <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions">
             <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Custom_Module::cart/item/renderer/actions/remove.phtml"/>
             **<block class="Custom\Module\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.custom.actions.remove" template="Custom_Module::cart/item/renderer/actions/remove.phtml"/>**
          </block>
     </block>
</referenceBlock>

basically i wanted to use 2 block classes for single remove.phtml file.

Thanks.


texts:
I have a graphql query as follow:
{
  customerPlacedOrder(customer_id: 1) {
    allOrderRecords {
      increment_id
      customer_name
      grand_total
      created_at
      shipping_method
    }
  }
 }

below array is my output
{
  "data": {
     "customerPlacedOrder": {
        "allOrderRecords": [
          {
            "increment_id": "000000001",
             "customer_name": "Veronica Costello",
             "grand_total": "₹36.39",
             "created_at": "2020-07-29 03:51:40",
             "shipping_method": "flatrate_flatrate"
           },
           {
             "increment_id": "000000002",
             "customer_name": "Veronica Costello",
             "grand_total": "₹39.64",
             "created_at": "2020-07-29 03:52:06",
             "shipping_method": "flatrate_flatrate"
           }
        ]
     }
   }
}

How to render this array in PWA. Please help.


texts:
I want to fetch all product id that selected on cart page in phtml file.
someone please send me some link or tutorial that i want to fetch product id's that selected in cart page through phtml file.


texts:
Guys I need your help and this is really a serious thing. I’m struggling with the visibility of the products from the day I’ve installed the Electronic Store theme (http://demo.pagayo.com/pagayotheme001/). Every single day I have to scratch my head to think what I’m doing wrong. My products are not being displayed on the homepage regardless of my indefinite attempts to make them appear. I’ve tried every single thing I could do by reading on forums and some blogs, but nothing worked for me. Please, please let me know how can make them visible on homepage? Everything is good according to me:

Status: In Stock

Visible: Enabled

What is missing, then? What is blocking the products from appearing on index page?
One last thing, how can I increase the number of slider? I don’t have sound knowledge of PHP or Magento so it becomes more hard for me to configure the webiste. Additionally I can’t afford the big fat fee of a front-end developer so I hope you guys will help me to solve your problem.
Website: http://www.dirtrades.com


texts: Mini cart js is not working properly the count is not showing some times

texts:
Minicart is not showing cart count properly at the time of not logging in. I had tried to show statically into the id condition but the when loading the 0 is shown after load it is not showing, I think the problem is that from the getCartParam('summary_count') the value is not passing if there is no zero is coming, it is not showing inside the if condition I will give the  minicart js code below please suggest some solution for this.
And please tell how to check the null in knockout Js magento 2.3?

                0


texts: Magento 2.1: How to add a custom row to admin custom grid

texts: I have created a custom grid in admin for "Seller Commission". Now, I want to show total commission earned, so need to add a row at the end of the grid which should say "Total Amount". Please help.


texts:
We've got a Magento install that's currently running like a dog... We've had to install FPC to help with the site speed but this doesn't help with the search.

I've logged into the server and I can see the load of the server is really high and it's MySQL that's hogging it all.


texts: There is no di folder generated in var directory. I am getting please re-run compile command. Why we need this di directory?


texts:
I have Magento web shop with prices on totals displaying both with included and excluded tax. On my cart and sales emails, the order of the totals is normal, like:
Product price Incl tax
Product price Excl tax
Shipping price Incl tax
Shipping price Ecl tax
Tax for shipping
Tax for product

Only on my PDF invoices, I have things unsorted, like.
Product price Incl tax
Product price Excl tax
Tax for shipping
Tax for product
Shipping price Incl tax
Shipping price Ecl tax

Is there a way to change order of the totals in PDF invoices and where?


texts: Magento 2 How to get disable/enable child categories?

texts:
I am working with display all categories on a custom page, either it is enabled or disabled.

When I try to get child categories with "getChildrenCategories()", but it is returning only enabled child categories it is not returning the disabled child categories. I need both types of child categories.

How can I get the all child categories which are disabled/enabled?

please check the code as below.

protected $_categoryFactory;
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Catalog\Model\CategoryFactory $categoryFactory
){
    parent::__construct($context);
    $this->_categoryFactory = $categoryFactory;
}

public function getAllChildCategories($categoryId)
{
    $categoryObj = $this->_categoryFactory->create()->load($categoryId);
    if($categoryObj->hasChildren()) {
        return $categoryObj->getChildrenCategories();
    }

}


texts: magento2: Increase the dropdown speed of nav-menu

texts:
by default nav-menu drop-down is so slow so I want the increase the drop-down time of nav-menu..

Till now I tried editing the two files but no success..
files edited: js/navigation-menu.js, Magento_Theme/menu.js

Hope some one help me to achieve this.


texts: Trying to remove unwanted space in a table,

texts:
I'm trying to create a 6 cell table on my site that contains 3 images and i want the corners of the three images to touch, with no boarder or padding. I've tried everything I can think of but everythng I've tried has resulted in unwanted spaces.
this is the code that I'm using
Can someone tell me what I'm doing wrong?


texts: How can I get more options for a rule that only allows "is/is not"?

texts:
I have an attribute (strength) that has 5 levels. For a sale (shopping cart rule) we want to try and sell the higher level options for 70% off.

So when I was testing I only could get the coupon to work with just one option at a time (is/is not). When I added the others on another line, it became invalid at checkout.

Is there a way to say is "1 of these" and then option 1, 2, 3... For category it is nice because you can add multiple categories.


texts: How to get products with a specific attribute value

texts:
How can I get the products with a attribute (attribute name is "use_state") value of "new"? I added an attribute called "use_state" and an attribute set with that attribute. Then I created some products that have this attribute set and assigned value "new" to these products' "use_state" attribute. For the world, I cannot anyhow get these products in my block, in order to be able to display them. I tried these approaches and each one was just giving me some useless information that I don't even understand, instead of the concrete products information, that I actually expect from them. I tried this:

$collection = Mage::getModel('catalog/product') -> getCollection();
$collection -> addAttributeToSelect(array('name'));
$collection -> addFieldToFilter("use_state", "new");

print "DEV:
"; print_r($collection); print "
";

$_products = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect(array('name'))
->addAttributeToFilter('use_state', 'new')
->load();

echo "DEV:
"; print_r($_products); echo "
";

Not giving me any products, just some info that I don't even understand. Can you help me see what's wrong here?

I have just found out that this line might be the culprit:

->addAttributeToFilter('use_state', 'new')

, and this is because 'new' is not the value to filter by, but another, coded value, which is in my case, 234. I don't know how to translate 'new' to 234 though.


texts: How to make function run even if getUsername() is null

texts:
How can I make this function run - also when getUsername() is null
$authSession = $objectManager->get('Magento\Backend\Model\Auth\Session');
$UUsername = $authSession->getUser()->getUsername();
$glsDirName = $this->directoryList->getPath('var') . '/GLS/' . $UUsername;

[2021-01-16 06:25:09] main.ERROR: Cron Job gls_import_tracking has an
error: Call to a member function getUsername() on null. Statistics:
{"sum":0,"count":1,"realmem":0,"emalloc":0,"realmem_start":223346688,"emalloc_start":220510920}
[] [] [2021-01-16 06:25:09] main.CRITICAL: Error when running a cron
job {"exception":"[object] (RuntimeException(code: 0): Error when
running a cron job at
/bbb/bbb/www/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php:362,
Error(code: 0): Call to a member function getUsername() on null at
/bbb/bbb/www/vendor/tric/module-gls/Helper/Data.php:453)"} []


texts:
I'm working on a tool that will let a customer reorder the same products as last order (pre added to cart) by clicking an unique link in e-mail.

By code I'm able to add the products to cart, however I also want to add the customer details such as firstname, lastname, company, address, email, phone etc to the checkout page.

I guess its the billing part of the checkout so its not new atttributes.

Can this be done?


texts: Magento 2.1.5 import error that mess category saving

texts:
this is what happening with the store i´m building: I have 280k products to import, i´m doing it in with 7 csv files every file contains 40k of data except the last one,

My problem is the following:

I import the first 40k of data with all the attributes i need, then when the import process is complete i can´t save the categories where the products are assigned.

A thing i want to do is just to create one url for my product bcause when i upload a product for both categories,

i.e: category-parent,category-parent/category-child the system creates two url for both categories like this: category-parent/my-product and category-parent/category-child/my-product, what i want is this: category-parent/category-child/my-product


texts: Magento 2.3.3. programmatically creating product - link to image on a CDN

texts:
I am creating/updating simple and configurable products and their images are stored on a CDN.
I would like to use the CDN rather than pulling the images on to the server and then in to Magento when I am creating the products.
How can I achieve this?
I can change the media base URL of course but then how do I get the image file name in to the product?
My current code is something like this:
...
$simpleProduct = $this->_productInterfaceFactory->create();
$simpleProduct->setSku("testsku")
                  ->setName("test product")
                  ->setImage('???')
                  ->setSmallImage('???')
                  ->setThumbnail('???')
                  ->setAttributeSetId(4)
                  ...
                  ...

$this->_productRepository->save($simpleProduct);
...

Is it possible this way?
I thought perhaps I can add the image to a new product attribute and then change the media phtml file to load the CDN image instead rather than the Magento image. But I would rather do it the "Magento" way.
Thanks
(Magento 2.3.3)


texts: jQuery (server side) search and sort using Ajax

texts:
I tried to create search and sort from live URL using Ajax , i used do search function and i managed to retrieve the data from the URL .
I am showing Ajax response in select options as below code. I want to sort the select options in order of values (level values),the values are retrieved randomly in the results.
How can I combine search and sort function for that ?I used lots of tutorials to do that. To anyone who knows please help me to do that. Thank you.
Please provide a solution to automate sort data with the current search function on values basis (by level) . Sample of the current results  like :
Level: 99 ℂᎩℕU$⭐id:16110891847172013476
Level: 39 HanSoloD㊂loid:16110914410897703121
Level: 84 SKULL⚓⛵☠id:16110908459448803417
Level: 39 Brutha3rdid:16110911398345043830
Level: 49 RF George id:16110770935818465206
Level: 90 Auggie98id:16110907549357360528
So far I have this code:
 function do Search(){
$. Ajax({
    URL: 'https://live.ksmobile.net/live/BOYS',

            data: {
        page_size: 10,
        page_index: current_page
    },
    cache: false,
    type: 'GET',
    datatype: 'JSON',
    success: function(r){

        var max = $('#limit'). VAL();
        if (r.data.video_info.length < max) max = r.data.video_info.length;

        for (index = 0; index < max; index++) {
            var entry = r.data.video_info[index];

            var level = parse Int(entry.level);

                            if ((level > $('#min'). val()) && (level < $('#max'). val())) {
                count++;
                var HTML = '
<h="'+entry+'">';
                HTML += '
Level: '+entry.level+' '+entry.name+''+'id:'+entry.heat;
                HTML += '
';
                $('#main'). append(HTML);

        }

}


texts: What does mean by line item in the order?

texts: While tax calculation we have an option of "Row Total" thats depend on the line items in the order.Can someone explain the term line item in the order?


texts: How to manage InstallData.php File in magento 2

texts:
How can I manage my InstallData.php file when I want to create multiple attribute for customer and product?

Here, in my InstallData file I have create an attribute for the product.

    namespace Backadmin\Grid\Setup;

    use Magento\Framework\Setup\InstallDataInterface;
    use Magento\Framework\Setup\ModuleContextInterface;
    use Magento\Framework\Setup\ModuleDataSetupInterface;

    /**
    * @codeCoverageIgnore
    */
    class InstallData implements InstallDataInterface
    {
        /**
         * Eav setup factory
         * @var EavSetupFactory
         */
        private $eavSetupFactory;

        /**
         * Init
         * @param CategorySetupFactory $categorySetupFactory
         */
        public function __construct(\Magento\Eav\Setup\EavSetupFactory $eavSetupFactory)
        {
            $this->eavSetupFactory = $eavSetupFactory;
        }

        /**
         * {@inheritdoc}
         * @SuppressWarnings(PHPMD.CyclomaticComplexity)
         * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
         * @SuppressWarnings(PHPMD.NPathComplexity)
         */
        public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
        {
            $eavSetup = $this->eavSetupFactory->create();
            $eavSetup->addAttribute(
                \Magento\Catalog\Model\Product::ENTITY,
                'clothing_material',
                [
                    'group' => 'General',
                    'type' => 'varchar',
                    'label' => 'Clothing Material',
                    'input' => 'text',
                    'source' => '',
                    'frontend' => '',
                    'backend' => '',
                    'required' => false,
                    'sort_order' => 50,
                    'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                    'is_used_in_grid' => false,
                    'is_visible_in_grid' => false,
                    'is_filterable_in_grid' => false,
                    'visible' => true,
                    'is_html_allowed_on_front' => true,
                    'visible_on_front' => true
                ]
            );
        }

}

Now I want to create an attribute for the customer so how can I manage InstallData file.

For example, I have removed this and put the customer attribute code? otherwise, I will create a new file for this?

Please, suggest me how to manage this structure in single file?

If you guys have the best link for this how to manage multiple attributes so please share with me.


texts: On express/review/ page revel if the user passed from onepage

texts:
I have a shop with paypal express checkout, so the user can checkout directly from poduct page and cart page with the paypal yellow button, but they can also go through onepage checkout and select paypal as payment method..

all paypal  users are redirected on paypal review page...

In the review page I want to identify if the user has passed through onepage or not.

Thanks
M.


texts: How to pass multiple parameter to rest web API?

texts:
I have created a rest web api. I want to pass multiple parameters to get my required data. How can I do that ?

    interface ProductsInterface
  {
    /**
   * Returns greeting message to user
   *
   * @api
 * @param string $sku
 * @return string Greeting message with users name.
 */
public function getProductPrice($sku);
/**
 * @param $sku
 * @param $attributecode
 * @return mixed
 */
public function getProductAttribute($sku, $attributecode);
}

Model:

class Products implements ProductsInterface
{
/**
 * @var ProductRepositoryInterface
 */
private $_productRepository;
/**
 * Product constructor.
 * @param ProductRepositoryInterface $productRepository
 */
public function __construct(ProductRepositoryInterface $productRepository)
{
    $this->_productRepository = $productRepository;
}
/**
 * Returns greeting message to user
 *
 * @param string $sku
 * @return string Greeting message with users name.
 * @throws \Magento\Framework\Exception\NoSuchEntityException
 * @api
 */
public function getProductPrice($sku)
{
    $prodcutBySku = $this->_productRepository->get($sku);
    return $prodcutBySku->getPrice();
}
/**
 * @param $sku
 * @param $attributecode
 * @return \Magento\Framework\Api\AttributeInterface|null
 * @throws \Magento\Framework\Exception\NoSuchEntityException
 */
public function getProductAttribute($sku, $attributecode)
{
    $prodcutBySku = $this->_productRepository->get($sku);
    return $prodcutBySku->getCustomAttribute($attributecode);
}
}

webapi.xml

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/products/getProductPrice/:sku" method="GET">
    <service class="Evamp\Webapi\Api\ProductsInterface" method="getProductPrice"/>
    <resources>
        <resource ref="anonymous"/>
    </resources>
</route>
<route url="/V1/products/getProductAttribute/:sku,:attr" method="GET">
    <service class="Evamp\Webapi\Api\ProductsInterface" method="getProductPrice"/>
    <resources>
        <resource ref="anonymous"/>
    </resources>
</route>


texts:
I was wondering if there is a setting for creating secure cookies on M2. I have a vulnerability check and it shown that cookies don't have "secure" tags.

Or do I need to override a core function?


texts: How to display product image in summary section in bundle product page in Magento 2?

texts:
we are using Magento V 2.3.5-p1
In default Magento when we select options in bundle product page the selected option will be displayed in the summary section. By default, only the quantity and name of the selected option is displayed in the summary section.
I have created one bundle product and created bundle options with input type radio button and added products in that bundle option. I have fetched and displayed product images (which were added as bundle options) on the front end.
what I want to do is display the product image with the product name when the user selects an option in the bundle product. I want display images in the summary section.
I had noticed that summary section is based on x-magento-template. So How can I display product images in the summary section? Is there a way to display product image in x-magento-template?


texts: Products in Category not showing all products in the category back-end

texts:
Not all products show under "Products in Category" when editing a category in the back-end.

Here is a screenshot showing the problem.  In the category tree, it correctly shows 123 products in 'Commercial' category.  But under the products section, only 9 appear (see bottom right).

Other categories are fine and show the same number of products in the tree and in the products list.

I've run the reindexer from the command line and this didn't help.  For info, both 'Use Flat Catalog Category' and 'Use Flat Catalog Product' are set to Yes.

Magento version 2.3.4

PHP 7.3.16

Mysql Ver 15.1 Distrib 10.1.44-MariaDB

Thanks.


texts: Custom Listing is separated by categories

texts:
I want to display the products in a separate sub-category for other sub-categories within the listing. Basis rather than display a common list of products they are organized the way it is in this example:

http://www.partypieces.co.uk/busy-bees-1.html


texts:
we're working with a class which should be placing groups and pages into the top menu of our magento shop, however it doesn't seem to be functioning.

From what I can see first the observer is created in the module.

<events>
    <page_block_html_topmenu_gethtml_before>
        <observers>
            <attributeSplash>
                <type>singleton</type>
                <class>attributeSplash/observer</class>
                <method>injectTopmenuLinksObserver</method>
            </attributeSplash>
        </observers>
    </page_block_html_topmenu_gethtml_before>
</events>

As it's an obsererver will it be theme dependant? Can anyone suggest where we might be going wrong?

Then in the observer the menu is called based on the pages or groups.

class Fishpig_AttributeSplash_Model_Observer
{
    /**
     * Inject links into the top navigation
     *
     * @param Varien_Event_Observer $observer
     * @return $this
     */
    public function injectTopmenuLinksObserver(Varien_Event_Observer $observer)
    {
        if (Mage::getStoreConfigFlag('attributeSplash/navigation/enabled')) {
            $groups = Mage::getResourceModel('attributeSplash/group_collection')
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addOrderByName()
                ->load();

            $this->_injectLinks($groups, $observer->getEvent()->getMenu());
        }

        return $this;
    }

    /**
     * Inject links into the top navigation
     *
     * @param Mage_Core_Model_Resource_Db_Collection_Abstract $items
     * @param Varien_Data_Tree_Node $parentNode
     * @return bool
     */
    protected function _injectLinks($items, $parentNode)
    {
        if (!$parentNode) {
            return false;
        }

        foreach($items as $item) {
            if (!$item->canIncludeInMenu()) {
                continue;
            }

            $children = $item->getSplashPages();

            if ($children && count($children->addOrderByName()->addFieldToFilter('include_in_menu', 1)->load()) === 0) {
                continue;
            }

            $data = array(
                'name' => $item->getName(),
                'id' => $item->getMenuNodeId(),
                'url' => $item->getUrl(),
                'is_active' => $item->isActive(),
            );

            if ($data['is_active']) {
                $parentNode->setIsActive(true);
                $buffer = $parentNode;

                while($buffer->getParent()) {
                    $buffer = $buffer->getParent();
                    $buffer->setIsActive(true);
                }
            }

            $itemNode = new Varien_Data_Tree_Node($data, 'id', $parentNode->getTree(), $parentNode);
            $parentNode->addChild($itemNode);

            if ($children) {
                $this->_injectLinks($children, $itemNode);
            }
        }

        return true;
    }
}

Can anyone shed any ideas where the problem may lie please?


texts: Adding a custom entity value in Order table

texts:
I need to do relatively a small thing with magento. But confused since I am a beginner in module development.

I added 2 columns named percentorder and commission into table
sales_flat_order
Now I need to add values to those two columns when user creates an Order.

How can I do that? Should I override the order related models? or write an event Observer?


texts: Magento export products in Excel format without third party library

texts:
I am using Magento CE-1.9.2.x in my website.

Now I want Catalog >> Manage Products >> Actions select box to include the Export Products to XLS option, with only a custom controller and custom action in background to be able to export products to xls format.

I have seen content-type of application/octet-stream is allowed in _prepareDownloadResponse() function, how this can help me and also what should be column-separator for xls format ?

I want this with default Magento functions without the use of any third party libraries.

I have searched a lot on Google but couldn't find a reliable code block or post for this.

Hope anyone here can help me out.


texts: Magento_Amqp: Is it safe to disable this module?

texts:
Magento_Amqp module is for Manage message queues as per https://devdocs.magento.com/guides/v2.3/config-guide/mq/manage-message-queues.html.

And system.log is continuous display below log.

Consumer "async.operations.all" skipped as required connection "amqp" is not configured. Unknown connection name amqp is not configured. Unknown connection name amqp

Is it safe to disable Magento_Amqp module?


texts:
I like to edit the cart totals table to remove the blue arrows and the summary details from each item.
I don't know how to do this.
I like to remove those blue arrows and the tax detail rows!


texts: How to override webapi.xml in custom module?

texts:
I want to override /vendor/magento/module-catalog/etc/webapi.xml file in my custom module.

<route url="/V1/categories" method="GET">
        <service class="Magento\Catalog\Api\CategoryManagementInterface" method="getTree" />
        <resources>
            <resource ref="Magento_Catalog::categories" />
        </resources>
    </route>

My module path for this webapi is
/app/code/CustomModule/Catalog/etc/webapi.xml

I want to override this specific code.

 <!-- Category Product Links -->
    <route url="/V1/categories/:categoryId/products" method="GET">
        <service class="Magento\Catalog\Api\CategoryLinkManagementInterface" method="getAssignedProducts" />
        <resources>
            <resource ref="anonymous" />
        </resources>
    </route>

I tried but it still gives me error

{
    "message": "Consumer is not authorized to access %resources",
    "parameters": {
        "resources": "Magento_Catalog::categories, anonymous"
    },
    "trace": "#0 /var/www/html/rb-dev/vendor/magento/
webapi/Controller/Rest/RequestValidator.php(68):

  Magento\Webapi\Controller\Rest\RequestValidator->checkPermissions()\n#1
  /var/www/html/rb-dev/vendor/magento/module-webapi/Controller/Rest/InputParamsResolver.php(86):
  Magento\Webapi\Controller\Rest\RequestValidator->validate()\n#2
  /var/www/html/rb-dev/vendor/magento/module-webapi/Controller/Rest.php(322):
  Magento\Webapi\Controller\Rest\InputParamsResolver->resolve()\n#3
  /var/www/html/rb-dev/vendor/magento/module-webapi/Controller/Rest.php(239):
  Magento\Webapi\Controller\Rest->processApiRequest()\n#4
  /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(58):
  Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#5
  /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(138):
  Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch',
  Array)\n#6
  /var/www/html/rb-dev/vendor/magento/framework/Interception/Interceptor.php(153):
  Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#7
  /var/www/html/rb-dev/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(39):
  Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch',
  Array, Array)\n#8
  /var/www/html/rb-dev/vendor/magento/framework/App/Http.php(135):
  Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#9
  /var/www/html/rb-dev/generated/code/Magento/Framework/App/Http/Interceptor.php(24):
  Magento\Framework\App\Http->launch()\n#10
  /var/www/html/rb-dev/vendor/magento/framework/App/Bootstrap.php(256):
  Magento\Framework\App\Http\Interceptor->launch()\n#11
  /var/www/html/rb-dev/index.php(39):
  Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#12
  {main}" }


texts: How can i get Tracking Number on Sales order grid

texts: I need tracking number on sales order grid,


texts: Skip import row, is not valid value “” for field “type”

texts:
i am using .xml file to import product in my new magento setup without sample data.. but after import, it gives an error...

Found 7 rows.

Starting catalog/convert_adapter_product :: parse
Skip import row, is not valid value "" for field "type"
Skip import row, is not valid value "" for field "type"
Skip import row, is not valid value "" for field "type"
Skip import row, is not valid value "" for field "type"
Skip import row, is not valid value "" for field "type"
Skip import row, is not valid value "" for field "type"
Skip import row, is not valid value "" for field "type"
Processed 100% 7/7 records
Imported 0 records


texts: Programmatically created attributes showing up in backend but not frontend

texts:
I have a script that bulk creates attributes and sets in Magento. The attributes and their sets look fine, and the settings are correct. When these attributes are created, I use AMartinez's customimpertexport script to bulk import products. These products do have the attributes correctly filled in.

If I look at a product in the back-end, they are there, with the correct values. When I take a look at the front-end however, the values are not displayed. Also, the layered navigation does not work (probably because of forementioned bug).

This makes me think there is something going wrong with linking attributes to products.

Since I'm pretty new at Magento, I don't know very much of it yet, so any explanations on how or why would be apreciated.


texts:
I have the following, (Note the capital and non capital letters.)

In app/design/adminhtml/default/default/template/customertab/action.phtml

  <form action="&lt;?php echo $this-&gt;getUrl('adminhtml/customertab/reset/'); ?&gt;" method="get"><input type="submit" value="Post This Form" /></form>

app/code/local/Sean/CustomerTab/controllers/Adminhtml/CustomerTabController.php

<?php

class Sean_CustomerTab_Adminhtml_CustomerTabController extends Mage_Adminhtml_Controller_Action
{
    function resetAction()
    {
        die("I'm lame");
    }

}

inside app/code/local/Sean/CustomerTab/etc/config.xml I have:

<config>
    <modules>
        <Sean_CustomerTab>
            <version>0.0.1</version>
        </Sean_CustomerTab>
    </modules>
    <adminhtml>
        <layout>
            <updates>
                <customertab>
                    <file>customertab.xml</file>
                </customertab>
            </updates>
        </layout>
    </adminhtml>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <sean_customertab before="Mage_Adminhtml">Sean_CustomerTab_Adminhtml</sean_customertab>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <global>
        <blocks>
            <customertab>
                <class>Sean_CustomerTab_Block</class>
            </customertab>
        </blocks>
    </global>
</config>

Why when I submit this form does it not call the function resetAction in my controller and die?

I know we are suppose to do 'module/controller/action' in the getUrl


texts: Magento 2 | Shipping Address gets set as Billing Address automatically

texts:
whenever the user sets a new standard shipping address it automatically gets set as billing address too.
The same in the opposite direction.

When he sets it for the first time both addresses get marked as standard shipping AND billing adresses.

How can I prevent this behaviour?

Thanks!


texts:
I am using chapagain/auto-currency-switcher Magento extension to setup auto currency and it's working well in the laptop browser but issue with mobile.

When I am trying to open a website from my mobile browser currency not change automatically it's always display USD

i.e. When i open site from laptop currency change to INR but it's not working on mobile


texts: How to get country dial code for telephone number in Magento 2?

texts:
I am getting data of country code and ID and name from

  Magento\Directory\Api\CountryInformationAcquirerInterface

using getCountriesInfo function.

Like this

{
    "id": "EG",
    "two_letter_abbreviation": "EG",
    "three_letter_abbreviation": "EGY",
    "full_name_locale": "Egypt",
    "full_name_english": "Egypt"
},
{
    "id": "KP",
    "two_letter_abbreviation": "KP",
    "three_letter_abbreviation": "PRK",
    "full_name_locale": "North Korea",
    "full_name_english": "North Korea"
},
{
    "id": "KW",
    "two_letter_abbreviation": "KW",
    "three_letter_abbreviation": "KWT",
    "full_name_locale": "Kuwait",
    "full_name_english": "Kuwait"
},

How can I get telephone code of that country as well in Magento 2 ?

like

Egypt telephone code +20
Kuwait telephone code +965


texts:
I have installed the Magmi into the magmi folder and I got it to work.
But somehow, it does not work anymore. I only get this exception:

PHP Fatal error:  Class 'Mage' not found in /var/www/c5shop/magmi/plugins    /extra/itemprocessors/groupprice/grouppriceprocessor.php on line 98
PHP Stack trace:
PHP   1. {main}() /var/www/c5shop/magmi/cli/magmi.cli.php:0
PHP   2. Magmi_Engine->run() /var/www/c5shop/magmi/cli/magmi.cli.php:132
PHP   3. Magmi_ProductImportEngine->engineRun() /var/www/c5shop/magmi/inc/magmi_engine.php:485
PHP   4. Magmi_Engine->callPlugins() /var/www/c5shop/magmi/engines/magmi_productimportengine.php:1834
PHP   5. GrouppriceProcessor->processColumnList() /var/www/c5shop/magmi/inc/magmi_engine.php:323

I even copied the whole magento shop from the online site where it works, but I still keep getting this exception.


texts: I need to attach HTML file. I have dynamic HTML content and attach the HTMl content in the email


texts: Magento 2 : Remove Delete Image checkbox from image type system configuration

texts:
How can i remove 'Delete Image' options from image uploder in system configuration

<field id="image_path" translate="label" type="image" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>Select Image</label>
 <backend_model>Demo\Generalconfiguration\Model\Config\Backend\Image</backend_model>
 <base_url type="media" scope_info="1">images</base_url>
</field>


texts: Anyone managed to have a dynamic default store view?

texts:
Due to different locales having more natural default values than others, the wish is to be able to have store views inherit values of a different store view rather than the common default store view (Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID) where default values are fetched from.

There is one constant indicating the default store view but a variety of classes write their own wrapper to that constant.

Has anyone ever implemented this behavior and how did you approach it? Does anyone have pointers on how to most elegantly solve this?


texts: how to update customer's billing address in magento2?

texts:
I want to update billing address:

$defaultBilling  = $this->_customerAccountManagement
            ->getDefaultBillingAddress($customerData->getId());

but $defaultBilling is is instance of \Magento\Customer\Model\Data\Address and doesnt have save method.

i tried via repository

$this->_addressRepository->getById($defaultShipping->getId())

but also a data model, not the model itself,
_addressRepository is injected in constructor as \Magento\Customer\Api\AddressRepositoryInterface

what do i do wrong ?


texts: Magento 2 - How to remove "Save" button in inline of grid customers index admin page?

texts:
How to remove "Save" button in inline of grid customers index admin page ?

Anyone know anything, can show me, pls!


texts: Multiple backend system with one website

texts:
I have two physical stores in two different places, only one store is using the magento backend system for the sales. I want to set up another magento backend system for the other store and they will be sharing the same product and the stocks(using the same website).

However, I do not want them to see each other's sales order. Is there any way to do this?

I have seen one method which is
Backend system-->system-->manage stores-->create store.
Is this the correct way to do?


texts: Magento 2: How to get ordered item details from order collection?

texts:
I have successfully got the order details and below is my code to get the details. Now, I need to get the ordered item details. Please guide
$collection = $this->_orderCollectionFactory->create()
            ->addAttributeToSelect('*');


texts:
I am new to Magento2, I need some guidance from magento geeks for migrating data from magento1 to magento2.

Quick Overview
I received a system that was built in magento2 from scratch. So I think there is no need to migrate the Themes, Extensions and other things except data from magento1 system as described in docs (see link below).

https://devdocs.magento.com/guides/v2.0/howdoi/migrate/migrate.html

I tried to read this link, and finally reached to this point where I have no understanding of settings.xml (see link below) file i:e which files I need to ignore, and which to include (That's the main issue)

https://devdocs.magento.com/guides/v2.0/migration/migration-tool-internal-spec.html#settings-migration-mode

Can someone please help me understand, what is the best way to migrate data/settings from Magento1 system to Magento2.

Feedback is much appreciated!!


texts: How to set userid for products added to cart in magento?

texts:
I am adding configurable products in to cart using the below code.

$product_id = 123;
$qty        = 1;
$product    = Mage::getModel('catalog/product')->load($product_id);
$cart       = Mage::getModel('checkout/cart');
$cart->init();

$superAttributeArray = array('151' => '3');

$params = array(
        'product' => $product_id,
        'qty'     => $qty,
        'super_attribute' => $superAttributeArray
     );
$cart->addProduct($product, $params);
$cart->save();

this code works well and I can able to add the product in to cart. Tested the same in Database.

I want to map user id for the quote that was created.
products will be added only after loggging in.
When I add products with above code, customer_id field in 'sales_flat_quote' table is NULL. I want current logged in user id need to be set to this quote.

Can any one help me with this?


texts: How to add custom new section(tab) in Product form in magento 2

texts:
How to add a new custom section in Product form in Magento 2 ?

I just want to add this new section as a new tab like content, configuration, etc...

Please refer to the attachment.


texts: magento category page not displaying after flush magento cache

texts: I am using magento 1.9, I have customized theme, I did flush magento cache and all my product stop showing. If i change the theme name in magento category it start showing again. What is the reason behind it ??


texts: Fotorama zoom_in and zoom_out buttons are not working in Magento 2.3.6

texts:
The zoom_in and zoom_out buttons are not working in the product pop-up gallery, however, while clicking the image, the image gets zoomed on the first double click and gets zoomed out on the second double click.
any suggestion for the solution?


texts: Add custom field in shipping address form of Checkout for Magento 2?

texts:
Below I have a shipping address form of checkout page and I would like to add another field (P.O. Box) in this form. I tried to look it up every forums and most of the answers were based on overriding.

Magento\Checkout\Block\Checkout\LayoutProcessor.
I checked app/code/company/Checkout/etc/di.xml but wasn't referencing layoutprocessor.

I am still confused from where this form is getting values from Magento\Quote\Api\Data\AddressInterface or Magento\Checkout\view\frontend\layout\checkout_index_index.xml

how can I add custom field to this form?


texts: Adding a preview product section on the product page

texts:
I am fairly new to the Magento platform so excuse my lack of knowledge!

I'm working on a Magento 2 project.

I need to add a preview section for my products.
Ideally, it would be between the product-info-main and the product-info-detailed. I'm looking to place this:
My Flipbook Preview (iCatalogue Module)

I understand I would need to create a template file for this and add the block to the product page. I am reading/studying layouts, blocks and templates (devdocs - customizing layouts). To help speed up my learning, could someone point me in the right direction or let me know the best practice for customizing a layout page?


texts:
I have my Magento package/theme structure configured like this:

In Configuration -> General -> Design:

In the package section the text "default".
In the themes section I have all the inputs empty except for the default input where I have introduced the name of my theme: "mytheme".

I need to get the package && theme name by code.

I have no problems with the package name:

Mage::getDesign('core/design_package')->getPackageName()

This code returns "default", which is perfect.

But when I try to get the theme name, I cannot get the text "mytheme".

Mage::getDesign()->getTheme('frontend');
Mage::getDesign()->getTheme('layout');
Mage::getDesign()->getTheme('template');
Mage::getDesign()->getTheme('skin');
Mage::getDesign()->getTheme('locale');

The different approachs return always "default".

If I introduce and save the name of my theme for example in the "layout" input, I can get it with:

Mage::getDesign()->getTheme('layout');

But how I can get the text of the "default" input?


texts: `$this->getViewFileUrl` adding en_us to a url

texts:
I'm trying to add an image from my theme in template like

<img src="<?php echo $this->getViewFileUrl('Vendor_Theme::images/image.svg'); ?>" />

But this url adds en_us. How can I remove it?


texts: Diff file list from Magento 2.1.7 to 2.1.8

texts:
Is there a diff file list of Magento v2.1.7 and v2.1.8?

Because I have overwritten some Core-Files in template.
For example minicart.js this resulted in a not functioning minicart. I fixed the problem, now I am not sure if there exists any other problems.


texts: Magento 2: Custom Instructions of Robots.txt is not working

texts:
We are facing an issue and need your guidance to solve that. The issue is that we have updated the custom instructions for robots.txt file as below
User-agent:*
Disallow:

But in the frontend, its showing as below
User-agent:*
Disallow: /

I have cleared and flushed the cache. So what could be the issue?
Any help will be appreciated!


texts:
I have created a custom report with custom collection. The issue is that I am getting an extra row in report grid. Please check screen shot to get a better idea.

Check my code below for one of the columns. Is there any property missing that would hide that row?

Grid.php

$this->addColumn('customer_lastname', array(
    'header' => Mage::helper('sales')->__('Last Name'),
    'index' => 'customer_lastname',
    'sortable'      => false,
    'filter' => false,
));

I also want to remove "Reset Filter" and "Search" button. So please help me for that also .


texts: Direct SQL query error: Column not found

texts:
I have a table with content:  I want to write a direct SQL query to select the time_delivery, where country is, for example, DK in this case. So it should return 1-5.  I was following a tutorial: https://fishpig.co.uk/magento/tutorials/direct-sql-queries/  And tried modifying query myself like this:

$country= "DK";
$query = 'SELECT time_delivery FROM ' . $table . ' WHERE country = '
     .$country . ' LIMIT 1';

But I get an error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'DK' in 'where clause'  I would assume that it has something to do with the fact the in the tutorial he uses an int but I want to use a string


texts: Magento2 disable a new module by default

texts:
I am new to Magento 2. I created a new module using:
Create Basic module Magento 2 - Inchoo

Once it was implemented then by default the module was enabled.
My question is how by default we can disable the module at first. Without the following steps:
 1. Without editing app/etc/config.php.
 2. Without command line

bin/magento module:disable Test_Helloworld

In Magento 1 we had option to disable a module by default by setting active as  false in app\etc\modules\Test_Helloworld.xml.
Is this option not exist in Magento 2.


texts: Magento 2.2.1 "Sorry, but something went wrong. Please contact the seller." Checkout using Authorized.net

texts:
Magento 2.2.1 : I have confirmed the transaction URLs, keys, and MD5 with Authorize.net. Transaction is processed and deducted from account.  Order is created within Magento, and emails are sent. However, the error message tells the customer at the time of the transaction that it has failed. When they attempt it again, it double charges them.

I have reviewed all logs and there is absolutely nothing being logged in system.log, error.log, debug.log with respect to the transaction.

Are there any other logs to review?

How can I properly inspect the browser session for response messages?

I have seen a similar issue in the past on a different website using 2.1 and the issue was with the transaction url. I corrected it to api2 and all worked well.

UPDATE:

I have switched to the Magento Blank theme and the issue still exists.

While viewing the console under the browser inspect, I see the following:

Refused to display 'https://www.<mydomain>.com/authorizenet/directpost_payment/redirect/x_invoice_num/000075321/success/1/controller_action_name/directpost_payment/is_secure/1/' in a frame because it set 'X-Frame-Options' to 'deny'.

Is this an issue with respect to what I am experiencing?


texts: Magento 2 configurable product import issue

texts:
I have uploaded configurable products using csv and it works fine when all the simple products have the same price.

However when the simple products are each having a different price within 1 configurable products they are not displayed.

Can somebody tell me what i am doing wrong.


texts:
does anyone have an idea, how it's possible to run the new ImportExport profile (e.g. for products or customer export) from shell?

I don't mean dataflow, but the new export routine from Mage_ImportExport module.

Thank you.


texts: I want to remove the quantity option from wishlist which shows on the customer dashboard in the wishlist section Magento 1.9 (Intenso theme)

texts:
I want to remove the option of quantity from the wishlist section found on the customer dashboard. As we a eCommerce company which have products with only 1 quantity.

<?php if (($this->getAddToCartQty($item) * 1) < 10): ?>
            <select class="simulate-change" name="qty[<?php echo $item->getId() ?>]" id="qty[<?php echo $item->getId() ?>]">
                <?php for ($i=1; $i < 10; $i++): ?>
                    <option value="<?php echo $i ?>"<?php if (($this->getAddToCartQty($item) * 1) == $i): ?> selected="selected"<?php endif; ?>><?php echo $i ?></option>
                <?php endfor; ?>
                <option value="10">10+</option>
            </select>


texts: Programmatically create configurable products

texts:
I am trying to create a product importer in Magento. Probably exception is thrown by the line: $product->setConfigurableProductsData($configurableProductsData);. When I comment it, no exceptions are thrown. What is wrong with the array?

$configurableProductsData = Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [attribute_id] => 135
                    [label] => 00
                    [value_index] => 48
                    [is_percent] => 0
                    [pricing_value] => 0
                )

            [1] => Array
                (
                    [attribute_id] => 92
                    [label] => Print
                    [value_index] => 511
                    [is_percent] => 0
                    [pricing_value] => 0
                )

        )

    [1] => Array
        (
            [0] => Array
                (
                    [attribute_id] => 135
                    [label] => 0
                    [value_index] => 48
                    [is_percent] => 0
                    [pricing_value] => 0
                )

            [1] => Array
                (
                    [attribute_id] => 92
                    [label] => Print
                    [value_index] => 511
                    [is_percent] => 0
                    [pricing_value] => 0
                )

        )

    [2] => Array
        (
            [0] => Array
                (
                    [attribute_id] => 135
                    [label] => 2
                    [value_index] => 49
                    [is_percent] => 0
                    [pricing_value] => 0
                )

            [1] => Array
                (
                    [attribute_id] => 92
                    [label] => Print
                    [value_index] => 511
                    [is_percent] => 0
                    [pricing_value] => 0
                )

        )

)

Exception:

exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`c1_estelles`.`catalog_product_super_link`, CONSTRAINT `FK_CAT_PRD_SPR_LNK_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C)' in /var/www/clients/client1/web97/web/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /var/www/clients/client1/web97/web/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /var/www/clients/client1/web97/web/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /var/www/clients/client1/web97/web/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /var/www/clients/client1/web97/web/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)


texts:
I have a Magento Site which have around 20 stores.

I have deleted 17 stores as they are not useful to me but when I go to Admin panel and go Catalog -> Categories then it shows me the following error

Requested store is not found

Update:

Give any suggestions on it.


texts: Which folders or files i should not upload on github when adding a new project

texts: I am pushing a magento 2 project on github but confused about the folders and files which i should not upload in first upload.I add a gitignore file, should i do not upload those files which are mentioned in .gitignore.Please guide.


texts: Bootstrap Popover error: undefined is not a function

texts:
I'm dealing with a problem that obviously a lot of people run into considering the amount of articles I've read and tried. However, none of these helped me actually solve the problem so I hope someone here has solution for this, I guess, simple problem.

For a Magento 1.8 installation I have developed a category grid that automatically renders a 3 column category layout based upon the main category. Then I implemented the Bootstrap Popover functionality accordingly:

Added jQuery.min.js
Added the Bootstrap.min.js

And used the following code to use in my grid:

I developed this on a dev site and everything worked perfectly. I then tried to implement this into my live site and ran into problems. I'm stuck at the following error:

TypeError: undefined is not a function (evaluating 'jQuery('[data-toggle="popover"]').popover()')

As you can see I already switched my code from using $ to jQuery in order to avoid any possible jQuery conflicts. However I'm still getting this error. I've also deleted another jQuery library that was being called upon but this also did not solve it.

I currently have a about half of my hair left since I get the feeling I'm overlooking a minor detail to solve this issue.


texts: Magento 2: Changing layout XML with URL parameter

texts:
Is it possible to control the layout using URL params? For example, I would like to be able to remove the sidebar block by adding &sidebar=no to the URL. It would be great if I can do this in the layout XML itself -- something like this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <action method="remove" ifrequestparam="sidebar" condition="true">
            <referenceContainer name="sidebar.main"/>
        </action>
    </body>
</page>

I know this is not possible right now, but what is the next simplest method to achieve something like this?


texts: Can we ask Customer if he like the shipping service or can pick the goods from the merchant shop ? If candidate choose to pick goods from merchant shop than i do not want to show customer the delivery option and method on checkout page.


texts: How to send email notification for custom events in magento 1.9

texts:
Im trying to send email notifications to customer in magento for custom events.

ie) Whenever the admin changes the status of a custom article, from Approve to Disapprove, there should be an email trigger to the customer.

I could get an email for order canceled event, i need to achieve for the above scenario.

I have tried below:

app\code\local\Magenshop\Recipe\etc\config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Magenshop_Recipe>
        <version>1.0.0</version>
    </Magenshop_Recipe>
</modules>
<global>
   <events>
       <recipe_admin_approve>
            <observers>
                <recipe>
                    <type>singleton</type>
                    <class>recipe/status</class>
                    <method>statusChangedApproved</method>
                </recipe>
            </observers>
        </recipe_admin_approve>
    </events>
</global>

So now when admin changes the status here, i should get a notification

\app\code\local\Magenshop\Recipe\Model\Status.php

<?php

class Magenshop_Recipe_Model_Status extends Varien_Object
{
const STATUS_ENABLED    = 1;
const STATUS_DISABLED   = 0;
const STATUS_REQUESTORM = 3;
static public function getOptionArray()
{
    return array(
        self::STATUS_ENABLED    => Mage::helper('recipe')->__('Approved'),
        self::STATUS_DISABLED   => Mage::helper('recipe')->__('UnApproved'),
        //self::STATUS_REQUESTORM   => Mage::helper('recipe')->__('Remove')
    );
}

static public function toOptionArray()
{
    return array(
        self::STATUS_ENABLED    => Mage::helper('recipe')->__('Approved'),
        self::STATUS_DISABLED   => Mage::helper('recipe')->__('UnApproved'),
        //self::STATUS_REQUESTORM   => Mage::helper('recipe')->__('Remove')
    );
}

//custom notification methods
public function statusChangedApproved()
{
        echo 'status changed';die;
}

}

?>


texts:
For example, I have catalog with SKU's:

ABCDE-3
HIJKL-6
ABCDE-5
VWXYZ-6
ABCDE-21

I want to fetch products that have SKU that starts from ABCDE-, so it'll return:

ABCDE-3
ABCDE-5
ABCDE-21

Is there any way to fetch the products by part of SKU in Magento? Or I'll have to add similar products manually?

Thank you.


texts:
guys so I'm just wondering how I can change the image that is used on my product listing page.

I imported my products with a CSV import and used the Media Gallery attribute to display external images.

The images are displaying fine however on my product listing page I'd like to be able to choose which image displays as my primary product image.

Any idea how this might be done?

For example if I have 5 external images on one product I'd like the primary image to be the first URL in the string to display.

So here is my code in list.phtml:

<img id="product-collection-image-<?php echo $_product->getId(); ?>" class="defaultImage" src="<?php if($aspect_ratio):?><?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(250);?><?php else: ?><?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($ratio_width,$ratio_height); ?><?php endif; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"/>
                    <img class="hoverImage" src="<?php if($aspect_ratio):?><?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(250);?><?php else: ?><?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize($ratio_width,$ratio_height); ?><?php endif; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'thumbnail'), null, true) ?>"/>

What should I amend to achieve this?

Thanks, Nick


texts:
Can anyone list the steps to insert edge animate on a page in Magento 1.9.
I can do it in an ordinary website but no luck here.Do I have to declare the js in an xml file or files?i can insert the stage div and insert the runtime stuff in the head ,its the js bit I'm stuck on.
Thanks.


texts: Change add to cart button based on customer group

texts:
Can anyone explain me how and where I can customize the add to cart button functionality based on the current customer group? I’d like to show a popup or redirect to a CMS page but only for a specific customer group.

Any help will be much appreciated!

Thanks in advance!
Damian


texts: How to get the specific product information on product landing page

texts:
I need the specific product id and product price on the product landing page to push in the datalayer magento 2.
Here is my code for datalayer
window.dataLayer = window.dataLayer || [];

window.dataLayer.push({

  'event':'product_view'

  'value':  <?php echo $product_price; ?>,

  'item': [
    {

   'itemId':  <?php echo $product_id; ?>,

   'google_business_vertical':'retail',

   }]

});

How can i get the product price and product id on the product landing page
I am using this code in details.phtml file in magento module how should i get the specific product information here


texts: Magento2 : Separate Login and Shipping Methods from Shipping Step

texts: I wanted to Separate login and Shipping methods from Shipping Step in Magento 2 on Checkout page ?


texts: Magento 2 : Switch also are different in Magento?

texts:
I have a problem, I made a switch case in my ajax.js file but even if the values fit a case, this is always the default case which is return,

someone has an idea why?

  There my code :

  app/code/Vendor/CustomerZipCode/view/frontend/web/js/ajax.js

define([
    'jquery',
    'underscore',
    'mage/template',
    'mage/url'
], function (
    $,
    _,
    template,
    url
) {
    'use strict';
    $(document).ready(function() {
        var ajaxurl = url.build('customerzipcode/zipcode');
        $('#zip_btn').val("not clicked");
        $('#zip_btn').on('click', function () {
            let Zip = $('#zip_txt').val();
            $('#zip_btn').val("clicked");
            $.ajax({
                showLoader: true,
                url: ajaxurl,
                data: {zipcode : Zip},
                type: "POST",
                dataType: 'json'
            }).done(function (data) {
                $('#test').removeClass('hideme');
                let displayzip ="You enter "+data['ZipCode']+" as zipcode <br/>";
                let fullchoice="You can choice between delivery or store pickup (for order over 200$)";
                let partialchoice="You can choice between delivery or store pickup, both for order over 200$";
                let nochoice="You are eligible only for store pickup for order over 200$";
                let html;
                console.log(data['ZipCode']);
                switch(data['ZipCode']){
                    case 11222 || '11222':
                        html=fullchoice
                        break;
                    case 11211 || '11211':
                        html=fullchoice
                        break;
                    case 11249 || '11249':
                        html=fullchoice
                        break;
                    default:
                        html=nochoice
                }
                $('#test p').html(displayzip+html);
            });
        });

    });
});


texts: Magento 2 get shipped items in sales_order_shipment_save_after event

texts:
I want the items that are shipped in the "sales_order_shipment_save_after" event(Not all the ordered items,only the currently shipped items). How can I do it. Here is my code. This code gives shipment id, but the shipment items are not returned.

class ProcessShipment implements ObserverInterface
{

     /**
     * @var eventManager
     */
    protected $_eventManager;

    /**
     * @var ObjectManagerInterface
     */
    protected $_objectManager;

    protected $_shipmentItemCollectionFactory;

    public function __construct(
        \Magento\Framework\Event\Manager $eventManager,
        \Magento\Framework\ObjectManagerInterface $objectManager,
        \Magento\Sales\Model\ResourceModel\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory,
        \Magento\Store\Model\StoreManagerInterface $storeManager
    ) {
        $this->_eventManager = $eventManager;
        $this->_objectManager = $objectManager;
        $this->_storeManager = $storeManager;
           }

    public function execute(Observer $observer)
    {

        $shipment = $observer->getEvent()->getShipment();
        $order = $shipment->getOrder();
        $items = $this->_shipmentItemCollectionFactory->create()->setShipmentFilter($shipment->getId());

        foreach($items as $item){
            $id = $item->getProductId();
        }

}


texts: Send Sales Order mail to multiple account Programatically

texts:
In this screenshot you can see sales order mail sending to multiple acounts .  and It work good mail sending to all accounts which mention in Send Order Email Copy To
This is hard code to give account.
I am developing multi-vendor site. i want to give just those vendor's accounts for email which  has items in this order.

Can anyone tell me how can give programmatically emails account instead of giving hardcode in frontend as shown in screenshot.


texts: PayPal cart contents for Magento 2 bundled products

texts:
So the issue I have is with gift hampers on my site. They are set up as bundled products with drop-down selections e.g. '4 Piece Hamper' {product1, product2, product3, product4;}. However, inside the PayPal Transaction Details Page for each order it only displays '4 Piece Hamper' (without it's actual selections).

I understand that usually orders and their details would be extracted from the E-Commerce CMS dashboard, however my client is 'technologically challenged', and isn't willing to change their procedures.

Previous to this project with Magento CE, we had to store the bundled products in an array and display them in the PayPal product description I believe, but this had its limitations due the top character limit limiting the number of options a hamper could have to display its options in PayPal.

Is there any way around this issue?

Thanks a lot,
William.


texts: over-riding magento's PriceHtml generation - doesn't work on homepage

texts:
I used an extension (Simple Product Pricing by Ayasoftware) to make it so that product pages and catalog listing pages show a "from:" price rather than £0.00 for configurable products, problem is that when I use the same function that I use in the listing/view pages on the homepage - it still shows £0.00

The code for displaying the price on the homepage is as follows:

$productBlock= Mage::app()->getLayout()->createBlock('catalog/product_price');
echo $productBlock->getPriceHtml($_product, true);

As you can see I create an instance of catalog/product_price and use its getPriceHtml function to get the price, so why does it display a different output than when I use it on the product listing and view pages?

On those pages I can just use $this as they extend the class with the method in but even if I do it the createBlock way (exactly as I have done on the homepage) then it still shows what I want - so I would pose they are using the same function (as I instantiate it the same way)


texts: How can I update my Magento version 2.3.2 to 2.3.3 in a simple way?

texts:
I have no idea how to about magento 2.3.2 to 2.3.3
can anyone tell how to update it in a simple manner.
can it be possible with composer or anything else.


texts:
I used the following command to setup my cronjob:

sudo crontab -e -u www-data

and the actual cronjob:

*/5 * * * * /bin/sh /var/www/cron.sh >/dev/null 2>&1

I also have APC running on my site. APC CLI is on:

apc.enable_cli = 1

However, I am getting the following error. It feels like the cron may not be running with enough previlages. Should the cron be run as root? Sources advised me against this.

Cron error while executing rule_apply_all:

exception 'Zend_Cache_Exception' with message 'can't get apc memory size' in /var/www/lib/Zend/Cache.php:209
Stack trace:
#0 /var/www/lib/Zend/Cache/Backend/Apc.php(191): Zend_Cache::throwException('can't get apc m...')
#1 /var/www/lib/Zend/Cache/Backend/TwoLevels.php(518): Zend_Cache_Backend_Apc->getFillingPercentage()
#2 /var/www/lib/Zend/Cache/Backend/TwoLevels.php(192): Zend_Cache_Backend_TwoLevels->_getFastFillingPercentage('saving')
#3 /var/www/lib/Zend/Cache/Core.php(390): Zend_Cache_Backend_TwoLevels->save('1391196921', 'MAGE_AW_FUE_LOC...', Array, 1800)
#4 /var/www/lib/Varien/Cache/Core.php(76): Zend_Cache_Core->save('1391196921', 'AW_FUE_LOCK', Array, 1800, 8)
#5 /var/www/app/code/core/Mage/Core/Model/Cache.php(380): Varien_Cache_Core->save('1391196921', 'AW_FUE_LOCK', Array, 1800)
#6 /var/www/app/code/core/Mage/Core/Model/App.php(1147): Mage_Core_Model_Cache->save(1391196921, 'aw_fue_lock', Array, 1800)
#7 /var/www/app/code/local/AW/Followupemail/Model/Cron.php(98): Mage_Core_Model_App->saveCache(1391196921, 'aw_fue_lock', Array, 1800)

After a little bit of tracing, I ended up at the following:

    public function getFillingPercentage()
{
    $mem = apc_sma_info(true);
    $memSize    = $mem['num_seg'] * $mem['seg_size'];
    $memAvailable= $mem['avail_mem'];
    $memUsed = $memSize - $memAvailable;
    if ($memSize == 0) {
        Zend_Cache::throwException('can\'t get apc memory size');
    }
    if ($memUsed > $memSize) {
        return 100;
    }
    return ((int) (100. * ($memUsed / $memSize)));
}

So it must mean $memSize == 0 however when I setup a test PHP script and evaluate $memSize, it gives me the right value. So why would during a cronjob would this be different?

I have commented out in local.xml the following cache node and the cronjob is running fine. It would be ideal to understand what the following node actually does. I take it that Zend looks at this config:

    <cache>
        <backend>apc</backend>
        <prefix>MAGE_</prefix>
    </cache>


texts:
Is it normal that not all our products are not listed in catalog_product_flat_1 even after I have reindexed  catalog_category_product or did i reindex the wrong index here ?
I want to avoid reindexing all the indexes.


texts: Magento 2 - Check if category exists or not

texts:
I need to check if category exist or not by category name.

I have try this with category name test but it does not work at the same time it does not throw any error

$category = $this->_objectManager->create('Magento\Catalog\Model\Category');

$cate = $category->getCollection()->addAttributeToFilter('name','test')->getFirstItem();

if (!isset($cate)) {
    echo "not exist";
} else {
    echo "already exist";
}

how to deal with check if category exist or not?

Thanks


texts: Reduce CSV upload time for big csv files

texts: I am working on a custom module where I want to upload a csv file in the admin backend. The csv would have a minimum of 150000 entries and it is right now taking more than 2 hours to complete the import


texts: Order of processing actions in local.xml

texts:
This is an extract from my local.xml:

<reference name="head">
    <action method="addLinkRel">
        <rel>stylesheet</rel>
        <href>//fonts.googleapis.com/css?family=Cabin:400,600,700</href>
    </action>
    <action method="addItem">
        <type>skin_css</type>
        <name>css/custom-atf.css</name>
    </action>
    ...
</reference>

In the html source I would expect the google font link to appear before the custom-atf.css link but that is not the case. The google font link is being loaded almost last of all the scripts and css files.

Is there a specific order in which different actions in local.xml are processed?


texts: What is Difference Between Group,Bundle,Configurable,Virtual & Simple Product In Magento?

texts: I can't Find the difference between in all of them.Please Explain it.


texts: How to change products per page from category admin

texts: I want to assign massive products to any category using the category default page. But I am unbaled to show the maximum product on the grid the maximum limit is 200 products, how can I change these values and set custom values as we do in the products grid. So that I check as many products to select and assign to the category I am using Magento 2.3.3


texts:
How do I add a tracking link to mail template?

Here is what I tried:

In System > Transactional Emails I opened the template for Shipment Email Template for Guest  (GLOBAL). I thought tracking numbers are included here:

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml'
  shipment=$shipment order=$order}}

So I copied email/order/shipment/track.phtml into my template and added a tracking link but it does not show up in the email:

<a href="http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=<?php echo $_item->getNumber() ?>"><?php echo $_item->getNumber() ?>


texts:
So I need to include an add to cart button on a cms page so I'm trying to do this through a template block file in php.
I can't figure out how to do this for just one static product though.

So the code for the usual add to cart button on product pages looks like this:

<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>

        <button type="button" title="<?php echo $buttonTitle ?>" class="btn btn-warning add-to-cart" style="margin-top:6px;width:200px;margin-left:20px;" data-url="<?php echo $this->getAddToCartUrl($_product, ['_secure' => true]) ?>" onclick="ga('ec:setAction', 'add'); ga('send', 'event', 'UX', 'click', 'add to cart');"><?php echo $buttonTitle ?></button>
        <?php echo $this->getChildHtml('', true, true) ?>

<?php endif; ?>

But how do I do this for just the product with the ID 33?
So I only want to display an add to cart button that adds the product with this ID on a static page.
I've tried using a url on the cms page so like http://testing.co.uk/checkout/cart/add?product=[33]&qty=[1]
but this goes to the cart, but doesn't add the product.


texts: Category URL rewrite generating with categoryname (hypen + increment) for n store views

texts:
My website has 10+ store views, I observed that while creating new categories the default URL rewrite functionality of Magento is adding hyphen + increment id based on the store views count.

like example below

domain.com/us/abc-1.html for USA store view - Default store view
domain.com/uk/abc-2.html for UK store view
..
..
domain.com/fr/abc-10.html for France store view

Before adding the store views, we haven't faced issues like this. Can anybody help me on this to understand the logic and remove the (hyphen + increment id) from the URLs while generating itself?

Note: For the earlier generated category URLs before adding the store views, we have not faced the same issue. There it is working fine. Like below.

domain.com/us/xyz.html for USA store view - Default store view
domain.com/uk/xyz.html for UK store view
..
..
domain.com/fr/xyz.html for France store view


texts: 400ms time to first byte ( ttfb ) on a fully cached magento 0.01mb page on 4g vps server, how can I reduce it?

texts:
I am trying to reduce my time to first byte on a magento 1.8.1 site.

Magento is running on an openVZ 4g vps server all on its own
I have LESTI::FPC http://gordonlesti.com/lestifpc extension which works great, I have even tried removing the dynamic and lazy blocks but see no performance difference
Redis is setup and working for fpc cache and session caching
I have just one colour swatch extension installed
The time to first byte is the same for any page on the website once the page has been cached give or take 50ms from a blank homepage to product category page with layered navigation
I have 4 websites setup and just 10 products, 3 users
mysqltuner.pl has been used to optimise the mysql server
I have allocated a good amount of ram to php and using 'top' I can see the resource usage is never over 50% when performing the heaviest backed functions in magento like re-indexing.

All the standard client side stuff has been done such as reducing request and file life limits and such, here I am asking about server side performance.

above is chrome showing the 400ms wait for the first byte

So, I can't understand why a this server, which is purely hosting 1 magento website takes 400ms to return full cached homepage which is a tiny 10025 bytes html file ? btw, with the standard magento cache the ttfb is 750ms on the homepage as of now.

As mentioned I am using redis for the cache so I believe the cache is stored in the memory in that case and would be the fastest option, it seems like overkill at this time but should be the fastest option but then using the standard file/disk based magento cache gives the same results.

(I ran a mysql query log when viewing the cached homepage and saw just 1 mysql query so to me that rules our mysql being the issue) but maybe not?

I have read a number of similar posts about similar issued with people using varnish and often people reply about the performance of magento, but once the page is cached, magento and mysql doesn't come into it does it? apart any dynamic blocks which are not cached? (as mentioned I tried disabling dynamic and lazy blocks in the fpc extension i am using and saw I tiny improvement, maybe 20ms)

All I can think is it is server hardware limitation? but surely 4g is enough to run this? some people slate openvz because you don't have truly allocated resources, but like i said, using top command the resources are not being strained.

The blank home page is actually 50ms slower to return the first byte than a category with 10 products...

So can anyone please give me some advice? to me it seems to boil down to an issue of the server returning the cached files slowly rather than magento seeing as the pages are fully cached.

Thanks very much for any help.


texts:
I followed a lot of tutorials to create a custom RWD theme with Magento.
But when I'm finished, the website is  not the same as the original RWD theme.

The header with the profile tab is not displayed correctly.
It got no styling
I checked the console and there was nothing displayed.
It must show something like this.

But it shows this

I don't know if the CSS is loaded correctly
You could check Unilinxx.com if you want to see the result


texts:
I have 3 blocks that are in the cms block and displayed on the cms page.
How to place each block in a separate custom tab

Tabs stretched to full page

3 templates:

app/code/Qqq/Wwwww/view/frontend/templates/template1.phtml
app/code/Qqq/Wwwww/view/frontend/templates/template2.phtml
app/code/Qqq/Wwwww/view/frontend/templates/template3.phtml

cms block install script:

app/code/Qqq/Wwwww/Setup/InstallData.php

 $block = <<<BLOCK_CONTENT

block 1

   {{block class="Qqq\Wwwww\Block\Qw" name="block_1" template="Qqq_Wwww::template1.phtml"}}

block 2

   {{block class="Qqq\Wwwww\Block\Qw" name="block_2" template="Qq_Wwww::template2.phtml"}}

block 3

   {{block class="Qqq\Wwwww\Block\Qw" name="block_3" template="Qq_Wwww::template3.phtml"}}
BLOCK_CONTENT;

 $cmsBlock = [
     'title' => 'Block 1',
     'identifier' => 'blocks',
     'stores' => [0],
     'is_active' => 1,
     'content' => $block
 ];

 $this->blockFactory->create()->setData($cmsBlock)->save();

cms page install script:

$pageContent = <<<PAGE_CONTENT
    {{block class="Magento\Cms\Block\Block" block_id="blocks"}}
PAGE_CONTENT;

        $cmsPageData = [
            'title' => 'Blocks Page', // cms page title
            'page_layout' => '1column', // cms page layout
            'meta_keywords' => 'Blocks Page', // cms page meta keywords
            'meta_description' => 'Blocks Page', // cms page description
            'identifier' => 'blocks-page', // cms page url identifier
            'content_heading' => '', // Page heading
            'content' => $pageContent, // page content
            'is_active' => 1, // define active status
            'stores' => [0], // assign to stores
            'sort_order' => 0 // page sort order
        ];


texts:
Hope all is well.

It would be great if you could help me to figure out the order flow in Magento 2.

I understood these steps Order Placed -> Order in Pending -> Payment Confirmed/Verified. But got confused with the invoice generation. I would like to use COD (Cash on Delivery) as the payment method and I need to generate an invoice which shows the "amount due" and send it to the customer.

Here are my questions:

At which step I can print the packing list to pick the order and process it?
Do I need to invoice the order before shipping it?
How can I modify an order (cancel one item from an order)?
Can I cancel an order after I ship it?
How do I handle a COD order return?
Can you suggest the best tutorial for Magento 2 order flow sequence, credit memo, generating packing slip etc?


texts: How to filter product collection using ratings?

texts:
I want to filter the product collection using "Ratings". As it is not an attribute of products how can i do that?

$collection = Mage::getModel('catalog/product')->getCollection()
             ->addAttributeToSelect('*')
             ->addAttributeToFilter('type_id', 'configurable')
             ->addAttributeToSort('name', 'asc');

I want to do Ratings filtering for the above collection.

Thanks in advance.


texts: Remove specific criteria from Varien_Db_Select join

texts:
I have Varien_Db_Select object with some joins and I need to change condition in one of them. How can I do this?

update: I found that condition in "from" part and then in "joinCondition" part. I can loop through, but I can't put them back