texts: PayPal express checkout issue on custom discount

texts:
I have an issue during the paypal express checkout.
I have a custom module for applying custom discount on quote. During paypal payment, it fails returning this error:

report.CRITICAL: PayPal NVP gateway errors: The totals of the cart
item amounts do not match order amounts (#10413: Transaction refused
because of an invalid argument. See additional error messages for
details). Correlation ID: 9bf727de5b54e. Version: 72.0. []

I did eventually find a solution to this problem, which was adding another custom module that triggers on payment_cart_collect_items_and_amounts event and add a custom item with the negative amount of the discount to the quote:
public function execute(Observer $observer){
    $this->logger->info("Add Product PayPal payment ", array());
    $cart = $observer->getEvent()->getCart();
    $quote = $this->checkout_session->getQuote();
    $this->promoter->setQuote($quote);
    $customAmount = $this->promoter->getQuoteTotalDiscount();
    $this->logger->info("quote discount: ", array($customAmount));
    $cart->addCustomItem(__("Promozioni"), 1, -1.00 * $customAmount, "Promozioni");
}

The solution was working perfectly, but then i had to change a configuration in the PayPal module.
I had to set in Stores -> Configuration -> Sales -> Payment methods.
Under PayPal configure button -> Basic Settings - PayPal Express Checkout -> Payment Action i changed from "Authorization" to "Sale".
After saving the configuration the PayPal express checkout returned the same error as before (inside var/log/system.log)

[2020-08-11 10:09:34] report.INFO: Add Product PayPal payment  []
[2020-08-11 10:09:35] report.INFO: quote discount::  [139.8]
[2020-08-11 10:09:36] report.CRITICAL: PayPal NVP gateway errors: The totals of the cart
item amounts do not match order amounts (#10413: Transaction refused
because of an invalid argument. See additional error messages for
details). Correlation ID: 9bf727de5b54e. Version: 72.0. []

As you can see the module is running because it is printing the correct test logs.
Checking the quote and sales_order table the totals values are correct.
If i bring back that configuration to "Authorization" the PayPal payment is working perfectly.
I also tried to change PayPal configuration under Basic Settings - PayPal Express Checkout -> Advanced Settings -> Transfer Cart Line Items from "Yes" to "No" with no results.
My magento version is Magento Enterprise 2.3.3
Thanks for the help.


texts: How to filter your admin grid collection based on certain condition in Ui component xml file

texts:
I want to filter my Grid based on condition that only active entries should be visible on the grid and not all entries from the table
I am using ui component to create grids


texts: How to tell which table should take in prepare collection method?

texts:
From this Change table name for admin grid collections thread, one doubt has come into being.

If we have been using 2 table in our custom module, how to tell which table should take in prepare collection method?

Eagarly awaiting for your response!


texts: magento 2 sales_order_shipment_save_after does not fire

texts:
I created an observer for changing the shipping method amount but it does not work.
This is my code

  Cop/Postexpres/etc/events.xml

<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_shipment_save_after">
    <observer name="popopp" instance="Cop\Postexpres\Model\Observer"  />
</event>

and

  Cop/Postexpres/Model/Observer.php

 namespace Cop\Postexpres\Observer;
      use Magento\Framework\Event\ObserverInterface;

class Observer implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $shipment = $observer->getEvent()->getShipment();
        $order = $shipment->getOrder();
       var_dump($order->getData());

    }

}


texts: Wrong currency displayed for old customer orders. How can this be changed?

texts:
I'm currently working on a new Magento ecommerce solution for our website.  Basically, I've migrated all the old data over using a tool for this purpose.  However, the old orders have come over having a currency of $.  I'm not sure why, as the base currency etc was set to £.

In any case, to fix it, the migration tool support suggested a re-migration of all the data again, not just the orders.  However, we've updated the Magento data a fair amount and didn't really want to migrate again.  So I'm wondering if there is another, safe solution to change older orders' currency, so it displays in £ and not $.

Thanks!

EDIT: Ok so on inspecting the table sales_flat_order, I can see that old orders have "USD" in the columns base_currency_code, global_currency_code, order_currency_code and store_currency_code.  I'm simply planning to update the values in these columns to have the value "GBP" (after backing up the table first of course!).


texts: Error when creating configurable product programmatically in multi-storeview site

texts:
I am trying to create a configurable product using the following code:

// Load Configurable Product
    $product = $this->product->create();
    $product = $product->load($parentId);

    $attributeValues = [];
    $options = $this->attribute->getOptions();
    array_shift($options); //remove the first option which is empty
    foreach($options as $option) {
        $attributeValues[] = [
            'label' => 'Option',
            'attribute_id' => $this->attribute->getId(),
            'value_index' => $option->getValue(),
        ];

    }

    $configurableAttributesData = [
        [
            'attribute_id' => $this->attribute->getId(),
            'code' => $this->attribute->getAttributeCode(),
            'label' => $this->attribute->getStoreLabel(),
            'position' => '1',
            'values' => $attributeValues,
        ],
    ];

    $this->output->writeln('ConfigurableOptions:'. print_r($configurableAttributesData, true));

    $configurableOptions = $this->optionsFactory->create($configurableAttributesData);

    $extensionConfigurableAttributes = $product->getExtensionAttributes();
    $extensionConfigurableAttributes->setConfigurableProductOptions($configurableOptions);
    $this->output->writeln("Linking deals:".print_r($simpleDeals['ids'], true));
    $extensionConfigurableAttributes->setConfigurableProductLinks($simpleDeals['ids']);
    $product->setExtensionAttributes($extensionConfigurableAttributes);
    $this->output->writeln('Extension attributes set');
    $this->productRepository->save($product);

All of the simple deals have been created at that point as well as the attribute options. This is what the $configurableAttributesData array looks like:

Array
(
[0] => Array
    (
        [attribute_id] => 215
        [code] => deal_options
        [label] => Option
        [position] => 1
        [values] => Array
            (
                [0] => Array
                    (
                        [label] => Option
                        [attribute_id] => 215
                        [value_index] => 128
                    )

                [1] => Array
                    (
                        [label] => Option
                        [attribute_id] => 215
                        [value_index] => 129
                    )

                [2] => Array
                    (
                        [label] => Option
                        [attribute_id] => 215
                        [value_index] => 130
                    )

            )

    )

)

But when running the code, everything runs smoothly except for the $this->productRepository->save($product); part which gives this error:

Option values are not specified.

Any idea what might cause this?

Thanks


texts:
How to create symbolic links in magento2 folder for pwa studio installation.
In linux using by

   ln command

But in windows, How to do?can anyone brief about this


texts: Varnish is running but don't see varnish in the response header

texts:
I have set up Varnish and confirm it's running in the server.

In the frontend browser response header shows this:

Accept-Ranges: bytes
Age: 46
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 37639
Content-Type: text/html; charset=UTF-8
Date: Thu, 28 Nov 2019 00:28:31 GMT
Expires: -1
Grace: none
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Magento-Cache-Control: max-age=86400, public, s-maxage=86400
X-Magento-Cache-Debug: HIT
X-UA-Compatible: IE=edge
X-XSS-Protection: 1; mode=block

I don't see any varnish related responses.

Is varnish working at all?


texts: Magento 2 How to add filter on render column with join

texts:
I want to add the filter on render column with join. I have 2 tables. first abcd that have cities name and second table have ids. That render column show name when coming id. that filter will show on grid of custom module. our main table have ids not name when I removed render then here city id's will show.
my code in grid.php

$this->addColumn(
                        '   city_id',
                        [
                            'header' => __('city Name'),
                            'type' => 'text',
                            'index' => 'city_id',
                            'renderer' => 'AB\DE\Block\Adminhtml\city\Grid\Renderer\cityName',
                            'header_css_class' => 'col-id',
                            'column_css_class' => 'col-id'

                        ]
                    );

I want to add filter. when some one enter name and shoe that names.


texts: How to add discount coupon code on Custom tab in Magento 2?

texts:
I have created Custom Tabs in Magento 2 Between Shipping and Review and Payment.
I want to remove Discount Coupon Code from Review and Payment to my Custom Tabs.How will i do it ?

I have already removed discount coupan from Review and Payment Screen. Now, i want to add it in my Custom tab ex. My Step Two Title.
How would i do that ?
I have added here one JS file and one HTML file but for each step i have added 3 js and html file.


texts:
I am using magento 2 api for assigning product link like related or crosssell
using api /V1/products/{sku}/links

Here is My Sample Code

<?php
error_reporting(E_ALL);
define('mag_apiurl',"http://www.mywebsite.com/rest/V1/");
define('tn_webshopKey',"myshowpkey");
$sku1 = "sku1";
$sku2 = "sku2";
$productData = array(
        "items" =>  array(
              "sku" => $sku1,
              "linkType" => 'related',
              "linkedProductSku" => $sku2,
              "linkedProductType" => "simple",
              "position" => 0
        )
    );

    $headers = array("Content-Type:application/json","Authorization: Bearer ".tn_webshopKey);
    $requestUrl= mag_apiurl.'products/'.$sku1.'/links';
    $ch = curl_init($requestUrl);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($productData));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    echo $returnProductDetails = curl_exec($ch);
?>

But Every time i run the script its
response

{"message":"%fieldName is required filed.","parameters":{"fieldName":"linkType"}}

But the link type 'related' is already defined in my data (productData)

Can anyone knows the solution


texts:
How can I fix the next error please: When i go to

  Store>Configuration>Store email address

and try to change from Name: Owner E-mail: owner@exemple.com to Name: Shop e-mail: shop@domain.com i get the next error below:
Something went wrong while saving this configuration: Validate class not found from base-name Magento\Framework\Validator\EmailAddress


texts: Simple product belonging to a configurable product not showing its details when clicking its thumbnail

texts:
I have a simple product which belongs to a configurable product. The simple product is out of stock. But in the front-end it is showing is corresponding thumbnail. And on clicking that thumbnail, it is showing the details of next available simple product.

I want to show the correct details of that simple product. When I made the simple product it stock and quantity to 10, it is showing correctly. But without changing that I want to display the details of product. Even though I cannot add it to the cart.

I am using Magento 1.7.0.2


texts: Magento2: Difference between Factory and Repository

texts: What is the difference between these two objects in magento2? (Factory and Repository) I have seen that they have almost the same methods. What proper use does one have?


texts: add product from codeigniter to magento 2 with options

texts:
On my server I have got Magento 2 running and at the same time I have got Codeigniter application.

What I am trying to do, is for my Codeigniter users  to be redirect to my Magento 2 site to complete their transaction from the codeigniter application.

I have created a custom module such to receive call from Codeigniter via Ajax.

In my js
I already defined var productId and var SiteUrl

var AjaxUrl=SiteUrl+"/carcomm/index/addproduct/id/"+productId;

Here is my Controller

<?php
namespace Ray\Carcomm\Controller\Index;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
class Addproduct extends \Magento\Framework\App\Action\Action
{
    protected $_resultPageFactory;
    protected $_cart;
    protected $_productRepositoryInterface;
    protected $_url;
    protected $_responseFactory;
    protected $_logger;

    public function __construct(
        Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Checkout\Model\Cart $cart,
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryInterface,
        \Magento\Framework\App\ResponseFactory $responseFactory,
        \Psr\Log\LoggerInterface $logger
        )
    {
        $this->_resultPageFactory = $resultPageFactory;
        $this->_cart = $cart;
        $this->_productRepositoryInterface = $productRepositoryInterface;
        $this->_responseFactory = $responseFactory;
        $this->_url = $context->getUrl();
        $this->_logger = $logger;
        parent::__construct($context);
    }

    public function execute()
    {
       $productId = $this->getRequest()->getParam('id');
       $TotalPrice = $this->getRequest()->getParam('price');
       $Product = $this->_productRepositoryInterface->getById($productid);
       //Define options
       $customOptions = array();
       $customOptions[0]=array('key' => 1, 'value' =>'Ford', 'title' =>'Car Type');
       $customOptions[1]=array('key' => 2, 'value' => '02-01-2019','title' =>'PickUp Date' );
       $customOptions[2]=array('key' => 3, 'value' => 'Ray Motors','title' =>'Dealer');
      //::::::::::
        $params = array (
            'product' => $productId,
            'qty' => 1,
            'price' => $TotalPrice,
            'options' =>  $customOptions
        );

       $this->_cart->addProduct($Product, $params);
       $isSaved=$this->_cart->save();
       $this->_redirect('checkout/cart/index');
    }

}?>

Ajax call is working because I logged headers in console and I am getting 200 ok

However product is not adding and redirection not working.

I am wondering if my approach is not correct or is there any other better approach to achieved this


texts:
I would like to put the top links (Login,Log out...) to my menu bar.

I would add the top links login option .

where I change to code in Magento 2?

Thanks.


texts: Find any file using Main.css using Grep Commandline

texts:
I'm looking to find a file that contains main.css using grep command line on mac OS/Linux.

How do I go about searching a directory using grep for a certain file?


texts:
This is not a question, I found this from here but my parameters are different.
I wanted to display 0 when cart is empty so I tried with jquery solutions after that I found knockout js inside the minicart area.then found this solution

Magento2 Minicart showing blank count

Thanks https://magento.stackexchange.com/users/2520/nagamani

Im using magento 2 ver. 2.1.2 - minicart coding ---

<span class="counter-number"> ko text: getCartParam('summary_count')   /ko </span>
To display 0 when cart is empty just add " || 0 " as follows.
 ko text: getCartParam('summary_count') || 0 --><!-- /ko >

This will helpful to everyone new to magento like me,
Thanks.


texts:
So I got some php code, but I want to separate the 'echo' from the 'echo this' so I can put them into 2 DIVs so that I can give them individual css (I have posted the exact code from my site). This code is to give a frontend message so that people can see that items are for backorder BEFORE the checkout phase.

<div class="extra-info">

<?php $inventory =  Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
$inv_qty = (int)$inventory->getQty();
if ($inventory->getBackorders() >= 0 && $inv_qty == 0) {
    echo "TO ORDER - LEAD TIME APROX. 3 WEEKS";
} else {
    echo $this->getChildHtml('product_type_availability');
}
?>
            </div>

Thx,


texts: Reverting block rewrite, how to set all child block elements

texts:
I had a custom page where I had to rewrite page/page.phtml, and inside the template file I needed some methods. So I had to rewrite the base class Mage_Page_Block_Html.
This is how my module's layout xml look liked:

  <vendorpage_index_index>
      <reference name="root">
          <action method="setTemplate">
              <template>page/vendor.phtml</template>
          </action>
      </reference>
  </vendorpage_index_index>

and the rewrite in the module's etc/config.xml:

    <blocks>
        <page>
            <rewrite>
                <html>OurCompany_Vendor_Block_Frontend_Vendor</html>
            </rewrite>
        </page>
    </blocks>

And it worked perfectly. However, Later, I found that it might make a conflict, because it rewrites the block class which is used everywhere, and it might rewrite other modules' rewrites. I removed the above rewrite xml, trying to redefine the block name root

<vendorpage_index_index>

    <block type="vendor/frontend_vendor" name="root" output="toHtml"
      template="page/vendor.phtml" />

<vendorpage_index_index>

But the problem was, I had to manually add millions of child blocks which were added to the root block manually. I suppose this is because of occupying the root block with a different type making the root forget all its children elements.

So I added the millions of blocks which were assigned to the root before the handle root occupation. Now I have a very long layout file full of duplicates,

<vendorpage_index_index>

    <block type="vendor/frontend_vendor" name="root" output="toHtml"
      template="page/vendor.phtml">

       <millions of blocks ...>

    </block>
<vendorpage_index_index>

which Evils of Duplication (®) are chasing. How do I avoid the duplication?


texts: What caused this "Payment Transaction Failed" error

texts:
I am getting intermittent errors that look like the one I copied below.  Any ideas what is causing this, and how to fix it?

Payment transaction failed.
Reason
This customer email already exists

Checkout Type
onepage

Customer:
XXXXX XXXXX XXXXXXXX

Items
AAAAAAAA® x 1 USD 44.99
BBBBBBBBB® x 1 USD 49.9900
Total:
USD 107.69

Billing Address:
Xxxxxx xxxxxxxx
693 E. Xxxxxx St
Xxxxxxx, California, xxxxx
United States
T: xxxxxxxxxxx
T: 5598015225

Shipping Address:
Xxxxxx xxxxxxxx
693 E. Xxxxxx St
Xxxxxxx, California, xxxxx
United States
T: xxxxxxxxxxx

Shipping Method:
StoreName Shipping

Payment Method:
PayPal

Date & Time:
Feb 4, 2015 3:14:19 PM


texts: Magento2.3.0 : In admin inside Payment method after save getting error

texts:
I am using Magento 2.3.0 I go to admin panel

  store -> configuration -> sales -> payment methods

enable any payment method after save below image display.

on this same page showing this error screenshot attached below

If any one idea please reply me how to resolve it.


texts: Magento 2: Get `core_config_data` Values without Creating a new Module

texts:
Is there a way in Magento 2.0 to  get a config value and display it in the header without creating a custom module?  I am trying to display the phone number from the admin Stores > Configuration under the search on the front-end header.

I figure I will have to add /app/design/frontend///Magento_Theme/templates/html/header.phtml as well as a layout/default.xml. But, I'm nut sure how to call the phone number.

The two main technical barriers I'm facing are

How can I fetch a configuration value from core_config_data from a theme.  If possible, I don't want to create a module to do this. It seems like there should be a standard object for performing this common task.
How can I add content to or replace the html/header.phtml template.

Note: This is not a duplicate, as the other question asks about creating a custom module and getting it's configuration values. That is NOT my question. I'm asking how to fetch a default Magento configuration value from core_config_data. Nothing to do with a custom module.


texts: File upload process for product file option?

texts:
I need to be able to modify the file of my product file type option after an order has been placed.

I then added, in the frontend order view using a <form> tag, a choose file button which allow file selection , and a "update file" button which call a custom controller.

In the controller, I can get the form values and the file (verified by Mage::log).

Now I need to update my options parameters (which is not a problem),

BUT, while looking in the original file option structure

<?php Mage::log('option'); Mage::log($_option); ?>
<?php Mage::log('option_value'); Mage::log(unserialize($_option['option_value'])); ?>

we can see :

2014-07-29T06:09:58+00:00 DEBUG (7): option
2014-07-29T06:09:58+00:00 DEBUG (7): Array
(
    [label] => Fichiers Gerber
    [value] => ecobiz.pdf.zip
    [print_value] => ecobiz.pdf.zip
    [option_id] => 6
    [option_type] => file
    [option_value] => a:10:{s:4:"type";s:15:"application/zip";s:5:"title";s:14:"ecobiz.pdf.zip";s:10:"quote_path";s:68:"/media/custom_options/quote/e/c/c25ad2046b4f47d3dbf136b87c40a61d.zip";s:10:"order_path";s:68:"/media/custom_options/order/e/c/c25ad2046b4f47d3dbf136b87c40a61d.zip";s:8:"fullpath";s:118:"/homepages/20/d524244365/htdocs/e-circuits/magento/media/custom_options/quote/e/c/c25ad2046b4f47d3dbf136b87c40a61d.zip";s:4:"size";s:6:"612878";s:5:"width";i:0;s:6:"height";i:0;s:10:"secret_key";s:20:"c25ad2046b4f47d3dbf1";s:3:"url";a:2:{s:5:"route";s:35:"sales/download/downloadCustomOption";s:6:"params";a:2:{s:2:"id";s:3:"353";s:3:"key";s:20:"c25ad2046b4f47d3dbf1";}}}
    [custom_view] => 1
)

2014-07-29T06:09:58+00:00 DEBUG (7): option_value
2014-07-29T06:09:58+00:00 DEBUG (7): Array
(
    [type] => application/zip
    [title] => ecobiz.pdf.zip
    [quote_path] => /media/custom_options/quote/e/c/c25ad2046b4f47d3dbf136b87c40a61d.zip
    [order_path] => /media/custom_options/order/e/c/c25ad2046b4f47d3dbf136b87c40a61d.zip
    [fullpath] => /homepages/20/d524244365/htdocs/e-circuits/magento/media/custom_options/quote/e/c/c25ad2046b4f47d3dbf136b87c40a61d.zip
    [size] => 612878
    [width] => 0
    [height] => 0
    [secret_key] => c25ad2046b4f47d3dbf1
    [url] => Array
        (
            [route] => sales/download/downloadCustomOption
            [params] => Array
                (
                    [id] => 353
                    [key] => c25ad2046b4f47d3dbf1
                )

        )

)

Also :

1 - files must be copied from tmp to a media directory (here e/c/)
How to do that, specially the creation / choice of the "e" and "c" directories?
(I do not manage to find the called function in magento files…)

2 -  there is a secret key stuff…
Is it the same as the URL secret key you call in forms?

<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

3 - the final file name seems to be the secret key added to the tmp name of the file you get in the form controller.
I am right?

Thank you for your help


texts: Magento 2 : collection filter error : Exception #0 (RuntimeException): Illegal state

texts:
I am having problem with collection filter

I am using event catalog_product_collection_apply_limitations_after to add collection limitations

In the observer i am using below code to apply filter.

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $collection = $observer->getEvent()->getCollection();
    $collection->addFieldToFilter('manufacturer','218');
    return $this;
}

It is throwing Exception #0 (RuntimeException): Illegal state

From

Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection::addFieldToFilter($field, $condition = null)

there is code that check $this->searchResult

 if ($this->searchResult !== null) {
        throw new \RuntimeException('Illegal state');
    }

check exception trace here

https://textsaver.flap.tv/lists/23zw

How to fix this if i remove throw new \RuntimeException('Illegal state'); then it is working but it's not a good idea right ?


texts:
I have this query in my .phtml file.

//Retrieve the read connection
$readConnection     = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql = "SELECT DATE_FORMAT(created_at,'%d-%m-%Y') AS order_date,COUNT(entity_id) AS total_orders
        FROM sales_flat_order
        WHERE DATE_FORMAT(created_at,'%Y-%m-%d') >= '2018-01-01'
        GROUP BY DATE_FORMAT(created_at,'%Y-%m-%d')";
$result = $readConnection->fetchAll($sql);

I want to generate chart using this data without install any extension.

    +---------------+--------------+
    | Order Date    | Total orders |
    +---------------+--------------+
    | 01-01-2018    | 287          |
    +---------------+--------------+
    | 05-01-2018    | 125          |
    +---------------+--------------+
    | 07-01-2018    | 27           |
    +---------------+--------------+
    | 10-01-2018    | 75           |
    +---------------+--------------+

Can I do it..?


texts: Magento 2.3.0: How to add TIMESTAMP_INIT as a default value in declarative schema?

texts:
As I'm adding CURRENT_TIMESTAMP as a default value for created_datetime
 and updated_datetime columns in my database table named faqs, I'm getting both the columns updated while edit the FAQ in admin form.

I want to update timestamp only for updated_datetime column. So for that I'm trying to add TIMESTAMP_INIT as a default value for created_datetime column and TIMESTAMP_INIT_UPDATE for updated_datetime column as described follows:

  app\code\Namespace\Module\etc\db_schema.xml

<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="faqs" resource="default" engine="innodb" comment="FAQ Table">
        ........
        <column xsi:type="timestamp" name="created_datetime" nullable="false" default="TIMESTAMP_INIT" comment="Created Datetime"/>
        <column xsi:type="timestamp" name="updated_datetime" nullable="false" default="TIMESTAMP_INIT_UPDATE" comment="Updated Datetime"/>
        ........
    </table>
</schema>

While running php bin/magento setup:upgrade command in cmd, I'm getting following error:

Element 'column', attribute 'default': [facet 'enumeration'] The value 'TIMESTAMP_INIT' is not an element of the set {'CURRENT_TIMESTAMP', '0', 'NULL'}.
Line: 12
Element 'column', attribute 'default': 'TIMESTAMP_INIT' is not a valid value of the atomic type 'defaults'.
Line: 12
Element 'column', attribute 'default': [facet 'enumeration'] The value 'TIMESTAMP_INIT_UPDATE' is not an element of the set {'CURRENT_TIMESTAMP', '0', 'NULL'}.
Line: 13
Element 'column', attribute 'default': 'TIMESTAMP_INIT_UPDATE' is not a valid value of the atomic type 'defaults'.
Line: 13

Can anyone please help me to correct the syntax or guide me how to achieve this in db_schema.xml? Thanks in anticipation.


texts:
How to add a new Bundle item to all products?
Is there a way in Magento to update all of these products?
I have not found a normal example at the moment


texts: Magento 2 layout with no html head or body tags for ajax output

texts:
I'm attempting to output the wishlist block as an ajax request. I've attempted to do it in the controller using

$block = $resultPage->getLayout()
->createBlock('Magento\Wishlist\Block\Customer\Wishlist','miniwishlist')
->setTemplate('Company_Module::miniwishlist.phtml')
->toHtml();

But as the block contains several child blocks and I didn't have any success in using the setChild method programmatically.

I've since created a layout file that returns the block by itself. The problem is that output contains html, head, body tags, css and javascript.

I want to return only the block and nothing else. How can I achieve that?


texts: How do I show related products on GPMD theme

texts:
I am using magento ver1.9.2 and GPMD.

I would love to ask that how to show related products on GPMD theme.I was able to show it when I use default one.However I cannot now.

I think I should put or rename some files.Do you have some tips or know how to do?I want to know it.That would be so helpful to me.


texts: Fatal error: Call to a member function getConfigTimezone() on null Magento 2.2

texts:
I'm trying to create a helper class that will help me determine If I should present some labels like new/sale etc. I'd like to inject to it a TimezoneInterface via the constructor however $_localeDate always comes back as null when I check on the debugger so I end up with the error below.

Fatal error: Uncaught Error: Call to a member function getConfigTimezone() on null in ...

Is there some additional step I forgot to take?

Here's my sample code

namespace Vendor\Module\Helper;

use Magento\Catalog\Model\Product;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;

class Label extends AbstractHelper
{
    /**
     * @var TimezoneInterface
     */
    protected $_localeDate;

    public function _construct(Context $context, TimezoneInterface $localeDate)
    {
        $this->_localeDate = $localeDate;
        parent::__construct($context);
    }

    /**
     * @param $product Product
     * @return bool
     */
    public function showLabel($product)
    {
        $zone = $this->_localeDate->getConfigTimezone();
        //...

    }

}


texts:
When displaying a product collection using a Mage_Catalog_Block_Product_List-type block, the custom attributes manufacturer and part_number are both blank/null/empty strings. Here's what's been checked so far:

The attributes have been added to the default product attribute set
The attributes have been added to the <reference name="product_list"> using the addAttribute method
Both attributes are set to Display in product listing in their configurations
The attributes are accessible via getManufacturer and getPartNumber after a product load

I have attempted some debugging (for example, I know the addAttribute method is being called), but if this is an issue anyone's run into, I would greatly appreciate some guidance.

As a side note, these two attributes do show up in some development environments, but not in what will be production. This leads me to believe that it's a configuration issue, though I don't want to influence answers down my (possibly) wrong line of thought.

Thanks


texts: How to validate postal code by country id?

texts:
In Magento checkout there is a postal code verification for each country, now I want to implement it in different module for different case, how to do it if I already have the country id and postal code as the parameter, for example:

$postalCode = '15433';
$countryId = 'UK';
$this->validatePostalCode($countryId,$postalCode);

public function validatePostalCode($countryId,$postalCode){
  // how?
  if($valid) return true;
  else return false;
}


texts:
How do we get Current grid name in our grid.phtml

I want to check whether we are on sales order grid or not.

if(Sales_order_grid){

Do some Action
}


texts: Completely remove magento 2 using command

texts:
How can i remove magento2 using command line?

I wants to remove database manually.

I want to get it by command line.

Please help me to solve out this.


texts: How to create new email template in Admin end in magento 2

texts: How to create a new email template in backend in magento 2


texts: Get the active shipping methods and rates custom checkout page?

texts:
We have integrate the custom checkout page. I will try to get the shipping methods and rates. I used the below code get all shipping methods but i want shipping cost also. How to get the shipping rates of the customer address

public function getActiveShippingMethods(){

        $activeCarriers = Mage::getSingleton('shipping/config')->getActiveCarriers();

        $allCarriers = array();

        foreach($activeCarriers as $carrierCode => $carrierModel){
            $options = array();

            if( $carrierMethods = $carrierModel->getAllowedMethods() ){

                $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
                foreach ($carrierMethods as $methodCode => $method) {
                    $code= $carrierCode.'_'.$methodCode;

                    $options[]=array('value'=>$code,'label'=>$carrierTitle.' '.$method);
                    $allCarriers[] = array('value'=>$code,'label'=>$carrierTitle.' '.$method,'label_disp'=>$carrierMethods[$methodCode]);

                }

            }
            $methods[]=array('value'=>$options,'label'=>$carrierTitle);
        }

         return $allCarriers;
    }


texts: Magento 2 create foreign key with upgrade schema

texts:
I have 2 table. I want to createForeignKey. I have my code:

if(version_compare($context->getVersion(), '1.2.0', '<')) {
        $installer->getConnection()->addForeignKey(
            $installer->getFkName('course_courses', 'courses_id', $installer->getTable('course_participant'), 'courses_id'),
            $installer->getTable('course_courses'),
            'courses_id',
            $installer->getTable('course_participant'),
            'courses_id',
            \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
        );
    }

Please help me!


texts: Magento2: Wrap all contents under .page-wrapper in new container

texts:
Im trying to add a secondary div wrapper if you like underneath the .page-wrapper, for example:

Is there a supported way of doing this by just creating a new container?  Im able to get a new container to show on the page but it doesn't wrap the rest of the contents.


texts: Create credit memo programatically - refund offline issue

texts:
This is my code:

    $OldOrder = Mage::getModel('sales/order')->loadByIncrementId(3123121312);
    $invoices = $OldOrder->getInvoiceCollection();
    $service = Mage::getModel('sales/service_order', $OldOrder);
    foreach ($invoices as $invoice){
        $data = [];
        $data['shipping_amount'] = 0;
        $data['grand_total'] = 1;
        $data['base_grand_total'] = 1;
        $data['adjustment_positive'] = 1;
        $data['qtys'] = array(0 => 0);
        $creditmemo = $service->prepareInvoiceCreditmemo($invoice, $data);
        $creditmemo->setShippingAmount(0);
        $creditmemo->setGrandTotal(1);
        $creditmemo->setRefundRequested(true);
        $creditmemo->setOfflineRequested(false);
        $creditmemo->setPaymentRefundDisallowed(false);
        try {
            $creditmemo->refund();
        }catch(Exception $e){
            var_dump($e->getMessage());
        }
    }

I got no error, nothing, but the credit memo is not created . Any ideas why ?


texts: Magento2: Display attribute text on products list.phtml

texts:
I use this code for display product attributes on products list.phtml
<?php
    $optionText = '';
    $attr = $_product->getResource()->getAttribute('help_name');

    if ($attr->usesSource()) {
       $optionText = $attr->getSource()->getOptionText($_product->getHelpName());
    }
?>
<?php if($optionText){ ?>

<?php echo $optionText ?>

<?php } ?>

<?php if($_product->getAttributeText('capacity')) : ?>
    <?php $optionValue = $_product->getAttributeText('capacity'); ?>

<?= $optionValue; ?>

<?php endif; ?>

But all this attributes is: drop down
When I create attribute text (no dropdown) and add to our code, then no display in frontend.
Aby solution?


texts: I grab category object from observer on event catalog_controller_category_init_after. Should I check it against store id? Or the fact that its loaded in controller first and then passed to event (and observer) makes it valid against the scope, as well as its data?


texts: Magento2 Category field Custom Layout Update - add handle and declaration of handle file

texts:
In Magento 2, has anyone tried to add an update handle in "Custom Layout Update" on the category admin page? I've set the following on a category:

<update handle="my_handle_lorem_ipsum_lorem" />

And I created the following file in my current theme:

[theme dir]/Magento_Catalog/layout/my_handle_lorem_ipsum_lorem.xml

However, the update handle doesn't appear to be applied.

I know the XML directives in my_handle_lorem_ipsum_lorem.xml are correct because they work correctly when placed in [theme dir]/Magento_Catalog/layout/catalog_category_view_id_123.xml.

By debugging I've found that the "Custom Layout Update" attribute is handled here:

// \Magento\Catalog\Controller\Category\View::execute() [excerpt]

$layoutUpdates = $settings->getLayoutUpdates();
if ($layoutUpdates && is_array($layoutUpdates)) {
    foreach ($layoutUpdates as $layoutUpdate) {
        $page->addUpdate($layoutUpdate);
    }
}

Tracing the source of $layoutUpdates, I found that it ultimately gets set in _extractSettings() of \Magento\Catalog\Model\Design:

// \Magento\Catalog\Model\Design::_extractSettings() [excerpt]

$settings->setCustomDesign(
    $object->getCustomDesign()
)->setPageLayout(
    $object->getPageLayout()
)->setLayoutUpdates(
    (array)$object->getCustomLayoutUpdate()
);

That pulls the entire string <update handle="my_handle_lorem_ipsum_lorem" /> from the category attribute. Does that mean it's trying to use the entire string as the handle name?

All I see is the call to addUpdate(). There doesn't seem to be a call to any function of the Merge class that would incorporate it into the overall layout XML.

In general, how should we add a handle in the category field "Custom Layout Update," and where and how should the file should be declared?


texts: setStoreId() not working on quote collecton

texts:
I have been loading quote collection like this:

$quote = Mage::getModel('sales/quote')
                        ->setStoreId($store)
                        ->load($quote_id);

I have 2 stores on my website. Above code gives same result on my both stores. ie: setStoreId is not working here.

How do i get store wise quote ?


texts: How to set discount when you buy 2 or more but limited to same SKU

texts:
E.g
A store wants to run a promotion to offer 10% off when purchase 10 or more of the SAME item(SKU).

Here comes a customers buys:
1 x Scarf (Pink)
1 x Scarf (White)
10 x Scarf (Red)

But Magento gives 10% of all the above 12 scarves instead of just the 10 red scarves.

What shall be done to solve it?

Many thanks!


texts:
I want to display free shipping product promotion message on product view & cart page. But I cannot be getting promotion details.

Magento2: How to get cart rules applied product details on product view page and cart page?

Magento 2.0


texts: Magento addAttributeToFilter array Value

texts:
I'm getting all products with this code:

->addAttributeToSelect('*')
->addStoreFilter()
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$collection->getSelect()->order('rand()');
$collection->getSelect()->limit(12);

and also I added this code to get products with "size" attribute.

->addAttributeToFilter('size', '13')

And now, I'm asking how can I do that with array. I mean getting products value of size = 13,14,15 like array


texts: Magento 2 instantiating classes through object manager factory

texts:
In magento 2 the classes are instantiated using an object manager factory:  \Magento\Framework\ObjectManager\Factory\Factory::create().
So far so goo. But there is something that I don't understand here.
After checking if there are no circular references in the arguments that should be passed to the constructor for DI and after the arguments are determined there is this ($args are the arguments that should be passed to the constructor):

    switch (count($args)) {
        case 1:
            return new $type($args[0]);
        case 2:
            return new $type($args[0], $args[1]);
        case 3:
            return new $type($args[0], $args[1], $args[2]);
        case 4:
            return new $type($args[0], $args[1], $args[2], $args[3]);
        case 5:
            return new $type($args[0], $args[1], $args[2], $args[3], $args[4]);
        case 6:
            return new $type($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
        case 7:
            return new $type($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6]);
        case 8:
            return new $type($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7]);
        default:
            $reflection = new \ReflectionClass($type);
            return $reflection->newInstanceArgs($args);
    }

Why is this long switch statement? Why not use directly the code from the default branch?
Or why stop the case at 8? Why not 5 or 10 or 127?


texts: Problem to override Product/attribute/backend/Media

texts:
I have a problem to override Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media.

Here is what I did:

config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Xx_Catalog>
      <version>0.1.0</version>
    </Xx_Catalog>
  </modules>
  <global>
    <models>
      <xx_catalog>
        <class>Xx_Catalog_Model</class>
      </xx_catalog>
      <catalog_resource>
        <rewrite>
          <product_attribute_backend_media>
        Xx_Catalog_Model_Resource_Product_Attribute_Backend_Media
          </product_attribute_backend_media>
        </rewrite>
      </catalog_resource>
    </models>
</global>

Media.php

class Xx_Catalog_Model_Resource_Product_Attribute_Backend_Media extends Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media
{
  public function loadGallery($product, $object){
    echo "test";
    die();
  }
}

And here is the error:

  Fatal error: Call to a member function loadGallery() on a non-object in /magento/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php on line 51`

Do you know how to override this class?
I have Magento 1.9.3.3

Thanks


texts:
How to override

  Magento\Sales\Controller\Adminhtml\Order\Create\Save.php

the file can you please help me out?


texts: Removing custom option values from cart/checkout page?

texts:
My question is an exact duplicate of Remove item-options price from checkout cart except I don't quite understand the accepted answer. I assume I'd have to create a custom template file for this to work? This wouldn't be a problem if I understood what to include in that template file ... i.e. how I would display the custom option label but not value. If my assumption is not right please correct me.

Is there an alternative way? Maybe overriding a class/method?


texts: How can you add a content block to magento onepage checkout?

texts: I want to add a custom text block to the magento one page check out. The block will just have text advising of no refund policy. Please let me know what exact magento file needs modification and wheres its located. Or if there's a better way to display a message during check out.


texts: How to display discount in invoice pdf, magento. which is define in rules(Shopping cart price rules or catalog price rules)?

texts:
How to display discount in invoice pdf, magento.
which is define in rules like Shopping cart price rules or catalog price rules?


texts: Magento2 Frontend and backend doesn't work while executing commands

texts:
Whenever I execute setup:di:compile and setup:static-content:deploy commands from SSH, magento2 frontend and backend showing error. My magento2 store in production mode.

What should I do before run SSH command so that frontend/backend should be work while executing commands?


texts: Magento 2: Ignore EAV tables during migration

texts:
I am setting up a migration from 1.8.1.0 to 2.2.9. All product related data has been manually set up in the new store so I would like to ignore anything product related including all the eav tables.

The map.xml already contains entries like these (by default):

<ignore>
    <document>eav_attribute</document>
</ignore>
<ignore>
    <document>eav_attribute_group</document>
</ignore>
<ignore>
    <document>eav_attribute_set</document>
</ignore>
<ignore>
    <document>eav_entity_attribute</document>
</ignore>
<ignore>
    <document>eav_entity_type</document>
</ignore>

But after migration all my newly created custom eav attributes' options are gone. For clarification: these attributes only exist in the new magento 2 database.

Basically all I need is customer and order data to be migrated. That's why I put in these sections into my config.xml:

<steps mode="data">
    <step title="Customer Attributes Step">
        <integrity>Migration\Step\Customer\Integrity</integrity>
        <data>Migration\Step\Customer\Data</data>
        <volume>Migration\Step\Customer\Volume</volume>
    </step>
    <step title="Map Step">
        <integrity>Migration\Step\Map\Integrity</integrity>
        <data>Migration\Step\Map\Data</data>
        <volume>Migration\Step\Map\Volume</volume>
    </step>
    <step title="OrderGrids Step">
        <integrity>Migration\Step\OrderGrids\Integrity</integrity>
        <data>Migration\Step\OrderGrids\Data</data>
        <volume>Migration\Step\OrderGrids\Volume</volume>
    </step>
    <step title="SalesIncrement Step">
        <integrity>Migration\Step\SalesIncrement\Integrity</integrity>
        <data>Migration\Step\SalesIncrement\Data</data>
        <volume>Migration\Step\SalesIncrement\Volume</volume>
    </step>
</steps>

What am I missing?

Thank you


texts:
How to create a custom attribute for configurable product using setup script. and the drop down list out all the bundle product and the value of drop down displayed in product detail page of a configurable product if anyone know reply me.

Installdata.php

<?php
namespace Productlinks\Bundleproduct\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
 * Eav setup factory
 * @var EavSetupFactory
 */
private $eavSetupFactory;

/**
 * Init
 * @param CategorySetupFactory $categorySetupFactory
 */
public function __construct(\Magento\Eav\Setup\EavSetupFactory $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

/**
 * {@inheritdoc}
 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
 * @SuppressWarnings(PHPMD.NPathComplexity)
 */
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    $eavSetup = $this->eavSetupFactory->create();
    $eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY,
        'Productlinks_Bundleproduct',
        [
            'group' => 'General',
            'type' => 'varchar',
            'label' => 'Product_link',
            'input' => 'select',
            'source' => 'Productlinks\Bundleproduct\Model\Attribute\Source\Material',
            'frontend' => 'Productlinks\Bundleproduct\Model\Attribute\Frontend\Material',
            'backend' => 'Productlinks\Bundleproduct\Model\Attribute\Backend\Material',
            'required' => false,
            'sort_order' => 50,
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            'is_used_in_grid' => false,
            'is_visible_in_grid' => false,
            'is_filterable_in_grid' => false,
            'visible' => true,
            'is_html_allowed_on_front' => true,
            'visible_on_front' => true
        ]
    );
    $eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'category_attribute', [
        'type'     => 'int',
        'label'    => 'Category Attribute',
        'input'    => 'boolean',
        'source'   => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
        'visible'  => true,
        'default'  => '0',
        'required' => false,
        'global'   => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
        'group'    => 'Display Settings',
    ]);
}
}

source for drop down

        <?php

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

  namespace Productlinks\Bundleproduct\Model\Attribute\Source;

  class Material extends
  \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
  {
  /**
 * Get all options
 * @return array
 */
 protected $_attributeFactory;

 public function __construct(
 Context $context,
 \Magento\Eav\Setup\EavSetupFactory $eavSetupFactory,
 \Magento\Store\Model\StoreManagerInterface $storeManager,

 \Magento\Catalog\Model\ResourceModel\Product\Attribute
\CollectionFactory
 $attributeFactory
)
{
  $this->_eavSetupFactory = $eavSetupFactory;
  $this->_storeManager = $storeManager;
  $this->_attributeFactory = $attributeFactory;
  parent::__construct($context);

  }

 public function getAllproducts()
{
  $attributeInfo = $this->_attributeFactory->create()-
 >addVisibleFilter();

  foreach($attributeInfo as $attributes)
  {
      $attributeId = $attributes->getAttributeId();

   }
  }
  }

I tried this but its not working


texts: Add custom routers for custom product types

texts:
I have created a custom product type extending from Mage_Catalog_Model_Product_Type_Abstract. What I would like to do is change this product's main controller class to use my own. If a user clicks the product on a product grid, cart line item, anywhere, I would like them to go to my_module/my_controller/my_action instead of some form of the generic catalog/product structure (catalog/product/view/id/5).

This would hold true as well for links such as the edit link on the cart page.

Best I can find, the only option I really see is to rewrite all the blocks that display these urls. It seems there should be a better way that I might just not be seeing. Also, using URL rewrites is not a good option as while it might be simple, I see lots of headaches down the road basing this on such a nebulous trick.

Is there a way to dictate which controllers/routers a product uses for various cart functions without having to do a massive amount of block/class rewrites?


texts: magento 2 - how to add tracking number and detail link open new window set in sale order grid

texts: how to add tracking number and detail new window link set in sale order grid like below


texts: Remove or add any elemt from magento2 Collection?

texts:
I have order collection and i want to add one more column in this collection .
How can possible ?

whats the addBindParam() or  addItem() method do ?

/vendor/magento/module-reports/Model/ResourceModel/Order/Collection.php

this method return revenue of order that show in dashboard Last Orders

 public function addRevenueToSelect($convertCurrency = false)
    {

        $expr = $this->getTotalsExpression(
            !$convertCurrency,
            $this->getConnection()->getIfNullSql('main_table.base_subtotal_refunded', 0),
            $this->getConnection()->getIfNullSql('main_table.base_subtotal_canceled', 0),
            $this->getConnection()->getIfNullSql('main_table.base_discount_canceled', 0)
        );
        $this->getSelect()->columns(['revenue' =>$expr]);
        $this->addFieldToFilter('current_seller_id',array('finset'=>1));
        //die( 'last order');
        return $this;
    }

here i filter orders by addFieldToFilter but i also want to change revenue element in this collection.

i want to get entity_id from this collection and then call model of sales_order_item and get price the add and return revenue for each order.


texts: When I am updating Product date for spacial price in magento 2.2.0 then i am face problem Invalid input datetime format of value '01/12/+00201717'


texts: the default display currency you selected is not available in allowed currencies

texts: i am new in magento 2, i want to set my currency to dinar but i did not find this currency. how to add a new currency BO. other question: the Us dollar  is not available in allowed currencies even it appear in the list of ollowed currencies please tell me whta to do to resolve this two problem and thanks in advance


texts: Unable to modify categories in magento due to error

texts:
Fatal error: Uncaught Error: Call to a member function toHtml() on boolean in /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php:153
Stack trace: #0 /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(297): Mage_Adminhtml_Block_Catalog_Category_Tabs->_prepareLayout()
#1 /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#2 /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php(55): Mage_Core_Model_Layout->createBlock('adminhtml/catal...', 'tabs')
#3 /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Core/Block/Abstract.php(297): Mage_Adminhtml_Block_Catalog_Category_Edit_Form->_prepareLayout()
#4 /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Core/Model/Layout.php(456): in /var/www/vhosts/Site/httpdocs/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php on line 153

$this->addTab('products', array(
  'label'     => Mage::helper('catalog')->__('Category Products'),
  'content'   => $this->getLayout()->createBlock(
    'adminhtml/catalog_category_tab_product',
    'category.product.grid'
  )->toHtml(),
));

Hello, i have had this error for sometime now but cannot seem to find the problem i have been over the file in question that is returning the error and looked through
   app\code\core\Mage\Adminhtml\etc\adminhtml.xml
   app\code\core\Mage\Adminhtml\etc\config.xml

and they are both correct and exactly the same as what is package with plain magento.

we haven't added any modules or changed any core code files this error has just appeared, if anyone could help this would be great.

This only seems to happen when trying to go to the category admin page.

header_nav -> catalog -> manage categories


texts: Magento core code - why module init files some in Mage_All and some not

texts:
Looking at the core code under app/etc/modules...

Why does Magento use Mage_All for a large part of the modules and individual files for the others?

I understand that Magento will ultimately merge the xml any, so it has no real effect either way.  But im interested as to why they have done this instead of putting all Mage modules in Mage_All.xml or alternatively separate files for all Mage modules.


texts:
We just upgraded from 1.12 to 1.13.0.2 and in the UAT we found that the original theme did not have the form_key tag on the products. We added this to the add to cart URL and it worked.

Since then the client has added configurable products and although we have added the form_key tag to the add to cart URL the product still does not end up in the cart?


texts:
It seems my server cannot be upgraded as my magento website 1.9.2.2 is not compatible with PHP 7.0.
My web developers say that there are plugins available but they do not recommend this? HELP......


texts: getBaseDir lib issues - call to undefined function

texts:
Right now I'm running into an error "Call to undefined function geoip_open()" on one of the lines of my files.

The line is

$geoip = geoip_open(Mage::getBaseDir('lib').DS.'MaxMind/GeoIP/data/'.Mage::getStoreConfig('onepagecheckout/geo_ip/city_file'),GEOIP_STANDARD);

So I have the file inside of lib/MaxMind/GeoIP/data and it throws this error. Is this because it's not finding the file? Or some other issue with GeoIP?


texts: How would I add "Brand" to the layered navigation without having to add the attribute to the product

texts: I want to add Brand as one of the filters, however when I do this - it also comes up as an option on the actual product. Is there a way to add the Brand information to each product and have it show up in the layered navigation without having it show up as a drop down on the product?


texts: Creating multiple subcategories in one script

texts:
I am trying to create many sub-categories for one category in Magento CE 1.9 through an upgrade script.

Here is the upgrade script:

$category = Mage::getModel('catalog/category');

$this->startSetup();
Mage::register('isSecureArea', 1);

Mage::app()->setUpdateMode(false);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); //Make admin store

$category->setPath('1/2/23/')  //Creating as subcategory for category ID 23
    ->setName('English')
    ->setUrlKey('english')
    ->setLanguageCode('ENG')
    ->setIsActive(1)
    ->setIncludeInMenu(1)
    ->setDisplayMode(1)
    ->setPageLayout(0)
->save();

$category->setPath('1/2/23/')
    ->setName('French')
    ->setUrlKey('french')
    ->setLanguageCode('FRE')
    ->setIsActive(1)
    ->setIncludeInMenu(1)
    ->setDisplayMode(1)
    ->setPageLayout(0)
->save();

$category->setPath('1/2/23/')
    ->setName('Spanish')
    ->setUrlKey('spanish')
    ->setLanguageCode('SPA')
    ->setIsActive(1)
    ->setIncludeInMenu(1)
    ->setDisplayMode(1)
    ->setPageLayout(0)
->save();

Following this approach, I find that only the last subcategory given (Spanish) is created and all others are skipped. Is there any sort of reset that we must give for the catalog/category model object before creating each category? Where am I going wrong?


texts: How to access global variables in a custom less file

texts:
Using Magento 2.3.4

I have a Custom Layout Update set for one of my CMS Pages, in this layout update I reference custom.css which has a corresponding custom.less. If I don't use global variables I can change the styling without issues, but I lack access to project-wide variables. I plan to control the styles of multiple pages through this file, so being able to access globals would be a big help.

I placed custom.less in the following directory VENDOR/CUSTOM_THEME/Magento_Cms/web/css.

Currently, I get this error:

[2020-05-11 19:28:00] main.CRITICAL: variable @media-common is undefined in file /var/www/html/var/view_preprocessed/pub/static/frontend/VENDOR/THEME/en_US/Magento_Cms/css/custom.less in custom.less on line 10, column 9
08| //  Common
09| //  _____________________________________________

How can I access things like media queries and variables for fonts in custom.less?


texts:
I'm working on a magento store which, in the checkout, allows customers to provide a gift message for the end consumer. I need to implement this exact functionality again in the same website. So where it once gave an option to give a 'gift message' it will also allow users the option of submitting a 'christmas gift message'.

Once the checkout process is over the customer receives an email with all details including the gift message and an order is created in the backend containing details of the message.

I need to implement the christmas gift message in such a way that it works exactly like the normal gift message but is somehow distinguishable as being specifically a christmas message.

I am unsure about what is the best way to do this. If anyone has done it before it would be a great help to know how you did it or if anyone simply knows of a good way to do this please say.


texts: How do I add the images for associated bundle product in the cart?

texts:
The options data gets called in the checkout/cart/default.phtml and I believe it's this function:

<?php echo $_formatedOptionValue['value'] ?>

.. that produces looped data for each associated item. How can I show the images for the associated bundle items? Let me know if I am not clear.


texts: Magento 1.9 How to Remove COD via shipping cart rule

texts: I want to remove payment method Cash On Delivery with the help of Shipping cart rule. If cart value is more than 10,000/- Cash On Delivery must be removed from Payment method. I was disabled default COD Module, Now I am using CashOnDelivery Based on Zipcode, this module has only zip code filteration, I need to set order limit.


texts: Get child items of parent bundle product from cart

texts:
Suppose I have a bundle product added into the cart. Now when I try to get all cart items that time I need to find particular bundle child is added with x bundle product.

Is it possible to find ?


texts: Is it valid to add .html in CMS page URL Key?

texts: I want to add CMS page link in navigation after specific category. I can add CMS page link in first or last position easily but can not find a proper way to add it after specific category. So i create a category name CMS Page with url key cms-page and place it after specific category. Then i create a CMS Page with URL Key cms-page.html and this works for me as my category url will be http://www.example.com/cms-page.html. Is this proper way to do it?


texts:
I'm trying to load fotorama on a cms page and some category pages which are custom.

The JS doesn't load on it's own so I thought I was being clever and added this to one of my theme's js files.

// my-custom-theme-script.js
requirejs([
    'jquery',
    'fotorama/fotorama'
], function($, fotorama){
});

This almost worked. I see my code is causing fotorama to load on the page, but strangely, I'm getting this error in console:

Uncaught Fotorama requires jQuery 1.8 or later and will not run without it.

So to further debug I changed my theme js to this

// my-custom-theme-script.js
requirejs([
    'jquery',
    'fotorama/fotorama'
], function($, fotorama){
    console.log($.fn.jquery); //-> 1.11.0
});

So now I'm thinking this is a requiredjs configuration issue on my part. If I add something to the fotorama.js file on about line 98 where the above error comes from, I see that $ is false.

// fotorama.js
var JQUERY_VERSION = $ && $.fn.jquery.split('.');

if (!JQUERY_VERSION
    || JQUERY_VERSION[0] < 1
    || (JQUERY_VERSION[0] == 1 && JQUERY_VERSION[1] < 8)) {

    console.log($); //-> false
    throw 'Fotorama requires jQuery 1.8 or later and will not run without it.';

How exactly am I suppose to add a custom fotorama gallery to a cms page or block outside of where fotorama is already loading? I'm guessing I'm way off here.

From what I can tell I need to manually define jquery as a dependency in my requirejs-config, however this seems counter intuitive for a js resource that Magento 2 natively includes. Any suggestions?


texts: create a block from cron - layout seem different

texts:
I need to create a block from a cronjob that render products grid (yes I know it sound weird), and get the output html. To do so I created a custom block with template and tried to use it like this (reminder: from a cronjob):

$block = Mage::app()->getLayout()->createBlock('my_special_block')
                        ->setTemplate('my_special_template.phtml');
Mage::log($block->toHtml());

This returned the html of a product grids with products in it, but they looked nothing like the actual site products. So I tried using this code in a controller, something like this:

$block = $this->getLayout()->createBlock('my_special_block')
                            ->setTemplate('my_special_template.phtml');
echo $block->toHtml();

And indeed the html I get when going to the controller url is totally different than the one I got from the cron.

My guess is that when I get the layout in the cron, Magento don't load all the layout updates or something like that. but I couldn't find info in the docs of how to do it. Or maybe its a different problem?

Any solution would be appreciated, I just need to get my hands on the correct html from inside the cron.

EDIT:
Tried adding these lines before creating the block in the cronjob, but the html still looks different. :/

    Mage::app()->setCurrentStore(0);
    $layout = Mage::app()->getLayout();
    $layout->getUpdate()->addHandle('default')->load();

Thanks!


texts: Magento 1: impact of dispatching events on performance

texts:
As of 1.9.3.0, Magento dispatches more than 300 events.

By checking the code that dispatches the event I'm pretty sure this is not memory free specially when the event data is a big object or collection:

public function dispatchEvent($eventName, $args)
{
    $eventName = strtolower($eventName);
    foreach ($this->_events as $area=>$events) {
        if (!isset($events[$eventName])) {
            $eventConfig = $this->getConfig()->getEventConfig($area, $eventName);
            if (!$eventConfig) {
                $this->_events[$area][$eventName] = false;
                continue;
            }
            $observers = array();
            foreach ($eventConfig->observers->children() as $obsName=>$obsConfig) {
                $observers[$obsName] = array(
                    'type'  => (string)$obsConfig->type,
                    'model' => $obsConfig->class ? (string)$obsConfig->class : $obsConfig->getClassName(),
                    'method'=> (string)$obsConfig->method,
                    'args'  => (array)$obsConfig->args,
                );
            }
            $events[$eventName]['observers'] = $observers;
            $this->_events[$area][$eventName]['observers'] = $observers;
        }
        if (false===$events[$eventName]) {
            continue;
        } else {
            $event = new Varien_Event($args);
            $event->setName($eventName);
            $observer = new Varien_Event_Observer();
        }

        foreach ($events[$eventName]['observers'] as $obsName=>$obs) {
            $observer->setData(array('event'=>$event));
            Varien_Profiler::start('OBSERVER: '.$obsName);
            switch ($obs['type']) {
                case 'disabled':
                    break;
                case 'object':
                case 'model':
                    $method = $obs['method'];
                    $observer->addData($args);
                    $object = Mage::getModel($obs['model']);
                    $this->_callObserverMethod($object, $method, $observer);
                    break;
                default:
                    $method = $obs['method'];
                    $observer->addData($args);
                    $object = Mage::getSingleton($obs['model']);
                    $this->_callObserverMethod($object, $method, $observer);
                    break;
            }
            Varien_Profiler::stop('OBSERVER: '.$obsName);
        }
    }
    return $this;
}

I was wondering if someone ever checked the impact on performance of dispatching events. I was thinking about implementing an event whitelist system (with all the events Magento core observes whitelisted) to avoid dispatching useless events and improve performance.


texts: magento 2 admin url not working and loaded frontend is all messy

texts:
Admin url is showing 404 error after installing magento 2 on wamp
          server and frontend design is all messy and css is not linked to it.Error visuals are shown below.

Frontend error:


texts: special price for the simple products of a configurable product

texts:
I am doing a project and now it needs a requirement such that we can assign special price for the single products of a configurable product. This price must be seen with strike through with the original price. I tried out by editing configurable.php by fetching the special price of each simple product of a configurable product. The problem which I am facing is the simple product's special price which is assigned is getting correctly but for those which is not assigned in the same configurable product, the last simple product's special price is coming.

My question is can I implement my requirement on Magento or what I am doing wrong?

Please help? The following is the way I tried to implement my need.

<?php
$obj = Mage::getModel('catalog/product');
if (isset($options[$attributeId][$value['value_index']])) {
       $productsIndex = $options[$attributeId][$value['value_index']];
       $_product = "";
       foreach ($productsIndex as $pr):
              $_product = $obj->load($pr);
              if (!empty($_product) && !is_null($_product)) {
                   $npr[$pr] = $_product;
              } else {
                  $npr[$pr] = 0;
              }
              unset($_product);
      endforeach;
   } else {
      $productsIndex = array();

}
?>


texts: How, where and when does Magento 2 save customer Tax/Vat number to the order?

texts:
I can not understand why the customer_taxvat field in sales_order table is empty for customers who have Tax/VAT number.

Please advice


texts: Greatly change the category structure of an existing Magento webshop. Negative effects?

texts:
I am about to greatly change the order and add / remove categories for an already existing Magento webshop. Does this have any great side effects?

For example

Will it mess up the Google ranking / SEO? Magento fixes automatically the redirections, right?
All the products, do they need to be manually re-assigned into the categories again?
Any other side effects?


texts: How do I find a list of all objects/variables under an object like $address = $cart->getQuote()->getShippingAddress();

texts:
$address = $cart->getQuote()->getShippingAddress();

what else is available from the getQuote() function?
can't find a list anywhere


texts: Magento - Put barcode items in email order

texts:
I wish put near SKU also a barcode for any items that my customer order in the email with order.

is it possible?
thaks


texts:
I have a site with 4 languages. When i'm at a product and changing to another language i get a 404 error.
Only on the homepage it works well. Any idea to resolve this?


texts: Magento 2.3 | Knockout.js - Unexpected end of input

texts:
I've installed the latest Magento Version (2.3) and everythign went well. The installation was completed and i was able to view and frontend aswell the backend.

For some reason i get the following error on the backend and the loading spinner keeps spinning forever. Sometimes, after a refresh, the spinner goes away but no menu items are clickable. In the Chrome DevTools i get various of errors displayed, especially with knockout.js or knockout related files.

PHP Version: 7.2
Magento Version: 2.3

Knockout.js:4566
Uncaught Syntax Error: Unexpected end of input
https://pastebin.com/2XGmf8Qm

knockout-fast-foreach.js:299
Uncaught TypeError: Cannot read property 'bindingHandlers' of undefined
https://pastebin.com/hTLK677z

mage-init.js:13
Uncaught TypeError: Cannot read property 'bindingHandlers' of undefined
https://pastebin.com/wEGi6yfm

fadeVisible.js:12
Uncaught TypeError: cannot read property 'bindingHandlers' of undefined
https://pastebin.com/aG3GAWs5

i18n.js:151
Uncaught TypeError: Cannot read property 'bindingHandlers' of undefined
https://pastebin.com/jFHtb83z

optgroup.js:19
Uncaught TypeError: Cannot read property 'bindingHandlers' of undefined
https://pastebin.com/4E9BtNZv


texts: Site stuck on "Error Processing Request: SQLSTATE[HY000] [2002] No such file or directory"

texts:
I was making some changes in a phtml file to my Magento store

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 927546133845

I now cannot get any access onto the site or into my admin system. Looking at the report for the number above I have but being new to magento i don't understand any of it:

a:5:{i:0;s:48:"SQLSTATE[HY000] [2002] No such file or directory";i:1;s:1575:"#0 /home/xxxxxx/public_html/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/xxxxxx/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/xxxxxx/public_html/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /home/xxxxxx/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /home/xxxxxx/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(141): Mage_Core_Model_Resource->getConnection('core_setup')
#8 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(234): Mage_Core_Model_Resource_Setup->__construct('core_setup')
#9 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#10 /home/xxxxxx/public_html/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#11 /home/xxxxxx/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#12 /home/xxxxxx/public_html/index.php(87): Mage::run('', 'store')
#13 {main}";s:3:"url";s:13:"/browse/cases";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Can anyone help? I urgently need to get this site back up


texts: magento 2.1.0 - currency conversion only on configurable products?

texts:
I have i question about currency conversion.

Background:

We have a fresh install of Magento 2.1.0 CE and have stared to add content (products).

In the config we have 4 website, each with its own base currency. The base currency in the Default config is set to SEK.

When adding products we set the price in the base currency (SEK). We have also imported exchange rates between the currencies that we use.

Question:

When I added simple products, when displayed on the EUR website it shows the price set i SEK as in EUR. 119SEK displays as €119 (no conversion).

However when I added configurable products the price that display on the EUR website.

Why does the conversion only work on the configurable products ? -- is there a setting for this etc.

Also, should the conversion work on tier pricing (that is set i the base currency).

I have attached screenshots.


texts: Recently Viewed not showing up when full page cache is enable

texts: The only solution i found so far is to add cacheable="false" to recently_viewed block in xml, but this did not work. Is there any other way to force magento show "Recently Viewed" block on product page when Full Page Cache is enable?


texts:
I can get sales revenue with this

$orderTotals = Mage::getModel( 'sales/order' )->getCollection()
    ->addAttributeToFilter( 'created_at', array( 'from' => date( 'Y-m-d' ), 'to' => date( 'Y-m-d', strtotime( '+1 days' ) ) ) )
    ->addAttributeToSelect( 'grand_total' )
    ->getColumnValues( 'grand_total' );
$totalSum = array_sum( $orderTotals );
$totalSum = Mage::helper( 'core' )->currency( $totalSum, true, false );

echo $totalSum;

But how do I get the total amount of orders and sales shipping total?

also is there a better way to find current days orders as I think I've done it a confusing way. Will this only show today? It appears to look right.

Update

Just a thought, is there a way to count the orders?


texts: Get Product Custom Option Html In Custom Page

texts:
I am trying to render custom option in my custom page. I found an example for magento 1 here but it dint work out as in magento 2 addOptionRenderer is removed I guess.

I tried this to call in from ajax which will return html

$layout = $this->layoutFactory->create();

$block_header = $layout->createBlock('Magento\Catalog\Block\Product\View\Options')
->setTemplate('Magento_Catalog::product/view/options.phtml');

$block_links1  = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\DefaultType','default')->setTemplate('Magento_Catalog::product/view/options/type/default.phtml');
$block_header->setChild('default',$block_links1);

$block_links2  = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\Text','text')->setTemplate('Magento_Catalog::product/view/options/type/text.phtml');
$block_header->setChild('text',$block_links2);

$block_links3  = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\File','file')->setTemplate('Magento_Catalog::product/view/options/type/file.phtml');
$block_header->setChild('file',$block_links3);

$block_links4  = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\Select','select')->setTemplate('Magento_Catalog::product/view/options/type/select.phtml');
$block_header->setChild('select',$block_links4);

$block_links5  = $layout->createBlock('Magento\Catalog\Block\Product\View\Options\Type\Date','date')->setTemplate('Magento_Catalog::product/view/options/type/date.phtml');
$block_header->setChild('date',$block_links5);

echo $block_header->toHtml();

The error I am getting is

  Fatal error: Uncaught Error: Call to a member function renderAmount()
  on boolean in
  /my/magento/path/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php
  on line 143


texts: I am trying to get all recently viewed product's id programmatically . I tried to check the reports/product_viewed and reports/product_abstract. But couldn't figure it out.


texts: Trying to add a static CMS block to each item in cart

texts:
I'm trying to add a static block that will display beneath each item's price on Magento's checkout page. I created a simple CMS block with the following settings in the admin area:

Title: Free Shipping Banner

Identifier: free_shipping_banner

Store View: All store views

Status: Enabled

I then added this line of code to app/design/frontend/base/default/template/checkout/onepage/review/item.phtml within the first :

<?php echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('free_shipping_banner')->toHtml(); ?>

The code is not in a location where it is effected by any if statements or anything else that I can tell would be a problem. Am I creating and displaying the block correctly with my line of code?


texts: Magento admin How to add button in sales invoice view page?

texts:
app\etc\modules\button_module.xml

<config>
    <modules>
        <button_module>
            <active>true</active>
            <codePool>core</codePool>

        </button_module>
    </modules>
</config>

  app/code/local/Button/Module/etc/config.xml

<adminhtml>
    <events>
        <adminhtml_widget_container_html_before>
            <observers>
                <button_module>
                    <class>button_module/observer</class>
                    <method>adminhtmlWidgetContainerHtmlBefore</method>
                </button_module>
            </observers>
        </adminhtml_widget_container_html_before>
    </events>
</adminhtml>

  app/code/local/Button/Module/controllers/Adminhtml/Sales/InvoiceController.php

<?php
require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'Sales' . DS . 'InvoiceController.php';
class Your_Module_Adminhtml_Sales_InvoiceController extends Mage_Adminhtml_Sales_InvoiceController
{
    public function viewinvoicespageAction() {
        $invoiceIds = $this->getRequest()->getParam('invoice_ids');
    }
}
?>

  app/code/local/Button/Module/Model/Observer.php

<?php
class Button_Module_Model_Observer
{
    public function adminhtmlWidgetContainerHtmlBefore($event)
    {
        $paramsarray = Mage::app()->getRequest()->getParams('invoice_id');
        $invoicesid = $paramsarray["invoice_id"];
        $block = $event->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Invoice_View) {
            $block->addButton('do_something_crazy', array(
                'label'     => Mage::helper('module')->__('Button'),
                'onclick'   => "setLocation('{$block->getUrl('*/sales_invoice/viewinvoicespage/invoice_ids/'.$invoicesid)}')",
                'class'     => 'go'
            ));
        }
    }
}
?>


texts: How to add new category button in Custom Module edit form in Magento2

texts: Want to add New Category Button like product edit Category selection.


texts:
I run Magento 1.9.2.2 and I want to switch to php 7.0.

Is it possible and save to switch to 7.0 with this Magento install?


texts:
I am using in this way to store Database

$connectionresource = Mage::getSingleton('core/resource');
                        $connectionWrite = $connectionresource->getConnection('core_write');
                        $query = "insert into imguplaod "
                                         . "(img) values "
                                         . "(:img)";
                        $binds = array('img_url'=> $img);
                        $connectionWrite->query($query, $binds);

But i didn't see any custom module use this way, Can you please tell me what are the way to store Database into values.


texts:
After I upgraded to Magento 2.3, running the command setup:di:compile, I get this error:

Area configuration aggregation... 5/7 [====================>-------]  71% 58
secs 276.0 MiB
In ClassReader.php line 35:

  Class Magento\Email\Model\Source\Variables does not exist

In ClassReader.php line 29:

   Class Magento\Email\Model\Source\Variables does not exist

setup:di:compile

I've checked the database setup_module to ensure no mismatch or missing scheme/data versions but all are ok.


texts:
I migrated all my settings, products etc from M1 to M2 recently.

Our old site has while developing our new M2 site gained new customers and products. So what would happen if I choose to migrate my data from M1 to M2 again?
As in this command: php bin/magento migrate:data --reset

Would the old products be overwritten and new products, customers be added or would it create duplicate products, customers and what not?

Thanks in advance.


texts: Magento 2.2.4 unable to get customer session data

texts:
Here I am unable to get customer session data ($customerSession) it's working in Magento version 2.2.3 but not working 2.2.4 it return false when cacheable is false.

namespace Namespace\ModuleName\Helper;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
    public $customerSession;

    public function __construct(
        \Magento\Customer\Model\Session $customerSession
    ) {
        $this->customerSession = $customerSession;
        parent::__construct($context);
    }

    public function getCustomerGroup() {
        if($this->customerSession->isLoggedIn()) {
            $groups = $this->customerSession->getCustomer()->getGroupId();
            return $groups;
        }
        return '0';
    }

}


texts: Magento2: programmatically add layout for specific products

texts:
Good evening.

I need to add layout for products, which SKUs start from 9 (so 9XXXX).

I've read we can add this though handler or some other methods.

If someone had experience with that moment, please give answer.

Thanks :)


texts: Magento 2 custom CSS is not loading after set new custom theme set on customer login

texts:
I set magento 2 luma theme for entire site if customer not login after customer login need set ultimo theme i have installed ultimo theme i am able to set
by using fallowing line
$objectManager->get(\Magento\Framework\View\DesignInterface::class)->setDesignTheme('Infortis/pawan', 'frontend');

all working fine but when I write custom CSS it not loading it generating in pub folder but not loading
I have place custom CSS Magento_Theme/layout/default_head_blocks.xml

my XML file

    <?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="css/font-awesome.min.css" />
         <css src="css/test.css" />

    </head>
</page>

but in frontend when I login all phtml files and other files loading but CSS and js not loading any idea how

in magento 1 by using below code I can set easily I want same in magento 2 any idea
Mage::getDesign()->setArea('frontend')->setPackageName('tricore')->setTheme('pawan');.


texts: How to change Magento's "var" directory to other place in Magento 2?

texts:
I have installed Magento 2 in ubuntu guest / windows host in vagrant, but it is extremely slow. I think a simple change can improve performance,
How can I move my Magento's "var" directory to "/tmp/var" of ubuntu?


texts:
When I click on Magento Connect --> Magento Connect Manager it replies with

  Cannot connect to host: name.domain.com

Can't find any other configurations to do


texts: How to insert/update data in custom table using Magento 2 using Ajax but 404 error occur on ajax hit?

texts:
I have created a custom module for admin area in which i have show some data in phtml file.
I have created a custom table in database using installschema.php.
Now i want to save that data in database but on hitting the update button ajax url is hit but the response it gives me 404.
My file path are
My URL is http://127.0.0.1/magento/AdminSample/datasave/index/?isAjax=true
My controller file path is ( app/code/Tym17/AdminSample/Controller/Adminhtml/Datasave/Index.php )
<?php
namespace Tym17\AdminSample\Controller\Adminhtml\Datasave;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\App\Config\ScopeConfigInterface; // Needed to retrieve config values

class Index extends \Magento\Backend\App\Action
{
/**
 * @var PageFactory
 */
 protected $resultPageFactory;
/**
 * @var scopeConfig
 * Needed to retrieve config values
 */
protected $scopeConfig;

/**
 * @param Context $context
 * @param PageFactory $resultPageFactory
 */
public function __construct(
    Context $context,
    PageFactory $resultPageFactory,
    ScopeConfigInterface $scopeConfig // Needed to retrieve config values
) {
    parent::__construct($context);
    $this->resultPageFactory = $resultPageFactory;
    $this->scopeConfig = $scopeConfig; // Needed to retrieve config values
}

/**
* Index Action*
* @return void
*/
public function execute()
{
    /*$post = (array) $this->getRequest()->getPost();
    var_dump($post);*/
    die('a');
}
}

My JS file path is ( app/code/Tym17/AdminSample/view/adminhtml/web/js/adminscript.js )
My routes.xml file path ( app/code/Tym17/AdminSample/etc/adminhtml/routes.xml )
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="admin">
    <route id="AdminSample" frontName="AdminSample">
        <module name="Tym17_AdminSample" before="Magento_Adminhtml" />
    </route>
</router>
</config>

My JS file is ( app/code/Tym17/AdminSample/view/adminhtml/web/js/adminscript.js )
require(["jquery","mage/url"],function($,url) {
$(document).ready(function() {
    console.log('123');
    url.setBaseUrl(BASE_URL);
    var BaseUrl = url.build('');
    jQuery( ".product" ).on( 'click', '.save',function() {
        console.log('click');
        let customurl = "http://127.0.0.1/magento/AdminSample/Datasave/index/";
        let dataid = jQuery(this).parent().parent().find('.dataid').text();
        $.ajax({
            url: customurl,
            type: 'POST',
            dataType: 'json',
            data: {
                dataid:dataid
            },
            complete: function(response) {
                console.log('aaaaa');
            },
        });
    });
});
});

My controller file path ( app/code/Tym17/AdminSample/Controller/Adminhtml/Post/Index.php )
<?php
namespace Tym17\AdminSample\Controller\Adminhtml\Post;

class Index extends \Magento\Backend\App\Action
{
protected $resultPageFactory = false;

public function __construct(
    \Magento\Backend\App\Action\Context $context,
    \Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
    parent::__construct($context);
    $this->resultPageFactory = $resultPageFactory;
}

public function execute()
{
    echo'controller check'; die('aaahahahah123');
    $resultPage = $this->resultPageFactory->create();
    $resultPage->getConfig()->getTitle()->prepend((__('Posts')));

    return $resultPage;
}
}

if anything else needed i will add that any help is appreciated.


texts: How to Print PICKING or PACKING Slips Before Shipping - Magento 2.0?

texts:
We ship large items and we have to configure the shipment on a pallet (or pallets).

When we get the order, based on ship to location and carrier chosen, we may send on one pallet, two  pallets or just parcel.

The PICKING SLIP - which is the same as the PACKING SLIP needs to be generated a few days before the shipment is actually ready but after invoicing. Some times the Shipment is done third party - which means we do not generate the label for it (based on customer).

How can I decouple creating a PICKING/ PACKING Slip from the actual SHIPMENT (entering tracking number, informing customer with tracking number etc.).?


texts: How to make a 'clone' of our Magento environment? And is that even necessary before using the Magento Migration tool?

texts:
Magento 1.9.4

I'm about to run the Magento Migration Tool and it says in the documentation to run it against a clone and not a real production website. Is that really necessary if we don't mind the potential downtime? (I guess we need to switch our Magento 1 stores to maintenance mode before starting the migration to Magento 2?)
What are the real chances of damage being done to the Magento 1 store when running the Magento Migration tool? Doesn't it just copy files?
We have Jetbackups which should allow us to do a full restore within an hour. If there is no real danger of damage to the Magento 1 store, I might just take my chances and then do the restore if needs to be.


texts: Magento 2 Migration Tool - Migrate Settings from 1.9 - 2.0 CE

texts:
I am trying to migrate settings from Magento version 1.9.2.2 to 2.0.0 CE

mage2\vendor\magento\data-migration-tool\etc\ce-to-ce\1.9.2.2\config.xml content

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="../../config.xsd">
    <steps mode="settings">
        <step title="Settings step">
            <integrity>Migration\Step\Settings</step>
            <data>Migration\Step\Stores</step>
        </step>
    </steps>
    <source version="1.9.2.2">
        <database host="localhost" name="magento9" user="root"/>
    </source>
    <destination version="2.0.2">
        <database host="localhost" name="mage2" user="root"/>
    </destination>
    <options>
        <crypt>
            <key><![CDATA[1bc968bd50b96ee18388feaed3bc1f1d]]></key>
        </crypt>
        <map_file>etc/ce-to-ce/1.9.2.2/map.xml</map_file>
        <settings_map_file>etc/ce-to-ce/1.9.2.2/settings.xml</settings_map_file>
    </options>
</config>

settings.xml is copied from path mage2\vendor\magento\data-migration-tool\etc\ce-to-ce

Added settings.xml.dist and map.xml.dist at location mage2\vendor\magento\data-migration-tool\etc

In CMD prompt I am executing commands:

D:\xamp\htdocs\mage2\> php bin/magento migrate:settings {vendor\magento\data-migration-tool\etc\ce-to-ce\1.9.2.2\config.xml}

But it throws an exception

[Migration\Exception]
 Invalid config filename: {vendor/magento/data-migration-tool/etc/ce-to-ce/1
 .9.2.2/config.xml}
 migrate:settings [-r|--reset] config

How do I run the command successfully to migrate settings?
Have I missed any step required for migration?

Please guide.

Reference links
 http://devdocs.magento.com/guides/v2.0/migration/migration-tool-install.html
 http://devdocs.magento.com/guides/v2.0/migration/migration-tool-configure.html
 http://devdocs.magento.com/guides/v2.0/migration/migration-migrate-settings.html


texts: How to implement readHandler on customer

texts:
I am trying to implement a ReadHandler on customer. Based on the cms module page read handler I did the following.

In my module etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\EntityManager\MetadataPool">
        <arguments>
            <argument name="metadata" xsi:type="array">
                <item name="Magento\Customer\Api\Data\CustomerInterface" xsi:type="array">
                    <item name="entityTableName" xsi:type="string">customer_entity</item>
                    <item name="identifierField" xsi:type="string">entity_id</item>
                </item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Framework\EntityManager\Operation\ExtensionPool">
        <arguments>
            <argument name="extensionActions" xsi:type="array">
                <item name="Magento\Customer\Api\Data\CustomerInterface" xsi:type="array">
                    <item name="read" xsi:type="array">
                        <item name="customerReader" xsi:type="string">MyCompany\MyModuleCore\Model\ResourceModel\Customer\Relation\Privacy\ReadHandler</item>
                    </item>
                </item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Framework\EntityManager\HydratorPool">
        <arguments>
            <argument name="hydrators" xsi:type="array">
                <item name="Magento\Customer\Api\Data\CustomerInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
            </argument>
        </arguments>
    </type>

</config>

and in

MyCompany\MyModuleCore\Model\ResourceModel\Customer\Relation\Privacy\ReadHandler.php file:

use Magento\Customer\Model\Customer;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\EntityManager\Operation\ExtensionInterface;

class ReadHandler implements ExtensionInterface
{

    /**
     * @var MetadataPool
     */
    protected $metadataPool;

    /**
     * @var Customer
     */
    protected $resourceCustomer;

    public function __construct(
        MetadataPool $metadataPool,
        Customer $resourceCustomer
    )
    {
        $this->metadataPool = $metadataPool;
        $this->resourceCustomer = $resourceCustomer;
    }

    public function execute($entity, $arguments = [])
    {
        $this->metadataPool->getMetadata();
        return $entity;
    }

}

I've put breakpoints into the constructor and into the execute method but neither runs. Debugger works.

I've checked that the Model/Customer.php does not implements CustomerInterface but the Model/Data/Customer.php does. I've set breakpoint there and debugger stops there.

What do I missing?


texts: Get Customer Group & Products Categories from Order Object

texts:
From the Magento checkout success page I need to get the following data to add to a tracking pixels script.

$orderObj = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());  // get the last order object
$customerType;
$productCategories;
$orderId = $orderObj->getIncrementId();
$orderRevenue = number_format($orderObj->getBaseGrandTotal(),2);

I have successfully gotten $orderId & $orderRevenue but how can I get $customerType & $productCategories?

I thought I could use something like $orderObj->_data['customer_group_id'] to help me get the $customerType.

UPDATE

I was able to get $customerType with:

$customerId = $orderObj->getCustomerGroupId();
$customerType = Mage::getSingleton('customer/group')->load($ross)->getData('customer_group_code');

Now just to figure out how to get$productCategories; ?


texts: How do I display a custom grouped product page layout?

texts:
I would like my Magento 2.2.6 store to have two grouped product pages.  For some grouped products I would like to use the existing default grouped product layout that ships with Magento 2.  For other grouped products I would like to use my own custom grouped product layout.  For this question, lets say that I would like my custom grouped product layout to simply move the list of grouped products from the default position (at the right side of the gallery) as shown here:

to display them below the gallery as shown here:

To attempt to do this I have created the following layout app/code/[COMPANY]/[MODULE]/view/frontend/layout/catalog_product_view_type_grouped.xml to extend the existing vendor/magento/module-grouped-product/view/frontend/layout/catalog_product_view_type_grouped.xml:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="product.info" destination="content" before="product.info.details"/>
    </body>
</page>

With this file alone, the list of grouped products (the product.info block) is correctly moved to below the gallery.  However, it is moved for all grouped products, not just my specific grouped products.

I believe (I acknowledge that I could be wrong) that what I need to do is specify a custom page layout for the grouped product under the product design section:

To do this I created the following layouts.xml file:

app/code/[COMPANY]/[MODULE]/view/frontend/layouts.xml:

<?xml version="1.0" encoding="UTF-8"?>
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">
    <layout id="custom_grouped_product">
        <label translate="true">Custom Grouped Product</label>
    </layout>
</page_layouts>

And added the corresponding app/code/[COMPANY]/[MODULE]/view/frontend/page_layout/custom_grouped_product.xml page layout file:

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

I have selected the page layout against the product in the product admin page but this is about as far as I have got.

How do I connect the catalog_product_view_type_grouped.xml layout file to the extended custom_grouped_product.xml page layout file so that the page layout file is only displayed when the custom_grouped_product.xml is selected in the product admin?

And as an aside (and I appreciate this could be another question entirely), should I be using a module or theme to achieve the above?  I have used a module here as I understand that themes are mainly for styling so would greatly appreciate any advice regarding this also.