texts: make increment_id of an order syncron to external system

texts:
We are integrating Magento with an existing system. Our existing system already has order numbers. There has been a lot of confusion since Magento has its own order numbers, and our existing system has different order numbers, so we're trying to get the order numbers to match up.

I have an observer set up for sales_order_place_after where I get the order number from our existing system. It doesn't seem to work to $order->setIncrementId($our_existing_order_id) I don't know if this is really all that good of an idea anyways..

Really, the end goal we want is for the order #s in email receipts that are sent out to match the order #s in our existing systems. Is there a better way to make that happen?


texts: EE 1.13.1 - Target Rule Index cause 'Integrity constraint violation'

texts:
I'm having the following exception on EE 1.13.1

Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'xxxxxxx' for key '5B1C775075460366570ABDA2839BC68A' in /lib/Zend/Db/Statement/Pdo.php:234

It looks something goes wrong with the Category Rules index:

According to the exception information the issue starts from app/code/core/Enterprise/TargetRule/Model/Resource/Index/Abstract.php(213)
key 5B1C775075460366570ABDA2839BC68A is actually an index of this table enterprise_targetrule_index_related

Any Idea ?
I'm actually debugging the above issue and I will share more info if I find something.

UPDATE

I have provided a solution below.
It will be great if someone with more experience can confirm if try catch is fine ( usually it is not advisable to use try catch in the business logic ) or transaction is better.


texts:
Following is a left side bar code when i am in "My Dashboard". I have to modify following style. Where is the file so i can modify the class.

  My Account

 Account Dashboard

 Account Information

 Address Book

 My Orders

 Billing Agreements

 Recurring Profiles

 My Product Reviews

 My Tags

 My Wishlist

 My Applications

 Newsletter Subscriptions

 My Downloadable Products


texts:
How do I change the favicon that displays while in the Magento 2 admin? It currently displays the favicon for the base website, but I would like it to display a custom favicon (and not the Magento logo).

To be clear, I want a different favicon in the frontend from the backend admin.

I'd prefer a way via the admin, but can edit code if necessary.


texts: How to update Magento through Installatron

texts:
Our host uses installatron as a way to download applications like Wordpress, Dreamweaver, Magento... etc, etc.

However, since Magento 2.0 got released, i've been waiting to upgrade it for our store as well, but Magento 2.0.1 got released recently, and i haven't seen it available in the installatron update menu.

Anyone knows how to upgrade magento 1.9.1.1 to Magento 2.0 or 2.0.1 through installatron?


texts: Can I use Magento2 back-end if we remove the domain?

texts:
We change webshop from Magento2 to a new platform next week and would like to know if you can log into Magento after moving the domain. Do we still have acces to the backend and our orders?
Hope anyone can help with a yes or a no. :-)

Thanks!
Monica


texts:
I'm trying to learn e-commerce solution development and because magento has huge community all around the globe as well as it's scalability with extensions and all other I planned working on Magento.I have downloaded the community package from the magento website and trying to run the following on XAMPP on my OSX .

It is running PHP v 7.0.8

When I'm trying to run the same I get the following error

Fatal error: Interface 'Zend\Stdlib\JsonSerializable' not found in /Applications/XAMPP/xamppfiles/htdocs/proj/magento/vendor/magento/framework/Phrase.php on line 14

I do understand that the following is missing from my system.Hence I looked up for the solution and found to upgrade the php version but I'm already using 7.0.8 also there's someone who says to composer install

But none of the above helped me so I tried to download the Zend-stdlib from github and pasted the same under Vendor folder as per the path in the error.
It didn't help either.

If anyone can suggest me something else or point me to the correct direction that would be really helpful.

EDIT 1

  The files that I have downloaded from the magento website is kept
  under a subfolder named proj within htdocs. The proj folder holds
  all the folder that has been downloaded as it is.

EDIT 2

  I have also tried running the files using MAMP PRO and kept the magento >folder as the main directory. Yet it won't help.
  Now I tried to run Composer install I got this error
  `composer install
  Loading composer repositories with package information
  Installing dependencies (including require-dev) from lock file
  Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - magento/framework 100.1.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - magento/framework 100.1.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - Installation request for magento/framework 100.1.0 -> satisfiable by magento/framework[100.1.0].

EDIT 3

  As per my understanding the above error occurred because MAMP is running PHP v 7.0.8 which is not same as my system PHP V. Thus I have modified my >system PHP to MAMP php version by setting the path using the following >commands

sudo nano ~/.bash_profile
PATH="/Applications/MAMP/bin/php/php5.6.7/bin:$PATH"

  Now the system has PHP V 7.0.8. After this I have tried composer install >and it throws the following error

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package fabpot/php-cs-fixer is abandoned, you should avoid using it. Use      friendsofphp/php-cs-fixer instead.
Generating autoload files

  [RuntimeException]
  Could not scan for classes inside "/Applications/MAMP/htdocs/magento/vendor
  /oyejorge/less.php/lessc.inc.php" which does not appear to be a file nor a
  folder

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

  It throws a runtime exception.

SOLVED

  After struggling so much, I have planned starting from scratch and instead of downloading the files from the Magento website I got the files from Magento Github repo magento2, paste it n the htdocs directory and run composer install. All seem to be working fine now.


texts:
I've been diving into Magento for last 3 months. I've understood pretty much the app/design-- part of it. But now when i try to look into module development, that look like a really scary part. I've gone through some good articles on module development basics, and have got some surface idea of that, but still when i see code like this, I get blank.

public function viewAction()
{
    if ($product = $this->_initProduct()) {
        Mage::dispatchEvent('catalog_controller_product_view', array('product'=>$product));

        if ($this->getRequest()->getParam('options')) {
            $notice = $product->getTypeInstance(true)->getSpecifyOptionMessage();
            Mage::getSingleton('catalog/session')->addNotice($notice);
        }

        Mage::getSingleton('catalog/session')->setLastViewedProductId($product->getId());
        Mage::getModel('catalog/design')->applyDesign($product, Mage_Catalog_Model_Design::APPLY_FOR_PRODUCT);

        $this->_initProductLayout($product);
        $this->_initLayoutMessages('catalog/session');
        $this->_initLayoutMessages('tag/session');
        $this->_initLayoutMessages('checkout/session');
        $this->renderLayout();
    }

I've a decent knowledge of PHP. But I don't have much understanding of MVC frameworks. Should I keep on digging into module development, or should i first learn MVC frameworks like Zend, and then come to magento. Is that step really required?


texts: Issue while installing security patch in magento 1.9

texts:
I am trying to install the patch but it throwing an error like below, kindly tell me how to solve this issue

  $'\r'PATCH_SUPEE-10266_CE_1.9.2.4_v1-2017-09-13-06-37-37.sh: line 7: $'\r': command not found
  PATCH_SUPEE-10266_CE_1.9.2.4_v1-2017-09-13-06-37-37.sh: line 9: syntax
  error near unexpected token
  $'{\r'''ATCH_SUPEE-10266_CE_1.9.2.4_v1-201709-13-06-37-37.sh:line9:_check_installed_tools(){


texts: How Does Dynamic Pricing Work In Magento?

texts:
I wonder how the dynamic pricing works in Magento?

For example I have created product in the backend and add some custom options to it. So, if user choose the option, the price change automatically on the product view page without reloading the page.

Can anybody explain how Magento perform this action?

And can we add custom dynamic pricing? I want if user click the link (I added to product view page), then the price change.


texts: Only order mails are not working in magento 2

texts: Order related mails are not working. But subscription mails are working. How to fix this?


texts: How can i a new registry field on my newsletter?

texts: I'm using MailChimp for the newsletter. I need the email and name but I only get the email on mailchimp. First name is empty.


texts: Category image not showing on layered navigation URL

texts:
I'm not sure if this is a bug in Magento 1.8.1.0. I just tested with the default theme, but there's no difference, so I assume it's not theme related.

If I go to a sub-category page via main navigation, e.g. http://mydomain.ch/maincat/subcat.html, the category image shows fine, but if I go to the same category via layered navigation Magento adds the sub-category as a GET param, i.e. http://mydomain.ch/maincat.html?cat=123 and the category image is not showing. The products are showing fine on both URLs, though.

Any ideas if this is a bug or a feature? And if it's a feature the question would be: How to rewrite the latter URL to the first in order to show the category image on both.


texts: USPS API doesn't return Priority Mail online rate

texts:
I'm running Magento Community Edition V1.9.x and offer both FedEx and USPS on my website.  For USPS, I offer the allowed shipping method, Priority Mail on the backend.  On the frontend, this returns the USPS retail price, not the online price.

Does anyone know how I can have Magento request the online price?  The documentation for the USPS V4 API is found here:

https://www.usps.com/business/web-tools-apis/rate-calculator-api.pdf

On page 5, I see there is a Service Request and things like "All" and "Online" and "Priority Commercial".  I'm guessing one of these is a variable being passed by Magento.  Any idea how this is coded in Magento and what needs to be changed to return the online pricing?  What is the file location?


texts: Magento 2: Do anything to custom data before inseting into database?

texts: I have created a custom text field on my checkout page and want to store the data the customer enters into my database. However, do I need to be worried about SQL injection, or any other type of hack / dirty data which might corrupt/hack my database? Do I need to write some code to sanitise the data before inserting it into the Database, or is this taken care of by Magento when passing it to the resource model?


texts: How to add new column in quote_item table?

texts:
In magento 2 I want to add column in quote_item table.

How can i add that column,i am new in magento

Please help me


texts:
We are using Magento CE 2.1.2, trying out the Magento 2 migration from a CE 1.9.0.2.

Migration works as expected with no problems except for "delta", that doesn't update any order or customer after the initial migration, also if the newer db given has more orders and customers than the one used for the initial migration.

We didn't found errors or anything on logs, and so far shell output says everything is ok.

Here is the log from shell:

    [2016-12-02 09:44:40][INFO][mode: delta][stage: delta delivering][step: Customer Attributes Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: Customer Attributes Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: delta delivering][step: Map Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: Map Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: delta delivering][step: Log Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: Log Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: delta delivering][step: OrderGrids Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: OrderGrids Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: delta delivering][step: SalesIncrement Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: SalesIncrement Step]: started
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: SalesIncrement Step]: Migration completed successfully
    [2016-12-02 09:44:40][INFO][mode: delta][stage: volume check][step: SalesIncrement Step]: Automatic restart in 5 sec. Use CTRL-C to abort
    [2016-12-02 09:44:45][INFO][mode: delta][stage: delta delivering][step: Customer Attributes Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: Customer Attributes Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: delta delivering][step: Map Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: Map Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: delta delivering][step: Log Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: Log Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: delta delivering][step: OrderGrids Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: OrderGrids Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: delta delivering][step: SalesIncrement Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: SalesIncrement Step]: started
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: SalesIncrement Step]: Migration completed successfully
    [2016-12-02 09:44:45][INFO][mode: delta][stage: volume check][step: SalesIncrement Step]: Automatic restart in 5 sec. Use CTRL-C to abort


texts: M2 commerce edition PDP page issue, CMS block repeated couple of times in custom theme

texts:
I am created custom theme in magento commerce edition, and added static block into my PDP page using
<?php

echo $this->getLayout()

->createBlock('Magento\Cms\Block\Block')

->setBlockId('your_block_identifier')

->toHtml();

?>

in

app\design\frontend\zero_theme\theme\Magento_Catalog\templates\product\view\attribute.phtml

In PDP page cms block shown couple of times, How to solve this issue.


texts: I am building an app with localisation using the REST API and I want the API to return localised messages (e.g. response messages and shipping methods). How can I achieve this?


texts: Magento is showing a "default" text in the url

texts:
Hello actually magento is showing me a "default" text after the base url, like this.

www.palabrainspirada.com/default/autores/

And i does not understand why is that.

Someone could help me?


texts: Speedster by homepage : Fatal error: Call to a member function setTitle() - after installing that extension. This error is on homeoage

texts:
I am new to magento. I added a extension Speedster by Fooman on my website after that I am getting error :

Fatal error: Call to a member function setTitle() on boolean in /home/trenkey/public_html/includes/src/Mage_Customer_Block_Form_Register.php on line 43

If you wish you can see a live example on https://trenkey.com
I am using Magento 1.9.2.4
your help will be much appreciated.


texts: Hide the "Buy now " Button for configurable products

texts:
plese visit configurable product: here i am using following code to display "BUY NOW" button.

template path hint : here

is there any way to hide the "BUY NOW" button for configurable products

app/design/frontend/default/default/template/mpassignproduct/catalog/product/view/addtocart.phtml

<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>

        <?php if(!$_product->isGrouped()): ?>
        <?php echo $this->__('Qty:') ?>
        <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
        <?php endif; ?>
        <?php
            $assignPro=Mage::getModel('mpassignproduct/mpassignproduct')->getAssignProDetails($_product->getId());
        ?>
        <?php if($assignPro['assignCount']): ?>
            <?php if($assignPro['sellerqty'] > 0): ?>

                <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><?php echo $buttonTitle ?></button>

               <button type="button" onclick="jQuery('#buy_now').val('buy_now');productAddToCartForm.submit(this)" class="button buy-now btn btn-block btn-express-buynow">Buy Now</button>

            <?php endif; ?>
        <?php else: ?>
            <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><?php echo $buttonTitle ?></button>

                <button type="button" onclick="jQuery('#buy_now').val('buy_now');productAddToCartForm.submit(this)" class="button buy-now btn btn-block btn-express-buynow">Buy Now</button>

        <?php endif; ?>
        <?php echo $this->getChildHtml('', true, true) ?>

<?php endif; ?>


texts: Magento 2 Get Module Version Outside of the Setup Directory

texts:
I am trying to get the version of my Magento 2 module outside of the Setup folder to display in the admin store config area under "current version". I have some code like this. I've tried this using both DI for the ModuleContextVersion class and calling the object manager directly, both results give the same error. Code:

<?php

namespace SalesIgniter\Rental\Block\Adminhtml\Form\Renderer\Config;

//use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;

class Version extends Field
{

    /**
     * @param AbstractElement $element
     * @return string
     */
    protected function _getElementHtml(AbstractElement $element)
    {
        $om = \Magento\Framework\App\ObjectManager::getInstance();
        $context = $om->get('\Magento\Framework\Setup\ModuleContextInterface');;
        return $context->getVersion();
    }

This is the system.xml code I have which doesn't really have to do with the error message, but you'll see what I'm trying to do:

<group id="current_version" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1"
               showInStore="1">
            Current Version Installed
            <field id="version" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
                   showInStore="1">
                Current Version
                <frontend_model>SalesIgniter\Rental\Block\Adminhtml\Form\Renderer\Config\Version</frontend_model>
            </field>
        </group>

The error it gives me using either DI or calling object manager is:

  Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Setup\ModuleContextInterface in vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php on line 73


texts: Magento 2 How to add Home link in navigation bar!

texts: How can i link my home page in the navigation bar(Home) button?


texts: How to add a text in the column 'Ship To Name' in sales->order incase of virtual product

texts:
I have a virtual product. I know that doesn't have shipping details and hence in sales->order grid, Ship To Name column is blank but in those cases, I want to add a custom text.
How can we achieve that in magento 1.9.2.2?


texts: Magento 2: magento layout not pick by magento

texts:
I found this error in system.log file and my layout is not loading in frontend.

main.CRITICAL: Broken reference: No element found with ID 'before.body.end'. [] []


texts: How to detect the Admin status of the current user?

texts:
Is there any way I can detect if the currently logged in user is an admin user?

I am trying to prevent non-admin users from processing orders.
Thanks your response is really appreciated.


texts:
Is it possible for a bundled product to be free in product 1 but not in product 2?

This happens before you put everything in the cart.


texts: Magento 2 Enterprise: Create New Module in vendor directory

texts:
I tried to create new module in vendor directory in Magento Enterprise 2.0.0.
The module could not be loaded after I ran the Magento setup:upgrade.

If I move my files to the app/code directory, the module will be set up successfully.

For Magento 2 Enterprise edition, all modules are in vendor directory but Community edition uses app/code directory. I wonder if it is possible to create custom module in the vendor directory. If yes, what are the differences between creating a custom module in app/code and vendor.

vendor/Test/Testing/registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Test_Testing',
    __DIR__ );

vendor/Test/Testing/composer.json

{   "name": "test/testing",   "description": "Testing",   "require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
    "magento/framework": "100.0.*"   },   "type": "magento2-module",   "version": "0.1.0",   "license": [
    "proprietary"   ],   "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "Test\\Testing\\": ""
    }   } }

vendor/Test/Testing/etc/module.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Test_Testing" setup_version="0.1.0">
    </module> </config>


texts: Remove Toolbar from product list grid mode

texts:
For showing product in my newsletter i am using below code .I created a new newsletterproductlist.phtml file and remove unwanted filters ....it is working fine but only showing 12 products i just want to show all products in particular category i tried to add product_count="20",  hide_toolbar="1"  but it is now showing any effect so please guide me the right direction to show all products.

{{block type="catalog/product_list"  column_count="4" category_id="9"  template="catalog/product/newsletterproductlist.phtml"}}

I remove toolbar from the new listing page i created as i don't want to show any type of filter in my newsletter so guys is there any option to show all products in category?


texts: How to add Approve and disapprove in admin grid Magento 2?

texts: I have already create admin grid in which there is one column status i want to add two functionality Approve and Disapprove which are store in database how can i do that?


texts: CSS and LESS files are ignored in custom theme

texts:
I'm trying to customize this component:

As I read from the documentation, in order to override the style of this search bar you need to create a folder called Magento_Search and add an _extend.less file in web/css/source/ but nothing happens. I can't figure out why.


texts:
I have a problem with subdomain on nginx server.
In our project, we need create different urls for different store views. For example:
main url: site.com
url for english store: site.com/en

I implemented next solution:
in root folder created new directory "en", where moved index.php and .htaccess files.
For English store view for secure and unsecure section I add new Base Url and Base Url link configuration http://site.com/en/.   For other 3 leave http://site.com/.

Because our live site on nginx server I add for each store new option:

location /en {
  #rewrite ^/en.html /en/ permanent;
  index index.php;
  try_files $uri $uri/ /en/index.php;
}

Everything works good, but when I make search on site (like site.com/en/catalogsearch/result/?q=opening+hours)it doesn't work. I made some researching and examined that in Mage_CatalogSearch_Helper_Data file in getQueryText() action array $_GET is empty.
I think that I have wrong nginx configuration, because on local machine (on Apach)everything works good. Can anybody help me, please? Thanks in advance.


texts: Magento why only title prefix show on title area

texts:
My projects default page title fixed. Suppose I go category page that's not show category name in title that showing default title which from core_config_data table path design/head/default_title.

Same things happen for product page and other pages.

how to possible to fixed this. And now I need to this dynamic


texts: Magento 2 - Contact us page returns 404 even though enabled in configuration

texts:
I have enabled the 'Contact us' page in the Magento 2 configuration and I have created a 'contact-us-info' static block (although I don't think this is necessary) but I have no contact us page on the front end.

I have run php 'bin/magento setup:upgrade' and cleared the cache but I can't see why this doesn't work. I am using a theme I have built based on Studioemma Optimus theme (which is based on Magento Blank)

Is it possible that I just have the wrong URL suffix?

I'm using /contact-us


texts: What is the difference between type and virtualType

texts:
In the di.xml that comes with Magento2 there is a node type and a node virtualType. My questions is what is this virtualType and in what case should it be used instead of type?

In some places it looks like a symbolic link or rewrite:

<virtualType name="Magento\Core\Model\Session\Storage" type="Magento\Framework\Session\Storage">

Where one full path gets changed into another but in other places it appears to be used as a way to define a shorter alias.

<virtualType name="lessFileSourceBase" type="Magento\Framework\View\File\Collector\Base">


texts: Is there a way to speed up multiple Joins in Magento Order Grid?

texts:
I am having an issue with load times in the Sales_Order_Grid after join creating three joins to add additional columns.

This has significantly increased loading times and I was wondering if there is a way to increase the speed or optimise the code to prevent the sluggishness?

Here are my joins

protected function _prepareCollection()
{

$collection = Mage::getResourceModel($this->_getCollectionClass());

/* This adds the additional Joins*/

$collection->getSelect()->joinLeft(array('sfop' => 'sales_flat_order_payment'),
    'sfop.parent_id=main_table.entity_id', array(
    'sfop.method', 'sfop.additional_information'));

$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'),
    'main_table.entity_id = sfoa.parent_id AND sfoa.address_type="shipping"',array('sfoa.street',
        'sfoa.city','sfoa.region','sfoa.postcode','sfoa.telephone'));

$collection->getSelect()->joinLeft(array(
        'item'=>$collection->getTable('sales/order_item')),
    'item.order_id=`main_table`.entity_id AND item.product_type="simple"',
    array(
        'skus' => new Zend_Db_Expr('group_concat(item.sku SEPARATOR ", ")'),
        'name' => new Zend_Db_Expr('group_concat(item.name SEPARATOR ", ")'),
        'brand' => new Zend_Db_Expr('group_concat(item.brand SEPARATOR ", ")')
    )
);
/* End additional Joins*/
$collection->getSelect()->group('main_table.entity_id');
$this->setCollection($collection);
return parent::_prepareCollection();

}

I've added the columns for the information that I need to display without any errors

...

        $this->addColumn('customer_firstname', array(
            'header' => Mage::helper('sales')->__('Customer Firstname'),
            'width' => '80px',
            'index' => 'customer_firstname',
            'type' => 'text',
            'filter_index' => 'customer_firstname'
        ));

...

The following 0 - 19 (20 total, Query took 93.0730 sec)

SELECT `main_table`.*, `sfop`.`cc_type`, `sfop`.`cc_last4`, `sfop`.`cc_type`, `sfop`.`last_trans_id`, `sfop`.`method`, `sfop`.`additional_information`, `billing`.`postcode`, `sfoa`.`street`, `sfoa`.`city`, `sfoa`.`region`, `sfoa`.`postcode`, `sfoa`.`telephone`, group_concat(item.sku SEPARATOR ", ") AS `skus`, group_concat(item.name SEPARATOR ", ") AS `name`, group_concat(item.nego SEPARATOR ", ") AS `nego` FROM `sales_flat_order` AS `main_table`
 LEFT JOIN `sales_flat_order_payment` AS `sfop` ON sfop.parent_id=main_table.entity_id
 LEFT JOIN `sales_flat_order_address` AS `billing` ON main_table.entity_id = billing.parent_id AND billing.address_type="billing"
 LEFT JOIN `sales_flat_order_address` AS `sfoa` ON main_table.entity_id = sfoa.parent_id AND sfoa.address_type="shipping"
 INNER JOIN `sales_flat_order_item` AS `item` ON item.order_id=`main_table`.entity_id AND item.product_type="simple" GROUP BY `main_table`.`entity_id` ORDER BY main_table.created_at DESC LIMIT 20

The question is how do I optimise the Grid to increase speed?

Hope someone can help??


texts: Magento error while upgrade from 2.2.1 to 2.3.3: The attribute can't be deleted. while running setup:upgrade

texts:
I have a site running with Magento 2.2.1, after upgrading to 2.3.3 with this guide, running bin/magento setup:upgrade returns error: The attribute can't be deleted.

I modified core file to get the stack trace and here is it:

#0 /var/www/html/sitedir/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(448): Magento\Eav\Model\ResourceModel\Entity\Attribute->_beforeDelete(Object(Magento\Customer\Model\Attribute))
#1 /var/www/html/sitedir/generated/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Interceptor.php(245): Magento\Framework\Model\ResourceModel\Db\AbstractDb->delete(Object(Magento\Customer\Model\Attribute))
#2 /var/www/html/sitedir/vendor/magento/module-eav/Model/AttributeRepository.php(183): Magento\Eav\Model\ResourceModel\Entity\Attribute\Interceptor->delete(Object(Magento\Customer\Model\Attribute))
#3 /var/www/html/sitedir/vendor/vertex/module-tax/Setup/UpgradeData.php(77): Magento\Eav\Model\AttributeRepository->delete(Object(Magento\Customer\Model\Attribute))
#4 /var/www/html/sitedir/vendor/vertex/module-tax/Setup/UpgradeData.php(58): Vertex\Tax\Setup\UpgradeData->deleteCustomAttribute()
#5 /var/www/html/sitedir/setup/src/Magento/Setup/Model/Installer.php(988): Vertex\Tax\Setup\UpgradeData->upgrade(Object(Magento\Setup\Module\DataSetup), Object(Magento\Setup\Model\ModuleContext))
#6 /var/www/html/sitedir/setup/src/Magento/Setup/Model/Installer.php(875): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data', Array)
#7 /var/www/html/sitedir/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php(123): Magento\Setup\Model\Installer->installDataFixtures(Array)
#8 /var/www/html/sitedir/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\UpgradeCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/sitedir/vendor/symfony/console/Application.php(893): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/sitedir/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Setup\Console\Command\UpgradeCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/sitedir/vendor/magento/framework/Console/Cli.php(105): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/sitedir/vendor/symfony/console/Application.php(145): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/sitedir/bin/magento(23): Symfony\Component\Console\Application->run()
#14 {main}

How to fix this problems?


texts: Magento 2.1.4 - Set default root category

texts: The first time I configured the categories, I renamed the default category. Now, I need to change the default category because it is the first category to be shown when I go to the categories menu. So I added a new root category but I didn't see any options to set it as default.


texts:
I am adding product data through Rest API.
How can i add sale price and dates through API.
https://prnt.sc/wdlko9
What are the attributes name?


texts: Magento product search by name is not working

texts:
$needle= $_GET["singleid"];

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

$_productCollection = $collection->addAttributeToFilter('name', array(
    array('like' => '% '.$needle.' %'), //spaces on each side
    array('like' => '% '.$needle), //space before and ends with $needle
    array('like' => $needle.' %') // starts with needle and space after
));
foreach ($_productCollection as $_product){
   echo $_product->getId().'
';
   echo $_product->getName().'
';
   echo $_product->getProductUrl().'
';
   echo $_product->getPrice().'
';
}

This is my code.

$needle= $_GET["singleid"];

$collections = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->load();

$collection = $collections->addAttributeToFilter('name', array('like' => '%'.$needle.'%'));
echo $collection->getSelect();

my sql query

SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IF(at_name.value_id > 0, at_name.value, at_name_default.value) AS `name` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
 INNER JOIN `catalog_product_entity_varchar` AS `at_name_default` ON (`at_name_default`.`entity_id` = `e`.`entity_id`) AND (`at_name_default`.`attribute_id` = '71') AND `at_name_default`.`store_id` = 0
 LEFT JOIN `catalog_product_entity_varchar` AS `at_name` ON (`at_name`.`entity_id` = `e`.`entity_id`) AND (`at_name`.`attribute_id` = '71') AND (`at_name`.`store_id` = 1) WHERE (IF(at_name.value_id > 0, at_name.value, at_name_default.value) LIKE '%s%')


texts: I am new to magento 2.x. I have created sitemap.xml, but it's not display in frontend. how to get sitemap url?


texts: magento 2 save timestamp and product qty in custom table

texts: I want to save timestamp and product qty in custom table, when the product qty is updated either by customer purchase or by admin


texts: Google craws errors of links that don't, and Never existed

texts:
In the last couple of days I'm having trouble with Googlebot crawlers.

I've experienced an increased of 404 links that don't exist, and have never existed.

Trying to see the origin of these 404 links is not possible so I really don't understand what's going on. The only thing that I can see is this:

Last crawled: 6/23/15

First detected: 6/23/15

Googlebot couldn't crawl this URL because it points to a non-existent page. Generally, 404s don't harm your site's performance in search, but you can use them to help improve the user experience. "

I don't have relative URL´s. All my URLs are absolute.

There are links that I already redirect to the correct one in the htaccess like this:

"Redirect 301 /en/wine/shipping-returns.html http://helloworld.com/en/shipping-returns.html"

The URL /en/wine/shipping-returns.html that was detected NEVER exist.

The thing is that the category wine was created. The problem is that the category as nothing to do with the page shipping-return.html.
The shipping-return.html is a CMS page and the category wine is a category of products.

The two together doesn´t make any sense. And would never had been together.

If I tried to see the origin of the tracking error it notifies me that it was on a specific page. But when I try to find out in the HTML code where the link is...it doesn´t exist. The only thing that exist is a link:

 Shipping and Returns

and another link:

Wine

So this is very frustating.

Can anyone help me?

Thank You


texts: display javascript result with php if condition

texts:
magento site : www.1234.com . In this page : www.1234.com/site6/orders.php We are trying to display Javascript result inside php if else condition

when we tried below code, If condition result is displaying , but else condition result is not displaying, also when i tried this code in else part : echo "display"; , than also result did't displayed.

function getDesignerCollection()
    {
    $user_home = new USER();
    require_once '../../app/Mage.php';

    Mage::app();

    $accountType = $rows['type'];
    if ($accountType == "admin")
        {
        $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id', array(
            'nin' => '0'
        ));

        }
    else
    {
    echo "<script>";
    echo "var colsOption = [
    {id: 'entity_id' , header: 'Order Id' , width :'15',renderer : my_renderId},
    {id: 'created_at' , header: 'Order Date' , width :'120'},
    {id: 'entity_id' , header: 'Order Id' , width :'75'},
    {id: 'product_id' , header: 'Product Id' , width :'70'}

     ];";
    echo "</script>";
    }
    }

here magento related code is displaying, but php & javascript code is not displaying.


texts: Magento 2 Send email to customer when import

texts:
Hello Magento Experts,

I would like to send email to customers when I am doing customer import on Magento 2.

Please help me to achieve this.

I found this is bug in Magento 2 here: https://github.com/magento/magento2/issues/10055

So I am planning to override Magento to write custom code to send a welcome email when doing the import.

I am going to override this model file in my custom module:

/var/www/html/magento2/vendor/magento/module-customer-import-export/Model/Import/Customer.php function _saveCustomerEntities line no. 263.

Please let me know if this approach is correct.


texts:
I created a theme in magento 2.0 that was working. Now, I updated the magento version to 2.1 and deployed the theme. The files get generated in pub/static folder but CSS files are not loading in head section. I am loading the CSS files as below:

default_head_blocks.xml

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

        <css src="css/test.css" />
        <css src="css/owl.carousel.css" />
        <link src="js/owl.carousel.js"/>

    </head>
</page>


texts: Is it possible to scrape a website's sitemap with no auth

texts: I was wondering if it's possible to access a website's sitemap to scrape their products if you do not have access to their Magento credentials.


texts:
I want to Load an Order By the Protected COde How I can do this

need Help. I am using Magento 2.3.5


texts: How To Properly Display Weight vs Destination Table Rates

texts:
First time using Magento. Still learning the ins and outs of this software. I am trying to setup table rates... but my CSV file that I keep uploading keeps yielding an error.

How would I write this in an CSV file, so Magento understands what I want?:

"Orders shipped to anywhere in the US weighing less than 5
pounds should charge $10 for shipping. Weighing more than 5 but less
than 10 pounds should charge $20 for shipping, and all other orders
should be charged $30 for shipping."

This is what I want to accomplish.

Here is what I have:


texts: How to fetch all products in the cart after place order button in my custom module

texts:
Step 1: I want to fetch all products in the cart and Show them with a form individually
Currently, I am fetching data using this code
<?php
namespace Softadroit\Prescription\Block;

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');

// retrieve quote items collection
$itemsCollection = $cart->getQuote()->getItemsCollection();

// get array of all items what can be display directly
$itemsVisible = $cart->getQuote()->getAllVisibleItems();

// retrieve quote items array
$items = $cart->getQuote()->getAllItems();

foreach($items as $item) {
    echo 'ID: '.$item->getProductId().'
';
    echo 'Name: '.$item->getName().'
';
    echo 'Sku: '.$item->getSku().'
';
    echo 'Quantity: '.$item->getQty().'
';
    echo 'Price: '.$item->getPrice().'
';
    echo "
";
}

And this is my prescription.phtml code, it shows me empty page in the frontend

<?php echo $items = $cart->getQuote()->getAllItems(); ?>

Step 2: How to display that page after placing an order (Before onepage/success)?
Actually I am new to Magento
Any help is really appreciated!


texts: Incorrect dependency error when run setup:di:compile command in magento 2.1.x

texts:
I have run command bin/magento setup:di:compile in my Magento 2.1.x.

I got below error.

  Solwin\ProductAttachment\Controller\Adminhtml\Attachment
    Incorrect dependency in class Solwin\ProductAttachment\Controller\Adminhtml\Attachment in /mnt/5BD419690F48D691/projects/work/214magento/app/code/Solwin/ProductAttachment/Controller/Adminhtml/Attachment.php
  \Magento\Backend\Model\View\Result\RedirectFactory already exists in context object

File is located at Vendor/Module/Controller/Adminhtml/Attachment.php

<?php

    namespace Vendor\Module\Controller\Adminhtml;

    use Magento\Backend\App\Action;
    use Magento\Backend\App\Action\Context;
    use Magento\Backend\Model\View\Result\RedirectFactory;
    use Magento\Framework\Registry;
    use Vendor\Module\Model\AttachmentFactory;

    abstract class Attachment extends Action
    {

        protected $_attachmentFactory;
        protected $_coreRegistry;
        protected $_resultRedirectFactory;

        public function __construct(
            AttachmentFactory $attachmentFactory,
            Registry $coreRegistry,
            RedirectFactory $resultRedirectFactory,
            Context $context
        )
        {
            $this->_attachmentFactory     = $attachmentFactory;
            $this->_coreRegistry          = $coreRegistry;
            $this->_resultRedirectFactory = $resultRedirectFactory;
            parent::__construct($context);
        }

        protected function _initAttachment()
        {
            $attachmentId  = (int)$this->getRequest()->getParam('attachment_id');

            $attachment    = $this->_attachmentFactory->create();
            if ($attachmentId) {
                $attachment->load($attachmentId);
            }
            $this->_coreRegistry->register('solwin_productattachment_attachment', $attachment);
            return $attachment;
        }
    }

Could anyone help me to find issue ?


texts: Magento 2 - InstallData script doesn´t add column to my 'customer_entitiy'

texts:
I´m now trying to add a custom attribute for like 5 hours now. It drives me nuts that I dont find the solution hope you can help me.

I want a custom attribute to be displayed and saved when the user wants to register in the frontend.

What I did :

Create Module

module.xml -> app/code/Magento/CustomerAttribute/etc

<?xml version="1.0" encoding="UTF-8"?>
<config  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Magento_CustomerAttribute"  setup_version="1.0.0">
        <sequence>
            <module name="Magento_Customer"/>
        </sequence>
    </module>
</config>

Create InstallData.php with my custom value

InstallData.php -> app/code/Magento/CustomerAttribute/Setup

<?php

namespace Magento\CustomerAttribute\Setup;

use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Customer\Model\Customer;
use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
/**
 * @codeCoverageIgnore
 */
class InstallData implements InstallDataInterface
{

    /**
     * @var CustomerSetupFactory
     */
    protected $customerSetupFactory;

    /**
     * @var AttributeSetFactory
     */
    private $attributeSetFactory;

    /**
     * @param CustomerSetupFactory $customerSetupFactory
     * @param AttributeSetFactory $attributeSetFactory
     */
    public function __construct(
        CustomerSetupFactory $customerSetupFactory,
        AttributeSetFactory $attributeSetFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
        $this->attributeSetFactory = $attributeSetFactory;
    }

    /**
     * {@inheritdoc}
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {

        /** @var CustomerSetup $customerSetup */
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
        $attributeSetId = $customerEntity->getDefaultAttributeSetId();

        /** @var $attributeSet AttributeSet */
        $attributeSet = $this->attributeSetFactory->create();
        $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

        $customerSetup->addAttribute(Customer::ENTITY, 'kndnumber', [
            'type' => 'varchar',
            'label' => 'Kunden nummer',
            'input' => 'text',
            'required' => false,
            'visible' => true,
            'user_defined' => true,
            'sort_order' => 1000,
            'position' => 1000,
            'system' => 0,
        ]);

        $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'kndnumber')
            ->addData([
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ['adminhtml_customer_address', 'customer_address_edit', 'customer_register_address'],
            ]);

        $attribute->save();
    }
}

After running php bin/magento setup:upgrade nothing happens the field was not added to the table customer_entitiy.

I tryed every tutorial on the Internet and still cant get it working. If I could debug that thing it would be a bit easier for developers.

Do you have any suggestions why this script doesnt work?


texts: How to Get Recently viewed Products in Magento 2

texts:
i want to get all data from magento core table
table name is

  report_viewed_product_index

i searched on stakeexchange and found some solution but havn't for success

class Wbtab extends \Magento\Framework\View\Element\Template
{
    protected $_recentlyViewed;

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Reports\Block\Product\Viewed $recentlyViewed,
        array $data = []
    ) {
        $this->_recentlyViewed = $recentlyViewed;
        parent::__construct($context, $data);
    }

    public function _prepareLayout()
    {
        return parent::_prepareLayout();
    }
    public function getOrderItems()
    {
        echo "<pre>";
        $collection = $this->_recentlyViewed->getItemsCollection();

        print_r($collection->load()->getData());
        exit();

    }
}


texts: TypeError: settings.$elementF.fotorama is not a function in gallery.js in magento 2.2.2

texts:
I have installed the porto theme but I got error in chrome.its working good in firefox.

require-config.js

var config = {
    deps: ['jquery'],
    map:{
        '*':{
            'fotorama/fotorama':'fotorama/fotorama'
        }
    },
    shim: {
        jquery: {
            exports: '$'
        },
        'Smartwave_Megamenu/js/sw_megamenu':
            {
                deps: ['jquery']
            },
        'owl.carousel/owl.carousel.min':
            {
                deps: ['jquery']
            },
        'js/jquery.stellar.min':
            {
            deps: ['jquery']
            },
        'js/jquery.parallax.min':
            {
            deps: ['jquery']
            },
        'fotorama/fotorama': {
            deps: ['jquery']
        },
        'mage/gallery/gallery': {
            deps: ['fotorama/fotorama']
        }
    }
};

getting below error in my console

Uncaught TypeError: settings.$elementF.fotorama is not a function
    at UiClass.initGallery (gallery.js:297)
    at UiClass.initialize (gallery.js:139)
    at UiClass.initialize (wrapper.js:109)
    at UiClass (class.js:49)
    at main.js:31
    at Object.execCb (db2cfb207124dfa2df050f1ef1a6e743.js:1650)
    at Object.context.execCb (resolver.js:131)
    at Module.check (db2cfb207124dfa2df050f1ef1a6e743.js:866)
    at Module.<anonymous> (db2cfb207124dfa2df050f1ef1a6e743.js:1113)
    at db2cfb207124dfa2df050f1ef1a6e743.js:132


texts:
I am trying to make a patch for a private method from the core of the magento/module-configurable-product module. I followed the instructions from here: https://magento.stackexchange.com/a/256580/6204 but when i run composer install, I simply get:
Cannot apply patch .....

This is my patch file:

diff --git a/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/Model/ResourceModel/Product/Indexer/Price/Configurable.php
index 3ee2rd..8349152 111644
--- a/Model/ResourceModel/Product/Indexer/Price/Configurable.php
+++ b/Model/ResourceModel/Product/Indexer/Price/Configurable.php
@@ -200,14 +200,14 @@
         );
         // Does not make sense to extend query if out of stock products won't appear in tables for indexing

-        if ($this->isConfigShowOutOfStock()) {
-            $select->join(
-                ['si' => $this->getTable('cataloginventory_stock_item')],
-                'si.product_id = l.product_id',
-                []
-            );
-            $select->where('si.is_in_stock = ?', Stock::STOCK_IN_STOCK);
-        }
+//        if ($this->isConfigShowOutOfStock()) {
+//            $select->join(
+//                ['si' => $this->getTable('cataloginventory_stock_item')],
+//                'si.product_id = l.product_id',
+//                []
+//            );
+//            $select->where('si.is_in_stock = ?', Stock::STOCK_IN_STOCK);
+//        }

         $select->columns(
             [

Can you advice why my patch is not working ? :) what did i do wrongly ? Thank you


texts: Magento 2.3 - Controller plugin redirect back to form loses form values

texts:
I have a plugin running on the aroundExecute of the Magento\Customer\Controller\Account\CreatePost controller.
use Magento\Framework\Controller\Result\RedirectFactory;
use Magento\Framework\UrlFactory;
use Magento\Framework\Message\ManagerInterface;

public function __construct(
    UrlFactory $urlFactory,
    RedirectFactory $redirectFactory,
    ManagerInterface $messageManager

)
{
    $this->urlModel = $urlFactory->create();
    $this->resultRedirectFactory = $redirectFactory;
    $this->messageManager = $messageManager;
}

public function aroundExecute(
    \Magento\Customer\Controller\Account\CreatePost $subject,
    \Closure $proceed
)
{
    $this->messageManager->addErrorMessage(
        'Error testing'
    );
    $defaultUrl = $this->urlModel->getUrl('*/*/create', ['_secure' => true]);
    $resultRedirect = $this->resultRedirectFactory->create();
    return $resultRedirect->setUrl($defaultUrl);

}

This works fine, but all form values on the registration form are lost on redirect back.
Any idea how I can pass them back to the original form and have them repopulate the form fields?
Thanks


texts:
I need to generate an .xml file from my extension. Inside Namespace/Module/view/adminhtml/ui_component/ folder,

I need to do this pro-grammatically because the .xml file will be generated based on data collection, is there a way to do this?


texts: Cannot "proceed to checkout" on certain product

texts:
When I add a particular product to my cart, I cannot proceed to checkout.

When I click "Proceed to checkout" on the shopping cart page, it just redirects me back to the same page.

I do not have any JS errors, nor do I have any errors in my error logs that come up when this happens.

The product is just like many others I have on the site, it's in stock.

I've cleared my caches, reindexed, etc, but nothings seems to work.

Any ideas?


texts: Magento 2.3 menu static block as dropdown

texts:
Currently in Magento 2.3 the dropdown menu only can show the subcategories. I want to change this so that the subcategories are not displayed but only a specific static block.

Inside that block I want to create my own navigation with subcategories and other content.

How can I achieve that?


texts:
I want to delete Admin website from my website, but if I delete my admin is not accessible anymore. Any ideas how I can delete that Admin Store safe?

This is my database:

store table

store_group table

store_website table


texts: Preference for Magento\Setup Classes not working

texts:
TLDR - Is there a reason I can't use preference for classes in Magento\Setup namespace, specifically during the setup:upgrade processing, OR is there something I am missing with the following preferences? They aren't being implemented.

I am trying to create a temporary module to override a couple classes under the Magento\Setup namespace. This reason behind this is because I am waiting for this PR to be deployed (https://github.com/magento/magento2/pull/18075) and in the meantime I need this functionality to work. So I'm creating a local module to implement this to avoid hacking core.

I have added two simple preferences same as I would in any other situation like this.

app/code/Company/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\Setup\Model\Installer" type="Company\Module\Model\Installer" />
    <preference for="Magento\Setup\Validator\DbValidator" type="Company\Module\Validator\DbValidator" />
</config>

I have created each of those classes and added the function I want to override with a simple logging in the first line. However neither of them are taking effect. The classes/functions are being called as part of the bin/magento setup:upgrade command. Below are shortened versions of my classes.

app/code/Company/Module/Validator/DbValidator.php

<?php
declare(strict_types=1);
namespace Company\Module\Validator;

class DbValidator extends \Magento\Setup\Validator\DbValidator
{
    //...construct and props declared here...

    public function checkDatabaseConnection($dbName, $dbHost, $dbUser, $dbPass = '')
    {
        $this->log->log("====Company::checkDatabaseConnection====");
        //...rest of the code to implement...
    }
}

app/code/Company/Module/Model/Installer.php

<?php
declare(strict_types=1);
namespace Company\Module\Model;

class Installer extends \Magento\Setup\Model\Installer
{
    //...construct and props declared here...

    private function assertDbAccessible()
    {
        $this->log->log("======Company::assertDbAccessible=====");
        //...
    }
}

I'm wondering if they are not taking effect because perhaps I'm trying to override Magento\Setup classes during the setup:upgrade functionality. Maybe there's something in the depths of this functionality that I'm missing that would cause this not to work.

UPDATE

I just found that the Magento\Setup component is actually being registered as a "setup" component instead of a "module" (found in setup/src/Magento/Setup/registration.php). Due to this it is bootstrapped differently than modules, and as such the typical Plugin (interceptor) and Preference mechanisms will not work. So now I'm stuck trying to figure out how I can extend/modify/override any functionality from setup without modifying the core files. Is there perhaps a unique way to use dependency injection or otherwise modify this "setup" component type with Magento?


texts:
For some reason after I recently imported in products using Magmi and now my root directory for some reason is showing up in the main navigation with the category showing in a pull down.  I've tried setting display in navigation menu to no but it still shows up.  I've also tried to change is active to no but it still shows up.  I've refreshed my computer's cache (F5) as well as Magento's.  Now, when I did the bulk import from Magmi, I've included the root directory followed by the next level category on the CSV using category Id (e.g. 2, 6).

Was I not supposed to add products to the root directory?  Could that have caused the issues or may be something.  I appreciate any help to resolve this issue.

Thanks

I used OpenOffice and saved it as Unicode UTF-8.  I can't seem to attach a file here to show the CSV.  Here's a snippet of the cells that may be affecting it.  Again, this is using magmi importer.

attribute_set   type    category_ids    websites
Dresses         simple   2,6            base

2 is the root category.  I'm not sure if I was supposed to add products to the root category or not and whether that may be causing the issue. I did also try to import the products in originally using categories column instead with both root category and category strung together with / but it wouldn't take so I used id's instead.  I'm not sure if that could be a cause as well.  Right now, if you click on the root category on the menu and the category beneath it, it shows that no products can be found.  All other navigational links on the man menu works perfect.

It's very strange and I can't seem to find anything on this issue.

Thanks.


texts:
I have a magento site.i following issue with the product url.

 - I have product A with url key as 'a'.
 - I have product B with url key as 'b'.

When i hit www.mysite.com/a it will redirect to www.mysite.com/b.

But when i hit product a from any category like www.mysite.com/category1/a it is redirecting to correct product.

Please Help Me.


texts: Adding template to admin panel results in strange behaviour

texts:
I am having some problems with adding files to the admin/sales_order_create/index page in Magento's admin/backend section. The js file is being rendered but twice. This is definitely not being called from anywhere else because if I comment it out from the layout file it's not even rendered once.

The phtml template doesn't render at all but when I put a javascript alert in it for some reason the alert popped up on page load. When this happened I added some markup to see if that would render also but it didn't despite the alert showing.

app/design/adminhtml/default/default/layout/mto.xml

<layout version="0.1.0">
     <adminhtml_sales_order_create_index>
         <reference name="head">
             <action method="addItem">
                 <type>skin_js</type>
                 <name>mto/js/createOrder.js</name>
             </action>
         </reference>
         <reference name="content">
             <block type="adminhtml/template" name="search" template="mto/index.phtml"/>
         </reference>
   </adminhtml_sales_order_create_index>
</layout>

app/design/adminhtml/default/default/template/mto/index.phtml

Any suggestions?


texts: How we can print array variable in log file of Magento 2?

texts:
I am trying to print array variable contents into a log file.

In Magento 1, it was possible using Mage::log(print_r($arr, 1), null, 'logfile.log');

For Magento 2, in class file I have written following code:

protected $_logger;

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

private function getValuesAsHtmlList(\Magento\Framework\Object $object) {
        $options = $this->getOptions($object);
       //$this->_logger->addDebug($options );
        $this->_logger->log(100,null,$options);
    }

When I execute the code after clearing the cache, Debug.log & system.log files are not showing the array contents.

Please share if anyone has any idea about it.


texts: Some product options remain disabled after the first selection

texts:
I am using Magento CE 1.9.2.4, and the Porto Theme.
I have some Configurable Products with a lot of variants (in some cases there are 5 attributes, each with several options).
Each variant has a Simple Product associated with it, and the prices are set up under the Super Product Attribute Configuration.

Everything looks correct in Admin as far as I can tell.

On the Front end product page, the first time you select your options is fine, some options are disabled (greyed out) based on the choices you select.
(For example, a certain Size may not be available in a certain Colour, and that Colour may not be available for one if the other choices etc)

However, if you then change your mind, and what to select a different combination of options, you can't do this because some options remain disabled.

You have to reload the page completely, to reset all the options back to 'Choose an option...'.

I understand this a theme issue, but it is expected behavior since RWD and Colour Swatches were introduced (as described in Configurable products..... Am I missing something?)

This doesn't sound right? It seems like a bug to me?!

If I change the 'Custom Design' of a product page to use something like the 'modern' theme instead, it works as I would expect.
The first drop-down options are not disabled, and if you change the value, it resets all the options below it to 'Choose an option...' and re-populates them accordingly.

I have looked though \app...[theme]......\options\configurable.phtml code and configurable.js but cannot find what causes this behavior.

Has anyone come across this issue? Or have any advice on how you would revert back to using 'just' the product options behavior described above (the pre RWD & Swatch Module behavior) without breaking the basic functionality of your child theme?

I imagine you could just delete the \app...[theme]......\options\configurable.phtml file and try and deal with the impact, but is there a better way?


texts: vat number required in Magento-2 checkout

texts:
I enabled the vat field from admin panel and now i want to make it required during checkout shipping step.

I have followed the steps described here but it is not working.
What is missing from the steps of the above link? Can you suggest how to solve this?

Thanks in advance


texts: Move related products to Right Column on product page Magento 1.9.0.1

texts:
In Magento 1.9.0.1, on product page "Related Products" appear just under the products description. I want to move this block to Right Column.

Please advise how to do this?


texts: Magento upgrade to 1.9.3.4 - is forms working without form_key output in templates

texts:
I've just upgraded to Magento v1.9.3.4 and have Enabled Form Key Validation On Checkout as recommended.  Magento also advices:

  Important! Enabling this option means that your custom templates used
  in checkout process contain form_key output. Otherwise checkout may
  not work.

However, even though we're using Idev_OneStepCheckout module which does not have <?php echo $this->getBlockHtml('formkey') ?> in any of it's templates our checkout still works.  And I can complete a purchase.

Am I testing it correctly, could the upgrade have failed some how? Perhaps, I should not be worried as everything is working but I don't understand why when our template don't include the form_key output.

I've searched the base directory and can see where the formkey is used in each of these templates, which are almost all overridden in our theme or another extension:

app/design/frontend/base//default/template/catalog/product/view.phtml:43:
app/design/frontend/base//default/template/checkout/cart/shipping.phtml:112:
app/design/frontend/base//default/template/checkout/cart.phtml:50:
app/design/frontend/base//default/template/checkout/multishipping/billing.phtml:94:
app/design/frontend/base//default/template/checkout/multishipping/overview.phtml:34:
app/design/frontend/base//default/template/checkout/multishipping/shipping.phtml:129:
app/design/frontend/base//default/template/checkout/onepage/billing.phtml:204:
app/design/frontend/base//default/template/checkout/onepage/login.phtml:69:
app/design/frontend/base//default/template/checkout/onepage/payment.phtml:40:
app/design/frontend/base//default/template/checkout/onepage/shipping.phtml:144:
app/design/frontend/base//default/template/checkout/onepage/shipping_method.phtml:46:
app/design/frontend/base//default/template/customer/address/edit.phtml:42:
app/design/frontend/base//default/template/customer/form/edit.phtml:33:
app/design/frontend/base//default/template/customer/form/login.phtml:42:
app/design/frontend/base//default/template/customer/form/newsletter.phtml:34:
app/design/frontend/base//default/template/oauth/authorize/form/login-simple.phtml:42:
app/design/frontend/base//default/template/oauth/authorize/form/login.phtml:39:
app/design/frontend/base//default/template/opc/customer/form/login.phtml:54:
app/design/frontend/base//default/template/opc/onepage/login.phtml:14:
app/design/frontend/base//default/template/persistent/checkout/onepage/billing.phtml:202:
app/design/frontend/base//default/template/persistent/checkout/onepage/login.phtml:75:
app/design/frontend/base//default/template/persistent/customer/form/login.phtml:41:
app/design/frontend/base//default/template/review/form.phtml:31:
app/design/frontend/base//default/template/sales/reorder/sidebar.phtml:41:
app/design/frontend/base//default/template/sendfriend/send.phtml:74:
app/design/frontend/base//default/template/wishlist/sharing.phtml:33:
app/design/frontend/base//default/template/wishlist/view.phtml:42:
app/design/frontend/base//default/template/wishlist/view.phtml:56:


texts: The best way to add an extra attribute to checkout shipping form fields

texts:
I want to know the best way to add some extra attributes ('disabled' & 'readonly') in shipping checkout form.

I found some workaround to bind a js in knockout but my js is loaded before the form !

  web/template/shipping-address/form.html

<form class="form form-shipping-address 22" id="co-shipping-form"
      data-bind="attr: {'data-hasrequired': $t('* Required Fields')},
                afterRender: function(){ //My js bind here
                    jQuery('input[name=postcode]').prop('readonly', true);
                    jQuery('input[name=postcode]').prop('disabled', true);
                    alert('ok');
                }">
...


texts:
I am installing smtp extension suddenly I am facing with below Mysql error message
https://prnt.sc/127cedv
SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
innodb_strict_mode = 0
innodb_log_file_size=100M
Hope you help


texts: Magento2 - programmatically add product attribute options

texts:
What is the right(official) way to programmatically add product attribute option in M2?
E.g. for manufacturer product attribute. Obviously existing option would be matched by "Admin" title value.


texts: Error in Adding product in product grid admin panel: Magento 2

texts:
I am trying to create the "Add Product" grid in admin panel in my custom module. I managed to create the grid and the Add product button is also getting displayed.

The issue here is on clicking the Add product button I am getting some JS errors and the page reloads without any of the products being added in the grid.

The error I am facing is,

configure.js:326 POST admin/sales/template/loadBlock/key/9d1f4989a90d8933aea24fc9668fe432525b25d15d53b442a03d0b5c5b89b12d/block/search,items,shipping_method,totals,giftmessage,billing_method?isAjax=true 404 (Forbidden)

How can I add the products in the product grid in my custom module.
 Please can anyone help me with the issue?


texts: i want to create a module for auto generate meta data(like this:Buy {product name} for Rs {price} at sitename.com | New Book | Authorised seller for {publihser}) on reindex data so what is observer event which run on Reindex data


texts:
In setting up a copy of the Magento site on a new server, when I try to view the website I get this message:

Array
(
[type] => 1
[message] => Class 'Varien_Autoload' not found
[file] => /home/matthewbutterwor/public_html/app/Mage.php
[line] => 54
)

Any ideas what it could be?


texts: How to customize billing address selection

texts:
i'm try to customize the billing select in "/checkout/#payment" i found the file list.html with this code

 1)">
    <select class="" name="billing_address_id" data-bind="
    options: addressOptions,
    optionsText: addressOptionsText,
    value: selectedAddress,
    event: {change: onAddressChange(selectedAddress())};
"></select>

and i don't know how to customize it using javascript o jquery see that it is a HTML file. i would from this

get something like that or like the default block of magento "customer/account"

(I'm using Magento 2.3.3)


texts: Having Multiple Setup Resources Under SQL Folder

texts:
Is it appropriate if maintaining the structure of setup resources folder structure as below ?

MyModule > Helper
           sql    > mymodule_customer_setup
                  > mymodule_directory_setup
                  > mymodule_setup

If above structure is fine, then how should I define in the config.xml? I am thinking to define like below:

<resources>
    <mymodule_customer_setup>
        <setup>
            <module>Package_MyModule</module>
        </setup>
    </mymodule_customer_setup>
    <mymodule_directory_setup>
        <setup>
            <module>Package_MyModule</module>
        </setup>
    </mymodule_directory_setup>
    <mymodule_setup>
        <setup>
            <module>Package_MyModule</module>
        </setup>
    </mymodule_setup>
</resources>


texts: Magento 2.3.4 BUG Undefined Offset Error

texts:
I am using magento 2.3.4 ver, i am getting following error if i try to apply filter,

Error:
Exception #0 (Exception): Notice: Undefined offset: -298 in /var/www/html/test/vendor/magento/framework/Search/Dynamic/Algorithm.php on line 302
How to solve this issue? Is it a configuration error?


texts: Image Uploading Issue, after supee-8788 version 2 in magento 1.9.1.0. Tried Flush Caches

texts:
When i was adding the product image in admin panel.  I am getting successfully uploaded text. but image cannot been uploading, could not seen in product page in frontend and backend Also

Tried:-
1. Go to Cache Management, Refresh all caches, Flush all other caches. Logout admin.
2. Clear browser caches, especially browser data and cached images & files. Close browser.
3. Clear your CDN Cache! (we are Not Using)
4. Reload Apache or restart your server
5. Open your fresh browser, and login to admin. Test your image upload. If still not working, use private browsing or incognito.

Above steps are not helped me.
Below image shows Google chrome error

Please Help me.


texts: Can I use my own attributes for the Magento 1 to Magento 2 migration tool?

texts:
I am trying to migrate some information from Magento 1 to Magento 2. I have created all my attributes, sets and group in Magento 2 and would like to migrate my M1 products to M2.

I assumed that I would be able to do this with the Magento 1 to Magento 2 migration tool, but it keeps trying to clear down my data in Magento 2. Can I skip this? Is my approach of only wanting to migrate certain data even going to work?


texts: Enable or disable checkout payment method based on user group

texts:
I've two types of customer: normal and business.
Normals users can pay with PayPal and Verified by Visa.
Business users can pay with Bank Transfer only.
How can I do this?


texts: Add class to Body If Template Paths Enabled

texts:
I know how to enable template paths and we are also using 'Easy Template Paths.' However, we want to disable some JavaScript when template paths are enabled.

To do so, we would like to add a class to the  tag only if template paths are enabled.  We've dug around a bit and figured that this has something to do with the 'getShowTemplateHints()' function (from /app/code/core/Mage/Core/Block/Template.php).

However, we are not sure what the if function in php would look like to detect if template paths are enabled.

This would look something like:

<body class="<?php echo $this->getBodyClass();?> <?php if(//need boolean to check here): ?>tpaths_enabled<?php endif;?>">

What we're unsure about is how to actually get the boolean value from Magento to check  if template paths are enabled.

Thanks in advance


texts:
I have a strange problem that I have spent hours trying to fix. For some reason the catalog search returns no results even though products are enabled and visible on the frontend.

I'm using

https://github.com/fheyer/sphinxsearch

which works fine on my dev box but on the live site it doesn't work and I'm running out of ideas on how to fix it.

It seems to be a common problem but none of the solutions that I have found seem to work.

Here's what I've done so far:

re-indexed from shell
cleared cache by deleting the var/cache folder
did a diff to see if any files are missing between development and live site
reinstalled the module
disabled the module

None of the above worked and I still can't search on the site, if anyone has come across this issue before I'd be grateful for some assistance.


texts: Magento admin section editing customer details hangs in IE

texts: Customer details are not saved on Edit customer details in admin in IE. It hangs saying "Please wait". It works fine in other browsers. Attached is the screenshot in IE 8 compatibility mode.


texts: In which table does customer data get saved, in particular created_from?

texts: I'm wondering where the customer data get saved in Magento. Actually it seems to be pretty clear - in one of the customer_* tables. But I can't find the email_address nor the "created_from" values. Can anyone point me in the right direction? Thanks!


texts: "Add to Cart" not working after moved local server to live server in Magento 2

texts:
Add to cart functionality not working after moved files and database from local computer server to live server.

Same files and database is works fine for local computer.

After moved files and database, I have done these:

Changed paths/URL.
Reindex.
Setup upgrade
Static content deploy.
Cleared cache.

So, Any idea guys why i am having this issue ?

Thanks in advance.


texts: Finding stock numbers for products on magento sites

texts: to start this question, i'd like to say that i'm a complete noob and dont really know how to read code. i'd just like to know how to find inventory/stock numbers on certain products on magento sites, such as ENDclothing.com. could anyone help me learn how to use this code so that i can find these values? thank you in advance


texts:
UPDATE

When I was reposting this edit I'd come to realize that you can only develop directly in the modules, since it would be idiotic to develop in the Magento source, move the code to the module and then create the symlinks. Sorry for wasting your time.

Original Post

I have just taking over a project that uses Modman with a Magento installation. I understand, that it uses Modman to create symlinks between the Magento installation and the modules you're building. So far so good.

The thing that bothers me is, I can not see how you would develop something without testing all the time and if you build it in a folder beside the Magento installation, should I "compile" it (create the symlinks), every time I make a change?

How do you guys keep a good workflow when developing with Modman?

If you haven't guessed, I'm pretty new to developing in Magento and with Modman, so bare with me.

// Ulrik McArdle


texts:
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs' in

I have multiple product attribute and I got below link
https://www.sonassi.com/knowledge-base/magento-kb/mysql-limitations-on-the-flat-catalogue-in-magento/

because we  want to use that attrbute in product listing also but its not helpful for me and I am using magento 1.7.0.2


texts: How to get Magento 2 Customizable Options with REST API

texts: I have customizable options in configurable products. How can I get it via REST API?


texts: Login from PHTML template (1.9) [Resolved]

texts:
The problem was that the following:

<?php echo $this->getBlockHtml('formkey') ?>

Had to be added to:

   template/customer/form/register.phtml

I am using the following inside a PTHML file:

if(!Mage::getSingleton('customer/session')->isLoggedIn()){
  echo "
YOU ARE NOT LOGGED IN
";
  echo $this->getLayout()->createBlock('customer/form_register')->setTemplate('customer/form/register.phtml')->toHtml();
  echo "

";
  echo $this->getLayout()->createBlock('customer/form_login')->setTemplate('customer/form/mini.login.phtml')->toHtml();
}

This creates the forms, as expected, however when I fill out the registration form and click the submit button I am directed to:

domain.com/customer/account/create/

When I fill out the login form I am redirected to:

domain.com/customer/account/login/referer/aHR0cDovL2Rldi53d3cucHJvdGVjdHlvdXJib3VuZGFyaWVzLmNhL2N1c3RvbWVyL2FjY291bnQvaW5kZXgv/

The user is not successfully logged in at this point.

I don't see any errors in the log files. Am I missing something? I wonder could it be related to the formkey stuff that was added?

My ultimate goal is:

User comes to Page X while not logged in.
User registers and/or logs in. (this is where I am stuck)
User is returned to the Page X. (I have an observer that should work once above is solved)


texts: Magento 2.4.1 Commerce Google Recaptcha script sending information to US servers. Can this be changed?

texts:
I'm using native Google Recaptcha functionality.
I'm also using cookiebot. In a recent scan they said that scripts that set cookies related to recaptcha send information ot the US, this not being adequate for EU countries under GDPR regulations.
Is there anything to do abt this?
I should mention that I've tried in my Google Account to configure where is the information sent with no luck.


texts: Apply all filters/sortby to Mage::getModel

texts:
How do I use the filters that the user set in the toolbar, when I load my product like this:

$_productCollection = Mage::getModel('catalog/category')->load($childId)
                 ->getProductCollection()
                 ->addAttributeToSelect('*') // add all attributes - optional
                 ->addAttributeToFilter('status', 1) // enabled
                 ->addAttributeToFilter('visibility', 4) //visibility in catalog,search
                 ->setOrder('price', 'ASC'); //sets the order by price

But by default it loads all the products like this:

$_productCollection = $this->getLoadedProductCollection();

The default method reads all the options somehow.
Can't I do that too with my method.

The only restriction is that I have to load the products by a category ID.


texts: Update product weight in Magento 1.9.x script

texts:
I'm writing a script to update product weight programmatically in magento 1.9.x.
The file contains more than ~50000

When I start script the execution time for 100 records is 20 seconds, then the execution time happen very slow, 1 second for item.

Why the first execution set of 100 items is fast, but next sets are very slow?
Do you have any Idea, how can I fix this issue?

require_once $mageFilename;
ini_set('display_errors', 1);
umask(0);
Mage::app('admin');
Mage::register('isSecureArea', 1);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

/***************** UTILITY FUNCTIONS ********************/

function show_status($done, $total, $size=30)
{
    static $start_time;

    // if we go over our bound, just ignore it
    if($done > $total) return;

    if(empty($start_time)) $start_time=time();
    $now = time();

    $perc=(double)($done/$total);

    $bar=floor($perc*$size);

    $status_bar="\r[";
    $status_bar.=str_repeat("=", $bar);
    if($bar<$size){
        $status_bar.=">";
        $status_bar.=str_repeat(" ", $size-$bar);
    } else {
        $status_bar.="=";
    }

    $disp=number_format($perc*100, 0);

    $status_bar.="] $disp%  $done/$total";

    $rate = ($now-$start_time)/$done;
    $left = $total - $done;
    $eta = round($rate * $left, 2);

    $elapsed = $now - $start_time;

    $status_bar.= " remaining: ".number_format($eta)." sec.  elapsed: ".number_format($elapsed)." sec.";

    echo "$status_bar  ";

    flush();

    // when done, send a newline
    if($done == $total) {
        echo "\n";
    }
}

function _getConnection($type = 'core_read')
{
    return Mage::getSingleton('core/resource')->getConnection($type);
}

function _getTableName($tableName)
{
    return Mage::getSingleton('core/resource')->getTableName($tableName);
}

function _checkIfSkuExists($sku)
{
    $connection = _getConnection('core_read');
    $sql        = "SELECT COUNT(*) AS count_no FROM " . _getTableName('catalog_product_entity') . " WHERE sku = ?";
    $count      = $connection->fetchOne($sql, array($sku));
    if($count > 0){
        return true;
    }else{
        return false;
    }
}

function _getIdFromSku($sku)
{
    $connection = _getConnection('core_read');
    $sql        = "SELECT entity_id FROM " . _getTableName('catalog_product_entity') . " WHERE sku = ?";
    return $connection->fetchOne($sql, array($sku));
}

$csv                = new Varien_File_Csv();
$data               = $csv->getData('weight.csv'); //path to csv
array_shift($data);
$message = '';
$count   = 1;
$total = count($data);
$data_chunk = array_chunk($data, 100);

foreach($data_chunk as $data_c){
    foreach($data_c as $_data){
        if(_checkIfSkuExists($_data[0])){
            try{
                $product = Mage::getModel('catalog/product')->load(_getIdFromSku($_data[0]));
                if(isset($_data[1])){
                    $weight = $_data[1];
                    $product->setWeight($weight);
                    $product->save();
                }
                $message .=  $count .'>Weight for Sku (' . $_data[0] . ')' . "\n";
            }catch(Exception $e){
                $message .=  $count .'> Error:: While Upating Weight to (' . $_data[1] . ') of Sku (' . $_data[0] . ') => '.$e->getMessage() . "\n";
            }
        }else{
            $message .=  $count .'> Error:: Product Model (' . $_data[0] . ') does\'t exist.' . "\n";
        }
        $count++;
        show_status($count, $total, $size=30);
    }
    sleep(1);
    unset($data_c);
}

  weight.csv

sku,weight
item_1,16.40
item_2,22.50
........


texts: Magento store switcher shows empty field for a particular store

texts:
As seen in the screenshot above, the store switcher showes an empty row for a particular website.

I've checked stores config and it is fine there.

Also checked core_website, core_store and core_group in the database and the information is ok there.

Tried deleting the website and recreating it, same issue. Tried reindexing, cache.

My question, what is the table in the database from where the store switcher grabs the info? Maybe if I edit the db manually it will solve it. Or anything else that I can try.


texts: I have to make an API where I can return orders (product name) placed by a customer using customer Id?

texts: In sales_order table product name field  is not there but i have to fetch that too. How to fetch the product name ordered by a customer using customer ID?


texts: Magento 2 - Load a Form Based on a Shipping Method

texts:
I have a shipping extension that has a small form appear when the user selects the shipping method.  The problem is that we used jQuery to show/hide the form based on the selection but the form is always there.  Because it is always there it shows (labels with no data) on the order in the admin and the order emails.  Is there something you know of that will not load the form unless the method is chosen?
Thanks for your help!


texts: Showing company name on payment section in Magento 2

texts:
I have successfully shown the company name by overriding the Magento_Checkout/template/shipping-address/address-renderer/default.html file. And I tried to show the company name on the payment section, but not.

I tried the address().company code from Magento214/vendor/magento/module-offline-payments/view/frontend/web/template/payment/purchaseorder-form.html file but it's throwing the error.

Any suggestion on this?


texts: Magento query to select all customer info

texts:
I am looking for a query with all the customer info that I can dump into a CSV from SQL. I am working with a broken site and the customer wants all the customer info.

Please don't write one yourself as I can do that, just seeing if anyone has one already written.


texts:
I am having trouble with googlebot crawling through our layered navigation. I get numerous logs like:

GET /shop/dresses?clothing_size=250&color=247&dir=desc&limit=15&mode=list&order=position
GET /shop/dresses?clothing_size=268&color=248&dir=asc&order=name
GET /shop/sale?clothing_size=252&dir=asc&limit=5&mode=grid&order=name&price=50-100

Here is a copy of my robots.txt

User-agent: Googlebot-Image
Disallow: /
Allow: /shop/media/catalog/product/
Allow: /shop/media/wysiwyg/

# Crawlers Setup
User-agent: *

# Directories
Disallow: /shop/404/
Disallow: /shop/app/
Disallow: /shop/cgi-bin/
Disallow: /shop/downloader/
Disallow: /shop/errors/
Disallow: /shop/includes/
#Disallow: /shop/js/
#Disallow: /shop/lib/
Disallow: /shop/magento/
#Disallow: /shop/media/
Disallow: /shop/pkginfo/
Disallow: /shop/report/
Disallow: /shop/scripts/
Disallow: /shop/shell/
Disallow: /shop/skin/
Disallow: /shop/stats/
Disallow: /shop/var/
Disallow: /offline/

# Paths (clean URLs)
Disallow: /shop/index.php/
Disallow: /shop/catalog/product_compare/
Disallow: /shop/catalog/category/view/
Disallow: /shop/catalog/product/view/
Disallow: /shop/catalogsearch/
#Disallow: /shop/checkout/
Disallow: /shop/control/
Disallow: /shop/contacts/
Disallow: /shop/customer/
Disallow: /shop/customize/
Disallow: /shop/newsletter/
Disallow: /shop/poll/
Disallow: /shop/review/
Disallow: /shop/sendfriend/
Disallow: /shop/tag/
Disallow: /shop/wishlist/
Disallow: /shop/catalog/product/gallery/

# Files
Disallow: /cron.php
Disallow: /cron.sh
Disallow: /error_log
Disallow: /install.php
Disallow: /LICENSE.html
Disallow: /LICENSE.txt
Disallow: /LICENSE_AFL.txt
Disallow: /STATUS.txt
Disallow: /.DS_Store
Disallow: /api.php
Disallow: /get.php
Disallow: /mage

# Paths (no clean URLs)
#Disallow: /*.js$
#Disallow: /*.css$
Disallow: /*.php$
Disallow: /*?p=*&
Disallow: /*?SID=

How can I rewrite my robots.txt to block these urls?


texts: Magento2: I want to set custom quote price programmatically

texts:
I want to set custom quote price programmatically. Without the observer method.

The observer method is working fine but it is worked on add to cart button.

Please check my observer file below

<?php
namespace Codism\Csr\Observer;

use Magento\Framework\Event\ObserverInterface;

class CustomPrice implements ObserverInterface
{
    protected $_request;

    public function __construct(\Magento\Framework\App\RequestInterface $request)
    {
        $this->_request = $request;
    }

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

        $item = $observer->getEvent()->getData('quote_item');
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
        $price = 100; //set your price here
        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);
        $item->getProduct()->setIsSuperMode(true);
    }

}

I want to set custom quote price using the controller. Please tell me how is it possible.


texts: Custom product type not working in frontend

texts:
Following this tutorial (Link) I created a custom product type that exends \Magento\Catalog\Model\Product\Type\Simple for myself.

I can choose custom options, quantity etc. in the backend but nothing is showing up in my frontend page, just the name and price are displaying, not even an "add to cart" button.

Where did I go wrong?

MyVendor/MyModule/etc/product_types.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_types.xsd">
    <type name="print_default" label="Print [Standard]" modelInstance="MyVendor\MyModule\Model\Product\Type\printDefault"></type>
</config>

MyVendor/MyModule/Model/Product/Type/printDefault.php

<?php

namespace MyVendor\MyModule\Model\Product\Type;

class printDefault extends \Magento\Catalog\Model\Product\Type\Simple
{
    /**
     * Product type code
     */
    const TYPE_CODE = 'print_default';

    public function deleteTypeSpecificData(\Magento\Catalog\Model\Product $product)
    {
    }
}

MyVendor/MyModule/Setup/InstallData.php

<?php

namespace MyVendor\MyModule\Setup;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
    /**
     * EAV setup factory
     *
     * @var EavSetupFactory
     */
    protected $eavSetupFactory;

    /**
     * Init
     *
     * @param EavSetupFactory $eavSetupFactory
     */
    public function __construct(EavSetupFactory $eavSetupFactory)
    {
        $this->eavSetupFactory = $eavSetupFactory;
    }

    /**
     * {@inheritdoc}
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        /** @var EavSetup $eavSetup */
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

        //associate these attributes with new product type
        $fieldList = [
            'price',
            'special_price',
            'special_from_date',
            'special_to_date',
            'minimal_price',
            'cost',
            'tier_price',
            'weight',
        ];

        // make these attributes applicable to new product type
        foreach ($fieldList as $field) {
            $applyTo = explode(
                ',',
                $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')
            );
            if (!in_array(\MyVendor\MyModule\Model\Product\Type\printDefault::TYPE_CODE, $applyTo)) {
                $applyTo[] = \MyVendor\MyModule\Model\Product\Type\printDefault::TYPE_CODE;
                $eavSetup->updateAttribute(
                    \Magento\Catalog\Model\Product::ENTITY,
                    $field,
                    'apply_to',
                    implode(',', $applyTo)
                );
            }
        }
    }
}


texts: Create object using object manager in magento 2

texts:
I want to load that $configLoader without constructor i tried like below, but it's not working please tell me any other way to load that ConfigLoaderInterface without constructor.

<?php
namespace NameSpace\Module\Console\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Magento\Framework\Exception\LocalizedException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CustomCommandClass extends Command
{
    public function __construct(
        \Magento\Framework\App\State $state,
        \Magento\Framework\ObjectManagerInterface $objectManager,
        \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader
    ) {
        $state->setAreaCode('frontend'); //SET CURRENT AREA
        $objectManager->configure($configLoader->load('frontend')); //SOLUTION
        parent::__construct();
    }
}

I tried like below without constructor,

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
$configLoader = $objectManager->create('Magento\Framework\ObjectManager\ConfigLoaderInterface');
$objectManager->configure($configLoader->load('frontend'));


texts: 301 Redirect Not Working. URL syntax bad for the .htaccess file?

texts:
I'm trying to redirect a few URLs. Other URLs work fine, but this group of URLs do not. Does anyone know what the issue is? I've tried to redirect through Magento and through the .htaccess.

This is how I've laid out the redirects in the .htaccess file:

301 Redirect /Blog/post/feed/2013/06/20/NASA-Gets-In-On-the-Search-and-Rescue-Game-to-Further-Space-Exploration?format=ATOM http://www.actuatorzone.com/blog


texts:
I am calling this endpoint /rest/V1/customers/me to change user password thorugh PUT request with request body:

   {
   "customer": {
       "firstname": "abc",
       "lastname": "abc",
       "email":"rrr@gmail.com",
       "website_id": 0,
       "addresses": [
           {
               "region": {
                   "region_code": "21",
                   "region": "Pakistan",
                   "region_id": 92
               },
               "region_id": 92,
               "country_id": "PK",
               "street": [
                   "assa"
               ],
               "city": "lahore",
               "firstname": "def",
               "lastname": "def",
               "telephone": "98798798798",
               "postcode": "987987",

               "default_shipping": true,
               "default_billing": true

           }
       ],
       "passwordHash"  : "Admin123123"

   }
   }

I am getting this error:

"message": "Internal Error. Details are available in Magento log file. Report ID: webapi-5cacb11c9a67c

When i've checked the magento log file it shows me this exception:

Message: Property "PasswordHash" does not have accessor method "getPasswordHash" in class "Magento\Customer\Api\Data\CustomerInterface"

I have seen this ref but it didn't works for me. Magento 2: Property does not have accessor method in class "Magento\Checkout\Api\Data\ShippingInformationExtensionInterface

Please help!


texts:
i user ajax to create popup. I have file app/code/Commercers/Course/view/frontend/templates/managecourse.phtml

   View Information

    <colgroup>
        <col width="1">
        <col width="1">
        <col width="1">
        <col width="1">
    </colgroup>

            Course
            Details
            Date From
            Date To

And my file controller

<?php
namespace Commercers\Course\Controller\Manage;

use Magento\Framework\Controller\ResultFactory;

class Information extends \Magento\Framework\App\Action\Action
{
public function __construct(
    \Magento\Framework\App\Action\Context $context
) {
    return parent::__construct($context);
}

public function execute()
{
    echo 1;exit;
    $this->_view->loadLayout();
    $this->_view->renderLayout();
}

}

Please help me!


texts: Edited CSS but not reflecting even after flushing Magento cache

texts:
I have done some minor changes in CSS, but it's not reflecting on my frontend even after flushing Magento cache.
To see the changes I have to hard refresh my website everytime I reload.


texts:
I have custom price field for specific product where user can input their desire product price, and i try to add the product to the cart programmatically, the problem is i need to change the product price to price which the user input, here's what i've got so far:

    $qty = $_REQUEST['qty'];
    $price = $_REQUEST['price'];
    $finalPrice = $price / $qty;

    $sku = 'BLA-01';
    $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
    /*
     need to chage the product price here
     $product->setCustomPrice($finalPrice);
    */
    $cart = Mage::getModel('checkout/cart');
    $cart->init();
    $params = array(
        'product' => $product->getId(),
        'qty' => $qty,
        'form_key' => Mage::getSingleton('core/session')->getFormKey(),
    );
    $request = new Varien_Object();
    $request->setData($params);
    try {
        $cart->addProduct($product->getId(), $request);
        $cart->save();
    } catch (Exception $e) {
        print_r($e->getMessage());
    }
    Mage::getSingleton('checkout/session')->setCartWasUpdated(true);