texts: How can get all products of magento estore with their position

texts:
I am getting all products of a magento estore with fields like sku,product_id,price,special_price and product categories .
but I am not getting product position field.
I want to get all products with their positions and categories so that products showing according to magento store on basis  of position also same show on POS app.

for example In my store 10 products with different categories .I need information for each one product like this

array(product_id=>1,
      name=>abc,
      product_categories=>1,2,3,
      price=>10.00,
      position of product=>1
)

similarly I want all products.please help.I tried all ways and solution that are on google.
Below is the code to get all products with their categories but position field not getting.

$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSort('position');
$prodIds=$products->getAllIds();
if(count($prodIds)>0)
{
     $product = Mage::getModel('catalog/product');
     $i=0;
     foreach($prodIds as $productId)
     {
         $ids= array();
         $productCollection = Mage::getModel('catalog/product')->load($productId);
         $final['prodCat_list'][$i]['sku']= $productCollection ->getSku();
         $final['prodCat_list'][$i]['product_id']= $productId;
         $final['prodCat_list'][$i]['name']= $productCollection ->getName();
         $final['prodCat_list'][$i]['image']=$productCollection ->getThumbnailUrl();
         $final['prodCat_list'][$i]['description']=$productCollection ->getDescription();
         $final['prodCat_list'][$i]['short_description']=$productCollection ->getShortDescription();
         $final['prodCat_list'][$i]['weight']=$productCollection ->getWeight();
         $final['prodCat_list'][$i]['created_at']=$productCollection ->getCreatedAt();
         $final['prodCat_list'][$i]['updated_at']=$productCollection ->getUpdatedAt();
         $final['prodCat_list'][$i]['price']=$productCollection ->getPrice();
         $final['prodCat_list'][$i]['special_price']=$productCollection ->getSpecialPrice();
         $final['prodCat_list'][$i]['tax_class_id']=$productCollection ->getTaxClassId();
         $final['prodCat_list'][$i]['cat_id']= implode(',',$productCollection ->getCategoryIds());
         $ids[$i]=$result[$i]['category_ids'];
         foreach($productCollection ->getCategoryIds() as $categoryId)
         {
             $category = Mage::getModel('catalog/category')->load($categoryId);
             $final['prodCat_list'][$i]['cat_name'][$categoryId]= $category->getName();
         }
         $i++;
     }
}


texts: Customer Deleted; Get old Order History back

texts:
Customer deleted in Magento from Backend accidentally.

Created a new Customer in Magento Backend to recover Customer.

But how to add the old Order History?

UPDATE
sales_flat_order
SET customer_id = 12345
WHERE
customer_email = 'customer@example.org'

Old Order now has the new customer_id but Magento Backend does not show this Order in Order-History???

  Q: How to connect Orders to a Customer in SQL??


texts: Magento2.3: How to upload profile picture and show it on My Account dashboard?

texts:
We have customized the My Account dashboard with our own design. Now we wanted to implement the profile picture option while the customer do the registration.

After the registration, in My Account dashboard, we want to show that image as in below attachment marked as red.

How can I do this in Magento 2?

Any help will be appreciated.


texts: Two Checkout page in Magento is it possible?

texts:
Is there any way to create two checkouts in Magento.
Can anyone tell me the procedure or reference link to this?
I have searched on google but I am not getting any result.


texts: How to check is jQuery available for my module?

texts:
Magento as far as I know have it already loaded but jQuery functions won't work in my module.
What can I do with it ? How can I make sure I have an access to it ?
I would like to avoid jQuery conflicts.


texts: How do I access the Magento system config?

texts:
I've just recently installed Magento 2.0.2 (I'm new to Magento) and have been following some tutorials and documentation to do it.

I've noticed that a lot of screenshots and tutorials ask to go to System > Configuration but when I log into my Magento admin, there is no such option (screenshot below). I tried to go into Web Setup Wizard where is asked me for a public/private access key which I generated and entered, now when I go into the Web Setup Wizard, it just shows this (screenshot 2 below).

I don't know what to do, can anyone please enlighten me?


texts: Issue with adding new checkout field when signed in and checking out as guest

texts:
Before I hack this with javascript will ask for help.  I have added a new custom address field "county" and set it to be required in the add attribute.  If I log in and do not enter default addresses and check out as guest I am presented with an address form to complete.  No issue, the new field is present, Im allowed to enter and it is validated.  I then click next where Im taken to the page where I place the order.  The address is displayed and it displays the custom address field.  When I press "place order" I get an error message stating that County is a required field.
I am able to complete checkout as a guest that is not logged in.  If I log in and add a default address I can also check out fine.
Can someone please help with a solution or please point me to a module that would be doing the verification so I can debug.
To recall, Im on the last page of checkout where I place the order.  Ive already completed the form successfully that has the custom field included.  The address is displayed with the custom field on this page.  When I click place order, apparently there is another validation that takes place that is not seeing the required field.  BTW if I make the field not required Im able to complete order.
Thanks in advance for any help ....


texts: Get stock items based on simple product id

texts:
I'm fairly new to Magento and came across a situation where I need to get data (specifically available quantity) of all simple products connected to its configurable product.

I've managed to get the id's of the simple products like this:

$simpleProductIds = Mage::getModel('catalog/product_type_configurable')->getUsedProductIds($product);

This gives me an array with all the ids of the simple products linked to the configurable product.
But now I'd like to get the quantities of all these simple products (to put in array and later check their availability, as requirement due to custom add to cart action).
I'd like to do this in a single request so as to minimize the load.

What I've got so far (and doesn't work), is the following:

$stockItemCollection = Mage::getModel('cataloginventory/stock_item')->getCollection()
            ->addAttributeToFilter('product_id', array('in' => $simpleProductIds));

I've also tried it with ->addAttributeToSelect and both versions with the following after it:

->joinField(
    'qty',
    'cataloginventory/stock_item',
    'qty',
    'product_id=entity_id',
    '{{table}}.stock_id=1',
    'left'
 );

(as found in this entry)

So far none of these things have yielded any results. What am I missing/doing wrong?

Please note that once I have the simple product ids (which works as desired), I want to get all the simple products with only one database call, which I know is possible, somehow (if all of this can be done with just one database call, instead of first getting all the id's, that would be even better).

Any wizard know this magic spell? Many thanks.


texts: Changed category name but new name is not showing on front-end

texts:
I changed a category name, refresh and flush all cache and reindex some related category

but on front-end, the new name is not showing and old name is still showing

(it seems changing url is working)

Delete all files on var/cache and var/sessions

What I have to do or check more to show new category name on front-end?


texts: Magento 2.2- stop newsletter popup to display on all pages

texts:
I am using cleversoft novetty theme.
My newsletter pop-up appears on all pages that's so irritating. I want it to display only once at homepage whenever someone visits my site.
here is the coding of default.xml :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="head.components">
        <block class="Magento\Framework\View\Element\Js\Components" name="newsletter_head_components" template="Magento_Newsletter::js/components.phtml"/>
    </referenceBlock>
    <referenceContainer name="footer">
        <block class="Magento\Newsletter\Block\Subscribe" name="form.subscribe" as="subscribe" before="-" template="subscribe.phtml"/>
    </referenceContainer>
</body>

What can I change in this so that it displays only on front page and not on all pages?


texts:
I have installed fr_FR package in magento2 site. But in detail page and checkout page I am getting error like below,

    [2018-03-24 13:10:46] main.CRITICAL: exception 'Zend_Locale_Exception' with message 'No localized value in 0.2750 found, or the given number does not match the localized format' in /home/Sites/vendor/magento/zendframework1/library/Zend/Locale/Format.php:255
Stack trace:
#0 /home/Sites/vendor/magento/zendframework1/library/Zend/Measure/Abstract.php(202): Zend_Locale_Format::getNumber('0.2750', Array)
#1 /home/Sites/vendor/magento/zendframework1/library/Zend/Measure/Abstract.php(99): Zend_Measure_Abstract->setValue('0.2750', 'KILOGRAM', 'fr_FR')
#2 /home/Sites/vendor/magento/module-shipping/Helper/Carrier.php(92): Zend_Measure_Abstract->__construct('0.2750', 'KILOGRAM', 'fr_FR')
#3 /home/Sites/app/code/Custom/Shipment/Helper/AbstractHelp.php(609): Magento\Shipping\Helper\Carrier->convertMeasureWeight('0.2750', 'KILOGRAM', 'KILOGRAM')
#4 /home/Sites/app/code/Custom/Shipment/Helper/Data.php(73): Custom\ShipmentHelper\AbstractHelp->getConvertedWeight('0.2750')
#5 /home/Sites/app/code/Custom/Shipment/Model/Carrier.php(1922): Custom\Shipment\Helper\Data->getBoxForItems(Array)
#6 /home/Sites/vendor/magento/module-shipping/Model/Shipping.php(293): Custom\Shipment\Model\Carrier->collectRates(Object(Magento\Quote\Model\Quote\Address\RateRequest))

Due to this error shipping is not working please tell me any thing I need to add number format in that language csv file?


texts:
I need to retrieve an order in Magento by its Id. How do I load a specific order by Id?

So far I've gotten the initial query constructed:

Mage::getModel('sales/order');


texts: Attributes assigned globally to advanced search/page sorting/layered navigation on two of my websites. How do I assign them manually?

texts:
I've created two websites, but they will be using two different attribute sets. The products are working fine, as they're only using the attribute set assigned to them. The major issue I'm facing is that all of the attributes I've created, or whenever I create a new attribute, it shows up in advanced search, page sorting, and layered navigation for both sites. I set the attributes scope to "website" or "store", but there's no option to assign it to a specific store or website.
What am I doing wrong and is there a fix for this? I'm having a hard believing Magento allows you to create multiple sites and stores on the same admin, but assigns all the attributes globally no matter what.
Example:

Attribute Set: 1, 2, 3 -
Attribute Set: 4, 5, 6

Right now layered navigation looks like this:
Website #1:

Attribute 1
Attribute 2
Attribute 3
Attribute 4
Attribute 5
Attribute 6

Website #2:

Attribute 1
Attribute 2
Attribute 3
Attribute 4
Attribute 5
Attribute 6

When it should looks like this:
Website #1:

Attribute 1
Attribute 2
Attribute 3

Website #2:

Attribute 4
Attribute 5
Attribute 6

If I change the settings in an attribute to show in advanced search, page sorting, and layered navigation, it automatically assigns them to both sites, which makes no sense.  I'm using Porto for one website, and Ultimo for the other. Any thoughts?


texts: who can help me with this issue we can't save the customer


texts: get current cart items to my custom checkout step magento2

texts:
I created a custom checkout step as per the devdocs , now I need to get current cart items to my custom checkout step, how can I do that ?

checkout_index_index.xml

<item name="my-new-step" xsi:type="array">
    <item name="component" xsi:type="string">Amsi_UserManagement/js/view/select-student-view</item>
    <item name="sortOrder" xsi:type="string">1.5</item>
</item>

view/frontend/web/js/view/select-student-view.js

define(
    [
        'ko',
        'uiComponent',
        'underscore',
        'Magento_Checkout/js/model/step-navigator'
    ],
    function (
        ko,
        Component,
        _,
        stepNavigator
    ) {
        'use strict';
        return Component.extend({
            defaults: {
                template: 'Amsi_UserManagement/selectstudent'
            },
            isVisible: ko.observable(true),e: function () {
                this._super();
                stepNavigator.registerStep(
                    'select_student_step',
                    'select_student_step',
                    'Select Student',
                    this.isVisible,

                    _.bind(this.navigate, this),
                    15
                );

                return this;
            },

            navigate: function () {
                console.log('navigation is good');
            },
            navigateToNextStep: function () {
                stepNavigator.next();
            }
        });
    }
);


texts:
When I upload a picture in my back end I just get this:

I guess it happens after I installed a patch. As I try to click the "little broken picture" I get redirected to a site saying "403 forbidden".
Any ideas what to do.
Regards
Jesper


texts: How to reload the price programmatically in Magento 2

texts:
i magento 2 in product view page based on some condition or input my SpecialPrice will be changed

so i follow below code in Block file but it return the old SpecialPrice , how to fix this issue

echo $block->getPriceHtml($_product, true);
echo $this->getCustomProductPrice($product);

in block

public function getCustomProductPrice(){
  $product->setSpecialPrice(40);
  return $this->getPriceHtml($_product, true);
}

but it show old price only


texts: We have lots of stores from Magento 1, ready to move in Magento 2. How was your experience with Magento v2 since it was released 2 years ago?


texts: Magento 2 - price calculation for different currencies

texts:
I use two different currencies on my Magento 2 shop - DKK and SEK.
I have two different website Danish and Swedish, with DKK as base currency for Danish website, and SEK as base currency for Swedish website.

I've set currency rate to 1 DKK = 1.28 SEK.

All products have only one price which is DKK in admin.

How ever, I need to use DKK (instead of SEK) as base currency for the Swedish website. And when I do this, the price on the front-end (swedish site) is wrong, it multiplies the currency rate 1.28 twice. how does this happened? and Where in the code should I change if I want to force the system to only multiply the currency rate once?


texts: Remove empty categories from magento menu

texts:
(Apologies for posting this here, and if people think this should be deleted, please do.

I posted this question on stackoverflow, having completely forgotten this forum, which of course is more appropriate for a Magento question. I'd prefer to move it here but... how?!

In order to keep only one version, I've posted the link to it here.

https://stackoverflow.com/questions/22822997/remove-empty-categories-from-magento-menu

Btw, I found an answer although I'm sure it can be improved.)

I want my main menu to not include any categories that are empty. I've done this for the layered navigation very easily in the relevant phtml file by using

$_category->getProductCount().

However, for the navigation menu, I'm finding it impossible to do this as easily (I have seen the Prattski example but it does seem rather OTT).

The main menu seems to be built in Mage_Page_Block_Html_Topmenu.php, specifically in the function _getHtml. This gets all the children in the menu and if I try something like $child->getId(), I get something like category-node-36.

It doesn't seem like I'm too far from being able to use getProductCount() and so test if it's more than zero.

Is it possible to do this? Can somebody point me to how?

If I can, I'll extend the class with my version.


texts:
I can pretty easily remove various blocks from a given page through an event observer on, for instance, the controller_action_layout_general_blocks_before action. Here is an example:

    $action = $observer->getEvent()->getAction();
    $layout = $observer->getEvent()->getLayout();
    $update = $layout->getUpdate();

    $update->addUpdate('
        <reference name="product.info">
            <remove name="product.info.addtocart" />
        </reference>
    ');

    $layout->generateXml();

However, I can't find a way to remove the price block, even straight from the catalog.xml file. It seems like Mage_Catalog_Block_Product->getPriceHtml($product) creates the block dynamically. (I think it ultimately uses Mage_Catalog_Block_Product_Abstract->_getPriceBlock() which is in a file I can't really override.)

My goal here is to remove the price block from catalog view pages in certain situations, but I can't seem to remove that block. Instead, it seems I have to change the template file itself, which I want to avoid doing for this particular task.

(Magento 1.9.0.1)

This is the solution that I came up with Fabian Blechschmidt's help.

In my config.xml

<frontend>
    <events>
        <core_block_abstract_to_html_before>
            <observers>
                <custom_to_html_before>
                    <class>mymodule/observer</class>
                    <method>coreBlockAbstractToHtmlBefore</method>
                </custom_to_html_before>
            </observers>
        </core_block_abstract_to_html_before>
    </events>
</frontend>

In my observer model

public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer) {
    // Simple example logic
    $hidePrice = true;

    $block = $observer->getBlock();

    if (get_class($block) == 'Mage_Catalog_Block_Product_View') {
        if ($hidePrice) {
            $block->getProduct()->setCanShowPrice(false);
        }
    }
}


texts: Magento 2.3 - multistore - Incorrect store view loaded for some products

texts:
I have a Magento 2.3 store with several store views for different languages, accessed via site.com/it, site.com/fr etc etc

See below:

The majority of products are accessible on all views but some are restricted to base only.

I'm having an issue where if a product is only assigned to the base store view, the site will load it in an incorrect store view. In most cases it loads it in Italian. Interestingly, if I go to the same url with the IT store code (e.g. if the problem url is domain.com/product, I go to domain.com/it/product) it 404's.

The funny thing is, I don't know why it's choosing a particular store view to load as default. There's no reason why Italian is treated as the store to display (as it alongside French and Netherlands has a sort order of 0).

Other things I have noticed:

If I change the theme to base, the issue still occurs
If I assign a product to more than 1 store view (for example base and italian) it loads the correct store view
getCurrentStoreCode(); in the language switcher returns the incorrect store code, but $store->getWebsite()->getCode()(from a custom extension) loads the correct code.

If anyone can shed some light on this, I would be most grateful. I have a feeling it could be how the stores are set up, but I'm fairly certain I've done it correctly.


texts: How to hide/ disable notices or warning in magento 1.8 ?


texts: Magento 2, how to deploy the content for specific area only (frontend or adminhtml) as requested parameter but in two languages

texts:
To save time when each time I need to deploy the content for changes in one area, how can I provide for example "adminhtml" as argument to be deployed in two languages? Below did not work:

bin/magento  setup:static-content:deploy adminhtml en_US nl_NL


texts: Magento Add To Cart Multi Product at a time

texts: How to add multi product into cart in magento.


texts: 301 redirect http links to corresponding https links

texts:
We are using the SSL securing the whole site now. At the admin end, unsecure and secure URL are all in the form of https.

Now the issue we are facing right now is, for example, the link "http://www.example.com/abc" is 301-redirected to "https://www.example.com". The correct way is to redirect to "https ://www.example.com/abc

Anyone can share the idea the correct way to do it?

Thanks!


texts: Correct way of creating custom SOAP API magento2

texts:
Please correct the below for creating custom SOAP API.

\Vendor\Module\etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <preference for="Vendor\Module\Api\Data\QueueInterface" type="Vendor\Module\Model\Queue" />
</config>

Vendor\Module\etc\webapi.xml

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/sync/getProduct/:limit" method="GET">
    <service class="Vendor\Module\Api\QueueRepositoryInterface" method="getProductUpdate"/>
    <resources>
        <resource ref="anonymous" />
    </resources>
</route>

Vendor\Module\Api\QueueRepositoryInterface.php

namespace Vendor\Module\Api;

/**
 * Vendor\Module CRUD interface.
 * @api
*/
interface QueueRepositoryInterface
{
   public function getProductUpdate($limit);
}

Here is my doubt

Is my Data file correcT?

Vendor\Module\Api\Data\QueueInterface.php

<?php

namespace Magento\Sales\Api;

interface OrderRepositoryInterface
{
   public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria);

   public function get($id);

   public function delete(\Magento\Sales\Api\Data\OrderInterface $entity);

   public function save(\Magento\Sales\Api\Data\OrderInterface $entity);
}

Vendor\Module\Model\Queue.php

namespace Vendor\Module\Model;

use Magento\Framework\Model\AbstractModel;
use Magento\Framework\DataObject\IdentityInterface;
use Vendor\Module\Api\Data\QueueInterface;

 class Queue extends AbstractModel implements QueueInterface,IdentityInterface
 {
    public function getProductUpdate($limit)
    {
    //echo 'getproductudate';die;
    if(!isset($limit))
    {
        return json_encode(array("result"=>false,"message" => 'Argument is missing'));
    }

    if(!$this->_status)
    {
        return json_encode(array("result"=>false,"message" => 'Vendor\Module Plugin is disabled'));;
    }

    if($this->_bulkImport == "enable")
    {
        return json_encode(array("result"=>false,"message" => 'Bulk Product Import in progress, Please try again later'));;
    }

    $data = $this->_helper->getProductUpdate($limit);
    if(isset($data))
    {
        return json_encode(array("result" => true,"data" => $data));
    }

    return json_encode(array("result" => false,"message" => "Record not found"));
}
}

In my URL i tried:

http://localhost:1338/magento2x_3/soap/default?wsdl&services=moduleQueueRepositoryV1

I get

exception 'Exception' with message 'Report ID: webapi-57a85520a7648; Message: Requested service is not available: "syncQueueRepositoryV1"'


texts: magento 2 do not send Order mail for failed payment

texts:
i have added some payment gateway modules, where my payment was failed still "Order mail" goes to user, is there way to stop this when payment gets failed.

I can not see any option in admin for it . Please help.


texts: Maximum execution time of 10 seconds exceeded in Magento

texts: Fatal error: Maximum execution time of 10 seconds exceeded in C:\xampp\htdocs\magento\lib\Zend\Db\Statement\Pdo.php on line 228 this error coming in loading magento site in localhost. when reloading some part of webwite is coming with the same error.


texts:
I Need a module or solution that can change Magneto2.1.9 URL generator.Actually want my URL to be like

This https://www.example.com/folder/product-name-SKU

the folder is my stores.

Right now it generates just by name(not name and SKU) by default.

If anybody knows about google Search Engine Optimization new URL structure.


texts: How to add Custom fields to sales_flat_order in magento

texts:
I am new to magento, If I want to add custom fields to sales_flat_order table how Can I do?

sales_flat_order

sales_flat_order_address

sales_flat_order_grid

sales_flat_order_item

sales_flat_order_payment

sales_flat_order_status_history

there are 6 tables are link up one to another. So if I want to add custom field/column to sales_flat_order table.

Is there required to add another 5 tables to reference field/column? please guide me in-detail?

guide/suggest me what is the relation between those 6 tables how it forms together at the run time when saving/updating/deleting/reading orders.

Thanks.


texts: How to programmatically add custom options to all products without duplication?

texts:
I have over 40,000 products in store and am trying to add custom options to all. The script below works fine, but stops after about 1000 products, then starts again.. making duplicates rather than continuing to next products.

What would be the best way to check if product has option with title "Request Samples?". If so, skip and go to next (if else statement)?

Here is the code I have:

require_once 'app/Mage.php';
umask(0);

Mage::app('admin');

set_time_limit(0);

$option = array(
    'title' => 'Request Samples?',
    'type' => 'drop_down',
    'is_require' => 0,
    'sort_order' => 0,
    'values' => getOptions()
    );

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

foreach ($collection as $product_all) {

        $sku = $product_all['sku'];

        // retrieve product id using sku
        $product_id = Mage::getModel('catalog/product')->getIdBySku($sku);

        //Add option for to all products
        $product = Mage::getModel('catalog/product')->load($product_id);
        $optionInstance = $product->getOptionInstance()->unsetOptions();
        $product->setHasOptions(1);
        $optionInstance->addOption($option);
        $optionInstance->setProduct($product);
        $product->save();
        unset($product);
        echo "Done";
}

    function getOptions(){
       return array(
       array(
        'title' => 'Yes',
        'price' =>0,
        'price_type' => 'fixed',
        'sku' => 'samples001',
        'sort_order' => '1'
        )
    );
}


texts: Using product list widget to just show price?

texts: How can I use a product list widget to just show the price of the product on an cms page.


texts: Get custom image attribute from category

texts:
How do I get a custom attribute from a category? I created an attribute in category_form.xml file and in the back-end I filled the field. But how do I get the field's value?

Thanks


texts: SQLSTATE[08004] [1040] Too many connections

texts: I'm getting this error. There is no my.cnf file in my etc/ directory. What do i have to do?


texts: Using a REST API can I find out which warehouse shipped the order

texts:
We have a multi-warehouse configuration and as a result of some complex intra-company charging we need to understand from which warehouse any given order was shipped from.

So far I have been unable to locate a REST API in the documentation that will provide that information.

Any help will be gratefully received.


texts: Can't change customer group when creating order in admin for new customer

texts: I have Magento 2.3.3 and when creating a new order in admin for a new customer I can't change the customer group from dropdown. It just reloads back to the first selection no matter what is selected.


texts: Block does not appear when using custom type, but appears with core/template

texts:
New to Magento. Trying to write a custom block and just make it show up at the most basic level. Been going crazy for two days, comparing my work to those of the other modules we are using plus research.

I think the issue lies somewhere with Magento not recognizing the block as being part of the global config. I need the block just to appear when I place it in local.xml!

At app\code\local\Csos\Spuritem\etc\config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <Csos_Spuritem>
            <version>0.1.0</version>
        </Csos_Spuritem>
    </modules>

    <global>
        <blocks>
            <spuritem>
                <class>Csos_Spuritem_Block</class>
            </spuritem>
        </blocks>
    </global>
</config>

The block definition app\code\local\Csos\Spuritem\Block\Item.php:

<?php

class Csos_Spuritem_Block_Item extends Mage_Core_Block_Abstract {

}

When I use print_r(Mage::getConfig()->getNode()->xpath('//global//blocks')); shows that my module is active:

[spuritem] => Mage_Core_Model_Config_Element Object
                (
                    [class] => Csos_Spuritem_Block
                )

In frontend\base\default\layout\local.xml,

<layout version="1.0">
    <default>
        <reference name="content">
            <block type="spuritem/item" name="spuritem.forever" template="csos/spuritem/spuritem.phtml"/>
            <block type="core/template" name="showit" template="csos/showme.phtml" />
        </reference>
    </default>
</layout>

and finally, app\design\frontend\base\default\template\csos\spuritem\spuritem.phtml

This is where my stuff will go.

In the current state, this produces nothing on the homepage. However, if in the local.xml I change

I have allowed block permissions in the back end for "spuritem/item".

<block type="spuritem/item" name="spuritem.forever" template="csos/spuritem"/>

to

<block type="core/templatem" name="spuritem.forever" template="csos/spuritem"/>

The homepage will produce the text as expected.

What am I doing wrong?


texts: How to get all products from an array of specific categories and grouped by the categories

texts:
I am trying to retrieve a list of product from an array of specific categories IDs and group by its category.

In this way, I retrieve all product in the root Category:

$collection = Mage::getResourceModel('catalog/product_collection')
      ->addAttributeToFilter('status', 1) // enabled
      ->addAttributeToSelect(array('name', 'price', 'small_image'))
      ->addUrlRewrite();
foreach ($collection as $item) {
    echo $item->getName();
}

Then I saw in another post, that it is possible to get products from specific category, in this way:

$storeId = Mage::app()->getStore()->getId();
$categoryIds = $catIds; Array = [23,24,25,27,30]
$productCollection = Mage::getModel('catalog/product')->getCollection();

$joinConditions = array(
  'cat_index.product_id=e.entity_id',
  $productCollection->getConnection()->quoteInto('cat_index.category_id IN (?)', $categoryIds),
  $productCollection->getConnection()->quoteInto('cat_index.store_id=?', $storeId)
);
$productCollection->getSelect()->join(
  array('cat_index' => $this->getTable('catalog/category_product_index')),
  $joinConditions,
  array('cat_index_position' => 'position')
);

$productCollection
    ->addStoreFilter()
    ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
    ->addMinimalPrice()
    ->addFinalPrice()
    ->addTaxPercents()
    ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
    ->addUrlRewrite();

But unfortunately I cannot adapt this last code to my initial one.
Any help would be appreciated a lot.

UPDATE

This is what I have now:

$storeId = Mage::app()->getStore()->getId();
$categoryIds = array('42','43','44','45','46','47');
$productCollection = Mage::getModel('catalog/product')->getCollection();

$joinConditions = array(
    'cat_index.product_id=e.entity_id',
    $productCollection->getConnection()->quoteInto('cat_index.category_id IN (?)', $categoryIds),
    $productCollection->getConnection()->quoteInto('cat_index.store_id=?', $storeId)
);
$productCollection->getSelect()->join(
    array('cat_index' => $this->getTable('catalog/category_product_index')),
    $joinConditions,
    array('cat_index_position' => 'position')
);

$productCollection
    ->addAttributeToFilter('status', 1)
    ->addAttributeToSelect(array('name', 'price', 'small_image'))
    ->addUrlRewrite();

foreach ($productCollection as $item) {
  echo $item->getName();
}

Unfortunatelly I have an error:

  THERE HAS BEEN AN ERROR PROCESSING YOUR REQUEST Exception printing is
  disabled by default for security reasons.

  Error log record number: 1276294659917


texts: Magento 2 - The shipping method is missing. Select the shipping method and try again

texts:
I am trying to set the Shipping Method Programatically on place Order using Below code . But I am Getting Error

For your Reference I am Using https://github.com/magestat/magento2-split-order/
Code

message: "The shipping method is missing. Select the shipping method and try again."

/**
 * Places an order for a specified cart.
 *
 * @param QuoteManagement $subject
 * @param callable $proceed
 * @param int $cartId
 * @param string $payment
 * @return mixed
 * @throws LocalizedException
 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
 * @see \Magento\Quote\Api\CartManagementInterface
 */
public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
{
    $currentQuote = $this->quoteRepository->getActive($cartId);
    // Separate all items in quote into new quotes.
    $quotes = $this->quoteHandler->normalizeQuotes($currentQuote);
    if (empty($quotes)) {
        return $result = array_values([($proceed($cartId, $payment))]);
    }
    // Collect list of data addresses.
    $addresses = $this->quoteHandler->collectAddressesData($currentQuote);
    /** @var \Magento\Sales\Api\Data\OrderInterface[] $orders */
    $orders = [];
    $orderIds = [];
    $orderSrNo = 1;
    $this->checkoutSession->setOrderSrNO($orderSrNo);
    foreach ($quotes as $items) {
        /** @var \Magento\Quote\Model\Quote $split */
        $split = $this->quoteFactory->create();
        // Set all customer definition data.
        $this->quoteHandler->setCustomerData($currentQuote, $split);
        $this->toSaveQuote($split);
        // Map quote items.
        foreach ($items as $item) {
            // Add item by item.
            $item->setId(null);
            $split->addItem($item);
        }
        $this->quoteHandler->populateQuote($quotes, $split, $items, $addresses, $payment);
        // Dispatch event as Magento standard once per each quote split.
        $this->eventManager->dispatch(
            'checkout_submit_before',
            ['quote' => $split]
        );

        $this->helperData->writeLogger('$split->getShippingAddress()->getShippingMethod()');
        $this->helperData->writeLogger(json_encode($split->getShippingAddress()->getShippingMethod()));
        $split->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');
        $split->getShippingAddress()->setCollectShippingRates(true);

        $this->toSaveQuote($split);
        $order = $subject->submit($split);
        $orders[] = $order;
        $orderIds[$order->getId()] = $order->getIncrementId();
        $orderSrNo++;
        $this->checkoutSession->unsOrderSrNO();
        $this->checkoutSession->setOrderSrNO($orderSrNo);

        if (null == $order) {
            throw new LocalizedException(__('Please try to place the order again.'));
        }
    }
    $currentQuote->setIsActive(false);
    $this->toSaveQuote($currentQuote);
    $this->quoteHandler->defineSessions($split, $order, $orderIds);
    $this->eventManager->dispatch(
        'checkout_submit_all_after',
        ['orders' => $orders, 'quote' => $currentQuote]
    );
    return $this->getOrderKeys($orderIds);
}
/**
 * Save quote
 *
 * @param \Magento\Quote\Api\Data\CartInterface $quote
 * @return \MyModule\SplitOrder\Plugin\SplitQuote
 */
private function toSaveQuote($quote)
{
    $this->quoteRepository->save($quote);
    return $this;
}
/**
 * @param array $orderIds
 * @return array
 */
private function getOrderKeys($orderIds)
{
    $orderValues = [];
    foreach (array_keys($orderIds) as $orderKey) {
        $orderValues[] = (string) $orderKey;
    }
    return array_values($orderValues);
}


texts: About Advantages of js & css merge , minify in magento 2?


texts: admin dashboard - load other language by default

texts:
I'm using other frontend language for Magento, but I like to load us_US language by default for admin area. The problem is that it always switches to the frontend locales (after each login).
How to load always/by default us_US language for admin ?

Thanks for help
Tomek


texts: customer_address_save_before event and normalizing customer input with error notices

texts:
I have enabled customer address entry during account creation via flag in local.xml:

<customer_account_create>
    <reference name="customer_form_register">
        <action method="setShowAddressFields">
            <value>true</value>
        </action>
    </reference>
</customer_account_create>

I also have an observer being called before address save (and depends on Mage_Customer during module load):

<customer_address_save_before>
    <observers>
        <mymodule>
            <class>mymodules/observer</class>
            <method>normalizeAddress</method>
        </mymodule>
    </observers>
</customer_address_save_before>

My observer intends to swap data in the event's object, basically:

$helper = Mage::helper('mymodule');
$observer->getCustomerAddress()->setRegion($helper->normalize($observer->getCustomerAddress()->getRegion()));
$observer->getCustomerAddress()->setCity($helper->normalize($observer->getCustomerAddress()->getCity()));

This is wonderful. I love my module. Except, now there is the problem of error handling. My helper's normalize() method receives a response where an error number and message might be included in the object along with original values, otherwise it contains the normalized values.

If there is an error message at this point, I'd like to stop and redirect the user back to the form page and include the response's error message as a error notice to the user (and abandon saving the customer):

if ($response->hasErrorMessage()) {
    Mage::getSingleton('customer/session')->addError($response->getErrorMessage());
    Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/create'));
}

However, trying this fails (customer is saved with unnormalized data) as what I believe is happening is the redirect is being modified later on, I assume by customer_address_save_after event. I haven't really dug into that.

I'm really not sure what I'm looking for here, but it seems there should be a way to flag the address with an error that will prevent it from saving (similar to how the core handles a new account if someone enters an email address that already exists), I just can't seem to track down where this is handled in Magento, or more specifically, I can't seem to track down how these errors might be set on the address object.


texts:
category page grid mode active class add but click list mode active class not add in magento 2.3.5-p2

viewmode.phtml

 <?php
 /**
 * Product list toolbar
 *
 * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar
 */
    ?>
<?php if ($block->isEnabledViewSwitcher()) :?>

    <?php $_modes = $block->getModes(); ?>
    <?php if ($_modes && count($_modes) > 1) :?>
        <?= $block->escapeHtml(__('View as')) ?>
        <?php foreach ($block->getModes() as $_code => $_label) :?>
            <?php if ($block->isModeActive($_code)) :?>
                <strong title="<?= $block->escapeHtmlAttr($_label) ?>"
                        class="modes-mode active mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"
                        data-value="<?= $block->escapeHtmlAttr(strtolower($_code)) ?>">
                    <?= $block->escapeHtml($_label) ?>

            <?php else :?>
                <a class="modes-mode mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"
                   title="<?= $block->escapeHtmlAttr($_label) ?>"
                   href="#"
                   data-role="mode-switcher"
                   data-value="<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"
                   id="mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>"
                   aria-labelledby="modes-label mode-<?= $block->escapeHtmlAttr(strtolower($_code)) ?>">
                    <?= $block->escapeHtml($_label) ?>

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


texts: I have multi-vendors and each one has thousands of products and each product has at-least one image URL. we've imported their CSV file to our Magento 1.9 and looks like there are bunch of broken links. would anybody can help me what is the best way to validate those URL links.


texts: Homepage only displays correctly when logged in

texts:
I just disabled a new extension due to some conflicts it had with a custom extension we have installed. Immediately after, I noticed the website was much slower, and after checking the cache, I noticed that all but compiled_config were disabled. I re-enabled them, and now much homepage doesn't display unless I'm logged in to the website. Any ideas on how to resolve this? I redisabled the applicable caches, but no luck.

Thank you all for your time.


texts: How to get invoice_Id or invoice in Magento2 after order is placed using REST API

texts: After order is placed i am getting order_id and how can i get invoice of placed order (or) invoice_id after order is placed using Magento REST API.


texts: Cannot remove ".html" from URL in Magento 2

texts:
I am trying to remove ".html" from the URL. Attached are my catalog SEO setting in the Magento 2. As you can see I have remove the ".html" from both Category URL Suffix and Product URL Suffix.

I'm stumped as to why it still shows the .html at the end. I have cleared all caches and reindexed all indexes.


texts: New Extensions not going in Community Folder?

texts:
I have recently moved a complete Magento installation to a new server. While I was debugging some issues, I noticed the community extensions were not listed in the MagentoConnect Manager.

When I went to install a new extension, its code files were not added to the app/code/community folder, but it did install successfully, but I have no idea where it put the code files!

Any thoughts as to what could be going on here?


texts: How to generate invoice pdf in checkout page magento 1.9.1.0?

texts:
I need to generate invoice pdf in checkout page. Payment method Bank Transfer for Indian Customer. Any Idea about it?

Success page:-
/app/design/frontend/themes/default/template/checkout/success.phtml:-

<?php #echo $this->__('Your order will be delivered over email shortly.') ?>

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('success_page')->toHtml() ?>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<?php #echo $this->__('Thank you for your purchase!') ?>
<?php if ($this->getOrderId()):?><?php if ($this->getCanViewOrder()) :?>
<?php echo $this->__('Your order # is: %s.', sprintf('%s', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?>
<?php  else :?>
<?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?>
<?php endif;?>
<?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?>
<?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>

 <?php echo $this->__('Click here to print a copy of your order confirmation.', $this->getPrintUrl()) ?>
    <?php echo $this->getChildHtml() ?>
    <a href="<?php echo $this->getUrl('invoice/index/print', array('invoice_id' => $_invoice->getId())); ?>">Download Pdf

<?php endif;?><?php endif;?><?php if ($this->getAgreementRefId()): ?>
<?php echo $this->__('Your billing agreement # is: %s.', sprintf('%s', $this->escapeHtml($this->getAgreementUrl()),$this->escapeHtml($this->getAgreementRefId())))?>
<?php endif;?><?php if ($profiles = $this->getRecurringProfiles()):?>
<?php echo $this->__('Your recurring payment profiles:'); ?>

<?php foreach($profiles as $profile):?><?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('%s', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>

<?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?>
<?php endforeach;?>
<?php endif;?>
<button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><?php echo $this->__('Continue Shopping') ?></button>


texts: display "print pdf" button on order view page in admin panel

texts:
In magento admin panel, on invoice view page, we can see there is "print pdf" option.

we want to display "print pdf" on order view page.


texts: How to open registeration form on category click

texts:
When Guest user click on any category it redirect to create account page.
How to achieve this ?
Please help me.


texts: Add image options programmatically in custom attribute not working

texts:
I want to add new custom option to upload image like extension : https://shop.emiprotechnologies.com/documentation/custom-option-image-for-magento-2 . So basically , i override some file to add new custom and function to upload, but image not save in pub/media and save name file on database

1. Create module :
2. Declare your new product option :  app/code/Vendor/Module/etc/product_options.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
    <option name="select" label="Select" renderer="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Select">
        <inputType name="gallery" label="Thumb Gallery" />
        <inputType name="gallery_popup" label="Thumb Gallery Popup" />
        <inputType name="gallery_multi_select" label="Thumb Gallery Multi Select" />
        </option>

</config>

3. Override file Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions to add new custom option :
app/code/Vendor/Module/etc/di.xml :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions" type="Vendor\Module\Ui\DataProvider\Product\Form\Modifier\CustomOptions" />
</config>

app/code/Vendor/Module/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

<?php

namespace Vendor\Module\Ui\DataProvider\Product\Form\Modifier;

use [...];

class CustomOptions  extends \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier
{
    const FIELD_IMAGE = 'image';
    const FIELD_COLOR = 'color';
    [...]
    protected function getSelectTypeGridConfig($sortOrder)
{
    $options = [...];

    return [],
        'children' => [
            'record' => [
                'arguments' => [...],
                'children' => [
                    static::FIELD_TITLE_NAME => $this->getTitleFieldConfig(
                        10,
                        $this->locator->getProduct()->getStoreId() ? $options : []
                    ),
                    static::FIELD_PRICE_NAME => $this->getPriceFieldConfigForSelectType(20),
                    static::FIELD_PRICE_TYPE_NAME => $this->getPriceTypeFieldConfig(30, ['fit' => true]),
                    static::FIELD_SKU_NAME => $this->getSkuFieldConfig(40),
                    static::FIELD_IMAGE => $this->getImageFieldConfig(50),
                    static::FIELD_COLOR => $this->getColorFieldConfig(70),
                    static::FIELD_SORT_ORDER_NAME => $this->getPositionFieldConfig(92),
                    static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(95)
                ]
            ]
        ]
    ];
}
   protected function getImageFieldConfig($sortOrder)
    {
        return [
          'arguments' => [
              'data' => [
                 'config' => [
                    'label' => __('Upload'),
                    'componentType' => Field::NAME,
                    'formElement' => \Magento\Ui\Component\Form\Element\DataType\Media\Image::NAME,
                        'dataScope' => static::FIELD_IMAGE,
                    'dataType' => \Magento\Ui\Component\Form\Element\DataType\Media\Image::NAME,
                    'sortOrder' => $sortOrder,
                ],
            ],
        ],
    ];
 }
    [...]
}

Now, you can select image to upload, but image not save file name on database. what is mistake in my code.. Thanks!


texts:
I have a custom module with a backend grid and an edit form.
In the edit form I have some tab one contains a grid for associated products.

I have implemented the grid int the tab using the code from the products grid for related products.

Now everything seems to work and checkbox are selected according to data from collection.

The only issue is related to the filter Yes/No/Any that doesn't work:
setting the filter to "yes" I have an empty grid, instead if I set the filter to "No/Any" I can see all the products and also the product selected.

So it looks like some association to between the filter and the field name are missed


texts: How to get store phone number in magento 2

texts:
I want to display phone number saved in magento admin in frontend in magento 2.

Like in magento 1.9 its like

$storePhone = Mage::getStoreConfig('general/store_information/phone');


texts:
I want to override the model for an optional lastname.

di.xml:

<type name="Magento\Customer\Model\Address\AbstractAddress">
    <plugin name="aroundAddressValidation" type="Xxx\OptionalLastname\Plugin\Customer\Model\Address\AbstractAddress" sortOrder="10"/>
</type>

AddressAbstract.php:

    <?php

    namespace Xxx\OptionalLastname\Plugin\Customer\Model\Address;

    class AbstractAddress
    {
        protected $_directoryData = null;
        protected $_eavConfig;

        public function __construct(
        \Magento\Directory\Helper\Data $directoryData, \Magento\Eav\Model\Config $eavConfig
        )
        {
            $this->_directoryData = $directoryData;
            $this->_eavConfig = $eavConfig;
        }

        public function aroundValidate(
        \Magento\Customer\Model\Address\AbstractAddress $subject, callable $proceed)
        {

            $errors = [];
            if (!\Zend_Validate::is($subject->getFirstname(), 'NotEmpty')) {
                $errors[] = __('%fieldName is a required field.', ['fieldName' => 'firstname']);
            }

            //
            // if (!\Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
            // $errors[] = __('%fieldName is a required field.', ['fieldName' => 'lastname']);
            // }

            if (!\Zend_Validate::is($subject->getStreetLine(1), 'NotEmpty')) {
                $errors[] = __('%fieldName is a required field.', ['fieldName' => 'street']);
            }

            if (!\Zend_Validate::is($subject->getCity(), 'NotEmpty')) {
                $errors[] = __('%fieldName is a required field.', ['fieldName' => 'city']);
            }

            if ($this->isTelephoneRequired()) {
                if (!\Zend_Validate::is($subject->getTelephone(), 'NotEmpty')) {
                    $errors[] = __('%fieldName is a required field.', ['fieldName' => 'telephone']);
                }
            }

            if ($this->isFaxRequired()) {
                if (!\Zend_Validate::is($subject->getFax(), 'NotEmpty')) {
                    $errors[] = __('%fieldName is a required field.', ['fieldName' => 'fax']);
                }
            }

            if ($this->isCompanyRequired()) {
                if (!\Zend_Validate::is($subject->getCompany(), 'NotEmpty')) {
                    $errors[] = __('%fieldName is a required field.', ['fieldName' => 'company']);
                }
            }

            return $errors;
        }

        /**
         * @return bool
         * @since 100.2.0
         */
        protected function isCompanyRequired()
        {
            return ($this->_eavConfig->getAttribute('customer_address', 'company')->getIsRequired());
        }

        /**
         * @return bool
         * @since 100.2.0
         */
        protected function isTelephoneRequired()
        {
            return ($this->_eavConfig->getAttribute('customer_address', 'telephone')->getIsRequired());
        }

        /**
         * @return bool
         * @since 100.2.0
         */
        protected function isFaxRequired()
        {
            return ($this->_eavConfig->getAttribute('customer_address', 'fax')->getIsRequired());
        }
    }

But it throws Please check the shipping information error. How do I overcome this error? If any modification in my code? If anyone knows please explain me.


texts: autocomplete search form only for testname

texts: I have created the search forms for testname location and all locations in magento and i cannot create a autocomplete search form for the testname feild  can u please suggest.


texts: How do I cancel an order programmatically with custom comments?

texts:
I know one can call $order->cancel() to easily cancel an order, but it calls registerCancellation() which in turns calls the internal _setState() itself.

The internal _setState() function will add a state change history all on its own, provided with no way to customize it.

If I want that status changing history contains my own comments, or even notify customers, how can I do that?


texts: Magento 2 css and js not working after install

texts:
I had a problem with magento 2, where in localhost I created the website and everything was fine, after importing to my server the CSS and JS was not working.

I search for so many answers and still no luck, after awhile I decided to simply start again, so I imported magento to my server, installed it with no errors, but when I entered the home page the CSS and JS does not work.

Here's a couple of things I already tried:

php bin/magento setup:content-static:deploy

deleting the static folder and keep the .htacess and run

 php bin/magento setup:content-static:deploy

Replacing Symlink with Copy

Checking the folders permissions

Here is the link of my website: http://maquinasdeoutrostempos.pt/

Thanks in advance


texts: 'Coupon with the same code already exists" error in magento

texts:
i have created a shopping cart price rule with a coupon code "xxx". Then i deleted the coupon code from admin side. The again i created the shopping cart price rule with the same coupon id then the error "Coupon with the same code already exists." comes.

When i check the database table the entry is deleted from the salesrule_coupon table but the entry of the coupon code is not deleted from the salesrule_coupon, this causes the above error.

Why this happening ? i use magento 1.9.2.0


texts:
I use the rwd theme (slightly modified but not this part) and my cart (before checkout) shows a strange behaviour.
The part with the "item-options" is only shown on some items.
I mean the part

  <?php if ($_options = $this->getOptionList()):?>

            <?php foreach ($_options as $_option) : ?>
            <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>

<?php echo $this->escapeHtml($_option['label']) ?>

                <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
                <?php if (isset($_formatedOptionValue['full_view'])): ?>

<?php echo $this->escapeHtml($_option['label']) ?>

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

                <?php endif; ?>

            <?php endforeach; ?>

    <?php endif;?>

which will be included in the /template/checkout/cart/item/default.phtml.

Until now I can't find a reason for this. The mini cart in the header contains this part and for every item.

I could narrow down the problem a little with what I tried so far:
Using /template/checkout/cart/item/default.phtml from the base theme changes nothing, but if I remove the part for the header mini cart in /layout/checkout.xml everything is fine.

But I cant't see why the (unchanged) header mini cart could cause this issue.
And to make it more weird, this demo shop (which uses the rwd theme) doesn't have the issue: see here.

Any thoughts what I could do or check?
Thanks.


texts: SQL direct query result set modification

texts:
I am using below code to fetch data from db.

$w = Mage::getSingleton('core/resource')->getConnection('core_read');
$table = Mage::getSingleton('core/resource')->getTableName('mymodule/mymodule');

$result = $w->select()
    ->from($table)
    ->where('t_store in(0,?)', Mage::app()->getStore()->getStoreId());

$row = $w->fetchAll($result);

It is giving me an array of array something like below

Array
(
    [t_id] => 4
    [t_store] => 0
    [t_name] => name1
    [t_text] => text1
)
Array
(
    [t_id] => 6
    [t_store] => 0
    [t_name] => name2
    [t_text] => text2
)

But I wanted to have only t_text in my result set something like below

Array
(
    [t_text] => text1
)
Array
(
    [t_text] => text2
)

How can I modify my code or query to have above result set?
Any help will be appreciated.


texts:
Is there a way to sort a collection of cms blocks? I need to sort blocks by identifier. I tried to do it similar to a collection of products:

$collection = Mage::getModel('catalog/product')
    ->getCollection()
    ->addAttributeToSort('name', 'DESC')
    ->load();

but it will not work because there is no addAttributeToSort method in the block collection object:

$collection = Mage::getModel('cms/block')
    ->getCollection()
    ->addAttributeToSort('identifier', 'DESC')
    ->load();

Is there any workaround for this?


texts: Magento 2 Migration. Ignore product attribute set

texts:
I'm running a data migration using the data migration tool provided by magento.

When running I get:

 [ERROR]: Incompatibility in data. Source document: eav_attribute_group. Field: attribute_group_name. Error: The product attribute set "Default" does not contain all required attribute group names "General, Prices, Design, Images"

I wish to mention that the table eav_attribute_group is ignored in my map.xml. And map.xml is correctly referened in my config.xml

If the given document is ignored why am I getting an Error regarding it?
Other from map.xml are successfully ignored.

Any pointers on how to fix this? Can I entirely ignore a product attribute set?


texts: How to combine table rate shipping and fixed shipping cost per product?

texts:
I'm using the table rates (price) to calculate the shipping costs. There are some products that have fixed shipping costs. I need the shipping rate with the combination of table rate shipping and the fixed shipping cost of a product.

For example: I've a total of 7 products in my cart. 5 of these products are covered by the table rate shipping rates. These 5 products have a total price of $200. The shipping cost of $200 is $20.

The other 2 products have a fixed shipping costs of $10 a piece. The price of these 2 products must not be include into the table rates.

So the total costs of shipping should be:

$20 for the first 5 products + 2 times $10 for the last 2 products.

So the total shipping cost should be $40.

How can I achieve this programmatically or Is there any extension to achieve this concept?


texts:
I'm trying to show all of my products in a custom controller
when I'm using the collection in a loop, the loop doesn't initiate at all.
but when I'm printing $collection->getData() I get an array filled with product entity table values.

Another thing is I cannot add product attributes (such as name) to the collection, 'addAttributeToSelect' doesn't add anything.

public function __construct(
    Magento\Framework\App\Action\Context $context,
    Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
)
{
    parent::__construct($context);
    $this->_productCollectionFactory = $productCollectionFactory;
}

public function execute()
{
    $collection = $this->_productCollectionFactory->create();
    print_r($collection->getData()); // print's out array
    foreach ($collection as $product) { // doesn't loop
        var_dump($product->getData());
    }
}


texts:
I was looking for errors inside system.log file and I have seen thhis list of error that obviously is pretty useless since I don't understand where I have to look for inside the thousands files I have got:

2014-10-05T10:28:48+00:00 DEBUG (7): <config/>
2014-10-05T10:28:48+00:00 DEBUG (7): <config/>
2014-10-05T10:28:49+00:00 DEBUG (7): <config/>
2014-10-05T10:29:19+00:00 DEBUG (7): <config/>
2014-10-05T10:29:19+00:00 DEBUG (7): <config/>
2014-10-05T10:29:20+00:00 DEBUG (7): <config/>
2014-10-05T10:29:20+00:00 DEBUG (7): <config/>
2014-10-05T10:29:21+00:00 DEBUG (7): <config/>
2014-10-05T10:29:23+00:00 DEBUG (7): <config/>
2014-10-05T10:29:23+00:00 DEBUG (7): <config/>
2014-10-05T10:29:25+00:00 DEBUG (7): <config/>
2014-10-05T10:29:25+00:00 DEBUG (7): <config/>
2014-10-05T10:29:26+00:00 DEBUG (7): <config/>
2014-10-05T10:29:29+00:00 DEBUG (7): <config/>
2014-10-05T10:29:29+00:00 DEBUG (7): <config/>
2014-10-05T10:29:29+00:00 DEBUG (7): <theme />
2014-10-05T10:29:31+00:00 DEBUG (7): <?xml version="1.0"?><customgrid></customgrid>
2014-10-05T10:29:33+00:00 DEBUG (7): <?xml version="1.0"?><jstranslator></jstranslator>
2014-10-05T10:29:33+00:00 DEBUG (7): <?xml version="1.0"?><config></config>

These kind of errors appear both from frontend navigation(2014-10-05T10:29:23+00:00 DEBUG (7): <config/>) (every page) and backend navigation(both kind of errors).
So I'm wondering if there is a way to find the exact xml file that generates these reports.
I have seen this lines of code while surfing the web:

header("Content-Type: text/xml");
echo Mage::app()->getConfig()->getNode()->asXml();exit;

But I don't know in which files I have to put this sketch
EDIT
These are the results for grep -r "<config></config>" * inside the app folder:

code/core/Mage/Admin/Model/Config.php:            $adminhtmlConfig->loadString('<?xml version="1.0"?><config></config>');
code/core/Mage/Install/Model/Config.php:        $this->loadString('<?xml version="1.0"?><config></config>');

These are the results for  grep -r "<config/>" *:

code/core/Mage/Core/Model/Config.php:        $unsortedConfig->loadString('<config/>');
code/core/Mage/Core/Model/Config.php:            $mergeToObject->loadString('<config/>');
code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php:        return new Mage_Core_Model_Config_Element('<config/>');

This is the result for grep -r -w "<theme />" *

code/core/Mage/Core/Model/Design/Config.php:            $this->loadString('<theme />');

Isn't there a way to return the xml file with the problem?


texts: Unable to create extension attribute for billing address in Magento 2

texts:
I have added custom field in magento checkout billing form, to get the value for field, I have added extension attribute

<extension_attributes for="Magento\Quote\Api\Data\AddressInterface">
        <attribute code="billing_dob" type="string"/>
    </extension_attributes>

but it is not generating get and set method and on click of place order showing below error

webapi-5c7e954226a41; Message: Property "BillingDob" does not have accessor method "getBillingDob" in class "Magento\Quote\Api\Data\AddressInterface".

Below is my mixin file :

define([
    'jquery',
    'mage/utils/wrapper',
    'Magento_Checkout/js/model/quote'
], function ($, wrapper,quote) {
    'use strict';

    return function (setBillingAddressAction) {

        return wrapper.wrap(setBillingAddressAction, function (originalAction) {
            var billingAddress = quote.billingAddress();
            billingAddress['billing_dob'] = $("[name='billing_dob']").val();
            if (billingAddress && billingAddress.customAttributes){
                if (billingAddress['extension_attributes'] === undefined) {
                    billingAddress['extension_attributes'] = {};
                }
                var taxcode = billingAddress.customAttributes['billing_dob'];
                if($.isPlainObject(taxcode)){
                    taxcode = taxcode['value'];
                }
                billingAddress['extension_attributes']['billing_dob'] = $("[name='billing_dob']").val();
            }
            return originalAction();
        });
    };
});


texts: Update on Save vs Manual Update Which Is Most Reliable In Magento Indexing

texts:
In indexing there is two option update on save and manual update.
Which one is good for big catalog?
Basically I want to know that if I save my product product on save then it's good or not.

Because some time on manual indexing I got "Error : 500 Internal Server Error".
So if any body can explain then please.


texts: When using WebP and Varnish, should WebP be added to line 82 of the VCL file?

texts:
varnish.vcl :

 ...
    # Compression filter. See https://www.varnish-cache.org trac/wikiFAQCompression
            if (req.http.Accept-Encoding) {
Line 82 ---- >  if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
                    # No point in compressing these
                    unset req.http.Accept-Encoding;
                } elsif (req.http.Accept-Encoding ~ "gzip") {
                    set req.http.Accept-Encoding = "gzip";
                } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
                    set req.http.Accept-Encoding = "deflate";
                } else {
                    # unknown algorithm
                    unset req.http.Accept-Encoding;
                }
        }
    ...


texts: Magento 2 system configuration image file upload into my custom directory with the size validation

texts:
I am working a Magento Extension, as per my requirement I've to upload an image from the system configuration field.

I have done the image upload, once the image uploaded the file stored in (root/pub/media/MY_DIR).
But instead of upload into the root directory, I've to upload the icon into my Namespace/Module/View/adminhtml/web/images/MY_DIR. Also, I have to validate the file size.

I've gone through some blog, but it couldn't help me to accomplish the task. I need a better approach to do the functionality.

Thanks in advance for your support.


texts:
I want to override lib/web/mage/gallery/gallery.less and some module files in

lib/web/mage/gallery/module/*.less

I need to override them because I want to change the style of product gallery images.

How to override or Are there any other way to "settle the question"?


texts:
I installed the Image Optimizer for Magento 2
I'm having trouble getting a scan on pub/media, follow the errors attached.
The error message is "Something went wrong while scan image. Please review the error log."
as per the below image
https://i.ibb.co/4VvvDWx/1.jpg
https://i.ibb.co/m0TFSwR/2.jpg


texts: New products take 12 plus hours to appear in categories

texts: We are currently using Magento 2.4.1 . When we add new products it takes hours to show in the categories we had picked when creating the product and yet if you search the product on the website it shows up. Any ideas or solutions would be gratefully appreciated. I am new to Magento.


texts: Magento 2 - Product images not loading in catalog view

texts:
I noticed that the product images are suddenly not loading in the category view anymore:

in the product view it works just fine.
I inspected the HTML source code and noticed that the images are loaded:

but why does it not show? I am using the fresh Luma theme without changes.
The server is in production mode.


texts:
I inserted 2 category attributes using a module with the file mysql4-install-0.1.0.php in a sql folder:

$installer = $this;

$installer->startSetup();

$installer->addAttribute('catalog_category', 'short_description', array(
    'type'          => 'text',
    'label'         => 'Short Description',
    'input'         => 'textarea',
    'group'         => 'General',
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'       => true,
    'required'      => false
));
$installer->addAttribute('catalog_category', 'static_block', array(
    'type'          => 'text',
    'label'         => 'Brand',
    'input'         => 'text',
    'group'         => 'General',
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'       => true,
    'required'      => false
));

$this->endSetup();

How can I delete them now. I tried inserting this in the sql file, as suggested in other answers:

$installer = $this;
$installer->startSetup();
$installer->removeAttribute('catalog_category', 'short_description');
$installer->removeAttribute('catalog_category', 'static_block');
$installer->endSetup();

But nothing happens. Should I create another module?


texts: Magento Grid Component not Sorting Correctly

texts:
I've configured a grid component in Magento -- and the sorting behavior seems broken.  Where can I debug this on the javascript level, and/or does anyone else have any idea why this might be happening?

If I sort the grid once, an ajax request is made, and everything sorts correctly.

However, the second sort, without an ajax request, renders the grid with all the same IDs.

The behavior is not repeated on Magento core grids, so I'm pretty sure this is something I'm doing. I just don't know the ui component system well enough to know where to start debugging this.


texts:
Hi all I am newbie Magento developer, I have a task about create gift message to checkout page with custom. I following an article to do that, link bellow.
Moving Gift message form block from Cart to Checkout step 1
Actually have no error when testing in localhost. But i have some error when deploy to staging. I have no idea about Error message, said that failed to load gift-message. This is error message show in console and screen capture bellow.
[ERROR] Failed to load the "General_Checkout/js/view/gift-message" component.

I have to create page layout like code bellow.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="content">
            <referenceBlock name="checkout.root">
                <arguments>
                    <argument name="jsLayout" xsi:type="array">
                        <item name="components" xsi:type="array">
                            <item name="checkout" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="sidebar" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="summary" xsi:type="array">
                                                <item name="config" xsi:type="array">
                                                    <item name="template" xsi:type="string">General_Checkout/summary</item>
                                                </item>
                                                <item name="children" xsi:type="array">
                                                    <!--Gift Options Cart-->
                                                    <item name="giftOptionsCart" xsi:type="array">
                                                        <item name="displayArea" xsi:type="string">gift_options</item>
                                                        <item name="component" xsi:type="string">General_Checkout/js/view/gift-message</item>
                                                        <item name="config" xsi:type="array">
                                                            <item name="template" xsi:type="string">General_Checkout/gift-message-checkout</item>
                                                        </item>
                                                    </item>
                                                    <!--End Gift Option-->
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </argument>
                </arguments>
            </referenceBlock>
            <block class="Magento\Framework\View\Element\Template" name="gift.messages.data" template="General_Checkout::gift_options.phtml"/>
        </referenceBlock>
    </body>
</page>

If You guys have some solution, could You help me to solved this issue. Thanks for reply my question.


texts: Admin catalog -> Manage products grid not showing

texts:
After upgrade from 1.14.2.4 to 1.14.3.1, product grid in admin side is not showing products. The page just opens blank.
No clues why this is happening.
The console is clean, not showing any error. Even after enabling error reporting, its not showing any PHP error too.


texts: Role resource tree not displaying in magento2

texts:
Magento 2.0.2 I am trying to add a new user role, but when I go to the Role Resource tab it doesn't display the Resources tree. I have no errors displaying. What is the next step to try and figure out why this isn't displaying.

Note : I loggedin as Administrator

Sreenshot :


texts: Flat rate in Shopping cart price rules by product ID or SKU

texts:
I have a category (id 37) for which I have already created a Shopping Cart Price Rule as followed:

( Free Shipping:  if category id 37 AND products in cart are 5 or more)

Now what I need is, I have some of the products in this category for which I need to apply shopping rule as followed:

( Flat $8 Shipping price: if category id is 37 AND product id is one of [45, 46, 47, 48, 49, 50] AND products in cart are 1 or more)

Note: The second condition mentioned is for one category. There are other category's specific products too for which I need some other Flat rate added to shipping cost.

Please Help!


texts:
I have been doing some user testing and noticed that lots of people put in a space after their email address i.e. "name@domain.com "

Magento shows a red box error on it, but some users get confused and don't know what to do. Is there a easy way of trimming the space from the email, through either code or javascript?


texts: Magento2 How to add a "Dynamic Rows" in to the Product Insert area

texts: I want to add dynamic rows with a dropdown field.how to add into the catalog product insert area thanks in a advance.


texts: I want to add of tags for facebook social media in Magento 2. So I do not know by where I can add this from code. Please help me to figure out this.


texts: Magento 2 How to Check the Current Product is come from the cart

texts:
Magento 2 current product how to check it is come from the cart edit in observer.

Please refer the cart edit url:

http://127.0.0.1/mage231/checkout/cart/configure/id/26/product_id/1/

Thanks in Advanced


texts: Add Job Title in Order Confirmation Email Magento 2

texts: I am trying to find way to show the Customer "Job Title" into order confirmation email.


texts:
I've created a backend theme from Mage/backend. When I deploy the static content, the theme is deployed but in front, the CSS is not shown. I created a styles.css file in the CSS folder of the theme.

Maybe I need to declare somewhere the styles.css but where?


texts: How can i make address input boxes as not required on the paypal express review page?

texts:
So as my title suggests..

I'm familiar with how to do this in billing on the one page checkout (

make attributes as not required in eav attributes table in the database,
copy the Customer/Model/Address.php file editing out the relevant validation in the method 'validate').

However this has not helped in the paypal express review page and it will not allow the user to checkout stating:

  "Incorrect billing address. CITY field is required"

There must be a similar file (to Abstract.php) that validates the data before submission but I just cannot track it down. Anyone who can or already knows please heed the call - the community may well benefit from this as well as myself. Any further info neede let me know. Thanks


texts: Add Country field in custom Checkout form in Magento2

texts: I added new step on checkout and I created a form for this new step. How can I add  Magento built-in Country drop down field and state/province drop down field to my custom checkout form?


texts: magento2 order place problem with last name mandatory

texts:
I am placing an order using api.

In customer_address_entity table lastname is blank
This gives error on payment gateway.

Error is

  ::Please check the shipping address information. Please enter the last
  name

How can i  resolve this. I don't want last name will mandatory.


texts:
I managed to move my magento store from my localhost to my live server, following this thread.

However, I have an unconventional folder structure how I run my main website and magento website. For instance,

This is the structure for my main website,

bin/
core/
local/
index.php

And I just want the magento system to be my sub 'website' as my webstore, so I keep all my magento files into bin/store/. And for this reason, all my images that I uploaded to wysiwyg/ don't work anymore - they are not displayed on screen anymore.

Also, the links with url rewrite are not working anymore too, for instance,

http://store.helloworld.com/wine/

I will get,

  Internal Server Error

  The server encountered an internal error or misconfiguration and was
  unable to complete your request.

  Please contact the server administrator and inform them of the time
  the error occurred, and the actions you performed just before this
  error.

  More information about this error may be available in the server error
  log. Apache Server at store.argenties.com Port 80

Any ideas how I can fix these two problems?


texts: Do not display sub-category products from "Is Anchor" tag

texts:
Currently I have a Magento site which uses Layered Navigation. The client wants to be able to control the products displayed on the parent category AND have layered navigation enabled, thus turning off "Is Anchor" isn't an immediate solution.

Any idea how I can control the product list while also keeping the layered navigation provided by Is Anchor enabled?


texts:
Need to auto fill postcode in checkout by using below code, it shows error like "Postcode is required field ".

Can you help how to reslove this error, but it works properly in fresh magento2.

/etc/di.xml

/Plugin/Checkout/Model/Checkout/LayoutProcessor.php

class LayoutProcessor
{
    /**
    * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
    * @param array $jsLayout
    * @return array
    */
    public function afterProcess(
        \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
        array  $jsLayout
    ) {
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['firstname']['value'] = 'asf';

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['lastname']['value'] = 'asf';

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['company']['value'] = 'asf';

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['city']['value'] = 'New York';

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['postcode']['value'] = '223456';

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['telephone']['value'] = '1234567890';

        return $jsLayout;
    }
}


texts: Magento 2: How to send different registration mail for different customer group?

texts: I am using magento 2.1 and i want to send the different registration emails or send different content, like separate login link for the customer belongs to different customer group. How can i achieve it. Please help.


texts: How to add new field in billing address in magento 2 and how to save that attribute data?

texts:
I wanted to add second field for telephone number. Can anyone tell me what is exact process for that ? Do I have to create attribute for customer address or any other ? please let me know.

Actually, I wanted to display second mobile number field in billing address form in checkout also it should display in backend where billing address is coming.
Thanks in advance.


texts: Disable address validation for PayPal Express Checkout

texts:
I'm using Magento 1.9 and have PayPal express checkout enabled.

And I have the problem that when a user makes a typo on his shipping address and tries to pay with PayPal it will receive the following error:

  PayPal gateway has rejected request. A match of the Shipping Address
  City, State, and Postal Code failed

I know that this is due PayPal validating the shipping address on its end, but I was wondering if there is a way to completely disable this on Magento. I have read on several sources that the way to fix this is by editing:

/app/code/core/Mage/Paypal/Model/Api/Nvp.php

And removing this line:

$request['ADDROVERRIDE'] = 1;

But I have done so already but I keep getting the same message.

Is there anything else I could try?

Thanks.


texts: Magento Display Product Prices In Catalog is not working for including tax

texts:
I have a custom tax rule and the "Catalog Prices" is set to including tax.Then i have set the "Display Product Prices In Catalog" to including tax.But this is not working at all.In category page and product detail page it still showing the price without the tax.Why this happening? if anyone know please help me.I have used the following settings in admin->system->configuration->sales->tax

The settings are listed below :

1. Tax Calculation Method Based On :- Total
2. Tax Calculation Based On :- Shipping address
3. Catalog Prices :- including tax
4. Shipping Prices :- including tax
5. Cash on Delivery fee include tax :- yes
6. Apply Customer Tax :- Before discount
7. Apply Discount On Prices :- including tax
8. Default Country :- Norway
9. Display Product Prices In Catalog :- including tax
10. Display Shipping Prices :- including tax
11. Display Cod Fee :- including tax

thank you all.


texts: How to integrate HDFC payment gateway in magento?

texts: After exhaustive search over the net I decided to post this question. The previous integration I have done had modules in magento E-commerce. I have no idea how to integrate HDFC payment gateway.Please help if anyone had did this before. Even a guidance or small instruction would help. Thank you.


texts: Magento 2 Custom No Route Handler redirect to default 404 Not Found Page

texts:
I am trying to redirect url to my custom no route found page but it always redirect to default 404 page,

I have made below changes in my module

Step-1
Create below file in Controller Folder
CustomNoRouteHandler.php

<?php

namespace SimplifiedMagento\RequestFlow\Controller\Page;

class CustonNoRouteHandler implements \Magento\Framework\App\Router\NoRouteHandlerInterface
{
    public function process(\Magento\Framework\App\RequestInterface $request)
    {
        $request->setRouteName('noroutefound')->setControllerName('page')->setActionName('customnoroute');

        return true;
    }
}

Step-2
My redirect page which should be display while no route found,

<?php

namespace SimplifiedMagento\RequestFlow\Controller\Page;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\ResponseInterface;

class CustomNoRoute extends Action
{
    public function execute()
    {
        echo "this is our custom 404 page";
    }
}

Step-3
In etc/frontend/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\App\Router\NoRouterHandlerList">
        <arguments>
            <argument name="handlerClassList" xsi:type="array">
                <item name="handlerinfo" xsi:type="array">
                    <item name="class" xsi:type="string">SimplifiedMagento\RequestFlow\Controller\Page\CustonNoRouteHandler</item>
                    <item name="sortOrder" xsi:type="string">50</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

Step-4
In etc/frontend/routes.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="noroutefound" frontName="noroutefound">
            <module name="SimplifiedMagento_RequestFlow" />
        </route>
    </router>
</config>


texts: Magento2: How to add a custom field with its value in the checkout cart summary?

texts:
How to add a custom field with its value in the checkout cart summary in Magento 2 ?

I have followed many links, but none helped me.

Any help would be appreciated.


texts:
I'm trying to create a module which i'm hoping will extend the Catalog Price Rules feature to allow me to create pricing groups based on Cost plus a percentage (e.g. All products in a category are cost + 30% for specific customer group).

Firstly, how can I ensure that Magento uses this price even if it is higher than the base price??

Secondly, Which files do i need to override?
So far, i've located:

vendor/magento/module-catalog-rule/Helper/Data.php - this contains the rule logic
vendor/magento/module-catalog-rule/Model/Rule.php - this contains the validation rules
vendor/magento/module-catalog-rule/Model/Rule/Action/Product.php - i think this contains the options for the rule logic
vendor/magento/module-catalog-rule/Model/Rule/Action/SimpleActionOptionsProvider.php - this also contains the options for the rule logic
vendor/magento/module-catalog-rule/Observer/ProcessAdminFinalPriceObserver.php & ProcessFrontFinalPriceObserver.php

Are there any others?

The last thing is that i will obviously need to parse the product cost into these functions, what would be the best way to do that?

Any and all help is greatly appreciated! :-)


texts: How to check if a product is salable using isSalable()?

texts:
I am trying to use plugin to override Magento\Checkout\Model\Cart.php - addOrderItem function
Instead of getting item's quantity, how to check if product is salable using isSalable()? Is there any way to use product id to get if product is isSalable().
public function aroundAddOrderItem($subject, callable $proceed, $orderItem, $qtyFlag = null)
    {
        if ($orderItem->getParentItem() === null) {
            $sku = $orderItem->getSku();
            $productId=$this->product->getIdBySku($sku);
            $productStock = $this->stockItemRepository->get($productId);
            $productQty = $productStock->getQty();

            if($productQty < 1)
            {
                return $this;
            }
            else
            {
                return $proceed($orderItem, $qtyFlag);
            }
        }
        return $this;
    }


texts:
I've created an extension of the Mage_Catalog_Model_Product_Type_Price module where I will dynamically load prices from an external database.

I need the product sku in order to retrieve the correct price from my DB. I used
Mage::getModel('catalog/product')->load($_product->getId())->getSku();

but that doesn't appear to be working.


texts:
I want to show my parent category and all its sub-categories, whenever I visit one of those category pages.

I want a structure like this on all the Ralph Lauren categories;

Ralph Lauren

T-shirts
Pants
Jackets

But this only shows when I visit the parent category Ralph Lauren. If I click on T-shirt it doesn't show any other categories, since Ralph Lauren T-shirts doesn't have any children.

How can I achieve that?

            <?php echo Mage::registry('current_category')->getName(); ?>

        <?php
            $store_categories = $this->toLinearArray($this->getStoreCategories());
            if ($count = count($store_categories))
                echo '
';
            foreach ($store_categories as $i => $_category)
            {
                $class = array() ;
                if ($count == 1)
                    $class[] = 'only';
                else if(!$i)
                    $class[] = 'first';
                else if ($i == $count-1)
                    $class[] = 'last';
                if (isset($store_categories[$i+1]) && $this->isCategoryActive($store_categories[$i+1]))
                    $class[] = 'prev';
                if (isset($store_categories[$i-1]) && $this->isCategoryActive($store_categories[$i-1]))
                    $class[] = 'next';
                echo $this->drawOpenCategoryItem($_category, 0, $class);
            }
            if ($count)
                echo '
';
        ?>


texts: Magento 2: Programmatically create & apply shopping cart rule

texts: I'm having an issue with creating a shopping cart rule in Magento 2.1. Is there a way to create shopping cart rule programmatically and then apply it to specific group of customers?


texts: how to add a product in cart from external php file in magento?

texts:
i've an external php file called addtocart.php who is located in my magento root folder. with this file i want to add a product to the cart. the product should have the following attributes:

sku name options price(!!) qty

EDIT: this is a screenshot of my magento folder structure: https://www.dropbox.com/s/vmli0973iflfski/Screenshot%202014-02-12%2009.44.39.png

this is my code: (only with qty and sku)

require_once('app/Mage.php');
umask(0);
Mage::app('de');

$image = "uploads/52f7857f039b2.jpg";
// the ID of the product
$product_id  = 149;

$product     = Mage::getModel('catalog/product')->load($product_id);

$cart = Mage::getModel('checkout/cart');
$cart->init();
$params = array(
    'product' => $product_id,
    'qty' => 1,
    'options' => array(
        149 => array(
                'quote_path' => $image,
                'secret_key' => substr(md5(file_get_contents(Mage::getBaseDir() . $image)), 0, 20)),
    )
);

$cart->addProduct($product, $params);
$cart->save();

Mage::getSingleton('checkout/session')->setCartWasUpdated(true);

it does not work! can anybody tell me how to do this? Thank you! :)


texts: Search does not work with special characters like '?

texts:
Magento 2.3.3
I figured out that the search in my store does not work as soon as the product name contains a '. I guess it also happens for other special chars, but in my case its only '. The auto suggest works, but the actual search always shows the "We could not find any products" message.
I tried to reindex and also checked the database, its contained as ' in the database. Anyone having an idea how to solve this problem?
Thanks


texts: How to modify/update cart success message in Magento 2?

texts:
I want to modify/update the success message added by cart controller (Magento\Checkout\Controller\Cart\Add).

As described here and here, I can use preference to override controller to update success message but I think overriding core classes is bad idea.

So, is there any other better way to update success message instead of preference?


texts: How to create custom space block below catalog.topnav ( Menu )

texts: I want to add add-to-cart and Wishlist under catalog.topnav ( Menu ) how to add right below menu bar.


texts:
Hi everybody how are you
I have a problem to limit the type of file that can be uploaded from the administrator panel in a custom module, I only need the type csv and xls
I try a class that extends from\Magento\Config\Model\Config\Backend\File But it does not work, I can upload any type of file
the field from system.xml are:
<field id="shipping_csv_upload" translate="label" type="Magento\Config\Block\System\Config\Form\Field\File" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" >
                <label>Upload csv</label>
                <backend_model>Ipinnovatech\Ordertoapi\Model\Config\Backend\CustomFileType</backend_model>
                <upload_dir config="system" scope_info="1" >upload</upload_dir>

and the class for custom file type is:
class CustomFileType extends \Magento\Config\Model\Config\Backend\File
{
    /**
     * @return string[]
     */
    public function getAllowedExtensions() {
        return ['csv', 'xls'];
    }
}

Thanks


texts:
I have installed magento in subdomain: magento.webstite.com

and enter admin panel name:  /paneladmin

When I try access magento.webstite.com/paneladmin then I get issue: Not Found

I checked in env.php and is correct name:

 'backend' => [
        'frontName' => 'paneladmin'
    ],


texts: Class not found when presenting new products on home page (magento 2.1)

texts:
I am currently re-writing our Magento 1 theme to work with Magento 2.1, it has been a steep learning but I am finally getting somewhere.
I am trying to use the New Product Grid block on the homepage of my site, for the moment there only is one product in the database (this does cause the new product block code to run).
I haven't changed the block at all and I am currently using the one that is located in the vendor/magento/theme-catalog/block/Product/newProduct.php. When I try to run the code on the home page (see below for cms_index_index.xml layout), I just get Class not found.

`<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="main">
            <container name="content.top" label="Main Content Top"/>
            <container name="content" label="Main Content Area">
                <block class="Magento\Catalog\Block\Product\NewProduct" template="Magento_Catalog::product/widget/new/content/new_grid.phtml" />
                <block class="Magento\Framework\View\Element\Template" name="info_boxes" template="Magento_Theme::info_boxes.phtml" />
                <block class="Magento\Framework\View\Element\Template" name="promo_boxes" template="Magento_Theme::promo_boxes.phtml" />
                <block class="Speedcrete\Manufacturers\Block\ManufacturerList" name="manufacturer.list" template="Speedcrete_Manufacturers::manufacturerList.phtml" />
            </container>
            <container name="content.aside" label="Main Content Aside"/>
            <container name="content.bottom" label="Main Content Bottom"/>
        </referenceContainer>
    </body>
</page>`

This my home page layout so far (i have overwritten this layout - this currently resides in the Magento_Theme/layouts folder in my theme dir).

The code that causes the issue is below (this bit of code is in the theme_catalog in the vendor directory):

$items = $block->getProductCollection()->getItems();

The error is as follows:
1 exception(s):
Exception #0 (ReflectionException): Class  does not exist
Exception #0 (ReflectionException): Class  does not exist
#0 /home/www/Desktop/Virtual-Hosts/Magento-2/vendor/magento/framework/Code/Reader/ClassReader.php(23): ReflectionClass->__construct(''

)

`
Thanks for looking, any help would be appreciated.


texts: How to exclude defer js extension in special page?

texts:
How to exclude extension in special page?
like it don't loading to onestep checkout page.
Because i'm using defer js extension no admin backend just auto enable but it affect onestep checkout page.
i just want to exclude checkout page.
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $response = $observer->getEvent()->getResponse();
        $htmlContent = $response->getBody();

Thank you


texts: Magento2 : third party js file including issue

texts:
I am using three.js (source code) in a module page:

requirejs-config.js

var config = {
    map: {
        "*": {
            three: "Vendor_Module/js/three/build/three",

and in the phtml file :

require([ 'jquery', 'three', 'jquery/ui'],function($, THREE) {

It works.

I would like now to add one of the three.js tools called OrbitControl (source code). I did the same principle, ie :

requirejs-config.js

var config = {
    map: {
        "*": {
            three: "Vendor_Module/js/three/build/three",
            orbitcontrols : "Vendor_Module/js/three/examples/js/controls/OrbitControls",

phtml file :

require([ 'jquery', 'three', 'orbitcontrols', 'jquery/ui'],function($, THREE) {

but when I call it in my page script :

var controls = new THREE.OrbitControls( camera, renderer.domElement );

I have 2 errors in my browser console :

THREE is not defined in OrbitControls.js

THREE.OrbitControls is not a constructor

What did I miss?

Thank you for your help.