texts:
Which among you have a solution for this problem:
When I add a new category, I always received the same messageYour product selection is empty for the selected Store View. If you are running a multi-store setup, please check this manual page for more informations.
 despite I have not put product yet, and even also if I add product and in the frontend, it appears me a message to wander as if I have no products related to this category
Unable to find products matching your selection.


texts: Magento 2 Search within category product list

texts:
In magento 2, is it possible to have search option within category product listing?
please find below attach image

[updated]
finally, i have rewritten Listproduct.php class and search is working. The problem is layered navigation is not getting update based on search results.

        <?php

        namespace Mycomp\MyModule\Rewrite\Magento\Catalog\Block\Product;

        /**
         * Class ListProduct
         *
         * @package Mycomp\MyModule\Rewrite\Magento\Catalog\Block\Product
         */
        class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
        {

            protected function _getProductCollection()
            {
                $query = trim($this->getRequest()->getParam('query'));
                $this->_productCollection =  parent::_getProductCollection();
                if($query != ''){  return $this->_productCollection->addAttributeToFilter('name', ['like' => '%'.$query.'%']);}
                return $this->_productCollection; //->addAttributeToFilter('name', ['like' => '%ne%']);
            }

        }

Could you kindly help me?


texts: Htaccess - How can i make this redirect a 301 instead of 302?

texts:
My website redirects everything from http to https but 1 of the redirects is a none cacheable 302 redirect according to a few seo checkers i use.

How can i get the following code to be a 301 redirect instead of a 302?

    Options +FollowSymLinks
    RewriteEngine on

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^lincoln-printing-services\.co\.uk$ [NC]
RewriteCond %{HTTP_HOST} !^www\.lincoln-printing-services\.co\.uk$ [NC]
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^index\.php$ - [L]


texts:
I am sure its possible but can't see how its done.

I would like to set up a promotion where a customer gets 20% off a sku if they enter in a promotion code.

I presume I need to use "Percentage of a price discount" and set the shopping cart rule to be 20% and but it seems to be taking 20% off every product and not just the 1 SKU I want it to take off


texts: How to add "read more" link to category pages

texts:
I want to create category pages that are similar to Houzz. See here: http://www.houzz.co.uk/photos/wall-lights

They have some introductory category text, followed by a more link that leads to more in-depth information positioned at the bottom of the page, after the products.

I'm aware that I would need to insert a block below my products for the more in-depth information, but how do I get my "more" link to work like Houzz? Is that possible to create within the Magento editor?

Thanks as always! You guys are great.


texts:
I've been looking all over the place and I can't find what this is:

updateCallback : function(elm, status) {
    if (typeof elm.callbackFunction != 'undefined') {
        eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')');
    }
}

What is callbackFunction? How come I can't find it defined anywhere?


texts: Raw sql query vs Mage::getModel('catalog/product') vs?

texts:
I want to optimize simple ajax call which retrieves product information. Just getting product information will take 13MB of memory:

require_once('app/Mage.php');
Mage::app('default');
$_product = Mage::getModel('catalog/product')->load(1);
var_dump($_product->getData());

But if I make raw sql query it takes only 0.5MB:

  $file = $_SERVER['DOCUMENT_ROOT']."/app/etc/local.xml";
  $xml = simplexml_load_file($file);
  $username = (string)$xml->global[0]->resources->default_setup->connection->username;
  $password = (string)$xml->global[0]->resources->default_setup->connection->password;
  $dbname = (string)$xml->global[0]->resources->default_setup->connection->dbname;
  $conn = new PDO("mysql:host=localhost;dbname=$dbname;charset=utf8",$username,$password);
  $sql = "SELECT * FROM (
      SELECT
          ce.sku,
          ea.attribute_id,
          ea.attribute_code,
          CASE ea.backend_type
             WHEN 'varchar' THEN ce_varchar.value
             WHEN 'int' THEN ce_int.value
             WHEN 'text' THEN ce_text.value
             WHEN 'decimal' THEN ce_decimal.value
             WHEN 'datetime' THEN ce_datetime.value
             ELSE ea.backend_type
          END AS value,
          ea.is_required AS required
      FROM catalog_product_entity AS ce
      LEFT JOIN eav_attribute AS ea
          ON ce.entity_type_id = ea.entity_type_id
      LEFT JOIN catalog_product_entity_varchar AS ce_varchar
          ON ce.entity_id = ce_varchar.entity_id
          AND ea.attribute_id = ce_varchar.attribute_id
          AND ea.backend_type = 'varchar'
      LEFT JOIN catalog_product_entity_int AS ce_int
          ON ce.entity_id = ce_int.entity_id
          AND ea.attribute_id = ce_int.attribute_id
          AND ea.backend_type = 'int'
      LEFT JOIN catalog_product_entity_text AS ce_text
          ON ce.entity_id = ce_text.entity_id
          AND ea.attribute_id = ce_text.attribute_id
          AND ea.backend_type = 'text'
      LEFT JOIN catalog_product_entity_decimal AS ce_decimal
          ON ce.entity_id = ce_decimal.entity_id
          AND ea.attribute_id = ce_decimal.attribute_id
          AND ea.backend_type = 'decimal'
      LEFT JOIN catalog_product_entity_datetime AS ce_datetime
          ON ce.entity_id = ce_datetime.entity_id
          AND ea.attribute_id = ce_datetime.attribute_id
          AND ea.backend_type = 'datetime'
      WHERE ce.sku = 'test'
    ) AS tab
    WHERE tab.value != '';
  ";
  foreach ($conn->query($sql) as $row) {
  var_dump($row);
  }
  var_dump(memory_get_usage()/1000/1000);

I believe I should use in such case raw query because the ajax call will be made for every page view and extra 13MB for every page view just for that is a lot. Anyway I am wondering if there is any other way which would spend less memory but still would use Magento model.


texts: Magento 2 module with custom table and plugin for quote event

texts:
I need to create a custom module that will have a table to count the number of times a customer updates the quote.  So the table should have a quote ID and a count column, and the plugin should be able to set and get the count.
I'm struggling a bit with the resource model.  Do I need to create a collection model?  Each quote should have only one entry, so why would I need a collection?


texts: magento 2 module register event observer

texts:
Is there a way to do some action at module registration/installation?

It can be through event observer or through migration.

I want to call a function to get some values and store them in core_config_data during installation.

Thanks.


texts:
I have Magento 2.1 installed.

When I change a quantity of some products (not all) since the record of a product nothing changes. If I go through the mass change there it changes.

Do you have any idea what's going on?


texts: Magento 1.9 - Anyone help me What is error in my Observer?

texts:
My Custom observer :

app\etc\modules\Gta_FindPaymentGateway.xml

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

app\code\local\Gta\FindPaymentGateway\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Gta_FindPaymentGateway>
            <version>1.0.0</version>
        </Gta_FindPaymentGateway>
    </modules>
    <global>
        <models>
            <gta_findpaymentgateway>
                <class>Gta_FindPaymentGateway_Model</class>
            </gta_findpaymentgateway>
        </models>
        <events>
            <sales_order_place_before>
                <observers>
                    <Gta_FindPaymentGateway_Model_Observer>
                        <type>singleton</type>
                        <class>Gta_FindPaymentGateway_Model_Observer</class>
                        <method>paymenter</method>
                    </Gta_FindPaymentGateway_Model_Observer>
                </observers>
            </sales_order_place_before>
        </events>
    </global>
</config>

app\code\local\Gta\FindPaymentGateway\Model\Observer.php

<?php
    class Gta_FindPaymentGateway_Model_Observer
    {
        public function paymenter($Observer)
        {
             $order = $Observer->getEvent();
             Mage::log($order->getName(),null,'event.log',true);
        }
    }
?>

log not created.

Share any debug tool for magento?


texts: Magento 1.9 - Can't able to save data showing https issue

texts:
Here is the error message after made any changes from Magento 1.9 admin panel.

  "The information you have entered on this page will be sent over an
  insecure connection and could be read by a third party."

Any suggestion??


texts: Magento 2 : Custom product type module update

texts:
I have a module that was defining a custom product type: MyPT1

I added a second custom product type (MyPT2) using the same module.

But When I create a MyPT2 product in the backend, the price is not present.
I Think that it is due to the fact that InstallData.php is not run during setup:upgrade as the module was already installed.
I then would like to create a UpgradeData.php but I don't know how to create it correctly.

Here is my InstallData.php

<?php
namespace Vendor\Module\Setup;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
    protected $eavSetupFactory;

    public function __construct(EavSetupFactory $eavSetupFactory)
    {
        $this->eavSetupFactory = $eavSetupFactory;
    }

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

        $fieldList = [
            'price',
            'special_price',
            'special_from_date',
            'special_to_date',
            'minimal_price',
            'cost',
            'tier_price',
            'weight',
        ];

        foreach ($fieldList as $field) {
            $applyTo = explode(
                ',',
                $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')
            );
            if (!in_array(\Vendor\Module\Model\Product\Type\MyPT1::TYPE_CODE, $applyTo)) {
                $applyTo[] = \Vendor\Module\Model\Product\Type\MyPT1::TYPE_CODE;
                $eavSetup->updateAttribute(
                    \Magento\Catalog\Model\Product::ENTITY,
                    $field,
                    'apply_to',
                    implode(',', $applyTo)
                );
            }

            if (!in_array(\Vendor\Module\Model\Product\Type\MyPT2::TYPE_CODE, $applyTo)) {
                $applyTo[] = \Vendor\Module\Model\Product\Type\MyPT2::TYPE_CODE;
                $eavSetup->updateAttribute(
                        \Magento\Catalog\Model\Product::ENTITY,
                        $field,
                        'apply_to',
                        implode(',', $applyTo)
                        );
            }
        }
    }
}

Thank you for your help,


texts: Configurable product line items have $0.00 price and subtotal in admin panel

texts:
I have created a configurable product in magento following this tutorial: http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product
However when I add this product to an order through the admin panel the price of the item is zero seen here:

This is my product in magento:

Any idea why this may be?


texts: How to protect our module with serial number or other way

texts:
We developed a module but want to make only few people can use our module

Is there any way to make this? (e.g. adding serial number like some extension company do)

(so even if someone got copy of all files, he can't use without our permission)


texts: Can't show custom text in block over product description

texts:
I have added this xml in /app/design/frontend/rwd/default/layout/mymodule.xml

<layout version="1.0.1">
    <catalog_product_view>
        <reference name="product.info">
            <block type="mymodule/showicon" after="product.info.media" name="mymodule_showicon" template="mymodule/showicon.phtml" />
        </reference>
    </catalog_product_view>
</layout>

for testing I have shown following code in showicon.phtml afterwards I will show a image that I want to overlay the products image

SHOW ICON HERE

and in my confix.xml I have defined

    <config>
    <modules>
        <NS_Mymodule>
            <version>1.0.1</version>
        </NS_Mymodule>
    </modules>

    <global>
        <helpers>
            <Mymodule>
                <class>NS_Mymodule_Helper</class>
            </Mymodule>
        </helpers>

        <blocks>
            <mymodule>
                <class>NS_Mymodule_Block</class>
            </mymodule>
        </blocks>

    </global>

    <frontend>
        <layout>
            <updates>
                <mymodule>
                    <file>mymodule.xml</file>
                </mymodule>
            </updates>
        </layout>
    </frontend>

</config>

Now as expected I don't see the text SHOW ICON HERE in my product page,

whats wrong, whats I'm missing?

UPDATE:

I've also added the block class with the code

class Ns_Mymodule_Block_Showicon extends Mage_Core_Block_Template
{
    public function myfunction()
    {
        return "Hello tuts+ world";
    }
}

I have also called the block in the view.phtml file at rwd/default/template/catalog/product

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

after this line

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


texts: magento 1.9: Update product images with dataflow on magento 1.9

texts:
I am updating all of the product images on my site. However when I change the base, small and thumbnail images in the dataflow CSV it adds the new image but keeps the old one as well as a second image for the product.

I don't want the old image associated with the product at all.

Is this possible with dataflow?

Thanks :-)


texts: How to create slider for Upsell product and keep related items in simple grid view?

texts:
I am running a store on Magento 2 and on product page I want to show upsell products in slider while keeping the related items in simple grid view.

Any help will be appreciated

Thanks


texts: We have a site which is accessed entirely over HTTPS, but sometimes display external content which is HTTP. Anybody can help me why sometimes display external content is HTTP.


texts: SOAP API for Java filter and sort Orders by order id

texts:
I am using Magja, java soap api for magento. I want to filter orders by order id or any other property, also want to sort orders by ASC or DESC. But my current code is not working for that, I need help to sort this out, thanks in advance for any help. My current code for filter is below

TestOrder to = new TestOrder();
OrderFilter filter = new OrderFilter();
filter.getItems().add(new OrderFilterItem("state", "=", "new"));
filter.getItems().add(new OrderFilterItem("store_id", "=", "3"));
filter.getItems().add(new OrderFilterItem("order_id", "gt","300000065"));
List<Order> list = to.service.list(filter);

Note: filters by state and store_id are working fine. But order_id/increment_id filters(gt, lt, eq etc) are not working at all.


texts: Configurable product Url Not changing in magento 2

texts:
I'm trying to change the URL of my configurable products I have changed the URL through

  Product->search engine->urlkey

But it's not getting effect on the product still loading from old URL


texts: Magento 2 Cart Price rule conditons: If items with attribute subtotal is greater then X

texts:
i'm looking for a specific way to solve a cart price rule condition. The resultion action itself is not relevant and already solved in my case.
I have different product types, specified by an attribute.
lets call them Type X and  Z
Goal:
If the subtotal of all items with attribute X is greater then 200,00, then apply rule
So far i could only find:

If amount of all X items is...
If price in cart of one item is...
If subtotal of cart is...

None of these and combinations of them solve the problem.
Example:

Position 1:
Item SKU 123, Type X, Amount 2, Price: 50,00 -> Subtotal of 100

Position 2:
Item SKU 124, Type X, Amount 100, Price: 0,50 -> Subtotal of 50

Position 3:
Item SKU 889, Type Z, Amount 1, Price: 1500,00 -> Subtotal of 1500

In this case the rule should not apply since the total of the X items are only 150,00.
Increasing the amount of Position 1 or 2, could activate the rule, if the subtotal reaches  atleast 200,00

The amount of the Type X items is useless to determine the price.

The price of one item in the cart is useless if there are multiple items of Type x

The subtotal of the cart is useless since other items, likeType Z, are to be ignored

Long story short:
Any possible core feature way to solve this? Or does this need an extansion?


texts: How to override Controller on Magento 1.9.x

texts:
I want to Override method setPathInfo on app/code/core/Mage/Core/Coontroller/Request/Http.php by my module (extension)

(not create file on local eg. app/code/local/Mage/Core/Coontroller/Request/Http.php)


texts:
I want to add share button in my template same as youtube share button for copy link. When clicking this button will show my current URL.

click button

Can anyone help me? Thanks.


texts: How to remove attribute from Product Collection

texts:
I have created an observer that manipulates the advanced search result of Magento.
For this, I've used the controller_action_layout_render_before_catalogsearch_advanced_result observer.

I'm using an "dummy" attribute called "brand". This attribute doesn't accually contain something, but is just there so that the user can input a value in the normal magento forms.

Now my problem is that I can not seem to remove this dummy attribute. I've tried removeAttributeFromFilter() (and removeFieldFromFilter()) but it does not seem to disappear.

I cannot just reset the WHERE statement, because all other attributes do need to function like normal.

The observer:

class Jeroen_SearchFilter_Model_Observers_Searchresults
{
      function manipulateSQL( $event ){
         if(!Mage::app()->getRequest()->getOriginalPathInfo() == "/catalogsearch/advanced/result/";){
            //double check if this we're really using advanced search
            return;
         }

         $block = Mage::app()->getLayout()->getBlock('search_result_list');

         if($block){
             $collection = $block->getLoadedProductCollection();
             $searchFilterTable = Mage::getSingleton('core/resource')->getTableName('searchFilter/searchtable');
             $collection->getSelect()->join(array("searchfilter" => $searchFilterTable), "e.entity_id = searchfilter.product_id" );
             $collection->getSelect()->where("searchfilter.brandAttributeId = 'mybrand'");
             $collection->removeAttributeFromFilter("brand");
             $block->setLoadedProductCollection($collection);
         }
      }

}

Does anyone know how to remove the brand attribute from the collection?


texts:
Magento is creating rewrite_urls for categories by their name
so when the name is full UTF8 like تست or تت it produce empty string for url rewrite like this:

 .html

so it will insert duplicate url rewrites and this error return in rest call

{"message":"Could not save category: %1","parameters":["URL key for specified store already exists."],"trace":"#0 [internal function]: Magento\\Catalog\\Model\\CategoryRepository->save(Object(Magento\\Catalog\\Model\\Category\\Interceptor))\n#1 \/Users\/sinamiandashti\/projects\/magento\/vendor\/magento\/module-webapi\/Controller\/Rest.php(307): call_user_func_array(Array, Array)\n#2 \/Users\/sinamiandashti\/projects\/magento\/vendor\/magento\/module-webapi\/Controller\/Rest.php(216): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#3 \/Users\/sinamiandashti\/projects\/magento\/var\/generation\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php(24): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#4 \/Users\/sinamiandashti\/projects\/magento\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#5 \/Users\/sinamiandashti\/projects\/magento\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\n#6 \/Users\/sinamiandashti\/projects\/magento\/pub\/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#7 {main}"}


texts: reporting_system_updates table is getting large

texts:
On our webshop (running community 2.1.9) we have a table called reporting_system_updates and it is allready over 300Mb in size.
Can I safely truncate this table?


texts: Where to find magento2-sample repository with payment module and many others as examples?

texts:
There is no sample-module-payment-gateway to start by developing a custom payment gateway. And, in fact, there is no more magento2-samples repository, which made the developers life much easier.
Where samples of modules can be found now?


texts:
Is there a official website for downloading Magento 1.9 ?

Is that version still supported by Magento or is there a support community for this version available?


texts: How to insert menu at left column in magento using diffrent theme

texts:
I install theme and made my home page of three columns, I have a menu on top of products and category.I want that menu on my left hand side in page . i
found the  3cloumn.phtml here D:\wamp\www\magento\app\design\frontend\base\default\template\page i copy that file in my theme here D:\wamp\www\magento\app\design\frontend\default\bluescale\template\page\html
but i am doing any changes in my theme on that page is not reflecting at front end . And how i can put that top product related menu on left hand side.


texts: programmatically create block to inject on checkout page in magento

texts:
In checkout page on Billing Section If user enter wrong address details (ex: address validation) I want inject block.

when I put my code in indexAction it's working. but saveBillingAction not working. Any Idea?

 public function indexAction()
    {
..............
$block = $this->getLayout()->createBlock(
            'Mage_Core_Block_Template',
            'my_block_name_here',
            array('template' => 'activecodeline/developer.phtml')
        );

        $this->getLayout()->getBlock('head')->append($block);
..............
     }

it's working.

    public function saveBillingAction()
        {

            if ($this->_expireAjax()) {
                return;
            }
            if ($this->getRequest()->isPost()) {
                $data = $this->getRequest()->getPost('billing', array());
                $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

                if (!$customerAddressId) {
                    $continue = $this->ValidateAddress($data['city'], $data['stateOrProvince'],$data['postalCode'],$data['countryCode']);
                    if (!$continue) {

             $block = $this->getLayout()->createBlock(
                       'Mage_Core_Block_Template',
                      'my_block_name_here',
                      array('template' => 'activecodeline/developer.phtml')
                      );

                  $this->getLayout()->getBlock('head')->append($block);

                        return;
                    }
                }

            }

            parent::saveBillingAction();
        }

it's now working.

How Can I inject when user enter wrong details?

Thanks.


texts:
Magento get Email template System Configuration Value

<customeremail>
    <label>Customer Email</label>
    <frontend_type>Select</frontend_type>
    <source_model>adminhtml/system_config_source_email_template</source_model>
    <sort_order>3</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <comment>Customer Email</comment>
</customeremail>

I called this way:

Mage::getStoreConfig ( 'mps_proxelle/enable/customeremail' );

But it prints 1 only. How to get Value in phtml ?


texts:
Im changing by checkout_cart_product_add_after the product Price and also want to change the Product weight.

here is the code: Magento 1.9.3

 public function checkoutCartProductAddAfter(Varien_Event_Observer $observer){
....

  // Get the quote item
  $item = $observer->getEvent()->getQuoteItem();

  // Ensure we have the parent item, if it has one
  $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
  // Enable super mode on the product.
  $item->getProduct()->setIsSuperMode(true)

  $weight = /.some calculation based on custom configuration../
  $item->setWeight($weight); // not working
...
}

so the weight is still overwritten by

  app/code/core/Mage/Sales/Model/Quote/item.php

 //line # 390
...
->setWeight($this->getProduct()->getWeight())
...

Have you any solution about this. Without changing the item.php file.

Thank you

Usman

My IDEA

So my Idea is to set here a custom Attribute like:

public function checkoutCartProductAddAfter(Varien_Event_Observer $observer){
....

  // Get the quote item
  $item = $observer->getEvent()->getQuoteItem();

  // Ensure we have the parent item, if it has one
  $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
  // Enable super mode on the product.
  $item->getProduct()->setIsSuperMode(true)

  $weight = /.some calculation based on custom configuration../
  $item->setWeight($weight); // not working

  $item->setCustomWeight($weight); // here we set a custom attribute custom_weight and store the calculated weight
...
}

and then set a second observer sales_quote_item_set_product

public function salesQuoteItemSetProduct(Varien_Event_Observer $observer){
    $_event     = $observer->getEvent();
    $_quoteItem = $_event->getQuoteItem();
    $_product   = $_quoteItem->getProduct();

    if ($weight = $_product->getData('custom_weight'))
        $_quoteItem->setWeight($weight);// set the new weight
}

but its still not working, because the Value of the Custom Attribute

  custom_weight

is empty.


texts: Add multiple customer attribute fields in Magento registration form

texts:
I am trying to add 2 customer attribute fields in my Magento registration form.

The input names are the same in the register.phtml as in the install-1.0.0.php file. However I think there is something wrong in the installer file, because only the first attribute is saved (is_privacy_statement).

Here is my code from the installer file:

$installer = $this;
$installer->startSetup();

$installer->addAttribute("customer", "is_privacy_statement",  array(
    "type"      => "int",
    "label"     => "Privacy Statement",
    "input"     => "checkbox",
    "position"  => 120,
    "required"  => true,
    "is_system" => 0
));

$installer->addAttribute("customer", "is_general_terms",  array(
    "type"      => "int",
    "label"     => "General Terms",
    "input"     => "checkbox",
    "position"  => 121,
    "required"  => true,
    "is_system" => 0
));

$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "is_privacy_statement", "is_general_terms");

$used_in_forms=array();

$used_in_forms[]="adminhtml_customer";
$used_in_forms[]="checkout_register";
$used_in_forms[]="customer_account_create";
$used_in_forms[]="customer_account_edit";

$attribute->setData("used_in_forms", $used_in_forms)
        ->setData("is_used_for_customer_segment", true)
        ->setData("is_user_defined", 1)
        ->setData("is_visible", 1);

$attribute->save();

$installer->endSetup();

I have no idea why is not saved the second attribute too.


texts: how to add newsletter link page to toplink

texts:
I want to add newsletter link to my top link block like first link.
I think that it can works adding some string in layout.xml files.
I've tried to add this code into customer.xml
but the newsletter link doesn't appear.

<default>
    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer"><label>Newsletter</label><url helper="newsletter"/><title>Newsletter</title><prepare/><urlParams/><position>10</position></action>
    </reference>
</default>

Anyone can help me to understand how works the toplinks adding?
Thanks


texts: Magento 2 how to get product attribute options on checkout cart

texts:
How I can get the configurable products attribute options in front end checkout cart page? I have tried with the below answer but can't get any success.

Magento 2 - How to get attribute options value of eav entity?

When I have print the echo "<pre>"; print_r($block->getOptionList()); die;, I am getting the below array result with the label and value but not getting the color code to show as per my custom design.

Array
(
    [0] => Array
        (
            [label] => Color
            [value] => Green
        )

    [1] => Array
        (
            [label] => Size
            [value] => S
        )

)

Also, I have go through the admin settings like below:

Stores > Configutation > Sales > Checkout > Shopping Cart > Configurable Product Image set as Product Thumbnail Itself

It's also not working in the magento 2.

Please see the attached screenshot what I want:

Display this color code value in the frontend like the below image:

Please suggest how I can get the color code? Thanks!!!


texts: Magento 2 :Develop Multivendor Marketplace store in Magento

texts: How to create a multi-vendor marketplace in magento?


texts: Application response time increase after flushing Redis object cache

texts:
So, today we attempted to migrate object cache from "local file storage" to Redis for our store on Magento EE 1.14.2.4.

After placing the connection details in local.xml and manually clearing var/cache/ on all front-end servers, everything seem to be working well as application performance stayed steady and we could see reads/writes on the Redis DB.

About 40 minutes later, we attempted to flush cache from the admin using the System > Cache Management > Flush Magento Cache button.

From this time on, we saw our application response time double and a large increase in writes to Redis DB.  This was not just a brief increase as cache was "re-warmed", response time and Redis DB writes stayed high for 20 minutes until we decided to switch back to local file storage for object cache.

During the period of increased application response time, we manually flushed Redis, but it did not solve the issue.

Can anyone shed any light on why we might have seen this behavior?

Here is a visualization of app response time, showing the effect of switching to Redis for object cache and flushing cache from the admin:


texts: Magento 2.2.3 - ERROR 1062 (23000) at line 368677: Duplicate entry '0' for key 'PRIMARY'

texts:
I used Magento Data Migration Tool to import my database test2_web2.sql from 1.9.2.2 to 2.2.3. Migration is successful with no issues.

If I export the database and then try to import it.

mysql -p -u test2_test test2_web2 < test2_web2.sql

The following error is displayed,

  ERROR 1062 (23000) at line 368677: Duplicate entry '0' for key 'PRIMARY'

From my database Line 368677

  ALTER TABLE cron_schedule

From within,

-- Indexes for table `cron_schedule`
--
**ALTER TABLE `cron_schedule`**
  ADD PRIMARY KEY (`schedule_id`),
  ADD KEY `CRON_SCHEDULE_JOB_CODE` (`job_code`),
  ADD KEY `CRON_SCHEDULE_SCHEDULED_AT_STATUS` (`scheduled_at`,`status`);

Does anyone know how I can resolve this?


texts: Eliminating a tab in the view of products

texts:
I need some help in the tabs of the products view, my client had asked me to create some products that are collections of products, and these products doesn’t have a price, and since they don’t have price I have to eliminate a tab in the view of this products, and I’m trying to figure out, I have an idea that in the tabs.phtm file, validate when the product doesn’t have a price, so there use a style with display none to hide the specific tab, but I can’t figure a way to obtain the price of the product it’s been currently watching. So, is there a way I can obtain the price of the product in the tabs.phtml file?

I hope there is, thanks!


texts:
I'm using checkout_cart_product_add_after event.

I have requirement like this
Tier Prices for Specific Increments

I have written following code in my observer.

But row total is not updated in cart page.But in system.log its giving updated value.Thanks in advance.please let me know if you need any clarification.

Here Specific increment=3;

    class Exinent_Customprice_Model_Observer {
                public function customprice(Varien_Event_Observer $observer){

                     $item = $observer->getQuoteItem();
                        if ($item->getParentItem()) {
        $item = $item->getParentItem();
    }
                 if (($item->getQty() % 3) == 0)
                  {
                  $custom_price=5;
                  $item->setCustomPrice($custom_price);
                  $item->setOriginalCustomPrice($custom_price);
                  $item->getProduct()->setIsSuperMode(true);
                  }
                 else
                 {
                  $custom_price=5;
                  $rem=(int)(($item->getQty())/3);
                  $rowsubtotal=($rem)*(3)*($custom_price)+($item->getQty() % 3)*($item->getProduct()->getPrice());

                Mage::log($rowsubtotal);
                $item->setRowTotal($rowsubtotal);
                Mage::log($item->getRowTotal());
                 }
    }
    }


texts:
POSTMAN rest client with magento REST api with Oauth.

  How to get Token and Token Secret?

Magento REST API, how i will get token and token secret to be fill in Postman REST request. I have only consumer key and consumer secret. Please provide me the steps to follow.

Please tell me step by step each process.


texts: How do I persist data in custom table in Magento Database (the right way)?

texts:
I have created a module that adds a custom table.

I also created a Model, ResourceModel and Collection classes, and was able to use them to insert data into this new table by calling the ModelFactory class and saving (save()) the data.

But I am wondering if this is the best practice or if I should create Api interfaces for doing that, or/and using Service Contract even if I don't want this class in Magento API.


texts: Moving a vendor module to new cron group in magento 2

texts:
We are utilizing the Firebear module to import product and pricing data which run in the default cron group. The import takes quite a bit of time/resources so it was recommended to move the Firebear cron to its own group. The Firebear crontab.xml is currently setup like so:

vagrant/tmp/vendor/firebear/importexport/etc/crontab.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
    <job name="importexport_jobs_run_id" instance="Firebear\ImportExport\Cron\RunImportJobs" method="execute">
    <schedule>*/1 * * * *</schedule>
    </job>
    <job name="importexport_export_jobs_run_id" instance="Firebear\ImportExport\Cron\RunExportJobs" method="execute">
        <schedule>*/1 * * * *</schedule>
    </job>
    </group>
</config>

At a high level I will need to:
1 - create new cron group
2 - override Firebear crontab to run in new group

Any help on the process to accomplish this will be much appreciated.


texts: Static block not visible under admin panel->cms->static blocks

texts:
I want to add a static block programmatically.
The way I'm trying to do that is next:

I created file data-upgrade-1.0.0-1.0.1.php (there were none other
   files except data-install...) inside setup directory app\code\local\[theme]\Customizations\data\[theme]_customizations_setup
Added this code:

$stores = Mage::getModel('core/store')->getCollection()
    ->addFieldToFilter('store_id', array('gt' => 0))->getAllIds();

foreach ($stores as $storeId) {
    $block = Mage::getModel('cms/block')
        ->setIsActive(1)
        ->setTitle('Test CMS Static Block')
        ->setIdentifier('cms_block_test')
        ->setContent('<!-- edit me -->')
        ->setStores(array($storeId))
        ->save();
}

After that, I changed config.xml version 1.0.1
Cleared all Magento cache

But my static block won't show under CMS > Static Blocks.
Am I missing something?


texts: How to add content after or before block using XML in magento

texts:
I what to append content in block using XML file. Please check below image

I have added below code but it is overtiring content. (I want to appending).

<reference name="order_items">
      <action method="addColumnRender">
         <column>name</column>
         <block>adminhtml/sales_items_column_name</block>
         <template>sales/items/column/name.phtml</template>
      </action>
</reference>

I have checked core file there are creating block programmatically.


texts: Adding ability for custom quantity in multiple select bundle option

texts: I would like for the user to enter a specific qty per multiple select option in a bundle. I see where it writes it in the json to the default quantity. Can I update that? Or how would I go about doing this?


texts: Magento 2 Catalog Price Rules applied to special_price

texts:
Catalog price rules by default are applied to the "price" field.

I need to make the Catalog Price Rules applied to "special_price" field.

Default use
Example:
If price=100 , special_price=90 and the catalog price rule is 80% the final_price = 80, 80% of "price"

I would like the discount to apply to special_price:
Example:
If price=100 , special_price=90 and the catalog price rule is 80% the final_price = 72, 80% of "special_price"


texts: Magento 2 How to assign custom multiselect attribute values to product?

texts:
$_product->setData($attributeCode, $attributeValue);

I can assign "normal" attributes to product like that and those attributes are visible on product page and admin panel. If I want to assign multiselect attribute it does not work.

I tried to save it with random ids and just values but nothing works.

 $_product->setData($multiselectAttributeCode, '1,2,3');
 $_product->setData($multiselectAttributeCode, ['option1', 'option2', 'option3']);

When I create multiselect attribute (code below) multiselect attribute name is visible in stores/attibutes/product tab and also is visible in panel products/catalog (it is empty without values/options). I can not see it directly on product page even if try to save it like "normal" attribute.

        $multiSelectData = ['option1', 'option2', 'option3', 'option4', 'option5'];

        $data = array(
        'attribute_set'           => 'Default',
        'group'                   => 'Autosettings',
        'type'                    => 'text',
        'backend'                 => '',
        'frontend'                => '',
        'label'                   => $attributeLabel,
        'input'                   => 'text',
        'class'                   => '',
        'source'                  => '',
        'global'                  => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
        'visible'                 => true,
        'required'                => false,
        'user_defined'            => true,
        'default'                 => '',
        'searchable'              => true,
        'filterable'              => true,
        'comparable'              => true,
        'visible_on_front'        => true,
        'used_in_product_listing' => true,
        'unique'                  => false,
        'apply_to'                => '',
        'is_used_in_grid'         => true,
        'is_visible_in_grid'      => true,
        'is_filterable_in_grid'   => true,
    );

    //if attribute should be multiselect change attribute data
    if (!$multiSelectData === false and is_array($multiSelectData)) {
        $data['input'] = 'multiselect';
        $data['option'] = array('values' => $multiSelectData);
    }
    $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, $data);

Let say I want to assign multiselect attribute with values

option1, option2, option3 to Product1,

option3, option4 to Product2.

Only those values are visible on product page. Is there way to do it?


texts: I can't cancel orders. Integrity Constraint Violation

texts:
Whenever i try to delete an order, by entering the order and then clicking cancel, i get a "The order has not been cancelled" Message.

I tried deleting the order from the list, and issuing an action from it and i got this error:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`databasename`.`catalog_product_entity_int`, CONSTRAINT `FK_CAT_PRD_ENTT_INT_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DEL)

Trace:
#0 /home/cashapoy/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/cashapoy/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/cashapoy/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/cashapoy/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /home/cashapoy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /home/cashapoy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(1910): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#6 /home/cashapoy/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1463): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('catalog_product...', Array, Array)
#7 /home/cashapoy/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Action.php(84): Mage_Eav_Model_Entity_Abstract->_processAttributeValues()
#8 /home/cashapoy/public_html/app/code/core/Mage/Catalog/Model/Product/Action.php(72): Mage_Catalog_Model_Resource_Product_Action->updateAttributes(Array, Array, 0)
#9 /home/cashapoy/public_html/app/code/core/Mage/Catalog/Model/Product/Status.php(203): Mage_Catalog_Model_Product_Action->updateAttributes(Array, Array, 0)
#10 /home/cashapoy/public_html/app/code/core/Mage/Sales/Model/Order.php(1167): Mage_Catalog_Model_Product_Status->updateProductStatus('541', 0, 1)
#11 /home/cashapoy/public_html/app/code/core/Mage/Sales/Model/Order.php(1139): Mage_Sales_Model_Order->registerCancellation()
#12 /home/cashapoy/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(359): Mage_Sales_Model_Order->cancel()
#13 /home/cashapoy/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Sales_OrderController->massCancelAction()
#14 /home/cashapoy/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('massCancel')
#15 /home/cashapoy/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 /home/cashapoy/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#17 /home/cashapoy/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#18 /home/cashapoy/public_html/index.php(87): Mage::run('', 'store')
#19 {main}

What exactly is going on and what can i do about it?

The product that once belonged to that order has been deleted, but this had not been an issue until yesterday.

Any idea why this could be happening?


texts: Get ID of created product in middle of database transaction

texts:
I am doing a webapi for Magento 2.1 and i need to create configurable product and simple products and then linking it all up.

A psuedo-code normal transaction will look something like this.

//Initialize database transactionFactory
$this->transactionFactory:  \Magento\Framework\DB\TransactionFactory

$addTransaction = $this->transactionFactory->create();

try{

 //Point 1: Add simple products
 $simpleProduct = [....]
 $simpleProduct2 = [....]

 //Point 2: Add configurable product
 $configurableProduct = [....]

 //Point 3: Add to transaction
 $addTransaction->addObject($simpleProduct);
 $addTransaction->addObject($simpleProduct2);
 $addTransaction->addObject($configurableProduct );

 //Point 4: Form the relation
 .....

 //Point 5: Save transaction
 $result = $addTransaction->save();

}

*note:

  i am aware the above wouldn't work as the products have not been added
  to database yet at point 4, so i am not able to retrieve the IDs to
  form the relation.

So my requirement is to do a "transaction-save" BEFORE point 4, as i need to have the IDs of the simple products and configurable product before i can form the relation. But at the same time, have an option to rollback everything if any error comes up from point 4 onwards.

Any advice would be great. Thanks


texts:
We have Magento 2.3.0 and use the theme "Claue".

But with some of the translations, when I use the inline translations, I get a weird window with a lot of input field but no change to change the translation...

For example, I want to change the translation for "This is a required field." but I get this:

Does anyone know why this happens, is it theme based or is there a solution for this?


texts: Adding Customer Address / Quote Field Enterprise Only?

texts:
I am struggling to add a field to checkout addresses that persists to the database, I have found this question where Magento insist on knowing the version of Magento and state that the feature is only available in Enterprise, I had no idea this was a requirement for such a customisation.

Does anyone know if what I am trying to do is possible in community edition?

https://github.com/magento/magento2/issues/7571


texts: I wrote a shell script to remove old files inside /shell

texts:
I would like to move all files that are older than 24 hours. Currently I'm just deleting them. When I'm in the shell folder and I try to run the script in terminal: php clean_fc_export.php i get the error:

require_once 'abstract.php';

class Clean_Fullcircle_Old_Export_Files extends Mage_Shell_Abstract
{
    public function fclean()
    {
        /** define the directory **/
        $dir = "var/report/";

        /** cycle through all files in the directory */
        foreach (glob($dir."*") as $file) {
            /** if file is 24 hours (86400 seconds) old then delete it */
            if (filemtime($file) < time() - 86400) {
                unlink($file);
            }
        }
    }

    // Shell script point of entry
    public function run()
    {
    }

    // Usage instructions
    public function usageHelp()
    {
        return <<<USAGE
Usage:  php -f scriptname.php -- [options]
  --argname <argvalue>       Argument description
  help                   This help
USAGE;
    }

    // Instantiate
    $shell = new Clean_Fullcircle_Old_Export_Files();

    // Initiate script
    $shell->run();
}

PHP Fatal error:  Uncaught Error: Call to undefined function simplexml_load_string() in /var/www/lib/Varien/Simplexml/Config.php:510
Stack trace:
#0 /var/www/lib/Varien/Simplexml/Config.php(498): Varien_Simplexml_Config->loadString('<?xml version="...', 'Mage_Core_Model...')
#1 /var/www/app/code/core/Mage/Core/Model/Config.php(274): Varien_Simplexml_Config->loadFile('/var/www/app/et...')
#2 /var/www/app/code/core/Mage/Core/Model/App.php(391): Mage_Core_Model_Config->loadBase()
#3 /var/www/app/code/core/Mage/Core/Model/App.php(275): Mage_Core_Model_App->_initBaseConfig()
#4 /var/www/app/Mage.php(616): Mage_Core_Model_App->init('admin', 'store', Array)
#5 /var/www/shell/abstract.php(86): Mage::app('admin', 'store')
#6 /var/www/shell/clean_fc_export.php(44): Mage_Shell_Abstract->__construct()
#7 {main}
  thrown in /var/www/lib/Varien/Simplexml/Config.php on line 510

I looked inside my phpinfo() file and it shows that i have Simplexml loaded and active.

I'm running vagrant and VM with a lamp stack.
I made sure that extension=php_xmlrpc.dll was un-commented out in both /etc/php/7.0/fpm/php.ini and /etc/php/7.0/cli/php.ini


texts:
We Have a problem where by a category was deleted and then recreated causing problems as the id changed, Is it possible to restore just the product tables as do not want to loose changes which have occured to other tables such as orders, customers etc.

Has Anyone restored all the catalog_ tables and did it work? Or is there something which might cause further problems?


texts: Two layered navigation blocks on category page

texts:
I need two layered navigation blocks on the same page (one at the top with select dropdowns) and one in sidebar with more similar to default styling. Additionally, there could be restriction on attributes, so top and sidebar can have different attributes to filter.

My first thought was just make another instance of layered nav block and pass there different template file. But then it turned out that templates assignment is buried inside block logic.
So, I decided to override block and create there methods like excludeAttribute or setStyling, and then call them within layout file for each block. Unfortunately, this doesn't work either, I guess because the logic for getting attributes and setting up child blocks in located under _prepareLayout method, which is being called before my methods. Then I tried to defer this evaluation, by creating wrapper block file, which has my methods for passing attributes and styling and save that data. Then, in _toHtml method of my wrapper block I create my overridden layer_view block, and pass there these settings. Constructor of layer_view block handles that data and calls _prepareLayout method using them, assigning different templates for child blocks and getting customized attributes collection to filter.
Visually, that seems to work. I can set filters and both blocks are getting updated properly (though both shows global active filters). But for some reason filtering itself doesn't work (products in category stays the same). So in short: if I create my layer_view block within layout file the filtering works, but I can't pass anything there. If I create wrapper block which then creates layer_view block programmatically via $this->getLayout()->createBlock method, I can pass my settings but I lose filtering. What can possibly be wrong with creating this block programmatically?

Maybe I'm going in wrong direction and it should be done in different way?


texts:
I am using Magento 1.8.1.0 with multiple websites.
I followed the instructions to setup the multiple websites as described here: http://www.dbits.be/blog/index.php/How-To/magento-multi-store-setup-sub-folders.html

Create stores/views/sites
Set default URL (safe/unsafe) and Homepage for each store.
Create subfolders, files & symlinks
Edit index.php in each subfolder

I would say that my setup is working halfway:

www.mydomain.com/ is pointing to my base website. This website is working perfectly fine.

www.mydomain.com/paris/ is pointing to the Paris website homepage which is fine. The links in the menu all have the www.mydomain.com/paris/ subfolder part, so this seems to be working fine too.

Problem is when I try to access a category or a product within a secondary website, such as www.mydomain.com/paris/shirts/

This type of URL is redirecting to the main website homepage. So it seems Magento doesn't recognize urls of type www.mydomain.com/paris/xxxx to belong to the Paris website but is looking in the base website, can't find anything and redirects to the base website's homepage.

I am out of ideas on how to fix this, any suggestion would be highly appreciated.


texts: magento PayPal gateway has rejected request. Security header is not valid (#10002: Security error)

texts:
PayPal gateway has rejected request. Security header is not valid (#10002: Security error).
how to resolve it


texts: magento2.3 porto checkout error any idea why my magento will not check out

texts: <link  rel="stylesheet" type="text/css"  media="all" href="{{MEDIA_URL}}styles.css" />


texts: checkout_cart_update_items_before magento 2 not able to get product in this event

texts:
I'm using this code:-

public function execute(\Magento\Framework\Event\Observer $observer)
    {

        $infoDataObject = $observer->getEvent()->getInfo();
        $cart = $observer->getEvent()->getCart();

        foreach ($infoDataObject as $itemId => $itemInfo) {

           $item = $cart->getQuote()->getItemById($itemId);
           $product = $item->getProduct();

         }
          echo "<pre>"; print_r($product); echo "</pre>";
    }


texts: When I try to generate Fedex shipping label using magento version 2.2.6. The error is showing "Customs Clearance Detail is required."

texts:
If I try to change file Carrier.php  add 'CommercialInvoice' => ['Purpose' => "SOLD"], the error is showing like

[08-Feb-2019 12:20:39 UTC] PHP Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/mindbsoul/public_html/staging/vendor/magento/module-fedex/Model/Carrier.php on line 7

But there is no space on this page

kindly suggest


texts: Magento 2: How to Automatically Create Invoice from Order Observer

texts:
I'm testing on Magento 2.2.3 and I've created an observer for the event sales_order_save_after which I'm using to automatically create an invoice.

Here is the current error that I'm receiving after placing an order:

Order saving error: Rolled back transaction has not been completed correctly.

And my MyCompany/MyModule/Observer/SalesOrderSaveAfter.php

<?php
namespace MyCompany\MyModule\Observer;

use Magento\Framework\Event\ObserverInterface;

class SalesOrderSaveAfter implements ObserverInterface
{
    protected $_invoiceService;
    protected $_transactionFactory;

    public function __construct(
      \Magento\Sales\Model\Service\InvoiceService $invoiceService,
      \Magento\Framework\DB\TransactionFactory $transactionFactory
    ) {
       $this->_invoiceService = $invoiceService;
       $this->_transactionFactory = $transactionFactory;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();

        try {
            if(!$order->canInvoice()) {
                return null;
            }
            if(!$order->getState() == 'new') {
                return null;
            }

            $invoice = $this->_invoiceService->prepareInvoice($order);
            $invoice->setRequestedCaptureCase(\Magento\Sales\Model\Order\Invoice::CAPTURE_ONLINE);
            $invoice->register();

            $transaction = $this->_transactionFactory->create()
              ->addObject($invoice)
              ->addObject($invoice->getOrder());

            $transaction->save();

        } catch (\Exception $e) {
            $order->addStatusHistoryComment('Exception message: '.$e->getMessage(), false);
            $order->save();
            return null;
        }
    }
}

If I remove the transaction portion of the code, eg:

$transaction = $this->_transactionFactory->create()
    ->addObject($invoice)
    ->addObject($invoice->getOrder());

    $transaction->save();

then the order will pass through with the products marked as invoiced, but no invoice is actually created or saved to the order.

Any ideas what I could be missing?


texts: Magento 2 allow navigation to update without cacheable="false"

texts:
In my main nav I have link and the url changes based upon if the customer is logged in. If the customer is login in the link is /shop/trade else the link is /trade.

My code is the following:

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()){
    echo '/shop/trade';
}
else{
    echo '/trade';
}
?>

The issue is though the block is being cached and thus the user does not see the updated link when logged in. I looked at using cacheable="false" on the block but I learnt this will disable caching on all pages since the nav is on all pages.

Whats the best way to sort this?


texts:
I am hosting my magento 2 shop at all-inkl and unfortunately I can only use a "cgi bridge" to call the cron.php via a web cron job.

I have built that bridge which looks like that:

<?php
exec("/bin/bash cron.php  2>&1", $out, $result);
echo "Returncode: " .$result ."
";
echo "Script:" ."
";
echo "
"; print_r($out);
?>

my cron.php looks like that:

#~ MAGENTO START
* * * * * /usr/bin/php /www/htdocs/USER/magento2/bin/magento cron:run | grep -v Ran jobs by schedule >> /www/htdocs/USER/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /www/htdocs/USER/magento2/update/cron.php >> /www/htdocs/USER/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /www/htdocs/USER/magento2/bin/magento setup:cron:run >> /www/htdocs/USER/magento2/var/log/setup.cron.log
#~ MAGENTO END

But if I open the bridge file via my browser, I get this error:

  Returncode: 127 Script: Array (
      [0] => cron.php: line 2: /bin/grep: Permission denied

[1] => cron.php: line 2: CHANGELOG.md: command not found
[2] => cron.php: line 3: CHANGELOG.md: command not found
[3] => cron.php: line 4: CHANGELOG.md: command not found

  )

I have no idea how to get those cron jobs running.


texts: change configurable product detail page layout

texts:
is it possible to change layout of product detail page of configurable products via custom modules instead of changing config.xml and other core files .

please prodive better wayto do this


texts: How to add Shipping Rate while creating Order programmatically

texts:
Shipping Method addition is happening as it should be. But, Shipping Rate as per the Shipping method or, custom Shipping rate is not getting added to the order.

$address = $quoteObj->getShippingAddress ();
$address->setCollectShippingRates ( true )->collectShippingRates()
        ->setShippingMethod('flatrate_flatrate');
$quoteObj->collectTotals ()->save ();

Searching through some other questions I found a solution which adds Custom Shipping Rate to the order, but it doesn't add the shipping rates to Grand Total.

$shippingprice = 0.9;
$orderObj->setShippingAmount($shippingprice);
$orderObj->setBaseShippingAmount($shippingprice);


texts: Pricing condition not working in widget section for Product showing from Backend

texts:
I'm trying to create widget from backend for showing the particular some product list in home page.

But when i'm giving pricing condition like below, the condition is not working and the UI portion going blank.

How to solve this issue. Please help. Is this condition workable?
Please suggest me any option. Thank You


texts: Trying to reproduce (and fix) "options is undefined" in customer-data:90

texts:
We are sporadically facing the following problem when on /checkout/cart/. As an effect, clicking on "Proceed to checkout" does not work.

We believe the proceeding is not working because of the following javascript error being logged:

The problem was reproducible on two machines, even after reloading the full page. But now is no longer.

I had a look at the code in line 90

    getFromServer: function (sectionNames, forceNewSectionTimestamp) {
        var parameters;

        sectionNames = sectionConfig.filterClientSideSections(sectionNames);
        parameters = _.isArray(sectionNames) ? {
            sections: sectionNames.join(',')
        } : [];
        parameters['force_new_section_timestamp'] = forceNewSectionTimestamp;

/** Line 90 **/ return $.getJSON(options.sectionLoadUrl, parameters).fail(function (jqXHR) {
            throw new Error(jqXHR);
        });
    }
};

So obviously the options are not loaded somehow -- but they are in the constructor, so how can this be?

Happy for any help.

EDIT

I traced the problem down to a module where we interact with customer-data.

We have the following code:

define([
    'jquery',
    'Magento_Customer/js/model/authentication-popup',
    'Magento_Customer/js/customer-data'
], function ($, authenticationPopup, customerData) {

    customerData.reload(['minvalue'],true).done(function(){

In some cases this code seems to be called before the constructor

vendor/magento/module-customer/view/frontend/web/js/customer-data.js:366

    'Magento_Customer/js/customer-data': function (settings) {
        options = settings;
        invalidateCacheBySessionTimeOut(settings);
        invalidateCacheByCloseCookieSession();
        customerData.init();
    }

Question: How can I force my code to be run, after the constructor was run?


texts: Mage::getUrl with _use_rewrite returns invalid URL for catalogsearch

texts:
I need to print a URL on a template that leads to the search page with the search query parameter already predefined.

This is the code I have at the moment:

$url = Mage::getUrl('catalogsearch/advanced/result', array('_use_rewrite' => true, '_query' => $query));

Where $queryis an array containing the search, e.g. $query['flavor'] = "bacon" to search using attributes.

If I understand correctly, _use_rewrite should check if there is any URL rewrite already in place, and return that URL instead. I will use URL rewriting later on, but at the moment there is not any rewrite defined, so I assume it should return just the regular URL.

Somehow, the getUrl function doesn't return the search URL correctly when _use_rewrite_ is set to true, and it instead returns the base store URL without the catalogsearch module on the URL. I.e.:

  http://mystore.local/?flavor=bacon

But if _use_rewrite is set to false, it prints the URL correctly:

  http://mystore.local/catalogsearch/result/?flavor=bacon

Is everything working as expected?


texts: Magento 2.3 How to overrride paid theme template?

texts:
I am working in magento 2.3.0 with paid theme. I want to override paid theme templates without changing theme files. So that in future if theme updates my functionality still remains.
How can I do this ?


texts: Magento 2 Facing Problem :Could not save product "3194" with position 0 to category 12

texts:
I am facing a problem whenever I go into

  catalog->products->edit product and delete the category from product
  and click on save button the error is coming. Could not save product
  "3194" with position 0 to category 12.

This is happening with my all products.

I have searched a lot on this error but could not found a proper solution for that.

Please See Image below for more clarity.


texts: Show deactivated/disabled products in comparison view

texts:
I am trying to show a product in comparison view, which is set as status = disabled through admin panel.

In default magento, this seems not possible as the disabled products are not visible in product listing page as well as product details page.

Somehow, I managed to show the disabled products in product listing page and product details page by overriding Mage_Catalog_Helper_Product.  In that I commented the following code:

    // if (!$this->canShow($product)) {
    //     return false;
    // }

Now, please someone help me on how to show up the disabled product even in comparison view?


texts:
I'm facing this strange issue on add to cart action:

sometime after I checkout (with a registered customer) correctly my order, if I try to purchase another item I got the following error:
Call to a member function setFinalPrice() on a non-object in app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php on line 73

I have debugged the code and found out that the issue is created by some old quotes associated to my user that are still active and have not items associated with it.

If I check the problematic quote in the Db it has items_count = 0 any way Mage_Sales_Model_Resource_Quote_Item_Collection::_assignProducts()method try to load an item using null as Id :

 $product = $productCollection->getItemById($item->getProductId());

This trigger the above error.

Now the fast fix it to set to is_active = 0 in all these quote, something like:

 UPDATE `sales_flat_quote` SET  `is_active` = 0 WHERE `is_active` = 1 AND `items_count`= 0 and customer_id is not null and customer_id <> 0

Question

Anyway I would like to understand the following points:

Is it normal to have old quotes (also multiple for same user) with 0 items and is_active = 1  ?
Is ok to delete all these quotes ?  ( I have 10000+ quotes like this )

Any suggestion is welcome


texts: How to get frontend product url when adding new product in admin using catalog_product_save_after event

texts:
I want product frontend url when admin adding new product. we use catalog_product_save_after event in this event we will get all information about product except product url

public function addNewproduct($observer) {

        $product = $observer->getEvent()->getProduct();
    $product->getName();
    $product->getShortDescription();
    Mage::getBaseUrl( Mage_Core_Model_Store::URL_TYPE_WEB, true ).$product->getUrlPath();// not get this product url path

}


texts: CDATA in my .xml is creating orphan /> closing tag in

texts:
When I made my child theme, I wanted to extend the local.xml of the parent theme, so instead of creating my own local.xml (which would replace the parent one instead of extending it), I created a customlocal.xml and added it via my theme.xml. However, my new CSS file is loading first before all other css files, which is really dumb for a parent-child theming scheme. I found this postthat explained that xml with if statements are loaded afterward, so I put an empty if statement in my xml:

        <action method="addCss">
            <stylesheet>css/mycustomcss.css</stylesheet>
            <if><![CDATA[<!--[]><!-->]]></if>
        </action>

This did work and load my CSS after the parent themes, but now I'm getting an orphan html closing tag right after my :

<body class="catalog-product-view" cz-shortcut-listen="true">/&gt;

The /&gt renders as /> on the page, before the header and all other content. Does anyone know how I correctly use an empty CDATA to get my css to load in the expected position?

PS also, in my css link in the head, <!--[]="" is being added in at the end:

<link rel="stylesheet" type="text/css" href="http://localhost/mylift/store/skin/frontend/custom/default/css/mycustomcss.css" <!--[]="">

and <!---->is also showing up right before the closing tag of the


texts:
from My magento How Can i Get Recent Viewed Product in my new Block

![i got the related products but how can i get recent viewed Products.......?
]1


texts: Magento 2.3.4: Product Views Report Not Working

texts:
I am using Magento 2.3.4, I have issue with product view reports. All reports are working well, except product view.
I have checked Time Zone as well as refreshed statistics lifetime. I tried all possible ways, but I am not getting  any result. I also checked in relevant in database which remain  empty. Also report_event table is empty all the time. For more info please check the screenshots attached below.

1) Dashboard Most Viewed Products are Empty.

2) Product Viewed Reports Empty

3) Statistics Lifetime Refreshed

4) All relevant tables remain empty


texts: Question about disabled cookie consent (Magento 1.9.3.7)

texts:
Normally speaking, the Cookie Restriction Mode is enabled in order to notify visitors that cookies are required for full-featured operations. The message links to the privacy policy for more information, and encourages visitors to click the Allow button to grant consent.

So does this mean that if the Cookie Restriction Mode is disabled, all cookies will be placed by default? I read that for some webshops, no consent is really needed, so I wondered if -in this case- it's enough with disabling the Cookie Restriction Mode, and all cookies would be placed.


texts: I install Magento 2, but i have one problem, after i login in the Admin Panel, my admin is look very strange. And i see the frontend is the same. Any idea why?


texts: Magento2: How to include third pary module through composer.json in custom module

texts:
I created a custom module, this module depends on thirt party module(tecnickcom/tcpdf), I added this library in my custom module composer.json file

{
"name": "packagename/mymodule",
"description": "N/A",
"require": {
    "php": "~5.5.0|~5.6.0",
    "magento/magento-composer-installer": "*",
    "tecnickcom/tcpdf":"*"
},
"type": "magento2-module",
"version": "2.0.0",
"license": [
    "GPL-3.0"
],
"autoload": {
    "files": [
        "registration.php"
    ],
    "psr-4": {
        "Packagename\\Mymodule\\": ""
    }
}

}

when i run this composer.json file its create vendor folder in my custom module and download "tecnickcom/tcpdf" library, but it should be in root vendor folder. how can i achieve this.


texts: Unable to get inventory status of configurable products

texts:
I am having some trouble and perhaps a few people here can expand my knowledge.  Here is the code I am using to retrieve some information about a product on my cart page.

    if($product->getTypeId() == "configurable"){
        $sku = $_item->getSku();
        var_dump($sku);
        $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
        $invStatus = $product->getResource()->getAttribute('product_inventory_status')->getFrontend()->getValue($product);
        var_dump($invStatus);
        $quantity = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
        var_dump($quantity);

If the product is found to be configurable I retrieve the sku of the simple product it is associated with and then set the product to that configured simple product.  I then get the inentory status and the quantity of that product.  And this is where the issue arises.  This is the result of that vardump:

string(6) "421199" string(2) "No" string(6) "1.0000"

When a similar methodology is enacted upon simple products I receive the following from the following code:

        var_dump($product->getSku());
        $invStatus = $product->getResource()->getAttribute('product_inventory_status')->getFrontend()->getValue($product);
        var_dump($invStatus);
        $quantity = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
        var_dump($quantity);

.

string(4) "DWCP" string(1) "Z" string(6) "0.0000"

The inventory status is definitely also set from the admin panel.  Any suggestions or incites would be appreciated.

--

Also, if I add the simple product as the item itself (from another part of the site) then the string resolves to the correct value.  It's when I'm fetching the product in this manner that non-resolvency becomes apparent.

Why doesn't magento handle products uniformly?? It makes NO sense at all.


texts: How to disable Paypal auto inovice generator in Magento 1.9.1

texts:
I need to disable the generating of invoices when the payment method is PayPal.

I already tried this solution, but it doesn't work on Magento 1.9:
How to stop auto invoice generation with Credit Card or Paypal payment methods


texts: Display the blank page on the SEARCH TERMS page

texts:
I can see some search queries on MARKETING, SEO & SEARCH, Search Terms of the admin page. However, the SEARCH TERMS page of frontend displays the blank.

Some people mentioned hat this error happens in version 2.1 even though it works in version 2.0.7.

I appreciate if you give advice or solutions.

Thank you.


texts: How to add custom data in order payment extension attribute rest api in magento2

texts:
I want to add custom data in order payment extension attribute like below :-

"payment": {
                "account_status": null,
                "additional_information": [
                    "Credit Card",
                    "M",
                    "M",
                    "I",
                    "FXZDM9",
                    "1000",
                    "Approved",
                    "xxxx-1111",
                    "Visa"
                ],
                "amount_authorized": 31.9,
                "amount_ordered": 31.9,
                "amount_paid": 31.9,
                "base_amount_authorized": 31.9,
                "base_amount_ordered": 31.9,
                "base_amount_paid": 31.9,
                "base_amount_paid_online": 31.9,
                "base_shipping_amount": 9.95,
                "base_shipping_captured": 9.95,
                "cc_exp_month": "12",
                "cc_exp_year": "2030",
                "cc_last4": "1111",
                "cc_trans_id": "m4ybzfr7",
                "cc_type": "VI",
                "entity_id": 70659,
                "last_trans_id": "m4ybzfr7",
                "method": "braintree",
                "parent_id": 80005,
                "shipping_amount": 9.95,
                "shipping_captured": 9.95,
                "extension_attributes": {
                    "vault_payment_token": {
                        "entity_id": 34386,
                        "customer_id": 76756,
                        "public_hash": "f0ad9e74cc52a78f499d318ee9e55fb479b0a757dbecb10849fbf960a5e84c5b",
                        "payment_method_code": "braintree",
                        "type": "card",
                        "created_at": "2017-11-15 13:20:54",
                        "expires_at": "2031-01-01 00:00:00",
                        "gateway_token": "7jfdwj",
                        "token_details": "{\"type\":\"VI\",\"maskedCC\":\"1111\",\"expirationDate\":\"12\\/2030\"}",
                        "is_active": true,
                        "is_visible": false
                    }
                "custom_data": {
                        "key1" => "value1",
                         "key2" => "value2"
                  }
                }
            },

as above you can see, I want to add this

"custom_data": {
                        "key1" => "value1",
                         "key2" => "value2"
                  }

I have no idea how to do it, can anyone suggest me ?


texts: Magento 2 rating add custom filter add in product page review tab

texts:
i need a filter review by name or date and by sort in magento 2.3
product review tab , so customer can easily search best review how can implement this functionality?


texts: Magento custom closing round bracket disappears when product has custom options

texts:
Can somebody please help me figure out why my closing brackets ) surrounding the "price-including-tax" value in price.phtml are ignored/overwritten when I add custom options to my simple products?

It occurs with every product as long as it has custom options (Magento default and Mageworx Advanced Product Options alike)

Example of opening and closing brackets showing correctly on product page:
here

And an example when they just magically disappear...
here

Thanks in advance :)

--

edit

The code in price.phtml resposible for this is as follows:

(<?php echo $this->helper('tax')->__('Incl. Tax:') ?>
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php echo $_coreHelper->formatPrice($_finalPriceInclTax, false) ?>)


texts:
I'm trying to test the SOAP API in my Magento Community install.

I created a role, a user  and a PHP file containing:

$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // Of course I inserted my url here
$sessionId = $proxy->login('apiUser', 'apiKey'); // And my user and API key

$result = $proxy->catalogCategoryTree($sessionId);
var_dump($result);

The result is a completely blank page, although I do have some categories in the shop.

Does anybody recognize this and know how to remedy it?

Thanks in advance!


texts:
I need to show order comment in file

  vendor/magento/module-sales/view/frontend/templates/order/history.phtml

I tried to use the code:

<?php $_history = $_order->getVisibleStatusHistory() ?>
<?php if (count($_history)): ?>

<?php foreach ($_history as $_historyItem): ?>

<?php echo $_historyItem->getComment()?>

<?php endforeach; ?>

<?php endif?>

Did not work.


texts: How to add module template on theme template


texts:
I installed Magento 2 with sample data and NO extensions so far. Now I wanted to install a bought extension and in the installation-guide is a pointer to System -> Magento Connect -> Magento Connect Manager. But under System there is no Magento Connect.
So I searched a little bit by myself and found a hint under http://192.168.xxx.xxx/Magento/downloader should be the side I am searching, but there is only a "404 Not Found"-Site.  Under System -> Integrations I found a point where you can activate some things. So I tried and activated the point "Available APIs" ->

System
    Magento Connect
       Connect Manager
       Package Extensions

But even after a relog as Admin, there is still no Magento Connect to see under System. Where could it be?


texts: How to update the shipping Address of an order?

texts:
I have created an placeorder function that is placing order programmatically. Now, I need to another function which can update the shipping address of an order.
I am using the below code, but it is giving error Call to a member function getId() on boolean in.

Please help me if anyone idea about this.

                $order = Mage::getModel('sales/order')->load($data['orderId']);

                $orderShippingAddress = $order->getBillingAddress()->getId();
                $orderShipping = Mage::getModel('sales/order_address')->load($orderShippingAddress);
                $shippingAddress
                    ->setPrefix($data['prefix'])
                    ->setFirstname($name[0])
                    ->setLastname($name[1])
                    ->setEmail($data['email'])
                    ->setCompany($data['houseNo'])
                    ->setStreet(array(
                         '0' => $data['area'], // compulsory
                         '1' => $data['landmark'] // optional
                     ))
                    ->setCity($data['city'])
                    ->setCountry_id('IN')
                    ->setRegion($data['state'])
                    ->setRegion_id($region_id)
                    ->setPostcode($data['pincode'])
                    ->setTelephone($data['telephone'])
                    ->setFax($data['bulidingName'])
                    ->setSaveInAddressBook(1)
                    ->save();


texts: Magento 2.4 | Filters are no longer seen with Elasticsuite

texts:
I have updated Magento to version 2.4.2 and have also activated Elasticsuite as the default search engine.
Elasticsuite installation went smoothly and the module is correctly installed. The search bar works fine but in the category page you can no longer see the Magento default filters, namely Color and Size. The price filter, on the other hand, is there but does not show prices correctly.
Before I installed Elasticsuite:

After installing Elasticsuite:

I have already run all the commands to reindex and update Magento but the problem persists.
How can I do?


texts: (display me) all the event names which are fired by the magento when any event or events occurs

texts: In Magento, how can I see all the event names which are fired when an event occurs in the frontend or backend (after some customer or admin action)?


texts: Trouble while getting product collection in observer

texts:
i am trying building a small module which house a Observer for getting called when and event called when catalog_product_import_profile_after is fired this is custom event which i have fired using the

Mage::dispatchEvent('catalog_product_import_profile_after',array('adapter'=>$this));

in the app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php file

My module config.xml is

<?xml version="1.0"?>
<config>
  <modules>
    <GWB_ClearOrphan>
      <version>0.1.0</version>
    </GWB_ClearOrphan>
  </modules>
  <global>
    <helpers>
      <clearorphan>
        <class>GWB_ClearOrphan_Helper</class>
      </clearorphan>
    </helpers>
    <models>
      <clearorphan>
        <class>GWB_ClearOrphan_Model</class>
        <resourceModel>clearorphan_mysql4</resourceModel>
      </clearorphan>
    </models>
    <events>
      <catalog_product_import_profile_after> <!-- identifier of the event we want to catch -->
        <observers>
        <catalog_product_import_profile_after_handler> <!-- identifier of the event handler -->
        <type>model</type> <!-- class method call type; valid are model, object and singleton -->
        <class>clearorphan/observer</class> <!-- observers class alias -->
        <method>disableProducts</method>  <!-- observer's method to be called -->
        <args></args> <!-- additional arguments passed to observer -->
            </catalog_product_import_profile_after_handler>
        </observers>
      </catalog_product_import_profile_after>
    </events>
  </global>
</config>

and the Observer.php is

<?php
class GWB_ClearOrphan_Model_Observer
{

        public function disableProducts(Varien_Event_Observer $observer)
        {
            //mail('kapil_gupta@gowebbaby.com','sub-test','msg-test');

            try{
                $collection = Mage::getModel('catalog/product')->getCollection();

                $pro_collection = var_dump($collection);
                mail('kapil_gupta@gowebbaby.com','collection',$pro_collection);

            }
            catch(Exception $e) {
                //Mage::log($e->getMessage(), null, 'collection.log');
            }

 }

the mail under the disableProducts function is working correctly but i am not able to get the product collection using this code $collection = Mage::getModel('catalog/product')->getCollection();

any body having any idea about what i have made wrong kindly point it out.
Thanks.


texts: Add HTML attribute for field in checkout

texts:
it's possible add custom attribute in div (or input) that contain field of checkout in $jsLayout array?

In my case i want add tabindex attribute


texts: Magento | Add border for a specific product in in the products' table of order confirmation email

texts: How can we add a border for the tbody of a specific product in the products table of order email template?


texts: How to use Marketplace Extension in Magento 2?

texts:
I have a task regarding seller registration. We have installed Marketplace extension in Magento 2 but I don't have any idea how to use this extension.

Could anyone please help with this?

Regards,


texts: Magento 2.2 Shopping options sidebar should display on sub category

texts:
Currently this shopping options displays only on main category page.
How to display this shopping options under sub category page navigation?


texts: How to display category details for update?

texts:
I want to update categories in Magento but the problem is when I click to a sub-category (e.g. Desktop) the details of that category doesn't show up in the "General Infomation" form.

General Infomation form -- doesn't display the details of selected category

Also, the number of products in other categories displays zero (0) but there's data exist when you collapsed one of the sub-category.

I did some research and I found these solutions, but I'm not sure if these are safe:

In System > Index Management: I didn't do "Reindex Data" action
In System > Configuration > Catalog > Frontend (section): My Use
Flat Catalog Category and Use Flat Catalog Product is set to No

Should I reindex data and set both flat catalog to yes? To solve my problem?

This is the error in console log:
POST https://www.macram.com.au/index.php/administrator/catalog_category/edit/key/a78831fe3d7241461e5a23306dd6d58e/?isAjax=true 403 (Forbidden)

PS: Front-end is working, doesn't have any problem on displaying the data.

The version of magento we're using is 1.9


texts: Magento 2 Get Attribute option Id issue with core method

texts:
I am using below code to get the option Id with an attribute value/label in a custom extension.
/*
* Get attribute id based on option value
*/
protected function getAttributeOptionId($attributeCode, $label)
{
    $productResource = $this->productFactory->create();
    $attribute = $productResource->getAttribute($attributeCode);
    if ($attribute->usesSource()) {
        return $optionId = $attribute->getSource()->getOptionId($label);
    }
}

This works fine in most cases. When I do a call with params color and red it works just fine.
But there is an issue when i call it with for instance attribute size with value 20. This only happens when there is an attribute label/value with id 20. It just returns the first occurrence it finds (20 as a label or as an id).
I did some research and I found out why this is. Below code is the part which returns the id. The second part in the OR condition $option['value'] == $value causes my issue. It looks for a match in the label OR value (which is the id). It just returns the first one found. I looked in the class there is no alternative method without the OR condtion.
/**
* File: /vendor/magento/module-eav/Model/Entity/Attribute/Source/AbstractSource.php
* @param string $value
* @return null|string
*/
public function getOptionId($value)
{
    foreach ($this->getAllOptions() as $option) {
        if (strcasecmp($option['label'], $value) == 0 || $option['value'] == $value) {
            return $option['value'];
        }
    }
    return null;
}

My question is.
What is the best way to solve this? Is there an alternative way to get an id from a attribute label? Or should I rewrite the method? Or maybe extends the class and use a custom method? In any of these cases I would be glad to see an example or a place to start.


texts: Magento 2 TTFB is very large for a JSON response from a simple controller

texts:
It takes about 1.5s to show the result on Chrome (1.X seconds are TTFB) according to record of Chrome's network tool.
My Magento is using redis for caches, and the caches are turned on.
How come the controller taking so long time to response?

use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\Controller\Result\RedirectFactory;

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

     /**
     * @var \Magento\Framework\Controller\Result\RedirectFactory
     */
    protected $resultRedirectFactory;

    /**
     * @param Context $context
     * @param PageFactory $resultPageFactory
     * @param \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        $this->resultRedirectFactory = $resultRedirectFactory;
        parent::__construct($context);
    }

    /**
     * Customer order history
     * return json
     * @return \Magento\Framework\View\Result\Page
     */
   public function execute()
    {
       $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
       $resultJsonFactory = $objectManager->get('\Magento\Framework\Controller\Result\JsonFactory');
       $result = ['status'=>'OK'];
       return $resultJsonFactory->create()->setData($result);
    }
}


texts: Add Product to cart Same item duplicated

texts:
I am trying to add items to my cart in a custom module and have it half working.

The problem is that it adds the same item in place of every other item.

PHP:

  $products = json_decode($_POST['products'], true) ?? array();

  foreach($products as $purchase){
    $productId = $purchase['productid'];
    $qty = $purchase['quantity'];
    $params = "";
    $params = array(
                  'form_key' => $this->formKey->getFormKey(),
                  'product' => $productId,
                  'qty'   => $qty
              );
      //Load the product based on productID
      $_product = $this->product->load($productId);
      $this->cart->addProduct($_product, $params);
      $this->cart->save();
  }

The products variable contains data similar to this:

[{"productid":"2181","quantity":"1"},{"productid":"2185","quantity":"1"},{"productid":"2189","quantity":"1"},{"productid":"2192","quantity":"1"}]

If this data was used in the php code, it would add the item with productid 4 times, instead of each item once. I am guessing it is something to do with either the $params array or the $_product variable not being reset at the start of the foreach.

How do i make each of the items add correctly with the quantity specified, and also, do i want to be calling this line $this->cart->save(); inside or outside of the foreach?


texts: Order total not showing including tax in shopping cart

texts:
We are having a problem in our Magento 2 shop. All tax settings are set and everywhere he is showing the tax good, so also in the checkout and on orders, the only place were he is not showing the price including tax is in the shopping cart.

We have set the tax settings as shown below and should be good. We also tried to set the "include tax in order total" to no, but this is also not working.

Does anyone know how we can fix this?


texts: Can't login to account after migration 1.6 to 2.3

texts:
I have migrated all my Db from a Magento 1.6.0 to Magento 2.3.3 all the products are ok and I was able to create an Admin account. But when I tried to login using the old account. It was not able to log me in and saying The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later. I'm not sure what went wrong as I didn't get any error. Is there a way to fix this?

Note: I already editted the crypt key to the migration script in opensource-opensource/1.6.0/config.xml


texts:
Can someone guide me on where I can find the issue the validator is concerned over?  This is Magento 2.3.4, and the database has gone through data migration.  There are several products that when I display them and then try to save I get an error, the message in the log is what appears in the title of this post.

  [2020-03-01 17:36:03] main.DEBUG: Request validation failed for action
  "Magento\Catalog\Controller\Adminhtml\Product\Validate\Interceptor" []
  []

I have been unsuccessful in finding a place in the code but have determined a breaking point by trial and error. I created a new product and gave each a drop down with 5 values.  The system will allow 9 of these options with 5 values each for the drop down.  Anymore than that, another option or another drop down value will give me the error.

So it seems to either be a Magento 2 issue or an interface issue into the database?
All I get on the backend is that I received a technical issue and try again later and the debug file points to an interceptor.  I am getting hits on it within the request and response functions but never have I been able to print large amounts of data like an object from Magento2  without crashing the system.  Any hints here would be greatly appreciated.

These products are currently in Magento 1 with up to 8 options and various drop downs, radio buttons and text fields associated with each option.

Any help would be appreciated, Thanks in advance..!


texts: Magento 1.9 Error when add associated products to a configuration product in admin

texts:
I've been working with Magento 1.9 for a while and to create a configurable product is not any problems to me, but I just encountered an weird issue with adding associated products to a configurable product on one of my Magento site.

When I fill out simple product (Associated product) info and click on Create, nothing happens but only a javascript box that is keep loading.

Any one have experienced similar issues and any fixes to this?


texts:
I have one magento live store in working condition, but now client want to change whole home page design. so now I need to create new package or just new theme?I have html theme.

can any one suggest me? Or also tell me what is the best way to change only home-page design.


texts: Google Recaptcha Issue on Showing the in Product Review

texts:
I have Installed the Google Recaptcha, and i was enabled the extension and entered successfully Site and Security Key. There was no Captcha in the Product Review Tab. Please Anyone Help me.?

I have used this extension.
enter link description here


texts: Magento2 - Admin grid Filter tab always show active

texts:
How to make admin panel grid filter on all the page. Tab always show active.

Like a shared screenshot.


texts: I have the problem that my main site is not working, while my other store view is working. I have an idea that it might be because the base URL i wrong. Therefore I would like to see the difference between my store views base URLs in the database. How do I find them?


texts: Add js to magento head in frontend and adminhtml without creating a requirejs module and loading last on module

texts:
I'm trying to add a simple js that has to be executed on documentReady with jQuery.

Script js

/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define([
    'jquery',
    'domReady!',
], function ($) {
   //Script code
});

Also, it needs to be on a module, not a theme, on every page, adminhtml and frontend.
I've tried adding the script with a default.xml like this

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

However, this puts the script before every other script, including require-js and jQuery.

I know i can make it a module and then a block that loads the module, but i cannot understand how to do that, and i've been on the second page of google checking for answers on multiple searches.

I've also tried this answer https://magento.stackexchange.com/a/131635, but then, the script never gets loaded.


texts: Don't Sort by Name when have Mysql Search Engine Magento 2.4.1

texts:
I installed the Weltpixel AjaxLayeredNavigation extension and with the Swissup extension of Mysql Legacy Search Engine, having both activated when I want to sort by name gives me the following SQL error: Column not found: 1054 Unknown column 'nameasc' in 'order clause'
If someone has gone through a similar error please it would be of great help.


texts: Magento 2 : How can I add an extra path to the DirectoryList

texts:
I want to be able to make Magento aware of an extra folder in my root called private_files. I thought I could do this by adding the following to my di.xml:

<!--
    Make Magento aware of an extra directory:
-->
<type name="Magento\Framework\Filesystem\DirectoryList">
    <arguments>
        <argument name="config" xsi:type="array">
            <item name="private_files" xsi:type="array">
                <item name="path" xsi:type="string">private_files</item>
            </item>
        </argument>
    </arguments>
</type>

So I could get the directory in my code like so:

$mediaDirectory = $this->fileSystem->getDirectoryRead('private_files');

Unfortunately, this doesn't work. Why is this? I noticed that if I make errors in my XML on purpose they don't get picked up if I put a die() in Magento\Framework\Filesystem\DirectoryList::assertCode().

Can magento/framework-classes and settings not be manipulated with di.xml?


texts: Is it possible to assign different categories to the same product, by Store View?

texts:
everyone.

I have a little problem, and I hope you can help me. Suppose I have a Site that has two Websites: Website1 and Website2. Respectively each has its StoreView1 and StoreView2:

--Website1
----StoreView1
--Website2
----StoreView2

And I haven the next Category structure:

--Default Category
----Shoes
----Outlet
------Shoes

So, if a Product is Shoes, It should be assigned to Category Shoes. In additional, if the product is Outlet, It should be assigned to Outlet > Shoes. But, a product can be Outlet in StoreView1 but not in StoreView2. So, I need that the product in StoreView1 to be assigned to Shoes and Outlet > Shoes, but in StoreView2 to be assigned only to Shoes.

But, when I try it:

$product = Mage::getModel('catalog/product')->setStoreId(<id of StoreView1>)->load(<Product Id>);
$product->setCategoryIds(array(<Shoes id>, <Outlet > Shoes Id>)->save();

$product = Mage::getModel('catalog/product')->setStoreId(<id of StoreView2>)->load(<Product Id>);
$product->setCategoryIds(array(<Shoes id>)->save();

The product always take the last categories I assigned. In other words, it assigns the categories to all stores equally, instead of assigning per store. I tried in Admin, changing product categories, positioned on the scope of the store view, but also the change is reflected in the other store view too. Are product categories always global? Is there no way to assign them for Store View?

Thanks for the help.