texts: Confused on the choice between multi-website or multi-store in Magento

texts:
I am building 3 magento websites using 1 magento installation, and those 3 are connected as below:

When user enters the site domain.com, they will enter the "main" website and presented by 2 options, go to "sub" website A or "sub" website B.
Each sub website has their own products and has a different theme, but when user switches between each sub-website, they'll carry the cart with them. In other words, they share the cart between the sub-websites.
Once the user is done shopping, they will go to checkout on the main
website.
On the main website's cart, if the user clicks the product that comes from subwebsite A, they will be redirected to subwebsite A with its own theme, and this goes for another product.
Another feature is, when user uses the "search functionality" on subwebsite A, they will only get results from sub-website A's products.

What is the best way to achieve this? Should I use 3 websites or just 3 stores under the same website?


texts:
As far as a search field is concerned, when we search an item
eg: jewel , just after typing "j" in the field , it should provide all the
results starting with "j"

but here the auto listing of items are not working ,

in the above image you can see that when 'y' is typed it provides 3

results but all those results provided are the already searched names.

Only the already searched names are shown in the result , it doesn't show

the complete products in the page starting with y

eg(below) : when a new item is searched , no related items are shown in the dropdown

I have indexed as well as removed the cache, Still the case is same.

Can anyone help me out to resolve this issue?


texts: "Command returned non-zero exit code" when trying to set M2 to production mode

texts:
When I try to bin/magento deploy:mode:set production I get the error

  Command returned non-zero exit code

I already tried to

increase memory with -d memory_limit=2G
bin/magento setup:upgrade
clear var/cache

nothing worked.

When I do

bin/magento deploy:mode:set production --skip-compilation

bin/magento setup:di:compile

it runs successfully but the frontpage is messed up. The standard Luna theme is just a HTML output without any CSS or JS.

Here's the output of

bin/magento deploy:mode:set production -vvv

  #0 /vendor/magento/module-deploy/Model/Filesystem.php(267):
  Magento\Framework\App\Shell->execute('/opt/plesk/php/...')
      #1 /vendor/magento/module-deploy/Model/Filesystem.php(172): Magento\Deploy\Model\Filesystem->compile(Object(Symfony\Component\Console\Output\ConsoleOutput))
      #2 /vendor/magento/module-deploy/Model/Mode.php(139): Magento\Deploy\Model\Filesystem->regenerateStatic(Object(Symfony\Component\Console\Output\ConsoleOutput))
      #3 [internal function]: Magento\Deploy\Model\Mode->Magento\Deploy\Model{closure}()
      #4 /vendor/magento/framework/App/Console/MaintenanceModeEnabler.php(85):
  call_user_func(Object(Closure))
      #5 /vendor/magento/module-deploy/Model/Mode.php(147): Magento\Framework\App\Console\MaintenanceModeEnabler->executeInMaintenanceMode(Object(Closure),
  Object(Symfony\Component\Console\Output\ConsoleOutput), false)
      #6 /vendor/magento/module-deploy/Console/Command/SetModeCommand.php(101):
  Magento\Deploy\Model\Mode->enableProductionMode()
      #7 /vendor/symfony/console/Command/Command.php(255): Magento\Deploy\Console\Command\SetModeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput),
  Object(Symfony\Component\Console\Output\ConsoleOutput))
      #8 /vendor/symfony/console/Application.php(893): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput),
  Object(Symfony\Component\Console\Output\ConsoleOutput))
      #9 /vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Deploy\Console\Command\SetModeCommand),
  Object(Symfony\Component\Console\Input\ArgvInput),
  Object(Symfony\Component\Console\Output\ConsoleOutput))
      #10 /vendor/magento/framework/Console/Cli.php(102): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput),
  Object(Symfony\Component\Console\Output\ConsoleOutput))
      #11 /vendor/symfony/console/Application.php(145): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput),
  Object(Symfony\Component\Console\Output\ConsoleOutput))

Thank you very much in advance


texts: Magento 2 Admin Grid per page remove 'Custom' from all Grids

texts:
I need to remove the 'Custom' in all Admin Grids. This to avoid a large collection request that probably making website slow.

vendor/magento/module-ui/view/base/web/templates/grid/paging/sizes.html

I had find it's coming from above mention file. And in a dirty way, I have an option to override this in my admin theme theme and comment out the 'Custom' div.

        <div class="selectmenu-item">
            <button
               type="button"
               class="selectmenu-item-action"
               data-bind="
                    click: function () {
                        $data.showCustom()
                            .discardEditing();
                    },
                    visible: !isCustomVisible(),
                    i18n: 'Custom'"></button>
        </div>

However it works but still wondering if is there any other nice way to remove it?

Thanks


texts: What is the use of load() method in collection?

texts:
CASE

  productCollectionFactory load function gives data in query but not
  in object

$collection = $this->_productCollectionFactory->create()
            ->addAttributeToFilter('status', '1')
            ->addAttributeToFilter('featured', '1')
            ->addAttributeToFilter('type_id',["neq"=>"configurable"]);

and after this i calling load() function

$collection->addAttributeToSelect('*')->load();

and after that applying JOIN's

$collection->getSelect()->join(
                ['cp' => $collection->getTable('custom_product')], 'e.entity_id = cp.marketplace_product_id'
        );

some other JOIN's

$collection->getSelect()->orderRand()->limit(8);

  In collection query i am getting perfect query with JOIN table's data.

foreach ($collection as $key => $data){
    $responce[$key]['custom_price'] = $data->getCustomSpecialPrice();
}

I am getting all custom_special_price and other JOIN fields DATA IN Query
But not in foreach.

But when i don't use load() function it gives me data using get method ,But when i do use load() function it doesn't.

So my question is why Magento loads data in Query ? But not in Object.

  What load() function is doing with generating query ?

  and why those data which is available in query but not in object ?


texts:
I am working on magento2 customization calculation functionality.
In this i have width and gather two field is there in text field
I have to calculation with product price eg. pricewidthgather like that.
That i did successfully but problem is in magento 1 we use to update price use reloadPrice() function is use but in magento 2 which function are require for update a final price


texts: How to move Attribute Group at last on product edit page?

texts:
In Magento admin I created a product attribute group.

I want to move this attribute group as last tab in product page in admin.

How Do I move this in last of all tabs ?

Note : Using drag-drop you can only move tab before inventory. I want this tab to move at last after all tab.


texts:
I am currently trying to PM Magento projects and I was wondering if there are any resources that people can recommend in order to get started. Any literature on this would be greatly appreciated.

Thanks!


texts: Get catalog rule discount amount for customer group in magento

texts:
I have customer group id.

I need to get catalog rule for this customer group.

And after that I want to get discount amount in % for this catalog rule;

Now I make something like this:

    $group_id= Mage::getSingleton('customer/session')->getCustomerGroupId();
    $resource = Mage::getSingleton('core/resource');
    $db = $resource->getConnection('core_read');
    $query = "SELECT * FROM catalogrule
              JOIN catalogrule_customer_group
              ON catalogrule.rule_id = catalogrule_customer_group.rule_id
              WHERE catalogrule.is_active = 1
              AND catalogrule_customer_group.customer_group_id = {$group_id}
              ORDER BY catalogrule.sort_order
              LIMIT 1";
    $results = $db->fetchAll($query);

Much thanks!


texts:
I am using WebShopApps MatrixRates with Magento 2.2.3 to manage delivery rates per destination city, It works fine however I want to make "City" as a dropdown list to avoid any misspelling because this will impact delivery costs.

Thank You.


texts: Dependency injection not working on one the the tax collector class

texts:
I am trying to override mapItem method from "Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector" using below code. However code written in my local module's class is not invoked.

VendorName\Tax\Model\Sales\Total\Quote\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\Tax\Model\Sales\Total\Quote\CommonTaxCollector" type="VendorName\Tax\Model\Sales\Total\Quote\CommonTaxCollector" />
</config>

VendorName\Tax\Model\Sales\Total\Quote\CommonTaxCollector.php

<?php

namespace VendorName\Tax\Model\Sales\Total\Quote;

use Magento\Quote\Model\Quote\Item\AbstractItem;

Class CommonTaxCollector extends \Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector {

/**
 * Map an item to item data object
 *
 * @param \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $itemDataObjectFactory
 * @param AbstractItem $item
 * @param bool $priceIncludesTax
 * @param bool $useBaseCurrency
 * @param string $parentCode
 * @return \Magento\Tax\Api\Data\QuoteDetailsItemInterface
 */
public function mapItem(
    \Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory $itemDataObjectFactory,
    AbstractItem $item,
    $priceIncludesTax,
    $useBaseCurrency,
    $parentCode = null
) {
    $objmanager = \Magento\Framework\App\ObjectManager::getInstance();
    $logger = $objmanager->get("Psr\Log\LoggerInterface");
    $logger->debug("Testing if local method is called");

    if (!$item->getTaxCalculationItemId()) {
        $sequence = 'sequence-' . $this->getNextIncrement();
        $item->setTaxCalculationItemId($sequence);
    }
    /** @var \Magento\Tax\Api\Data\QuoteDetailsItemInterface $itemDataObject */
    $itemDataObject = $itemDataObjectFactory->create();
    $itemDataObject->setCode($item->getTaxCalculationItemId())
        ->setQuantity($item->getQty())
        ->setTaxClassKey(
            $this->taxClassKeyDataObjectFactory->create()
                ->setType(TaxClassKeyInterface::TYPE_ID)
                ->setValue($item->getProduct()->getTaxClassId())
        )
        ->setIsTaxIncluded($priceIncludesTax)
        ->setType(self::ITEM_TYPE_PRODUCT);

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

    $itemDataObject->setParentCode($parentCode);

    return $itemDataObject;
}

}


texts:
I am looking to the file Magento\LayeredNavigation\Block\Navigation\FilterRenderer (a preference actually but that's not the point).
This class defines public function render(FilterInterface $filter)
I'm looking to understand where and how the $filter is initialized.
If I'm looking to $filter->getItems() I have a list of items filtered, my objective is to alterate one the these items so I look where for exemple the filter with name filterA is defined.


texts: Magento 2: How to stop expanding advanced layered navigation tab on a page load?

texts:
I am getting expanded tabs for all attributes in layered navigation when category page loads.
I want navigation like this on page load

Does anyone have any idea about it?


texts: Create Account not working, maybe related to SUPEE 6788 patch

texts:
I'm new with Magento and I have a problem creating a new account in a Magento 1.7.0. When I input name, email and password and I click in create account it just refreshes the page.

So, I guess, it detect an error and redirects to the same page. First, I don't know which method is being called to register a new customer. I have changed app/code/core/Mage/Customer/controllers/AccountController.php so:

 /**
 * Create customer account action
 */
public function createPostAction()
{
    Mage::log('create post action', null, 'createAccount.log');
    if (!$this->_validateFormKey()) {
        $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
        return;
    }
    Mage::log('validateFormKey() returns true', null, 'createAccount.log');

I thought that _validateFormKey() was returning false and it was redirecting. But createAccount.log file is not being created. So... How can I know which method is being called to create a new user? It would be the first step to detect the error.

I have to say that some days ago I installed the SUPEE-6788 patch, which updated this AccountController.php file.


texts: How can I modify default Magento Form Value?

texts:
I want to modify the value of the Associate Website options in

  Customer > Manage Customers > Add a New Customer.

The default value of Associate Website option is 'Admin' but I want to set to Main Website.

but I know that's a native Magento option so how can I rewrite it ?

Thanks!


texts: Magento2 programmatically create Product with the custom option not displaying on frontend

texts:
magento2 custom option created backend but not displaying in the frontend.

public function createProduct($data)
    {
        $productName = 'name';
        $product = $this->productModel;
        $product->setSku('test');
        $product->setName($productName);
        $product->setAttributeSetId(4);
        $product->setStatus(1);
        $product->setWeight(1);
        $product->setVisibility(4);
        $product->setWebsiteIds(array(1));
        $product->setTaxClassId(0);
        $product->setTypeId('simple');
        $product->setPrice(100);
        $product->setUrlKey('test');
        $product->setIsDesigntoolProduct(1);
        $product->setStockData(
                array(
                    'use_config_manage_stock' => 0,
                    'manage_stock' => 1,
                    'is_in_stock' => 1,
                    'qty' => 5
                )
        );

        $product->save();
        $options = array(
                array(
                    "sort_order"    => 1,
                    "title"         => "Demo",
                    "price_type"    => "fixed",
                    "price"         => "0",
                    "type"          => "area",
                    "is_require"   => 0
                )
            );
        $objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
        $product->setCanSaveCustomOptions(true);
        $product->setHasOptions(1);
        foreach ($options as $arrayOption) {

            $product->getResource()->save($product);
            $option = $objectManager->create('\Magento\Catalog\Model\Product\Option')
                            ->setProductId($product->getId())
                            ->setStoreId($product->getStoreId())
                            ->addData($arrayOption);
            $option->save();
            $product->addOption($option);
        }
        $product->save();
        return $product;
    }


texts: Module to Group Orders Under 1 Invoice #

texts:
I'm interested in creating a billing module to generate monthly bills for my business customers (Not the same as recurring billing!).

I'm using both a website and regular in store POS, which is connected to magento. When a business registers as a customer, they are allowed to order goods in store or online and receive them without paying upfront. At the end of each month, a bill is generated showing all the customer orders; the date each was ordered, items ordered, the price and total due to be paid.

I was able to allow the business customer group to place orders without paying by using an extension that allows me to set a specific payment method for a specified customer group (in this case business).

NEEDS:
Now the next part of the puzzle is to find a way to generate a pdf for each business customer, displaying their account information, orders place within that month and the total due to be paid. This can then be printed or emailed to each customer.

I have searched high and low for an extension that is at least close to what i need, but i was unsuccessful in finding one.

Current Magento Process

As you can see, with the current Magento system an invoice and shipment has to be created for each order.

SOLUTION:
I believe 1 solution could be to group each business customers orders under 1 invoice# each month, so i can generate that one invoice showing the array of order items for that period. after which a new invoice# will be assigned for the new month, which that months orders will be grouped under, repeating the process.

Illustration

so essentially, when a business customer places an order, it will automatically do the invoicing placing the order under that months invoice number. at the end of that month the bill is generated and sent to the business, when payment is received, the shipping process is done to completing the process.

Is this a solution/workflow that will work within the magento system or do i need to come up with another solution?

any help will be appreciated. Thanks...


texts:
I'm trying to create a simple theme in magento2 on my localhost,
I added all directories and logo image following this link enter link description here

but when I refresh the frontend page it gave me this message

  Exception #0 (Magento\Framework\Exception\LocalizedException): Could
  not read config file


texts: How to override phtml using custom module

texts:
I want to override two phtml one is product view.phtml and another one is addtocart.phtml

I m trying this code:

<catalog_product_view>

    <reference name="product.info">
          <action method="setTemplate">
            <template>coupon/catalog/product/view.phtml</template>
        </action>

    </reference>
</catalog_product_view>

now i m copy catalog/product/ view.phtml  and paste in my file and change what i want to change

Using this i can override view phtml but i m not getting proper phtml

i m attaching image

is this correct way to override view phtml


texts: Slow async bulk import via RabbitMQ, no multiple threads?

texts:
I really hope someone can help me out here. We have setup a RabbitMQ and a Magento 2.3.4. RabbitMQ runs and get about 83k messages via an import by our external product management software. There are about 19k products, 4 different storeviews and simple as well as grouped products. Every product has at least 2 images.
The way we do it now is, that we upload roughly 12 GiB of images in a folder. We use a plugin for Magento (https://github.com/olivertar/m2_api_product_images/) which is modified a bit regarding 2.3.4. It works and imports all the products, BUT the import takes about 20 hrs.

This is what's happening while importing. In the background you can see the graphs from RabbitMQ. The last argument which is not visible on the screenshot is the max-messages which is set to 10.000.
What I don't get here is, why is only one single CPU is used? If all 8 cores, or at least 6 would be used at the same time, it would be enough already. CPU usage on that single task is high, but memory very low. On which ends do I have to change the configuration to get to that? All those imports go to the REST API via async call (.../async/bulk/V1/products...).
My env.php configuration regarding AMQP is this:
'queue' => [
    'amqp' => [
        'host' => 'localhost',
        'port' => '...',
        'user' => '...',
        'password' => '...',
        'virtualhost' => '/'
    ],
    'consumers_wait_for_messages' => 0
],

Any ideas?


texts: Magento 2 Custom Tab on Customer Account

texts:
I'm trying to add a custom tab on Customer Account Frontend.

I've successfully added the link but when clicking it all I get is a blank page.

There is no clue in the logs.

This is what I have

customer_account.xml

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

            <referenceBlock name="customer_account_navigation">
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-subscriptions-link">
                    <arguments>
                        <argument name="label" xsi:type="string" translate="true">Tab Name</argument>
                        <argument name="path" xsi:type="string">frontName/controller</argument>
                    </arguments>
                </block>
            </referenceBlock>

</page>

frontname_controller_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>

        <referenceContainer name="content"  cacheable="false">
            <block class="Company\Module\Block\BlockClass"
                   name="name"
                   template="Company_module::templateName.phtml"
            />
        </referenceContainer>

</page>

Controller

class Index extends Action
{
    /**
     * @var PageFactory
     */
    protected $resultPageFactory;

    /**
     * @param Context $context
     * @param PageFactory $resultPageFactory
     */
    public function __construct(
        Context $context,
        PageFactory $resultPageFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        parent::__construct($context);
    }

    /**
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {
        /** @var \Magento\Framework\View\Result\Page $resultPage */
        $resultPage = $this->resultPageFactory->create();
        $resultPage->getConfig()->getTitle()->set(__('My Title'));
        return $resultPage;
    }
}

Block

class BlockClass extends Template
{
    /**
     * Subscriptions constructor.
     * @param Context $context
     */
    public function __construct(Context $context)
    {
        parent::__construct($context);
    }
}

Template:

It Works!

I should point out that the right controller is called. Given that the right title is set to the page. Yet no html is displayed.

What am I missing. Any pointers are highly appreciated.


texts:
I need to get customer life time sales data.
Both Qty and Amount.

I have tried below Mysql Query it's worked fine.

How can i change this Mysql query in Magento collection format.

Because this data showing in Magento Grid.

select CAST(SUM( t.qty )as UNSIGNED) AS `qty`,  SUM( t.grand_total )as grand_total, t.customer_id , t.customer_name, t.customer_email_id,  date_format(t.customer_dob, '%d-%m-%Y') as customer_dob from (

SELECT `main_table`.`entity_id`, `main_table`.`customer_id`, `main_table`.`grand_total`, `cusFirstnameTb`.`value` AS `customer_first_name`, `cusLastnameTb`.`value` AS `customer_last_name`, CONCAT(cusFirstnameTb.value, ' ', cusLastnameTb.value) AS `customer_name`, `cusDOBTb`.`value` AS `customer_dob`, `cusEmailTb`.`email` AS `customer_email_id`, `sub`.`qty_canceled`, `sub`.`qty_refunded`, `sub`.`qty_ordered`, CAST(SUM( qty_ordered )as UNSIGNED) AS qty, CAST(SUM( grand_total )as UNSIGNED) AS grand_total1, SUM( grand_total ) AS `grand_total2` FROM `sales_flat_order_grid` AS `main_table`

INNER JOIN `customer_entity_varchar` AS `cusFirstnameTb` ON main_table.customer_id = cusFirstnameTb.entity_id AND cusFirstnameTb.attribute_id = 5 AND cusFirstnameTb.entity_type_id = 1

INNER JOIN `customer_entity_varchar` AS `cusLastnameTb` ON main_table.customer_id = cusLastnameTb.entity_id AND cusLastnameTb.attribute_id = 7 AND cusLastnameTb.entity_type_id = 1

INNER JOIN `customer_entity_datetime` AS `cusDOBTb` ON main_table.customer_id = cusDOBTb.entity_id AND cusDOBTb.attribute_id = 11 AND cusDOBTb.entity_type_id = 1

INNER JOIN `customer_entity` AS `cusEmailTb` ON main_table.customer_id = cusEmailTb.entity_id AND cusEmailTb.entity_type_id = 1

INNER JOIN `sales_flat_order_item` AS `sub` ON main_table.entity_id = sub.order_id

WHERE ( cusDOBTb.value = "2014-08-21" )

GROUP BY `order_id`

ORDER BY `order_id` ASC

) t GROUP BY t.customer_id

This result i get from PhpMyadmin, run above query .

Thanks for your help


texts: What is the difference between usage of '/' and '\'?

texts:
<block class="Magento\Framework\View\Element\Template" name="test"
               template="test/example.phtml" />

In above example for class used '\' and template '/'

use Magento\Framework\Escaper;
const XML_PATH_EMAIL_SENDER = "trans_email/ident_custom2/email";

Again we used both.
So when to use '/' and '\'?


texts:
I am familiar with using various methods to generate a secure URL based on context, ie:

$this->getUrl('my-page', array('_forced_secure' => $this->getRequest()->isSecure()));

This works great for building links that will direct to a secure page while you are in secure mode (or will just link to the non-secure page if not using secure mode).

The problem I am looking at is Magento only treats a few special pages as needing to be secure (customer account, checkout, etc). What I would prefer would be to have Magento always use a secure link if the user is currently in secure mode, or use the non-secure link if the user is in non-secure mode.

From what I can tell, my only real options are:

Modify every instance of $this->getUrl() to be similar to the snippet above.
Set non-secure base_url to use HTTPS, forcing all pages to secure.

Is there a better method that won't involve having to change every call to $this->getUrl() or forcing all pages to HTTPS regardless of user's context?

-- edit --

I am aware I can modify /app/code/core/Mage/Core/Model/Url.php->setRouteParams() method, though I am hoping there is a cleaner way.


texts: Magento is losing customer session when returning from payment gateway

texts:
We have developed a payment plugin for Magento 2. The plugin is working correctly in our test environments and in some merchant environments but it's failing in some merchants stores due to not being able to recover the session data.

The merchant is using Magento Commerce 2.3.2 and it's using Fastly as a cache solution.

Basically, the plugin stores some data in the session before redirecting the user to the payment gateway. When the user is redirected back (the redirection is made using a location.href), an action of a plugin controller is triggered, but when executing that action, the content of the session variables is empty.

We suspect that the issue might be related to the cache configuration. But unfortunately, we can't properly debug the issue because we don't have access to the merchant environment and also Magento Commerce and Fastly are paid products.

Has anyone come across an issue like this before and can provide some solution?


texts: Layout.xml Action Calling Block Class Method

texts:
I was working on adding the ability to set a default product list sorting option for just search results, when I noticed that \app\code\core\Mage\CatalogSearch\Block\Result.php has the method setListOrders(). I couldn't find any PHP code that called this method, but did find this:

\app\design\frontend\base\default\layout\catalogsearch.xml

<action method="setListOrders"/>

This suggests to me that the method is simply called, without passing any data, at some point before the layout is rendered. Can someone tell me more about how this works, and where this happens in the process of building the page?


texts: sales_order_place_after event not working

texts:
I trying to execute my second observer which reacts to when Place order button has been clicked (sales_order_place_event). My first observer  running good but second observer isn't. Could anybody tell me why? what am i doing wrong here?
config.xml

<events>
    <controller_front_init_before>
        <observers>
            <test_capture>
                <class>Foo_Test_Model_Observer</class>
                <method>capture</method>
                <type>singleton</type>
            </test_capture>
        </observers>
    </controller_front_init_before>
    <sales_order_place_after>
        <observers>
            <test_order>
                <class>Foo_Test_Model_Observer</class>
                <method>order</method>
                <type>singleton</type>
            </test_order>
        </observers>
    </sales_order_place_after>
</events>

Observer.php

class Foo_Test_Model_Observer {

    public function capture(Varien_Event_Observer $observer) {
        /*some code*/

    }

    public function order(Varien_Event_Observer $observer){

        echo __LINE__;exit;

    }
}

I tried to put my method in <controller_front_init_before> and run.. it works but my <sales_order_place_after> is not working


texts: How to save errors through observer on checkout page

texts:
I am creating a module to save the errors response of shipping method and payment method on checkout page through observer

Like when its say user submit his/her billing/shipping and they get :

  the shipping method is currently unavailable

save this error into table.
and on when they
"place order" and get the error :

  Gateway error: Unable to read response, or response is empty

save it also in db

my code is config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Paras_Ordertrack>
      <version>0.1.0</version>
    </Paras_Ordertrack>
  </modules>
  <frontend>
        <events>
            <controller_action_predispatch_checkout_onepage_saveBilling>
                <observers>
                    <checkout_order>
                        <type>singleton</type>
                        <class>Paras_Ordertrack_Model_Observer</class>
                        <method>saveorder</method>
                    </checkout_order>
                </observers>
            </controller_action_predispatch_checkout_onepage_saveBilling>
             <sales_model_service_quote_submit_success>
                <observers>
                    <checkout_order>
                        <type>singleton</type>
                        <class>Paras_Ordertrack_Model_Observer</class>
                        <method>orderPlace</method>
                    </checkout_order>
                </observers>
            </sales_model_service_quote_submit_success>
        </events>
    </frontend>
    --------
    --------
</config>

Observer.php

<?php
class Paras_Ordertrack_Model_Observer
{

    public function saveorder($observer)
    {
        // how to get shipping response error here ??
    }

    public function orderPlace($observer){

        // how to get payment method response error here ??
    }

}


texts: why region_code not storing properly in magento 2.3.5?

texts:
I am using Magento GraphQL api in my project. To create a customer address I used createCustomerAddress mutation(createCustomerAddress).
Below is the mutation that I have called to create the customer address :
mutation createAddress {
  createCustomerAddress(
    input: {
      firstname: "test"
      lastname: "name"
      company: "networld"
      telephone: "1231231231"
      street: ["test address line 1", "test address line 2"]
      city: "Rajkot"
      region: { region:"Gujarat", region_code: "GJ" }
      postcode: "360001"
      country_code: IN
    }
  ) {
    id
    prefix
    firstname
    lastname
    middlename
    city
    company
    country_code
    default_billing
    default_shipping
    postcode
    region {
      region
      region_code
    }
    street
    suffix
    telephone
    vat_id
  }
}

This is working properly and returning me the result as below :
{
  "data": {
    "createCustomerAddress": {
      "id": 44,
      "prefix": null,
      "firstname": "test",
      "lastname": "name",
      "middlename": null,
      "city": "Rajkot",
      "company": "networld",
      "country_code": "IN",
      "default_billing": false,
      "default_shipping": false,
      "postcode": "360001",
      "region": {
        "region": "Gujarat",
        "region_code": "GJ"
      },
      "street": [
        "test address line 1",
        "test address line 2"
      ],
      "suffix": null,
      "telephone": "1231231231",
      "vat_id": null
    }
  }
}

But, now when I query to get the customer address, it returning wrong region_code.
Here is the query I written to get the customer address :
query{
  customer{
    addresses{
      id
      firstname
      lastname
      street
      city
      region{
        region
        region_code
      }
      country_code
      postcode
      telephone
    }
  }
}

Result :
{
  "data": {
    "customer": {
      "addresses": [
        {
          "id": 44,
          "firstname": "test",
          "lastname": "name",
          "street": [
            "test address line 1",
            "test address line 2"
          ],
          "city": "Rajkot",
          "region": {
            "region": "Gujarat",
            "region_code": "Gujarat"
          },
          "country_code": "IN",
          "postcode": "360001",
          "telephone": "1231231231"
        }
      ]
    }
  }
}

As you can see, region_code in this query result and region_code in mutation result was different. Query not returning region_code that generated from the mutation. Mutation generated region_code was GJ and query returned region_code was Gujarat.
Can anyone help me why this is happening ? How to solve it ?


texts: Magento 2: How to validate the radio box and show required message?

texts:
I want to make the required radio box on submitting form. Validation works but it not showing the error message as "This is required field"

    <input type="radio" class="required-entry" name="delivery" value="door"> Door Delivery

    <input type="radio" class="required-entry" name="delivery" value="pick"> Pick Up

Edit:

Answer defined here gives the error message but it is showing error message below first radio button. I want the error to be display below the All radio boxes.

New Code:

            <?php echo 'Delivery Option' ?>:

                        <input type="radio" class="radio" id="delivery-3-5" data-validate="{'validate-one-required-by-name':true}" name="delivery" value="door" <?php if($partner['delivery']=='door') echo "checked='checked'"; ?>>

                            Door Delivery

                        <input type="radio" class="radio" id="delivery-3-6" data-validate="{'validate-one-required-by-name':true}" name="delivery" value="pick" <?php if($partner['delivery']=='pick') echo "checked='checked'"; ?>>

                            Pick Up


texts: Magento 2 - what is the correct location to place a repository in my custom module

texts:
I am trying to establish what the best practise is regarding the placement of custom repositories.

Accordingly, my question is ; what is the correct location to place a model's repository in a custom module.

in magento's 'customer module' its placed in the ResourceModel folder:

magento\module-customer\Model\ResourceModel\CustomerRepository.php

However in the product Module its place in the model folder:

magento\module-catalog\Model\ProductRepository.php


texts: Magento 2 - Category filter on custom search page

texts:
I have custom search page that is working perfectly and all the filters are applying properly except category filter.

Following is the code:

    $indices = $this->searchResult->getIndices();
    foreach ($indices as $index){
        if($index->getIdentifier() === "catalogsearch_fulltext") {
            $collection = $this->searchResult->getSearchCollection($index);

            //Apply filters if required
            $this->apiHelper->applyFilters($collection);

            $categoryRepository = $objectManager->create("\Magento\Catalog\Model\CategoryRepository");
            $category = $categoryRepository->get(176,1);
            $collection->addCategoryFilter($category);

            if($this->request->getParam("category_id")) {
                //code for applying category filter
                $category_ids = [$this->request->getParam("category_id")];
                $collection->addCategoriesFilter(['in' => $category_ids]);
            }

            $collection->setPageSize($perPage);
            $collection->setCurPage($page);
            $size += $collection->getSize();
            foreach ($collection as $k => $product) {
                $result["products"][] = $this->apiHelper->createListProduct($product, $listProduct);
            }
        }
    }

where $this->searchResult is the instance of \Mirasvit\Search\Block\Result

after applying this code with category filter product collection return 0 items.

Any help, knowledge and experience sharing would be appreciated


texts: Magento 2.1.1 Failed to load resource: the server responded with a status of 400 (Bad Request)

texts:
Magento 2.1.1.

I couldnot place order and continue receiving message "An error occurred on the server. Please try to place the order again." upon placing order.
I got this error on console "Failed to load resource: the server responded with a status of 400 (Bad Request)".

The POST url is =>
http://example.com/rest/default/V1/guest-carts/7d2013516903be5efea72e25f301d00c/payment-information

SOAP Api is installed.
Payment method is Cash on delivery

I don't find any issues on log.


texts:
Is there a maximum timeout that we can set for the session cookie?
Can I set it up to 1 year for example?


texts:
I want to create responsive email templates and for that I need to add media queries in templates, but whenever I add any style in  of transactional emails, it appears in Preview but doesn't appear in emails.

I have tried adding internal css in html file of email template also but that too is not working.

Is this possible in this version of magento, or is there any way to create responsive templates in 1.9.0.1 version of magento.

I also want to ask that does magento 1.9.0.1 version provide responsiveness in email, may be that's why it isn't working. There is no option to add css file in Configuration -> Design -> Transactional emails.

Please let me know if responsive emails is possible or not in version 1.9.0.1.

Thanks in advance.


texts:
I got the following message when trying to accept payment in Magento.

Does anyone know the cause of this error? It was working fine before I install a Paypal payment extension installed.
error msg:

PayPal gateway has rejected a request. The transaction has already been Accepted/Denied and the status cannot be changed (#11614: The transaction has already been Accepted/Denied and the status cannot be changed).


texts: Security patch 11219 risk error for Magento 1.9.2.4

texts:
Security patch 11219 risk Error for Magento 1.9.2.4

I'm using Magento 1.9.2.4 version

in the Security patch error(magereport.com)

But in the Magento Security patch not have this version (https://magento.com/tech-resources/download)

How to I use Security patch for this ?


texts: Pull out the specific word from title name and insert it anywhere on view page?

texts:
We use Magento 1.9 and we have the following name for product name:
"Laptop Gaming MSI Bravo 17 A4DDR-057XRO AMD Ryzen 7 4800H pana la 4.20 GHz, 17.3", Full HD, 144Hz, 8GB, 512GB SSD [NEW]"
We call above product name with the following code:
<?php echo $_product->getName()?>

This last word in bracket "[NEW]" we would like to pull out (if possible) and insert it in other place on our view page!
Any suggestion how this can be accomplished? Thank you


texts: How to custom search function in Magento 2

texts:
Because the search of Magento 2 works wrong with my shop, I want a custom search function in Magento 2 but I don't know it where.

Please help me, where is function in vendor


texts: add custom text field as configurable attribute for Magento 1.9.x

texts:
We are preparing a tourism agency website and we have packages to sell online. These packages are inclusive of transfers, tours and hotel stays (eg. 3* - 4* - 5*), accomodation types (eg. sngl - dbl - trpl), adult quantity (eg. 1 - 2 - 3) etc.

We have managed to do them all by configurable attributes. But what we need is to get the names of these guests with a condition like if accomodation type is selected as DBL and adult quantity is selected as 2, we require 2 text fields asking the names and surnames of these adults. But if accomodation type is selected as TRPL and adult quantity is selected as 3, then we requre 3 text fields asking the names and surnames.

So as a conclusion these text fields must be dependant to these selections. We could not find a solution to add these custom text fields as a configurable attribute no matter we searched internet in every possible way. Please advise if there is a way and how.


texts: After installing a module, I can't login to my back-end

texts:
I can get to the login page, but as I am trying to login, I am getting this error:

  Fatal error: Uncaught Error: Call to a member function getNext() on null in /home/geekcoreco/public_html/generated/code/Magento/User/Model/User/Interceptor.php:529 Stack trace:

#0 /home/geekcoreco/public_html/vendor/magento/module-backend/Model/Locale/Manager.php(96): Magento\User\Model\User\Interceptor->getInterfaceLocale()
#1 /home/geekcoreco/public_html/vendor/magento/module-backend/Model/Locale/Resolver.php(77): Magento\Backend\Model\Locale\Manager->getUserInterfaceLocale()
#2 /home/geekcoreco/public_html/vendor/magento/framework/Locale/Resolver.php(65): Magento\Backend\Model\Locale\Resolver->setLocale(NULL)
#3 /home/geekcoreco/public_html/vendor/magento/module-backend/Model/Locale/Resolver.php(60): Magento\Framework\Locale\Resolver->__construct(Object(Magento\Framework\App\Config), 'general/locale/...', 'store', NULL)
#4 /home/geekcoreco/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Backend\Model\Locale\Resolver->__construct(Object(Magento\Framework\App\Config), 'general in /home/geekcoreco/public_html/generated/code/Magento/User/Model/User/Interceptor.php on line 529

I've tried everything, I'm a bit lost now.
Any help would be very much appreciated. FYI the module I recently installed is Magstore Google Shopping module.

Running Magento v2.2.5


texts: Get cart items and subtotal value in static block

texts:
I want to get cart items and total value in my custom block section.

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('custom_block_id')->toHtml()  ?>

I called it in header.phtml.

This is my image tracking pixel for bronto

 <img alt=""
 src="http://www.example.com/public/?q=stream_conversion&amp;fn=Mail_Conversion&amp;id=blbimmbjoskvkqnahjntpjzmoqpsbdd&amp;type=$&amp;description='{{cart_items}}'&amp;money='{{cart_subtotal}}'"
 height="0" width="0" />

Instead of cart_items and cart_subtotal I want actual data. How can I do that?


texts: How to add a custom serialize value in sales_flat_quote_item_option table

texts:
Here my code but it does't work

 $action = Mage::app()->getFrontController()->getAction();
    //echo "<pre>";print_r($action);die;
    if ($action->getFullActionName() == 'checkout_cart_add')
    {
           //die("<br>.s");
           //$product = $observer->getProduct();
            //echo "<pre>";print_r($observer->getProduct());die;
            // add to the additional options array
            $additionalOptions = array();

                $additionalOptions[] = array(
                    'label' => 'comefrom',
                    'value' => $comefrom,
                );
            $observer->getProduct()
                ->addCustomOption('additional_options', serialize($additionalOptions));

    }

  This additional option filed I want to add in sales_flat_quote_item_option table in a serialize form.


texts: How to disable frontend for CMS/API-only, headless Magento 2.3

texts:
I'm currently working on a web-app that uses Magento 2.3 as a CMS-only. How can I disable the customer-facing frontend and leave only the admin pages accessible?

Alternatively, is there a way to set Magento theme so it returns a static html file (something like 404.html) when non-admin/rest routes are visited?


texts: missing js file after module files added

texts:
New to the magento 2
I am getting error JS while loading page, Any one know what exactly this issue.

Unable to resolve the source file for 'frontend/Magento/luma/en_US/modulename.js'
#0 C:\xampp\htdocs\modulename\vendor\magento\framework\App\StaticResource.php(97): Magento\Framework\View\Asset\File->getSourceFile()
#1 C:\xampp\htdocs\modulename\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\StaticResource->launch()
#2 C:\xampp\htdocs\modulename\pub\static.php(13): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\StaticResource))
#3 {main


texts: Magento 2.1: adding custom field in product form by ui component

texts:
I'm trying to add a new custom field in product form using Ui Component so I've created the install script, My/Module/Setup/InstallData.php:

<?php

namespace My\Module\Setup;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory /* For Attribute create  */;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
    /**
     * EAV setup factory
     *
     * @var EavSetupFactory
     */
    private $_eavSetupFactory;

    /**
     * Init
     *
     * @param EavSetupFactory $eavSetupFactory
     */
    public function __construct(EavSetupFactory $eavSetupFactory)
    {
        $this->_eavSetupFactory = $eavSetupFactory;
    }

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        /** @var EavSetup $eavSetup */
        $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);

        /**
         * Add attributes to the eav/attribute
         */
        $eavSetup->addAttribute(
            \Magento\Catalog\Model\Product::ENTITY,
            'file_uploader_attribute', /* File Uploader Attribute */
            [
                'type' => 'varchar',
                'backend' => '',
                'label' => 'File Uploader Attribute (Filename)',
                'input' => 'file',
                'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
                'visible' => false,
                'required' => false,
                'visible_on_front' => true
            ]
        );
    }
}

and the product Ui Component, My/Module/view/adminhtml/ui_component/product_form.xml:

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="file_uploader_attribute_fieldset">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">More Product Links</item>
                <item name="collapsible" xsi:type="boolean">true</item>
                <item name="opened" xsi:type="boolean">true</item>
                <item name="sortOrder" xsi:type="string">2</item>
                <item name="canShow" xsi:type="boolean">true</item>
                <item name="componentType" xsi:type="string">fieldset</item>
            </item>
        </argument>
        <field name="product[file_uploader_attribute]">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="formElement" xsi:type="string">file</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataScope" xsi:type="string">product[file_uploader_attribute]</item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

It has created new eav attribute into db and it has added element into HTML product form, all correctly.

The only issue is that the HTML element has not name attribute (see image) so the post request doesn't send the field value.

If I force in the code to set name attribute all works fine.

How can I set name attribute by Ui Component?


texts: How to get MOQ of child that inside the bundle?

texts:
How to get MOQ (default quantity) of child product option that inside the bundle?
Bundle itself doesn't contains any MOQ, so I need to find their child and get MOQ.
Child option may be simple products or Configurable products. But their MOQ was define inside the bundle.
Please help


texts: How to Join custom table to customer grid collection and show new column in Grid in Magento2

texts:
I want to add new column to customer grid and that new column is from my custom new table

how to do it in Magento2


texts:
I am trying to create a create a page in block but I'm trying to add a custom contact form. I can view it in frontend but it wouldn't work its not doing anything when I click submit.

is there anyone who could help me out or any suggestions

Is it good to create a new module for custom form?

How I'm calling the .phtml in CMS block

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="my_module::form.phtml"}}

but not sure why action="<?= $block->escapeUrl($block->getFormAction()) ?> isn't working in .phtml


texts: How can you set the customer group pricing for specific logged in ids as 50 percent discount for all products in magento2?

texts: How can we enable the customer group pricing for a specific set of the customers and even reflect that price while adding items to cart as well from Magento storefront screen?


texts: How can I use different emails on contact us page?

texts:
We have a contact us page, and we have the fields: Name, Email, Telephone, Reason, and Message.

We have different people who deal with different things, so we were thinking the reason could be the variable which decides which email the contact form should be sent to.

Can anybody push me in the correct direction for this?

Thank you!


texts: How to Save Front-end Feedback Form Data in database table Magento 2

texts:
I want to save form data in a table, I searched a lot of stuff but unable to do it

here i created a form in form.phtml file

<form >
    First Name
    <input type="text" id="fname" name="firstname" placeholder="First Name">

    Last Name
    <input type="text" id="lname" name="lastname" placeholder="Last Name">

    Email
    <input type="text" id="email" name="email" placeholder="Email-Id">

    Mobile No.
    <input type="text" id="mobile" name="mobile" placeholder="Mobile Number">

    Feedback
    <textarea id="feedback" name="feedback" placeholder="Write something.." style="height:200px"></textarea>

    <input type="submit" value="Submit">
</form>

please tell me what changes in phtml file and how I save this form data in a table

I am able to create a table with the proper field but unable to save data in the table


texts: Disable/Enable widget in Magento 2 admin

texts: I need to enable and disable a widget from time to time in admin. I don't see a disable/enable switch please advise how it can be done.


texts: Magento 2 - Where is the best place to save temp files

texts:
I need to save same temp file, now I'm using:

/**
*Magento\Framework\App\Filesystem\DirectoryList $directoryList
*/
$this->directoryList->getPath('media')

But I need same place where this files will be deleted same day.

Where is the best place to put this files?


texts: Massive display problem (css not loaded?) depending on used internet browser

texts:
My pages (www.worg.ch and www.luxury-silk.ch) look good under IE and Google Chrome, but www.worg.ch is not displayed correctly in Firefox. Perhaps the CSS files are not loaded? luxury-silk Looks good on Firefox.
Any idea how to solve the Problem?

IE

Firefox


texts: Cannot locate an inline css in product page

texts:
I have installed a theme and trying to edit it. On product page I have found some blank space and while troubleshooting I have found that it is an effect of an inline css but I am unable to locate where is that inline css placed.

Please guide me in this.


texts: Magento 2.3 - Paypal error 500 (order not created)

texts:
"What's happening?"
When someone places an order, goes to Paypal website, login to Paypal account, and pay with no issues at all, but when coming back to website it gives an error 500. The order is not created, but all the order info are in the quote tables. It don't show any error in the logs at all, just after a little while start showing the error 'The "xxxxx" order ID is incorrect...'.

"What was tried?"
So I thought about creating a clone to disable every module to see if was an error in any module, but funny thing, it all works fine in an exact copy of the live website. The only differences that I can remember are Cloudflare (the clone don't have it) and the traffic in the website (same thing, in the clone it's just me), I tried to test in the live website with only like 2 customer and error still persist so I'm not sure that traffic is the problem.
Now I ask, what can cause this? What can I do to debug this?
EDIT
So I tried to disable Cloudflare (Pause in website), and all ended the same, so I think I can say it's not cloudflare fault.


texts: Dataflow/Magmi/Pricing - How to set "use config" for certain fields?

texts:
I'm trying to update pricing for 2k+ items in our store.

The problem: When done with the import, each product is setting the wrong values for both:

"Apply MAP" - (defaulting to No)
"Display Actual Price" - (defaulting to In Cart)

http://linenwoods.com/test/pricing.jpg

This causes the prices to not show up on the front end. I want each product to use Use config for those fields. I didn't see a header for them (when exporting all products through Dataflow) so I'm unsure of what to do.

How can I set those fields to use config when importing with Magmi?


texts: Apple Safari Column Layout Issues on Category pages Magento 2.3

texts:
I am hoping someone will be able to give me some advice.

I have noticed that when using Apple Safari browser, the columns on our product category pages do not seem to line up. I have the left hand column but the right hand column appears underneath.

Here is an example page if you have Safari: https://www.valvesonline.co.uk/solenoid-valves/brass-solenoid-valves.html

I am not sure if it is a viewport setting or something else.

Any advice would be greatly appreciated

Many thanks


texts: M2 early patches are not available for some auth keys

texts:
Magento sends an email to vendors before announcing officially about security patch to provide vendors possibility to upgrade/patch M2 beforehand.

We have two Commerce Edition projects with different credentials in auth.json:

{
    "http-basic": {
        "repo.magento.com": {
            "username": "*****************",
            "password": "*****************"
        }
    }
}

The interesting point, that for one project, new patched M2 is available, for another - not.

The result of:

composer show magento/product-enterprise-edition --all

will provide different results. Changed to the good keys for testing purpose, and it works (shows all available new versions)

Have someone faced with a similar issue?


texts: I have magento2.0.2 version,and added a flat rate of $10 per item in the backend but it doesn't show in front end


texts: Need to set custom shipping rates magento 2

texts:
I Need to set custom shipping rates for table rate shipping method, Through observer in magento2,

By default shipping charges is coming from table rate CSV, I created some condition in observer, Any one have suggestion then please share

Observer code:

$order= $observer->getData('order');
$price = 100;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$quote = $observer->getEvent()->getQuote();
$quote->getShippingAddress()->setShippingMethod('tablerate_bestway');
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->getShippingAddress()->collectShippingRates();
$address = $quote->getShippingAddress();
$address->setShippingAmount($price);
$address->setBaseShippingAmount($price);
$rates = $address->collectShippingRates()->getGroupedAllShippingRates();


texts:
Mangento has something that is called dynamic events. This are events dispatched as follows

$this->eventManager->dispatch($this->eventPrefix . '_load_before')

After what rules is the value in $this->eventPrefix built and who(which entity) is in charge of doing it?


texts: Flush Static Files Cache button is missing from Magento 2 backend

texts:
In the Magento 2.2 backend, the Flush Static Files Cache button is not appearing under the Advanced Cache Management

Any help is appreciated.

Thanks


texts: Getting listing of all available data passed with an event

texts:
I'm working with this event dispatch: dispatchEvent('nextbits_form_save_after',array('form_data'=>$params, 'form_model'=>$formModel)); but I don't have any documentation on it.

The event fires after a contact form is submitted, and I need to do some routing to deliver the posted data to specific email addresses based on some of the choices on the form, etc. How can I get a listing or enumeration of the data that is passed with the event?

I was thinking something along the lines of:

$request = $observer->getEvent()->getData(‘form_data’);

and then

foreach ($request as $k => $v) $output .= "Key: '".$k."' | Value: ".$v."<br>";

...but I get no response from that....


texts: Trying to call image in backend adminhtml less file

texts:
I am using  below css property inside a less file

background: url('../images/button-read-more.png') no-repeat left top;

this is addded in custom module
app/code/Vendor/ModuleName/view/adminhtml/web/css/source/content-type/quote-item/_import.less

so wen image is being called it check at Magento/base module instead of Magento/backend

pub/static/version1591023269/adminhtml/Magento/base/default/vendor_modulename/images/button-read-more.png

I am unable to find a solution .


texts:
How can I add cutom options display in the product page:

I need to add custom options in product view pages, but I also need to display custom options in category pages.
What I want is to be able to select options and then add the product to the cart (user says it will be good). Please explain or let me know!

Thanks.


texts:
I have received an order where user chose "Bank Transfer" as payment method but in order totals I've found "Cash on delivery" as payment method (by selecting this payment method user has to pay an extra fee).
The order totals are now wrong because of this extra fee.
why do I find a payment method that the user did not select in order totals section?
I've analyzed other orders with bank transfer payment method but they have not this issue.


texts: Date Formatting Options - getCreatedAtFormatter($format)

texts:
The new order transactional email template passes in the number "2" and creates the format including the time. I wish to display just the Date.

I would like to know what the different format options are for this?


texts: How to add confirm email at checkout form in Magento 2.2.0

texts: I need to add confirm email field to the checkout page. I could not trace the file path - from where does it appear? Could anyone tell me the path for the checkout form?


texts: Magento 2.1.8 database move to another installation

texts:
I've tried to move my Magento database to the another fresh Magento installation.
So in Plesk panel, I've created MySQL dump and save on my HDD and then imported this to new installation but after that, I have no names on my category also can't see Products when you click on catalog (security reason can't see this page).

There are about 1800 Products. How can I perhaps transfer just Products Categories and Attributes to the new installation?

Old Installation:
There was migration database from 1.9 to 2.1 and it looks like this migration wasn't perfect.


texts: Magento 1.9.3 additional information under details

texts:
On the product view page the additional information is next the details. (tabs)

I want the additional information under the details.

So:
Details
Additional information
Review


texts: How can i solve Magento 2 Server migration error?

texts:
Magento 2 Server migration error below:

{"0":"Expecting a string, got NULL","1":"#1 Laminas\Uri\Uri->parse()
called at
[vendor/magento/module-backend/App/Area/FrontNameResolver.php:140]\n#2
Magento\Backend\App\Area\FrontNameResolver->getHostWithPort()
called at
[vendor/magento/module-backend/App/Area/FrontNameResolver.php:129]\n#3
Magento\Backend\App\Area\FrontNameResolver->isHostBackend() called
at
[vendor/magento/module-backend/App/Area/FrontNameResolver.php:106]\n#4
Magento\Backend\App\Area\FrontNameResolver->getFrontName() called
at [vendor/magento/framework/App/AreaList.php:76]\n#5
Magento\Framework\App\AreaList->getCodeByFrontName() called at
[vendor/magento/framework/App/Http.php:111]\n#6
Magento\Framework\App\Http->launch() called at
[vendor/magento/framework/Interception/Interceptor.php:58]\n#7
Magento\Framework\App\Http\Interceptor->___callParent() called at
[vendor/magento/framework/Interception/Interceptor.php:138]\n#8
Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
called at
[vendor/justbetter/magento2-sentry/Plugin/GlobalExceptionCatcher.php:43]\n#9
JustBetter\Sentry\Plugin\GlobalExceptionCatcher->aroundLaunch()
called at
[vendor/magento/framework/Interception/Interceptor.php:135]\n#10
Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
called at
[vendor/magento/framework/Interception/Interceptor.php:153]\n#11
Magento\Framework\App\Http\Interceptor->___callPlugins() called at
[generated/code/Magento/Framework/App/Http/Interceptor.php:26]\n#12
Magento\Framework\App\Http\Interceptor->launch() called at
[vendor/magento/framework/App/Bootstrap.php:261]\n#13
Magento\Framework\App\Bootstrap->run() called at
[pub/index.php:40]\n","url":"/admin_10kazc/","script_name":"/index.php","report_id":"90e2b534b0f76333aeeeebbbbd560354ca8fe551a1de591db24895af3721b2bc"}


texts: Save Product custom filed data to sales_order_item table custom field from in Magento 2

texts:
I have created custom column in sales_order_item table, I am trying to save product custom field data to sales_order_item custom filed. But I am unable to save.
tried the way to create field as below:
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="sales_order_item" resource="sales" engine="innodb" comment="Sales Order Item">
        <column xsi:type="varchar" name="custom_message"   nullable="true" comment="Custom Message"/>
    </table>
</schema>

Any suggestions to do?


texts:
How can I get the product category's URL Key?

I can get the category name by $category->getName() but it does not work if I use this $category->getURLKey(),

$categories = $_product->getCategoryCollection()
    ->addAttributeToSelect('name');

foreach($categories as $category) {
    $productCategoryName = $category->getName();
    var_dump($category->getURLKey());
}

Return null

Any ideas?


texts:
I have grid in my custom tab.

Need to validate my checkboxes, atlease select one checkbox before submitting the form.

Please have a look at attached screenshot.

help me in this. Thank you!


texts: Is it possible to generate merged static contents programmatically in magento2? There is issue with sync merged static contents in CDN, multi-server setup with load balancer.


texts:
When I am trying to access admin URL it gives 404 error page in magento2.

Also, I tried to clean cache
rm -rf  var/cache/* but not working


texts: Bundle Item won't list Downloadable items

texts:
For Magento 1.7.0.2

My new bundle item, when I search items to add to the bundle, it only lists virtual and simple. I need downloadable. How do I get this?

Other information:
1. I'm switching to another platform in two months, so I'm not interested in upgrading to 1.9
2. I use jfusion with my Joomla sites, so upgrading would cause a ton of headaches there. So again - I'm not doing it.
3. I cached and re-indexed
4. I create this bundle every year. Last year's 2014 bundle I duplicated and removed the bundle items that were in there and went to add the new ones - and none of the downloadable items appear. Never ran into this issue before.


texts: How to move test store to new directory or domain?

texts:
I am messing around with a test store so I can get my settings right and theme adjusted.  My plan is to move from Bigcommerce to Magento 2.0, so I want to have it all ready to go before I move and "flip the switch".

Any tips on how to easily move that installation from my test directory to a new folder or domain?


texts: Magento performance issue in our site having huge data and backend jobs running

texts:
We have more then more then 2L products and 10L orders exists in multiple stores in our magento site. I was told to optimize the performance on some point of actions.

Magento ver. 1.9.1.0

Admin Catelog Product Grid.
Admin Order Grid.

Because we have noticed that when our sales team working on back-end mostly they are using product or order grid which is then executing some sql queries without having limit in it.

Examples:

SELECT `e`.*, `at_qty`.`qty`, `at_status`.`value` AS `status`, `at_visibility`.`value` AS `visibility`, `e`.`market_status` FROM `catalog_product_entity` AS `e` LEFT JOIN `cataloginventory_stock_item` AS `at_qty` ON (at_qty.`product_id`=e.entity_id) AND (at_qty.stock_id=1) INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '84') AND (`at_status`.`store_id` = 0) INNER JOIN `catalog_product_entity_int` AS `at_visibility` ON (`at_visibility`.`entity_id` = `e`.`entity_id`) AND (`at_visibility`.`attribute_id` = '91') AND (`at_visibility`.`store_id` = 0) INNER JOIN `catalog_product_entity` AS `table_alias2` ON e.entity_id = table_alias2.entity_id ORDER BY `e`.`entity_id` DESC

SELECT DISTINCT e.entity_id FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_product_website` AS `product_website` ON product_website.product_id = e.entity_id AND product_website.website_id = '2' INNER JOIN `catalog_product_entity_varchar` AS `at_name` ON (`at_name`.`entity_id` = `e`.`entity_id`) AND (`at_name`.`attribute_id` = '60') AND (`at_name`.`store_id` = 0) INNER JOIN `catalog_product_entity_varchar` AS `at_custom_name` ON (`at_custom_name`.`entity_id` = `e`.`entity_id`) AND (`at_custom_name`.`attribute_id` = '60') AND (`at_custom_name`.`store_id` = 0) INNER JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '84') AND (`at_status`.`store_id` = 0) INNER JOIN ;

`catalog_product_entity_int` AS `at_visibility_default` ON (`at_visibility_default`.`entity_id` = `e`.`entity_id`) AND (`at_visibility_default`.`attribute_id` = '91') AND `at_visibility_default`.`store_id` = 0 INNER JOIN `catalog_product_entity` AS `table_alias2` ON e.entity_id = table_alias2.entity_id;

I have checked this query by running in mysql workbench, they are taking long time to execute.

My senior suggest me to apply a limit of 5000 on all such queries to fix performance issue immediately.

Please help or suggest me the best way to do this.


texts: when trying to update or disable the cache site does not work magento 2.2.3

texts: I am new in Magento, i need help When trying to update or disable the cache site does not work magento 2.


texts: in which file can control total price on magento2

texts:
we want to do a dev like the following image:

if the product is 1th-100th , each price of the product is 190€
if the product is 101th-150th , each price of the product is 250€
if the product is 151th-175th , each price of the product is 500€
if the product is 176th-200th , each price of the product is 1000€

the max-stock is: 200 , and if customer want to buy 120 products
the current total price should be:  20*190 + 50*250 + 25*500 + 25*1000 = 53800
and the unit price should be: 53800/120 = 448.3333333 ≈ 448.33

after doing the dev on Quote\Model\Quote\Address\Total\Subtotal.php  protected function _initItem($address, $item)
the unit price is ok , but the total price still not ok , it becomes to 448.33*120=53799.60 , right algorithm should be :
20*190 + 50*250 + 25*500 + 25*1000 = 53800

but i can't find the file which to change this functionality , is any one can help me?

thank you for your reply.


texts:
My understanding is that the "weight" field in products does not actually "mean" anything.  If you want it to mean pounds, then be consistent . . . if you want it to mean "kilograms", then again, be consistent.

That said, I was testing my Fedex that I just setup, and it seems the rates are absurdly high.  That made me wonder how Fedex is calculating the rate?    Presumably it uses the "weight" field . . . what about dimensions?  How (if at all) does it calculate that info?

Just trying to figure it out to see if this will suffice or if I will need to get an extension.


texts:
Just wondering - how are you meant to sort the order of associated products?
It seems that they are sorted by their "ID", from smallest to largest.

If you forget to add an associated product, for example an XS Variant, and then add it - this will appear at the end, after the XXL etc. Or if you add a US8 after you've already added US10, it will be in the order US9, US10, US8 etc

Any ideas? There isn't an ordering column that is obvious.


texts: How to enable database logging without modifying the core?

texts:
I am afraid that this might be a rhetorical question, but:

Is there any other and cleaner way to enable DB logging then modifying the file Varien/Db/Adapter/Pdo/Mysql.php and set $_debug and $_logAllQueries to true?


texts: Unset shipping rate by code, in checkout

texts:
In some cases, I need to unset or reset shipping rates. So what I need to do is to get all available rates for given address in checkout, check some variables, and based on the result to unset some rates.

I'm trying to do this in an Observer like:

$event = $observer->getEvent();
$quote = $event->getQuote();
$_rates = $quote->getShippingAddress()->getShippingRatesCollection();
foreach ($_rates as $key => $_rate):
    if($_rate->getCode() == 'xxx'){
        unset($_rates[$key]);
    }
endforeach;

The above example code is not working ok. I need to figure out how to unset the specific rate and update the rates collection in quote.

UPDATE-----
The unset() is returning an error:

Cannot use object of type Mage_Sales_Model_Resource_Quote_Address_Rate_Collection as array

Any suggestions?


texts:
Login to the website frontend in a customer account.
Click on "Account information" and edit some information (firstname, lastname, ...). Click on the save button. Now login to the magento backend and click on customers -> manage customers. Now you see the grid with the correct "updated_at" timestamp.
Login to the website frontend again. Click on "Account information"
And now click on "Addressbook" and edit some information. Click on the save button. Now go to the magento backend and click on customers -> manage customers. Updated_at is not changed.

Now i have a observer. But there is no effect if i click the save button in the customer account / adressbook in the frontend.

How i can set new updated_at timestamp for the address book also:

Easylife_Meta.xml

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

Observer.php

<?php
function autoMetaDescription(Varien_Event_Observer $observer)
{
$_address = $observer->getCustomerAddress();
if (!$_address->hasDataChanges())
{
return $this;
}
$_customer = $_address->getCustomer();
$_customer->setUpdatedAt(Varien_Date::now())
->save();
}
?>

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Meta>
            <version>0.0.1</version>
        </Easylife_Meta>
    </modules>
    <global>
        <models>
            <easylife_meta>
                <class>Easylife_Meta_Model</class>
            </easylife_meta>
        </models>
    </global>
    <frontend>
        <events>
            <customer_address_save_after><!-- observe the event -->
                <observers>
                    <easylife_meta>
                        <class>easylife_meta/observer</class>
                        <method>autoMetaDescription</method>
                    </easylife_meta>
                </observers>
            </customer_address_save_after>
        </events>
    </frontend>
</config>


texts:
Up to versions 2.2 (including it) you could uninstall modules installed via composer and when you did that the method uninstall from Setup/Uninstall.php will be executed.
Basically this was the place to drop the tables that the module added and remove all the data. And do other fancy stuff.
Magento 2.3 now has a declarative schema and patches instead of InstallData.
Is there an uninstall equivalent for magento 2.3 ?
I know that the installSchema and installData and Uninstall still work in Magento2.3, but I want to know if there is an alternative (best practice).

As an exercise, I have a module that creates a table my_table.
On uninstall I want to drop that table and remove from core_config_data all the rows where path like 'my_module/'.


texts: Website van wordpress omzetten naar Magmento?

texts:
Wij lopen al een langere tijd tegen een aantal problemen aan met onze website AEDmaster. Het is namelijk zo dat wij de website graag verder willen upgraden, zodat deze sneller wordt. Onze huidige website is in Wordpress gebouwd en de webbouwer geeft aan at hij op zoek gaat naar een andere plugin. Echter heb ik het idee dat al die plugins niet bijdragen aan een snellere site.
Mijn vraag is of dit ook met een website van Magmento geldt en of het eennvoudig is om een wordpress site om te zetten naar een magmento site?
Ik hoop dat er iemand id die mij verder kan helpen.


texts:
I recently have the problem that the yellow block with the total order on the bottom right of the sale order info page stays empty.
I looked into the files and found out that in /app/design/adminhtml/default/default/template/sales/order/view/tab/info.phtml the following lines should display the content

<?php echo Mage::helper('sales')->__('Order Totals') ?>

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

The divs are shown, but the second one is empty, so $this->getChildHtml('order_totals') doesn't do anything. In the other *.phtml files everything seems ok, but in the layout sales.xml file i find things like this:

<block type="adminhtml/sales_order_totals" name="order_totals" template="sales/order/totals.phtml">
    <block type="adminhtml/sales_order_totals_tax" name="tax" template="sales/order/totals/tax.phtml" />

</block>

So all the item files are commented out, but the overview should work, i think. Still I uncommented it but it doesn't make any difference.

What do I have to do that the order totals are shown?


texts: Shipping calculated by weight and calculated by price for different products in the same store

texts:
Is it possible to have shipping calculated by weight and shipping calculated by price at the same time in the same store?

For example some products will be calculated by weight and some products calculated by price during checkout.

Please help.


texts: add button inside custom column in sales order grid page

texts:
I added new column in Sales Order Grid & successfully added title [say download] of column, now i want to add button [ say button name download1] for all rows of that column.

I did't created any column in database as i dont want to fetch anyy value from database.

app/code/community/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php :
Function : _prepareColumns()

$this->addColumn('download',
            array(
                'header'=> Mage::helper('sales')->__('download'),
                'width' => '70px',
                'index' => 'download1',
                'type' => 'text'
            ));


texts: How to change front end text in payment information section in Magento 1.9.2.1

texts: Here is the snapshot for your reference.


texts: Is it possible to call multiple endpoints in a controller test

texts:
I am implementing a controller test, where I add some product to the cart and want to check its price:

It looks like I can call dispatch only once?

$this->dispatch('custom/add/?foo=bar');

$this->assertRedirect($this->stringContains('checkout/cart'));

$this->setUp();
$this->dispatch('checkout/cart');
$this->assertRegExp('#.*999\.00#', $this->getResponse()->getBody());

I already tried to call setUp to clear the state, but still the first action seems to be called on the second dispatch call.

EDIT:

\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize();

is also not helping


texts: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() magento 2

texts:
Fatal error: Uncaught Error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strpos() in /home/hydromarket/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php:500 Stack trace: #0 /home/hydromarket/public_html/vendor/symfony/polyfill-mbstring/bootstrap.php(34): Symfony\Polyfill\Mbstring\Mbstring::mb_strpos('/home/hydromark...', '/home/hydromark...', 0, 'UTF-8') #1 /home/hydromarket/public_html/vendor/magento/framework/Filesystem/Directory/PathValidator.php(60): mb_strpos('/home/hydromark...', '/home/hydromark...') #2 /home/hydromarket/public_html/vendor/magento/framework/Filesystem/Directory/Read.php(82): Magento\Framework\Filesystem\Directory\PathValidator->validate('/home/hydromark...', '/var/.regenerat...', NULL, false) #3 /home/hydromarket/public_html/vendor/magento/framework/Filesystem/Directory/Read.php(210): Magento\Framework\Filesystem\Directory\Read->validatePath('/var/.regenerat...') #4 /home/hydromarket/public_html/vendor/magento/framework/Code/GeneratedFiles.php(66): Magento\Framework\Filesyste in /home/hydromarket/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 500

I have try run composer require symfony/polyfill-iconv, but it doesn't work. We are using CENTOS 7.6 xen hvm. Do you have any idea?


texts: Sitemap won't generate - sitemap.xml is created but only contains 2 lines

texts:
We're having trouble with the Google sitemap feature in Magento 1.9.0.1. When generating the sitemap the error "Unable to generate the sitemap.".

The file sitemap.xml is created but only contains the following lines:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

We've tried adding a new sitemap and changing the location of the sitemap.xml file but that doesn't change anything.

Any help on the matter would be greatly appreciated.


texts:
Magento is confusing. I want to modify how the address in the front end displays but I can't locate where it should be modified.

In the checkout page,the address fill out form shows in this order:

Street Address
Municipality
Prefecture
Zip Code
Country

But I want it in japan address format:

Country
Zip Code
Prefecture
Municipality
Street Address

Do you have any tips on how to find the page easily?


texts:
When I print a pdf of a particular invoice, I'd like it to include order comments as well. I have no idea what files I need to edit to make this happen.

I tried following the instructions here to no avail.


texts: Magento 1.9 (.3.1) CSS auto-reverted to an older version

texts:
We're using a custom theme built on top of rwd theme and when I do changes to our theme's CSS files, everything is fine for next about a day or two, then those changes are auto-reverted to previous versions of the same CSS files. JS and (p)HTML files are NOT affected, only CSS. I did look if we have (we took over the store, not build it) a scss/sass/less auto-compiler and I can't find it, so this is not causing problems.

I am not an expert in Magento but I do know my way around it, but this issue is really mind-boggling. I also noticed that there's no similar issue to be found on Google ...

Does any of you have an idea what could be causing this restoration of old CSS files? There's not backup solution set, so this is out of the question.

We're not merging CSS and JS files, they are being served directly.

Any help would be greatly appreciated!


texts: Remove product from wishlist using customer id and product id in Magento2?

texts:
How to remove product from wishlist using customer id and product id programmatically? I searched alot about it, But the results are remove wishlist item using item id only. So is there any way to remove wish list item using customer id and product id only?

Please suggest me how can I get this done.

Thanks.


texts: Is it possible to load only specific components of magento?

texts:
Does anyone know if it is possible to load specific components from the core of Magento. For example I am looking at building a custom XML-RPC for a remote system that interacts with Magento.

I have two options, I can build it into Magento and deal with the very slow times due to the level of abstraction and how Magento is built, or I can build a stand alone system that interacts directly with the database.

Both methods seem to be poor options. What I would like to know...  Is it possible to simply autoload only the components I need for my few calls. This way I can still leverage the Magento system via their own classes, but not have all the overhead and baggage that slows the system down.


texts:
Synopsis

I am attempting to create a drop-down box with JavaScript where by I would like to dump my collection results through toOptionHash, however all i am getting is an array of null values.

I will be encoding to JSON and setting the response body however this is outside the scope of this question.

$result = Mage::getModel('cutting/plate_thickness')->getCollection()
    ->addFieldToFilter('main_table.spec_id', $specId);

Zend_Debug::dump( $result->toOptionHash('id', 'size') );

This outputs:

array(41) {
  [1] => NULL
  [2] => NULL
    ... snip ...
  [40] => NULL
  [41] => NULL
}

Although I could do the following - I want to make use of the toOptionHash which is what it exists for?

$result = Mage::getModel('cutting/plate_thickness')->getCollection()
    ->addFieldToFilter('main_table.spec_id', $specId);

$data = [];
foreach ($result as $record) {
    $data[$record->getData('id')] = $record->getData('size');
}


texts: Magento 2 Extension Packaging: How to include sample CSV file in var directory

texts:
Recently I developed my first magento 2 extension. In this extension I am going to give admin an option to import a CSV. For that I have given a sample CSV to download.

In My development server its inside var directory. And I am able to access.

$sample_file = $this->_objectManager->get('\Magento\Framework\Filesystem\DirectoryList')->getPath('var') . '/my_sample.csv';

I was wondering how to include this sample file while packaging the extension and upload to magento marketplace.

Is there any other alternative?


texts: Magento 2 How to fix Error site has been blocked by CORS policy

texts:
I have Developed a custom API its working fine in Postman, but its not working in another platform.
How to fix this issue.
I tried by updating root .htaccess
RewriteEngine on
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ "index.html" [R=200,E=API:1,PT]
<IfModule mod_headers.c>
    SetEnvIf Accept application/json API
    Header always set Access-Control-Allow-Origin "*" env=API
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" env=API
    Header always set Access-Control-Allow-Headers "Access-Control-Allow-Headers, Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization" env=API
</IfModule>

Still am getting error as 'http://mysite/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Where am doing wrong. Can I get Help? Thank you.


texts: Add to cart button on product list page doesn't add to cart

texts:
I've just upgraded from 1.6.2.0 to the latest 1.9.2.4. I've noticed an issue on product list pages, where the Add to Cart button now doesn't actually add the product to the cart - it simply takes you to the product detail page.

This is because in the onclick event the query string (options=cart) is missing. I have tracked this down and it seems to be as a result of some changes to Mage_Catalog_Model_Product_Url->getUrl(), whereby a product's URL is generated once and subsequently is retrieved from a stored version. This is an issue because query parameters passed through to that method have no effect!

Here's the onclick event:

onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"

It seems to be identical to the base theme's markup.

Am I missing something or is this a bug? And what would be the best way of remedying it?


texts: Contact Us and Add to Cart forms not secure

texts:
I have setup my site (Magento 1.9 CE) to use SSL. This was done in the configuration (System > Configuration > Web > Secure) and with Apache redirects.

When browsing the site, the browser (Chrome) marks Contact Us and Product View pages to have insecure content.

Both of these are related to the submit form. Upon closer inspection of the template files:

/template/contacts/form.phtml

<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">

/template/catalog/product/view.phtml

<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>

While I realize I could simply change the form actions with getUrl(), I was wondering if there is a right way to fix this considering this was core code.


texts: Get email templates defined in admin panel in custom module

texts:
I'm writing a module that sends some emails to customers.
Right now it works just fine with the email template defined in my code. Thing is I want other non-developer users to be able to access that template in the admin-panel.

Is there a way I could define a template in the back-office and call it in my  code ?


texts: Set product reviews limit and pagination

texts:
I have large number of product reviews being displayed on product detail page.

I need to count the total number of reviews and set limit on the number of reviews displayed and with pagination.

Does Magento default has this feature ?

How can I achieve this.

Thanks.


texts:
I've got a query which returns the orders by considering a condition on the column "maxvalue":

Mage::getModel('sales/order')->getCollection()->addFieldToFilter('maxvalue', 'bla')

It generates following invalid SQL :

SELECT `main_table`.* FROM `sales_flat_order` AS `main_table` WHERE (maxvalue = 'bla')

Since a mysql upgrade, "maxvalue" is a reserved keyword, it can not be left unquoted. So it must be:

... WHERE (`maxvalue` = 'bla')

... addFieldToFilter('`maxvalue`', 'bla')

Is it possible to set globally a kind of auto-column-name-quotation for the query builder?

UPDATE..
I'm using an extensioon which is ioncube-obfuscated, so there is no possibility to change the code. So I thought there would be another solution e.g. auto-quotation of field names by setting a global directive.


texts: TypeError: stepNavigator.setHash is not a function in checkout Magento 2

texts:
TypeError: stepNavigator.setHash is not a function

I have a javascript error in the console like above, because of this error some shipping method is not showing properly.

Can anyone please tell me how to resolve this error?

I am using Magento 2.2.6.


texts: Magento 1.9 add category root in grid column

texts:
I have already a column with category that I call from database. for exemple I have Women as main category and then their subcategory Tops & blouses and Pants & Denim .
So what I need to implement is like Women->Pants & Denim in a column grid.I've tried with a foreach but I can't display results in the column.

this is my Grid.php

class Ns_Thorleif_Block_Adminhtml_Commerciaux_Grid extends Mage_Adminhtml_Block_Widget_Grid
{

    public function __construct()
    {
        parent::__construct();
        $this->setId('commerciaux_grid');
        $this->setDefaultSort('entity_id'); // Order by entity_id ASC
        $this->setDefaultDir('ASC');
        $this->setSaveParametersInSession(true);
    }

    public function _prepareCollection()
    {
        $subcategories = Mage::getModel('catalog/category')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->getCollection()
            ->addAttributeToSelect('*')
            //->addAttributeToFilter('parent_id', array(2, 37))
            ->setOrder('parent_id', 'ASC');//if you want them somehow grouped by parent_id

        $categories = array();
        foreach ($subcategories as $category) {
            //do something with $category
            if ($category['level'] > 1) {
                $categories[$category['entity_id']] = array($category['entity_id'], 'name' => $category['name'],'route' => $category['level']);
            }
            var_dump($categories);
        }

        $collection = Mage::getModel('thorleif/commerciaux')->getCollection();
        $collection->addFieldToFilter('entity_id', array("nin" => array(1,2))); //Where entity_id not in (1,2)
        foreach ($collection as $row) {
            $retour .= $row->name.'<br />';
        }

        //return $retour;
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

    public function _prepareColumns()
    {
        $this->addColumn('entity_id',
            array(
                'header' => 'ID',
                'align' => 'left',
                'width' => '10%',
                'index' => 'entity_id'
            )
        );
        $this->addColumn('name',
            array(
                'header' => 'Category Name',
                'align' => 'left',
                'index' => 'name'
            )
        );
        $this->addColumn('route',
            array(
                'header' => 'Route',
                'align' => 'left',
                'index' => $category['name']
            )
        );
        $this->addColumn('linio',
            array(
                'header' => 'Linio Category',
                'align' => 'left',
                'index' => 'linio'
            )
        );
        $this->addColumn('tax',
            array(
                'header' => 'Tax',
                'align' => 'left',
                'index' => 'tax'
            )
        );
        $this->addColumn('action',
            array(
                'header' => 'Action',
                'align' => 'left',
                'index' => 'action'
            )
        );
        return parent::_prepareColumns();
    }
}

my grid look like this

and There is a way to put the grid into a form with form header title?

Thanks in advance.


texts: Edit the category page in html source (1.8)

texts:
The category page of my Magento 1.8 webshop.

There is a display: none  in the source on the category title in this div:

<div class="page-title category-title">

It's ok for me that this is invisble, but I don't like the display: none css solution. I prefer to delete this line/div from the source.

Only thing is I cannot find the file on the server that contains this.

Could anyone point me in good direction?


texts:
How to create an event on customer remove from backend.?
what is the name of the event?
I need to remove customer's data from my custom table after removing a customer from the backend.


texts: Magento 2.3.5: Home Page Banner not Load Properly

texts:
Hello I have used Banner Slider extension at Home Page, here is Banner Extension: Link.
But when site load the banner was not display properly, after full page load its look perfect, but during loading, it does not display properly,
Here is Image that shows the banner:
https://snipboard.io/CoTsdb.jpg
Please let me know how to fix this?


texts: Multilevel filter in backend in magento2

texts:
Is it possible to apply filter on another filter in admin grid in magento2 ?

Get the solution if possible


texts: i am building this site in porto 6.0.6 in wordpress and i want to remove the extra space under the copy rights line. i've tries to remove it through custom css but nothing happened. so anyone can help me with this issue please.


texts: Any future update planned for Magento1 to be combat upcoming GDPR changes?

texts:
Does anybody know if Magento1 will release an update this month to be compatible with the GDPR changes due to be in place before the 25th of May 2018?

Just wondered if Magento ver. 1.9.3.9 was planned to be released in time and would include changes to the admin area settings to allow stores to update policies/framework etc for GDPR.


texts: How create 4 custom footer links blocks with titles Magento 2?

texts:
How create 4 custom footer links block Magento 2?
There are many similar themes, but unfortunately there is no solution for several blocks.


texts: How to track source & medium of all sales in Magento dashboard?

texts:
I have a new Magento eCommerce store 2.3 of my website and recently migrated from Shopify to Magento.

In Shopify, I was able to find all sources & mediums (like google ads, Facebook, Instagram, etc.) in the sales data but here in Magento, I couldn't find any.

Do I need to install any extension to get these details or I am looking at the wrong place?

Please help!


texts: How to get the list of attributes on frontend in Magento 2

texts:
I'm using Magento 2, when I try add product in Backend, in the Configurations tab, I have created Configuration and I saw there three attributes.

How can I get them in a module on frontend?

I see they are stored in eav_attribute table but I dont know which SQL can be do it, because it has no conditional column

Thank so much!


texts: How to add a logo for a payment method OTHER than PayPal

texts: similar to the PayPal logo at the checkout page, I would like to add a logo for Cash on Delivery and Bank Transfer. How to go about that?


texts: Magento PWA Studio: Where's my React At?

texts:
How do I edit and add to components in a PWA Studio React application?
Using the buildpack tool, I've installed the PWA scaffolding with the following command.
buildpack create-project /tmp/zing \
    --template "venia-concept"\
    --name "zing"\
    --author "me <me@me.com>"\
    --backend-url "https://mymagentourl.example.om/"\
    --braintree-token "a token" \
    --npm-client "npm"\
    --no-install

This gives me a Node.js application in the zing folder.  If I start this application in developer/watch mode
$ cd zing
$ npm install
$ npm run watch

I get a server at http://localhost:10000 that serves out a React based application AND acts as PWA Studio's Upward server.  Communication between my Upward server and Magento instance appears to be working -- the Venia application is grabbing the Venia sample data in installed in my Magento instance.
What's unclear to me is: Where are my React components? How do I start editing the existing Venia application and/or adding my own components to this application?
In src/index.js folder I see a bunch of bootstrapping code, including this
#File: src/index.js
// ...
import { Adapter } from '@magento/venia-drivers';
// ...
import App, { AppContextProvider } from '@magento/venia-ui/lib/components/App';
// ...
ReactDOM.render(
    <Adapter apiBase={apiBase} apollo={{ link: apolloLink }} store={store}>
        <AppContextProvider>
            <App />
        </AppContextProvider>
    </Adapter>,
    document.getElementById('root')
);

I presume (but am uncertain that) this is <Adapter/> is the top level React component?
Regardless of that, it's unclear what starts adding the real UI to the <App/> component, and what/where I'm meant to be writing code.
Is there a straight forward answer to this?


texts: Redirect to store on first visit with observer/event

texts:
On the first visit i have to redirect the user to relative store view depending on the user's country (retrieved by IP).

I want to create a custom module for this purpose, so i think to need a magento event dispatched "before all" so i could set the right store view programmatically.

Is there an event that can afford to do this?


texts: how to add a free product in Cart automatically when any other product added in cart in Magento 2

texts:
Add a free item in the cart. For example when anyone adds X product in the cart then Y automatic added if remove X then Y automatic remove.

for doing this task I made an observer and an events.xml file, I not getting any result

Thanks

here is my code

observer file

<?php
namespace Feedback\Addon\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;

class CustomObserver implements ObserverInterface
{
    protected $_productRepository;
    protected $_cart;

    public function __construct( \Magento\Catalog\Model\ProductRepository $productRepository, \Magento\Checkout\Model\Cart $cart ){
        $this->_productRepository = $productRepository;
        $this->_cart = $cart;
    }
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $product = $observer->getEvent()->getData('product');
        if($product->getId() != 10 ){
            $params = array(
                'product' => 10,
                'qty' => $product->getQty(),
                'price' => 0
            );
            $_product = $this->_productRepository->getById( 10 );
            $this->_cart->addProduct($_product,$params);
            $this->_cart->save();
        }

    }
}

events.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_cart_update_items_after">
    <observer name="CustomObserver" instance="Feedback\Addon\Observer\CustomObserver" />
</event>
</config>