texts: How to create a customer programmatically with custom attributes in Magento 2?

texts:
I would like to create a customer account programmatically in Magento 2.0.4.

I just have one problem. I don't know how to persist custom attributes. With following code, I got response that my required custom attribute (xxx_test) is not set.

 class Register extends \Magento\Framework\App\Action\Action {

    protected $storeManager;

    /**
     * @var \Magento\Customer\Model\CustomerFactory
     */
    protected $customerFactory;

    /**
     * @param \Magento\Framework\App\Action\Context      $context
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
     * @param \Magento\Customer\Model\CustomerFactory    $customerFactory
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Customer\Model\CustomerFactory $customerFactory
    ) {
        $this->storeManager     = $storeManager;
        $this->customerFactory  = $customerFactory;

        parent::__construct($context);
    }

    public function execute()
    {
        // Get Website ID
        $websiteId  = $this->storeManager->getWebsite()->getWebsiteId();

        // Instantiate object (this is the most important part)
        $customer = $this->customerFactory->create();

        $customer->setWebsiteId($websiteId);
        $customer->setEmail("test@mail.com");
        $customer->setFirstname("First Name");
        $customer->setLastname("Last name");
        $customer->setPassword("password");
        $customer->setPrefix("Herr");

        $customer->setAddresses(null);

        $storeId = $this->storeManager->getWebsite($websiteId)->getDefaultStore()->getId();
        $customer->setStoreId($storeId);

        $storeName = $this->storeManager->getStore($customer->getStoreId())->getName();
        $customer->setCreatedIn($storeName);

        /*
         * TODO
         * Problem with custom attributes
         */

        $customerData = $customer->getDataModel();
        $customerData->setCustomAttribute("xxx_test", "N/A");
        $customer->updateData($customerData);

        $customer->save();
        $customer->sendNewAccountEmail();
    }

}

Could anybody please help?


texts:
I have installed Magento 2.2.8 in Xampp. After installed and done all the necessary things, I have checked the site in frontend but it seems the CSS is not loaded correctly. Please see the screenshot

In the Network tab, I'm getting these:

Could anyone please help me to resolve this issue?


texts:
I need to create a json file with data and store that file in specific directory of magento 2. Can any one please tell me how we can achieve this in magento2 in standard way like file system.

Please don't suggest PHP way as this might not be the standard way due to which magento will restrict module from uploading.

any help will be appreciated. thanks in advance


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

texts: I am developing an online store using Magento 2. I am using the Sm mega menu. In their nav section in mobile view, they show categories. So I want to create home categories and show them in nav bar hover and redirect it to home page.


texts: How to redirect category products to different website?

texts: I have 100's of products that needs to be redirected to a different website when the customer clicks on a product on category page, because I want to sell them there. Is it possible with Magento. Can anyone please guide me.


texts:
How to add Cambodia state?
My country is Cambodia but when i select Camboida do not show "State or Province" Automate.

Example: Collection Cambodia so Many State such as: Pursat, Kompong Speu, Svay Rieng...


texts:
At the moment I'm using the following code to get the image by position. Is there an easiest way to do that?

<?php
$imgFile = $imgLabel = "";
$imagens = Mage::getModel('catalog/product')->load($_item->getProductId())->getMediaGalleryImages();
foreach ($imagens as $imagem) {
if($imagem->getPosition() === '9') :
    $imgFile = $imagem->getFile();
    $imgLabel = $imagem->getLabel();
    endif;
}
if(!$imgFile && !$imgLabel):
?>
<img src="<?php echo $this->helper('catalog/image')->init(Mage::getModel('catalog/product')->load($_item->getProductId()), 'small_image')->resize(70,105); ?>" width="70" height="105" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" />
<?php else : ?>
<img src="<?php echo $this->helper('catalog/image')->init(Mage::getModel('catalog/product')->load($_item->getProductId()), 'small_image', $imgFile)->resize(70, 105); ?>" width="70" height="105" alt="<?php echo $this->htmlEscape($imgLabel);?>" />
<?php endif; ?>


texts:
Hi

I wonder if is possible to group the attributes by attribute set to layered navigation. Let me expalin what I mean.

Let's say that we make a search to products with various attribute sets.

Shoes -> shoes-attr-set -> size,style,color
Car -> car-attr-set -> type,hp,car-color
Toys -> toys-attr-set -> age,genre

The search returns all products from this categories and display all the attributes to layered navigation. Something like this
size
style
color
type
hp
car-color
age
genre

What I want is to format the layered navigation this way

Shoes
- size
- style
- color

Car
- type
- hp
- car-color

Toys
- age
- genre

Can anybody help me. Thank you


texts:
Getting a custom attribute in the cart should be simple enough: adding a app/code/<Vendor>/<Module>/etc/catalog_attributes.xml with e.g. the following content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd">
    <group name="quote_item">
        <attribute name="sample_attr"/>
    </group>
</config>

Should be enough. However, for some reason, when doing

$product = $block->getItem()->getProduct();
$attribute = $product->getCustomAttribute('sample_attr');

in the default.phtml of the cart, $attribute will still always be null, even in developer mode, or even after cache:flush and setup:di:compile. We have also enabled the options Visible on Catalog Pages on Storefront and Used in Product Listing in the attribute's configuration, but still no luck. No matter what we try, the custom attribute is always null.

This approach works fine for us for the product list (using the catalog_product group in the catalog_attributes.xml), but we can't get it working for cart items. Does anyone have any further ideas?

Magento 2.3.2


texts:
How I can create a full backup of the store without ftp/ssh or cPanel access? I have access only in Magento admin. The version of Magento store is 1.4.

Update: I try to install a new extension but I have this error:

No releases for package "magento-community/MageBackup_MageBackupFree" exist
PEAR ERROR: install failed


texts: how to get product id from which category in magento2

texts: I want to get product id and also check that this product's category id and name. and also want to check that this current category id and selected product's category id equal or not...


texts: Magento 2 - Current url not work well in copyright section

texts:
I need to get the current url in the copyright.phtml section.
This is my code:
echo $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);

After clearing the cache it seems to work but when I change the page the link is always the same and doesn't change.
This problem only happens to me in the copyright.phtml section. Why?


texts: How is the minicart content loaded and rendered?

texts:
I have overriten the content.html minicart template in my theme, currently the code looks like this:

他に点の商品があります

商品点数

点

商品合計

(税込)

送料

￥(税込)

送料はご登録住所を元に計算

手数料

合計

(税込)

買い物かごを見る

注文する

買い物かごに商品はありません

Can anyone explain where I would find these functions:

cart().delivery_fee,
cart().subtotal,
car().summary_count,
.....

And how would I go about adding my own function? Example: cart().total_after_charge_fee

Thanks


texts: Add option to attribute in database table

texts: In database where can I find a table where I could add another option to admin attribute?


texts: Where "use in layered navigation" attribute property is stored in the database?

texts:
I am looking for where (what table) in the Magento 1.9.0.3 database this attributes property "use in layered navigation" is stored. I actually new it but now it takes a lot of time to remember. Maybe someone can help out right away? Thanks.

Searched in eav_attribute, eav_attribute_option. No luck yet :)

I need to select all the attributes ids with "use in layered navigation" enabled
programmatically.


texts: Magento 1.9 - 503 Error timing out - Notice: iconv_strlen(): Detected an illegal character in input string

texts:
PHP 5.5.38
Magento 1.9.3.2

I've had a site running perfectly fine for over a year, and suddenly today its been timing out most of the time trying to load a page, with the 503 error page coming up saying:

  The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

I am unable to login to admin side of things to check, so looking through system logs it looks like theres an error in a look causing the crash:

2019-06-29T18:41:06+00:00 ERR (3): Notice: iconv_strlen(): Detected an illegal character in input string  in /var/www/vhosts/******/httpdocs/shop/app/code/core/Mage/Core/Helper/String.php on line 86

Looking up line 86 in that file its:

return iconv_strlen($string, self::ICONV_CHARSET);

I have also noticed when trying to login to admin, it forces this error now:

2019-06-29T19:06:54+00:00 ERR (3): Warning: Illegal offset type in isset or empty  in /var/www/vhosts/*****/httpdocs/shop/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php on line 332

Line 332 in this file is:

if ($order && isset($orders[$order])) {

After using google-fu I haven't come up with much information on this.

UPDATE: I managed to login admin very temporarily, and I have noticed the search terms looked strange on the dashboard so went to the search terms, see the screenshot below:

Which makes it looks like bots or even a DoS attack? Anyone had this before and know if I'm right in thinking this is a DoS?


texts: Magento2: Adding a block to referenceContainer on all pages?

texts:
I'm trying to get a block to embed on all pages. I've tried many references containers including footer, page.top and page.wrapper. The only one I've managed to get to include correctly on the thankyou (order success) page in footer.

Even using footer the embed does not seem to happen on category or CMS pages. I'm using the default Magento 2 theme and test data.

My default.xml is as follows:

<?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">
    <head> </head>
    <body>
        <referenceContainer name="footer">
            <block class="Company\Module\Block\Module" name="company_module" template="Company_Module::tracking.phtml" />
        </referenceContainer>
    </body>
</page>

Any ideas appreciated.


texts: Magento 2 No ‘Access-Control-Allow-Origin’ header is present on the requested resource

texts:
We are developing a front-end web app, running on a Node.js server, which accesses REST API of our Magento 2 instance, located on a separate server. The problem is that browsers impose Same Origin policy and when a request is made from the front-end served by Node.js to the server on which Magento 2 resides, we get  "No ‘Access-Control-Allow-Origin’ header is present on the requested resource.” error. We tried putting Header set Access-Control-Allow-Origin “*” in .htaccess file, as well as allowing all methods (put,post,get,options,delete,patch) and headers but we keep getting this error. We even tried setting the headers in index.php but no effect.

Any help is appreciated!


texts: Setting Http Custom Header in REST Api Magento2

texts:
I want to set a custom Http header in my response in a Magento2 REST Api. I did the following:

class Review implements ReviewInterface {

    public function __construct(
    \Magento\Framework\App\ResponseInterface $response) {

       $this->response = $response;

    }

And in my function I set it using:

$this->response->setHeader('X-rating-summary', $product_rating , true);

However I'm not getting the custom header in the response. Not sure what im missing.


texts:
I am working on admin notification area where I want to show on message which is related to currently logged-in user.
I have created a column in db with user_id  where after some functionally I push message with specific userID.
now I want that when that specific user logged in he see all messages where

userId == currentLoggedInUserID

adminhtml_notification_block.xml this is the layout file where the collection file is placed.
Now, when I create my custom collection file and extend the protected function

_initSelect()

protected function _initSelect()
    {
        $currentUserId =  $this->adminSession->getUser()->getId();
        parent::_initSelect();
        $this->addFieldToFilter('brand_user', $currentUserId);
        $this->addRemoveFilter();
        return $this;

it throws a NULL error because I can not get the session of the admin user in the collection file. what is the suggestion for this, please?


texts: Magetno 2: Theme Configuration Goes To 404 After Save

texts:
I'm using Magento 2.3.5, I'm scratching my head for a couple of days, the issue is when I go to Theme Configuration, do any changes and hit Save Configuration, the page goes to 404 error: Page not found.. Like This:

**Please help me out with this one.**


texts: What is referenceContainer or referenceBlock for Payment method in Magento2

texts:
I am trying to override cc.phtml file in Magento2 in my payment method,
but I did not find Proper referenceBlock or referenceContainer.

Like this way,

    <referenceContainer name="checkout.onepage.review.info.items.after">
        <block class="Magento\Payment\Block\Transparent\Form" name="payment.form.transparent">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Magento_Payment::transparent/form.phtml</argument>
            </action>
        </block>
    </referenceContainer>

I need the name of Container or Block for payment Section,

hope this will be helpfull for my question.


texts: Item pending in cart for more than 15 min then which event to trigger in magento 2

texts:
I want to trigger an event when in cart, items are pending for more than 15 minutes.
Can anyone pls guide me how to do?


texts:
I was looking for some extension that could give this possibility, but I did't find anyone.

Has anyone had this need? How do you solved?

Those groups would be for example: attendants, it, managers, hr, and so on. This data will be used in others systems.

Thanks!


texts: How do you display product in colorbox lightbox in magento 1.9 custom theme

texts:
I have successfully managed to get the colorbox pop up window to display on page. However beyond that I am not getting much success in displaying the product - At best I get the entire webpage loading in the box :(

I've created a version of media.phtml within my theme directory:

Package>Theme>Template>Catalog>>product>View>media.phtml

All my modifications have been done in this file which basically consist of

Removing the zoom script
Adding the colorbox calls

It looks like I'm missing the specific syntax or format that is required to have the product display, I really don't want to use an extension to achieve this and would be grateful for a little direction.

There is a mass of info for achieving this on older versions but I've struggled to locate this for mage 1.9+

Any assistance or guidance would be grand.


texts: Magento 2 plugin not working for CommonTaxCollector model

texts:
I want to overwrite mapItem function which is under the CommonTaxCollector class. So, I have done this but getting undefined error.

Uncaught Error: Call to undefined method Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory::getTaxCalculationItemId() in /app/code/VendorName/ModuleName/Plugin/CommonTaxCollectorPlugin.php:14

  app/code/[VendorName]/[ModuleName]/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector">
        <plugin name="[vendorname]_[modulename]_commontaxcollector" type="[VendorName]\[ModuleName]\Plugin\CommonTaxCollectorPlugin" sortOrder="1" />
    </type>
</config>

  app/code/[VendorName]/[ModuleName]/Plugin/CommonTaxCollectorPlugin.php

<?php
namespace [VendorName]\[ModuleName]\Plugin;

class CommonTaxCollectorPlugin
{
    public function aroundMapItem(
        \Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector $subject,
        $itemDataObjectFactory,
        $item,
        $priceIncludesTax,
        $useBaseCurrency,
        $parentCode = null
    ) {
        if (!$item->getTaxCalculationItemId()) {
            $sequence = 'sequence-' . $this->getNextIncrement();
            $item->setTaxCalculationItemId($sequence);
        }

        $itemDataObject = $itemDataObjectFactory->create();
        $itemDataObject->setCode($item->getTaxCalculationItemId())
            ->setQuantity($item->getQty())
            ->setTaxClassKey(
                $this->taxClassKeyDataObjectFactory->create()
                    ->setType(TaxClassKeyInterface::TYPE_ID)
                    ->setValue($item->getProduct()->getTaxClassId())
            )
            ->setIsTaxIncluded($priceIncludesTax)
            ->setType(self::ITEM_TYPE_PRODUCT);

        if ($useBaseCurrency) {
            if (!$item->getBaseTaxCalculationPrice()) {
                $item->setBaseTaxCalculationPrice($item->getBaseCalculationPriceOriginal());
            }
            $itemDataObject->setUnitPrice($item->getBaseTaxCalculationPrice())
                ->setDiscountAmount($item->getBaseDiscountAmount());
        } else {
            if (!$item->getTaxCalculationPrice()) {
                $item->setTaxCalculationPrice($item->getCalculationPriceOriginal());
            }
            $itemDataObject->setUnitPrice($item->getTaxCalculationPrice())
                ->setDiscountAmount($item->getDiscountAmount());
        }

        return $itemDataObject;
    }
}

Thank you,


texts: How Can A Block Render Without Specifying `as` property of the block, When we use getChildHtml() Method

texts:
This is the source for my doubt. Please have a a look on this question, answer and answer's comment.
Basically the question demands to include a core/template block inside header block. For this we can use this code in layout XML.
<reference name="header">
    <block type="core/template" name="test_name" as="test_as" template="test/test.phtml" />
</reference>

and the test.phtml look like this.

<?php echo $this->__('Can you see me ?'); ?>

In order to see the content of my template, I need to call my test block inside header block as like this. This is because, header block is of type page/html_header and the block will not automatically convert its content to html as other core block does. So this is how we can call test block in header block.

<?php echo $this->getChildHtml('test_as') ?>

Note that, I am using the as property of test block to invoke that block in header block. Upto this everything is clear for me. But the actual doubt starts here.
Doubt :- If I didn't specify the as property in my test block and if I call my test block and then invokes the block as like this,

<?php echo $this->getChildHtml('test_name'); ?>

it works and show the content of test.phtml in frontend. This also works.

<?php echo $this->getChildHtml(); ?>

How it is possible to show the block output, by invoking that block with its name in its parent block ????
I am asking this because, there were lot of occasions in which I didn't specify as property that leaves a block not rendered. (even if I use name property of my block)
I know, magic happens here. But I can't just understand what exactly happens here.
public function getChildHtml($name = '', $useCache = true, $sorted = false)
{
    if ($name === '') {
        if ($sorted) {
            $children = array();
            foreach ($this->getSortedChildren() as $childName) {
                $children[$childName] = $this->getLayout()->getBlock($childName);
            }
        } else {
            $children = $this->getChild();
        }
        $out = '';
        foreach ($children as $child) {
            $out .= $this->_getChildHtml($child->getBlockAlias(), $useCache);
        }
        return $out;
    } else {
        return $this->_getChildHtml($name, $useCache);
    }
}

So any help mostly appreciated .
Thanks in Advance


texts: Magento : How to do share cart between different domain

texts:
I have tried share-cart between different domain but it isn't working.

I have two websites with different domains like

  https://www.site1.com

and

  http://www.site2.com

I want to share this website cart data

  https://www.site1.com

to

  http://www.site2.com

I have tried it but not working for me.

If you have any idea about this please share with me.

Thanks in advance.


texts:
I have this problem and I can't locate where the problem is :

1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed. Line: 1124

This problem occurs as a connected customer, when I try to access the invoice for a test order.

Here is what I tried to do to solve the problem by following a lot of topics on this forum:

setup:di:compile
Delete the content of /pub/static/frontend
Deploy static content

Nothing works.

Note that I searched my XML for a referenceBlock with a class attribute, but I didn't find anything. Maybe I'm not looking in the right place?

The directories scanned to find the error:
- /app/code
- /app/design

Can someone explain to me how to locate this error more precisely? Or help me solve it?

EDIT : I made : grep -r -i --include \* '<referenceContainer' mySiteDirectory/
And there is no referenceBlock with "class" attribute.

EDIT 2 : With Luma theme, I have same problem. So I suppose it's coming from a module.

So... What to do please ?

Magento version 2.3.1

Thank you in advance.


texts:
Hi i need display in cart with total block also different price: display price in cart without tax and display price in cart with tax - where and what i need modify for display prices, prices should be in different fow and display always

Thanks


texts: Any Search Extension which does the 2 word job for Magento Yet?

texts:
Magento since its days of birth has the worst search engine and I can't imagine, how Magento core team has ignored this completely. We are now at 1.9.x and its still the same.
No improvement or work whatsoever.

I have seen every commercial search extension now too, none tell to work the more than one keyword search results, CORRECTLY!

So, has anyone got a solution yet or any good working extension ?

Let us know.


texts: How to make an extension Paid and Upload on Magento Connect

texts:
We have developed an extension and need to upload it on Magento Connect. This would be our first extension on marketplace.

Could anyone guide me on the following queries

How to upload an extension on Magento Connect ?
Does it require a special merchant account to upload any extension ?
How can I upload a paid extension on Magento Connect ?
Do I need to redirect user to my website in order to complete the
extension purchase ?
How to define warranty, support, and contact information ?

Please help and guide.


texts:
Is there a way to remove a checkbox label from above?

I looked into documentation, but i didn't find any similar example.


texts:
I have multiple websites with different domains for each website and different Catalog Root Tree for each website on a single Magento 1.9 installation.

The first website (abc.com) is the default website store selling almost 40.000 products. The second website (123.com) have a limited range with same product of first website.

When I create a product I select the website that I want to show the product (or select all websites). Also If I select all website I choose to add it to specific category of every website.

I create different sitemaps for every store view of every website.

The problem is that to second sitemap xml (with limited range of products) appears all the products even if I haven't enabled. As a result the Google returns me 404 error cause not find the product.

Anyone know how can I exclude the products from the second XML?


texts: How can I get the customer remote address(ip) in javascript? Magento 2

texts:
I couldn't find any javascript file that would get the remote address(ip). I am thinking of creating my own javascript helper with api, but maybe there is a better way or the javascript that I am looking for already exists.

Any help is welcome, tnx fellas :)


texts: How do I add a template for account pages only?

texts:
I have a template that needs to be only on account pages and checkout pages.

I have got a menu in the local.xml that is shown when a customer is logged in but I want to show it only on certain pages aswell.


texts: How do you edit the default footer links that Magento applies? Orders and Returns, Search term?


texts: How to get every product's quantity in event observer json file?

texts:
public function productDataToJson(Varien_Event_Observer $observer)
{
  $category = Mage::getModel('catalog/category');
  $tree = $category->getTreeModel();
  $tree->load();
  $ids = $tree->getCollection()->getAllIds();
  $jsonFilePath = Mage::getBaseDir().'/jsondata';
  $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
  $productMediaConfig = Mage::getModel('catalog/product_media_config');
  foreach ($ids as $id) {
    $productsArr = array();
    $products = $category->load($id)
        ->getProductCollection()
         ->addAttributeToSelect('*')
         ->addStoreFilter(Mage::app()->getStore()->getId());
    $i = 0;
    foreach ($products as $_product) {
        $baseImageUrl = $productMediaConfig->getMediaUrl($_product->getImage());
        $smallImageUrl = $productMediaConfig->getMediaUrl($_product->getSmallImage());
        $thumbnailUrl = $productMediaConfig->getMediaUrl($_product->getThumbnail());
        $heroImageUrl = $productMediaConfig->getMediaUrl($_product->getProductHero());
        $productUrlPath = $baseUrl.$_product->getData('url_key');
        $categoryName = $category->getName();
        $productsArr[$i] = array_merge($_product->getData(), array('category_ids' => $_product->getCategoryIds(),'price'=>Mage::helper('core')->currency($_product->getFinalPrice(), true, false),'size'=>$_product->getAttributeText('size'),'color'=>$_product->getAttributeText('color2'),'brand'=>$_product->getAttributeText('brand')));
        $productsArr[$i]['image'] = $baseImageUrl;
        $productsArr[$i]['small_image'] = $smallImageUrl;
        $productsArr[$i]['thumbnail'] = $thumbnailUrl;
        $productsArr[$i]['product_hero'] = $heroImageUrl;
        $productsArr[$i]['url_path'] = $productUrlPath;
        $productsArr[$i]['category_names'] = $categoryName;
        $i++;
        //echo '<pre>';print_r($productsArr);exit;
    }
    $jsonData = Mage::helper('core')->jsonEncode($productsArr);
    file_put_contents($jsonFilePath.'/c_' . $id . '_node.json', $jsonData);
  }
}

Also need lables of all attributes, like if I create any attribute, I can get it in my json file. how can I get this in my function?


texts: Zend_Db_Adapter_Exception pdo_mysql extension is not installed

texts:
ralfe@ralfe:/opt/lampp/htdocs/amboim$ bin/magento setup:di:compile
Compilation was started.
Proxies code generation... 0/7 [>---------------------------]   0% 1 sec 42.0 Mi
Proxies code generation... 1/7 [====>-----------------------]  14% 1 sec 46.0 Mi
Repositories code generation... 1/7 [====>-----------------------]  14% 1 sec 46
Repositories code generation... 2/7 [========>-------------------]  28% 6 secs 1
Service data attributes generation... 2/7 [========>-------------------]  28% 6
Service data attributes generation... 3/7 [============>---------------]  42% 6
Application code generator... 3/7 [============>---------------]  42% 6 secs 134
Application code generator... 4/7 [================>-----------]  57% 16 secs 15
Interceptors generation... 4/7 [================>-----------]  57% 16 secs 152.0
Interceptors generation... 5/7 [====================>-------]  71% 26 secs 170.0
Area configuration aggregation... 5/7 [====================>-------]  71% 26 sec
Area configuration aggregation... 6/7 [========================>---]  85% 37 sec
Interception cache generation... 6/7 [========================>---]  85% 37 secs
Interception cache generation... 7/7 [============================] 100% 46 secs
Interception cache generation... 7/7 [============================] 100% 46 secs 242.0 MiB

Generated code and dependency injection configuration successfully.
We're sorry, an error occurred. Try clearing the cache and code generation directories. By default, they are: var/cache, var/di, var/generation, and var/page_cache.

[Zend_Db_Adapter_Exception]
pdo_mysql extension is not installed

I'm using ubuntu and Xampp as Server


texts:
I am trying to get product collection programmatically and product flat table structure is enabled.

I don't want to disable product flat table, this will hurt frontend performance. Just for my script I want to get product collection from EAV structure.

Is it possible to do this? or I need to disable flat table for this?


texts: Using luma LayeredNavigation in custom theme based on blank theme

texts:
I want to copy the style and functionality of luma layered navigation to my custom theme - parent is blank theme.
If I copy the Magento_LayeredNavigation of luma theme to my custom theme <vendor>/<theme>/Magento_LayeredNavigation
then it re-styles everything.

I think I need to copy some additional files/modules to my custom theme?! Maybe I just need some CSS which I need to append to my _extend.less files?!
Can you give detailed instructions how to solve this problem?
Thank you!


texts:
In the default layout for the admin product edit page, we have an accordion style setup. This is really annoying as you have to scroll down several pages every time you want to edit an option that's not part of the General tab.

I would like to have a sidebar like on the customer edit page. Switching to "admin-2columns-left" doesn't seem to do the trick. Is there any recommended way of achieving this?

I'm using the default Magento admin theme. Not Luma. Luma is a frontend theme. I don't think the default admin theme has a name.

I'm talking about

vendor/magento/theme-adminhtml-backend


texts: Customer form Allignment issue in magento 2

texts:
I had created a template for Customer address form.
There is alignment issue with name block and phone number block.
As shown in below image

This thing works fine on my development environment but creating issue on production site

<fieldset class="fieldset">
    <legend class="legend"><?= $block->escapeHtml(__('Contact Information')) ?></legend>

    <?= $block->getBlockHtml('formkey') ?>
    <input type="hidden" name="success_url" value="<?= $block->escapeUrl($block->getSuccessUrl()) ?>">
    <input type="hidden" name="error_url" value="<?= $block->escapeUrl($block->getErrorUrl()) ?>">
    <?= $block->getNameBlockHtml() ?>

    <?php if ($_telephone->isEnabled()): ?>
        <?= $_telephone->setTelephone($block->getAddress()->getTelephone())->toHtml() ?>
    <?php endif ?>

    <?php if ($_company->isEnabled()): ?>
        <?= $_company->setCompany($block->getAddress()->getCompany())->toHtml() ?>
    <?php endif ?>

    <?php if ($_fax->isEnabled()): ?>
        <?= $_fax->setFax($block->getAddress()->getFax())->toHtml() ?>
    <?php endif ?>


texts: Script to round all product prices in database to 2 decimal places

texts:
What is the best approach to go through all products PRICES (price, final price, promo price, group price ...) and round them to 2 decimal places.
for example:
28,1200 -> 28,1200
28,1255 -> 28,1300
28,1261 -> 28,1300


texts: What is best way to override third party modules?

texts:
I am using a third party module, but it doesn't fulfill all the requirements. So I have to do some customizations in this module. If I do changes directly in the third party module then it will be overridden when we update the module.
What is the best way to override this third-party module?
I have to override fronted controller file.
I am new to Magento. Please provide me some guidance.


texts:
How to get contact us email from get category content tab form select drop down attribute in Magento 2.3.1
form_select category custom attribute how to get contact us from there.

app/code/Vendor/Module/Setup/InstallData.php

$eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'form_select', [
        'type'         => 'int',
        'label'        => 'Form Select',
        'input'        => 'select',
        'sort_order'   => 130,
        'source'       => Template::class,
        'global'       => ScopedAttributeInterface::SCOPE_STORE,
        'visible'      => true,
        'required'     => false,
        'user_defined' => false,
        'default'      => '1',
        'group'        => 'Content',
    ]);

app/code/Vendor/Module/view/adminhtml/ui_component/category_form.xml

<field name="form_select">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Vendor\Module\Model\Source\Template</item>
            <item name="config" xsi:type="array">
                <item name="required" xsi:type="boolean">false</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">false</item>
                </item>
                <item name="sortOrder" xsi:type="number">90</item>
                <item name="dataType" xsi:type="string">string</item>
                <item name="formElement" xsi:type="string">select</item>
                <item name="label" translate="true" xsi:type="string">Form Select</item>
            </item>
        </argument>
    </field>


texts: Mysql server goes down with queries in SLEEP STATE when I access magento site

texts:
We have a Magento 1.9.2.4 site. We are accessing it on using a subfolder and subdomain as http://dummysite.com/magentosite and http://magentosite.dummysite.com

Here we would live to mention that our main site dummysite.com is made in core php and project is listed in public_html directory.
Now we now want to make our magento site on main domain so we are writing following code in htaccess of public_html folder.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?dummysite.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www.)?dummysite.com$
RewriteCond %{REQUEST_URI} !magentosite/
RewriteRule (.*) /magentosite/$1 [L]

It is working fine, our site is now accessing magentosite. Now the issue is when load or traffic comes, server goes down.
Our server have a 64GB RAM, and 1.44 TB Hard Disk with CentOS 6.8.

By checking in mysql with show processlist; it is showing queries in SLEEP STATE.
Within 3 hours server goes down. It is only happening with my magento site on main domain.
If we revert it to old php site no SLEEP STATE under mysql.

We have found various concerns to overcome this issue:
1. By Clearing full page Cache.
2. By Enabling Flat Table of Product Images

We have tried all of them but still same SLEEP STATE

Also there is nothing helpful recorded in log.

Is there anything which we need to follow before making Magento site live by using this process. We can only make live site by redirecting it using htaccess.


texts: How to save custom product tab fields drop box and input text value to database in Magento 2

texts:
Overrided Admin Product Save Controller (shown below)

<?php

namespace Maxime\Helloworld\Controller\Adminhtml\Rewrite\Product;

class Save extends \Magento\Catalog\Controller\Adminhtml\Product
{

    public function execute()
    {
    $productId = $this->getRequest()->getParams();
    $data = $this->getRequest()->getPostValue();

    print_r($_POST);die();
    return parent::execute();
    }
}

In my phtml page, listed out a input field and a select/option field inside a form.
I tried a lot of times to paste the code.But it didn't appears.
I need to get the values of both fields in that overrided controller.


texts: How to create magento2 custom theme/design

texts:
I am trying to create new custom theme in magento I have followed the official document and did all the changes, I can see my custom theme in admin section too.

Now I need to make some adjustment in header/footer files but not able to find a proper way to do.

I have replaced all the folder on my theme such as below

  app\design\frontend\flow\fa\magento\module-catalog\view\frontend\templates\product\view

and tried below also

  app\design\frontend\flow\fa\module-catalog\view\frontend\templates\product\view

I am not sure which one is the right but in above all cases still the files are coming from

  vendor/magento/module-catalog/view/frontend/templates/product/view/details.phtml

How can I make to come these files from my folder? I need to override templates to suit my design.

Any view what I am doing wrong? did anyone created any new custom theme and it's working properly?


texts: Magento 2: Get Payment Information in checkout_submit_all_after event observer

texts:
I have need to get Payment information in checkout_submit_all_after event observer.

File path: magento/app/code/Vendor/Module/etc/events/xml

<event name="checkout_submit_all_after">
    <observer name="order_create_all_after" instance="Vendor\Module\Observer\OrderObserver" />
</event>

File path: magento/app/code/Vendor/Module/Observer/OrderObserver.php

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

I have try to print order object through the getdata but not get payment information.

Any help will appreciate. Thanks.


texts: Magento 2 module not working. Override fails

texts:
I am trying to write a module that filters products in a product collection. For that I have tried to override Magento\Catalog\Model\Layer. These are the files in the module:

/Viking/FilterProducts/registration.php

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

/Viking/FilterProducts/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\Layer" type="Viking\FilterProducts\Model\Layer" />
</config>

/Viking/FilterProducts/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="Viking_FilterProducts" setup_version="1.0.0"/>
</config>

/Viking/FilterProducts/Module/Layer.php

<?php

namespace Viking\FilterProducts\Model;

class Layer extends \Magento\Catalog\Model\Layer{

    protected $_customerSession;

    protected $_resource;

    public function __construct(
        \Magento\Catalog\Model\Layer\ContextInterface $context,
        \Magento\Catalog\Model\Layer\StateFactory $layerStateFactory,
        AttributeCollectionFactory $attributeCollectionFactory,
        \Magento\Catalog\Model\ResourceModel\Product $catalogProduct,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\Registry $registry,
        CategoryRepositoryInterface $categoryRepository,
        array $data = []
        ) {
            $this->_resource = $resource;
            $this->_customerSession = $customerSession;
            parent::__construct(
                $context,
                $layerStateFactory,
                $attrubuteCollectionFactory,
                $catalogProduct,
                $registry,
                $categoryRopository,
                $data
            );
    }

    //Old funciton with print statement
    public function getProductCollection(){

        if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) {
            $collection = $this->_productCollections[$this->getCurrentCategory()->getId()];
        } else {
            $collection = $this->collectionProvider->getCollection($this->getCurrentCategory());
            //Will filter products here
            $this->prepareProductCollection($collection);
            $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection;
        }

        echo 'New Layer <br />';

        return $collection;
    }

}
?>

It is still the old Layer that is called. I have overridden other classes in the same way but this time it doesn't work and I don't know why.Been stuck at this point really long now. No error messages.

removing constructor (which will be used) does not make any difference.

Edit

I changed the module.xml file as @dersam suggested but it did not help. I also added an composer.json file in Viking/FilterProducts that look like this:

{
    "name": "Viking/FilterProducts",
    "type": "magento2-module",
    "version": "1.0.0",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/module-catalog": "~100.0"
    }
}

This did not make any difference either but I am not sure if it is correct. (I ran disable/enable command and then setup and compile commands). The module shows up as enabled when running module:status.


texts:
I can’t understand why there is a very long response from the server. Everything can work well for 2-3 days, and then, by some magical case, the site starts loading for a long time. I'm doing a restart mysql , but it does not help restarted php-fpm, also nothing.I did many more different things, but it doesn’t work. Only full server restart helps.

How can I understand why the long answer is


texts: Magento 2 admin grid csv export not working properly

texts:
I added csv export in admin grid and want to have export functionality whether admin user have filtered results or not.
now I'm filtering data by daterange. some dates are working properly and gives me csv file like this

and some dates not giving me a csv file and all I'm getting is a blank page.
all data export not working at all.
this is my code to create a csv file:
            $component = $this->filter->getComponent();
            $this->filter->prepareComponent($component);
            $dataProvider = $component->getContext()->getDataProvider();
            $dataProvider->setLimit(0, false);
            $searchResult = $component->getContext()->getDataProvider()->getSearchResult();
            $name = md5(microtime());
            $file = 'export/' . $component->getName() . $name . '.csv';
            $this->directory->create('export');
            $stream = $this->directory->openFile($file, 'w+');
            $stream->lock();
            $header = [
                'Customer ID',
                'Customer Name',
                'Customer Mobile',
                'Comment To Customer',
                'Comment To Admin',
                'Balance Change',
                'Balance',
                'Transaction Date',
                'Type',
                'Customer Notified',
                'Created By',
            ];
            $stream->writeCsv($header);
//            var_dump(count($searchResult->getItems()));
            foreach ($searchResult->getItems() as $document) {

                $content = [
                    $this->customerRepositoryInterface->get($document->getCustomerEmail())->getId(),
                    $document->getCustomerName(),
                    $this->customerRepositoryInterface->get($document->getCustomerEmail())->getCustomAttribute('mobile')->getValue(),
                    $document->getCommentToCustomer(),
                    $document->getCommentToAdmin() ?? '',
                    number_format($document->getBalance(),0,',',','),
                    number_format($document->getCurrentBalance(),0,',',','),
                    $shamsi->toJalaliTime($document->getTransactionDate()),
                    (new TransactionType)->getBalanceUpdateLabel($document->getType()),
                    (new NotifiedStatus)->getStatusValue($document->getBalanceUpdateNotified()),
                    $document->getCreatedBy() ? $document->getCreatedBy() : '',
                ];
//                echo "<pre>";
//                var_dump($content);
//                echo "</pre>";
                $stream->writeCsv($content);
            }
            $stream->unlock();
            $stream->close();
            $date = $shamsi->toJalaliTime((new \DateTime())->format('Y-m-d H:i:s'));
            return $this->fileFactory->create("TransactionReport_$date.csv", [
                'type' => 'filename',
                'value' => $file,
                'rm' => true  // can delete file after use
            ], 'var');

before foreach i wrote count($searchResult->getItems()) result is correct,
but after foreach i don't have any data! this is my var_dump() data after getting a blank page :

as you can see array (size=353) 353 records!


texts: Custom controller which will search for a particular attribute in Magento v-1.9

texts:
I have an issue currently where my custom IndexController performs a search correctly based on a product SKU.

However, once I try and edit the code to return results from a chosen attribute (In my case a product code). It doesn't function correctly.

Below is my SearchController:

public function searchAction(){
    $id = $this->getRequest()->getParam('id');
    $this->findProduct($id);

}

protected function loadNoRoute() {
    $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
    $this->getResponse()->setHeader('Status','404 File not found');
    $pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_NO_ROUTE_PAGE);
    if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
        $this->_forward('defaultNoRoute');
    }
}

protected function findProduct($sku,$attributeSetId = null) {
    $collection = Mage::getModel('catalog/product')->getCollection();
    $collection->addAttributeToSelect(array('/product_url/'));
    $collection->addAttributeToFilter('sku',$sku);
    if ($attributeSetId) {
        $collection->addAttributeToFilter('attribute_set_id',$attributeSetId);
    }
    $collection->addUrlRewrite();
    $product = $collection->getFirstItem();
    $product['data'];
    // Check we have a product.
    if ($product->getId()) {
        // Get the URL and redirect to it.
        $url = $product->getProductUrl();
        // Parse URL
        $request = parse_url($url);
        $pageUrl = $request['path']; // Get URL without domain name
        if ($url) {
            $this->_redirectUrl('/support'.$pageUrl);
            return true;
        }

    }   // If we didn't find a matching product, load the default.
    $this->loadNoRoute();
    return false;
}
}

  It's really confusing me now why the Controller isn't outputting the results when the attribute $sku is swapped for $product_code as everything works as expected via the SKU search.

I'm obviously missing something here and wondered if somebody could help me or point me in the right direction.

I did previously have some help which fixed a separate problem and was a seriously good bit of code and advice.

Thanks


texts: Catalog Price Rule Not applying for all products

texts:
We are creating a catalog price rule mapping to a particular category. There are three different problems.

The rule is applied only to certain products in the category and not the other products.
The rule stopped working on a certain day in between the given time gap.
The rule did not get reflected when the starting date was same as the rule creation date, whereas once the rule starting date was changed to one day prior to the rule creation date, the rule got reflected in the front end.

Any help on this would greatly be appreciated.


texts: Making backorder go by store scope with MSI

texts:
I had an override to make backorder go by scope(in advanced inventory settings on the product) but after I turned on MSI, it disappeared. I can't seem to figure out how to change it. Think there is something in msi I am not understanding.
app\code\Vendor\Module\etc\adminhtml\system.xml
<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>

            <group id="item_options" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="backorders" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
                    Backorders
                    <source_model>Magento\CatalogInventory\Model\Source\Backorders</source_model>
                    <backend_model>Magento\CatalogInventory\Model\Config\Backend\Backorders</backend_model>
                    <comment>Changing can take some time due to processing whole catalog.</comment>
                </field>
            </group>

    </system>
</config>


texts: Get `entity_type_id` by `entity_type_code`

texts:
As the title, states, how can I get entity_type_id by entity_type_code in Magento 2?

I've looked in the source code, and the only thing I found was Magento\Eav\Setup\EavSetup->getEntityTypeId, however I'm not sure if this method is meant to be used in normal code, since to get the entity_type_id for catalog_product, my code becomes like this:

$entityTypeId = $objectManager
            ->create('Magento\Catalog\Setup\CategorySetup')
            ->getEntityTypeId(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE);


texts: Code Not working in category description

texts:
Great Discounts .

<button id="toglbtn">V</button>

Back to school offer brings printers at just

Laptops at

Routers at

Button is not toggling the specified Div element, But when I add the below code in Browser, It works fine.

var z = jQuery.noConflict();
z("#toglbtn").click(function(){
    z("#catdescr").toggle();
});

What can be the issue?


texts: Layout file that moves a block breaks entire layout

texts:
I'm running Magento 2.1.7 CE and I need to move the navigation.sections block inside of the header-wrapper. I found the reference to navigation.sections in vendor/magento/module-theme/view/frontend/layout/default.xml so I created a theme and I'm trying to modify the layout to just move that one block.

Here's the XML I setup to move navigation.sections inside of header-wrapper (saved under app/design/frontend/ThemeName/default/Magento_Theme/layout/default.xml):

<?xml version="1.0"?>
<page layout="3columns"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="navigation.sections" destination="header-wrapper" before="logo" />
    </body>
</page>

This technically works and when I apply this theme the navigation.sections block is moved to that container, but only in developer mode. If I change to production mode with this theme enabled, I run into these issues:

magento setup:static-content:deploy fails (I need to clear a lot of directories under var/ to get it to work)
Cannot minify or bundle JS or CSS, it just fails
Layout on the front page is completely wrecked
Some CSS and JavaScript files 404. From what I've seen it's files like require.js that are included in the original layout.xml that I'm trying to extend

I tried copying the original layout.xml and just adding the move tag but no luck. The only way I can get it to work without Magento having a meltdown is by adding the move tag to the original file, but that's not what I want.

What am I doing wrong?

Here is my registration.php:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/ThemeName/default',
    __DIR__
);

Here's my theme.xml:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <!-- Theme's name -->
    <title>Theme Name</title>
    <!-- Parent theme -->
    <parent>Magento/luma</parent>
    <media>
        <!-- Theme's preview image -->
        <preview_image>media/preview.jpg</preview_image>
    </media>
 </theme>

I found this in var/logs/exception.log:

"/path/to/magento/pub/static/frontend/ThemeName/default/en_US/mage/requirejs/mixins.js"
Warning!file_get_contents(/path/to/magento/pub/static/frontend/ThemeName/default/en_US/mage/requirejs/mixins.js):
failed to open stream: No such file or directory in /path/to/magento/vendor/magento/framework/Filesystem/Driver/File.php:149

So the compilation step is looking for requirejs/mixins.js which is NOT in my theme, I just want those pulled from the Luma theme. Again, what's an actual fix for this?

This is how I have been clearing cache so far:

rm -rf var/cache/* var/generation/* var/view_preprocessed/* var/page_cache/* pub/static/* var/di/* \
&& php bin/magento cache:flush


texts: How do I override plugin phtml file added by XML?

texts:
I have the MageFan Awesome Blog plugin for my Magento 2 instance. I've managed to override the recent posts template by adding my own BlogOverride plugin to my vendor.

Now I am trying to override the relatedposts.phtml file with my own code and I thought I did it the right way but nothing happened.

I first copied the file

  vendor/magefan/module-blog/view/frontend/templates/catalog/product/relatedposts.phtml

to

  app/code/Company/BlogOverride/view/frontend/templates/catalog/product/relatedposts.phtml

and changed the code to how I'd like it.

I then did a grep for the relatedposts.phtml file to see which XML file calls it, and it led me here:

  vendor/magefan/module-blog/view/frontend/layout/catalog_product_view.xml

I copied it to

  app/code/Company/BlogOverride/view/frontend/layout/catalog_product_view.xml

where my code looks like this:

<?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">
    <body>
        <referenceContainer name="content.aside">
            <block class="Magefan\Blog\Block\Catalog\Product\RelatedPosts"
                   name="product.info.blog.relatedposts"
                   as="relatedposts"
                   before='-'
                   template="Company_BlogOverride::catalog/product/relatedposts.phtml" />
        </referenceContainer>
    </body>
</page>

I then ran:

$ php bin/magento setup:upgrade
$ php bin/magento setup:di:compile
$ php bin/magento setup:static-content:deploy -f
$ php bin/magento cache:flush

and nothing changed, it's still using the default relatedposts.phtml file. How can I override files created by external plugins?

Edit: I've tried the below suggested answer to no avail:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance dc" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="content.aside">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Company_BlogOverride::catalog/product/relatedposts.phtml</argument>
        </action>
    </referenceBlock>
</page>


texts: all the answers found on SO so far to the problem "We can't find the products matching the selection Magento 2.3.4" didn't help get products displaying on the catalog page even after ensuring the checklist that one of the posts mentioned was followed. As a matter of fact, this was working fine when the migration to Magento 2.3.4 was being tested. When I click on a couple of main menu items, they display the products. Accessing products through sub-menu items is returning the error message mentioned earlier. Kindly share what you think must have been causing this scenario.I can access any product by search.


texts: Please Specify a Shipping Method error on submit order on checkout page

texts:
I have onetep checkout extension and sagepay extension installed.

1. Add product to cart...
 2. go to checkout page...
 3. select shipping method and payment method(sage pay)...
 4. Then click to 'place order' button...

It opens popup for sage pay detail. I enter sage pay test detail and click to submit, it gives error in js popup 'Please specify a shipping method'.

On file app/code/core/Mage/Sales/Model/Service/Quote.php
there is _validate() method which returns $method and $rate blank.

$method= $address->getShippingMethod();
$rate  = $address->getShippingRateByCode($method);
if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
    Mage::throwException(Mage::helper('sales')->__('Please specify a shipping method.'));
}


texts:
http://localhost/magento123/
Please enter a valid URL. Protocol is required (http://, https:// or ftp://)


texts: How can I add new custom field into customer form and then save it into database in Magento

texts:
I am using magento version 1.9.1.0, I want to add new custom field into customer form and then save this new field into database. And Again on form edit I want to back this filed on customer form.

In magento customer form(in admin panel) I want to pass a new field value as hidden field. And when I save this customer form, my new field will be save into database and on editing customer form want this new field back into form for editing purpose.

Please suggest me, I look some off the PHP file in folder /STA/app/code/core/Mage/Customer/, But I did not get the way where I add my custom PHP code to add this new field into database.

My main purpose is that I want to pass an extra field into customer form and then save this new field into database and want to back it on editing the form.


texts: Fatal error: Allowed memory size of 1258291200 bytes exhausted (tried to allocate 262144 bytes) and My site down in Magento 2.3

texts:
Fatal error: Allowed memory size of 1258291200 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/vendor/magento/module-configurable-product/Pricing/Price/Configurable Price Resolver.php on line 65 in Magento 2.3
After this error my site show page without header and foter.
I have already increase memory in .htaccess  and php.ini file.
memory_limit=1024M


texts: How can I include and use html2canvas in magento 2

texts:
I want to use this https://github.com/niklasvh/html2canvas  but getting error after including its cdn like

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-beta4/html2canvas.js" type="text/javascript" xml="space"></script>

When I use it like

download : function() {
        html2canvas($("#result-box"), {
          scale: 2,
        onrendered: function(canvas) {

             var a = document.createElement('a');
             window.open(canvas.toDataURL("image/jpg"));
             a.href = canvas.toDataURL("image/jpg").replace("image/jpg", "image/octet-stream");
             a.download = 'lash-prescription.jpg';
             a.click();

     }
        });
    }

it says

 Uncaught ReferenceError: html2canvas is not defined
    at Object.download (my.js:269)


texts:
I want to create an extension where a user can make a bulk order by uploading a csv file - this extension would be same as https://www.magentocommerce.com/magento-connect/catalog/product/view/id/30402/ I am new to magento extension.

Share the tutorial of how to extract the value of file and bring it in cart


texts: Magento 2 - Quantity Field add on Up-Sell Products Listing product details page

texts: I want to be able to add a quantity box to the products that show up in the 'Up-Sell products' list that is shown on the product detail page


texts:
I am creating a Persian Magento website and using magento C.E  1.9.2.1 but when i try to change admin back office , see it translates the word and text correctly but everything is LEFT TO RIGHT yet.

I need a back office(admin) Right To Left theme, appreciate your suggestion and help


texts: Mail Acknowledgement to admin in magento 2

texts: I have created the frontend form as a popup window which contains name and email etc.... while clicking submit the contents automatically set as a mail content and want to send a that to a customer. In admin side I need to receive the acknowledgement message. please provide me a solution


texts: compare product block display left sidebar_additional block in magento 2.3.5

texts:
how to compare products block define and call in our theme in magento 2.3.5
Now Please check our xml file

app/design/frontend/Mageplaza/simple/Magento_Theme/page_layout/2columns-left.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
 -->
 <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<update handle="1column"/>
<move element="catalog.leftnav" destination="sidebar.main" after="current"/>
<referenceContainer name="columns">
    <container name="div.sidebar.main" htmlTag="div" htmlClass="sidebar sidebar-main" after="main">
        <container name="sidebar.main" as="sidebar_main" label="Sidebar Main" before="-"/>
        <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>
    </container>
    <container name="div.sidebar.additional" htmlTag="div" htmlClass="sidebar sidebar-additional" after="div.sidebar.main">
        <container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>
    </container>
</referenceContainer>
</layout>


texts: magento fishpig get category list in homepage.phtml

texts:
As per my requirement. i need to display WordPress category list in homepage.phtml    Is it possible or not in this plugin.

If possible then please provide appropriate help.

Just for your reference homepage.phtml file path is
Path :- frontend/base/default/template/wordpress

Thanks.


texts:
I am getting this strange error while reindex, and I cannot find any solution on google or on stackoverflow.

Stock index exception: SQLSTATE[42S01]: Base table or view already
exists: 1050 Table './mydb/cataloginventory_stock_status_outdated'
already exists, query was: RENAME TABLE cataloginventory_stock_status
TO
cataloginventory_stock_status_outdated,cataloginventory_stock_status_replica
TO
cataloginventory_stock_status,cataloginventory_stock_status_outdated
TO cataloginventory_stock_status_replica

already checked in /var/lib/mysql/mydb/ and there is no cataloginventory_stock_status_outdated table
I am getting the same error for catalog_category_product_index_store1_outdated
Any help please.


texts: Magento 2, how to create a test from a custom module in the new MFTF (magento functional testing framework)

texts:
I've read the documentation that is available for the new MFTF for Magento 2, however I can't figure out how to go about creating tests that are located in a different folder other than the folders that correspond to the Magento core modules.

More specifically, right now, if I want to create a new test for myself, the only solution that I managed to come up with is to go to <magento2root>/dev/tests/acceptance/functional/Magento/FunctionalTest/ and add the various .xml files in one of the folders inside. Then I can run vendor/bin/robo generate:tests, it will generate the new tests, and I'll be able to run the tests.

My question is: How can I add those .xml files in some other folder, like <magento2root>/dev/tests/acceptance/functional/CustomCompany/FunctionalTest/CustomModule, and be able to generate the tests,so I don't have to mix up my custom code with the core Magento code? Does it have something to do with the .env file?


texts: Good and afordable Magento hosting solution for small business? Is it possible to setup on a new host with a full Cpanel backup?

texts:
Magento 1.9.1
Porto theme
currently Hostforweb.com

We were hacked (or so does the hosting company say), files deleted. I provided the hosting company 6 recent full Cpanel backups as well as seperate backups of the database but they were not able to restore our site saying files must be missing in the backup. We are down for 3 days now and all services in our VPS hosting account seem to be failing - I am unable to access webmail, I have problems in the WHM and cpanel, I get Error messages on a Magento site that was running even after the hack etc.

My friend checked and says we only currently have 4GB of memory on our VPS server (we suppose to have more) and NO swap file setup.
I opened tickets with Hostforweb for not only the main website restore but also to fix the other service's failures but all they say is:

Our senior techs are working on resolving this as soon as possible and one of them will get back to you in your ticket.

But it never happens (they take about 12 hours to put some note on the ticket and then nothing again).

I even get these warning (lots of them) by Email:

[new.horrible.net] FAILED ⛔: lfd (IP address)
[new.horrible.net] FAILED ⛔: cpanel_php_fpm (IP address)
[new.horrible.net] RECOVERED ❇: cpanellogd (IP address)
[new.horrible.net] FAILED ⛔: watchmysql (IP address)
[new.horrible.net] cPanel & WHM update failure in upcp script
[new.horrible.net] FAILED ⛔: cpanellogd (IP address)
[new.horrible.net] FAILED ⛔: lmtp (IP address)
[new.horrible.net] FAILED ⛔: ftpd (IP address)
[new.horrible.net] FAILED ⛔: dnsadmin (IP address)
[new.horrible.net] FAILED ⛔: lfd (IP address)
[new.horrible.net] FAILED ⛔: watchmysql (IP address)
[new.horrible.net] FAILED ⛔: imap (IP address)
[new.horrible.net] cPanel version change from “11.74.0.9” to “11.74.0.9” is blocked

I asked their tech on chat if they are going out of business and he replied: "Not that I am aware of, what makes you think that we are ?"

I think I need to find a new hosting company fast. I don't really have the time to look through thousands of hosting companies to find the right one. Can someone recommend a good affordable Magento hosting solution for an affordable price? I probably need it to be fully managed.

Another big question would be if it is possible to use either my full Cpanel backup from Hostforweb or the HTML files only backup plus the database backup to easily setup on the new host? Are there any hosting companies that would offer a free migration maybe?

Currently we have Magento 1.9.1. Would it be possible to somehow export products and customers and orders out of it and setup on the new Magento 2.x? I would install and configure the Porto theme on the 2.x instalation so pretty much set it up new but keep the products, orders and customer data.


texts:
For example,

http://mysite.com/magento/high-level-category/second-level-category/product-page1.html

and

http://mysite.com/magento/product-page1.html

go to the same place.

It does this for all the pages.

Duplicate URLs are bad for SEO. How do I make it so that I just get the first format of URL?

Thanks


texts:
I have Magento 2.2.x and system.log grows each minute, because of entries like:

[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Customer::customer_manage was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Customer::customer_online was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Customer::customer_group was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_AdminNotification::system_adminnotification was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Config::system_config was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Indexer::system_index was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Cms::cms_page was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Cms::cms_block was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Catalog::catalog was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Catalog::catalog_products was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Catalog::catalog_categories was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Catalog::catalog_attributes_attributes was processed [] []
[2018-09-30 17:53:15] main.INFO: Add of item with id Magento_Catalog::catalog_attributes_sets was processed [] []

How can I stop Magento logging such info?


texts: Magento 2 Error: Validate class not found from basename 'Magento\Framework\Validator\EmailAddress'

texts:
When we try to change the email in back office or when we try to place an order in frontend it's displayed the error:
Validate class not found from basename 'Magento\Framework\Validator\EmailAddress'
I have tried to follow the suggestion found in another thread but in my directories i don'have zendframework1/library. I have zendframework and in this directory, other directories zend-*.
Magento 2.3.1
Theme Claue
Php 7.2
Plesk


texts: Magento 2 customer export is giving me the error

texts:
I added one custom attribute with Yes/No option in customer grid and with that i'm unable to export the customer data, facing issue like below

  Fatal error: Uncaught Type Error: Argument 2 passed to
  Magento\Framework\View\Element\UiComponentFactory::argumentsResolver()
  must be of the type array, null given, called in
  vendor/magento/framework/View/Element/UiComponentFactory.php on line
  222 and defined in
  vendor/magento/framework/View/Element/UiComponentFactory.php:174

When i tried to debug the column data Type is taking as int if it is select my export is working fine. For this attribute i'm using backed_type as int and fronted_input as Boolean. When I changed this back end type to static it is not displaying the customers in grid and SQL error is like unknown column.

If some one faced this issue, suggest me how can we do this.


texts: billing address in checkout page out of select box

texts:
I want to show the billing address in a div not in select type box.

In billing.phtmlfile

<div class="input-box">
    <?php echo $this->getAddressesHtmlSelect('billing') ?>
</div>

This statement is creating select box and displaying the address.
Here is the code in Checkout_Block_Onepage_Abstract.php

public function getAddressesHtmlSelect($type)
{
    if ($this->isCustomerLoggedIn()) {
        $options = array();
        foreach ($this->getCustomer()->getAddresses() as $address) {
            $options[] = array(
                'value' => $address->getId(),
                'label' => $address->format('oneline')

            );

        }
        $addressId = $this->getAddress()->getCustomerAddressId();
        Mage::log($addressId,null,'address.log');
        if (empty($addressId)) {
            if ($type=='billing') {
                $address = $this->getCustomer()->getPrimaryBillingAddress();
            } else {
                $address = $this->getCustomer()->getPrimaryShippingAddress();
            }
            if ($address) {
                $addressId = $address->getId();
            }
        }

        $select = $this->getLayout()->createBlock('core/html_select')
            ->setName($type.'_address_id')
            ->setId($type.'-address-select')
            ->setClass('address-select')
            ->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
            ->setValue($addressId)
            ->setOptions($options);

        $select->addOption('', Mage::helper('checkout')->__('New Address'));

        return $select->getHtml();
    }
    return '';
}

This function is returning the address.


texts: Setup color swatches image update (update image without size selection)

texts:
is it possible to update the image on colour selection? without having to select size?

I successfully setup swatches, but the image only updates after I select size.

thanks


texts: Magento 2: Header & Footer Not Displaying in Email

texts:
In continue with

Magento 2: How to change Contact Us Email Type?

I have set my new template for Contact Us.

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

        {{trans "Name: %name" name=$data.name}}

        {{trans "Email: %email" email=$data.email}}

        {{trans "Phone Number: %telephone" telephone=$data.telephone}}

        {{trans "Comment: %comment" comment=$data.comment}}

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

When i "Preview Template" from Admin, then it's showing Header & Footer.

In the Email it's not showing. I already cleared cache & run all commands.


texts: How to add Review using REST API in magento 2.3

texts:
I am trying to find a rest api to add review. But it seems like magento doesn't provide api for that.I created custom api's to get review and rating using:

https://www.mageplaza.com/devdocs/get-review-rating-collection-magento-2.html

But I have no idea how to add review and rating using rest api. Please somebody Help.


texts: Magento 2 Can't Convert Data Convert From quote_item to order_item Table Using Field-set

texts:
Can Anyone Please Help me to data convert quote_item to order_item Table Using Field-set.

First I am Create file etc/extension_attributes.xml and use code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Checkout\Api\Data\ShippingInformationInterface">
        <attribute code="temp_id" type="decimal"/>
    </extension_attributes>
</config>

After Create Another File in etc/fieldset.xml and put code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
<scope id="global">
<fieldset id="sales_convert_quote_item">
<field name="temp_id">
<aspect name="to_sales_order_item"/>
</field>
</fieldset>
</scope>
</config>

and also created the column in both tables.


texts: Welcome emails being blocked by receivers email clients

texts: Our site is hosted by a company on a remote server. Our welcome emails used to be received fine, but as we've grown many customers are complaining about never seeing their emails. Some end up in junk/spam folders, which isn't ideal but is fine since it still gets through. But some email domains, such as comcast.net, aren't evening letting them hit the inbox. Is there anything I can do about this? Or do I need to contact our server host? Is there somewhere else I should ask about this?


texts: Magento 2 : From where (PHP) is the checkout billing address options drop down being populated?

texts:
From where is the checkout billing address options drop down being populated? How can I control the options?

EDIT:
Found
root/vendor/magento/module-checkout/view/frontend/web/js/view/billing-address.js

   var lastSelectedBillingAddress = null,
        newAddressOption = {
            /**
             * Get new address label
             * @returns {String}
             */
            getAddressInline: function () {
                return $t('New Address');
            },
            customerAddressId: null
        },
        countryData = customerData.get('directory-data'),
        addressOptions = addressList().filter(function (address) {
            return address.getType() == 'customer-address'; //eslint-disable-line eqeqeq
        });

addressList then is 'Magento_Customer/js/model/address-list'

Found the template as well root/vendor/magento/module-checkout/view/frontend/web/template/billing-address/list.html

 1)">
        <select class="select" name="billing_address_id" data-bind="
        options: addressOptions,
        optionsText: addressOptionsText,
        value: selectedAddress,
        event: {change: onAddressChange(selectedAddress())};
    "></select>

This is database information so php has to bring it.
Where in php are these values passed to knockout?


texts:
I am working on magento very custom.

Now i have created a script for the import customers. This script does more checks.
Now... into the database there are 1400 customers. My script import into magento only 370.

The error message is:

Error 503 Service Unavailable

Service Unavailable
Guru Meditation:

XID: 279928762

I think can by the max execution time.

i have insert this
ini_set('max_execution_time', 3600);
set_time_limit(3600);
but it's still the problem.

Can you help me?


texts:
I have this template.

    <form id="form1">
        <input type="text" name="text" required>
    </form>
    Calculate

I want to validate text input after clicking to the Calculate button. I tried this, but it doesn't work:

Please help me through this problem.

And if there is any extra information needed, please tell me.

Thanks in advanced!


texts: How do I make MySQL accessible to only certain specified IP addresses? I'd like to access the database through a remote server


texts: Not getting all the products after executing my query (they appear in the application)

texts:
Yesterday i tried to obtain all products from MAGENTO database. I did
  a query and i thought it was working BUT i was wrong.

I put a random SKU in the MAGENTO application, then i clicked on "search" and the product appeared but that SKU did not apprear in my query:

This is my query:

SELECT main.sku, code_brand.value AS code_brand,option_value_brand.value

FROM catalog_product_entity AS main
LEFT JOIN catalog_product_entity_int AS code_brand ON main.entity_id = code_brand.entity_id
JOIN eav_attribute_option option_brand on option_brand.attribute_id = code_brand.attribute_id and option_brand.option_id = code_brand.value
JOIN eav_attribute_option_value option_value_brand on option_brand.option_id = option_value_brand.option_id

WHERE code_brand.attribute_id = (
    SELECT attribute_id
    FROM eav_attribute
    WHERE attribute_code LIKE 'code_brand'
    AND `entity_type_id` = (
        SELECT entity_type_id
        FROM eav_entity_type
        WHERE entity_type_code = 'catalog_product'
    )
);

Whats going on here?

EDIT: What about store_id = 0 and store_id = 1?

Can please help me to obtain ALL the products?

What should i modify?

This is the MAGENTO database diagram:


texts: Magento2 : checkbox change function in knockout js

texts:
I need to add one checkbox on checkout and call one function on checkbox change event, how can I do that?

Check this screenshot for better understanding exactly what I need.


texts: Double entries appearing when adding custom attribute to orders grid

texts:
I have added a few custom columns to the sales order grid.

SKU and product name were successfully added, appearing as expected in their respective rows.

Now when I add a product attribute that doesn't come from the sales_flat_order_item table, I get double entries populating for every row for these columns.

=> For example : I add custom_attr from the catalog_product_entity_varchar table. Now all three extra columns are doubled up:

SKU: 123,123

Name: example, example

custom_attr: blue,blue

I think the problem comes from the following code in my Observer, if anyone can spot it?

    $collection = $observer->getOrderGridCollection();
    $select = $collection->getSelect();
    $select->joinLeft(array('payment' => $collection->getTable('sales/order_payment')), 'payment.parent_id=main_table.entity_id', array('payment_method' => 'method'));
    $select->join('m_sales_flat_order_item', '`m_sales_flat_order_item`.order_id=`main_table`.entity_id', array('sku' => new Zend_Db_Expr('group_concat(`m_sales_flat_order_item`.sku SEPARATOR ", ")'),'name'  => new Zend_Db_Expr('group_concat(`m_sales_flat_order_item`.name SEPARATOR ", ")') ));
    $select->join('m_catalog_product_entity_varchar', '`m_catalog_product_entity_varchar`.attribute_id=163 AND `m_catalog_product_entity_varchar`.entity_id = `m_sales_flat_order_item`.`product_id`', array('custom_attr'  => new Zend_Db_Expr('group_concat(`m_catalog_product_entity_varchar`.value SEPARATOR ",")')));
    $select->group('main_table.entity_id');

Update

Thanks to the below responses I was able to reach a solution with a bit modification. The two joins worked as below.

    $select->join('m_sales_flat_order_item','`m_sales_flat_order_item`.order_id=`main_table`.entity_id', array('sku' => new Zend_Db_Expr('`m_sales_flat_order_item`.sku'),'name'  => new Zend_Db_Expr('`m_sales_flat_order_item`.name') ))->where('`m_sales_flat_order_item`.parent_item_id IS NULL');
    $select->join(array('m_catalog_product_entity_varchar'),'(m_catalog_product_entity_varchar.entity_id = `m_sales_flat_order_item`.`product_id`) AND `m_catalog_product_entity_varchar`.attribute_id=163',
array('custom_attr' => 'm_catalog_product_entity_varchar.value'));


texts: How to get the Order date from the order id in magento 2

texts: I wish to get the order date  from order id, to display in the success page. Please provide me a solution


texts: How to hide product with 0 price in magento 2 checkout and cart minicart

texts: How to hide product with 0 price in Magento 2 checkout and cart mini cart.


texts: How can I add a image to my welcome text?

texts:
I want to add a image to my welcome text(backend: system -> design), like you can see on many modern pages(for example a telephone icon). How can I do this?

Edit: Now I'm getting a new line after I'm inserting the image:


texts:
I want to add some implementaion code in system configuration section for my custom module. How is that possible. Please help.

This is my block file

<?php

namespace Vendor\Module\Block\Adminhtml\System\Config;

use Magento\Framework\Data\Form\Element\AbstractElement;

class Implementationcode extends \Magento\Config\Block\System\Config\Form\Field
{
    /**
     * @var \Magento\Directory\Helper\Data
     */
    protected $_directoryHelper;

    /**
     * @param \Magento\Backend\Block\Template\Context $context
     * @param \Magento\Directory\Helper\Data $directoryHelper
     * @param array $data
     */
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Directory\Helper\Data $directoryHelper,
        array $data = []
    ) {
        $this->_directoryHelper = $directoryHelper;
        parent::__construct($context, $data);
    }

    /**
     * @param AbstractElement $element
     * @return string
     */
    protected function _getElementHtml(AbstractElement $element)
    {
        $html = parent::_getElementHtml($element);
        $html .= "
Code for Implementing Responsive Banner Slider
";
        return $html;
    }
}

This is my system.xml file

 <group id="slider" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="1">
                Implementaion Code
                <field id="slider" translate="label" type="hidden" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    <source_model>Vendor\Respbannerslider\Block\Adminhtml\System\Config\Implementationcode</source_model>
                </field>
            </group>


texts: why is Development in Magento 2 EE so slow?

texts:
when applying changes in the development, it takes like 15 minutes to regenerate the PUB so I can test the implemented solution.
When changing classes, we would need to regenerate the "Generation" file too

And in general, development tends to be really slow when developing in Magento 2 EE. As strange as it may sound when developing in Magento 2 CE this problem does not appear present.

Any advices on how to fix this?


texts: Magento Adminhtml grid massaction function's redirect throws user to dashboard

texts:
I have set up a custom adminhtml grid for a model of mine, which works fine. I've added a mass-delete function which allows the user to tick multiple entries and then delete them.

This function works as intended, however, as soon as a user applies a filter on the page, i.e tries to filter by a certain date AND THEN tries to use mass delete, it simply throws the user to the admin dashboard

$this->_redirect('*/*/index');

Layout handles

<adminhtml_availability_index>
    <reference name="content">
        <block type="company_module/adminhtml_availability" name="company_module_availability" />
    </reference>
    <reference name="js">
        <block type="core/template" template="module/availability-js.phtml" />
    </reference>
</adminhtml_availability_index>

Anybody have any ideas?


texts: Magento 2 displaying HOST name in sales email only

texts:
Magento 2 website Sales emails are showing hostname to customer i.e Apache.

Recently we have upgraded Magento version to 2.2.5 but initially, it was working fine before the upgrade.

Any suggestion?


texts:
When we are in checkout I can't find the location where is created the invoice from the order.
I've manage to handle my custom invoice when we save the order in the admin. Now I need to do it in the checkout.
In admin in Magento\Sales\Controller\Adminhtml\Order\Invoice\Save there is a $invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);
I'm looking for the checkout version location of this treatment.


texts: Save product observer - detect availability

texts:
I have catalog_product_save_after observer where I want detect when product became available for sale (Magento 2.2). I'm trying to compare some attributes using this code

$old = $product->getOrigData('status');
$new = $product->getData('status');

Which attribute should I use? I was trying

is_in_stock -> this is always empty
quantity_and_stock_status -> old value is an array new is integer always with value 1
status seems to work, but only after second product save. When I click save product once, new status value is always equal old value. When I click save second time (without changing anything) then status has new value.

How can I check this, maybe this is something connected with stockitem?


texts:
I am attempting to override this file

  \vendor\magento\module-checkout\view\frontend\web\js\view\form\element\email.js

First
I create a requirejs-config.js file in

  C:\wamp64\www\magento222\app\code\BodyMod\EmailHide\view\frontend\

with the following content

var config = {
    config: {
        mixins: {
            'Magento_Checkout/js/view/form/element/email': {
                'Vendor_Modul/js/email-mixin': true
            }
        }
    }
};

Second
I create an email-mixin.js file in

  C:\wamp64\www\magento222\app\code\BodyMod\EmailHide\view\frontend\web\js\

But it is not working. What am I doing wrong?


texts: M2.1.9 - How to display total ordered qty on email template?

texts:
I want to display the total ordered qty on email template. I can implement this function on Magento-1 using the following code :

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/**
 * @var $this Mage_Sales_Block_Order_Totals
 * @see Mage_Sales_Block_Order_Totals
 */
?>

        Total Qty

        <?php $_order = $this->getOrder(); //call the order
               $order_qty = floor($_order->getData('total_qty_ordered')); //get qty of all items rounded to full number (without 3.0000 or so)
            echo $order_qty;?>
            (

             <?if($order_qty >= 12){?>

                <?$mods = intval($order_qty)%12;?>
                <?php $dzn = explode('.' ,intval($order_qty)/12); ?> <?echo $dzn[0]?> Dozen <?printf("%d", $mods);?>  Pcs
                <?}else{?>
                <?echo ($order_qty*1)/12 ;?>
                <?}?>
                )

But I was trying to use $_order->getData('total_qty_ordered') under /public_html/vendor/magento/module-sales/view/frontend/templates/order/total.pthml(This is original path, I already overwrote it under my custom template folder) but it doesn't work. How can I do this.

Thank you


texts: Magento 2.2 : Syntax error or access violation: 1064 syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*'

texts:
When i search a keyword in search from in Magento 2 version it shows the following error.
Syntax error or access violation: 1064 syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*'.


texts: Magento 2. APIs. What is Content Tagging?

texts:
I'm looking here
https://devdocs.magento.com/guides/v2.0/get-started/bk-get-started-api.html

Under What can I do with the Magento web APIs?, you can find Integrate with a CMS (Content Management System). At present, content tagging is not supported.

What do they mean by content-tagging. An example will help too.
Cheers.


texts: how to show products with category filter in header search

texts:
I am trying to display category based auto suggest results in header search,

form.mini.phtml

<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
     <select id="select-category" title="Select your category" name="cat">
        <option value="0" selected>Select category</option>
        <?php
           foreach ($categoryCollection as $category) { ?>
            <option value="<?php echo $category->getId(); ?>"><?php echo $category->getName(); ?></option>
         <?php } ?>
     </select>

        <?php echo $this->__('Search:') ?>
        <input id="search" type="search" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text required-entry" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" placeholder="<?php echo $this->__('Search entire store here...') ?>" />
         <button type="submit" title="<?php echo $this->__('Search') ?>" class="button search-button"><?php echo $this->__('Search') ?></button>

</form>

In this Form, When I type in input box ajax request passed like

http://127.0.0.1/site/catalogsearch/ajax/suggest/?q=bla

but selected cat value not include in this url, How can I include Cat="bla" in ajax/suggest url like  http://127.0.0.1/site/catalogsearch/ajax/suggest/?q=bla&cat=bla


texts: Magento 2 - How to resize image using image's url?

texts:
How is the right way of resizing images in Magento 2.
$image->getData('url');

I have the url of the image, how to resize it using the url? Is there an API / helper that does that?


texts:
I have create a custom module that is overriding catalog sales rule module.

I have add some banner and text on those products which are in the sale.
Now I  am confused that what happens when sales get expired? I actually want that when sale expires the banners and text should not be displayed on the product page.

If anyone has worked on catalog sales rule please let me know. Thanks


texts:
So i have a slightly big problem and would need a solution fast for my website.

Only the order confirmation/invoice confirmation etc etc mails are not being sent! All the other mails (including order update mails) are working.

Things that i already have done :

checked together with my host if the cron jobs are running
disabling all external modules and even uninstalling some
going to developer mode and back , redeploying static files
checking for log files etc (no errors)

It seems like for some reason magento 2 says 'mail sent' but doesn't queue it or anything. I dunno.

Anyone an idea? I know its not a lot of information to go on but thats all related i can give because all the other things i did or mentioned didn't return any information.

Please help!


texts: Why? Can't call custom file phtml to list.phtml?

texts:
In controller

....
      $this->_initAction();
//        $this->loadLayout();
        $update = $this->getLayout()->getUpdate();
        $update->addHandle('default');
        $this->addActionLayoutHandles();
        $update ->removeHandle('shopbybrand_index_view')
                ->addHandle('catalog_category_default')
                ->addHandle('catalog_category_view')
                ->addHandle('catalog_category_layered')

                ->addHandle('shopbybrand_index_view');
        $this->loadLayoutUpdates();
        $this->generateLayoutXml();
        $this->generateLayoutBlocks();
        $this->_isLayoutLoaded = true;
....

in list.phtml:

   <?php
$block = Mage::app()->getLayout()->createBlock('shopbybrand/productinfo')->setTemplate('shopbybrand/namebrand.phtml')->toHtml();
echo $block;
?>

But nothing show, same code in view.phtml, block shows fine!!

+/

    Getproduct in productinfo.php

        public function getProduct(){
                 $product = Mage::registry('current_product');
                return $product;
            }


texts:
A lot of my Web API interfaces use DateTime return types or parameters as follows.

interface TestInterface
{
    /**
     * @param \DateTime $value
     * @return void
     */
    public function setDate(\DateTime $value);

    /**
     * Gets the current date.
     *
     * @return \DateTime
     */
    public function getDate() : \DateTime;
}

When trying to request Web API end-point which has TestInterface[] as return type. I get the following error in Magento 2.

  Each getter must have a doc block. See DateTime::format()

So I assume there is no DateTime-Formatter in Magento 2. I took a look into DataObjectProcessor.php and the ServiceOutputProcessor.php assuming it would be an option to provide a custom formatter when an Object is of type \DateTime.

Any suggestions or solution to this problem? Best would be if my DateTime ojects would end up being ISO8601 serialized as in JSON standard.


texts: Magento 2.1 : How can I use a uiComponent in my custom modules' modal (adminhtml)

texts: I'm creating a module, and part of this module is that it adds a modal (slide-out) on the product edit page in the adminhtml. I've got it so far working that the modal shows, but now I'm faced with the next challenge: get a grid of my custom entity to show in this modal. (you know, just like when you want to set the related products, you get a slide panel that allows you to select entities). How can I make this? Can anyone point me in the right direction? I'm currently looking at uiComponents, but Magento 2.1's documentation isn't quite complete yet.


texts: How to add complex query in magento 2 collection?

texts:
I have a query something like this
SELECT * FROM `zip_codes`
WHERE
(`code` = '123456' OR ('123456' BETWEEN `from` AND `to`))
AND
(`use_label` = 1)

can someone please tell how we add this condition to the collection ?


texts: Magento 2: Set order history page as default after login

texts:
I am trying to set the order history page as the default page when the customer is logged in.

When the customer login is successful, it redirects to customer/account/

Instead of this can we direct to sales/order/history/

So when the customer login happens, he can see order history page instead of the dashboard page.

Is something like that can be achieved? Can anyone help me on this issue, please?

Thanks


texts: How to run a update query in Magento Observer in 1.9.1

texts:
public function placeOrderAfter($evt)
    {
        $order = $evt->getOrder();
        $quote = $evt->getQuote();

        $quote_id = $quote->getId();
        $order_id = $order->getId();

        $collection = Mage::getModel('scancheck/file')->getCollection();
        $collection->addFieldToFilter('quote_id',$quote_id);

        Mage::log('Observer Place Order After Quote ID:' . $quote_id);

        foreach($collection as $object){
            Mage::getModel('scancheck/order')->saveFile($order_id,$object->getFilename(),$object->getType());
            $object->delete();
        }
    // I want to run an update query here

}


texts: Is there a CometD messaging event extension for Magento?

texts:
I've been looking for a CometD messaging event extension for Magento which publishes events when records change, but had no luck finding anything.
I've found a Webhook extension, but would prefer to subscribe to messages/events rather than process webhook HTTP POST's.
Is there anything like this out there?
If not, are there any internal Magento events I could build on top of to achieve this?


texts: Magento 1.9 - how to determine if customer already used discount code

texts:
How Magento know if the customer already used coupon code (unregistered customer).
Is Magento checking customer's IP or some other specific data?


texts:
$from='HKD';
    $to='USD';
    $price=10;
    $newPrice = Mage::helper('directory')->currencyConvert($price, $from, $to);
    echo $newPrice;

I use this code but it not work for me it gives error

  Fatal error: Call to a member function getCode() on string in
  /home4/proddev/public_html/app/code/core/Mage/Directory/Model/Currency.php
  on line 194


texts: Turn on template paths using command line

texts:
Is there any command to turn off/on the template path hints?
Now that most of the things are controlled by command line, it would be nice to have command to turn on/off the hints :)


texts: How to extend core templates in Magento 2

texts:
How to extend vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml so I can add another button to it?

I tried it by creating my own module and copied the above file to app/code/"vendorname"/"modulename"/view/frontend/templates/form.phtml and created an xml file app/code/"vendorname"/"modulename"/view/frontend/layout/checkout_cart_index.xml that has the following content:

               <referenceBlock name="checkout.cart">
                    <action method="setTemplate">

                         <argument name="template" xsi:type="string">Rampart_Core::form.phtml</argument>

                    </action>
               </referenceBlock>

But it override the cart page and display only a portion of the original-cart page whereas I want to add button to existing cart page.