texts: redirect to admin dashboard from my custom module controller

texts:
I have a requirement, where admin is performing certain action on a custom module, he should be redirected to admin-dashboard on error.
I tried redirection codes with different values but they lead to 404 page.
Moreover the admin url is customized not a customary one.
its like admin.thesitename.com/index.php/securecontrolpanel

i am still trying but decided to ask here :)  if i can get a quick help.


texts:
<?php

namespace Ecomsolver\Measurement\Observer;

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

class SetAdditionalOptions implements ObserverInterface
{
    /**
     * @var RequestInterface
     */
    protected $_request;

    /**
     * @param RequestInterface $request
     */
    public function __construct(
        RequestInterface $request
    ) {
        $this->_request = $request;
    }

    /**
     * @param \Magento\Framework\Event\Observer $observer
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        // Check and set information according to your need
        if ($this->_request->getFullActionName() == 'checkout_cart_add') { //checking when product is adding to cart
            $product = $observer->getProduct();
            $additionalOptions = [];
            $additionalOptions[] = array(
                'label' => "Some Label",
                'value' => "good product",
            );
            $observer->getProduct()->addCustomOption('additional_options', serialize($additionalOptions));
        }
    }
}

I am using the above code for adding custom option when product add to cart in magento 2.2.5 but everytime I am getting the below error:

  main.CRITICAL: Unable to unserialize value. [] []

how to fix this ?


texts: Magento 2 install with sample data placeholder images

texts:
I recently installed Magento 2.3.6 on an Ubuntu 18 VM instance using Composer 1.10.13.
The basic installation was done using the following commands:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.6 /var/www/html/magento2

And to install Magento I ran the following command:
bin/magento setup:install --base-url=$mage_base_url --base-url-secure=$mage_base_url_secure --db-host=$mage_db_host --db-name=$mage_db_name --db-user=$mage_db_user --db-password=$mage_db_password --admin-firstname=$mage_admin_firstname --admin-lastname=$mage_admin_lastname --admin-email=$mage_admin_email --admin-user=$mage_admin_user --admin-password=$mage_admin_password --language=$mage_lang --currency=$mage_currency --timezone=$mage_timezone --use-secure=$mage_use_secure --use-secure-admin=$mage_use_secure_admin --use-rewrites=$mage_use_rewrites --backend-frontname=$mage_admin_backend_frontname

Note: Environment variable values have been obscured.
After this I had a working Magento 2 install. I then installed sample data using the following:
bin/magento deploy:mode:set developer
bin/magento sampledata:deploy
bin/magento setup:upgrade

The issue I'm having is that after installing sample data, some products are showing placeholder images, and some are not. See the image below:

I'm thinking it might be related to the sample data version I installed. On the Magento2 sample-data repo, I see multiple releases [for different Magento2 versions], but I'm not sure which one is installed when I run bin/magento sampledata:deploy. Could it be it's installing the latest sample data [2.4.1] instead of [2.3.6]? How do I check what version is installed? Is it possible to specify a specific sample data version when I run bin/magento sampledata:deploy command? Perhaps setting the exact version number I require?
I've looked in the admin panel, and the images for the listed products also appear as placeholder images. I've also tried bin/magento catalog:images:resize, but that did not have any effect.
How do I fix this?


texts: Magento2.3 : Pagination - jump to top of pagination at PLP page

texts:
I have a problem with Buttons in Pagination. If the user clicks the button, it reloads the page with loader and settles down at the current page scroll position. Is there any method to force the reload to jump to the top of the page?
The code I have tried so far is
    jQuery(document).ready(function() {

    jQuery('a.action.next,a.action.previous,li.item.current,li.item a.page').click(function() {
          setTimeout(function(){
                jQuery("html, body").animate({ scrollTop: 0 }, "slow");
          }, 6000);
    });

});

Any help will be appreciated!


texts:
Is it possible to collapse all filters on layered navigaton and if so how?

Currently half of our filters are collapsed and some are open such as colour and category by default

How do we collapse and open filter programatically?


texts: Customising layered navigation for live pricing

texts:
I’m kind of stuck with a module I’m currently writing.

The client wants to use a third party pricing supply (web service) for existing customers (when they’re logged in). Currently I’ve got the pricing for the product page overloaded and for general collections but the one I’m struggling to get to work is the layered navigation pricing.

The minimal price and final price are calculated in the query itself which means I can’t simply modify it.

I’ve tracked it all back to the prepareProductCollection() method in the Mage_Catalog_Model_Layer model and ideally, if I could simply loop through the collection, get the correct pricing for each product and then write them back to the collection it ‘should’ do what I need it to. However, If I do this in the way that you’d normally do it in an observer (there are no events dispatched around this method from what I can tell) then it doesn’t update the collection how I’d expect.

Original Method:

 public function prepareProductCollection($collection)
{
    $collection
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
        ->addMinimalPrice()
        ->addFinalPrice()
        ->addTaxPercents()
        ->addUrlRewrite($this->getCurrentCategory()->getId());

    Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
    Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

    return $this;
}

Modified Method that currently isn’t working quite right (explicitly setting the prices for now):

 public function prepareProductCollection($collection)
{
    $collection
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
        ->addMinimalPrice()
        ->addFinalPrice()
        ->addTaxPercents()
        ->addUrlRewrite($this->getCurrentCategory()->getId());

   foreach($collection as $product) {
        $product->setMinimalPrice("13.5");
        $product->setFinalPrice("13.5");
        $product->setMinPrice("13.5");
    }

    Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
    Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

    return $this;
}

Any ideas or alternative solutions to carry out the pricing change globally in one place would be greatly appreciated.


texts: Magento 2.2.2 - Add Custom Wrapper using XML

texts:
I need to add additional wrapper inside page.wrapper so that other containers will be inside by custom wrapper.

app/design/frontend/Vendor/Theme/Magento_Theme/page_layout/1column.xml

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="empty"/>
    <referenceContainer name="page.wrapper">

        <container name="my-custom-wrapper" htmlClass="my-custom-wrapper" htmlTag="div">

        <container name="header.container" as="header_container" label="Page Header Container" htmlTag="header" htmlClass="page-header" before="main.content"/>
        <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
        <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" />

        </container>

    </referenceContainer>
</layout>

Expected HTML

     ... all other containers ....

How do I do it ?


texts: "One-page checkout is turned off." error message. How to enable 2-step checkout?

texts:
If I have the one-page checkout enabled, I can continue to checkout and place the order. The setting is found under: Store -- Configuration -- Sales -- Checkout -- Checkout Options -- Enable Onepage Checkout
As soon as I set this to "No", the checkout is breaking giving me a message of "One-page checkout is turned off."
I am running Magento ver. 2.3.5-p2
How can I enable the 2-step (or two page) checkout?


texts: After updating from 2.3.1 to 2.3.2, unable to export products

texts:
After updating from version 2.3.1 to 2.3.2 community edition, I can not export products. The usual method - system - export, select entity type products, CSV format, fields enclosure checked, gives the message "Message added to the queue, wait to get your file soon" and nothing else. Below a file name called "email" appeared, and when I click download, blank page loads. Attempt to delete the file, and the following occurs:

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): There are no export file with such name email

Exception #0 (Magento\Framework\Exception\LocalizedException): There are no export file with such name email
<pre>#1 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:231]
#2 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#3 Magento\ImportExport\Controller\Adminhtml\Export\File\Delete\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#4 Magento\ImportExport\Controller\Adminhtml\Export\File\Delete\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#5 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#6 Magento\ImportExport\Controller\Adminhtml\Export\File\Delete\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#7 Magento\ImportExport\Controller\Adminhtml\Export\File\Delete\Interceptor->___callPlugins() called at [generated/code/Magento/ImportExport/Controller/Adminhtml/Export/File/Delete/Interceptor.php:26]
#8 Magento\ImportExport\Controller\Adminhtml\Export\File\Delete\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:159]
#9 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:99]
#10 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#14 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:137]
#15 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#16 Magento\Framework\App\Bootstrap->run() called at [index.php:39]
</pre>


texts: Magento 2: Create customer group programatically

texts:
I'd like to know if it's possible (if so, how) to programmatically create a new customer group using the Magento 2 framework. Ideally I'd like to do this in a setup class.

Looking at the GroupRegistry class, I only see a retrieve() and remove() method. The class also doesn't extend anything so wouldn't inherit these methods - so I know this isn't the right place to look.

Of course, I'm probably looking in the wrong place or misunderstand the concept of how it works.

Do I even need to bother trying to find the class that will handle this, or should I just specify a GroupRepositoryInterface in the constructor of the class and assume it'll be provided by the object manager? The interface provides the save() method, which is what I need.

This is what I'm thinking so far:

namespace MyCompany\MyModule\Setup;

use Magento\Framework\Module\Setup\Migration;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Customer\Api\GroupRepositoryInterface;
use Magento\Customer\Model\GroupFactory;

class InstallData implements InstallDataInterface
{
    protected $groupFactory;
    protected $groupRepository;

    /**
     * I'd like a customer group factory and a customer group repository
     */
    public function __construct(
        GroupFactory $groupFactory,
        GroupRepositoryInterface $groupRepository
    ) {
        $this->groupFactory = $groupFactory;
        $this->groupRepository = $groupRepository;
    }

    public function install(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $setup->startSetup();

        // Create the new group
        $group = $this->groupFactory->create();

        $group->setCode('My New Group');
        $group->setTaxClassId(3); // magic number is only for demo..

        // Use the group repository to save it
        $this->groupRepository->save($group);

        $setup->endSetup();
    }
}

Am I close? If I run this, I get the following exception:

  Argument 1 passed to Magento\Customer\Model\ResourceModel\GroupRepository\Interceptor::save() must implement interface Magento\Customer\Api\Data\GroupInterface, instance of Magento\Customer\Model\Group\Interceptor given


texts:
In mail-tester.com I get 1,5 point lower because of a missing date header in my transaction emails.

How to add the date header in transaction emails?


texts: Don't understand the details of upgrading Magento from 1 to Magento 2 latest version

texts:
I have a website on Magento 1.9.0.1 on one Linux server with PHP 5.6 and I need to upgrade it to the latest version and install it on another Linux server with PHP 7.2. So, I'm very confused about my next steps. I know that I can't upgrade PHP to the latest version on the first server as Magento 1.9 doesn't support that.

So, do I need to upgrade it first to Magento 2.0 (I've read somewhere that it does support 5.6) or I can't upgrade it straight to the latest version? I also have some confusion about transferring the data. Do I need to create a separate copy of the original database or I can just repoint it? I appreciate any help


texts: How do we allow customer create product from rest api without extension?

texts:
I need customer to be able to create product without extension. I just need an access from rest api.

Is this possible?

Thank you


texts: How to control block XML cache via admin?

texts:
I've created a condition in my admin panel to enable or disable a feature in my module. In my XML I used the ifconfig to check if it's enabled or disabled. I want to disable the cache in the entire page if my module is enabled.

will ifconfig skip the cache parameter if disabled?

<block ifconfig="mycompany_mymodule/general/enable" cacheable="false" class="Magento\Framework\View\Element\Template" name="mymodule" as="mymodule" template="Mycompany_Mymodule::redirect.phtml" before="-">
    <arguments>
        <argument name="view_model" xsi:type="object">Mycompany\Mymodule\ViewModel\Helper</argument>
    </arguments>
</block>

Thank you!


texts: Magento 2 : I Want to Display All Catagory and Sub Category in Layerd Navigation

texts:
I want to display all category in layered navigation in Magento 2.

For example :
Clothing I have 3 sub categories then I want to display all three categories with subcategory.


texts:
I have tried to display the data from Quote_item table in the database to file .phtml but it shows this error

the code in Magento/MyHistory/Block/View.php

<?php
   namespace Magento\History\Block;
   class View extends \Magento\Framework\View\Element\Template
   {
   public function __constructor(
    ....
    /Magento/Checkout/Model/Cart $cart
   ....)
   {
   ...
    $cart = $cart;
   ...
  }
   public function getCartData(){
       $data = $this->cart()->create()->getCollection()-
         >addFieldToSelect('*');
       return $data;
   }
   }

in Magento/MyHistory/view/frontend/template/index.phtml like this

<?php
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $orders = $objectManager->create('Magento\Checkout\Model\Cart')-
     >getCollection();
     $orders->addFieldToSelect('*');
?>

Your Order Detail

Look at this table

              Image
              Sku
              Name
              Quantity
              Create at
              Update at

          <?php foreach ($orders as $item): ?>

                   <?php echo $item-
                   >getImage(); ?>
                   <?php echo $item-
                   >getSku(); ?>
                   <?php echo $item-
                   >getName(); ?>
                   <?php echo $item-
                   >getQty(); ?>
                   <?php echo
                   $item->getCreatedAt(); ?>
                   <?php echo
                   $item->getUpdatedAt(); ?>

               <?php endforeach; ?>

Anyone can help me, please?


texts: Are there any creative solutions for launching cron.sh for multiple Magento stores in a distributed architecture?

texts:
At the company I work for, our architecture is set up in such a way that we have hundreds of Magento stores, and a variable number of application servers (behind a load balancer), but only one centralized database and file server. This has proven good for cost, reliability and scalability, but it it's not good for launching the cron for a few reasons:

1) The central file server doesn't have PHP, so we can't launch cron.sh from there.

2) There's no way to decide which app-server should run the cron (we don't want the same cron to run multiple times.)

3) Even if we could denote which one should run the cron, we'd have to intelligently balance this out across the farm.

4) Even if we could balance it out, this balance will be constantly changing as we add or take away app servers during load spikes and peak seasons.

5) One other idea I had was to have a separate application server only for cron processing, but this seems wasteful, and also not scalable because you will eventually need a second server when you get enough crons (I think we are already at this point.)

As a workaround, we have a separate server which sends an HTTP request to each store's cron.php using curl to kick off the cron. This helps to distribute the load because the load balancer can decide which server runs it, but we are starting to see weird issues where some stores crons don't run (too late in schedule,) or run more than once, or get scheduled more than once. After reading this article which explains why this implementation is prone to race conditions it got me thinking about changing to the cron.sh method, but to do so seems very complicated with the current state of our platform.

Is anyone else out there running a distributed multi-server, multi-store Magento platform with some success? How do you launch your crons?


texts: Prices missing tax i shopping cart. Corrects itself when visiting cart

texts:
Magento 1.9.2.1

A really strange problem...

I only have configurable products in my shop with associated simple products. Product prices are entered without tax. Prices are displayed including tax on frontend. So far, so good.

Problem is when visiting a configurable product and adding one of the simple products to cart. When page loads the cart prices, both total and per unit, are displayed without tax.

Although if I visit the cart page (/checkout/cart/) or add another product to the cart, all prices are suddenly displayed including tax.

Because of this all orders are including tax as they should be. But when adding the first product to cart, the prices are displayed without tax, causing some confusion.

In tax settings I have the following:

Calulation settings

Tax Calculation Method Based On: Unit price
Tax Calculation Based On: Shipping address
Catalog prices: Excluding tax
Shipping prices: Excluding tax

Shopping cart display settings

Display Prices: Including tax
Display Subtotal: Including tax
Display Shipping Amount: Including tax
Include Tax In Grand Total: Yes
Display Full Tax Summary: No
Display Zero Tax Subtotal: No

I have also entered the shipping origin address in Shipping Settings. Address is in Norway if it matters.

Here's to hoping someone might have an idea on whats causing this.


texts: Is it possible to manage only a range of users by roles?

texts:
I want to give access to 2 new roles. This new role will manage the customers, but one will manage the customers of the 'group X' and the other the 'group Y'. Is there a solution to filter this?

I mean, 'role 1' will not see customers group Y, but group X, and role 2 the opposite of role 1.

Is this possible? I searched for extensions but the research was useless.

Thanks.


texts: Magento 2 - Is there a way to change element "data-mage-init" without overriding a template?

texts: For example I want to change some options of minicart dialog initialization. So I need to change minicart template (override this template in custom theme/module). Is there a way to change minicart dialog init options without overriding a template?


texts:
I have problem in wishlist

I need to move products from wishlist to enquiry quote

$url = Mage::getUrl('qquoteadv/index/addItem/');
$actionQuote = "addQuote('".$url."');"

i tried above code but its not working

any suggestion for this query?


texts: Is too much cron jobs schedule cause server time out of website ?

texts:
Hi i have a website in magento2 , in my database we have 467500 rows in cron_schedule table , my site is lacking alot and most of the time it goes down displaying server timeout issue .
The configuration of my server is 18gb ram with 1 tb HDD , my database got crashed during the time of when cron jobs run , its my guess it is creating issue .

  i see 462318 statuses are in pending states in my cron_schedule table out of 467500 statuses .

I just wants to know is this creating issue ? should i delete that all rows in my table for quick heal ? , as my db is crashing so much , what will be the permanent solution for this ?


texts:
I am trying to install the greek language pack through the magento connect manager and i always get the following error:

community/Locale_Mage_community_el_GR: Package release 'Locale_Mage_community_el_GR' not found on server: No releases for 'Locale_Mage_community_el_GR: Package release 'Locale_Mage_community_el_GR' not found on server', skipping

I know the extension is in beta version so i changed the preferred state from the magento's connect manager settings, but the error still remains.
What can i do?


texts: Magento 2 Base table or view not found: 1146 Table 'catalog_product_index_price_cg13_ws2' doesn't exist

texts:
I am getting "Base table or view not found: 1146 Table'catalog_product_index_price_cg13_ws2' doesn't exist" when customer logged out.
We have a multiple website:
ex(abc,abc123,abc1234)

Now I have tried to created account from "abc" website like:
https://yourdomain.com/abc/customer/account
Your account is created successfully but after login you getting this error on my account page "An unspecified error occurred. Please contact us for assistance."
In var log getting above error base table not found.

Can you please help me on this issue ? If anybody having idea how to generate "'catalog_product_index_price_cg13_ws2" this table based on customer group please answered here.


texts:
I need to be able to create orders manually from my control panel, but I can not select payment methods, how can I resolve this? This option is found in: Sales > Orders > Create New Order
In this image you can see the message I can see:

I am using Mollie for payments and it works fine, but I can not select any payment method when I want to create an order manually.
Any ideas to solve this problem?


texts: how to remove magento wishlist page title for custom theme

texts:
i already try to edit wishlist.xml page.

                    My Wishlist

please suggest me .
thanks


texts: How can we remove layered navigation filters view page source code in magento 2 category page?

texts:
How can we remove the filters applied in category page,ie:
.

It's appending the pipe with filter values in view page source as shown in below-

<meta name="description" content=" | Price: $0.00 - $100.00"/>

we need to remove the price from its tag.

We have added the SEO mageworx extension for our code base.


texts:
About: Make Magento e-mails work for Google "My Purchases"

Yesterday I was browsing one of our products that we sell via our brand site, but also some platforms. Suddenly I saw a recent purchase in my Google search overview. What? Apparently this is not new but I did not read how to get it working for our order e-mails.

https://www.google.nl/search?q=my+purchases

Question: so how would one add this to the Magento transactional e-mails?

Thanks!


texts: Get salesrule id from order id in Magento 2

texts:
How to get salesrule id from order id,for example:

public function getSalesruleIdByOrderId($orderId){
   //???
}


texts: How to override final_price.phtml in magento 2?

texts:
I want to override final_price.phtml, I have tried following in my module but it is not working.
I have created app/code/MyVendor/MyModule/view/frontend/layout/catalog_product_prices.xml

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <referenceBlock name="render.product.prices">
        <arguments>
            <argument name="default" xsi:type="array">
                <item name="prices" xsi:type="array">
                    <item name="final_price" xsi:type="array">
                        <!-- item name="render_class" xsi:type="string">Magento\Catalog\Pricing\Render\FinalPriceBox</item> -->
                        <item name="render_template" xsi:type="string">MyVendor_MyModule::product/price/final_price.phtml</item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</layout>

Also I have created template file as well. at app/code/MyVendor/MyModule/view/frontend/templates/product/price/final_price.phtml
And in final_price.phtml I wrote my custom code.

But it is not working.
Can anyone tell me what is missing in this code?


texts: Magento 2 redirect back with message from controller, redirecting working fine but error message not showing

texts:
Messages do not appear after redirection. Tried many solutions but no luck. Here is the code I tried. I have created a fronted form with custom routing with URL params.
public function execute(){
        $resultRedirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);
        try{
            $this->messageManager->addSuccess(__('Redirection Sucessful.'));
        }catch (\Exception $e) {
            $this->messageManager->addError($e->getMessage());
        }
        $resultRedirect->setUrl($this->_redirect->getRefererUrl());
        return $resultRedirect;
    }

And
public function execute(){
        $resultRedirect = $this->resultRedirectFactory->create();
        try{
            $this->messageManager->addSuccess(__('Redirection Sucessful.'));
        }catch (\Exception $e) {
            $this->messageManager->addError($e->getMessage());
        }
        $resultRedirect->setUrl($this->_redirect->getRefererUrl());
        return $resultRedirect;
    }

in sulkar_sktok_form.xml file into
<referenceContainer name="page.messages">
    <block class="Magento\Framework\View\Element\Template" name="ajax.message.placeholder" template="Magento_Theme::html/messages.phtml"/>
    <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages" template="Magento_Theme::messages.phtml"/>
</referenceContainer>


texts:
I am using the Quickbooks API for my application and I have used
https://intuit.github.io/QuickBooks-V3-PHP-SDK/authorization.html
generate-oauth-2-0-tokens for token generation.
The token is created successfully and I am able to use the token for updating Quickbooks. The problem is that after 1 day I receive the following error:
Refresh OAuth 2 Access token with Refresh Token failed. Body:
[{"error":"invalid_grant"}]

.


texts: Onepage checkout - Load last used billing address

texts:
On checkout, I'd like the Billing section to load - by default - the last (saved) address that the customer checked out with by default, as opposed to the primary billing address.

I looked at app/design/frontend/base/default/template/checkout/onepage/billing.phtml:

And established that this is the call I'll need to override:

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

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

This method (getAddressesHtmlSelect('billin')) is located in:

app/code/core/Mage/Checkout/Block/Onepage/Abstract.php: (~line 110)

At about line 124, the $type parameter is verified:

if ($type=='billing') {
    $address = $this->getCustomer()->getPrimaryBillingAddress();
}

I'm trying to think of an intelligible method to, instead of loading the primary billing address, loading the last billing address which was used?

Or do you think the better approach would be saving the billing address used on checkout as the primary billing address?

I suppopse either method would work, but would appreciate some insight.

P.S. I couldn't find a setPrimaryBillingAddress method anywhere in the code base.


texts:
I need to force a csv file's download from a cms page in Magento.
I've looking for many forums about it and I created a custom php code and insert it in blank empty cms page in Magento but the downloaded csv file contains html code with scripts and html tags before the file info.

So, how could I download the file without html code and only with the info I need?


texts: Magento 2: get controller, module, action name in template file?

texts: How can I retrieve controller, module and action name within a template?


texts: Magento 2 Maintenance Mode IP filtering not working

texts:
I hope you can help me with this issue.

I already enabled the maintenance mode and set up the IP filter, but it's not working. Although I configured to access the site with my IP I'm unable to see front-end and back-end, I only get the 503 Error page.

I used all the common commands for the manintenance mode and even tried to configure a redirection through .htaccess with IP filter and doesn't work either.

Thank You.!


texts:
I've created an option under System > Configuration > Catalog > Catalog that allows an admin to select which customer groups can add products to the cart. I now want to notify admin's about this setting when they are changing wishlist settings on another system config page. Something like "Products in the Wishlist can only be added to the cart if blah blah blah."

1) I know about the <depends> tag, but I don't know how to use that for settings from other parts of the config. For instance <depends><active>1</active></depends> is simple, but how can I do that for fields from other groups or sections?

2) Is there a standardized way to put a notification or simple string on a system config page, or does Magento only support fields out of the box?

Thank you.


texts: How to Manage Multilingual Mail Templates

texts:
We have a store for different countries that should use very similar mail templates.
The logo - and of course - the texts have to be changed.

Is there a way around copying all templates and assigning them in the backend for each mail type that is sent?


texts: Elastic Search Parse Error: unknown token [START_ARRAY]

texts:
My site uses Magento 2.3.2 and Elastic Search 6 (6.7.1)
I have one particular attribute that cannot load its products when used as a category filter. I can load the category with all of its products but trying to filter by this one attribute I get no results. I get an error in the exceptions log that says: "[terms] unknown token [START_ARRAY] after [in]"
My research led me to this Github discussion, which does describe my problem exactly. I can confirm that because my field is a dropdown field, something in the Magento Elasticsearch implementation adds an "in" command to the Elastic Search query that should not be there (see the detailed example in this comment way down the page).
This github issue is closed and they say it's fixed. However (and this is where I'm stuck) this change here is supposed to be the solution but I implemented and it did NOT fix my issue. It looks like the fixed location is only for search and the error I'm getting is for browse. The fix as implemented did make a keyword search find these items. However it did not fix my issue, which is the same but for a filter on a category.
I dug around in the code but got lost in all of the abstractions. I have a feeling that the exact same fix that was accepted as the solution for search just needs to be implemented again in a different location. I was hoping someone more familiar with this code or who has fixed this themselves would be able to point me in the right direction.


texts: Magento2 Multi-store category / product customization

texts:
I'm looking to make the change to Magento2 from a custom system and I'm trying to figure out the most efficient way possible to share products / categories between stores with minor changes.  All stores will be on the same domain / server.

What I'd like to be able to do is have a primary public store and:

Create a product category (pants)

Create several products (A, B, C) in the category pants

Then create a sub-store on the same server with access to the same category / products.  From there I'd like to make small updates to the category / products that are specific to the sub-store I've added (images, branding info, special descriptions / coupons).

After that I'd like to have other sub-stores that can customize those aspects in a different way.

Is it possible to do this without re-creating the category / products?  I'm having difficulties in my searches around this so far.


texts: Magento 2.2.5: Add Student Instead of Update Student

texts:
So instead of update the student, this code add a new student.
I'm looking for a way that not using object manager, because the objectmanager is recommended not to use.

So when i searching for how to update a product in magento 2, i found alot of objectmanager way, but like i said, i wont use them.

I found 2 other ways, 1st way is using factory only, the 2nd way is using resource model and factory.

So here is the code :

namespace Fudu\HelloWorld\Controller\Adminhtml\Student;

use Magento\Backend\App\Action\Context;
use Fudu\HelloWorld\Model\StudentsFactory;
use Fudu\HelloWorld\Model\ResourceModel\Students as ResourceModel;

class Update extends \Magento\Framework\App\Action\Action
{
    /**
     * @var StudentsFactory
     */
    protected $studentsFactory;

/**
 * @var ResourceModel
 */
protected $resourceModel;

public function __construct(
    Context $context,
    StudentsFactory $studentsFactory,
    ResourceModel $resourceModel
) {
    $this->resourceModel = $resourceModel;
    $this->studentsFactory = $studentsFactory;

    parent::__construct($context);
}
/**
 * Save action
 *
 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
 * @return \Magento\Framework\Controller\ResultInterface
 */
public function execute()
{
    $data = $this->getRequest()->getPostValue();

    /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
    $resultRedirect = $this->resultRedirectFactory->create();
//
        if ($data) {
            try{
                /** @var \Fudu\HelloWorld\Model\Students $model */

            $id = $this->getRequest()->getParam('id');

//                The 1st way :
                $model = $this->studentsFactory->create()->load($id);
                $model->setData($data);
                $model->save();

//                  The 2nd way :
//                $model = $this->studentsFactory->create();
//                $resource = $this->resourceModel->load($model,$id);
//                $model->setData($data);
//                $resource->save($model);

            $this->messageManager->addSuccessMessage(__('Update Student Successfully.'));

            // Redirect to your form page (or anywhere you want...)
            $resultRedirect->setPath('students/student/index');

            return $resultRedirect;
        }
        catch (\Exception $e) {
            $this->messageManager->addErrorMessage($e->getMessage());
        }

    }
}
}


texts: Get Order ID in Abstract.php PDF protected function insertLogo

texts:
I have been banging my head against a brick wall for the last 2 hours.

I am editing app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.pdf.

All I am trying to achieve is a little if statement so that based on a particular payment method I can change what image is used on the invoice header.

I have tried evrything but cannot get the OrderID inside the

protected function insertLogo{}

Any advice would be great.

Thankyou.


texts:
Is it possible to modify Magento to provide a "random discount" between 1 and 999?

The reason I ask this is because we need to uniquely differ between bank transfer payments (from customer) when they have the same grand total invoiced amount.

For instance, Customer A with grand total of 120'000 IDR gets a (random) discount of 377, so A will have to transfer 119'623 IDR. Customer B with same grand total of 120'000 (and same cart contents) gets a (random) discount of 421, so B will be transferring 119'579 IDR.

(Optionally, it would be nice if the uniqueness of the grand total can be guaranteed for one week. But if that hammers the database, we can live without it)


texts: Magento 2.4: issue with reindex product EAV

texts:
Impossible reindex magento 2.4.  Indexer stop at Product EAV. I try run command with -d memory limit and on maintenance mode.
Also I switch to production mode and developer mode and reset indexes. Still the same issue.
Any solution?


texts: Do Magento 2 Integration OAuth Access Tokens Never Expire?

texts:
Hi I just want to make sure that if I created an integration via OAuth authentication
I would use the access token of which for Magento 2 API calls.  It is my experience that they never expire, is this claim absolutely true?
Insofar that the behavior is different from the admin and customer access tokens that do expire and have to regenerate a token else get a 401 error


texts: Magento 2: Are uiClass/uiElement Imports/Exports order sensitive?

texts:
Magento's uiClass/uiElement objects have a feature that allow them, at the time of instantiation, to populate a property of their own (imports) from a uiRegistry registered object, or populate a property from another object (exports) from a third uiRegistry object.

What's not clear from the implementation is

Are there imports/exports sensitive the the order components are loaded? (i.e. naive implementation)
Or will the property "linking" functionality retry until it finds a registered object in the uiRegistry
Or is the "link" lazy loaded?
Does this behavior change if the uiClass/uiElement objects are used stand-alone vs. being used in a Magento_Ui/js/core/app application

I'd assume a naive implementation -- but there's a lot of javascript promise use and deferred callback loading going on in Magento_Ui/js/core/app that's not easy to follow.  That, plus poor documentation of how the object system works or its intent makes this difficult to know for sure without fully unspooling a Magento_Ui/js/core/app app.

I'm hoping someone already has the answer and can spare me that code dive.


texts: How do I change the front-end default language? 1.7.0.2

texts:
How do I change the default language?  Front-End only.

CE 1.7.0.2
Entering the website address gives the store Home page in English.
Preference of local French Home page/Accueil as default.
Admin needs to stay in English.
The language switcher is working great.

Thank you in advance for pointing me in the right direction.


texts: Magento 2 full page cache invalidates everything

texts:
i do not know if this is a bug or by design. I have been searching and getting a lot of mixed signals.

running magento 2.2.5 with built in cache and redis.
i dont know why, but when i change 1 letter in a product name.. All the page caching is invalidated?!

is this a bug or am i missing some logic?


texts:
i created function call my block. so i want use getData() i my block
i tried
function maxTest($name, $data){
     $name->getLayout()->createBlock('Namespace\ModuleName\Block\CustomBlock',[emty_id=>$data])
};

after i call print_r($this->getData()); in Namespace\ModuleName\Block\CustomBlock it not has. so how do setData() in may function. Many thank.


texts: How to programatically transfer qty from one to other source

texts:
Does anyone has idea how to update product qty from one source to other programmatically ?

Basically I've 2 sources in my magento setup. Let say currently Salable Qty = 50 and first source has 20 qty and other has 30 qty.

I want to transfer qty from first to other programmatically ?

 Like, First contains 19 qty and other has 31 qty.


texts: How to select and upload multiple images from Media Storage

texts: I want to select and upload multiple images from Media Storage. In default functionality I have to open Media Storage and go to the specific folder again and again to upload new image. How can I achieve that I can select and upload multiple images in Media Storage.


texts: Magento 2: how to hide ''price' of custom option in products

texts:
how to hide ''price' of custom option in products

Magento version is :  2.2.6


texts: Magento 2 : Disable RequireJS (and all JavaScript)

texts:
Is there a way to disable RequireJS completely in Magento 2? I want to build a theme from scratch and I do not want to include any of JavaScript that Magento automatically includes, Including RequireJS.

There is a documented way of disabling any Magento 2 JS: http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/custom_js.html#disable_default_js (though I had little success with that so far), but this still would not disable the integration of RequireJS.


texts:
I have Created the slideshow name in page.xml file and configure the .js and .css files.

my .js files are under magento\js\scripts, images are under magento\skin\frontend\Ics\default\images\media\slideshow and css are magento\skin\frontend\Ics\default\ss.

<block type="core/text_list" name="slideshow" translate="label" as="slideshow">
                Slide Show
            </block>

                <action method="addJs">

                </action>
                <action method="addJs">

                </action>

            <action method="addCss">

            </action>

I created layout.xml file in frontend->Ics->default->layout->layout.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="slideshow">
            <block name="footer" type="layout/footer" template="layout/footer.phtml"></block>
        </reference>
    </default>
</layout>

And I have created custom layout.xml file to inclide in 2columns-rights.phtml. It is showing well by using below code.

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

Finally in my footer.phtml file:

To Day Date is :
<?php  echo $this->getDate() ?>

Slide Show

<?php

$directory = $this->getSkinUrl('images/media/slideshow');

Zend_Debug::dump($directory);

try {
    // Styling for images
    echo '
';
    foreach ( new DirectoryIterator($directory) as $item ) {
        if ($item->isFile()) {
            $path = $directory . '/' . $item;
            echo '';
        }
    }
    echo '
';
}
catch(Exception $e) {
    echo 'No images found for this slideshow.
';
}
?>

When I run this it is not displaying images but the path is returning correctly.

Zend_Debug::dump($directory);

using this string(73) "http://localhost/magento/skin/frontend/Ics/default/images/media/slideshow"

No images found for this slideshow.

images path is correct but images are not displaying correctly.

Can anyone tell me where I went wrong?

Thanks in advance.


texts: Magento 1.9.1 - suggestion needed for PHP 7 version and extension compatibility

texts:
Before someone put it as duplicate post, i found this link :

Is Magento ready for PHP 7?

but i want to know about advantages of php 7 over php 5.6 & extensions issues.

we set up magento site in php 5.6 version.

as PHP 7 is ready, now we want to go for PHP 7.

we want to know is there any advantages and disadvantages of upgrading to php 7 version?

also we used lot of extensions in our site, will it affects on our extensions also ?


texts:
I have a magento shop that will be selling both frozen and non-frozen foods. I'm trying to figure out how to set two straight flat shipping prices. One for each.

As well as this, i need to set it so if orders are over a certain amoutn shippping is free, however i'm aware that this is done through the table shipping settings.

I've looked into different possible modules to help with this, but i can't seem to find anything to fit what i'm looking for. They all seem to relate to weight for the most part instead of category. Does anyone have any ideas or can point me in the right direction to set this up?


texts: Shipping Estimator from ShipperHQ fails on page load if I remove item from cart or leave and come back to cart

texts:
My shopping cart has a shipping estimator from ShipperHQ. If the value changes in the zip code field it calculates the shipping cost. If you remove an item from the cart, update the quantity, leave the cart and come back for any reason, the zip code remains in the cart but no estimate appears and a field note displays: Sorry, no quotes are available for this order at this time
How can I fire this javascript on page load?
I see How to update Shipping rates using Ajax when cart item is deleted on Checkout-Cart page?
But where does this go and how is it implemented? Magento 2.4.1 using Luma theme.


texts: How I can create donate button in magento?

texts:
How can I create 3 donation button in magento 1.9.3 on cms page .

  1st button price is 100$
  2nd button price is 200$
  3rd button price is 300$

and when visitor click on button automatically redirect to checkout page


texts: magento 2 admin how to edit table row with ko (knockout) like customer grid?

texts:
I created a custom grid, but I need to update the data using the grid interface using ko (knockout) JS, as in the customer grid

Created custom grid table using https://webkul.com/blog/create-grid-edit-add-grid-row-and-installer-in-magento2/


texts:
I have this exception when running the installation for Magento 2. Couldn't find further information on how to fix this anywhere, error thrown was not very clear either. Anyone has any ideas? This happens after it says 'Running schema recurring...'

Using Magento EE 2.2.3 on Ubuntu, with Nginx

Module 'Magento_Amqp':
[ERROR] LogicException: Request schema definition for topic "shared.catalog.product.price.updated" should reference existing service class. Given "Magento\AsynchronousOperations\Api\Data\OperationInterface" in /var/www/tpb.com/html/vendor/magento/framework/Communication/Config/Validator.php:71
Stack trace:
#0 /var/www/tpb.com/html/vendor/magento/framework/Communication/Config/Reader/XmlReader/Converter.php(204): Magento\Framework\Communication\Config\Validator->validateRequestSchemaType('Magento\\Asynchr...', 'shared.catalog....')
#1 /var/www/tpb.com/html/vendor/magento/framework/Communication/Config/Reader/XmlReader/Converter.php(111): Magento\Framework\Communication\Config\Reader\XmlReader\Converter->extractTopicRequestSchema(Object(DOMElement))
#2 /var/www/tpb.com/html/vendor/magento/framework/Communication/Config/Reader/XmlReader/Converter.php(84): Magento\Framework\Communication\Config\Reader\XmlReader\Converter->extractTopics(Object(DOMDocument))
#3 /var/www/tpb.com/html/vendor/magento/framework/Config/Reader/Filesystem.php(171): Magento\Framework\Communication\Config\Reader\XmlReader\Converter->convert(Object(DOMDocument))
...


texts:
I have a multi store with following structure. The ID is obtain by hovering mouse over the link in the store management.

WebsiteA (http://www.websitea.com/), ID 2
StoreA, ID 2
StoreB, ID 4
StoreC, ID 6

WebsiteB (http://www.websiteb.com/), ID 3
StoreD, ID 3
StoreE, ID 5
StoreF, ID 7

WebsiteA is using USD as base currency while WebsiteB is using AUD. I have another database which host the price list based on the SKU. Catalog Price Scope is configured to “Website”.

I have the following code created as cron to update the price however it doesn’t appear to work properly. Instead it updated all websites with aud price.

    foreach($data as $p) {
        $price_usd = $p[‘usdprice’];
        $price_aud =  $p[‘audprice’];
        $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$p['sku']);
        $websites = Mage::app()->getWebsites();
        if ($product) {
            $product->setPrice($price_usd)->save();
            foreach ( $websites as $website ) {
                $basecurrency = Mage::app()->getWebsite($website)->getBaseCurrencyCode();
                $websiteid = Mage::app()->getWebsite($website)->getId();
                if ( $basecurrency == "USD" ) {
                    $product->setWebsiteId($websiteid)->setPrice($price_usd)->save();
                }
                elseif  ( $basecurrency == “AUD" ) {
                    $product->setWebsiteId($websiteid)->setPrice($price_aud)->save();
                }
            }
        }
    }


texts: How to add JS/CSS from layout.xml only if multible conditions are met?

texts:
I have three fields in admin config section that have to be checked. If at least one of them is set  to true the files should load.

  layout.xml

<reference name="head">
    <action method="addItem">
        <type>skin_js</type>
        <name>path/to/file1.js</name>
    </action>
    <action method="addItem">
        <type>skin_js</type>
        <name>path/to/file2.js</name>
    </action>
    ...
</reference>

Ideas:

add a helper for each file
add a new (hidden?) field to config and at sections save_before set value depending of the other fields
Extended ifconfig extension is already is installed, but no idea how to set up condtions

At the moment I prefer 2nd one ...

Any other ideas? Any suggestions?


texts:
maximum call stack size exceeded error

Uncaught RangeError: Maximum call stack size exceeded

at legacy-build.min.js:1
at legacy-build.min.js:1
at g.h [as _each] (legacy-build.min.js:1)
at g.e [as each] (legacy-build.min.js:1)
at g.h [as pluck] (legacy-build.min.js:1)
at g.r [as values] (legacy-build.min.js:1)
at g.serializeObject (grid.js:992)
at g.registerData (grid.js:927)
at g.registerData (grid.js:930)
at g.registerData (grid.js:930)


texts: Image randomly missing with Varnish on Magento2

texts:
I'm currently struggling into getting the correct configuration for my M2 shop and i can't figure out on how to troubleshoot this.

On some images, varnish backend is randomly returning 503 backend fetch, sometimes it's appearing, sometimes it's not.

I'm using Ubuntu 18.4 with Nginx / Varnish 5.2.1 and PHP 7.3.16.

Here is the content of my default.vcl: https://pastebin.com/HJ2B7pvf

Then, my nginx conf: https://pastebin.com/GDytNsht

First thing that i struggled, i could not enable the health_check no matter what i was putting on it. Each time i got a 503 backend fetch failed on this so i disabled it (tried to remove pub/). Second funny thing, i'm not able to setup MAGE_ROOT to my pub directly, each time got a 404 error.

I'm kind of stuck in there, any help would be appreciated.

Thank you!


texts:
I have install extension and I get the following error on frontend.

Fatal error: Declaration of Apptha\Airhotels\Controller\Index\Index::execute() must be compatible with Magento\Cms\Controller\Index\Index::execute($coreRoute = NULL) in

  public_html/app/code/Apptha/Airhotels/Controller/Index/Index.php

on line 52.

<?php
/**
 * Apptha
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.apptha.com/LICENSE.txt
 *
 * ==============================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * ==============================================================
 * This package designed for Magento COMMUNITY edition
 * Apptha does not guarantee correct work of this extension
 * on any other Magento edition except Magento COMMUNITY edition.
 * Apptha does not provide extension support in case of
 * incorrect edition usage.
 * ==============================================================
 *
 * @category    Apptha
 * @package     Apptha_Airhotels
 * @version     1.0.0
 * @author      Apptha Team <developers@contus.in>
 * @copyright   Copyright (c) 2017 Apptha. (http://www.apptha.com)
 * @license     http://www.apptha.com/LICENSE.txt
 *
 */
namespace Apptha\Airhotels\Controller\Index;

class Index extends \Magento\Cms\Controller\Index\Index
{
    public function execute(){

         $objectManager = \Magento\Framework\App\ObjectManager::getInstance ();
         //$airhotelsKey = $objectManager->get ( 'Apptha\Airhotels\Helper\Product' )->AirhotelsKey();
         $moduleEnableornot = $objectManager->get ( 'Apptha\Airhotels\Helper\Data' )->getEnableFrontend();

         if ($moduleEnableornot == 0) {
               /**
               * Notification Message
               */
           $msg = base64_decode('PGgzIHN0eWxlPSJmbG9hdDpsZWZ0O2NvbG9yOnJlZDttYXJnaW46IDMwMHB4IDQ3NXB4OyB3aWR0aDoyNiU7IiBpZD0idGl0bGUtdGV4dCI+RW5hYmxlIEFpcmhvdGVscyB0byB2aWV3IHRoZSB3ZWJzaXRlPC9oMz4=');

           $this->getResponse()->setBody ( $msg );
        } else {
              return  parent::execute();
         }
    }
}

Need Help please.


texts: Change the selection of results per page on local xml

texts: I have to change the results per page option on my products page. The results per page drop down must show 3,12,21 and right now it's 12,24,36. I have to change it using only the local.xml file. I'm using magento 1.9.


texts: Magento multi-store is not working with different cart or session

texts:
I am using a multistore setup and have an issue regarding using the same session after login.

Site 1 : http://testsite.com/store1
Site 2 : http://testsite.com/store2

If login with the same user and password and add a product to the cart, that product is showing up in both stores carts.

If I add something to the cart, it should only show in the store site in which I added the product, but not in the other store. What do I need to do?
Subdomain ie. store1.testsite.com and in that other store was created having url store2.testsite.com


texts: Product custom image option with preview

texts:
I am building a system where a customer can upload a image to a product and that image will then be printed onto the product. I have found out how to do this using a field custom option easily enough.

However we would like to be able to preview a example of what the product will look like on the product page. This would most likely be done using image overlays or masks on top of the customers image. To do this however I would need the image to be uploaded before the product is added to the cart.

I have looked for modules that let you preview your image before adding to cart but have not found anything.

I think the only other option would be to duplicate the file upload custom option and build in functions like this that let you upload as preview then add to cart. However this might be a time intensive option and we have not confirmed the system will be built in magento yet so I cannot dive into this option too deeply yet. I am wondering if there are any other options for building a system like this or modules I may have missed that could do this.


texts: Magento 2 Error 500 after admin login (apache)

texts:
I recently installed the current magento 2 version (fresh install) on an apache server. Everything worked as intended until I logged into the admin panel, which results in an internal server error. As my access to log-files is very limited due to hosting (domain factory) I hope that someone could just throw a few possible solutions at me which I could try out to solve the issue. .htaccess file is the original one (magento 2 installed via composer).

Roundup:

Apache Webserver with php7.0.6
Fresh Magento 2 install via composer
original .htaccess
Frontend works fine, Admin-Login page too - but after login getting error 500
Webhoster is domain factory (which limits access to log-files i.e. no access to apache logfiles via terminal)
already tried developer mode and rebuilding static content, clearing cache


texts: I am facing issue of "Specified rule does not allow auto generated coupons" while saving cart rules

texts:
I am customising module where i want to save cart rule without Use Auto Generation. When i save cart rules its showing this error

Unable to save program with ID 37. Error: Error occurred when saving coupon: Specified rule does not allow auto generated coupons

Anyone have idea about this ?


texts: Magento 2 What is the Cron Group / Module "Scconnector"?

texts:
I've noticed the cron group "Scconnector" found in the admin area under; system > configuration > Cron. What is this Module?

The reason why I ask is I have noticing some CPU spikes when running the command 'top'. There are 5 cron processes running at the same time every minute.

Two of these are Yotpo and Scconnector modules. Since I don't use Yotpo I disabled the module. I am curious as to what this modules does so I can decide if I need it enabled. I can't seem to find much about this "Scconnector"

My issue is similar to what I've found here (see link below), but my question is different to what is being asked: How to delay some cron jobs?.


texts: [![I got this when i'm launching the admin panel for the first time strong textbut it never loaded to the magneto2 admin panel! please tell me what to do?][1]][1]


texts: What is the /pub/static in Magento2? I am trying to find the Header.phtml?

texts:
Am I correct in assuming that /pub/static is rendered somehow by GruntJS and Less and this is an automated compilation of some sort - or can I directly edit these files or are they cache based? Would appreciate some light on how this renders and works?

I am looking for the default header.phtml files. So far I have only found 1column.xml and 2column.xml etc - I don't really like the XML files and editing them. I just want to access the raw header.phtml in the Blank theme if there is one and also some light on the above question

Thanks


texts:
How to make readonly SKU input in admin while product add/edit magento 2.3
Please help!
Thanks


texts: sort options Url parameters '?' change to '&' so 404 error

texts:
in my category page, sort options url (Position, Name or Price) are

https://www.mywebsite.com/category/subcategory?dir=asc&is_ajax=1&order=position&type=195

https://www.mywebsite.com/category/subcategory?dir=asc&is_ajax=1&order=name&type=195

https://www.mywebsite.com/category/subcategory?dir=asc&is_ajax=1&order=price&type=195

but if i switch to another sort option like position to price for example :
https://www.mywebsite.com/category/subcategory&dir=asc&is_ajax=1&order=price&type=195

? change to & so i have 404 errors

The really strange things, on my Preprod or dev no issues, i was thinking of an htaccess issue

Thanks for putting me on right track.


texts: How can I get values from a database according to some fieldname?

texts:
I have a custom table in my database with three fields ie id a_id and cat_id

I have an entry like this in the table.

    id a_id c_id

    2   7   7
    3   7   8
    4   7   8
    5   7   8
    6   7   5
    7   7   5
    9   9   7
    10  9   5
    11  7   5

Now I want to fetch data according to an a_id so that all the values will be collect in an array.

I tried this

 $categoryModel= Mage::getModel('blog/category')
        ->getCollection()
        ->addFieldToFilter('a_id','7');

but this shows an array without any value in it.

I want to update the table with the form so when I use this code

$categoryModel= Mage::getModel('blog/category')->load('7');

it only shows the last value of the table.

and when I collect this in an array again it only shows the last value.

So how can I collect all the value of the a_id = 7 in one array.

Here is my model file

class Vertax_Blog_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract
{
 public function _construct()
 {
  $this->_init('blog/category','id');
 }
}
?>


texts: Shipping address Not Set for programatically created product?

texts:
This below code adds product to cart and redirects to checkout page but can't place order. It shows shipping address is not set. I hope will get help.

namespace My\Module\Controller\Index;

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

protected $formKey;
protected $cart;
protected $product;
 protected $_response;

public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Data\Form\FormKey $formKey,
\Magento\Checkout\Model\Cart $cart,
\Magento\Catalog\Model\Product $product,
 \Magento\Framework\App\ResponseInterface $response,
array $data = []) {
    $this->formKey = $formKey;
    $this->cart = $cart;
    $this->product = $product;
     $this->_response = $response;
    parent::__construct($context);
}

public function execute()
 {
  $productId =482;
  $params = array(
                'form_key' => $this->formKey->getFormKey(),
                'product' => $productId, //product Id
                'qty'   =>1 //quantity of product
            );
    //Load the product based on productID
    $_product = $this->product->load($productId);
    $this->cart->addProduct($_product, $params);
    $this->cart->save();
    //$this->_response->setRedirect('magento')->sendResponse();
    header("Location: https://mysiteof/checkout/#payment"); exit;

 }

}


texts: Install SUPEE 11314 after unable upload zip in download product Magento 1


texts: Magento 2 EE - Need to add custom mass action in admin action log report

texts:
I added the custom mass action for invoice and shipment.

Now I need to add these custom action in Admin Action log report

following is the screenshot of default action log report

I already tried this solution Custom action logging in Magento 2 EE though it will add the Action group label in Admin action log but it will not save logs in Action log report

Any help, experience and knowledge sharing would be appreciated.


texts: Free Shipping option with multiple "Method Name"

texts:
I have a few rules for "Free Shipping", however, the output for the "Method Name" is a general label that doesn't make sense for one of my free shipping options.

Example:

Free Shipping Rule 1: Display "Shipping Courier 1"

Free Shipping Rule 2: Display "Software Virtual License"

Is there a way to change the Free Shipping "Method Name" based on a rule? If not, what would be the best way to go about this?

EDIT: Since I cannot change these products to a virtual product, is it possible to create an observer on the cart and checkout page that would treat these products with a specific attribute as a virtual product?

How would I create a basic observer to by-pass the shipping?


texts: magento 2.1.9 new order email sometimes not sent

texts:
I'm using Magento 2 for my webshop now for about 6 months and thats working fine (exept for some bugs that are solved). When a costumer orders and pays with Mollie Ideal (Dutch payment provider) an new order email goes to the costumer and myself.

The last 2 weeks in some cases the invoice is not being made and due to that also the new order email is nog being made. I can't find the root cause, sometimes it goes wright and sometimes not, strange...

Any ideas? Some tables or registers that are full maybe? Or someting with cronjobs?


texts: Is It possible to Inject Customer Attributes to wsdl.xml file dynamically in Magento?

texts:
I'm trying to develop Custom Module Magento V2 API with dynamic Elements. So for that I have written statically it's working fine. Now I need to change it dynamically

here is the question?

Normal Magento V2 API wsdl.xml file like below format

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
             name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
            <complexType name="helloHellomultiCreateAddEntity">
                <all>
                    <element name="name" type="xsd:string" minOccurs="1" />
                    <element name="description" type="xsd:string" minOccurs="0" />
                </all>
            </complexType>
        </schema>
    </types>
    <message name="helloHellomultiCreateRequest">
         <part name="sessionId" type="xsd:string"/>
         <part name="filters" type="xsd:filters" />
     </message>
    <message name="helloHellomultiCreateResponse">
        <part name="sessionId" type="xsd:string" />
        <part name="data" type="typens:helloHellomultiCreateEntity" />
    </message>
    <portType name="{{var wsdl.handler}}PortType">
        <operation name="helloHellomultiCreate">
            <documentation>Add Record</documentation>
            <input message="typens:helloHellomultiCreateRequest" />
            <output message="typens:helloHellomultiCreateResponse" />
        </operation>
    </portType>
    <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />

        <operation name="helloHellomultiCreate">
            <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
            <input>
                <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
            </input>
            <output>
                <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
            </output>
        </operation>

    </binding>
    <service name="{{var wsdl.name}}Service">
        <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
            <soap:address location="{{var wsdl.url}}" />
        </port>
    </service>
</definitions>

Required Magento V2 API wsdl.xml file need to change complexType as below

<complexType name="helloHellomultiCreateAddEntity">
                <all>
                    <?php
                            Mage::getModel('customer/customer')->getAttributes();
                            foreach($customer as $id => $key){ ?>
                            <element name="<?php echo $key ?>" type="xsd:string" minOccurs="1" />
                    <?php } ?>
                </all>
            </complexType>

Is it possible to write PHP code in .xml file? for dynamic magento attributes as elements.

Thanks.


texts: Magento 2 installation error – Allowed memory size

texts:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
  to allocate 32768 bytes) in
  C:\xampp1\htdocs\magento2\vendor\magento\module-catalog-graph-ql\Model\Resolver\Product\Price.php
  on line 1


texts: magento2 add or update items of a row builder widget programmatically

texts:
How can i add/update items of a row builder widget when clicking on a button?
I have a button in my page, and i want to update a row builder widget when a user clicks on it.
The button will send an ajax request to remote server and then i will use its response to add some items into the row widget.
my current code is like the below:

    <?php
      $dataMageInit = '
        {
            "rowBuilder":{
                "rowTemplate":"#properties-row-template",
                "rowContainer":"#properties-row-container",
                "rowParentElem":"

",
                "remEventSelector":"button",
                "btnRemoveSelector":"[id^=btn-remove]",
                "maxRows":"30",
                "maxRowsMsg":"#max-properties-message",
                "addRowBtn":"#add-property",
                "additionalRowClass":"additional",
                "hideFirstRowAddSeparator":false,
                "formDataPost":'.$block->getPropertiesJson().'
            }
        }
      ';
    ?>

    <table class="properties" data-mage-init='<?php echo $dataMageInit; ?>'>

                <?php echo $block->escapeHtml(__('Name')) ?>
                <?php echo $block->escapeHtml(__('Value')) ?>
                <?php echo $block->escapeHtml(__('Action')) ?>

                        <?php echo $block->escapeHtml(__('Number of properties exceeded')) ?>

                    <button id="add-property" type="button" class="btn btn-primary">

                        <?php echo $block->escapeHtml(__('Add Property')) ?>
                    </button>


texts: I can't understand, why I can't write just echo "Agent", but I can write echo $this->__('Agent');? And what does this method do?


texts: Magento 2 default captcha on newsletter form?

texts: How to add a default captcha on newsletter subscription form on footer.


texts: Magento2 System Requirements PHP Memory Limit

texts:
What are the system requirements of Magento 2 regarding PHP memory limit (Resource Limits: memory_limit)?

I have problems to find these informations in the System Requirements despite the second release candidate has been already pushed out.


texts: Magento 2.3.6 - How to Bulk change existing & new Product image file name for SEO

texts:
How can I change the filename of existing & new product images as per SEO instead of just sku type names.
I noticed some similar threads here, but those are for Magento 1.
Can anyone pl help me with how it can be done in Magento 2? Anyway to do this programmatically or via SQL? For both existing & new images that are added.
categoryname-productname-sku-frontview.jpg


texts:
I know it may be asked before that for Magento 1 and I remember that I had this problem and fixed it by below config in php.ini

session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

after many times I am facing a similar issue. I change session config like above but it still creates many session files (about 20-30 file in each minute).
how I can fix it?


texts: Magento 2.2.5 : Runtime Exception during setup:di:compile

texts:
The issue started when I was attempting to enter production mode with

php bin/magento deploy:mode:set production

Upon researching the issue, I attempted to see if the error gave more information when I tried to compile without entering production mode.

Here is the error I received.

Any thoughts on the next steps I can take to resolve this? The ultimate goal is to be able to switch to production mode, but this compiling issue seems to be what is preventing me.


texts: Apply Cart Price Rule (Coupon) on empty cart

texts:
Is it possible to apply a Cart Price Rule using a Coupon to a customers cart when the cart is empty?

The reason is the following:
We’d like to apply a discount code (cart price rule) for customers who use a link which includes a coupon code to visit our shop. This works fine by using the /checkout/cart/couponPost/?coupon_code=…&return_url=/ url (returns a success message). However, the cart price rule will not be applied if the cart is empty at that point (which it will be for all first-time-visitors).

Is this a limitation of Magento, that cart price rules cannot be applied or saved on empty carts?


texts: Hide shipping method for multiple store views

texts:
I am trying to create a solution for different shipping options in cart based on store view and would really appreciate any advice.

In Magento I have 1 website (abc.com) with 2 store views (general) and (vip)
I have the following shipping methods set up:
In bracket I have the admin shipping method used

Economy FREE 4-6 day delivery (Matrix shipping rates table)
Standard 1.99 2-3 day delivery (Matrix shipping rates table)
Premium 3.49 1 day delivery (Matrix shipping rates table)
FREE Premium Delivery activated when order over 99 (Free shipping method enabled)

Attached is screenshot of my shopping cart

I need the above 4 methods to be enabled on the (general) store view, but I want to disable the Economy on the (vip) store view. In Magento configurations it is only possible to disable at the website scope level. When you select a store view scope there is no ability to disable based on store view.

To hide the FREE 4-6 working day delivery I understand there may be an option to code a conditional IF statement in php code, but I very basic skill on php. I think the code may need to be placed in one of the files in checkout/cart maybe the available.phtml or shipping.phtml, something to do with sp-methods. But the php code uses a get method so I cannot access the hard code to wrap an IF statement around the specific shipping method.

I would really appreciate some help on getting the desired solution. Thanks for your time.


texts: How to find a file that render html of a function?

texts: How to find a file in Magento Core that render getPayementHtml() function (Admin Default Template)?


texts: What's the "NEW ZEND FRAMEWORK 1 SECURITY VULNERABILITY"?

texts:
Today we learned that Magento has a new vulnerability. They call it NEW ZEND FRAMEWORK 1 SECURITY VULNERABILITY.

It's described as follow here:

  To protect your site from this vulnerability, you should immediately
  check your mail sending settings. Go to the system settings used to
  control the “Reply to” address for emails sent from your Magento
  store:

  Magento 1: System-> Configuration-> Advanced-> System-> Mail Sending
  Settings-> Set Return-Path

  Magento 2: Stores-> Configuration-> Advanced-> System-> Mail Sending
  Settings-> Set Return-Path

  If “Set Return-Path” is set to “Yes,” and your server uses Sendmail,
  then your store is vulnerable to this exploit. Enterprise Cloud
  Edition customers do not need to worry about this issue. We’ve already
  checked your configuration and you are not at risk.

Currently I have settings for Set Return-Path as Specified in my EE.

Magento suggests

  Enterprise Cloud Edition customers do not need to worry about this issue

and also

  set it to NO

I am a little confused what to do till the patch arrives.

Am I vulnerable?


texts: Magento 2 : Impossible to retreive the customer id of the session in an external script

texts:
I created an external script test.php inside Magento 2 at the root. But, I don't succeed to retrieve the customer ID of the session in this external script.

The script is as follows:

<?php
require_once 'app/bootstrap.php';

$params = array(
    Mage::PARAM_RUN_CODE => '',
    Mage::PARAM_RUN_TYPE => 'store',
    'entryPoint' => basename(__FILE__)  ,
);

$entryPoint = new Mage_Index_Model_EntryPoint_Indexer(BP, $params);
$entryPoint->processRequest();

$customer_id = Mage::getSingleton('Mage_Customer_Model_Session')->getCustomerId();

echo "  customer_id session :  ".$customer_id;

To test, firstly, I authenticate a customer via Magento. Secondly, I launch the script test.php. But the customer ID session isn't displayed.

Could anyone explain how to retrieve session customer data in an external script?


texts: I am using the quick package of a magento2.3 version. Some of my jquery files like tinymce.js, plugin.js is not here in the directory that is generating issue in Magento admin. Can anyone suggest?


texts: Magento add extra field to existing section in system.xml

texts:
How can we add an extra field to an existing section in the child module in Magento 2?
Here is the code in parent module/
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>

            <group id="my_config" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                Demo Label
                <comment><![CDATA[]]></comment>
                <attribute type="expanded">1</attribute>
                <group id="group_id" translate="label" type="text" sortOrder="600" showInDefault="1" showInWebsite="1" showInStore="1">
                    Demo label
                    <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                        Enabled
                        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    </field>
                </group>

<----------Add new group using the child module-------------->

            </group>

    </system>
</config>


texts: How Can i Reset Default Category Products Count Number?

texts: I don't have products in my website but Default category shows count of the products. How can i reset?


texts: Check user is logged in or not using Javascript

texts:
If user click on button in Product view page , we are redirecting to another url [ say 1.html] with help of js code :  window.location.replace(responseData.redirect);. But i want to redirect only if user is Registered.

.js :

_ajaxCreateImg: function(dataUrl, startNumber)
{
    new Ajax.Request(this.createImgUrl, {
        onComplete: function(response) {
            var responseData = response.responseText.evalJSON();
            if(lastRequest == 1){
                this._processAjaxResponse(response);
                window.location.replace(responseData.redirect);
            }
         }.bind(this)
     });
},


texts: Magento 2.3.2 - display text/attribute in product listing page(catalogue page)

texts:
I want to display attribute(sku) on product listing page in magento 2.3.2. I have tried to code on list.phtml file under public_html/vendor/magento/module-catalog/view/frontend/templates/product with no success. Please inform name and location of file where I need to code.

In magento 1.9.4 I can code in list.phtml file located under public_html/app/design/frontend/rwd/default/template/catalog/product to achieve result.

But In Magento 2.3.2 coding in list.phtml file located under public_html/vendor/magento/module-catalog/view/frontend/templates/product is not working.

Can anyone please let me know where & how to code to display attribute sku on product listing page(catalogue page) in magento 2.3.2

thanks,


texts: Magento 2: How to get add to cart url in custom templete file and add product to cart

texts:
i am not able to get add to cart url in my custom template files , here is my code

$postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
$postData = $postDataHelper->getPostData($block->getAddToCartUrl($product), ['product' => $product->getEntityId()]);

O/p:->

string(110) "{"action":null,"data":{"product":"392","uenc":"aHR0cDovLzQ1LjMzLjEyMi42Ni9ib25hZ2UvaW5kZXgucGhwL3Rlc3QtMi8,"}}"

My add to cart form code is :

<form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $postParams['action']; ?>" method="post" enctype="multipart/form-data" validate="validate">
        <input type="hidden" name="product" value="<?php echo $postParams['data']['product']; ?>">
        <input type="hidden" name="<?php echo \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED; ?>" value="<?php echo $postParams['data'][\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED]; ?>">
        <?php echo $block->getBlockHtml('formkey') ?>

      <button type="submit" title="<?php echo $block->escapeHtml(__('Add to Cart')); ?>" class="action tocart primary">
      <?php /* @escapeNotVerified */ echo __('Add to Cart') ?>
     </button>

    </form>

while i submit form only page is load because i am getting null in post action.
Please help me to complete my add to cart code in my custom template files


texts: If a configurable product has only one option available, should it automatically select it?

texts:
I was wondering what is best practice from the customers perspective.

I have got a few configurable products from our webshop that have only one option available for selection. Should I make this option automatically select the only available option, or should it be selected by the customer?

Please see the image for explanation.

What is the best of the two ways from the customers perspective?


texts: Want to make my zipcode text field required while adding the products in the shopping cart

texts:
I am making the magento ecommerce website. I want to make the zipcode text field on product page required (compulsory to proceed the next page) before users add the products in shopping cart. I want to make compulsory for every users to check the zipcode for their area before adding the products in the shopping cart.

This is my cod.phtml code:

<?php
/***************************************
 *** Cash On Delivery ***
 ***************************************
 *
 * @copyright   Copyright (c) 2015
 * @company     NetAttingo Technologies
 * @package     Netgo_Cod
 * @author      NetGo
 * @dev         netattingomails@gmail.com
 *
 */

$msgData = Mage::helper('netgo_cod')->getConfigData();
if($msgData['zip_status'] == 1){
?>

        Zip Code : <input type="text" placeholder="Enter your pincode" value="" name="cod" class="product-custom-option" id="cod" size="29" style='color:black; font-size:12px' required>
        <button type="button" onclick="checkCOD();" name="zip-check" title="Check" class="button" id="zip-check">Check</button>

<?php } ?>


texts: Get Product Attributes to populate JWPLAYER playlist in foreach loop

texts:
HELLO I am trying to create a foreach loop which will cycle through a given list of magento products to get their attributes in order to populate a JW Player playlist. The structure of JW Player's syntax allows for the inclusion of multiple product attributes values to build a playlist, however I need to break into the foreach when it reaches the final item in order to close the playlist config.

When not being dynamically generated, the JW Player syntax looks so:

With this products collection, I want to get attributes for each product to populate the playlist:

<?php
$productCollection = Mage::getModel('catalog/product')->getCollection();
$product_file =  $item->getMediaUrl();
$product_name =  $item->getName();
$product_img = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(113, 113);
$product_description = Mage::helper('catalog/output')->productAttribute($product, $product->getShortDescription(), 'short_description');
?>

<?php foreach ( $productCollection as $_product ) : ?>

<?php endforeach; ?>

But the foreach loop show only 1 product attributes. I want it show for all products in the array $productCollection . Help please.


texts: Calling action of another module in magento through custom module with parameter?

texts: I want to call action of another module with the parameter through my custom module controller action.


texts: Magento 2 - discrepancy between documentation and theme files structure on github

texts:
I am creating a new theme and  would like to start by duplicating the default blank theme and then modify it to become my new theme.

When I checked the frontend developer guides, it indicated the theme files should be within app/design/frontend/Vendor/theme/.

But the structure of magento 2 theme files differs between the github and official magento site download:

Github has all the theme files within app/design/frontend/Vendor/theme/ folder
Magento 2 official website download has theme files within vendor/magento/theme-frontend-blank/. The app/design/frontend/magento/ folder is empty.

So currently i'm a little bit confused about which magento 2 structure should i use - github or official website download.

Any pointers appreciated.

Edit: I have found the same question on M2 forums but currently without replies.


texts: How to prevent order while placing order?

texts:
I want to prevent order on checkout page. With the use of particular condition i need stop placing order.
When i click on place order button , my order should not be place and should redirect to cart page with error message.
Do anyone have idea on this?
Thanks!


texts: how to change the name of add to cart button as customise product in particular product page

texts:
I want to change the name of add to cart button as customise product on a particular page.
Any reference please.


texts: Does Magento 1 log transactional mails that were sent?

texts: Can you view the automated transactional emails that have been sent by the system like order confirmations, password forgotten-mails and more? Is there some kind of a mail log which you can view afterwards?


texts: Set cookie in Observer Not working when full page Cache is enabled

texts:
I have to set category id in cookie when customer go to Category page and update cookie with category id when visit again using seperate module.

I have created Observer and set cookie there but not working. I have checked Observer is calling and also getting correct category ID.

Issue is with Cache. if Cache is enabled all is working fine.

  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="catalog_controller_category_init_after">

    <observer name="cookieObserver" instance="Vendor\Module\Observer\Category\Data" />

</event>

</config>

  Observer - Data.php

<?php
namespace Vendor\Module\Observer\Category;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
use Magento\Framework\Stdlib\CookieManagerInterface;

class Data implements ObserverInterface
{

const COOKIE_NAME = 'categoryId';
const COOKIE_DURATION = 86400; // One day (86400 seconds)

protected $cookieManager;

/**
 * @var CookieMetadataFactory
 */
protected $cookieMetadataFactory;

public function __construct(
    CookieManagerInterface $cookieManager,
    CookieMetadataFactory $cookieMetadataFactory
)
{
    $this->cookieManager = $cookieManager;
    $this->cookieMetadataFactory = $cookieMetadataFactory;
}

/**

 * Below is the method that will fire whenever the event runs!

 *

 * @param Observer $observer

 */

public function execute(Observer $observer)
{
    $data = $observer->getData();
    $metadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(86400)->setPath('/');
    $this->cookieManager->setPublicCookie('categoryId', $data['category']->getId(), $metadata);

return $this;
    }

}

Please provide some suggestion or help.


texts: Inline edited catch response in javascript

texts:
When making any changes in inline edit and save. The controller which is called on the save button is passing some content to the ajax call.

I want need to get that data in javascript how can i do it.

Edited
The inline edit feature of magento 2 allow to edit the record displayed in the listing.
Now once we changed the input of column and click save it go to a controller and save changes.
A controller can send some response with content. I am sending some response from the controller i want to catch that content.

In normal Ajax we call the controller and controller process that reqrest and send some content back. This content is catched by ajax call.

How can i do this with magento's 2 default inline save?


texts:
When I think I got my head wrapped around the DI system from Magento 2 something comes up and un-wraps it.
I see in the core code different ways to access a helper.
For example in Magento\Catalog\Controller\Category::_initCategory there is this:

if (!$this->_objectManager->get('Magento\Catalog\Helper\Category')->canShow($category)) {
    return false;
}

But in Magento\Catalog\Block\Category\View the helper is injected int he constructor

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Catalog\Model\Layer\Category $catalogLayer,
    \Magento\Framework\Registry $registry,
    \Magento\Catalog\Helper\Category $categoryHelper,
    array $data = array()
) {
    $this->_categoryHelper = $categoryHelper;
    $this->_catalogLayer = $catalogLayer;
    $this->_coreRegistry = $registry;
    parent::__construct($context, $data);
}

This lead me to think that the helpers should be accessed differently in controllers and blocks (and models) but then I found a controller where a helper is injected in the constructor Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute.

Please clear the fog for me.
When should I use DI and when should I use objectManager? and why?
I've read this question: Instantiating Helpers in Magento 2. This is just a follow up question on that.


texts: How to enable configurable product showing price after login?

texts:
Our website using Magneto 2.2.6
Other single products all can log in to see price but the configure products.
Don't know where I can find the setting and apply to all?
Thanks.


texts: Multiple Magento installs on seperate servers. One Inventory.

texts:
I am curious if this is possible:

I have several Magento websites with the same products all on their own servers. So each store is its' own brand but sells the same products. These are all completely seperate instances of Magento. These sites are not all connected with multistore nor do I want them to be for my own personal reasons.

Say we have store 1, store 2 and store 3. They all have roughly (if not) the same exact products, with different urls etc. Here is how I would like this process to work:

Somebody purchases a product from store 2.
Store 1, 2 and 3 ALL have that same product pulled out of inventory.

Same goes for the other stores. If someone buys a product from store 1, then store 1, 2 and 3, would all have one taken from their inventory. Basically I want each site to have the same exact inventory. I understand that this is exactly what multistore could do for me, but I am not willing to go that route.

Im assuming this may have to be done through a third party so if I was on the third party website, any updates to stock would take place on all 3 sites.


texts: Magento 2 REST API Add product to cart with custom option type file

texts:
I'm trying to add a product to cart using the REST API. I'm using a custom option to add an image, but it doesn't seem to work. This is my json object that I'm sending. The option 7819 which is text is added, but the file isn't. I've tried setting the option_value to the base64 string, but no luck.

'{
  "cartItem": {
    "sku": "f6e957d1-51b2-4a56-90be-dc3c877e3e3b",
    "qty": 1,
    "quote_id": "1234",
    "product_option": {
      "extension_attributes": {
        "custom_options": [
          {
            "option_id": "7818",
            "option_value": "file.jpg",
            "extension_attributes": {
              "file_info": {
                "base64_encoded_data": "/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUj ...",
                "type": "image/jpeg",
                "name": "file.jpg"
              }
            }
          },
          {
          "option_id": "7819",
          "option_value": "test"
          }
        ]
      }
    }
  }
}'

Greetings


texts:
I'm designing a new products widgets that will be used in our CMS page.  I'd like to call the toolbar.phtml file in order to display some information on the page, however, i'm unsure where to add this file within the .xml page and how to call this template.  This widget is located at:

  .../magento/app/design/frontend/enterprise/default/template/catalog/product/widget/new/content/new_grid.phtml

Any help or elucidation is appreciated.

Thanks.


texts: Override Magento 2 CatalogImportExport import functionality

texts:
Could someone please suggest me on how to override the Magento2 defaults CatalogImportExport functionality.

Im stuck here as my Model class is not getting overridden.

I tried below links:

http://www.ibnab.com/en/blog/magento-2/magento-2-programming-implement-import-with-import-xml

But upto no effect.


texts:
I have my url structured like so: "http://domain.com/post" where post is my module's main router url.

Then for each post I have:

http://domain.com/post/category/view/id/1.
and my url rewrite is  http://domain.com/post/news it works!

Further more I have:

http://domain.com/post/category/view/id/1/place/uk"

where /place/uk is another parameter just lie id/1

When I access this url:

http://domain.com/post/category/view/id/1/place/uk It Works !

Now here is where the problem lies using the url rewrites with /place/uk appended it does not work.
When I access this url: http://domain.com/post/news/place/uk it goes to 404.

Can anyone help with the above?

Thank you in advance.


texts:
I am new to magento, and I have got a requirement from client.
Background of requirement : There are 10 vendors pincode based and 4 main vendors zone wise, linked with my client. The client wants to route the order based on the nearest pincode vendor. The vendor can accept or deny the order received. Once the vendor denies the order, the order then goes to the main vendor of that zone. I know how to create custom modules but I am not sure how to handle this request and from where to start ?
How can I achieve this functionality and what are the aspects I need to cover in the order fulfillment under this scenario. ? Below are the major requirements on frontend :

The user enters pincode, it is checked from backend and deliverable vendors are listed along with their price list.

Once user selects a vendor and places an order the order is routed to that vendor.

What all will be the tables I need to consider to create module to achieve this requirement. Is there any similar extension for this ? I tried searching for multi vendor module but that seems little different or can I use the same and extend it, can anyone guide me by giving some idea as I have just started learning this framework.


texts: Magento 2 How to resize product gallery images?

texts:
I have to resize the product gallery images.

I'm using this link to resize image
Resize Image

but it's only allow to resize image product_base_image. While I have to resize all other image then base image.

I'm getting all images by

  $images = $_product->getMediaGalleryImages();

it's give me images data as

Array
(
[value_id] => 3424
[file] => //w/b/wb01-black-0_1.jpg
[media_type] => image
[entity_id] => 14
[label] =>
[position] => 3
[disabled] => 0
[label_default] =>
[position_default] => 3
[disabled_default] => 0
[video_provider] =>
[video_url] =>
[video_title] =>
[video_description] =>
[video_metadata] =>
[video_provider_default] =>
[video_url_default] =>
[video_title_default] =>
[video_description_default] =>
[video_metadata_default] =>
[url] => http://192.168.1.174/magento2261/pub/media/catalog/product/w/b/wb01-black-0_1.jpg
[id] => 3424
[path] => D:/xampp/htdocs/magento2261/pub/media/catalog/product/w/b/wb01-black-0_1.jpg
)


texts: Moving customers and orders between CE and EE

texts:
My client decided to merge Magento instances and migrate customers (and orders) from CE to EE. I have analyzed several options from custom plugins to database level migration and each approach has some cons. Here are the issues I see:

afer migration customer may not be able to login (different password encryption)
data model changes between CE and EE

Any help appreciated.


texts: Magento 2 remove My Account and Wishlist link from top links

texts:
I have inherited a theme from Magento's blank theme, now I need to remove the My Account and Wishlist links from the top.links block.
To remove the links, I am using Magento_Theme module's default.xml layout file. Below is the xml that I have added to remove the links:

<body>
    <referenceBlock name="my-account-link" remove="true" />
    <referenceBlock name="register-link" remove="true" />
    <referenceBlock name="wish-list-link" remove="true" />
</body>

But it does not have any effect on frontend. Please tell me if I am  missing something? or is it the right place I should place this xml?

I have checked the log files, there is no entry related to layout or top.links.