texts: Magento 2 - How to check customer is logged in or not using cookie?

texts:
I want to achieve below functionality.

When user visit my website I want to setup cookie for example 30 second, After 30 second if user is not register then ask him/her for registration. It is just like registration reminder.

Can anyone help me how can I Implement this functionality.

Any help would be appreciate.


texts: Magento 2 Category attribute not creating

texts:
I am using below Script it's working in my local but its not working in my Live Sever

InstallData.php

<?php

namespace Namespace\ModuleName\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;

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

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

    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        /** @var EavSetup $eavSetup */
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        if (version_compare($context->getVersion(), '1.0.0') < 0){
            $eavSetup -> addAttribute(\Magento\Catalog\Model\Category :: ENTITY, 'test', [
                        'type' => 'text',
                        'label' => 'Test',
                        'input' => 'textarea',
                        'required' => false,
                        'sort_order' => 110,
                        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                        'wysiwyg_enabled' => true,
                        'is_html_allowed_on_front' => false,
                        'group' => 'General Information',
                        "default" => "",
                        "class"    => "test",
                        "note"       => "test"
            ]
            );
            $eavSetup -> addAttribute(\Magento\Catalog\Model\Category :: ENTITY, 'test1', [
                        'type' => 'text',
                        'label' => 'test1',
                        'input' => 'textarea',
                        'required' => false,
                        'sort_order' => 120,
                        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                        'wysiwyg_enabled' => true,
                        'is_html_allowed_on_front' => false,
                        'group' => 'General Information',
                        "default" => "",
                        "class"    => "test1",
                        "note"       => "test1"
            ]
            );
            $eavSetup -> addAttribute(\Magento\Catalog\Model\Category :: ENTITY, 'test2', [
                        'type' => 'text',
                        'label' => 'test2',
                        'input' => 'textarea',
                        'required' => false,
                        'sort_order' => 130,
                        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                        'wysiwyg_enabled' => true,
                        'is_html_allowed_on_front' => false,
                        'group' => 'General Information',
                        "default" => "",
                        "class"    => "test2",
                        "note"       => "test2"
            ]
            );
        }

    }
}

Error : Attribute with attributeCode "test" does not exist.


texts: Automatically publishing new added product to social media

texts:
I want to add this functionality to my store, when the store owner add a new product to the store. I want to share this product automatically in social media hubs (Facebook, Instagram, twitter and google+), share it on Facebook like posting it on a facebook page.

I don't know where I should start. Could you give me a hint how to do this?

Edit one: I think it is better to handle the process of auto posting using script files. Suppose I have a controller outside Magento scope that will use Magento SOAP api to get the product then post it to social network. I want a way to pass the product id to this controller when the admin adds the product using get request. I searched inside the code and found two ways to do it.

First way to override saveAction() in Mage_Adminhtml_Catalog_ProductController. And the second way to override _afterSave()in Mage_Catalog_Model_Product which one is better ?


texts: Notice: Array to string conversion in Magento 2

texts:
I have created Magento2 Api which is working fine when return type is string and When return type is Array it's throwing Error.

  Error: main.CRITICAL: exception 'Exception' with message 'Report ID:
  webapi-5612096a251d1; Message: Notice: Array to string conversion.

my code is:

app/etc/config.php

modules' =>
  array (
    'Learning_Test' => 1,
  ),

app/code/Learning/TestWebService/Api

<?php
namespace Learning\TestWebService\Api;

interface TestInterface
{
     /**
     * Return the Concatenate of the two values.
     *
     * @api
     * @param string $name1  Left hand operand.
     * @param string $name2 Right hand operand.
     * @return array list of the two values.
     */
    public function say($name1,$name2);
}

app/code/Learning/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <preference for="Learning\TestWebService\Api\TestInterface" type="Learning\TestWebService\Model\Test" />
</config>

app/code/Learning/etc/webapi.xml

<?xml version="1.0"?>

<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd">
    <route url="/V1/test/say/:name1/:name2" method="GET">
        <service class="Learning\TestWebService\Api\TestInterface" method="say"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>
</routes>

app/code/Learning/TestWebService/Model/Test.php

<?php
namespace Learning\TestWebService\Model;

use Learning\TestWebService\Api\TestInterface;

class Test implements TestInterface
{
    /**
     * * Return the Concatenate of the two values.
     *
     * @api
     * @param string $name1 Left hand operand.
     * @param string $name2 Right hand operand.
     * @return array list of the two values
     */
    public function say($name1,$name2) {

        return array(
            'name1' => $name1,
            'name2' => $name2,
        );
    }
}

Could you please suggest me how to return Array?


texts: Magento 2: Controlling M2 via command line – when and why to use each command

texts:
When making changes to my Magento 2 site, I usually run a few of the command line commands to 'refresh' my site to see the changes I've made. The problem is, I'm not too sure what each command really does and when to use a particular one... Meaning I usually run a lot of them 'just to make sure' the site's refreshed and my changes will take effect.

When I make changes to the template layout.xml files I just use

php bin/magento cache:clean

If I make changes to the .phtml files or .php files, I usually run:

php bin/magento setup:static-content:deploy
php bin/magento setup:upgrade
php bin/magento cache:clean

and php bin/magento cache:flush – just to make sure!

I have no doubt this is overkill and I'm using some commands unnecessarily.

Could someone explain what each command actually does and when (and why) it would be correct to use each one?

Here's a list of commands which I think would be useful to know the reasons for using each of them:

php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:static-content:deploy
php bin/magento setup:upgrade
php bin/magento setup:di:deploy

For example, if I were to update a .phtml file, which commands should I run to make sure I see my changes? A .php file? layout.xml files?

Thank you!


texts: How to send wishlist item quotation in PDF format via email to customer- Magento 1.9

texts:
I want to send the wishlist quotation in PDF format to the currently logged in customer.

Magento has the option to share a wishlist, but it only lets you share with another recipient where as I would like the user to be able to click and have the quotation emailed to themselves in a PDF format.

This is complete new for me so please help me. thanks in advance


texts: Is it possible to pass data from layout xml to static block

texts:
In Magento 1, I want to do this:
From Custom Layout Update, pass data via setData or some other way to a static block,

<reference name="left">
    <block type="cms/block" name="side_tabs" before="-">
        <action method="setData">
        <name>cms_target</name>
        <value>info_page</value><!-- url-key to a cms page -->
        </action>
        <action method="setBlockId"><block_id>side_tabs</block_id></action>
    </block>
</reference>

In a static block I want to use the passed data to customize the static block's functionality

 <a href="{{store url=''}}{{cms_target}}" target="_blank">

I know the above doesn't work.
Is something similar to this possible?

The use case is customizing the static block's function depending on the category page it is displayed on.


texts: Custom admin configuration tab not showing Magento CE 2.1

texts:
I am trying to add a configuration tab to the magento admin for my custom module. The problem is that the tab is not showing and no error is given.

this is my acl.xml

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

                                <resource id="Xlii_Ekomi::config_xlii_ekomi" title="Helloworld Section" sortOrder="80" />
                            </resource>
                        </resource>
                    </resource>
                </resource>
            </resources>
        </acl>
    </config>

and this is my system.xml

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

            <tab id="xlii" translate="label" sortOrder="300">
                Darsh Banner
            </tab>

                Helloworld
                <tab>xlii</tab>

                <resource>Xlii_Ekomi::config_xlii_ekomi</resource>

            <group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                General Options
                <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Enabled
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </system>
    </config>


texts: Magento 2 save custom order status in custom table using custom module

texts:
I have created a custom module for show the custom order status in the admin. It's working fine and displaying the static.

Now, I want to save the status value in the custom table with the current order ID. Please see the below image:

Below is my module code and files path:

app/code/Vendor/MyModuleName/registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_MyModule',
    __DIR__
);

app/code/Vendor/MyModuleName/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\Sales\Block\Adminhtml\Order\View\Info" type="Vendor\MyModuleName\Block\Adminhtml\Order\View\Info"/>
</config>

app/code/Vendor/MyModuleName/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="Vendor_MyModuleName" setup_version="2.0.0">
        <sequence>
            <module name="Magento_Sales"/>
        </sequence>
    </module>
</config>

app/code/Vendor/MyModuleName/view/adminhtml/layout/sales_order_view.xml

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

        <referenceBlock name="order_info">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">order/view/info.phtml</argument>
            </action>
        </referenceBlock>
        <referenceBlock name="content" after="order_totals">
            <block class="Vendor\MyModuleName\Block\Adminhtml\Order\View\Custom" name="sales_order_view_custom" template="order/view/custom.phtml" />
        </referenceBlock>

</page>

app/code/Vendor/MyModuleName/view/adminhtml/templates/order/view/custom.phtml

        <?php /* @escapeNotVerified */ echo __('Custom Dropdown') ?>

        <?php /* @escapeNotVerified */ echo __('Custom Status') ?>

            <select name="custom[status]" id="custom_status" class="admin__control-select">
                <?php $customStatus = array('1' => 'Custom Option 1', '2' => 'Custom Option 2');
                    foreach ($customStatus as $_code => $_label): ?>
                    <option value="<?php /* @escapeNotVerified */ echo $_code ?>"><?php /* @escapeNotVerified */ echo $_label ?></option>
                <?php endforeach; ?>
            </select>

        <button title="Submit Comment" type="button" class="action-default scalable action-save action-secondary" data-ui-id="widget-button-0">
            Submit Status
        </button>

app/code/Vendor/MyModuleName/Block/Adminhtml/Order/View/Custom.php

<?php
namespace Vendor\MyModuleName\Block\Adminhtml\Order\View;

class Custom extends \Magento\Backend\Block\Template
{

}

How I can save the dropdown value in the below table and get the value in respect of current order id below is custom_table structure:

Please help out how I can achieve this? Thanks


texts: Magento 1.7 : Custom Option Validation Dependent on another Custom Option

texts:
I need help to apply validation on custom option, that is dependent on another custom option value.

Here is the image, which describes what I actually want :

Please suggest, I am using Custom Options, Not Configurable Products


texts: Mageto2 product listing page random product

texts:
when we refresh the product listing page , it always show the random position for the products. we set the default sort by the position and did not assign any position to products for this category.
what could be wrong ?
Thanks


texts: magento 2: where are methods ($_product->getResource()->getAttribute($_code)->getFrontend()->getValue($_product)) declared?

texts:
lets say in my catalog_product_view.xml I have this additional Block:

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.demo" template="product/view/warranty.phtml" after="product.info.price">

in warranty.phtml I use the following:

$_product = $block->getProduct();
$_attributeLabel = $_product->getResource()->getAttribute($_code)->getFrontendLabel();
$_attributeValue =$_product->getResource()->getAttribute($_code)->getFrontend()->getValue($_product);

In the block class Description.php:

 public function getProduct()
{
    if (!$this->_product) {
        $this->_product = $this->_coreRegistry->registry('product');
    }
    return $this->_product;
}

We use getProduct() to get product object from registry.

Info: This product object was earlier first obtained and then put in the registry, in class Magento\Catalog\Helper\Product:

     ...
    try {
             //productRepository is Catalog\Api\ProductRepositoryInterface
            //getById() returns \Magento\Catalog\Api\Data\ProductInterface
        $product = $this->productRepository->getById($productId, false, $this->_storeManager->getStore()->getId());
    } catch (NoSuchEntityException $e) {
        return false;
    }
    ...
         //put obtained product object into registry
    $this->_coreRegistry->register('product', $product);

Method getById() in Catalog\Api\ProductRepositoryInterface:

     * @param int $productId
 * @param bool $editMode
 * @param int|null $storeId
 * @param bool $forceReload
 * @return \Magento\Catalog\Api\Data\ProductInterface
 * @throws \Magento\Framework\Exception\NoSuchEntityException
 */
public function getById($productId, $editMode = false, $storeId = null, $forceReload = false);

Soo: our product-object in warranty.phtml $_product = $block->getProduct(); should be \Magento\Catalog\Api\Data\ProductInterface right ?

Also:
In warranty.phtml we call $_attributeValue =$_product->getResource()->getAttribute($_code)->getFrontend()->getValue($_product); , but there are no such methods defined in \Magento\Catalog\Api\Data\ProductInterface. Where are these methods declared/implemented ??


texts: I have developed a site in the url www.example.com/demo on now i want to move the site to www.example.com on the same server what are the steps that are to be taken to move the site on the same server with the same database.


texts: Load language based on a custom user option

texts:
Apologies is this is one of those elementary sort of questions. Well I've spent a couple of hours searching for the last piece of what I need for my project to work, but I just like every other topic I search for about Magento, can't find that last bit of magic information that makes everything work.

In short, I inherited a project for which I wouldn't pick Magento to be the framework, and I'm basically stuck with Magento as too much work has already been done. There are pieces of native Magento that are used, but there is a great deal of coding completed in custom classes and custom tables. The app as a whole is behind a login screen and has no public areas.

The client is fairly happy with the way things are working so we just can't up and redevelop the thing.

My challenge at this point is to get the translation parts working. When a user logs in, the app needs to translate the site into the language according to custom options set in the user's profile. I need to do this with code. There is no dropdown or link to click on to switch between languages.

This is not a typical ecommerce website, but a custom B2B where the clientele is in Europe. The site needs to translate, at this moment, into four other languages other than English.

Poking around the interwebs I gathered this much:

i. I need a csv for my stuff at app\locale\en_US\xxxx_ssss.csv

-- added the file, entered a test case:  "New Order","Neue Ordnung"

ii. Updated the config.xml with this:

<frontend>
    <translate>
        <modules>
            <xxxx_ssss>
                <files>
                    <default>xxxx_ssss.csv</default>
                </files>
            </xxxx_ssss>
        </modules>
    </translate>
</frontend>

iii. Enclosed the text to be test translated with the $this->__() function.

-- this is works. I see "Neue Ordung" where I expect to see it, instead of the "New Order"

This is all good and well, however, taking it one step further, things don't work. I need to set the language, via code, according to the user's profile.

I found a bit of code I've only seen once:

Mage::app()>getLocale()>setLocale('nl_NL');

This seems to be able to "force" Magento to use that locale.

I added a test file at app\locale\nl_NL\xxxx_ssss.csv with a different translation to see if Magento picks it up.

It doesn't. I still see my test translation from above.

If I print out Mage::app()->getLocale() we can see (below) that the localCode has been set to nl_NL

(
    [_defaultLocale:protected] => en_US
    [_locale:protected] =>
    [_localeCode:protected] => nl_NL
    [_emulatedLocales:protected] => Array
    (
    )
)

I also added another store view with the locale default language, for this test, to Dutch.

This still doesn't seem to work. I cleared out the cache (even though it's turned off, it's in development).

I just don't know what else I need to do to get this to work. (I'm basically "desperate" as I've clicked to the second and third pages of a Google search ;)  )


texts:
Very recently I had to perform a minor upgrade on an extension (eBizmarts Mailchimp) in my Magento 2.1.7 installation. It went smoothly, as usual, even though it is terrifying to do this for fear of Magento completely breaking!

Anyway, after going through all the usual steps, and cleaning caches, etc, the site was returned to LIVE status, and all appeared to be normal.
My steps are as follows:
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy en_GB
bin/magento indexer:reindex
bin/magento cache:clean
bin/magento cache:flush
Reapply permissions

That night, and every night since, I get an email at 1:20am with these contents:

  Product alerts cron warnings

  Warning: getimagesize(): Filename cannot be empty in /var/www/vhosts/website/htdocs/vendor/magento/module-catalog/Model/Product/Image.php on line 922

  Warning: getimagesize(): Filename cannot be empty in /var/www/vhosts/website/htdocs/vendor/magento/module-catalog/Model/Product/Image.php on line 922

  Warning: getimagesize(): Filename cannot be empty in
  /var/www/vhosts/website/htdocs/vendor/magento/module-catalog/Model/Product/Image.php on line 922

And so it continues, exactly the same for another 91 lines.

I do not see any corresponding error in any log files.

I can only imagine that something is perhaps cached on the server somewhere (in Magento) causing this, but it isn't actually causing an error? Maybe it is but I don't know about it.

Has anyone come across this before and knows what the issue is, and more importantly, how to fix it?

I am able to manually run cron on the server without any errors. When I use the command:

  bin/magento cron:run

I get the following message back:

  Ran jobs by schedule.

The error did not happen before the last update as mentioned above, and any products that have been added since the update have all got perfectly working images against them.

Could it be an unseen rogue image on a new item maybe?
Or maybe 94 new items (one for each entry in this email)?

How do I debug this with no apparently useful info beyond this email?


texts: Show Tier Price in Product Grid of Sales Order creation form Magento 2

texts:
I'm trying to show the Tier Price in the Product Grid of the sales order creation page, but can't show.

I tried the below code.

added the column to _prepareColumns() method from Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid.php class

 $this->addColumn(
            'action', array(
            'header' => __('Price Breaks'),
            'width' => '100',
            'type' => 'action',
            'actions' => array(
                array(
                    'caption' => __('Tier Price'),
                    //'url' => array('base' => '*/*/*'),
                    'field' => 'entity_id',
                    'target'=>'_blank',
                    'id' => 'price_break',
                    'class' => 'price_break',
                   // 'onclick' => "window.open('http://www.google.com')"
                )
            ),
            'index' => 'entity_id',

        ));

but it's not displaying becz it's not a field.

Any help to show the tier price in the product grid.


texts: How to Get Distinct Entries from Joined Tables Through Join()

texts:
This doubt aroused when I am answering one of the question that posted here. But this question is not a continuation of that question, rather a general doubt.

Basically I need to get log-customer collection. I can't get it directly, since there is no collection defined for log customers. ie

Mage::getModel('log/customer')->getCollection(); //false

However I can get the above collection indirect way. I need to use log-visitor collection for this and then using this collection I can get log-customer collection. This is the code that do that trick.

$collection = Mage::getModel('log/visitor')->getCollection()->addFieldToFilter('store_id', array('eq' => 1));
$collection->getSelect()
            ->join(
                array('log_customer'=> $collection->getTable('log/customer')),
                'main_table.`visitor_id`= log_customer.`visitor_id`'
            );
foreach ($collection->getItems() as  $item) {
    print_r($item->getData());
}

This code will do the trick if everything came right. But there is a small problem related to this code. In order to show what is the problem, let me show you log_customer table.

+--------+------------+-------------+---------------------+---------------------+----------+
| log_id | `visitor_id` | customer_id | login_at            | logout_at           | store_id |
+--------+------------+-------------+---------------------+---------------------+----------+
|      1 |        105 |           2 | 2014-02-05 18:49:10 | 2014-02-05 13:19:10 |        4 |
|      2 |        105 |           2 | 2014-02-05 13:19:30 | NULL                |        4 |
|      3 |        113 |           3 | 2014-08-05 10:26:08 | NULL                |        1 |
|      4 |        325 |           3 | 2014-09-04 01:32:18 | NULL                |        1 |
+--------+------------+-------------+---------------------+---------------------+----------+

Here you can see that, there are multiple entries for visitor_id = 105. That duplicate entry came because, customer didn't logout properly. (See null value of second duplicate entry). Hence if I filter log-customer collection for store_id = 4. It will throw an error, which seems like this.(the code will work as expected store_id = 1, since there is no duplicate entries)

  ( ! )Fatal error: Uncaught exception 'Exception' with message 'Item
  (Mage_Log_Model_Visitor) with the same id "105" already exist' in
  C:\wamp\www\magento_v1.8\lib\Varien\Data\Collection.php on line 373

  ( ! ) Exception: Item (Mage_Log_Model_Visitor) with the same id "105"
  already exist in
  C:\wamp\www\magento_v1.8\lib\Varien\Data\Collection.php on line 373

So in general, I need to avoid this. So how can I distinct my join query ? Please enlighten me with your beautiful thoughts.

Thanks


texts: How to get simple product info only Magenot 2 API

texts:
So im using rest/V1/orders/{id} from which im extracting info via PHP.
My problem is when extracting info from "items" array i get the info of a simple product and a configurable product. So basically i get everything double.
Is it possible to get simple product info only?


texts: How can I dispatch 'payment_method_is_active' from controller?

texts:
I have a payment_method_is_active event in Magento. I'm trying to dispatch from controller with:

Mage::dispatchEvent('payment_method_is_active', array(
                    'result' =>$this->getResult(),
                    'method'          => $method,
                    'quote'           => $quote
                ));

but it is not working(doesn't even get in observer).
I suppose I don't get array variables right. So, how can I do?


texts: Magento 2 How to Insert sku in product title

texts:
run this sql query but nothing happened::

 UPDATE `catalog_product_entity_text` as pt LEFT JOIN `catalog_product_entity` as p ON p.`entity_id` = pt.`entity_id` SET pt.`value` = CONCAT(pt.`value`,' (',p.`sku`,')') WHERE pt.`attribute_id` = 75


texts: Migrate only products from Magento 1 to Magento2

texts:
I am using Magento data-migration tool and am able to do migrate all data successfully.

My requirement was to:

migrate only customers

migrate only Orders

migrate only Products

Followed below link and achieved migrate only customers.

Magento 2: is it possible to migrate only customer using migration tool

Followed below link and achieved migrate only Orders.

Magento 2: Migrate only Customer and orders

Can anyone help me how to migrate only products?

Referred some links but they are not useful.

If anyone worked on migration please help me to achieve above requirement.

Note: If there are any free migration script or migration can be done pro grammatically please share the links or ideas.

Migration can be done pro grammatically apart from the cli? If anyone tried this share the knowledge please

Thanks


texts: 404 after migration to development environment for multistore

texts:
I recently copied over my files from my production environment over to a new development directory.

Production:
/xtacolle/public_html/

Development:
/devxta/public_html/

I also made a copy of the DB and changed it in:
/devxta/public_html/app/etc/local.xml

Lastly I updated my htaccess to the following and commented out the second site since it is not important for this environment:

## Magento Store Configuration

SetEnvIf Host dev\.xtacollectibles\.com MAGE_RUN_CODE=xtacollectibles_com
SetEnvIf Host dev\.xtacollectibles\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^xtacollectibles\.com MAGE_RUN_CODE=xtacollectibles_com
SetEnvIf Host ^xtacollectibles\.com MAGE_RUN_TYPE=website

When i try to visit the development site dev.xtacollectibles.com I am getting these two errors in the log:

2016-12-28T21:05:37+00:00 ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /home/devdta/public_html/app/code/core/Mage/Core/Model/App.php on line 634 and defined  in /home/devdta/public_html/app/code/core/Mage/Core/Model/Store.php on line 395

2016-12-28T21:05:37+00:00 ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Model_Store_Group::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /home/devdta/public_html/app/code/core/Mage/Core/Model/App.php on line 654 and defined  in /home/devdta/public_html/app/code/core/Mage/Core/Model/Store/Group.php on line 275

Any Ideas? Thanks


texts: How to hide the menu bar (with all the categories) on all pages except the front page?

texts:
Magento 1.9.1
Porto theme

We have a massive categories' menu bar at the top of the website with 14 long category names. It is taking way too much real estate space and we don't really need it other than on the front page. How can we hide it in all subsequent pages?


texts: How to magento 2 send xml file as a email attachment?

texts:
In Magento 2, I want to send custom XML file as an attachment in the email. How can I achieve this.
This is really urgent.


texts: Magento 2.4 with AWS ES not able to install

texts:
I'm trying to install Magento 2.4.
I have set up AWS ES that I tasted and it works fine! But I keep getting an error:
  In SearchConfig.php line 81:

  Could not validate a connection to Elasticsearch. null

Is there a special configuration I need to make on AWS es?
Thank you.


texts: Hide all product images - for store selling only virtual products

texts:
How can I hide or remove product image area for a company selling only virtual products?
Trying to remove or hide Thumbnail, Small Image, Base Image, And Media image, if possible.

Thank you!!!


texts: Shopping cart rules: Autogenerated unique codes, applicable to any product with different discounts

texts:
I need to generate a number of unique coupon codes. Any of those coupon codes could be used for any of the products. The problem is that different products need to get different discounts.

Seems to me I can't create different rules for every product because the rules wouldn't share the same set of coupons.

Is such a thing even possible?

Magento Version 1.9.2.2


texts:
I have code:
let fieldset = document.getElementsByClassName('fieldset-wrapper');

            console.log(fieldset);

in console log:

HTMLCollection { length: 0 }

when I open collection in console log:
HTMLCollection

0:

1:

length: 2

But when I try to:
console.log(fieldset[0]);

I got an answer 'undefined';
How do I get items from a collection? thanks for the answer


texts:
I want to have a custom database connection with a module I am creating.  I am following this tutorial which will work well:

http://fishpig.co.uk/magento/tutorials/create-external-database-connection/

But my issue is that I dont want to store the database credentials within the module.

What would be the accepted way to securely do this?


texts: How to show Extra free only not add in order total in order summary

texts:
I have code for add extra fee in order in magento 2, now my requirement is the extra fee can only show will be not add in order total

the extra free can also add in order total but I can not add that

I need order total 155 not 160

my code is that

public function collect(
        \Magento\Quote\Model\Quote $quote,
        \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
        \Magento\Quote\Model\Quote\Address\Total $total
    )
    {
        parent::collect($quote, $shippingAssignment, $total);
        if (!count($shippingAssignment->getItems())) {
            return $this;
        }

        $enabled = $this->helperData->isModuleEnabled();
        $minimumOrderAmount = $this->helperData->getMinimumOrderAmount();
        $subtotal = $total->getTotalAmount('subtotal');
        if ($enabled && $minimumOrderAmount <= $subtotal) {
            $fee = $quote->getFee();
            $total->setTotalAmount('fee', $subtotal);
            $total->setBaseTotalAmount('fee', $subtotal);
            $total->setFee($fee);
            $quote->setFee($fee);
            $total->setGrandTotal($total->getGrandTotal());
            $total->setBaseGrandTotal($total->getBaseGrandTotal());
        }
        return $this;
    }


texts: How do I retry a failed extension upgrade?

texts:
An extension we use has released several versions since our last update, we'll say that I started on 1.0 and was trying to upgrade to 1.5.  During the update to the latest version I encountered an error (the server began returning 500's) and the error logs indicated that the setup script for 1.3 to 1.4 was breaking.  I was able to recover by reverting the code changes to version 1.3.

Magento's core_resource table shows that version 1.5 is installed, which isn't correct.  The schema appears that the database is in fact from 1.3, and so I've left the code at that version as well.

mysql> select * from core_resource where code = 'myextension_setup';
+--------------------+---------+--------------+
| code               | version | data_version |
+--------------------+---------+--------------+
| myextension_setup  | 1.5.0   | 1.5.0        |
+--------------------+---------+--------------+

My impression is that I just need to update version and data_version in core_resource in order to re-run the setup scripts.  What other steps are needed before I can re-attempt the upgrade?

What steps should I take to re-attempt the upgrade, after identifying and resolving the cause of the server errors with 1.5?  Do I need to review each step of the 1.4 and 1.5 setup scripts to ensure that they haven't already been run?


texts:
I'm trying to create my own widget in Magento 2 however I get this error:

  Error filtering template: Invalid block type: Inchoo1\CatalogWidget\Block\Product\ProductsList

My code is identical to that of "https://inchoo.net/magento-2/magento-2-custom-widget/".

Inchoo/CatalogWidget/Block/Product - ProductList.php

<?php
namespace Inchoo\CatalogWidget\Block\Product;

class ProductsList extends \Magento\CatalogWidget\Block\Product\ProductsList
{
const DEFAULT_COLLECTION_SORT_BY = 'name';
const DEFAULT_COLLECTION_ORDER = 'asc';

public function createCollection()
{
    /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
    $collection = $this->productCollectionFactory->create();
    $collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());

    $collection = $this->_addProductAttributesAndPrices($collection)
        ->addStoreFilter()
        ->setPageSize($this->getPageSize())
        ->setCurPage($this->getRequest()->getParam($this->getData('page_var_name'), 1))
        ->setOrder($this->getSortBy(), $this->getSortOrder());

    $conditions = $this->getConditions();
    $conditions->collectValidatedAttributes($collection);
    $this->sqlBuilder->attachConditionToCollection($collection, $conditions);

    return $collection;
}

public function getSortBy()
{
    if (!$this->hasData('collection_sort_by')) {
        $this->setData('collection_sort_by', self::DEFAULT_COLLECTION_SORT_BY);
    }
    return $this->getData('collection_sort_by');
}

public function getSortOrder()
{
    if (!$this->hasData('collection_sort_order')) {
        $this->setData('collection_sort_order', self::DEFAULT_COLLECTION_ORDER);
    }
    return $this->getData('collection_sort_order');
}
}

Can anyone please direct me towards a fix, thanks :)


texts: I don't have any products BUT I have products in categories!

texts:
No products in my magento. None. No data to export from products.

YET, I have product counts next to categories in the cat management area.

WHAT GIVES?

thanks


texts: Where to find source code and document for ext-tree.js 1.0.1

texts: I'm a bit surprised magento is using a super old ExtJS library whose version is 1.0.1, it's about 8 years old. In ExtJS website, there's no document or source code available for such old version. The JS library is compressed in magento installation. That makes development and debugging very difficult. Where can I found the related source code or document?


texts: How to enable Gift cards feature in magento like amazon?

texts:
I need to enable gift card option in magento without using any extension. The gift card feature should be like amazon's gift card.

Can anyone please tell me to enable this feature in magento?


texts: Order emails only sent to customer not to admin

texts:
There should be default feature in magento that would send email to admin as well about the order placement. I have cron setup and working, customer receiving email about order placement, but the admin doesn't get email.

I found that the exact copy customer receives can be send to multiple email addresses(via configuration / sales emais / order /Send Order Email Copy To), but there should be other email that will be send to admin. How it gets active or how to configure or am i missing something ?


texts: When I try to save a category I get "The value of attribute "is_active" must be set"

texts:
I am on Magento 2.1.7. I have installed the Ultimo theme and am trying to manage the menu. When I save is when I get the error "The value of attribute "is_active" must be set" I can tell I am not the only one who gets it- https://github.com/magento/magento2/issues/6176

I tried running the script in that link but I get the error-

PHP Warning:  require_once(../app/bootstrap.php): failed to open stream: No
such file or directory in /www/sites/www.example.com/files/magento2/project-community-edition/catalogurl.php
on line 2

Are there any other ways to fix this?


texts:
I tried to find where did a button send data to do something. For example, for a button below, it is a button on "Ship to Multiple Addresses" page.

<button type="button" title="<?php /* @escapeNotVerified */ echo __('Enter a New Address') ?>" class="action add" data-role="add-new-address">
   <span>
      <?php /* @escapeNotVerified */ echo __('Enter a New Address') ?>
   </span>
</button>

So, where i can find the logic for that button? Is it in controller? or other place?


texts: Trouble testing plugin with object manager

texts:
Issue: When attempting to test a plugin "after" method with $objectManager->create('Shopgate\Base\Model\Config')->startup(), the original startup() method is called but not my plugins afterStartup()

Steps Taken:

[✔] Confirm module enabled & loaded
[✔] Clear cache with magento cache:clean config
[✔] Empty generated code with rm -r generated/*
[✔] Register plugin as shown below:

In my etc/di.xml, I have the following:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Shopgate\Base\Model\Config">
        <plugin name="bugFixEnableGetSettings" type="MoninGlobal\ShopgateBugfix\Plugin\ShopgateConfig" sortOrder="9999" />
    </type>
</config>

In MoninGlobal\ShopgateBugfix\Plugin\ShopgateConfig I have:

    public function afterStartup($subject, $result){
        var_dump(get_class($subject));
        var_dump($result);

        return $result;
    }

The same occurs when using get() instead of create() on the object manager.

Any insight into what I am missing here would be greatly appreciated.


texts: Getting the last viewed category on a product page?

texts:
We would like to add a link "view all other [category name] products" on the product page.

We tried several things no full success.

it seems there is a last viewed category methode Mage::getSingleton('catalog/session')->getLastViewedCategoryId() but this is always empty
and Mage::registry('current_category') is also empty
so we added a method to capture the breadcrumbs and get the before last item (this seems to work in some cases, but when the user opens some items directly or some Magento systems show the shortest path: then it results in "view all"

We are now testing a work around where we use setData to the session to store the category name and url whilst visting the category. We retrieve this on the product page. This seems to work in some cases also - but we use a FPC - so this code is not always executed.

What is the best - and always working - method to get the last visited category?

thanks in advance


texts: How to display data from many tables in .phtml file Magento 2.3

texts:
I displayed data from sales_order table in .phtml file, in my history page, not yet create table to this information to be on the custom table

But I also want to display more, from sales_order_item

and sales_order_status

in .phtml page to my history page

If anyone has free time, please help me step by step, it will be useful for me.


texts:
On checkout page using local database if customer enter zip code then city/state /country auto complete.

Is any free extension available which completes the customer's city/state/country by using only their zip code?


texts: Magento 2 CE and ElasticSearch integration

texts:
I'm learning how to config and use Elasticsearch as search engine for a "test project" which we will develop soon.

I have a few questions about how to integrate these two technologies.

Is it possible to integrate elasticsearch with magento 2 CE? or I need a custom module for this?
Otherwise, how can I populate an elasticsearch cluster with, for example, the catalog of my Magento 2 CE shop? is it possible?

I know that it sounds a little bit confusing but I'm new to elasticsearch and I'm trying to integrate it in my platform.

If some of you had a previous experience with Magento 2 and ES can please tell me which are the common problems during integration?

Thanks in advance.

EDIT 05/12/2018

Now Magento 2.3 has ElasticSearch integration out of the box in Community Edition.


texts: Inquiry regarding url_path product attribute

texts:
Product has an attribute called url_path.

What is the purpose of this attribute ?
When does it get populated with values ?
When are this values used ?


texts: How to remove custom extension and its entries from Database?

texts:
I am developing a custom magento extension to add attributes and attribute sets when anyone extract the zip file and put that code to "/app" folder.

It makes several entries to database for atributes.
Now I am making further changes in attribute sets and want to install this module again.
So for this I am installing fresh version of magento to test the extension.
So any way to remove extension and its relavant entries from database?
I am not installing this extension from "Magento Connect Manager".


texts: Magento 2.3 - Display text Instead of 0 for 0 Price products

texts: For my Magento 2.3.3 store lot of products ASK Price condition, How efficiently achieve this case, Anyone helps me with preference or module?


texts: How to check whether a block exist ( based on its type )

texts:
This really confuses me !!

I came to a situation, where I need to create a new block (core/template block) programmatically, if there is CMS Block present in a page layout. In general case, according to my knowledge, there are two work around for this.

1. Add a block through layout

In most of the case, this would be the best idea to do this task. We can add a block to a page if an appropriate layout handle is available. But unfortunately, in my case, I dont have any static block specific layout handle available (for cms pages, we know there is cms_page handle). So I can't rely on this method

2. Use an observer

The second method would be listen to an appropriate observer. Again, I cannot find a static block based observer that get triggered during layout/block loading time. However there are some general observers that I can rely on. I think controller_action_layout_generate_blocks_before can use in my case. But here I am facing my real problem

My real Problem

So when I use controller_action_layout_generate_blocks_before event in my case, the problem is that, I cannot retrieve blocks based on their type. I can filter blocks based on their name, but not based on their type. ie

$observer->getEvent()->getLayout()->getBlock('block_name'); //this work; Used name
$observer->getEvent()->getLayout()->getBlock('cms/block'); //this wont; use type

I cant rely on names in fact. Because I want to get all cms/block type blocks and add a new template after checking some of their custom property that I have set with static block

So how can I get all cms/block through an observer ? Is it even possible. Please share your thoughts.


texts: How to only show cms block in phtml file on homepage

texts:
we need to show cms block in footer of homepage only

our block is called footer_partners

We tried both

<?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()): ?>

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

and

<?php if($route == 'cms' && $action == 'index'): ?>

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

<?php endif; ?>

But both methods seem to work fine - but then I saw it underneath the cart and also underneath the login

Question: Now how could I do this correctly using phtml?

Question: Is there a way to access my custom coded phtml block using XML? (and this way show it only, only on the homepage)

thx


texts: Magento U Virtual Machine - Warning: Authentication failure. Retrying

texts:
I just tried to 'vagrant up' the VM from Magento U, and was surprised to get this as a response:

  Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Clearing any previously set forwarded ports...
    ==> default: Clearing any previously set network interfaces...
    ==> default: Preparing network interfaces based on configuration...
        default: Adapter 1: nat
        default: Adapter 2: hostonly
    ==> default: Forwarding ports...
        default: 22 => 2222 (adapter 1)
    ==> default: Running 'pre-boot' VM customizations...
    ==> default: Booting VM...
    ==> default: Waiting for machine to boot. This may take a few minutes...
        default: SSH address: 127.0.0.1:2222
        default: SSH username: vagrant
        default: SSH auth method: private key
        default: Warning: Connection timeout. Retrying...
        default: Warning: Authentication failure. Retrying...
        default: Warning: Authentication failure. Retrying...
        default: Warning: Authentication failure. Retrying...
        default: Warning: Authentication failure. Retrying...
        default: Warning: Authentication failure. Retrying...
        default: Warning: Authentication failure. Retrying...
        default: Warning: Authentication failure. Retrying...

This worked fine before, but with VirtualBox 5.0 and Vagrant 1.7.4, suddenly no dice. How can I make this work?


texts: Ubertheme error while Migrating date from Magento 1 to Magento 2

texts:
I am currently trying to Migrate datafrom our Magento 1 site to the Magento 2 site. We've installed the Ubertheme tool and set the details up in the extension.

but every time I try to set up the Databases tab I get the following error:

Both the original website and the new Magento 2 database have the same host (localhost:3306) and as far as I can tell I am using the right credentials. So I'm not sure why this error is happening.

UPDATE:

After speaking to my hosting provider the issue seems to be that, in this case, the extension is reading the Host name as localhost:3306 automatically in both the source and target database fields.

Manually editing the host to read "localhost" and setting the port to "3306" seems to allow connection to the database but the current issue is that I can't connect to the Magento 2 database.

It doesn't seem to be possible to modify the fields in the "Target" database as the field values are detected automatically and cannot be changed.

I have tried modifying the information in the following file:

  pub/ub-tool/protected/config/db.php

But this does not seem to affect any of the values in the fields on the interface.

I'm currently in contact with Ubertheme to resolve the issue and will post an answer if/when I have one.


texts: Add custom options while adding grouped product to cart

texts:
I've got a problem when adding a grouped product to cart.

I need to set a custom option for all products that are added to cart while adding a grouped product to cart.

What I have tried last (with a little bit of success):

<checkout_cart_product_add_after>
    <observers>
        <customoptions>
            <type>singleton</type>
            <class>Company_CustomOptions_Model_Observer</class>
            <method>addCustomOptionGroupSku</method>
        </customoptions>
    </observers>
</checkout_cart_product_add_after>

and

public function addCustomOptionGroupSku(Varien_Event_Observer $observer) {
    $product = $observer->getProduct ();
    if ($product->isGrouped ()) {
        $quoteItem = $observer->getQuoteItem ();
        $additionalOptions = array (
                'options' => array (
                        'label' => 'GROUPSKU',
                        'value' => $product->getSku ()
                )
        );
        $quoteItem->addOption ( new Varien_Object ( array (
                'product' => $quoteItem->getProduct (),
                'code' => 'additional_options',
                'value' => serialize ( $additionalOptions )
        ) ) );
    }
}

I have created one grouped product, containing two products.
But that code only adds the custom option "GROUPSKU" to one of the items in the cart. The other one is untouched.

How do I get all the QuoteItems that are about to be added to the cart?

I have also added this question to the StackOverflow part of StackExchange: https://stackoverflow.com/questions/27905415/add-custom-options-while-adding-grouped-product-to-cart


texts: display custom attribute inside text field

texts:
We are using following code to display Price inside TextField

<input type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name= "price[]" value = "<?php echo $products->getPrice(); ?>" style = ""/>

We are using following code to display a custom attribute COD.

I want to know what code we need to use for displaying COD inside textfield

 <?php
    $attribute = $products->getResource()->getAttribute('cod_available');
    if ($attribute) {
    echo $attribute_value = $attribute ->getFrontend()->getValue($products);
    }
    ?>

i am getting the COD value , i want to display inside text field as like price


texts:
I"m new to the magento front, and I need to develop a template for it, but somehow I can't wrap my head around the url helpers in the local.xml...

Is there a reference list for available helpers? Or is there a method how can I track down the available helpers in the magento code?

I was looking at the top.links customization options at classyllama.com, but most of the relevant aritcles are outdated, and while the concept works, some of the helpers don't.


texts: Where to place Magento 2 Theme customizations?

texts:
I installed Magento 2 via Composer and it does not have a directory for theme in frontend. I tried to create a new theme in app/design, every time I create registration.php I get an error.

Question
Is it possible to edit the CSS file in vendor/Magento/theme-frontend-blank? Will the changes take in effect on front-end?
I am confused to where should the theme customization should be done. When I use Firebug I see that the location of the CSS files are directing me to pub/static/


texts: How to group custom data by id in magento 2

texts:
i have data array like this

array(1) { [0]=> array(3) { ["name"]=> string(6) "Ärzte" ["id"]=> string(2) "53" } }
array(1) { [0]=> array(3) { ["name"]=> string(15) "Bijouteriewaren" ["id"]=> string(2) "58" } }
array(1) { [0]=> array(3) { ["name"]=> string(7) "Optiker" ["id"]=> string(3) "110" } }
array(1) { [0]=> array(3) { ["name"]=> string(31) "Reisebüros & Reiseveranstalter" ["id"]=> string(3) "120" } }
array(1) { [0]=> array(3) { ["name"]=> string(2) "DJ" ["id"]=> string(2) "66" } }
array(1) { [0]=> array(3) { ["name"]=> string(10) "Damenmoden" ["id"]=> string(2) "65" } }
array(1) { [0]=> array(3) { ["name"]=> string(2) "DJ" ["id"]=> string(2) "66" } }
array(1) { [0]=> array(3) { ["name"]=> string(2) "DJ" ["id"]=> string(2) "66" } }
array(1) { [0]=> array(3) { ["name"]=> string(22) "Bordelle & Laufhäuser" ["id"]=> string(2) "61" } }

How to group custom data by id?

My code

$getBranche = $block->getBranchesBySellerId($subAccount['seller_id']);
foreach ($getBranche as $branche) {
?>
     <a href="<?php echo $branche['link'] ?>"><?php echo $branche['name'] ?>
<?php
}

My function getBranchesBySellerId()

public function getBranchesBySellerId($sellerId) {
    $nameBranche = $this->getBranche->getBrancheByIdSeller($sellerId);
    $id = $this->getBranche->getIdBranche($nameBranche);
    $selectedBranches[] = [
        'name' => $nameBranche,
        'id' => $id,
        'link' => $this->getUrl('branche/collection') . '?branche=' . $id
    ];
    return $selectedBranches;
}

It get all branche

EX : When use foreach, it like this

Ärzte
Bijouteriewaren
Optiker
Reisebüros & Reiseveranstalter
DJ
Damenmoden


texts:
How to load a customer with an eav attribute ?

I created a new eav attribute with that :

$attribute  = array(
        'type'          => 'varchar',
        'input'         => 'text',
        'label'         => 'My Field',
        'global'        => true,
        'visible'       => true,
        'default'       => '',
        'required'      => false,
        'user_defined'  => 0,
        'used_in_forms' => array(
                'adminhtml_customer',
        ),
);
$installer->addAttribute('customer', 'my_field', $attribute);

And now, I want to load customer, but the following code doesn't work :

$customer = Mage::getModel('customer/customer');
$customer->load($myField, 'my_field');

But if I load the customer with email (for example), after, I can get 'my_field' value with :

$customer->getData('my_field');

Any idea ?


texts:
We are using Magento 2.3.2 version.We are facing issue when we go to Sales --> Order and  click on view  orders the below error comes up. The  error is  not coming  with pending orders but coming  with completed / In process or cancelled orders. The error we get is below

1 exception(s):
Exception #0 (Exception): Warning: Division by zero in /home/websites/public_html/vendor/magento/module-weee/Block/Item/Price/Renderer.php on line 207

Exception #0 (Exception): Warning: Division by zero in /home/websites/public_html/vendor/magento/module-weee/Block/Item/Price/Renderer.php on line 207
<pre>#1 Magento\Weee\Block\Item\Price\Renderer->getBaseUnitDisplayPriceExclTax() called at [vendor/magento/module-weee/Block/Adminhtml/Items/Price/Renderer.php:77]
#2 Magento\Weee\Block\Adminhtml\Items\Price\Renderer->getUnitPriceExclTaxHtml() called at [vendor/magento/module-weee/view/adminhtml/templates/items/price/unit.phtml:25]
#3 include('/home/websites/s...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#4 Magento\Framework\View\TemplateEngine\Php->render(&Magento\Weee\Block\Adminhtml\Items\Price\Renderer#000000001f54bb8b00000000102aeb83#, '/home/websites/s...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
#5 Magento\Framework\View\Element\Template->fetchView('/home/websites/s...') called at [vendor/magento/framework/View/Element/Template.php:301]


texts: Magento 2 multi website unable to set Developer mode "production"

texts:
I am using magento 2 with multiple websites, need to enable production mode. But it getting error with _custom.less can't able to read my theme package.

Thanks


texts: Send Contact Form To Different Email, Depending on Select Value?

texts: Does anyone have any experience customizing the Magento Contact module to send the values to different emails depending on email? I'm trying to figure out how to add a select field that would determine the email destination.


texts: Any suggestions of a Single Sign-On to users from external apps (Mobile) to Magneto 2?

texts:
The titles say it all.  Is there any extension, or suggestions to add this feature to Magento 2 store?  I want users to access the store from a 3rd-party mobile app.
And from there, users will be able to access the store without login again.

Thank you.


texts: How do verify Pinterest in Magento? Where is the index.html?

texts: I need to add a meta tag to  of index.html file or equivalent in order to verify my website for Pinterest. Where in Magento do I find this?


texts: Magento 2 Fail to change form encoding method to enctype='multipart/form-data'

texts:
added the following codes to _prepareForm(), but it can't change to the encoding method to multipart/form-data. How to change the encoding method to multipart/form-data? Thanks.

$form = $this->_formFactory->create(
            [
                'data' => [
                    'id' => 'edit_form',
                    'method' => 'post',
                    'enctype' => 'multipart/form-data',
                ],
            ]
        );


texts:
I created a custom route which is working fine.
However it is just a blank page.

How can I add the header and the footer?

Thanks!


texts: error in catalog view layered navigation filter

texts:
This is the block from  my catalogsearch.xml

<reference name="left">
        <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
    </reference>

The selected filters are displaying multiple time.I tried changing the type and still no change,
Please Help.

update :

in my catalog\layer\state.phtml

$_filters = $this->getActiveFilters();
count($_filters)

is returning me 3 which should be only one .Please help why this is happening


texts: magento 1 additional option of type file to cart programatically

texts:
i want to add custom option of file type while product is adding to cart.
like i will be giving a customer an option  to choose image from his computer, and when customer choose and hit add to cart button then the image should be added as custom option to that product.

anyone knows how to do it?


texts: Magento 2 How to get Category attribute value label

texts:
Magenot 2 How to get Category attribute value label.
This code is magenot 1 and this code work to get Category attribute value label:-
<?php $title = Mage::getSingleton('categorylandingpage/entity_attribute_source_landingpageproducts')->getOptionText($mojoHelper->getCurrentCategory()->getCategoryLpageProducts()); ?>

I have Source Model File :-
<?php

namespace GetSomeMojo\CategoryLandingPage\Model\Entity\Attribute\Source;

use Magento\Framework\Option\ArrayInterface;

class Landingpageproducts extends \Magento\Eav\Model\Entity\Attribute\Source\Boolean implements ArrayInterface
{

    const VALUE_NO = 'lpage_no';
    const VALUE_NEW = 'lpage_new';
    const VALUE_FEATURED = 'lpage_featured';
    const VALUE_SALE = 'lpage_sale';

    protected $_options;

    public function getAllOptions()
    {
        return [
            ['value' => self::VALUE_NO, 'label' => __('No')],
            ['value' => self::VALUE_NEW, 'label' => __('New Products')],
            ['value' => self::VALUE_FEATURED, 'label' => __('Featured Products')],
            ['value' => self::VALUE_SALE, 'label' => __('Sale Products')]
        ];
    }

    public function getOptionArray()
    {
        $_options = array();
        foreach ($this->getAllOptions() as $option) {
            $_options[$option['value']] = $option['label'];
        }
        return $_options;
    }

    public function getOptionText($value)
    {
        $options = $this->getAllOptions();
        foreach ($options as $option) {
            if ($option['value'] == $value) {
                return $option['label'];
            }
        }
        return false;
    }
}

But I want to convert above code in magenot 2.
Please Advice me.
THANKS.


texts: Magento 2 - Product category id on success

texts:
How can I get the category id of the products ordered on the success.phtml page. I have managed to get other bits of data but cant find the category id.

I need to check the category so i can post to a third parties API only if a product from a specific category has been purchased.

My OOP knowledge isn't the best. So please be patient lol


texts: Magento uninstall extension custom script php

texts:
I've created my own module and generated a package mymodule.tgz. When I install extension in MagentoConnect (by Direct package file upload) everything works fine. The problem occurs when I want to completely remove the module. When I click "uninstall" in MagentoConnect all files of module are deleted but sql tables are still present in database. That is why I have 2 questions:

Is it possible to remove sql tables created by module when uninstall method is executed by php script?
Is it possible to remove only some certain files of module when uninstall method is executed by php script?

Second question concerns the problem of images folder which is created by module. I don't want to delete this files when it's uninstalled because when the user installs extension once again, he should have those files visible.


texts: Magento 1.9.2.4: Custom Options price not changing

texts:
I got this issue where Price is not updated when checking the custom options (Fixed Price: +400).

I got this error:

TypeError: Product.OptionsPrice is not a constructor

TypeError: optionsPrice is undefined

Related questions:
Custom Options not updating price - JS error

Custom Option Price Not Updating

Custom Option Price is not changing

Update product custom option price on product price change


texts: Magento 2 - How to add attribute in order shipping address block?

texts:
In magento 2 I try to add company attribute in admin > Sales > Order > edit > "shipping Address" block, between name and address :

Do you know how to make this change ?

EDIT

In Store > Configuration > Customers > Customer Configuration > Address Templates

In HTML there is "company" attribute :

{{if intitule_adresse}}{{var intitule_adresse}}
{{/if}}
{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}{{depend firstname}}
{{/depend}}
{{depend company}}{{var company}}
{{/depend}}
{{if street1}}{{var street1}}
{{/if}}
{{depend street2}}{{var street2}}
{{/depend}}
{{depend street3}}{{var street3}}
{{/depend}}
{{depend street4}}{{var street4}}
{{/depend}}
{{if postcode}}{{var postcode}}{{/if}} {{if city}}{{var city}} {{/if}}{{if region}}{{var region}} {{/if}}

{{var country}}

{{depend telephone}}T: {{var telephone}}{{/depend}}
{{depend fax}}
F: {{var fax}}{{/depend}}
{{depend vat_id}}
VAT: {{var vat_id}}{{/depend}}

But It does not appear in shipping address.
When I remove {{depend company}}{{/depend}} and leave only {{var company}}
 there is a blank line.


texts: Need to save all simple products via admin or programatically

texts:
I need to be able to re save all simple products in order to update a custom attribute via some custom code, the attribute is only updated when a product is sold or saved or an order is cancelled. The problem occurs when I make a direct injection of inventory data to update our stock levels, using Magmi for example, each simple product will then need to be manually opened and saved from the backend admin in order to update my custom attribute.

I've tried selecting all in admin, making a minor change to attributes for all products and resaving, this does not have the same effect as opening and resaving each product individually. Reindexing doesn't help either.

What I'm trying to identify is whether any backend mass action can be used to get the effect of saving all product attributes or whether there is a piece of simple code which would have the same effect?

Please note I'm not a programmer or developer, more of an admin with limited unix ability.
Thanks..


texts: How to change Magento's default date in calendar?

texts:
My requirement is when I click on the frames of the calendar popup the text-box is filled up with the current date.

How I disable this. I want the date to be selected only when clicking respective dates and not the other parts.


texts:
Whenever I try to install an extension on Magento via SSH or via Magento Connect (/downloader) the following error happens:

  error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure!

This happens on all versions from 1.5 - 1.9.1.0.

This happens with any extension.


texts: After rejection magento extension version

texts: I have created package extension for magento.My extension was rejected and also uploaded my_extension_name with version 1.0.0. Now I have solved all issue created proper guideline.Should I have upload again new higher version(e.g. 1.1.0) or older version 1.0.0 in for upload package in magento website ?


texts:
When I browse my domain name with "www" it works fine. But without "www" it return error Page not found.

Currently my server is on EC2. I need expert advice.


texts: Multiple country-specific stores - how to set up global products

texts:
So I'm setting up a multi country/same domain store, with the stores living in /us/ and /au/

I want to have global products but localised prices. That is, I can build a product once that shows in both stores, but then have different pricing on each site.

Can anyone assist with the best practice to achieve this?

Thanks.


texts:
How to create new *.less file in Magento 2.3 project ?

Here is my existing Theme:

Here is my existing less file that DOES NOT work:

Nothing is work here:

My question is how to add custom less code/file to custom Theme?

any help would be extremely appreciated.


texts: alternative solution of full page cache for CE version

texts:
I had used magento enterprise which include full page cache can be configured as served by redis, but how about in CE version of magento?

Is there any alternative solution available which performance is as good as FPC in enterprise?


texts:
I'm in Production mode. I like to change some styles in my website, so i edited .less

for example:

app/design/frontend/Templatemonster/theme/web/css/styles-l.less

I used "flush Magento cache" from backend and run

 setup:static-content:deploy

still my modified files not updated. What can I use to solve this problem?


texts: In magento 2 URLkey saving issue using programatically

texts:
We are using Magento 2.2.5.we have all store views and default store views are available. Like image http://prntscr.com/nnu4qd
some product are don't have the URL Keys in admin side.
we tried to save the product by manually Url key is generated for only All store views but its not for default store view.
we are writing a program to load product id and save the product again, in this case, url key assigns for default store view but not for all store views.
I need both all store views and default store views url key for the product.
how can I solve this issue?


texts:
I'm trying to include a PHP class in magento 2.

I use a require_once and create a folder lib in the root of my module and there I put the folder that contains the class lib/Meli/Meli.php

Also try in the project folder lib/lib_web/Meli/Meli.php

All without success, any suggestion

This is my controller Controller/Adminhtml/Action/publicar.php

<?php
namespace Uno\MercadoLibre\Controller\Adminhtml\Action;

use \Magento\Backend\App\Action;

class publicar extends Action {
  protected $_session;

  protected $_filesystem;
  protected $_directoryList;

  /**
   * @param Action\Context $context
   */
  public function __construct(
        Action\Context $context,
        \Magento\Framework\Filesystem\DirectoryList $directoryList,
        \Magento\Framework\Filesystem $filesystem,
        \Magento\Customer\Model\Session $session
  ) {
        parent::__construct($context);
        $this->_directoryList = $directoryList;
        $this->_filesystem = $filesystem;
        $this->_session = $session;
  }

  /**
   * {@inheritdoc}
   */
  protected function _isAllowed() {
      return $this->_authorization->isAllowed('Uno_MercadoLibre::action_publicar');
  }

  /**
   * Publicar action
   *
   * @return \Magento\Framework\Controller\ResultInterface
   */
  public function execute() {
    $appId = '123';
    $secretKey = 'abcdefghijkl';
    $redirectURI = 'https://example.mx';
    $siteId = 'MLM';

    //$path = $this->_directoryList->getPath('lib_web');
    //echo "PATH " . $path.'/Meli/Meli.php';
    //require_once($path.'/Meli/Meli.php');

    //$libPath = $this->_filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::LIB)->getAbsolutePath();

    $mediapath = $this->_filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::APP)->getAbsolutePath();
    $modulePath = $mediapath.'code/Uno/MecadoLibre/lib/Meli/Meli.php';

    echo $modulePath;

    require_once($modulePath);

    $meli = new Meli($appId, $secretKey);
    $params = array();

    $url = '/sites/' . $siteId;

    $result = $meli->get($url, $params);

    echo '<pre>';
    print_r($result);
    echo '</pre>';
    die();
  }
}

?>

my echo $modulePath, returns

/var/inetpub/example.mx/app/code/Uno/MecadoLibre/lib/Meli/Meli.php

but it does not help me for the require_once


texts: View.phtml don´t show attribute if empty

texts:
I have made an attribute called replacement_sku to be show on the product page.
My problem is that I would like it only to be visible if there is content and not visible if empty.

Hope someone can help me with some kind of if statement for that.
I use the Ultimo template and Magento 1.9


texts: Get a custom attribute value from a configurable product added to the cart

texts:
I'm trying to get a custom attribute from every product on the shopping cart to disable a shipping method if the attribute is set to Yes on any added product.

It doesn't work for configurable products (It gets the attribute for the parent). I tested it on simple and grouped ones and it works.

Basically I don't know how to look for the attribute on the child product.

Here's my model:

class Si_Shipping_Model_Shipping extends Mage_Shipping_Model_Shipping
{
public function collectCarrierRates($carrierCode, $request)
{
    if (!$this->_checkCarrierAvailability($carrierCode, $request)) {
        return $this;
    }
    return parent::collectCarrierRates($carrierCode, $request);
}

protected function _checkCarrierAvailability($carrierCode, $request = null)
{
    foreach (Mage::getSingleton('checkout/cart')->getQuote()->getAllVisibleItems() as $item)
    {
        if($item->getProduct()->isConfigurable()){
         // Do something to get the overweight attribute value
        }else{
        if($item->getProduct()->getOverweight()){
                if($carrierCode == 'flatrate'){
                    return false;
                }
            }
            }
    }

    return true;
}
}

config.xml

  <global>
<helpers>
  <shipping>
    <class>Si_Shipping_Helper</class>
  </shipping>
</helpers>
<models>
    <shipping>
        <rewrite>
            <shipping>Si_Shipping_Model_Shipping</shipping>
        </rewrite>
    </shipping>
</models>
<sales>
        <quote>
            <item>
                <product_attributes>
                    <overweight />
                </product_attributes>
            </item>
        </quote>
</sales>


texts: How to route custom Magento module controller to a subdomain with Nginx?

texts:
To simplify my question I'm going to use this custom module example as a base for my question.

Once I implemented the custom module in the example, I was able to access indexAction as follow:

  http://www.example.com/index.php/mymodule/index/index

However, my objective is to access indexAction from a subdomain as follow:

  http://mymodule.example.com/index.php/index/index

The frontName is the subdomain name.

Does anyone have an idea on how to implement this.


texts: Custom product type, disable type change when using configurations

texts:
I'm creating a custom product type. I want to have the option of adding configurations (red shirt, green shirt,...). The problem is that there is something in Magento_ConfigurableProduct that the moment you add a configuration it changes the product type to 'configurable'. I cannot change the product type in my type class because once you add configurations I doesn't use this class anymore. Does someone now where it changes the product type (class / file & function)?

ps. I'm not using my custom product types for shirts this is just an example.


texts: Magento + APCu caching issue. Site is slow and there is more cache misses than hits

texts:
I have a Magento 1.7.0.2 installation running on LEMP Stack; Nginx + PHP-FPM (PHP v5.5.6 w/ APCu v4.0.2) + Percona.

I've configured my magento to use APCu caching like this:

app/etc/local.xml

<config>
    <global>
        ...
        <cache>
            <backend>apc</backend>
            <prefix>BDWEB_</prefix>
        </cache>
    </global>
    ...
</config>

and the APC is configured like this:

/etc/php.d/apcu.ini

extension=apcu.so

apc.enabled          = 1
apc.shm_segments     = 1
apc.shm_size         = 512M
apc.ttl              = 7200
apc.user_ttl         = 7200
apc.num_files_hint   = 10240
apc.mmap_file_mask   = /tmp/apc.XXXXXXX
apc.enable_cli       = 1
apc.cache_by_default = 1
apc.max_file_size    = 10M
apc.stat             = 1

and here's the apc info page displaying the huge miss to hit ratio:

Any idea what might be wrong?


texts: How to upload and read csv file import into database in magento 2?

texts:
How to upload the csv file and read import into the database magento 2?

<?php

/**
* XXXX_ProductImport extension
* @category
* @package XXXX_ProductImport
* @copyright Copyright (c) 2018
* @license Open Software License (OSL 3.0)
*/
namespace \ProductImport\Controller\Adminhtml\Imports;

error_reporting(E_ALL);
ini_set('display_errors', 1);

use Magento\Framework\Controller\ResultFactory;

use Magento\Backend\App\Action;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Filesystem;
use Magento\MediaStorage\Model\File\UploaderFactory;

class Save extends \Magento\Backend\App\Action
{
    protected $fileSystem;

    protected $uploaderFactory;

    protected $allowedExtensions = ['csv']; // to allow file upload types

    protected $fileId = 'file'; // name of the input file box

    public function __construct(
       \Magento\Backend\App\Action\Context $context,
        Filesystem $fileSystem,
        UploaderFactory $uploaderFactory
    ) {

        $this->fileSystem = $fileSystem;
        $this->uploaderFactory = $uploaderFactory;
        parent::__construct($context);
    }

    public function execute()
    {

        $destinationPath = $this->getDestinationPath();

       $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     $resultRedirect->setUrl($this->_redirect->getRefererUrl());
        try {
            $uploader = $this->uploaderFactory->create(['fileId' => $this->fileId])
                ->setAllowCreateFolders(true)
                ->setAllowedExtensions($this->allowedExtensions)
                ->addValidateCallback('validate', $this, 'validateFile');

            if (!$uploader->save($destinationPath)) {
                throw new LocalizedException(
                    __('File cannot be saved to path: $1', $destinationPath)
                );
                return $resultRedirect;
            }

            // @todo
            // process the uploaded file
        } catch (\Exception $e) {

            $this->messageManager->addError(
                __($e->getMessage())
            );
            return $resultRedirect;
        }
    }

    public function validateFile($filePath)
    {

        echo "hi";

        // @todo
        // your custom validation code here
    }

    public function getDestinationPath()
    {
        return $this->fileSystem
            ->getDirectoryWrite(DirectoryList::TMP)
            ->getAbsolutePath('/');
    }
}


texts: Magento 2 check user is loged in or not when click on any link in my account section

texts: I want to check when the user clicks on my custom link in my account section it should verify that the customer is logged in or not then it should open.the particular action.Otherwise, it will redirects to login page.


texts:
I am trying to insert a new block above "Grand Total" on the checkout page, but I am really struggling so after a bit of looking I found this to help but  i am still not having any success.

I first tried creating (what I thought was) the correct xml in a mymodule.xml file, when that did not work I tried adding that code to local.xml, that hasn't worked either. I know all xml files are loaded then local.xml is loaded again last in order to override previously made definitions but that leaves me wondering, can you only added new blocks to the core using local.xml or can I do it with mymodule.xml. If I can add blocks using mymodule.xml file, do I only use local.xml only when I want to move/remove/override core blocks?

I am trying to add a custom block before checkout.cart.totals (location: checkout.xml). I have tried

<reference name="checkout.cart">
    <action method="insert"><blockName>mdeprojects.remainder</blockName></action>
</reference>

<reference name="checkout.cart">
    <checkout_cart_index>
        <action method="insert"><blockName>mdeprojects.remainder</blockName></action>
    </checkout_cart_index>
</reference>

<checkout_cart_index>
    <action method="insert"><blockName>mdeprojects.remainder</blockName></action>
</checkout_cart_index>

what am I doing wrong?

===EDIT===

Now I'm getting more confused to confirm I was targeting the block I added

<checkout_cart_index>
   <remove name="checkout.cart.totals" />
</checkout_cart_index>

this worked

I then tried (for test purposes) to add the block directly to checkout.xml and my template file was not rendered.


texts: How to add Product id after cart url on cart page in Magento 1.9

texts:
I want to add some product id after cart url on cart page the product that is added in the cart. Because i want to target that products by using omnisend extension that target by part of url. To show popup on cart page showing discount for that particular product.

Second method - there's second method is if all products in cart have discount, then there must be a random url key after cart url in url on cart page, so that i can target one specific part of url to show popup of discount on products at cart page that are added in cart on cart page only.


texts: Mechanism to Track "COSTS" associated with FREE SHIPPING Promotions

texts:
Currently, if/when a merchant sets up a FREE Shipping Cart Price Rule - the Quote and Sales-Order tables (sales_order / sales_order_grid / quote / quote_address / quote_shipping_rate) capture cost associated with the FREE Shipping method as ZERO DOLLARS.
But, the reality of the matter is - the merchant still has to pay the Shipping_Carrier money to generate the shipping labels needed to actually ship the item.
Therefore, from a Cost-of-Customer-Acquisition and/or Profit-&-Loss-Statement (P & L) perspective - it makes sense to identify and/or track how much money it costs to "make the sale" w.r.t Shipping-Incentives.
Given this background, is it possible to setup Cart-Price-Rules to apply the Shipping Amount (i.e. as quoted by the Shipping Carrier) as a $$ Discount instead of accounting for it as
a ZERO dollar Order Attribute?
In Other words,
How do we go from the Current Model:

Order Subtotal => $30.00
Taxes => $9.00
Shipping & Handling => $0.00
Order Grand Total = $30.00 + $9.00 + $0.00 => $39.00

.
.
.
To this Model:

Order Subtotal => $30.00
Taxes => $9.00
Shipping & Handling => $17.00
Discount (Shipping & Handling) => $17.00
Order Grand Total => $30.00 + $9.00 + $17.00 - $17.00 => $39.00


texts:
Hi there I am looking at Magento as a platform for our CMS and have seen a layout displaying products on this site and many more.  I have seen it on mostly kitchen cabinet sites. Looks like a variable product layout of sorts.  Before I dig into magento I need to know this as my employer would like this look.
http://www.wholesalecabinets.us/cabinets/spice-shaker.html. I am interested in the grid with the image on the left and the products on the right.  If this is possible can you give me some insight on how to do it or at least if there is an extension.  I have knowledge in both wordpress/woocommerce and Joomla.

The layout should be similar to this.


texts:
I am moving from magento 7.0.3 to 7.2.33
I have a list of functions which will be deprecated with 7.2 php version.
I can see there are lots of files that use the deprecated functions.
I can't make changes to a lot's of core files.

Is their any way it can be fixed ?
Does Magento has solution for this type of migration ?

Thankyou


texts: Magento 2.2 Creating Configurable Product With API

texts:
I want to create configurable product and its related simple products at the same time via API.

For example: shoes; with different sizes(attribute=shoesize).. as like:

Prada's new shoe (configurable product)... And it's child sizes:
36 => stock: 4 (simple product), 37 => stock: 2(simple product) etc..

I'm recently using the code at below, to add simple products; could someone help me to update my code to resolve my need?

<?php
$url = "http://www.example.com/";
$token_url=$url."rest/V1/integration/admin/token";
$product_url=$url. "rest/V1/products";
$ch = curl_init();
$data = array("username" => username, "password" => password);
$data_string = json_encode($data);
$ch = curl_init($token_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$token = curl_exec($ch);
$adminToken=  json_decode($token);

$sampleProductData = array(
'sku'               => 'SAMPLESKU',
'name'              => 'sample product',
'visibility'        => 4,
'type_id'           => 'simple',
'price'             => '200',
'status'            => 1,
'attribute_set_id'  => 101,
'weight'            => 1,
'manufacturer'            => 25,
'extension_attributes' => array(
        "stock_item"=>array(
                'qty' => $inventory_stock,'is_in_stock' => 1,'manage_stock' => 1,'use_config_manage_stock' => 1,'min_qty' => 0,'use_config_min_qty' => 1,'min_sale_qty' => 1,'use_config_min_sale_qty' => 1,'max_sale_qty ' => 10,'use_config_max_sale_qty' => 1,'is_qty_decimal' => 0,'backorders' => 0,'use_config_backorders' => 1,'notify_stock_qty' => 1,'use_config_notify_stock_qty' => 1
        ),
),
'custom_attributes' => array(
    array( 'attribute_code' => 'category_ids', 'value' => ["6"] ),
    array( 'attribute_code' => 'description', 'value' => 'xxxxx' ),
    array( 'attribute_code' => 'short_description', 'value' => 'xxxxx' ),
    array( 'attribute_code' => 'meta_title', 'value' => 'xxxxx'),
    array( 'attribute_code' => 'meta_keyword', 'value' => 'xxxxx'),
    array( 'attribute_code' => 'meta_description', 'value' => 'xxxxx'),
),

);

$productData = json_encode(array('product' => $sampleProductData));

$setHaders = array('Content-    Type:application/json','Authorization:Bearer '.$adminToken);

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $product_url);
curl_setopt($ch,CURLOPT_POSTFIELDS, $productData);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $setHaders);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$response=  json_decode($response);
echo $response;
curl_close($ch);

?>


texts: How to get the price of all simple products assigned to configurable products in magento 2?

texts:
I am trying to display prices of all the simple products which are assigned to the configurable products. For that I am using:

<?php
    $attributes = $configurable->getConfigurableAttributesAsArray($_product);
    foreach($attributes as $attrId => $attribute){
        $att_value = $attribute['values'];
        echo "<pre>"; print_r($att_value); echo "</pre>";
    }
?>

After this is I am not getting price of the simple products, although I got the variations of the configurable product. But I want to display the price of the simple products. How can I do this?


texts: Magento 2: how to use sql queries on controller?

texts:
Please, how we can use sql queries on controller? i am using Magento 2 and this is my controller:

<?php

namespace Demo\Demo\Controller\Demo;

class Demo extends \Magento\Framework\App\Action\Action
{

    public function execute()
    {

    }
}


texts:
I try to add more KO functions to the Magento_Checkout/template/summary.html

I have an own extension "XXX_Checkout"

For this i do the follow parts:

Create Mixin

  /app/code/XXX/Checkout/view/frontend/requirejs-config.js

    var config = {
    map: {
        '*': {
            'Magento_Checkout/js/view/shipping': 'XXX_Checkout/js/view/shipping',
            'Magento_Checkout/js/view/payment': 'XXX_Checkout/js/view/payment',
            'Magento_Checkout/js/model/shipping-save-processor/default': 'XXX_Checkout/js/model/shipping-save-processor/default',
            'Magento_Checkout/template/summary.html': 'XXX_Checkout/template/summary.html'
        }
    },
    config: {
        mixins: {
            'Magento_Checkout/js/action/set-payment-information': {
                'XXX_Checkout/js/order/set-payment-information-mixin': true
            },
            'Magento_Checkout/js/view/summary': {
                'XXX_Checkout/js/view/summary-mixin': true
            }
        }
    }
};

For this i place the original summary.html in my Extension and place some additional code:

  /app/code/XXX/Checkout/view/frontend/web/template/summary.html

    <button type="button" class="button action primary" id="place-order-trigger">

    </button>

Now i add the summary-mixin.js

  /app/code/Team23/Checkout/view/frontend/web/js/view/summary-mixin.js

define([
    'jquery',
    'jquery/ui',
    'ko',
    'Magento_Checkout/js/model/step-navigator'
], function($, ui, ko, stepNavigator){
    'use strict';
    var mixin = {
        isVisibleShippingButton: function () {
            return !stepNavigator.getActiveItemIndex();
        },

        isVisiblePaymentButton: function () {
            return stepNavigator.getActiveItemIndex();
        },

        initialize: function () {
            var self = this;

            $(function() {
                $('body').on('click', '#place-order-trigger', function () {
                    $('.payment-method._active').find('.action.primary.checkout').trigger('click');
                });
            });

            this._super();
        }
    };

    return function (target) {
        return target.extend(mixin);
    };
});

After build and cache clean i get this error in my console:

knockout.js:3012 Uncaught ReferenceError: Unable to process binding "if: function(){return (isVisiblePaymentButton()) }"
Message: isVisiblePaymentButton is not defined
    at if (eval at createBindingsStringEvaluator (knockout.js:2624),

So i think, the mixin is not working.

What is wrong?

Best regards
Andre


texts: Multi website category url issue in magento 2

texts:
I have 2 website Retail and wholesale. Both the websites have same categories.
Retail website takes proper base url.https://5iallk0uwem1coeq.mojostratus.io/
For the wholesale website i have set the base url as https://wholesale-5iallk0uwem1coeq.mojostratus.io/ but still it is taking the base url for the retail store.
You can refer https://wholesale-5iallk0uwem1coeq.mojostratus.io/ url and check the categories in menu and the footer links.
Please help me in this.


texts:
I encountered the following issue when i was trying to install a module. When I try to access the admin panel on my magento I get:

  Call to a member function setActive() on boolean in C:\xampp\htdocs\project\vendor\magento\module-backend\Model\View\Result\Page.php on line 27

I disabled all third party and custom modules, I compiled the code but I still get this error.

EDIT: I did a var_dump($itemId) just below the line where the error is and the $itemid is 'Magento_Backend::dashboard'.

EDIT 2: The error is because the line "$this->layout->getBlock('menu');" above returns false. I can't find though why this is happening


texts: Magento 2 Show selected Bundel Product Option into Popup

texts:
I have create one custom Module. I need to get bundle product html into popup like give below. I have product id.

How to achive this ?


texts: (Silently) failing to create custom attribute for category

texts:
I am trying to add some custom attributes to my categories in Magento.

So Ive created my first ever module which would add a single custom attribute, by following the tutorial here: http://gauss-development.com/blog/tutorials/adding-custom-category-attributes-magento/

Everything seems to be working fine, the modules appears to be installed (I can see it in System > Advanced > Disable Modules Output).

But my custom attributes are not appearing. At all.

Ive been through the tutorial for the last 4 days. Over and over again. Following it as closely as possible, copy and pasting wherever possible. Other tutorials I have seem appear to be similar to this, I tried following them as well. All of these tutorials end up with the same results, no errors, nothing appears to be wrong, the modules appear to be loaded, but no sign of my new custom attributes appearing.

I feel I am missing something not mentioned in these tutorials, but I have no idea what.

Can anybody think of anything I could be doing wrong?

If you need to look at any code, please look at the tutorial mentioned above. Is there a piece of information, or instruction that tutorial is missing? Remember I have no other experience with creating modules, so I am following these to the letter. If they are assuming I would have a basic piece of information, this is probably where I am slipping up, but currently I have no way of knowing what I am missing.

Thanks in advance for your help.


texts: 301 Redirect Magento System URLs to SEF version

texts:
I'm struggling to find a solution to permanently redirect Magento's system product URLs, that look like this http://domain.com/catalog/product/view/id/473. My goal is to automatically redirect them to their search engine friendly version: http://domain.com/blue-widget.html

I checked my system settings and made sure that Use Web Server Rewrites is set to yes in Under System > Configuration > General > Web > Search Engine Optimization, but for some reason the redirect is not working. Example URL

Note that I'm running Magento 1.7


texts: Magento custom module with custom database table admin page

texts: I wants to view your custom table datas in admin panel


texts: Magento 2: How to reload/update billing address on the Checkout page

texts:
I'm working on the OneStepCheckout and my problem is when I clicked on the place order button and the My billing and shipping address are the same checkbox is not changed (after filling the shipping address) then it gives me error for required billing address fields.

I'm trying to update/reload the billing address (if the My billing and shipping address are the same checkbox is clicked) when all the fields are filled in the shipping address form on the checkout page.

Can anyone help me with this.

Thanks in advance!!!


texts: Add custom product attribute to checkout summary Magento -2

texts:
I have added onestepCheckout module in my project. Now, I want to show discount amount in checkout summary after product name.

I refer this link : Add custom product attribute to checkout summary Magento 2

It shows something on that page while loading. But when my page loaded properly then it's gone.

Can anyone please help me to solve this.

Here you can see this 'no' below item image
 is showing while loading and then disappears. :  https://www.loom.com/share/ab05cd107b384d468b2d1147816c2ae6


texts: How can I find all the children of a bundle which are currently out-of-stock or have zero quantity

texts:
Every now and then, a client creates a bundle product, and they include some simple products that aren't in stock. When this happens, they reach out and ask why their product isn't showing.

To expedite this process, it would be great to have a tool to troubleshoot common reasons that a bundle might not be working as intended.

How can I find all the products under a bundle that aren't in stock?


texts:
Looking for some advices/ideas

Magento 2 offer us Custom Options in catalog section.

In Backend, we can add custom options like below picture and it appear on frontend like

My question is I want to add custom custom option, how can  I achieve that.


texts: The use of functions rename(), is_readable(), fopen(), fgetcsv() is discouraged Magento 2

texts:
I am checking uploaded file is readable by is_readable function of php but in coding standard check it's shows

  The use of function is_readable() is discouraged

same error show ablow all function.


texts: Magento 2 - add lazy loading to pagebuilder images

texts:
I already have lazyloading in place for category product images.
I added a script to the head, added a class "lazyload" to each image, and changed the src to data-src.
This works perfectly.
I am now trying to change this for pagebuilder images.
so far, I have created my own module and added a class to the image.
File app\code\module\Lazyload\view\adminhtml\web\template\content-type\image\full-width\master.html
I edited the class attribute to include "lazyload"
Code snippet:

All that is left to do is change the src to a data-src, but I am unsure where to change this.
I tested editing view\adminhtml\pagebuilder\content_type\image.xml, but have been failing in implementation.
Any help would be appreciated.
Thanks!


texts: Some Category pages taking exactly 10 seconds to load

texts:
Magento V. 1.7x

On the menu bar there are multiple categories like boats, cars, trucks etc.

Some of these categories, whatever is in Cars & Trucks are taking exactly 10 seconds to load. I am not sure why these are taking 10 seconds before they even show anything on the page.

Here is the page taking a long time to load:
https://www.sealskincovers.com/index.php/landing/allcarcovers.html

This is another category page that loads fine:
https://www.sealskincovers.com/index.php/landing/allboatcovers.html

I have performed all indexes to make sure its not an indexing issue.

Any help would be really appreciated. Thank you


texts: Static content deploy issue for Magento 2.3.2

texts:
Hello!

After upgrading Magento 2.1.8 to Magento 2.3.2, I get an error when run command:

> php setup:static-content:deploy

or

> php setup:static-content:deploy en_US -f

Text of my Error:

  failed to open stream: No such file or directory

How to fix it, guys? Please, help me

Thanks)


texts: Magento EE 1.14.1 RWD not displaying Rotating banner widget

texts:
I'm testing Magento EE 1.14.1 using the RWD theme (rwd/default) and have come across the following problem.

I've created a very simple banner which is just plain text. It is not
associated with a promotion or a segment.
To preview I've inserted the banner into a standard CMS page using
the insert widget tool and then the rotating banner method (set
to show all banners at once). I've assigned the banner to this.
Caching is turned off so no need to flush.
When I go to view the page on the frontend the banner is not displayed.
If I change the theme back to the original enterprise/default and view the page the banner displays.

I've also tried viewing the banner using the widget with a layout position (multiple layout positions) but to no avail.

Is anyone aware of anything I am doing wrong? Has anyone else come across this problem or able to replicate it. I've tried on two instances of EE and the problem happens on both.

Is this a bug or an error on my part? and if anyone has a solution I would be very grateful.


texts: Delete User from Back-end not apply, Magento 2.3

texts:
We use Magento 2.3.3 and I tried to delete user from backEnd (admin panel).
Go to System > Permission > All Users > select the user that I want to delete, click on "Delete User" button, enter the admin password,  and got a message "You deleted the user.".

I still see the user in the list grid and still I found it in Data Base...

Any idea, why it is not delete the user from DataBase and BackEnd?

Thanks


texts:
I have manually uninstalled an extension, but cant figure out the last part

Removed the Db Tables
Removed all traces from magento core tables
Removed the Design, skin, app, app/etc files
Removed from var/package
Flushed the cache

The extension is M2epro

Now magento connect says the extension is already installed (as i want to reinstall it)
Where is it getting this info from?