texts: Issue with script for updating products programmatically

texts:
I have the following csv from which I get the info to update products programmatically:

name1;sku1;description1;shortdescription1
name2;sku2;description2;shortdescription2
name3;sku3;description3;shortdescription3
name4;sku4;description4;shortdescription4
name5;sku5;description5;shortdescription5
name6;sku6;description6;shortdescription6

How this works?

Magento will look first in the catalog collection (in the store view with ID 1) for the products matching the name name1, name2, ...., name6.

The product with name name1, will be assigned the sku sku1, the description description1 and the short description shortdescription1; the same will happen for the products name2, name3, ...., name6. These changes will take effect in the store view with ID 2.

For some reason the script is still not working as intended. The code is as follows:

<?php

    require_once ('abstract.php');
    require_once 'Mage.php';
    umask(0) ;

    function importData($file, $store_id) {
        Mage::app();
        $handle = fopen($file, "r");
        while ($row = fgetcsv($handle, 0, ";")) {
        Mage::getModel('core/store')->load($store_id);
        $storeId='1';
        Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
        $productIds[] = $row[0];

        $products = Mage::getModel('catalog/product')->getCollection();
        $products->addStoreFilter();
        $products->addAttributeToSelect('*');
        $products->addAttributeToFilter('entity_id', array('in' => $productIds));
        foreach($products as $product)
            {
                $price = $product->setSku($row[1])->setDescription($row[2])->setShortDescription($row[3]);
                Mage::app()->setCurrentStore(2);
                $product->save();
            }

        }
        fclose($handle);
    }

    importData("test.csv", 3);

?>

I think the issue has to do with the definition of $productIds but I cannot manage to solve it.

Do you have any ideas or recommendations? Thanks


texts:
I used Magento 2 add Sort By Best Sellers Option on category products litsing page and Magento 2 Sort by New Products and Most View Product for sorting options. now I want to add price (high to low) and remove name (default option) and direction switcher. Could anyone help me please?

here is my code :

Company\Module\Model\Config

class Config extends \Magento\Catalog\Model\Config
{
    public function getAttributeUsedForSortByArray()
    {
       $options = ['mostviewed' => __('Most Viewed'), 'newest' => __('Newest'), 'bestseller' => __('Best Seller'), 'price' => __('Price - Low To Highا');
        foreach ($this->getAttributesUsedForSortBy() as $attribute) {
            /* @var $attribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */
            $options[$attribute->getAttributeCode()] = $attribute->getStoreLabel();
        }

       return $options;
    }
}

Company\Module\Block\Product\ProductList\Toolbar

class Toolbar extends \Magento\Catalog\Block\Product\ProductList\Toolbar
    {
        public function setCollection($collection)
        {
            if($this->getCurrentOrder()=="bestseller")
            {
                  $collection->getSelect()->joinLeft(
                    'sales_order_item',
                    'e.entity_id = sales_order_item.product_id',
                    array('qty_ordered'=>'SUM(sales_order_item.qty_ordered)'))
                    ->group('e.entity_id')
                    ->order('qty_ordered '.$this->getCurrentDirectionReverse());
            }
            if($this->getCurrentOrder() == "newest")
            {
                $collection->getSelect()
                    ->order('created_at ' . $this->getCurrentDirectionReverse());
            }
            if($this->getCurrentOrder() == "mostviewed")
            {
                $collection->getSelect()->joinLeft(
                    'report_event',
                    'e.entity_id = report_event.object_id',
                    array('view_count' => 'COUNT(report_event.event_id)'))
                    ->group('e.entity_id')
                    ->order('view_count ' . $this->getCurrentDirectionReverse());
            }

            $this->_collection = $collection;

            $this->_collection->setCurPage($this->getCurrentPage());

            $limit = (int)$this->getLimit();
            if ($limit) {
                $this->_collection->setPageSize($limit);
            }
            if ($this->getCurrentOrder()) {
                $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
            }
            return $this;
        }

        public function getCurrentDirectionReverse() {
                if ($this->getCurrentDirection() == 'asc') {
                    return 'desc';
                } elseif ($this->getCurrentDirection() == 'desc') {
                    return 'asc';
                } else {
                    return $this->getCurrentDirection();
                }
            }

    }


texts: Magento 2: How to retrieve a random product from a random category?

texts:
Magento 2.2, developing a custom theme whose parent is Magento/blank.

I intend to create a module which generates a random discount weekly.

Firstly, I must retrieve a random product from a particular sub-category. This data will be utilised on the backend. I must then store its information for a week.

For now, though, I'm only looking for a way to create a model from the information.

There are various answers for Magento 1.x, utilising the rand() function, but I haven't discovered any clear description for Magento 2.

Here is the class, based on Thiago's answer:

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Magento\Framework\Console\Cli;

class CreateDiscount extends Command{

    protected $_productCollectionFactory;
    protected $_categoryFactory;

    public function __construct(
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        \Magento\Catalog\Model\CategoryFactory $categoryFactory,
        \Magento\Framework\View\Element\Template\Context $context
    ) {
        $this->_categoryFactory = $categoryFactory;
        $this->_productCollectionFactory = $productCollectionFactory;
        parent::__construct($context);
    }

    /**
     * @var $categoryId
     */
    public function getRandomCategoryId() {
        $categoryId = rand(2, 4);
        settype($categoryId, "string");
        return $categoryId;
    }

    /**
     * @param int $categoryId
     */
    public function getRandomProduct($categoryId)
    {
        $products = $this->productRepository->getList($this->getProductSearchCriteria($categoryId));
        $randomId = array_rand($products->getItems(), 1);
        $productItems = $products->getItems();
        return $productItems[$randomId];
    }

    /**
     * @param $categoryId
     * @return \Magento\Framework\Api\SearchCriteria
     */
    private function getProductSearchCriteria($categoryId)
    {
        $searchCriteria = $this->searchCriteriaBuilder
            ->addFilter('category_id', $categoryId)
            ->create();
        return $searchCriteria;
    }

    public function randomProduct()
    {
        // Find a random product
        $product = $this->getRandomProduct($this->getRandomCategoryId());
        $sku = $product->getSku();
    }
}


texts: Magento2 - when customer Sign Out then error occurred: "No such entity with id = 0"

texts:
After data migration process I fetched one problem. Problem is when customer Sign Out from the account then this error occurred,

  No such entity with id = 0

When I refresh the page again then customer Sign Out but I see that customer is logged in.

Does anyone have a solution for this?


texts:
I need to sort a collection based on "sort_order" field instead of "id" as shown in the image.

$collection=Mage::getResourceModel('banners/manage_collection');
$collection->getSelect()->order('sort_order','DESC');

And

I have tried this but its always returns collection based on id field.


texts: Getting Package Qty on Shipping Methods template (answered)

texts:
I want to get the number of "shippable" products in the quote/basket on the template file checkout/onepage/shipping_method/available.phtml. The aim is to tell the customer at that point how many more products they would need to buy to qualify for free shipping.

When building shipping method modules, you can get this with $request->getPackageQty();

For example, if you have 3 books, 2 T-shirts and 1 virtual product in your basket, getPackageQty will return 5, not 6.

On checkout/onepage/shipping_method/available.phtml, I've tried the following:

$quote = $this->getQuote();
// AND/OR
$quote = Mage::getSingleton('checkout/session')->getQuote();

$packageQty = $quote->getPackageQty();

Neither is working. I'm working a bit blind here, can anyone help me out?

Thanks


texts: I am looking for a table in the database where the Abandoned Carts are saved, but I cannot find the correct place. Where are the Abandoned Carts saved in the database? Or are they saved in a different matter (for example by combining data)?


texts: Magento search return only products containing both words

texts:
If a customer searches for "black dress" my current search results includes products with word "black" OR "dress" OR "black dress".

How can I only show products that have both words: "black" AND "dress"?

I tried to change the search type: like, fulltext, combine. Neither worked.

Thanks!


texts: I need to create a form in system.xml having username and password field on submitting it should need to append one more field license key is that possible?


texts: Magento2 - Ordered Products Report sorting columns

texts:
Magento Admin > Reports > Products > Ordered
I have created new columns(SKU) using the help of these two links in the report grid.

Magento 2 ordered product report

HOW TO ADD COLUMN TO 'Order Total Report' GRID and display custom customer data to new column in magento 2?

app/code/Mymodule/Orderedproductsreport/view/adminhtml/layout/reports_report_product_sold_grid.xml

<referenceBlock name="adminhtml.report.grid.columnSet">
    <arguments>
        <argument name="id" xsi:type="string">report_product_sold</argument>
        <argument name="count_totals" xsi:type="string">1</argument>
    </arguments>
    <block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.report.grid.columnSet.sku" as="sku">
        <arguments>
            <argument name="header" xsi:type="string" translate="true">SKU-*1</argument>
            <argument name="sortable" xsi:type="string">1</argument>
            <argument name="type" xsi:type="string">text</argument>
            <argument name="index" xsi:type="string">order_items_sku</argument>
            <argument name="id" xsi:type="string">sku</argument>
            <argument name="column_css_class" xsi:type="string">col-sku</argument>
            <argument name="header_css_class" xsi:type="string">col-sku</argument>
        </arguments>
    </block>
    <block class="Magento\Backend\Block\Widget\Grid\Column" as="name">
        <arguments>
            <argument name="header" xsi:type="string" translate="true">Product-1</argument>
            <argument name="sortable" xsi:type="string">5</argument>
            <argument name="type" xsi:type="string">text</argument>
            <argument name="index" xsi:type="string">order_items_name</argument>
            <argument name="id" xsi:type="string">name</argument>
            <argument name="column_css_class" xsi:type="string">col-product</argument>
            <argument name="header_css_class" xsi:type="string">col-product</argument>
        </arguments>
    </block>
    <block class="Magento\Backend\Block\Widget\Grid\Column" as="ordered_qty">
        <arguments>
            <argument name="header" xsi:type="string" translate="true">Ordered Quantity-1</argument>
            <argument name="sortable" xsi:type="string">10</argument>
            <argument name="total" xsi:type="string">sum</argument>
            <argument name="type" xsi:type="string">number</argument>
            <argument name="index" xsi:type="string">ordered_qty</argument>
            <argument name="id" xsi:type="string">ordered_qty</argument>
            <argument name="column_css_class" xsi:type="string">col-qty</argument>
            <argument name="header_css_class" xsi:type="string">col-qty</argument>
        </arguments>
    </block>
</referenceBlock>

Product, Ordered Quantity these two columns are calling from core file while SKU is calling from my custom module file.

SKU column is showing after Product, Ordered Quantity column.

How can I move SKU before Product column?

Any help will be appreciated.


texts: What's the best Magento version for PHP Version 5.2.17

texts: My current hosting have PHP version 5.2.17 and MySQL version 5.6.26, It's shared hosting and I can not upgrade to the PHP 5.6, So .. What is the best "stable" version of Magento CE can I work on?


texts: Transform root folder script in module more Magento2 "friendly"

texts:
I'm trying to adapt some scripts I created (fully functional but not very Magento2) into modules but after many hours of reading, still don't really understand how it works.
For exemple, this scripts called "delete.php" retrieve all configurable/simple associated which are out of stock, convert and download in a csv so I can use the import process (behavior delete) to remove all old products.

<?php

ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
error_reporting(E_ALL);
ini_set('display_errors', '1');

use Magento\Framework\App\Bootstrap;
include('../../app/bootstrap.php');

$params =  $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);

$obj = $bootstrap->getObjectManager();

$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');

$productCollection = $obj->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
$collection = $productCollection
            ->addAttributeToSelect('*')
            ->setPageSize(500) //Selecting 500 products for TEST
            ->load();
echo "sku" . ';' . "name" . ';' . "mgs_brand" . ';' . "urbmag_season" . "\n";
foreach($collection as $product){

    $productType = $product->getTypeId(); // look if CONFIGURABLE

    if ($productType == "configurable" AND !$product->isAvailable()) { // CONF + OUT OF STOCK
    $productSku = $product->getSku();
    $productName = $product->getName();
    $productBrand = $product->getAttributeText('mgs_brand'); //brand attribute for filter in csv
    $productSeason = $product->getAttributeText('urbmag_season'); // season attribute for filter in csv
        echo $productSku.';'.$productName.';'.$productBrand.';'.$productSeason."\n";

        $children = $product->getTypeInstance()->getUsedProducts($product); // simple associated
        foreach ($children as $child) {
      $childSku = $child->getSku();
      $childName = $child->getName();
            echo $childSku.';'.$childName.';'.$productBrand.';'.$productSeason."\n";
        }
    }
}

chdir('convert_csv');
if( file_exists ('delete.csv'))
     unlink('delete.csv') ;

//*****************  DOWNLOAD CSV        ***********************
$fp = fopen('delete.csv', 'w+');
fclose($fp);

header("Content-type: text/csv");
header("Content-disposition: attachment; filename = delete.csv");
readfile("delete.csv");

I follow all the tutorials I found, like How to create a basic module in Magento 2 but I can't adapt this for my needs.
Idea here is to call an url that execute my function. Would someone have the kindness and patience to explain to me step by step how to make my module ?


texts: Can't get Info Text (supports HTML) to display at checkout?

texts:
I'm using Magento ver. 1.9.2.2 and have created a Flat Rate 2 shipping method which is an International Shipping function. The checkout selects this if the buyer is in one of the five countries listed in the Info Text (supports HTML) section. That Info Text however does not show up anywhere the shipping options are listed at checkout. Is this magento core or template specific? Would I have to add some code to display the Info Text (supports HTML) text or should magento be displaying this by default?

Admin Dashboard

Front end store view. One page checkout

Thanks


texts: Magento 2 not work when move source code to other PC

texts:
I'm install a new project with magento 2 (M2), and use sample data of M2.
This installation is success on my laptop, and M2 works fine.

After that, I compress source code of my project, then copy to another PC. This PC is installed the same environment with my laptop - (XAMPP), even using the same port

But, it does not work on the PC. I try to clean caching but many javascript/ css/ image files still cannot load.

When, i run this command: php bin\magento setup:static-content:deploy it works normally.

I really want to know what's happen in this case to get more knowledge about M2?

Please explain for me! Thank you!


texts: After redirect to Paypal from site discount amount is not deducted

texts:
I have discount on my site, and its apply correct on my Magento 1.9.0.1, but when we redirect to PayPal, its not deduct discount amount, its show all amount without discount.
Please suggest some solution.


texts: How to check if a module is enabled or not inside a block in Magento 2

texts:
I have a block in an XML file, and I want to hide it if a specific module doesn't enable (for example Mymodule2), how can I do it please, is there an attribute should I add it or not

<block ifconfig="zendesk/ticket/backend/order_view"
                       class="Vendor\Mymodule\Block\Adminhtml\Order\View\Tab\Info"
                       name="some_name"
                       aclResource="Vendor_Mymodule:myresource"/>


texts:
What are the differences between grouped products and bundle products?

What is a typical case for using each type?


texts: Magento2 : Which Magento Event for Update cart quantity only?

texts:
I have work on the task in which I need to handle quote item,
here I have use two event

  checkout_cart_add_product_complete

  checkout_cart_update_item_complete

here it work fine,
But when I have change Quantity directly in mini cart then my Logic was not work.
For this I am find some event which work for me.
If You have any solution this Pleas Provide Me

my code is

<event name="checkout_cart_add_product_complete">
    <observer name="customprice" instance="Ns\Module\Observer\CustomPrice" />
</event>
<event name="checkout_cart_update_item_complete">
    <observer name="custompriceupdate" instance="Ns\Module\Observer\CustomPrice" />
</event>
<event name="sales_quote_item_qty_set_after">
    <observer name="custompriceupdateqty" instance="Ns\Module\Observer\CustomPrice" />
</event>

and observer is

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $cart = $this->cart;
    $quote = $cart->getQuote();
    $items = $cart->getQuote()->getAllItems();
    $basetotal = 0;
    foreach ($items as $itemforprice) {
        $total = $this->processItem($itemforprice);
        $basetotal += $total;
    }

    $quote->setSubtotal($basetotal);
    $quote->setGrandTotal($basetotal);
    $quote->setBaseSubtotal($basetotal);
    $quote->setBaseGrandTotal($basetotal);
    $quote->setSubtotalWithDiscount($basetotal);
    $quote->setBaseSubtotalWithDiscount($basetotal);
    $quote->save();
}

private function processItem($itemforprice)
{
    $myprice = 100;
    $total = $myprice * $qty;

    $itemforprice->setCustomPrice($myprice);
    $itemforprice->setOriginalCustomPrice($myprice);
    $itemforprice->setBasePrice($myprice);
    $itemforprice->setPrice($myprice);

    $itemforprice->setRowTotal($total);
    $itemforprice->setBaseRowTotal($total);
    $itemforprice->setRowTotalInclTax($total);
    $itemforprice->setBaseRowTotalInclTax($total);

    $itemforprice->save();

    return $total;
}


texts:
I am using magento 1.9.

I want to get the quote details of guest in the shipping method step. I tried using this code

  Mage::getModel('checkout/session')->getQuote()->getData();

But, It returns null on the first time of checkout. But returns data after refresh the page.


texts:
I have a bpmn tool, it will generate CSV, that CSV contains single product. I need to import that csv file programatically. Already magento admin have that feature.

please can anyone point key code to trigger that import module from cron Job?


texts: Magento 2.3.5 - Display block on product page only if product got related products

texts:
On our productpage we want to display a block, only if that product got related products.
How can I check in M2 if the product got related products?


texts:
I am a new magento user. I have facing some problems. I installed a new theme in my store. I have remove the theme by removing the theme files. But after that, I have noticed that, my home page is empty. I found that, the home page goes under "home" folder. Means that, now showing the home page in www.example.com/home link.
Please how to solve this problem?


texts: Magento 2 - Email notifications have server path as 'from' email

texts: When receiving email notifications from our Magento 2 site (order confirmations etc), the 'From' email header field includes the server path, as opposed to the Sales Representatives details.  The means that in some instances the email is being seen as junk.  So for example cpanelusername@servername.  Any help would be much appreciated.


texts: rest api magento 2 get attribute code by attribute id

texts:
I need to get the attribute code by attribute id with rest api.
This is needed for configurable product.
I get the configurable product data:
  "extension_attributes": {
        "website_ids": [
            1
        ],
        "configurable_product_options": [
            {
                "id": 2568,
                "attribute_id": "253",
                "label": "Size",
                "position": 0,
                "values": [
                    {
                        "value_index": 1847
                    },
                    {
                        "value_index": 1844
                    },
                    {
                        "value_index": 1845
                    }
                ],
                "product_id": 25539
            }
        ],
        "configurable_product_links": [
            25540,
            25541,
            25542
        ]
    },

The 'configurable_product_options' has no attribute_code, I need it to find the value of the value_index which is the option id.
How to get the attribute_code?


texts: Am trying to import mysqldump but getting error "#1293 - Incorrect table definition; there can be only one TIMESTAMP

texts: How can i fix in order to have a smooth import to phpmyadmin on cpanel... I am getting error #1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause


texts: How to add google reCaptcha on the checkout page Magento 2

texts: I want to add Google reCaptcha on the Checkout page.Is there any way to add google reCaptcha add on the checkout page?


texts: Magento 2.4.2, child theme of Blank - Front end. How do you remove properties in parent Blank theme styles, for example footer border?

texts:
The file I use to override these styles: app/design/frontend/Vendor/ChildTheme/web/css/source/_module.less as per M2 documentation.
I tracked that it applies my modified styles, but then goes and puts the original on top, overriding my customisation.
Simple solution might be setting border: 0; but that's not what I want to achieve here. I need that rule removed.

To track it I added properties content: "Theme" and content: "Vendor" indicators. As you can see, the one from theme has border rule removed, but it gets overridden by rules from vendor.


texts:
I have installed the above version of Magento 2 (no sample data) onto my 1an1 hosting site. No errors on installation however, the stylesheets are not loading. I've tried a few suggestions to fix via here and the magento forum but most if not all answers use terminal console or similar for the fixes for which I do not have access to.

When I look in the pub/static folder there are no css files. I'm not sure if this is a rewrite issue or not. pub folder has been set with file permissions 777 via filezilla ftp.

I did not use the composer as I am really not sure how to use this under a hosted site.

I am also getting an Internal Server error 500 when trying to access the admin area

Do I need to copy the css files to the static folder or elsewhere ?

This lack of css etc seems to be a common problem with the installation but I have NO idea how to fix this on 1and1. Any help would be appreciated however please keep it simple for me please.

Versions : PHP 7.2 SQL 5.7

Kind Regards Kate


texts:
I have added a custom field in Quote item table. I have been able to populate this field and can see data in it. However, during conversion from Quote to Order I am trying to retrieve value of this field for current item. I am doing this in Observer. Added an observer event sales_convert_quote_item_to_order_item and code for getting field value is like this:

$quoteItem = $observer->getItem();

$customFieldData = $quoteItem->getCustomFieldData();

This is not working. It seems that $observer->getItem() returns model Mage_Sales_Model_Quote_Address_Item, so my custom field is not present in this model.


texts: CE 1.8.1 display taxes differently per customer group

texts:
And next question popping up.

In our store we have a sales tax rule of 19%, we have two customer groups, B2C and B2B. The former shall see the prices only including taxes (law in Germany), while the B2B customers have a special interest in seeing the prices excluding taxes.

The calculation of the tax is the same for both, in fact it is the same tax, I just need to set the display taxes setting separetely for each customer group. But I only find general settings in system->configure->sales->taxes-> for displaying taxes for products and cart

Is there a way to configure this cleanly or do I have to use workarounds with tax rules or template rewrites?


texts: I would like to exchange data and / or call methods of another UI component. How can I access another UI component in Magento 2 knockout JS ?


texts: How do I disable/remove the State field in Magento2

texts:
Under Stores->Configuration->General->State Options

I unselect Switzerland. Then on the checkout page, the * for required field is not there anymore but the red message "Please select an option." still appears when I try to place an order without selecting a State.

"Allow to Choose State if It is Optional for Country" set to No and the field still shows up.

Any idea?

By the way, it seems that at least one Country must be selected in the "State is Required for" list.


texts:
How to perform reorder in Magento 2 REST api.

I am passing 2 parameters in my function customerId and orderId. Based on orderId I can get all the items of the product with options.


texts:
newbie here. We did setup a multistore in magento, look this way: a main store contains 2 child stores.

mainstore.mydomain.com
store1.mydomain.com
store2.mydomain.com

now the weird part: I run through the products, everything is fine produt1 belongs to store 1 and I see it only there, which is exactly what I need. The problem is if I order it, then in the cart the product url doesn't point to the store 1 but to the mainstore, which I don't want. How do I make it point to his own store?

Thanks a lot


texts: Element 'script': Character content is not allowed, because the content type is empty. Line:xxx

texts:
I am running my custom plugin in Magento 2.2.2 fresh install.

I have customised Magento search page. When I hit search page then below error comes.

It's working perfectly in Magento 2.1 and 2.2.0 but not working in Magento 2.2.2.

Below is the code which I am using.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="Vendor_ModuleName::js/timer.js" type="text/javascript"></script>
    </head>
    <body>
        <referenceBlock name="search_result_list" template="Vendor_ModuleName::product/list.phtml">
        </referenceBlock>
    </body>
</page>


texts: Magento2: How to get product collection by parent-category-id and sub-category-id?

texts:
How to get product by  parent-category-id and  sub-category-id?

Magento 2.0


texts:
I have a magento 2 store but am having issues with language characters in the checkout page state drop-down option. See screenshot for the issue

My php.ini already set with  default_charset  UTF-8
What could be the issue?


texts:
I have created new module and create a cron file for it.
I have set cron in system and it is working properly, but my problem is I want to run only my cron file not all.

Code:

* * * * * /usr/bin/php  /var/www/html/magento-td/bin/magento cron:run | grep -v "Ran jobs by schedule" >> var/www/html/magento-td/var/log/magento.cron.log
* * * * * /usr/bin/php  /var/www/html/magento-td/update/cron.php >> var/www/html/magento-td/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/html/magento-td/bin/magento setup:cron:run >> var/www/html/magento-td/var/log/setup.cron.log


texts: What is the exact use of 'sales_sequence_meta' table in magento 2?

texts: Do I need to make an entry for each and every store into the table 'sales_sequence_meta' to get the order placed?


texts:
I've been looking for a solution on how to get total ordered products weight displayed upon checkout on the frontend, in the notification email, sent to admin and in the invoice.

I would appreciate very much if you can give me some hints.


texts: Problems with PHP version after upgrade to 1.9.1

texts:
I have 2 separate installations of Magento in different sub-domains on the same host.

The first one, my development store where I test upgrades, try out new add-ons etc. upgraded from 1.8.1 to 1.9.1 just fine (I used the upgrade in Magento Connect) apart from a couple of minor colour issues in a 3rd party template which were easily fixed.

I have just tried to upgrade the live store using exactly the same method and it crashed out part way through (got a cache flushing error in the Magento Connect console) and now I am getting an invalid PHP version error (says I need PHP 5.3.0 or newer). I have run phpinfo and I am getting 5.2.6 as the installed version.

This makes no sense at all, as the test store is running just fine with 5.2.6.

Anyone have any ideas?


texts: Magento FPC EE 1.14: Flush single block from observer / helper

texts:
I have custom Magento Block (Featured Products) on HomePage. I'm also using FPC (+ Cm_Redis). I've made HolePunch to be independent from other parts of App.

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <placeholders>
        <company_home_page_featured_products>
            <block>package/package_product_list_simple</block>
            <placeholder>CMP_HOME_PAGE_FEATURED_PRODUCTS</placeholder>
            <container>Company_Package_Model_Container_Package_Product_List_Simple</container>
            <cache_lifetime>86400</cache_lifetime>
        </company_home_page_featured_products>
    </placeholders>
</config>

The problem is that some products can change using API, other from Backend and I'd like to be able to refresh (flush) this block from Observer or just in Helper.

Could you help me how to perform this cache flush? I tried

Enterprise_PageCache_Model_cache::getCacheInstance()->remove('CMP_HOME_PAGE_FEATURED_PRODUCTS');

... but without success.


texts: Cron Job has not been configured yet error on setup

texts:
Every time when I need to install anything (Module). I see this readiness check process and I see that the check returns an error.
I exchanged. setup_cronjob_status with this

All problems are fixed but this problem still I can't fix this


texts: attribute values are displaying in frontend only from store view

texts:
i needed to convert an dropdown attribute to multi select attribute.

so i followed this link : http://swarminglabs.com/how-to-change-a-product-dropdown-attribute-to-a-multi-select/

Than i got this problem & solution here :

Attributes did't selected in backend after changed from dropdown to multi-select

after this , i can able to get the attributes in frontend only when we select our store view of site.

but i want this to work for when we select "Default values" also.


texts: Magento 2 How to pass variable from Controller to Observer on checkout_cart_product_add_after event

texts:
I'm trying to send a $price variable from a controller where I add to cart my product to checkout_cart_product_add_after event observer.
Here is my Controller:
public function execute(){
        $request = $this->getRequest()->getPostValue();
        $product_id = $request['product_id'];
        $params = array(
            'formKey' => $this->formKey,
            'product_id' => $product_id,
            'qty' => 1
        );

        $productFactory = $this->product->create();
        try{
            $product = $productFactory->load($product_id);
            $this->cart->addProduct($product,$params);
            $this->cart->save();
        }
        catch(\Exception $e){
            return $request;
        }
    }

Here is my Observer
 public function execute(\Magento\Framework\Event\Observer $observer){
        $item = $observer->getEvent()->getData('quote_item');
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
        $price = 44; //I wan't to get this from Controller
        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);
        $item->getProduct()->setIsSuperMode(true);
    }

So basically I just wan't to pass from Controller a param to Observer, the $price.
Creating a variable session seems too much trouble considering that hundreds of customers will use the ecommerce at the same time. Maybe a cookie?
Thanks and greetings!
UPDATE
I have tried this on controller:
             foreach($items as $item) {
                $this->eventManager->dispatch(
                    'checkout_cart_product_add_after',
                    ['quote_item' => $item, 'price' => 50]
                );
              }

And this on Observer
$price = $observer->getEvent()->getData('price');

But it's not working


texts: Order "Send Mail" Button not working properly Magento 2

texts:
When I press the Send Email Button from order, it sometimes does not give any response, but by clicking multiple times it works.

Any suggestions what might be the cause of this? Or which files to search for this issue.


texts: Magento 2 - bin/magento Commands not working in Cpanel Terminal

texts:
I have an issue while try to run commands bin/magento in terminal. Commands not working. No command run after bin directory. You can see the below screenshot about the error.

Basically yesterday I installed Mailchimp extension using SSH Putty (login as root user). Now I can't run commands in terminal.

Need help.


texts: Error during unserialization in Order/Payment.php: Mage_Core_Helper_UnserializeArray->unserialize('NULL\n')

texts:
Getting error on exception log,How to fix this?

Using: Magento ver. 1.9.3.1

exception 'Exception' with message 'Error during unserialization' in /home/testing/public_html/lib/Unserialize/Parser.php:60
Stack trace:
#0 /home/testing/public_html/app/code/core/Mage/Core/Helper/UnserializeArray.php(44): Unserialize_Parser->unserialize('NULL\n')
#1 /home/testing/public_html/app/code/core/Mage/Sales/Model/Resource/Order/Payment.php(78): Mage_Core_Helper_UnserializeArray->unserialize('NULL\n')
#2 /home/testing/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(550): Mage_Sales_Model_Resource_Order_Payment->_unserializeField(Object(Mage_Sales_Model_Order_Payment), 'additional_info...', Array)
#3 /home/testing/public_html/app/code/core/Mage/Sales/Model/Resource/Order/Payment/Collection.php(68): Mage_Core_Model_Resource_Db_Abstract->unserializeFields(Object(Mage_Sales_Model_Order_Payment))
#4 /home/testing/public_html/app/code/local/Varien/Data/Collection/Db.php(612): Mage_Sales_Model_Resource_Order_Payment_Collection->_afterLoad()
#5 /home/testing/public_html/lib/Varien/Data/Collection.php(741): Varien_Data_Collection_Db->load()
#6 /home/testing/public_html/app/code/local/Mage/Sales/Model/Order.php(1673): Varien_Data_Collection->getIterator()
#7 /home/testing/public_html/app/code/local/Mage/Sales/Model/Order.php(907): Mage_Sales_Model_Order->getPaymentsCollection()
#8 /home/testing/public_html/app/code/community/Ds/Imports/Model/Functional/Export.php(7): Mage_Sales_Model_Order->getPayment()
#9 /home/testing/public_html/app/code/community/Ds/Imports/Model/Table/Csvcontent.php(104): Ds_Imports_Model_Functional_Export->getPaymentMethod(Object(Mage_Sales_Model_Order))
#10 /home/testing/public_html/app/code/community/Ds/Imports/Model/Selectorder.php(95): Ds_Imports_Model_Table_Csvcontent->getCSVvalue(Object(Mage_Sales_Model_Order))
#11 /home/testing/public_html/app/code/community/Ds/Imports/Model/Selectorder.php(77): Ds_Imports_Model_Selectorder->writeOrder(Object(Mage_Sales_Model_Order), Resource id #260)
#12 /home/testing/public_html/app/code/community/Ds/Imports/controllers/Adminhtml/ExportsController.php(35): Ds_Imports_Model_Selectorder->selectOrdersdownload(Array)
#13 /home/testing/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Ds_Imports_Adminhtml_ExportsController->selectorderAction()
#14 /home/testing/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('selectorder')
#15 /home/testing/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 /home/testing/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#17 /home/testing/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#18 /home/testing/public_html/index.php(113): Mage::run('', 'store')
#19 {main}

Thanks


texts: Show different signup form for different customer group

texts:
In magento2.3, I have different customer groups and have to show separate signup form for each group.
Please anybody can help me how can i achieve it.
Thank you,


texts:
In Magento 2, can you use a product repository to filter by product attributes?

In Magento 2, you can use a search criteria object

\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria,

and a repository

\Magento\Catalog\Api\ProductRepositoryInterface $productRepository,

To fetch a list of objects

$searchCriteria->getPageSize(10);
$list = $productRepository->getList($searchCriteria);

However, the searchCriteria object doesn't (seem to?) have direct filtering capabilities.  The search criteria class does have methods for adding something called filterGroups

#File: lib/internal/Magento/Framework/Api/SearchCriteria.php

public function getFilterGroups()
{
    $filterGroups = $this->_get(self::FILTER_GROUPS);
    return is_array($filterGroups) ? $filterGroups : [];
}

public function setFilterGroups(array $filterGroups = null)
{
    return $this->setData(self::FILTER_GROUPS, $filterGroups);
}

But it's not clear what, exactly, a filter group is thanks to PHP's untyped arrays.

How can I use a Magento 2 repository to do things like

  Show me all the products with [this specific SKU]
  Show me all the products created after [this date]
  etc.


texts: Base currency rate is not showing in admin order summary : custom added fee

texts:
I have followed below link to add a custom fee to order.

  How to add fee to order totals in Magento 2

Custom fee is added perfectly and showing in admin order summary without any issue.

Now I Have a different store view for China and I have ordered from it, custom fee is adding and showing in admin but its base rate is not showing or added in order totals, is there something which I forgot to add.


texts:
I want to merge my two collections,
public function getRelatedPosts()
    {
        if (!$this->hasData('related_posts')) {
            /** collection 1 */
            $collection = $this->_relatedPostsCollection
                ->addFieldToFilter('post_id', ['neq' => $this->getId()])
                ->addStoreFilter($this->getStoreId());
            $collection->getSelect()->joinLeft(
                ['rl' => $this->getResource()->getTable('magefan_blog_post_relatedpost')],
                'main_table.post_id = rl.related_id',
                ['position']
            )->where(
                'rl.post_id = ?',
                $this->getId()
            );

            /** collection 2 */
            $collection = $this->_relatedPostsCollection
            ->addFieldToFilter('post_id', ['neq' => $this->getId()])
            ->addStoreFilter($this->getStoreId())
              ->addFieldToFilter('category_id', ['in' => $this->getCategories()]);
          $collection->getSelect()->columns(['position' => 'post_id']);
          $collection->getSelect()->joinLeft(
                         ['cl' => $this->getResource()->getTable('magefan_blog_post_relatedpost')],
                         'main_table.post_id != cl.related_id',
                         ['auto_related']);

            $this->setData('related_posts', $collection);

        }

        return $this->getData('related_posts');
    }

How to do that?


texts: I am using custom module and want to send order comment data when comment is added to order. Can you please let me know which event will be useful for after add comment. I am using Third party API and want to send data to other website so I need exact event which will work better


texts: Difference between adapter curl and client curl in magento 2

texts:
I came across two methods for making a CURL call in Magento 2.

  Magento\Framework\HTTP\Adapter\Curl

  Magento\Framework\HTTP\Client\Curl

Paypal uses the First one as a factory Method to make its NVP cUrl calls and the later one is used by Magento's setup model PackagesAuth class. A few blogs also recommend to use the second one to make our custom cUrl calls.

Which is the recommended method to use?

What is the Difference between these two methods?


texts: Invoice PDF layout not showing proper Magento 2

texts:
There are more than 15 custom option for my each product. When I print the PDF for invoice or order then it does not showing properly. Please check the attached screenshot.

Have you guys any idea how to remove that blank space from the pdf file?
You can download the pdf file from below link,

https://ufile.io/wu6dz


texts: How to disable previous date for custom attribute in magento 2?

texts:
Step 1 : Add below input field whereever you need in .phtml file

        <?= /* @escapeNotVerified */ __('License Expiration Date') ?>
        <input type="text" id="date_field" name="date_field" name="date_field">

Step 2 : Add below script


texts: Magento2 : How to path for background image in .less file?

texts: I want to set path for background image in less file app\design\frontend\vendor\theme\web\<lessfile> in magento2.


texts: Add Category Filter to Mini Search on Top Bar Magento

texts:
I would like to add category filter on the top search box. I found the link with same task for magento 1 but i would really appreciate if anyone can provide any guidance for magento 2

https://community.rackspace.com/developers/f/7/t/917


texts:
Guys I would like to change the image when a person enters the site, for example, have a static block that loads an image and when a person enters or gives an F5 I would like to change the name of the image in order to always have a new image. The code below is within the home:

I want to change this name as a random variable from 1 to 10, so could have 10 different images:

image_ [number-Random] .jpg

Is it possible to do that?


texts:
i have problem in my website
when i am going to open website then i am found following attachment error.
Web Url Is- www.mkzon.com
I Have Tried To Clear Cache But My Problem Is Not Solved
now what i can tried.
So Please Tell Me About My Problem.. Please..


texts: Special price time dependent on frontend

texts:
I am trying to make special price dependent to time on frontend. I have already managed to save the date with time on backend and inside data table catalog_product_entity_datetimethanks to this post using time in special price from/to

The problem is that the price is not changing after the time is reached. It only reads the date and so the prices only changes back to normal after 00:00:00 next day, as normal.

I could not find the controller responsible for this on "Mage_Catalog_block_Price"

Does anyone have an idea where is this controlled and how can I make the special price dependent on time?

Any help is welcome

Thanks

Gabriel


texts:
I have a string HTML and have to convert(parse) it to HTML in PHP.

$stringHtml

How to convert this to HTML so that it all <p>, <br> tag works

this is Riskified decline email, and whatever content I add in its admin panel it prints as it is in email.
so I have added  html_entity_decode in $content

code

        $transport = $this->transportBuilder
            ->setTemplateIdentifier('riskified_order_declined') // this code we have mentioned in the email_templates.xml
            ->setTemplateOptions(
                [
                    'area' => \Magento\Framework\App\Area::AREA_FRONTEND, // this is using frontend area to get the template file
                    'store' => $order->getStoreId(),
                ]
            )
            ->setTemplateVars(
                [
                    "content" => html_entity_decode($content),
                    "subject" => $subject,
                ]
            )
            ->setFrom(
                [
                    "email" => $this->apiConfig->getDeclineNotificationSenderEmail(),
                    "name" => $this->apiConfig->getDeclineNotificationSenderName(),
                ]
            )
            ->addTo($order->getCustomerEmail(), $order->getCustomerName())
            ->getTransport();

This is what my email looks like. no formatting it just prints the  tag.

Riskfied email_template.xml

<config
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
<template
        id="riskified_order_declined"
        label="Notification sent to customer when order was declined"
        file="order/declined.html"
        type="html"
        module="Riskified_Decider"
        area="frontend"
/>

declined.html

<!--@subject {{var subject}} @-->
{{template config_path="design/email/header_template"}}
{{var content}}
{{template config_path="design/email/footer_template"}}


texts: Magento Product Import XML/CSV 5 description columns to one description field

texts:
I have an a little bit crazy feature request. I have a Excel/CSV file with 5 description fields. Description 1, Description 2, Description 3 ... and need during the import to merge them with breakline

Description 1
Description 2
Description 3
Description 4
Description 5

into one description field.

I know via PHP is it possible but the guy who needs this want it so simple as possible via CSV or better Excel.


texts:
How to remove order history tab from magento2 admin sales order view page?

I am using the following code in sales_order_view.xml

<referenceBlock name="sales_order_tabs">
    <action method="removeTab">
        <argument name="name" type="xsi:string">order_history</argument>
    </action>
</referenceBlock>

But, i am getting the exception like

  Exception: Warning: Illegal offset type in isset or empty in
  /vendor/magento/module-backend/Block/Widget/Tabs.php on line 479


texts: What options are available to add a calculated attribute to Mage_Core_Model_Product?

texts:
We've got a number of attributes which are generated by basic Excel formulas and then bulk-loaded into the catalog via imports.  The process results in "extra" attributes which are read-only and shouldn't be altered by individuals.

Ideally these values wouldn't be stored in EAV attributes, but would instead be calculated on-the-fly as needed.  I've considered (and not ruled out) extending the catalog/product model to have additional methods for this data, such as:

class My_Extension_Model_Catalog_Product extends Mage_Core_Catalog_Product {

  public function getSomeValue() {

    if (!$x = $this->getX() || !$y = $this->getY()) {
      return null;
    }

    return ($x * $y);
  }
}

The attribute needs to be available to consumers who expect it to behave like any other attribute--they should be able to call Mage::getModel('catalog/product')->load(123)->getSomeValue(); without any extra boilerplate or bootstrapping.

What other options would I have?  Would there be events that would let me calculate and set the value when the product is being loaded?  Or better could I assign the function when the product is loaded?


texts:
I am keep getting below warnings :

ERR (3): Warning: include(FacebookApiException.php): failed to open stream: No such file or directory  in /lib/Varien/Autoload.php on line 94

2015-06-11T11:20:13+00:00 ERR (3): Warning: include(): Failed opening 'FacebookApiException.php' for inclusion (include_path='/app/code/local:/app/code/community:/app/code/core:/lib:.:/usr/share/pear:/usr/share/php')  in /lib/Varien/Autoload.php on line 94

How can I track the source of this warning and how can this be fixed?
Any help will be appreciated.


texts: Cart rule not working for same product with different custom option

texts:
In Magento 2.3, If I added a product 2 times with different custom option value and I have a cart rule with no coupon is: if quantity is >= 20 then 10% coupon should apply.
Now scenario is I have added same product 2 times with different custom option with quantity 10. Now both products quantity is 20 so 10% coupon should apply but its not.
Please any body can suggest what changes I need to do?

Thank you,
Vijay


texts: Assign product category to specific store

texts:
I've been trying for a while now to assign a product to a new category. We are running multiple store views, but when i try to assign the products to the new category IDs the original product is also affected.

$newProduct = Mage::getModel('catalog/product')->setStoreId($this->_targetStoreId)->load($productId);
$newProduct->setCategoryIds($newCategoryIds);
$newProduct->getResource()->save($newProduct);

Can anyone see the bug?

For some products i get this error:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '47893-0-6-8' for key 'FA0D1FDA369EC09AFFDA36F11B04E66B'


texts: magento multistore with global accounts but with different address per website

texts:
I have a magento 1.9.2.4 with multistore (3 websites), and it has configured global accounts.

I need to filter the customer addresses by website.

For example, let's say the countries are France, Germany and UK.

If a customer with a french shipping address logs in the german website, I need that the french address is not available in the german website (or the Uk website).

If a customer with a german shipping address logs in the UK website, it shouldn't have available the german address in the UK website (or french).

But I have no clue where I should begin with this....

EDIT:
In system > configuration > SALES > Shipping Methods > Ship to Applicable Countries I have set Specific Countries option and selected a different country by website.

Now, customers can't ship to a different country, but I need to not list at all the addresses from another countries and the other countries addresses are still there.

EDIT 2:
I'm still searching, and I've tracked this code in app/design/frontend/rwd/myproject/template/opc/onepage/billing.phtml

<?php if ($this->customerHasAddresses()): ?>

        <?php echo $this->__('Select a billing address from your address book or enter a new address.') ?>

            <?php echo $this->getAddressesHtmlSelect('billing') ?>

<?php endif; ?>

and getAddressesHtmlSelect leads me to:

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();
        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 '';
}


texts: Cart items are not updating when same product is added multiple time

texts:
When an item of same type is added to cart more than one, the drop down cart preview still shows "1 item in cart".

I am working in magento 2. Please help me how to fix this issue. Thanks


texts: Add Upsell Product On Checkout Cart Page -Magento 2.3

texts:
How to we can add upsell products on checkout cart page as crossell products in Magento 2.3.5 ?
Thanks


texts:
The Description of the patch SUPEE-11086 is:

  SUPEE-11086, Magento Commerce 1.14.4.1 and Open Source 1.9.4.1 contain
  multiple security enhancements that help close remote code execution
  (RCE), cross-site scripting (XSS), cross-site request forgery (CSRF)
  and other vulnerabilities.

Also includes patch for SQL Injection with CVSSv3 Severity: 9.0

  An unauthenticated user can execute arbitrary code through an SQL
  injection vulnerability, which causes sensitive data leakage.

Are there any issues or problems we can expect from this patch?


texts:
I magento 1x i can put url of images like {{media }} or {{skin }}. I have take a look in frontend dev docs but not mention about this. Can anyone tell me how to put images url in cms page
many thanks


texts:
How to hide PayPal Express Checkout in code at the following location:

  vendor/magento/module-checkout/view/frontend/templates/onepage.phtml

<!-- ko template: getTemplate() --><!-- /ko -->

How to debug this ko.?

Case:

Express checkout is enabled at admin. Example:

product sku: commission-product
if commission-product is added to cart: payment through Express checkout
else: show all payment methods expect Express checkout


texts: Prototype check if Checkbox is selected and pass its value in Params

texts:
I have a below checkbox in my phtml file

<input type="checkbox" id="my_checkbox" name="my_checkbox">

Below code is used to pass params to controller file

$('checkbox_id').observe('click', function(e) {
            var checked = this.checked;
        });

new Ajax.Request("<?php echo $formAction;?>", {
           method: 'post',
           postBody: "mypostdata="+$('my_value').value,
           onComplete: function(data) {
                var mydata = data.responseText.evalJSON(true);
                $('shopping-cart-totals-table').update(mydata);
            }
    });

How can I check if the checkbox is clicked or not and pass its vale in postBody as params to my controller file ?

For example,

If checkbhox clicked, value = yes/true
If not, value = no/false

How can I pass the aboove value, based on user's click as params ?

Thanks


texts: Magento 2.2.2 - InstallSchema.php - update multiple tables

texts:
While developing a new extension, I'm trying to update two tables at installation time by using Setup\InstallSchema.php. The tables are "admin_user" and "customer_entity", and I basically need the same fields for both of them.

The InstallSchema.php is triggered, but the tables don't get updated.

Please see the code & info below:

namespace Vendor\ModuleName\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;

class InstallSchema implements InstallSchemaInterface
{
    protected $installer;

    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $this->installer = $setup;
        $this->installer->startSetup();

        $this->addUsersFields('admin_user');
        $this->addUsersFields('customer_entity');

        $this->installer->endSetup();
    }

    protected function addUsersFields($table)
    {
        $table = $this->installer->getTable($table);

        $this->installer->getConnection()->addColumn(
            $table,
            'field1',
            [
                'type' => Table::TYPE_TEXT,
                'nullable' => false,
                'default' => 'field1Default',
                'length' => '45',
                'comment' => 'comment'
            ]
        );

        $this->installer->getConnection()->addColumn(
            $table,
            'field2',
            [
                'type' => Table::TYPE_TEXT,
                'nullable' => false,
                'default' => 'field2Default',
                'length' => '45',
                'comment' => 'comment'
            ]
        );
    }
}

  EDITED: updated fields name correctly : field1 and field2

Using Magento 2.2.2 on AWS, from an AWS AMI. Developer mode enabled.

I'm running :

php bin/magento module:enable ModuleName (works fine, tells me that
has enabled the module)
php bin/magento setup:upgrade (works fine, I can see the module in the output)
php bin/magento setup:di:compile (works fine)

I've :

made sure the InstallSchema.php is included each time by deleting
the module entry from "setup_module" table;
tested that it's
triggered by deliberately deleting an ";" from a line, and within
php bin/magento setup:di:compile it shows an error message and the
process is stopped.

So basically I'm 100% sure the InstallSchema.php is triggered.

THE PROBLEM is that the tables don't get updated, nor do I get any error message. Neither anything worth mentioned in exception.log, system.log or /var/log/apache2/error.log.

Any way to debug this?


texts: Magento 2: Why Add/Edit redirect to Admin Dashboard

texts:
I'm working on simple CRUD (create, read, update and delete) module without grid or ui component, just simple CRUD.
 So when i'm trying to create add/edit form, i've meet some weird issue, when i click on add/edit button, it redirect to my admin dashboard (At first i think it was acl.xml problem, but it wasn't). The controller for edit/add is almost excactly like the list/manage controller.

I've try to find the problem many hours but no chance.
 Here is my module, please take a look.
Thanks.


texts: Out of stock products: why do they appear in Collection::getAllIds and not in Collection::getItems

texts:
Im trying to get all products in a collection: out of stock and products in stock.
So what I did is:

/** @var $collection \Magentp\Catalog\Model\ResourceModel\Product\Collection */
$collection = $this->productCollectionFactory->create();
$collection->addAttributeToSelect('*');
$collection->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH);
$collection->addAttributeToFilter('status', \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
$collection->sePageSize(3);
$collection->setCurPage(1);

Now, when I use a foreach() loop with $collection->getItems() as the array expression, it just shows the products that have stock, but when I use the $collection->getAllIds() instead, it includes the products out of stock.

Can anyone explain why?


texts: Magento Save Guest Address after he entered billing or shipping information

texts: How I can save the current state of checkout in magento, for example Guest filled the address and suddenly leave the browser I want to save his information in database. Is there any way do this?


texts: I want to create pricelist like category page without images. Mean that want a list page with list view to show SKU product name Guaranty and color with price and a button to show product. with pagination. For example make a category and show that category page like described


texts: Refresh and update mini cart in Magento 1.9

texts:
I have a javascript function to add the product to the cart, but the problem is I need to refresh the page to see if the mini cart updated, in Magento 2 I use this function to update this mini cart, it seems pretty simple

<script>
    require([
        'Magento_Customer/js/customer-data'
    ], function (customerData) {
        var sections = ['cart'];
        customerData.invalidate(sections);
    });
</script>

Is there a way just to update mini cart in Magento 1.9 using javascript?


texts: Where is the default location for the magento newsletter opt in

texts:
So I was exploring options to get customers subscribed into a mailing list. I noticed magento has a newsletter functionality built in and I don't plan on using this.

But just curious, where exactly does it place the opt in checkbox for the guest and registered customer? I can't seem to find it anywhere?  How does magento determine which emails to throw in newsletter_subscriber table?


texts:
I need help to know How to edit, delete or hide menu (More Information and Reviews) on product page magento 2.
http://prntscr.com/v91f8b


texts: Sorting Collection after joinField not working

texts:
I have a collection of products which I filter and show out of stock items only and it works fine. This is what I have:

$collection = Mage::getResourceModel('reports/product_collection')
    ->addAttributeToSelect('*');
$collection->joinField('qty','cataloginventory/stock_item','qty','product_id=entity_id','{{table}}.stock_id=1','left')
    ->addAttributeToFilter('qty', array('eq' => 0));

I wanted to sort by Price so I added this:

$collection->setOrder('price', 'desc');

Unfortunately this does not work. and I get a blank page.

If I change the Filter on the Join to show in stock products it works and will show in the correct order

->addAttributeToFilter('qty', array('neq' => 0));

What am I missing?

Update:

I removed the filter completely and sorted the collection and it only shows in stock products. It refuses to show out of stock products after sorting.

Update:

If I show out of stock products on front end it works:

Admin >> System >> Configuration >> Catalog >> Inventory >> Stock Options
Display Out of Stock product -> Yes

I do not want to show out of stock products on the front end though, only in this collection.


texts:
When I try to print shipment I get this error:

  Fatal error: Call to a member function getParentItem() on null in
  /public_html/includes/src/Mage_Sales_Model_Order_Pdf_Shipment.php on
  line 121

Please help me to solve this.


texts: get product attribute on module-catalog/view/frontend/templates/product/image.phtml

texts:
I have created a new product attribute of media type with code img_hover.
Now I want to access it in the template file vendor/magento/module-catalog/view/frontend/templates/product/image.phtml

When I printing $block->getData(), I am not seeing the new attribute.

How can I achieve it?


texts: Magento 2 - Multiple categories filter on product collection

texts:
I have a product collection $collection which is created by Magento\Catalog\Model\ResourceModel\Product\Collection

code is:

$collection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
$collection->addAttributeToSelect('*');
$collection->addAttributeToFilter('status', array('eq' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED));

How can I add multiple category filter in it?


texts: need the CMS path directive for a app/code module folder

texts:
i added my own module under /app/code/my/module/ , activated it and put a java script under /app/code/my/module/view/frontend/web/js/myjs/myjs.js

it works so far. The javascript is called within a cms page via data-mage-init.
The javascript istself needs some configuration arguments, as beside others a folder, to put some temporary data for the java script to work. : Argument is: folder = "/myjs/temp"

The problem is, that the js expects the folder now to be under

root-folder/myjs/temp  (ok, its clear somehow) , but it should be within my Module folder:

root-folder/app/code/my/module/view/frontend/web/js/myjs/temp

How can i fix the path within the argument in the cms page?


texts: Foreach loop taking long time in magento product collection with limit

texts:
I have following code in which I have join product collection with sales order item table. this query takes fraction of a seconds to execute but foreach loop after that takes around half minute while collection has limit to 12 products. :--

$strtime = microtime(true);

$allProductObject = Mage::getModel('catalog/product')->getCollection()
                   ->addAttributeToSelect('*')->addAttributeToFilter('status',1);

$toDate=date('Y-m-d', strtotime('today'));
$fromDate=date('Y-m-d', strtotime('today -1 days'));

$allProductObject->getSelect()->joinLeft(
                          array('order_item' => $allProductObject->getTable('sales_flat_order_item')),
                          "order_item.product_id = e.entity_id AND order_item.created_at BETWEEN '{$fromDate}' AND '{$toDate}'",
                          array("SUM(order_item.qty_ordered-(order_item.qty_refunded+order_item.qty_canceled)) as sold_qty")
                         );
                     $allProductObject->getSelect()->group('e.entity_id')->order("sold_qty desc");
                     $allProductObject->getSelect()->limit(12);

echo $finaltime = microtime(true)-$strtime."
"; // print 0.0453298091888 sec

 $strtime1 = microtime(true);

 foreach($allProductObject as $product)
  {
       echo $product->getEntityId()."
";
       echo $product->getname()."
";
       echo $product->getSoldQty()."
"."
";
  }
  echo $finaltime1 = microtime(true)-$strtime1."
"; // print 39.8572499752 sec

Why above foreach loop taking so much time to execute while query fetches only 12 products ?
Thanks in Advance.


texts: What is the variable that holds the My Cart url?

texts:
I have edited XML files to add an icon before the My Cart top-link. I made the icon a link as well, but I added a simple ....

I am looking to instead use Magento's variable that holds My Cart's URL in case my store's URL changes.

I am looking for something like this:

<a href="<?php $_myCartLink ?>">...

with the correct My Cart Link variable.

Thank you!

$parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"', '<a href="<?php echo Mage::getUrl('checkout/cart');?>"> ');


texts: Magento 2: Get Customer data after login with observer

texts: I need to detect in frontend section for my custom module if customer has just successfully logged in, and i need to run some function before it redirect to another page, is there any way to do this?


texts:
I will need to integrate a Magento with another tool. I will override user (login, register, and personal information), cart and payment.

I created these modules:

Mycompany_Base: "Core" of my module with tabs and some other configurations.

Mycompany_ModuleName: In helper, I started to create all classes about an external SOAP connection, and get or send my information. I do not know if this is the correct way to do this, but all other modules would access this helper.

Mycompany_ModuleNameUser: overwrites models, blocks and controllers of the customer.

Mycompany_ModuleNameCart: overwrites models, blocks and controllers of the cart.

[...]

And I will create others similar to those.

Am I doing something wrong? Or is this way also right?

Thanks


texts:
I am working on a module and I need to get the order status from an order. There is an API call which sets the order status to complete. The order state remains processing.

I am using this code to execute code if the order status is complete, but I cannot get it working (see lines starting with: //this is not working:)  Any ideas how to solve this?

<?php

   namespace Mymodule\AutoInvoice\Model\Observer;

   use Magento\Framework\Event\ObserverInterface;
   use Magento\Sales\Model\Order;
   use Magento\Sales\Model\Order\Email\Sender\InvoiceSender;

 class AutoInvoice implements ObserverInterface
 {
   protected $_invoiceSender;

   public function __construct(
    InvoiceSender $invoiceSender
) {
    $this->_invoiceSender = $invoiceSender;
}

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $order = $observer->getEvent()->getOrder();
    if (!$order) {
        // Dont send invoice if order is not provided
        return;
    }

    //this is not working: if($order->getState() == Order::STATE_COMPLETE) {
    //this is not working: if ($order->getStatus() == 'complete') {
    //this is not working: if($order->getStatus() == Order::STATE_COMPLETE) {

        $invoices = $order->getInvoiceCollection();

        foreach ($invoices as $invoice) {

            if (!$invoice->getEmailSent()) {
                try {
                    $this->_invoiceSender->send($invoice);
                } catch (\Exception $e) {
                    // Do something if failed to send
                }
            }

        }

    }
}

}


texts: How can use strleft function in email template?

texts:
I am going to use strleft in email template. I used php inside the template. I am failed to use the php code in email template. Does anyone known how to use php in email template of magento?

Please help.


texts: Magento 1.9.1 not saving the Card Verification Number in the "Credit Card (saved)" payment option

texts: We need to save the 3 digit code from the back of the card. I enabled the credit card (saved) payment option but Magento 1.9.1 (although it shows it during the order process) is not saving the Card Verification Number after customer fills that in during the order process. It does not show on the order in the Admin...Any ideas?


texts: How to change product image on swatch selection on related product on product view page in Magento 2?

texts:
I have color swatches on related products list on product page. I want to change product image on the basis of swatch selection on view page.

How can I change image?


texts: Why is magento delivering images as https on http site

texts:
I have a magento website with multiple stores.

In the basic configuration we use https://exampleBackend.com as Unsecure Url and Secure Url because the backend has to be in https.

On each store we use for example http://exampleFrontendEnglish.com as Unsecure Url and https://exampleFrontendEnglish.com as Secure Url.
The setting for media is {{unsecure_base_url}}media/ for all stores.

When I visit one of the stores (for example http://exampleFrontendEnglish.com) the site is loaded with http but all the pictures are tried to be loaded via https which fails and I have no clue why that happens.

If I change the secure base url to http everything is loaded with http but I do not have any https anymore for secure parts.

Has someone a clue why the stores are loaded in http but medias in https?
Any hint is welcome


texts:
I tried excluding page/html/header.phtml from caching with Lesti FPC, but failed so far. How can I exclude that template file?

Magento 1.9.3


texts: magento 2 observer for change shipping amount on checkout

texts:
which event used for changing shipping amount on checkout ?
i want to change shipping amount on checkout if customer change city or state
i already used sales_order_shipment_save_before but it doesn't worked


texts:
I am new on Magento, and i'm facing an issue after  I've installed it, everything looks ok but in the "new product page" i can't create a custom options. This is giving me an error, and i have no idea what could be wrong with it. Below I've attached a screen-shot of the issue. Have a look.

My Magento version is 1.9.3


texts: How to setup two for £20 on a single product

texts:
How would I go about setting it up so that a product that is normally £15 can be purchased at two for £20?

I.e they get two tickets for £10.00 each if they buy two

Hope that makes sense

Thanks


texts: Step by step instructions for adding a block to the shopping cart in Magento 2

texts: Can anyone provide a link or write out step-by-step instruction for adding a link to the Magento 2 shopping cart page?  I have tried following several provided by 3rd parties, but I haven't had any luck.


texts: How to export store's csv that Excel will read properly?

texts:
In Sales > Orders when I export csv and open it in excel some characters are not encoded properly. e.g: ü is exported as:  Ã¼ etc.

Do suggest some solution to this problem. Thanks


texts: How do you accept terms and conditions via API?

texts:
I attempted to place an order via /rest/default/V1/carts/mine/payment-information and got the following response:

    "message": "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again."
}

How do I accept terms via API?


texts: Not able to run command after upgrade - Magento2

texts:
I have upgraded the Magento version after that I have run cache clean, flush and permission command.

above cache-related commands are working good but php bin/magento setup:upgrade command isn't working.

It gives this error:

[Exception]
  Notice: unserialize(): Error at offset 1977 of 2818 bytes in /var/www/html/magento2/vendor/magento/framework/Unserialize/Unserialize.php on line 21

Any help will be appreciated.


texts: Custom option displaying Product Price on product page

texts: There are custom options displaying on product view page. But custom options are displaying product price. Custom option should display their own price.


texts: Magento 2 : Form Ui Component doesn't submit field in the html content

texts:
I built a ui component form and it's a compilation of <field> tag and <htmlContent> tag. This is the htmlContent :

<htmlContent name="resource">
    <block class="Namespace\ModuleName\Block\Adminhtml\Package\Role\Tree" name="package_form.resources_access.resource_tree"/>
</htmlContent>

I loaded a template inside the block Namespace\ModuleName\Block\Adminhtml\Package\Role\Tree and created some dynamic input text fields in the template.

The problem is my input text field inside htmlContent didn't submit with other <field>
Did I miss something when I was creating the htmlContent?


texts: upsell.phtml - get products without column and row sorting

texts:
the upsell.phtml is built a little bit dated imho. It loads rows and then products for each row. I'd like to load every product without a table.

Something like

<?php if(count($this->getItemCollection()->getItems())): ?>
    <?php for($_i=0;$_i<$this->getProductCount();$_i++): ?>
        <!-- DOM for Upsell Product -->
    <?php endfor; ?>
<?php endif ?>

How could I achieve this?


texts: Validate if it's correct way to create the integration while creating the module extension for Magento 2 Marketplace

texts:
While creating a module i want to create the integration for accessing the API's. I have found two ways to do that in
The first way is pretty straight forward to use and I know it will not be rejected by Magento Marketplace.
$this->integrationManager->processIntegrationConfig([Constants::INTEGRATION_NAME]);

The above code is added in the InstallData.php and the integration is created but the problem is that the Magento Admin have to manually do the activation by going to the Integration page and click activate. After click on the activate the endpoint is then able to generate the indefinite access_token.
I wanted to skip this step so that there is no such additional step. So, i found the other way.
The second way is to create the integration and activate there and then in the InstallData.php. Here is the code snippet:
$integrationExists = $objectManager->get('Magento\Integration\Model\IntegrationFactory')->create()->load($name, 'name')->getData();
    if (empty($integrationExists)) {
        $integrationData = array(
            'name' => $name,
            'email' => $email,
            'status' => '1',
            'endpoint' => $endpoint,
            'setup_type' => '0'
        );
        try {
            // Code to create Integration
            $integrationFactory = $objectManager->get('Magento\Integration\Model\IntegrationFactory')->create();
            $integration = $integrationFactory->setData($integrationData);
            $integration->save();
            $integrationId = $integration->getId();
            $consumerName = 'Integration' . $integrationId;

            // Code to create consumer
            $oauthService = $objectManager->get('Magento\Integration\Model\OauthService');
            $consumer = $oauthService->createConsumer(['name' => $consumerName]);
            $consumerId = $consumer->getId();
            $integration->setConsumerId($consumer->getId());
            $integration->save();
            // Code to grant permission
            $authrizeService = $objectManager->get('Magento\Integration\Model\AuthorizationService');
            $authrizeService->grantAllPermissions($integrationId);

            // Code to Activate and Authorize
            $token = $objectManager->get('Magento\Integration\Model\Oauth\Token');
            $uri = $token->createVerifierToken($consumerId);
            $token->setType('access');
            $token->save();
            return $uri;
        } catch (Exception $e) {
            $this->_logger->debug('Error creating token :: ' .  $e->getMessage());
            return null;
        }
    }

Using the second way i am able to get the access_token and then i can share this token to external application which can then use this access_token to fetch data. I tried that and it's working.
Please note that i can use dependency injection in the constructor to not make use of object manager. But the point remains the same.
The problem is now that I want to know if using this code the Marketplace would reject my extension for publishing? If this is allowed are there any other things that I need to do?


texts: Customer Last Logged In date is showing incorrect year in magento

texts:
Suddenly, I am getting incorrect 'Last Logged In' date magento admin panel for edit customer..It is showing date with a year which is unexpected.
I am not sure if there also happening any issues with date..
Do anyone know why this is happening suddenly?
This is happening to magento 1.8 and magento 1.9.1
please help!


texts:
Im looking to add a custom tab to the bottom of my existing tabs found on this page: Example

I don't mind the way i add it, the information that's going to be added there will be the same information throughout the whole website it will be a delivery-information tab which just states all the delivery information. I was thinking either making an attribute and controlling it that way or injecting it directly. I would love to hear anyone's advice and their help.

Kindest Regards

bLAZYY


texts: How to add AJAX for the 'Add to Cart' button in wishlist page and in sidebar wishlist product in produst list page in Magento 2.2.3?

texts:
How to add AJAX for the 'Add to Cart' button in wishlist page and in sidebar wishlist product in product list page in Magento 2.2.3?
Please help.


texts: Admin Product View Page Error on Sort Magento 2.3

texts:
I am attempting a simple task, to sort the product filter in the admin panel page but I am receiving the error:

  Something went wrong with processing the default view and we have restored the filter to its original state.

I have looked at the server logs and the following PHP error is being thrown up when I attempt to sort/filter in the product page of admin panel.

AH01071: Got error 'PHP message: PHP Fatal error:
Method Magento\\Ui\\TemplateEngine\\Xhtml\\Result::__toString() must not
throw an exception,
caught TypeError: Argument 1 passed to
Magento\\InventorySalesAdminUi\\Model\\GetSalableQuantityDataBySku::
execute() must be of the type string, null given, called in
/var/www/vhosts/mywebsitehere.com/vendor/magento/module-inventory-sales-
admin-ui/Ui/Component/Listing/Column/SalableQuantity.php on line 70 in
/var/www/vhosts/mywebsitehere.com/vendor/magento/module-
ui/Controller/Adminhtml/Index/Render.php on line 0\n'

This is a clean install of Magento 2.3.0 with only my Magento 1 migrated products added. Using PHP 7.2.15, Plesk Onyx v17.8.11_build1708180301.19 os_CentOS 7.

Any assistance is much appreciated.


texts: How to pass data from PHP to JavaScript component

texts:
I've overridden the grand-total element in checkout_cart_index layout and in my custom component JS I need to get the data that I have in a PHP class with a specific logic.

How can I get the data returned in that PHP class from my custom JS?

  checkout_cart_index.xml

<referenceBlock name="checkout.cart.totals">
<arguments>
    <argument name="jsLayout" xsi:type="array">
        <item name="components" xsi:type="array">
            <item name="block-totals" xsi:type="array">
                <item name="children" xsi:type="array">
                    <item name="grand-total" xsi:type="array">
                        <item name="component"  xsi:type="string">My_Module/js/view/summary</item>
                        <item name="config" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Order Total</item>
                            <item name="template" xsi:type="string">My_Module/cart/totals/grand-total</item>
                        </item>
                    </item>
                </item>
            </item>
        </item>
    </argument>
</arguments>

  my-module/view/frontend/web/js/view/summary.js

define([
    'Magento_Checkout/js/view/summary/abstract-total',
    'Magento_Checkout/js/model/quote'
], function (Component, quote) {
    'use strict';

    return Component.extend({
        defaults: {
            template: 'My_Module/summary/grand-total'
        },

        initialize: function () {
        this._super();
        },

        myCustomData: function () {
            // get data returned in PHP
        }
    });
});

So what I need is to get the data returned as a php array using the method myCustomData from my JS file.

I there any way to set the PHP class as an argument in the layout or something similar?


texts:
I have uploaded a logo (200x50) for invoices in the admin (Magento 2.2.5) but it is not showing in the pdf.

I have cleared the cache and reindexed but no luck.

Does anyone know why the logo is not showing?


texts: Custom layout not loading for custom module

texts:
I have created a custom module.

Below is my app/etc/modules/Php_CardReload.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Php_CardReload>
            <version>0.0.1</version>
            <active>true</active>
            <codePool>local</codePool>
        </Php_CardReload>
    </modules>
</config>

Below is my app/code/local/Php/CardReload/etc/config.xml

<config>
    <modules>
        <Php_CardReload>
            <version>0.0.1</version>
        </Php_CardReload>
    </modules>
    <global>
    </global>
    <frontend>
        <routers>
            <reload>
                <use>standard</use>
                <args>
                    <module>Php_CardReload</module>
                    <frontName>reload</frontName>
                </args>
            </reload>
        </routers>
    </frontend>
    <layout>
        <updates>
            <cardreload>
                <file>php_cardreload.xml</file>
            </cardreload>
        </updates>
    </layout>
</config>

Below is my controller

<?php
    class Php_CardReload_MtoMController extends Mage_Core_Controller_Front_Action {
        function reloadCardAction(){
        $this->loadLayout();
            $this->renderLayout();

        }
    }
?>

Below is my php_cardreload.xml

<?xml version="1.0"?>
<layout version="0.0.1">
<default>
        <reference name="top.links">
            <block type="checkout/links" name="checkout_cart_link">
                <action method="addCartLink"></action>
                <action method="addCheckoutLink"></action>
            </block>
        </reference>
        <reference name="right">
            .
            .
            .
        </reference>
    </default>
    <cardreload_mtom_reloadcard>
        <reference name="content">
            <!--<block type="cardreload/cardreload" name="cardreload" template="cardreload/cardreload.phtml" />-->
            <block type="core/template" name="cardreload" as="reload" template="page/card-summary.phtml"/>
        </reference>
    </cardreload_mtom_reloadcard>
</layout>

But the page.card-summary.phtml is not rendering.
Also no log captured on system.log.


texts: Magento 1: is there any downside removing Varien_Profiler?

texts:
I recently noticed this interesting post regarding performance: https://magento.stackexchange.com/a/124/2380

So according to the OP, it seems like removing the references to Varien_Profiler in the Magento core files (around 500 references in 1.9.2.4) could speed up the performance by up to 5%

So I was wondering if anyone has ever done that ?

If so, apart from the command line the OP posted:

grep -l "Varien_Profiler" * -R > profiler.txt
for x in `cat profiler.txt`
do
sed -i '/Varien_Profiler/s/^/\/\//' $x
done

Or as one of the comments say:

find . -type f -exec grep -qF 'Varien_Profiler' {} \; -exec sed -i '/Varien_Profiler/d' {} \;

Is there anything else that needs to be done ? The OP also said:

  You might need to adjust the file /lib/Varien/Profiler.php manually
  afterwards.

Also, I was wondering apart from not being able to use the profiler, is there any downside to this operation ? I'm talking about possible code issues related to the profiler that could possibly break the system.


texts: refresh Shipping Method's block on checkout page Magento 2

texts:
We have a custom checkout field called the city where we have multiples cities. Now I want that when customers select/ change any city, refresh the shipping method block. Same as when we add/change the zip code. I have read all of the blog posts and applied that solution nothing worked for me. I would really appreciate it if anyone can help with this.
This did not work for me. Give an error.


texts: How to get required options in magento to add a product in cart

texts:
I am trying to add a product to cart in Magento using Magento SOAP v1 API ,but am getting Please specify the product required option(s). error message.

The call happens like:

        $productArray[] = array(
            "product_id"=>"24",
            "qty"=>1
);
    $resultCartProductAdd = $client->call($session, "cart_product.add", array($shoppingCartId, $productArray));

I am unable to figure out how to find out what all options are needed to add a product to the cart using SOAP v1 . Any help will be greatly appreciated.


texts: Can not get data from form ui component to controller in Magento 2

texts:
I create form ui component, and controller save, but i can't get data to controller, i tryed this code but it not show error, not get data.

$data = $this->getRequest()->getParam();

It show This page isn’t working, but if i echo 1; exit; it show 1.


texts: Hide a shipping method frontend and still show in backend condition based magento 2

texts:
I want hide a multiple shipping method in frontend based on customer group.

Please tell me Where I have to put the condition to check shipping method with customer group?

If match then shipping method should be visible.

Can any one help me on this problem ? Any references or suggestions are highly appreciated. Thanks in advance.


texts: SMS for different order events in Magento

texts:
I want to send SMS to customers when ever an order status changes from pending > processing > complete (for all sort of changes).

For pending process(when place order is clicked), i should able to get a SMS. Below is the code: Onserver.php

public function sendSMS ($observer)
    {
        $orderIds = $observer->getEvent()->getOrderIds();
        foreach($orderIds as $orderId)
        {
            $order = Mage::getModel('sales/order')->load($orderId);
            $orderId = $order->getId();
            $order_status = $order->getStatus();
            $smsMessageTemp =Mage::getModel('core/variable')->loadByCode('template_sms_order_placement_confirmation')->getValue('plain');
                . . . . .
         }
 }

When admin changes the state from pending to processing , how to send sms for different events.

In my .xml file:

     <events>
        <sales_order_save_after>
            <observers>
                <Metro_SellerPurchaseOrder>
                    <type>singleton</type>
                    <class>sellerpurchaseorder/observer</class>
                   <method>sendSMS</method>
                </Metro_SellerPurchaseOrder>
           </observers>
        </sales_order_save_after>
    </events>

Please suggest.


texts: Tracking code for when customers signup/register

texts:
I have been asked to add some javascript twitter tracking code on my site which should track when a new customer registers.

In my store there is no dedicated page for a successful signup for me to place this code, it just directs the customer to their acccount dashboard.

I have had a look at the event when a customer registers and it seems that it is called in:

Mage > Customer > controllers > AccountController.php

In line 526:

protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
{

    $this->_getSession()->addSuccess(
        $this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())
    );

I thought by adding my javascript code onto the register success message like so it would add the tracking code onto the page:

protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
{

    $tracking = '

';

    $this->_getSession()->addSuccess(
        $this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName() . $tracking)
    );

But it doesn't seem to be tracking with this. Is this correct or is there another way of doing so?


texts:
What is the best way to disable magento 2 rating & review?

I try to follow this guide https://blog.landofcoder.com/disable-magento-2-reviews-and-rating/

but can't follow the tab as it seems magento 2.3.1 has different backend structure

I'm using default luma theme


texts:
Hi I am having difficulties getting Magento 2.4.1 to work when Braintree module is enabled.
With Braintree enabled I cannot view the product page, i get an error that begins with

Error: Class 'Braintree\Configuration' not found

When I disable the braintree module I can access the product page ok.
When I run

php bin/magento setup:di:compile

I get the following error:

Compilation was started.
Area configuration aggregation... 5/9 [===============>------------]  55% 37 secs 288.0 MiB
In ClassReader.php line 45:
Impossible to process constructor argument Parameter #1 [  Braintree\Transaction $transaction ] of PayPal\Braintree\Model\Report\Row\TransactionMap class
In ClassReader.php line 34:
Class Braintree\Transaction does not exist
setup:di:compile

I have ran setup upgrade, clean and flush cache then tried to di:compile still issues occurs.
Short of a fresh install i cannot think of anything else that may resolve the issue.
Any help would be of great help.


texts: How to use redis endpoint in magento 2.1

texts:
i am unable to add redis endpoint in magento 2.1 below is my code that i added in "etc/env.php"
Please let me know what i am missing
 'cache' =>
    array(
       'frontend' =>
       array(
          'default' =>
          array(
             'backend' => 'Cm_Cache_Backend_Redis',
             'backend_options' =>
             array(
                'server' => 'xyz-redis-latest.opb3io.0001.aps1.cache.amazonaws.com',
                'database' => '0',
                'port' => '6379'
                ),
        ),
        'page_cache' =>
        array(
          'backend' => 'Cm_Cache_Backend_Redis',
          'backend_options' =>
           array(
             'server' => 'xyz-redis-latest.opb3io.0001.aps1.cache.amazonaws.com',
             'port' => '6379',
             'database' => '1',
             'compress_data' => '0'
           )
        )
      )
    ),


texts:
I'm looking for a solution to only give the products whom are in stock and have a qty more then 0 to have a discount regardless the total quantity the customer orders.

Example:

product 1 (qty: 1)
product 2 (qty: 0)
product 3 (qty: 4)

products 1 and 3 will have a discount and product 2 does not.

At default this is not a function available in Magento 1 > cart price rules.

Also I cannot find a module which will give me these options.

Any help would be appreciated.

UPDATE:
We've solved the issue by creating a category, not visible on frontend, that holds all the products with a qty above 0. Via a cronjob the products will either be removed or added to the category. By using the cart price rules we were able to set only the discounts on the regarding products.


texts: Magento 2: Is possible to apply a fixed price in cart price rule?

texts:
I need to indicate a fixed price when the product number in the car is X.

Example:

When the total is equals o greather than 36 and sku is D0B33200 with price 45€

Now I need apply a fixed price in this condition (33€ per product).

Magento just lets me apply a discount and I need to apply a fixed price per product (the price would be the same for all products)

Apply the discount on the original price

Is it possible to indicate a fixed price in some way or by programming it?


texts: Inconsistent Failing to Load JS Components in Checkout

texts:
first time poster long time Magento developer here. We recently upgraded from Magento 2.3.2 to 2.4.1 Enterprise. We are using Magento's default checkout (previously were using a checkout very specific to our theme, but decided to drop that due to compatibility issues) with some light customizations to fix some of the default Magento behaviors that we thought were particularly crazy.
After this upgrade, we're noticing that very inconsistently (maybe one in every twenty to thirty refreshes of checkout) that the page will just not fully load, and on the developer console we'll see errors such as the following:
Failed to load the "Magento_Checkout/js/view/summary/totals" component
etc.
I'll attach a console screenshot below, but there are quite a few different components not loading, probably all of the components that checkout requires.

Even when this does happen, a single refresh will correct it every time. As I mentioned, it's very inconsistent.
I've done my research, and there are issues like this that have been reported in previous versions of Magento, though none of them seem to mention the inconsistency problem that I'm having. Some common suggestions for a solution:

You need to re-deploy static assets, clear cache, file permissions, etc.
We use the Magento 2 deployer recipe for our deployments and have for some time with no issues. Part of this process is the re-deploying of static assets on each deployment, and this one was no exception. We've cleared cache many times, and file permissions are not an issue, I have double checked. Again this is all done using Deployer and not by hand.

Run in Production Mode
We are, we always have been.

Missing PHP modules
As far as I know if this was the case, we would get errors consistently, not as infrequently as we do.

Any other ideas that anyone may have would be greatly appreciated, thank you!


texts: How to get some store information in my Magento 1?

texts:
I got the following two statements for my dutch store (Magento 1.9.3.4), with the following issues:

<?php $_BaseUrl=Mage::app()->getStore()->getHomeUrl() ; ?>

With this statement I am getting the home page plus '/nl', but I just need it without the 'nl'. Example: I get www.homepage.com/nl instead of www.homepage.com

<?php $countryId=Mage::app()->getStore()->getCode(); ?>

With this second statement, I get 'Netherlands' instead of 'nl'

Could you guys help me to achieve what I want? PHP version is 5.6.31

Thanks for your collaborations.


texts:
I am currently trying to override a register.phml from a custom module in my own custom module.

My modules name is UV_Mitgliedsnummer, the custom module I want to override the template from is Clarion_CustomAttribute.

  magento/app/code/UV/Mitgliedsnummer/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\Customer\Block\Form\Register" type="Vendor\Module\Block\Form\Register" />
    </config>

  magento/app/code/UV/Mitgliedsnummer/etc/module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="UV_Mitgliedsnummer" setup_version="1.1.0">
        <sequence>
            <module name="Clarion_CustomAttribute" />
        </sequence>
    </module>
</config>

  magento/app/code/UV/Mitgliedsnummer/view/frontend/layout/customer_account_create.xml

<?xml version="1.0"?>
<block class="Magento\Customer\Block\Form\Register" as="virtual" template="form/register.phtml">

<!--
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="clarion.register">
            <arguments>
                <argument name="template" xsi:type="string">Clarion_CustomAttribute::view.phtml</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
-->

  magento/app/code/UV/Mitgliedsnummer/view/frontend/templates/form/register.phtml

Ich bin ein Test. :-)

Do you have any suggestions why it is not working?
Thanks :-)

Edit: It seems to work now but I get these exceptions.

Exception #0 (Magento\Framework\Exception\LocalizedException): Ungültiger Block-Typ: Magento\Customer\Block\Form\Register

Exception #1 (ReflectionException): Class Vendor\Module\Block\Form\Register does not exist