texts: custom fields are not showing in order summary when we goto payment page in checkout page magento2

texts:
I have override the file DefaultConfigProvider.php which in Magento\Checkout\Model\DefaultConfigProvider.

/**
     * {@inheritdoc}
     */
    public function aroundGetConfig(
        \Magento\Checkout\Model\DefaultConfigProvider $subject,
        \Closure $proceed
    ) {
        $result = $proceed();

    if (isset($result['totalsData'])) {
        $totalsData = $result['totalsData'];

        if (isset($totalsData['items'])) {
            $items = $totalsData['items'];

            foreach ($items as &$item) {
                $item['custom_text'] = $this->getCustomtext($item['item_id']);
                $item['custom_values'] =  $this->getCustomvalues($item['item_id']);
            }

            $result['totalsData']['items']=$items;
        }
    }

    return $result;
}

Custom values are showing in shipping page when we goto the shipping page it is disappears. please help on this issue.


texts: Magento 2 : Simply want to change the text colour on my checkout page

texts:
Sorry for what is probably another daft question but after 2 hours of trying to work out how to make a simple change, I've admitted defeat! My proceed to checkout button is on a white background so people have trouble spotting it. I don't want much.

I just want to change the background/text color? Can I find where to do that?


texts:
Are there any off-the-shelf solutions for generating a Stock Moment (History) Report for all products, in M2.3CE? In other words, a Stock Tracker.
For example
Date        Qty    Stock    Reason
01/01/2020  -2     50       Sale (012345)
01/01/2020  -1     49       Sale (012346)
02/01/2020   1     50       Credit Memo (014343)
05/01/2020   10    60       Adjustment (bob_admin)


texts: magento login not works unless variens cookie parameter are disabled on core file

texts:
I couldn't login to magento dashboard unless commenting these codes

   $cookieParams = array(
        'lifetime' => $cookie->getLifetime(),
        'path'     => $cookie->getPath(),
        //'domain'   => $cookie->getConfigDomain(),
        //'secure'   => $cookie->isSecure(),
        //'httponly' => $cookie->getHttponly()
    );

My admin values look like below


texts:
I just installed the security patch SUPEE-6788 and the installation was a success from MageReport.com. However, I encountered 404 error on my admin page, yet I can still see the CMS page.

Does anyone know how to fix it?

The problem came up before the patch installation, and I thought the problem will be solved after the patch installation.( And obviously, it's not. ) Before the patch installation, I changed some codes according to this post. http://www.oscprofessionals.com/articles/magento-security-patch-supee-6788-effects-and-testing/

I think the problem occurred after the Change3 to move class files.

I've tried:

Making sure core_store, core_store_group, core_website, and customer_group table ids are set to 0 (as described in this and many other articles - http://www.nude-webdesign.com/fix-for-magento-admin-error-404-page-not-found/)
Cleared the var/cache
According to this post http://alanstorm.com/magentos_many_404_pages, I ran the command: curl -I http://idfr.com
output:
HTTP/1.1 200 OK
Date: Wed, 09 Dec 2015 16:15:17 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Set-Cookie: frontend=r1bnk3642gjfgb24vukhu06ma7; expires=Wed, 09-Dec-2015 17:15:17 GMT; Max-Age=3600; path=/; domain=idfr.com; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: sns_aviva_tpl=sns_aviva; expires=Mon, 28-Nov-2016 16:15:17 GMT; Max-Age=30672000; path=/
Content-Type: text/html; charset=UTF-8

I also ran the command: curl -I http://www.iana.org/domains/idfr
output:
HTTP/1.1 404 NOT FOUND
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=3600
Date: Wed, 09 Dec 2015 16:18:25 GMT
Connection: keep-alive
Server: Apache
X-Cache-Hits: 0


texts: No translations for `Invalid Form Key. Please refresh the page`

texts:
I am using Magento 2.3.1

I can not load translations for text Invalid Form Key. Please refresh the page. shows occasionally on frontend.

Of course I add translations for language .csv placed in theme.
I also tried add translation to specific modules.


texts:
My checkout submit process is 7-8 sec slow. I am checking with profiler and found that this one takes more than 500ms.
Is it normal? I did not edit much the email order template.

layout/db_update: sales_email_order_items
frontend/base/default/template/email/order/items.phtml
frontend/base/default/template/email/order/items/order/default.phtml
locale/currency
frontend/base/default/template/sales/order/totals.phtml


texts: Save customer bank infos, so that they don't have to reenter it on checkout everytime

texts:
Our customers are complaining that they can't save their bank infos and so they always have to enter them again if they order something.

I know I could just develope an extension so that customers can save their bank/payment details and select them in checkout, but is there already such an extension? Am I allowed to store their debit details in my database?


texts: Imported products not showing up on front end - Magento 2

texts:
tried searching but couldn't find an answer. Apologies in advance if it's a duplicate question.

I've imported a bunch of products to a new Magento 2 setup. I created the CSV files and added all necessary attributes associated with products etc.

Import occurs ( I run into the url_key issue which for now I'm resolving by adding random unique garbage values into each product cell).

Products show up on the backend catalog but don't show up on the front-end even if I reindex everything, clear the cache etc. But if I open up a product on the backend and then 'save' it, it pops up on the store. Now this won't be feasible as I'll be importing 100+ products, to go and 'save' each product. Tried multiple things but nothing seems to help.

If anyone has any ideas, I'd be grateful! Thanks a lot.


texts: How to delete migrated from magento 1.9.3.0 to 2.3 email templates?

texts: After migrate from Magento 1.9.3 to 2.3 I saw that email templates still the same, so what I was supposed to do, how can I delete them?


texts: Magento registry in widget's template returns null

texts:
I'm trying to pass some data from controller thru redirection to widget's .phtml file.

In sampleController.php:

Mage::register('demo_access', (isset($request['paragraphText']) ? 2 : 1));
Mage::log(Mage::registry('demo_access'));
$this->_redirect('watchdemo.html');

Works well, but after redirection to some cms page with some widget in sample.phtml code:

<?php var_dump($this->getNameInLayout()); ?>

returns null. Is it possible to do my job using registry or should I use session for my task?


texts: Order View Page not showing Customer order details?

texts:
Recently I have faced one errors on Order View page. When I am clicking on view customer order to see the details of the customer but the order view page not showing any information of customers order.

Could you please check my screenshot which I have added here. Please give the code with file location then I can sort it out.

Thanks in Advance
Shakib


texts: Magento 2 add new tab in customer dashboard frontend

texts:
I am trying to create new tab in customer dashboard.I have added customer_account.xml in my module(Singh/Module1)layout

<body>
    <referenceBlock name="customer_account_navigation">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-about-me">
            <arguments>
                <argument name="path" xsi:type="string">aboutme/customer/index</argument>
                <argument name="label" xsi:type="string" translate="true">About Me</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

frontName : aboutme;

My Controller directory structure: Singh/Module1/Controller/Customer/Index.php.

I have created aboutme_customer_index.xml also

<update handle="customer_account"/>
<body>
    <referenceContainer name="content">
        <block class="Magento\Customer\Block\Account\Dashboard" name="customer.account.link.back" template="account/link/back.phtml" cacheable="false"/>
    </referenceContainer>
</body>

Below is the index.php

class Index extends \Magento\Framework\App\Action\Action //implements AboutmeInterface
{
    /**
     * @var PageFactory
     */
    protected $resultPageFactory;

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

    /**
     * Customer order history
     *
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {
    /** @var \Magento\Framework\View\Result\Page $resultPage */
    $resultPage = $this->resultPageFactory->create();
    $resultPage->getConfig()->getTitle()->set(__('About Me'));

    $block = $resultPage->getLayout()->getBlock('customer.account.link.back');
    if ($block) {
        $block->setRefererUrl($this->_redirect->getRefererUrl());
    }
    return $resultPage;
    }
}

Below is my route file

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
    <route id="aboutme" frontName="aboutme">
        <module name="Singh_Module1" />
    </route>
</router>

My new tab is coming in Customer account dashboard but it always redirect to 404 not found error.


texts: Magento hosting requirements for small website, max 500 vistors/day

texts:
I am going to upgrade the cloud VPS of my company.
Here the current configuration:

2 cores, 2GB RAM, 20GB SSD storage
Apache with Nginx for serving static contents
Magento 1.8.1 with around 400 products (not SKUs). Currently we setup the website just only for viewing product information. We will set up for placing order online 1 year in the future.
No Varnish, No Redis, No Full-page-cache or any kinds of cacheing, just Magento's default caching.

Currently, max is 500 visitors and 2000 page views per day but only when we run marketing campaigns, normally just around 300-350 visitors per day. We are growing but not so fast.

BUt the speed of the website is not fast enough. So I will install Varnish, Redis and Full-page-cache in order to make it faster. I am going to upgrade the VPS to 4 cores and 4GB RAM.

I want to ask you guys whether new configuration is sufficient or I have to go for more CPU and RAM.


texts: Magento2 - Override Template order summary in sales email order

texts:
I have the template that is using the following to render order summary

  {{layout handle="sales_email_order_items" order=$order
  area="frontend"}}

it is taking the code from the following template

  /app/design/frontend/Corra/Mytheme/Magento_Sales/templates/email/items/order/default.phtml

So I want to override this file with my custom module file and use this one.

I created a module "Corra_Sales"

I put the .phtml here

  /app/code/Corra/Sales/view/frontend/templates/email/items/order/default.phtml

Also, I created the layout with the file:

  /app/code/Corra/Sales/view/frontend/layout/sales_email_order_renderers.xml

The code inside file is:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
    <body>
        <referenceBlock name="sales.email.order.renderers">
            <block class="Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder" as="default" template="Corra_Sales::email/items/order/default.phtml"/>
        </referenceBlock>
    </body>
</page>

Also, I tried with :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
    <body>
        <referenceBlock name="sales.email.order.renderers">
            <arguments>
                <argument name="template" xsi:type="string">Corra_Sales::email/items/order/default.phtml</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

I clear cache, remove var folder, rebuild, etc.

But it still not working, someone could tell me what I am doing wrong that always take this file ->?

  /app/design/frontend/Corra/Mytheme/Magento_Sales/templates/email/items/order/default.phtml


texts:
I need to remove certain part of description from ~200 products.
How should i do it?
I cant do it directly from admin panel.
I thought about exporting all of my products to csv file, modify it and then import it back again.
Is there another way to do that? Something that involves PHP or accessing database?


texts: json_encode error for special characters in magento

texts:
In checkout page in magento. In billing information when i select a country, states having special characters are not displayed.For ex: A Coruña,Ardèche .I got this error message in error.log

Warning: json_encode() [function.json-encode]: Invalid UTF-8 sequence in argument in /chroot/home/site/html/lib/Zend/Json.php on line 146.

Is there any solution to overcome this problem.


texts: Limit country drop down input field Magento 2

texts: Currently my magento store shows all the country in shipping, billing, and register customer form. is there a way to show only some countries that i want ?


texts: Add bundled item to cart without specifying an option

texts:
I am trying to add a bundled item into the cart without having to specify any of the options. All the options have been set to "not required" and I want the base item added to the cart (at it's fixed price).

I've attempted to use this method noted in this thread (http://www.magentocommerce.com/boards/viewthread/17289) but the given solution forces the code to "pick up" the first option. So when you add the product into the cart, the overall price is base item + first configured product.

I want to add the base item only without any configured products. Could someone suggest a viable solution for this?


texts: How to add yes or no confirmation pop up after enter the clear shopping cart.Now its directly clear the cart

texts:
How to make yes or no confirmation popup after clicking the clear shopping cart. Now it's clearing the cart without confirmation.

/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**  @var $block \Magento\Checkout\Block\Cart */
<?php $mergedCells = ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 2 : 1); ?>
<?php echo $block->getChildHtml('form_before') ?>
<form action="<?php /* @escapeNotVerified */ echo $block->getUrl('checkout/cart/updatePost') ?>"
      method="post"
      id="form-validate"
      data-mage-init='{"validation":{}}'
      class="form form-cart">
<?php echo $block->getBlockHtml('formkey'); ?>
<div class="cart table-wrapper<?php echo $mergedCells == 2 ? ' detailed' : ''; ?>">

<?php /* @escapeNotVerified */ echo __('Shopping Cart Items') ?>

                <?php /* @escapeNotVerified */ echo __('Item') ?>
                <?php /* @escapeNotVerified */ echo __('Price') ?>
                <?php /* @escapeNotVerified */ echo __('Qty') ?>

        <?php foreach ($block->getItems() as $_item): ?>
            <?php echo $block->getItemHtml($_item) ?>
        <?php endforeach ?>

    <?php if ($block->getContinueShoppingUrl()): ?>
        <a class="action continue"
           href="<?php echo $block->escapeUrl($block->getContinueShoppingUrl()) ?>"
           title="<?php echo $block->escapeHtml(__('Continue Shopping')); ?>">
            <?php /* @escapeNotVerified */ echo __('Continue Shopping') ?>

    <?php endif; ?>
    <button type="submit"
            name="update_cart_action"
            data-cart-empty=""
            value="empty_cart"
            title="<?php echo $block->escapeHtml(__('Clear Shopping Cart')); ?>"
            class="action clear" id="empty_cart_button">
        <?php /* @escapeNotVerified */ echo __('Clear Shopping Cart'); ?>
    </button>
    <button type="submit"
            name="update_cart_action"
            data-cart-item-update=""
            value="update_qty"
            title="<?php echo $block->escapeHtml(__('Update Shopping Cart')); ?>"
            class="action update">
        <?php /* @escapeNotVerified */ echo __('Update Shopping Cart'); ?>
    </button>
    <input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>

</form>
<?php echo $block->getChildHtml('checkout.cart.order.actions') ?>
<?php echo $block->getChildHtml('shopping.cart.table.after'); ?>


texts: Magento 1.9 - Add additional function after form validation fail

texts:
I'm trying to find the best place to add a function to fire whenever a form in magento is submitted and fails. By fail I mean a required field wasn't filled in properly.

Where would the best place be? Should I edit validation.js?


texts: Magento 2 require.js:166 Uncaught Error: Script error for: jquery-ui-modules/widget

texts:
I recently installed Magezon Pagebuilder plugin.
It works perfect and everything, however when I add Sliders or Carousel I get this 2 errors:
require.js:1895 GET http://dev.emall.com.mx/pub/static/version1606325200/adminhtml/Transom/ChangeAdminLogo/en_US/jquery-ui-modules/widget.js net::ERR_ABORTED 404 (Not Found)

Uncaught Error: Script error for: jquery-ui-modules/widget
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js:166)
    at HTMLScriptElement.onScriptError (require.js:1681)

I have tried this solutions:
php bin/magento setup:static-content:deploy
php bin/magento setup:di:compile
php bin/magento setup:upgrade

Delete var/cache and var/view_preprocessed.
clean cache
I checked my .htaccess and seems to be in order, in pub/static and pub/media.
I have used all solutions I know, what could it be?
Thanks!


texts: Magento 2 - CLI Installation - MySQL Access Denied despite correct authentication

texts:
I've been following the documentation for Magento 2.3 and am now stuck while trying to set it up on the command line.  I'm executing the following:

bin/magento setup:install --base-url=http://localhost/magento --db-host=localhost --db-name=magento --db-user=magento --db-password=[password] --backend-frontname=admin --admin-firstname=name --admin-lastname=name --admin-email=admin@test.com --admin-user=admin --admin-password=[password] --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1

Obviously, in place of [password] I have my actual passwords.

I get the following response:

  SQLSTATE[HY000] [1045] Access denied for user 'magento'@'localhost'
  (using password: YES)

This response would indicate that my user or password or database name are incorrectly entered.  But they aren't.  I have checked my command many times, and am fully able to login with mysql -u magento -p with the same password.


texts: How to make div collapsible in ko template?

texts: We often want to make store credit or adding gift card div collapsible on checkout page. How to make store credit or customer balance div collapsible in knockout template?


texts:
my products has a custom attribute named producing_days

and im pretty sure that it has a value in catalog_product_entity_varchar

now im trying to access producing_days from quote item
/* $item is a quote item*/
$product = $item->getProduct();

$id = $product->getId(); //this works and return 3272
$producing_days = $product->getProducingDays(); //this returns null

i tried accessing it on stores 4, 14 and 19 and its all null in there. and it shouldnt be an issue because the "All Stores" has a value. any idea why i cant access the producing_days?


texts: Can I change customer email without entering password on account edit page?

texts:
I'm developing a website that contain SSO customers. They do NOT have customer password when creating customer account. That caused a problem in a scenario: If they attempt to change email, they need to enter current password.

But as I said before, they do not have customer password, so they simply can't edit their email currently. Every time they try the change email, it shows the error message "The password doesn't match this account.". So, is there any methods to change the email address without entering customer password?


texts:
Can I run the EE1.14 Responsive theme in 1.13?

I am just trying to think things through and I think if I copy the entire package it should work?


texts: How to get the user's password and insert it into a new bank

texts:
I have the hash passwords of my magento clients, I am migrating to a new bank all the data of the old bank, I would like to know how to enter the passwords in the users.

I use this to re-create the users on the new site, I would use their passwords, how can I put them there?

Code

ini_set("display_errors", 1);
require_once('app/Mage.php');
Mage::app(0);

$link = mysqli_connect('databaseip','login','password','database');
$link->set_charset("utf8");
$query = "SELECT * from customers";
$select = mysqli_query($link, $query);
foreach ($select as $key => $selects) {
while($row = mysqli_fetch_array($select)){
$teste = array(
$clientes_id = $row['clientes_id'],
$nome = $row['nome'],
$sobrenome = $row['sobrenome'],
$site = $row['site'],
$loja = $row['loja'],
$grupo = $row['grupo'],
$email = $row['email'],
$criadoem = $row['criadoem']
);

$customer = Mage::getModel("customer/customer");
$customer->setId($clientes_id)
 ->setFirstname($nome)
 ->setLastname($sobrenome)
 ->setWebsiteId($site)
 ->setStoreId($loja)
 ->setGroupId($grupo)
 ->setEmail($email)
 ->setCreatedAt($criadoem)
 ->setPassword('');

$customer->save();
}
}

And I use this code to get the passwords, what should I do to insert them correctly in the users?

Code

$customer_email = 'test@test.com';
$customer_password = Mage::getModel("customer/customer")->setWebsiteId(Mage::app()
->getWebsite()->getId())->loadByEmail($customer_email)->getPasswordHash()."\n";

print_r(array("Passwrd_Hash"=>$customer_password));

What I get

[Passwrd_Hash] => 6ca46cdc372243d3e768c306c07edcc0:e4OKoYvFzKQVGgZRQJIFp9ntAMMQCmYf


texts:
I have created customer image attribute and I create form which hit to controller after fill if customer email not exsist it save customer with my custom attribute and values save but if customer exsist then my image attribute not work this is my code:-

$customer->setCustomerImageGovtId($file_name);
 $customer->save();


texts:
I've already asked a question about that here:How to Fetch / Add a Custom Column in Product List Grid In Admin
Unfortunately, I didn't see that due to this solution my products name don't appear anymore.

I changed my code, and now, the collection fetch the data correctly (I printed the query and executed it in the mysql console directly), but the data aren't displayed inside the custom column for I don't know which reason.

Here's my module code:

app/code/local/Mypackage/Customgrid/etc/Config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Mypackage_Customgrid>
            <version>0.4.0</version>
        </Mypackage_Customgrid>
    </modules>

    <global>
       <blocks>
            <adminhtml>
                <rewrite>
                     <catalog_product_grid>Mypackage_Customgrid_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>
</config>

app/code/local/Mypackage/Customgrid/Block/Adminhtml/Catalog/Product/Grid.php:

class Mypackage_Customgrid_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid {

    protected function _prepareCollection() {
        parent::_prepareCollection();
        $collection = $this->getCollection();

        $resource = Mage::getSingleton('core/resource');
        $collection->getSelect()
        ->join(
            array('v' => $resource->getTableName('udropship/vendor')),
            'e.entity_id = v.vendor_id',
            array('vendor_name')
        );

        $collection->printLogQuery(true);

        $this->setCollection($collection);
        $this->getCollection()->addWebsiteNamesToResult();

        return $this;
    }

    protected function _prepareColumns() {

        $this->addColumnAfter('vendor_name', array(
                'header'    => Mage::helper('catalog')->__('Vendor'),
                'index'     => 'vendor_name',
                'type'      => 'text',
            ), 'visibility');

        return parent::_prepareColumns();
    }
}

Any idea on what's happening here ? Thank you !


texts:
I'm trying to do

php -f bin/magento config:set dev/js/enable_js_bundling 1

But I get:

  The value you set has already been locked. To change the value, use the --lock-env option.

What does this mean and how can I achieve what I want?


texts: How to prefill Magento2 checkout email field?

texts:
I am passing email from some other page which I want to auto fill in check out page shipping address form. I have been referring to How to auto fill the shipping address field

it works for other fields but not working for email. Please help.


texts: Add avs_FastSimpleImport to magento store

texts:
I am trying to install FastSimpleImport in a magento store to import new products into the store. I've put the files in the app/code/community and the app/etc/modules folders (that's how I downloaded it from GitHub). But after that, the documentation only says "The above code is designed to be included into your own module." So I have a couple of questions:

Does this mean I have to create a new module in the app/code/local folder?
I am not very experienced with Magento. I just created a custom module (in the app/code/local) that hooks into an event to send updates to a warehouse. Can I add the code for the import of new products to this module, or should I create a new one?
When I created the other custom module, I could hook it into an event. But how does that work with FSI? Do I hook it up to a cronjob?

I know these are a lot of questions, and it's not even all of them. I have searched for tutorials or tips on how to use FastSimpleImport, but can't find any good examples on how to create the custom module. Any help would be much appreciated.

EDIT:

I think I need to specify my questions. How do I use FastSimpleImport in a custom module after installing it, and what does the custom module look like? Does anyone have an example or know a tutorial I can follow?


texts: How to pad string before other string in php?

texts:
I am using magento 2.2.6. I am showing the amount in particular column.
of my custom page.

E.g

CASE - A

I have amount say, $100.50, I want to display amount in the following format:

00010050 (here 3 zeros should be appended before this amount and decimal format should be removed).

CASE - B

I have amount say, $1100.50, I want to display amount in the following format:

00110050 (here 2 zeros should be appended before this amount and decimal format should be removed).

Is it possible to append zeros as per amount length and show amount in such format?


texts: Magento 2.3 Admin Sales Order Grid hide cancelled orders

texts:
I want to remove all cancelled orders from admin sales_order_grid. I am trying to add a collection as below. But it's not updating. However the printed data showing correctly.
<?php
namespace Custom\Module\Model\ResourceModel\Order\Grid;

use Magento\Sales\Model\ResourceModel\Order\Grid\Collection as OriginalCollection;
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy;
use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory;
use Magento\Framework\Event\ManagerInterface as EventManager;
use Psr\Log\LoggerInterface as Logger;
class Collection extends OriginalCollection
{
    protected $_authSession;
    public function __construct(
       EntityFactory $entityFactory,
       Logger $logger,
       FetchStrategy $fetchStrategy,
       EventManager $eventManager,
       \Magento\Backend\Model\Auth\Session $authSession
      )
    {
       $this->_authSession = $authSession;
       parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager);

    }

    protected function _initSelect()
    {
        parent::_initSelect();
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager
        $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
        $connection = $resource->getConnection();
        /*$sales_order = $resource->getTableName('sales_order');
        $sales_order_item = $resource->getTableName('sales_order_item'); */
        $sql ="SELECT * FROM `sales_order_grid` WHERE `status`!='canceled'";
        $result = $connection->fetchAll($sql);
        return $result;
    }
}

If I print $result it's showing correct data, without cancelled orders. But in admin it's not updating.
Below is my di.xml code:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="sales_order_grid_data_source" xsi:type="string">Custom\Module\Model\ResourceModel\Order\Grid\Collection</item>
        </argument>
    </arguments>
</type>


texts: I am using mail chimp extension in my magento2 store. Suddenly I have noticed that my order stop sync there is just syncing stuck i checked log error is A cart with the provided ID already exists in the account so what i did to debug this error.


texts: Bulk append one word in front of all product names in store

texts:
I have magento 2.3.4 and trying to append one word to all products. Is it possible to do using standard M2 means or phpmyadmin?
Correction, I only need to append names for items with certain attribute.


texts: Magento2.3.3 - Where can I see the Store Credit amount of an user?

texts:
I'm using Magento2.3 Open Source. Here in the doc, you can see references to Store Credit in the Open Source version:

  If the purchase was paid with store credit, mark the Refund to Store
  Credit checkbox to credit the amount to the customer account balance.


texts: Indian regional language pack. Magento 1.9

texts:
How to get Indian regional language pack for Magento

e.g Marathi, Hindi, Tamil, Bengali, etc.

Because there are more than 20K magento developers, all across India, working on both CE and EE.


texts: "This product doesn't exist" after migrating, error: Table 'sales_order_varchar' doesn't exist

texts:
After having migrating Magento 1.9.4.5 to Magento 2.4, without any problems.
Now, on the products page in the front-end I get a 404 error page not found but the categories pages are still all there.
All products are showing in the backend, however if i try to edit one i get a message saying "This product doesn't exist."

The error I get in exception log:
[2020-11-13 16:03:05] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sales_order_varchar' doesn't exist, query was: SELECT `u`.* FROM ( (SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `sales_order_varchar` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('106', '109', '493', '1158', '271', '929', '836', '96', '481', '998', '562', '570', '879', '880', '881', '103', '105', '571', '1155', '1156', '996', '905', '906')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `sales_order_int` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('863', '273', '110', '862', '860', '859', '274', '1154', '861', '526', '904', '944')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `catalog_product_entity_varchar` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('1104', '1045', '1105', '1129', '1062', '1054', '1079', '1078', '1114', '1108', '1109', '1110', '1111', '1112', '1113')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `sales_order_decimal` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('567', '100', '270', '503', '999', '99', '101')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `catalog_product_entity_int` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('1040', '1011', '1041', '1063', '1042', '949', '1043', '1044', '1116', '1130', '1074', '953', '956', '960', '955', '1056', '1081', '1076', '962', '1057', '954', '1107', '1075', '1094', '1088', '1089', '1090', '1093', '1095', '1098', '1099')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `sales_order_datetime` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('568', '569', '572', '573', '704', '705')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `sales_order_text` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('531', '104', '97', '506')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `catalog_product_entity_decimal` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('1117', '1118', '1120')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `catalog_product_entity_datetime` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('1143', '1144', '1091')) AND (`store_id` IN (0)))UNION ALL(SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `catalog_product_entity_text` AS `t` WHERE (entity_id = '1021') AND (attribute_id IN ('1096', '1097', '1100', '1101')) AND (`store_id` IN (0))) ) AS `u` ORDER BY `store_id` ASC

It's asking for a table "sales_order_varchar" but this table doesn't exist in de database not in the source database of Magento 1 or in destinations database of Magento 2.
I did some searching but the table "sales_order_varchar" was deprecated after Magento 1.6.
Can anyone point me in the right direction to fix this issue?
Thank you all in advance.
Best regards,
Mike


texts: Cannot use object of type Closure as array magento 2 during setup upgrade

texts:
Cannot use object of type Closure as array when run the setup upgrade.
When we try to run the php bin/magento setup:upgrade command. it's given below error. Fatal error: Cannot use object of type Closure as array in /public_html/setup/src/Magento/Setup/Model/Installer.php on line 1288


texts: Transposed images (white with black background)

texts:
My developer is in the middle of upgrading my site from M1 to M2 2.3.2. Some of the product images that should have a white back ground now have a black background. My developer says it's because M2 does not support .gif images. Does anyone have an answer how to get around this without having to manually change each image?
Update: We have an answer if anyone else has experienced this problem. Answer: "Magento 2 was compressing .gif files and making them look like this. We have disabled the compress option for .gif files and they are fine now."


texts: I was working on a new Magento-2 (Version-2.3.0) site and all workes is fine then I added theme so my admin was not open and showing this error.


texts: How to add JS code in the head tag for only in the success page in Magento 2?

texts:
I need to add a JS script on the head tag, but only in the Success page. Inside Magento 2, I have no idea how doing this.
Someone can help me? :)


texts: Add Configurable products using REST API

texts:
While running below code to add configruable product,I get unable to save products.

try {
     $url = 'http://ddddd.com/index.php';
      $api_username = 'admin';
      $api_password = 'admin1234$';
    $userData = array("username" => $api_username, "password" => $api_password);

    $ch = curl_init($url."/rest/V1/integration/admin/token");
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));

    $token = curl_exec($ch);
    $product_data= '{
      "product":{
        "sku":"KudosConfigssss",
        "name":"Kudos Configurablesssss",
        "price":110.0000,
        "status":4,
        "type_id":"configurable",
        "attribute_set_id":4,
        "weight":1,
        "extension_attributes":{
          "stock_item":{
            "qty":10,
            "is_in_stock":true
          },

          "configurable_product_options":[
            {
              "attribute_id":"90",
               "label":"color",
              "values":[
                {
                  "value_index":54
                },
                {
                  "value_index":109
                }
              ]
            },
            {
              "attribute_id":"159",
               "label":"size",
              "values":[
                {
                  "value_index":15
                },
                {
                  "value_index":16
                }
              ]
            }
          ]
        }
      }
    }';

     $ch = curl_init($url."/rest/V1/products");
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS,$product_data);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));

     $result = curl_exec($ch);
     }catch(Exception $e){

           echo $e->getMessage();

     }

     /****** Show results ****/
    var_dump($result);


texts: What are the three different kinds of Plugins available and their difference with observer in magento2?

texts: I want to know the different kinds of plugins, their utilities and difference along with their difference with observer in magento2.


texts: get template id of custom transaction email by template name

texts:
Hi Can someone help me on this.

I need to send a custom email.

Currently all custom emails are send by setting the template id to a variable named $templateId as

$templateId = 20;

(or)

$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);

I want to be able to get the template id based on the email template name.
, say "NewEmailTemplate" is the email template name and the id is 10.

I want the id 10 by giving the template name.

Thanks


texts: How to get Order information from event checkout_onepage_controller_success_action?

texts:
I am trying to get order information to do some tasks, after the order is placed. I tried with the events "checkout_submit_all_after" and also with "sales_order_place_after" but the only event I am able to capture with an observer is "checkout_onepage_controller_success_action".
Can anyone help me to know how to get the order information with this event, or how to achieve it with another event. I need one that happens after the "Place" button is pressed.

My "events.xml":

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_cart_add_product_complete">
    <observer name="add_order_cart" instance="Tracy\ShippingMethod\Observer\AddOrderToCart"/>
</event>
<event name="checkout_onepage_controller_success_action">
    <observer name="send_order_tracy" instance="Tracy\ShippingMethod\Observer\SendOrderToTracy"/>
</event>
<event name="sales_order_place_after">
    <observer name="send_order_tracy_sales" instance="Tracy\ShippingMethod\Observer\SendOrderToTracyFromSales"/>
</event>
</config>

My observer class:

class SendOrderToTracy implements \Magento\Framework\Event\ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
       $writer = new \Zend\Log\Writer\Stream(BP.'/var/log/test.log'); // creates new log file named test.log in var/log folder
       $logger = new \Zend\Log\Logger();
       $logger->addWriter($writer);
       $logger->info("Aquí caputré el evento: checkout_onepage_controller_success_action."); // this will be print in test.log file

       $order_ids  = $observer->getEvent()->getOrderIds();
       $order_id   = $order_ids[0];
       $myText = (string)$order_id;
       $logger->info($myText);

       //HOW GET THE ORDER WITH THE ORDER_ID????!
    }
}


texts:
today i install Magento2 2.0.0-rc and setup my module confign but get error

Setup version for module 'Test_Newconfign' is not specified.

this code file module in Test/Newconfign/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Test_Newconfign" setup_version="2.0.0" >
        <sequence>
            <module name="Magento_Backend"/>
        </sequence>
    </module>
</config>


texts: Best place for code that will be reused in module

texts:
I have searched high and low and can't really find a good answer on this. I would like to create a class that contains a method/function that I can easily reuse in controllers, blocks and etc instead of copying the same method in many classes.

For example, I want to create a class and method that will delete specific cookies. I already know how to delete the cookies but I'm trying to figure out the best place to create this reusable class. I figured since in a way it is altering data (cookies) a model would be the best place. Am I right?

In M1 I would have created a model for this. However, the structure of M2 has changed so much I wanted to see what is recommended just to be sure. I'm still learning about the contracts and interfaces and etc. I also understand that plugins are to be used to change data or methods. I just want to be sure I place it in the best place and understand the reason why.

I would like to create a class that the construct method can make use of the following:

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

If someone can create and example of the top half of the class down to the __construct method/injector that would be awesome! I just want to understand where you would place this, why and what you extend and/or implement. Thank you in advance!

Update:

I came up with this.

<?php

namespace NameSpace\Module\Model;

use Magento\Framework\Session\SessionManagerInterface;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
use Magento\Framework\Stdlib\CookieManagerInterface;
use Magento\Framework\Model\AbstractModel;

class Cookie extends AbstractModel
{
    /**
     * @var \Magento\Framework\Session\SessionManagerInterface
     */
    protected $_sessionManager;

    /**
     * @var MetadataFactory
     */
    protected $_cookieMetadataFactory;

    /**
     * @var Manager
     */
    protected $_cookieManager;

    public function __construct(
        SessionManagerInterface $sessionManager,
        CookieManagerInterface $cookieManager,
        CookieMetadataFactory $cookieMetadataFactory
    ) {
        $this->_sessionManager = $sessionManager;
        $this->_cookieManager = $cookieManager;
        $this->_cookieMetadataFactory = $cookieMetadataFactory;
    }

    ....

}

Then in my controller I inject this class into the construct method:

protected $_cookieModel;

public function __construct(
Context $context,
\NameSpace\Module\Model\Cookie $cookieModel,
....

) {
    $this->_cookieModel = $cookieModel;
}

And then I simply call it from the controller $this->_cookieModel->deleteCookies();

Does this look ok? If not, what would you have done differently?


texts: Magento 2 : How to get success/error message after review post?

texts:
When I submit review form its properly redirect back on same page and review is properly saved in admin but there is no success message.

How do I show the success message on that page and where I can set that message ?


texts:
I am trying to write a plugin (interceptor) to fire when a customer is being deleted in Magento 2.
Previously I have written a plugin to fire when a new customer is saved. My plugin for saving makes use of
 * @param \Magento\Customer\Model\ResourceModel\CustomerRepository $subject
 * @param CustomerInterface $customer
 * @param string|null $passwordHash
 * @return array
 */
public function beforeSave(\Magento\Customer\Model\ResourceModel\CustomerRepository $subject, CustomerInterface $customer, $passwordHash = null)
{

    // TODO Plugin functionality here
    return [$customer, $passwordHash];
}

When a new customer is created this plugin fires and with my added functionality works fine for my purpose
My problem is the delete functionality. I have tried both an afterDelete and an aroundDelete as follows (personally I would prefer the afterDelete for simplicity if it works)
/**
 * @param \Magento\Customer\Model\ResourceModel\CustomerRepository $subject
 * @param $result
 * @param CustomerInterface $customer
 */
public function afterDelete(\Magento\Customer\Model\ResourceModel\CustomerRepository $subject, $result, CustomerInterface $customer)
{
    // TODO: Implement plugin method.
    return $result;
}

OR
/**
 * @param \Magento\Customer\Model\ResourceModel\CustomerRepository $subject
 * @param callable $proceed
 * @param CustomerInterface $customer
 */
public function aroundDelete(\Magento\Customer\Model\ResourceModel\CustomerRepository $subject, callable $proceed, CustomerInterface $customer)
{
    // TODO: Implement plugin method.
    return $proceed($customer);
}

Neither of these delete plugins work
I have put some logging inside the save and delete classes in \Magento\Customer\Model\ResourceModel\CustomerRepository and I can see the save class getting hit when the save action takes place. I never see the delete class being hit although the customer delete is working fine.
I have been hunting through the Magento 2 code and cannot see how the delete actually takes place and what class is being used for the delete action.
If anyone has any experience with the customer delete class I would like to know how the delete works and what class is taking care of it so I can target the class with a plugin


texts: creating cart promotion rule in Magento but this is not applying on subtotal

texts:
I am creating a Magento cart promotion rule but this is not working as we are thinking. I have two products in cart and apply this promo code but this is applying on first product amount only not all product subtotal.

link.
https://onedrive.live.com/redir?resid=AD49CC6A701028A5!123&authkey=!AHrXZMlIvEsEQIw&ithint=folder%2cpng


texts: Pass multiple attribute values to filter products

texts: How I can pass more than one attribute values at a time to filter products like attached image instead of filtering products using default functionality of selecting one attribute at a time?


texts: Magento2 - I want to change image size in gallery.phtml widget

texts: How can I change the default max-width and max-height of the image ?


texts: How to get applied coupon details in magento 2.1

texts:
I need to get applied coupon details in cart form.phtml

/app/design/frontend/Vendor/Theme/Magento_Checkout/templates/cart

In this path we have shopping cart files are there like coupon.html, form.html

In a coupon.html file we have code to get coupon

 $block->escapeHtml($block->getCouponCode())

How to get this coupon detail in other phtml file form.phtml


texts: How to get *every* products (in stock, out of stock, enabled, disabled, etc..)

texts:
I've been trying to figure this out for too many hours now...

How can I fetch every products from the database?

I've tried a lot of different method of getting the products, but all of them either don't work at all or only return products in stock.

This is what I'm using at the moment and it returns every products in stock (5 products out of the ~50 products that I can see in the admin):

$collection = $this->productCollectionFactory->create();
$collection->addAttributeToSelect('*');
$collection->load();

foreach ($collection->getItems() as $productItem) {
    $product = $productItem->getData();
    echo $product['name'].'<br>';
}

If it matters, my goal is to update these products (name, description, stock, price...).


texts: Discrepancies with $_item->getFreeShipping() - can't find whether order item had free shipping

texts:
I have a script which runs through order items.

I also set up a Shopping Cart Promotional Rule for Free Shipping on certain items 'For matching items only' which I've matched by SKU in the Actions tab.

I know this rule is working because I have a custom shipping module and when calculating the shipping costs via this module the function $_item->getFreeShipping below returns 1 if the rule has applied free shipping to the item. There are no problems with this as far as I can see:

// Looping through items in checkout to calculate shipping cost to apply.
foreach ($request->getAllItems() as $_item) {
    ...
    // returns 1 for the product in question
    $_item->getFreeShipping();
    ...
}

So the above is for the items in the shipping quote.

However, after I have gone through checkout, placed the order (using Check/Money order), and invoiced the order (manually in admin panel), when I loop through the order items of the order, the $_item->getFreeShipping call is returning 0 for all items (even those that were returning 1 when calculating shipping costs)

foreach ($order->getAllItems() as $_item ) {
    ...
    // returns 0 for the product in question (and all other products)
    $_item->getFreeShipping();
    ...
}

I'm currently working with a fresh install of CE 1.7.0.2. No third party modules apart from my custom shipping module, but this only adds some custom shipping methods that calculate shipping costs based off units ordered, with some custom logic.

I need a way of getting whether the order item had free shipping when it was placed - the script is for sending an order feed to a distributor, and I need to send them the shipping cost for the order. In some cases it's more complicated than using $_order->getShippingAmount as some orders will need to be separated into separate shipments, so the effective shipping cost needs to be recalculated for each order item.

Please note for these orders I am not using the "Free Shipping" Shipping Method, just a Free Shipping Promotional Rule - might that be where the discrepancy lies?

Can anyone shed any light? Thanks in advance.


texts: Magento 2.4 all category links are not accessible

texts:
All the category will show an exception error whenever i click the category link

An error has happened during application run. See exception log for details.
I cannot see any new errors in exception log

var/log/exception.log shows nothing relevant to the error based on the time shown.
access.log shows the requested url but all links to category resulted to the error.
I am using an update theme from blank theme and have tried all the backend settings..
im using
Ubuntu 18.04
php 7.4.10
magento 2.4.0


texts: Multiple tracking code Google Analytics with e-commerce conversion

texts:
Magento 1.9.1
Google Analytics setting up correctly.

I want to add a new google analytics code that have e-commerce transaction (so add the tracking code in all page is not sufficient).

Is it possibile? And if yes, how can I do that?

Thanks a lot for your support!


texts: Why doesn't Magento 2.1 support PHP 7.0.3 to 7.0.5?

texts:
As you may know Magento 2.1.0 is out.

According to the release notes, only PHP 7.0.2 AND PHP 7.0.6 are supported

Why aren't PHP 7.0.3 / 7.0.4 / 7.0.5 supported ?

Edit: 2.1.2 now supports PHP 7.0.4


texts:
I need run php bin/magento setup:upgrade, but bin folder not exists in magento installation.

I have this files and directories:

How I can run the command?


texts:
I've added a customer custom data (code_client) to the customer info and I want the user to be able to login with both the email addresses and that code_client.

Is it possible to log in to my store without using only an email address?

Find some hint on the stack  : Magento 2: Get Customer data before login with observer

But there's no mention of the password and how to check it.


texts: Is there a Magento 2 equivalent of Drupal's "variable_set"?

texts:
I want to store persistent values (e.g. system settings, etc) in Magento 2. In Drupal you can use variable_set and variable_get to quickly do this without worrying about the DB calls involved.

Is there a way to do it in Magento 2? I see that there are tables called variable and variable_value, but there doesn't seem to be any information about them out there.


texts:
After having to download the theme into my Magento root I run command php bin/magento setup: upgrade and I meet that error:

  Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html

I don't understand why this error comes, maybe because my PHP version is  7.2.11..
 Please help me .thanks.


texts:
I am working on a module where I need to get a product's bundle items information as it is displaying in the Product display page.
For product display Page the option are available through options.phtml
<?php /** @var $block Magento\Bundle\Block\Catalog\Product\View\Type\Bundle */ ?>
<?php
$product = $block->getProduct();
$helper = $this->helper('Magento\Catalog\Helper\Output');
$stripSelection = $product->getConfigureMode() ? true : false;
$options = $block->decorateArray($block->getOptions($stripSelection));
?>

how can I get the same in my php file?


texts:
Can somebody explain how stock index works in Magento 2 and what is it used for and how?

If I set it "index on schedule" what exactly happens and how does it affect the shop if stock index is in "reindex needed" status?


texts: Changing sort-order of attribute dropdown (configurable product, magento 2)

texts:
I want to change the order of the dropdown (where a customer can select the variant he/she wants). I already tried to change the order in the attribute itself but it does not apply to the products dropdown on the frontpage (already did flush cache and reindexed).

Any idea why magento doesn't apply my custom sort order?

Attribute is about the products size in mm and I just want to order it from smallest to biggest size.


texts: Custom option of product not display in product view page?

texts:
I am using magento 1.9.2.4. version. I added some custom option for my test product.
Please check this screen short

But it's not showing in product view page

I also use this code in view.phtml

$productCollection = Mage::getModel("catalog/product")->load(1742);
$i = 1;
echo 'kkkk';
foreach ($productCollection->getOptions() as $value) {
echo "Custom Option:" . $i . "
";
echo "Custom Option TYPE: " . $value->getType() . "
";
echo "Custom Option TITLE: " . $value->getTitle() . "
";
echo "Custom Option Values:
";
// Getting Values if it has option values, case of select,dropdown,radio,multiselect
$values = $value->getValues();
foreach ($values as $values) {
print_r($values->getData());
}
$i++;
}

and this also

echo '
';
if($product->hasOptions())
                        {
    foreach ($product->getOptions() as $o) {
        $optionType = $o->getType();
        echo 'Type = '.$optionType;

        if ($optionType == 'drop_down') {
            $values = $o->getValues();

            foreach ($values as $k => $v) {
                print_r($v);
            }
        }
        else {
            print_r($o);
        }
    }
}
echo '
';

But nothing is happened.
And the same code is working fine on xmapp.
please guide me. I am new in magento.


texts: Create Attribute set in Magento 2 using Api

texts:
I am trying to create an attribute set and assign multiple attribute into it using rest api in Magento2.
Please help me in this regard.


texts: Magento 2 Second time loading not going to observer controller_action_predispatch with cms_page_view

texts:
I have created a observer controller_action_predispatch and did an echo  its triggering on all page view but with Second time loading its not triggering on cms_page_view for all other pages it triggers.

Dont know whats the reason, I can guess that it can be cached date, Using a weltpixel pearl theme.

How to fix this.

events.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch">
        <observer name="restrict_website" instance="Test\Dev\Model\RestrictWebsite" />
    </event>
</config>

RestrictWebsite.php

<?php

namespace SahiSdi\Dev\Model;

use Magento\Customer\Model\Context;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Store\Model\StoreManagerInterface;

class RestrictWebsite implements ObserverInterface
{
    protected $_storeManager;

    /**
     * RestrictWebsite constructor.
     */
    public function __construct(
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Framework\App\Response\Http $response,
        \Magento\Framework\UrlFactory $urlFactory,
        \Magento\Framework\App\Http\Context $context,
        \Magento\Framework\App\ActionFlag $actionFlag,
        \Magento\Store\Model\StoreManagerInterface $storeManager
    )
    {
        $this->_response = $response;
        $this->_urlFactory = $urlFactory;
        $this->_context = $context;
        $this->_actionFlag = $actionFlag;
        $this->_storeManager = $storeManager;
    }

    /**
     * @param Observer $observer
     * @return void
     */
    public function execute(Observer $observer)
    {
        $request = $observer->getEvent()->getRequest();
        $actionFullName = strtolower($request->getFullActionName());
        echo $actionFullName;
    }
}


texts: Magento 2: How can i configure magento shipping option?

texts:
i have tried to access "magento shipping" shipping method but i can not able to get any require credentials and also not found any support about pricing list if its a paid service.

Is there anyone who have already used this method then please share your knowlegde.

Thanks.


texts:
Some associate product not showing image of configurable product, you can see the error in this page:
https://www.cammaleao.com/ankle-boot-oxford-wirth-couro-taupe.html

In "Escolha seu tamanho" please choose number 39 (not show images), after choose 33 (show images).
Both associated products are similar. I am trying to debug with chrome/firebug... But I have not succeeded.

I tried flush all types cache, including "Catalog Images Cache".

Any suggestions?
Thanks in advance.


texts:
I managed to put up a EcomDev_PHPUnit_Test_Case with this:

public function testGetModelMemoryTrace() {
    $model = Mage::getModel('catalog/product');
    $product = $model->load(10);
    $this->assertEquals($product->getId(), 10);
    $parentProduct = $model->load(4);
    $this->assertEquals($product->getId(), 10); //here getId() is actually 4...
}

This test fails for me in the last assert. Is this an expected effect ? To clarify, the second load alters first reference to object id 10.

Thank you.


texts: How to make my own selection algorithm working with multi source inventory? Magento 2.3

texts: Is there a way to make my own selection algorithm in MSI? Working only with one website and one store.


texts: Adding sign in as checkout step in the magento2

texts: which js file is responsible for returning register sign_in template in magento2. As i want to add sign_in register to the checkout page.


texts:
/vendor/magento/module-eav/Model/Entity/Attribute/ScopedAttributeInterface.php

There are 3 defined scopes

/**
 * @api
 * @since 100.0.2
 */
interface ScopedAttributeInterface
{
    const SCOPE_STORE = 0;

    const SCOPE_GLOBAL = 1;

    const SCOPE_WEBSITE = 2;
}

  and here is the DB for entity_type_code

mysql> SELECT entity_type_id, entity_type_code FROM eav_entity_type;
+----------------+------------------+
| entity_type_id | entity_type_code |
+----------------+------------------+
|              1 | customer         |
|              2 | customer_address |
|              3 | catalog_category |
|              4 | catalog_product  |
|              5 | order            |
|              6 | invoice          |
|              7 | creditmemo       |
|              8 | shipment         |
+----------------+------------------+

  So above all entities, Which Entity Allows scope attributes.

customer and customer_address Does not support Scope Attribute [Global]

catalog_category and catalog_product Does support Scope Attribute [Default, Website and Store]

  So the question is Sales tables does support Scope Attribute ?
  Because sales tables are stored as flat tables in Magento.

5: order
6: invoice
7: creditmemo
8: shipment


texts: Magento 2 properly update core jquery lib

texts:
I keep seeing this warning in my console (firefox dev-console)

JQMIGRATE: jQuery.browser is deprecated  jquery-migrate.js:41:4
console.trace():  jquery-migrate.js:43
    migrateWarn ---.com/static/version1498093005/frontend/Magento/luma/en_US/jquery/jquery-migrate.js:43:5
    get ---.com/static/version1498093005/frontend/Magento/luma/en_US/jquery/jquery-migrate.js:58:6
    f< ---.com/static/version1498093005/frontend/Magento/luma/en_US/jquery/jquery.ba-hashchange.min.js:9:677
    <anonymous> ---.com/static/version1498093005/frontend/Magento/luma/en_US/jquery/jquery.ba-hashchange.min.js:9:389
    <anonymous>

I'd really like to update it to a newer version.
Thanks


texts:
I get blank page when I place order, on success page I have 500 error and it is blank. I can see the order on admin panel and buyer panel, but status is pending.
Also i increased PHP memory limit. I can not even go to bank payment because of this issue. Also COD has this issue too

This is my exception log on COD:

 [2019-12-08 04:52:20] main.CRITICAL: Magento\Framework\View\Asset\File\NotFound$
Stack trace:
#0 /vendor/magento/framework/View/Asset/Mer$
#1 /vendor/magento/framework/View/Asset/Mer$
#2 /vendor/magento/framework/View/Asset/Mer$
#3 /vendor/magento/framework/View/Asset/Mer$
#4 /vendor/magento/framework/View/Asset/Mer$
#5 /vendor/magento/framework/View/Page/Conf$
#6 /vendor/magento/framework/View/Page/Conf$
#7 /vendor/magento/framework/View/Page/Conf$
#8 /vendor/magento/framework/View/Page/Conf$
#9 /vendor/magento/framework/View/Result/Pa$
#10 /vendor/magento/framework/View/Result/L$
#11 /vendor/magento/framework/Interception/$
#12 /vendor/magento/framework/Interception/$
#13 /vendor/magento/framework/Interception/$
#14 /vendor/magento/module-page-cache/Model$
#15 /vendor/magento/framework/Interception/$
#16 /vendor/magento/framework/Interception/$


texts: How the product edit form generated in magento2?

texts:
Suppose I'm talking about downloadable product.

How the product edit form generated which default files will work for it in magento2?

Can you please help me if you know?


texts: Fatal error: Class Magento\Framework\Config\FileIterator

texts: While working with Magento theme styling suddenly i received this error from both fronend and backend. Please help me to solve this issue. I have no idea of where the exact issue.


texts:
I have checked some tutorials to create custom shipping module in user panel where sellers can update carrier information and tracking  information. However, all are available for admin panel. I need to create in user panel. I know, how to create module for Magento. However, I am not able getting starting point where to start and which module I look through.

In Admin dashboard, admin can update the shipment information like which carrier is used for shipment and what is the tracking number. Is this module is using flat table in database?

Thanks :)


texts: Developing a Web-Site using Magento Community Edition

texts:
I intend to develop a web-site using Magento Community Edition (free version). The solution needs to have, in addition to an e-commerce store with shopping cart, some other auxiliary web-pages (for example, a page containing some location information) and some pages with hyperlinks that are linked to product information stored in Magento.
I am aware of the Magento's store hierarchy. What is the way in Magento to have such auxiliary web-pages ?

Thanks for your feedback!


texts: How to write two queries in one function?

texts:
In my block file there are some queries like below,

    protected $resource;

    public function __construct(
        \Magento\Framework\App\ResourceConnection $resource
    ) {
        $this->resource = $resource;
        $this->connection = $this->resource->getConnection();
    }
public function getFrameColorOption()
    {
        $tableColor = $resource->getTableName('color_price');

        $sql = "SELECT * FROM " . $tableColor;
        $color = $connection->fetchAll($sql);
        return $color;
    }
public function getGlassPriceOption()
    {
        $tableGlass = $resource->getTableName('glass_price');

        $sql = "SELECT * FROM " . $tableGlass;
        $glass = $connection->fetchAll($sql);
        return $glass;
    }

In there im duplicating my connection how can i do it correctly.

my template .phtml file im retieving those values like below

$color = $block->getFrameColorOption();
$glass = $block->getGlassPriceOption();

  I need to do this correct way can someone please help me im new to
  magento


texts: Magento 2.4 - Port must be configured within host parameter Pls Help

texts:
I can start the setup via Command Line. And I get no Errors. But if i enter the homepage i got this error:
[2020-11-03 23:11:17] main.CRITICAL: Port must be configured within host parameter (like localhost:3306 {"exception":"[object] (Zend_Db_Adapter_Exception(code: 0): Port must be configured within host parameter (like localhost:3306 at /usr/share/nginx/html/magento2/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php:405)"} []

What is this Error?????


texts: magento 1.9 getting values from $_product issue

texts:
I am working in magento 1.9 . I have around 350 products in backend . When i get the attributes of line items like height , width etc , i am facing the issue . Just like the product "chair" has width = 3.00 , product "paper" has width = 0 and last but not the least product "table" has width = 12.00 . When i print the values of lineitems ,it print the width of chair as 3 , now it should print the width of paper as 0 but the issue is that it overwrites the previous value in case of 0 . For product table it shows the width as 12 . which is fine . Only issue with 0 values . My code looks like that .

 function cortigoLtlProductAttr($_product) {
        $attributes = array(
            'enableLtl'     => 'en_ltl_check',
            'length'        => 'en_length',
            'width'         => 'en_width',
            'height'        => 'en_height',
            'freightClass'  => 'speed_freight_class',
            'hazmat'        => 'en_hazmat',
        );
 foreach ($attributes as $key => $attribute) {

                $haveAttribute = $this->checkAttributeAdded($attribute);
                if($haveAttribute){
                    $productAttr[$key] = $_product->getResource()->getAttribute($attribute)->getFrontend()->getValue($_product);
                }else{
                    $productAttr[$key] = 'No';
                }
            }
            return $productAttr;
        }
    public function checkAttributeAdded($attributeName){
            $entity = 'catalog_product';
            $attr = Mage::getResourceModel('catalog/eav_attribute')
                ->loadByCode($entity,$attributeName);

            if ($attr->getId()) {
                return True;
            }else{
                return False;
            }
        }

Looking for kind help .


texts: Add a "Reload This Page" button on Front End

texts:
for some reason our product pages like to redirect to the 404 page not found every now and again but this is usually resolved by refreshing the page.

Unfortunately not everybody is going to know this and the only current option we have is a hyperlink/button for "Return to Home Page" which obviously isn't ideal and unnecessarily lengthens the customer journey.

Is there a way to add a "Refresh/Reload This Page" in to the CMS page?

Preferably in a way I can add it using the wysiwyg or html as i'm not clued up on Java.

Thanks!


texts: When schema_version & data version will be different?

texts:
For example i don't have setup scripts in My module,can i ignore setup_version tag in module.xml file.

In m1 automatically modules installed,now it's first throwing an error(if we don't run setup upgrade command).
Why I need to manually run setup upgrade?

What is the scenario schema_version and data_version will be different?
I observed almost records in setup_module table contain same values.


texts: How to hide a admin menu based on config value for enable or disable for custom module in magento?

texts:
Is there any possibility to hide a menu related to a custom module in the admin side when the custom module is deactivated using the system config options written in the system.xml of the magento.

Please anyone help me.


texts: Where is set shipping_description value in sales_flat_order table?

texts:
I need to set a new value for the shipping_description column of the sales_flat_order table.

I would like to know in which file I can define this value before the order is created in the database ?

Thanks for your help


texts:
My API returns a JSON that I would like to transform into a PHP object so that I can find a specific field in return. how can I do this?

My get

public function teste()
{
    $requestUrl='http://XXXXXX:XXX/api/login';
    $users = array("wts-authorization: XXX/XXx","content-type: application/json","accept: application/json");
    $ch = curl_init($requestUrl);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $users);
    $obj = curl_exec($ch);

}

My return

{"page":2,"per_page":6,"total":12,"total_pages":2,"data":[{"id":7,"email":"michael.lawson@reqres.in","first_name":"Michael","last_name":"Lawson","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/follettkyle/128.jpg"},{"id":8,"email":"lindsay.ferguson@reqres.in","first_name":"Lindsay","last_name":"Ferguson","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/araa3185/128.jpg"},{"id":9,"email":"tobias.funke@reqres.in","first_name":"Tobias","last_name":"Funke","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/vivekprvr/128.jpg"},{"id":10,"email":"byron.fields@reqres.in","first_name":"Byron","last_name":"Fields","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/russoedu/128.jpg"},{"id":11,"email":"george.edwards@reqres.in","first_name":"George","last_name":"Edwards","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/mrmoiree/128.jpg"},{"id":12,"email":"rachel.howell@reqres.in","first_name":"Rachel","last_name":"Howell","avatar":"https://s3.amazonaws.com/uifaces/faces/twitter/hebertialmeida/128.jpg"}]}

I would like to treat as an object and use as follows

obj->first_name == "Michael"

Magento 2.3.3
Win10  Xampp


texts: Override community extension controller is not working in magento 1.9.2

texts:
I am using Quote2Sales community extension, but i need some customization in it so i am overriding controller by local module.

In Community folder Bobcares package and in this Quote2Sales extension.

To override RequestController.php i have made Mt package inside local and in it Quote2Sales folder. In it controllers and make file RequestController.php . In RequestController.php code is as following:

require_once 'Bobcares/Quote2Sales/controllers/RequestController.php';

class Mt_Quote2Sales_RequestController extends Bobcares_Quote2Sales_RequestController {
---
---
}

And in etc folder config.xml file code is as following:

<?xml version="1.0"?>
<config>
    <modules>
        <Mt_Quote2Sales>
            <version>0.0.1</version>
        </Mt_Quote2Sales>
    </modules>
    <frontend>
        <routers>
            <quote2sales>
                <use>standard</use>
                <args>
                    <modules>
                        <mt_quote2sales before="Bobcares_Quote2Sales">Mt_Quote2Sales</mt_quote2sales>
                    </modules>
                </args>
            </quote2sales>
        </routers>
    </frontend>
    <global>
        <helpers>
            <quote2sales>
                <class>Mt_Quote2Sales_Helper</class>
            </quote2sales>
        </helpers>
    </global>
</config>

And also add code in Mt_Quote2Sales.xml as follow:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mt_Quote2Sales>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Bobcares_Quote2Sales/>
            </depends>
        </Mt_Quote2Sales>
    </modules>
</config>

But it is not working. Please help me.


texts: Change Product Price if particular Payment Gateway is selected

texts:
I have 2 payment gateway on the website, I want when user choose payment gateway one, price of all products gets increased by 10

I new to magento and could not find with an event to override for this please help me with a way for same


texts: Removing welcome message and breadcrumbs stops the title tag appearing on category page

texts:
I have the following lines of code in my Magento 2 template's Magento_Theme default.xml file:

<referenceBlock name="header" remove="true"/>
<referenceBlock name="breadcrumbs" remove="true"/>

Either of these lines work correctly alone - the first to remove the welcome message, and the second to remove the breadcrumbs.

However, on the category page, the title then just renders as <title></title>.  Removing either of these lines of code makes it work fine, ie  <title>Category Title</title>.

Any ideas what is causing this?


texts: How can i get selected shipping method on checkout Magento2?

texts: I am on checkout page and i want to get the shipping method that is selected by the user on which i can further add or extend functionality on the basis of shipping method choose?


texts: Magento 2 : Modify Name of Product Category With API Rest

texts:
How to change name of product category with API Rest? The URL is  http://localhost:8082/magento/index.php/rest/V1/categories/26 and JSON is

{
   "category": {
      "id": 35,
      "parent_id": 34,
      "is_active": true,
      "position": 4,
      "name": "bio 33",
      "level": 2
   }
}

The name is only modified on front but not in back.
What am I doing wrong?

Thanks.


texts: Unable to extend customer address edit page in Magento 2

texts:
I'm trying to extend customer address edit page, but it is throwing Error. For these I have written code as below.

composer.json

{
  "name": "learning/module-contact",
  "description": "Contact",
  "require": {
      "php": "~5.5.0|~5.6.0|~7.0.0",
      "magento/framework": "100.0.*",
      "magento/module-ui": "100.0.*",
      "magento/module-config": "100.0.*"
  },
  "type": "magento2-module",
  "version": "1.0.0",
  "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
  "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "Learning\\Contact\\": ""
        }
    }
}

registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Learning_Contact',
    __DIR__
);

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="Learning_Contact" setup_version="1.0.0">
    </module>
</config>

di.xml

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

    <preference for="Magento\Customer\Block\Address\Edit" type="Learning\Contact\Block\Address\Edit"/>
</config>

Edit.php

<?php

namespace Learning\Contact\Block\Address;

class Edit extends \Magento\Customer\Block\Address\Edit{

    /**
     * Registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_registry;

    public function __construct(\Magento\Framework\Registry $registry){
        $this->_registry = $registry;
        parent::__construct();
    }

    public function _toHtml() {

        if ($this->getTemplate() == 'customer/address/edit.phtml') {

                $htmlToInsertAfter = '
'. __('Address') .'
';
                $addressCandidatesHtml = $this->getLayout()->createBlock('contact/candidates')->setTemplate('custom.phtml');
                $editHtml = parent::_toHtml();
                return substr_replace($editHtml, $addressCandidatesHtml, strpos($editHtml, $htmlToInsertAfter)+strlen($htmlToInsertAfter),0);
        }

        return parent::_toHtml();
    }

}

custom.phtml

Hi I'm here

  Error : Object DOMDocument should be created

Is it correct procedure to extend customer address edit page?


texts: magento 2 category and product page displaying blank

texts:
I have upgraded Magento from 2.1.10 to 2.2.5. First I have upgraded it locally and all things are working in local then I have upload those source code in beta and did following process :

php bin/magento s:up

php bin/magento s:s:d

php bin/magento c:c

php bin/magento c:f

php bin/magento i:rei

In beta database was of Magento 2.1.1 but after did above process now my Magento is 2.2.5.

All things are working but the Category and Product detail page is not opening. It is showing blank a white page.

I checked error in var/log but no error. I have enabled the error in index.php but still no luck.

I gave permission to var and generated directories.

I changed theme to default theme and also tried by disable all extension.


texts: Magento 2: object manager construct call without calling direct in phtml file

texts:
I need to call object manager in my phtml file but I don't want to call direct in my file.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

Please suggest


texts: Set value to created customer custom attribute in magento 2

texts:
I have created custom attribute for customer using below code.

setup/installData.php

class InstallData implements InstallDataInterface {

const LEGALITY_DOCUMENT_1 = 'user_legality_document_1';
protected $customerSetupFactory;
private $attributeSetFactory;

public function __construct(
CustomerSetupFactory $customerSetupFactory, AttributeSetFactory $attributeSetFactory
) {

    $this->customerSetupFactory = $customerSetupFactory;
    $this->attributeSetFactory = $attributeSetFactory;
}

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) {
    $setup->startSetup();
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
        $attributeSetId = $customerEntity->getDefaultAttributeSetId();

        $attributeSet = $this->attributeSetFactory->create();
        $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

    $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, self::LEGALITY_DOCUMENT_1, [
        'type' => 'varchar',
        'label' => 'Legal Document',
        'input' => 'image',
        "source" => '',
        'required' => false,
        'default' => '0',
        'visible' => true,
        'user_defined' => true,
        'sort_order' => 210,
        'position' => 210,
        'system' => false,
    ]);

    $document = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, self::LEGALITY_DOCUMENT_1)
            ->addData([
        'attribute_set_id' => $attributeSetId,
        'attribute_group_id' => $attributeGroupId,
        'used_in_forms' => ['adminhtml_customer', 'customer_account_create', 'customer_account_edit'],
    ]);

    $document->save();
    $setup->endSetup();
}

}

Now i want to set value to this attribute pragmatically.

How can i do achieve this ?

Thanks in advance.


texts: Csv file empty after export orderd products list

texts:
I have found a list of ordered products in
Magento 2 admin -> reports -> products -> ordered. that's working properly. but after that, I export that list as a CSV file. but after downloaded it's empty.
this is only happening in the ordered products report. others working properly.
plz, provide a solution to fix this.


texts: Rewrite URL for multiples website/store views

texts:
I'm using Magento 1.8.0 with multiples websites for each country, for example

USA (Website) with english (store views)
France (website) with french and english (store views)
Switzerland (website) with french, german and english (store views)

Actually, when someone visit my website, I use a geoIP script to redirect it to the right store views.

$geoPlugin_array = unserialize( file_get_contents('http://www.geoplugin.net/php.gp?ip=184.172.117.120') );

//Get country code
$code = $geoPlugin_array['geoplugin_countryCode'];

//Get browser Language
$browserLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$browserLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);

if ($code == "CH") {
    switch ($browserLanguage){
        case "fr":
           $mageRunCode = "ch_fr";
            break;

        case "de":
           $mageRunCode = "ch_de";
            break;

        default:
            $mageRunCode = "ch_en";
            break;
        }
}

I choose to add the store views to the URL, because my store are SEO friendly (I think). ch_fr, ch_de, ch_en, us_en...

So my website will look like : www.mystore.com/ch_fr/

This work fine it the user goes to the homepage, but If I want to share a link to a specifc produc on Facebook for example, I can't.
For example :

I have a product, www.mystore.com/us_en/category-in-english/myProduct.html
But in Swiss-french, it should be : www.mystore.com/ch_fr/categorie-en-francais/monProduit.html

Ideally, I would like to share a link like : www.mystore.com/myProduct.html and to be redirect by the same geoIp to the right country/language.


texts: How to get product image by product Id in magento2

texts:
I am not able to get the absolute path of the image by product id in Magento 2. Can anybody help me?

I am able to get media path so far by directoryList class by doing this:

$this->directory->getPath('media');

How to get product image full path?

Please note that I don't want an image URL, I want the image path directory.


texts: Magento 2 how to remove Category name With ID

texts:
here am using Magento 2.3 here category displaying category with its ID,

How to Hide or Remove these Ids. Can I get help? thank you in advance.


texts:
I am trying to capture magento's calender date-select event, haven't found anything about any where, but I already know magento is using jQuery UI calender so I looked into jQuery UI documentation and found that onSelect event is on their list using which I can capture the event.

here is the code I had written :

Calendar.setup({
   inputField  : 'store_date',
   ifFormat    : '%m/%e/%y',
   button      : 'store_date_trig',
   align       : 'Bl',
   onSelect: function(dateText,selectedDate) {
        console.log(selectedDate);
   }
});

event is getting called but the problem is after selecting a date calender doesn't hide with single click but I have do double click on date to hide the calender also textbox (inputField) is not getting updated after date select.

Thanks


texts: Facebook like button count inconsistancy due to automatic url rewriting

texts:
I was trying to add the facebook like button to my product pages but then I noticed that the like counter has different numbers depending on where the page was accessed from and the URL it has.

Magento by default creates 3 URL rewrites for each new product automatically.

If I access a product from my home page it has the URL  mysite/product-name.html.
If I access a product from a base category it has the URL mysite/base-category/product-name.html
If I access a product from a sub-category it has the URL mysite/base-category/sub-category/product-name.html

all of the above have different like counts and are treated as different pages. is there a way to merge the like counts while still keeping the SEO friendly URLs? what are the best practices in this regard?

Thank you.


texts:
I just cant get to the review step in my standard 1.9.3.9 checkout. I checked the response of savePayment and it looks ok, the code for the review is there and looks ok, but its not "put" in the next section.

This is the beginning of the response: {"goto_section":"review","update_section":{"name":"review"...

This is my review section:

        6

Bestellübersicht

        Bearbeiten


texts:
Im getting this error while trying to create a product in magento
"Error occurred during "custom_attributes" processing. Attribute "color" has invalid value. The "black" value's type is invalid. The "int" type was expected. Verify and try again."
This is the payload i am passing
{
  "product": {
    "sku": "Snee1",
    "name": "Snee Tee Large",
    "attribute_set_id": 11,
    "price": 25,
    "status": 1,
    "visibility": 1,
    "type_id": "simple",
    "weight": "0.5",

    "extension_attributes": {
        "category_links": [
            {
                "position": 0,
                "category_id": "11"
            },
            {
                "position": 1,
                "category_id": "12"
            },
            {
                "position": 2,
                "category_id": "16"
            }
        ],
        "stock_item": {
            "qty": "10",
            "is_in_stock": true
        }
    },
    "custom_attributes": [
        {
            "attribute_code": "spc",
            "value":"snee1"
        },
        {
            "attribute_code": "description",
            "value": "The Champ Tee keeps you cool and dry while you do your thing. Let everyone know who you are by adding your name on the back for only $10."
        },
        {
            "attribute_code": "tax_class_id",
            "value": "2"
        },
        {
            "attribute_code": "material",
            "value": "148"
        },
        {
            "attribute_code": "pattern",
            "value": "196"
        },
        {
            "attribute_code": "color",
            "value": "black"
        },
        {
            "attribute_code": "size",
            "value": "170"
        }    ]
  }
}

I understand i am creating a product with a custom attribute of color and the value should be an  int but i have tried to pass "black".
My question is , is there a way to configure magento to receive the value instead of the int value?
I am asking as we are integrating with an epos provider and they seem to only be able to pass the actual value instead of the id
Thanks


texts: Magento 1.9 - How to filter catalog_product.list with their custom attribute in soap/v1

texts:
$client     = new SoapClient('http://localhost/project/api/soap/?wsdl');

$user_name  = $_POST["user_name"];
$password   = $_POST["password"];

$response = array();

$session    = $client->login($user_name, $password);
$result     = $client->call($session, 'catalog_product.list');

$response = array(
    "status" => 1,
    "message" => "suceess",
    "featute_products" => $result
);

ob_start();
header('Content-type: application/json');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');

echo json_encode($response);
exit;


texts: Magento - get url of the logo for a frontend store in admin

texts:
I'm building a Magento extension for the admin backend and I'm trying to retrieve the url of the logo for a frontend store.

I've tried the following code:

$logo_src = Mage::getStoreConfig('design/header/logo_src', $store_id);
$design = Mage::getDesign();
$logo_url = $design->getSkinUrl($logo_src);

But it returns the url of the logo for the admin backend.

Then I managed to get the right url using the following code:

$logo_src = Mage::getStoreConfig('design/header/logo_src', $store_id);
$design = Mage::getDesign();
$design->setArea('frontend');
$logo_url = $design->getSkinUrl($logo_src);
$design->setArea('adminhtml');

I was wondering if there is a cleaner way to retrieve the logo url...


texts: I'm using magento 1.9 and I'm trying to set up the cookie restriction mode to display the cookie notice. I have everything enabled and appears set up correctly but the cookie notice doesn't display, is there something that I'm missing?


texts:
Whats the rule to makes the search form URL https? I tried:

<secure_url>
    <catalogsearch>/result/</catalogsearch>
</secure_url>

But that doesnt do the job. Whats wrong?

Thanks!

Solution:

<catalogsearch>/catalogsearch/result/</catalogsearch>


texts: Get attribute groups from multiple attribute sets

texts:
I'm trying to retrieve in some custom code the existing attribute groups from multiple attribute sets.
For this, I am using the Magento\Eav\Model\Attribute\GroupRepository::getList method with search criteria builders and filters.
But I get a Magento\Framework\Exception\NoSuchEntityException with the message No such entity with %fieldName = %fieldValue.

This is my code:

private $searchCriteriaBuilder;
private $filterBuilder;
private $attributeGroupRepository;
public function __construct (
    \Magento\Eav\Api\AttributeGroupRepositoryInterface $attributeGroupRepository,
    \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
    \Magento\Framework\Api\FilterBuilder $filterBuilder
) {
    $this->attributeGroupRepository = $attributeGroupRepository;
    $this->searchCriteriaBuilder = $searchCriteriaBuilder;
    $this->filterBuilder = $filterBuilder;
}

private function getExistingAttributeGroupIds($existingAttributeSetIds)
{
    $this->searchCriteriaBuilder->addFilters(
        [
            $this->filterBuilder
                ->setField('attribute_set_id')
                ->setValue($existingAttributeSetIds)
                ->setConditionType('in')
                ->create(),
        ]
    );

    $attributeGroups = $this->attributeGroupRepository->getList($this->searchCriteriaBuilder->create());
    $attributeGroupIds = [];

    foreach ($attributeGroups->getItems() as $attributeGroup) {
        $attributeGroupIds[] = $attributeGroup->getAttributeGroupId();
    }

    return $attributeGroupIds;
}

I did some digging around and found that the issue comes from the getList method of the attribute group repository:

    $attributeSetId = $this->retrieveAttributeSetIdFromSearchCriteria($searchCriteria);
    if (!$attributeSetId) {
        throw InputException::requiredField('attribute_set_id');
    }
    try {
        $this->setRepository->get($attributeSetId);
    } catch (\Exception $exception) {
        throw NoSuchEntityException::singleField('attributeSetId', $attributeSetId);
    }

This line $attributeSetId = $this->retrieveAttributeSetIdFromSearchCriteria($searchCriteria); ignores the fact that my filter has the condition in and expects it to be an integer. But based on my code it returns an array. So $this->setRepository->get($attributeSetId); tries to retrieve an attribute set with an id that is actually an array and it obviously fails.

So I have 2 questions about this:

Should I report this as a bug/inconsistency?
Is there a nice way to get the attribute groups via a single query for multiple attribute sets?  Please don't suggest calling getList for each attribute set (I have a lot of them so a foreach is not a nice solution).  Please don't suggest using attribute group collections instead of repositories. I already thought about the 2 solutions above. I want a clean, "magento2-way" one.


texts: I am trying to get Product Image on Shopping cart , in magento Admin


texts: Performance on the product page with attributes

texts:
I'm working on a Magento webshop (EE 1.14.2.0) with terrible performance on pages where product attributes are loaded, the worst performing page is the product page because there're multiple attributes shown. It takes 12854ms and 250MB memory to load!

I've installed the AOE Profiler extension for better profiling where I saw the following:

When I disable all the local and community modules and restore the default or rwd theme I've got the same performance (there are no core hacks).

The shown queries are all the same and the complete version of it:

SELECT
    `main_table`.*, `tdv`.`value` AS `default_value`, `tsv`.`value` AS `store_default_value`, IF(tsv.value_id > 0, tsv.value, tdv.value) AS `value`
FROM
    `eav_attribute_option` AS `main_table`
INNER JOIN
    `eav_attribute_option_value` AS `tdv`
ON
    tdv.option_id = main_table.option_id
LEFT JOIN
    `eav_attribute_option_value` AS `tsv`
ON
    tsv.option_id = main_table.option_id AND tsv.store_id = '1'
WHERE
    (tdv.store_id = 0)
ORDER BY
    main_table.sort_order ASC, value ASC

When I run this query I get 11000 records! All attribute option values. The webshop does have a lot of attribute option values, but why get all these instead of getting the ones needed? For example the attributes.phtml file, this one renders on this product page just 6 attributes. As you can see, the query runs 6 times! It looks like it's getting everything (the collection, correct me if I'm wrong) and filters afterwards.

Is this a bug in Magento or something I can fix easily?


texts: Magento2: Cart with discount code higher then the amount in cart shows -€ NaN,N as grand total

texts:
We added 1 product to cart with the price of 10.99
Tax applied is 5.99
when applied a discount code of 50 euro
the grand total incl tax = € NaN,N

Can anyone suggest what could be the issue?


texts: cron Scheduler requests remains in pending , eventually site crashed why?

texts:
Our a magento 2.2 site usually goes down for about 3 to 4 minutes after within every 4 or 5 hours, than goes up when cron scheduler finishes it job.
In this database...
select count(status) from cron_schedule where status='pending'

...there are just over a thousand status pending records, the requests we are getting from our store server for pricing updates of products.
Following is the error comes on screen when site is down during execution of cron_scheduler .

Reason: Connection Timeout
Reason: HTTP 503 - Service Unavailable

Can anyone please assist us why it's happening and what will be best permanent solution of it, because right now we are using temporary solution by doing so...
 delete from cron_schedule where scheduled_at < date_sub(now(), interval 1 hour);

Thanks


texts: Can't install Magento 2 via composer on Windows 10

texts:
I try to install magento 2 via composer.

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition .

But I get "out of memory". I have 16 GB RAM.

So I restarted windows and tried again directly after restart without any programs open, but it still throws this error.

  Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried
  to allocate 64 bytes) in
  phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Rule2Literals.php
  on line 53

  Check
  https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
  for more info on how to handle out of memory errors.


texts: Magento Uncaught syntaxerror: unexpected token <

texts:
I have this function:

public function adminhtmlWidgetContainerHtmlBefore($event)
{
    $blockID = Mage::app()->getRequest()->getParam('id');
    $js = "<script type='text/javascript'>
                jQuery.ajax({
                        url: '".Mage::helper('adminhtml')->getUrl('adminhtml/index/generate/')."',
                        method: 'GET',
                        data: {FeedId : ".$blockID."}}).success(function(){
                            alert ('Generation Successful!');
                            }).error(function(){
                                alert ('Generation Failed!');
                });
        </script>";
    $block = $event->getBlock();
    $test= Mage::getModel('test/test')->getCollection();
    if($test)
    {
        foreach($test as $currentFeed)
        {
            if($blockID == $currentFeed->getData('id'))
            {
                $link = $currentFeed->getData('filename');
                $block->addButton('Download', array(
                    'label'     => Mage::helper('adminhtml')->__('Download'),
                    'onclick'   => "window.open('http://test.com".$link."', '_blank', 'Download')"
                ), -1);
                $block->addButton('Generate', array(
                    'label'     => Mage::helper('adminhtml')->__('Generate Feed'),
                    'onclick'   => $js,
                    'class'     => 'go'
                ), -1);
            }
        }
    }
}

And I am getting an error when I try to click the Generate button, the error is:

  (index):646 Uncaught SyntaxError: Unexpected token <

And I am not sure why, the problem is with my $js value, but it seems correct, what could actually cause this error? I know it is something simple but I can not figure it out.

Thank you.


texts: Reduce Shipping Cost if Cart is over $100

texts:
I want to offer the customer (if they spend over $100):

Free standard shipping
Express shipping, but instead of the normal $11, bring the price down to $5

How can I do the second part?


texts: Paypal Express Checkout integration issue

texts:
I have a Magento 2.3.4 site, and i'm having some problems with paypal.
Some customers say they can't place an order, when they try to pay they see a generic error. Tried it my self, it seems to me that is a 10410 invalid token error.
I've the case of one customer that was able to place the order, the money where taken from his account, but we have not received them.
I honestly have no idea what's going on, here's some ideas or info.
I've imported some customers from an older M1 site, it seems to me that the error occurs when you place an order with your imported address.
I've installed a module that add some informations to the address
Currently my paypal is connected to two magento sites on two separates domains, one is for test and the other one is live.
I really hope you can help me out, i've already contacted paypal, but they say the issue is with magento.


texts: How does Magento2 handle compare products for Guest Users?

texts:
Magneto2 I would like to know how does Magento handles compare products for Guest User.
I am creating a Rest API to add the product to compare products. But for Guest User how am I suppose to restrict user to add same product to compare if product already exists?