texts: Set custom price of product when adding to cart code not working

texts:
I have write module for set custom price of product when adding to cart but my code not working.

     namespace Navin\Testcart\Observer;

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

        class CustomPrice implements ObserverInterface
        {
            public function invoke(\Magento\Framework\Event\Observer $observer) {
                //echo "test";exit();
                 $item=$observer->getEvent()->getData('quote_item');
                 $product=$observer->getEvent()->getData('product');
                $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
                // Load the custom price
                $price = $product->getPrice()+10; // 10 is custom price. It will increase in product price.
                // Set the custom price
                $item->setCustomPrice($price);
                $item->setOriginalCustomPrice($price);
                // Enable super mode on the product.
                $item->getProduct()->setIsSuperMode(true);
            }

        }

Help for resolve my issue.


texts: how to display subcategory in list page filter?

texts:
I want to display the subcategories of selected category in list page.

ex:

level0:
     level1
     level1
     level1
         level2
         level2
level0
     level1
     level1
         level2

This is the basic structure of topmenu categories. I want the level1 and its respective level2 menus of selected level0 category to get displayed in the sidebar of list page as filter.

I have just tried it with the following code:

    <?php

$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$categories = $category->getCollection()
        ->addAttributeToSelect(array('name', 'thumbnail'))
        ->addAttributeToFilter('is_active', 1)
        ->addIdFilter($category->getChildren())

 ?>
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($categories) > 0): ?>

        <?php foreach ($categories as $category): ?>

             <a href="<?php echo $_helper->getCategoryUrl($category)  ?>"  >

  <?php echo $category->getName()?>

                <?php $_category = Mage::getModel('catalog/category')->load($category->getId()) ?>
                    <?php $_subcategories = $_category->getChildrenCategories() ?>
                    <?php if (count($_subcategories) > 0): ?>

                                <?php foreach ($_subcategories as $_subcategory): ?>

                                <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
                            <?php echo $_subcategory->getName() ?>

                    <?php endforeach; ?>

            <?php endif; ?>

    <?php endforeach; ?>

<?php endif; ?>

And the level1 and level2 categories are getting displayed.
Here as am getting in for loop as subcategory of category, When I click the level1 category  form the filter, only its subcategory (ie) level2 is displayed in sidebar. I want level1 and level2 categories to be displayed when level0 or level1 categories are clicked. When Level2 category is clicked the parent categories need not be displayed.


texts: Some customers don't receive confirmation email

texts: Some our our customers don't receive confirmation email.  Customers couldn't find email from their spam folder either.  We placed order to ourselves.  We didn't receive confirmation email for some orders.


texts: Import new products and new categories using import product CSV file (Magento CE 1.9)?

texts:
I want to import new products and new categories to my Magento CE 1.9 store. I want to import them all at once using Magento's native import function. During this action the new products need to be assigned to the newly created categories.

Can I do this by uploading a single CSV file?


texts: Joining Custom flat table with EAV table not Working

texts:
I am Joining two tables by following code

$collection = Mage::getModel('commission/commission')->getCollection();
    $collection->getSelect()->join(
        array('customer' => $collection->getTable('customer/customer')),
        'main_table.customer_id = customer.id');

commission/commission is my custom module and flat table. that contain customer_id.

I am getting Error like this

Can't retrieve entity config: customer/customer

I am not understanding what is happening, Please suggest anything wrong,
Thanks in advance.:)


texts: Allow cookies popup display on every page- Default Magento2

texts:
Allow cookies popup display on every page. After allowing still getting cookie popup on every page.
I am using chrome, Magento2.3.4-p2. Browser save cookie data settings are already enabled.
See attached screenshot.


texts: How can i get customer order using customer token?

texts:
In Magento2 we have rest api to get customer orders.[Route: "/rest/V1/orders"].
It can used only by admin token. I want to get customer purchased order list using customer token. I couldn't find any rest api for this.
I have seen some suggestion like overriding the above api like folowing..

<route url="/V1/orders" method="GET">
    <service class="Magento\Sales\Api\OrderRepositoryInterface" method="getList"/>
    <resources>
        <resource ref="self" />
    </resources>
</route>

But I dont know how to achieve this. I just learned to create new models. I m new for magento. Can you guys please help me out?


texts: Configurable Product Dropdown Image Switch

texts:
I upgraded my site from EE 1.14.1.0 to 1.14.3.10 and now when I navigate to a configurable product that uses a drop down (not swatches) to change the image, the image does not change.

I have looked at the solutions in these exchanges, but none of them solved my issue:

Configurable products: product image not updating after selecting attribute in dropdown

^ This solution while it technically solves my problem, it doesn't keep the options in a dropdown, but switches them to swatches. We want the options to remain in a dropdown.

https://stackoverflow.com/questions/41845427/typeerror-product-configurableswatches-is-not-a-constructor-in-magento-1-9-3

^ This solution solves a JS error I also got, but doesn't fix the images switching part.

--

As soon as I navigate to the page, these errors are generated in system.log:

ERR (3): Warning: array_merge_recursive() expects at least 1 parameter, 0 given  in /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 336
ERR (3): Warning: array_unique() expects parameter 1 to be array, null given  in /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 337
ERR (3): Warning: array_map(): Argument #2 should be an array  in /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 340
ERR (3): Warning: array_merge(): Argument #1 is not an array  in /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 340
ERR (3): Warning: in_array() expects parameter 2 to be array, null given  in /app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 345

Could this be what is causing the issue? If so, what might a solution be?

This was not an issue prior to updating. I have a support ticket out with Magento, but they are taking their sweet time (since November), so I thought I would see if anyone has any solutions.

--

Update 3/12

Magento sent me a patch that resolved the errors in system.log, but I am still unable to swap images based on the option selected in the dropdown.

In app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php update the filterImageInGallery function as follows:

public function filterImageInGallery($product, $image)
{
    if (!Mage::helper('configurableswatches')->isEnabled()) {
        return true;
    }

    if (!isset($this->_productImageFilters[$product->getId()])
        && $childAttributeLabelMapping = $product->getChildAttributeLabelMapping()
    ) {
        $mapping = call_user_func_array("array_merge_recursive", $childAttributeLabelMapping);
        $filters = array_unique($mapping['labels']);
        $filters = array_merge($filters, array_map(function ($label) {
            return $label . Mage_ConfigurableSwatches_Helper_Productimg::SWATCH_LABEL_SUFFIX;
        }, $filters));
        $this->_productImageFilters[$product->getId()] = $filters;

        return !in_array(Mage_ConfigurableSwatches_Helper_Data::normalizeKey($image->getLabel()),
            $this->_productImageFilters[$product->getId()]);
    }

    return true;
}


texts:
I have written a module to override vendor/magento/module-customer/Block/Form/Login/Login.php in app/code to change the page title. My override code is below:

<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace CoreEdits\LoginTitle\Block;

/**
* Customer login form block
*
* @author      Magento Core Team <core@magentocommerce.com>
*/
class Login extends \Magento\Customer\Block\Form\Login\Login
{
/**
 * @Override Title
 */
protected function _prepareLayout()
{
    $this->pageConfig->getTitle()->set(__('Customer Login - Test'));
    return parent::_prepareLayout();
}
}

EDIT: This is my di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<preference for="Magento\Customer\Block\Form\Login\Login" type="CoreEdits\LoginTitle\Block\Login"/>
</config>

However, when I run setup:upgrade the title remains the same. Is the above code correct?


texts:
I forgot to disable symlync before apply to patch 9767 now if i enable
  form key validation my checkout is not working .can you please assist
  me now what i have to do


texts: Magento 2 theme giving error Unable to load theme by specified key: 'Yogesh/mytheme'

texts:
I have try to create custom theme I have got following error.

  Unable to load theme by specified key: 'Yogesh/mytheme'

Below is my folder structure.

\magento2\app\design\frontend\Yogesh\mytheme

media

preview.jpg

composer.json
registration.php
theme.xml

Following are content of files.

Composer.json

{
    "name": "magento/theme-frontend-blank",
    "description": "N/A",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/theme-frontend-blank": "100.0.*",
        "magento/framework": "100.0.*"
    },
    "type": "magento2-theme",
    "version": "100.0.1",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/Yogesh/mytheme',
__DIR__
);

theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>Yogesh mytheme</title>
 <parent>Magento/blank</parent>
 <media>
     <preview_image>media/preview.jpg</preview_image>
 </media>

I have try with php bin/magento setup:upgrade but my module is not registered, not showing in config.php.

After I have try to setup:static-content:deploy but my theme content not deployed.

My theme is not able to load what mistake I have doing?


texts:
Is there a possibility when the stock is 0, people can still place an order and that it will be a backorder.

Thanks for the support.


texts: I need to upgrade my Magento store from 1.7 to 1.9. I am very new to Magento, SSH and MySQL. I was just wondering what is the easiest way to upgrade without breaking my website.


texts: How to solve direct object instantiation warning

texts:
I used following code

->order(new \Zend_Db_Expr('FIELD(option_id,' . implode(',', $totalPro).')'));

That give following warning.

  Direct object instantiation (object of \Zend_Db_Expr) is discouraged
  in Magento 2.

How to remove this warning?


texts: Set landing page for Newsletter Confirm Subscription action

texts:
When a customer subscribes to newsletter, he receives an email (app/locale/en_US/email/newsletter_subscr_confirm.html) which contains a confirmation link.

{{var subscriber.getConfirmationLink()}}

Is there a way to set the landing page for this link? So I can display a "Thank you" text in there and some other information?


texts: How to migrate products changes after delta migration from m1 to m2?

texts: I have done data migration from m1 to m2, after that changes have been made in m1 products. Now i want to migrate product changes from m1 to m2. I have done delta migration but as we know it doesn't update the existing products changes. Any help or advice will be appricated.


texts: Magento 2 How add dynamic rows field to custom widget

texts: I need add dynamic rows field to my custom widget, which should have three columns: title(text field), color(select field), url(text field). There should also be an add button, and delete buttons for each row. If possible, it would be nice to be able to swap lines. I suppose in widget.xml I have to declare a block type and specify a class, but I don’t understand how the code of this class should look.


texts: Email header & footer( theme ) not set to custom email in magento 2?

texts:
I created a custom email with the following code.
public function SendEmail( $orderId, $shipping_label_path,$pdf_name ,$customer_name, $customerEmail )
{
    try {
        $this->inlineTranslation->suspend();
        $sender_name = $this->scopeConfig->getValue('general/store_information/name',\Magento\Store\Model\ScopeInterface::SCOPE_STORE);
        $sender_email = $this->scopeConfig->getValue('trans_email/ident_general/email',\Magento\Store\Model\ScopeInterface::SCOPE_STORE);
        $sender = [
            'name' => $this->escaper->escapeHtml($sender_name),
            'email' => $this->escaper->escapeHtml($sender_email),
        ];
        $transport = $this->transportBuilder
            ->setTemplateIdentifier('ayakil_email_label_template')
            ->setTemplateOptions(
                [
                    'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
                    'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
                ]
            )
            ->setTemplateVars([
                'customer_name'  => $customer_name,
                'shipping_label'  => $shipping_label_path,
                'order_id' => $orderId
            ])
            ->setFrom($sender)
            ->addTo($customerEmail)
            ->getTransport();
        $transport->sendMessage();
        $this->inlineTranslation->resume();
    } catch (\Exception $e) {
        $this->logger->debug($e->getMessage());
    }
}

The email template file looks like this.

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

{{trans "Dear"}} {{var customer_name|escape}},

 Please find the shipment label to use when returning your items.

{{trans "Shipping Label"}}

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

My email_templates.xml file looks like this.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
<template id="ayakil_email_label_template"
          label="Shipping label customer notification template"
          module="Ayakil_Retrun"
          file="ayakil_retrun_label_send_customer.html"
          type="html"
          area="frontend"/>
</config>

Whenever email fired, The default header and footer picking in the email. Not the theme header & footer. How can I fix this?


texts: How to disable proceed to checkout button when enter invalid post code in Magento2.1?

texts:
We need to disable 'Proceed to Checkout' button on the cart page, When user enter invalid postal/zip-code using custom module.

Please help to find a solution.


texts:
I created a custom observer to add some additional prices in product before placing order.
I created an observer to sales_order_place_before and here's my code for observer:

<?php
class CustomPriceUpdate_Checkout_Model_Observer{
  public function update_price($observer){
    $quote = $observer->getEvent()->getOrder();
    foreach ($quote->getAllItems() as $item) {
        $product = $item->getProduct();
        $product_id = $product->getId();
        $price = $item->getPrice();
        $discountprice = 23;
        $newPrice = ($price)+($discountprice);
        $item->setCustomPrice($newPrice);
        $item->setOriginalCustomPrice($newPrice);
        $item->getProduct()->setIsSuperMode(true);
        $item->save();
        Mage::log($newPrice, null, "order.log", true);
    }
    $quote->save();
  }
}

But its not saving the product price. I am getting the new price in the order.log file, that means by observer is triggering correctly.

It just need to save the new price.
Please someone suggest me any options.


texts: I'm using magento 2 and I'm trying to add the facebook pixel code into it , what's the right file to add it ?


texts: Mutually inclusive and possibily Mutually exclusive issue with options

texts:
Listing a product that is in two pieces, with options for each. If an option for "A" is selected, only "A" will be added to the cart. if option for "B" is added, then only "B". If option for "A" and "B" are selected, then both "A" and "B" is added as a single line item.

A simple example: https://ujena.com.br/index.php/rockstar-veneziana-614.html

It seems that an option can be either "mandatory" or "optional". Setting all options to "optional" solves the problem, however introduces the problem of having an item added with no options. Is there a way to make the options one or the other, or both, but at least one? Option "A"

Or option "B" solution, where is the option checking code for post data? I can recode the check function in the receiver of the post data.


texts: Add search functionality in admin for select

texts:
Hi I want to add search functionality in select box in admin form.
screenshot: https://nimb.ws/Rj5osS , anyone had any idea?
I have this code which creates the field:
$baseFieldset->addField(
            'magento_id',
            'select',
            [
                'label' => __('Magento Attribute'),
                'title' => __('Magento Attribute'),
                'name' => 'magento_id',
                'required' => true,
                'options' => $Mage_Attribute
            ]
        );


texts: How to call static block from Category Layout Update XML Magento 2?

texts:
I am trying to call a static block in category page after category products.
I have added a below code in category design layout update xml but nothing is displaying.

<referenceContainer name="content">
<block class="Magento\Cms\Block\Block" name="search-block" after="category.products">
<arguments>
<argument name="57" xsi:type="string">search-block</argument>
</arguments>
</block>
</referenceContainer>

Display mode is staticblock and products.

Thanks for your answer in advance.


texts: I need to display the tax rate (varies with different countries) next to shipping text on cart page. How could I print the tax rate used in template php file?


texts: Magento 2: How to add Estimate Shipping and Tax in Minicart?

texts: I want to add  Estimate Shipping and Tax block on Minicart. It is possible to calculate tax and shipping from minicart block?


texts: Magento 2 Custom Payment Method Not Visible on Checkout Page

texts:
Magento 2 Payment Method not showing in checkout page

app/code/payhere/payhere/registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Payhere_Payhere',
__DIR__

);

app/code/payhere/payhere/etc/config.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
    <default>
        <payment>
                <payhere>
                <active>1</active>
                <title>PayHere</title>
                <order_status>pending_payment</order_status>
                <instructions>Instruction.</instructions>
                <title>PayHere</title>
                <payment_action>true</payment_action>
                <model>Payhere\Payhere\Model\Payhere</model>
                <group>offline</group>
            </payhere>
            <!-- payment-config -->
        </payment>
    </default>
</config>

app.code/payhere/payhere/etc/module.xml

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

app/code/payhere/payhere/etc/payment.xml

<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="../../../Magento/Payment/etc/payment.xsd">
    <groups>
        <group id="offline">
            <label>Offline Payment Methods</label>
        </group>
    </groups>
    <methods>
        <method name="payhere">
            <allow_multiple_address>1</allow_multiple_address>
        </method>

    </methods>
</payment>

app/code/payhere/payhere/view/frontend/web/js/view/payment/payhere.js

define(
    [
        'uiComponent',
        'Magento_Checkout/js/model/payment/renderer-list'
    ],
    function (
        Component,
        rendererList
    ) {
        'use strict';
        rendererList.push(
            {
                type: 'payhere',
                component: 'Payhere_Payhere/js/view/payment/method-renderer/payhere-method'
            }
        );
        /** Add view logic here if needed */
        return Component.extend({});
    }
);

app/code/payhere/payhere/view/frontend/web/js/view/method-renderer/payhere-method.js

define(
    [
        'Magento_Checkout/js/view/payment/default',
        'mage/url'
    ],
    function (Component, url) {
        'use strict';

        return Component.extend({
            defaults: {
                template: 'Payhere_Payhere/payment/payhere'
            },
            redirectAfterPlaceOrder: false,
            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            },
            afterPlaceOrder: function () {
               window.location.replace(url.build('payhere/payment/request'));
            },

        });
    }
);


texts:
I am trying to change favicon for custom module in same theme but stuck in it. Actually I want to show different favicon when specific module action in called wanted to show different favicon and for all remaining modules and theme remains the same as old one.
Can anyone give me any idea how can I achieve this.
Thanks in Advance.


texts: After Enabling SSL magento still loads default Javascript and CSS files with unsecure URLs

texts:
I enabled SSL in magento through following system configuration settings:

System > Configuration > General > Web > Secure > Use Secure URLs in Frontend > Yes
System > Configuration > General > Web > Secure > Use Secure URLs in Admin > Yes
System > Configuration > General > Web > Secure > Offloader header > SSL_OFFLOADED
System > Configuration > General > Web > Secure >  Base JavaScript URL > {{secure_base_url}}js/

Above setting completely breaks the frontend and gives the error Blocked loading mixed active content because all the Javascript and CSS files are being loaded through unsecure URLs using http. My {{secure_base_url}} is having https and a trailing slash.
These settings also leave the admin panel inaccessible as it gives the error "This page is not redirecting properly" when accessing backend.
I am aware, similar questions have been asked here before and I tried all the solutions, but none of it is working.
I can make it work temporarily by forcefully changing unsecure URLs to secure ones. But this is not the best way. Ideally, when the request is on https, Magento automatically takes the secure Javascript and CSS URLs.
Any idea why this is happening ?


texts: Problem with the customer groups after importing the magento csv customer data

texts:
I need help about a problem I met after importing my customers data in Magento.

I imported the data via csv to a new magento in order to create a new website,
but I met a problem concerning the customer groups.

I cannot find the reason why but for some customers account, after saving their data, they are changed from the "domestic market customer group" to the "overseas customer group".

From what I was able to check, It seems there is nothing in common between the customer accounts that are changed from one group to another.

Would anybody know why this is happening?


texts: Magento 2 : Remove "Add new Address" Button in 2nd Step of Checkout Process for Customer Group

texts: I created one customer group. How to disable(remove) "Add new Address" button in checkout process for customers who belonging to this group?


texts: How can I get the number of customers that bought a product?

texts: I am in product view page, and I want to display the number of customers that bought that particular product.


texts:
I want to use array_map() method in my code, but i need to pass an array and the 'product' object.
There's solutions to do it but my question here is : if it's a good practice, or how horrible is to do something like:

[...]
private $myproduct;
[...]
$this->setMyproduct($product);
[...]
$product = $this->getMyproduct();
[...]

My doubt is if php save the object again, what looks like a lot of work for the code, or if only save a reference to it and it's fast and a good manner to have my product where i want.

Thanks


texts: Issues combining secure_url with noaction

texts:
I have a custom module with frontend actions that I want to be secure. So in my module's config.xml file I put this:

<secure_url>
    <mymodule_controller>/mymodule/controller</mymodule_controller>
</secure_url>

On it's own, this works great.

Secondly, in my controller's Index action I have this:

if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
    $this->norouteAction();
    return;
}

If I browse to example.com/mymodule/controller (or example.com/mymodule/controller/index) over HTTP, Magento redirects me to HTTPS, then sees that I'm not logged in and tries going to the norouteAction which is on HTTP, so Magento forces HTTP, and then it loops.

I get an infinite redirect loop.

Is there a way to use the noroute from an secure controller action without causing redirect loops?


texts: Sample files to use Magento 2 API REST and SOAP

texts:
How can I use the REST and SOAP?

I'd like to have sample PHP files to use each one.

I'm using the Magento 2.1.

Thanks


texts: How can I change language in param of REST API?

texts:
I want to change language in REST API.

ex.

integration/customer/token for Japanese is "error message = Japanese translation"
integration/customer/token for English is "error message = English translation"

Can I ?

I tried
http://[mydomain/rest/[store_id]/V1/integration/customer/token

store_id = Japanese locale store, I set. (Default store is English locale)

=> response error message is English. ( I want Japanese response ...)


texts: How to prevent bots from appearing in "Online Customers" in backend?

texts:
Checking the "Online Customers" in Magento's backend shows a lot of bot IP addresses. These bots include bots like google crawler.

Is there a way to filter those out, so I can see only real visitors?

I suppose that might require a list of IP addresses/ranges. For some bots they are publicly available, so I guess that is not a problem.

But how do I actually hide them from the backend? Is there any extension made for this?

EDIT:
Please note:
These are bots I would like to continue accessing my site, so I would not want to block them from accessing my site, so blocking bots is not an option. I simply want to filter the display, so they do not appear in the given list.

(using Magento CE 1.9.1)


texts: Create customer using customer repositoryInterface magento2

texts:
I am creating customer with repositoryInterface

below is my code

 <?php
 namespace [Vendor]\[Module]\Model;
 use [Vendor]\[Module]\Api\CustomCharityInterface;
 use Magento\Store\Model\StoreManagerInterface;
 use Magento\Customer\Api\AccountManagementInterface;

class CreateCustomer implements CustomCharityInterface
{
protected $_storeManager;
protected $customerRepository;
protected $accountManagement;
protected $customerFactory;
protected $addressFactory;
protected $customerInterfaceFactory;
protected $encryptInterface;

public function __construct(
    \Magento\Framework\ObjectManagerInterface $objectManager,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    AccountManagementInterface $accountManagement,
    \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
    \Magento\Customer\Model\CustomerFactory $customerFactory,
    \Magento\Customer\Model\AddressFactory $addressFactory,
    \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerInterfaceFactory,
    \Magento\Framework\Encryption\EncryptorInterface $encryptInterface

) {
    $this->_objectManager = $objectManager;
    $this->_storeManager = $storeManager;
    $this->accountManagement = $accountManagement;
    $this->customerRepository = $customerRepository;
    $this->customerFactory  = $customerFactory;
    $this->addressFactory  = $addressFactory;
    $this->customerInterfaceFactory  = $customerInterfaceFactory;
    $this->encryptorInterface  = $encryptInterface;
}

/**
 * {@inheritdoc}
 */
public function createCustomer($params) {

    // Get Website ID
    $websiteId  = $this->_storeManager->getWebsite()->getWebsiteId();
    $customer = null;
     try{
        $customer = $this->customerInterfaceFactory->create();
        $customer->setWebsiteId($websiteId);

        $email = "test@gmail.com";
        $customer->setEmail($email);
        $customer->setFirstname('test');
        $customer->setLastname("test");
        $password = "1234567";
        $hashedPassword = $this->encryptorInterface->getHash($password, true);

        $customer->setCustomAttribute("position","Manager");

        $this->customerRepository->save($customer, $hashedPassword);

     }
     catch(\Exception $e)
     {
            print_r($e->getMessage());
     }

}

}

After using above code customer is not getting created, Please anyone help me in this code


texts:
I developed my own extension but in order for it to work it requires the PHP JSON extension. How can I specify that requirement for module installation? Do I have to mention it in the composer.json?
And what about Magento 1?


texts:
I have around 80 different customer groups, with different prices on.
How can I find out how many customers are in any given group?
Can I make a list of all customers included in customer group?
I have this but it gives me error Fatal error: Class 'Mage' not found in /domains/dev.domain.co.uk/http/customer_groups.php on line 3
UPDATE: adding:
require_once('app/Mage.php');
Mage::app();

Fixed it.
Update 2:
Error:
Fatal error: Call to a member function addField() on a non-object in /domains/dev.domain.co.uk/http/customer_groups.php on line 19
Where do I have to place the code to get the result. I found this code and this supposed to be a outcome but I'm struggling implementing it.
UPDATE 3
This is my code, it displays almost everything exactly as I want, except, there are gaps in between the groups, also could I have a group ID with it too?

require_once('app/Mage.php');
Mage::app();

$_customer = array();
$customerCollection = Mage::getResourceModel('customer/customer_collection');
foreach ($customerCollection as $customer) {
    $_customer[$customer->getGroupId()][] = $customer->getId();
}

$_groups = array();
$groupCollection = Mage::getResourceModel('customer/group_collection');
foreach ($groupCollection as $group) {
    $_groups[$group->getId()] = $group->getCode();
}

foreach ($_customer as $groupId => $customerIds) {
    echo 'Group "' . $_groups[$groupId] . '" has ' . count($customerIds) . ' customers.<br>';
}


texts: how to give download link to var/export/export_customers.csv?

texts:
Normally after successful running export customers data flow profiles its saving data to var/export folder, but I want to download that file to desktop.

Can you give any suggestions?


texts:
We have already know that How to redirect from an Observer for magento 1.x version.

but for magento 2,we does not know How to forcefully do redirection from an observer.

I have done google ,but does not get any answer.


texts: remove block and after that adding the block

texts:
so I came across a question which I don't understand it properly

    <default>
    <reference name="header">
    <remove name="top.menu"/>
    <block type="core/text_list" name="top.menu" as="topMenu">
    <lable>Navigation Bar</label>
    <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
</block>
</reference>
</default>

in my understanding we have a header block somewhere else and we referenced to it,then we remove the block of top.menu within this block
then we add a structural block of top.menu and then we add other block within this block which is a template of top menu
so I don't really know what's happening does the top.menu has been deleted? or it isn't and it has been added again?
can someone explain it to me in a way I can understand blocks better?

the answer was the block will never be displayed! and It seems I was right and it is not the correct answer

Is there any way that we delete the block and after that we add the same block so that in the end we didn't change anything? for example I have block A I remove it once but again I add block A again and still I can see it in the page

Thanks


texts: Change Product Description when clicking Color Swatch

texts:
I am using Magento CE 1.9.1.0 and I am using the Configurable swatches function so that I can display color icons and when you click on a color icon it changes the product image to that colored image. This is working just fine. However What I am wanting to do is change the product description dynamically when you click on a different color swatch.

So for example the default product description may say "this white shirt comes in many colors". Then if you click on the red color swatch I want the product description to dynamically/automatically change to say what ever is in the "red" products description box which might be something like "this red colored shirt is 100% cotton".

Can anyone suggest what the code for this would be? I am thinking I would just need to edit the view.phtml file in the catalog/products directory however not sure what the code would be.
I also want to display the product title and some attributes values for each color swatch. Like some color swatches have a machine washable = yes value while others have a Machine washable = no value.


texts: How to call the Shop now categeory in side the seach bar

texts: I want to call the shopnow categeory inside the search bar as a filter option in the search bar.


texts: Stock quantity not increasing after cancellation

texts:
I have installed Magento 1.8. When a user orders a product, the quantity is decreased by one, but if he cancels that order (before invoicing), the stock quantity does not gets increased.

Admin > Catalog > Inventory > Stock Options > Set Items Status to be In Stock When Order is Cancelled is set to Yes

The code I have been using to cancel order is as follows:

class Kaushikamdotcom_Pay_OrderController extends Mage_Core_Controller_Front_Action {
    public function cancelAction() {
        if (($order_id = $this->getRequest()->getParam('order_id'))) {
            $order = Mage::getModel('sales/order')->load($order_id);

            $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true);
            $order->save();
        }

        $this->_redirect('sales/order/history');
    }
}

The code I have been using to know the current stock is as follows (The same can be also seen in the admin side):

Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();

Why is the quantity not get increased ? Is it the intended behavior ? I searched in google, on those links I have been instructed to do it programmatically.


texts: Magento2: I need to override the footer in my custom module

texts:
I have checked the best solution. But not able to override the footer for my custom module.

Does anyone have a solution for this?

Thanks


texts: Magento 2 Add Shipping Option Charges in shipping method amount

texts:
How I can add selected shipping option charge in selected shipping method price.
Here i have 2 shipping option add charge in shipping method original price based on customer shipping option selection.


texts: Magento 2 : Get image file from custom_option folder

texts:
I have a custom option of type file where I am allowing user to upload photo while adding a product to cart.

I am using the REST api to get the cart items. Below is the response for the same.

[
    {
        "item_id": 525,
        "sku": "782-169",
        "qty": 1,
        "name": "simple product 1",
        "price": 0,
        "product_type": "simple",
        "quote_id": "538",
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": "3",
                        "option_value": "image/png,photosample.png,/var/www/html/magento2/pub/media/custom_options/quote/p/h/photosample.png,custom_options/quote/p/h/photosample.png,custom_options/quote/p/h/photosample.png,457,40,40,700e78d4f014ef0da997"
                    }
                ]
            }
        }
    }
]

URL I am using to fetch the image is : http://local.magento2.com/media/custom_options/quote/p/h/photosample.png

It gives me 404 error. I also tried below urls
http://local.magento2.com/media/customoptions/quote/p/h/photosample.png
http://local.magento2.com/media/custom_options/quote/p/h/700e78d4f014ef0da997

But same error I am getting. Can anyone please help me here?


texts: Magento2: Session messages not removed properly - persist across multiple requests

texts: I have facing in cache issue in my magento 2 store here if i submit any form getting error and success message coming  when refresh page.i don't understand why this issue comes again and again .if any one facing same issue please suggest me and reply me as soon as


texts: Redirected to dashboard when something is wrong

texts:
I'm trying to build a Magento 2 module that has an admin section.
But apparently I'm doing something wrong and when I click the admin menu link, I get redirected to the dashboard.
I've seen this question: Magento2 custom admin menu link is redirecting back to admin dashboard but that does not help much.
There is nothing in the logs, but for the moment, I don't care what the problem is.
What I need is a way to debug this.
Where is the actual redirect happening so I know where to start?


texts:
I am trying to setup Magento on my recently purchase MAMP Pro, hoping to setup a testing environment, similar to production site.

I added my server name as div.example.com
use port 80, 443,3306 www/mysql
use self-signed SSL, and put in my project root folder
I tested with a simple index.php with hello world call, everything looks ok
I copy the magento file, I got a 403 error

I am pretty sure, it have to do with the .htacess file magento come with anyone have any experience with it? please help.


texts: Overriding send email functions with custom functions

texts:
I have to pass the transactional email templates lots of custom variables. The solution many have found to this is to load the necessary variables and collections in the email send function, and pass them in the array to the transactional email template. So, for instance, in app/code/core/Mage/Customer/Model/Customer.php we edit the code to look like:

public function sendPasswordResetConfirmationEmail()
{
   $storeId = $this->getStoreId();
    if (!$storeId) {
        $storeId = $this->_getWebsiteStoreId();
    }
    $customVar = $this->getCustomvar();

    $customCollection= Mage::getModel('namespace_extension/customcollection')->load(5);

    $this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
        array('customer' => $this, 'customvar' => $customVar, 'customcollection' => $customCollection), $storeId);

    return $this;
}

With the edit, customvar and customcollection are loaded and passed with the array to the email template. Now one can reference these in the transactional email template by {{var customvar}} or {{var customcollection.name}}, etc.

Obviously, the huge problem with this is that it is editing core files, which should not be done. I am still relatively new to Magento and unsure how I can override or add to these methods without directly editing the core files. I assume it will involve a module of some sort, but I'm really at a loss on how to do this, and time spent searching the web has simply yielded the existing and flawed solution.


texts:
My client is using IQ software. They want to integrate the necessary stock levels to the website so it pulls the data so there is no chance of selling an item that is not in stock.

How can I achieve that?

They want two synchronization way. Is that possible to achieve this?

Please help.

Thanks in advance

Pearl


texts: Best Practices for Planning Attributes and Attribute Sets

texts:
We have a tool shop and anticipate having around 40K simple products. With that we anticipate having around 2500 attribute sets, and as many as 10,000 attributes. I'm concerned about system performance, searching and page load speed. Would it be better to try to reuse as many attributes as possible?

For example Size, Color, Type, Material are attributes used frequently. These are filterable attributes too, so we will have to set them up as dropdown attributes.

Question: Is it better to try to reuse these attributes among many different attribute sets? Or would that be harder for the store owner when he's maintaining all these products.

Please advise and let me know what the best practices are.

Thx!


texts: Magento API adding a custom attribute to the sales_order.list output

texts:
Looked all over the web and have only managed to pull through the api a custom field I’ve added for sales_order.info using api v1 without any problems, however, I can’t seem to get it to pull through that value when calling a LIST of orders rather than a single order – seen nothing on the web specific to that call.

I’ve created my own module fine and have simply extended the Mage_Sales_Model_Order_Api class and inside the info() function I’ve simply added:

$customerId = $order->getCustomerId();
$customer = Mage::getModel('customer/customer')->load($customerId);

$result['sp_user_id'] = $customer->custom('extra_user_id');
$result['sp_client_id'] = $customer->custom('extra_client_id');

Works perfect when calling the sales_order.info method, but on the list method I'm not getting those fields passed back to me afterwards.

EDITING AGAIN TO BUMP - Hopefully someone has an idea I am really struggling!


texts:
How do I overwrite the core Gallery.php?
from

  vendor/magento/module-catalog/block/View/Gallery.php

to

**app/design/ ...?**

Please help, Thanks


texts: Getting Error Unique constraint violation found - When remove suffix .html in magento 2

texts:
I Am getting error when I am removing .html from Category URL Suffix.
Error is Unique constraint violation found.

Anyone have genuine solution for this.

Thanks


texts:
This is a 2 part question.
Main question:

How risky is to delete the records from the *_cl tables (cataloginventory_stock_cl, catalog_product_attribute_cl, ...) where the version_id field is lower that the version of index associated to the _cl table in the mview_state table?
Example.
The  mview_state version for cataloginventory_stock is 5000.
In the cataloginventory_stock_cl table I have 10k records with version_id below 5000.
Is it OK to delete those?
Note: I've read the explanations about the mview provided in here: what is mview in magento2? and I concluded that the cron with code indexer_reindex_all_invalid does exactly what I'm trying to do (I may be wrong here).
The cron does not run anymore because the stock index is set on 'Update on save'.

Bonus question:
How risky it is to completely clean all the _cl tables if I'm sure that all the indexes have been rebuilt and are up to date?


texts: Testing Pull Requests and Patches from Magento 2's GitHub

texts:
I'd like to test the following patch applied by the community. As seen here, https://github.com/magento/magento2/pull/13359/files.

Since I've always installed Magento via composer, is there an easy way to test this patch against a Magento 2.2.2 install where the code exists in the Vendor directory?  In Magento 1, I could see testing this in app/code/local/Mage, but since that no longer exists what does everyone recommend as a solution?

Thanks!


texts: Magento 2.4 is loading from pub folder not root folder

texts:
I am have installed Magento 2.4 successfully. I don't know why it's loading from the pub folder, not the root folder. I have followed all the document still not working.
The links I have followed
https://firebearstudio.com/blog/magento-2-css-and-javascript-files-are-not-loading.html,
Magento 2 CSS and JavaScript not loading from correct folder.
Still no USE. CSS and Javascript file even admin URL also not loading. Can anyone help to fix it?
Thanks.


texts: Magento 2 Associate Certified Developer Progtis Ended?

texts:
Anyone known that adobe ended the Magento Associated Certification Program?(Magento 2 Associate Certified Developer Exam).
If Not, Then guide me which program is alternate of Magento 2 Associate Certified Developer Exam?
Thanks...


texts: Magento 2: How to get the full size of the page?

texts:
I need to get the size of the whole page to gain space, I've tried it with CSS but there's no way.

As I show in the image I would like to get the empty space that remains on the side edges.

How to do it?


texts: Allow Only Specific Payment Methods Available on Particular Cart Price Rule (Coupons)

texts:
We have two payment methods.

COD (Cash on Delivery)
HBL Pay

When user inputs a coupon code AYZ223.
Then only HBL Pay should be visible as a payment method because of that coupon.
Otherwise all payment methods should show.
Please Guide me how to do that.


texts: Product reviews aren't shared between store views - bug or feature? Magento 2

texts:
I'm using Magento 2.2.2. and just noticed that product reviews aren't shared between store views. Is this a bug or a feature?

For example my test customer which reviewed many products only sees the reviews on the store view on which the review was created.

Is there a way to share reviews between store views?


texts:
I have recently upgraded Magento  with the Latest Magento 1.13.1.0.
Now the issue is the URLS in older version are like

categroy1/subcategory1/test-product.html
category2/test-product.html
brand/test-product.html
brand/new-product.html

where the product is assgin to 3 different categories. But after upgrade and when i run the url_migration_to_1.13.php all the urls are updated and the new url are weird.

Some of the urls are like

test-product-1.html
new-product-1-395db788289ee286662bbcabe78d99da.html

My client do not want to lose any previous URLs from older Magento.

Can any one suggest me any idea?

Thanks


texts: How to get best-selling category base on most selling product and one more? It should not take too much loading time.


texts: Magento 2 automatically appends form key at the end of my ajax call

texts: I am trying to use jquery to perform ajax call to a magento rest api from a custom backend (admin) module. For some reason, every time I perform ajax call, the query parameter isAjax=true automatically gets appended to the url, and &form_key=mJRSj3FScbiIKWsl automatically gets appended to my request payload. Is there any way I can prevent this?


texts:
Using Magento Community 1.4.0.1
In the Admin Sales Orders template, I have set the row heights and column widths to be able to show more data like this:

Now, I want to set an anchor tag for the order number. This is what gets set to the TITLE attribute, I want to create an
anchor so that I can right click and open in another tab.
This is a sample of the title attribute value:
%store_url%/admin/sales_order/view/order_id/141799/key/0fab5c58e60debb542519cbe0879a857/

How/where would I do that?


texts: Magento 2.2.6 Product Pages Not Opening after upgrade

texts:
The product detail pages on my site are no longer opening after upgrading from magento 2.2 to 2.2.6

There are no error rather
a catalog search results page is loading instead

http://mydomain.co.uk/catalogsearch/result

I have tried restoring .htaccess files (as many as i could find) however I know I dont have all of them in any case it may be something else but it was working without any issue before upgrade - I have tried running a url rewrite too for full site but this did not fix issue

I have tried with and without elasticsearch on the site but makes no different product pages are not opening

Please can someone help


texts: Magento 2 : Product Table Name in Database

texts: In my case, I created multiple users and created two or three products from each user from admin panel. So I want to know the name of the table in which username added with product??? please help....


texts: Custom Module Fatal error: Call to a member function toOptionArray() on a non-object

texts:
Fatal error: Call to a member function toOptionArray() on a non-object in /home/myName/public_html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 463

I've looked at numerous sites and StackExchange threads with the same error and I still can't figure out why the error is being thrown.

I'm using a customized extension for tracking customers. Having the entire system.xml file on the server throws the error on my entire System Configuration page.

After commenting out different parts, I've narrowed the error down to having to do with the following bit from the system.xml (the source_model):

<fields>
<tipe translate="label">
   Tracking Type
   <frontend_type>select</frontend_type>
   <source_model>pixel/system_config_source_tracktype</source_model>
   <sort_order>1</sort_order>
   <show_in_default>1</show_in_default>
   <show_in_website>1</show_in_website>
   <show_in_store>1</show_in_store>
</tipe>
</fields>

What I have for models within my config.xml:

<models>
     <pixel>
         <class>PixelMarket_Pixel_Model</class>
         <resourceModel>pixel_system</resourceModel>
     </pixel>

     <pixel>
         <class>PixelMarket_Pixel_Model</class>
         <resourceModel>pixel_mysql4</resourceModel>
     </pixel>

     <pixel_mysql4>
          <class>PixelMarket_Pixel_Model_Mysql4</class>
                 <entities>
                        <reftable>

reftable

                        </reftable>
                  </entities>
      </pixel_mysql4>

</models>

My class within Tracktype.php is:

<?php
 class PixelMarket_Pixel_Model_System_Config_Source_Tracktype

{

public function toOptionArray()
{
    $tmp[] = array(
                'value' => '',
                    'label'=> ''
            );
    $tmp[] = array(
                'value' => 1,
                    'label'=> 'Full Tracking'
            );

    $tmp[] = array(
                'value' => 2,
                    'label'=> 'External Referrer Tracking Only'
            );

    return $tmp;
}

}

Path of Tracktype.php same as class.


texts: Magento 2.1 Multistore - Invoice not created

texts:
I have 5 stores (5 domains) running on magento 2.1
The last store I created doesn't create invoice after an order is completed
because of that the order confirmation email isn't sent to the customer.

Does anyone know why this is the case and how I can fix it?

FYI: I do use another currency here.

Thank you!


texts: Magento2 : PayPal Standard error "Express Checkout has been canceled"

texts:
I am using Magento2.2.0 and I have enabled Payments Standard(Accept credit card and PayPal payments securely) and set up paypal email , API username , API password, API Signature etc.

Now on frontend when I am placing an order with PayPal standard, it is being redirected to PayPal page and if I complete the full Payment Process it is working fine.

But If I cancelled the payment, it is redirected to Shopping Cart Page with the message "Express Checkout has been canceled".

Now my question is I have set up PayPal Standard but why it is giving error "Express Checkout has been canceled".


texts: Magento - Is it possible to attach a xlsx file to a transactional email?

texts:
Currently i attach CSV file in transaction mail.

my code is

 $transactionalEmail->getMail()->createAttachment($string,'text/UTF-8')->filename = 'order_'.$report_date.'.csv';

but want to send xlxs file transaction email

i used

 $transactionalEmail->getMail()->createAttachment($string,'text/UTF-8')->filename = 'order_'.$report_date.'.xlxs';

xlxs file attached in mail but didn't open properly.

please suggest?


texts: Transferring a bespoke Customer Address attribute to the Customer Address Data layer

texts:
I've added a static Customer Address attribute (for some reason, other didn't work, but whatever; another time):

$setup->addAttribute('customer_address', 'xxx', [
    'type' => 'static',
    'input' => 'text',
    'label' => 'XXX',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'visible_on_front' => 1,
    'group' => 'General',
    // 'used_in_forms' => ['adminhtml_customer']
    'used_in_forms' => ['adminhtml_customer_address']
]);

The attribute is showing up in the admin panel and, on load, the object is populated with the correct value.

But now I want to make sure this attribute gets correctly transferred to the Data model as well (\Magento\Customer\Api\Data\AddressInterface):

$x = \Magento\Framework\App\ObjectManager::getInstance()
       ->get(\Magento\Customer\Api\AddressRepositoryInterface::class);

/** @var \Magento\Customer\Api\Data\AddressInterface $addr */
$addr = $x->getById(1); // <-- "xxx" is not available here; others are

At first, I thought that only by having the static attribute, M2 would transfer its value to the Data model, or at least to its getCustomAttributes() or getExtensionAttribute(). It didn't. So I've created an extension_attrbutes.xml, telling it to do so:

<?xml version="1.0"?>
<config path="to.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\AddressInterface">
        <attribute code="xxx" type="string" />
    </extension_attributes>
</config>

Damn it, that didn't work either, because I didn't specify a join directive and thus failing some conditions. But do I have to specify a join condition when my attribute is static/column? Furthermore, the Address Data interface is implemented (not auto-generated) so I think the only way is through extension attributes, right?

Do I really have to do it manually?

I'm really starting to hate those Data layers. There's not only many criterias to get an attribute functioning correctly, but, once you finally have made a valid attribute, some other find-them-if-you-can criteria need to be satisfied in order to have attributes into the Data layer.


texts: add new to Transactional email template backend is not working

texts: Transnational email template i cant edit in on backend nor i can't add new template page goes blank white page in backend its working fine on local environment but not on live server


texts: Catalog URL Rewrites not working for "Duplicated" products

texts:
Facing a strange issue:
Whenever client "duplicates" a product from Admin, then the URL Rewrite of the new product doesn't get updated in the Rewrites table, even if client gives a different URL-Key everytime or doesn't give any URL-Key to newly duplicated products.

As a result the newly created products(with "Duplicate" button) have URLs redirecting to either 404 page or original products(from which they're cloned) or some other product randomly.

Can anyone guide me on this, as to what causes this issue & how to resolve?


texts:
How will final result should look like for this implementation.
Thank you

file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php

Below is my default Success.php for Magento 2.1

<?php /**  *  * Copyright © 2016 Magento. All rights reserved.  * See COPYING.txt for license details.  */ namespace Magento\Checkout\Controller\Onepage;

class Success extends \Magento\Checkout\Controller\Onepage {
    /**
     * Order success action
     *
     * @return \Magento\Framework\Controller\ResultInterface
     */
    public function execute()
    {
        $session = $this->getOnepage()->getCheckout();
        if (!$this->_objectManager->get('Magento\Checkout\Model\Session\SuccessValidator')->isValid()) {
            return $this->resultRedirectFactory->create()->setPath('checkout/cart');
        }
        $session->clearQuote();
        //@todo: Refactor it to match CQRS
        $resultPage = $this->resultPageFactory->create();
        $this->_eventManager->dispatch(
            'checkout_onepage_controller_success_action',
            ['order_ids' => [$session->getLastOrderId()]]
        );
        return $resultPage;
    } }

............................ where do i paste this code on Success.php

  <script>
    window.renderOptIn = function() {
      window.gapi.load('surveyoptin', function() {
        window.gapi.surveyoptin.render(
          {
            "merchant_id": XXXXXXXXX,
            "order_id": "<?php echo $order->getIncrementId() ?>",
            "email": "<?php echo $order->getCustomerEmail() ?>",
            "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId() ?>",
            "estimated_delivery_date": "YYYY-MM-DD"
          });
      });
  }
  </script>


texts: SOAP - how to Add SKU to Bundle product 'items' array

texts:
I'm using SOAP for reading orders from Magento to insert them into an internal accounting system. I have a problem to decode Bundle products. Internal accounting system does not know anything about these bundles since they're created in Magento only. I get the data for Items and I have some data in product_options field, but it's not complete enough:

s:14:"bundle_options";a:2:
{
i:445;a:3:{
s:9:"option_id";s:3:"445";s:5:"label";s:6:"Finish";s:5:"value";a:1:{i:0;a:3:{s:5:"title";s:17:"Sana 5 Arm Chrome";s:3:"qty";i:1;s:5:"price";d:8.79;}}
}
i:446;a:3:{s:9:"option_id";s:3:"446";s:5:"label";s:4:"Lamp";s:5:"value";a:1:{i:0;a:3:{s:5:"title";s:31:"2896 LED 3.5W Clear Tube L1 Cap";s:3:"qty";i:5;s:5:"price";d:29.15;}}
}
}

In this serialized array, I can read 445 and 446 as product options ID's but these are internal ID's from one of magento DB tables, so there's not much I can do with them.

I'd like to add SKU field to this SOAP readout - is there any way to modify SOAP export to add more fields?


texts: Very slow product listing issue with magento CE

texts:
I have a category called new arrivals which has 5 subcategories. I created a custom view called new-arrivals.phtml. I created custom Static Block with the following code in magento

{{block type="core/template" template="custom/new-arrivals.phtml"}}

then from Category setting I changed the display setting>CMS Block to the this cms block that I created. And the display mode is static block only

This view bring all the subcategories of New Arrivals(Bags, Tops, Shoes etc..) with it's products.. Like on this website   As you can see on this website it is very fast but on my website with my code it is not. Here it is...

How can I make this load faster. Cache and everything is enabled. I assume that there is something wrong with my code. thank you for your help.

and this is new-arrivals.phtml content:

Magento CE 1.8.1

<?php
            //I load all the subcategories here
            $category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
            $categories = $category->getCollection()
                    ->addAttributeToSelect(array('name', 'thumbnail'))
                    ->addAttributeToFilter('is_active', 1)
                    ->addIdFilter($category->getChildren())
            ?>

                <?php foreach ($categories as $category): ?>

                            <a href="<?php echo $category->getUrl() ?>">
                            <?php echo $category->getName() ?>

                        <?php
                            // here I load all the products for each category
                            $_helper = $this->helper('catalog/output');
                            $category = Mage::getModel('catalog/category')->load($category->getId());
                            $_productCollection = $category->getProductCollection()->addCategoryFilter($category)
                            ->addAttributeToSelect('*') // add all attributes - optional
                            ->addAttributeToFilter('status', 1) // enabled
                            ->addAttributeToFilter('visibility', 4) //visibility in catalog,search
                            ->addAttributeToSort('date_added', 'ASC');

                        ?>

<?php echo $count; ?> <?php echo $this->__('Products'); ?>

            <?php if(!$_productCollection->count()): ?>

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

            <?php else: ?>

                <?php // Grid Mode ?>
                <?php
                    $_span = 'span3';
                    $_grid_pro = 4;
                ?>

                <?php $_collectionSize = $_productCollection->count() ?>
                <?php $_columnCount = $_grid_pro; //$this->getColumnCount(); ?>
                <?php $i=0; foreach ($_productCollection as $_product): ?>
                    <?php if ($i++%$_columnCount==0): ?>
<?php // all the others stuff ....... ?>


texts: How to show an image on browser in Magento

texts:
<?php
        $hint = 'dell';

        $sql="SELECT p.`entity_id`, pv.`value` as name,
                 GROUP_CONCAT(DISTINCT(pm.`value`) SEPARATOR ', ') as imagesPath
               FROM `catalog_product_entity` as p
               INNER JOIN `catalog_product_entity_varchar` as pv
                 ON pv.`entity_id` = p.`entity_id` and  pv.`attribute_id` = 71
               LEFT JOIN `catalog_product_entity_media_gallery` as pm
                 ON pm.`entity_id` = p.`entity_id` and pm.`attribute_id` = 88
               WHERE pv.value LIKE '".$hint."'";

        foreach($readConnection->fetchAll($sql) as $orders) {
?>

<img src="<?php echo Mage::getBaseUrl('media').'catalog/product'. $orders["imagesPath"].''; ?>" alt="" />

<?php
    }
?>

The output of this code is :-

It shows me just the path of the image but i want an image in output on the browser.


texts: Limit Thumbnail Images on Product View Page

texts:
I am using Magento 2.4.1, I have added more than 3 images in the product but in the thumbnail, it only shows 3 thumbnails.
However, on clicking the Previous and Next buttons I am able to see all images.
I want to display all thumbnails of product images.
As shown in the below picture showing only 3 thumnails.


texts:
I am getting Random JS errors on a website built with Magento 2.4.1 and Apache2. Tried many solutions but no luck. Here are the some screenshot attached.

I am using Magebig Martfury theme. Did anybody else face this issue before. It is working fine on local machine. Issue exist on server only. Appreciate if anybody can help.


texts: getAttributetext() not working when there is only one value?

texts:
$product->getAttributeText('att_code'); not working when there is only one value for dropdown,multiselect attribute.

I am having a very strange problem in fetching multiselect option value on the frontend when there is only one option is selected for multiselect attribute.

Let's take an example i have a multiselect attribute "color_section" when i select two values from admin panel for any product it starts showing on frontend using  $product->getAttributeText('color_section'); but when i select single value it doesn't give anything.

Please answer if anyone have gone through this.

Thanks in advance.


texts:
What would be the correct product type to use for example we are selling a Printer.

Then we want to add a dropdown for what Color of Printer Ink they want to buy.

I don't think its a bundled product since the Printer is a fix Variable only the Color of the Ink has options.

Thank You


texts: Elasticsearch is not working after configurations in Magento admin

texts:
Installed details: Magento 2.4.2, Elasticsearch 7.6.0, Ububtu 20.04.
Elasticsearch is working on localhost:9200.
{
  "name" : "magento",
  "cluster_name" : "my-application",
  "cluster_uuid" : "bp8QVARQTxavGac9XSUadw",
  "version" : {
    "number" : "7.6.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
    "build_date" : "2020-02-06T00:09:00.449973Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

I made the necessary configurations in the Stores/Configurations/Catalog/Catalog/Catalog Search.

then php bin/magento cache:clean and bin/magento indexer:reindex, then tried to search.
But the problem is that the search does not work on the Luma page:

I checked http://127.0.0.1:9200/_cat/indices?v:
health status index                            uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   magento2_es_demo5x1_product_1_v2 W4E0HOGtTd6Y4LCBWvo3-w   1   1          0            0       283b           283b
yellow open   magento2_product_1_v9            YerIXZhrSii_b5wxarJ6hA   1   1          0            0       283b           283b

checked http://127.0.0.1:9200/magento2_product_1_v9/_search?pretty=true:
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

(I can provide the necessary details).
Just started learning Magento and ElasticSearch, so I really ask the community to tell me in detail what to do to make ElasticSearch work in my Magento project.


texts: Contact Page redirect to 404 page in magento 2.2.2

texts:
I recently checked my Contact page and found out it redirects to a 404 page.

Using the below url, it works fine:

  http://192.168.0.33/test/contact/index/index

but using below url I get not redirected to contact page

  http://192.168.0.33/test/contact/

Anyone encountered this issue?


texts: Unset Default Value for Product Attribute

texts: How to unset 'use Default Value' for all products values? I have checked all over the Internet but could not find proper solution.


texts: Magento, default layout for the custom module

texts:
I want to add a block in left column of only my module, not whole website.

If I place it in <default> tag it will be shown in whole website, but I want to do something like <mymodule_default>, is it possible ?

I know I can place my block in every layout_handler like

 <mymodule_controllername_actionname>
    <reference name="left">
        <block type="mymodule/block" name="left_navigation" before="-" template="mymodule/left-nav.phtml" />
    </reference>
 </mymodule_controllername_actionname>

but this is not what I want, I want to do it as

 <mymodule_default>
    <reference name="left">
        <block type="mymodule/block" name="left_navigation" before="-" template="mymodule/left-nav.phtml" />
    </reference>
 </mymodule_default>

Or it is not preferable ??
Thanks


texts: Magento newsletter unsubscribe link not working

texts:
I wanted to add a unsubscribe link to the bottom of the newsletter.
the magento default

  {{var subscriber.getUnsubscriptionLink()}}">{{var
  subscriber.getUnsubscriptionLink()}}

It generates the link

https://example.com/nl/newsletter/subscriber/unsubscribe/

Which redirects to

https://example.com/nl/newsletter/subscribed#.WR3C02grL4Y

And the user is not unsubscribed from the newsletter.


texts: Looking up Product Attributes and Customizable Options

texts:
I'm working with info_buyRequest data stored in Quotes. There are cases where super attributes as well as options are present in the buyRequest. These appear purely as DB id's, and I am trying to figure out the best way to access the associated metadata such as the text codes, store labels, etc.

Here is an example:

buyRequest:
 id                          =[354]
 product                     =[2131]
 selected configurable option=[1869]
 related product             =[]
 item                        =[354]
 super attributes:
   super attribute:          =[174]=>[159]
   super attribute:          =[172]=>[137]
   super attribute:          =[173]=>[157]
 options:
   option:                   =[38]=>[some entered value for custom option 38]
   option:                   =[36]=>[some entered value for custom option 36]
   option:                   =[37]=>[some entered value for custom option 37]

I need to look up the attributes with IDs 174,172,173 and find the associated strings for the values 159,137,157.

Similarly, I need to look up the custom options with IDs 38,36,37 and find their names.

I am not sure what the best interfaces are to do this.

Any help appreciated. Thanks.


texts: Magento2 write updated query using connection & Zend format

texts:
I am trying to add below SQL query in the form of Zend format using Magento connection object
Can you please let me know the syntax of how to follow...

update eav_attribute_set set attribute_set_name = replace(attribute_set_name, '_src', '') where attribute_set_name LIKE '%_src%';

Here is my method

protected function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $connection = $this->resourceConnection->getConnection();
            $tableName = $connection->getTableName(self::ATTRIBUTE_SET_TABLE);

           //Add your logic here
             -----------------------------
             -----------------------------

        } catch (\Exception $e){
            $output->writeln("Something went wrong please check and try again");
        }

    }


texts:
I have two Magento websites in the same domain, store.com and us.store.com.

For 24 hours I can't login in the backend. Only If I use a plugin browser like anonimoX, which changes my IP the login works. So I think it is a problem witht cookies.


texts: How to check all Magento 2 versions available to install via Composer?

texts:
I work with different projects using Magento 2.1, 2.2 and 2.3, I'd like to update each project to the last version available of each release, for example:
Magento 2.2.4 -> Magento 2.2.11
How could I check all the releases available via terminal?


texts: Cannot change order status back to Processing from Complete

texts:
For debug purposes, I need to change the status of some orders back to Processing, after they've been already shipped, so the status is Complete.

I'm trying to do this programmatically, so I deleted the shipments of the order, and also the Invoices, but I cannot force the status to get back to Processing and it remains Complete.

Is it possible to do it, or once the status is complete, one cannot go back in the status flow?

Just a snippet of code:

protected function deleteShipments(){
    foreach($this->_ordersToProcess as $incrementId){
        $myOrder = $this->_order->loadByIncrementId($incrementId);

        if($this->_registry->registry('isSecureArea')){
            $this->_registry->unregister('isSecureArea');
        }
        $this->_registry->register('isSecureArea', true);

        $_shipments = $myOrder->getShipmentsCollection();

        if($_shipments){
            foreach($_shipments as $_shipment){
                $_shipment->delete();
            }
        }

        $_invoices = $myOrder->getInvoiceCollection();

        if($_invoices){
            foreach($_invoices as $invoice){
                $invoice->delete();
            }
        }

        $myOrder->setState(\Magento\Sales\Model\Order::STATE_PROCESSING, true)->setStatus(\Magento\Sales\Model\Order::STATE_PROCESSING, true);
        $myOrder->save();
    }

}


texts: Why Mage_Catalog_Model_Layer_Filter_Item::getRemoveUrl() is escaped and getUrl() is not?

texts:
There are two methods in Mage_Catalog_Model_Layer_Filter_Item. One retrieves the URL of for a filter:

public function getUrl()
{
    $query = array(
        $this->getFilter()->getRequestVar()=>$this->getValue(),
        Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls
    );
    return Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query));
}

and another removes it:

public function getRemoveUrl()
{
    $query = array($this->getFilter()->getRequestVar()=>$this->getFilter()->getResetValue());
    $params['_current']     = true;
    $params['_use_rewrite'] = true;
    $params['_query']       = $query;
    $params['_escape']      = true;
    return Mage::getUrl('*/*/*', $params);
}

I'm wondering is there any reason why an URL for getRemoveUrl is escaped and getUrl is not?


texts: Magento1.9 : how to get all registered mails which is in active

texts:
For Email validation am checking customer exists or not, I wrote code like this for updating email in my account page.

       $cus = mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
        foreach($cus  as $user){
        $custEmail[]=$user['email'];
        }

        if(in_array($customer->getEmail(),$custEmail)){
            $this->_getSession()->addError($this->__('email already exists'));
        }else{
            $this->_getSession()->setCustomer($customer)->addSuccess($this->__('Not Exists.'));
        }

Here all emails are getting , I want only confirmation activation mails.Can anyone guide me on this


texts: update message " Your search returned no results. " when no records found

texts:
I wanted to update message "

  Your search returned no results

. " in magento2.But i am not getting directory file to change the message.I am new to magento2. Please let me know the exact file path for this message.

Thanks in advance.


texts: Product detail page: Current category from Registry sometimes incorrect

texts:
For different customer journeys, I would like to differentiate between a product being displayed in a category (via host/category/category/product.html) and the product being displayed without a category path (host/product.html). The former is how a product is displayed when the customer navigates through the tree and finds a product, the latter when a product is displayed via the search function or the customer lands on the product itself via outside search engines.

Now, the code I use to differentiate is like this:

$currentCategory = Mage::registry('current_category');
if($currentCategory) {
  $paths = array_splice(explode('/', $currentCategory->getPath()), 2);
  if(count($paths)>1) {
    ...

However, I have discovered a problem with that differentiation. If I navigate to a product using the tree (host/category/category/product.html), then immediately afterwards opening up the same product using the search function (host/product.html), the code

$currentCategory = Mage::registry('current_category');

still returns the category as if the product is currently being displayed via the category subtree (host/category/category/product.html). Opening the same URL in a new browser window fixes the "problem". Opening another category list page without opening another product detail page, then going back to the original product fixes that as well.

I would conclude that this means that getting the current category from the registry is not a sufficient way to determine if this product detail page is called under a subcategory or not. Is there a way/function that allows to make that distinction, short or grabbing the current URL and manually parsing the path?


texts:
I've done numerous searches and found some people with the same issue but nothing has helped.  I'm hosted on GoDaddy's Grow Business hosting and installed Magento 2.2.4 through their cPanel.  Everything has been working great.  If I pull up phpinfo() I see it has a local memory limit of 756M (the minimum) and a master value of 512M.

Now I'm trying to install an extension through the Web Setup Wizard.  When it runs the Readiness check it errors out that memory is only 512M.  If I put in debug statements in the PHP readiness check scripts I see that ini_get('memory_limit') is, indeed, 512M.  But I can't find ANYTHING in the file system that's doing this.  I tried putting a PHP.ini in the /setup folder, no help.  I tried putting an ini setting in the .htaccess in the bin/magento folder, no help.  Finally, to get around this issue, I simply modified the core PhpReadinessCheck.php (I know, I know, it's temporary).  Where it checks if the value is high enough, I just put another block that sets the value, then checks again.

if ($currentMemoryInteger > 0
    && $this->dataSize->convertSizeToBytes($currentMemoryLimit)
       < $this->dataSize->convertSizeToBytes($minimumRequiredMemoryLimit)
) {
    //set to 756M
    ini_set('memory_limit', $minimumRequiredMemoryLimit);
}

Has anyone else run into this issue?  Is there a better fix?


texts: Check Magento Store Performance with APC or Memcache

texts:
On my Server both APC and Memcached is installed. I have enabled both caching system one by one from local.xml each time.

In both cases I have checked site speed from Google Page Speed and Gtmetrix Speed test but its showing tha same grade as previous.

Here my question is: How can I check site performance after enabled APC OR Memcached. Or How can I check its working fine or not.

Please Help !!


texts: How do I update products without resetting attributes to default values

texts:
I have a script that updates stock and price but it seems to save all attributes with a default value back to the default.

The collection is loaded like this:

$productsCollection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect(array('visibility','name','price','plu'))
            ->addAttributeToFilter('sku', array('in' => $this->skuArray));

foreach ($productsCollection as $product)
        {
            //update stuff here
            $product->save();

        }

I have read somewhere that using load() is needed to save only those attributes specifically selected but if I do that I get a memory exhausted error.

Can someone give me some pointers on how to modify what I have in order to only save the attributes I have selected?


texts: How to change magento store location from www.mysite.com/magento2 to www.mysite.com?

texts: I'm so sorry, I'm really new to Magento - I've tried my best to solve what is probably a very simple problem but I just can't find the solution. After installing magento2, the folder is located at mysite.com/magento2, and this is the URL that I can access my Magento store from. However, I want my store to be accessible from mysite.com. How would I go about achieving this?


texts: Run "bin/magento setup:upgrade" from the Magento root directory - Magento 2 module

texts:
I have developed a module that has worked well previously on Magento 2. I now find the following error when I enable the module with composer:

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Creare_Example schema: current version - none, required version - 2.0.0
Creare_Example data: current version - none, required version - 2.0.0

I have ran the database upgrade command as requested, but I then get this error:

The extension has a simple data install script which I imagine has already ran, but now I can't get any further. Has anybody else encountered this problem?

I'm running Magento 2 on the following Vagrant Box: https://github.com/rgranadino/mage2_vagrant


texts: Magento 2.3.2 Rest API Showing 401 Authorization Required

texts:
I am trying to use the Magento 2.3 Rest API, using token authorization. when I try to GET data back from one of the endpoints using the token in an Authorization Bearer heading, I get an HTTP 401 Basic Authentication error. The problem is that the server requires Basic Authentication.My magento site host from AWS.
site url is to https://........
In my local project API is working but live site not work API.

Postman error

        <title>401 Authorization Required</title>

401 Authorization Required

        nginx/1.14.0 (Ubuntu)

Please give me solution?


texts: Magento 2.1 Display Product details,image in Success page

texts: I want to display Product details in which if it is configurable with options, image in Success page.


texts: eliminate render blocking resourcejacascript with .pagespeed extension

texts:
I am getting error Eliminate Render Blocking Resource in file,
it is having the extension of .pagespeed.*js

/media/js/fe2e6f53276726439b1fac7296dd6414.js.pagespeed.jm.nywy_6kRdV.js

I installed google speed module for apache server

how can i resolve this


texts:
I have installed ssl certificate , but https is still not working, so I would like to disable secure url for admin to work in backend.
I have updated the mg_core_config_data table for the path secure url to http://mydomain.com. And use secure urls in admin to 0. I have reindexed using the php indexer.php reindexall inside the shell folder. I have emptied the var/cache folder too. What am I missing ?


texts: when creating new attributes getting an error

texts:
I created the module. Everything is working fine but when click on add to new attribute button this error coming. Can you please anyone help me.

    1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Tychons_CustomerAttribute::Customer/attribute/labels.phtml' in module: 'Tychons_CustomerAttribute' block's name: 'attribute_edit_tabs_schedule_block4'

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Tychons_CustomerAttribute::Customer/attribute/labels.phtml' in module: 'Tychons_CustomerAttribute' block's name: 'attribute_edit_tabs_schedule_block4'
#0 /var/www/html/inciteenergy/vendor/magento/framework/View/Element/Template.php(300): Magento\Framework\View\Element\Template->fetchView(false)


texts: How to redirect user to Cart page after "Add to Cart"?

texts:
I have made a custom .phtml file to show "Add to Cart" button where I call/use the .phtml file in a CMS page.
Below is my code:
<?php
    $sku = $block->getData('product-sku');
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $productRepository = $objectManager->get('\Magento\Catalog\Model\ProductRepository');
    $product = $productRepository->get($sku);
    $productid = $product->getId();
    $listBlock = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');
    $addToCartUrl =  $listBlock->getAddToCartUrl($product);

    $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
    $postData = $postDataHelper->getPostData($block->getAddToCartUrl($product), ['product' => $productid]);
?>
<?= $block->escapeHtml(__('produtc sku')) ?>
<?php echo $sku; ?>

<form data-role="tocart-form" action="<?php echo $addToCartUrl; ?>" method="post">
    <?php echo $block->getBlockHtml('formkey')?>

        <button type="submit" title="Add to Cart" class="action tocart primary">
            Add to Cart
        </button>

</form>

Is there any way that using the above code, I redirect the user to the cart page too? I don't want to do it through admin panel as that will apply to all "Add to Cart" buttons in the website. I just want it for this specific CMS page.
Thank you.


texts:
I need to unicode "images" (icons) in the subject, for example, to display this image [☮], I can use the following code with the core/email model.

$subject='☮';
$mailModel=Mage::getModel('core/email');
$mailModel->setSubject('=?utf-8?B?'.base64_encode($subject).'?=')

However the following code (for the core/email_template model) is not working,

$_mailModel = Mage::getModel('core/email_template');
$_mailModel->setTemplateSubject('=?utf-8?B?'.base64_encode($subject).'?=');

it returns =?utf-8?B?SG93IHdhcyB5b3VyIG9yZGVyPyBKdXN0IGNoZWNraW5nIGluLi4u4pmlIFBMVVIg4piuIA==?=

How to display the image using the second core/email_template model.


texts: Layered Navigation Price Range input form?

texts:
Is it possible to make a form that allows the user to input to and from price range rather than calculating specific price ranges?

A lot of eCommerce websites are using this including eBay itself, so I'm curious if they plan to make that in the future, and if not, does the layered navigation accept custom values if I were to implement a form?


texts: check content update javascript Magento 2

texts:
I have changed content to next page in category page in magento by
https://infiniteajaxscroll.com/docs/methods.html

I try to check content of list update by this function:

$('.category-products .products.list').change(function () {
    console.log('list update');
});

It doesn't work for me.


texts:
I was running CE1.9.2.4 and I did SUPEE-8788 v1. I then did a full upgrade to 1.9.3.

Now I'm running 1.9.3 and SUPEE-8788 v1. Do I still need to back out SUPEE-8788 v1 and do SUPEE-8788 v2?


texts:
I have a POST endpoint that receives a JSON payload.

I'm using the Magento\Framework\App\Request\Http class to try and retrieve my POST data.

If I run $data = $this->request->getPost();, then $data will be empty.

However if I run $data = file_get_contents('php://input'); I am able to view my JSON payload as a string.

Is there a way to grab this natively through Magento?

FWIW I'm testing this through a rest/V1 endpoint through Postman.
This is a POST request with a chunk of (valid) JSON data in the raw data type.


texts:
I am working on a development server and I need to create a Magento (1.9.2) website with 2 different stores inside with different theme, different products and different customers.
At first I setup my first store, used a theme for it, played with it for a while then decided to add the second store (that would need to be accessed from a different domain when testing is done).
So I followed this tutorial here:
Magento Multistore Tutorial

I did everything described there using my own configuration but it is not working.
here is what I did:
1. My domain is www.example.com
2. It is hosted on a VHost together with 2 other websites, so my var/www/html folder contains 3 folders:

www.example.com
www.example2.com
www.example3.com

2.I decided to install magento inside the first website, (inside www.example.com)

So I ended up with this structure (for the single store):

var/www/html/www.example.com/magento/

Now, following the tutorial from the above link:

I created 2 subfolders inside /magento/: firststore and secondstore
I copied inside each of them the .htaccess and index.php files from the /magento/ folder
And then I edited them as explained in the tutorial, with the slight change caused by my folder structure. So, inside .htaccess file I changed the text as follows:

(for the file ../magento/firststore/.htaccess)

RewriteBase /magento/firststore/

and
(for the file ../magento/secondstore/.htaccess)

RewriteBase /magento/secondstore/

Then I moved to the index.php files, and:
(in the file ../magento/firststore/.htaccess I made it look like this)

$compilerConfig = MAGENTO_ROOT . '/../includes/config.php';
...
$mageFilename   = MAGENTO_ROOT . '/../app/Mage.php';
...
Mage::run('firststore',$mageRunType);

Same for the second store, so:

$compilerConfig = MAGENTO_ROOT . '/../includes/config.php';
...
$mageFilename   = MAGENTO_ROOT . '/../app/Mage.php';
...
Mage::run('secondstore',$mageRunType);

In the backend administration I created 2 websites, and each website has a Store and a storeview, so it's like this:

Main Website         FirstStore                        FirstStoreView
(Code: firststore)  (Root Category: Default Category)   (Code: default)

secondstore.ro       second store                   SecondStoreview
(Code: secondstore)  (Root Category: Second root) (Code: secondstoreview)

Then in System->Configuration->General, with
current configuration scope: First Store  -->> BaseURL: http://www.example.com/magento/firststore/

for Current configuration scope: Second Store  -->> BaseURL: http://www.example.com/magento/secondstore/

Now if I access the url: http://www.example.com/magento/firststore, or http://www.example.com/magento/firststore/index.php
I get an empty page. No error messages, no nothing, just an empty page. Same goes for the secondstore.
What am I doing wrong? What should I do to make it work?


texts: Magento 2 Uncaught SyntaxError: Invalid or unexpected token

texts:
When I tried to select the product color swatch and product size I got this error in production mode.

Uncaught SyntaxError: Invalid or unexpected token
    at new Function (<anonymous>)
    at Function._.template (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:64:39)
    at eval (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:6:73)
    at $.(anonymous function).(anonymous function)._UpdatePrice (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:37:107)
    at $.(anonymous function).(anonymous function).eval [as _UpdatePrice] (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:28:334)
    at $.(anonymous function).(anonymous function)._OnClick (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:28:156)
    at $.(anonymous function).(anonymous function).eval [as _OnClick] (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:28:334)
    at HTMLDivElement.eval (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:24:561)
    at HTMLDivElement.dispatch (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:339:447)
    at HTMLDivElement.elemData.handle (eval at require.load (http://217.160.142.147/pub/static/version1522436350/_cache/merged/9f0e77a0e649eade7c26426be1fcf110.min.js:170:216), <anonymous>:312:172)


texts: Firegento - add custom attribute field to product in order PDF

texts: I'm starting to use firegento, but I need to add a particular attribute field, only to the order document, in particular it is the original product code, so I can send my order document directly to the supplier that can read directly this one to understand which product I need. How can I do that?


texts:
I have a magento 1.9.2 with Redis cache server.

I have one issue that every time, I make changes, it does not invalidate the cache so to enforce changes I use redis-cli flushall every time which is not good because it takes days to recreate cache again.

My question is whether there is any tool that I can install to delete cache keys that are not up to date.


texts: Magento 2 API: Possible to edit an order?

texts: I would like to know whether it is possible to edit an order via API analog to the functionality in the Magento 2 backend.


texts: Catalog Category permissions keeps on changing automatically in Magento 2.4.1 Enterprise Edition

texts:
We are using Magento 2.4.1 Enterprise Edition. Suddenly our built-in catalog category permissions keeps on changing automatically (category permissions are set to "Deny"). which caused PLP and PDP 404 error page issues. Whenever we change permissions manually from admin settings, after some time they are Auto reverted or changed totally. same issue for the magento directories permissions, they also keeps on changing within time.
Can someone help me out of this issue ?


texts: Magento Zero Subtotal Checkout - Assign Pending then immediately Proccessing

texts:
I have a email delivery module that for security reasons only send out delivery emailS if the order has had the order status PENDING and currently have the status PROCESSING.

This works great for regular orders. But for free (zero) orders, i in Admin can only select that the order either should get the status PENDING or the status PROCESSING.

How can i do so that free (zero) orders first get status PENDING and then status PROCESSING?


texts:
Before special prices were displaying on every page. Now special prices are not displaying in the site.

I set the product to use other themes. It's not displaying there also, so it is not a theme problem.


texts:
Lets consider machine with IP:192.168.1.60 is in DMZ with NAT IP:111.222.333.444.
How should i configure the baseURL in database so that public users can access the site as well as i should be able to view the site when entered "http://localhost/"

Case 1: If I enter public IP URL eg:"111.222.333.444/test
in database baseURL,then URL localhost/test doesnt work on the machine as it in DMZ and no internet access and browser is trying to connect public ip from local machine.

But URL is accessable from public users.

Case 2: If I enter intranet IP as a URL "http://192.168.1.60/test in baseURL then public users cant access the site as the database baseURL is pointing out to intranet ip.

Any help would be greatly appreciated


texts: Where to Learn magento 2 Advance development?

texts:
I want to take Magento 2 associate exam is there any preferred way that can help me to clear that exam, If yes please provide me your answers on understanding the magento core structure to clear that exam.
I have already reviewed the Magento DevDocs and found it useful sometimes but When comes to complex scenario then Magento Docs seems difficult to do the job and can't help with client's requirements.


texts: How to creditmemo for order with Total paid 0 amount

texts:
I have an order with total paid amount is 0 after applying discount. After complete there is no creditmemo button showing for that order.

Order total showing in below figure :

How to create creditmemo for that order?


texts: How to save stores selector result to database in magento 2?

texts:
I'm creating a simple CRUD with fields that should be configurable for store views. How should I save result of multiple store view selector? Should I serialize the array and save all store_views in one column, keep field for every store in separated records, or maybe use some sort of EAV?

I probably should keep it just like cms_block and cms_block_store are kept, right?


texts: Problem: When to hide a product in sub category from showing in the main category?

texts:
thanks in advance. This issue has been bugging me.

On my website, I have a main category called 'Lighting' and one subcategory within it called 'accessories' shown below:

When on the main category page 'Lighting', products from the sub category 'Accessories' are shown. How do I NOT show them here?

It is an issue because when entering the 'Lighting' landing page you expect to see lights and not accessories, but you would still expect 'Accessories' to feature as a sub category within 'Lighting' - part of the website navigation.
This I expect is having a negative effect on visitors.

It is worth mentioning that in the backend for manage products I have deselected the products I do not want showing up in the 'lighting' main category and kept them within the 'accessories' sub category. Yet they still show up on the main cat landing page.

I want them removed from the main CAT but kept in the sub CAT. Why does this not work? It seems like it should.

Thank you in advance,

Not found an answer elsewhere but I am sure many people experience the same.

David


texts: Customer required attribute fails order creation for new Customer

texts:
I have added a required field in customer attribute named as reference_number. If I create a new customer and save the attribute I am able to create the order for customer . But if i create a order for new customer from backend (which is not in db) it throws the exception on order save as

  The value of attribute "Reference No" must be set

I don't know if I have to save the refernce_number using knockout or observer .

In Short order created through these steps throws the Error

  Sales->Order->Create New Order->Create New Customer->Submit Order


texts:
I have added the google recaptcha in contact us form but value is also submitting without captcha.
I have used in my contact page following codes for captcha:

These two code i have used. please tell me how can i validate captcha.


texts: Magento2: can't translate transactional email phrases

texts:
I'm trying to translate some custom transactional email templates but I have some problems.

In the templates (mycustomtheme/Magento_Sales/email), strings are the same of the default luma ones.
If I try to change the translation using theme translation (mycustomtheme/i18n/xx_XX.csv) nothing happens. What I think is that my theme can't override luma phrases.

What can I do?

Thanks in advance


texts: Magento2 - Set up different currency for different website for same product

texts:
My requirement is : I want to setup different Currencies for different website on my Magento2.3 store.

eg: For Website A, default Currency is  A.

For Website B, default Currency is B.

Now what I will do is, I will setup price for a product in default website. I want the price to be calculated automatically for Website A in Currency A and for Website B in Currency B.

Is there any extension/ Module free or paid , which helps me in achieving this functionality.

Any help would be highly appreciated.


texts: How to know if a checkout field is loaded in JS?

texts:
I'm working on the checkout in Magento 2 (2.2.5). And I constantly have the issue in JavaScript that I don't know when a field is loaded. So if I need the input of country_id field for function I can't get it unless I place a setTimeout around it.

There must be a better solution, right?