texts:
This is my System.log
what problem...how can i modification for this error ?
my homepage have many usage cpu. (sometimes cpu 100% and not opened homepage)
please help me !

2016-02-15T07:52:34+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:34+00:00 ERR (3): Warning: simplexml_load_string(): &lt;reference name=&quot;left&quot;&gt;  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:34+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:48+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:48+00:00 ERR (3): Warning: simplexml_load_string(): &lt;reference name=&quot;left&quot;&gt;  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:48+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:55+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:55+00:00 ERR (3): Warning: simplexml_load_string(): &lt;reference name=&quot;left&quot;&gt;  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:52:55+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:53:07+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:53:07+00:00 ERR (3): Warning: simplexml_load_string(): &lt;reference name=&quot;left&quot;&gt;  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T07:53:07+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T08:12:21+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T08:12:21+00:00 ERR (3): Warning: simplexml_load_string(): &lt;reference name=&quot;left&quot;&gt;  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T08:12:21+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T08:15:25+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T08:15:25+00:00 ERR (3): Warning: simplexml_load_string(): &lt;reference name=&quot;left&quot;&gt;  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-15T08:15:25+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450


texts:
I'm using the extension Amasty Reps and Dealers which works beautifully but I want to change the naming convention of somethings.

Because this is an extension I'm unable to find how it inserted into the

AdminPanel --> Customers --> Manage Customers --> Click on a Customer --> Account Information then I want to change the name here from Dealer to Merchant on the left side, right below "Customer Group" and above "Prefix".


texts:
It appears that column data type TIME (not datetime, just the time of day, for example 12:00) is not supported in Magento 2.

I need to store a time of day, how to work around this?
How should I go about it with the tools and datatypes that are available?

I thought about saving a normal but distinctive date (like 1970-01-01 12:00:00 which is distinctive enough not to be confusing to anyone browsing the data) and just extracting the time part from it in the UI, but it's horrid and makes me cringe inside.

Is there a more elegant way?


texts: get Attribute default store view label list

texts:
I'm looking for a function that get all labels of a specific attribute. However the label that I get is the admin view. I would like to show the default store view instead.

Here is my current wrong code :

 $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', '81');
 foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){
    /*some stuff here*/
 }

Thanks for your help !


texts:
As the question implies:

I've created a new errors theme in /error/custom/ and edited the layout.xml to show the new error pages but I don't know how to test them??

Does anyone know how to force an error or preview the error pages?

By this I mean its easy to force a 404 error just visit www.yourdomain.com/ajdkts.html and it will produce a 404 error.

But how would I force a 500 error or a 503 error? So that I can see that I can preview my changes.


texts: Add to Cart Resulting in: Cannot add the item to shopping cart

texts:
I have this observer listening:
sales_quote_product_add_after

Inside the observer I run this code to change the price of the item when added to the cart.

 $item = $items[0];
        $request = Mage::app()->getRequest();
        $newPrice = $request->getParam("new_price");

        $item->setCustomPrice($newPrice);
        $item->setOriginalCustomPrice($newPrice);
        $item->getProduct()->setIsSuperMode(true);
        $item->save();

This works perfectly when a customer is logged in, however when a customer isn't logged in I get a red error message on the front end saying: "Cannot add the item to shopping cart." and it doesn't add to the cart.


texts: magento 2 How to add custom content under the buy button for a specific product

texts: I want to add some custom content under the shopping button on the product page of the specified category. I have used the block and widget functions to create it, but the display position is not what I want. How to achieve it?


texts:
I have migrated data from Magento CE 1.9.2.0 to CE 2.2.5
Migration is successfully for data of old Magento 1 to latest Magento 2 version.
 While I am trying to save the product from admin or programmatically Bellow error generated

Error :

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'catalog_product_entity_varchar.ebay_template_new' in 'field list', query was: SELECT catalog_product_entity_varchar.ebay_template_new FROM catalog_product_entity_varchar WHERE (ebay_template_new LIKE :attribute_code) ORDER BY entity_id DESC, ebay_template_new ASC LIMIT 1

Anyone please help to resolve error..!


texts: Select2 / Selectize JS does not start domReady! - RequireJs

texts:
I have add my requirejs-config.js

  app/design/frontend/Altravista/my_theme/requirejs-config.js

var config = {
    deps: [
        'js/custom'
    ],
    paths: {
        'select2': 'js/select2/select2.min'
    },
    shim: {
    'select2': {
      'deps': ['jquery']
           }
      }
};

I have my custom js file in

  app/design/frontend/Altravista/my_theme/web/js/custom.js

define([
    "jquery",
    "select2",
    "domReady!"
],
function($, select2) {
        "use strict";
        $( function (){
            $('select').select2();
            console.log('my_log');
    });
});

but select2 does not start.

custom.js is loaded (I can see my log in console)
If i write jQuery('select').select2(); in console select2 works

PS: I have try also with selectize.js plugin and I have the same problem

if I use a scroll jquery event it works (start on scroll of page) so it is not a script error

$(function(){
  $(window).scroll(function(){
    // $('select').selectize({
 //     create: true,
 //     sortField: 'text'
    // });
    $('select').select2(
        {
            width: 'resolve',
            closeOnSelect: true,
            minimumResultsForSearch: -1
        }
    );
    console.log('Hey!');
    });
});

my custom.js file is loaded before select2.min.js


texts: Use category path for product url in magento 1.9.3

texts:
i want to use category path with my product url.

e.g
https://domain.com/product-url.html
to
https://domain.com/catA/sub-cat/sub-sub-cat/product-url.html

thanks


texts: footer disappears when showing products in home page

texts:
I just installed magento 1.9.0.1 and it comes with the rwd theme.
Tried to list products from a category. The product shows up but the footer part completely disappears.

Our Latest Products

{{block type="catalog/product_list" category_id="3" template="catalog/product/list.phtml"}}

Before..

After..


texts: How to increase default favicon ico image in Magento 2

texts:
I have upload the favicon ico image 65*65 but still showing small
  size, could you please let me know, how to do the same.


texts: CSV - Imported product image is not visible in admin section but shown in front end

texts:
I have imported products from CSV into my magento store using Product import section.The product images are visible in front store, but not visible in admin section. When I try to edit a product, product image is not visible and after saving of product, the image is hidden from front store also.
I placed media files in media/import for importing. I have added sample CSV inventory here.

What is the problem I am facing? How can I fix it?

Any help appreciated.

CSV file


texts: how to change text color in category view in magento2

texts:
I am trying to change text color in magento 2 for product names and nested names in category view.

Can someone point me in right direction.


texts: how to define different layouts for each page in magento 2

texts:
I want to know if is possible to create different layouts for each page.
In my Magento_Theme/layout/default.xml I have the copy of the Magento/Theme/view/frontend/layout/default.xml and I want to add this block:

<referenceContainer name="head.components">
    <block class="Magento\Framework\View\Element\Template" name="head.changer" template="Magento_Theme::head-changer.phtml" before="-"/>
</referenceContainer>

But I want this to be applied only in my our-services.phtml page.
Can someone tell me if this is possible, and if it is how can I do it?


texts: Cron job has not been configured yet getting magento 2.3

texts:
when I am trying to install extensions in Magento 2.3 getting an error Cron job has not been configured yet help me how to solve this

Error from Setup Application Cron Script:
Cron job has not been configured yet
Other checks will fail as a result (PHP version, PHP settings, and PHP
extensions)

Error from Updater Application Cron Script:
Cron job has not been configured yet


texts:
We want to have a modal popup form on clicking a image or link. Though i achieved this on CMS page using template page(.phtml), I want to use this form on every page, so i am using a static block inside header.phtml.

Now the problem is style tags of the static block is overriding the default CSS, hence the page is getting distort. Please help me with a way, so that the static block CSS doesn't effect other part of the pages.


texts: How to add an image uploader (to record an image and its path in the Magento store config) to the admin form, using .xml files?

texts:
I made a plugin that adds a custom menu item in the left-hand side menu in admin. Now I have the item, and also the form that the item leads to. Form already has some text field for inputting text value. I need to make a field for uploading (saving) an image, for later usage somewhere else (also by referencing it through ::StoreConfig). How can I make use of the image uploader (image upload field)? Apparently the image is not saved this way. I added the image upload field by adding this code to system.xml (as a child of config/sections/mynamespace/groups/mynamespace_group/fields), successfuly:

<mynamespace_image translate="label">
    <label>Image 1: </label>
    <comment>First image for the carousel</comment>
    <frontend_type>image</frontend_type>
    <sort_order>90</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
</mynamespace_image>

When I save the form data, the name of the image is successfuly saved, but the image itself is apparently not saved anywhere - when I try and access the image through

$first = Mage::getStoreConfig('mynamespace/mynamespace_group/mynamespace_image');

in a block, I only get the name of the file (ie. "Milka.png", or "Milka.jpg"), and not the whole URL. I need to save the image and have it accessible in Block, in order to display it. How can I do that?


texts: how to display a new root category except default category in magento?

texts:
In my website I have a default menu which always shows in the header part. Now I want to add another root category which will show up in a specific page(not all pages). I already created a new root category from magento admin but don't know how to show only this category in frontend. point that my new category id is '12' I tried

<?php
      $category = Mage::getModel('catalog/category');
      $tree=$category->getTreeModel();
      $tree->load();
      $ids = $tree->getCollection()->getAllIds();
      $arr = array();
      if ($ids){
    foreach ($ids as $id){
     $cat = Mage::getModel('catalog/category');
     $cat->load($id);
    $arr[$id]=$cat->getName();
     }
    }
 ?>
  <?php
  $cat_id = Mage::app()->getStore()->getRootCategoryId();
$collection = Mage::getModel('catalog/category')->getCategories($cat_id,12, true, true);
$position=array();
$index=array();
foreach($collection as $key=>$cat) {
    array_push($index,$cat->getPosition());
}
asort($index);
echo '
';
$c=0;
foreach($index as $index_new){
foreach($collection as $cat){
    if( $index_new==$cat->getPosition())
    {
    echo '
getURL().'" />'.$cat->getName().'';
    $cat_id=$cat->getId();
    $subcategory_html=GetSubcategory($cat_id);
    echo $subcategory_html;
    echo '
';
    }
}
}
 ?>

but this only shows the default category, not the other category.


texts: Create a group and send out emails when each order comes to an email id assigned for each group

texts:
I have a requirement which is like follows:
We have a B2B model store

I have a store in which we want to set up groups with clients from different places and assign an email id for each group. Now once there is an order from one group, a notification should be sent to the assigned email id of the group. This assigned email is of the distributor.

Let me explain this in another way if you didn't get it.
We have 6 clients from 3 different places.
place1: client1, client2
place2: client3, client4
place3: client5, client6

email ids: Place1id@store.com, Place2id@store.com, Place3id@store.com

Now if client2 places an order, Place1id@store.com should get an email notification.
If client6 places an order, Place3id@store.com should get an email notification.
And so on.

Is there anyway we could achieve that without having to create multiple stores?


texts: Moving the compare products to the top of the screen when resolution is below 770px

texts: I want to make sure that the compare products block is positioned at the top of the page under Filters. I don't want to put it in the left sidebar though. Is there a way to adjust the layout on lower res screens so that it will have this layout?


texts:
Magento removes all html for default Bank Tranfer payment method instructions.

How can I override that and allow html tags in instructions displayed in checkout page?

File used for displaying instructions is located here (probably)
vendor/magento/module-offline-payments/view/frontend/web/template/payment/banktransfer.html


texts: Add external scripts int admin header in Magento 2.1

texts:
i need to add the following in the admin section head tag:

<link rel="manifest" href="/manifest.json" />
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
<script>
  var OneSignal = window.OneSignal || [];
  OneSignal.push(function() {
    OneSignal.init({
      appId: "xxxxxxxxxxxxxxxxx",
    });
  });
</script>

i know how to add local scripts , but any idea how to add remote scripts?


texts: How to customize order succes page url and add some order details

texts:
I want my order success page URL(checkout/onepage/success/) to be changed to order/?ORDERID

And I need to display some order details in that success page. That should be shown even after the reload.

I have tried to get some details by calling a phtml in checkout_onepage_success.xml

But this is not exactly I want.

Any suggestions are welcome.
Thanks in Advance.


texts: Magento 2 - Adding 2 (or more) configurable products to cart with custom options causes Integrity constraint violation

texts:
I have a controller that receives custom options for a specific configurable product. For each custom option, I must add the product to the cart with such custom additional option. In the end, I want as many cart items as the number of custom options submitted.

The problem is, because im adding the same configurable product more than once (although with different custom options) in the same script execution, something is messing up when the cart is saved.

At first, I think this is a Magento 2.x bug. I've even opened an issue in Github here: https://github.com/magento/magento2/issues/7488

But maybe its just a simple detail I'm missing, thats why I wonder if anybody could help with this.

Bellow is a test script to illustrate the problem.

$storeId = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId();
$cart = $this->_objectManager->get('\Magento\Checkout\Model\Cart')->getStore()->getId();

$productId = 115; // Configurable Product

$colorAttributeId = 90;
$color = 10; // white

$sizeAttributeId = 135;
$size = 13; // small

$customOptionValues = [
    'print_style_1',
    'print_style_2',
];

foreach ($customOptionValues as $customOptionValue) {
    $product = $this->_objectManager->create('Magento\Catalog\Model\Product')->setStoreId($storeId)->load($productId);

    // prepare buyRequest
    $buyRequest = new \Magento\Framework\DataObject();
    $buyRequest->setData([
        'qty' => 1,
        'super_attribute' => [
            $colorAttributeId => $color,
            $sizeAttributeId => $size,
        ],
    ]);

    $additionalOptions = array();
    if ($originalAdditionalOptions = $product->getCustomOption('additional_options'))
    {
        $additionalOptions = (array) unserialize($originalAdditionalOptions->getValue());
    }
    $additionalOptions['print_style'] = [
        'label' => 'Print Style',
        'value' => $customOptionValue,
    ];

    // add the additional options array with the option code additional_options
    $product->addCustomOption('additional_options', serialize($additionalOptions));

    $cart->addProduct($product, $buyRequest);
}
$cart->save();
$cart->getQuote()->setTotalsCollectedFlag(false)->collectTotals()->save();

Expected result

Upon $cart->save() there should be 2 products in the cart, each one with the same configurable attribute options, but with distinct custom additional options (Print style)

Actual result

Whe cart is saved, an exception is thrown regarding the quote_item_option INSERT query.

Notice the insert query for the item option is missing the 'item_id' column

  SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (magento.quote_item_option, CONSTRAINT QUOTE_ITEM_OPTION_ITEM_ID_QUOTE_ITEM_ITEM_ID FOREIGN KEY (item_id) REFERENCES quote_item (item_id) ON DELETE CASCADE), query was: INSERT INTO quote_item_option (product_id, code, value) VALUES (?, ?, ?)

If you add one product with custom option A in one HTTP request, and then do another HTTP request to add the same product with custom option B, there will be no errors. This only happens when products are added to cart in the same HTTP request.


texts:
I am facing one issue and trying to find it solution form a long time. But still unable to find the solution

In our live site, the server has one backend and four frontend servers.
while checkout we get the errors and when I debug I found

  https://BASEURL/static/version1568090061/frontend/xxx/xxx/STORE/Magento_Checkout/js/action/set-shipping-information.min.js and https://BASEURL/STORE/rest/STORE/V1/guest-carts/5a7b7d15090f56fde5477e0b649d536a/set-payment-information return 404

When I search then I think this issue may be occurring because of a sticky session. so I ask the server hosting company to enable sticky session then the error came 503. When I debug the message I found it also return the server down the message with the JSON response. I am wondering, I am the only one who is facing this issue or anyone else have also faced this issue. I am using Magento EE 2.2.2

Note: This issue occurs more often If I use the Onestep Checkout extension and chrome. And in my staging server where there is only one server for backend and frontend this issue does not occur.


texts: Overwrite template without the "name" attribute

texts:
How can I overwrite the template of something like select.phtml

<block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="product/view/options.phtml">
    <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="product/view/options/type/select.phtml"/>
</block>

via my module, even tough it does not have a "name" attribute only a class and "as"?

I tried the following:

MyCompany/MyModule/view/frontend/layout/catalog_product_view.xml

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <referenceBlock name="product.info.options">
                <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="MyCompany_MyModule::product/view/options/type/select.phtml"/>
            </referenceBlock>
         </referenceContainer>
    </body>
</page>

but that does not work at all.


texts:
How do I know how much cache I should have?
I am always increasing the ram disk for var folder. Now it is 2GB.
Looks like Magento could eat all cache space.
Whenever I run a api script, I have to clear cache before to speed this operations up.
How do I know, what kind of stuff uses how much space in the cache?


texts: Magento 2 Products Base Image Missing on Frontend after Import

texts:
We've been having an issue with importing images via CSV spreadsheet into Magento 2.
I'm able to import product images into the Magento admin via the columns Base Image, Small Image, Thumbnail and Swatch - however it doesn't show on the product frontend. However, it shows just fine on the catalog pages. Screenshots attached.

I've tried the following commands:
php bin/magento indexer:reindex

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

php -f bin/magento setup:upgrade

But none of them fix the issue. The product main image works when manually added via the admin.
What could be causing this? Any help is appreciated.


texts: How do I add a fixed-row-format import type to uRapidFlowPro?

texts:
I want to add a new type of Fixed Row Format import to uRapidFlow Pro (Magento 2.x) - however the code is completely obfuscated.

Is there a way to do this, and what would I need to do in order to plugin to it?


texts: Additional Options to quote item REST API

texts:
I'm trying to add additional options to the product, it is working fine to add attributes programmatically on the website but how to add these additional attributes to the REST API.
public function aroundConvert(
    \Magento\Quote\Model\Quote\Item\ToOrderItem $subject,
    Closure $proceed,
    \Magento\Quote\Model\Quote\Item\AbstractItem $item,
    $additional = []
) {
    /** @var $orderItem \Magento\Sales\Model\Order\Item */
    $orderItem = $proceed($item, $additional);//result of function 'convert' in class 'Magento\Quote\Model\Quote\Item\ToOrderItem'
    if ($additionalOptions = $item->getOptionByCode('additional_options')) {
        $options = $orderItem->getProductOptions();
        $options['additional_options'] = $this->serialize->unserialize($additionalOptions->getValue());
        $orderItem->setProductOptions($options);
        return $orderItem;
    }
    return $orderItem;
}

When I try to add an additional option to REST API: V1/carts/mine/items I'm getting the following error.

"Property "AdditionalOptions" does not have accessor method "getAdditionalOptions" in class "Magento\Catalog\Api\Data\CustomOptionInterface"."

Below is my request packet:
    {
  "cartItem": {
    "sku": "MEW001",
    "qty": 1,
    "quote_id": "126252",
        "product_option": {
      "extension_attributes": {
                "custom_options": [
                    {
                        "additional_options":
                        {
                                "price":"200.000000",
                                "send_friend":"1",
                                "customer_name":"Sender Name",
                                "recipient_name":"Friend",
                                "recipient_email":"sendto@email.com",
                                "message":"xyz"
                        }
                    }
                ]
            }
        }
  }
}

And the screenshot.


texts:
When i compile php bin/magento setup:di:compile it generates an error

 Fatal error: Class 'Magento\Sales\Block\Adminhtml\Totals' not found in C:\xampp\htdocs\market-place\vendor\magento\module-sales\Block\Adminhtml\
Order\Creditmemo\Totals.php on line 17

I don't known why the class is not found. The class even exists in this path.


texts: How to override Price Block only for category list and not for search list?

texts:
I have a custom module for ajax layered navigation with multiple filters which has a price slider. I don't want a price slider on the search result page.

my config.xml rewrites block like this

    <blocks>
        <catalog>
            <rewrite>
                <layer_state>Royal_Layerednav_Block_Catalog_Layer_State</layer_state>
                <layer_view>Royal_Layerednav_Block_Catalog_Layer_View</layer_view>
                <product_list_toolbar>Royal_Layerednav_Block_Catalog_Product_List_Toolbar</product_list_toolbar>
                <layer_filter_attribute>Royal_Layerednav_Block_Catalog_Layer_Filter_Attribute</layer_filter_attribute>
                <layer_filter_price>Royal_Layerednav_Block_Catalog_Layer_Filter_Price</layer_filter_price>
            </rewrite>
        </catalog>
        <catalogsearch>
            <rewrite>
                <layer_filter_attribute>Royal_Layerednav_Block_CatalogSearch_Layer_Filter_Attribute</layer_filter_attribute>
                <result>Royal_Layerednav_Block_CatalogSearch_Result</result>
            </rewrite>
        </catalogsearch>

without this price block overriden, everything works fine (ofcourse with no price slider).
If I override Price Block Royal_Layerednav_Block_Catalog_Layer_Filter_Price, category listing page works fine, with price slider.
But in catalog search page price slider is appearing with wrong values.

I admit that I did not design the Price block to collect prices in search result page. But I don't need to show a price filter on search page.

  So My question is: Is there a way, that catalogsearch does not take my overriden price block, instead it should use the default Price block
  Mage_Catalog_Block_Layer_Filter_Price

I don't know what to do to accomplish this. Can anyone please help?


texts: Magento 2: Get Related products from Product Id now showing Name and price

texts:
Below is my code to get related products from products id, It is working fine but not giving values for name and price it just gives SKU and id

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $product = $objectManager->create('Magento\Catalog\Model\Product')->load($lastid);

    $relatedProducts = $product->getRelatedProducts();

    if (!empty($relatedProducts)) {
        echo 'Related Products
';
        foreach ($relatedProducts as $relatedProduct) {
            echo $relatedProduct->getId().'-->'.$relatedProduct->getPrice().'-->'.$relatedProduct->getName().'-->'.$relatedProduct->getId(); //get name
            echo "
";
        }
    }


texts: Magento 2 - Get View count for the product

texts:
Below is my code following the post.

use \Magento\Catalog\Block\Product\View\AbstractView;

class ProductViewCount extends AbstractView
{
    /**
    * @var CollectionFactory
    */
    protected $_productRepo;

    /**
     * @var \Magento\Store\Model\StoreManagerInterface
     */
    protected $_storeManager;

    /**
     * @var \Magento\Reports\Model\ResourceModel\Product\Collection
     */
    protected $_prodCollection;

    /**
     * ProductViewCount constructor.
     *
     * @param \Magento\Catalog\Block\Product\Context $context
     * @param \Magento\Catalog\Model\ProductRepository $productRepo
     * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils
     * @param \Magento\Reports\Model\ResourceModel\Product\Collection $prodCollection
     * @param array $data
     */
    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Catalog\Model\ProductRepository $productRepo,
        \Magento\Framework\Stdlib\ArrayUtils $arrayUtils,
        \Magento\Reports\Model\ResourceModel\Product\Collection $prodCollection,
        array $data = []
    ) {
        $this->_productRepo = $productRepo;
        $this->_prodCollection = $prodCollection;
        $this->_storeManager = $context->getStoreManager();
        parent::__construct($context, $arrayUtils, $data);
    }

    /**
     * @param int $id
     *
     * @return mixed
     */
    public function getProductViewCount()
    {
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $_product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
        $productId = $_product->getId();
        /**
         * @var \Magento\Catalog\Model\Product\Interceptor $product
         */
        $prodData = $this->_prodCollection->addViewsCount()->getData();

        if (count($prodData) > 0) {
            foreach ($prodData as $product) {
                if ($product['entity_id'] == $productId) {
                    return (int) $product['views'];
                }
            }
        }

        return 0;
    }

}

In the above code, $prodData = $this->_prodCollection->addViewsCount()->getData(); always return an empty array. Please help.


texts: Module not generated in pub/ folder, Magento 2.3.3

texts:
Hello!
I have Magento version 2.3.3.
I run:

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento bin/magento setup:static-content:deploy -f

And permissions for folders:
But after commands in pub/static/frontend folder i not find module with my styles and with my JS code.
How i can fix it?
Please, help me)


texts: How authorization is managed and handled in magento2

texts:
I found below code on custom API file :

public function orderDetails($params)
{
    $customerID = $this->userContext->getUserId();
    if(empty($customerID)){
        return[[
            'error_code' => 1001,
            "message"=>"Validation Failed",
            'error_desc'   => 'Unable to locate customer'
        ]];
    }
    .........
    .......
}

Few Points :

$this->userContext is object of class Magento\Authorization\Model\UserContextInterface

My Questions are :

How magento handles authentication in API's.
What data we need to send and where so that Magento\Authorization\Model\UserContextInterface can set customer id
What data i need to send so that i can get the User Id from UserContextInterface class, like code above

I am not getting how and from where the data are set and retrieve related to user on API's.


texts: Magento 2.2.5: 'rm' is not recognized as an internal or external command

texts:
When i'm trying to use this command:

rm -rf var/cache/

It throws an error message:  'rm' is not recognized as an internal or external command.


texts: Magento 2: How programmatically comment / uncomment code php in topmenu?

texts:
Example. Top menu:

Comment manually children category in topmenu.phtml:

<?php /* @escapeNotVerified */ /*echo $block->getChildHtml();*/ ?>

After click or hover - uncomment this code:

<?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?>

What is the best solution? I want to reduce the number of links in the body of html, but I don't want to hide the top menu (I believe that this should be implemented in the basic functionality of the Magento).


texts: Add Customer data in custom module grid in Magento 2

texts:
I have created a custom module in magento admin. In my module i have customer id.
Using this ID i want to show customer data in my custom module Grid. But i am not getting how to do it.

I have created grid using ui component.


texts:
I'm trying to get registry value in my block. Here's how block looks like,

<?php
namespace Vendor\Dunning\Block\Adminhtml\Dunning\Edit\Tab;

class PartPayments extends \Magento\Backend\Block\Template
{
    protected $_template = 'Vendor_Dunning::installments.phtml';

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

Template is getting rendered but If I create constructor then it gives me error like below which looks dangerous to debug.

  Fatal error: Method
  Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an
  exception, caught Error: Call to a member function dispatch() on null
  in
  /opt/lampp/htdocs/magento2/vendor/magento/module-ui/Component/Wrapper/UiComponent.php
  on line 0

Please help.


texts:
I created under my theme/Magento_Customer/templates/form:register.phtml and register2.phtml and i put this in customer_account_create under mytheme/Magento_Customer/layout, and i created  a module to have  a route that lead to the second form and i overrided again under layout of my new module the customer_account_create.xml to just show the address in the form and i put in the layout of my new module newcust_index_index :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="1column">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Form\Register" name="customer_form_register_2" template="Magento_Customer::form/register2.phtml"/>
        </referenceContainer>
    </body>
</page>

I got this as result in customer/account/create (the form is duplicated ):

and in the new form i got this :

the customer_account_create layout

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Customer\Block\Form\Register" name="customer_form_register_2" template="Magento_Customer::form/register2.phtml">
            </block>
        </referenceContainer>
    </body>
</page>


texts: "shop by" box / layered navigation not showing

texts:
How can I make the layered navigation to appear on my site home page ( or any other pages)

I have a default category and a laptop category with “is anchor” set to YES.

These categories contains products with price.

The attribute price is set as filterable.

I still see no layered navigation appearing. What can be missing?


texts: should free shipping be disabled when enabling table rates

texts:
I Created a table rate for price vs destination. I had to use table rates because in "City A" the shipping is free , but for rest of the cities in the country can have free shipping only if the cart value is more than 299. But now the issue is when I try to place an order , in the shipping method section of my one page check out, it  displays the error  "Sorry, no quotes are available for this order at this time". I want to know if it  is caused by disabling the free shipping in the backend or is it some problem with my table rate.

|Country |Region/State|Zip/Postal Code |Order Subtotal (and above)|Shipping Price
|ARE     |*           |*               |                         0|            12
|ARE     |*           |*               |                       299|            0
|ARE     |AE02        |*               |                         0|            0


texts: Just copy original domain files and DATABASE to Sub-domain and change Base-URL every links is working prefect but only few products, category, and images slide show links redirect to original main domain index/category page and show 404 not found error.


texts: Magento2 how to display additional custom total value in shipment email

texts:
I have added a new custom cart total (e.g. Extra Fee) in my current project. I made it display on almost every page, email and pdf files. However, I can't able to find a way to display it in the shipment email and pdf.

Magento2 has 'order_totals', 'invoice_totals' and 'creditmemo_totals' blocks inbuilt in core sales module. So I can add my new total reference to these blocks. However, Magento2 does not have a 'shipment_totals' kind block. The total section also does not display on the shipment page in admin. However, it does display on shipment email and its pdf file.

How can I add/set my custom total into shipment email and pdf file? Can someone please help me with this?

Thanks,


texts: magento 2.3.4 configurable product price difference

texts:
My problem is in configurable product price display. actual price in my product is 58.

But i select my drop down configurable price display only 53 QR.

Any one help me.


texts: magento install "Too many arguments, expected arguments"

texts:
I get "Too many arguments, expected arguments" when I use the template php magento/bin setup:install \
   --admin-firstname=John \
   --admin-lastname=Smith \
   --admin-email=jsmith@mail.com \
   --admin-user=admin \
   --admin-password=password1 \
   --base-url=http://magento.local/ \
   --db-host=localhost \
   --db-name=magento \
   --db-user=magento \
   --db-password=magento \
   --currency=USD \
   --timezone=America/Chicago \
   --language=en_US \
   --use-rewrites=1


texts: Need help regarding rewrite concept in config.xml

texts:
I am learning Magento. Somewhere in module I have seen below code in config.xml

<global>
    <rewrite>
            <namespace_modulename>
                <from><![CDATA[#^/module/controller/action/#]]></from>
                <to>/modulename/newcontroller/newaction/</to>
            </namespace_module>
        </rewrite>
        <rewrite>
            <namespace_modulename2>
                <from><![CDATA[#^/module/controller/action/#]]></from>
                <to>/modulename/newcontroller/newaction/</to>
            </namespace_modulename2>
        </rewrite>
        <rewrite>
            <namespace_modulename3>
                <from><![CDATA[#^/module/controller/action/#]]></from>
                <to>/modulename/newcontroller/newaction/</to>
            </namespace_module3>
        </rewrite>

    <blocks>
            <review>
                <rewrite>
                    <form>Namespace_Modulename_Block_Review_Form</form>
                </rewrite>
            </review>
        </blocks>
</global>

I have two question regarding this code.

<namespace_modulename> it seems okay, But why they have used <namespace_modulename2>, <namespace_modulename3>. I mean why they have added number along with modulename.
My second question is that in the <block> section, it seems here it is overwriting any predefined block. But how magento find which block have to rewrite.


texts:
I use google maps autocomplete to fill address[0] field and city field and autocomplete these fields from jquery after getting response from map. After the fields populated I press place order but error occures that

address field is required, city field is required.

What's the problem some one tell me how to prevent this or how to disable required from these fields...


texts: Can't see specific order magento on admin after supee-7405

texts:
After a couple of days that the patch supee-7405 was released I've decided to install the it.

I did a backup of my website because I could see there were a lot of files to modify and I suspected that something could be wrong and yes, something has been wrong.

When I am on the admin panel and I go to sales>orders it looks like everything is ok. But when I try to access to any of those orders I can't see the information of that order.

Does this have a solution or I should go back to my backup?


texts:
I'm trying to override the method aroundExecute.
<type name="Magento\InventoryConfigurableProduct\Plugin\Sales\GetSkuFromOrderItem">
    <plugin disabled="false" name="X_Y_GetSkuFromOrderItem" sortOrder="10" type="X\Y\Plugin\Magento\InventoryConfigurableProduct\Plugin\Sales\GetSkuFromOrderItem"/>
</type>

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\InventoryConfigurableProduct\Plugin\Sales;

use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\InventorySalesApi\Model\GetSkuFromOrderItemInterface;
use Magento\Sales\Api\Data\OrderItemInterface;

/**
 * Get simple product SKU from configurable order item
 */
class GetSkuFromOrderItem
{
    /**
     * @param GetSkuFromOrderItemInterface $subject
     * @param callable $proceed
     * @param OrderItemInterface $orderItem
     * @return string
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function aroundExecute(
        GetSkuFromOrderItemInterface $subject,
        callable $proceed,
        OrderItemInterface $orderItem
    ): string {
        if ($orderItem->getProductType() !== Configurable::TYPE_CODE) {
            return $proceed($orderItem);
        }

        $orderItemOptions = $orderItem->getProductOptions();
        // use object manager for now, till I override the method.
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $_productloader = $objectManager->get('Magento\Catalog\Model\ProductFactory');
        $simple = $_productloader->create()->load($orderItemOptions['info_buyRequest']['selected_configurable_option']);
        if($simple->getVisibility() != \Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG){
            return $simple->getSku();
        }
        $sku = $orderItemOptions['simple_sku'];

        return $sku;
    }
}

Any idea how to achieve this?
decided to override:
<type name="Magento\Sales\Model\Order\Item">
        <plugin name="X_Y_get_product_Options"  type="X\Y\Plugin\Magento\Sales\Model\Order\Item" sortOrder="1"/>
    </type>

public function aroundGetProductOptions(
        \Magento\Sales\Model\Order\Item $subject,
        \Closure $proceed
    ) {
        $result = $proceed();
        rerurn $result;
}

Thanks for your help!


texts:
I want to add Quantity increment / decrement buttons in header minicart.

For that I have added divs as follows

+

                    <input data-bind="attr: {
                           id: 'cart-item-'+item_id+'-qty',
                           'data-cart-item': item_id,
                           'data-item-qty': qty,
                           'data-cart-item-id': product_sku
                           }, value: qty"
                           type="number"
                           size="4"
                           class="item-qty cart-item-qty"
                           maxlength="12"/>

-

in file Magento_Checkout/web/template/minicart/item/default.html in my custom theme.

I have created the javascript

jQuery('.more, .less').on("click",function(){
                var obj = jQuery(this);
                var currentQty = obj.siblings('.cart-item-qty').val();
                var iid = obj.siblings('.update-cart-item').attr('data-cart-item');

                if(obj.hasClass('more')){
                    var newAdd = parseInt(currentQty)+parseInt(1);
                    obj.siblings('.cart-item-qty').val(newAdd);
                    obj.siblings('.cart-item-qty').attr('data-item-qty',newAdd);
                    jQuery('#update-cart-item-'+iid).click();
                }else{
                   var newAdd = parseInt(currentQty)-parseInt(1);
                    obj.siblings('.cart-item-qty').val(newAdd);
                    obj.siblings('.cart-item-qty').attr('data-item-qty',newAdd);
                    jQuery('#update-cart-item-'+iid).click();
                }
            });

But I am not sure where to add this script and how to call it. The script is working fine when I am executing it from browser console.

I have tried adding the script in default.html, minicart.phtml but it is not working.
My query here is how and where I can add this script to make it work?


texts: Access denied for user 'root'@'localhost' (using password: YES)

texts:
I do not know where I am wrong.

db' => [
    'table_prefix' => 'astro',
    'connection' => [
      'default' => [
        'host' => 'localhost',
        'dbname' => 'astrokapoor_new',
        'username' => 'root',
        'password' => 'dayzero',
        'active' => '1'
      ]
    ]
  ],


texts: Magento 2: Pre-load key request fonts/Luma-Icons.woff2

texts: How can I remove fonts/Luma-Icons.woff2 from google page speed insight. From which less file this font is being loaded.


texts: Call to a member function getSortedChildren() on a non-object product attributes

texts:
On my product view page I get the following error:

 Fatal error: Call to a member function getSortedChildren() on a non-object in /template/catalog/product/view/type/options/configurable.phtml on line 32

Here's configurable.phtml

<?php
   $_product    = $this->getProduct();
   $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
   $_jsonConfig = $this->getJsonConfig();
   $_renderers = $this->getChild('attr_renderers')->getSortedChildren(); // LINE THE ERROR REFERS TO
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>

<?php foreach($_attributes as $_attribute): ?>
    <?php
    $_rendered = false;
    foreach ($_renderers as $_rendererName):
        $_renderer = $this->getChild('attr_renderers')->getChild($_rendererName);
        if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_attribute, $_jsonConfig)):
            $_renderer->setProduct($_product);
            $_renderer->setAttributeObj($_attribute);
            echo $_renderer->toHtml();
            $_rendered = true;
            break;
        endif;
    endforeach;

    if (!$_rendered):
    ?>

*<?php echo $_attribute->getLabel() ?>

    <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>

            <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                <option><?php echo $this->__('Choose an Option...') ?></option>
              </select>

    <?php endif; ?>
<?php endforeach; ?>

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

I haven't made any changes to the attributes lately, I only uploaded some swatch images, I've renamed the folder and the code still isn't working


texts: Get current product id in Observer controller_front_send_response_before

texts:
catalog_controller_product_view event cannot be used in conjunction with FPC cache since Magento will not raise it after the first visit. That's why I am using controller_front_send_response_before observer as it is described in:https://magento.stackexchange.com/a/126377/31910

My question is, how can I get current product id in this observer?


texts: Custom CSS as module configuration option

texts:
I'm looking to add an option to a module that gives users the power to override CSS styling. The option in system.xml looks like this:

 <additional_css translate="label, comment">
  <label>Additional CSS:</label>
  <frontend_type>textarea</frontend_type>
  <sort_order>2</sort_order>
  <show_in_default>1</show_in_default>
  <show_in_website>1</show_in_website>
  <show_in_store>1</show_in_store>
 </additional_css>

Where I'm stuck is where to put the contents of this option. Ideally it is added to a CSS file that is loaded after the main module CSS is loaded. However I don't know if this is even possible. Anyone who has experience with this?


texts: Decrement value instead of setting it like `number = number - 1`. Is it possible in Magento?

texts:
I need to decrement a value with an atomic database operation, is it possible using Magento models?

setNumber($number) works like number = $number, but I need it to be decremented in SQL query.

Is it possible in Magento or do I have to write the SQL query myself?


texts: How to sell a complete product package, without the customer can select just one

texts:
I need sell product package, but I need that client won't be able to select just one, the default method is like this image below:

I need only show to client what products are available on package like this image:

But the client cannot be able to change or select products, if the client change the amount, the price just multiply all products on package x2, example:

Total amount of product are 211, if the client change the amount to 2 the total go to 422 and so on...

Obs: I need to sell package of different amounts, like 2 Products on package, 3 or 4 products...


texts: Need different inventory and currency, should I make two websites or stores?

texts:
So here is my issue. We are running a clothing store which ships internationally as well. Often we need to maintain different inventory for our local and international customers. For local store, shipping address has to be limited to Pakistan while billing address can be anywhere in the world. And for the international store, the shipping address can be any country except Pakistan whereas the billing address can be anywhere in the world. Furthermore, we also need the Pakistan store to have PKR currency while the international store to have a couple of major currencies (USD, GBP, EUR).

What's the best way to achieve this? Should I make two websites or two stores? We are using Magento 2.2.

Furthermore, I would like two show the store selector (i.e. Pakistan or International) first time a user visits the website (something like this: https://www.kayseria.com/country.php?20180219155425) and then it should always show their selected store to them. Unless they want to change it (there will be an option for that in the header).


texts:
I need to override the RichContent Component of PWA.
I have used the below package to override components.
https://www.npmjs.com/package/@fooman/venia-ui-override-resolver
With this package, I'm able to modify Header, Footer, Sidebar, etc. But RichContent does not render the HTML after override.
anyone any ideas what I' missing?


texts: How to Extend \Magento\Sales\Block\Order\Email\Items\DefaultItems.php class for adding an extra function?

texts:
I want to extend the \Magento\Sales\Block\Order\Email\Items\DefaultItems.php class so I can add an extra function instead of putting in the core file. (which works btw)

I tried it with creating a preference in my di.xml in my custom module like this;

<preference for="\Magento\Sales\Block\Order\Email\Items\DefaultItems"
                type="MyModule\MyVendor\Rewrite\Magento\Sales\Order\Email\Items\DefaultItems" />

Then extend the class like the this:

<?php

namespace MyModule\MyVendor\Rewrite\Magento\Sales\Order\Email\Items;

class DefaultItems extends \Magento\Sales\Block\Order\Email\Items\DefaultItems
{

    /**
     * DefaultItems constructor.
     */
    public function __construct()
    {

        die('Class extended');

    }
}

When I make a functiongetSku() my IDE (PHPstorm) shows that it will be overridden like it supposed to. When sending an invoice email through the backend it will show me the die in the constructor.

When deleting the constructor (or the die) I  am getting the following error message:

Unknown template engine type ".

So what am i missing here, any ideas?


texts: Magento 2 checkout process(place order) not thread safe

texts:
I found that if two people clicking "place order" at the same time to buy the same product with qty=1, both people can checkout successfully. The stock quantity deducted to 0.
Anyone encountered the same problem?


texts: Magento rewrite 'Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select' not working?

texts:
below is my config files code.

  app/code/local/Eventprice/Meta/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Eventprice_Meta>
            <version>0.0.1</version>
        </Eventprice_Meta>
    </modules>
    <global>
        <models>
            <eventprice_meta>
                <class>Eventprice_Meta_Model</class>
            </eventprice_meta>
        </models>
        <resources>
            <eventprice_sql>
                <setup>
                    <module>Eventprice_Meta</module>
                </setup>
            </eventprice_sql>
        </resources>
    </global>
    <adminhtml>
        <rewrite>
            <catalog_product_edit_tab_options_type_select>
                Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Select
            </catalog_product_edit_tab_options_type_select>
            <catalog_product_edit_tab_options_option>
                Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_option
            </catalog_product_edit_tab_options_option>
        </rewrite>
    </adminhtml>
</config>

below the code of my Select.php file.

  app/code/local/Eventprice/Meta/Block/Adminhtml/Catalog/Product/Edit/Tab/Options/Type/Select.php

<?php

class Eventprice_Meta_Block_Adminhtml_Catalog_Product_Edit_Tab_Options_Type_Select
extends
Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Abstract
        {
            /**
             * Class constructor
             */
             public function __construct()
            {
                parent::__construct();
                echo 'dsfdsfsd';exit;
                $this->setTemplate('sphere/catalog/product/edit/options/type/select.phtml');
                $this->setCanEditPrice(true);
                $this->setCanReadPrice(true);
            }
        }
 ?>

but my module Select.php file is not called. please help where i create a mistake Thanks.


texts:
We are currently making a major overhaul to an old website of ours, and it is still using Magento Version 1.4.1.1. I know it is very outdated.

We have a lot of orders here that we want to make a backup of, such as name, email address, telephone order, sale amount, date of order(s), items ordered, etc.

There are over 10k transactions.

How do I easily back it up in a reader friendly format, preferably on a spreadsheet?

I have seen plugins like https://marketplace.magento.com/raveinfosys-raveinfosys-orderexporter.html but it only goes until version 1.5.

I have a little programming knowledge, but prefer an easy way to do it.


texts:
I am trying to convert currency in Magento 1.5 using the following code in a separate file to check currency conversion. I have two stores with respective currency settings in the admin.

set_time_limit(0);
error_reporting(1);
ini_set('display_errors', 1);
define('D_S', DIRECTORY_SEPARATOR);
require_once 'app/Mage.php';
umask(0);
Mage::app();

$_fromCurr = 'USD';
if( Mage::app()->getStore()->getCurrentCurrencyCode() == 'CAD') {
    $_locale = 'en_CA';
    $_toCurr = 'CAD';
} else {
    $_locale = 'en_US';
    $_toCurr = 'USD';
}
$currency = new Zend_Currency($_locale);
$amount = 150;
echo $_price = $currency->toCurrency(round( Mage::helper('directory')->currencyConvert( $amount, $_fromCurr, $_toCurr ), 2 ));

I am getting following error,

  Fatal error: Call to a member function getCode() on a non-object in /var/www/vhosts/www.test.com/httpdocs/app/code/core/Mage/Directory/Model/Currency.php on line 171

I tried following this http://www.magentocommerce.com/boards/v/viewthread/118631/P15/#t381027, but it does not work. What is wrong here?


texts: Products and categories are not showing in frontend store

texts: I am using magento version 1.9.2. I have added some products in appropriate categories, also mentioned the stock quantity and product is in "in stock". But still those products are not available in front-end store. So what to do???


texts: Error: You cannot apply bindings multiple times to the same element in Magento 2.1.0

texts:
I have used Knockout JS app with in Magento 2.1.0, when I use ko.applyBindings(ViewModel, document.getElementById("custom")); it breaks the Knockout used by Magento and throws this error:

Uncaught Error: You cannot apply bindings multiple times to the same element.

Even i have tried with ko.cleanNode(document.getElementById("custom"));Still the error exists


texts: Added CMS block to contacts page layout XML, but doesn't show up

texts:
I am trying to add a CMS static block, to the magento 1 contacts page, in the right column.

I've tried adding the following to

  app/design/frontend/{client}/{theme}/layout/local.xml

<contacts_index_index>
    <reference name="right">
        <block type="cms/block" name="contact_stores">
            <action method="setBlockId"><block_id>contact_stores</block_id></action>
        </block>
    </reference>
</contacts_index_index>

I've also tried overriding the contacts.xml file and adding:

<reference name="right">
    <block type="cms/block" name="contact_stores">
        <action method="setBlockId"><block_id>contact_stores</block_id></action>
     </block>
</reference>

But neither of this show up on the page... What have I missed?

Edit: I have now also tried adding a block with a template as follows:

<reference name="right">
    <block type="page/html" name="product.stores" before="banner.right" as="contact_stores" template="moores/contact_right_block.phtml"/>
</reference>

and the template has the following:

<div class="banner_right">
<?php
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('contact_stores')->toHtml();
?>
</div>

This also fails to add anything to the page?


texts: upgrade magento 2.2.6 to 2.3.3 PHP requirement incompatible with your PHP version (5.6.33.0)

texts:
i am upgrading magento version like
magento 2.2.6 to magento 2.3.3
and my php version is 7.2
but still not run command

and my PHP CLI version

anyone facing this issue?
which command needed in magento 2.3.3 upgrade?
Any help would be appreciated.

Thanks.


texts: No order information if products is virtual?

texts:
I have added virtual products to a webshop for the first time, and afterwards i created an order with the virtual product.
But when I click on the order in the back-end I can't get any information about the order. Is this normal? Please see my screenshot below;


texts: Qty Uses Decimals Magento 2 does not work

texts:
Our client needs to give the option to the customers to buy certain products in the decimal quantities. i.e. the customers can buy in periods on 0.25. (0.25, 0.50, 0.75, 1, 1.25....... )

Enabled the option Qty Uses Decimals from the admin panel, when i go to the frontend and add a point its gives me the following message

  You can buy this product only in quantities of 1 at a time.

Here is the backend for the product

If you know about patch or any extension, that would help


texts: Magento2: How to get the old qty of product?

texts:
How to get the available qty of the product before saving the product with new qty in magento2.

How to do that.

Thanks.


texts: Interceptor Plugin for Product Attributes

texts:
I'm trying to modify the "short_description" attribute using a plugin but I can't seem to get it to work across the whole website. I can do this on the product view page with the following but I don't know how to do this globally across the whole website.

I've been trying to create a plugin on "getAttributes" but nothing I try wants to work.

../app/code/TM/Customplugin/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\Catalog\Block\Product\View">
        <plugin name="tm-block-plugin" type="TM\Customplugin\Plugin\GetProductPlugin" sortOrder="2" />
    </type>
</config>

../app/code/TM/Customplugin/Plugin/GetProductPlugin.php

<?php
    namespace TM\Customplugin\Plugin;
    class GetProductPlugin
    {
        public function afterGetProduct(\Magento\Catalog\Block\Product\View $subject, $result)
        {
            $result['short_description'] = strtolower($result['short_description']);
            return $result;
        }
    }

UPDATE

This product attribute is being called through the helper class

$_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description').

Using print_r(get_class_methods($_helper)) I get this:

Array ( [0] => __construct [1] => addHandler [2] => getHandlers [3] => process [4] => productAttribute [5] => categoryAttribute [6] => isDirectivesExists [7] => isModuleOutputEnabled )

Does anyone know if I need to create a plugin to intercept the productAttribute from the helper or is there another way?

SOLUTION

I ended up getting this to work using the preference class rewrite method and not the Plugin method. I know this isn't ideal but it works. If anyone knows how to achieve the same result using a Plugin please share :)

/app/code/TM/Module1/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">
        <preference for="Magento\Catalog\Model\Product" type="TM\Module1\Model\Catalog\Product" />
    </config>

/app/code/TM/Module1/Model/Catalog/Product.php

<?php
namespace TM\Module1\Model\Catalog;
class Product extends \Magento\Catalog\Model\Product
{
    public function getShortDescription()
    {
        return strtolower($this['short_description']);
    }
}
?>


texts: Controller file was loaded but class does not exist in localhost

texts:
i am new in magento

When i have setup my magento 1.9.0 website in local then after i am facing one error message during check out So can anyone please help me

a:5:{i:0;s:51:"Controller file was loaded but class does not exist";i:1;s:873:"#0 E:\sam\htdocs\mytheme01\includes\src\__default.php(28528): Mage::exception('Mage_Core', 'Controller file...')
#1 E:\sam\htdocs\mytheme01\includes\src\__default.php(28496): Mage_Core_Controller_Varien_Router_Standard->_includeControllerClass('E:\\Chetan\\htdoc...', 'WCL_CustomCheck...')
#2 E:\sam\htdocs\mytheme01\includes\src\__default.php(28383): Mage_Core_Controller_Varien_Router_Standard->_validateControllerClassName('WCL_CustomCheck...', 'index')
#3 E:\sam\htdocs\mytheme01\includes\src\__default.php(27971): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#4 E:\sam\htdocs\mytheme01\includes\src\__default.php(30837): Mage_Core_Controller_Varien_Front->dispatch()
#5 E:\sam\htdocs\rolson\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#6 E:\sam\htdocs\rolson\index.php(87): Mage::run('', 'store')
#7 {main}";s:3:"url";s:151:"/mytheme01/checkout/cart/add/uenc/aHR0cDovL2xvY2FsaG9zdC9yb2xzb24vY2xhbXBzLWNyYW1wcy8zcGMtZy1jbGFtcC1zZXQuaHRtbA,,/product/7899/form_key/RGCx0UYdMYYYhd8U/";s:11:"script_name";s:17:"/mytheme01/index.php";s:4:"skin";s:7:"default";}


texts: Can't install extensions "Failed to connect to magento-community port 443: Connection refused"

texts:
I am trying to install an extension (I have tried more than 1 and also checked version compatibility) but I keep getting this error:

  Failed to connect to magento-community port 443: Connection refused

An example extension key that this occurs on is:

magento-community/ArtsOnIT_OfflineMaintenance


texts: Advanced Report - Sales Report : Adding Attribute Column

texts:
how to add attribute column in Sales Report?
I use the Advanced Report of AheadWorks and I've tried to make the attribute column but do not know how to join the sales table with the attribute table.
I've show the contents of the attributes (the attributes I was Brand) in drop down style.
The following is how I add the attribute column (file location : app\code\local\AW\Advancedreports\Block\Advanced\Sales\Grid.php ) :

http://i.imgur.com/eh7q9PD.png  ( image )

protected function _prepareColumns()
{
   .....

   $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'brand');
    $options =  array();
                foreach( $attribute->getSource()->getAllOptions(true, true) as $option ) {
                $options[$option['value']] = $option['label'];
                }

    $this->addColumn('brand',
        array(
            'header'=> Mage::helper('catalog')->__('Brand'),
            'width' => '80px',
            'index' => 'brand',
            'type'  => 'options',
            'options' => $options,
    ));

   ........

           return parent::_prepareColumns();
}

add : November 07, 2014

(sorry, I do not know in which section to put this. edit my question or add as an answer)
I add this subquery to $collection

//CREATE A SUBQUERY FOR GETTING A BRAND - Start
$brandTable = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('entity_id');
$brandTable->getSelect()->join( array('cpei' => 'catalog_product_entity_int'),
                                "e.entity_id = cpei.entity_id",
                                array()
                                );
$brandTable->getSelect()->join( array('eaov' => 'eav_attribute_option_value'),
                                "cpei.value = eaov.option_id",
                                array('brand' => 'value')
                                );
$brandTable->getSelect()->join( array('eao' => 'eav_attribute_option'),
                                "eaov.option_id = eao.option_id",
                                array()
                                );
$brandTable->getSelect()->join( array('ea' => 'eav_attribute'),
                                "eao.attribute_id = ea.attribute_id AND ea.attribute_code = 'brand'",
                                array()
                                );
$collection->getSelect()->join( array('child_brand' => new Zend_Db_Expr( '(' . $brandTable->getSelect() . ')')),
                                "child_brand.entity_id = _product.entity_id",
                                array('brand'=>'child_brand.brand')
                                );
//CREATE A SUBQUERY FOR GETTING A BRAND - End


texts: how can add store to magento in cpanel share host

texts:
i am using cpanel sharing host and can't access ssh
before i create this question i searched in google and this site and stackoverflow about add second store to magento store
most of site write similar thing , use symlink for virtual server and use htaccess modification for host.
i test all of theme but get 404 error. i am tired of search . maybe you do this in shared host such as cpanel or direct admin then can you help me to add second store to my magento store ?
my store base url is : shop.com
i want to add second store with this name : shop.com/store2
and later add other store to this shop
i read all of this toturial and don't get answer . my magento is 1.9.1
1-http://www.crucialwebhost.com/kb/how-to-setup-multiple-magento-stores/
2-https://www.properhost.com/support/kb/30/How-To-Setup-Magento-With-Multiple-Stores-And-Domains
3-https://stackoverflow.com/questions/13091175/how-to-add-create-new-store-in-magento-1-7


texts: Magento2 - Using Luma - Can't add CSS or JS

texts:
new Magento2 installation, went through a whole series of learning where I could not figure out why my default head blocks xml wasn't working to load my custom css/js files... as per the new theme in the documentation.
After re-going over the code, there was nothing wrong... by trial & error,
I figured out that if I made my new theme inherit from magento/blank, then my custom css & js would load... but if I inherit from magento/luma, it would not... so... my question is HOW can I use the Luma theme and then just modify it to suit needs, it's a great starting point, and would cut out weeks of development if we could use this.
So, I created a new theme, and inherit from luma like this:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>CVPStyle4</title>
    <parent>Magento/luma</parent>
    <media>
        <preview_image>media/preview.jpg</preview_image>
    </media>
</theme>

then I go and regenerate static files via deploy, and my theme is in the backend, and I activate it and it looks like luma, but it does NOT load my custom css/js files, or anything in the default_head_blocks.xml
inside:
app > design > frontend > myvendor > mytheme > Magento_Theme > layout
and here's my code in that xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>

    <!--Custom Styles-->
    <css src="css/cvpstyle.css" />

    <!--Before-After Script-->
    <link src="js/jquery.twentytwenty.js"/>
    <link src="js/jquery.event.move.js"/>

    <!--Font Awesome-->
    <css src="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" src_type="url" />
</head>
</page>

and no matter how I do it, it will not load and work.
How can I inherit from luma and add some css/js to customize it?
note
I have tried copying the entire luma theme from:
vendor > magento > theme-frontend-luma
and then changing the name and such in composer.json, registration.php, and theme.xml - theme sort of loads, (doesn't look quite right) - and STILL won't load any custom CSS/JS from the default_head_blocks.xml
any thoughts? I'd really like to use luma as a base.
Thanks!


texts: Maintain same product for two stores in magento

texts:
I'm trying to save product to magento from frontend programmatically. Here, I have two stores, one for german language and another one for english language. But I need to maintain the same product for both.

$product = Mage::getModel('catalog/product');
foreach($variables as $key => $value){ //where key contains attribute code and value as values
   $product->setData($key, $value);
}
$product->setStoreId(0);
$product->save();

With help of above code, the product which I tried to save gets saved perfectly for "all stores view". But some fields values are not updated for the english and german stores because of the use default value uncheck. Can anyone guide how to do?

Please note I'm using multiple stores only for language translation.


texts: getting error: Class Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory does not exist

texts:
When i run command for indexing

  php bin/magento indexer:info

Error was thrown

  Class Magento\Indexer\Model\ResourceModel\Indexer\State\CollectionFactory does not exist

  [Magento\Framework\Exception\LocalizedException]   Can't create
  directory /var/www/html/var/generation/Magento/Indexer/Model/R
  esourceModel/Indexer/State/.

I'm using magento 2.0.4, Linux server


texts: Ajax is not working going to 404 in Magento 2.4.2 Admin

texts:
I am creating module for frontend and backend and want to run ajax with in the modules.
My ajax is perfectly working on frontend but it doesn't work on admin side.
My Ajax URL is http://127.0.0.1/mag/createmenubackend/create/ajax/?isAjax=true which goes to 404.
The result but AJAX goes to 404 Not Found. What's the issue i didn't get this.Any Help is appreciated.


texts:
I am new to Magento. I was able to retrieve products from our UniVerse db using php COM extension in an upgrade script.

But what I really need to achieve is to implement a system that would sync data between Magento2 website and UniVerse db. If a product's price, let's say, is updated in UniVerse, then this price would be updated in Magento too. And of course if a client orders products from Magento, our UniVerse db should be informed.

I could not find any pre-built connector for this so I think I have to create a custom script for this. I am a bit lost so I would really appreciate if someone would give me advice as to which path to follow.

Should I create webservices for this? (but, webservices rely on http protocol, which is not the case of Uniobjects, am I right?)
Should I create cron jobs for updates in Magento with data from UniVerse ?

Thanks a lot for your help and insights.


texts: Magento2: How to create custom table in database?

texts:
I have created the basic model. But the custom table does not add in the database.

My Magento V2.0


texts: How to show all categories and their subcategories on Layered Navigation?

texts:
I am using Mageplaza Layered Navigation module to show categories and their subcategories but its only showing subcategories.

I want to show all categories and their subcategories like below format -

Category 1

-Subcategory 1-1

-Subcategory 1-2

-Subcategory 1-3

Category 2

-Subcategory 2-1

-Subcategory 2-1

-Subcategory 2-3

But its only showing subcategories if I select Category 1

-Subcategory 1-1

-Subcategory 1-2

-Subcategory 1-3

Below is the code which returns me only subcategories

  app/code/Mageplaza/LayeredNavigation/Model/Layer/Filter/Category.php

protected function _getItemsData()
    {
        if (!$this->_moduleHelper->isEnabled()) {
            return parent::_getItemsData();
        }

        /** @var \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection $productCollection */
        $productCollection = $this->getLayer()->getProductCollection();

        if ($this->_isFilter) {
            $productCollection = $productCollection->getCollectionClone()
                ->removeAttributeSearch('category_ids');
        }

        $optionsFacetedData = $productCollection->getFacetedData('category');
        $category           = $this->dataProvider->getCategory();

        $categories         = $category->getChildrenCategories();

        $collectionSize = $productCollection->getSize();

        if ($category->getIsActive()) {
            foreach ($categories as $category) {
               $count = isset($optionsFacetedData[$category->getId()]) ? $optionsFacetedData[$category->getId()]['count'] : 0;
                if ($category->getIsActive()
                    && $this->_moduleHelper->getFilterModel()->isOptionReducesResults($this, $count, $collectionSize)
                ) {
                    $this->itemDataBuilder->addItemData(
                        $this->escaper->escapeHtml($category->getName()),
                        $category->getId(),
                        $count
                    );
                }
            }
        }

        return $this->itemDataBuilder->build();
    }

Can anyone please help me to show all categories and their subcategories on layered navigation?

Thanks.


texts: Having a Error approval column not found in the System.log

texts:
I having this below error on the system.log continuously.

  main.CRITICAL: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'approval' in 'where clause', query was: SELECT ROUND((e.min_price) * 1, 2) AS min_price_expr FROM catalog_product_index_price AS e
   INNER JOIN catalog_category_product_index_store2 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=2 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='1961'
   INNER JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1
   INNER JOIN search_tmp_5cd177f4280396_75007589 AS search_result ON e.entity_id = search_result.entity_id WHERE (stock_status_index.stock_status = 1) AND (approval IN (2, 4)) AND (vendor_id NOT IN(142,147,148,149,150,151,152,154,157,159,161,162,163)) AND ( e.website_id = '1' ) AND ( e.customer_group_id = 0) AND (e.min_price IS NOT NULL) ORDER BY e.min_price ASC
   LIMIT 10000000000 [] []

I don't have any idea with this error. anyone can help me to clear this error is highly Appreciated.


texts: Add a new dropdown attribute to product and display on product and check out pages

texts:
I want to add a new product attribute like sku or color option . The attribute is drop down. This i can do through admin side with out issues.
But how can i display the value of the attribute in product , cart and checkout page ? I am seeing many answers and most of them are related to extension . I don't want to create new extension for that .
I want to display the attribute value after price in the product page. Please help.


texts: If custom module not active it not render default magento block - Magento 2

texts:
I have module overwrite Magento/Theme/Block/Html/Topmenu.

i want check if My module is active render myBlock and customTopmenu.phtml else render default.

This code in myBlock file.

namespace Custom\Module\Block\Html;

 use \Magento\Framework\View\Element\Template;
 use \Magento\Framework\DataObject\IdentityInterface;
 use Magento\Store\Model\ScopeInterface;

 class Topmenu  extends Template
 {
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        ...
        array $data =[]
    ){
        ...
        parent::__construct($context, $data);
    }

    protected function _toHtml()
    {
        $this->setModuleName('Magento_Theme');
        // check Custom_Module is acitve
        if($this->getActive()){
            $this->setTemplate('Custom_Module::html/topmenu.phtml');
        }
        return parent::_toHtml();
    }
 }

Added
this is content di.xml file

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference  for="Magento\Theme\Block\Html\Topmenu" type="Custom\Module\Block\Html\Topmenu" />
    <type name="Custom\Module\Block\Html\Topmenu">
        <arguments>
            <argument name="name" xsi:type="string">custom-top-menu</argument>
        </arguments>
    </type>
</config>

  Now i get issue when Custom_Module not active it not render default.

Any help or any suggestion diff for my question is appreciated.

i checked. When My Module not checked
template is vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml and Block is Custom\Module\Block\Html\Topmenu. How to change Block to Magento\Theme\Block\Html\Topmenu?


texts:
Is there a non programatic way to convert an existing cart/quote into an order in a stock Magento CE system?  Stock Magento EE system?

If not, how are merchants handling the (seemingly common) problem of a customer service agent helping a customer complete an order over the phone or via chat support?  Does an extension exist the enable this sort of backend workflow?  Or is everyone programming their own?

Again, not looking for the code that would do this — I have that part covered.  I'm wondering if this feature is supported in Magento, and if not, how the community is handling this common feature request.


texts:
I have try to use register to save value and call it in some place of UiComponent such as ButtonProvider or Field OptionSource but seem it doesn't work. Is that a right way to do it or i am doing wrong

In controller i save variable to register

$this->_coreRegistry->register('someVal',data);

In another place i get data by registry

$this->_coreRegistry->registry('someVal');


texts: How add configurable product for selected options magento 2 programatically?

texts:
I want to add configurable product pragmatically.
If product is ABC it has 3 size options XS M L so I want to add all options same time only changeable thing is quantity. I tried but it added as first selected option 3 times, need help.
thanks.


texts: How to remove credit card number from order confirmation email?

texts:
I use magento 1.8.1.0.
How can I remove

Credit Card Number:
**** **** **** 1234

this part from order confirmation email?


texts:
I am trying to install this and and am getting this error - could you please let me know what the problem is.

Error in file: "C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Sales\sql\sales_setup\upgrade-1.6.0.8-1.6.0.9.php" - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.sales_flat_quote' doesn't exist, query was: DESCRIBE `sales_flat_quote`

Trace:

#0 C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Core\Model\Resource\Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')
#1 C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Core\Model\Resource\Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.6.0.8', '1.6.0.9')
#2 C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Core\Model\Resource\Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.6.0.8', '1.6.0.9')
#3 C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Core\Model\Resource\Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Core\Model\App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 C:\Program Files (x86)\Ampps\www\magento1\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Model_App->_initModules()
#6 C:\Program Files (x86)\Ampps\www\magento1\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#7 C:\Program Files (x86)\Ampps\www\magento1\index.php(83): Mage::run('', 'store')
#8 {main}


texts: How to get data from custom table without using object manager

texts:
I want to insert data in custom table "outofstockproductnotification". But before insert data, I want to check if some data like email id and product id is already exist or not in my custom table. I saved it by using this code.

filepath : app/code/Chirag/Stockproduct/view/frontend/templates/form.phtml

/**
 * Product view template
 *
 * @var $block \Magento\Catalog\Block\Product\View
 */
?>
<?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?>
<?php $_product = $block->getProduct(); ?>

<?php  if (!$_product->isAvailable()): ?>

            Subscribe to back in stock notification

        <form method="post" name="emailnotification" id="emailnotification" action="<?php echo $this->getUrl('stockproduct/index/save'); ?>" >

                <input name="guest_email" class="input-text amxnotif-guest-email" id="amxnotif-guest-email-1183" size="50" type="email" data-validate="{required:true, 'validate-email':true}" placeholder="Insert your email">
                <input type="hidden" name="product_id" value="<?php echo $_product->getId(); ?>">
                <input type="hidden" name="createddate" value="<?php echo $date = date('Y-m-d H:i:s'); ?>">
                <button type="submit" class="action submit primary">
                    Submit
                </button>

        </form>

<?php endif; ?>

file path : app/code/Chirag/Stockproduct/Controller/Index/save.php

namespace Chirag\Stockproduct\Controller\Index;

use Magento\Framework\App\Action\Context;
use Chirag\Stockproduct\Model\TestFactory;
class Save extends \Magento\Framework\App\Action\Action
{
    /**
     * @var Stockproduct
     */
    protected $_test;

    public function __construct(
        Context $context,
        TestFactory $test
    ) {
        $this->_test = $test;
        parent::__construct($context);
    }
    public function execute()
    {
        $email = $this->getRequest()->getParam('guest_email');
    $product = $this->getRequest()->getParam('product_id');
    $createddate = $this->getRequest()->getParam('createddate');
    //check weather user already register for same product.
    //if not exist data than submit data
    $test = $this->_test->create();
    $test->setEmailid($email);
    $test->setProductid($product);
    $test->setCreatedAt($createddate);
    if($test->save()){
        $this->messageManager->addSuccessMessage(__('We will notify you when product is in stock!'));
    }else{
        $this->messageManager->addErrorMessage(__('Error!! Data was not saved.'));
    }
    $resultRedirect = $this->resultRedirectFactory->create();
    $resultRedirect->setPath($_SERVER['HTTP_REFERER']);
    return $resultRedirect;
    //if data exist than display approprate message
    //$this->messageManager->addErrorMessage(__('You already registerd for this product.'));
    }
}

In save.php, I want to check if there is emailid and productid is already exist or not in custom table "outofstockproductnotification". Here i put code of two files only. I think you can understand from these. Any help will be appreciate. Thanks.


texts: cart not empty after order place success magento 1.9.3

texts:
i have faced an issue. i have placed order but cart not empty after order success.

i have used $session->clear(); but no luck. anyone have idea to solve this. my successAction code is bellow.

public function successAction()
    {
        $notallowed = $this->getRequest()->getParam('na', false);
        if ($notallowed) {
            $this->_redirect('checkout/onepage');
            return;
        }
        $session = $this->getOnestepcheckout()->getCheckout();
        if (!$session->getLastSuccessQuoteId()) {
            $this->_redirect('checkout/cart');
            return;
        }
        $lastQuoteId           = $session->getLastQuoteId();
        $lastOrderId           = $session->getLastOrderId();
        $lastRecurringProfiles = $session->getLastRecurringProfileIds();
        if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
            $this->_redirect('checkout/cart');
            return;
        }
        $session->clear();
        $this->loadLayout();
        $this->_initLayoutMessages('checkout/session');
        Mage::dispatchEvent('checkout_onepage_controller_success_action', array(
            'order_ids' => array(
                $lastOrderId
            )
        ));
        $this->renderLayout();
    }


texts: How to get salable qty in magento 2.3.3?

texts:
How to get salable qty of each Product and display in Product view page.

Can someone help me?

Thanks in advance.


texts: Magento 2: configurable product doesn't update image on select of attribute

texts:
I know this is probably a duplicated, but I read ALL the posts about this issue and I still didn't figure it out.

So, I have attribute size (dropdown) and attribute color (swatches). What I want is to change the picture based on the selection of the attributes.

The result is that Magento loads me the default picture.

I cleared the cache and I did a re-index, but the problem still persists.

Any suggestions?

Here is the screenshot

https://i.stack.imgur.com/wnAPt.jpg

Here is the configuration I have on the back-end

https://i.stack.imgur.com/154Mc.jpg

https://i.stack.imgur.com/YVTyW.jpg

Here is the error that I got:

TypeError: this.options.jsonConfig.mappedAttributes is undefined swatch-renderer.js:772:29
    _getAttributeCodeById https://webiste.com/pub/static/version1576523586/frontend/Mgs/amely/en_US/Magento_Swatches/js/swatch-renderer.js:772
    $.widget/</proxiedPrototype[prop]</< jQuery
    _OnClick https://webiste.com/pub/static/version1576523586/frontend/Mgs/amely/en_US/Magento_Swatches/js/swatch-renderer.js:738
    $.widget/</proxiedPrototype[prop]</< jQuery
    _EventListener https://webiste.com/pub/static/version1576523586/frontend/Mgs/amely/en_US/Magento_Swatches/js/swatch-renderer.js:640
    jQuery 2

PS, I'm using Magento 2.3.3

Thanks in advance!


texts: How can i use owl carousel slider in my custom theme

texts:
requirejs-config.js

var config = {
    paths: {
            'owlcarousel': "web/js/owl.carousel",
            'owlCarousel': 'js/owl.carousel.min'
        },
    shim: {
        'owlcarousel': {
            deps: ['jquery']
        }
    }
};

.phtml file

1

I try so many solutions but its not working.

Please Help.


texts:
I have multistore magento with multi domains.
I want to add store switcher in main menu in mobile view. But giving store1.com as href do not call customers session to get shared shopping cart between stores.
What should i add after href="http://domain1.com" in static block that i use in mobile menu?


texts: Magento 2 : Replace a custom JS component

texts:
We are working on a module that requires JS overwrite for file Magento_Checkout/js/model/shipping-save-processor/default.

We are able to overwrite the JS using the steps provided in the magento guide.
However this JS is already overwritten by AvaTax module.
So instead of overwriting the default Magento JS we are trying to overwrite the Avatax JS using the same steps.
We have added dependency in our module so that the Avatax module is loaded first.
But this JS overwrite is successful only, if we overwrite the default Magento JS.

We don't want to make changes directly in the Avatax JS.

Is there any other way out?

Code used for overwrite:

 var config = {
    "map": {
        "*": {
            "ClassyLlama_AvaTax/js/model/shipping-save-processor/default" : "XYZ_Checkout/js/shipping-save-processor/default"
        }
    }
};

Code used for dependency:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="XYZ_Checkout" setup_version="2.0.0">
    <sequence>
        <module name="ClassyLlama_AvaTax"/>
    </sequence>
</module>

We need to add extension attribute payload function as below:

                payload = {
                addressInformation: {
                    shipping_address: quote.shippingAddress(),
                    billing_address: quote.billingAddress(),
                    shipping_method_code: quote.shippingMethod().method_code,
                    shipping_carrier_code: quote.shippingMethod().carrier_code,
                    extension_attributes: {
                        po_number: jQuery('[name="additional_po_number"]').val(),
                        spec_del_comment: jQuery('[name="additional_spec_del_comment"]').val(),
                        spec_del_comment_2: jQuery('[name="additional_spec_del_comment_2"]').val(),
                    }
                }
            };


texts: Issue when setting mode from Developer to Production

texts:
My Magento 2 webshop (oplader.com) is having CSS/JS issues when setting the mode to production.

It gives the following error in the console:

The resource from “https://www.oplader.com/%3Clink%20href=%22https://fonts.goog…t.css%22%3E%3Cscript%20type=%22text/javascript%22%3Erequire([” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

Some additional information:

In developer mode, no issues are shown in the console log.
I have refreshed the cache, run setup, deployed static-content and recompiled di.
I have checked the presence of the .htaccess

It is also showing this in the HTML and on top of the page:

I have had it in production mode before with no issues. Does anyone know how to might occur?


texts: Magento addComplexSuccessMessage on admin module

texts:
I'm trying to use the addComplexSuccessMessage function on admin custom module, but I get an empty message.

The code I have is the following:

/etc/di.xml

    <type name="Magento\Framework\View\Element\Message\MessageConfigurationsPool">
        <arguments>
            <argument name="configurationsMap" xsi:type="array">
                <item name="createDocumentSuccessMessage" xsi:type="array">
                    <item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
                    <item name="data" xsi:type="array">
                        <item name="template" xsi:type="string">Invoicing_Moloni::messages/createDocumentSuccessMessage.phtml</item>
                    </item>
                </item>
            </argument>
        </arguments>
    </type>

view/adminhtml/templates/messages/createDocumentSuccessMessage.phtml

<?php
// @codingStandardsIgnoreFile
/** @var \Magento\Framework\View\Element\Template $block */
?>

<?= $block->escapeHtml(__(
    'Document was sucessefuly created: Open document.',
    $block->getData('document_url')),
    ['a']
);

Controller/Adminhtml/Documents/Create.php

$this->messageManager->addComplexSuccessMessage(
            'createDocumentSuccessMessage',
            [
                'document_url' => $this->_url->getUrl('document/url')
            ]
        );

I can't seem to understand why I get this empty message:

If anyone could help, I would really appreciate


texts: Use layered navigation attribute filter only in specific categories

texts:
Im am in the progress of making a gift finder. For that, I need to make some specific filterable attributes, that I would like to show in this category only (Gifts for men, Gifts for women, etc..)

What would be the best way to achieve this? Some check for category id in view.phtml or some hiding in catalog.xml and a custom xml-layout for the specific category to show it there?


texts: Data Migration Tool Removing Already Exist Values Of Magento2 Database

texts: I want know that data migration tool working with fresh database or with already exist values in Magento2.


texts: Magento search can't find products with the word 'and' in the title

texts:
A client of mine has a product named "C137-936 and T324-456"
When Searching for "C137-936 T324-456" this product show up in the results, but when explicitly searching for "C137-936 and T324-456" the product isn't present.

Why is Magento missing this, and how can this issue be fixed?


texts: Display attribute image but if file_exists returns always false

texts:
I can't get this working.

$filename = Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL) . "media/wysiwyg/Logos/$manufacturerName.png";
$filename = str_replace(" ", "_", $filename);
 if (file_exists($filename)) {

     echo "The file $filename exists";
 } else {
     echo "<img src='$filename' title='$manufacturerName' alt='$manufacturerName' style='float:right;margin:0px' />";
 }

I've tried many ways but it always returns false even thou it the image shows for the not existing echo.

What I'm I doing wrong? Safe mode is off, the files have permissions and the image actually show but in the false echo.

EDIT:

I'm doing it this way now with a new tag I learned about i.e. <object data=. I get a 404 error on using it but no php errors. It works good other than the 404s.

  <?php
        $_product = $this->getProduct();
        $manufacturerName = $_product->getAttributeText('manufacturer');
        $manufacturerId = $_product->getManufacturer();
        $filename = Mage::getBaseDir('media') . "/wysiwyg/Logos/$manufacturerName.png";
        if (empty($filename)) $filename = ''; ?>
    <?php if ($_product->getManufacturer()):?>
        <?php $manufacturerlogo = str_replace(" ", "_", $manufacturerName); ?>
        <?php if (file_exists(Mage::getBaseDir('media') . "/wysiwyg/Logos/$manufacturerlogo.png")): ?>
        <?php $size = getimagesize(Mage::getBaseDir('media') . "/wysiwyg/Logos/$manufacturerlogo.png");
        list($width, $height) = $size;
        $cleanfilename = str_replace(" ", "_", $filename);
        list($width, $height, $type, $attr) = getimagesize($cleanfilename);
        ?>
    <?php endif ?>
        <object data="<?php echo Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL); ?><?php echo 'media/wysiwyg/Logos/'; ?><?php echo $manufacturerlogo; ?><?php echo $this->__('.png"') ?> <?php echo "title='$manufacturerName' alt='$manufacturerName' style='float:right;margin:10px;width:{$width}px;height:{$height}px'"; ?>" type="image/png"></object>
    <?php endif ?>


texts: & when (@media-common = true) - Changes not picked up unless I do static-content-deploy

texts:
In the Magento 2 lib documentation it contains the following:

@media-common: true|false - sets whether to output common styles. For common styles every time you want to add some styles you should use

& when (@media-common = true) {
    your styles
}

Question

What determines when these blocks are processed?

While working in a module's less file e.g. _module.less, It seems to be ignored if I trust either grunt watch, or run grunt less manually, unless I first run bin/magento setup:static-content:deploy

Changing between  the production ( with or without the --skip-compilaiton flag) and developer deploy modes seems to make no difference.

This isn't ideal as setup:static-content:deploy is very slow and disrupts the workflow.


texts: How to create jQuery cookie in cart and show in checkout page on Magento 2?

texts:
I Try to set a Jquery cookie in the cart page with a custom product attibute, and i need to show this attribute on the checkout page.

But i can't find anything how to set and use a cookie.
The only thing i found it's: jquery cookie, but it's not helping me.
I try to use jquery.cookie.js library which is loading in the both page, cart and chekcout!

Can anyone help me with an answer?

Thank you!


texts: Magento CE 1.9.1 permission to access scss files denied (dev environment using MAMP)

texts:
I'be been trying to solve this for hours, to no avail :( I would like to inspect (in the browser) the RWD sass rules based on the generated map files, but access is denied to all files in the scss directory. Read/write privileges are OK and I've been tinkering with .htaccess rules as well, but so far no luck.

What else should I check?
Thanx in advance!


texts: Best way to start making Magento 2 themes

texts:
I have done the research about it and found many solutions I tried some of them and came up with results successfully.

In my study, I have found that Magento 2 comes with its built-in CSS library and its own grid also.

But, I am a very big fan of bootstrap, some of them suggested that as well,  and showed me the path how to take bootstrap into magento's luma theme.

So, my question here is what is the best practice, shall i invest my time in integrating bootstrap and making it from scratch with bootstrap. Or should i invest my time in learning magento's design framework?