texts:
Can anyone elaborate the theme structure of Magento 2.2. I already refer the Theme document for it.

Also I want to change the category page layout so please guide me.

Category description block is hide if I change the referenceContainer name(column.top) in catalog_category_view.xml file, so please elabore what is the column.top and where it is define in the magento.


texts: How to set default color configurable product on product page in pwa-studio with Magento 2.3.2?

texts: In PWA-studio default random colors are loading, but I want to load default Product colors.


texts: How to show sub total section on checkout page Magento 2

texts:
How to show sub-total section on Magento 2 checkout page sidebar?

Ex :

I want to show this section on checkout page.
cart sub total section only visible on www.example.com/checkout/#payment

but I want to show it on www.example.com/checkout/ page too.


texts: Magento CE 1.7.0.0 Cache Management Creates JS Issue

texts:
The site I am working with uses an image gallery/banner rotater. The script for this is contained in the head.phtml file. It looks like all pages are reading it except those that are actually categories set up to display a static block only.

<script type="text/javascript">
        jQuery.noConflict();
        jQuery(document).ready(function() {
        jQuery(".navigat li:first").css("background","none");
            jQuery('.slideShow').slideShow({
                interval: 5
            });
             var body_h = jQuery('body').height();
             //alert(body_h);
             body_h = body_h-58;

             jQuery('.imagescont').height(body_h);
            });
    </script>

The admin is set to allow full page caching:
Location: System/Configuration, using Default Config
Left Menu: System
Heading: External Full Page Cache Settings

When Cache Storage Management via System/Cache Management is turned off all pages read the gallery script and it functions as expected.

When Cache Storage Management via System/Cache Management is turned on then any page that is created via a category in admin set to use a static block fails. In this scenario, the source code shows that the gallery script is not present in the head.

Steps tried so far: Clear the cache completely after turning on Cache Storage Management via System/Cache Management. Remove gallery script from head.phtml and add to header.phtml again clearing the cache and waiting up to 10 minutes in case the cart needed time to cycle the changes through. Adding the script to the static block being tested. (No that does not make sense but I still wanted to rule it out.)

Does anyone have any ideas as to why this would be the case?


texts: Getting Custom Product Attribute Value via objectManager in Magento 2

texts:
I have a custom template where I would like to get custom product attribute value, in my particular case is a yes/no attribute type. This has troubled me for quite a while as I can get all default attribute value, such as sku, id, price etc, but not my custom attribute value. The code I used was:

$attribute_value = $_product->getResource()->getAttribute('custom_attribute_code')->getFrontend()->getValue($_product);

It will always return Yes no matter what.

Until I gave 'objectManager' a go and it worked and returned the correct attribute value and the code I used are:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($_product->getId());
$attribute_value = $product->getData('custom_attribute_code');

So my question is

1) Why the first option returns only "Yes" and is it a bug?

2) Can someone please explain the difference between the two?

Thanks!


texts:
I'm trying to access the REST Endpoints:

POST /V1/products/special-price
POST /V1/products/special-price-information
POST /V1/products/special-price-delete

I want to achieve this through PHP code however i'm finding it hard to understand just how to access them. I want to be able to GET the special prices of specific products. Any direction would be a help.


texts: Magento 2: how to get Custom Options in custom product list on detail page?

texts:
This is my Custom Collection, I want custom options in this collection below the price.

I have custom product collection like related, upsell products, the collection is properly displaying on the product page. now I want to display custom options (same as swatches) in that collection using XML.
How can I make it possible?

I tried as below but not Working.

<block class="Magento\Framework\View\Element\Template" name="product.info.form.options" as="options_container">
    <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="Magento_Catalog::product/view/options/wrapper.phtml">
        <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="Magento_Catalog::product/view/options.phtml">
            <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" name="product.info.options.default" as="default" template="Magento_Catalog::product/view/options/type/default.phtml"/>
            <block class="Magento\Catalog\Block\Product\View\Options\Type\Text" name="product.info.options.text" as="text" template="Magento_Catalog::product/view/options/type/text.phtml"/>
            <block class="Magento\Catalog\Block\Product\View\Options\Type\File" name="product.info.options.file" as="file" template="Magento_Catalog::product/view/options/type/file.phtml"/>
            <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" name="product.info.options.select" as="select" template="Magento_Catalog::product/view/options/type/select.phtml"/>
            <block class="Magento\Catalog\Block\Product\View\Options\Type\Date" name="product.info.options.date" as="date" template="Magento_Catalog::product/view/options/type/date.phtml"/>
        </block>
        <block class="Magento\Framework\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/>
      </block>
    <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="Magento_Catalog::product/view/options/wrapper/bottom.phtml">
        <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.additional" as="product.info.addtocart" template="Magento_Catalog::product/view/addtocart.phtml"/>
    </block>
</block>


texts: How to hide non available attributes on catalog page ? Magento 1.9

texts:
I want to hide Non-available attributes (i.e. color or size) on catalog page or products listing page. I have tried to get quantity/stock for particular attribute_id and product_id but I did not get it. So let me know how can I do that.

I am using colorselectorplus module for displaying color swatches on my site. See how my catalog page is looking :- http://prntscr.com/du7k13 All the colors attribute are there, available and non-available both. And See how my detail page is looking for same product :- http://prntscr.com/du7kn9. I want to display same like product page in catalog page.

Please Help !


texts: How to redirect to custom module after order is placed on admin panel?

texts:
After I create an order (fill the form) in the admin panel and clicking submit order button, usually the page gets redirected to order_view page.

I use sales_order_place_after event , I need to redirect to a custom module grid page.

How can I do that?


texts: How to edit the custom option price type programmatically?

texts:
I have a product which has 1 custom option (Size) with 3 custom options values (Standard,Medium,Large).

Now I am trying to change price type (price_type) 'fixed' to 'absolute'.
I fetched the option_type_id by using customOptions as below:

$customOptions = $obj->get('Magento\Catalog\Model\Product\Option')->getProductOptionCollection($product);
foreach ($customOptions as $customOption) {
    $values = $customOption->getValues();
    foreach ($values as $value) {
    // fetched the option_type_id
    }
}

It stored in catalog_product_option_type_price table into the database.

Is there any way to update the price type directly from option_type_id?

How to do with ProductCustomOptionInterface?


texts: Magento - edit multiple original tables of magento

texts:
I want to edit some tables of magento and I've made a module to do that.
For example I want to edit table "catalog_product_bundle_price_index".

Here is the global section of my config.xml :

<global>
    <resources>
        <mymodule_setup>
            <setup>
                <module>Mynamespace_Mymodule</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </mymodule_setup>
        <mymodule_read>
            <connection>
                <use>core_read</use>
            </connection>
        </mymodule_read>
        <mymodule_write>
            <connection>
                <use>core_write</use>
            </connection>
        </mymodule_write>
    </resources>
</global>

And here is the code in mysql4-install-1.0.0.php :

$installer = $this;
$installer->startSetup();

$tables = array(
        $installer->getTable('bundle/price_index') => array(
                'columns' => array(
                        'min_price' => array(
                                'type'      => Varien_Db_Ddl_Table::TYPE_DECIMAL,
                                'scale'     => 4,
                                'precision' => 16,
                                'nullable'  => false,
                                'comment'   => 'Min Price'
                        ),
                        'max_price' => array(
                                'type'      => Varien_Db_Ddl_Table::TYPE_DECIMAL,
                                'scale'     => 4,
                                'precision' => 16,
                                'nullable'  => false,
                                'comment'   => 'Max Price'
                        )
                ),
                'comment' => 'Catalog Product Bundle Price Index'
        )
);

$installer->getConnection()->modifyTables($tables);
$installer->endSetup();

but it does not work, What am I doing wrong?


texts:
While creating custom attribute in magento 2, what is the use of below

'backend' => '',
  'frontend' => ''
  'class' => ''
  'source' => ''

$eavSetup->addAttribute(
                \Magento\Catalog\Model\Product::ENTITY,
                'sample_attribute',
                [
                    'type' => 'text',
                    'backend' => '',// What is the use of this
                    'frontend' => '',//What is the use of this
                    'label' => 'Sample Atrribute',
                    'input' => 'text',
                    'class' => '',// What is the use of this
                    'source' => '',// What is the use of this
                    'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
                    'visible' => true,
                    'required' => true,
                    'user_defined' => false,
                    'default' => '',
                    'searchable' => false,
                    'filterable' => false,
                    'comparable' => false,
                    'visible_on_front' => false,
                    'used_in_product_listing' => true,
                    'unique' => false,
                    'apply_to' => ''
                ]
            );


texts: How to remove white space product image on product detail page magento 2.3?

texts:
I have getting issue of white space on product detail page.

I tried to fixed using view.xml but no success.

I have added image to show where I am getting white space.


texts:
After installing patch SUPEE-9767 and enabling Form Key Validation in checkout page, the shipping method step cannot proceed to next step.

After disabling the Form Key Validation in admin it's working fine.

Please find the below screenshots.

I want to show like this:

Thanks
Bestregards


texts: sandbox - How to get paypal payment details if failed to return back

texts:
I am using Paypal Sandbox for at my site to process payments.

I am saving payment stuffs after the user returned successfully to the store using an URL defined for payment successful/canceled.

But suppose the user loses connection due to any technical issue (e.g. server down or failed internet connection), then how I will get the payment details,  especially in cases of the paid orders?


texts: magento 2 - call payment method render function after discount has been applied

texts:
i defined a function RecalculatePlan in */view/frontend/web/js/view/payment/method-renderer/installment-method.js that recalculates the installments displayed in a table contained in the method section.
I can call the function when the user changes payment method (i bound the event in my template html ).

My problem is: when the user applies a discount in the checkout page i would like to recalculate the installment table of the current selected method.
How can i call this function? I have no idea how to access the js component.

Any help?


texts: Magento 2: How to implement multiple image uploader in admin form using UI component

texts:
I'm using UI component for building admin form. In the form, I have an image uploader field.

Using this uploader, I'm able to select only one image to upload. But I need to upload multiple images.

On referring to Magento docs, isMultipleFiles option needs to be true.

<field name="image" sortOrder="10" formElement="imageUploader">
<settings>
    <label translate="true">Image</label>
    <elementTmpl>ui/form/element/uploader/image</elementTmpl>
    <visible>true</visible>
    <validation>
        <rule xsi:type="boolean" name="required-entry">true</rule>
    </validation>
</settings>
<formElements>
    <imageUploader>
        <settings>
            <isMultipleFiles>true</isMultipleFiles>
            <validation>
                <rule xsi:type="boolean" active="false" name="required-entry">true</rule>
            </validation>
            <uploaderConfig>
                <param xsi:type="string" name="url">sample/image/upload</param>
            </uploaderConfig>
            <previewTmpl>Module/image-preview</previewTmpl>
        </settings>
    </imageUploader>
</formElements>

But still, the uploader is able to select only one image. Am I missing something here?


texts: Getting Undefined offset: 90 while Edit Simple product in magento 2

texts:
I am migrating my website from Magento 1.7 to Magento 2.

In my backend ,
Whenever I am trying to edit any product URL redirection, I am getting Undefined offset: 90 in

vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 168.

Please help me to resolve this issue.

Thanks


texts: Add block for category and subcategories

texts:
I need to add my *.phtml page to right part of the site in special category and subcategories.

I tried <catalog_category_view>, but it is for all categories. I also tried <CATEGORY_{category_id}> but it is not working (do not know why) and i think it will not be for subcategories.

So, how may i do it? where should i paste this code:

 <reference name="right">
            <block type="my_module/block" name="blog.articles"
                   as="blog.articles"
                   template="path/to.phtml"
                   translate="label">
                <label>Articles</label>
            </block>
        </reference>


texts: Get attribute admin values layered navigation filter - Magento 2.3

texts:
I need to change this code to get attribute Admin value not store view value, any advice about this, please. or how to set a store view in this code to be able to list the admin value and skipping the store views value.
 public function getFilterableAttributes()
    {
        if ($this->loadedAttributesData !== null) {
            return $this->loadedAttributesData;
        }

        $attributesData = [];
        $attributeCollection = $this->filterableAttributes->getList();

        foreach ($attributeCollection as $attribute) {
            $attributeCode = $attribute->getAttributeCode();

            $attributesData[$attributeCode]['type'] = $attribute->getBackendType();
            $options = $attribute->getSource()->getAllOptions();

            foreach ($options as $option) {
                //$attributesData[$attributeCode]['options'][$this->formatUrlKey($option['label'])] = $option['label'];
                $attributesData[$attributeCode]['options'][$option['value']] = $option['label'];
                //$attributesData[$attributeCode]['options'][$option['value']] = $this->getOptionLabel($option['label'], $option['value']);
                $attributesData[$attributeCode]['frontend_label'] = $attribute->getFrontendLabel();
            }
        }

        $this->loadedAttributesData = $attributesData;
        return $this->loadedAttributesData;
    }

public function getAttributeValue($filterItem)
    {
        $labelValues = [];

        if (method_exists($filterItem->getFilter(), 'getAttributeValues')) {
            $values = $filterItem->getFilter()->getAttributeValues();

            if ($values) {
                foreach ($values as $optionId) {
                    $labelValues[] = $filterItem->getFilter()->getAttributeModel()->getFrontend()->getOption($optionId);
                }
            }
        }

        $labelValues[] = $filterItem->getLabel();

        $attribute  = $filterItem->getFilter()->getData('attribute_model'); //->getAttributeCode()
        if ($attribute) {
            if ($attribute->getAttributeCode() == 'price' || $attribute->getBackendType() == 'decimal') {
                return $filterItem->getValue();
            }
        }

        $labelValues = array_unique($labelValues);
        return implode($this->helperLayerAll->getMultipleValueSeparator(), $labelValues);
    }


texts: How to create new shipment using Magento REST API?

texts:
I am looking here

http://www.magentocommerce.com/api/rest/introduction.html

but I am unable to found any method that supports shipment creation.
Please help.


texts: Add Product to Cart via SOAP error - Please specify the product required option(s)

texts:
I am trying to use the shoppingCartProductAdd SOAP API to add a product with Custom Options to cart.

Below is the array I am passing for the products parameter. I've a required custom option id 1 for which the selected value id in the dropdown is 2. (you can view the product here)

array (size=1)
  0 =>
    array (size=3)
      'product_id' => int 25
      'qty' => int 1
      'options' =>
        array (size=1)
          1 => int 2

When I execute this SOAP request, I get an error "Please specify the product required option(s)."

It looks like its not accepting my 'options' key in the array.

What am I doing wrong?


texts:
The catalog URL rewrite indexers do not work correctly for some reasons. I realised something was wrong when, with FPC on (or Varnish), a wrong category (or no category at all) were set on the product view page. I tried to debug it a bit, and found out that the URL reindexer did not add any entries for target paths like catalog/product/view/id/XXX/category/YYY, even though the option "Use category path in product URL" is active. I simply found product URLs with no category attached like catalog/product/view/id/XXX. I though a full reindex would help in this, therefore I truncated all URL rewrite tables on my dev machine and run the indexer via CLI. Same result: no entry for products in the categories.

Puzzled, I did the same on a fresh install on Magento EE with test data: run installation, truncated all url_rewrite tables, and run a full reindex. Magento creates entries for category URLs, products URLs, but I found nothing for products with category paths. Is this a bug or a "feature"? Am I missing something here? Did anyone have the same problem?

EDIT:

I tried to investigate this issue a bit further. The Catalog URL and Product URL indexers are definitely not creating these rewrites, other than what happened in EE 1.12 / CE 1.7. The only place I could find where these rewrites are created is in enterprise_catalog/observer: the event observer is bound to catalog_product_save_after and generates the rewrites for product URLs including the category path. However, and this is something I don't get, these are not system paths as in the past (is_system is set to 0), but they are created as redirects.


texts: how to add phone number next to my account

texts: I would like to add support phone number before my account in top link.  Please help step by step in including path.  I am a beginner.  Thank you.


texts: How to know the database name from InstallData.php file

texts: Could anyone please help me how to know the table name from InstallData.php file in this question. there is no InstallSchema.php file


texts: Insert video in specific category page, Magento 1.9

texts:
I want to insert a video in a single category page.

I have the category "mou you" and I would like to insert an explain video in the head of this page, is it possible?

This is my page and the place where I want to insert the video:


texts: Stuck due to waiting for table metadata lock

texts:
sometimes, when i run the setup:upgrade command, magento2 stops on Magento2 Indexer (Runnign data recurring) for hours. Reading processlist under mysql server it looks like there is a problem on some queries like this one
DROP TRIGGER IF EXISTS `trg_cataloginventory_stock_item_after_insert
and the status is Waiting for table metadata lock.
if i kill the process and restartm, flushing cache, manual reindexing, it does the same.
What could i do?


texts: programmatically user confirm and news letter subscrip in magento(1.9.0.1)

texts:
case 1 : when i register via Facebook,i need to confirm the user and activate the newsletter subscription programmatically.

your support will help much more, thanks advance.


texts: Error "DDL statements are not allowed in transactions" while create new product In Magento 2.3.4

texts:
When i try to create new product it showing below error
"DDL statements are not allowed in transactions"
I have done research and found that in "vendor/magento/framework/DB/Adapter/Pdo/Mysql.php"
protected $_ddlRoutines = ['alt', 'cre', 'ren', 'dro', 'tru'];

if (in_array($startSql, $this->_ddlRoutines) && strcasecmp($sqlMessage[1], 'temporary') !== 0) {
                throw new ConnectionException(AdapterInterface::ERROR_DDL_MESSAGE, E_USER_ERROR);
}

It give error for this query "ALTER TABLE catalog_product_entity_tmp_indexer ADD PRIMARY KEY (entity_id)".
Simply it checks if sql starts with ALT and and its not temporary it throws error.
Any Idea why it happens.
Thanks
Amit


texts: How to set Currency by default Billing Address Country in Magento 1.9?

texts:
In my setup only logged in customers can see prices and order. How to set currency due to their default billing address?

Thanks!


texts: Sort products by date DESC as the base sort order on category page?

texts:
For example, below products are created in sequential order:

A - oldest, added 5 months ago
B
C
D
E
F - newest, added today

Magento's default sort order seems to be by Date ASC with the oldest products at the top:

A - oldest
B
C
D
E
F - newest

However if "Default Product Listing Sort By" of this category is selected as "Best Value" in Catalog > Manage Categories > (Choose the category) > Display Settings, AND some of the products are given arbitrary "Position" values other than the default value 1 in "Category Products" tab, the category product listing sort order would be like this:

E - pos = 112
C - pos = 27
A - pos = 1, oldest
B - pos = 1
D - pos = 1
F - pos = 1, newest

Basically, you can either sort them by Date or by Position, but NOT both at the same time. I can set order by Date DESC as the category default sorting but then position sorting will not work.

So my question is this. How can I sort the products first by date DESC, and then by Position DESC? So the product listing of a particular category looks like this:

E - pos = 112
C - pos = 27
F - pos = 1, newest
D - pos = 1
B - pos = 1
A - pos = 1, oldest

Which is much more desirable as immediately after position sorting, newer products come ahead of older products.

How can I sort the product listing on category pages by Date DESC rather than by Date ASC as the base sort order? So the other sort types work on top of that?

Please let me know if I made myself clear.


texts: Mage log printing any variable/string 2 times

texts:
I am facing very strange problem if i using mage log function in controllers file to print any string/varable/array it prints 2 times in log file

Mage::log('string', null, 'mylogfile.log');
Mage::log('$vaiable', null, 'mylogfile.log');
Mage::log('$array', null, 'mylogfile.log');

i don't have any idea about this & i also search internet but no appropriate result.
can any help me why this is happening
because of this i am getting problem in debugging.


texts: magento2 still serves files from root/pub/ directory even in dev mode

texts:
App mode is developer (checked also in env file).

Nginx has root www/.

www/index.php is hit.

Placed a die() statement in www/pub/index.php to make sure that the file isn't hit. It is not hit.

But if I look into page source, css and js are still served from pub folder.

In admin I have selected client side workflow.

So if I have some js in my module, I have to edit the js in pub/ and then copy my changes to app when done, which is quite a pain.

I don't know about any other settings that I can check.

grunt watch picks up less files but doesn't do anything to js files (I don't know if this is the intended behaviour).

Thanks!


texts:
I've been running into an issue with an M2 store where randomly when you attempt to add a product to the cart you get the 404 page instead.  Running a re-index fixes the issue.  It may be days in between problems or weeks but we haven't been able to find the root cause.  Any suggestions on where I could look?
I looked in exception, debug and system logs but didn't see anything that jumped out at me as a possible cause.


texts: magento products been shuffling on homepage?

texts:
i am in the process of implementing the product list , but the thing is , do not know why its been shuffling . if somebody have experience on how to get rid of this.

{{block type="catalog/product_list" name="home.catalog.product.list" category_id="2" template="catalog/product/list.phtml"}}

the above code is in my homepage .


texts: Magento2 calling assets in folder pub/static/versionXXXXXXX after static content deploy

texts:
I'm running the command php bin/magento setup:static-content:deploy which exports all the assets in pub/static (creates folders: _requirejs, adminhtml and frontend), changes the deployed version in deployed_version.txt, and finishes with 0 errors.

The problem is that my frontend is calling assets like:

$BASE_URL/pub/static/**version$DEPLOYED_VERSION**/frontend/... (e.g. http://local.estores.com/pub/static/version1503583668/frontend/Magento/luma/en_US/mage/calendar.css)

instead of:

$BASE_URL/pub/static/frontend/... (without the version folder).

Not sure why it's doing this, or how to change it. I upgraded and recompiled. The deploy process is creating the files, so I guess it's not a permissions thing.


texts:
I need to add the search param in the title of the block.
Currently i have on catalogsearch_result_index.xml

<referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Searched For: </argument>
            </action>
</referenceBlock>

The above displays

  Searched For:

However, I need to display

  Searched For: test

as the title of the catalog search


texts: How to send custom email with email template from root Magento2.3?

texts:
I have created a script on the Root directory to disabled the products which having price below $50 which is working fine.
Now I want to send the disabled product information like ID, SKU, Product Name....etc to the admin using an email template.
How can I do this?


texts: How to get a product review form form key in magento 1.9?

texts: I want form key of product review form in magento 1.9 , Can anyone tell me how to get product wise formkey programatically.


texts:
Can anyone assist with these errors showing in our system.log?

2017-09-25T19:14:27+00:00 ERR (3): Notice: Array to string conversion  in /var/www/html/app/code/core/Mage/Page/Block/Html/Head.php on line 133

2017-09-25T19:14:27+00:00 ERR (3): Warning: Illegal offset type  in /var/www/html/app/code/core/Mage/Page/Block/Html/Head.php on line 177

2017-09-25T19:22:22+00:00 ERR (3): Notice: Array to string conversion  in /var/www/html/app/code/core/Mage/Page/Block/Html/Head.php on line 133

2017-09-25T19:22:22+00:00 ERR (3): Warning: Illegal offset type  in /var/www/html/app/code/core/Mage/Page/Block/Html/Head.php on line 177


texts: Should I temporarily turn Indexing and Bots off?

texts:
My Magento store has been live on my server for around 10 days. The website isn't quite ready and will take another week before all of the pages, categories and products are what I want.

After looking in my settings I realise that default robots have been set to “INDEX, FOLLOW”. Should I change this to "NOINDEX, NOFOLLOW" until everything is ready? I imagine search engines may have already started indexing some pages.

Thanks for any help you can give me, I'm still getting to grips with this.


texts: Magento 2.3.5 - Limit max search results

texts:
Is there a way to set a max number of search results, so it only shows max 500 producs?
At the moment the search results can contain every single product, so the entire catalog, which is unnecessary a heavy load.


texts: How to remove Option Value from XML during call API in Magento 2?

texts: How to remove the highlighted section from our order XML file during call API in Magento 2?


texts: create product image attribute in magento2

texts:
I am trying to create product attribute of image type.
  I am already created one custom attribute group and some other attribute in it but image type attribute doesn't look good.

InstallData.php

$eavSetup->addAttribute(
            \Magento\Catalog\Model\Product::ENTITY,
            'my_attribute_image',
            [
                'type' => 'varchar',
                'backend' => 'My\Test5\Model\Attribute\Product\Image',
                'frontend' => '',
                'label' => 'My Attribute Image7',
                'input' => 'image',
                'class' => '',
                'source' => '',
                'group' =>'My custom group',
                'visible' => true,
                'required' => false,
                'user_defined' => false,
                'default' => 0,
                'searchable' => false,
                'filterable' => false,
                'comparable' => false,
                'visible_on_front' => true,
                'used_in_product_listing' => true,
                'unique' => false,
                'apply_to' => ''
            ]
        );

My\Test5\Model\Attribute\Product\Image.php

class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
{

    protected $_uploaderFactory;
    protected $_filesystem;
    protected $_fileUploaderFactory;
    protected $_logger;

    public function __construct(
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Filesystem $filesystem,
        \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory
    ) {
        $this->_filesystem = $filesystem;
        $this->_fileUploaderFactory = $fileUploaderFactory;
        $this->_logger = $logger;
    }

    public function afterSave($object)
    {
        $value = $object->getData($this->getAttribute()->getName() . '_additional_data');

        if (empty($value) && empty($_FILES)) {
            return $this;
        }

        if (is_array($value) && !empty($value['delete'])) {
            $object->setData($this->getAttribute()->getName(), '');
            $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
            return $this;
        }

        $path = $this->_filesystem->getDirectoryRead(
            DirectoryList::MEDIA
        )->getAbsolutePath(
            'catalog/product/'
        );

        try {

            $uploader = $this->_fileUploaderFactory->create(['fileId' => $this->getAttribute()->getName()]);
            $uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png']);
            $uploader->setAllowRenameFiles(true);
            $result = $uploader->save($path);

            $object->setData($this->getAttribute()->getName(), $result['file']);
            $this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName());
        } catch (\Exception $e) {
            if ($e->getCode() != \Magento\MediaStorage\Model\File\Uploader::TMP_NAME_EMPTY) {
                $this->_logger->critical($e);
            }
        }
        return $this;
    }
}

It's save image perfectly at front at

Magento_Root/pub/catalog/product

But cann't display/delete at admin in product tab.because It's find image at
{base_url}/catalog/product/my_image.jpg

So it's look like miss "pub" in url. Anyone wants to suggest another way or correction in my code.
Any kind of help will be appreciated.
Thank you.


texts: Customer EAV Attribute not Showing in Admin

texts:
Before upgrading to Magento 2.2.1, I was using version 2.1.10 and made a custom uuid attribute for customers. The attribute was added to the customer form in the admin panel and saved correctly. However after upgrading to 2.2.1, the attribute no longer shows in the form. It is still present in the eav_attributes db table so I'm not sure what has changed.

This is my code used to initial setup the attribute:

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

public function install(ModuleDataSetupInterface $setup,
                        ModuleContextInterface $context)
{
    /** @var CustomerSetup $customerSetup */
    $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
    $setup->startSetup();
    $attributesInfo = [
        'uuid' => [
            'label' => 'UUID',
            'type' => 'varchar',
            'input' => 'text',
            'position' => 1000,
            'visible' => true,
            'required' => false,
            'system' => 0,
            'user_defined' => true,
            'unique' => true,
        ]
    ];
    $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
    $attributeSetId = $customerEntity->getDefaultAttributeSetId();
    /** @var $attributeSet AttributeSet */
    $attributeSet = $this->attributeSetFactory->create();
    $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
    foreach ($attributesInfo as $attributeCode => $attributeParams) {
        $customerSetup->addAttribute(Customer::ENTITY, $attributeCode, $attributeParams);
    }
    $magentoUuidAttribute = $customerSetup->getEavConfig()
        ->getAttribute(Customer::ENTITY, 'uuid');
    $magentoUuidAttribute->addData([
        'attribute_set_id' => $attributeSetId,
        'attribute_group_id' => $attributeGroupId,
        'used_in_forms' => ['adminhtml_customer'],
    ]);
    $magentoUuidAttribute->save();
    $setup->endSetup();
}

}

Any help would be greatly appreciated.


texts: Disable Recent Orders Only Customer Account Dashboard

texts:
who disable recent orders only customer account dashboard.

And I want to avoid using other modules sidebar. I just want the customer menu are displayed.

thank you


texts:
I try to get from collection, City ID and City Name, to put in module Meanbee/Shippingrules as new condition
All it's good but on multtiple select filed I get city iD-s, I supose to get name as Label and Id as Option.

class Meanbee_Shippingrules_Model_Rule_Condition_Source_City {
public function getCitiesAsOptions()    {
    $cityCollection = Mage::getModel('romcity/romcity')->getCollection();
    $cityCollection->addFieldToSelect('cityname', $cityname);
    $cityCollectionMetods = array();
    // LOg
    Mage::log($cityCollection->printLogQuery(true));

    foreach ($cityCollection as $cityName => $cityName) {
        $cityCollectionMetods[] = array(
            'label' => $cityName,
            'value' => $CityId
        );
    }

    return $cityCollectionMetods;
}

}

Where I am wrong ?


texts: Magento2 : How to Connect Local Database with Magento Site to Update Details

texts:
I wanted to update Price Details of products in Magento Site.

My Products details are maintained in Oracle Database - Local System.

Magento is hosted in remote server.

How can i connect my Magento with my Local Oracle Database.

Please suggest me ideas. How can i do it.

Edit:

Can I create a web service for magento2 (a module) which will take SKU , price, Quantity and update the inventry.

Please let me Know how can i find the magento REST Service.


texts: Magento 2.2 - Fatal error: Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection::load()

texts:
Fatal error: Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection::load() in
  /var/www/html/magento2_dev/vendor/magento/framework/Model/AbstractModel.php:536

Just adding the resource connection on my extended Sales Model, getting the above issue.

Below is my code:

<?php
namespace Sdi\Sales\Model;
use Magento\Framework\App\Request\DataPersistorInterface;
class Order extends \Magento\Sales\Model\Order
{
   protected $_resource;
   public function __construct(
        \Magento\Framework\App\ResourceConnection $resource
) {
    $this->_resource = $resource;
}
public function bnDelete()
{
    if ($this->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED) {
        $connection = $this->_resource->getConnection(\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION);
        $query = 'SQL QUERY';
        $connection->query($query);
    }
    return false;
}
}


texts:
I have magento in subfolder and running very well like below url:-

www.site.com/myshop/

but for SEO purpose I want to run my magento site without myshop folder.
I want to run my site like www.site.com/category.html instead of www.site.com/myshop/category.html

How can I do this using htaccess. please help me and thanks in advance.


texts:
At the moment, I have a controller that returns the url for one product, based on a pre-defined custom attribute. I'm able to get the product I want, but the url that I get from the object, takes me to a 404. I've tried many different methods based on other similar questions, without success:

$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('upc');
$storeId = Mage::app()->getStore()->getStoreId();
$collection->addFieldToFilter(array(
    array('attribute'=>'upc','eq'=> $barcode),
));
$url = null;
foreach ($collection as $product) {
    $url = $product->getProductUrl();
    break;
}
Mage::log($url);

On the code above, I'm able to find my product without problems. Calling getProductUrl also returns a URL. If I browse to the URL though, I get a 404 Magento page.
I've also tried adding something like this, before looping through the collection:

$collection->addUrlRewrite($categoryId);

If I try to get the URL by using the id, like below, I get a different URL, but invalid as well:

$url = Mage::getModel('catalog/product')->setStoreId($storeId)->load($id)->getProductUrl();

None of the urls that I get, exist in the URL rewrite list in the Admin Panel. As a side note, I've flushed my cache and reindexed everything prior to each method above. Would appreciate if anyone could enlighten me as to what's going on!


texts: Can we rewrite multiple blocks of same core extension?

texts:
Can we rewrite multiple blocks of a core extension like catalog ? like this :

<blocks>
    <catalog>
        <rewrite>
            <class_name_here>YourNamespace_YourModule_Block_Your_New_Class_Here</class_name_here>
            <2nd_class_name_here>YourNamespace_YourModule_Block_Your_2nd_Class_Here</2nd_class_name_here>
        </rewrite>
    </catalog>
</blocks>


texts: Magento2 : How To Access Custom Parameter's of Admin Url in admin login page

texts:
this is my admin url : http://127.0.0.1/m2-test/index.php/admin?username=test

and i want to access username value in admin login.phtml

i have tried with $_GET["username"] but it will return nothing

Does  anyone have idea about this issue ?.


texts: Magento 2.1 How do I create form component field custom depends on another field value?

texts:
I have one field select which has some options. One of them will have some fields depend on value, another field will hidden. I have copied and extended component js for my field but it didn't work or I did it wrong way. Ui component supports this feature? How I can achieve this?

Below is what I have done:

<field name="field1">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">Namespace\ModuleName\Model\Config\Source\Options</item>
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Field name</item>
            <item name="visible" xsi:type="boolean">true</item>
            <item name="dataType" xsi:type="string">number</item>
            <item name="formElement" xsi:type="string">select</item>
            <item name="source" xsi:type="string">item</item>
            <item name="dataScope" xsi:type="string">field1</item>
            <item name="component" xsi:type="string">Pathto/js/form/element/options</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

<field name="field2Depend1"></field>
<field name="field3Depend1"></field>

jsComponent js/form/element/options:

define([
    'underscore',
    'uiRegistry',
    'Magento_Ui/js/form/element/select',
    'Magento_Ui/js/modal/modal'
], function (_, uiRegistry, select) {
    'use strict';

    return select.extend({

        onChange: function () {
            this.enableDisableFields();
        },

        /**
         * Enable/disable fields on Coupons tab
         */
        enableDisableFields: function () {
            // code check field
        }
    });
});


texts: Get Product Collecton by category with filters in magento 2

texts:
I need to filter category product collection with Instock items and only simple products.

I have used below code to implement it.But the out of stock products also fetching with the collection.

class CategoryData extends \Magento\Framework\View\Element\Template
{
 protected $categoryFactory;
  public function __construct(
     \Magento\Backend\Block\Template\Context $context,
     \Magento\Catalog\Model\CategoryFactory $categoryFactory,
     ){
       $this->categoryFactory = $categoryFactory;
       parent::__construct($context);
     }
  public function getSimilarCollection($productId)
   {
        $categoryId = 10;
        $category = $this->categoryFactory->create()->load($categoryId);
        $categoryProducts = $category->getProductCollection()
                                 ->addAttributeToSelect('*')
                                 ->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
                                 ->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
                                 ->setPageSize(6);
         return $categoryProducts;
    }
}

Can anyone suggest me how to filter the above collection with instock items. Thanks


texts: M2 - Difference between ScopeInterface SCOPE_STORE and SCOPE_STORES

texts:
I understand that there are websites, stores within websites, and store views within a store. However, one thing I've never understood is the difference between ScopeInterface::SCOPE_STORE and ScopeInterface::SCOPE_STORES

What is the difference? And when would you use them for reading/writing config values?


texts:
I have this warning every second in the system.log file of magento.
I made a copy of the prod in dev site, but no such error in the log file.
Does someone have a solution?

11271 2015-02-13T21:42:22+00:00 ERR (3): Warning: include(): Failed opening
'Mage/Enterprise/Enterprise/Model/Observer.php' for inclusion (include_path='/www/xxxxxx.com/files/html/app/code/local:/www/xxxxxx.com/files/html/app/code/community:/www/xxxxxx.com/files/html/app/code/core:/www/xxxxxx.com/files/html/lib:.:/usr/share/php:/usr/share/pear') in /www/xxxxxx.com/files/html/lib/Varien/Autoload.php on line 94
    11272 2015-02-13T21:42:22+00:00 ERR (3): Warning: include(Mage/Enterprise/Enterprise/Model/Observer.php): failed to open stream: No such file or directory in /www/xxxxxx.com/files/html/lib/Varien/Autoload.php on line 94
    11273 2015-02-13T21:42:22+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Enterprise/Enterprise/Model/Observer.php' for inclusion (include_path='/www/xxxxxx.com/files/html/app/code/local:/www/xxxxxx.com/files/html/app/code/community:/www/xxxxxx.com/files/html/app/code/core:/www/xxxxxx.com/files/html/lib:.:/usr/share/php:/usr/share/pear') in /www/xxxxxx.com/files/html/lib/Varien/Autoload.php on line 94
    11274 2015-02-13T21:42:22+00:00 ERR (3): Warning: include(Mage/Enterprise/Enterprise/Model/Observer.php): failed to open stream: No such file or directory in /www/xxxxxx.com/files/html/lib/Varien/Autoload.php on line 94

These are some observer.php files in local

app/code/local/GoMage/Navigation/Model/Observer.php
app/code/local/GoMage/Navigation/Model/Enterprise/Search/Observer.php
app/code/local/LC/CustomShipping/Model/Observer.php
app/code/local/LC/CustomShipping/Model/Sales/Quote/Observer.php
app/code/local/MageWorx/CustomOptions/Model/Observer.php
app/code/local/MageWorx/OrdersPro/Model/Observer.php
app/code/local/MageWorx/OrdersPro/Model/AwOrdertags/Observer.php
app/code/local/Magestore/Magenotification/Model/Observer.php
app/code/local/Magestore/Socialrecommend/Model/Observer.php


texts: Magento 2 Admin Panel hangs forever until page refresh

texts:
Ever since working with Magento 2, I repeatedly have this annoying issue:

I log in to the admin panel or switch to a different page within the admin panel
The page starts loading, sometimes shows up partially but then hangs forever (at least for several minutes), sometimes it shows up completely but the browser still indicates "loading" and the navigation does not work, but I don't see failed or running requests in the browser console.
If I press F5 while it's hanging, the page loads almost instantly (at least most of the time)

It doesn't seem to be related to any events, because I get this behavior even without having done any changes in the admin panel, nor in the code, just navigating. However, I observed a possible correlation with invalidated caches.

Any idea what could cause this issue? I don't believe that it's the typical problems with permissions or cookies because generally speaking the admin panel works.

Magento is running in developer mode on Linux.


texts:
PHP7.1

Magento 2.2.0 upgraded to 2.2.1

After my vendor , pub/static/* and theme loss many file and no css

How can I do?

Please help thank you!


texts: When we migrate the Magento1.x to Magento2.x what are the tables we can migrate using migration tool? And what are the tables need to migrate from the current version? can anyone help me?


texts: Add to cart button added the same product issue

texts:
I have created a custom phtml for my homepage. Here i check for all products in a specific category.

All the products and the information looks fine, but i have a problem with adding the product to cart.
If a add the first product on the line everything works fine, but if a tried to add the second product, or third product and so on, magento  added to cart  to cart only the first product.
So for example:

Clik on the second product "Add to cart button", first product addded instead of the second one and so on.

My form looks like this:

<form action="<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
                    <?php $buttonTitle = $this->__('Add to Cart'); ?>

                            <?php if(!$_product->isGrouped()): ?>
                            <?php echo $this->__('Qty:') ?>
                            <input type="text" name="qty" id="qty" maxlength="12" placeholder="<?php echo $this->__('Amount'); ?>" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" />
                            <?php endif; ?>
                            <button type="button" title="<?php echo $buttonTitle ?>" id="product-addtocart-button" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><?php echo $buttonTitle ?></button>
                            <?php echo $this->getChildHtml('', true, true) ?>

                    </form>

and my JS:

I think the problem is here:  <form action="<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>".

For some reason on the action, $_product it's the same all the time.

Does anyone know why i have this problem?


texts: i want to set canonical href as full/path/with/category/product-url? in magento 2

texts:
I want to set canonical href as full/path/with/category/product-url?

  right now it will use only demain.com/product.html


texts:
I'm trying to sort the products in search result by "Position". Obviously this works in product listing but i found out that it is commented in Block Result.php:

/**
 * Set search available list orders
 *
 * @return Mage_CatalogSearch_Block_Result
 */
public function setListOrders()
{
    $category = Mage::getSingleton('catalog/layer')
        ->getCurrentCategory();
    /* @var $category Mage_Catalog_Model_Category */
    $availableOrders = $category->getAvailableSortByOptions();
    unset($availableOrders['position']);
    $availableOrders = array_merge(array(
        'relevance' => $this->__('Relevance')
    ), $availableOrders);

    $this->getListBlock()
        ->setAvailableOrders($availableOrders)
        ->setDefaultDirection('desc')
        ->setSortBy('relevance');

    return $this;
}

I removed the unset($availableOrders['position']); but Magento throws an SQL error.

Does anyone know how can I achieve this?

Thanks a lot!


texts: Magento 2.3.1 Store redirect based on GEO IP not working with Cache warmer

texts:
I am using GEO IP extension to redirect user to specific store. It's working correctly without cache warmer. When i installed cache warmer Store redirect is working correctly but getting incorrect currency.
Please suggest a combination of both third party extension if anybody is using and working correctly.


texts: I want to feature a grouped product, but it shows a price of $0.00.  Can I show minimum price? Or better yet, can I show "starting at $xx.xx?"


texts:
I have followed the steps at: https://devdocs.magento.com/guides/v2.4/security/two-factor-authentication.html to get a token in order to use Postman to fetch Magento 2 REST endpoints e.g. products, sales etc. But these steps don't give me the expected results.
I have a web api user and a web api customer token configured in the staging environment, but still can't get past 2fa.
Any idea what steps are required to use Magento 2 REST API when 2FA is enabled?


texts: Magento 2.3.4 Paypal Plus Blank Page and error 500

texts:
I would have the problem with Paypal Plus Module for Magento 2.3.4 from i-ways

https://github.com/i-ways/magento2-paypal-plus

I have a fresh Shop installed on Magento 2.3.4 with Codazone Fastest Template and Fire Checkout. In my shop is only one Product for testing.
I have installed this module from GitHub for Paypal Plus with composer without any problem or error. In Back End also everything looks good, I set all the parameters for the module (Paypal API and so on).
On the Fron End side, this module is active and user can place an order and is redirected to Paypal log in after login confirms the order on Paypal and is redirected to the Shop. But when is redirected to Shop get a blank page with no errors and the money is debited from his Paypal account. In Magento Back End no new order has been received.
On Server logs he shows me the following errors:

GET /paypalplus/order/create/?paymentId=PAYID-L4G2SOQ0UU552582T601305K&token=EC-88394458G6941023B&PayerID=7892GT7GLC5EC HTTP/1.0 (with ERROR 500)

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Sales\Api\Data\OrderPaymentExtensionInterface in /var/www/vhosts/website_exaple_link/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121\nStack trace:\n#0 /var/www/vhosts/website_exaple_link/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Sales\\A...', Array)\n#1 /var/www/vhosts/website_exaple_link/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Sales\\A...')\n#2 /var/www/vhosts/website_exaple_link/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get('Magento\\Sales\\A...')\n#3 /var/www/vhosts/website_exaple_link/vendor/magento/framework/O...', referer: https://www.sandbox.paypal.com/webapps/hermes?flow=1-P&ulReturn=true&country=DE&useraction=commit&token=EC-88394458G6941023B&country.x=DE&locale.x=de_DE&nxlr=true

Has anyone else faced this problem and could help us? What do these errors really mean? and how we could make it work?
Thank you in advance.


texts: Get the average rating of the current category

texts:
I'm new to magento and i'm currently working on the CE1.9 for work.
I'm having trouble to get the average rating of the current category.

$category_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
$category = Mage::getModel('catalog/category')->load($category_id);
$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addCategoryFilter($category)->load();

$reviews = array();

foreach ($products as $product) {
    $productId = $product->getId();
    array_push($reviews, Mage::getModel('review/review')
            ->getResourceCollection()
            ->addStoreFilter(Mage::app()->getStore()->getId())
            ->addEntityFilter('product', $productId)
            ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
            ->setDateOrder()
            ->addRateVotes()
    );
}

foreach ($reviews as $review) {
    $_votes = $review->getRatingVotes()->getFirstItem();
    if($_votes->
    $totalRating += $_votes->getFirstItem()->getValue();
}
Zend_debug::dump(100 * $totalRating / (5 * $reviews));


texts: How to move gallery html into theme to update html?

texts:
I am trying to make changes to the following file but unsure how I can copy it over the to theme? As I do not want to edit the core gallery file?

  lib/web/mage/gallery/gallery.html

I've moved this to:

  app/design/frontend/theme/theme/web/mage/gallery/gallery.html

But still seems to be using the lib/web/mage/gallery/gallery.html file?

How can I get edit this file from within my theme?


texts: Magento 2 Attempt to load value of nonexistent EAV attribute with CategoryInterface

texts:
I am getting error as following in my System.log file.

Attempt to load value of nonexistent EAV attribute '42'
                        for entity type 'Magento\Catalog\Api\Data\CategoryInterface'

I have checked this Magento 2 Attempt to load value of nonexistent EAV attribute. It is product related. but my is Category related.

How to solve this error?


texts: Magento 2 SQLSTATE[42S22]: while create product?

texts:
I'm using magento v2.1.7 with two website, two store. While creating product get error

  SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'e_attr.store_id' in 'field list', query was: SELECT
  e_attr.store_id FROM catalog_product_entity AS e INNER JOIN
  catalog_product_entity AS e_attr ON e.entity_id = e_attr.entity_id
  WHERE (e_attr.attribute_id = '') AND (e.entity_id = '127').

I'm try redindex, plush cache. but it not success

Add more info
I checked in exception.log get message

  main.CRITICAL: PDOException: SQLSTATE[42S22]: Column not found: 1054
  Unknown column 'e_attr.store_id' in 'field list' in
  /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228


texts: call phtml file in page builder in magento 2.3 enterprise

texts: I want to call phtml file in static block that uses page builder in Magento 2 EE.


texts: User is getting logged out when they tried to change the password from my accounts section

texts: I'm facing a peculiar issue with Magento2.3.4-p2 (upgraded from 2.2.6). When the user changes the password from my accounts section, the user is getting logged out.I verified till the redirect to /customer/account in EditPost.php, $this->session->isLoggedIn is true.


texts: Update Tier Price Using "Mage::getSingleton('catalog/product_action')"

texts:
Hello I tried to update tier_price of products using Mage::getSingleton('catalog/product_action') but it not works.

My code is as below:

    $model = Mage::getSingleton('catalog/product_action')->getResource();
    $attrData = array();
    $attr = "tier_price";
    $tierPrices = array(
                        array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
                  );

    $attrData[$attr] = $tierPrices;
    $model->updateAttributes(product_id, $attrData, $store_id);


texts: Observer's getCollection() not being rewritten

texts:
Is this standard behavior, or am I doing something wrong?

// in event 'catalog_product_collection_load_before'
get_class($observer->getCollection());
 > Mage_Catalog_Model_Resource_Product_Collection
get_class(Mage::getModel('catalog/resource_product_collection'));
 > MyStuff_Catalog_Model_Resource_Product_Collection

I'm trying to avoid rewriting the block that outputs this code, since one of our plugins already does so (bleh), so that's why I'm using the event.


texts: how to get value from checkout form to payment gateway's integration part?

texts:
this is the continuation of my question from stackoverflow. i hope somebody can help me.

all i need is to pass a value of radio button from checkout form page to payment integration section.
my aim is to achieve partial payment if my order total is above 25000 Rs.

what i im trying to achieve is :-> does user wish to proceed with partial payment?

i don't want this value to be stored in database. i can neglect this data as soon as i forward the amount to payment gateway.
pls help me. im just a beginner.Thanks in advance..


texts: Magento add label + show out of stock products in configurable product dropdown

texts:
there are some related messages but not precisely this.

Is there an easy method to
- show both instock/outofstock products (for a configurable product)
- add a label "in stock", "out of stock"

So a drop down with

S
M
L

becomes

S        In stock
M        Sold out
L        In stock

Where one would like to play a little with the label color/css ....

Help appreciated


texts: What should I choose Session Save - 'Files' or 'DB' while magento install?

texts:
I have to choose Session Save - 'Files' or 'DB' while installing Magento2

What is different, advantage, disadvantage?

What should I choose?


texts: What is preventing an install-script to run in Magento 1.8?

texts:
I am trying to create a simple module in order to add customer comments at checkout, I know there are a few freebies on the market that already do this but I need to further extend the functionality so decided to go about it from scratch.

The problem is I cannot even get my install script to run and create the necessary tables. I've been revising the code for hours but cannot get it to work!!!

Any help would be much welcomed...

config.xml

    <?xml version="1.0"?>
<config>
    <modules>
        <Namespace_CheckoutComments>
            <version>0.1.0</version>
        </Namespace_CheckoutComments>
    </modules>
    <global>
        <resources>
            <checkoutcomments_setup>
                <setup>
                    <module>Namespace_CheckoutComments</module>
                </setup>
            </checkoutcomments_setup>
        </resources>

        <models>
            <checkoutcomments>
                <class>Namespace_CheckoutComments_Model</class>
                <resourceModel>checkoutcomments_resource</resourceModel>
            </checkoutcomments>

            <checkoutcomments_resource>
                <class>Namespace_CheckoutComments_Model_Resource</class>
                <entities>
                    <comments_table>

checkout_comments

                    </comments_table>
                </entities>
            </checkoutcomments_resource>
        </models>

    </global>
</config>

sql/namespace_checkoutcomments_setup/install-0.1.0.php

<?php

/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;

$installer->startSetup();

$table = $installer->getConnection()->newTable($installer->getTable('checkoutcomments/comments_table'))
    ->addColumn('comment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'identity' => true,
        'unsigned' => true,
        'nullable' => false,
        'primary'  => true,
    ),  'Comment ID')

    ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'unsigned' => true,
        'nullable' => false,
    ),  'Real Order ID')

    ->addColumn('comment', Varien_Db_Ddl_Table::TYPE_INTEGER, '64k', array(
    ), 'Comment')

    ->addForeignKey(
        $installer->getFkName(
        'checkoutcomments/comments_table',
        'order_id',
        'sales/order',
        'entity_id'
    ),
        'order_id', $installer->getTable('sales/order'), 'entity_id',
        Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
        ->setComment('Checkout Comments');

$installer->getConnection()->createTable($table);
$installer->endSetup();

I have no idea what is wrong with either my install script or my config.xml. What would be the main reason for this not to execute and create the required tables?

+-------------------------+------------+--------------+
| code                    | version    | data_version |
+-------------------------+------------+--------------+
| adminnotification_setup | 1.6.0.0    | 1.6.0.0      |
| admin_setup             | 1.6.1.1    | 1.6.1.1      |
| api2_setup              | 1.0.0.0    | 1.0.0.0      |
| api_setup               | 1.6.0.1    | 1.6.0.1      |
| backup_setup            | 1.6.0.0    | 1.6.0.0      |
| bundle_setup            | 1.6.0.0.1  | 1.6.0.0.1    |
| captcha_setup           | 1.7.0.0.0  | 1.7.0.0.0    |
| catalogindex_setup      | 1.6.0.0    | 1.6.0.0      |
| cataloginventory_setup  | 1.6.0.0.2  | 1.6.0.0.2    |
| catalogrule_setup       | 1.6.0.3    | 1.6.0.3      |
| catalogsearch_setup     | 1.6.0.0    | 1.6.0.0      |
| catalog_setup           | 1.6.0.0.18 | 1.6.0.0.18   |
| checkoutcomments_setup  | 0.0.1      | 0.0.1        |
| checkout_setup          | 1.6.0.0    | 1.6.0.0      |


texts: Magento 2 - Add permission to add specific product (Simple Product OR ... )

texts:
On add product, there's a list of typical products, like a simple product, virtual product ... etc

But, I want to give a list of permission to the user, to add a specific products

for example:

User 1: can add (Simple Product & Virtual Product)

User 2: Can add all products type

User 3: Can add just a simple product

is there any method to do that ?


texts:
I am trying to move my local Magento site to my Live server. (MAMP to cPanel)

To do this I have exported the database, etc and all those steps are fine.

However when I copy my local Magento files from Application/MAMP/htdocs to my FTP client (cyberduck) and choose to overwrite the existing Magento files, to ensure that all my local updates will be moved to the live site, it takes hours to overwrite and then says it has failed!

Does anybody know if I am doing this step correctly, or is there a different way to get my Magento files from my Local site to my Live site.

Thanks in advance.


texts:
I've been going crazy with this for a few days now.  I'm having problems with my multi-store sales report.  I have 3 stores on one magento.  They are called English, French and Dealer. When I run a report (yes I use lifetime) for All Websites I only get the sales from Dealer.  It doesn't show the other stores.  When I ask for reports for Dealers, it works.  When I ask for reports for English or French, I get $0 but I have had sales in those areas.

This is a new site so it never worked and is on 1.9.2.0.  I have a feeling it's a setting somewhere.


texts: magento skip shipping but not remove from checkout page

texts:
i have magento store with free shipping , so it is of no use to show shipping step in checkout page.

But i want to manage shipping from admin like fedex tracking and all from admin so that user can track his / her order.

i check few links online they seems to disable and then remove shipping , can i get idea how to do this


texts: How to get configurable child product quantity from cart item

texts:
I'm working with magento2, I have created custom add to cart product functionality. Now I want update product quantity. I have fetched all cart items and I want update but I am getting incorrect quantities of configurable child product. I have fetched quantity  using $item->getQty() inside cart get all items  it is working fine with normal product. But I get incorrect cart item quantity for child configurable product.
Can we use any other way instead of $item->getQty()
I have also configurable child product I'ds.


texts: Filter is not working for a boolean datatype column in custom admin grid

texts:
A custom table columns are displayed in the filter as well as in a grid.

Other filters are working fine except Is Notified column.

is_notified is the boolean type field.

Here is the code from xml file:

...
<column name="is_notified" class="Vendor\Notify\Ui\Component\Listing\Columns\IsNotified">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="sorting" xsi:type="boolean">false</item>
                    <item name="label" xsi:type="string" translate="true">Is Notified</item>
                </item>
            </argument>
        </column>
...

In the is_notified column, I am storing boolean values 0, 1. While displaying in the grid. I have displayed Yes for 1 and No for 0.

Vendor\Notify\Ui\Component\Listing\Columns\IsNotified.php

namespace Vendor\Notify\Ui\Component\Listing\Columns;

use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use Magento\Framework\UrlInterface;

/**
 * Class ProductActions
 *
 * @api
 * @since 100.0.2
 */
class IsNotified extends Column
{
    /**
     * @var UrlInterface
     */
    protected $urlBuilder;

    /**
     * @param ContextInterface $context
     * @param UiComponentFactory $uiComponentFactory
     * @param UrlInterface $urlBuilder
     * @param array $components
     * @param array $data
     */
    public function __construct(
        ContextInterface $context,
        UiComponentFactory $uiComponentFactory,
        UrlInterface $urlBuilder,
        array $components = [],
        array $data = []
    ) {
        $this->urlBuilder = $urlBuilder;
        parent::__construct($context, $uiComponentFactory, $components, $data);
    }

    /**
     * Prepare Data Source
     *
     * @param array $dataSource
     * @return array
     */
    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items']))
        {

            // column name for which this class is specified
            $fieldName = $this->getData('name');

            foreach ($dataSource['data']['items'] as &$item)
            {
                if (isset($item[$fieldName]))
                {
                    if( $item[$fieldName] == 0 )
                    {
                        $item[$fieldName] = "No";
                    }

                    if( $item[$fieldName] == 1 )
                    {
                        $item[$fieldName] = "Yes";
                    }
                }
            }
        }

        return $dataSource;
    }
}

When I enter keywords Yes or No in the Is Notified filter field then it returns No Records.

Any help would be appreciated. Thank you.


texts: Add Meta for Facebook with Custom Product Page

texts:
I have this custom product page but the meta information is not correct.

<?php
$og = [];
$og['title'] = $this->getTitle();
$og['site_name'] = Mage::app()->getStore()->getName();
$og['description'] = strip_tags($this->getDescription());
$og['url'] = $this->helper('core/url')->getCurrentUrl();

if(Mage::registry('current_product')):
    $product = Mage::registry('current_product');
    $og['title'] = $product->getName();
    $og['type'] = 'product';
    $og['image'] = $this->helper('catalog/image')->init($product, 'small_image')->resize(100,100);
    $og['description'] = strip_tags(($product->getShortDescription()));
    $og['price:amount'] = Mage::registry('product')->getFinalPrice();
    $og['price:currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
elseif(Mage::registry('current_category')):
    $og['type'] = 'product.group';
elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
    Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) :
    $og['type'] = 'website';
else:
    $og['type'] = 'article';
endif;
?>

I use that code to Integrate the meta for check different kind of page in the Site. The code consider the Product as an Article Type.
According to the Facebook Share Debugger, it still a missing IMG.

And the page is considered to be an Article Type not a Product Type.


texts: Megamenu issue - Clicking menu opens category page for that menu in mobile in Magento2

texts:
I need to resolve issue of responsive megamenu for mobile.

The issue is when I click on the subcategory to opens its child sub-categories the link gets clicked and gets redirected because of which seeing expanded menu gets difficult.

However I tried to locate the code due to which this happens.
Below is the code which is present in menu.js file:

_toggleMobileMode: function () {
            $(this.element).off('mouseenter mouseleave');
            this._on({
                "click .ui-menu-item:has(a)": function (event) {
                    event.preventDefault();

                    var target = $(event.target).closest(".ui-menu-item");

                    if (!target.hasClass('level-top') || !target.has(".ui-menu").length) {
                        window.location.href = target.find('> a').attr('href');
                    }
                },
                "click .ui-menu-item:has(.ui-state-active)": function (event) {
                    this.collapseAll(event, true);
                }
            });

            var subMenus = this.element.find('.level-top');
            $.each(subMenus, $.proxy(function (index, item) {
                var category = $(item).find('> a span').not('.ui-menu-icon').text(),
                    categoryUrl = $(item).find('> a').attr('href'),
                    menu = $(item).find('> .ui-menu');

                this.categoryLink = $('<a>')
                    .attr('href', categoryUrl)
                    .text($.mage.__('All ') + category);

                this.categoryParent = $('<li>')
                    .addClass('ui-menu-item all-category')
                    .html(this.categoryLink);

                if (menu.find('.all-category').length === 0) {
                    menu.prepend(this.categoryParent);
                }

            }, this));
        }

What I need is that when we click on pseudo element(which shows expansion and contraction) of the sub-category, its child sub-categories should be shown and clicking on sub-category anyways redirects to that particular sub-category
page.

Can someone please help me.


texts: I tried to get customer id from default.phtml in /vendor/magento/module-catalog/view/frontend/templates/product/view/type, but when I use $_SESSION['customer_base'], the customer_id is NULL like in the picture below. How can I get the current logged in customer id ?


texts: Load M2EPro amazon data about gift wrap via magento sales/order model

texts:
I can load sales order via magento model like this:

$order = Mage::getModel('sales/order')->loadByIncrementId('200000025');

How do I get to the amazon values via the model?:
Ref: http://support.m2epro.com/forums/138395-m2e-pro-amazon-magento-integration/suggestions/4965271-add-amazon-gift-wrapping-option-to-the-created-m

gift_price
gift_message
gift_type

These were found in the m2epro_amazon_order_item table.

I don't see these fields when I dump the order / each line data (using $model->getData()). How do I read the values from that table, for the current sales order object I am working with?


texts: How to obtain the selected custom option value from options.phtm

texts:
I'm trying to get the dropdown selected custom option value before the client adds the product to the checkout from

  /default/template/catalog/product/view/options.phtml

I have access to $_options object and I'm able to iterate over it and read all it's values

foreach ($_options as $key => $value) {
                            $optionData = $value->getProduct()->getOptionById($key);
                            if($optionData['type'] == 'drop_down') {
                            foreach ($optionData->getValues() as $v) {
                                Mage::log($v['option_type_id'],null,'customily.log');
                            }
                         }
                        }

But I need to obtain the selected one. How could I do it?


texts: How to get tax settings from order object?

texts:
In Magento 2 how we can check from order object that what is the settings for the tax either its including or excluding.
We can get the tax info generally by this function

$this->scopeConfig->getValue('tax/calculation/price_includes_tax',
                $storeScope);

but this function return the current setting for the tax, is there any method to check the setting from the order object ? So we can get the tax settings while the order created.

What if we save the settings while order creation ?


texts:
I have Magento 1.6.0.0 and I use Paypal Express Checkout. The issue is that Invoice emails are not automatically sent. It says at the invoice details page:

  the invoice email is not sent

Can someone tell me whats the issue here?

The Order confirmation emails are sent successfully and I think Paypal data is also getting captured via IPN (or by PDT) as I am getting "Payment Information" filled with data coming from paypal.

Let me know how to get this solved.

Thanks a lot.


texts: Magento 2 UI form set default value from url params?

texts:
I want to set a form field value from the URL params in UI form. I am aware that static values can be set via default property of the field but how to set dynamic values as default (to be specific request URL params).

Also, what is the standard way to do it?

`http://localhost/magento/2.2.4/admin/mymodule/myform/edit/type/vendor/`

Here, type/vendor the value vendor needs to be set on type field as default.

<field name="type">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">MyModule\MyVendor\Model\Source\Type</item>
            <item name="config" xsi:type="array">
                <item name="visible" xsi:type="boolean">true</item>
                <item name="dataType" xsi:type="string">select</item>
                <item name="formElement" xsi:type="string">select</item>
                <item name="source" xsi:type="string">mymodule_myform_form_data_source</item>
                <item name="label" xsi:type="string" translate="true">Type</item>
                <item name="disabled" xsi:type="boolean">true</item>
                <item name="default" xsi:type="string">inventory</item>
            </item>
        </argument>
    </field>

  MyModule\MyVendor\Model\Source\Type.php

<?php

namespace MyModule\MyVendor\Model\Source;

use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;

class Type extends AbstractSource
{
    /**
     * @return array
     */
    public function getAllOptions()
    {
        return [
            [
                'value' => 'vendor',
                'label' => __('Vendor'),
            ],
        ];
    }
}


texts:
Is there a way to trigger a DB schema update?

I've just copied the live DB which is 1.8 to a development host which has 1.9.3.3 installed. The frontend is displaying correctly but I can't get into /admin as some of the metadata tables are missing columns.

For example I'm getting the following logged in var/report

  a:5:{i:0;s:698:"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sales_bestsellers_aggregated_yearly.product_type_id' in 'field list', query was: SELECT COUNT(*) FROM (SELECT MAX(DATE_FORMAT(period, '%Y-%m-%d')) AS period, SUM(qty_ordered) AS qty_ordered, sales_bestsellers_aggregated_yearly.product_id, MAX(product_name) AS product_name, MAX(product_price) AS product_price, sales_bestsellers_aggregated_yearly.product_type_id FROM sales_bestsellers_aggregated_yearly WHERE (EXISTS (SELECT 1 FROM catalog_product_entity AS existed_products WHERE (sales_bestsellers_aggregated_yearly.product_id = existed_products.entity_id))) AND (store_id IN(0)) GROUP BY product_id LIMIT 5) AS t";i:1;s:5064:"#0 /public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)


texts: How to check all elements of first array with single element of second array one by one using jquery

texts:
Like I have two arrays and I wan't to disable value from drop down which are greater then single element of array.

['5', '10', '15', '20', '25', '30'] // dropdown
['10', '15', '20'] // second array

Here I wan't to disable 25 and 30 from dropdown.


texts: Customer Sign Up - after form submition, just reloads the page and no customer created

texts: After filling all fields in Registration form on frontend (Customer Sign Up page) - the page just updates with empty fields and customer not being created. Its fresh install, default luma theme. And no errors in logs


texts: Magento 2 Send custom email with observer failed with error message

texts:
I'm trying to send a message by email after an order is placed with observer.

The following is the code in my Observer,

    <?php

namespace TestModule\OrderComment\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Mail\Template\TransportBuilder;

use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Translate\Inline\StateInterface;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

class SalesOrderPlaceAfterObserver implements ObserverInterface
{
    const SENDER_EMAIL='trans_email/ident_general/email';
    /**
     * Email Template
     */
    const EMAIL_TEMPLATE='orderupdate/email/email_template';

    public function __construct(StoreManagerInterface $smi,
                                TransportBuilder $tb,
                                StateInterface $si,
                                ScopeConfigInterface $scopeConfig
    )
    {
        $this->storeManager=$smi;
        $this->transportBuilder=$tb;
        $this->inlineTranslation=$si;
        $this->scopeConfig = $scopeConfig;
    }

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

        $cname = "customer name";
        $templateOptions = array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId());
        $templateVars = array(
            'store' => $this->storeManager->getStore(),
            'customer_name' => $cname,
            'message'   => 'test message'
        );
        $from = array('email' => "test@example.com", 'name' => 'AnyName');
        $this->inlineTranslation->suspend();
        $to = array('myemail@example.com');
        $transport = $this->transportBuilder->setTemplateIdentifier('myemail_email_template')
            ->setTemplateOptions($templateOptions)
            ->setTemplateVars($templateVars)
            ->setFrom($from)
            ->addTo($to)
            ->getTransport();
        $transport->sendMessage();
        $this->inlineTranslation->resume();
    }
}

But I'm getting this error when placing orders.

STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:3D0D0000, 17.43559:0000000094000000000000000200000000000000, 20.52176:140F0E85180010100A008883, 20.50032:140F0E858817101003000B37, 0.35180:B6000000, 255.23226:0A000137, 255.27962:0A000000, 255.27962:0E000000, 255.31418:C0000000, 16.55847:8E000000, 17.43559:0000000068010000000000000200000000000000, 20.52176:140F0E8518001010CF000000, 20.50032:140F0E8588171010D4000000, 0.35180:0A00DF82, 255.23226:D9000000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:E3000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0A005A85, 0.37692:02000100, 0.37948:02000100, 5.33852:00000000534D545000000100, 4.56248:DC040000, 7.40748:010000000000010B32343A48, 7.57132:00000000000000003A323931, 1.63016:32000000, 4.39640:DC040000, 8.45434:9D79BF8C8650E940A0E63AF29BA7E5514300E702, 5.10786:0000000031352E32302E313239342E3032343A4845"

I have tried this both on my local maching and on a live server which I know that php email function is working properly.

Did I missing anything?


texts:
I have recently set up a new magento store. Everything seems to be working apart from the most important thing, the add to cart button. It's odd because the smaller green add to cart buttons on the home page
www.creations-online.co.uk work fine. However the larger orange add to car button on the individual product pages says error when pressed?!

I have tried starting again by re installing magento but it hasn't made any difference...

I can see an error message when I inspect with Google chrome either:

Failed to load resource: the server responded with a status of 404 (Not Found) http://www.creations-online.co.uk/index.php/creations/ajax/index/add/uenc/a…lvbmVyLTUwMG1sLmh0bWw_X19fU0lEPVU,/product/3368/form_key/dxLgYvodbd0VPQzZ/

Or

POST

http://www.creations-online.co.uk/index.php/creations/ajax/index/add/uenc/a…lvbmVyLTUwMG1sLmh0bWw_X19fU0lEPVU,/product/3368/form_key/dxLgYvodbd0VPQzZ/ 404 (Not Found)

I can't figure this out!

Thanks for reading, any help would be greatly appreciated.

This is from the button that works:

POST

http://www.creations-online.co.uk/index.php/creations/checkout/cart/add/uenc/aHR0cDovL3d3dy5jcmVhdGlvbnMtb25saW5lLmNvLnVrLw,,/product/3368/form_key/dxLgYvodbd0VPQzZ/


texts: Fatal error : dispatch() on null magento 2

texts:
How to identify where and why this error is coming from mu custom module?

Call to a member function dispatch() on null in C:\xampp\htdocs\magento2x\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php on line 644


texts: I have a catalog with over 85k articles, when I do a search as a result I always find the usual 4 products. I have also installed the Amasty Search Pro extension and it is able to find all the products in the catalog but only in the popup window.


texts: Best Practice: How to add a column to a backend grid ?

texts:
Usually we need to add to the Order Grid some column, so let take this as example.

There are 3 ways to do that:

Rewrite the grid block in our custom module
Use an observer on the event core_block_abstract_prepare_layout_before
Use a Layout update

(let don't consider the alteration of the collection to make things more easy)

First method is the most powerful but It leads to conflict in the scenarios.
Second method is in IMHO resource consuming as we are adding an extra code step for every block we are going to render
Third step is a layout update so should be the most advisable ... but are we sure it will work always ?

Other consideration are welcome

References:
Method 1:
   - http://inchoo.net/ecommerce/magento/programming-magento/adding-customer-group-column-to-sales-grid-in-magento/
Method 2:
   - http://www.atwix.com/magento/add-column-to-customers-grid-alternative-way/
Method 3:
- http://www.atwix.com/magento/column-to-orders-grid/


texts:
I created a new field on customer_entity table.

 $setup->getConnection()->addColumn(
            $setup->getTable('customer_entity'),
            'profession',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'comment' => 'Profession',
                'nullable' => false,
                'default' => false,
            ]
        );

Now I need to update this field. I'm trying

    use Magento\Customer\Model\CustomerExtractor as CustomerExtractor;

    $customer = $this->customerExtractor->extract('customer_account_create', $this->_request);
    $customer->setCustomAttribute('profession','test');

but the field on table stay blank.
No error appears.


texts: Php / Magento 'requires' Fatal Error .... need help interpreting problem

texts:
I am trying to install a new theme (not getting a reply from support about this and trying to fix it myself). After SFTP'ing the theme folders to my root folder, I am getting the following error when trying to load up the browser/GUI installer in Chrome/Safari.

Warning: require(/srv/public_html/pub/pearl-theme-installation/../app/bootstrap.php): failed to open stream: No such file or directory in /srv/public_html/pub/pearl-theme-installation/index.php on line 6

Warning: require(/srv/public_html/pub/pearl-theme-installation/../app/bootstrap.php): failed to open stream: No such file or directory in /srv/public_html/pub/pearl-theme-installation/index.php on line 6

Fatal error: require(): Failed opening required '/srv/public_html/pub/pearl-theme-installation/../app/bootstrap.php' (include_path='.:/usr/local/lib/php') in /srv/public_html/pub/pearl-theme-installation/index.php on line 6

My limited knowledge and understanding tells me that the index.php file requires but cannot find the bootstrap.php file? Is this correct? And if so would it be likely that I have put the theme folders in the wrong place? I have tried to research how to read errors and interpret them, but I am a bit stuck. Thanks.


texts: Magento 2 Impossible To Trace Admin Grid Error: Fatal error: Method Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an exception

texts:
Because of the high reliance of XML files, I am having a very hard time figuring out the cause of this error when creating a custom admin grid:

  Fatal error: Method
  Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an
  exception in
  C:\wamp64\www\mage2\vendor\magento\module-ui\Component\Wrapper\UiComponent.php
  on line 0

I am trying to make an admin grid for the sales_shipment_item table.

So far I have:

Used xdebug and put it within the __toString() method of the Result class, it does not show what the real error is
I have var_dump-ed the variables within the __toString() method
I have developer mode turned on in Magento 2
I have checked the var/logs and it shows nothing helpful

I have successfully made other admin custom grids, but trying to figure out the actual error is like a needle in a haystack. Has anyone found a better way of debugging these? I have looked over all the grid xml, di.xml, and models and all looks ok.


texts: Magento 2 - extension hello world template .phtml not executing

texts:
Ok - I am about to tear my hair out.  The issue is that the template for my test extension is not executing - or does not appear to be executing.

The page displays - the title shows up on the page - but none of the content actually ends up on the page.  When I insert some debug code into my block file I see it at the top of the page.  When I insert some debug code into the .phtml file - I do not see anything.

Here is what I have so far (The pertinent bits so far that is):
I have debugged down to the block code is executing, and the .phtml code is NOT executing or does not seem to be updating the content page that is pushed out.

  Kevin\Extension\view\frontend\layout\kevin_extension_index.xml

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

    <title>Page Title 2</title>

    <referenceContainer name="content">
        <block class="Kevin\Extension\Block\Main" name="success" template="Kevin_Extension::success.phtml">
        </block>
    </referenceContainer>
 </page>

  Kevin\Extension\view\frontend\templates\success.phtml

test

<?php echo $this->getSuccessContent();?>

<?php echo "here too";?>

  Kevin\Extension\Block\Main.php

<?php
namespace Kevin\Extension\Block;

use Magento\Framework\View\Element\Template;

class Main extends Template
{
public function __construct(Template\Context $context, array $data = [])
{
    $this->_isScopePrivate = true;
    return parent::__construct($context, $data);
}
...

None of the content above shows up on the page.  However, the title "Page Title" DOES show up on the page - and if I change it in the .xml file - it does change on the site on the frontend.

SIGH - it's probably something very obvious - but I can't figure out what.

Here is a screen shot of the output.  As you can see the title is showing up.
The content that should be displaying from the .phtml file is not displaying.


texts: Include more than one media attribute in phtml

texts:
I want to add multiple media image attributes in my phtml template but if I use more than one then none of them show :(

I'm using the following:

$product = $block->getProduct();

$productImageAttr = $product->getCustomAttribute( 'custom_image_1' );
$productImage = $this->helper('Magento\Catalog\Helper\Image')
    ->init($product, 'custom_image_1')
    ->setImageFile($productImageAttr->getValue());

and then I can include it as follows:

<img src="<?php echo $productImage->getUrl(); ?>" alt="<?php echo $block->escapeHtml($product->getTitle()); ?>"  />

If I want to add another I would assume that I need to do this:

$productImageAttr2 = $product->getCustomAttribute( 'custom_image_2' );
$productImage2 = $this->helper('Magento\Catalog\Helper\Image')
    ->init($product, 'custom_image_2')
    ->setImageFile($productImageAttr2->getValue());

but when I do, neither images show.

Can anyone help please?


texts: One of my client need to select multiple values in magento layered navigation using checkboxes for product weight options . How can I do this by coding without using any extensions ? I'm using magento 1.9


texts: Magento 2 - How to Override Checkout LayoutProcessor

texts:
I wanted to customize a private method of

  \Block\Checkout\Layoutprocessor.php

private function getAddressAttributes()
{
    // My code here
}

To do that I have created a custom module and did with di.xml. Now issue is if I copy COMPLETE code of core "\Block\Checkout\Layoutprocessor.php" file into my module "\Block\Checkout\Layoutprocessor.php" it works fine, but if I remove all other methods and just leave desired method (where I have made changes) it doesn't work.

So I need help how I can customize layout processor individual method instead of copying complete file code and make my changes :

Here is my code :

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\Checkout\Block\Checkout\LayoutProcessor" type="Vendor\Module\Block\Checkout\LayoutProcessor" />
</config>

LayoutProcessor.php

<?php

namespace Vendor\Module\Block\Checkout;

use Magento\Framework\App\ObjectManager;
use Magento\Checkout\Block\Checkout\AttributeMerger;

class LayoutProcessor extends \Magento\Checkout\Block\Checkout\LayoutProcessor
{
/**
 * @var \Magento\Customer\Model\AttributeMetadataDataProvider
 */
private $attributeMetadataDataProvider;

/**
 * @var \Magento\Ui\Component\Form\AttributeMapper
 */
protected $attributeMapper;

/**
 * @var AttributeMerger
 */
protected $merger;

/**
 * @var \Magento\Customer\Model\Options
 */
private $options;

/**
 * @param \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider
 * @param \Magento\Ui\Component\Form\AttributeMapper $attributeMapper
 * @param AttributeMerger $merger
 */
public function __construct(
    \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider,
    \Magento\Ui\Component\Form\AttributeMapper $attributeMapper,
    AttributeMerger $merger
) {
    $this->attributeMetadataDataProvider = $attributeMetadataDataProvider;
    $this->attributeMapper = $attributeMapper;
    $this->merger = $merger;
}

/**
 * @deprecated
 * @return \Magento\Customer\Model\Options
 */
private function getOptions()
{
   // Core method code
}

/**
 * @return array
 */
private function getAddressAttributes()
{
   /* my custom code will go here */
}

/**
 * Convert elements(like prefix and suffix) from inputs to selects when necessary
 *
 * @param array $elements address attributes
 * @param array $attributesToConvert fields and their callbacks
 * @return array
 */
private function convertElementsToSelect($elements, $attributesToConvert)
{
    // Core method code
}

/**
 * Process js Layout of block
 *
 * @param array $jsLayout
 * @return array
 */
public function process($jsLayout)
{
    // Core method code
}

/**
 * Inject billing address component into every payment component
 *
 * @param array $configuration list of payment components
 * @param array $elements attributes that must be displayed in address form
 * @return array
 */
private function processPaymentConfiguration(array &$configuration, array $elements)
{
    // Core method code
}
}

Help will be highly appreciated.


texts: Invoices note generated automatically after Stripe update

texts:
Last week, we moved from the Cryozonic Stripe modules to the newest Stripe Payments module in response to the reported security vulnerabilities. One functionality change we've noticed is that invoices are no longer automatically generated when an order is completed online. I'm wondering if I'm overlooking any configuration settings that could relate to this, or if I'd need to introduce some custom code?
Any thoughts would be very helpful, thank you.


texts: Is it right to manually add an extension to the configuration file?

texts:
While learning to build Magento 2 extensions, I have come across several tutorials (blogs, books and videos) teaching me different things. When it comes to registering a new extension, some tutorials ask me to manually add my extension to the app/etc/config.php file, while others say it is out of place to manually edit the app/etc/config.php.

Is it right to manually add an extension to the configuration (app/etc/config.php) file?


texts: Block Arguments Override in a Child Theme

texts:
The website I support has multiple sites. We have created a custom with parent Luma called Company/base. All other site have a unique theme whose parent is Company/base.
In the base theme I have create a custom block in to replace the copyright. Note that the block passes arguments. The example has 1 argument but we will need to pass 4 to meet requirements.
/app/design/frontend/Company/base/Magento_Theme/layout/default.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        ...
        <referenceContainer name="footer">
            ...
            <block class="Magento\Framework\View\Element\Template" name="company.copyright" template="Magento_Theme::footer/companyCopyright.phtml" after="-">
                <arguments>
                    <argument name="change_country_flag" xsi:type="string">Change Country</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>

The arguments will need to be overridden in a child theme.
/app/design/frontend/Company/childtheme/Magento_Theme/layout/default.xml
I have a couple variations of the below but am still not seeing the arguments being overridden. The layout still shows the same arguments that appear in the base theme.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="footer">
            <referenceBlock name="company.copyright">
                <arguments>
                        <argument name="change_country_flag" xsi:type="string">Change Country Italy</argument>
                    </arguments>
            </referenceBlock>
        </referenceContainer>
    </body>
</page>

Looking for the proper way to handle the override in the child theme.
I am working on Magento 2.4.1. Enterprise Edition.


texts: /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php Magento Script edit

texts:
I'm reasonably new to Magento and i'm trying to edit my Magento code/script (what ever you call it) and all the forums keep telling me to

"Copy /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php to /app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php." to be able to access it

My question is where the hell is this and where do I enter it?

Probably a very silly question but I'm having a blonde day.


texts: Magento 2 : How to Add Custom Block to Admin Using Plugin

texts:
In magento admin ‘New Shipment’ page, How can I add new custom block after the ‘Payment and Shipping Method’ block using plugin?

I have achieved this, using override technique by overriding Module_shipping core files.
But I do not want this, because it can affect in future when Magento core is updated.

Thanks.