texts: Recalculating a product's price (applying 'catalog price rules')

texts:
I have a module that directly changes a product's price in the database. I would like for the catalog price rules, the various discounts on our site, to get applied to the product's price after I update the base price.

Saving the item, either in admin area or with a ->save() call sets the prices, but it takes far too long to save all the items we need. I want to just recalculate the discount prices without doing anything else.

I've tried various 're-indexing' methods, but I don't know if this is the issue. Nothing I've done seems to affect the product's price. Below is a overview of the attempts I've made that haven't born fruit:

Mage::getResourceModel('catalog/product_indexer_price')->reindexProductIds($productId);

This runs without error but doesn't seem to actually update the discounted prices on the front end.

Mage::getSingleton('index/indexer')->processEntityAction(
        $product, 'catalog_product', Mage_Index_Model_Event::TYPE_SAVE
    );

Again, this will run without error, but it won't change the price. I've tried changing catalog_product to catalog_product_price and TYPE_SAVE to TYPE_REINDEX all without success.

Mage::getModel('catalog/product_indexer_price')->reindexAll();
$event = Mage::getSingleton('index/indexer')->logEvent(
    $product,
    $product->getResource()->getType(),
    Mage_Index_Model_Event::TYPE_SAVE,
    false
);
Mage::getSingleton('index/indexer')
    ->getProcessByCode('catalog_product_price')
    ->setMode(Mage_Index_Model_Process::MODE_REAL_TIME)
    ->processEvent($event);

Once again, no errors, but also no price updates.

To be clear, the base price will show up immediately. It is only the actual price that is calculated with all of the catalog price rules that isn't updating.

Caching is disabled on my development system.


texts: What's the last event dispatched before content is sent to the browser?

texts:
I need to set or update a cookie, but I want to ensure that all (or as much as possible) of the request processing occurs before my cookie generation code runs.  i.e. if the user logs in, I want to ensure that the login processing has occurred before my code runs, or if the user adds something to their cart I want to know that all cart processing is done first.

Are there any events that are dispatched immediately before a response is sent to the browser?


texts: Quick Simple Product Creation stuck on Please wait... screen

texts:
When I have a configurable product, I can't associate products through the Quick simple product creation menu because the screen gets stuck on the loading Please wait... screen.. It doesn't matter how long I wait, the simple product will not be created.
I thought at first it was maybe a javascript thing, so I removed all the js from the server and uploaded the js from a fresh install (1.7.0.2 version) but still the problem persists.
When I create a simple product normally I can assign it fine, but it would be quicker and less error-prone if we could add simple products through the quick simple product creation menu.

Anyone have any idea what might be wrong?


texts: Echo product attribute, only if it has value

texts:
I have this to display the attribute on my product page:

<?php echo "Bottle size: ", $_product->getAttributeText('bottle_size'); ?>

However, not all of my products will have this attribute so I don't want it to display anything if the "bottle_size" attribute has no value in it.

How can I achieve this?

UPDATE:::::

Tried this but that still doesn't work:

<?php
$attribute_value = $product->getResource()->getAttribute("bottle_size")->getFrontend()->getValue($product);
if ($attribute_value) {
echo $attribute_value
}
?>


texts: How to override _registerJsPrice($price) function in Configurable.php Block in Magento2?

texts:
I am trying to override __registerJsPrice($price) function in configurable.php

This function is work when we change swatch.

Path of configurable.php is /opt/lampp/htdocs/magento/vendor/magento/module-configurable-product/Block/Product/View/Type

This is Protected function. so I overrided using preference method

Step 1:- create di.xml file in Folder app/code/Webkul/Hello/etc/

<?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\ConfigurableProduct\Block\Product\View\Type\Configurable" type="Webkul\Hello\Block\Rewrite\Product\Configurable" />
</config>

Step 2:-create Configurable.php Block file in Folder /magento/app/code/Webkul/Hello/Block/Rewrite/Product

<?php

    namespace Webkul\Hello\Block\Rewrite\Product;

    class Configurable extends \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable
    {
        protected function _registerJsPrice($price)
        {
            return str_replace(',', '.', $price + 11);
        }
    }

I Change return str_replace(',', '.', $price); to return str_replace(',', '.', $price + 11); it mean when i change swatch the price increase by +11 rupees.

I changed this in the core file and the changes were shown but when I override at that time no any charges shown.


texts:
I'm developing my first Magento extension for which I have overwritten a few default templates and created some new ones. At the moment, they reside in frondend/default/default and adminhtml/default/default in the app/design folder. According to the current Magento documentation, using the default package and theme is a bad practice because they are overwritten during upgrades (similar to base/default).

From what I gather, I should create a new package for my custom templates. This raises a big question though.

Suppose I put my own template files in frontend/mypackage/default, how can I configure Magento to display them? I know you can change the design package in the admin panel, but if the store owner already uses a custom package and theme, then there's a conflict. Is there any way to solve this issue?


texts: What being Magento developer mean in practice?

texts:
Am I correct that new magento developer spends firsts months mainly for understanding Magento structure (all pieces of puzzle) than programming custom classes?

and

being good Magento developer is more about how you move around this complicated architecture and how well you insert these pieces in correct places than just writing custom classes (algoritms) like in "usually PHP projects" written in Symfony framework f.e.?

(I know this not place for this kind of questions, but other magento comunities are death. I will remove this question tomorrow if no reply)


texts: Fatal Error when attempting to approve/view reviews in backend

texts:
This Fatal Error began occurring recently while attempting to approve/view reviews in the back end of our site, so we are unable to approve comments our customers have left. We are running Magento 1.7.0.2

I've hunted around the net but have not been able to find a solution.

Fatal error: Class 'Varien_Data_Form_Abstract' not found in /home/aloelife/public_html/lib/Varien/Data/Form.php on line 35


texts: I am the support developer for a project on Magento 1.3.1. There is a problem I can't reproduce. Some customers wrote that they receive emails of orders of other persons. In admin I saw that person X made an order (practically at the time as another) and it got assigned to another person. How is this possible. I spent a day without success :(


texts: How to change multiple page/blocks Store View?

texts:
I created a new Store View in my Magento 1.9.1.0 and now I need to set some of my pages and blocks to "All Store Views".

When I go to CMS > Page or CMS > Static Blocks I am able to open one item (page or block) and change the Store View inside it. Do I need to do it manually for each page/block or is there an easy way to do that? (Like multiple select changes)

Thanks!


texts: I have deleted PHP and re-install it now below error coming /Can't find ini.php file

texts:
Fatal error: Uncaught Error: Class 'DOMDocument' not found in /var/www/html/magento211/vendor/magento/framework/Config/Dom.php:384
Stack trace:

0 /var/www/html/magento211/vendor/magento/framework/Config/Dom.php(115): Magento\Framework\Config\Dom->_initDom('

1 /var/www/html/magento211/vendor/magento/framework/ObjectManager/Config/Reader/Dom.php(70): Magento\Framework\Config\Dom->__construct('

2 /var/www/html/magento211/vendor/magento/framework/Config/Reader/Filesystem.php(149): Magento\Framework\ObjectManager\Config\Reader\Dom->_createConfigMerger('Magento\Framewo...', '

3 /var/www/html/magento211/vendor/magento/framework/Config/Reader/Filesystem.php(130): Magento\Framework\Config\Reader\Filesystem->_readFiles(Object(Magento\Framework\Config\FileIterator))

4 /var/www/html/magento211/vendor/magento/framework/App/ObjectManagerFactory.php(275): Magento\Framework\Config\Reader\File in /var/www/html/magento211/vendor/magento/framework/Config/Dom.php on line 384

1: https://i.stack.imgur.com/Cu7H7.png (I can find php/7.1/apache2/php.ini file or php/7.1/cli/php.ini file for any version of php
(2) also when I run sudo apt-get install php7.1-xml in the end below error coming


texts: Magento 2 : Remove Address Book from customer Dashboard

texts:
i want to remove Address Book Block from customer dashboard

i did tried below code but it seems not working


texts: Magento 2, How can I change the PDF Invoice Columns sort Order?

texts: How I Can Change PDF Invoice Columns Order? I want the qty column should be the first column. see the image below


texts: Magento 2: Issue when creating Magento Plugin for overriding GetSelectionTitlePrice method

texts:
I 've created the following plugin to override a method located at
vendor/magento/module-bundle/Block/Catalog/Product/View/Type/Bundle/Option.php
but it still does not seem to sort the desired effect. Any ideas on how this could work as desired?

  app/code/MySpace/MyModule/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option">
        <plugin name="bundle-product-option-radio" type="MySpace\MyModule\Plugin\RadioPlugin" />
    </type>
</config>

  app/code/MySpace/MyModule/Plugin/RadioPlugin.php

<?php

namespace MySpace\MyModule\Plugin;

class RadioPlugin
{

     public function aroundGetSelectionQtyTitlePrice(
        \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option $subject,
        \Closure $proceed,
        $selection,
        $includeContainer = true)
    {
        $this->setFormatProduct($selection);
        $priceTitle = ''
            . $this->escapeHtml($selection->getName())
            . '';
        return $priceTitle;
    }
}

The method to override is located at vendor/magento/module-bundle/Block/Catalog/Product/View/Type/Bundle/Option.php:

/**
 * Get bundle option price title.
 *
 * @param \Magento\Catalog\Model\Product $selection
 * @param bool $includeContainer
 * @return string
 */
public function getSelectionQtyTitlePrice($selection, $includeContainer = true)
{
    $this->setFormatProduct($selection);
    $priceTitle = ''
        . $selection->getSelectionQty() * 1
        . ' x '
        . $this->escapeHtml($selection->getName())
        . '';

    $priceTitle .= ' &nbsp; ' . ($includeContainer ? '' : '') .
        '+' .
        $this->renderPriceString($selection, $includeContainer) . ($includeContainer ? '' : '');

    return $priceTitle;
}


texts:
I have created a custom REST API that return all review of products based on store id.

http://hostname/magento/index.php/rest/V1/showreview/allreviews/1

it returns output like-

[{"review_id":"345","created_at":"2018-08-16 08:03:19","entity_id":"1","entity_pk_value":"1705","status_id":"1","detail_id":"345","title":"Huge arm holes??","detail":"I don't know why the arm holes are so big. It looked ok in the photo but in person they're really wide. It's really comfortable but that bugs me.","nickname":"Valorie","customer_id":null},{...}..]

Now my question is how to implement search criteria on custom rest api.?
actually i previously applied search criteria on predefined rest api but don't know how to implement on custom api.

Any help appreciated.


texts: With which I can change the method load() if it is deprecated?

texts:
public function getShipAddress($customerId){
    $customer = $this->_customerFactory->create()->load($customerId);    //insert customer id

    //shipping
    $shippingAddressId = $customer->getDefaultShipping();
    $shippingAddress = $this->_addressFactory->create()->load($shippingAddressId);

    return $shippingAddress;
}


texts: Configurable Swatches Thumbnails not showing

texts:
I am using configurable swatches for a product. I want to configure just like the given link.

Click to see the product

But in my case the thumbnails are not showing. Every associated product have single image. and i have also upload images to the main configurable product. the thumbnails are showing, but when i give label name to images, then thumbnails are not showing..
I want the thumbnails, and when click on thumbnail, it change the color in drop down..
Any Idea.?


texts: Maximum Qty Allowed in Cart for the ENTIRE CART

texts: How can I limit the maximum number of items allowed for the ENTIRE CART regardless if the items were from the same product or from different products?


texts: Magento 2 - Adding calendar to custom frontend form

texts:
I'm trying to add the calendar in magento2 to custom front-end form. jquery-ui.js and jquery-ui-timepicker-addon.js are also added in header & this is the code that I think should work to call the calendar.

    <input type="text" class="input-text hasDatepicker" title="From" value="" id="page_from_date" name="from_date">
   <button type="button" class="ui-datepicker-trigger v-middle">Select Date</button>

I didn't found any js code like Calendar.setup({ ... }); etc in Magento 1 that may be necessary to call the calendar


texts: Any ideas on how to remove a knockout template from M2 (at the checkout)?

texts:
The template in question is

  vendor/magento/module-sales-rule/view/frontend/web/template/payment/discount.html

and it shows at the checkout

The rule that places the template in

  vendor/magento/module-sales-rule/view/frontend/layout/checkout_index_index.xml

is

<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>


texts: Webpage is not available in Magento installation

texts: I'm trying install Magento in my localhost, but I'm getting the message "This webpage is not available". I've installed WAMP and it works fine. Then, I extracted magento to "www" folder of WAMP. I'm using Windows 8.1, Wamp 2.2 and Magento 1.8.1.


texts: How to solve Error in file including in magento?

texts:
I want to include a file to my custom module observer.

I added my file folder to lib folder.

In my observer i called like below

require_once 'MailchimpAPI/MCAPI.class.php';//this is workig fine

//I want to call another file

require_once 'Mailerlite/vendor/autoload.php';//this is not working

both folders are in same path

\lib\MailchimpAPI

\lib\Mailerlite

Can any one tell me what is wrong here.I want to implement Mailerlite to my magento registration.


texts: Demo Store Notice Cannot be Disabled in Magento 2 Admin Panel

texts:
I tried to turn off the demo store notice through the Admin panel system configuration, Unfortunately I encountered this error that says Something went wrong while saving this configuration: Area is already set.

Any help would be greatly appreciated.

Error Image:


texts: Multiple Items but want one SKU for all Item which fall under same category

texts:
I am newbie to Magento. I have multiple items (say it1,it2,it3 ... ) from same item category (say itcat1 ) in my store.

How can I set same stock for all items or some item from same category?

One solution I have for CakePHP is set one item as "stock count item" (say stockit1 ) do not display it to site. maintain its id in other items as "stock item id". When originally user buy it1's 1 quantity it will decremented from stockit1.

Is the same can work in Magento?
If yes then brief me how else explain any other way?


texts: onepage checkout payment method automatically changed and coming by default saved cc?

texts: Anyone can help me my onepage checkout payment method automatically change, and coming saved cc but it is disabled at backend and rightnow current method is payumoney. Please help me out this problem.


texts: Imported Products Not In Catalog --> Manage Products

texts:
I have imported about 150 products.  None of them show up in the backend under "Catalog --> Manage Products"  However I can see the products related to the categories under "Catalog --> Manage Categories".

Does anyone have any ideas why this may be happening?


texts: Facing the following error in my 'magento localhost'. Tried creating a 'tmp' folder in the 'root directory' but is not working. Maybe I'm creating it in the wrong directory? Thanks


texts: Magento 2: get store url without store code [SOLVED]

texts:
How to get Configuration->Web->Base URLs -> Base URL in multi store magento 2. I have enabled Add Store Code to Urls

I have use on phtml page but it return me url with store code and I need only base url without store code:

<?php echo $block->getBaseUrl();?>

Output of above code is www.example.com/de and my requirement is www.example.com

This is magento1 code.

Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_UNSECURE_URL);

I need it in magento 2.


texts:
In System > Cache Management all types are disabled. Each morning when I log into Magento (sometimes the previous evening also) all cache types will have been re-enabled.

This is very strange. I have crawled through each installed extension and disabled yet each day Magento cache is re-enabling itself.

Is there some buried cache Magento feature that I do not know about?


texts: hasData() methods no longer available in email templates?

texts:
I'm running Magento EE 1.14.2.1 (CE 1.9.2.1) and have noticed what appears to be a regression in functionality with added parameters in email templates.

Assuming I have a sales/order class rewrite which adds a template parameter to the $mailer like so:

// ...
if ($this->hasSomeData()) {
    $templateParams['some_data'] = 'Hello World';
}
$mailer->setTemplateParams($templateParams);
// ...

Then I access it in an email template like so:

{{depend order.hasSomeData())}}
Some data: {{var some_data}}
{{/depend}}

Prior to upgrading to Magento CE 1.9.2.1 or EE 1.14.2.1 this line was correctly rending "Some data: Hello World" in the email template, but after the upgrade the depend condition is not truthy, so nothing is rendered.

If I change it to this, it works fine:

{{depend some_data}}
Some data: {{var some_data}}
{{/depend}}

My question is: is this some functionality that has been lost or broken in the upgrade to 1.9.2.1/1.14.2.1 from previous versions, deprecated and removed or just wrong to start with?


texts:
I want to override the file in magento/module-offline-payments/view/frontend/templates/info/purchaseorder.phtml.
I copied this file to app/design/frontend/[vendor]/[theme]/Magento_OfflinePayments/templates/info/purchaseorder.phtml.
But it still outputs the original file. Any suggestion?
To be complete: it's about the email of an new order where this template is used


texts:
I've copied over the contents of the old file structure to the new one. I.E;

  www/SHOP1 to www/newstore/SHOP2

Copied the current database to a new database and edited core_config_data to point to the new URL. Then I deleted everything in /var/cache and /var/session.

When I view the new URL it loads for a second then links to the old URL still. The new URL is on the same server (same FTP details, folder is located inside main DIR where the old store is)

Anything else I have to edit?


texts: How to fix: “HEADER ALREADY SENT” and GD2?

texts:
This is a follow on to the question on How to debug: HEADER ALREADY SENT and GD2. Specifically how to fix the following errors (note first line had been added using previous debug advice to track the source):

   2014-02-04T14:26:06+00:00 DEBUG (7): Cannot send headers; headers already sent in /home/.../lib/Varien/Image/Adapter/Gd2.php, line 133
   2014-02-05T16:14:32+00:00 DEBUG (7): HEADERS ALREADY SENT: < pre >
    [0] /home/.../app/code/core/Mage/Core/Controller/Response/Http.php:52
    [1] /home/.../lib/Zend/Controller/Response/Abstract.php:766
    [2] /home/.../app/code/core/Mage/Core/Controller/Response/Http.php:83
    [3] /home/.../app/code/core/Mage/Core/Controller/Varien/Front.php:188
    [4] /home/.../app/code/core/Mage/Core/Model/App.php:354
    [5] /home/.../app/Mage.php:683
    [6] /home/.../public_html/index.php:87
    </ pre >

That question was about how to debug this issue. This question is on how to fix it. As per my "answer" on that question, and having done some further tests on a vanilla Magento install, I can confirm that this does appear to be a Magento core bug (v1.7.0.2).

Simply managing images on pages or static blocks, using the standard Magento page/block image manager causes these logs. To reproduce, open a page that has images on it. There will be one of these logged per image on the page. Open the image manager and view uploaded images - there will be another for each image displayed.

The problem seems to be with this function, which on my reading will most certainly cause this error any time a CMS image is fetched for display in the dashboard.

public function display()
    {
        header("Content-type: ".$this->getMimeType());
        call_user_func($this->_getCallback('output'), $this->_imageHandler);
    }

While it doesn't appear to have any impact on the store, I'd rather not treat this as a "benign error" (as Microsoft like to call things they can't get right/fix!). I guess we could just modify canSendHeader() in lib/Zend/Controller/Response/Abstract.php to not throw an error if $file is gd2.php, but that's just a nasty kludge!

What it looks like is at some point before canSendHeaders is called as part of displaying CMS images in the dashboard, either $throw or $this->headersSentThrowsException should be set false so this doesn't generate an exception.

Any ideas? Or this is this something Magento owners have learnt to live with!?


texts: Magento 2 "Whoops, our bad" on every product page

texts:
The products are shown in category view. But, once clicked, the product page is not shown, but instead, a 404 Whoops, our bad… message is displayed.

I tried clearing the cache and was not able not find the re-index option that is mentioned in other questions.

The system.log and exception.log shows nothing when the error occurs.

Any idea why is it broken and how to fix it?


texts: Automatically update cache when updating product

texts:
When I update a product the cache becomes invalid. Is it possible to make Magento auto update the cache when saving a product?

I tried searching and the results I got seemed to either be for pre-1.8 Magento or missed som details on how to implement it:

https://stackoverflow.com/questions/10988132/why-does-magento-invalidation-of-full-page-caching-on-product-save-actually-make
http://inchoo.net/magento/magento-debugging/magento-how-to-fix-one-or-more-of-the-cache-types-are-invalidated-blocks-html-output-click-here-to-go-to-cache-management-and-refresh-cache-types/


texts:
Bonjour, je souhaite ajouter le champ total remboursé qui est visible dans une commande client.
Pourriez-vous m'aider ? Je suis sous Magento 1.9

 $this->addColumn('total_refunded', array(
        'header' => Mage::helper('sales')->__('Total remboursé'),
        'index' => 'total_refunded',
        'width' => '25px',
        'align' => 'center',
    ));

    protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel($this->_getCollectionClass());
  $collection->getSelect()->join('sales_flat_order_address',
            'main_table.entity_id = sales_flat_order_address.parent_id',
        array('telephone','city','postcode','country_id'))
        ->where("sales_flat_order_address.address_type =  'billing'");
        $this->setCollection($collection);
        return parent::_prepareCollection();


texts: How to run my custom code when FPC & Fastly CDN is enabled?

texts:
When there is url param in any magento url (no matter it is a category/product/cms page url), e.g. http://www.example.com/about-us?myparam=123456, i need to save it to database.
However after enabled Fastly FPC module in Magento2, the request is cached and cannot goes to my server.
I have tried to add observer / plugin and seems all cannot be run because of Fastly cache.
What is the best practice to do it?


texts: Magento 2 setup:staitic-content:deploy doesn't update css

texts:
I'm running Magento 2 in production mode.

I made some changes in my theme's css files.

I try to make the css change reflecting on the live site, by using following command.

php bin/magento setup:static-content:deploy en_AU en_US

I can't see the css files are updated in pub/static folder.

I have flushed cache php bin/magento cache:flush before and after static-content deploy.

Did i miss any steps?

Update,

By removing everything from the pub/static/frontend folder, then deploy static-content will make css changes reflecting on the site. But this will break site for a few moment. There's no way to implement css / js changes in a product mode without breaking the site?


texts:
Where are the Magento Luma theme files located?

Been looking around for them for the past hour and just can't find them. Although the theme is being applied to my store locally, I'm not seeing where the theme files are located at, at all. Can't find any css/scss/less files, js, etc etc. in regards to this theme.

What I'd like to do is copy Luma to my custom theme, then customize it from there. Better to start from something, rather than nothing, is how I see it.

If I enable my custom theme right now, it looks like this: https://i.imgur.com/MyQviW4.png

My theme.xml is:

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>pilot-shop</title>
    <parent>Magento/Luma</parent>
    <media>
        <preview_image>media/theme-image.jpg</preview_image>
    </media>
</theme>

My registration.php file is:

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/Sportys/pilot-shop',
    __DIR__
);

Thank you.


texts: How to add export functionality in Magento 2 new grid system

texts:
In Magento 1 I could add export functionality to any admin grid I create by adding this

$this->addExportType('*/*/exportCsv', Mage::helper('helper_alias')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('helper_alias')->__('Excel XML'));

in the _prepareColumns of the grid block and then implementing the expotCsvAction and exportXmlAction in my admin controller.

How can I achieve the same result in Magento 2 in the new grid system? (the one that uses ui components and knockout js for rendering). Example, the products grid, the cms pages grid.
Or better yet, is this even possible?


texts: Magento Community form key from external site url

texts:
I have an requirement to allow products to add to the cart from an external link, like in an email campaign. I've created an observer to allow a form key to be added to the url if it doesn't exist, however it only adds if the session already exists (if I visit the site then use the URL it works) otherwise I get a cms no cookies url. Am I using the correct event to hook into for pre-cart but post-session start?

The URL I'm tyring to get working is:

  /checkout/cart/add?product=1&qty=1

config.ml:

<?xml version="1.0"?>
<config>
<modules>
    <Vendor_GenerateFormKey>
        <version>1.0.0</version>
    </Vendor_GenerateFormKey>
</modules>
<frontend>
    <events>
        <controller_action_predispatch_checkout_cart_add>
            <observers>
                <Vendor_GenerateFormKey_Model_Observer>
                    <type>singleton</type>
                    <class>Vendor_GenerateFormKey_Model_Observer</class>
                    <method>GenerateFormKey</method>
                </Vendor_GenerateFormKey_Model_Observer>
            </observers>
        </controller_action_predispatch_checkout_cart_add>
    </events>
</frontend>
</config>

Observer.php

<?php

class Vendor_GenerateFormKey_Model_Observer
{
//Put any event as per your requirement
public function GenerateFormKey() {

    $oldkey = Mage::app()->getRequest()->getParam('form_key');

    $domain = Mage::getBaseUrl();

    if (empty($oldkey) && ($domain == 'http://site1.co.uk/' || $domain = 'http:///site2.co.uk/')) {

        Mage::getSingleton("core/session", array("name" => "frontend"));

        $product = Mage::app()->getRequest()->getParam('product');
        $qty = Mage::app()->getRequest()->getParam('qty');

        $key = Mage::getSingleton('core/session')->getFormKey();

        if (empty($product)) { //if no product id, redirect to homepage
            Mage::app()->_redirect('');
        } else { //redirect to the add to cart with the form key

            $url = 'add/product/' . $product . '/qty/' . $qty . '/form_key/' . $key;

            Mage::app()->getRequest()->setParam('return_url', $url);
        }

    }

}
}

I had a look at several 'how tos' for this but I can't seem to find a solution that wants to work with Magento 1.9.2.3. I know the form key doesn't last past the user session, hence the observer to add the form key only once the user is on the site.


texts: how to remove text "items" from top links wishlist magento 2

texts: I want to display just wishlist count like wishlist (2) in top bar, how can I remove the word "items" or "item"


texts:
Can we override app/Mage.php in Magento 1 ?
I have some changes in the above file.
I am not sure if it can be override ?
Any advice/thoughts ?


texts: Magento 2 Set Shipping Method Programatically

texts:
I am trying to set Shipping Method Progrmatically but getting following error.
The shipping method is missing. Select the shipping method and try again.

foreach ($quote->getAllAddresses() as $address) {
            // Build grand total.
        $grandTotal = (($finalPrice + $shipping + $tax) - $discount);
        $baseGrandTotal =  $this->convertPrice($grandTotal);
        $baseFinalPrice =  $this->convertPrice($finalPrice);
        $baseDiscount =  $this->convertPrice($discount);
        $baseTax =  $this->convertPrice($tax);

        //$address->setFreeShipping(true); //tried this but not getting set

        $address->setShippingMethod('flatrate_flatrate'); //tried this getting error
        $address->setCollectShippingRates(true);

        $address->setBaseSubtotal($baseFinalPrice);
        $address->setSubtotal($finalPrice);
        $address->setDiscountAmount($discount);
        $address->setBaseDiscountAmount($baseDiscount);
        $address->setTaxAmount($tax);
        $address->setBaseTaxAmount($baseTax);
        $address->setBaseGrandTotal($baseGrandTotal);
        $address->setGrandTotal($grandTotal);
        $address->save();

}


texts:
I have a Magento 2 store in Amazon cloud and I wanted to set a domain name.
I set the A record in my domain name registrar as in the picture.

when I type my URL, it forwards me to the shop but I see the IP address instead of Domain name.


texts: Magento extensions not loading in dev environment but work on staging...?

texts:
New info

This is something to do with modman and symlinks. In the staging environment I'm deploying a tarball with no symlinks (and everything works) but in development I use modman with symlinks to modules. What I can't figure out is why some modules load fine and others don't.

Original post

I need some help figuring out what is happening here or even how to troubleshoot it.

Developing Magento on my local dev machine (OSX - XAMPP, PHP/5.6.12, Apache/2.4.16) I am finding that certain Magento extensions don't load. They don't even show up in System -> Configuration -> Advanced -> Advanced -> Disable Modules Output.

Some extensions do show, others don't and I can't find any pattern. It is like the extension xml files in app/etc/modules don't even get parsed - there are no PHP errors, nothing in system.log or exception.log - totally silent failure from what I can see. Happens the same in 3 of my dev setups each for different Magento installs.

I take the exact same code and push to my staging server (CentOS 6.x, PHP/5.6.16, Apache/2.2.15) and all the extensions load fine.

Running magerun dev:module:list on both environments shows all modules correctly!

I have a script that sets appropriate file permissions and so ownership and permissions are consistent in both environments.

Any ideas what could be going on? In writing this I've realised the Apache versions are different so maybe there is something funky going on there, but that doesn't make a lot of sense.

Can anyone suggest where I should look, or how I could begin to debug? Or has anyone seen this kind of behaviour before?

Any pointers appreciated!


texts: Change translation for individual product or category

texts:
I am working on a magento store setup which sells both Products and Class Subscription.

Products detail page i would like to show description title as Product Description but when it is a Class Subscription (these are product in separate Category) i need it to be Class Details

As i need it for a particular product, i cannot change it in particulate. It there any option to override translation for particular product or category. May be through layout xml update.
Or is there any other standard approach to do this in magento.


texts: Override Adminhtml importexport dataflow Profile Controller

texts:
I'm trying to override ProfileController located in

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

I created a new module to handle that as following :

  app/etc/modules/FifoBox_ProductApproval.xml

<?xml version="1.0"?>
    <config>
        <modules>
            <FifoBox_ProductApproval>
                <active>true</active>
                <codePool>local</codePool>
            </FifoBox_ProductApproval>
        </modules>
    </config>

  app/code/local/FifoBox/ProductApproval/etc/config.xml

<config>
    <modules>
        <FifoBox_ProductApproval>
            <version>1.0.0</version>
        </FifoBox_ProductApproval>
    </modules>
    <global>
         ....
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <fifoBox_productapproval before="Mage_Adminhtml">FifoBox_ProductApproval_Adminhtml</fifoBox_productapproval>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

And My main class (controller) located in :

  app/code/local/FifoBox/ProductApproval/controllers/Adminhtml/System/Convert/ProfileController.php

<?php require_once Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'System' . DS . 'Convert' . DS . 'ProfileController.php';

class FifoBox_ProductApproval_Adminhtml_System_Convert_ProfileController extends Mage_Adminhtml_System_Convert_ProfileController {

    public function batchRunAction() {

        die('Overriden');
    }

} ?>

But Magento still call overriding (Original) method (i.e can't access my new class), even I tried to put the new controller file in
app/local/Mage/Adminhtml/controllers/System/Convert/ProfileController.php to avoid any xml config error but I got the same result, I cleared catch checked all logs even Apache ones with nothing

The only way I got my new code work is to modify the core file itself

Please help


texts: Studying to become a Magento Certified Developer

texts:
I have been considering studying to become a Magento Certified Developer.
When I look at the study guide I see a lot of questions which I can answer, however, the problem is I don't really know what they are expecting me to answer.

For example this question:

  Describe typical Magento module structure

Would they expect me to answer with the full module structure (how far do I go?), would they expect me to also answer with how the config.xml should look like? Do I include helpers and/or resource collections?

Does anyone know where I could find a more specific guide or can anyone give me any advice?

EDIT

Apparently, the questions are all multiple choice, so this would make things a lot easier. However, I'm still interested in the resources you can find/know about.


texts: Get list of EU countries in JS file in checkout

texts:
I'm trying to get a list of the EU countries in my checkout (the list that is available in the backend).

I found this PHP code to get the list but i'm not sure on how I would get it into the JS my checkout. I need to show a field depending on if the selected country is in Europe.

Thanks in advance.

I currently have this:

   <item name="vat-country-code" xsi:type="array">
       <item name="component" xsi:type="string">
              BB_Checkout/js/view/vat-country-code
           </item>
   </item>

But of course this leads to a JS file.


texts:
I'm using Follow Up Email extension from AheadWorks.
I tried to make a rule : Abandoned cart.

Here my Rule set:

General:

Title               : Abandoned cart
Event               : New abandoned cart appeared
Cancellation events : - Order obtained 'Credit Card Verification' status
                      - Order obtained 'Processing' status
Email chain         : Send     : After 0 Days 0 Hours 30 Minutes
                      Template : AW Your cart has been abandoned_3.5.0

Sender Details :

Sender name  : Andhi Irawan
Sender email : andi@bilna.com

Send Test Email :

Test recipient : andi@bilna.com
Customer ID    : 77

Other values are left as originally (default)

AW Your cart has been abandoned_3.5.0 Newsletter template contained in the following line code:

{{foreach var="$quote.getAllVisibleItems()" template="nsltr:AW Abandoned cart row_3.5.0"}}

if the line code is not removed from the template then when I click the Save And Send Test Email button, the Mail Logs (Follow Up Email Queue) remains empty.

if the line code is removed then the Rule was to send an email to the Mail Logs. (see capture screen: http://i.imgur.com/bi2i4ja.png) or

but the table is empty in preview email
see capture screen here : http://i.imgur.com/7rawu8n.png or

the question is :

how to display the content (product name, image, price) in the table on email


texts: Magento 1.9 how can get tax amount in mini cart

texts:
How can get tax amount in mini cart.? for guest and login, both of customer.

How to get programatically.


texts: Magento 2.1 - Flat Catalog module has a limit of 64$d filterable and/or sortable attributes

texts:
I'm getting the error below during my re-index:

  The Flat Catalog module has a limit of 64$d filterable and/or sortable
  attributes.Currently there are 92$d of them.Please reduce the number
  of filterable/sortable attributes in order to use this module

How can I fix it? Is that a limit in MYSQL?

Any help is appreciated.


texts:
I tried to override a model in Magento\Quote\Model\Cart\Data\CartItem but I cannot override it.
here is my 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\Quote\Model\Cart\Data\CartItem" type="Vendor\AddProductWithVendorGraphQl\Model\Cart\Data\CartItem" />
</config>

and this is my class
class CartItem extends \Magento\Quote\Model\Cart\Data\CartItem
{

        /**
     * @var string
     */
    private $sku;

    /**
     * @var float
     */
    private $quantity;

    /**
     * @var string
     */
    private $parentSku;

    /**
     * @var SelectedOption[]
     */
    private $selectedOptions;

    /**
     * @var EnteredOption[]
     */
    private $enteredOptions;

    /**
     * @param string $sku
     * @param float $quantity
     * @param string|null $parentSku
     * @param array|null $selectedOptions
     * @param array|null $enteredOptions
     */
    public function __construct(
        string $sku,
        float $quantity,
        string $parentSku = null,
        array $selectedOptions = null,
        array $enteredOptions = null
    ) {
        $this->sku = $sku;
        $this->quantity = $quantity;
        $this->parentSku = $parentSku;
        $this->selectedOptions = $selectedOptions;
        $this->enteredOptions = $enteredOptions;
    }
    public function getQuantity(): float
    {
        var_dump('tes');die();
    }

I've tried to use plugins too. But it still didn't work. Can anyone help me?


texts: How to get base url in js without using block and phtml in Magento 2

texts:
I have a custom js which will be loaded every time in backend, i want to get the site base url without using phtml pure in js, for now i'm stuck in this:

 define(['mage/url'],
      function (url) {
       'use strict';
        var baseurl = url.build('/sitename/namespace_module/test/index');
    });

which will give a result like this

http://127.0.0.1/sitename/namespace_module/test/index

the problem is, i have to define the sitename which is not flexible and correct for an extension, is there anyway to get the base url without using block and phtml file like  this ?


texts: Toggle shipping method based on customer's condition

texts:
I created an extension following Inchoo's tutorial but still confusing at how to toggle the shipping method.

Once customers about to see the shipping method page, I need to check the customer's attribute. If Yes the display my custom shipping method, otherwise hide. This is required for both frontend and admin placing order.

I have a few thoughts but all out of my ability to start. I need some hints about which idea is the most efficient and what files should I created:

Using event: set an event such as before_shipping_method_render(I made up this one), then I can setup a function in Observer.php to remove the shipping method from the collection before rendering but I don't know the event name and how to get the collection.
Rewriting Magento function: rewrite the function that puts all enabled shipping methods together. I can put my condition check function in the iterate then allow my custom shipping method if condition is Yes otherwise vice versa.


texts: Magento 2.2.4. Product Import additional_attributes Error Issues

texts:
I have a problem with Magento 2.2.4. when I try to Import new products into a website, even when I try to Import the Exported products I already have on the website, I get this kind of error.

Those problematic attributes are additional_attributes created by me. The error shown is not correct, because those rows 250 and 265 have correct values, identical with the one set on the website for that attribute. For example, if I delete from CSV those problematic rows and try again, Magento will show the other 2 rows with the same problem. I had this problem even when I imported a brand new export with all the products from the website, but this time a different attribute was shown as problematic.

If I try to import some CSV without the additional_attributes column, everything works fine.

Thank you!


texts: REST API 404 error: "Request does not match any route error" at Shipping method selection Magento 2

texts: The REST API request rest/default/V1/guest-carts/:cartId/shipping-information is returning a 404 error with message "Request does not match any route".


texts: Magento2 product export based on website?

texts:
I have 20+ website in my Magento store. If I click System->Data Transfer ->Export if I click the export means all website products are exporting.

But, I want to export product based on the website, I need to add the filter for that, please tell me how to create that website filter attribute in magento backend or else I need to write any custom script for that attribute?


texts:
I'm getting blank product pages on my Magento website. When i check the system.log it gives the following error:

Warning: include(`Mage/Core/Model/Domainpolicy.php`) [function.include]: failed to open stream: No such file or directory

What to do?!


texts: How to get in stock product collection by category id in Magento 2.3.3?

texts:
I'm using Magento 2.3.3 with multiple websites store that uses different multiple stock sources(multi inventory) and I tried to retrieve product collection by category id like this:

public function __construct(
    \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productsCollectionFactory,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory
){
    $this->_catalogProductVisibility  = $catalogProductVisibility;
    $this->_productCollectionFactory  = $productsCollectionFactory;
    $this->_categoryFactory           = $categoryFactory;
}

$collection = $this->_productCollectionFactory->create();
$category = $this->_categoryFactory->create()->load(3);

$_collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());
$_collection->addFieldToFilter('status', array('eq' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED));

$_collection = $this->_addProductAttributesAndPrices($_collection)
        ->setCurPage(1);

$_collection->setPageSize($7);

$_collection->addCategoryFilter($category);
$_collection->addAttributeToFilter('is_featured',1);
$_collection->setOrder('created_at','desc');

return $_collection;

The collection will show both in stock and out of stock product collection, how can I filter out the out of stock product and only show the in-stock product collection?

Thanks in advance..!


texts: Checkout page takes 7 or more seconds to place order

texts:
My checkout page is taking 7 or more seconds every time to place order.
Can anybody let me know what could be the possible reason or how can I debug this issue?
I am totally confused from where should I start.
It is happing with every payment method.
Any help will be appreciated.


texts: Magento 2 - Add additional attributes in register

texts:
I am using Magento 2 EE.

I want to call phone number attribute in customer register form.

To do this I just created a custom customer attribute from

  Store -> Attributes -> Customer

But it is not appearing on frontend signup form. How can I show this attribute on form?


texts: Programatically create simple product not showing in catalog product grid

texts:
I have create product programmatically but not showing in catalog product grid.
Here is code :

    $product = new Mage_Catalog_Model_Product();
    $product->setWebsiteIds(array(1));
    $product->setAttributeSetId(9);
    $product->setTypeId('simple');
    $product->setCreatedAt(strtotime('now'));
    $product->setName('custom name');
    $product->setSku('custom123');
    $product->setManufacturer('brand id');
    $product->setCategories(array('categories id'));
    $product->setOffer('custom offer');
    $product->setPrice('10');
    $product->setSpecialPrice('8');
    $product->setStatus(1);
    $product->setTaxClassId(0);
    $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
    $product->setStockData(array(
            'manage_stock' => 1,
            'use_config_manage_stock' => 0,
            'is_in_stock' => 0,
            'qty' => 0
          ));
    $product->save();

Above script create a row in database table catalog_product_entity but this product not showing in magento catalog product grid.
This product is showing in frontend and backend sales_order_create page. But didn't showing in catalog product grid.
Please someone suggest me how to show product in catalog product grid.


texts: Looking to create a Category Attribute that will allow me to change the style of my dropdown navigation

texts:
I am wanting to be able to have three different styled drop downs in my Menu. I would like to be able to change the style type using a category attribute.

What I imagine is to be able to go to a category and select the type of dropdown style that will appear in the main navigation for the individual category if there are subcategories.

For example i have three links in my nav that each have three subcategories:

Link 1

List item
List item
List item

Link 2

List item
List item
List item

Link 3

List item
List item
List item

(They will be in a line but cant put them in a line in this post for some reason)

I want to be able to have Link 1's drop down to be a full page dropdown mega menu style, Link 2 to be an ordinary thinner styled dropdown and Link 3 to be a full size dropdown that can include images.

In the category section of the admin area I would like a new group to be added labeled Menu with a selector dropdown with the options:

Style 1
Style 2
Style 3

When you select one of the styles, in the Selector dropdown, the class or classes will change in the html for the Main Navigation on the frontend that will apply the different css styles to create the correct look for the selected category sub menu dropdown.

I have done the three styles in css and so far I can have which ever look i want by changing the class manually but can only have one or the other for all categories.

I have started to create the module for it but have hit a wall. Here is my mysql install code so far:

    <?php
$installer = $this;
$installer->startSetup();
$attribute  = array(
    'type'          =>  'text',
    'label'         =>  'Navigation Type',
    'input'         =>  'select',
    'global'        =>  Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible'       =>  true,
    'required'      =>  false,
    'user_defined'  =>  true,
    'group'         =>  "Menu"
);
$installer->addAttribute('catalog_category', 'Navigation_Type_Select', $attribute);
$installer->endSetup();

This creates the Group tab and the Selector dropdown.

However I:

Don't know how to populate the Selector dropdown options
Don't know how to when the type is selected apply the class to the html

Any help would be greatly appreciated.

I apologise for the length of this question I wanted to be through in my explanation. Let me know if any one requires additional information.

********** UPDATE **********

I have managed to get the dropdown and the dropdown values working by doing the following:

Added Mypackage > Mymodule > Model > Source > Style.php

    <?php

class Mypackage_Mymodule_Model_Source_Style extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
    public function getAllOptions()
    {
        $options = array(
            1 => 'Style 1',
            2 => 'Style 2',
            3 => 'Style 3'
        );

        return $options;
    }
}

?>

And edited the mysql-upgrade:

<?php
$installer = $this;
$installer->startSetup();
$attribute  = array(
    'type'              =>  'int',
    'label'             =>  'Menu Style',
    'backend'           => '',
    'visible_on_front'  => false,
    'input'             =>  'select',
    'source'            =>  'Mypackage_Mymodule_Model_Source_Style',
    'global'            =>  Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible'           =>  true,
    'required'          =>  false,
    'user_defined'      =>  true,
    'default'           =>  "",
    'group'             =>  "Menu Style"
);
$installer->addAttribute('catalog_category', 'Menu_Style', $attribute);
$installer->endSetup();
?>

What I need to know how can I use this to change a class do I

a.) Set a script up to change the class depening on what option is selected. If so whats the best way

or

b.) Use php if statements in the html for the class depending on what option is selected.

or

c.) A better option?

Any help would be very much appreciated.

Thanks.


texts: Magento 2 - Get the postcode entered in the Estimate Shipping block

texts:
I'm trying to get the postcode that has been entered in the Estimate Shipping block on the basket page. I am trying to grab it from local storage.
I have the following code on a template file that is called on the homepage:

<script>
    require(['jquery','Magento_Checkout/js/model/quote'], function($,quote){
        console.log(quote.shippingAddress().postcode)
    })
</script>

This one returns an error in the console: quote.shippingAddress(...) is null

I have also tried to retrieve it via the cart session:

...
use Magento\Checkout\Model\Cart;
...

public function __construct(
    Cart $cart,) {
    $this->cart = $cart;
}

public function getCustomerDeliveryPostcode() {
    $quote = $this->cart->getQuote();
    $shippingAddress = $quote->getShippingAddress();
    $postcode = $shippingAddress->getPostcode();
}

This one returns nothing.
Can anyone see what is wrong?
Magento 2.3.0


texts: Does anyone know a simple tutorial on how to add plugins to tinymce 4 based on magento 2.4. The most stuff i found out there is outdated or missing alot of informationen


texts:
Hope someone can shine some light on this!

Can anyone confirm what the Paypal IPN url should be set to for Standard payment?

I have been advised by a Paypal tech that it is http://www.yoursitename.com/index.php/paypal/ipn/index/ but the Paypal IPN history still shows the response code 500 and we are not getting order status change from "Pending Payment" to processing.

I have checked the logs but can seem to find anything that stands out and we have tried the old code change to the ipn.php file but still no luck!

Any help would be great as I don't have much hair left to pull out :(


texts:
I have been experiencing this weird issue the last 2 weeks, and it's happening very randomly.

customers were using IE as the browser
they put something in the shopping cart and clicked PayPal Express Checkout
they were redirected to PayPal, logged in, and clicked to come back to my site to confirm the order
then they saw an error message that says Unable to initialize Express Checkout (at this stage, this order actually got through, payment processed and Magento order created)
thinking that the order did not get through, they retried, and failed, and finally gave up by using the normal PayPal checkout, which worked.
they then saw duplicate payments in PayPal and sent me complaints

Could anyone please guide me in the right direction?


texts: Magento Swapping Customer Orders and Billing Information

texts:
We have a Magento website that is experience this issue. When a customer places an order on our website in their account, after the order goes through it is showing the billing address for a different customer in the confirmation. The billing information that it shows is for a completely different customer with a separate account. This has caused us to send several orders out to the wrong addresses. Has anyone experienced this before? Any ideas to fix it?

Also, when the customer logs into their account it is showing the information from a different customer.

We have tried running a cron job daily and that seemed to fix the issue for a week, but then it happened again twice yesterday and today. Our website is using Magento ver. 1.7.0.0

Thank you!


texts:
which localhost server is best for Magento ver. 1.9.3.2..?

Am tried in xampp but it slow

Please anyone suggest me...!

Thank You in advance.


texts:
We currently use a "workaround" to cache our product view pages, as we have only a couple of configurable products with big collections it made sense to us at the time to create a couple of templates with the below code in to achieve caching on the product page.

<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
                    <action method="setCacheLifetime">
                        <lifetime>86400</lifetime>
                    </action>
    <block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml">
    <block type="review/form" name="product.review.form" as="review_form"/>
</block>

This as I say works fine at the time but we're changing our product offering making this workaround messy and more incorrect than what it was to start with. I don't want to go installing hefty FPC apps and modules just for 1 page, so can anyone advise on a sensible way to cache the product_view block to ensure that each time I load a different product the same cached block isn't shown for each?

Cheers


texts:
We Klarna integrated in Check out. on running command upgrade , compile and deploy My logo is not shown , my one menu is not showing sub menu  categories and Check out is showing 404 not found
It is directing to object%20Object error 404 page not found
Failed to load resource: the server responded with a status of 404 (Not Found)


texts: Magento 1.9.2.1 how to prevent core_config_data from getting malicious scripts

texts:
I have been scanning the website at Magento Scan and getting the following error:

  Magento Compromise Injection
  Your site is compromised with injected JavaScript. (131)
  The malicious code signature(s) has been found on the page.

In page source I can clearly see a malicious script included in header.

After further research I found that there are entries in core_config_data with path : 'design/head/includes' and the value column has that malicious script.

I have not changed nor uploaded any extensions.

This has happened 3 to 4 times earlier and I am able to track how is this being injected.

When it happened for the first time and for every other times, I have changes database credentials but it didn't helped.

What measures should I take to prevent this?


texts:
After move theme folder (app, pub, lib) to root folder then run php bin/magento setup:upgrade getting the following error,

php bin/magento setup:upgrade

  Installing data... SQLSTATE[23000]: Integrity constraint violation:
  1062 Duplicate entry '21' for key 'PRIMARY', query was: INSERT INTO
  eav_attribute_set (entity_type_id, attribute_set_name,
  sort_order, attribute_set_id) VALUES (?, ?, ?, ?)

After check with eav_attribute_set Duplicate entry 21 is my eav_attribute_set. What i need to do further shall i delete and run again the php bin/magento setup:upgrade?

Screenshot : https://snipboard.io/v1z0f2.jpg


texts: can not find function getCustomRootTemplate

texts:
I try to read the flow of magento but can not find the function

getCustomRootTemplate

that called line 102 of file app/code/core/mage/cms/helper/page.php


texts: Magento 2: How to get Special Price range of Configurable product

texts:
I am able to get Bundle and Configurable Regular Price of Product. But Special Price there is no min max available.

Below is code which I tried for regular configurable price but same is not working for special Price

    $product = $this->modelProduct->load(745);
    $configPrice=$product->getPriceInfo()->getPrice('regular_price');
    echo '=>'. $configPrice->getMinRegularAmount();// For min price
    echo '=>'. $configPrice->getMaxRegularAmount();// For max price


texts: Magento2 how to insert link inside the img tag with knockout js

texts: Can somebody help me with this? I wanted to make the image clickable but whenever I try to put it inside the  tag, the image doesn't show


texts: Magento 2 System Configuration for Module issue

texts:
I visited many sites for find solution of this issue.

But after creating system.xml and acl.xml Magento give me a report generated error.

Error

  a:4:{i:0;s:140:"Notice: Undefined index: id in
  /usr/local/ampps/www/mgn2/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php
  on line 59";i:1;s:6391:"#0
  /usr/local/ampps/www/mgn2/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php(59):
  Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...',
  '/usr/local/ampp...', 59, Array)

Can you clarify this issues?

app/code/Pulsestorm/HelloWorldMVVM/etc/adminhtml/system.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="Pulsestorm" translate="label" sortOrder="200">
            Pulsestorm
        </tab>

            Pulsestorm
            <tab>HelloWorldMVVM</tab>
            <resource>Pulsestorm_HelloWorldMVVM::config_helloworldmvvm</resource>
            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                General
                <field id="enable" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Enable Hello World
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="block_label" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Module page title
                </field>
            </group>

    </system>
</config>

app/code/PulseStorm/HelloWorldMVVM/etc/acl.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Magento_Backend::stores">
                    <resource id="Magento_Backend::stores_settings">
                        <resource id="Magento_Config::config">
                            <resource id="Pulsestorm_HelloWorldMVVM::config_helloworldmvvm" title="HelloWorldMVVM" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>


texts: Magento2 Related Products Block Based On Customer Interest

texts:
I have a magento2 website and what i am thinking is i want to develop a related products block which needs to be displayed based on user interest.

Lets assume a user open my website firstly and then clicked on any product then i want to show a random products under related products.

If the same user used any filter or search keyword as "black" then i want to show related products based on that black keyword only.

I almost checked all the available magento2 modules by mageplaza or webkul or cedcommerce but none of them providing this feature.

I want to know is that search history or filter history storing in any database table? If yes based on user browser history how can i get the related products?


texts: Magento 2.3.0 Admin grid using UI component sticky CSS is not working

texts:
I have created a grid using UI component. in this grid, I display only grid I don't need to display button <buttons></buttons>. gird is working perfectly when I scroll down in grid page sticky CSS is not working and grid layout is brek.

When I add a button using <buttons></buttons> and scroll down element sticky grid is working fine but if I remove button <buttons></buttons> (I remove button because I don't want) and scroll down sticky grid is not working.

What actual result :

What Expected result :

It is default Magento bug I Report an issue on GitHub

Any help would be appreciated! Thanks.


texts:
I would like to add value field. Find the below screenshot for custom
  options in magento2

Screenshot:


texts: Move childhtml from product/view.phtml to product/view/description.phtml

texts:
under my theme's config.xml, below layout block used to trigger product reviews and it's form.

<reference name="content">
.............
<block type="review/product_view_list" name="review.list" as="review_list" template="review/product/view/list.phtml">
  <block type="review/form" name="product.review.form" as="review_form">
    <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label">
      <label>Review Form Fields Before</label>
      <action method="setMayBeInvisible"><value>1</value></action>
    </block>
  </block>
</block>
</reference>

and using <?php echo $this->getChildHtml('review_list') ?> in my themes product/view.phtml to display review with review form.

Now i'm trying to use <?php echo $this->getChildHtml('review_list') ?> in product/view/description.phtml but it's showing empty.

Any solution to solve this ?


texts: Is there any web interface for message queue MySQL adapter in Magento 2?

texts:
Is there any web interface for "message queue MySQL adapter" in Magento 2 ?

I have searched that, but cannot find anything (But no result for searches does not mean it doesn't exist though)

magento 2 doc where the MySQL adapter is mentionned

The version of Magento is Magento Community Edition 2.2

In the end, I wish to use this message queue system/'message broker', as I cannot install RabbitMQ on the server.


texts:
I have a little problem. I am currently working on an synchronize job for cron.

The sync function just gets the newest elements from an api and updates in the Magento db. The Magento version is: 2.3.1 .

Here is the function:

 public function synchronize()
{
    $writer = new Stream(BP . '/var/log/cron.log');
    $logger = new Logger();
    $logger->addWriter($writer);

    $login = $this->login();

    $dateTimestamp = $this->getLatestDate('/tmp/marketsSync.txt');

    $items = $this->getNewestItems($dateTimestamp, $login);

    foreach ($items as $item) {
        $srcItem = $this->_marketFactory->create();
        $srcItem->setContent($item);

        $marketCollection = $this->_marketCollectionFactory->create();
        $marketCollection
            ->addFieldToSelect('*')
            ->addFieldToFilter('id_location', ['eq' => $srcItem->getData('id_location')])
            ->load();

        $logger->info('found? :'. $marketCollection->getSize());

        if ($marketCollection->getSize()) {
            $tgtItem = $marketCollection->getFirstItem();

            $srcTime = strtotime($srcItem->getData('date_upd'));
            $tgtTime = strtotime($tgtItem->getData('date_upd'));

            if ($srcTime > $tgtTime) {
                $this->updateElement($tgtItem, $srcItem);
            }
        } else {
            $logger->info('create');
            $this->createElement($srcItem, $marketCollection);
        }
    }

    $this->setLatestDate('/tmp/marketsSync.txt', date("Y-m-d H:i:s") );
}

public function createElement(Synchronizable $obj)
{
    $item = $this->_marketFactory->create();
    $item->setContent($obj->getData());
    $item = $item->save();
}

public function updateElement(Synchronizable $tgtObj, Synchronizable $srcObj)
{
    $writer = new Stream(BP . '/var/log/cron.log');
    $logger = new Logger();
    $logger->addWriter($writer);

    $tgtObj->setContent($srcObj->getData());

    $logger->info($tgtObj->getData());

    $tgtObj->save();
}

I've got the Object to update from the marketCollection via getFirstItem(). Now in the updateElement() function i use the the api data to update the object with

$tgtObj->setContent($srcObj->getData());

This function is just a foreach loop:

 public function setContent($content)
{
    foreach ($content AS $key => $value){
        $this->setData($key, $value);
    }
}

I know that this method is already deprecated, but why does save allways create a new entry? (it creates the same data but with a new id)


texts: Multiselect category dropdown on admin form

texts:
I have created custom CRUD on new database table. I just wanted to save comma separated categories in a field.

I have this code for multiselect categories:

$fieldset->addField(
    'categories',
    'multiselect',
    [
        'label' => __('Categories'),
        'title' => __('Categories'),
        'name' => 'categories',
        'values' => \Vendor\Module\Block\Adminhtml\Products\Grid::getCategories(),
        'note' => __('Could be multiple'),
        'disabled' => $isElementDisabled
    ]
);

I have created getCategories function in Grid.php.

Can anyone suggested how to populate categories in tree form and return categories array


texts: Magento 2 - Field "Tax Class" not showing

texts:
I have the problem that for a custom new product type there are no taxes getting calculated and are always 0.
I found a solution here. It says there is a dropdown in the product details called Tax Class:

But there is no such field for me (on any product type). The attribute set is set to default.

Attribute Set "Default":

As you can see an attribute with name "tax_class_id" already exist in this attribute set, but why is it not showing?


texts:
In my site, I need to add a condition to ,

Display Free Shipping only for order total bigger than 150$. I've added Maximum Order Amount from backend. from Stores>Settings>Configuration>Sales>Shipping Methods->Free shipping

I need to hide Free shipping option if total amount is less than 150$.

This works correctly only if order item total is 150$ without any discounts or deductions.
I added 10$ discount onto 150$ item.but it still shows free shipping option.

How can I fix this?


texts:
I would like to make automated category, where I want to have all catalog products sort by discount price percentage from the highest discount to the lowest.

Could anyone help me?

I tried many extensions and tried to change code, but nothing helped me.

Thank you very much.


texts:
I tried to login magento2 account but it redirects to the frontend login page in chrome and tries to login firefox it's redirected to the empty page.
Please help me, anyone.


texts: How to solve facebook login problem on Magento?

texts:
I use facebook login module in magento site that not redirecting to my Magento 1.9.2 site.
But i user this module many Magento 1.9.2 site that are rediredted succesfully with account My Dashboard.

I think it is my domain server configuration issue.

How can i findout what actual problem of my server domain configuarion.

Module Url:
https://www.magentocommerce.com/magento-connect/twitter-facebook-login-by-plumrocket-inc.html


texts: Magento redirects from onepage to cart in Firefox and Safari (ipad)

texts:
Ok, I'm having this issue where in Firefox on a desktop and Safari on an iPad the url checkout/onepage redirects to checkout/cart. So from the actual checkout process to the cart again. Even if I manually type in checkout/onepage I just get redirected to the cart again. Magento, PHP, and Apache are not throwing any errors in the entire process or warnings.

Site: www.cepcompression.com
Magento Version: 1.7.0.2

Edit: Found out that if I turn off Secure Frontend URLs it works fine but then again I can't turn them off.


texts: Magento 2 : How to configure cookie free domain?

texts:
In GTMetrix, I checked "Use cookie-free domains" result is 0 and also checked that there are Magento 2 default provide this configuration.

How to setup that and upgrade maximum "Use cookie-free domains" score ?

Any help would be appreciated.

Thanks.


texts:
I am working on list of categories where I need to select one of root categories in the list and after selecting it, it should show the subcategories and  so on. SO I am here using ajax calls. As in ajax I am passing variables using get method but how can I a call block.

I have checked in controller for testing and its working fine using this url in ajax as using in controller

xmlhttp.open("GET","http://localhost/magento/weblog/index/fn/?id="+str,true);

then tried to implement on block but i am not able figure out regarding the URL in blocks. How can I use it in Block. and I thik we can not pass the variables from controller to blocks. So finally my question is, How can use Ajax in blocks so that I can use this function in phtml file

Thanks everyone :)


texts:
I am working on a task to modify Date Range on Dashboard chart. Data chart will display on custom date range selection (Today/Yesterday/This Week/Last Week/This Month/Last Month).

I have extend the module from core (\app\code\core\Mage\Reports\Model\Resource\Order\Collection.php) to local (\app\code\local\Andi\Dashboard\Model\Reports\Resource\Order\Collection.php). I make changes to the getDateRange function.

I'm adding

case '2d':
            $dateEnd = Mage::app()->getLocale()->date();
            $dateEnd->addHour(1);
            $dateStart = clone $dateEnd;
            $dateStart->subDay(2);
            break;

for yesterday data.
2d means yesterday.
The condition is that the data shown today is the data of today's date only and does not include data from yesterday. Data shown yesterday was a day of data without the data the day before yesterday and today. So also with the data of the Week, Last Week, This Month, Last Month, This Year and Last Year.
I have debug it and get the following data:

$dateEnd = Mage::app()->getLocale()->date(); is Feb 12, 2015 7:56:15 PM
$dateEnd->addHour(1);                        is Feb 12, 2015 8:56:50 PM
$dateStart->subDay(2);                       is Feb 10, 2015 8:57:34 PM

How do I make by using addHour, subHour, addDay, subDay, addWeek, subWeek, addMonth, subMonth, addYear and subYear. Or can use this?

$current_time = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
$yesterday = date("Y-m-d", Mage::getModel('core/date')->timestamp(time()-(60*60*24)));


texts: Configuration data broken after upgrading to Magento from 2.2.5 to Magento 2.3.3

texts:
i Have 3 multi websites , with each websites have 3 different store views, After upgrading to Magento 2.3.3 from 2.2.5 , i've encountered some issue:

Magento 2.3.3 prints empty base URL, so all the link generated in my site becomes index.php/xxx
My configuration data in store configuration is empty
My theme configuration is empty, logo, header, etc is gone, when i set the theme, it still shows no theme after i saved the theme configuration and the logo still not uploaded

When i look up at the core_config_data all the data is there, but there are seems an increasing amount of records

Magento 2.2.5 core_config_data for theme_id

Magento 2.3.3 core_config_data for theme_id

is there a way to fix this?


texts: Show wishlist counter on header when it doesnt have items

texts:
I need to display cart and wishlist counters on my own header block. For the first one i've just modified the CSS to display block.

But I can't find how the wish list counter works, so it will show 0 when it has no items.

Thank you very much for your help.


texts:
How to get product id if choose option color in configure product?

If anyone knows please help me?


texts: What is the correct way to create mock object in unit test

texts:
Now days I am focusing on TDD development, and I am following the Magento test class for reference. So firstly I look into Contact module (as it is the small module) and I found that in DataTest.php from Magento\Contact\Test\Unit\Helper\DataTest.php it gets the mock object from construct argument. like in setUp you can find it like,

  protected function setUp()
    {
        $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
        $className = \Magento\Contact\Helper\Data::class;
        $arguments = $this->objectManagerHelper->getConstructArguments($className);
        /**
         * @var \Magento\Framework\App\Helper\Context $context
         */
        $context = $arguments['context'];
        $this->scopeConfigMock = $context->getScopeConfig();
        $this->customerSessionMock = $arguments['customerSession'];
        $this->customerViewHelperMock = $arguments['customerViewHelper'];
        $this->helper = $this->objectManagerHelper->getObject($className, $arguments);
    }

from here customersession Magento get the mock object from construct argument.

        `$this->customerSessionMock = $arguments['customerSession'];`

But in some of test class magento create the mock object by using createMock method. Like,

$this->customerSessionMock = $this->createMock(\Magento\Customer\Model\Session::class);

So which way I should follow to create mock object ? and why?


texts: Category Products not visible in magento 2

texts: In my Magento 2 website, no products are displaying on category pages. I did reindexing and flushed cache but issue is not resolved. I have checked magento admin, all products are there with associated categories and all categories has products. Please provide me solution


texts: Edit default Cash On Delivery Payment module/extension

texts:
I am using Magento 1.9.

Guys i want to create a very simple change in the Cash On Delivery Payment the default module that comes with the freshly installed magento store.

I am not sure if there is a module/extension for this payment method.

I want to ask where it is located so i can check out the files of this payment method and edit what i want.

Thanks in advance!


texts:
Are there any articles or is there someone who can explain how Magento's layout system works. How the rendering is done, where do all these blocks come from and based on what are they placed on the page etc.

This topic seems quite big and difficult to understand at first.

EDIT:

For Magento 1.9.x


texts: Magento 2 - How to insert logo into custom pdf

texts:
I am trying to print logo into custom pdf through controller. I am able to print product name, sku etc.But I don't know how to add store logo. My code is as below. Can anyone please help me to add store logo into custom pdf as I have logo URL but don't know how to insert them. Thanks in advance.

$logoURl = $this->_logo->getLogoSrc(); //logo URL
$productName = $product->getName(); //Product Name
$productSku = $product->getSku(); //Product SKU

$pdf = new \Zend_Pdf();
$page = $pdf->newPage(\Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
$page->setFont(\Zend_Pdf_Font::fontWithName(\Zend_Pdf_Font::FONT_HELVETICA), 20);
$page->drawText($logoURl, 10, 500); //Able to print Logo URL
$page->drawText($productName, 10, 400); //Able to print product name
$page->drawText($productSku, 10, 350); //Able to print product SKU
$pdfData = $pdf->render();

header("Content-Disposition: inline; filename=result.pdf");
header("Content-type: application/x-pdf");

echo $pdfData;


texts: How to show Review Form instead of Review tab in product detail page magento2?

texts: I want to show review form after the related products section instead of Review tab on Product Detail Page in magento2?


texts: How to add attribute advance properties in magento 2.2.7

texts:
How to add attribute for product attribute advance properties in magento 2.2.7

I want to implement yes/no attribute for product and second attribute for image attribute for Product Attribute


texts:
I'm trying to remove content from my homepage. I have just installed a theme and even if I set a blank page as  a default page (homepage) the content get's added. I tried to figure out if it's a file causing but my experience is to less.

If I create a blank page it stays blank until I set it as CMS Home Pagein the backend.

Where can I find this file causing that and what do I have to delete/edit in order to get that removed?


texts: Cron is working but Last heartbeat is older than one hour

texts:
we have 2 sites on the same server.

we have a custom module to check if the cron is working or not.

in one site we are getting the below message

in another site, this message:

Is there any other way to check if the cron is working or not except AOE scheduler extension ?

cron.php

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage
 * @copyright  Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

// Change current directory to the directory of current script
chdir(dirname(__FILE__));

require 'app/Mage.php';

if (!Mage::isInstalled()) {
    echo "Application is not installed yet, please complete install wizard first.";
    exit;
}

// Only for urls
// Don't remove this
$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);

Mage::app('admin')->setUseSessionInUrl(false);

umask(0);

$disabledFuncs = explode(',', ini_get('disable_functions'));
$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;
$isShellDisabled = true;

try {
    if (stripos(PHP_OS, 'win') === false) {
        $options = getopt('m::');
        if (isset($options['m'])) {
            if ($options['m'] == 'always') {
                $cronMode = 'always';
            } elseif ($options['m'] == 'default') {
                $cronMode = 'default';
            } else {
                Mage::throwException('Unrecognized cron mode was defined');
            }
        } else if (!$isShellDisabled) {
            $fileName = basename(__FILE__);
            $baseDir = dirname(__FILE__);
            shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");
            shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");
            exit;
        }
    }

    Mage::getConfig()->init()->loadEventObservers('crontab');
    Mage::app()->addEventArea('crontab');
    if ($isShellDisabled) {
        Mage::dispatchEvent('always');
        Mage::dispatchEvent('default');
    } else {
        Mage::dispatchEvent($cronMode);
    }
} catch (Exception $e) {
    Mage::printException($e);
    exit(1);
}

?>

<?php
Mage::log('cron working', null, 'cron.log');
?>

command :

*/5 * * * * /usr/bin/php  -q /var/www/html/sitename/cron.php

**Edit **

when i add this code at the end of cron.php , and run the file in browser, it showed : Tuesday 17th of May 2016 07:12:03 PM so seems cron is running. but why Heartbeat not found ?

try {
   $myFile = "cronlog.txt";
   $fh = fopen($myFile, 'w');
   $stringData = date('l jS \of F Y h:i:s A');
   fwrite($fh, $stringData);
   fclose($fh);
} catch (Exception $e) {
   Mage::printException($e);
}


texts:
This is my popup it show first time click only

How to achieve this?

Value

Please fill following information to download files

        <form action="<?php echo $this->getUrl('downloadenquire/index/downloadme') ?>" method="post" id="download">
            <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
                <input type="text" name="name" placeholder="Name" required="true" class="input-text required-entry validate-alpha" />
                <input type="text" name="email" placeholder="Email" required="true" class="input-text required-entry validate-email"/>
                <input type="text" name="mobile" placeholder="Mobile" required="true" class="input-text required-entry validate-number"/>
            <input type="submit" value="Submit" id="submit-download" />
        </form>


texts: Magento 2.3: Is it possible import/create a category tree with category_id assigned

texts: I have to import a 3rd party catalog into Magento 2.3. I need to recreate in Magento the category tree with the same category_id in the original tree because I need it when I update inventory. How can I do it? Exist an extension? Can I do it directly on the DB? Below you can see an example of the category tree I need to recreate. Any suggestion will be appreciated!!


texts: Callback on method for KO JS observable data after AJAX completion

texts:
I have a module that modifies the product prices on the catalog pages and needs to bypass the cache. My issue is that I've defined these classes and need to trigger their flush method once another class has completed it's AJAX request and has ensured that the data needed is added to the DOM. Everything works if I specify a timeout to execute the flush on a set interval (once the data is available) however I can not specify to flush all the product prices or even specify a specific product to flush such as product-item-123.flush(); What am I missing here? Am I not utilizing the correct context? How can I specify to call the flush method from another class once the ajax has completed? I've found references throughout the core such as

.trigger('contentUpdated');

Which seems to be some sort of event driven system. This will work too as all I need to know is when the AJAX request completes and I can handle the rest from there.

in final_price.phtml I instantiate a new ko class via


texts: custom table creation by install script error

texts:
I am using magento 1.8.
I am creating my custom table through magento model install script,

<?php
//die('jfjf n');
$installer = $this;
$installer->startSetup();
$installer->run("DROP TABLE IF EXISTS {$installer->getTable('commission')};
CREATE TABLE {$installer->getTable('commission')} (
  `id` int(11) unsigned NOT NULL auto_increment,
  `product_id` int(11) NOT NULL,
  `product_type` int(11) NOT NULL,
  `transaction_id` int(11) NOT NULL,
  `store_id` int(11) NOT NULL,
  `foundation_id` int(11) NOT NULL,
  `mano_admin_fees` decimal(10,2) NOT NULL,
  `mano_promotion_fees` decimal(10,2) NOT NULL,
  `paypal_fees` decimal(10,2) NOT NULL,
  `foundation_fees` decimal(10,2),
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();

I am getting following error,

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key

I am googled for this lot and made changes to it but not working,
I also checked magento database table core_resource their is no table called commission
my config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Npm_Commission>
            <version>0.1.0</version>
        </Npm_Commission>
    </modules>
    <global>
        <resources>
            <commission_setup>
                <setup>
                    <module>Npm_Commission</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </commission_setup>
            <commission_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </commission_write>
            <commission_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </commission_read>
        </resources>
        <models>
            <commission>
                <class>Npm_Commission_Model</class>
                <resourceModel>commission_mysql4</resourceModel>
            </commission>
            <commission_mysql4>
                <class>Npm_Commission_Model_Mysql4</class>
                <entities>
                    <commission>

commission

                    </commission>
                </entities>
            </commission_mysql4>
        </models>
    </global>
</config>

Any wrong with my code?
Thanks in advance.:)


texts:
Using magento rest API i can see the data of product, category etc using

https://magentohost/api/rest/products, Here is can see list of products but when i access

https://magentohost/api/rest/orders it says forbidden, I have assined all access to admin and guest but still it does not show it.

http://devdocs.magento.com/guides/m1x/api/rest/Resources/Orders/sales_orders.html

Here is my PHP code which works for product data but when i change products to orders it shows blank array

<?php

$callbackUrl = "http://localhost/magento_navo/rest.php";
$temporaryCredentialsRequestUrl = "http://localhost/magento_navo/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://localhost/magento_navo/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://localhost/magento_navo/oauth/token';
$apiUrl = 'http://localhost/magento_navo/api/rest';

$consumerKey    = '5d93150171fa64e87ae316646f07b0ae';
$consumerSecret = '06b312b7b8ea4e7c6319f00bf49f1e35';

session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
    $_SESSION['state'] = 0;
}
try {
    $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
    $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
    $oauthClient->enableDebug();

    if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
        $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
        $_SESSION['secret'] = $requestToken['oauth_token_secret'];
        $_SESSION['state'] = 1;
        header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
        exit;
    } else if ($_SESSION['state'] == 1) {
        $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
        $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
        $_SESSION['state'] = 2;
        $_SESSION['token'] = $accessToken['oauth_token'];
        $_SESSION['secret'] = $accessToken['oauth_token_secret'];
        header('Location: ' . $callbackUrl);
        exit;
    } else {
        $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
       //$resourceUrl = "$apiUrl/products";
        $resourceUrl = "$apiUrl/orders";
        $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => '*/*'));
        $productsList = json_decode($oauthClient->getLastResponse());
        echo "<pre>";
        print_r($productsList);
    }
} catch (OAuthException $e) {

    print_r($e);

Output:

stdClass Object
(
    [41] => Array
        (
        )

    [42] => Array
        (
        )

    [43] => Array
        (
        )

    [44] => Array
        (
        )

    [46] => Array
        (
        )

    [47] => Array
        (
        )

    [48] => Array
        (
        )

    [49] => Array
        (
        )

    [50] => Array
        (
    )

[51] => Array
    (
    )


texts: cart not getting empty after success page redirection done in magento 2

texts:
How can I empty my cart value when order successfully done in Magento
2. This issue only done with logged-in user how can I handle this issue. Is there any solution for this?


texts: What is the use of [_secure => true] in controller redirect path argument in Magento 2

texts: Anyone can explain to me what is the use of [_secure => true] in controller redirect path arguments in Magento 2.


texts: Background Color Settings for Newsletter Popup

texts:
I have created some buttons in the magento2 backend :
One is for the background color of the popup, the other is for the font color of the popup.
I have tried everything but nothing is working, what can i do?


texts: Merge attributes values so that affected products become part of 1 filterable attribute

texts:
I would like to know how to merge attribute values so that all of the affected products would be part of 1 filterable attribute as apposed to multiple.

Problem: The data sheets I use have multiple entries for the same value, this translates into multiple filterable attribute values for the same value.

Example:

Attribute touch_sensitive
Value YES  (10 products)
Value Yes  (5 products)
Value Y     (2 products)
Value NO   (20 products)
Value No   (1 product)
Value N    (6 products)

Essentially I have 6 different attributes on the front end spread across multiple products that should be really under 2 attributes.

What is the recommended method to merge multiple attribute values?


texts: Magento 2 is removing product image soon after upload and save

texts:
I have recently change the mode from Developer to production and get it ready to work, seems everything correct but all the product images are lost. I am trying to upload the product image again which uploads successfully and shows to the placeholder as it is but as soon as I save the product and check again on the product page in the admin panel, it is not there. Instead, the Magento default logo with 0 bytes is getting shown.
On the other end, if I check frontend, URL looks like this:
http://mywebsite/pub/media/catalog/product/cache/9ab5a8906e55350040c566b7af2f6dda/c/f/cf-msh017.jpg

which actually is 404 in the console.
So, when I check the same in my Magento directory, the path is like this pub/media/catalog/product/c/f
Notice cache/9ab5a8906e55350040c566b7af2f6dda is missing, which I feel should be due to the virtual directory.
Moreover, in f directory, there are no files at all. So, I suspect there should be a permission issue pub/media directory.
So, I did this to the media directory:
sudo chmod -R 777 pub/media

and tried again, but again no luck.
In my exception.log, this is coming:
[2020-08-25 13:55:35] main.WARNING: Cannot gather stats! Warning!stat(): stat failed for /var/www/html/cfnx/pub/media/catalog/product/c/f/cf-msh017.jpg {"exception"
:"[object] (Magento\\Framework\\Exception\\FileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /var/www/html/cfnx/pub/media/catalog/p
roduct/c/f/cf-msh017.jpg at /var/www/html/cfnx/vendor/magento/framework/Filesystem/Driver/File.php:73)"} []


texts: How to send Coupon Codes on customer's Email Id?

texts: I have generated the coupon codes (Promotions > Shopping Cart Price Rule). I am not getting the way, how to send these coupons on customer's mail id's.


texts: How to get products not from the current category in category page?

texts:
I have Sales page as category.

I am using observer (catalog_Product_Collection_Load_Before) to filter products which to be shown in frontend.

But I am getting only products connected to the current category (Sales).

How to modify collection to get other products, not related with current category?


texts: Whether possible to reindex Catalog URL Rewrites for some products?

texts:
Daily 5 to 10 products are uploaded in website. So when we reindex Catalog URL Rewrites, it takes so much time and website becomes slow and down.

I thought is it possible to reindex only 10 products instead indexing all.

Can anyone explain what will be the consequences?

Whether it is safe or not?


texts: How to add custom html renderer in admin form

texts:
How can I add custom html renderer for my for element.

I need a text bux besides it a button which will call ajax when clicking on it to do some random work. How can I implement it.

here is my form field

<fieldset name="General">
            <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                            <item name="label" xsi:type="string"/>
                    </item>
            </argument>
            <field name="product_id">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="label" translate="true" xsi:type="string">product_name</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="source" xsi:type="string">Import</item>
                        <item name="sortOrder" xsi:type="number">10</item>
                        <item name="dataScope" xsi:type="string">product_name</item>
                        <item name="validation" xsi:type="array">
                                <item name="required-entry" xsi:type="boolean">false</item>
                        </item>
                    </item>
                </argument>
            </field>
    </fieldset>


texts:
I need help with getting some values out of my code.So I have my configurable product and it is based on a global attribute "size", it has its own associated products which are the same product in different sizes. I need to somehow call a model or something that will give me the associated products and their label for the attribute "size" for example "xxl".
What I did so far was to get all child products. But the this size value is an Int, and there is no size label variable.

Another thing I'd like to add if it helps: the size variable from child products and the value_index from "size" options are the same.

UPDATE

This is the code and need to insert the label in it and to get it displayed in a foreach as a li element

$product1= Mage::getModel('catalog/product')->load($_product->product_id);
$childProducts = Mage::getModel('catalog/product_type_configurable')
                         ->getUsedProducts(null,$product);

foreach($childProducts as $child) {

    print_r($child->getId());
    print_r($child->getsize());

}