texts: How to get root category id in admin product grid

texts:
I have multi-website, multi-store magento installation. Each store have different root category.

I have created admin users for each store and restricted access to their related store.

In each admin panel product grid I have to display his product only.

So I want to filter each product before display in grid, To do this i need the root category id of current logged in admin.

But whenever I try to get current admin store root category, the value is zero.

So the questions are:

How can I get currently logged in admin store's root category?
How can I get each product root category?

Thanks in Advance..


texts: How to get selected percentage discount all products

texts:
I want to get specific percentage (i.e 5%) discount all products. how can I get the products?

I am using Magento 1.7.0.2 and trying with below code for all selected products:

    $_pro_collection = Mage::getModel('catalog/product')->getCollection();
    $_pro_collection->getSelect()->order('(price_index.final_price / price_index.price)', 'DESC');

Your help will be appreciated. Thanks in advanced.


texts: Category Block Random.phtml Display Issue

texts:
How can I limit this block of code to display only 4 images from the category?

   <?$_productCollection=$this->getLoadedProductCollection()?>
   <?if(!$_productCollection->getSize()):?>

   <?=$this->__('There are no products matching the selection.')?>

   <?else:?>

<?=$this->__('Accesssories')?>

   <?$i=0;$j=0; foreach ($_productCollection as $_product): ?>
   <?if ($i%2==0):?>
   <tr class="<?=($j++%2==0)?'even':'odd'?>">
   <?endif?>

   <a href="<?=$_product->getProductUrl()?>"><img src="<?=$this->helper('catalog/image')->init($_product, 'small_image')->resize(95, 95);?>" width="95" height="95" alt="<?=$this->htmlEscape($_product->getName())?>"/>

<a href="<?=$_product->getProductUrl()?>" class="product-name"><?=$this->htmlEscape($_product->getName())?>

   <a href="<?php echo $this->getAddToCartUrl($_product) ?>" data-url="<?php echo $this->getAddToCartUrl($_product) ?>" data-id="<?php echo $_product->getId(); ?>" title="<?php echo $this->__('Add to Cart') ?>" class="btn btn-primary ajax-cart" > <?php echo $this->__('Add to Cart') ?>

   <?if ($i%2!=0):?>

   <?endif?>
   <?$i++?>
   <?php endforeach?>

   <?endif;?>

I'm displaying the results like this here in my category

{{block type="catalog/product_list" category_id="22" products_count="4" columnCount="4" template="catalog/category/random.phtml"}}

however products_count="4" doesn't work. it just displays all images in that category. Is there some php I can used to control,

<?$_productCollection=$this->getLoadedProductCollection()?>


texts: Getting at variables from CMS block insertions

texts:
Magento 1.9

I am trying to add a form several times onto a CMS page with code similar to:

{{block type="core/template" template="page/html/jobappform.phtml"}}

But I want to pass a variable thru to the PHP in jobappform.phtml so I can differentiate between the different forms.

I have tried using:

{{block type="core/template" template="page/html/jobappform.phtml?a=1&b=2"}}

In the hope I get get at the variables with $_GET, but if I use this the form doesn't appear.

Is there a way of doing this:

{{block type="core/template" template="page/html/jobappform.phtml" a="1" b="2"}}

And then in jobappform.phtml can I get at variables a and b?


texts: magento 2 Add totals row at end of the grid

texts:
Note: I am not using ui component to create my grid

I want to show totals at the end of the grid:

I got stack exchange question related to this, but its for Magento 1.9

How to add a column Total row in a magento grid at the end

Can anyone would help me on this?


texts:
My site is www.suresafety.com which is in Magento 1.9.2.0. It was working fine for the last 1.5 years, but from the last 2 months, it is too much slow. There are 1400 products in it.

Its speed in Speed Insight was 83 before 1 year. Now it is 39 which is not good for our e-commerce.

I have done all this on steps:

Combine CSS and JS Files

In the Magento Admin, go to System > Configuration > Developer.
Under “Javascript Settings”, change “Merge Javascript Files” to YES.
Under “CSS Settings”, change “Merge CSS Files” to YES.
Clear the cache.

Enable Flat Catalog

In the Magento Admin, go to System > Configuration > Catalog.
Under “Frontend”, change “Use Flat Catalog Category” to YES.
Under “Frontend”, change “Use Flat Catalog Product” to YES. (optional)
Clear the cache.

Make sure the section with the deflate compression rules is not commented to enable the default compression rules.

<IfModule mod_expires.c>

    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>

Add expiration time for images, JS, CSS (.htcaccess)

##for image test
<IfModule mod_expires.c>

    ExpiresActive On

    ExpiresByType image/jpg "access 1 year"

    ExpiresByType image/jpeg "access 1 year"

    ExpiresByType image/gif "access 1 year"

    ExpiresByType image/png "access 1 year"

    ExpiresByType text/css "access 1 month"

    ExpiresByType text/html "access 1 month"

    ExpiresByType application/pdf "access 1 month"

    ExpiresByType text/x-javascript "access 1 month"

    ExpiresByType application/x-shockwave-flash "access 1 month"

    ExpiresByType image/x-icon "access 1 year"

    ExpiresDefault "access 1 month"

</IfModule>

Cpanel -> Optimize Website -> tic on 2nd option(Compress all content)
Download optimized images, CSS, JS from Page Insights (bottom)
Replace with the old one.


texts: Abnormally large size of 'update.log' caused by error: "Cron readiness check failure"

texts:
I'm using 2.3

one day my update.log will be 1gb ago.

and i open this file showing this message.

how can i fix it,thank you!

  [2019-01-31 17:00:02] update-cron.ERROR: Cron readiness check failure!
  Found non-writable paths:     /public_html/.php_cs.dist
    /public_html/.travis.yml    /public_html/CHANGELOG.md
    /public_html/COPYING.txt    /public_html/Gruntfile.js.sample
    /public_html/LICENSE.txt    /public_html/LICENSE_AFL.txt
    /public_html/app/.htaccess  /public_html/app/autoload.php
    /public_html/app/bootstrap.php  /public_html/app/functions.php
    /public_html/auth.json.sample   /public_html/bin/.htaccess
    /public_html/bin/magento    /public_html/dev/.htaccess
    /public_html/dev/tests/acceptance/.htaccess.sample
    /public_html/dev/tests/acceptance/composer.lock
    /public_html/dev/tests/acceptance/tests      .......

i already ran this but can't help.

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R :xxxx .
chmod u+x bin/magento


texts: New order notification mail not working in magento

texts:
My website is on one server.and mail is on different server.

My website is in Magento 1.9.2.3. It is now live on server and the order comes as the URL is same as old website.

But the problem is Mail has to be sent on new order to admin and customer too. Mail functionality is not working.

I have set
System -> Configuration -> Store Email Address. and System -> Configuration -> sales -> Sales Emails

I have also set System -> Configuration -> Advanced -> System -> Cron(Schedule Task)

Still i don't receive any mail on new order [On admin side or as a customer]

I have also following steps which are in this video
https://www.youtube.com/watch?v=GqRlXmBvvkE

I have also look that blog


texts: How to create category attribute programmatically in Magento2

texts:
I am workign on custom extension for magento 2 and i need to create category attribute programmatically,

List me exact steps, because i am not sure is the code to be placed in InstallData.php or where?


texts: Fork of Old magento/magento2-samples Modules

texts:
Magento's GitHub account used to have a project at

https://github.com/magento/magento/magento2-samples

This repository contained around 20 examples of How to Build a Magento 2 module.  However, this project's been deleted because -- reasons?

While some of practices in these modules have been abandoned, and not all the modules ran, this was still an important resource, both historic and practical, for developers learning and working with Magento 2.

Does anyone know if there's any public forks of the repository available?


texts: My Custom product tab not displaying in Magento 2

texts:
I am trying to inject my custom product tab in storefront on product view page, but it's not displaying. For this I am written below code.

registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Test_ProductTabs',
    __DIR__
);

Test/ProductTabs/Block/CustomTab.php

<?php
namespace Test\ProductTabs\Block;

use Magento\Catalog\Model\Product;

class CustomTab extends \Magento\Framework\View\Element\Template{

    /**
     * @var Product
     */
    protected $_product = null;

    /**
     * Core registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry = null;

    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Framework\Registry $registry,
        array $data = []
    ) {
        $this->_coreRegistry = $registry;
        parent::__construct($context, $data);
    }

    /**
     * @return Product
     */
    public function getProduct()
    {
        if (!$this->_product) {
            $this->_product = $this->_coreRegistry->registry('product');
        }
        return $this->_product;
    }

}

Test/ProductTabs/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Test_ProductTabs" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Catalog"/>
        </sequence>
    </module>
</config>

Test/ProductTabs/view/layout/catalog_product_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

        <referenceBlock name="product.info.details">
           <block class="Test\ProductTabs\Block\CustomTab" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
               <arguments>
                   <argument name="title" translate="true" xsi:type="string">Kit Components</argument>
               </arguments>
           </block>
       </referenceBlock>

</page>

Test/ProductTabs/view/templates/kit.phtml

Kit Components

above code is not working for me. Any help on this?


texts: change Paypal Payment Method "What is Paypal?" text & hyperlink for Paypal Express Checkout

texts:
I'm trying to change the text and hyperlink for "What is Paypal?" for Paypal Express Checkout in the Payment step. Which file should i edit?

I changed the text of 'What is paypal?' in vendor\magento\module-paypal\view\frontend\templates\payment\mark.pthml but the changes does not show up on frontend after flush cache & recompile static content. Also, can't find the place to change the hyperlink.

mark.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
/**
 * Note: This mark is a requirement of PayPal
 * @var \Magento\Paypal\Block\Express\Form $block
 * @see \Magento\Paypal\Block\Express\Form
 */
$url = $block->escapeUrl($block->getPaymentAcceptanceMarkHref());
?>

<img src="<?= $block->escapeUrl($block->getPaymentAcceptanceMarkSrc()) ?>"
     alt="<?= $block->escapeHtml(__('Acceptance Mark')) ?>" class="paypal icon"/>
<a href="<?= /* @noEscape */ $url ?>"
   onclick="javascript:window.open(
           '<?= /* @noEscape */ $url ?>',
           'olcwhatispaypal',
           'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,' +
           'left=0, top=0, width=400, height=350'
       ); return false;"
   class="action paypal about">
    <?php if ($block->getPaymentWhatIs()) {
        echo $block->escapeHtml(__($block->getPaymentWhatIs()));
} else {
        echo $block->escapeHtml(__('What is PayPal test test?'));
} ?>


texts:
On my env, I want to run a specific cron via cmd or programmatically.

My magento2 cron is disabled, how to make sure that this particular cron is set to queue


texts:
So, I'm building a custom module to allow admins to define some custom business logic. I have most of it worked out at this point but I would like to tap into the admin action log that is included in Magento Enterprise Edition.

Is there a helper or model that automatically picks up the current user information (ID, time, IP, etc) and just allows me to specify the unique-to-my-module info?


texts:
I added a new review to my newly added product and approved it from the backend. It is showing 1 review and link, but does not showing the review image yellow star. So please help me to bring this star in the product detail page

Thanks


texts: Shopping Cart Price Rule exclude parent products categories

texts:
Please help.

We add all our products so that only the parent products get assigned into categories. I need to add a shopping cart price rule to exclude certain categories i.e:

If ALL of these conditions are TRUE :
 Category is not one of [category IDs]

The problem is the child products don't belong to any categories so the rule doesn't get applied to the cart.

Any solutions????


texts:
I want to use the features of default_head_blocks.xml in a custom block that will not be rendered for output, but saved in a file.

As far as I understand it, the HTML head is now rendered completely based on layout XML, it's not a block class anymore. But is there a sensible way to reuse <head> rendering without rendering a complete page?


texts: Set shipping method programatically Magento 2 return 0

texts:
I am setting the Shipping Method programatically in the observer checkout_cart_add_product_complete, the code works fine. I navigate to the cart page, I am able to see the shipping price in the summary, but after the page loads completely, it gets the totals again and the shipping price returns 0.
Below is the code in the observer:
public function execute(EventObserver $observer)
{
    /** @var \Magento\Catalog\Model\Product $product */
    $product = $observer->getEvent()->getDataByKey('product');
    $quote = $this->_checkoutSession->getQuote();

    $totals = $quote->getTotals();
    $subtotal = $totals['subtotal']['value'];

    $shippingAmount = 15;
    $total = $subtotal + $shippingAmount;

    $address = $quote->getShippingAddress();
    $address->setCollectShippingRates(true)->collectShippingRates();
    $address->addShippingRate($rate);
    $address->setShippingMethod('vendor_shipping_rate_table')
            ->setShippingDescription("Shipping Description");

    $address->setSubtotal($total);
    $address->setBaseSubtotal($total);
    $address->setSubtotalInclTax($total);
    $address->setGrandTotal($total);
    $address->setShippingAmount($shippingAmount);
    $address->setBaseShippingAmount($shippingAmount);
    $address->setShippingInclTax($shippingAmount);
    $address->setBaseShippingInclTax($shippingAmount);
    $address->setBaseGrandTotal($totals);
    $address->setDiscountAmount(0);
    $address->setBaseDiscountAmount(0);
    $address->save();

    $quote->collectTotals()->save();
}


texts:
I have attempted to edit the minicart on our webstore, however this resulted in an error occurring which seems to be quite common but no one seems to have an easy fix. The minicart now outputs a JS error in the console:

  type error: unable to bind ko if: getCartParam('summary_count')

This has been on our website for three days now and it is affecting sales. I am new to magento and messed up by editing the vendor/magento/module-checkout files.

I want to revert back to the vanilla checkout but am struggling with this. Does anyone know where I may find the original files?


texts: Magento 2.3.1 Getting JS errror on checkout/#payment Uncaught TypeError: items is not a function

texts:
I am getting JS error 'Uncaught TypeError: items is not a function' on checkout/#payment step in browser console.
It's slowing down page load.
Please check screen shot.


texts: Images are not loading after upgrade to Magento 2.3.0

texts:
We have upgraded magento from 2.2.8 to 2.3.0

Upgrade is done correctly, But product images are not loading in list page and product detail page.

Right now the product images are taking like below

  site_url/media/catalog/product/cache/2765542505660baab28ecd555e27366e/t/m/image_name.jpg

which is going to 404 error.

Same url if i open like below by removing cache the image is loading

site_url/media/catalog/product/t/m/image_name.jpg

So, how can i change the code in list page, product page and all other pages to load the product image without from the cache folder through out the site.

I have run the upgrade, static content deploy and flushed the cache also.

Is there any fix available for this. I am using magento commerce edition in magento cloud.

Right now all product images are loading from media/catalog/product/cache folder, but all are returning 404 not found

Can anyone help me to resolve this issue?

Thanks


texts: Magento 2.3 use of `db_schema_whitelist.json` file in etc directory of each module

texts:
What is the use of db_schema_whitelist.json located in Magento Catalog etc directory?

In Magento 2.3 version, I found  db_schema_whitelist.json and db_schema.xml files, in the Magento_Catalog module.

Having idea about db_schema.xml, that is related with declarative schema management.

Also found that db_schema_whitelist.json file located in etc directory and it contains GraphQL based attributes that may be require to fetch attributes at frontend.

I want to know that which operations Magento 2 application will consider for db_schema_whitelist.json for Magento_Catalog in terms of GraphQL.


texts: How do I find the backing store for Amasty Full Page Cache?

texts:
Background

I just inherited a Magento site. The last guy left without leaving any notes/documentation. :) I know we're using AMFPC because the module is installed and enabled, and the business team has a process to flush it at certain times (and the site gets a little bit slower when they do this until the cache is warmed up).  I'm trying to figure out where the cache is actually storing data.

Question

Is it on disk somewhere?  Or is it on a separate cache server?

More Context

We have a cache server running memcached so I'm wondering how I can tell if AMFPC is pointed at memcached somehow.  We have 2 web servers so I'm hoping it's a distributed cache so it can be shared between both servers, but I don't know how to check.

I checked app/etc/amfpc.xml as well as the module in Magento Admin but couldn't find anything.

Can someone explain how to trace what is backing the AMFPC?

Update 1

I checked folders in MAGENTO_ROOT/var and found the full_page_cache and amasty_cache are both empty:

[myuser@webserver var]$ ls
amasty_fpc  cache  full_page_cache  locks  log  report  resource_config.json  sli  tmp
[myuser@webserver var]$ du amasty_fpc/
4   amasty_fpc/
[myuser@webserver var]$ du full_page_cache/
4   full_page_cache/mage--tags
16  full_page_cache/
[myuser@webserver var]$ sudo du cache/
80  cache/mage--b
3048    cache/mage--d
256 cache/mage--7
3200    cache/mage--9
340 cache/mage--5
308 cache/mage--1
224 cache/mage--4
101584  cache/mage--f
852 cache/mage--6
552 cache/mage--2
5212    cache/mage--3
3220    cache/mage--c
236 cache/mage--8
8504    cache/mage--e
3000    cache/mage--0
200 cache/mage--a
130820  cache/

However, cache appears to be populated.  Not sure what that one does anyway.  I also checked app/etc/local.xml and found this:

<session_save><![CDATA[memcache]]></session_save>
<session_save_path><![CDATA[tcp://<IP_ADDRESS_OF_MY_CACHE_SERVER:11211?persistent=1&weight=2&timeout=10&retry_interval=10]]></session_save_path>

That matches the IP and port of my memcached server so I think it's safe to say we are using memcached for saving session data.

I didn't find anything useful in app/etc/enterprise.xml or in app/etc/amfpc.xml.

Is there any definitive place to look to see where AMFPC is storing the cached pages?


texts: The directory is not writable by server- Magento 1.9 - Images

texts:
Ok! so I have finally upgraded to Magento 1.9 from Magento 1.7 through cPanel files, it seems to work well until I tried to upload a picture then it comes up ' the directory is not writable by server' I know this is a permission thing.

what file do I have to change permission for to get this working?

Thank you in advance.


texts: Different MySQL servers with Magento2, how to use MAMP Databases instead of Brew

texts:
I am currently quite new to programming. I believe I may have installed two different MySQL servers as I have different databases when I load up 1)Via Brew and 2)PHPmyadmin via MAMP. This might be because I have uninstalled and installed MAMP multiple times, so I am quite clueless how to clean up this mess. I believe my installation of Magento2 is running off the MySQL Databases off brew rather than MAMP.
Can someone help in how to get my store/Magento installation to communicate with the databases within MAMP?
A bit more info; I am using MacOS and MAMP.


texts: give special prices only for products uploaded in one month

texts:
we uploaded some 1000 products to our site.

we uploaded 500 products in 1st month and next 500 products in 2nd month

now we want to give special prices for products that we uploaded in 1st month.

so we want to use promotions > catalog price rules to give special prices for products uploaded only in first month.

is there any way that we can give special prices for products uploaded in 1st month.


texts: Unable to search with keyword in State/Region at Tax Zones and Rates section?

texts:
I am facing one small issue with the "Tax Zones and Rates", while searching with the keyword in the "State/Region" field.

first i have removed rule as shown in the screen shot 1) https://prnt.sc/jwkidj

Then i have removed Tax Zones and Rates 2) https://prnt.sc/jwkiph

getting an error while searching with the any keyword 3) https://prnt.sc/jwkkco

How do i fix this?

Thanks


texts: Need to send order details to Amazon after successful payment Magento 2

texts: I have created an app with the Amazon API allowing me to create orders to be fulfilled by Amazon.  I want to capture my customers order information (product SKU's, address, name, etc.) when their payment is accepted and send it to Amazon.  What is the best way to grab this information?  Magento version 2.1.


texts: Storeswitcher (not storeview-switcher) - Multistore

texts:
On my current Magento project Wein-Partner.at I have to prepare multiple shops on one website.

For the different stores there will undoubtedly be different languages, also meaning multiple storeviews.
However, the language selector disappeared on me and I have no clue where to. Interestingly enough I have a currency selector instead.

Is there a way for me to make a "store-selector" at the top, not just a store-view selector?

Do I have to enable the "add storecode to URL" for that?

The plan is basically as follows:

There's the website (wein-partner.at) which will open on the homepage, showing the main-store. Below that, if you click on a category, you come into category-view with additional tags to choose from (region, price, ..). If you click on, let's say a region that has only one winemaker, you're supposed to be taken to the winemaker's subshop showing his logo instead of ours (I currently can't change store, so it always shows the vendor's storeview).

The template-file is the same as the category-view aside from the logo (each vendor has his own storeviews as well [mainly probably English, German, French and Italian]).

To sum up, this means that there will be 4 levels (Website - mainstore - store/storegroup - storeview/store)

edit01: I found this so far (app/design/frontend/default/your_theme/template/page/switch)

<?php if(count($this->getGroups())>1): ?>

    <?php echo $this->__('Select Store:') ?>
    <select id="select-store" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
    <?php /*foreach ($this->getStores() as $_store): ?>
        <option value="<?php echo $_store->getUrl('') ?>"<?php if($_store->getId()==$this->getCurrentStoreId()): ?> selected="selected"<?php endif; ?>><?php echo $_store->getName() ?></option>
    <?php endforeach;*/ ?>
    <?php foreach ($this->getGroups() as $_group): ?>
        <?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? ' selected="selected"' : '' ?>
        <option value="<?php echo $_group->getHomeUrl() ?>"<?php echo $_selected ?>><?php echo $this->escapeHtml($_group->getName()) ?></option>
    <?php endforeach; ?>
    </select>

<?php endif; ?>


texts:
I am very new to magento. I am thinking of using magento as ecommerce platform for our company.

I'll have an offshore team who will provide customer service and also take phone orders. I am thinking of giving each customer service rep a role in magento admin so that they can view customer orders, take phone orders, do cancellations and refunds etc.

Is magento admin designed to be used by customer service reps, say around 200 of them?
or there is a better way?

Orders will go to a crm system from magento and customer service reps will also have access to it to log conversation details.


texts: Uncaught ReferenceError: massactionJsObject is not defined

texts:
I am adding new logic to Affiliate module from MageStore.
I want add MassAction for enabling/disabling coupons code in accounts. But when I add method _prepareMassaction, I have error when try disable coupon:

Uncaught ReferenceError: couponGrid_massactionJsObject is not defined is not defined


texts:
Let's say that a product view/page has the following blocks,

product name
SKU
stock status
tabbed content (video, specifications, reviews etc.,)

If a 3rd party module appends its block to the product view then, is there a way to display it within an existing block?

For instance, if a 3rd party module appends product reviews to the product view then, can this block be displayed within the existing 'reviews' block?

I understand that before and after attributes can be used to position blocks in layouts but, I am looking for something on the lines of within.

(display the block from the 3rd party module within an existing block on the product view template)

Any guidance regarding this would be helpful.


texts: I missed putting some orders in at the end of 2014. I need to change the dates so it doesn't show ordered n 2015. How do I do this or is it possible?


texts: Magento 2 setTemplate and add content to phtml template

texts:
How to add bare HTML to a block e.g:

$block = $result->getLayout()->getBlock('category.description');
$block->setTemplate('Vendor_Module::myTemplate/blank.phtml')
->toHtml('
My Content
');

Is there a way to dynamically add content to a block perhaps without use of templates or any other way appreciate?


texts:
I am creating a controller extending \Magento\Customer\Controller\AbstractAccount but it automatically get redirected to http://example.com/customer/account/login/ how can I stop that.
basically all the controller under Magento_customer/Controller/Account are extended by \Magento\Customer\Controller\AbstractAccount

but some are redirecting same as mine,like

Magento_customer/Controller/Account/index.php

while some are not redirected, like

Magento_customer/Controller/Account/create.php

Controller code

<?php
namespace Vendor\Module\Controller\Account;

class ControllerName extends \Magento\Customer\Controller\AbstractAccount
{
    public function execute()
    {
        echo "Test";
    }
}


texts: Is there any extension in the market able to have 2 smtp service in the setting? when the primary smtp service fail, use secondary to send out email. Any comments?


texts: Optimal structure of grouped products with more than 30K unique products

texts:
I have a question to community how to organize my catalog with grouped products. Following my situation:

1. I have more than 30K unique simple products (not visible in catalog).
2. I have more than 5K grouped products (visible in catalog)
3. Every grouped product contains of combination of simple products on point 1.
4. One simple product can be included to 1-5 grouped product.

That is not to hard to organize my catalog, but problem is:

Product "SA" is child product for "GA", "GB", "GD". And "SA" has unique value for every group, for example polygon, order, image attributes are differentiated for every parent group. But it is one simple product with unique sku and price. In the catalog there are many such products given like this.

If the situation is clear can you help me how to organize simple and grouped products. Thanks.

Updated

Products comes in .csv file and I should write custom module to organize products. One variant is to save every unique combination as new product and link them to group product appropriately. For example if "SA" product has 3 parent product I will save "SA" as 3 new product and so on. By the way if I have 30K unique products in .csv file the result of import will produce more than 80K products in magento db. And database size will overloaded. Currently I haven't another optimal way.


texts: where i need to place the code related to shipping method

texts:
This question is different from following links question.

This is the problem : Shipping charges are not saving in Database if we added Product to cart through Android App

in the link's answer :

 $result = $proxy->shoppingCartShippingList($sessionId, 10,'default');

But i have no idea where i need to place this code. please guide me for this.


texts: How to save custom field value in sales_order table before place order in magento2?

texts:
I have use event checkout_submit_all_after and sales_order table field test_field.

class SalesOrderPlaceAfter implements ObserverInterface
    {
        public function execute(\Magento\Framework\Event\Observer $observer)
        {
            $order = $observer->getEvent()->getOrder();
            $order->setTestField(12);
            $order->save();
        }
    }

TestField in not save value.how does it save?


texts: Ajax Form Within Magento Onepage Checkout Help

texts:
I am trying to put an Ajax form within the checkout process of Magento. I am having a slight issue though.

I have the form working as a sidebar on my sight, but I am having a conflict with one of the scripts that I found for my Ajax form. When I use it on the checkout page the onepage doesn't load like at all, but as soon as I remove it, it loads, but my form no longer changes like it should.

The working form can be seen here: https://www.therange702.com/gun-store.html

This is the script code that causes the conflict.

<script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script>

Whats inside that can be seen here -> https://www.therange702.com/js/jquery-1.2.6.pack.js

Sorry for the linking, the code in that is too big to put in here. I know this is the issue, cause if I remove the <Script> tag then it loads, but like i said my form no longer changes to the other part of it. I even removed the tag from the working form in the sidebar and it cause it to not work anymore.

I know it is a very old file, but I am new to ajax and I found a tutorial that I followed and used the source files that were provided. If you have suggestions for using a new file I am open to that too, maybe one that is actually understandable.


texts: Use API v2 to work with Customer Group Prices

texts:
Does anyone know a way to write and read the Customer Group Prices with API v2?
We are using a tool to integrate our financial software with Magento. Each customer has a different agreed price for products in Dynamics GP and we need to match this price in Magento. This way, when a Customer logs into the Magento site, their agreed price will be displayed in all simple products.


texts: Update Cart Page by Ajax on quantity change

texts:
I have to update the main cart on change of quantity by Ajax without click on "Update Cart Button" and without reloading the page.
By the following code, I'm able to update cart table but m not getting a solution to update the "Cart Summary" block.

<script>
require(['jquery', 'Magento_Customer/js/customer-data',
    'jquery/jquery-storageapi'], function ($) {
    // $("#submitbutton").hide();
    var form = $('form#form-validate');
    var qtyfields = $('input.qty');
    $('.page.messages').each(function () {
        var thismessage = $(this);
        thismessage.attr('id', 'messages');
    });

    form.find(qtyfields).each(function (e) {
        var thisfield = $(this);
        $(this).change(function () {
            console.log('change detected');
            form.submit();
        });

    });
    form.on('submit', function (e) {
        e.preventDefault();
        $.ajax({
            url: form.attr('action'),
            data: form.serialize(),
            type: 'post',
            success: function (res) {
                var parsedResponse = $.parseHTML(res);
                var result = $(parsedResponse).find("#form-validate");
                $("#form-validate").replaceWith(result);
                //console.log(result);
                //location.reload();
            },
            error: function () {
                console.log('error');
            }
        });
        console.log('form submitted');
    });
});
</script>

Please give me some solution.


texts: Simple products are not showing on magento site: Magento

texts:
I have recently created the new Product category and a simple product in it and shows it on front end using block but it giving this error "There are no products matching the selection." as the product is present there still it giving me error:

I have tried by clearing the cache and login and logout again but still the same issue.

Any Help in this issue.

Thanks


texts:
I need to fetch the "URL Key" of all products of magento.
Can anyone suggest how to run that loop?


texts: add php code to display sku in before error message

texts:
we are using an extension to import the products.

This is the code we are using to display some error message.

we are using this file to display error message :

$errors[] = Mage::helper('mpmassuploadaddons')->__('Skip import row, attribute "%s" does not exist', $attributeCode);

Before the error message , i want to display the sku .
i guesss usually we need to display following code to display sku :

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

i want to merge the above 2 lines of code, so that i want to display as

"sku : some error message"


texts: how to remove product attribute from conditional  select box


texts:
When you add a new widget you can specify a layout update container.

I want to create a custom container that inserts the widget into a tab on the product page. If the tab is empty then hide it.

I have the following in my catalog_product_view.xml

<referenceBlock name="product.info.details">
      <container name="my-custom-tab" label="Custom Tab" htmlTag="div" htmlClass="custom-tab">
      <block class="Magento\Catalog\Block\Product\View" name="custom.tab" as="customtab" group="detailed_info" >
         <arguments>
            <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
            <argument name="at_label" xsi:type="string">none</argument>
         </arguments>
      </block>
    </container>
</referenceBlock>

The above almost works in a sense that it appears as a selectable container but then nothing is shown on the front end.

I can't be far off so I'm hoping that someone can help with this last bit please?


texts: Magento 2 : How to call text/x-magento-init on Ajax success

texts:
I am in need to trigger some script with "text/x-magento-init" on ajax call but I am unable to do so.

trigger('contentUpdated')

contentUpdated is also not working in my case.

I am using contentUpdated as:

$('.page-footer').html(response.categoryProducts);
$('.page-footer').trigger('contentUpdated');

On console log(response.categoryProducts) I can see that x-magento-init script but the effect is not shown on frontend on using this way.

Any help ??


texts:
We're running a Magento 2.1.10 staging environment on a server. The session, FPC & config cache are written to REDIS.
But we can't help but notice that our environment runs very slow when requesting pages. Even if they are stored as FPC. And FPC hit of the Magento product list page takes up to 350 ms, which is quite frankly way to slow to server a page from REDIS.

The speeds we're looking for are more in the regions of 100ms to 125m (or faster).
But if we disable REDIS in env.php and write everything to disk, we can't help but notice that our website runs a lot faster. 150ms and lower.

REIDS should easily be faster than disk, which makes perfect sense, but not in our case.

Data:

    'session' => [
    'save' => 'redis',
    'redis' => [
        'host' => '127.0.0.1',
        'port' => '6379',
        'password' => '',
        'timeout' => '2.5',
        'persistent_identifier' => '',
        'database' => '5',
        'compression_threshold' => '2048',
        'compression_library' => 'gzip',
        'log_level' => '1',
        'max_concurrency' => '6',
        'break_after_frontend' => '5',
        'break_after_adminhtml' => '30',
        'first_lifetime' => '600',
        'bot_first_lifetime' => '60',
        'bot_lifetime' => '7200',
        'disable_locking' => '0',
        'min_lifetime' => '60',
        'max_lifetime' => '2592000'
    ]
],
'cache' => [
    'frontend' => [
        'default' => [
            'backend' => 'Cm_Cache_Backend_Redis',
            'backend_options' => [
                'server' => '127.0.0.1',
                'port' => '6379',
                'database' => '1',
                'persistent' => '',
                'password' => '',
                'force_standalone' => 0,
                'connect_retries' => 1,
                'use_lua' => 1
            ]
        ],
        'page_cache' => [
            'backend' => 'Cm_Cache_Backend_Redis',
            'backend_options' => [
                'server' => '127.0.0.1',
                'port' => '6379',
                'database' => '2',
                'persistent' => '',
                'password' => '',
                'force_standalone' => 0,
                'connect_retries' => 1,
                'use_lua' => 1
            ]
        ]
    ]
],

Any thoughts on what the problem might be? In New Relic, all we can do it see the fact that "REDIS HGET" take a lot of time.

Currently, we're converting the TCP traffic for REDIS over a UNIX SOCKET.
Do note that we've implemented REDIS for more than 1 project and never have we experienced this kind of "lag" on REDIS. And REDIS is configured the same way on every server. Which leads me to think the Magento version and CM_Redis plugin has something to do with it.


texts: Joining Products Table with Custom Module Table (Adding Product Thumbnails to Custom Grid)

texts:
I created a custom module with a grid and needed to display product thumbnail images there.
Tried codes from the answer below and the thumbnails were added, BUT ALL MY OTHER COLUMNS IN THE GRID ARE BLANK NOW.
How can I join the tables correctly?

..\app\code\local\Cpstest\ProductComment\Block\Adminhtml\Cps\Grid.php

    protected function _prepareColumns()
    {
    $this->addColumn('thumbnail',
    array(
        'header'=> Mage::helper('cpstest_productcomment')->__('Thumbnail'),
        'renderer'  => 'cpstest_productcomment/adminhtml_grid_renderer_image',
            'index'     => 'thumbnail',
            'sortable'  => true,
            'filter'    => false,
            'width'     => 90,
    ));
    }

    protected function _prepareCollection()
    {
    // Get and set our collection for the grid
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('sku')
    ->addAttributeToSelect('name')
    ->addAttributeToSelect('attribute_set_id')
    ->addAttributeToSelect('type_id');
    //$collection = your collection
    $store = $this->_getStore();
    $collection->joinAttribute('thumbnail', 'catalog_product/thumbnail', 'entity_id', null, 'left', $store->getId());/**/
    $collection->joinField('id',
    'cpstest_productcomment/cps', //check namespace/modelname
    'id',
    'id=entity_id',
    null,
    'left');
    $this->setCollection($collection);
    return parent::_prepareCollection();
    }

And the renderer file in ...\app\code\local\Cpstest\ProductComment\Adminhtml\Grid\Renderer\Image.php

    <?php
    class Cpstest_ProductComment_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
    {
    public function render(Varien_Object $row)
    {
    try
    {
    $size    = 70;
    if (!$row->getThumbnail())
    {
    $product = Mage::getModel('catalog/product')->load($row->getEntityId());
        if ($product)
        {
            if ($product->getThumbnail())
            {
                $row->setThumbnail($product->getThumbnail());
            }
        }
    }
    $url     = Mage::helper('catalog/image')->init($row, 'thumbnail')->resize($size)->__toString();
    if ($url)
    {
        $html  = '';
        $html .= '<img src="' . $url . '" alt="" width="' . $size . '" height="' . $size . '" />';
        return $html;
    }
    } catch (Exception $e) { /* no file uploaded */ }
    return '';
    }
    }

Here is the table structure for my custom grid:

Thanks for all your help.


texts: Prevent hanging cronjobs together with stack protection with flock

texts:
So I have couple of things to make sure crons are running ok.

Protection against stacking -> flock (manual)
Monitoring cron availability -> https://healthchecks.io/
Prevent "hanging" cronjobs -> ?

The problem: Cronjobs are protected from stacking with flock. It creates a lock with a lock file. But when a cronjob hangs or just doesn't finish for whatever reason the lock never expires. And with this the cronjob never runs again unit the lock file is manually removed
Question: How can I solve the issue of hanging cronjobs and never starting again because of the infinite lock?
I tried to just put timeout 3600 in the cron command without any luck.


texts: is there is any list of bugs available for magento ver 1.9.1, i need just a list with solutions

texts: i have just installed a site in magento 1.9.1 , i have found during the research of the blogs that there are bugs which were there in this system. is there is ready list wth solution is available. can you provide me a link to that.


texts: phone value not importing from etc/config.xml

texts:
I have the following Magento Store Configuration set in my modules etc/config.xml file.

app/code/NameSpace/MyModule/etc/config.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
    <general>
        <country>
            <default>GB</default>
        </country>
        <locale>
            en_GB
            <timezone>Europe/London</timezone>
            <weight_unit>kgs</weight_unit>
        </locale>
        <store_information>
            <phone>7771234</phone>
        </store_information>
    </general>
</default>

It's all working, except for general/store_information/phone.

Any idea what is wrong with it.

I have cleared the cache, and ran setup:upgrade and app:config:import.


texts: Magento2 Limit product collection for a specfic category

texts:
I'm trying to show newly added 30 products on the category list page for a specific category. it has more than 1k products.
I have tried to modify temporarily the code in the following file but it never works:
Magento\Catalog\Block\Product\ListProduct;
Original code:
protected function _getProductCollection()
    {
        if ($this->_productCollection === null) {
            $this->_productCollection = $this->initializeProductCollection();
        }

        return $this->_productCollection;
    }

Updated code:
 protected function _getProductCollection()
    {
        if ($this->_productCollection === null) {
            $this->_productCollection = $this->initializeProductCollection();
        }

        return $this->_productCollection->setPageSize(30);
    }


texts: How to send newly subscribed email id to admin mail

texts: I want to send email of newly subscribed email id to admin mail, I can not send any setting for it in admin please help with it


texts: Is it possible to create 2 catalog_category.view.xml?

texts: I need to move my category.description to the bottom of the page when in list mode, and leave it at the top when in grid mode, but who sets the position is the correct catalog_category_view? Is there any way to do this?


texts: Programmatically setting products multi select attribute doesn't work in Magento 2.1

texts:
I am trying to be able to create/update a product programatically based on an API call in magento 2.1. I have everything working except for setting our 'Product Brand' multi select attribute. Using code found from stack exchange answers, this is what I have which isn't working:
//...
$product->setData('product_brand', $brands);

Where $brands is a CSV separated string of author names. However, I can hard code in one of the author names or their ID and the result is the same. The rest of the code works fine, and the product does get saved - but without any of the multi select options selected.
If I also include:
$product->getResource()->saveAttribute($product, 'product_brand');

Then I receive an SQL error and the product does not save: Exception PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails ([my user].catalog_product_entity_varchar, CONSTRAINT CAT_PRD_ENTT_VCHR_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (entity_id) REFERENCES catalog_product_entity (entity_id) ON DELETE )
Any help would be appreciated.


texts: Shipping Method not showing in frontend in magento2.3.5?

texts:
I have added custom shipping method in magento2 local system And it is working fine till the magento2.3.4 version but in the magento 2.3.5 version in frontend custom method not showing.
What is the issue with  magento2.3.5 version.
Let me Know and what should I need to add in this module for magento 2.3.5.


texts:
By best practice collections are typically instantiated in a Block. Best practice also dictates that a Block should set a cache tag and lifetime to take advantage of the Block caching mechanism.

This practice may render the use of a collection cache somewhat useless, at least as far as front-end performance is concerned. However the Collection Cache in Magento is ONLY utilized in TWO areas: neither are guarded by a Block cache: the Website collection (from within Mage::app()) and the Mage_Sales_Model_Resource_Order_Item collection.

This much makes sense. Lots of load on these collections from various places within Magento - it makes sense to implement the cache.

So, my question is: does it ever make sense for me to implement a collection cache if the only place it is used is inside of a Block, and that block does not have wide reuse across the front-end? Any rationale as to best practice here would be welcome.

Typed from my phone, apologies for typos


texts: How to make category 'Default Product Listing Sort By' default option as 'Position'

texts:
There is 'Default Product Listing Sort By' on every category

I setup ' Use Config Settings' for all categories and the config settings 'Product Listing Sort by' is 'Best Value'

I want to always products sort and show as 'Position'. but How can I make sort default option as 'Position?


texts: Filter Product Collection to exclude a category in catalog_product_collection_load_before

texts:
I am trying to filter product collection to exclude a particular category products in the observer written for the event catalog_product_collection_load_before.

Here is the code that i tried.

In config.xml:

<frontend>
    <events>
        <catalog_product_collection_load_before>
            <observers>
                <velanapps_restrict_products>
                    <class>Namespace_Module_Model_Observer</class>
                    <method>filterProductCollection</method>
                </velanapps_restrict_products>
            </observers>
        </catalog_product_collection_load_before>
    </events>
</frontend>

My observer.php:

public function filterProductCollection($observer){
        $observer->getEvent()->getCollection()->addAttributeToSelect('*')
->joinField(
    'category_id', 'catalog/category_product', 'category_id',
    'product_id = entity_id', null, 'left'
)->addAttributeToFilter('category_id', array(
        array('nin' => array('13')),
));

When the category join is applied, it returns only empty result. Any help would be much appreciated.


texts:
I have a client that set up their products without filling in the cost field. They now wish to report an actual profit in Magento and I have set cost for all products. However, I notice the profit is only correct on reporting after this change. Looking at orders, those that were placed prior to the fix have a profit of $0 since it didn't have the cost value to do the calculation. Those are fine.

Is there any way I can force Magento to update those historic orders in order to get their profits? I've tried the simple option of doing a "Refresh Stats" but that doesn't change anything.

Thanks!


texts: "Not Visible Individually" products display on Frontend in Magento2.4

texts:
Is there any way to display "Not Visible Individually" products on frontend?
My goal is admin can see product before upload in site...


texts:
i want do this
How do I change the default value of the "position" category attribute?
But i noob in magento, i try search in google how do it, but in all guides standart models stay in Mage folder, but my model in vendor

mag.ru\vendor\magento\module-catalog\Model\ResourceModel\Product.php

need rewrite this method _saveCategories

what i need write into config.xml and what name in MyModule folder i need create?

P.S. sry for bad eng


texts:
Does anyone know how to fix the email sender to look more professional?  The image below is an email confirmation for an order I placed in the Magento Marketplace...even they can't make it look good:

I have the same problem on my Magento 2 install.  Transactional emails show up as coming from some garbledy gook email that is associated with the actual web server's user.  It's ugly and doesn't scream professional at all.  Other emails, such as a contact-us form, don't have the same problem.  I've heard you can fix this using an SMTP extension, but I've had problems with emails not working at all when I use those.  If that's the only solution I'll see if I can get it to work.  But why is this the default functionality for an eCommerce platform?


texts:
In app\Mage.php under dispatchEvent function i have written Mage::log($name) before "return $result" to get events list executed on any action.

In System > Config if i save any field value i'm getting

  Fatal error: Maximum function nesting level of '100' reached.

If i comment or remove Mage::log($name) its saving normally.

Could you please help me on why i'm getting this error when i write Mage::log($name)


texts: How to override a template file in module creation in Magento2

texts:
I want to override :

/opt/lampp/htdocs/magento_composer/vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml

i have copied and pasted it in my custom module at :

/opt/lampp/htdocs/magento_composer/app/code/Hello/Custom/view/frontend/templates/product/view/addtocart.phtml

This is my Layout file:

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>

        <referenceBlock name="product.info.addtocart" template="Hello_Custom::product/view/addtocart.phtml" after="alert.urls">

        </referenceBlock>

    </body>
</page>

at:

/opt/lampp/htdocs/magento_composer/app/code/Hello/Custom/view/frontend/layout/catalog_product_view.xml

module.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Hello_Custom" setup_version="1.0.0" schema_version="1.0.0">
    </module>
</config>

Module is working for simple hello world so its registered correctly ...

The issue is in template path hints file comes from vendor..
but it should come from my custom module only (not from theme)


texts:
Hello i try to create an xml feed, but it works only in some of my store views.

I get the following error on line 419 at column 29: Input is not proper UTF-8, indicate encoding !
Bytes: 0x1F 0x63 0x65 0x20


texts:
I'm very new to magento. I want to show the newsletter template's preview for the customers. I know it is possible from the admin backend. But how can I obtain this link in the template pages?.  I found this code in core/Mage/AdminHtml/controllers/Newsletter/TemplateController.php

`public function previewAction ()
{
    $this->_setTitle();
    $this->loadLayout();

    $data = $this->getRequest()->getParams();
    if (empty($data) || !isset($data['id'])) {
        $this->_forward('noRoute');
        return $this;
    }

    // set default value for selected store
    $data['preview_store_id'] = Mage::app()->getAnyStoreView()->getId();

    $this->getLayout()->getBlock('preview_form')->setFormData($data);
    $this->renderLayout();
}`.

but I don't know how to use it for this. I have the template_id to load the template.

Is there any other method to accomplish this?. Thanks in advance


texts: Magento 2 theme override: changes not showing

texts:
I am new to Magento 2 and theming and I'm having trouble overriding a particular template. I am running in developer mode.

I have successfully installed my theme and applied it globally in the admin, using Luma as a parent.

<vender> = SampleStore
<theme> = sampletheme

I can tell it is working because I have added _theme.less to <vender>/<theme>/web/css/source and changed the background color of the body to red, which after a cache clear is reflected on the store in my browser.

My issue is when I try to override a template not just a style change my changes are ignored and the parent Luma template is served.

I am trying to add some text after QTY on the product page, just as a test.

I went into vender/magento/ and copied module-catalog and all it's sub folders (as that is where the template for this particular change is) and paste them in my own vendor directory (not inside the <theme> directory, but right inside <vender>): <vender>/**module-catalog**

I deleted all the folders I didn't need, leaving me with view/frontend/templates/*all files*

Have I misunderstood where to place this module-catalog folder, have I missed out a step or something else? Why is my new template ignored and Luma being used?

I am using this guide. Specifically this section:

  Template customization walkthrough

  To customize or override a template:

  Locate the template which is associated with the page or block you
  want to change, using template hints in developer tools. For example,
  these would be located at:
  app/design/<vendor_name>/<module_name>/view/frontend/templates/
  Copy the template to your theme folder according to the template storing
  convention.
  Make the required changes.


texts:
I am working on custom payment method with SnapPay integration.
I want to add iframe in vendor/magento/module-payment/view/frontend/web/template/payment/cc-form.html

<iframe id="tokenFrame" width="100%" height="40" name="tokenFrame" src="https://stage.snappayglobal.com/Interop/InteropCCAjaxTokenizer/Index/<?=$return['requestid'] ?>"  frameborder="0" scrolling="no">.</iframe>

where $return['requestid'] dyanamic variable.

I don't know how can achive that.

How can I use this file vendor/magento/module-payment/view/frontend/templates/form/cc.phtml as a template file.? Is this possible?

Anyone suggestions?


texts: How to secure our Magento store from hackers?

texts:
I have read somewhere that hackers are making target to e-commerce sites to hack. As we know Magento provides some inbuilt security features but still wants to know more regarding security. Also, Magento provides security patches as well time by time.
I have some questions as below:

Which areas are more sensitive in website/e-commerce to prevent hackers?
What steps we need to follow to prevent hackers?

If anyone has any idea about it please share.


texts:
I am getting fatal error while running file in magento. I am calculating and updating all product records price value in product table.

Fatal error: Out of memory (allocated 1444151296) (tried to allocate 134217728 bytes)


texts: Ajax form submit: Magento redirects to controller instead processing response

texts:
I'm working on a newsletter signup form (following this tutorial). When I hit the signup button Magento redirects me to the "form action url" and displays the response on a white page only:

{"message":"
Thanks for signing up!
"}

I have no idea what is causing the issue.

My controller

class MyModule_Signupx_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        $this->loadLayout(array('default'));
        $this->renderLayout();
    }

    public function signupxAction()
    {
        $response = array();
        $response['message']="TEST";
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
    }
}

Javascript in template

<script type="text/javascript">
    //< ![CDATA[
    var customForm = new VarienForm('form-signupx');

        jQuery('#signupx').click(function (){
            var data = jQuery('#form-signupx').serialize();
            var url= "<?php echo $formActionUrl; ?>";
            console.log(data);
            if(customForm.validator.validate()){
                console.log("This does show up, just before the redirect happens");
                jQuery.ajax({
                          url: url,
                          dataType: 'json',
                          type : 'post',
                          data: data,
                          success: function(data){
                                console.log("This does not show up in console");
                          }
                    });
        }
    //]]>
</script>

config.xml

<frontend>
    <routers>
        <signupx>
            <use>standard</use>
                <args>
                    <module>MyModule_Signupx</module>
                    <frontName>signupx</frontName>
                </args>
        </signupx>
    </routers>

Thank you so much in advance!


texts: How to get the Custom admin grid collection in custom module template file in magento 2

texts:
I want to get the custom admin grid collection in template file. How can I get
that?

http://i.prntscr.com/c92860d45a904aa4b400ea73b750b8e7.png

I have Used these link to get custom admin grid

https://github.com/mageplaza/magento-2-sample-module

I am Using these code in template file to get the collection

File Path:app/code/Mageplaza/HelloWorld/view/frontend/templates/helloworld_index_index.phtml

  $objectManager = $bootstrap->getObjectManager();

    //$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

    /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */
    $productCollection = $objectManager->create('Mageplaza\HelloWorld\Model\ResourceModel\Post\collection');
    /** Apply filters here */

     $collection = $productCollection->create()
                    ->load(1);

    echo count($collection);

Can Anyone help me?

Thanks In advance.


texts:
This is an easy question.
I changed the URL-KEY of the 404 page thinking that it would apply to the whole website, only to find that the 404 page didn't work anymore.
Now I just need to know the default 404 page url so that I can revert the 404 page url-key key to the original one. The url-key circled in red in the picture is not the default one, I need to know the default one.


texts: Assign attribute value when saving products

texts:
A product has an attribute with a list of values A, B, C, ...

When saving the product, I want to compare the first letter of the product names with a list of attribute values. If the attribute value coincided with the first letter of the product, save this value.

How can I do that?


texts:
I have the Facebook Ads extension plugin with Magento.
I already have it configured with one Facebook Page with the product feed.
Is it possible to add another page and a second product feed? The two feeds have different parameters (currency).


texts: how to get the product custom option in template file in the magento 2?

texts:
this is my code but when i echo   count ($_product->getOptions()) output show 0

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($productId);
    foreach ($_product->getOptions() as $options) {
    $optionType = $options->getType();
    $optionTitle = implode('_', explode(" ", $options->getTitle()));
    $options->getId();

how i get the product custom option in the magento 2


texts:
I want to change the order of the filters in the category view.
A the moment color is the first filter. I want another filter to be the first.

So I tried to set the position of the attribute "Color" in the Attributeset behind some others but nothing has changed in the frontend.
Can somebody help me?


texts: How to show embedded google map in magento 2 in phtml file

texts:
I am trying to add google map in the frontend. I added embedded google map in phtml. here is my code

<?php
    $contacts_config = $this->getConfig('porto_settings/contacts');
    $_enable = $contacts_config['enable'];
    if($_enable){
        $_apikey = $contacts_config['api_key'];
        $_full_width = $contacts_config['full_width'];
        $_address = $contacts_config['address'];
        $_zoom = $contacts_config['zoom'];
        $_center_lat = $contacts_config['latitude'];
        $_center_lng = $contacts_config['longitude'];
?>

<?php if(!$_full_width): ?>

<?php endif; ?>

<?php if(!$_full_width): ?>

<?php endif; ?>
<?php
    }
?>

I am getting a map but not for this location.


texts: Calling customer_form_login block in DropdownDialog widget?

texts:
Is it possible to call the login form (/customer/account/login/) or block block: customer_form_login in the Magento 2 DropdownDialog widget?
I'm trying to build a Dropdown with login functionality.


texts: How can we load product image gallery instantly without the delay in magento?

texts:
this is my first question bare with me :)
Problem: The fotorama gallery used in Magento 2 makes the user experience sluggish. It does not matter how fast my cached static Magento 2 runs if the product image is not "instant".
https://www.ninewest.co.uk/sandals/high-heel/allclear-black-snake-print-nine-west
If you go to the above link, (a store showcased on Magento blog), you can see it opens, then it shows a loading icon, and then it loads the images. That's horrible.
It should load instantly. Like bamm. Done, Specially with full page cache and opcache enabled.
Is there a way to change this behavior? To load it instantly?
For the user, it's the most important "element" on the page. and it loads as the latest.
I don't understand how no one is complaining about this.
This is E-commerce, the only thing that matters is "pictures". It's what the user cares about. The reason they click on the product page is to "see the images better. Personally, for me, it truly bugs me. For no reason, I become super angry and then I ask myself if I'm crazy?
Thanks in advance, I'm just confused about how such a thing could happen.
On my Magento 1, it loads instantly.


texts: Which techniques could be used to reduce or remove overhead related to front end rendering for a headless Magento 2 implementation?

texts:
I'm interested in implementing a very simple site using Magento 2 through its REST API alone. I have actually already done this with a client project and overall it went fairly well (though I ended up implementing a number of missing / not totally usable service endpoints), but my next implementation will be for my own personal site hosted on a very minimal / barebones server.

Because of this, I'm interested in getting as much performance out of Magento as possible, specifically in the application itself (in other words, outside of caching, redis, etc).

I'm wondering if there are techniques, modules, best practices, etc, that others have found that would remove a significant amount of overhead that might not be necessary in a headless implementation.

I suspect there may not be very many "easy wins" that are of any significance, but I imagine I'm not the first out there who is interested in using Magento 2 headless and who doesn't want any extra overhead being added by tasks that may not be relevant when only using the API.


texts: How to restrict payment methods by Attribute or Category?

texts:
I want to Restrict payment methods by attribute or category ? I am using Magento 2.4.0.
if someone have idea or solution please share with me, I am stuck in this issue.
Thanks


texts:
Site is working fine but Apache generate big error log every time I hit the website.

As I have investigate : it is cause of illegal char in XML

[26-Sep-2016 11:40:47] invalid cache data for cacheId[config_global] {<config><global><install><date>Mon, 22 Jun 2015 13:51:26 +0000</date></install><resources><default_setup><connection><persistent>0</persistent><host>localhost</host><username></username><password></password><dbname></dbname><initStatements>

Then after a long xml file of 3MB t


texts: Magento2 - How to translate string using js?

texts:
Does not translate a string in Arabic(ar_SA) Language, How to translate using jQuery?

require([
        "jquery",
        "mage/translate"
    ],
    function($,$t) {
        alert($t("hello"));
    });


texts: Is it possible to display an XML Block based on an IF?

texts:
I use the below code in a module within catalog_product_view.xml to display a new Tab on the Product Page.

<body>
    <referenceBlock name="product.info.details">
        <block class="Magento\Catalog\Block\Product\View" name="example.tab" template="Vendor_Module::example.phtml" group="detailed_info">
            <arguments>
                <argument translate="true" name="title" xsi:type="string">Example Title</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

I'd like to know if you can Display/Hide this based on a Product Attribute? Normally, I'd embed an IF within the phtml file. But wondered if it could also be done this way instead?

Reason why I ask, is because I don't want the Tab to load if a Product Attribute = Yes. As the information might not be relevant.


texts: Magento 2.1 security: Arbitrary PHP from database fields

texts:
I have a basic security question about Magento 2.1

Do any of the modules in a default installation allow the execution of arbitrary PHP code directly from a database field? I'm assuming not, but I need to check.


texts: Custom attributes for customer are missing at login after they get saved in Magento 2

texts:
I have created a custom attribute for a customer and I can see it in the DB, inside the customer_eav_attribute table:

It was inserted using the following code:

/** @var CustomerSetup $customerSetup */
    $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
    $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
    $attributeSetId = $customerEntity->getDefaultAttributeSetId();
    /** @var $attributeSet AttributeSet */
    $attributeSet = $this->attributeSetFactory->create();
    $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

    $customerSetup->addAttribute(Customer::ENTITY, \Shreeji\CustomerApproval\Model\Config::CUSTOMER_APPROVE_ATTRIBUTE_CODE, [
        'type' => 'varchar',
        'label' => 'Is Approved',
        'input' => 'select',
        'required' => false,
        'visible' => true,
        'user_defined' => true,
        'sort_order' => 10,
        'position' => 10,
        'system' => 0,
        'source' => 'Shreeji\CustomerApproval\Model\Config\Source\ActivationType',
        //'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
        'adminhtml_only'=>1

    ]);
    $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, \Shreeji\CustomerApproval\Model\Config::CUSTOMER_APPROVE_ATTRIBUTE_CODE)
    ->addData([
        'attribute_set_id' => $attributeSetId,
        'is_used_in_grid' => 1,
        'attribute_group_id' => $attributeGroupId,
        'is_visible_in_grid' => 1,
        'is_searchable_in_grid' => 1,
        'is_filterable_in_grid' => 1,
        'used_in_forms' => ['adminhtml_customer'],//you can use other forms also ['adminhtml_customer_address','adminhtml_customer', 'customer_address_edit', 'customer_register_address']
    ])->save();

Then, I have a method that gets executed when a user logs in.

public function execute(\Magento\Framework\Event\Observer $observer)
{
    if(!$this->_config->isActive()) {
        return $this;
    }
    $customer = $observer->getEvent()->getCustomer();
    $session = $this->_objectManager->get('Magento\Customer\Model\Session');
    $aprroveSatus=$this->_config->isApprovedCustomer($customer);
.....

and

public function isApprovedCustomer($customer){

    $approveStatus=$customer->getData();
    var_dump($approveStatus);
    die('here');
.......

When I login with a user that has a value set for that custom attribute (as visible in customer_entity_varchar):

 .. I get this in return:

array (size=15)
  'entity_id' => string '11' (length=2)
  'group_id' => int 5
  'default_billing' => string '0' (length=1)
  'default_shipping' => string '0' (length=1)
  'created_at' => string '2017-08-01 13:50:29' (length=19)
  'updated_at' => string '2017-08-02 15:07:26' (length=19)
  'created_in' => string 'Maxtel BG' (length=9)
  'email' => string 'team@creatizmo.com' (length=18)
  'firstname' => string 'Stanimir' (length=8)
  'lastname' => string 'Genovov' (length=7)
  'store_id' => int 1
  'website_id' => int 1
  'addresses' =>
    array (size=0)
      empty
  'disable_auto_group_change' => int 0
  'attribute_set_id' => int 1
here

The custom attribute's name is si_is_approved I can't find out a way to obtain that value, when it is clearly set. getCustomAttributes returns an empty array and getData returns the array above. What is wrong with the custom field and why can't I obtain the value for it ?


texts: Magento 2.3 : Customer after login Storeview switcher/redirect problem

texts:
I have created 3 store for example:

Australia
India
USA

and created related store view as show below:

In my case if any customer is register from any store or store view. They are successfully register from any store/storeview. and successfully login from any store/storeview but after login from any store/storeview when user click on store/storeview switcher it's will not working.
In admin setting I have done

Add Store Code to Urls to Yes
Customer Share to "Globe"

Now problem is that I am able to login from any store/storeview but not able to switch from one store to another store after login, without login it's successfully working.

Anyone is able to help me for solve this issue.


texts:
I've created my own cron job in Magento that is executed every day at the beginning of the day where I have my business logic, the goal of this cron job is import external data and insert in the magento database and I need to have a log there to register each record that has been inserted/updated/deleted and register if something went wrong, as this process is too long I want to have one log per each day.

So in my observer method I've put something like this:

public function importCron()
{

    $filename = date('Y-m-d') . "-import.log";
    $startDate = date('Y/m/d H:i:s');
    $emailTemplateVariables["startDate"] = $startDate;
    Mage::log("Import STARTED on " . $startDate, 7, $filename);

    // {
    //  Bussiness logic here
    // }
}

In the above code I want to create a new log file using the date as part of the name so each time that my cron will be executed it will generate a new log file using the date.

But now my problem is that the log file isn't created when the cron runs, I've set all the permissions to the folder in order to test, but nothing is created when the cron runs; the weird thing is that I'm using Aoe_Scheduler extension to run my cron manually and in this case the log file is created.


texts: Magento 2 Reviews menu not showing backend and frontend

texts:
I have disabled magento 2 reviews module on Magento 2.2 with bin/magento module:disable Magento_Review command and removed with composer.

Now i want to use this module again i have installed it with composer and enabled it.
It's showing installed and enabled with bin/magento module:status command.
But there nothing showing on frontend and backend.

Also i checked source files of review module under vendor module there is no problem too.

How can i fix this issue?


texts: Custom Widget  ChooserModel run local, but not online

texts:
I have written a custom widget. It's run on my local installation (1.8.1), but not in my remote installation (same system).

If i select my widget from the select box i get a fatal error:

  Fatal error: Call to a member function toOptionArray() on a non-object
  in
  /var/www/vhosts/.../.../app/code/core/Mage/Widget/Block/Adminhtml/Widget/Options.php
  on line 171

That is my ChooserModel, located in app/code/local/[Namespace]/[Module]/Model/ChooserCategories.php:

class [Namespace]_[Module]_Model_ChooserCategories {

    public function toOptionArray() {

        $arrOption;
        $arrOptions;
        $objCategories;

        if (Mage::registry('[Namespace]_[Module]_Model_ChooserCategories_value')) {

            $arrOptions = Mage::registry('[Namespace]_[Module]_Model_ChooserCategories_value');

        } else {

            $objCategories = Mage::getModel('catalog/category')->getCollection();

            $arrOptions = array();
            $arrOption = array();

            $arrOption['label'] = '(no filter)';
            $arrOption['value'] = 'none';

            array_push($arrOptions, $arrOption);

            foreach ($objCategories as $objCategory) {

                $objCategory->load();

                $arrOption = array();
                $arrOption['label'] = str_repeat("---", $objCategory->getLevel()) . ' ' . $objCategory->getName();
                $arrOption['value'] = $objCategory->getId();

                array_push($arrOptions, $arrOption);

            }

            Mage::register('[Namespace]_[Module]_Model_ChooserCategories_value', $arrOptions);

        }

        return $arrOptions;

    }

}

On line 171 in app/code/core/Mage/Widget/Block/Adminhtml/Widget/Options.php try magento to load the source_model by name. It's look like magento have the model not loaded. If i return the model-name i get the correct one:

  [Module]/choosercategories

Take a look into the config.xml for the module:

<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace]_[Module]>
            <version>0.1.0</version>
        </[Namespace]_[Module]>
    </modules>
    <global>
        <helpers>
            <[module]>
                <class>[Namespace]_[Module]_Helper</class>
            </[module]>
        </helpers>
        <blocks>
            <[module]>
                <class>[Namespace]_[Module]_Block</class>
            </[module]>
        </blocks>
        <models>
            <[module]>
                <class>[Namespace]_[Module]_Model</class>
            </[module]>
        </models>
    </global>
</config>

Can anybody find the bug, or does someone have a tip for me?

Thanks!


texts: Admin users seem to be deleting and adding themselves on Magento

texts:
I'm witnessing a bit of a weird predicament at the moment on Magento and I'm not really sure to make of it all.

A few days ago I got an e-mail from some people from my company informing me that their Magento back-end logins weren't working. I ran them through some steps i.e. clear browser caches check user/pass and so on and it still didn't work. I then checked my login and it worked fine, however when check the users on Magento back-end it seems all three of these peoples accounts had disappeared without a trace. Nothing was showing for them in the back-end but mine along with 2-3 others login were still there.

I re-added the other three as users and de-activated all other account apart from my own as the other guys were not really necessary.

Now about a day after all of this occurred the site completely messed up, almost as if the CSS files had disappeared. I cleared the cache and everything fixed itself magically but then I thought I would check the users again (just in-case) and although all was fine and all the users were still there, there was also a random new user (image attached).

I know this is a bit of a long shot but has anybody experience something similar and secondly, does anybody know why the random new user appeared and who/what it is?

My first though was possibly this Magento instance has been compromised. But I have inactivated all the user apart from trusted people. However saying that possibly someone has access to SSH as apart from HTTPS & HTTP all other ports are closed.

Any advice is greatly appreciated as I am a little lost with this one. I know it is working now but I would love for no other mess ups to happen in the future a s a result if I can nip it in the butt now.

Thanks :)

Magento 1.9.1


texts: Magento 2 Round off layered navigation max price in the price range

texts:
I want to round off the price range values in the layered navigation. Now it is showing as below

$40.00 - $49.99
$50.00 - $59.99
$60.00 - $69.99
$70.00 - $79.99
$90.00 and above

I want the following format.

$40.00 - $50
$51.00 - $60
$61 - $70
$71 - $90
$91.00 and above

How can I do it?

I am using magento 2.3.2.
I have configured the Price Navigation Step Calculation field as "Automatic (equalize price ranges)".

Please help me to resolve this


texts: url_path is missing for products in category-view

texts:
product attribute url_path is missing for all products in category view, but it is present in product lists/grids.

This has an effect on review links, they have empty urls.

I can't get my head around, where is that defined or being loaded?

catalog/category/view => Mage_Catalog_CategoryController->viewAction

calls somewhere in a template

Mage_Catalog_Model_Product_Url::getUrlPath

and the result is null, coming from

$product->getData('url_path')


texts: Generate order xml for ERP in magento 1.9

texts: How to create a XML file of B2C Order format in Magento 1.9? whenever order genrate it creates in a particular folder automatically. And send to ERP System.


texts: Validation date is not working in Magento2

texts:
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$fieldset->addField(
    'to_date',
    'date',
    [
        'name' => 'to_date',
        'label' => __('From'),
        'title' => __('From'),
        'date_format' => $dateFormat,
        'class' => 'validate-date',
        'required' => false,
        'singleClick' => true
    ]
);

Date validation is not working. Please suggest.


texts: remove pop up box only if login successfull

texts:
we are hiding the pop up once we click on login "button", but we want to hide only if the login is successfull. [ if user enter correct email id & password ]

  Login Form

<form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect.....>

Email Address
<input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" />
password
<input type="password" name="login[password]"  id="pass" />

<button onclick="hideWindow()" id="send2"><?php echo $this->__('Login') ?></button>

  controllers

protected function _createProduct($type, $doSave = true, $originalProduct, $newImagePath = "")
    {

        Mage::register('isSecureArea',true);
        $session = Mage::getSingleton('customer/session');

        $result = array(
            'success' => false
        );

        $login ="";
        $productId ="";
        if ($this->getRequest()->isPost()) {
            $login     = $this->getRequest()->getPost('login');
            $productId = $this->getRequest()->getPost('product_id');
        }
            // echo $login['product_id'];die;
            // if (!empty($login['username']) && !empty($login['password'])) {
                try {
                    if(isset($login) && (is_array($login) && !empty($login)) || ($login!="")){
                        $session->login($login['username'], $login['password']);
                        $result['redirect'] = $this->_getRefererUrl() ? $this->_getRefererUrl() : Mage::getUrl('customer/account', array(
                            '_secure' => true
                        ));
                        $result['success']  = true;
                        $customerId         = Mage::getSingleton('customer/session')->getCustomerId();
                    }
                    else{
                        $customerId = "";
                    }

                    $product->setName($originalProduct->getName());

                    $customerId = Mage::getSingleton('customer/session')->getCustomerId();
                    $product->setCreatedByCustomerId($customerId);

                    if ($doSave)
                        $product->save();
                    // To save inside my_designs

                    return $product;

                }
                catch (Mage_Core_Exception $e) {
                    switch ($e->getCode()) {
                        case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
                            $message = Mage::helper('customer')->__('This account is not confirmed. Click here to resend confirmation email.', Mage::helper('customer')->getEmailConfirmationUrl($login['username']));
                            break;
                        case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
                            $message = $e->getMessage();
                            break;
                        default:
                            $message = $e->getMessage();
                    }
                    $result['error'] = $message;
                    $session->setUsername($login['username']);

                }
                catch (Exception $e) {
                    $result = "ERROR :".$e->getMesage();
                    /
                }
            // } else {
            //     $result['error'] = Mage::helper('customer')->__('Login and password are required.');
            // }
        // }

        Mage::unregister('isSecureArea');
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));

        // code for guest end
    }


texts: how to use post method to contoller and phtml for button event in magento 2

texts:
I have a button in phtml file

some.phtml

<button class="example-button-1 example-button-3 :active" type="button" id="acceptnow" >Active</button>

  I want to use post method to the controller for triggering the email

  but how I do that???


texts:
I'm facing a strange issue (on Magento EE 1.14.2.1) where I cannot retrieve EAV product data after setting up a fixture.

My test:

/**
 * @loadFixture
 */
public function testExample()
{
    $product = Mage::getModel('catalog/product')->load(1);
    var_dump($product->getSku(), $product->getData('name'), $product->getPrice());
    exit;
}

My fixture:

# File: fixtures/testExample.yaml
eav:
    catalog_product:
        - entity_id: 1
          sku: 12345/RED/
          name: Some configurable
          attribute_set_id: 4
          entity_type_id: 4
          type_id: configurable
          price: 49.99

I'm using exit to prevent EcomDev_PHPUnit from clearing the database tables after the test completes. At the moment my output from this is:

string(10) "12345/RED/"
NULL
NULL

I can access the product data (e.g. sku) that is stored in catalog_product_entity, but nothing from the EAV tables.

I've examined the database after this fixture is loaded, and the attributes for example name and price all exist in their respective EAV tables (catalog_product_entity_varchar and catalog_product_entity_decimal).

The attributes exist in the test database and are configured correctly for the product entity ID and attribute set.

When using getData() or getName() for example, they always return null.

Am I missing something?


texts: Define an event on select with event observer

texts:
My template is located in src/app/design/frontend/MySite/default/Magento_Checkout/templates/cart/item/default.phtml

There is a select and in this select I'm adding an event.

<select id="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty"
        name="cart[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]"
        data-cart-item-id="<?= $block->escapeHtml($_item->getSku()) ?>"
        title="<?= $block->escapeHtml(__('Quantity')) ?>"
        class="qty"
        data-role="cart-item-qty"
        data-bind="event:{ change: qtyChanged}">

Problem is when I load the page checkout/cart/ where the select id, I have this js error :

  VM25008:3391 Uncaught ReferenceError: Unable to process binding "event: function(){return { change:qtyChanged} }"
  Message: qtyChanged is not defined
      at event (eval at createBindingsStringEvaluator (eval at req.exec (require.js:2063)), :3:74)
      at init (eval at req.exec (require.js:2063), :4241:30)
      at eval (eval at req.exec (require.js:2063), :3368:46)
      at Object.ignore (eval at req.exec (require.js:2063), :1480:33)
      at eval (eval at req.exec (require.js:2063), :3367:48)
      at Object.arrayForEach (eval at req.exec (require.js:2063), :159:17)
      at applyBindingsToNodeInternal (eval at req.exec (require.js:2063), :3353:22)
      at applyBindingsToNodeAndDescendantsInternal (eval at req.exec (require.js:2063), :3233:37)
      at applyBindingsToDescendantsInternal (eval at req.exec (require.js:2063), :3215:13)
      at applyBindingsToNodeAndDescendantsInternal (eval at req.exec (require.js:2063), :3242:13)

And here is the place I write the new file

src/app/code/Cam/Checkout/view/frontend/web/js/view/cart/item/default.js

And that's the content

define([
    'Cam_Checkout/cart/item/default'
], function (Form) {
    'use strict';

    return Form.extend({
        defaults: {
            template: 'Cam_Checkout/cart/item/default'
        },

        qtyChanged : function () {
            console.log("Qty changed called");
        }
    });
});


texts: what is the use of wysiwygAdapter at frontend in magento 2?

texts:
I have just checked

  vendor/magento/module-theme/view/base/layout/default.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referencecontainer name="after.body.start">
            <block class="Magento\Ui\Block\Wysiwyg\ActiveEditor" name="theme.active.editor" template="Magento_Ui::wysiwyg/active_editor.phtml">
            </block>
        </referencecontainer>
    </body>
</page>

which initialize wysiwygAdapter at front-end. so what is the use of this code on front-end?
Anyone know?


texts: have any idea how can create or import product in magento-2?

texts:
I want to be a insert or import product in magento-2 ? Please if you have any thought share with me.
Thanks


texts: Magento2 Fatal error: Interface 'Iterator' not found

texts:
I am using Magento 2, when i tried to login from frontend , after submitting login this fatal error is showing

  Fatal error: Interface 'Iterator' not found in
  C:\xampp1\htdocs\magento\vendor\magento\framework\Config\FileIterator.php
  on line 15

How to solve this


texts: Magento 2.4.0 Toolbar showing wrong result after applying custom filter in *LayerPlugin

texts:
I've overridden the Layer.php file using the plugin, to show product based on Multi-source location.
But now I have the wrong number of elements in the toolbar (I have 4 products displayed but still showing 7 number in the toolbar also the per page items is 4 by default but it's showing only 2).
I've added condition in aroundgetProductCollection function.
    $collection->getSelect()->reset(\Magento\Framework\DB\Select::WHERE);
    $collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
    $collection->addAttributeToFilter('entity_id', ['in' => $productid]);


texts: Magento2: custom validation Error "Uncaught TypeError: Cannot read property 'call' of undefined"

texts:
In my custom validation rules shows '

  Uncaught TypeError: Cannot read property 'call' of undefined'
  errors!!!...

.  how can i do custom logic and proper validation ?

Here is my Code

  app/code/{vendor}/{module}/view/frontend/web/template/form/element/email.html

       <input class="input-text"
               type="text"
               data-bind="
                    textInput: email,
                    hasFocus: emailFocused,
                    mageInit: {'mage/trim-input':{}}"
               name="username"
               data-validate="{required:true,'validate-custom-key':true}"
               id="customer-email" />

  app/code/{vendor}/{module}/view/frontend/requirejs-config.js

// JavaScript Document
var config = {
    map: {
        '*': {
            script: 'Vendor_Module/js/script'
        },
        '*': {
            'Vendor_Module/js/action/login': 'Vendor_Module/js/action/login'
        },
        '*': {
            'Magento_Checkout/template/form/element/email.html':
                'Vendor_Module/template/form/element/email.html'
        }
    }, mixins: {
        'Magento_Ui/js/lib/validation/validator': {
            'Vendor_Module/js/validator-mixin': true
        }
    }
};

  app/design/frontend/Smartwave/porto/web/js/validator-mixin.js

define([
    'jquery'
], function ($) {
    "use strict";

    return function () {
        $.validator.addMethod(
            'validate-custom-key',
            function (value) {
                // Some custom validation stuff here
                return false;
            },
            $.mage.__('Your validation error message')
        );
    }
});

  jquery.validate.js:556 Uncaught TypeError: Cannot read property 'call of undefined


texts: how to fetch all order items through loop from json data api ? magento2

texts:
Hi i have an array coming from json data of placed order items in my api in this form.  let's suppose this example :

[items] => Array
        (
            [0] => stdClass Object
                (
                 [item_id] => 392
                 [name] => ketchup 20g
                 [qty] => 2
                )

            [1] => stdClass Object
                (

                    [item_id] => 393
                    [name] => Powder
                    [qty] => 1
                )

        )

-------------php code for dumping array data on screen -------

 $result=  json_decode($result);
 echo "<pre>";
 print_r($result);
 echo "</pre>";

...........
Basically i wants to fetch all order items placed by customer in one order.

echo $result->items[0]->name;

this code is returning one item name at a time manually ,but let's suppose if one order has multiple items , how can i fetch it through loop? please guide


texts: Magento 2.1 Translate text to given locale

texts:
I have a situation where I need to save values in couple of languages, Arabic and English at a save form, So I have two fields with the name Product Name and اسم المنتج i.e Product Name in Arabic, So I need a way I can translate the value in given locale i.e. ar_SA

Note: The Product Name is the primary textbox where as the اسم المنتج will be secondary at the Store View for en_US and vise versa in the case of Store View for ar_SA so I cannot hard code the text, I need it to be dynamically changed on the basis of current locale of the Store

I tried using Translate\Adapter class here but no luck

use Magento\Framework\Translate\Adapter as TranslateAdapter;

...

$translateAdapter = new TranslateAdapter();
return $translateAdapter->translate('Edit Product', 'ar_SA');

but no luck it returns the same Edit Product string, I already have Edit Product in my i18n/ar_SA.csv file

"Edit Product","تحرير المنتج"
"Save","حفظ المنتج"
"Product Name","اسم المنتج"
"Description","وصف"
"Short Description","وصف قصير"


texts:
What i tried in custom module schema.graphql
    input PageData {
        location: String @doc(description: "The location from where the login performed")
        login_type: String @doc(description: "The login type, such as manual or facebook")
        page_path: String @doc(description: "The path of the page")
        page_referrer: String @doc(description: "The page referrer")
        page_title: String @doc(description: "Title of the page")
        page_url: String @doc(description: "The page url")
    }

type PageData {
    location: String @doc(description: "The location from where the login performed")
    login_type: String @doc(description: "The login type, such as manual or facebook")
    page_path: String @doc(description: "The path of the page")
    page_referrer: String @doc(description: "The page referrer")
    page_title: String @doc(description: "Title of the page")
    page_url: String @doc(description: "The page url")
}

type Mutation {
    revokeCustomerToken(input: PageData): RevokeCustomerTokenOutput @resolver(class: "\\DollsKill\\CustomerGraphQl\\Model\\Resolver\\RevokeCustomerToken") @doc(description:"Revoke the customer token")

}

type RevokeCustomerTokenOutput {
    result: Boolean!
    pagedata:PageData @resolver (class: "\\Vendor\\CustomerGraphQl\\Model\\Resolver\\RevokeCustomerToken") @doc(description:"Pagedata for respective customer.")
}

How i test it in chrome graphql tool
mutation {
  revokeCustomerToken{
    result
      pagedata (
        location:"sddsd"
      )
    {location}
    }
    }


texts: i want to change the admin panel favicon icon, how to do that?

texts: I want to change the favicon icon of admin panel in magento. i have changed the favicon icon of the front end, but i want to change the admin panel's favicon icon also, how to change that?


texts:
Is there a convention for model alias names (or any alias names for that matter)? I.e. should it be

1.

<mynamespace_mymodulename>
    <class>MyNamespace_MyModuleName_Model</class>
</mynamespace_mymodulename>

or

2.

<mymodulename>
    <class>MyNamespace_MyModuleName_Model</class>
</mymodulename>

I've always used 1. and prefer it as there are less like to be conflicts.  But I've noticed a few well respected modules on the market do otherwise.


texts:
I want to call a php file containing first name in system.xml.

I know that it can be done by using source_model and using class class_name implements \Magento\Framework\Option\ArrayInterface

Is there any other way to do so without using \Magento\Framework\Option\ArrayInterface


texts: Grid image in shopping cart in magento dashboard

texts:
please check attached snap-shot:

I am trying to Get image on shopping cart grid, but its showing no image, please check my code:

    ))->addColumn('image', array(
        'header'=> Mage::helper('catalog')->__('Image'),
        'type'  => 'image',
        'width' => '100px',
        'index' => 'image',

I have made changes in this file: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php.

Please help.


texts: Lost front end back templates after updating 1.9.3.6 to 1.9.6.8?

texts:
After updating from 1.9.3.6 to 1.9.6.8 the front and backend templates are gone. Also none of the product images are being shown. What could be the problem ?

Thanks.


texts: Remove index.php from magento url in sitemap.xml

texts:
We have removed the annoying index.php from all of our urls in magento 1.9.3.8 and the frontend is working beautifully (server rewrites and htaccess properly set up etc.). However, our sitemap.xml is including the index.php portion inevery URL and submitting to google resulting in 404s, obviously. How do we stop the sitemap generator from including the unwanted index.php portion of the url?

Hope someone can help:)


texts: How to add custom Image attribute to category in Magento 2?

texts:
Can you help me to add custom field for the image on my category?

I want to add a thumbnail for my category via admin panel, and then get it on front-end.

I have now eav attribute in eav_attribute table, but it still doesn't appear in admin panel.

Thanks!


texts: "uploaded file has no extension" error when trying to import product or customer information from CSV

texts:
I am trying to import Product and Customer data into my new Magento install (CE 1.9.1) I have the CSV files correctly formatted based on the export files but when I upload and click on check data I get the error "uploaded file has no extension".

What does this mean and how do I fix it?