texts: Add Custom Attribute to New Order Email Magento 1.7

texts:
I added a custom attribute in to my default product type like so

Attribute Code: mfgpartnumber
Attribute Label:  Manufacturer Part Number

This attribute is used to add products in Magento backend and I want to include this attribute in new order emails. I have researched so far and here is what I finally added

<?php $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getSku(), array('mfgpartnumber')); ?>
<?php echo $product->getAttributeText('mfgpartnumber'); ?>

To /home/txsystems/store/app/design/frontend/base/default/template/email/order/items/order

That did not work, please can someone point me in the right direction on how to add custom attribute to Magento new order emails.


texts: how magento getting configurable product lowest price of associated products?

texts:
In view page by default magento displaying lowest price of associated products.

I need to display highest price of associated products.
Any one have idea where the logic is reside.how to customize this behavior.

update:

Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver

/**
     * @param \Magento\Framework\Pricing\SaleableInterface|\Magento\Catalog\Model\Product $product
     * @return float
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
    {
        $price = null;
        foreach ($this->configurable->getUsedProducts($product) as $subProduct) {
            $productPrice = $this->priceResolver->resolvePrice($subProduct);
            $price = $price ? min($price, $productPrice) : $productPrice;
        }
        if (!$price) {
            throw new \Magento\Framework\Exception\LocalizedException(
                __('Configurable product "%1" do not have sub-products', $product->getName())
            );
        }
        return (float)$price;
    }

i'm trying to override this core file,but its not working.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver" type="Kensium\Catalog\Pricing\Price\ConfigurablePriceResolver" />

<?php
namespace Kensium\Catalog\Pricing\Price;
class ConfigurablePriceResolver extends \Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver
{
    /**
     * @param \Magento\Framework\Pricing\SaleableInterface|\Magento\Catalog\Model\Product $product
     * @return float
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
    {
        $price = null;
        $assPrice=array();
        foreach ($this->configurable->getUsedProducts($product) as $subProduct) {
            $productPrice = $this->priceResolver->resolvePrice($subProduct);
            $assPrice[]=$productPrice;
            $price = $price ? min($price, $productPrice) : $productPrice;
        }
        if (!$price) {
            throw new \Magento\Framework\Exception\LocalizedException(
                __('Configurable product "%1" do not have sub-products', $product->getName())
            );
        }
        return (float)(max($assPrice));
        //return (float)$price;
    }
}


texts: How to update existing entity type values in Magento 2?

texts:
I created custom entity type which existing in eav_entity_type table.

But, I want to update value of entity_model, attribute_model & etc.

How to update it?

Any help would be appreciated.


texts: Magento 1.7 - Export New Orders in Observer

texts:
Every 30min I want to export all NEW orders, I don't want to re-export orders I've already done.

Later I'm going to access these files to import into a third party program through FTP automatically.

Here is the code that I have so far.
app/code/local/Sean/NavisionExport/etc/config.xml

<config>
    <global>
        <models>
            <seannavisionexport>
                <class>Sean_NavisionExport_Model</class>
            </seannavisionexport>
        </models>
    </global>
    <crontab>
        <jobs>
            <seannavisionexport>
                <name>Export orders every 30 minutes</name>
                <short_description>Orders</short_description>
                <description>Runs every 30 minutes to export orders</description>
                <schedule>
                    <cron_expr>0 * * * *</cron_expr>
                </schedule>
                <run>
                    <model>seannavisionexport/observer::runOrdersExport</model>
                </run>
            </seannavisionexport>
        </jobs>
    </crontab>
</config>

app/code/local/Sean/NavisionExport/Model/Observer.php

<?php

class Sean_NavisionExport_Model_Observer {

    public function runOrdersExport(Varien_Event_Observer $observer) {

    //How should I do this here?

    }

}


texts:
I'm trying to find the discount value of a sale, of grouped products

my code is like this, when it is a simple product, the discount value appears, but when it is a product group the value is zero

my code below:

$orderItems =  $order->getAllVisibleItems();
            foreach ($orderItems as $item) {
      $items[] = array(
                                'qty' => (int)$item->getQtyOrdered(),
                                'sku' => $item->getSku(),
                                'name' => $item->getName(),
                                'price' => number_format($item->getPrice(), 2),
                                'discount' => number_format($item->getBaseDiscountAmount(), 2),
                                'ERP' => $ehERP
                                );
            }

the value $ item-> getBaseDiscountAmount () comes with zero, when product is grouped.

I gave a var_dump ($ item), the discount amount appears in the code below

["_data":protected]=>
array(144) {
["entity_id"]=>
string(2) "50"
["state"]=>
string(3) "new"
["status"]=>
string(15) "pending_payment"
["coupon_code"]=>
NULL
["protect_code"]=>
string(6) "5cafe6"
["shipping_description"]=>
string(43) "Formas de Envio: - PAC - Em média 6 dia(s)"
["is_virtual"]=>
string(1) "0"
["store_id"]=>
string(1) "1"
["customer_id"]=>
string(2) "36"
["base_discount_amount"]=>
string(7) "-6.4800"
}

i need get this value -6.4800


texts: How to get the orders above the order id and How to use the limit in magento 2

texts:
I need to write code to get next 10 orders above the given order id.

<?php

namespace Learning\GreetingMessage\Controller\Index;

use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\Context;
use Vendor\Module\Model\ModuleFactory;
use Magento\Sales\Api\OrderRepositoryInterface;

use Magento\Framework\Setup\SchemaSetupInterface;

class Test extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;

protected $_orderCollectionFactory;

public function __construct(
    \Magento\Framework\App\Action\Context $context,
    //~ \Magento\Framework\View\Result\PageFactory $pageFactory,
    \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
    )
{
    //~ $this->_pageFactory = $pageFactory;
    $this->_orderCollectionFactory = $orderCollectionFactory;
    return parent::__construct($context);
}

public function execute()
{
     //~ $orders = $this->_objectManager->create('Magento\Sales\Api\Data\OrderInterface')->getCollection()->addAttributeToFilter('created_at',  array('from'=>date('Y-m-d',strtotime('2018-01-01')), 'to'=>date('Y-m-d',strtotime('2019-01-01'))));   // Getting first order
     //~ $orders = $this->_objectManager->create('Magento\Sales\Api\Data\OrderInterface')->getCollection()->addAttributeToFilter('entity_id',  array('gt'=>0));
     $orders = $this->_objectManager->create('Magento\Sales\Api\Data\OrderInterface')->setPageSize(1)->setCurPage(10)->getCollection()->load();
     echo "Count is ". count($orders);
     foreach($orders as $order)
     {

         $gross = $order->getGrandTotal();
         $tax = $order->getTaxAmount();
         $net = $gross - $tax;
         $payment = $order->getPayment();
         $method = $payment->getMethodInstance();
         $methodTitle = $method->getTitle();

         echo "
gross :". $gross;
         echo "
tax :". $tax;
         echo "
net :". $net;
         echo "
Created :". $order->getCreatedAt();
         echo "
state :". $order->getState();
         echo "
payment methodTitle :". $methodTitle;
         echo "
 Customer : ". $order->getCustomerId();
         echo "
Items in order";

         $items = $order->getAllItems();
        foreach($order->getAllItems() as $orderItem) {
            $itemid =  $orderItem->getId();
            echo "Item id" .$orderItem->getId() . "
";
        }
    }

    echo "Hello World";
    exit;
}

}


texts:
As you can see in the image below, seems like my CRON is working well, but there is two index that was updated 6 days ago and isn't updating every day like the other.

How can I solve that?


texts: How to display the static block inside tab content?

texts:
I want to insert a cms block in a tab content. So I inserted the below code in catalog.xml:

<block type="cms/block" name="care" as="care" >
   <action method="addToParentGroup"><group>detailed_info</group></action>
   <action method="setBlockId" translate="value"><block_id>Care</block_id></action>
</block>

But the block is not displayed in the tab content. Please help.


texts:
I  have tried to create plugin of  method getProductDetailsHtml of \Magento\Catalog\Block\Product\ListProduct.

But this plugin is not working.

di.xml

<type  name="Magento\Catalog\Block\Product\ListProduct">
   <plugin name="changes_template_of_product_list" sortOrder="1"  disabled="false"
   type="StackExchange\Magentodemo\Plugin\Block\ListProductPlugin"/>
</type>

Plugin class

<?php
namespace StackExchange\Magentodemo\Plugin\Block;

class ListProductPlugin
{

    public function aroundGetProductDetailsHtml(
        \Magento\Catalog\Block\Product\ListProduct $subject,
        \Closure $proceed,
        \Magento\Catalog\Model\Product $product)
    {
        $result = $proceed($product);
        $result. 'Test';
        return $result. 'Test';
    }

}

Now, if I changed the class at di. and plugin class

Magento\Catalog\Block\Product\AbstractProduct from \Magento\Catalog\Block\Product\ListProduct the then plugin is working perfectly.

Now Question:

Why plugin is not working on ListProduct  where it is worked on AbstractProduct?

If we do di compile then will find that  both class's Interceptor class
has getProductDetailsHtml() method.So it means that we can create plugin at    getProductDetailsHtml method at both class.

  Interceptor class  of \Magento\Catalog\Block\Product\AbstractProduct

<?php
namespace Magento\Catalog\Block\Product\ListProduct;

/**
 * Interceptor class for @see \Magento\Catalog\Block\Product\ListProduct
 */
class Interceptor extends \Magento\Catalog\Block\Product\ListProduct implements \Magento\Framework\Interception\InterceptorInterface
{

    /**
     * {@inheritdoc}
     */
    public function getProductDetailsHtml(\Magento\Catalog\Model\Product $product)
    {
        $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getProductDetailsHtml');
        if (!$pluginInfo) {
            return parent::getProductDetailsHtml($product);
        } else {
            return $this->___callPlugins('getProductDetailsHtml', func_get_args(), $pluginInfo);
        }
    }

      /**
     * {@inheritdoc}
     */
    public function getImage($product, $imageId, $attributes = array())
    {
        $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage');
        if (!$pluginInfo) {
            return parent::getImage($product, $imageId, $attributes);
        } else {
            return $this->___callPlugins('getImage', func_get_args(), $pluginInfo);
        }
    }

}

  Interceptor class of \Magento\Catalog\Block\Product\AbstractProduct

<?php
namespace Magento\Catalog\Block\Product\AbstractProduct;

/**
 * Interceptor class for @see \Magento\Catalog\Block\Product\AbstractProduct
 */
class Interceptor extends \Magento\Catalog\Block\Product\AbstractProduct implements \Magento\Framework\Interception\InterceptorInterface
{

    /**
     * {@inheritdoc}
     */
    public function getProductDetailsHtml(\Magento\Catalog\Model\Product $product)
    {
        $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getProductDetailsHtml');
        if (!$pluginInfo) {
            return parent::getProductDetailsHtml($product);
        } else {
            return $this->___callPlugins('getProductDetailsHtml', func_get_args(), $pluginInfo);
        }
    }

}

But really strange that the plugin is not working on ListProduct class. Where it should work.

Also, I am avoiding to create  plugin on AbstractProduct as this class is deprecated from version 101.1.0.

  So, anybody has idea Why Plugin is not working on  ListProduct 's  getProductDetailsHtml()?


texts: Fastest way to update an attribute in all products

texts:
I'm trying to update the price to a lot of products (more than 10.000). The way I am doing that right now is extremely time-consuming. Which is the best way to loop through all the products and update most of them?

Thanks


texts: Magento & Google Analytics - Tracking Code or Google API?

texts:
Is there any difference between using the Google Analytics Tracking Code or using the inbuilt Google API analytics section in Magento?

Using the Google API section seems 'neater' as I don't have to copy & paste code into my site.  I assume Magento inserts this code automatically once configured.

I just wondered if there was much difference in terms of usability and features?


texts: Duplicate transaction id error in citrus payment option in magento

texts:
HTTP Status 403 - Duplicate Transaction Id : 100000335

  type Status report

  message Duplicate Transaction Id : 100000335

  description Access to the specified resource (Duplicate Transaction Id
  : 100000335) has been forbidden. Apache Tomcat/7.0.26

I got this error from Citrus after redirecting to citrus payment mode when I select this payment mode in payment methods option in Magento and clicking on "continue".


texts:
I actually want a clean magento 1.9, without any modules/extensions/themes, but would like to keep at least products and customers. Orders are good to keep, but not necessary.

Now I tried:

A fresh install. Trying to use Magento's built-in import/export customers and products, but errors were there. Something like "field value not valid" or "field value empty." Seems Magento 1.5 and 1.9 import/export not compatible?
Download Magento full package to my server and then run initial setup with the old 1.5 database, hoping that it would upgrade my database automatically. At some point there was a server 500 error. The old Magento does have some extensions/modules/custom themes.

Any advise? What would be the best way to achieve my goal? Thank you.


texts:
When we try to go to next page in Catalog > Manage Products the screen just freezes on please wait.
Any tips would be very helpful.
Thanks


texts: Minimum purchase for configurable product

texts:
i would like to know if there is a way to have a minimum purchase for configurable product.

Example. We have a soccer club that every child will buy 2 pair of shorts. Can we make it so when a player orders a QTY of 1 they are actually getting 2 pairs of shorts?

I tried minimum shopping qty in inventory tab but it shows qty as 1 by default please note this is for Configurable products


texts: How to write magento 2 media query only for 1366*768

texts: I'm trying to write styles only for 1366*768 resolution .. How can write Media query that effect only 1366*768 in magento 2 way


texts: File Upload progress bar with custom file upload

texts: We need to show the progress bar uploading image for product custom option frontend. And also show the preview the uploaded file. Is it possible to apply admin section file uploader.


texts: how to run cron jobs automatically in magento 2?

texts:
i have to run all cron jobs automatically. i had used this one php bin/magento cron:run --group="captcha_delete_expired_images" to delete captcha images manually but it is not deleting the images.

so please help me out how to run cron jobs automatically


texts: layered navigation not working with custom filters magento 2.4

texts:
layered navigation is not working with custom Collection filters in Magento 2.4
File Name - Magento\Catalog\Model\Layer\Category\CollectionFilter;
$collection->addAttributeToSelect($this->catalogConfig->getProductAttributes())
        ->addMinimalPrice()
        ->addFinalPrice()
        ->addTaxPercents()
        ->addUrlRewrite($category->getId())
        ->setVisibility($this->productVisibility->getVisibleInCatalogIds());

$collection->getSelect()
            ->join(
                ['marketplace_assignproduct_items'],
                'e.entity_id= marketplace_assignproduct_items.assign_product_id',
                ['marketplace_assignproduct_items.seller_id']
            );

With help of this, I am able to display products properly in Category Page but layered navigation and Pagination not working properly.
Note - this issue with Magento 2.4


texts:
I want to add a block inside another block I have this structure:

in config.xml for the observer part I have this:

......
 <frontend>
       <events>
            <core_block_abstract_to_html_before>
                <observers>
                    <cart_shopping>
                        <type>model</type>
                        <class>cart_shopping/observer</class>
                        <method>insertBlock</method>
                    </cart_shopping>
                </observers>
            </core_block_abstract_to_html_before>
        </events>
....

and in observer I search for block and then I create the new block:

class Cart_Shopping_Model_Observer
{

        public function insertBlock($observer)
        {
            /** @var $_block Mage_Core_Block_Abstract */
            /*Get block instance*/
            $_block = $observer->getBlock();
            /*get Block type*/
            $_type = $_block->getType();
           /*Check block type*/
            if ($_type == 'catalog/product_price') {
                /*Clone block instance*/
                $_child = clone $_block;
                /*set another type for block*/
                $_child->setType('test/block');
                /*set child for block*/
                $_block->setChild('child', $_child);
                /*set our template*/
                $_block->setTemplate('at.phtml');
            }
        }
    }

my theme is rwd so:
I have put at.phtml in app/design/frontend/rwd/default/template/catalog/product/at.phtml

and here is  at.phtml:

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

Hello

It is not adding the block, why? do I need any custom layout file or changing any local.xml file?! I don't know what else I should do
I tried to do observer solution with this link


texts: Reload page after removing item from Mini cart in magento 2.3.3

texts:
Is there any way to reload the page completely, when we remove an item from mini cart.
https://prnt.sc/11i1x2g
After clicking on ok , i want to reload the page.


texts: Fresh Magento 2.4, nginx reverse Proxy can't redirect to fresh Magento 2.4

texts:
I am installing a fresh Magento 2.4 on a docker-compose stack with these specs:

Reverse proxy: jwilder/nginx-proxy

 ports:
      - "80:80"
      - "443:443"
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - dhparam:/etc/nginx/dhparam
      - ./certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - nginx-proxy

web running apache expose on port 80 and 22.

Long story short, I have had no problem installing magento 2.3.5 and before that with that docker-compose setup.  But starting Magento 2.4.0, I added elasticsearch container to my setup, confirm seeing setup landing page "Welcome to Magento Admin".  But after i run /bin/magento setup:install with Basic install. I am getting "502 Bad Gateway".  I suspect my reverse proxy can't detect my web container apache after running setup:install but it was able to see it before running setup:install.   So what change to my apache.conf file I need to setup to get thing work again.  What could go wrong here.  I can't think of any.  Any help?
Thanks


texts: How to override or extend template and layout files for an extension downloaded by composer?

texts:
I have an extension that is downloaded through composer, there are two files i would like to update. How to I override/extend the files? what is the correct paths i need to create in app/design/frontend/ folder?

The paths for the files i want to change are:

/vendor/amasty/module-faq-product-questions/view/frontend/layout/catalog_product_view.xml

and

/vendor/amasty/module-faq-product-questions/view/frontend/templates/pages/question_view.phtml


texts:
I want to write data in a form to a csv file. I have used the following code:

$data = array();
$data['name'] = $this->getRequest()->getParam('name');
$data['company'] = $this->getRequest()->getParam('company');
$data['email'] = $this->getRequest()->getParam('email');
$data_row[] = $data;

$fileName = "example.csv";

$var_csv = new Varien_File_Csv();

$var_csv->saveData($fileName, $data_row);

But it is not working. Where will be the location of the csv file. Please help.


texts:
i have installed magneto 2.4 using nginx site is working fine with HTTP but i have to run it with HTTPS and some how able to run with HTTPS but issue is that my CSS ana JS is called with HTTPS.... which is unable to load but when i access the same file in browser with HTTP it is accessible don't know what's the issue
if someone has gone through this same issue kindly share some answer or any guide or path where should i look


texts: Magento customer registration not saving selected state/region

texts:
So for some reason my Magento install (1.5) stopped saving new customers state/region name, both inside admin and outside.

Magento's registration form has a dropdown select, with a name of "region_id" and a hidden text field named "region". I guess that some javascript is supposed to get the selected name and set the "region" field, but that doesn't work.

What I did was create a jQuery line that, on form submit, gets the region name and sets the "region" field to it. That works, somewhat. There are still customers who are registering without a region name, only the id.

Anyone ever had something similar?


texts: I create attributes for customer, how to add storefront properties?

texts:
I created a dropdown customer attributes by default Magento2.
I would like to pull this dropdown box out to the checkout page. When customer at checkout page, they will see that dropdown box above shipping method.
I created a field at sales_order and quote table. It will save the value to order as well.
What should I do?

I have a XML in place, how can I replace the xml and show the customer attributes that I create? I want to to be database driven instead of XML static options.
Thanks


texts: Per-user permissions within a customer group

texts:
The background here is that my client is looking to create a B2B e-commerce website with Magento that he wants to integrate with his ERP.

In B2B world, companies sell to companies, not individuals. One company might have several employees who can place orders for the company in the e-commerce website.

This means that I need to figure out if and how it's possible to do the following in Magento:

Create "Company" accounts and have several users for each company
Per-company pricing
Each "Company" should have multiple addresses
Manage permissions within a Company for each user (for ex: one user can only create cart, but not submit the order, the other has rights to submit the order, etc)

For 1 and 2 I though about using Customer Groups, this would effectively solve the per-company pricing issue.

For 3, I thought about building a mechanism that syncs addresses between users that are in the same Customer Group (ie in the same company). This way, when one user changes or adds an address, it is reflected for each user.

For 4... I have no answer so I'm hoping someone can give me some insights...


texts:
Currently limit records on search page is 10.000
https://prnt.sc/vr3iq4
how can i increase this limit?


texts: How to add configurable product in wishlist in magento2

texts:
How to add configurable product option id in magento2 programmatically

Thanks


texts:
Hi guys i am having trouble creating a Magento CE price rule.

I have created an attribute called deals. It is a drop down box with these combinations:

2 FOR $100 (MIX N MATCH)

2 FOR $80 (MIX N MATCH)

2 FOR $60 (MIX N MATCH)

I have then applied the attribute to each product accordingly. I have done it this way because our system is also in combination with a barcode printing system and we needed the deal to print on the label too. So i am trying to do a two in one and utilize the same attribute for setting the price rule aswell.

So this is how the rule needs to work:

If a customer purchases one product with the attribute "2 FOR $80 (MIX N MATCH)" then there is no discount.

If the customer purchases 2 products with the attribute "2 FOR $80 (MIX N MATCH)" then it should apply the deal even if its a different product.

If the customer buys 3 products with the attribute "2 FOR $80 (MIX N MATCH)" then the first two products get the deal but the third does not.

This would continue onward with no limit on the amount the customer can buy.

Any help would be greatly appreciated. I am also a junior developer so take it easy on me guys! haha


texts: In Magento2 when product is add to cart the total price is added which includes product price and Custom Option price

texts:
When product is Added to Cart total is show in cart which includes Product Price and Custom Option price.

My Question is Where exactly the Product price and Custom Option Price are Added Can Anyone Help me out With file path flow.

Thank in advance


texts: Duplicate images for associated simple items within a configurable product

texts:
I am currently undertaking some house keeping project using Magento  and have noticed duplicate images on our server.

I believe that the issue is where configurable products with a number of associated simple items have been loaded into the system via a CSV file.

For example:

simple | small | /t-shirt-black-sku-1.jpg
simple | medium | /t-shirt-black-sku-1.jpg
configurable | /t-shirt-black-sku-1.jpg

Looking in the catalog/product folder on the server I see the following:

t-shirt-black-sku-1
t-shirt-black-sku-1_1
t-shirt-black-sku-1_2

We will soon be moving hosting providers and I want to ensure that we are not importing across any unnecessary files. As you can imagine, the duplicate images are bloating the overall size of the website considerably.

My questions is: Are the images for the associated simple items really necessary and are there any drawbacks to deleting them from the server?

I'm guessing that going forward, the best thing is to not include the product image name in the CSV for the associated simple items within a configurable product.

I hope this makes sense and any advice would be greatly appreciated.


texts: Show Out of Stock words On Category Pages and change color & font

texts:
I've already configured to show product that is out of stock,

How Can I also show some texts under this product on category page? Like Pre-order now or Sold Out.  and Maybe also capable to change the color or font size of this word.


texts:
I don't understand how can configure grunt to get the files i want and write where i want.

I'm in Magento 2, and have my own theme, I want Grunt to get the files in:
app/design/frontend/Name/theme/web/css/source/_theme.less

and update:

app/design/frontend/Name/theme/web/css/my.css

but i don't know how to put it in grunt.

UPDATE

I'm the only one with grunt v0.4.5, who doesn't have the grunt.initConfig in his Gruntfile

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({


texts: I am not sure what is wrong with my shipping method, Every order above 500 getting shipping price 0.Even it blocking other shipping method and make the shipping price to 0. Before I add a price rule if product above 500 free shipping but now I have deleted that, But still I am getting the same, I am not sure how to fix this issue


texts:
I implemented Content Security Policy feature by creating a Custom Csp module in staging server. I created config.xml and csp_whitelist.xml file in module /etc folder. But some times it shows Error 502 Bad gateway error.
Can anyone suggest me about this?


texts: Magento 2: How to move go to check out button to bottom of the page in summary section?

texts: In the checkout page, I'm trying to move go to check out button to the bottom of the summary section (after order totals) in checkout_cart_index.xml layout but it's not working, is there any solution.


texts: Unique Value For Custom Attribute in magento 2

texts:
I created one custom attibute for customer. and make unique value true.
while we edit customer in admin panel , and trying to save, its always give error like attribute should be unique. but their value is already unique.

I created the attribute like this:

if(version_compare($context->getVersion(), '1.1.9','<')) {
        $customerSetup->addAttribute(Customer::ENTITY, 'mobile_number', [
                'type' => 'text',
                'label' => 'Mobile Number',
                'input' => 'text',
                'backend' => '',
                'frontend' => '',
                'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                'required' => false,
                'visible' => true,
                'user_defined' => false,
                'unique' => true,
                'searchable' => false,
                'filterable' => false,
                'comparable' => false,
                'position' => 112,
                'system' => 0,
                'source' => ''
        ]);

        $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'mobile_number')
        ->addData([
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ['adminhtml_customer','customer_account_edit'],

        ]);

        $attribute->save();
     }


texts: backend order create: default billing = shipping address + add to addressbook

texts:
we enter a lot of orders via backend. And for every single order I have to click:
 - shipping address = same as billing
 - save to address book

How can we set this to default (avoiding these two extra clicks)

Merci!


texts: Add Custom attribute from Sales_Order table into New order email template?

texts:
I have create new custom attribute on Sales_order table name "QR_Code". How to insert this field into my new order email template?

Thanks
kllee


texts: How to generate Coupon rule dynamically using observer/model method?

texts:
How can i generate coupon rule dynamically using observer method?

I have created below function, it works if we create controller action and run. But not working with observer.

function createCoupon($customer_id, $discount,$days,$type)
{
    $customer = Mage::getModel('customer/customer')->load($customer_id);

    $customerGroupIds = Mage::getModel('customer/group')->getCollection()->getAllIds();
    $websitesId = Mage::getModel('core/website')->getCollection()->getAllIds();

    $customer_name = $customer->getName();
    $couponCode = Mage::helper('core')->getRandomString(9);

    $model = Mage::getModel('salesrule/rule');
    $model->setName('Discount for ' . $customer_name);
    $model->setDescription('Discount for ' . $customer_name);
    $model->setFromDate(date('Y-m-d'));
    $model->setToDate(date('Y-m-d', strtotime('+'.$days.' days')));
    $model->setCouponType(2);
    $model->setCouponCode($couponCode);
    $model->setUsesPerCoupon(1);
    $model->setUsesPerCustomer(1);
    $model->setCustomerGroupIds($customerGroupIds);
    $model->setIsActive(1);
    $model->setConditionsSerialized('a:6:{s:4:\"type\";s:32:\"salesrule/rule_condition_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}');
    $model->setActionsSerialized('a:6:{s:4:\"type\";s:40:\"salesrule/rule_condition_product_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}');
    $model->setStopRulesProcessing(0);
    $model->setIsAdvanced(1);
    $model->setProductIds('');
    $model->setSortOrder(1);
    $model->setSimpleAction($type);//$model->setSimpleAction('by_fixed');
    $model->setDiscountAmount($discount);
    $model->setDiscountStep(0);
    $model->setSimpleFreeShipping(0);
    $model->setTimesUsed(0);
    $model->setIsRss(0);
    $model->setWebsiteIds($websitesId);

    try {
        $model->save();
    } catch (Exception $e) {
        Mage::log($e->getMessage());
    }
}

Can anyone have idea, why these happens?


texts: How to Override custom module Model in custom module Magento 2?

texts:
I have two Modules in app/code.

Xyz_Xyz - Module that already exists. I can't change its file.
Abc_Abc - Module that I creating to override Xyz_Xyz Model.

The code I try is here.

  app/code/Abc/Abc/etc/module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Abc_Abc" schema_version="1.0.0" setup_version="1.0.0" >
        <sequence>
            <module name="Xyz_Xyz" />
        </sequence>
    </module>
</config>

  app/code/Abc/Abc/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Xyz\Xyz\Model\Payment\PaymentAbstract" type="Abc\Abc\Model\Payment\PaymentAbstract" />
</config>

  app/code/Abc/Abc/Model/Payment/PaymentAbstract.php

<?php
namespace Abc\Abc\Model\Payment;

class PaymentAbstract extends \Xyz\Xyz\Model\Payment\PaymentAbstract
{
    public function getFormFields($order, $requestParams, $isRequest = true)
    {
        \Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class)->debug("Works ");
    }
}

Then I am going to cmd and run this commands :

  rm -rf var/cache var/generation var/page_cache var/view_preprocessed
  var/composer_home var/di

Then

  php bin/magento setup:di:compile

There is no error in di: compile.

So, can anyone tell me what to do ??


texts: Magento 2 and REST API with Nginx config not working

texts:
We're using a 3rd party software to get data from our Magento 2.1.9 store.

If I click on "get Listings" in this software, it's supposed to download our products from Magento 2.

In our Nginx server error log I find then:

2017/10/26 14:18:09 [error] 4183#4183: *713019 open() "/var/www/html/domain.com/www.domain.com/pub/rest/V1/integration/admin/token" failed (2: No such file or directory), client: 64.71.*.40, server: www.domain.com, request: "POST /rest/V1/integration/admin/token HTTP/1.1", host: "www.domain.com"

And the 3rd party software tells me a 404 HTTP error.

Now the 3rd party company is really bad with customer support but I assume  it's because of our Nginx config. Probably that's the bit of interest:

    location /pub/ {
    location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
        deny all;
    }
    alias $MAGE_ROOT/pub/;
    add_header X-Frame-Options "SAMEORIGIN";
}

The whole shop and everything seems to be working fine - just not the integration.
Any idea why?


texts: I am not able to save value in added custom field in customer address in magento 2

texts:
I have created the custom field in customer address section in magento admin and attribute created successfully and visible in customer admin area using below code:-

 <?php
    namespace Vendor\Module\Setup;

   use Magento\Customer\Setup\CustomerSetupFactory;
    use Magento\Customer\Model\Customer;
    use Magento\Framework\Setup\InstallDataInterface;
    use Magento\Framework\Setup\ModuleContextInterface;
    use Magento\Framework\Setup\ModuleDataSetupInterface;
    use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
    /**
     * @codeCoverageIgnore
     */
    class InstallData implements InstallDataInterface
    {
        /**
         * Customer setup factory
         *
         * @var CustomerSetupFactory
         */
        private $customerSetupFactory;
        /**
         * @var AttributeSetFactory
         */
        private $attributeSetFactory;
        /**
         * Init
         *
         * @param CustomerSetupFactory $customerSetupFactory
         */
        public function __construct(
            CustomerSetupFactory $customerSetupFactory,
            AttributeSetFactory $attributeSetFactory
        ) {
            $this->customerSetupFactory = $customerSetupFactory;
            $this->attributeSetFactory = $attributeSetFactory;
        }
        /**
         * {@inheritdoc}
         * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
         */
        public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
        {
            /** @var CustomerSetup $customerSetup */
            $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
            $setup->startSetup();

            $kcaddressidInfo = [
                    'kc_address_id' => [
                    'label' => 'Custom address id',
                    'type' => 'int',
                    'input' => 'text',
                    'position' => 1000,
                    'visible' => true,
                    'required' => false,
                    'system' => 0,
                    'user_defined' => true,
                    'position' => 1000,
                ]
            ];
            $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer_address');
            $attributeSetId = $customerEntity->getDefaultAttributeSetId();
            /** @var $attributeSet AttributeSet */
            $attributeSet = $this->attributeSetFactory->create();
            $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

            foreach ($kcaddressidInfo as $attributeCode => $attributeParams) {
                $customerSetup->addAttribute('customer_address', $attributeCode, $attributeParams);
            }

            $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'kc_address_id');

            $attribute->addData([
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ['adminhtml_customer'],
            ]);

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

but after created the attribute I am not able to save value in this attribute.

Any help would be appreciated.


texts: How to Exclude Magento Review tab from tabs and show at bottom

texts: hello guys can you help me in changing Magento review tab position , i want reviews to show after tabs to for more user friendly


texts: After Clearing all the cache. I can't able to scroll to top, menu is hiding

texts:
Magento 2.2.7

I cleared all the cache.
Clicked on system icon on the left side menu.
I can't scroll up. but I can able to scroll up after the refreshing page.


texts: Magento 1.9.3.1 Innoext Advanced Store Pricing (Version: 1.2.1.0) Module Product Price indexing issue Unknown column 'cwd.date' in 'field list'

texts:
When I tried to Integrate Innoext_AdvancedStorePricing Module in Magento 1.9.3.1 and tried to reindex the Product Prices, it failed with an error message:

  Column not found: 1054 Unknown column 'cwd.date' in 'field list', query was: INSERT INTO catalog_product_index_price_final_idx SELECT e.entity_id, cg.customer_group_id, cw.website_id, IF(IFNULL(tas_tax_class_id.value_id, -1) > 0, tas_tax_class_id.value, tad_tax_class_id.value) AS tax_class_id, IF(IFNULL(tas_price.value_id, -1) > 0, tas_price.value, tad_price.value) AS orig_price, IF(IF(IF(IFNULL(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) IS NUL ......


texts: URL rewrites does not work after update to 1.9.3.1

texts:
Our redirects aren't working anymore - properply after updating to Magento 1.9.3.1.

The rewrites are still present in the URL Rewrites. If I click on one of them and save it (without editing anything), then it works again.

Any ideas how to "re-apply" them, without manually saving each and everyone?
(Reindexing does not fix the issue.

Example:

https://www.fyr-selv.dk/Briketter/SEDI-Toervebriketter/SEDI-Toervebriketter-k111-i46.html

UPDATE:

Seem's to be 1.9.3.1 bug caused by changes to rewrites and case sensitivity.
When i save a rewrite, then requestpath changes all uppercase characters to lowercase. This matches the fix description in Magento changelog regarding rewrites:

Case-sensitive variations of URL rewrites work as expected.

But seems like the update lacks to change this for all current rewrites.


texts: Find the jquery tabs conflict in magento 2

texts:
I am using Magento 2 EE. When I press on a tab link inside a block in the home page, the next tab becomes invisible. The handler is adding this code:

aria-expanded="false" style="display: none;"

to the next tab.

This is the code for the navigation tabs:

New Arrivals

Bestsellers

Most Viewed

And this is the code for one tab after pressing the tab next to it:

Most Viewed

I used Visual Event for java script to debug the issue. I found that the click event is calling the following function from the live bootstrap.min.js v 3.3.6:

function (c){c.preventDefault(),b.call(a(this),"show")}

The are no errors in the console.

Any help to solve the issue?


texts: My Custom Attribute not Getting in magento

texts:
I have created a custom attribute in Customer Address (govt_id) and it is showing on Adminhtml UI, but when I retrieve the customer address attributes it's not getting it.

my setup code:

<?php

$this->startSetup();

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$setup->addAttribute('customer_address', 'govt_id', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'GOVT ID',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'default' => '0',
    'visible_on_front' => 0,
));

Mage::getSingleton('eav/config')
    ->getAttribute('customer_address', 'govt_id')
    ->setData('used_in_forms', array('customer_register_address','customer_address_edit','adminhtml_customer_address'))->save();

$this->endSetup();

And i'm getting attributes by using below code

$magentoAttributes = Mage::getModel('customer/address')->getAttributes();
        foreach(array_keys($magentoAttributes) as $att)
        {
            $name = $att;
            $this->magentoOptions[$att] = $name;

        }
        Mage::log( $this->magentoOptions);

Result:

2015-09-14T06:35:15+00:00 DEBUG (7): Array
(
    [entity_id] => entity_id
    [entity_type_id] => entity_type_id
    [increment_id] => increment_id
    [parent_id] => parent_id
    [attribute_set_id] => attribute_set_id
    [created_at] => created_at
    [updated_at] => updated_at
    [prefix] => prefix
    [firstname] => firstname
    [middlename] => middlename
    [lastname] => lastname
    [suffix] => suffix
    [company] => company
    [street] => street
    [city] => city
    [country_id] => country_id
    [region] => region
    [region_id] => region_id
    [postcode] => postcode
    [telephone] => telephone
    [fax] => fax
    [vat_is_valid] => vat_is_valid
    [vat_request_id] => vat_request_id
    [vat_request_date] => vat_request_date
    [vat_request_success] => vat_request_success
    [vat_id] => vat_id
)

Here the govt_id attribute is missing.

I have cleared cache also, but still it's not getting Why?

Did I do anything wrong or is something missing?


texts: Why doesn't Magento reindex search results itself?

texts: Is there a way to make Magento reindex itself so that frontend product search would work without manually reindexing all indexes?


texts: Magento 2 - Custom UI Component on checkout page

texts:
I'm creating an extension that modifies the checkout page. What I want to do is create a custom textarea with some additional classes and a wrapper class. I used the default textarea UI Component as a base.

How can I use this new component in my checkout page?

What I did so far:

Create an extension: Silvan\Checkout, added class Comment.php in Silvan\Checkout\Component\Form\Element and created file view/frontend/ui_component/etc/definition.xml:

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_definition.xsd">
    <comment class="Silvan\Checkout\Component\Form\Element\Comment">
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Silvan_Checkout/js/form/element/comment</item>
                <item name="config" xsi:type="array">
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="elementTmpl" xsi:type="string">ui/form/element/comment</item>
                </item>
            </item>
        </argument>
    </comment>
</components>

view/frontend/web/js/form/element/comment.js

define([
    './abstract'
], function (Abstract) {
    'use strict';

    return Abstract.extend({
        defaults: {
            cols: 15,
            rows: 2,
            template: 'ui/form/element/comment'
        }
    });
});

view/frontend/web/templates/form/element/comment.html

        Opmerking bij bestelling

        <textarea class="form__text--full-width form__text--bg-gray" data-bind="
            value: value,
            hasFocus: focused,
            attr: {
                name: inputName,
                cols: cols,
                rows: rows,
                'aria-describedby': noticeId,
                placeholder: placeholder,
                id: uid
            }"
        />

Then I try to use the component in my checkout page under shipping-address-fieldset/children:

<item name="order_comment" xsi:type="array">
    <item name="config" xsi:type="array">
        <item name="component" xsi:type="string">Silvan_Checkout/js/form/element/comment</item>
        <item name="config" xsi:type="array">
            <item name="template" xsi:type="string">ui/form/field</item>
            <item name="elementTmpl" xsi:type="string">ui/form/element/comment</item>
        </item>
    </item>
</item>


texts: How can I remove Recently Viewed Products individually using delete(icon) button?

texts:
I want to add a delete button link to the recently viewed products and when we click on delete button link of any product then it should be remove from the list.
You can see image for better understandings:

Please help me to implement this functionality, I will be very thankful to you.


texts:
I have one collection in a method where I want to perform two different operations on this collection. So, I want two separate copies of same collection, and then assign one of the two collections to original collection again and return it.

To make this simple, suppose I have an object collection called $collection.

Now, I am trying it with PHP cloning as I don't know if there is any Magento collection cloning inbuilt or not.

$coll1 = clone $collection;
$coll2 = clone $collection;

Now I am trying to perform different operations on these two separate clones of the original collection, something like.

$coll1->getSelect()->where('some where condition');
$coll2->getSelect()->where('some different where condition');
if($coll1->count() == 0) {
    $collection = $coll2;
} else {
    $collection = $coll1;
}

But the weird thing is, both these cloned collections have both the where conditions assigned! $coll1 condition is applied to $coll2 along with $coll2's condition, and vice versa.

Does anyone know how to achieve this?

Thanks!


texts: What is the proper way of implementing service contracts in Magento 2?

texts:
I have a simple module with custom entity and I wanted to implement service contracts. I've read some articles about it and watched the course on Magento U (Fundamentals of Magento 2 development). According to the course, Data API should be implemented to a separate class contatining only data -> \Vendor\Module\Model\Data\Entity (not \Vendor\Module\Model\Entity) should implement the \Vendor\Module\Api\Data\EntityInterface, and all the functions in the Repository class should "work" on the Data\Entity class, for example get() function returns the Data\Entity class.

The issue I'm facing, in controller I need to check if the entity is new or one of the fields are changed, in \Magento\Framework\Model\AbstractModel there are functions that could handle this, but as the Data\Entity does not extend the AbstractModel I don't have access to this functions. Should I create a Service API in the module and create functions for this (basicly copy them from AbstractModel) or there is some other proper way. Could anyone point me in the right direction?

BTW is there any usage of entity models in service contracts pattern? The getters/setters are moved to Data API, the save/load are moved to Repositories and the bussines logic is moved to Service API, what's left?


texts:
I've installed fresh Magento 2 on local machine, but can't login to admin, neither to customer page. No messages are shown about bad password or login if I try false login.

Console doesn't show errors on admin page, but some on customer login page:

System.log:

[2017-06-21 09:45:28] main.INFO: Cache file with merged layout: LAYOUT_adminhtml_STORE1_3c470299521325284ed2f872fb317d47b and handles default, adminhtml_auth_login: Please correct the XML data and try again.  [] []
[2017-06-21 09:45:28] main.INFO: Cache file with merged layout: LAYOUT_adminhtml_STORE1_331b80c99f1d265b3f83441bdff2abf85 and handles admin-login: Please correct the XML data and try again.  [] []
......
[2017-06-21 10:15:14] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_2dd32ce4e9a4da9f99b408194db562ca2 and handles default, customer_account_create: Please correct the XML data and try again.  [] []

Edit: I have a bad feeling that's something wrong with server configuration, because I can't even login to Adminer for MySQL management...

PHP error log doesn't show anything.


texts: 404 on startup page changing admin panel URL

texts:
I've tried to change admin panel URL of my Magento site replacing <![CDATA[admin]]> with <![CDATA[new_admin_url]]> in app/etc/local.xml file.

I have only this issue: when I login, the startup page (dashboard in my case) gives me a 404 Page Not Found (this is the URL: http://mywebsite.com/index.php/admin/new_admin_url/index/noRoute/key/008cc1001579efd08067c36c315f293e/). After that I navigate in the admin panel and all works fine. It seems the system doesn't find the correct route.

Any ideas?


texts: Magento : Product Attributes Indexing Gets Infinitely Processing

texts: In System > Manage Indexes, in the Product Attributes Index only, the processes does not get completed, even after compiling Magento several times. Even researching, I found nothing that could help me find the error.


texts: How Can I override Sales_Order_History template in customer section at frontend

texts:
I am creating custom module for RMA(product return) in magento that's why I am trying to add a custom link "Return Request" in My Orders panel in customer account section as shown in below image-

For that I have created module "Assel_Rma" which have some files as below-

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <modules>
        <Assel_Rma>
            <version>1.0.2</version>
        </Assel_Rma>
   </modules>
   <frontend>
        <routers>
            <rma>
                <use>standard</use>
                <args>
                    <module>Assel_Rma</module>
                    <frontName>rma</frontName>
                </args>
            </rma>
        </routers>
        <layout>
            <updates>
                <rma>
                    <file>assel/rma.xml</file>
                </rma>
            </updates>
     </layout>
    </frontend>
    <global>
        <models>
            <rma>
                <class>Assel_Rma_Model</class>
            </rma>
        </models>
        <blocks>
            <rma>
                <class>Assel_Rma_Block</class>
            </rma>
            <sales>
                <rewrite>
                    <sales_order_history>Assel_Rma_Block_Sales_Order_History</sales_order_history>
                </rewrite>
           </sales>
        </blocks>
        <helpers>
            <rma>
                <class>Assel_Rma_Helper</class>
            </rma>
        </helpers>
    </global>
</config>

frontend/base/default/layout/assel.xml

<?xml version="1.0"?>
<layout version="0.1.0">

    <sales_order_history translate="label">
        <label>Customer My Account Order History</label>
        <update handle="customer_account"/>
        <reference name="my.account.wrapper">
            <action method="setTemplate">
                <template>rma/sales/order/history.phtml</template>
            </action>
          <block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
        </reference>
        <reference name="left">
            <remove name="catalog.shopby"/>
            <remove name="basenews"/>
            <remove name="bestsales"/>
            <remove name="left-block-banner-free"/>
            <remove name="blogleft" />
        </reference>
    </sales_order_history>

</layout>

app/code/local/Assel/Rma/Block/Sales/Order/History.php

<?php
class Assel_Rma_Block_Sales_Order_History extends Mage_Sales_Block_Order_History
{
}

After doing all above now "My Orders" looks like as below-

In above image my sidebar gets doubled and nothing is shown on the page.
can anyone please help me to get rid out of this problem.


texts: Product different prices and options per customer group

texts:
I am looking to set up 3 simple products

1 box - 700g
8 boxes - 700g
12 boxes - 700g

I would then make a configurable product based on a new custom attribute of "Number of boxes" and associate these products thus allowing customers to choose which option they wish to purchase.

The question is though based on the customer group I want to do the following

Have a different price if you are logged in as a trade instead of retail
Hide 1 box 700g product option if logged in as trade

Please, could someone tell me how this is possible?

1 way I thought would be possible is that I could have different configurable products

Retail configurable product
Trade configurable product

And then only associate the relevant options. I would then use something like http://www.magentocommerce.com/magento-connect/customer-groups-catalog2.html to hide the trade product from the retail customer group.

I am not sure if this is the best method though?

Cheers


texts: magento 2.2.4 white blank page after setup:di:compile on windows 10

texts:
I have installed Magento 2.2.4.

After installation, it was good, loading pages as expected.

But, when I setup:di:compile, it gives blank page on frontend and admin as well.

Once I delete generated folder and load page, it will again ok, and no blank page.

I checked it on Ubuntu, it works fine.


texts: How to insert custom core/template in product.info.options

texts:
How can i insert a custom core/template between select and date type?

<reference name="product.info.options">

     <action method="addOptionRenderer" ><type>text</type><block>catalog/product_view_options_type_text</block><template>customoptions/options-type-text.phtml</template></action>

                <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>customoptions/options-type-select.phtml</template></action>

<-- custom core/template should be here -->

                <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>customoptions/options-type-date.phtml</template></action>

                <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>customoptions/options-type-file.phtml</template></action>

                <action method="addOptionRenderer"><type>default</type><block>catalog/product_view_options_type_default</block><template>customoptions/options-type-default.phtml</template></action>

</reference>


texts: Remove validation from city field in checkout

texts: How can I remove the validation from city field which says, "Please use letters only (a-z or A-Z) in this field". I have checked the extension files but I can't find anything there.


texts: Magento 2 Observer after account confirm by email

texts: I need to trigger a Email after the account is verified from email link by the customer, Need the observer.


texts: Magento 1.9 Get Actual category of current product

texts:
Categories:

--Women (isAnchor = Yes)
    -- Clothing (isAnchor = Yes)
        --T-Shirt (isAnchor = Yes)

Products:

Simple product, Category assigned (T-Shirt)

When Product is visited from T-Shirt category then you get correct category name.

When product is viewed from Category Women or Clothing then you get current category but not T-Shirt

it returns Registry('CURRENT_CATEGORY')

I want to get the category that is actually assigned to the product.

Please help


texts: How to override Mage/ImportExport/Block/Adminhtml/Export/Edit/Form

texts:
app/code/local/Ti/Customer/etc/config.xml

<?xml version="1.0"?>

<config>
<modules>
    <Ti_Customer>
        <version>0.1.0</version>
    </Ti_Customer>
</modules>
 <frontend>
    <routers>
        <Ti_Customer>
            <use>standard</use>
            <args>
                <module>Ti_Customer</module>
                <frontName>customer</frontName>
            </args>
        </Ti_Customer>
    </routers>
</frontend>
<global>
      <blocks>
        <ti_customer>
            <class>Ti_Customer_Block</class>
        </ti_customer>
        <importexport>
            <rewrite>
                <export_edit_form>Ti_Customer_Block_Adminhtml_Export_Edit_Form</export_edit_form>
            </rewrite>
        </importexport>
    </blocks>
</global>

  app/code/local/Ti/Customer/Block/Adminhtml/Export/Edit/Form.php

<?php

class Ti_Customer_Block_Adminhtml_Export_Edit_Form extends Mage_ImportExport_Block_Adminhtml_Export_Edit_Form
{

 protected function _prepareForm()
{
   echo '000000000000000000';exit;
}
}


texts: Localy made php to magento directory- magento 2

texts:
My requirement is sending sms while place order button triggered.

1) Locally I have use one predefined sms gateway server

I receive message When I run http://localhost/send-sms.php, its not a magento way its fully core php.

2) I have set one event/observer when place order get trigger

I could try with copy the send-sms.php content to observer execute method, also copy the php library to the same Observer Class location but it is not work.

Observer class execute method

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

require "twilio-php-master/Services/Twilio.php";
$AccountSid = "XXXXXXXXXXXXXXXXXXX";
$AuthToken = "XXXXXXXXXXXXXXXXXXXX";
$client = new Services_Twilio($AccountSid, $AuthToken);
$message = $client->account->messages->create(array(
    "From" => "YYYYYYYYY",
    "To" => "YYYYYYYYYY",
    "Body" => "Test message!",
));
echo "Sent message {$message->sid}";
}

problem is magento get not recognize require URL. (first line of the execute method)

 require 'twilio-php-master/Services/Twilio.php';
 $client = new Services_Twilio($AccountSid, $AuthToken);

Services_Twilio class defined in Twilio.php, localy its work when I move to magento 2. I stuck with this two lines.

Where could I copy the twilio-php-master (php libreary)?


texts: Magento Get Max entity_id from sales_flat_order_status_history

texts:
The following code does not give me any output.

    $collection = Mage::getModel('sales/order_status_history')->getCollection()->getLastItem();
    print_r($collection->getData());

I have SQL Query for this but I have to use magento collection for this.

   SELECT MAX(entity_id) AS entity_id FROM sales_flat_order_status_history

Any idea ?


texts:
I want to compare products with tier prices from two databases. From database Magento 1 and Magento 2. Compare them to generate a list of products from Magento 1 that do not have tier prices in Magento 2 and import these products.
I wrote a comparison script in js, but how can I form a query in the database to find all SKU products?
Please help me with a MySQL query to select all products with tier prices for Magento 1 and Magento 2.
let test1 = ['1', '2', '3', '4/2', '5/4', '6-2'];
let test2 = ['1', '2', '3', '5/4', '4/2', '6-1', '7/2', '8-2'];

const diff = function(arr1, arr2) {
  const set = new Set(arr2);
  return arr1.filter(n => !set.has(n));
}

console.log(diff(test1, test2));

If I get all products from select catalog_product_entity_tier_price I get the only id. But I need SKU
select DISTINCT (entity_id ) from catalog_product_entity_tier_price

I tried that but its don't work
SELECT catalog_product_entity_tier_price.entity_id, catalog_product_entity.sku FROM catalog_product_entity_tier_price
INNER JOIN catalog_product_entity ON catalog_product_entity_tier_price.entity_id = catalog_product_entity.sku


texts: How to add ajax increment and decrement button in minicart magento2?

texts: I have follow many article but i don't get proper answer please help me, provide me step by step.


texts: Block of "random" characters printed on every page and cli

texts:
Please advice, what can be a reason for encoded characters block output in every call to magento - both in website and in ssh console?

It looks like it was started after using inline translation tool.

What is printed as text before any actual output:

HR+cPobz03NXsVWwWyIL5aee9dpGJJY7sJ9CDlO1iDTclVd53b+2PBvdUT8PJ6YVs7N9rsZQsc9h

aEoyYwLrvBldQ2UoYGlvWuxM+RihG41tARg9qNJtLRY2jEMJjJ+9yiE9Q+8LjkTkoVpzLr+hBMzQ
f8syaf/I/WXfTvthGqLqpf3+JRUivQH1dgZDgyY1Y+YVHhSLrVvBfsG5gMi+ZyxXfYZGSmCBqNtL
0C+/pg0XTAjNfEW5Mj48bsJdzY3vQ9EBYYMM7v2f3/oNziLccGgcBoxGRUBqKq3QqEyVnwuHc4Ir
R0/0KFkf0JWI2E4MRLfDx4aN1P8ZKWNOVI7F2OZrLongwOw4I1szPosub/L+70O5rz2gO2rVXEAH
lvOBp6Z3XHNRoeZGY57xQRsvWXa+uxKUfn5IX07QcKpysOvaZKUJyvvZrPZi+v0/GB8Ok4dW9Xlh
aFOmRpHTfvBSQ9dlg/ACOSBQJnc2fzfr2hqL9QtGyq13jMFbRLfo95IXaJ4xZ2A1noRrXEhfatNF
ht/e8FHBupgZWnzabhMelW7GeDIZswlxfbvBD25kYg2Bl35QhIqwt04SHwVTw13zJ4PfcOLwQUaf
vmVu49HvGJS+TxUsuvYY1esSmgZ0Et0DuavlrIQuc6l9/Q+m8cBwiinrSSoJNZyUO+NJD7N03tbP
t2PN0BcDYG1bY4r4OJG9e3F2VqiKg16bReU64rlZVfTyos5PPG35QJbwEQZaLgBws9xXwRywB5My
GXLxdWe9ka6dEODbLD2SIAKThUHEYFOpSKPSTqiZSHhuVCIsmCg5FItEYOJ7up974FqpGDhk+8MV
7I+Z30Qb8C3VIQaSXAyl4EKzy/tKVaxBPqehx+ZL602LID8MsGT24cRTu/5ym7cqII5P//H5+QFd
O7pDwFvbJBfjxUWZvKnfV6G9yZcO/VzNmIv74IxWnAFasCdx/eg5roAxc/R54nG8XgZWWuyb6GP7
UuORCxb7O/l4TcAZsK//ZMWMFbfO/kb4QBnTswseqHP4kv/uvnO4SXAApEqm0tIFoKPuKW2A2H1G
NlLcInVjuWqwoSp8egd6vz/m1N9An5ZuXqKJJkhdTUcY7kzY+iuAILW3WTXuS/AcCF07htkS2Nm1
jqARVW21E09ORkhmFHQslDospb0=HR+cP+JPvxSYFTouH61obCBJ6E7Uv2YbNL9SKXKDBbzXQOLMwKZs//jAcznPW2+LS24ZLyMnl+Xv
NA9LzQnlqtsRYAUd/KP7W733j45TlGlrMmWYeqA/RIN4q48eX1srDVIRU3r3/h95M1a9mRh5sdw5
DOXtJzFn2DV8uk9ULOxHB0wFO/VplIzsgZcv9AaioBH8yuOtDtIDi+D6sKRKFw6HmyEd9SeAEaZJ
qnosDnuEP3Y1Igo9KjAWqgDRcOrV3Xduo6pZpr4wKikzXd9rl5uN8HEsMmOj3WDp4R/CuecaeMKF
juHCtEJfWcdz25jXEObjuR48r1hZ/bqHaXSPZOiWsuw24PsX9/OmXq3FmX/H9vKnYX/SDEKomUbw
qGXujylC0nbkHRyXDyzRzVrUXPM8lJZ1zYJV14kcphIefPWMgqBVfGgZQOvSmL87/tIoqVrPH0ys
L+A3VUPtrE5CIC3fij6AlwIuYHP2z/NIn9HtZAI54k2y1peGDfnuD819dFcH20E8DxO6Mrqg4vyS
vfaqQ/KtfunwmKMkWPwNZRTXN45qiRchO6NP/tfI7Sdtx3aKgqq41MKjZngyD5eNla13Q0OgARjU
qyuPII5bI2vYsBxaazBgl19iYVFNxVmtSZ84yaLHkG4MrF7LPaDM/4pNykfVafvptbmwIu95Oh8/
+v0Ur5vB3sptXzq3yiI8O8INjbcw1j41Yj4WxhkZZkVPKlokcNNHGKAu6hKz7ZvMltcx39nn8CGX
ghpYGYbBqT/EmCogTFwea/KAVuwKKLD1xvHarUGdUNLw06ggOhSwo4X9/u9bWsKXthiQzNvW4Y3/
HA2t+F+Xg1arRn27lm0jUZNDOc53Mxz4SFrVgxTzAoNuY/Y7CUlRwvEWmQyATNVZxzFVEDvkZz6R
3mTklvv3X8WLHW1iqDm31tJBoG7RVt8VzlUoTBWZ6sJHMD3joQvTelj+2WT/Bh4zn9gYmtJOf0Jx
e+xS0fkKYsFIZHD8kKckdP2JkNSfBgpa9X6+9asz1YbfuFjB7+6Br+J8z8P9MrnfQcrUnT6RmTio
HyI5/xpCd1H5c6bLuL1IWaJNH/z1Ac30+RKvRwK0O4MpXL4MeFataWgQ4SI5/vzcAI97OPb+onDT
xQXIZ/WTdAsasiMryGopvEjmEkjI79HTeRTkmWvd


texts: Magento 2 - Use vendor library in custom module's helper file

texts:
How can I use below vendor library in my custom module's helper file?
I want to create an object of this class.

/magento2/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php

I have tried with below in my helper file but not working.

use phpseclib\phpseclib\phpseclib\Crypt\RSA;

Also I tried to add using composer but still its not working.

{
"name": "company/module",
"description": "N/A",
"require": {
    "php": "~5.6.0|7.0.2|~7.0.6",
    "magento/magento-composer-installer": "*",
    "phpseclib/phpseclib":"*"
},
"type": "magento2-module",
"version": "2.0.0",
"license": [
    "proprietary"
],
"autoload": {
    "files": [
        "registration.php"
    ],
    "psr-4": {
        "Company\\Module\\": ""
    }
}

}


texts: Magento2 VAT id required for specific countries

texts:
i have an Magento2 Shop and the countries Germany and France are allowed.
Now i want the following settings:

DE = Vat ID is optional in checkout and register
FR = Vat ID is required in checkout and register

It is one storeview. Any solution for this problem?


texts:
Whenever we are clicking on a Product on Admin site, we are getting this Error.

    Exception #0 (Exception): Item (Magento\CatalogInventory\Model\Stock\Status) with the same ID "1" already exists


texts: Magento 2.3.5 - Change Date Format on item options in Sales Order details

texts:
UPDATE
I have created a product with custom options like below. One of the fields is a date field. I have modified the date option (date.phtml) to show the time choice on the date-picker. However, because the option is declared as a date not showing the time in the dashboard by default.

When a customer place an order the date appears without the time details like below.

How could I change the date format to display the time on items options in order details? I don't want to use the default time option of Magento because doesn't allow us to set restrictions. I want to have an option with DateTime picker.
Many thanks


texts: add one more to qty of product in cart programtically

texts:
If an item from category id = 525 is added to the cart, this code should add one more to quantity if quantity is 1, then a promo on the admin panel is set which will give customer 50 % discount but this code is not adding one more to cart and not giving any errors. How do I make this work?

public function salesruleValidatorProcess(Varien_Event_Observer $observer)
{
    /* @var $quote Mage_Sales_Model_Quote */
    $quote = $observer->getEvent()->getQuote();
    /* @var $item Mage_Sales_Model_Quote_Item */
    $item = $observer->getEvent()->getItem();
    /* @var $rule Mage_SalesRule_Model_Rule */
    $rule = $observer->getEvent()->getRule();
    $category = Mage::getResourceModel('catalog/category_collection');

    if ($rule->getSimpleAction() != C4B_Freeproduct_Model_Consts::ADD_GIFT_ACTION
        || $item->getIsFreeProduct()
        || $rule->getIsApplied())
    {
        return;
    }

    ////
    $qty="2";
$cid="525";
$Qty1 = $item->getQty();
$quote = Mage::getSingleton('checkout/session')->getQuote();
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item) {
if ($cid==$item->getCategoryId() && ($Qty1=1)){
$item->setQty($qty);
}
}

}


texts: How do I extract from db the categories and subcatories of a product?

texts:
This is my try:

 SELECT fs.entity_id, fs.path, fs.name,c.level
     FROM catalog_category_product_index AS PI
      INNER JOIN catalog_category_flat_store_1 AS fs
      ON pi.category_id = fs.entity_id
      INNER JOIN catalog_category_entity c
      ON c.entity_id = pi.category_id
     WHERE pi.product_id = 1

I know about the path. but i want to extract the data in other format:

category1/subcategory1.1/subcategory1.1.1 , category1/subcategory 1.2/ subcategory 1.2.1

Is there a way to extract the data like that ?


texts: Order state is updated to closed after creating an invoice

texts:
This is my code for creating a pending invoice:
if ($order->canInvoice()) {
    $invoice = $this->invoiceService->prepareInvoice($order);
    $invoice->register();
    $invoice->save();
    $transactionSave = $this->transaction->addObject($invoice)
        ->addObject($invoice->getOrder());
    $transactionSave->save();
}

I also have virtual products, so no shipment will be created. My issue is, that after creating the invoice programmatically, the order state and status is updated to closed. Not sure why?
It should remain processing.
Do yo have any ideas why or any suggestion are welcome.
Thank you


texts: Issue in order page Issue in order page  Issue in order page Issue in order page


texts:
I have a Magento Installation version 1.9.3.1.
Until yesterday It was working fine, but now the frontpage is not working with the error - Too many redirects.

On further checking in the console(firebug), I can see all the files are showing as moved permanently
as also
it is adding a extra slash / that is two slash in the end of the sitename in the browser address.
also in console all the get pages are showing as //

update:

I observed that it is only home-page/index.php where I am facing this issue.
for example If I am accessing site/category-name
it is working fine.

How I can fix that.


texts:
I have a CMS page with a URL key of "contact" (without the last 's'), I would like to add a block within it.  The content of the CMS page is simply:

{{block type="core/template" name="contactForm" form_action="/contacts/index/post"template="contacts/form.phtml"}}

I know, why don't they just use Magento's default /contacts form.  That's the way they have it set up but I will talk to them about changing it as it would make things easier.

Anyway the problem is I want to add a block to contactForm, I've tried with below Layout XML in a local.xml and in the CMS Page Layout Update XML section, but it doesn't work.

local.xml

<contacts_index_index>
    <reference name="contactForm">
        <block type="studioforty9_recaptcha/explicit" name="studioforty9.recaptcha.explicit" template="studioforty9/recaptcha/explicit.phtml"/>
    </reference>
</contacts_index_index>

CMS Page Layout Update XML

<reference name="contactForm">
        <block type="studioforty9_recaptcha/explicit" name="studioforty9.recaptcha.explicit" template="studioforty9/recaptcha/explicit.phtml"/>
</reference>

I'm not sure why it's not working, I also tried adding the studioforty9_recaptcha/explicit block to System > Permissions > Blocks, but that didn't work either.

I can see it is working with the /contacts form so am going to encourage them to just use this one, but am interested as to why my layout updates are not working.

I'm working on an old version of Magento, 1.7, I wonder if this may have something to do with it.


texts:
I have a Magento 2.0 store that I am trying to update the categories and products on. When I run it through the gui I get the following error message:

  exception 'Magento\Framework\Exception\LocalizedException' with message 'Class Magento\Catalog\Model\Indexer\Category\Flat\Action\FullFactory does not exist' in vendor/magento/framework/Code/Generator.php:103
  Stack trace:
  #0 vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Catalog...') #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Catalog...')
  #2 [internal function]: spl_autoload_call('Magento\Catalog...')
  #3 vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Catalog...')
  #4 vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Catalog...')
  #5

Any ideas? I'm a bit stumped and would appreciate any help.


texts: How to conditionally mutate widget based on configuration value

texts:
I'm in the process of porting an M1 module over to M2 and am trying to figure out the cleanest approach for conditionally mutating a component based on a system configuration value.

In Magento 1 I did the following:

Use ifconfig in a layout.xml file to load a JavaScript file which mutates a Prototype JS class.

I've read through Magento's "use custom JavaScript" but it doesn't seem to account for this use case.

The best way I can think of to do this is...

Add some dummy element to the document with a data property for the configuration value.
Mutate the widget and use jQuery to access the value from the document.

Feels pretty dirty and I'm wondering if there's a cleaner way?


texts: Pulling simple products into cart from configurable

texts:
I have a configurable product, where the simple products have different stats (i.e. some have no VAT), so when it comes to checkout, I need the simple products to be in the cart to show the differences.

Is there a way to pull the simple products from the Configurable when the customer adds the configurable item to the cart?

Additional info:Magento ver: 1.7Plugin using: Magento Mechanics Products Grid


texts: Braintree charging twice when order is shipped

texts:
We are facing an issue that the transaction is being created twice on Braintree and our clients have been charged twice.

What we found is that the TransactionTime on Braintree is the same for when the order is created (first transaction) and when the order is shipped (second transaction).

Here is the first transaction on the Braintree panel (the right one):

Here is the second transaction on the Braintree panel (duplicated):

I configured the Braintree to Authorize and Capture
If you repair on the second image you'll see that there is no orderId setted on Braintree transaction.
Both transaction type is sale
Braintree and my Magento comments on panel has 2 hours timezone difference
Magento version 2.2.8 (it was upgraded recently from 2.2.6)


texts: How to add knockout js binding to custom template

texts:
We want to add proceed to checkout button

on product detail page.

We will show this checkout button when cart have items

otherwise we will remove this.

See this : http://www.awesomescreenshot.com/image/1702035/4335f469aee99eb7375a9fdeb7d2f22e


texts: Unable to get Grunt less task working on Custom Magento theme

texts:
Good morning,

I'm pretty new to Magento 2 and I'm currently in the process of trying to get my first custom M2 theme up and running.

I have managed to create my new theme but running into trouble when trying to get the Grunt LESS task running.

I have been following the Magento docs and do the following...

added in the package.json, Gruntfile.js, and grunt-config.json files
ran npm install && npm update
I've then proceeded to add a local-themes.js file and update it to contain the following...

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

'use strict';

/**
* Define Themes
*
* area: area, one of (frontend|adminhtml|doc),
* name: theme name in format Vendor/theme-name,
* locale: locale,
* files: [
* 'css/styles-m',
* 'css/styles-l'
* ],
* dsl: dynamic stylesheet language (less|sass)
*
*/
module.exports = {
 blank: {
     area: 'frontend',
     name: 'Magento/blank',
     locale: 'en_US',
     files: [
         'css/styles-m',
         'css/styles-l',
         'css/email',
         'css/email-inline'
     ],
     dsl: 'less'
 },
 luma: {
     area: 'frontend',
     name: 'Magento/luma',
     locale: 'en_US',
     files: [
         'css/styles-m',
         'css/styles-l'
     ],
     dsl: 'less'
 },
 alpha: {
     area: 'frontend',
     name: 'SC/alpha',
     locale: 'en_GB',
     files: [
         'css/styles-m',
         'css/styles-l'
     ],
     dsl: 'less'
 },
 backend: {
     area: 'adminhtml',
     name: 'Magento/backend',
     locale: 'en_US',
     files: [
         'css/styles-old',
         'css/styles'
     ],
     dsl: 'less'
 }
};

My grunt-config.json is as follows...

{
    "themes": "dev/tools/grunt/configs/local-themes"
}

Then when I try running the grunt exec:alpha command I get the following error...

Running "exec:alpha" (exec) task
Verifying property exec.alpha exists in config...ERROR
>> Unable to process task.
Warning: Required config property "exec.alpha" missing. Use --force to continue.

Aborted due to warnings.

Running the grunt exec command by itself references the blank and luma themes but not my custom theme.

Really not sure on how to proceed with this, has anyone else encountered this problem before?

Any help on this would be greatly appreciated.


texts:
I'm using Magento 2 CE Version 2.1.0

Sometimes it gives below kind of error

  Fatal error: Call to a member function getId() on null in {folder
  path}\magento2\vendor\magento\module-backend\Block\Menu.php on line
  296

Below is the code from

public function getCacheKeyInfo()
    {
        $cacheKeyInfo = [
            'admin_top_nav',
            $this->getActive(),
            $this->_authSession->getUser()->getId(), // Giving Error on this Line
            $this->_localeResolver->getLocale(),
        ];
        // Add additional key parameters if needed
        $newCacheKeyInfo = $this->getAdditionalCacheKeyInfo();
        if (is_array($newCacheKeyInfo) && !empty($newCacheKeyInfo)) {
            $cacheKeyInfo = array_merge($cacheKeyInfo, $newCacheKeyInfo);
        }
        return $cacheKeyInfo;
    }


texts: Magento 2 - Write plugin for API interface

texts:
In the documentation it says:

"A plugin, or interceptor, is a class that modifies the behavior of public class functions by intercepting a function call and running
code before, after, or around that function call. This allows you to
substitute or extend the behavior of original, public methods for
any class or interface."

But is this also true for API?
I try to write a afterSave Plugin for the class Magento\Quote\Api\CartItemRepositoryInterface to log something if the quote is getting saved.
But it does not work and no log is created.
app/code/Company/Checkout/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <type name="Magento\Quote\Api\CartItemRepositoryInterface">
        <plugin name="Company_Checkout_CartItemRepositoryInterface" type="Company\Checkout\Plugin\Quote\Api\CartItemRepositoryInterface" sortOrder="10"/>
    </type>
</config>

app/code/Company/Checkout/Plugin/Quote/Api/CartItemRepositoryInterface.php
<?php
namespace Company\Checkout\Plugin\Quote\Api;

class CartItemRepositoryInterface
{
    protected $_cartFactory;

    public function __construct(
        \Magento\Checkout\Model\CartFactory $cartFactory
    ) {
        $this->_cartFactory = $cartFactory;
    }

    public function afterSave(\Magento\Quote\Api\Data\CartItemInterface $cartItem)
    {
        $cart = $this->_cartFactory->create();
        $quote = $cart->getQuote();

        \Eddcapone\ChromePhp\Helper\ChromePhp::log("Hello from afterSave Plugin (API: module-quote/api/CartItemRepositoryInterface/save");
        \Eddcapone\ChromePhp\Helper\ChromePhp::log("QuoteId = ". $quote->getId());
    }

}

Update:
The reason was, that I tried to log by using chromePhp, which does not seem to work at API Interface plugins... Now I used this approach to log it:
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/zend_debug.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info("afterSave test");

...and it works!


texts: How are Permissions set on Cache Files in Magento 2.1

texts:
I'm working with Magento 2.1.  I have a magento_umask file that contains the following

#File: magento_umask
000

That's a mask of 000, which should give users, groups, and all-users/world write permissions to fils.  However, with this umask in place, Magento is generating cache files with the following permissions when run from the command line.

-rw-rw----  1 alanstorm  staff  508 Jun 28 10:52 /Users/alanstorm/Sites/magento-2-1-0.dev/project-community-edition/var/cache//mage-tags/mage---b3e_CONFIG

That is -- users and groups have read/write, but all-users/world have none.

Where does Magento's cache generating code change the permissions and/or override the explicit umask I've set?


texts: Magento 2: How to add a custom attribute to the CMS Page

texts:
I am trying to add a custom attribute to a CMS page in Magento 2.

As it seems there is no way of using EAV, since the Page model does not have entity types.

I tried to add an Extension Attribute, and using a preference for the CMS Page form, like described in this answer and added a field to the CmsPage edit form, but I can't get the plugin for the save functionality in PageRepositoryInterface to work.

The Extension Attribute is added as follows in etc/extension_attributes.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Cms\Api\Data\PageInterface">
    <attribute code="slider" type="VanOns\Slider\Api\Data\SliderInterface[]"/>
</extension_attributes>

The plugin for the PageRepositoryInterface in etc/di.xml:

<type name="Magento\Cms\Api\PageRepositoryInterface">
    <plugin name="pageAroundSave" type="VanOns\Slider\Model\Plugin\AroundPageRepositorySave"/>
</type>

If I use a logger in my aroundSave function, it won't log anything, suggesting it doesn't pass this function.

Any idea's on how to fix this?


texts: Magento 2 : How to locate language packs

texts:
I try translate other website. I install language pack via composer. Language pack pl_PL I found in vendor.
But I research are others folders and I cannot find other languages. eg. cs_CZ. Any one know how I can find this?


texts:
How would I apply this query to Magento to display results on page. Basically I want to show the top 10 users total sales purchase amount

SELECT customer_id,SUM(base_grand_total) AS total_sales
FROM sales_flat_order
GROUP BY customer_id
ORDER BY total_sales DESC
LIMIT 10;


texts:
I have a requirement where customer is not suppose to pay at the time of checkout and the order will be placed bypassing payment step/method. After order placing, customer will receive an email with a URL that will redirect him to payment step or payment page where the final payment will be done and order will be completed.

This is more than just bypassing the payment method.

How can I achieve this ?

Thanks.


texts: "random" order clause added to my collection

texts:
For a module I load a custom product collection where I select products based on IDs in an array, I also try and sort the collection by the same order as the IDs have in the array().

To achieve the sorting I use Zend's getSelect->order() to add a custom "ORDER BY" to the SQL statement.

$collection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('entity_id', $productIds)
            ->addOrder('entity_id');

$sortIds = array_map('intval', $productIds);
$collection->getSelect()
           ->order("find_in_set(e.entity_id,'".implode(',', $sortIds)."')");

This will generate a SQL error: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'cat_index_position' in 'order clause'", since I don't have the "cat_index_position" in my product flat table.

This error is because Magento adds an extra ORDER BY clause: 'cat_index_position' ASC after the one I add with getSelect()->order()

If I don't add the getSelect()->order() no extra ORDER BY is added and no SQL error is generated, however the sort order is obviously wrong.

I can, very ugly, hack this by commenting out the rest of the SQL statement like this $collection->getSelect()->order("find_in_set(e.entity_id,'".implode(',',$ids)."');--"); but I really really don't want to do that.

I need help tracking down the source of that extra ORDER BY clause or any other way of solving it.

UPDATE

If I do $collection->getSelect()->__toString() after I've added my custom order I get:

  SELECT 1 AS status, e.entity_id, e.type_id, e.attribute_set_id
  FROM catalog_product_flat_1 AS e
  WHERE (((e.entity_id = '8534') OR (e.entity_id = '4184') OR (e.entity_id = '4185') OR (e.entity_id =
  '4183') OR (e.entity_id = '13314') OR (e.entity_id = '5069') OR
  (e.entity_id = '11217') OR (e.entity_id = '4355') OR (e.entity_id =
  '4354') OR (e.entity_id = '4353') OR (e.entity_id = '4352') OR
  (e.entity_id = '4351') OR (e.entity_id = '4350') OR (e.entity_id =
  '4349') OR (e.entity_id = '4348') OR (e.entity_id = '5203'))) ORDER BY
  find_in_set(e.entity_id,'8534,4184,4185,4183,13314,5069,11217,4355,4354,4353,4352,4351,4350,4349,4348,5203')
  ASC

And as I said previously, now Magento adds an extra ORDER BY, because the error I get say I have this SQL statement:

  SELECT 1 AS status, e.entity_id, e.type_id, e.attribute_set_id
  FROM catalog_product_flat_1 AS e
  WHERE (((e.entity_id = '8534') OR (e.entity_id = '4184') OR (e.entity_id = '4185') OR (e.entity_id =
  '4183') OR (e.entity_id = '13314') OR (e.entity_id = '5069') OR
  (e.entity_id = '11217') OR (e.entity_id = '4355') OR (e.entity_id =
  '4354') OR (e.entity_id = '4353') OR (e.entity_id = '4352') OR
  (e.entity_id = '4351') OR (e.entity_id = '4350') OR (e.entity_id =
  '4349') OR (e.entity_id = '4348') OR (e.entity_id = '5203'))) ORDER BY
  find_in_set(e.entity_id,'8534,4184,4185,4183,13314,5069,11217,4355,4354,4353,4352,4351,4350,4349,4348,5203')
  ASC, cat_index_position ASC, e.entity_id ASC LIMIT 16


texts: How to add more information to Order Information page (Admin and Customer)

texts:
I'm super noob in Magento module development, but I'm working on a custom payment module that grabs some payment information on checkout into "additional_information", using this Observer:

class DataAssignObserver extends AbstractDataAssignObserver
{
    /**
     * @param Observer $observer
     * @return void
     */
    public function execute(Observer $observer)
    {
        $method = $this->readMethodArgument($observer);
        $data = $this->readDataArgument($observer);

        $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
        if (!is_array($additionalData)) {
            return;
        }

        // $paymentModel = $this->readPaymentModelArgument($observer);  // Magento 2.1 ONLY
        $paymentInfo = $method->getInfoInstance();

        // $paymentModel->setAdditionalInformation(
        $paymentInfo->setAdditionalInformation(
            $additionalData
        );
    }
}

Is there a detailed example on how to pull this information into the Order information pages, admin and customer side?

I know a few bits and pieces, like $paymentInfo->getAdditionalInformation(), but I'd really like to have a detailed example for it.


texts: Magento 2.1, Help figuring out Cron job error

texts:
So I'm testing my cron jobs, and found out I'm getting the following error:

/usr/bin/php70 -c /etc/opt/remi/php70/php.ini /home/user/public_html/update/cron.php >> /home/user/public_html/var/log/update.cron.log

  PHP Warning:
  require_once(/home/user/public_html/update/vendor/autoload.php):
  failed to open stream: No such file or directory in
  /home/user/public_html/update/app/bootstrap.php on line 13 PHP Fatal
  error:  require_once(): Failed opening required
  '/home/user/public_html/update/vendor/autoload.php'
  (include_path='.:/opt/remi/php70/root/usr/share/pear:/opt/remi/php70/root/usr/share/php:/usr/share/pear:/usr/share/php')
  in  /home/user/public_html/update/app/bootstrap.php on line 13

I've looked at the bootstrap, which is attempting to load the autoload.php, which I have no idea what its supposed to do.


texts: How to set a fallback to English for non-existing language in Magento 2?

texts:
I have a i18n folder with 7 csv files which contain keys and translation into 7 different languages.

Then I go into admin panel and in General->Locale options, I select a language which is contained in my i18n folder.
All works fine as expected (I see correct translation in frontend checkout page).

But when within admin panel, I select the locale which I don’t have in my i18n folder, then in frontend checkout page I only see translation keys (and not translation them selves).

  Is there a way to set a default fallback language to English for example, when the current selected language is not supported?


texts: How to add a ajax option to load address in Admin panel customer information address tab?

texts:
Hi guys we want to add a pagination/load more feature in backend customer edit address section.
Please guide us on how we can do this.


texts: Magento 2 : Pass URL from Static block to PHTML

texts:
In my static block, Following is code

    {{block
        class="Magento\Framework\View\Element\Template"
        template="Magento_Theme::html/homepage-blocks.phtml"
        title="Scoring &amp; Management"
        linktitle="SHOP NOW"
        link="{{store_url='parts.html'}}"
        bgimage="{{media url='wysiwyg/parts.jpg'}}"
    }}

In my homepage-blocks.phtml I'm trying to get above data as following

<?php
    echo $block->getBgimage(). "
";
    echo $block->getTitle(). "
";
    echo $block->getLink(). "
";
    echo $block->getLinktitle(). "
";
?>

And I'm getting following output in frontend

Scoring & Management
{{store_url=parts.html
SHOP NOW
" bgimage="http://test.test/pub/media/wysiwyg/parts.jpg" }}

But instead, I want the following output

Scoring & Management
http://test.test/parts.html
SHOP NOW
http://test.test/pub/media/wysiwyg/parts.jpg

What went wrong?


texts: Magento 2.2.5 : setData save records array vise

texts:
I have so many fields in my custom table. When, I update records at that time, I save records as like below code :

$myModel->load($id);
$myModel->setData('field_1',$field_1);
$myModel->setData('field_2',$field_2);
$myModel->setData('field_3',$field_3);
$myModel->setData('field_4',$field_4);
$myModel->setData('field_5',$field_5);
$myModel->setData('field_6',$field_6);
$myModel->save();

But, I don't want to use setData() multiple times. Then, how to save records just using one time setData().

Anyone know about this?


texts: I am trying to alter the text below the PayPal express checkout but cannot find it anywhere? Where do i start to look.


texts:
I'm trying to log information using an Psr\Log\LoggerInterface instance, but for some reason var/log/system.log file doesn't exist and Magento can't create it; and when I create manually that file then the Magento is able to write my logs in that file and I think I don't have to create manually my logs files it doesn't make sense.

The file directories have the correct permissions and I have my Magento instance in developer mode.

I don't know if anybody can help me with this problem.

This is my code:

class Cron
{
    protected $logger;

    public function __construct(\Psr\Log\LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    public function logHello()
    {
        $this->logger->info('Hello from Cron job!');
        return $this;
    }
}


texts:
I want to change this default logo

How to change??


texts:
In magento 2 i am enable developer mode, all things are working good but today

Its give me this error

  Warning: DOMDocument::schemaValidate(): Invalid Schema in\magento\framework\Config\Dom.php on line 290

When i am disable developer mode its working properly, i don't understand why this error generate suddenly

i want to enable developer mode,is there any solution?


texts: How to clear cache on page loading magento 2?

texts: I need to flush cache when a controller is loaded. This is mandatory for me because some function works only when cache is cleared. I Hope will get help.


texts: An error occurred while saving the cms page in magento back-end

texts:
When i am creating new cms page at that time it give error "An error occurred while saving the page." but old cms pages i can save so please help me to solve this issue

Thank You.


texts: Product Page review field move google captcha before submit button in magento 2.0

texts: how can i move google captcha section before submit button in magento 2. i have add website key & secret key in magento google captcha. i have doesn't used any third party extension of google captcha. i have used google captcha only provided by magento. i have no idea how can i move to other position. please help me and thanks in advance.


texts: Magento search does not recognize one word: "bow"

texts:
We have a line of "bow" products, but the Magento search just completely ignores this word. It works just fine with all other products. If I search just the word "bow" it return no results. If I search the word "bow" with another term, it just ignore the word "bow" and search for the other term. e.g. if I search "red bow" it will only search for the word "red."

The minimal query length is set to 1. The name and description attributes are searchable. The products are searchable. They're in a "bow" category, which is not at root level. I've checked every setting I can think of or seen reccommended. There are no 3rd party modules that should be touching the search. Again, the search works fine otherwise. The bow products do come up in the search for other terms. It's literally just the word "bow" that it's ignoring.


texts: I want to change SKU Unique value to NO. How to edit this?


texts: How to get media directory path in a phtml file in magento 2?

texts:
Used the below method in order to get the media directory path, but it returns an error.

$om = \Magento\Core\Model\ObjectManager::getInstance();

$directoryList = $om->get(\Magento\App\Filesystem\DirectoryList::class);

$pubMediaDir = $directoryList->getPath(\Magento\App\Filesystem\DirectoryList::MEDIA);

Please help me to find a solution.


texts: magento 2 how to add magestore slider in blog phtml file

texts:
Here I have a blog page there I wanted to display banner sliders.
I configured the sliders they working fine in home page, but am unable to add in custom phtml(blog) page
here is my blog Phtml file

<?php
    $this->getLayout()->createBlock("Magestore\Bannerslider\Block\SliderItem")->setSliderId(3)->toHtml();

    $blockObj= $block->getLayout()->createBlock('Mageplaza\Blog\Block\Listpost');
    $blockImageResize= $block->getLayout()->createBlock('Mageplaza\Blog\Block\Frontend');

    // $coll =  $blockObj->getPostCollection();

?>

    <?php
    ?>

    <a href="<?= $block->getRssUrl('post/rss') ?>" class="bb-rss-icon">
        <img src="<?= $this->getViewFileUrl('Mageplaza_Blog::media/images/rss.png') ?>" width="16px">

What am doing wrong? can i get help? Thank you.


texts: Writing unit tests: refactor the original vs deal with difficult code to test

texts:
Given that I am using EcomDev's PHPUnit framework to write unit tests for my Magento modules, sometimes I come across a controller action that has too much logic within it. It would mean mocking lots of objects and probably providing lots of fixtures to create an effective unit test for methods like this.

Of course, in hindsight the methods should have been written to be smaller and utilize models and helpers wherever possible in small, testable functions, but retrofitting unit tests doesn't really give you that flexibility.

My question is: when situations like this occur, should I:

Refactor the original controller method to be more modular and easy to unit test
Battle on through what looks to be an inefficient method to write unit tests for (time to write test greatly outweighs the benefit of having it)
Skip writing unit tests for this method altogether


texts: Magento 2 - Undefined index: instance in PluginList/PluginList.php

texts:
I am getting below error while compilation.

Notice: Undefined index: instance in /var/www/html/magenot2/vendor/magento/framework/Interception/PluginList/PluginList.php on line 196

Anyone have any idea how to solve this.

Thank you


texts: *Completely* Disabling Frontend Customer Registration

texts:
So I have read a few threads which all go into detail of removing the create account login button, hiding the content, and even creating a mini extension to remove such activity (http://importantmagento.blogspot.com/2012/06/how-to-disable-user-registration-in_22.html)

I have done all of these, however still adding customer/account/create/ to the end of the webstore still persists with a create account page. Any ideas what I can do here? I have a webstore in which we manually create each account, however it appears someone has found the loophole and persists in creating an account. Thanks!


texts: Magento2.3 : Unit Case writing for Observers

texts:
I was wondering what is best practice for Unit test case writing for observers ?
I looked for examples in core , and found below file

 magento/module-sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php

I found even there are no assertions are performed but when we run test case for it

Time: 1.6 seconds, Memory: 10.00MB

OK (1 test, 3 assertions)

if someone can even point me to reference article it would be helpful