texts: Magento 2: How to use constructor injection in Contoller

texts:
I've following controller code which is working fine using object manager. How I can use constructor injection instead of object manager for this ?

namespace Amit\Qr\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
/** @var \Magento\Framework\View\Result\PageFactory  */

    protected $resultPageFactory;
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory

    ) {
        $this->resultPageFactory = $resultPageFactory;

        parent::__construct($context);
    }

    public function execute()
    {
        $orderId = $this->getRequest()->getParam('order_id');
        $order = $this->_objectManager->create('Magento\Sales\Model\Order');
        $order->load($orderId);
        $customerId = $order->getCustomerId();
        echo $customerId;
        //.....
   }
}


texts: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row?

texts:
When i have upload image from backend  and save it but this image not saved bellow error display.

  SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
  update a child row: a foreign key constraint fails
  (bisquehaus_db6.catalog_product_entity_media_gallery_value_to_entity,
  CONSTRAINT FK_A6C6C8FAA386736921D3A7C4B50B1185 FOREIGN KEY
  (value_id) REFERENCES catalog_product_entity_media_gall), query
  was: INSERT INTO
  catalog_product_entity_media_gallery_value_to_entity
  (value_id,entity_id) VALUES (?, ?) ON DUPLICATE KEY UPDATE
  value_id= VALUES(value_id),entity_id= VALUES(entity_id`)

screenshot

How to solve it? Please help me?


texts: Magento 2.4 Best way setup with Docker environment

texts: What is the best way to Configure Docker environment with Magento 2.4. If some know please give me a solution.


texts: How to use bin/magento config:set for obscure / encrypted values

texts: How can I use the magento CLI to set an encrypted value to a custom path that was added by a module? At the moment it seems that the CLI will add it as plain text even though the field is defined to have a type of "obscure".


texts:
I need to override Varien class because I need to change one method.

app/code/core/Varien/Data/Collection/Db.php

From what I know, the only way is to put it inside local folder.

app/code/local/Varien/Data/Collection/Db.php

But in this way I override entire class. Is there any way to override just single method?


texts: Filter collection with attribute from custom module

texts:
I have a custom module which I load data with following code inside list.phtml:

foreach ($_productCollection as $_product){
$_id = $_product->getId();
$event = Mage::getModel('aw_eventbooking/event');
$event = $event->loadByProductId($_id);
$eventStartDate = $event->getEventStartDate();
}

I want to create a way to filter products based on event start date, I modified List.php on Mage_Catalog_Block_Product_List to do something like this:

$now = new DateTime();
$now = $now->format('Y-m-d H:i:s');
$strnow = strtotime($now);

$this->_productCollection = $layer->getProductCollection();
$this->_productCollection
            ->getSelect()
            ->where('ATTRIBUTE START DATE > $now');
}

The problem is, how can I get the "ATTRIBUTE START DATE", the $event->getEventStartDate(); to make the filter possible? Please help, I am new to magento

I want something like this:

$eventcollection=$this->getLoadedProductCollection();
    $eventcollection = $eventcollection
    ->getSelect()
    ->where('$event->getEventStartDate() > $strnow');

Is this somehow possible?


texts: Magento 2.3 Modify pagination limit in admin for all (Custom options)

texts: I want to modify Customizable options pagination. Currently on 1 page by default we can see 20 options and the 21st will be on next page i.e. page 2. I need to see 100 options on page 1 & 101 on page 2. Any help will be appreciable.


texts: How to get current cart items for logged in user

texts:
Following is my code:-

 try
        {
          $store = $this->_getStore();
          Mage::app()->setCurrentStore($store->getId());
          $customer_ID = 3;
          $customer = Mage::getModel('customer/customer')->load($customer_ID);

          // load quote by customer
          $quote = Mage::getModel('sales/quote')->loadByCustomer($customer_ID);

          $quote->assignCustomer($customer);
          $product = Mage::getModel('catalog/product')
                     // set the current store ID
                     ->setStoreId(Mage::app()->getStore()->getId())
                     // load the product object
                     ->load(3);

           // Add Product to Quote
           $quote->addProduct($product,1);

           // Calculate the new Cart total and Save Quote
           $quote->collectTotals()->save();

           return json_encode(array("", $quote->getId()));

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

Using this the product is getting added in cart successfully and returning quote_id, but using this id i want to fetch current cart items details for currently logged in user.


texts: How To Add Custom Attribute To Transaction Email?

texts:
I have added an custom attribute to products. i want to show this attribute in order transaction email.

Is there a way to do this?

Thanks.


texts: Mass change product URL keys to match product names

texts:
Shopkeeper created configurable products by duplicating existing products and did not change the product URLs to match the product names. The shop is also a multilingual shop and different languages are made as store views.

This all lead to situation where the duplicated products had wrong url keys.

I found this code that could be added to a new .php file and run on the server and that was a solution for ONE store view:

<?php
require 'app/Mage.php';
Mage::app();
$amount = 0;
$model = Mage::getModel('catalog/product');
$products = $model->getCollection();
foreach ($products as $product) {
    $model->load($product->getId());
    $product->setUrlKey($model->getName())->save();
    set_time_limit();
    $amount++;
}

That code changed the product url keys to match the product names, but it only worked for one store view.

My question is: how do I change the product url keys for the other store views in other languages?

UPDATE!
The solution was easy: in the frontend just change to the next store view and run the new .php file in that view also.


texts: No Hyphens in SKU Built from Custom Options

texts: I'd like to prevent hyphens being used when Magento builds SKU's from a product's selected custom options. Does anyone know where this happens in core, and how to override it?


texts: Bundled Items not going out of stock when a component is out of stock

texts:
What needs to be set for a bundle product to go out of stock if one of it's components goes out of stock?

Right now I have a bundle product with manage stock set to yes. Ship together. Input type multiple select, required checked.

Three products, qty 1 all have default checked.

If one of those three products goes out of stock, the bundle remains in stock and can be purchased not including the out of stock product. How can I change this to where if one product is out of stock, the entire bundle is marked as out of stock?

Magento 2.2.5


texts: Add custom section on order create backend Magento1.9

texts: I want to add custom section when admin order create..


texts:
I've got a module which works fine, however I need a different frontName for each store.

The stores are 'english' and 'french', and as such, the frontName should be translated for each.

I've tried a couple of things in config XML, namely:

<?xml version="1.0"?>
  <config>
     <modules>
        <Lw_Listbundles>
          <version>1.0.0</version>
        </Lw_Listbundles>
     </modules>
     <frontend>
       <routers>
          <listbundles>
              <use>standard</use>
              <args>
                 <module>Lw_Listbundles</module>
                 <frontName>bundles</frontName>
              </args>
           </listbundles>
          <listbundles>
              <use>standard</use>
              <args>
                 <module>Lw_Listbundles</module>
                 <frontName>agencements</frontName>
              </args>
           </listbundles>
       </routers>
    <layout>
        <updates>
            <listbundles>
                <file>listbundles.xml</file>
            </listbundles>
        </updates>
    </layout>
    </frontend>
    <global>
        <blocks>
            <listbundles>
                <class>Lw_Listbundles_Block</class>
            </listbundles>
        </blocks>
    </global>

</config>

and

<?xml version="1.0"?>
  <config>
     <modules>
        <Lw_Listbundles>
          <version>1.0.0</version>
        </Lw_Listbundles>
     </modules>
     <frontend>
       <routers>
          <listbundles>
              <use>standard</use>
              <args>
                 <module>Lw_Listbundles</module>
                 <frontName>bundles</frontName>
              </args>
           </listbundles>
       </routers>
    <layout>
        <updates>
            <listbundles>
                <file>listbundles.xml</file>
            </listbundles>
        </updates>
    </layout>
    </frontend>
    <global>
        <blocks>
            <listbundles>
                <class>Lw_Listbundles_Block</class>
            </listbundles>
        </blocks>
    </global>

    <stores>
        <french>
          <frontend>
              <routers>
              <listbundles>
                  <use>standard</use>
                  <args>
                     <module>Lw_Listbundles</module>
                     <frontName>agencements</frontName>
                  </args>
               </listbundles>

              </routers>
          </frontend>
        </french>
    </stores>

</config>

But I'm not getting much luck - I don't mind too much if both frontNames are available on both stores, but I do need both frontNames on way or another!

Any advice would be appreciated!


texts: Issue with Price Rules for shopping cart

texts:
Hi I am running two magento websites, different installs on different servers with different themes. Magento version is same for both and that is 1.7.0.2. The problem I am facing is, different price rules options in Conditions in Promotions -> Shopping Cart Price Rules . In one of the sites,  there are a lot of options(in select field) in Conditions for Product Attribute like Attribute set, Category, SKU, Color,  model, price,  special price, visibility, url and lot more. But in other site there are only two options there for Product attribute, and those are Attribute set and Category.

I changed other options like discount action etc but there remains only two options. I do not know whether its any other 3rd party extension(have different extensions in both sites) which are responsible or is there any other configuration options for this somewhere else in Magento.

Any type of help regarding this would be highly appreciated, Thanks in advance.


texts:
We are using Magento's built in messaging system to show some messages to the user. However its not appearing properly in the front-end. When i checked the html using the firbug its appearing as follows:

Please upload a CSV file with required details!

I'm using following code to add messages,

Mage::getSingleton('core/session')->addError($this->__('Please upload a CSV file with required details!'));

Its only happening in one page and in rest of the pages the message appears properly. What might be the possible reasons for this issue. Can any one help me?


texts: How to show product custom attribute in sales item ordered section in admin for bundle product and configurable product in Magento2.2.0?

texts:
I want to show product custom attribute in sales item ordered section in admin for Bundle product and Configurable product in Magento2.2.0?
Refer my screenshot.


texts: Facing php version related issue with magento extension

texts:
I am facing an issue with $this in a code of extension. Looks like PHP version issue. In one server all working fine and in another server it is not working & giving error like this :-

Fatal error: Uncaught Error: Using $this when not in object context in filename.php on line no. 12

The code on line no.12 is :

if (!$this->getConditions())
{
    return true;
}

If I comment this code then error comes on another line where there is $this.

The server where everything is working fine, it's PHP version is : 5.3
The server where error is coming, it's PHP version is : 7.0

I guess this PHP version may be the issue but can anyone please tell the solution for this? or there is no way except changing the PHP version?

EDIT: scope:

class Namespace_Module_Model_SalesRule_Rule_Condition_Product_Combine
    extends Mage_SalesRule_Model_Rule_Condition_Product_Combine
{
    public function validate(Varien_Object $object)
    {
        if (!$this->getConditions()) {
            return true;
        }

        // ..... other code....

    }
}


texts: Magento 2: How to add custom attribute in an admin field?

texts:
I created a new field using the file system.xml, but I need to add a custom attribute, for example, data-mycustomattr="true".

You can see an example on this image below, the console shows a custom attribute in the field Store Name.

How could I do that?

Thanks!


texts: Is There A Way To Make A Shipping Method Only Available In The Backend?

texts:
I need to add a shipping method to my site that is only allowed to be used by the Sales staff. (A customer gets free shipping for orders, but has to be charged for return shipping after repairs)

I've got a spare Flat Rate I could use, but I don't want it to be able on the front end. I only want it to show as a Shipping Option during a MOTO order.
Is there a way of doing this?


texts: In Magento 2 how to unserialized the array to get a data?


texts: how to add 6% tax on four product based on there product id

texts: how to add tax 6% on 4 product using there product id and where to write these code i am new in Magento ver. 1.9.0.0 please  help me. product id is 301,504,709,935


texts: is it possible to change delivery depending upon product

texts:
I am trying to figure out if magento will provide me with all the functionality I need or if I have to write some code specifically. Naturally I'd like to keep the system as standard as possible. What I need to do is set the shop up with free delivery unless specific items have been ordered alone. So for example if we have two items in the shop:

Item A - 50p cost and is 50p to deliver on it's own otherwise no extra fee with item B.
Item B - £4.50 cost and is 50p to deliver

Now in the shop I will mark item B as £5 with free delivery. What I would like is to sell item A at 50p and then this happens.

Item A and Item B in cart = free delivery.
Item A in cart alone = 50p delivery.

Is there a way of doing this or will I have to use something like Checkout_Cart_Save_Before and alter it myself?


texts: Magento 2.3: main.ERROR: Unable to resolve the source file issue

texts:
I am getting below error when I ran php bin/magento setup:static-content:deploy -f cmd.
frontend/Alothemes/digitalstore3/en_US  2494/2645           ==========================>- 94%    5 secs
Compilation from source /var/www/mag2/app/design/frontend/Alothemes/digitalstore1/web/images/flags/german.jpg failed
Magento\Framework\View\Asset\File\NotFoundException: Unable to resolve the source file for 'frontend/Alothemes/digitalstore3/en_US/images/flags/german.jpg' in /var/www/mag2/vendor/magento/framework/View/Asset/File.php:160
Stack trace:
#0 /var/www/mag2/vendor/magento/framework/App/View/Asset/Publisher.php(74): Magento\Framework\View\Asset\File->getSourceFile()
#1 /var/www/mag2/vendor/magento/framework/App/View/Asset/Publisher.php(62): Magento\Framework\App\View\Asset\Publisher->publishAsset(Object(Magento\Framework\View\Asset\File))
#2 /var/www/mag2/vendor/magento/module-deploy/Service/DeployStaticFile.php(89): Magento\Framework\App\View\Asset\Publisher->publish(Object(Magento\Framework\View\Asset\File))
#3 /var/www/mag2/vendor/magento/module-deploy/Service/DeployPackage.php(189): Magento\Deploy\Service\DeployStaticFile->deployFile('images/flags/ge...', Array)
#4 /var/www/mag2/vendor/magento/module-deploy/Service/DeployPackage.php(133): Magento\Deploy\Service\DeployPackage->processFile(Object(Magento\Deploy\Package\PackageFile), Object(Magento\Deploy\Package\Package))
#5 /var/www/mag2/vendor/magento/module-deploy/Service/DeployPackage.php(102): Magento\Deploy\Service\DeployPackage->deployEmulated(Object(Magento\Deploy\Package\Package), Array, false)
#6 [internal function]: Magento\Deploy\Service\DeployPackage->Magento\Deploy\Service\{closure}()
#7 /var/www/mag2/vendor/magento/framework/App/State.php(187): call_user_func_array(Object(Closure), Array)
#8 /var/www/mag2/generated/code/Magento/Framework/App/State/Interceptor.php(89): Magento\Framework\App\State->emulateAreaCode('frontend', Object(Closure), Array)

I am using a third party theme for my store which is https://themeforest.net/item/digitalstore-responsive-magento-1-2-theme/19685939.
I have no idea, How can I resolve this error.
Magento ver. : 2.3.5-p1
Any help?


texts: Add Taxvat field to magento 2 checkout page

texts:
I'm from Brazil, and here we use the "taxvat" customer field to store a number called "CPF". I managed to make the field appear on checkout by adding it to an layoutProcessor, like this:

      $shippingFields['taxvat'] = [
        'component' => 'Magento_Ui/js/form/element/abstract',
        'label' => __('CPF'),
        'config' => [
            'customScope' => 'shippingAddress',
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/input',
        ],
        'placeholder' => 'CPF *',
        'validation' => [
            'required-entry' => 1
        ],
        'provider' => 'checkoutProvider',
        'source' => 'customer.taxvat',
        'dataScope' => 'customer.taxvat',
        'sortOrder' => 1,
    ];

But, i don't know why, this field it's not saving on database. It only works if i save this field on customer form, not on checkout form.

Anyone know what i'm missing?

i want to do that to enable guest checkout (but i need this field)

thanks!


texts: No css found and admin url not found on this server magento 2

texts:
I have added my project on a virtual machine amazon and when I try to get my FO I have no CSS and when I click on any link example category I get an error

  The requested URL /Siteindex.php/customer/account/create/ was not
  found on this server.

and can't recuperate my admin URL not found on this server any help, please


texts: Can i add product in category page product collection?

texts:
Can I add a product in category page product collection?
I want to add product #123 in category page product collection but the same product already exists in the collection so it is possible?
My concern is
I want to repeat products on the category page multiple times. with pagination and filter working so any have an idea about this.  like


texts: All products have randomly jumbled catagories, is this a known issue is 1.7.0.2?

texts: For some reason most of our products have seemed to changed categories in random ways. Is there any known issue of products changing catagories randomly?


texts:
I am placing some new products inside a magento installation.
The site is not developed by me, but I have to fix this problem.

I inserted a new product, and in the frontend I have this error on the url of the product:

  Fatal error: Cannot redeclare class YT_BasicMenu in
  /home/yutucano/public_html/imac/app/design/frontend/default/sm_meline/template/catalog/navigation/top.phtml
  on line 0

Some days ago i had the same problem but the problem disappeared, don't know how.


texts: Incorrect dependency in class & \Magento\Framework\View\Asset\Repository already exists error in context object How to solve it?

texts:
<?php

namespace Identixweb\Requestquote\Block\Requestquote;
use Identixweb\Requestquote\Block\BaseBlock;
class Quote extends \Magento\Framework\View\Element\Template
{
    protected $_quoteCollectionFactory;
    protected $_assetRepo;

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Identixweb\Requestquote\Model\ResourceModel\Quote\CollectionFactory $quoteCollectionFactory,
        \Magento\Framework\View\Asset\Repository $assetRepo,
        array $data = []
    )
    {
        $this->_quoteCollectionFactory = $quoteCollectionFactory;
        $this->_assetRepo = $assetRepo;
        parent::__construct($context, $data);
    }

    public function getRequestCollection(){
       $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
       $customerSession = $objectManager->get('Magento\Customer\Model\Session');
      if($customerSession->isLoggedIn()) {
        $customerId = $customerSession->getCustomer()->getId();
        $collection = $this->_quoteCollectionFactory->create();
        $collection->addFieldToSelect('*');
        $collection->addFieldToFilter('user_id',$customerId);
        $collection->setOrder('id', 'DESC');
        return $collection;
     }
   }

}


texts: Magento 2 : How to Use County and Region dropdown in custom module

texts:
I have a simple question about handling Country and Region dropdowns in admin form.
Do I need to create two EAV attributes for region and region_id and put dropdown value in region_id and custom region value in region field.
Can't I use the same attribute, some how.
Is there a good tutorial which handles the scenario.


texts: Magento 2: How to get sub category and their products in collection?

texts:
I want to get the categories and related products in collection using parent category ID. So that i can show the grid like

sub category 1

sub category 1's product 1
sub category 1's product 2
sub category 1's product 3

sub category 2

sub category 2's product 1
sub category 2's product 2
sub category 2's product 3

and so on. I can get the products in foreach but I need to add pagination also.


texts:
I should get file (image) in

  magento2/pub/media/vendor_name/....

How can i do this? Thanks


texts: Number of results returned in search, pagination not working

texts:
Regardless of the setting for number of results per page.

I'm getting all results returned (they are all correct matching results).

This becomes a problem with categories or searches which have hundreds or thousands of results, and the page sometimes never loads.

You can see an example here, 1 per page selected, but 21 results showing:

I have configured the defaults in the admin console, and I've also tried to configure it in local.xml but the settings don't seem to be honored,i'm always getting all results returned.

It also doesn't matter whether I use Magento's built in database search, Solr, or ElasticSearch, the same problem exits which suggests to me that something before it gets as far as asking for results is failing to paginate.

Any ideas?


texts: Magento 2: No options under store: configuration -> general -> general

texts:
best regard.

I am new in the word of Magento 2,i was made the installation of Magento 2.1 and 2.2 with PHP 7.0.x in XAMPP , then of right installation when i try to change the language at store->configuration->General->General  Magento not show the information in general(i can not see the tags for the configuration  how to a manual and diferents tutorials).

please how can i fix this problem

thanks


texts: Magento 2 How to add all country regions in database?

texts:
I checked directory_country_region in the database there is no region of the United Kingdom, I need all region of United Kingdom.

Is Magento provide the sheet of all country regions or from where I can add them?

Please help me.


texts:
Invalid 'X-Frame-Options' header encountered when loading '': '*' is not a recognized directive. The header will be ignored.
Refused to load the font '' because it violates the following Content Security Policy directive: "font-src 'self' 'unsafe-inline'".
in chrome browser only


texts: How to create Single abstract controller to inherit in other controllers

texts: I would like to create a single abstract controller in which i will define my authorization code to check for user validity and want to inherit that controller in my other controllers, so that i don't need to write the same authentication code on every other controller.


texts: magento routing not works when i enabled 'Add Store Code to Urls' in admin

texts:
when i change   Add Store Code to Urls  to  yes at

system > web > url options in admin panel,

all the routing to my controller is not works. returns 404 error page. how to resolve this?


texts: Setting up grunt to work with Magento 2.1?

texts:
I am following this devdoc to get grunt working in Magento 2.1: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/css-topics/css_debug.html

I followed all of the steps and tried to run grunt exec on the blank theme, but got an error as seen below.

Running "exec:blank" (exec) task
Running "clean:blank" (clean) task
>> 0 paths cleaned.

Done, without errors.

Execution Time (2017-05-18 08:54:02 UTC-5)
loading tasks  829ms  ██████████████████████████████████████████████ 97%
clean:blank     18ms  █ 2%
Total 853ms

>> 'php' is not recognized as an internal or external command,
>> operable program or batch file.
>> Exited with code: 1.
Warning: Task "exec:blank" failed. Use --force to continue.

Aborted due to warnings.

Do I need to run grunt from a different place? I am using docker to run my local magento environment, so php is being run on its own docker container.

Has anyone else run into this issue?


texts: How to fix images for some products not resizing?

texts:
For some reason, the image gallery for certain products isn't resizing its main image, but other products are doing it fine. Here's an example of a product that isn't working. Here's an example of one that is. As you can see, the images themselves are the same size, but one is being sized to ~800px, and the other to ~300px. Both have inline styling, but I can't figure out where this styling is coming from.

It's just using the default Fotorama Slider. I've attempted to add various maxwidth, max-width, maxheight, and max-height attributes to various places:

x-magento-init block in app/design/frontend/<theme>/Magento_Catalog/templates/product/view/gallery.phtml
vendor/magento/theme-frontend-luma/etc/view.xml
vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml

No dice - I can get changes to appear on the frontend, but nothing I do fixes the image sizes.


texts: add a custom attributes to Payment method in order invoice detail page

texts: Want to display custom attribute in payment method section of sales order invoice view


texts: product export error : Unsupported operand type

texts:
How can I solve this :

  Unsupported operand types in
  C:\wamp\www\abc\app\code\core\Mage\ImportExport\Model\Export\Entity\Product.php
  on line 875

It occurs when trying to export products via the admin panel system -> import/export menu.


texts: How to Validate Special Characters in Magento 2 Validation Mixin

texts:
I want to validate special characters in a custom validation mixin file (validation-mixin.js)

When I am using this validation mixin for my input field, i.e. a Purchase Order Number in checkout, it shows an error message every time, even though I am using only alphanumeric.

  I want for the text field to ONLY accept special characters like
  @#$&*()_-{}[]:";',.  along with alphanumeric values and white spaces.

Below is my code for validation-mixin.js

define([
    'jquery'
], function ($) {
    "use strict";

    return function () {
        $.validator.addMethod(
            'validate-ponumber-custom',
            function (value) {
                //alert("Data >>> "  +  value);
                // Some custom validation stuff here
                // return utils.isEmptyNoTrim(value) || /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(value);
                // return !/p(\s|.){0,2}?o(\s|.){0,2}?.*box|post(\s|.){0,2}?office/i.test(value);
                //return $.mage.isEmptyNoTrim(value) || value.match(/^[0-9 \.-]+$/);
                // return $.mage.isEmptyNoTrim(value) || value.match(/^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/);
                // return $.mage.isEmptyNoTrim(value) || value.match(/^[a-zA-Z0-9!@#$&()`.+,/"-_:;']*$/);
                // return $.mage.isEmptyNoTrim(value) || value.match(/^[a-zA-Z0-9!@#$&()\`.+,/"-]*$/);
                //return $.mage.isEmptyNoTrim(value) || value.match(/^[a-z]+[a-z0-9_]+$/);
                return $.mage.isEmptyNoTrim(value) || /^[a-zA-Z0-9 ]+$/.test(value);
            },
            $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9), spaces, "#", "$", "&", "(", ")", "-", "_", ":", ";", """, "\'", ",", ".", in this field. Custom >> ')
        );
    }
});

Please let me know which Regular Expression should be used here.

Thanks in advance.


texts: Save Config Button Not work in payment methods

texts:
I was trying to add a new payment method klarna. I configured klarna
  in a proper way and I couldn't save it.

  Further try to some other changes in
  stores->setting->configuration->sales->payement method  But nothing
  gets saved.

  It takes me to the top of the page. Can anyone say why it occurs like
  this and need a solution for it. thanks in advance.


texts: Limiting the number of products in wishlist — Magento 2.2

texts:
In Magento 2.2, is there any possible way, through the admin panel, or through the custom theme that we can limit the number of each wish-listed product to 1?

To be more clear; so when the "add to wishlist" button is clicked multiple times, the item will be added to wishlist multiple times, is there any way to "not" allow each individual item being added to wishlist more than once?

Please let me know if it is not yet clear so I provide more description.
Any help is greatly appreciated.


texts: Serving a different product page for certain products with router

texts:
I've developed a module that sends some product pages to a product customization wizard. I've used getProductUrl() to change the links to point to the customization URL.

http://mywebsite.com/designer/?id=417&size=21

I now want to use the original URL, but serve up the content of the new URL.

http://mywebsite.com/custom-rectangle-name-tag-1-5-x-3-5

I want this only to happen for products that use my customization module. The logic for this already exists in getProductUrl(). My question is where can I put this logic?

I've tried to send the product route to my module. I've put the route for products in my config.xml as is. This doesn't reroute it, nor would I expect it to. (extraneous information left out).

<config>
    <frontend>
        <routers>
            <catalog>
                <use>standard</use>
                <args>
                    <module>Mage_Catalog</module>
                    <frontName>catalog</frontName>
                </args>
            </catalog>
        </routers>
        <default>
            <router>catalog</router>
        </default>
    </frontend>
</config>

I've put in the controller I've wished to use, but it serves a 404.

        <routers>
            <catalog>
                <use>standard</use>
                <args>
                    <module>HSC_PCE</module>
                    <frontName>pce</frontName>
                </args>
            </catalog>
        </routers>

I've also tried putting it inside of my namespace like so. It gives the original product page.

        <routers>
            <hsc_pce>
                <catalog>
                    <use>standard</use>
                    <args>
                        <module>HSC_PCE</module>
                        <frontName>designer</frontName>
                    </args>
                </catalog>
            </hsc_pce>
        </routers>

Even if this did work, if it wasn't a customization wizard product, how would I serve the original route?

How can I serve a different page to my customization wizard products?


texts:
I have removed reviews tab and placed the form in a popup modal.

Now I have displayed all the reviews posted by the customer about the particular product and I have displayed the Rating summary for the Product.

Now I need to get Rating for each customer and display in the following format  for each reviews in frontend.
Please Provide me a solution to add star rating for each reviews.

This is my collection class I have displayed in frontend like below

For reference

Block file

<?php

namespace XXX\YYY\Block;

use Magento\Framework\View\Element\Template;

class Collection extends Template
{

    protected $_coreRegistry;

    protected $_reviewsColFactory;

    protected $_reviewFactory;
    protected $_voteFactory;

    public function __construct(\Magento\Framework\View\Element\Template\Context $context,\Magento\Review\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Framework\Registry $registry, \Magento\Review\Model\ResourceModel\Review\CollectionFactory $collectionFactory, array $data = [])
    {
        $this->_coreRegistry = $registry;
        $this->_reviewsColFactory = $collectionFactory;
        $this->_reviewFactory = $reviewFactory;
         $this->_voteFactory = $voteFactory;
        parent::__construct($context, $data);
    }

    public function getProductId()
    {

        $product = $this->_coreRegistry->registry('product');
        return $product ? $product->getId() : null;
    }

    public function getCollectionSize()
    {
        $collection = $this->_reviewsColFactory->create()->addStoreFilter(
                        $this->_storeManager->getStore()->getId()
                )->addStatusFilter(
                        \Magento\Review\Model\Review::STATUS_APPROVED
                )->addEntityFilter(
                'product', $this->getProductId()
        );

        return $collection->getSize();
    }

    public function getAllreviews()
    {
        $collection = $this->_reviewsColFactory->create()->addStoreFilter(
                        $this->_storeManager->getStore()->getId()
                )->addStatusFilter(
                        \Magento\Review\Model\Review::STATUS_APPROVED
                )->addEntityFilter(
                'product', $this->getProductId()
        );

        return $collection;
    }

    public function getRatingSummary()
    {
        $product = $this->_coreRegistry->registry('product');
        $this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId());
        $ratingSummary = $product->getRatingSummary()->getRatingSummary();
        return $ratingSummary;
    }

}

abc.phtml

    <?php $reviews = $block->getAllreviews(); ?>

    <?= /* @escapeNotVerified */ __('Rating summary : ') ?><?php echo $rating = $block->getRatingSummary(); ?>

 <?= /* @escapeNotVerified */ __('Customer Reviews') ?>

        <?php foreach ($reviews as $review): ?>
            <?= /* @escapeNotVerified */ __('Customer Name : ') ?><?php echo $review->getNickname(); ?>

            <?= /* @escapeNotVerified */ __('Review : ') ?><?php echo $review->getDetail(); ?>

            <?= /* @escapeNotVerified */ __('Date : ') ?><?php echo $review->getCreatedAt(); ?>

        <?php endforeach; ?>


texts: Magento 2 - Display custom modules' Block before Add to Cart and after Short Description on Product Detail Page

texts:
Custom Module - layout/catalog_product_view.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="product.info.main">
                <block class="Einfochips\ConcreteMix\Block\Index" name="concretemix_index" template="Einfochips_ConcreteMix::concretemix_prod_detail.phtml"
                       after="product.info.price" before="product.info.addtocart" />
        </referenceContainer>
    </body>
</page>

Tried with above code but it is not working. Here I need to display my custom container before Add to Cart button and after product's short description


texts: Is there a way to add a class name to a category link

texts:
I have a menu on my Magento website generated from my categories.

For this menu I am using images. The problem is when I remove a category then the image for the links are not attach to the right link... Because the classes that I am using for CSS are numbered and not named.

So is there a way to add my own class for a category link?


texts: Buy one product, get one product half price

texts:
I'm trying to create a shopping cart price run whereby if you buy one of a product in one category, you get one of a product in another category at 50%.  I'm trying to also maintain a 1 to 1 ratio on the discount, eg:

If I buy 1 from category A I get 1 from category B at 50%

If I have 1 item from category A and 2 items from category B, only one item from category B gets the 50% discount, the other is at full price.

If I have 2 items from category A, 2 items from category B get 50% off additional items from category B are at full price.

I've set the following on the Actions tab:

Discount Amount 50

Maximum Qty Discount is Applied To 1

Discount Qty Step (Buy X) 1

Stop Further Rules Processing No

If any of these conditions are true, category is category B

As it runs now, if I put one item from category A all of category B get the 50% discount.  I'm stumped on this one...


texts:
I have done data migration using data migration tool from magento 1.9.x to 2.2.4, but it doesn't import admin users as mentioned in the docs, and we need to manually copy the admin users.

What I have done is, I have simply copied the users from magento1DB.admin_user to magento2DB.admin_user table. I can see that users are now appearing in the Magento2 backend, but when I try to edit any admin user, it throws an exception.

Exception #0 (InvalidArgumentException): Unable to unserialize value

Also, I cannot login with the Magento1 admin user in Magento2 admin panel.

Couldn't find any help, does any one have an idea?


texts: Injecting Variables into a Magento 2 CMS static block

texts:
Magento 1 Way :-

https://inchoo.net/magento/injecting-variables-into-a-magento-cms-static-block/

I need the same in Magento 2, how can I achieve? it's urgent.

Here is my afford:-

<?php

namespace Test\Clientform\Controller\Show;

use Magento\Framework\App\ObjectManager;

class Index extends \Magento\Framework\App\Action\Action
{
    protected $_filterProvider;
    protected $_storeManager;
    protected $_blockFactory;
    protected $_filterFactory;

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Cms\Model\Template\FilterProvider $filterProvider,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Cms\Model\BlockFactory $blockFactory,
        \Magento\Framework\Filter\Template $filterFactory,
        array $data = []
    )
    {
        parent::__construct($context, $data);
        $this->_filterProvider = $filterProvider;
        $this->_storeManager = $storeManager;
        $this->_blockFactory = $blockFactory;
        $this->_filterFactory = $filterFactory;
    }

    public function execute()
    {

        $blockId = 'client_intake_form';
        $html = '';
        if ($blockId) {
            $storeId = $this->_storeManager->getStore()->getId();
            /** @var \Magento\Cms\Model\Block $block */
            $block = $this->_blockFactory->create();
            $block->setStoreId($storeId)->load($blockId);

            $array['full_name'] = 'test';

             $this->_filterFactory->setVariables($array);
             // exit;
             //exit;
                $html = $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent());
        }
        echo   $html;

        // $resultPage = $this->_resultPageFactory->create();
        // return $resultPage;
    }

}

?>

When I'm hitting controller:-

http://127.0.0.1/Magento2/test/show/index

still not able to set value.

you can check here:-

http://nimb.ws/TEZVRp

To set value I've used  \Magento\Framework\Filter\Template $filterFactory,

& calling setVariables() method.

When I'm setting values directly in the core class:-

\Magento\Framework\Filter\Template $filterFactory

e.g-

public function setVariables(array $variables)
    {
        $variables['full_name'] = 'test'; // added this line staticaly
        foreach ($variables as $name => $value) {
            $this->templateVars[$name] = $value;
        }
        return $this;
    }

Then value gets set, you can check here:-

http://nimb.ws/ytvcRV

so please let me know why I'm not able to set value from the controller.


texts: How to redirect to a custom page after order is placed JS

texts: I want to be able to redirect to a custom page after the order is place so I can build a post request to a 3rd party payment gateway and send the customer to the payment gateway, similar to paypal flow.


texts: how to create custom contact form based on base contact form in magento

texts:
I am creating a order form i used default magento contact form add many extra fields also defined in admin but how can i link form with template in admin ?

because i want contact us form should stay same and order form should work separately.

Many thanks in advance


texts: Magento 2.2.2 to Magento 2.3.2 - setup:upgrade error

texts:
After being able to update magento to 2.3.2 Which is in current state when I try to run the command bin/magento setup:upgrade: get the below error

root@---:/var/www/html# bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
/var/www/html/generated/code/Composer
/var/www/html/generated/code/MSP
/var/www/html/generated/code/Magento
/var/www/html/generated/code/Mageplaza
/var/www/html/generated/code/Symfony
The directory '/var/www/html/generated/metadata/' doesn't exist - skipping cleanup
Updating modules:
Schema creation/updates:
**Cannot process definition to array for type enum**

anyone knows where this error comes from and how to solve it


texts: Looking for a Subscription model plugin or a logic to solve it custom

texts:
I am developing a website which sells subscriptions.

PROBLEM:

Actually the subscriptions are the products that I sell. Each Subscription has 8 different sub products (The actual physical product) within them. Eg: A 3 month science subscription has Science magazines within them, which will be shipped every month for 3 months. These magazines are not available without subscription.
How to go about from here.

Have a subscription plugin that can solve this? If so what is it?
Build it custom? Please give me good way points to achieve my goal

I am pretty new to magento.

WHAT I VE RESEARCHED:

I looked at AheadWorks subscription plugin. Does seem to be great but they treat physical objects as the product and subscription as an option. Also their payments are recurring. Eg. $1 per month for 3 months. I need $3 completely and buy the subscription. Almost few others treat it in a same way.

Help me out in what I must do.


texts: Magento2 can't translate this sentence with "+"

texts:
In the "file vendor/magento/module-ui/view/base/web/js/lib/validation/rules.js" in line 433 Magento2 can't translate this sentence.

But after remove "+" the translation is perfect.

How I can translate correct without rewrite "rules.js"?


texts: Direct object instantiation is discouraged in Magento 2

texts:
As per magento marketplace standards I just cannot instantiate object of class as below. I have checked with various files of core and found that magento itself uses new keyword to instantiate. The code check can be ignored by adding // @codingStandardsIgnoreStart and // @codingStandardsIgnoreEnd but wanted to know if we have any other way.

//Below is the class
OAuth\Common\Consumer\Credentials

//Below is the object
$foo_object = new Credentials($this->getconsumerId(),
                              $this->getconsumerSecret(),
                              $this->getcallbackUrl());


texts: How to configure Magento 2 in subfolder using NGINX

texts:
I install Magento in my root folder and it's ok, but when I install in my subfolder don't work.

How could I do it using a Magento 2 install?


texts: Magento 2.2.5 How to add the Datepicker in frontend(product view page)

texts: I'm using Magento 2.2.5. How to add the Datepicker in frontend(product view page).


texts: Magento2: Vat Validation on checkout page?

texts: How can i validate VAT number on checkout page how it is validated on backend when setting store vat number?


texts:
I have switched my platform to Magento for little over 6-7 months now, and I am having some issues with my configurable products ranking in Google.

Before switching to Magento, our products we're ranking top 2-3 in Google's 1'st page. Currently 50% of our products are ranking in the 2nd or 3rd pages in Google.

We did a lot of research we cleaned a lot of problems like - clean URLs, Meta Tag Titles, duplicate tags, and much more other bugs from our website, which helped. When searching in Google for our selected products it seems like the "simple products" are performing better then the "configurable products".

Can anyone suggest if this is a problem that they know about, and what can I do to fix this ?


texts:
Yesterday I messed something up on my Magento installation. A plugin destroyed the test environment, so I've decided to reïnstall the test environment.

I got the back-up database from our working live site, as well as the map structure.
Put everything in place in the local HtDocs folder and changed the database url's and the local.xms file to the appropriate parameters.

Everything seems to work, however when I go to the back-end and log in... it just refreshes and does nothing.

I have read a lot about restoring cookies and editing the varien file.
/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

However, this does not work.
So far I've tried:

changing the web/cookies url's in the database;
clearing the var/cache folder;
clearing the browser cookies and cache;
edit the varien.php file.

It doesn't seem to work, the front end works fine.


texts: Retrieve Product Attribute Label in event catalog_entity_attribute_save_before

texts:
How can I change the label associated with an attribute in the catalog_entity_attribute_save_before event?

When I say label, I mean the value set here:

Catalog -> Attributes -> Manage Attributes -> Click on an attribute -> Manage Labels / Options -> Manage Titles -> Admin

I have tried this in my observer, but $attribute->getLabel() returns NULL.

class NS1_ProductAttributeSpacesAndProperty_Model_Observer
{
    public function catalog_entity_attribute_save_before($observer)
    {
        $attribute = $observer->getEvent()->getAttribute();

        $entityTypeId = $attribute->getEntityTypeId();
        if($entityTypeId == 4)
        {
            // the attribute is a product attribute
            $label = $attribute->getLabel();
            echo gettype($label);exit; // prints NULL
            //$attribute->setLabel("Test");
        }
    }
}

Edit:

I have managed to retrieve the label with $attribute->getFrontendLabel(), but I am still unable to update the attribute label before it saves.


texts: Magento 2.3.1 Getting Incompatible argument type error

texts:
I'm getting the following error: Incompatible argument type: Required type: \Magento\Framework\Data\Helper\PostHelper. Actual type: array.

I have tried changing the parent constructor, but I'm still getting the same error.

I also tried extending:

extends \Magento\Framework\View\Element\Template implements \Magento\Widget\Block\BlockInterface

still, getting the same error.

posting the relevant part of my code:

class ProductList extends \Magento\Catalog\Block\Product\ListProduct
{
    protected $_logger;
    protected $_searchCriteriaBuilder;
    protected $_productRepository;
    protected $_categoryRepository;
    protected $_storeManager;
    protected $_categoryFactory;
    protected $_filterBuilder;

    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
        \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
        \Magento\Framework\Api\FilterBuilder $filterBuilder,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
        \Magefan\Blog\Model\CategoryFactory $categoryFactory,
        \Magento\Framework\Url\Helper\Data $urlHelper,
        \Psr\Log\LoggerInterface $logger,
        array $data = []
    )
    {
        $this->_logger = $logger;
        $this->_productRepository = $productRepository;
        $this->_filterBuilder = $filterBuilder;
        $this->_storeManager = $storeManager;
        $this->_searchCriteriaBuilder = $searchCriteriaBuilder;
        $this->_categoryRepository = $categoryRepository;
        $this->_categoryFactory = $categoryFactory;
    //    parent::_construct();
    //    parent::__construct($context, $data);
        parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data);
    }

Can anyone please assist?


texts: Magento 2: How to insert a block before the date product options

texts:
I'm trying to add a custom template before the date element. Here is the code in catalog_product_view.xml on my custom theme.

    <referenceBlock name="product.info.options">
        <block class="Magento\Catalog\Block\Product\View"
  name="custom.text" as="customtext" template="Vendor_Catalog::customtext.phtml" before="product.info.options.date"/>
    </referenceBlock>

and these codes are from the Magento catalog_product_view.xml.

<block class="Magento\Catalog\Block\Product\View" name="product.info" template="Magento_Catalog::product/view/form.phtml" after="alert.urls">
                    <container name="product.info.form.content" as="product_info_form_content">
                        <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="addtocart" template="Magento_Catalog::product/view/addtocart.phtml"/>
                    </container>
                    <block class="Magento\Framework\View\Element\Template" name="product.info.form.options" as="options_container">
                        <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="Magento_Catalog::product/view/options/wrapper.phtml">
                            <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="Magento_Catalog::product/view/options.phtml">
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" name="product.info.options.default" as="default" template="Magento_Catalog::product/view/options/type/default.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\Text" name="product.info.options.text" as="text" template="Magento_Catalog::product/view/options/type/text.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\File" name="product.info.options.file" as="file" template="Magento_Catalog::product/view/options/type/file.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" name="product.info.options.select" as="select" template="Magento_Catalog::product/view/options/type/select.phtml"/>
                                <block class="Magento\Catalog\Block\Product\View\Options\Type\Date" name="product.info.options.date" as="date" template="Magento_Catalog::product/view/options/type/date.phtml"/>
                            </block>
                            <block class="Magento\Framework\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/>
                        </block>
                        <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="Magento_Catalog::product/view/options/wrapper/bottom.phtml">
                            <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.additional" as="product.info.addtocart" template="Magento_Catalog::product/view/addtocart.phtml"/>
                        </block>
                    </block>
                </block>

custom text and the template not showing.

what's wrong the in code?


texts: Best way to upgrade Magento 1.6.2.0 to 1.9.0.1

texts:
I'm having a live site running Magento 1.6.2.0. Besides having customized template, I also have installed 3rd party modules.

As time goes by I thought it would be wise to upgrade the system, as well as changing the theme from normal to responsive.

Currently my site is running on a cloud hosting server (aka VPN), therefore I can run more than 1 magento in the account.

There are 2 known methods:

Upgrade via Magento Connect
Fresh install

Any one knows which method is best practice? If fresh install is needed, any idea what are the steps required? Thanks!

Oops, meanwhile which is better? 1.8.1.0 or 1.9.0.1?


texts: Magento2 fetch value from catalog_compare_item table

texts: Magento2 How can I get the value of following table 'catalog_compare_item' using a model or any other proper way of Magento?


texts: Remove items from order items using SQL query Magento 1

texts:
Is there any way we can remove some items/ some SKU's from order items for multiple orders using MySQL query in Magento 1 in a script?
Feel free to share thoughts on this.


texts: How to remove product info/collateral box from the product page with Layout XML

texts:
I'm trying to remove the product info/collateral box from the product page.  I've tried using the below methods without success:

<layout>
    <catalog_product_view>
        <reference name="product.info">

            <action method="unsetChild"><name>product.info.tabs</name></action>
        </reference>
    </catalog_product_view>
</layout>

I'm using the <reference name="product.info"> as it is used in the parent theme's.

<reference name="product.info">

    <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml">

Im able to remove the product info/collateral box by just commenting the below section of code out of the catalog/product/view.phtml template, but this not seem to be the best practice.

    <?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
        <div class="box-collateral <?php echo "box-{$alias}"?>">
            <?php if ($title = $this->getChildData($alias, 'title')):?>

<?php echo $this->escapeHtml($title); ?>

            <?php endif;?>
            <?php echo $html; ?>

    <?php endforeach;?>
        <?php echo $this->getChildHtml('upsell_products') ?>
        <?php echo $this->getChildHtml('product_additional_data') ?>

Is there a way I can remove this with Layout XML?


texts: Would like to display grouped products in a table layout, but also with a price / quantity discount visible

texts:
My questions refers to CE.  I'm putting a new store together and I would like to display grouped products in a table layout, but also with a price / quantity discount visible.

As an example of what I'm trying to achieve, please see here: http://www.allpacksolutions.co.uk/product.php?xProd=110&xSec=11

I'm no expert in Magento, I'm pretty new to it to be fair, so I thought I'd ask on here as I'm sure someone will be able to point me in the right direction.

P.S. I'm only assuming here that (based on the example link given) grouped products is the way to go in terms of the type of products to display in this manner?  Configurable products are just for dropdown options correct?  I have however seen examples of extensions that combine these two elements and present them in one table.  So perhaps I'm after something like that, but with a few modifications.


texts: M2.2.3 : How can I create a Category Attribute in the global scope?

texts:
I'm trying to create a global scoped category attribute, but it always seem to be scoped on store-level. I've got this:

$categorySetup->addAttribute(
    $categorySetup->getEntityTypeId(Category::ENTITY),
    CategoryMetaInterface::CATEGORY_CODE,
    [
        'type' => 'varchar',
        'label' => 'Category Code',
        'input' => 'text',
        'unique' => true,
        'required' => false,
        'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
    ]
);

This creates the attribute, but it does not set it's scope to GLOBAL; if I look into catalog_eav_attribute, the is_global-column is set to 0, but it should be 1. Even if I add:

$categorySetup->updateAttribute(
    Category::ENTITY,
    CategoryMetaInterface::CATEGORY_CODE,
    'global',
    ScopedAttributeInterface::SCOPE_GLOBAL
);

The scope is not adjusted. I already tried changing global to is_global, but with no luck. Any thoughts on this?

Another strange issue: also the setting of visible => true/false does not seem to have any effect when it comes to categories. Is the catalog_eav_attribute-table properly populated when it comes to category attributes?

UPDATE: Found the issue. It's almost too embarrassing to say but there was in fact another update script that also tried to create this attribute with the older settings (refactoring gone wrong). Removing this old (not-so-dead) code solved the issue for me.


texts: how to change shipping rates based on shipping origin

texts:
I want to calculate shipping rates and shipping methods based on shipping origin.
In Cart page shipping estimation and checkout page i want to calculate shipping charges based on different shipping origin locations.
I will have different shipping origins at cart page shipping estimation and checkout page after shipping address save.Now i want to pass dynamic shipping origins to calculate shipping charges.
any suggestions or ideas on where to start and how to get it.

Update:
I want same as Where is the code that calculates shipping from origin.
 but how to handle getRateOriginRequest and Mage_Shipping_Model_Shipping::collectRates()

I Want to replace ship-from configuration fields dynamically in shipping estimation and checkout process


texts:
I would like to be able to give a ONE FREE item from Category 'X' so long as the Customer orders a MINIMUM amount of say $30.

How to do this?

Thanks!


texts: Can't save role for custom module with ACL?

texts:
The custom module menu shows under Role Resources. Under Role Resources I click the check-box and save. I then reload the role and the check-box is no longer checked. I basically copied the menu items to the ACL XML element. Why is this happening?

config.xml

<?xml version="1.0"?>
<config>
...
    <adminhtml>
        <menu>
            <customModuleHeader translate="title" module="custommodule">
                <title>customModule</title>
                <sort_order>60</sort_order>
                <children>
                    <custommodule_configform translate="title" module="custommodule">
                        <title>custommodule Configuration</title>
                        <sort_order>50</sort_order>
                        <children>
                            <custommodule_configform translate="title" module="custommodule">
                                <title>Settings</title>
                                <action>custommodule/adminhtml_configuration</action>
                                <sort_order>10</sort_order>
                            </custommodule_configform>
                        </children>
                    </custommodule_configform>
                </children>
            </customModuleHeader>
        </menu>
        <layout>
...

admin.html

<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <customModuleHeader translate="title" module="custommodule">
                        <title>customModule</title>
                        <sort_order>60</sort_order>
                        <children>
                            <custommodule_configform translate="title" module="custommodule">
                                <title>custommodule Configuration</title>
                                <sort_order>50</sort_order>
                                <children>
                                    <custommodule_configform translate="title" module="custommodule">
                                        <title>Settings</title>
                                        <sort_order>10</sort_order>
                                    </custommodule_configform>
                                </children>
                            </custommodule_configform>
                        </children>
                    </customModuleHeader>
                </children>
            </admin>
        </resources>
    </acl>
</config>


texts:
I am new to Magento & using Magento 2.1.7 in my system I have installed a theme in my Magento & now when I am changing the background color in my theme's CSS it is not showing any change in that & while in the inspect element the classes & the CSS the theme is accessing it is not present in the CSS that is located in the web/css folder of the theme

here is the Image how it is showing in inspect element.

here in this image, the color showing in the css is with code #ff3366 & in the CSS of this theme I have replaced it with #ff6600 but still, it is showing here as #ff3366

I am not able to find the exact solution please anyone can help?


texts: Magento 2 : How to change position of Sign in and My Account link?

texts:
Magento 2 how to change Position of My Account Link and Sign In link in header.

i want to show position like, Sign In, My Account and My Wishlist.

Theme is blank to working for it.

Thanks.

I would like to show My Account only after Successfully Sign in.


texts: Special Price From Date and Special Price To Date not visible in backend M2

texts:
I am working on Magento Enterprise 2.2.5, I want to set special price for some products but Special Price From Date and Special Price To Date is not visible. Can someone have idea how we can add these to products?

According to Magento docs we should have date
https://docs.magento.com/m2/ce/user_guide/catalog/product-price-special.html

https://gmkr.io/s/5bb47cb8f30a05168c6836cb/0


texts: Currently url is forming by product name and i want to change it by using the sku_id.for this change where i change the code. To change the product url which file has to be modified. please help me i am new to magento.


texts: Can we create Two customers with same email (Magento 1)

texts:
I have just saw a different behaviour
I have created a customer with email "abc@abc.com" from admin.
& then tried to login from frontend but it asked to sign up i sign up & customer created.
Any thoughts if this is normal behavior in Magento 1 ?


texts:
In checkout/cart page sidebar listing the Shipping Method, in that, if my shipping is free need to set like "Free" now it displays "$0.00". Please check the attachment and let me know.

Thank you


texts: Magento 2 Reindex overwriting database Tier_Price changes

texts:
Could someone explain to me why whenever I perform a reindex on my magento website any changes I have made within the catalog_product_index_price table get overwritten.

I have created a module that can set custom tier prices for a customer group and when I set a new tier price I can see that it updates within the database to the new value. However, when I perform a reindex on the website the new value gets overwritten with the old value again.

Any help would be appreciated.

Update:

I have just set different values directly into the database and when I reindex they also get overridden and reverted back to their base values. Have I missed a step to make the reindex recognise the changes or is this intended?

Turns out, the table catalog_product_index_price is a frontend table which explains that whenever changes to this is made they are also shown on the frontend without having to reindex. What I think is happening is the reindex is grabbing its values from a EAV table and overwriting the table record. Currently I don't know which EAV table this values are stored in.


texts: Magento 2.3.X - Override /checkout/cart to show my custom module

texts:
I am trying to create a module that replaces the default /checkout/cart page. I have created app/code/NewShop/Cart module and it just displays a text now.

  app/code/NewShop/Cart/etc/frontend/routes.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
  <router id="standard">
    <route frontName="checkout/cart" id="cart">
      <module name="NewShop_Cart"/>
    </route>
  </router>
</config>

I compiled it and when I go to /checkout/cart it still shows the default Magento cart page. How can I override that?


texts: how to add a new page like sales/order/history

texts:
I want to add a new customer page (sales/order/unpaid-history) like sales/order/history in customer menu, it shows all the unpaid order with status pending_payment. Same template, same data, but has a condition filter.

Can modify magento core file, simple the best

My thought is copy the sales/order layout file, add a new phtml template, add a new method in sales order model. Is it right?

thanks for your help


texts: How to add My custom module in existing menu (Backend)

texts:
I have inserted one module in Magento Backend named "Importactualprice"!

It's coming as a new menu in admin backend!

I want that as submenu in Sales menu! How to achieve this?

my Menu.xml file code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
    <menu>
        <add id="Backend_Importactualprice::parent" title="Importactualprice" module="Backend_Importactualprice" sortOrder="100" resource="Backend_Importactualprice::parent"/>
        <add id="Backend_Importactualprice::index" title="Importactualprice Index" module="Backend_Importactualprice" sortOrder="10" action="importactualprice/index" resource="Backend_Importactualprice::index" parent="Backend_Importactualprice::parent"/>

    </menu>
</config>


texts:
In Magento 1, you can add AJAX tabs by doing the following:

In your Tabs.php block:

$this->addTab('test_tab', array(
        'label'     => "Test",
        'title'     => "Test",
        'url'       => $this->getUrl('*/*/test', array('_current' => true)),
        'class'     => 'ajax'
    ));

Then in your controller you could do:

public function testAction()
{
    $this->loadLayout();
    $this->renderLayout();
}

And finally in your layout file you had to do:

<adminhtml_controller_test>
    <block type="core/text_list" name="root" output="toHtml">
        <block type="module/adminhtml_edit_tab_test" name="module.edit.tab.test"/>
    </block>
</adminhtml_controller_test>

How to achieve the same thing in Magento 2 ?


texts: How to remove /magento2/ parameter from URL?

texts:
Current URL :  http://localhost/magento2/rest/V1/products/options/types

I want to use without /magento2/

  i.e. http://localhost/rest/V1/products/options/types

I am using XAMPP server with apache and php.


texts: Which classes need to be extended to change the price in code throughout the store?

texts:
I'm writing a test module that should change the prices of all items throughout the store simply by adding some value (eg 10).

I've written the module and now I am trying to find out exactly which Classes to extend. I have successfully managed to change the Grand Total by extending

\Magento\Quote\Model\Quote\Address\Total\Grand

and editing the collect() function to wrap the vars in my helper function _rewritePrice() prior to setting them.

eg: $total->setBaseGrandTotal($this->_helper->_rewritePrice($baseTotals));

However, I can't seem to find out exactly which Classes I need to extend to have it apply to all values throughout the store.

eg: Category View, product view, mini cart, cart, checkout, invoice and so it is correctly applied to tax values, refunds and so forth.

Is there an easy way to find out which I may have overlooked? Or does anyone know where I need to look?


texts: Display Configurable Product Image to Match Filter Selection in Magento 2

texts:
I have a configurable product, it has 2 colour options - black and white.

When I navigate to its category on my website I see my products black version thumbnail, which is an image I have manually selected as thumbnail when I created the configurable product.

Now I select colour white in the magento layered filter on left hand side and only products have white option (one of the configurable product variations) shown, but thumbnail hasn't changed, its still what I have manually selected previously. I would like the image that I have attached to white option of this product to be displayed.

Now the question is how to get this thumbnail to change according to filter selection?


texts:
Is it possible to emulate a different user role in code?

I'm wondering if it is possible to do something similar to Mage_Sales_Model_Order::sendNewOrderEmail() where a different store is emulated i.e.:

$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
...
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo).


texts: Ordering of collection changes depending on call method

texts:
I have the following piece of code:

$model = Mage::getModel('catalog/category')->load(1);
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->addCategoryFilter($model);
$collection->addAttributeToSort('product_id','DESC');

foreach ($collection as $p ) {

    var_dump($p->getId());

}

This basically loops over the products within a category (with the ID of 1).

The strange behaviour I am experiencing is that the var_dump of the product ID varies in sort order depending where I call it from. I am calling it from two places: a controller and an observer (catalog_category_save_commit_after).

Is there anything I am missing? The ID's should be printed in the same order.


texts: Blank product Image on category page Magento 2

texts: When i upload  images  from admin for a product of low size it give blank  product image on category page but when i upload image of large size,then it shows properly ,


texts:
When i create an order and enter not vaild mail(syntactically correct but mail that not exsist and can't recive message),Magento try to send that mail over and over,so when i check in SMTP log on every few minutes i got sending error.
Next,in system log i got following error:
main.ERROR: No such "recipient" here


texts: Custom Message Not Show in Cms Page in Magento 2

texts:
I have created custom contact form and call in cms page. I submit all form field with controller and add success message after submit and redirect back to cms page but success message not appeared in my cms page.

My Controller.php

<?php

namespace Vendor\Module\Controller;

use Magento\Framework\Controller\ResultFactory;

class Form extends \Magento\Framework\App\Action\Action
{
    public function execute()
    {
        $post = (array) $this->getRequest()->getPost();

        if (!empty($post)) {

            $this->messageManager->addSuccessMessage('My custom Message !'); // This message not appeared in cms page after redirect

            $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
            $resultRedirect->setUrl('/mycmspage');

            return $resultRedirect;
        }

        $this->_view->loadLayout();
        $this->_view->renderLayout();
    }
}

I also add cms_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="page.messages">
        <block class="Magento\Framework\View\Element\Messages" name="messages" as="messages"/>
    </referenceContainer>
</page>

Help Appreciated...


texts: percentage calculation based off total on cart page

texts:
I need advice on how to set this up. please refer to the image attached.

On the cart page I need to display 30% of the order total on the area marked with red circle called impact dollars. In other words if my order total is $100.00 the impact dollar section with automatically display $30.00 impact dollars.

I would also like to cary this %30 percent (impact dollars) to the confirmation page, to remind the user that out of their transaction had earned them a total or $30 impact dollars.

thanks


texts:
I want to add the pagination in myaccount dashboard link:

Please find the below screenshot:


texts: Magento2 : how can I call my theme images in static block

texts:
I have install Magento2 and create static block how can I call my theme images in static block ? In Magento1.x we used {{skin url="images/demo.jpg"}}.

Any one have idea for how to call images in Static block not using editor like {{media url="wysiwyg/demo.jpg"}}.


texts: Set multiple price for single store view in magento

texts:
I want to set 3 different currency for a single store in Magento 2.
For e.g i have one store i.e store 1
I want to set 3 currency for this store for e.g Dollar, indian rupee and Euro.
On frontend there will be currency convertor or something similar to that.
Does this can be achieved with default functionality or using any extension.?
My main concern is setting multiple prices for single product in single store view.


texts: How to show other module system config setting under catalog section configuration

texts:
I have a requirement is that,have an module it  some have system setting which are manged from admin system configuration.
I want show the section under Catalog setting.
Just like...
System>Configuration> Catalog
In Catalog tabs under  below tabs  available-

Catalog
Inventory
Google Sitemap
RSS Feeds
 Email to a Friend

I want to add another tab "Amit"

 Catalog
   Inventory
 Google Sitemap
 RSS Feeds
 Email to a Friend
Amit

Pleas help me....


texts: Magento 2: Import categories images external url via csv

texts:
I have import categories via CSV and I would like to import category image from external URL. I have used Magento ver. 2.3.1

I have tried to save images to the category but can't able to get success.

If any have idea how to import category image from external URL then let me know.

Any help would be appreciated. Thanks.


texts: Difference Between DHL (Deprecated) and DHL Shipping Method

texts:
I have DHL Details for Shipping Method.

In admin Showing Two DHL shipping Methods DHL (Deprecated) and DHL.

So Please Suggest me Which one I should Configure.


texts:
Preconditions

Magento 2.1.9

Php 7.0

Steps to reproduce

Like your documentation i have created a module for redirect user.
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/events-and-observers.html

Détail about my config file is avaible here : https://github.com/magento/magento2/issues/11629

When i go to the frontend, it's show an error about the observer class does not exist :(

Expected result

No error

Actual result

1 exception(s):

Exception #0 (ReflectionException): Class Athena\RedirectToLanguage\Observer\AthenaObserverRedirect does not exist

Exception #0 (ReflectionException): Class Athena\RedirectToLanguage\Observer\AthenaObserverRedirect does not exist

0 /var/www/html/athenacomputing/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Athena\Redirect...')

1 /var/www/html/athenacomputing/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Athena\Redirect...')

2 /var/www/html/athenacomputing/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Athena\Redirect...')

3 /var/www/html/athenacomputing/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Athena\Redirect...')

4 /var/www/html/athenacomputing/vendor/magento/framework/Event/ObserverFactory.php(33): Magento\Framework\ObjectManager\ObjectManager->get('Athena\Redirect...')

5 /var/www/html/athenacomputing/vendor/magento/framework/Event/Invoker/InvokerDefault.php(59): Magento\Framework\Event\ObserverFactory->get('Athena\Redirect...')

6 /var/www/html/athenacomputing/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))

7 /var/www/html/athenacomputing/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('controller_acti...', Array)

8 /var/www/html/athenacomputing/vendor/magento/framework/App/Action/Action.php(91): Magento\Framework\Event\Manager\Proxy->dispatch('controller_acti...', Array)

9 /var/www/html/athenacomputing/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))


texts: Mage_Install_Controller_Router_Install failing to autoload

texts:
I patched our site with SUPEE 6482 and, once clearing the cache, I get the same issue described here and here:

  Fatal error: Class 'Mage_Install_Controller_Router_Install' not found in /var/www/.../public_html/app/code/core/Mage/Core/Controller/Varien/Front.php on line 138

We did not get this error after SUPEE 5994 as others did.

It is not due to compilation (that has been disabled and cleared), cache (both main cache and sessions have been emptied several times, PHP opcache is disabled), nor the server itself (have restarted Apache and the entire box). The file definitely exists (others report patching failed to create it) and has the right owner and permissions.

I'm guessing that the file isn't able to be autoloaded but I don't know why.

I tried commenting out the router conf (as per this answer) and manually clearing the cache again. This does prevent the fatal error, as Magento no longer tries to load the file, but that isn't a solution because that code needs to be there to patch a hole.


texts:
Since I have started developing with Magento 2 I've noticed, compiling the dependency injector with bin/magento setup:di:compile can take 40 seconds and up to 1 min 20s with xdebug enabled.

I have an Intel i5 CPU M460 2.53GHz running PHP 7.1.11 on Ubuntu 17.10, not using docker or any VM. Is 40 seconds a normal compile time? Is there any way to improve it? It really slows me down when I just need to inject a new object into a class I'm working on and have to recompile everything.

I noticed workload is mostly CPU bound running on a single core. Has any work been done to make it multi-threaded?

I guess I just need to know when a manual setup:di:compile would be required when doing development?


texts: how to get custom table data in magento2

texts:
I am trying to get my custom table data on frontend but i was not getting any success please suggest me  by looking at below code thanks in advance

<?php
namespace vendor\module\Block;

use Magento\Framework\View\Element\Template;

class Postform extends Template
{

        const CONFIG_CAPTCHA_PUBLIC_KEY = 'quickrfq/google_options/googlepublickey';
        const CONFIG_CAPTCHA_THEME = 'quickrfq/google_options/theme';
        const CONFIG_CAPTCHA_ENABLE = 'quickrfq/google_options/captchastatus';

        const CONFIG_FILE_EXT_UPLOAD = 'quickrfq/upload/allow';

    protected $scopeConfig;

    protected $_connection;

    public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Framework\App\ResourceConnection $resource
    )
    {

        $this->scopeConfig = $context->getScopeConfig();
        $this->_connection = $resource->getConnection();
        parent::__construct($context);
    }

    public function getTableData()
    {
        $myTable = $this->_connection->getTableName('fme_quickrfq');
        $sql     = $this->_connection->select()->from(
             ["tn" => $myTable]
        );
        $result  = $this->_connection->fetchAll($sql);
        return $result;

        //print_r($result);
    }

    public function getFormAction()
    {
        return $this->getUrl('quickrfq/index/post', ['_secure' => true]);
    }

    public function getCaptchaTheme()
    {

        $theme = $this->scopeConfig->getValue(self::CONFIG_CAPTCHA_THEME);
        return $theme;
    }

    public function isCaptchaEnable()
    {

        $enable = $this->scopeConfig->getValue(self::CONFIG_CAPTCHA_ENABLE);
        return $enable;
    }

    public function getAllowedFileExtensions()
    {

        $ext = $this->scopeConfig->getValue(self::CONFIG_FILE_EXT_UPLOAD);
        return $ext;
    }
    public function getPublicKey()
    {

        return $this->scopeConfig->getValue(self::CONFIG_CAPTCHA_PUBLIC_KEY);
    }
}

now in phtml file

<?php

 $myTabledata = $block->getTableData();
    print_r($myTabledata);

?>

update

<?php
namespace vendor\Module\Block;

use Magento\Framework\View\Element\Template;

class Postform extends Template
{

        const CONFIG_CAPTCHA_PUBLIC_KEY = 'quickrfq/google_options/googlepublickey';
        const CONFIG_CAPTCHA_THEME = 'quickrfq/google_options/theme';
        const CONFIG_CAPTCHA_ENABLE = 'quickrfq/google_options/captchastatus';

        const CONFIG_FILE_EXT_UPLOAD = 'quickrfq/upload/allow';

    protected $scopeConfig;

    protected $resourceConnection;

    public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Framework\App\ResourceConnection $resource
    )
    {

        $this->scopeConfig = $context->getScopeConfig();
        $this->resourceConnection = $resourceConnection;
        parent::__construct($context);
    }

    public function getTableData()
    {
        $connection  = $this->resourceConnection->getConnection();
        $tableName   = $connection->getTableName('fme_quickrfq');
        $query = 'SELECT * FROM ' . $tableName;
        $results = $this->resourceConnection->getConnection()->fetchAll($query);
        return $result;
    }

    public function getFormAction()
    {
        return $this->getUrl('quickrfq/index/post', ['_secure' => true]);
    }

    public function getCaptchaTheme()
    {

        $theme = $this->scopeConfig->getValue(self::CONFIG_CAPTCHA_THEME);
        return $theme;
    }

    public function isCaptchaEnable()
    {

        $enable = $this->scopeConfig->getValue(self::CONFIG_CAPTCHA_ENABLE);
        return $enable;
    }

    public function getAllowedFileExtensions()
    {

        $ext = $this->scopeConfig->getValue(self::CONFIG_FILE_EXT_UPLOAD);
        return $ext;
    }
    public function getPublicKey()
    {

        return $this->scopeConfig->getValue(self::CONFIG_CAPTCHA_PUBLIC_KEY);
    }
}


texts: how can i override importexport adminhtml block?

texts:
i want to rewrite importexport block of admin panel, but it's in app > code > core > mage > importexport > Block > Adminhtml so i am confuse about that how to rewrite if adminhtml block is not in app > code > core > mage > Adminhtml

i have added in config.xml

 <importexport>
       <rewrite>
            <adminhtml_import_edit>cNAme_mName_Block_Adminhtml_Import_Edit</adminhtml_import_edit>
      </rewrite>
    </importexport>

--------------------------AND---------------------------------------

<blocks>
    <adminhtml>
      <rewrite>
        <import_edit>cName_mName_Block_Adminhtml_Import_Edit</_import_edit>
      </rewrite>
    </adminhtml>
</blocks>

but it's not work for me.

i have rewriting other block like.

app/code/core/Mage/Adminhtml/Block/Catalog/Form.php

using

<adminhtml>
    <rewrite><catalog_product_grid>cName_mName_Block_Catalog_Product_Grid</catalog_product_grid>
    </rewrite>
</adminhtml>


texts: How can i change color of this minicart-wrapper counter.qty with _theme.less

texts:
i want to know how can i change the color of this .minicart-wrapper .action.showcart .counter.qty when i search on my browser i know the name of css class are .minicart-wrapper .action.showcart .counter.qty but on my _theme.less i don't know how can i access that with @name to change brackground color.

Thanks a lot for the help.


texts:
In onepage.phtml the #checkout component is initialized using the settings from a json generated by the block object $block->getJsLayout(); :

<!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
    {
        "#checkout": {
            "Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
        }
    }
</script>

How can I see the output of this json using the browser console, without changing the .phtml by adding a console.log in there ?


texts: Getting a list of basket items in Magento 2.3

texts:
I am trying to get a list of products in the basket. I have the following in my class

 public function __construct(\Magento\Quote\Api\Data\CartInterface $cartInterface)
 {
        $this->cartInterface = $cartInterface;
 }

 public function getCart()
 {

    $cartId = $this->cartInterface->getId();

    echo $cartId;
 }

The issue I have is that the $cartId is always coming back as null even though I have 3 items in my basket

Please, could someone advise what I am doing wrong?

I use to use \Magento\Checkout\Model\Cart but this has now been deprecated


texts: Images are not displaying after installation of sample data In magento 2.3

texts:
I have downloaded and installed latest version of magento(2.3.0) with sample data , everything went smooth but i am getting images are broken links, tried with both installing through sample-data repository and download by sample data zip file. but same issue i am facing.

Note: while installing through composer update getting issue with downloadable-sample-data as it is not available in http://packagist.org


texts: Programmatically update all products to Taxable Goods

texts: I accidentally imported 21k products without a tax class id.  Is there a way to programmatically update their tax class without having to reimport again?


texts: Magento 2 Product import error :. Value for 'product_type' attribute contains incorrect value

texts:
I'm using Magento 2 Version 2.1 .
I have migrated data from magento 1.9 to magento 2.1.

The csv looks like, this:

sku,product_type,additional_attributes
123,simple,brands=APPLE,hideprice_by_customergroup=General|Wholesale|Retailer,hide_price=1,product_type=Enclosures,url_path=10invsp.html

I have exported CSV File. it's not working. it showing error.


texts:
Currently OOTB Magento 2 ee logs all messages to the .../var/log directory.

Is it possible to reconfigure Magento 2 to log all log entries to syslog, either a local or remote rsyslogd instance?


texts: Getting status from object returns different value compared to var_dump

texts:
I have this piece of code:

public function getAllOpenOrders() {
     $collection = Mage::getResourceModel('sales/order_item_collection');
                $collection->getSelect()->join( array('orders'=> sales_flat_order), 'orders.entity_id = main_table.order_id', array('orders.status'));
                $collection->addAttributeToFilter('orders.status',
                    array(
                        array('eq' => 'pending'),
                        array('eq' => 'processing'),
                    )
                );
}

When I var_dump the first object in a foreach loop is see the object has the following data.

["status"]=> string(7) "pending"

But when I do echo $object->getStatus(); it returns a different value. It returns Ordered when I echo and string(7) "Ordered" when I var_dump it.

What am I missing, or what am I doing wrong?

EDIT:

The foreach loop in my template file

<?php $orders = $this->getAllOpenOrders(); ?>

<?php foreach($orders as $order): ?>
     <?php var_dump($order->getStatus()); ?>
<?php endforeach; ?>


texts: What is 'best practice' when setting anchor on multi-level categories?

texts:
With three level category tree (can be more!) where we want the highest level not to be set to 'anchor' but want the next level down to be an 'anchor', what would we do with the lowest level? Set it to 'anchor' or not?

Category

Highest level: Category A (not anchor)
Middle level: Category B (anchor)
Lowest level: Category C (?)


texts: To understand the new magento 2 design structure i'm trying to create a simple frontend form submitting module. In it i'm submitting a number in an input box and i want to multiply it by 2 and display the result in another page. What is the correct architectural flow to achieve it? And please mention a link for a similar example if available.


texts: Admin updated user passwords not working after upgrade (Magento 1.7 -> 1.9)

texts:
When I change the user passwords after upgrade for some users in the systems > permissions > users edit page and try to login, the passwords do not work.

Looked at the database admin_user and it seems when I change/save the new password that the salt is actually longer than the old passwords. The old salt character(1.7) count was always limited to two characters and the new ones are longer (1.9)

  Old salt: :x7
  New salt: :t2UMmbI

Old passwords work and continue to work but as soon as I change them in the backend, users cannot login.

Also I tried inserting md5 hash+salt passwords and that via SQL query and that seems to work with two character salt but not with longer ones.

I have checked the sessions, etc and the solutions involving sessions do not seem to have any affect on it.

Any help would be greatly appreciated.


texts: Magento 2, how to edit 'Text-area' to 'select-list' in sale order page?

texts: Using magento 2.2, admin, sale->order->ship. I want to change the text-area of shipment comment to select list .


texts:
How do I rid of an "addLinkRel" and a "setText" via "local.xml"?
More specific, I'm trying to unload these

<action method="addLinkRel"><rel>stylesheet</rel><href>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</href></action>

<block type="core/text" name="head.viewport">
<action method="setText"><text><![CDATA[<meta name="viewport" content="initial-scale=1.0, width=device-width" />]]>&#10;</text></action>
</block>


texts: Magento 2 : How to Import Color and Size Swatch Attributes Using CSV

texts: How to import color and size swatch attributes using csv.


texts: Different Invoice/Order Emails for same Transactional Email template

texts:
I created a custom Transactional Email for Order and Invoice. To list the items that were ordered I use this call {{layout handle="sales_email_order_items" order=$order}}

I customized it while making test purchases from my main store view. Now I found out, that if I purchase something from my mobile store view, the transactional email for order and ivoice look different (s. picture)

web looks alright, but when the purchase was done via the mobile website, the table format doesn't fit. I already looked into folder structure. For the web store view all the template files were in "email" folders like app\design\frontend\base\default\template\bundle\email.

Where do I find the files to change the table for mobile store view?


texts: no discount percentage on configurable products

texts:
We have a Magento 2.3 version online store.
The discount percentage is only visible on simple products and not configurable.
I assume this cos simple products have unique price, and config products don't have a price.


texts: Magento resource: custom selects with OR in where (select orders by status)

texts:
I'm building a custom module and i'm trying get all orders with specific status:

$canceledQuery = Mage::getSingleton('core/resource')->getConnection('core_read')->select()
            ->from('mage_sales_flat_order', 'entity_id')
            ->where('status = ?', 'canceled');

This works very well. But now i'm trying use OR in where, without successs.
I have been try this:

$whereCanceled = array();
foreach ($_status as $statusCode => $value) {
    $whereCanceled[] = sprintf('%s=:%s', 'status', $statusCode);
}

$ordersQuery = Mage::getSingleton('core/resource')->getConnection('core_read')->select()
            ->from('mage_sales_flat_order', 'entity_id')
            ->where(implode(' OR ', $whereCanceled));

So, I don't know how use OR right in this case. I found no use for this with OR. Any idea?


texts: Magento Paypal not displaying transaction details

texts:
Magento 1.8

Starting from last week orders that were received via Paypal didnt appear as paid status at the backend and paypal transaction details were missing.

What could cause that? We are using default paypal bundled with Magento.

Default display fields:

Payer ID:
Payer Email:
Payer Status:
Payer Address Status:
Merchant Protection Eligibility:
Last Transaction ID:
Order was placed using MYR
Current display field

Empty paypal transaction details


texts: Magento 2: Display Active Paymet methods in configuration

texts: I am working on one custom extension in Magento2 and I need to show the active payment methods in the backend configuration of the extension with multi select option. How can I do that?


texts: Magento2 - Remove Extra space from Shopping cart image

texts:
Here I am facing a UI issue but don't know how to solve it.

In My shopping cart page my product image is getting extra space i dont know from where it is coming.


texts: Magento2 - disable add to cart on product page

texts:
Im running Magento2.3.4 and would like to disable the add to cart bottom on some product pages because they are to complicated to ship.

Have created an Yes/No attribute "afhentes" and I would like to disable the add to cart by enable this attribute.

One the same time I would like a text displayed indsteed: "Pick up in store"

Have found some around the net but they does not seem to work.

Hope someone can help med out with this matter.


texts: getModel attributeToFilter overridden by server default status?

texts:
I'm trying to get all the products where the qty is above 0 and is_in_stock on 1.
But when i'm trying to use the following code it overrides the addAttributeToFilter.

$collection = Mage::getModel('catalog/product')
    ->getCollection()
    ->addAttributeToSelect('entity_id')
    ->joinField(
        'qty',
        'cataloginventory/stock_item',
        'qty',
        'product_id=entity_id',
        '{{table}}.is_in_stock=1',
        'left'
    )
    ->addAttributeToFilter('qty', array('gt' => 0));

This code should return (on development server):

SELECT `e`.*, `at_qty`.`qty`
FROM `catalog_product_entity` AS `e`
LEFT JOIN `cataloginventory_stock_item` AS `at_qty` ON (at_qty.`product_id`=e.entity_id) AND (at_qty.is_in_stock=1)
WHERE (at_qty.qty > 0)

but instead it returns (on live server):

SELECT `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, `at_qty`.`qty`
FROM `catalog_product_flat_1` AS `e`
LEFT JOIN `cataloginventory_stock_item` AS `at_qty` ON (at_qty.`product_id`=e.entity_id) AND (at_qty.is_in_stock=1)
WHERE (e.status = 1)

EDIT:

For some reason the WHERE part is overridden and changed to e.status

Any help would be appreciated.

FINAL EDIT

Because of the awesome research @Jaimin I was able to solve my problem.
Both development and live were on yes in this setting:

  System > Configuration > Catalog > Frontend > Use Flat Catalog Product

So both returned values from catalog_product_flat_1.

after using the following getModel instead:

$collection = Mage::getModel('catalog/product')
     ->getCollection()
     ->addAttributeToSelect('entity_id');
$collection->getSelect()->join(
array('stock_item'=>'cataloginventory_stock_item'),
 '`stock_item`.`product_id` = `e`.`entity_id`',
 array('qty', 'is_in_stock'));

and using the following to add qty and is_in_stock to the where part of the sql:

$collection->getSelect()->where('is_in_stock = ?', 1);
$collection->getSelect()->where('qty > ?', 0);

It was able to show  me the correct data.


texts: Magento root directory to install patch files

texts:
How to specify exact command for Magento patch file installation, I need to install CE-MAGETWO-67805.patch file it shows some errors.

git apply --apply CE-MAGETWO-67805.patch I use this command to install patch file where to specify magento root folder and how to do that.

git apply public_html/pub --apply CE-MAGETWO-67805.patch this is the command? please help me somebody..

I attach the error image

This error shows at every time try to install and also tried another method

create patch.php upload using FTP in public_html folder
In browser called that file ex: www.example.com/patch.php it shows "done" text only..

I am using magento 2.1.6 then upgrade to magento 2.1.7 it solve image resize issue then try to install patch file using putty. Then I use this command git apply --apply CE-MAGETWO-67805.patch there is nothing to be install please somebody help me..


texts: Magenot 1.9.x : The URL "http://magedk.local/" is not accessible

texts:
I can't install magento 1 because I have error:

  "The URL "http://magedk.local/" is not accessible."

  "Unable to read response, or response is empty"

Magento installing on docker.


texts:
I have a product with 8 custom options. Each custom option is a range value in increments, meaning there are ~180 values per option (8 * 180 values to input manually!). I'd really like to insert these in via an SQL query.

Is this possible without messing up Magento, and does anyone have some example SQL to hand? I don't need to create the custom option itself, only add additional values.


texts: Add custom input_renderer to an existing attribute

texts:
I've been searching for 2 hours now... I want to use a custom_renderer on the product view for the "color" attribute.

Many answers posted here are adding new attributes and setting "input_renderer" in an install script.

OK but what if my attribute already exists ? I don't want to drop it (and lose all its value).

It there a way to do that ? An event to use maybe ? I only want to change the renderer for this attribute and not for every  input.

I hope i was clear enough. Feel free to ask any questions that may be needed.