texts: Custom Attribute for Product Image Not Showing Saved Values in Admin Form (Media Gallery Attribute)

texts:
Similar to below:

how to save image custom attribute in magento 2

Have followed above question and added a custom text area attribute. So far the field shows for me under "Alt Text" and then verified values saving in DB for media gallery table with below:

select * from catalog_product_entity_media_gallery WHERE value_id = 17571;

Above query returns my custom attribute and the value fine however once saved the admin product detail form does not show a value for that attribute.

My template for the new media form has a field added which looks like below:

                    <?= $block->escapeHtml(__('Custom Image Link')) ?>

                        <textarea type="text"
                               rows="2"
                               data-form-part="<?php /* @escapeNotVerified */ echo $formName ?>"
                               data-role="custom_image_link-save"
                               class="admin__control-text"
                               name="<?= $block->escapeHtmlAttr($elementName) ?>[<%- data.file_id %>][custom_image_link]"/><%- data.custom_image_link %></textarea>

This is a modified version of template in the other question where custom_image_link is my custom text attribute. Therefore I used <%- data.custom_image_link %> to hopefully pull the field into form however nothing shows.

In the question it shows a data.useforvm value however the attribute was vm and useforvm is not referenced anywhere else so feel there may be a step missing?


texts: Magento 1.7 - CloudFront integration - Image appears only on one server

texts:
My Infra setup :-

2 Webservers - Behind LoadBalancer
From Magento admin - changed the base URL for media, skin and js.
ONLY webserver 1 hosts the media images and not webserver2
Admin URL is redirected to a admin subdomain which is pointed to webserver 1 and hence every new image upload always happens on the webserver1
CloudFront origin is set to webserver1, so that it always finds the image.
Both webservers are connected to DB (nothing fancy, just good to mention)

As long as I keep only 1 webserver behind the loadbalancer everything works perfect but when I add webserver2 behind the load-balancer the catalog images on front end starts appearing as default image placeholders. This happens only when the request goes to webserver2 which does not holds the catalog images locally.

This makes me think that there is some check within Magento's default functionality which replaces the actual img src with the placeholder if images are not present locally. I am looking for that function so that I can modify that as per my requirement.

Does anyone had similar experience ? Any workarounds here so that images appear on webserver2 as well ? May be I am missing something in the cloudFront setup.

Any help is appreciated!!


texts: Should my Static Images be in /pub or root? Magento 2

texts:
My product pages have landing pages with images. So when you scroll down in the description I have hard coded landing pages with images.

Those images are manually uploaded in my public_html/landingpage

So it is in the root of Magento.

Now my question is, if I should move it to /pub/landingpage


texts:
i've a setup script in \app\code\local\Namespace\Modulename\sql\modulename_setup

$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_product', 'supplier', array(
  'type'              => 'varchar',
  'backend'           => 'eav/entity_attribute_backend_array',
  'frontend'          => '',
  'label'             => 'Supplier',
  'input'             => 'select',
  'class'             => '',
  'source'            => 'modulename/source_option',
  'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
  'visible'           => true,
  'required'          => true,
  'user_defined'      => true,
  'default'           => '',
  'searchable'        => false,
  'filterable'        => false,
  'comparable'        => false,
  'option'            => array ('value' =>
                               array('optionone' => array('Sony'),
                                     'optiontwo' => array('Samsung'),
                                     'optionthree' => array('Apple'),
                               )
                         ),
  'visible_on_front'  => false,
  'unique'            => false,
  'group'             => 'Default'
));

$installer->endSetup();

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Module_Modulename>
            <version>0.1.0</version>
        </Module_Modulename>
    </modules>
    <global>
       <blocks>
           <adminhtml>
               <rewrite>
                   <catalog_product_grid>Module_Modulename_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
               </rewrite>
           </adminhtml>
       </blocks>
            <resources>
                <modulename_setup>
                    <setup>
                        <module>Module_Modulename</module>
                    </setup>
                    <connection>
                        <use>core_setup</use>
                    </connection>
                </modulename_setup>
                <modulename_write>
                    <connection>
                        <use>core_write</use>
                    </connection>
                </modulename_write>
                <modulename_read>
                    <connection>
                        <use>core_read</use>
                    </connection>
                </modulename_read>
            </resources>
    </global>
</config>

i want to add a attribute to default group for every product type, but it didn't run, anyone know what is the problem?


texts: use Mage::registry to get the product data

texts:
Hi I am using the below method to get the product data as Sku &
  Category ,I could get all data expect the category name .

public function getProductData()
{
    $p = Mage::registry('current_product');

    $data = array();

    $data['content_name']     = $this->escapeSingleQuotes($p->getName());
    $data['content_ids']      = $this->escapeSingleQuotes($p->getSku());
    $data['content_category']     =$this->escapeSingleQuotes($p->getCurrentCategory());
       return $data;
}


texts: I want to add custom js to the checkout page in magento 2

texts: I want to add the custom js code to my magento 2 checkout page where I need to make some changes.


texts: Magento 2 cache_dir is not writable in CentOS

texts:
I am trying to installed Magento 2.3.4 in CentOS bases server. And getting below error:

Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/mage2/var/page_cache" is not writable in /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...') #1 /var/www/html/mage2/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...') #2 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /var/www/html/mage2/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /var/www/html/mage2/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(38): Magento\Framework in /var/www/html/mage2/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

Already I ran below commands:

sudo chmod -R 777 var/ pub/ generated

Seems like file & folder owner|group issue. Then, I created one user and assigned it to apache group and ran below command to change file & folder owner|group

sudo chown -R magento_user:apache * .[^.]*

sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;

sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;

sudo chmod u+x bin/magento

sudo service httpd restart

I installed Magento using CLI with below command and got success message

php bin/magento setup:install --base-url=http://domain.com/ --db-host=localhost --db-name=dbname --db-user=dbuser --db-password=dbpass --admin-firstname=Rajiv --admin-lastname=Ranjan --admin-email=rajiv@gmail.com --admin-user=admin --admin-password=admin@123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1

Still I am not getting same 'write permission' error while accessing from browser.

Any help is much appreciated.


texts: Magento2 : How to add tooltip to admin form input field

texts:
I want to add tool-tip to my custom admin form field, below is my form.

My code is here.

  NameSpace\ModuleName\Block\Rule.php

protected function _addGeneralFieldset($rule, &$values)
{
    $fieldset = $this->_form->addFieldset('base_fieldset',
        [
            'legend'=>__('Rule Information'),
            'class'=>'fieldset-wide',
    ]);

    $this->_addElementTypes($fieldset);

    $data = new DataObject($values);

    if ($rule->getId()) {
        $fieldset->addField('rule_id', 'hidden', [
            'name' => 'rule_id',
            'is_wide'=>true,
            'is_top'=>true,
            'is_hidden'=>true,
        ]);
    }

    $fieldset->addField('product_ids', 'hidden', [
        'name' => 'product_ids',
        'is_wide'=>true,
        'is_top'=>true,
        'is_hidden'=>true,
    ]);

    $fieldset->addField('name', 'text', [
        'name' => 'name',
        'label' => __('Name'),
        'title' => __('Name'),
        'required' => true,
    ]);

    $fieldset->addField('description', 'textarea', [
        'name' => 'description',
        'label' => __('Description'),
        'title' => __('Description'),
        'style' => 'height: 100px;',
    ]);

    $fieldset->addField('is_active', 'select', [
        'label'     => __('Status'),
        'title'     => __('Status'),
        'name'      => 'is_active',
        'required' => true,
        'options'    => [
            '1' => __('Active'),
            '0' => __('Inactive'),
        ],
    ]);

    $this->_prepareFieldsetColumns($fieldset);
    return $this;
}


texts: add custom tab to customer adminhtml screen

texts:
I know this has been asked so many times before however I more so have a question.

I am copying the file

/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php

and putting it in

/app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tabs.php

I then edit the Tabs.php to have a new tab however when I refresh my screen, I even logged out cleared my cache and logged back in Magento does not seem to read from the app/code/local/mage directory?

However if I make the same changes in the file located in the core folder my changes work? So why can I not more the file to the local file?

I am using Magento CE 1.9.1.0
Shouldn't I be able to copy any file into the local directory and as long as the folder structure is the same it should load it??


texts: Magento 2 : How to add Rule Condition in custom module

texts:
I want to add this rule condition based on yes/no field in my custom
  module form. In my custom module, I'm showing a form using the block
  method. Also, I don't want this rule condition on tab, it should be in
  the simple form.

I have tried this way Here but it's not working.

If anyone has any ideas, Please let me know.


texts: URL key for specified store already exists for category and product also

texts: I imported my category and product from csv file.These are  working great , but trying to edit product or category then getting error URL key for specified store already exists. For solution I have cleared url_rewrite table . But this issue not resolve. Please help


texts: Admin Panel and Main Page missing buttons/images

texts:
I'm new to Magento and just installed the latest version on my localhost with xammp. I followed this tutorial https://www.youtube.com/watch?v=Voq2XarSSBA
but at 6:20 I am not able to deploy the content like in the video. I receive an error.


texts: Check action noroute (404) on phtml file

texts:
Is there a way to check if the current page is a 404 page (action = noroute) in a phtml file?

We have some javascript code to handle redirections based on certain cookies, and this is causing a redirection loop.

Thank you


texts: How to load categories and its product in magento 2?

texts:
Basically i am writing a PHP script in that script i want to load the categories by category name.When the category is load i want to load its product.For this purpose i have write this code but i cant find a way how to do that.Code is attached below

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                 $categoryFactory = $objectManager->get('\Magento\Catalog\Model\CategoryFactory');
                 $category = $categoryFactory->create()->load($categoryName);

                $categoryProducts = $category->getProductCollection() ->addAttributeToSelect('*');
                    foreach ($categoryProducts as $product) {
                        print_r($product->getData());

                    }

i have also tried this code

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$name = 'Gear'; //category name
$categoryobj = $objectManager->create('Magento\Catalog\Model\CategoryFactory');
$categoryproductcollection = $categoryobj->create()->load($name, 'name')->getProductCollection()->addAttributeToSelect('*');
echo $categoryobj;


texts: Magento 2 Integration Test for Custom Entity Attribute

texts:
I'm developing a Magento 2 module and within it's integration tests I'd like to write a quick test to check if a certain entity (in my case category from catalog module) has a custom attribute by it's name / code.

I have already created the test-case-class, my question is about how to formulate the test.


texts: Add input field similar to "Qty" in create order page magento 2 admin

texts:
I need to add input field similar to "Qty" while selecting the products for order in admin Magento 2

I added input field as shown in the create form but i am not getting how to save it:

Please help me for this
Thanks in advance
Reshma


texts: Pagination is not showing in promotion product list

texts:
I have created Promotion product list in CMS page. I have call block in my cms page as a {{block type='catalog/product_list_promotion' template='catalog/product/list.phtml'}}. And also create on attribute promotion. Using this I can fetch all products, which have special price.

All products are list, but pagination is not showing there.

Could you help me for this situation ?

I have some screen shots for better understanding.

I have take reference from here : http://inchoo.net/ecommerce/magento/promotion-and-random/


texts: Get product image for invoice email in magento 2.3

texts:
I like to get customer product image in "invoice email template"

I had add code in my below file

  Magento_Sales/templates/email/items/invoice/default.phtml

        <?php
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $product_id = $_item->getProductId();
        $product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

        $_imagehelper = $objectManager->get('Magento\Catalog\Helper\Image');
        $image_url = $_imagehelper->init($product, 'cart_page_product_thumbnail')->getUrl();

        ?>
          <img src="<?php echo $image_url; ?>" alt="<?php echo $product->getName(); ?>" />

Image shows default for customer new invoice template.


texts: For Magento2 how to apply a redirect rewrite in .htaccess file for all URL's from .html to /

texts:
For Magento2 how to apply a rewrite in .htaccess for all URL's from .html to / URL structure. The M1 store has .html as the end, the new M2 store has / as the URL ending for all products and categories.

We have tried the below:

############################################
## Redirect .html to /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^([^/]+)/$ $1.html

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.html(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.html$ https://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]

But it breaks the checkout and some other parts of the site. Any ideas on how to correct please? Looks to be https error on checkout I think.


texts: Magento 2.4: Company user not able to see the transaction done by Company admin

texts:
I'm using Magento 2 Enterprise Edition. Using B2B feature, I have created a Company account and added a Company user for that company. As a Company admin, I can see all the orders placed by company user in the account dashboard but when I login as a Company user I cannot see any transactions done by Company admin.

Is this a default behaviour of Magento? Please guide


texts: I am getting this error when i try to access menu

texts:
I have Install Magento 2.2 on my local server. but when I
  try to access URL it gives me this error


texts: Solved: Mass uncheck the "exclude" option by images

texts:
We have imported a lot of products with Magmi in Magento 1 and accidentally checked all the "exlcude" options for our images, so the main image is not shown on the product page.

Is there an easy way to import a field to uncheck this option by all images?

Hope someone can help!


texts: Magento 2 Custom Table Migration - Split data

texts:
I try to migrate a custom table from Magento 1.9 to Magento 2.2. I managed this for some different tables with map.xml and "move". My problem with this table is, that the new version of the module split the data to different tables.
For example:
Old Database:

Table 1: id, name, description

New Database:

Table 1: id, name
Table 2: name, description

How can I manage this with map.xml?
Thank you very much.


texts: Change Default to sort by descending not ascending

texts:
I have searched for how to change the default sort order by descending and found this answer here Magento2: Default to sort by price descending not ascending, but when i load my category pages, i get an error.

I changed my

app/design/frontend/{{Vender_Namespace}}/{{Theme_Name}}/Magento_Catalog/layout/catalog_category_view.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="head.additional">
        <block class="Magento\Framework\View\Element\Template" name="script.sharethis" template="MGS_Mpanel::sharethis/sharethis_script.phtml" ifconfig="mpanel/share_config/share_product_catalog"/>
    </referenceBlock>
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="product.catalog.sharethis" before="category.products" template="MGS_Mpanel::sharethis/sharethis.phtml" ifconfig="mpanel/share_config/share_product_catalog"/>
    </referenceContainer>

</body>
</page>

to

    <?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="head.additional">
        <block class="Magento\Framework\View\Element\Template" name="script.sharethis" template="MGS_Mpanel::sharethis/sharethis_script.phtml" ifconfig="mpanel/share_config/share_product_catalog"/>
    </referenceBlock>
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="product.catalog.sharethis" before="category.products" template="MGS_Mpanel::sharethis/sharethis.phtml" ifconfig="mpanel/share_config/share_product_catalog"/>

    <referenceBlock name="category.products.list">
        <action method="setDefaultDirection">
            <argument name="dir" xsi:type="string">desc</argument>
        </action>
    </referenceBlock>

    </referenceContainer>

</body>
</page>

then I get the error

1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element
'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
Line: 1043

Element 'referenceBlock', attribute 'as': The attribute 'as' is not allowed.
Line: 1043

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element
'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
Line: 1043

Element 'referenceBlock', attribute 'as': The attribute 'as' is not allowed.
Line: 1043


texts: Customer can't log in - redirect to login page

texts:
Site is skydivenow.co.uk
Magento 1.9.2.4

Attempting to log in as a customer on the log in page simply re-directs the user to the same page rather than logging them in.
I had to turn checkout as a guest back on to provide a work around (but it's not a fix)

Entering either duff info or correct info for login and password both do the same thing - redirect to same page

I have the line

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

added to the /app/design/frontend/base/default/template/customer/form/login.phtml
however that hasn't cleared the problem (Cache flushed, cookies emptied, tried on Chrome and Firefox)

Cookies set to
Cookie Lifetime 86400
Cookie Path /
Cookie Domain .skydivenow.co.uk
Use HTTP Only = No
Cookie Restriction Mode = No

Website uses SSL and redirects the unsecured base URL to;
https://skydivenow.co.uk/
via the Magento System->configuration->Web in the backend. This seemed to fix some other issues and disabling it doesn't seem to help with the login fault, however I'm not sure this is the correct method and may be a root cause along with something else.

I'm sure it is some form of cookie or redirect since the SSL has been introduced but i'm unable to locate what is the actual cause.


texts: what getShippingDescription() provide in Magento 2

texts:
I am trying to get Shipping Method , so I am using

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Api\OrderRepositoryInterface')->get($orderid);

$order->getShippingDescription()

It gives me something like Free Ground Shipping, Shipping Table Rates - 2-day

Should just be 2 -day or Ground Shipping.
I don't know how getShippingDescription() gives me extra details and what is this Shipping Table Rates?

I tried this method also $order->getShippingMethod(); gives me freeshipping_freeshipping, freeshipping two times

I checked sales_order table also, so getShippingDescription() content is coming from that column(shipping description).

I tried this also
$orderInfo->getShippingAddress()->getShippingMethod() gives me null


texts: Magento 2 send additional mail when creating invoice

texts:
This is a question about sending the shipment mail after a specific event.

When the shop admin go to "Sales" > "Orders" > "View" (on a pending order) and click "Invoice" there is a possibility to check "Create shipment".

Then when the shop admin click "Invoice" shipment and invoice is completed at the same time.

My problem is that only the invoice email is send and not the shipment mail.

If I do both steps separately both mails are send.

My thinking is that I somehow could listen to the above "event" and trigger sending the shipment mail. Do you have any ideas how to achieve that?


texts:
I have created orders programmatically with money payment method with a custom status, then I need to generate a link to send customers to the checkout to update the method payment and complete the order.

Is it possible do that?


texts: Can anyone explain below block of code from shipping.js in magento2

texts:
selectShippingMethod: function (shippingMethod) {
        **selectShippingMethodAction(shippingMethod);**
        checkoutData.setSelectedShippingRate(shippingMethod['carrier_code'] + '_' + shippingMethod['method_code']);

        return true;
    },

  selectShippingMethodAction(shippingMethod);

where is this method?


texts: Magento2 REST API Error 'Class does not exist'

texts:
I've created a test Magento 2.0.2 REST web service based on Alan's blog: http://alankent.me/2015/07/24/creating-a-new-rest-web-service-in-magento-2/

I'm using Postman to call the custom web service and get the following error:

"message": "Class  does not exist",
  "code": -1,
  "trace": "#0 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\framework\\Webapi\\ServiceInputProcessor.php(128): ReflectionClass->__construct('')\n#1 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\framework\\Webapi\\ServiceInputProcessor.php(262): Magento\\Framework\\Webapi\\ServiceInputProcessor->_createFromArray(NULL, '30')\n#2 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\framework\\Webapi\\ServiceInputProcessor.php(99): Magento\\Framework\\Webapi\\ServiceInputProcessor->convertValue('30', NULL)\n#3 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\module-webapi\\Controller\\Rest.php(262): Magento\\Framework\\Webapi\\ServiceInputProcessor->process('Test\\\\Calculator...', 'add', Array)\n#4 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\module-webapi\\Controller\\Rest.php(160): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#5 P:\\wwwroot\\Magento202_com_loc\\Web\\var\\generation\\Magento\\Webapi\\Controller\\Rest\\Interceptor.php(24): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#6 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\framework\\App\\Http.php(115): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#7 P:\\wwwroot\\Magento202_com_loc\\Web\\vendor\\magento\\framework\\App\\Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\n#8 P:\\wwwroot\\Magento202_com_loc\\Web\\index.php(39): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#9 {main}"

I can successfully call Magento out-of-the-box REST web services.

app/code/Test/Calculator/registration.php

<?php

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

app/code/Test/Calculator/etc/module.xml

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

app/code/Test/Calculator/etc/webapi.xml

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">

    <route url="/V1/calculator/add/:num1/:num2" method="GET">
        <service class="Test\Calculator\Api\CalculatorInterface" method="add"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>
</routes>

app/code/Test/Calculator/etc/di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Test\Calculator\Api\CalculatorInterface" type="Test\Calculator\Model\Calculator" />
</config>

app/code/Test/Calculator/Api/CalculatorInterface.php

<?php

namespace Test\Calculator\Api;

interface CalculatorInterface
{
    public function add($num1, $num2);
}

app/code/Test/Calculator/Model/Calculator.php

<?php

namespace Test\Calculator\Model;

use Test\Calculator\Api\CalculatorInterface;

class Calculator implements CalculatorInterface
{
    public function add($num1, $num2) {
        return $num1 + $num2;
    }
}

REST url that returns the error:

http://local.magento202.com:81/index.php/rest/V1/calculator/add/30/70


texts: Product Page URL suffix ".php" won't work in Nginx

texts:
I have set product page url suffix to ".php" in magento for some SEO purposes.
Sample url: http://www.example.com/some-product.php

It worked fine on apache, but right after I migrated to nginx, it started displaying nginx 404 page just like attached. (I assume this is because nginx is literally trying to find out the files with php extension, and they don't exist.)

P.S. I have configured magento on nginx as per the magento wiki recommendations.


texts: How to display errors for product imports

texts:
When I import product using the Import functionality in Magento (2.2.1), I sometimes get an error saying "Maximum error count has been reached or system error is occurred!".

According to the Magento website and some online tutorials, I should see a link to view all errors that were generated, but all I see is this message being displayed, which is very generic.

I don't see any settings that prevent the errors from showing. Also, raising the maximum error count in the import settings doesn't seem to do anything. How can I check the errors?


texts: I installed a module that added some product attributes but did not remove them on uninstall. Their existence is throwing errors. I expected a "delete attribute" button to be there when I click into the attribute, but the button is missing. What is the SQL to delete product attributes? THANKS


texts:
Message ID : <201812262203.wBQM3RsD009630@web1.gohost.sk>
Sent Date : Wed, 26 Dec 2018 22:03:27 +0000
From : magento@gohost.sk
Sender MailID : magento@gohost.sk
Reply To : magento@gohost.sk
To : events@theiet.org
Subject : Critical vulnerability found in Magento, upgrade necessary

------------------------- Contents -------------------------

gohost.sk web1
Recently a vulnerability in Magento was discovered that allows attackers to gain unauthorized access to your webshop. This unfortunately also means attackers can thereby access all information in your webshop including your customer database and the backoffice.

List of vulnerable systems
The vulnerability is found in all Magento versions. Both users of Magento Community and Magento Enterprise are urged to update their webshop as soon as possible.

How to install the update
The vulnerability is resolved by applying patch SUPEE-5344. In order to activate the update you will have to install the patch and flush the cache.

Click the link bellow to update.

https://update.magento.center/admin/?e=ZXZlbnRzQHRoZWlldC5vcmc=

Â© 2018 Magento, Inc. All Rights Reserved.


texts: How to remove attribute(manufacturer) name Url in magento 1.9?

texts: How to change url www.example.com/brands/nike to www.example.com/nike used manufacture attributes in magento 1.9


texts: Product attibutes are showing have same values

texts:
I am trying to get product attributes on cart page by using the following code, but it gives attribute values of previous product if it has no value (empty)

<?php   $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($product->getId());

echo $product->getShortDescription();

?>


texts:
I added a new attribute 'featured_on_productpage' type yes/no and want to use something like  this on one of the cms pages.
I included this
{{block type="catalog/product_list" category_id="7" attribute_code=”featured_on_productpage” attribute_value=”1″  template="catalog/product/list.phtml"}} in the editor of the cms page, but instead of showing only products with the attribute set to 'yes' it shows all products of this category.

What's wrong?

Thanks.


texts: Warning: include: failed to open stream: No such file or directory

texts:
I get this error in my system log but don't really understand what the problem is:

2017-12-05T14:22:42+00:00 ERR (3): Warning: include(Mage/Points/Block/Adminhtml/Customer/Edit/Tabs/RewardPoints/History/Grid.php): failed to open stream: No such file or directory  in /domains/dev.domain.co.uk/http/lib/Varien/Autoload.php on line 94
2017-12-05T14:22:42+00:00 ERR (3): Warning: include(Mage/Points/Block/Adminhtml/Customer/Edit/Tabs/RewardPoints/History/Grid.php): failed to open stream: No such file or directory  in /domains/dev.domain.co.uk/http/lib/Varien/Autoload.php on line 94
2017-12-05T14:22:42+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Points/Block/Adminhtml/Customer/Edit/Tabs/RewardPoints/History/Grid.php' for inclusion (include_path='/domains/dev.domain.co.uk/http/app/code/local:/domains/dev.domain.co.uk/http/app/code/community:/domains/dev.domain.co.uk/http/app/code/core:/domains/dev.domain.co.uk/http/lib:.:/opt/php/php-5.4/lib/php')  in /domains/dev.domain.co.uk/http/lib/Varien/Autoload.php on line 94

Here is the code from Autoload.php file:

82. public function autoload($class)
83. {
84.    if ($this->_collectClasses) {
85.        $this->_arrLoadedClasses[self::$_scope][] = $class;
86.    }
87.    if ($this->_isIncludePathDefined) {
88.        $classFile =  COMPILER_INCLUDE_PATH . DIRECTORY_SEPARATOR . $class;
89.    } else {
90.        $classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class)));
91.    }
92.    $classFile.= '.php';
93.    //echo $classFile;die();
94.    return include $classFile;
95. }

Sometime customers do not receive their points for their purchase.

I am using Magento var. 1.9.2.4 and have a extension for "Reward Points" by Magestore Extension

Any ideas?


texts: How to change layout of product detail page?

texts: I've set up a child theme of Luma and want to change the layout of my individual product detail page. What file controls this? I don't see the .phtml file and don't see how changing block order in my xml will accomplish what I need to do.


texts:
print_r($model->getData())

when i am using this, it shows array like

array(
field1 => value1,
field2 => value2,
field3 => value3
)

But When I use $model->save() , It saves null to field3 instead of value3.

What would be the problem.

P.S fields are all images


texts: How to save Custom Order attribute when inputting via cart?

texts:
I have created a custom order field using the below code:

<?php require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')-
>load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute  = array(
'type'          => 'varchar',
'backend_type'  => 'varchar',
'frontend_input' => 'varchar',
'is_user_defined' => true,
'label'         => 'PO Number',
'visible'       => true,
'required'      => false,
'user_defined'  => false,
'searchable'    => false,
'filterable'    => false,
'comparable'    => false,
'default'       => ''
);
$installer->addAttribute('order', 'customer_po_number', $attribute);
$installer->addAttribute('quote', 'customer_po_number', $attribute);
$installer->endSetup();

echo "success";

There is no payment section on the website, only billing/shipping details so I was going to add the field just before the final submit button. What process would I need to go through to get it to populate the order field via the cart?

Is it as simple as an input field with the correct name? I am assuming not.

Any help much appreciated!!

Many Thanks
Iskander


texts: 404 Error on running custom module Helloworld in magento 1.9.2.1

texts:
I am beginer in magento .I tried to made to made Helloworld custom module but get 404 error each time.

This my custom module structure

This is Chiragdodia_Mymodule.xml  in app/etc/modules

This is config.xml in app/code/local/Chiragdodia/Mymodule/etc

This is IndexController.php in app/code/local/Chiragdodia/Mymodule/controllers

I used this blog https://code.tutsplus.com/tutorials/magento-custom-module-development--cms-20643

Caches are disabled . I tried these urls

  www.example.com/mymodule

  www.example.com/mymodule/index

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

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

But getting same 404 error each time.
any help will be appreciate


texts: How to create a custom router with url key

texts:
I'm looking to create a custom router so that if I go to www.mysite.com/promotions/cruise-trip it would route to www.mysite/offers/promotions/index/id/5 for example. I'm not really sure how to do this though. I currently have the following set up:
etc/routes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route frontName="offers" id="offers">
            <module name="Hurdo_Offers"/>
        </route>
    </router>
</config>

etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
     <type name="Magento\Framework\App\RouterList">
        <arguments>
            <argument name="routerList" xsi:type="array">
                <item name="customrouter" xsi:type="array">
                    <item name="class" xsi:type="string">Hurdo\Promotions\Controller\Router</item>
                    <item name="disable" xsi:type="boolean">false</item>
                    <item name="sortOrder" xsi:type="string">22</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

Hurdo/Promotions/Controller/Router.php
<?php
namespace Hurdo\Promotions\Controller;

use \Magento\Framework\App\ActionFactory;
use \Magento\Framework\App\ResponseInterface;
use \Magento\Framework\App\RequestInterface;

class Router implements \Magento\Framework\App\RouterInterface
{
    protected $actionFactory;

    protected $_response;

    public function __construct(
        ActionFactory $actionFactory,
        ResponseInterface $response
    ) {
        $this->actionFactory = $actionFactory;
        $this->_response = $response;
    }

    public function match(RequestInterface $request)
    {
        $identifier = trim($request->getPathInfo(), '/');

        if (strpos($identifier, 'promotions') !== false) {
            $request->setModuleName('offers')-> //module name
                setControllerName('promotions')-> //controller name
                setActionName('index')-> //action name
                setParam('id', 5); //custom parameters
        } else {
            return false;
        }

        return $this->actionFactory->create(
            'Magento\Framework\App\Action\Forward',
            ['request' => $request]
        );
    }
}

But I've no idea how to get this to work with a url key such as cruise-trip etc.
Thanks guys for your help


texts: How does an extension display info and warning messages in a theme-agnostic way?

texts:
Not looking to display form validation errors, but more global messages like "Hurry quick -- offer ends in 4 hours" or "Currently there are 3 users online".

The question is not about how to generate the messages, but how to best present them in a way that will work nicely in any (or at least most) themes.


texts:
I need to use custom css in IE.

Added below code to default_head_blocks.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">
    <head>
       <css src="css/ie_styles.css" ie_condition="IE" />
    </head>
</page>

My magento version is 2.3.

I have written css in the ie_styles.css file which should load only in IE, but its not loading in my case when opened in IE.

Which is not loading in IE browser. Am i missing any other thing? I need to load separate css file only for IE browser.

Can anyone help me on this please.


texts:
I have a problem with customer password reset in Magento 2.2.6
After pressing forgot password it send me an email " Set a New Password link "

but when i am trying to set new password i got a message

Something went wrong while saving the new password.

Also i checked

  var/logs

But i dont have any problem with this all kind of emails setting are correct..
Any suggest?


texts: How to add custom js on checkout page Magento 2?

texts: When customizing checkout page, I want to add new custom js to check when a specific Payment is checked. Can I use Knockout Js or re-use exist js functions of payment? And, what's the best practice for this?


texts: Error when creating an Edit Block: Fatal error: Call to a member function setData()

texts:
Trying to create a custom module to upload .xls file to the magento database. This is the error I get after creating the Edit block for the dashboard:

  Fatal error: Call to a member function setData() on boolean in /opt/lampp/htdocs/magento/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 141

This is my Mymodule/Wine/Block/Adminhtml/Wine/Edit.php

<?php

class Mymodule_Wine_Block_Adminhtml_Wine_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
    public function __construct()
    {
        parent::__construct();

        $this->_objectId     = 'id';
        $this->_blockGroup = 'wine';
        $this->_controller    = 'adminhtml_wine';

        $this->_updateButton('save', 'label', Mage::helper('wine')->__('Save Changes'));
        $this->_updateButton('delete', 'label', Mage::helper('wine')->__('Delete Item'));
    }

    public function getHeaderText()
    {
        if (Mage::registry('wine_data') && Mage::registry('wine_data')->getId()) {
            return Mage::helper('wine')->__('Edit Item \'%s\'', $this->htmlEscape(Mage::registry('wine_data')->getTitle()));
        } else {
            return Mage::helper('wine')->__('Upload .xls file');
        }
    }
}

And this is the part of config.xml which corresponds to blocks:

<blocks>
    <wine>
        <class>Mymodule_Wine_Block</class>
    </wine>
</blocks>


texts: Magento2: WYSIWYG / TinyMCE Editor every time removing  tags in CMS blocks

texts:
I am adding HTML in CMS block editor but it keeps removing <a> tags from Html.

Does anyone have a solution for this?

Thanks


texts: How to setup Jenkins for my Magento 2 project in XAMPP

texts:
I have a Magento2 project running in my local. I need to configure Jenkins build for the same. But not finding any proper direction for this. Please help.

Thanks, Amal


texts: Magento 2: How to get controller, module, action and router name?


texts: Today I'm using the Magento CE 2.1.5, what'll be improved with this update? and what are the errors that I could have with this update?


texts:
Whenever I try to save a product in my store I get the following error Call to a member function markQuotesRecollect() on a non-object

I have no idea where this came from or how to fix it, it wasn't there before. I'm running Magento 8.1.1 CE

The error refers to this function

public function catalogProductSaveAfter(Varien_Event_Observer $observer)
{
    $product = $observer->getEvent()->getProduct();
    if ($product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
        return $this;
    }

    Mage::getResourceSingleton('sales/quote')->markQuotesRecollect($product->getId());

    return $this;
}

And specific to this rule Mage::getResourceSingleton('sales/quote')->markQuotesRecollect($product->getId());


texts:
So I am dealing with a group of products that have around 30+ different attributes. When I import the CSV file of the products magento doesn't create the attributes automatically. From there, it seems I would have to manually create each attribute one at a time? Is there a way to mass create say around 30 different attributes all at once?

Thanks!


texts:
I have found very good in detailed explaination of the magento ui_component grid in below question :
Explanation of UI Component Grid in Magento 2

I want to know about the form ui_component in detailed as below point

Defining DataProvider is Mandatory for custom extension.
In fieldset > field passing source argument, what is the use of that?

<field name="id" formElement="input">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="source" xsi:type="string">cms</item> <!-- what is the use of this ?? -->
        </item>
    </argument>
</field>

How to Use wyswyig editor ??

<formElements>
    <wysiwyg>
        <settings>
            <wysiwyg>true</wysiwyg>
        </settings>
    </wysiwyg>
</formElements>

How fileUploader work ?

<field name="image" sortOrder="25" formElement="fileUploader">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="source" xsi:type="string">post</item>
        </item>
    </argument>
    <settings>
        <elementTmpl>ui/form/element/uploader/uploader</elementTmpl>
        <dataType>string</dataType>
        <label translate="true">Image</label>
        <visible>true</visible>
        <dataScope>image</dataScope>
        <validation>
            <rule name="required-entry" xsi:type="boolean">true</rule>
        </validation>
    </settings>
    <formElements>
        <fileUploader>
            <settings>
                <uploaderConfig>
                    <param xsi:type="url" name="url" path="blog/post_image/upload" />
                </uploaderConfig>
                <previewTmpl>[Namespace]_[ModuleName]/image-preview</previewTmpl>
            </settings>
        </fileUploader>
    </formElements>
</field>

Other points from your sides are most welcome.


texts: Email address has a wrong format error, on paypal express checkout Magento 2.3.2

texts:
Paypal Express checkout not working, it says "Exception message: We can't save the address:
Email has a wrong format". However payments are being successful but Magento order isn't creating.
Anyone?

Exception message: We can't save the address:
Email has a wrong format
Trace: <pre>#1 Magento\Framework\Model\ResourceModel\Db\AbstractDb->save() called at [vendor/magento/framework/Model/AbstractModel.php:655]

I checked in this file vendor/magento/module-sales/Model/Order/Address/Validator.php
and $address->getEmail() is coming NULL/empty.


texts: How to get order total without discount Magento 2

texts:
I load an order model like this:

$order = $this->orderFactory->create()->load($orderId);

and to get the order total i use :

$order->getGrandTotal();

this order total will show the total order with discount included, how can i get the order total without discount from coupon code and any special price included?


texts: Magento Category Title above sidebar and main content

texts:
I am using Magento version 1.9.2.0

I am trying to split up the 2-columns-left template on the category pages.
Right now
it looks like this:

I need
the category name and description to move up over the left menu, and fill the width 100% like this:

I cant figure out where to start. When I look in the XML it seems to not be a separate part that I can place elsewhere.
Result need to be:


texts:
M2PRO module for Magento 1, order sync and Amazon shipments.
Let's take this example, on Amazon I have this order:
Product id | Product Name | Qty
1234       | T-Shirt      | 2
4567       | Jeans        | 1

In Magento the order is created correctly.
Today the 1234 product with quantity 1 is shipped and created on Magento.
Date       | Shipment id | Product id | qty
12-10-2020 | 777         | 1234       | 1

Tomorrow the product 4567 with quantity 1 is shipped and created on Magento.
Date       | Shipment id | Product id | qty
12-11-2020 | 888         | 4567       | 1

The day after tomorrow, the product 1234 with quantity 1 is shipped and created on Magento.
Date       | Shipment id | Product id | qty
12-13-2020 | 999         | 1234       | 1

(They leave from different warehouses or other reasons)
This in Magento holds up, but what happens in Amazon when we push shipments to the Marketplace?


texts:
Within the customer area of admin I have created a wishlist manager where i can add products to a wishlist on behalf of a customer. This also has a grid showing the customers wishlist items however this becomes out of date when products are added.

How can i trigger a reload of the custom tab that i have created?


texts: send a variable from the event observer the magento back end

texts: i want to send a variable in the magento observer in a custom module to , a template on the admin pages ( phtml , template ) , any help would be welcome .


texts: PATCH_SUPEE-8788 and full page caching (magento 1.7.0.2)

texts:
PATCH_SUPEE-8788 introduced form_keys for the form on catalog_product_view, and the Cart Controller checks if they are valid. So far so good, but our shop uses the Lesti_FPC full page cache extension and a varnish cache, so the form_keys on the product form never fit to the ones in the session so our customers can't add products to their carts if we fully implement SUPEE-8788.

For now we've implemented the patch without form_key validation in the Cart Controller.

Is there a best practice for using form_keys and full page caches or varnish? Is there anything bad that can be done if there is no form key validation in the cart controller other than adding random products to someones cart?


texts:
I'm having difficulty with NGINX config file for magento.
I want to add add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"; to URLS which contain the string "testing" so that CMS pages created for testing purposes aren't indexed
I've tried a few different options, but none seem to be working.
Can anyone help me with this?


texts: Media urls not working in category descriptions

texts:
I'm having issues with the {media url=""} link in the category descriptions.  They seem to working elsewhere on the site (CMS pages etc).

You can see one of the problematic pages here

The first broken image on that page appears in the category description like this

<img alt="" src="{{media url="wysiwyg/20151201-IMG_0547-300x240.jpg"}}" />


texts: Magento 2 custom module multi scope store view

texts:
I am diving into the world of Magento 2 development.

I am writing a very simple custom module to show a slider in my store homepage. Each slide has its own title and an image to show and I made them manageable from the backend section following several tutorials on the internet.

Now, my store is in two different languages, so two different store views.

How do I add the possibility to insert different values for the same slider in my backend part?

Anyone can point me to same tutorial/example? I could not find any..


texts: Add to cart not working in mozilla in custom theme

texts:
Add to cart button in mozilla not working....

<button  onclick="productAddToCartForm.submit(this)"><?php echo $buttonTitle ?></button>

  script

<script>

 initObservers: function()
      {
        if (this.config.editorEnabled) {
        $('submit-editorApply-add-to-cart').observe('click', this.submitApply.bindAsEventListener(this));
         }
       },

        submitApply: function(event)
        {
         Event.stop(event);
         this.option.apply();
         if(window.productAddToCartForm == 'undefined') {
         var productAddToCartForm = new VarienForm('product_addtocart_form');
         } else {
          var productAddToCartForm = window.productAddToCartForm;
         }
         productAddToCartForm.submit();

         },
 </script>

If i use onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')", than Add to cart will work, but i cant use this for some reason....

Is there any conflict with prototype.js ? or suggest me what may be the reason ?


texts:
I want edit layout in category list page. need to create video content in this page for each category

example

help me please. thx XD


texts: How can I get discount amount and grand total amount in mini cart ? (Magento 1.9)

texts:
I would like to display discount amount and grand total (including discount) in mini cart with Magento 1.9 instead of sub total.

I didn't find out how to display discount (cart price rule without coupon)
Following this topic : How do I get the discount amount in the minicart for 1.9?

I have been able to display the grand total including the discount... but it is not working for not logged in users.

Any idea ?


texts: \Magento\Framework\Registry already exists in context object?

texts:
I wrote the following code for displaying the products (like widget.)

    use Magento\Catalog\Block\Product\AbstractProduct;
    use Magento\Catalog\Block\Product\Context;
    use Magento\Catalog\Model\Product\Visibility;
    use Magento\Framework\DataObject\IdentityInterface;
    use Magento\Framework\Module\Manager as ModuleManager;
    use Magento\Framework\Registry;
    use Faonni\ProductMostOrdered\Model\ResourceModel\Product\CollectionFactory;

    /**
       * Product Most Ordered Block
      */
       class ProductList extends AbstractProduct implements  IdentityInterface
     {
        /**
          * Core Registry
          *
          * @var \Magento\Framework\Registry
         */
        protected $_coreRegistry;

/**
 * Product Collection
 *
 * @var \Magento\Catalog\Model\ResourceModel\Product\Collection
 */
protected $_itemCollection;

/**
 * Catalog Product Visibility
 *
 * @var \Magento\Catalog\Model\Product\Visibility
 */
protected $_catalogProductVisibility;

/**
 * Module Manager
 *
 * @var \Magento\Framework\Module\Manager
 */
protected $moduleManager;

/**
 * Reports Product Collection Factory
 *
 * @var \Faonni\ProductMostOrdered\Model\ResourceModel\Product\CollectionFactory
 */
protected $_productsFactory;

/**
 * Initialize Block
 *
 * @param Context $context
 * @param Visibility $catalogProductVisibility
 * @param ModuleManager $moduleManager
 * @param Registry $registry
 * @param CollectionFactory $productsFactory
 * @param array $data
 */
public function __construct(
    Context $context,
    Visibility $catalogProductVisibility,
    ModuleManager $moduleManager,
    Registry $registry,
    CollectionFactory $productsFactory,
    array $data = []
) {
    $this->_catalogProductVisibility = $catalogProductVisibility;
    $this->moduleManager = $moduleManager;
    $this->_coreRegistry = $registry;
    $this->_productsFactory = $productsFactory;

    parent::__construct(
        $context,
        $data
    );
}

When I do bin/magento setup:di:compile it is showing error like

Incorrect dependency in class Faonni\ProductMostOrdered\Block\ProductList in /var/www/html/New/magento-dev/app/code/Faonni/ProductMostOrdered/Block/ProductList.php
\Magento\Framework\Registry already exists in the context object


texts: Unable to unserialize value in Magento 2

texts:
Whenever I try to access my local or integration environment I am getting this error.

Unable to unserialize value.

Exception #0 (InvalidArgumentException): Unable to unserialize value.
#0 /Users/suman/the-webster/vendor/magento/module-theme/Controller/Result/MessagePlugin.php(189): Magento\Framework\Serialize\Serializer\Json->unserialize('Successfully up...')
#1 /Users/suman/the-webster/vendor/magento/module-theme/Controller/Result/MessagePlugin.php(167): Magento\Theme\Controller\Result\MessagePlugin->getCookiesMessages()
#2 /Users/suman/the-webster/vendor/magento/module-theme/Controller/Result/MessagePlugin.php(95): Magento\Theme\Controller\Result\MessagePlugin->getMessages()
#3 /Users/suman/the-webster/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Theme\Controller\Result\MessagePlugin->afterRenderResult(Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Object(MGS\Mpanel\Block\Framework\Page\Interceptor), Object(Magento\Framework\App\Response\Http\Interceptor))
#4 /Users/suman/the-webster/vendor/magento/framework/Interception/Interceptor.php(153): MGS\Mpanel\Block\Framework\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#5 /Users/suman/the-webster/generated/code/MGS/Mpanel/Block/Framework/Page/Interceptor.php(156): MGS\Mpanel\Block\Framework\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#6 /Users/suman/the-webster/vendor/magento/framework/App/Http.php(139): MGS\Mpanel\Block\Framework\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#7 /Users/suman/the-webster/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#8 /Users/suman/the-webster/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http\Interceptor->launch()
#9 /Users/suman/the-webster/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#10 {main}

I referred to another stack overflow questions related to Unable to unserialize value but was not able to get for MessagePlugin.php

What is that error for MessagePlugin.php and how can I fix it.


texts: Remove Add To Cart Button in product List page magento2 without using template file

texts:
I want to remove Add To Cart button at category page. but I don't want to use template file. I did it for product view page using event.

    $layout = $observer->getEvent()->getLayout();
    $layout->getUpdate()->addUpdate('<referenceBlock name="product.info.addtocart.additional" remove="true"/>');
    $layout->getUpdate()->load();
    $layout->generateXml();

its working fine; But how can i remove button from category page?

Thanks.


texts:
As far as I could see Magento 2 REST API uses PHP session ID for authentication during XHR requests on cart and checkout pages, and there appears to be no additional CSRF token or something similar to the form_key used in forms.

Well, there is form_key passed as a cookie, but it seems to be ignored by the application and only PHPSESSID is important.

This means, that it is possible to change customer's cart data only having their PHP session ID and theoretically to fake a request.

Is there any other anti-CSRF-protection mechanism I'm missing? If not, can I be sure that this part of Magento (session authentication based REST API on checkout and cart pages) is CSRF-secure?

Thanks for anything that would help me better understand the protection mechanism of Magento API.

System: Magento 2.2.x


texts: frontend and admin not working magento 2.4.2 upgrade

texts:
Frontend and admin doesn't work or show only 404 not found pages
It is installed in a sub directory of root folder
The development in command line everything works
I can change the .htaccess file , it shows a little better but doesn't work
Cannot find any help yet, because not many have this issue or installed 2.4.2 yet
Guess that it has to do something with being a subfolder and new htaccess
Anyone has an effective solution?
Having front on takoda.shop and backup at takoda.shop/backup so working on 2 sites at the same time


texts: How to get quote object through customer id in magento2?

texts:
When customer login through customer id i have to get quote object.
In magento i have written this code.but in magento2 how to get quote collection.or quote id of that customer.

$quoteCollection = Mage::getModel('sales/quote')->getCollection()
                ->addFieldToFilter('customer_id', $customerId)
                ->addFieldToFilter('store_id', $store)
                ->addOrder('updated_at');
            $quote = $quoteCollection->getFirstItem();
            $quoteId = (int) $quote->getId();


texts:
I am getting magento cronjob error for indexing from this week i dont know how to get rid of i tried setting up cron like:

  sh /home/jsbfurniture/public_html/cron.sh

  sh /home/jsbfurniture/public_html/cron.php

  sh -f indexer.php reindexall


texts:
in magento 1 it was possible to instatiate objects on the fly:

foreach($modelCustomerAccounts as $modelCustomerAccount){
            $modelCustomer = Mage::getModel($customerModelClass);
            $customers[] = $modelCustomer->load($modelCustomerAccount->getCustomerId());

or

  public function createObjectOnTheFly($modelName,$model)
    {
        $newObject = Mage::getModel($modelName . "/$model");
        return $newObject;
    }

However the preferred method to instatiates objects in magento 2 is via Dependency injection factories:

  public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Catalog\Model\CategoryFactory $categoryFactory,
        array $data = []
    )
    {
        $this->_categoryFactory = $categoryFactory;
        parent::__construct($context, $data);
    }

my question is how can i now dynamically instantiate objects on the fly in magento 2 bearing in mind that its recommended that objects instantiation is done via a factory method passed
 through the constructor


texts: Does composer update remove extra files from extension folder?

texts:
I have installed an extension with composer and we have added custom translation files to the extension folder. If I update the extension with composer, do those extra files get wiped away or do they stay in place?

Another solution would of course be to put those files into our custom theme's folder, but my question still stands.


texts:
Hi I have some cross sells that appear after adding to basket, when setting the "position" attribute in the backend for each cross sell it does not affect their actual order frontend!

The code is

  <?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?>

What can I add to this to get $_product->getCrossSellProducts() in order of their position?

I tried the following but get a blank popup so obviously errors.

  <?php if($_crossSellProducts = $_product->getCrossSellProducts()->addAttributeToSort('position')): ?>

Thanks!


texts: magento 2 How to get registration page custom value on my account frontend

texts:
Currently Using magneto 2.3

  Already add a custom field [Spouse Name] on registration page

  Now i want to show on my Account frontend. How to show??


texts: Magento2: Need to show image from image asset folder in block file

texts:
I need to show image from the images asset folder in the
block file.

  app\code\Abc\Mkt\Block

Here is my file path and code:

namespace Abc\Mkt\Block;

use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;

class Orderfield extends Field
{

    public function __construct(
        Context $context,
        array $data = []
    ) {

        parent::__construct($context, $data);
    }
    public function render(AbstractElement $element)
    {
        $html='

';
        return $html;
    }
}


texts: Magento 2 - Delete all products with ID 140.000 and higher

texts:
We have a lot of duplicate products in our Magento 2 store, that we need to remove.
Now I am looking for a way or a sql query to remove all products from id 140.000 or higher.
So all products from 1 to 140.000 should remain.
How can we achieve that?


texts: manual backup information needed in admin

texts:
I have just done a database backup in admin but I now want to do a manual backup. Can you tell me where do I find this in admin?

To back up, find phpMyAdmin in the hosting control panel and choose “export” from the menu bar. In many cases you can stick with the “Quick” option, but, if you have more than one database in the same MySQL install, for example, choose the “Custom” option and find the relevant database in the drop-down list. Unless you know what you’re doing, leave the other options alone. Scroll to the bottom of the page, and click “Go”. A dump of the database will be downloaded and you can store it with the files you downloaded earlier or somewhere else


texts: Change the main/root page to a custom page

texts:
How can I change the root/main page of Magento 2 Luma theme to a page of my design? and how to move the root/main page to http://127.0.0.1/OldRootPage?

please use simple detailed words ... I'm not deep in this :)


texts: Getting data from customer attribute checkbox type in Magento 1 issue

texts:
I created a customer attribute with Text field as an Input Type . I selected the Show on Frontend on Yes . I went to the register phtml file and I added:

<input type="checkbox" name="my_attribute_code" checked title="Custom Text" id="my_attribute_code" >

If I checked my checkbox in the post request I got the value on If I do not check it , it is an empty array. The fact is that in customer_entity_varchar table for my attribute the value column is always empty . Why ?
If i checked my checkbox I would expect to have the on value in the table.


texts: Error parsing headers: duplicate header 'Content-Type' from DashboardController tunnelAction

texts:
I'm getting an apache error saying that I have duplicate headers for 'Content-Type'. I see that the tunnelAction function correctly adds the header Content-Type:image/png, but instead of passing in the parameter to replace the original header, it just appends it to the list. Here is the current code below:

$response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL)
                        ->setParameterGet($params)
                        ->setConfig(array('timeout' => 5))
                        ->request('GET');

                $headers = $response->getHeaders();

                $this->getResponse()
                    ->setHeader('Content-type', $headers['Content-type'])
                    ->setBody($response->getBody());

$headers['Content-type'] is "image/png", but it's not passing in a 3rd boolean parameter to replace the existing header "text/html". I'm wondering if adding my own route to handle this request would be the right fix?


texts: When customer Cancels Recurring Payment in Magento, will it cancel PayPal?

texts:
I have a few Recurring Profiles in my Magento store, and have it attached to PayPal in sandbox mode. It appears that when I as a customer go to my (Magento) store account, go to Recurring Profiles, and Cancel it, PayPal continues to charge me. This would be horrible customer experience. Is it supposed to also cancel PayPal, or is this how it is intended to work?

If intended, how should the merchant assure the customer can intuitively cancel their subscription? Do I need to manually check every day for cancelled subscriptions, and send them an e-mail on how to also cancel in PayPal? :(

I'm on Magento 1.9.2.4


texts: How to load a model using a value of an array?

texts:
Using this code

$recurringProfile = Mage::getModel('sales/recurring_profile')->load(431);

I get

Array
(
    [profile_id] => 431
    [state] => active
    [customer_id] =>
    [store_id] => 1
    [method_code] => novalnetCc
    [created_at] => 2017-09-24 23:22:17
    [updated_at] => 2017-09-24 23:22:22
    [reference_id] => 13599300000202558
    [subscriber_name] =>
    [order_item_info] => Array
        (
            [item_id] => 3234
            [quote_id] => 2897
            [created_at] => 2017-09-24 23:14:33
            [updated_at] => 2017-09-24 23:14:33
            [product_id] => 22
            [store_id] => 1
            [parent_item_id] =>
            [is_virtual] => 0
            [sku] => 1111111
            [name] => Free Test

        )
)

As you can see, the order_item_info array has [quote_id] => 2897. How can I load the model (or collection model) differently using the quote_id solely as the parameter.


texts: The value specified in the URL Key field would generate a URL that already exists.To resolve this conflict

texts:
i am working with Magento 2.4 , initially i have uploaded all the products to the "DEFAULT CATEGORY" via csv, and afeterwards I tried to update a new category name for each product using CSV in this new CSV i used just with SKU and CATEGORIES columns.
before updating always check the file with the CHECK DATA button and it shows me ok no errors... BUT after importing it just update 100 products and shows me this error:
General system exception happened Show moreAdditional data:  The value specified in the URL Key field would generate a URL that already exists.  To resolve this conflict, you can either change the value of the URL Key field (located in the Search Engine Optimization section) to a unique value, or change the Request Path fields in all locations listed below:.................................
note:
**ALL MY PRODUCTS NAMES ARE UNIQUE..!!
** I MUST TO USE CSV TO UPLOAD OR UPDATE ANY PRODUCT
hope you could understand my inconvenience and be glad to know if you know how to solve it..
best regards,


texts: On the checkout/#shipping page there is NEXT button. Where in code is ajax fired for that button?


texts: iframe in backend: check if backend user is logged in

texts:
I'm using Magento 1.9.

I have created a module and added a page in the backend that can be accessed by the menu. This page contains an iframe (declared in a phtml file) which loads an own application. The php files of this application are on the same server.

Everything works fine so far. However, I have a security issue. The application in the iframe could be accessed by calling the php script directly if the URL is known. And this shouldn't be possible.

Now I think the best what I could do is to check if the caller of the script is a logged in backend user. Right? But I'm not sure how to do this.

I have done the following in the phtml file:

<iframe src="/path/to/app.php" frameborder="0" width="100%" height="1000px"></iframe>

And in app.php:

require_once('../../app/Mage.php');
Mage::app();
$session = Mage::getSingleton('admin/session');
$session->isLoggedIn();

But isLoggedIn always returns false. What do I have to do to make it work correctly? As a newbie I don't have any clue.


texts: Magento2 no value in minicart Itemscount on some pages

texts:
For performance reasons I removed the knockout functionality to get the total number of articles in my cart. By using the Magento\Checkout\Helper\Cart helper

On some pages the count of articles in my minicart is always 0. While on other pages (url.com/cart and url.com/contact) the count is showed correct.

Does somebody know what the problem is?

minicart.phtml

<?php
$cartHelper = $this->helper('Magento\Checkout\Helper\Cart');
?>

        <?php echo $cartHelper->getItemsCount(); ?>

        <?php if($cartHelper->getItemsCount() == 1): ?>
            <?php /* @escapeNotVerified */ echo __('Artikel'); ?>
        <?php else: ?>
            <?php /* @escapeNotVerified */ echo __('Artikelen'); ?>
        <?php endif; ?>


texts: Images are not displaying from custom email template on localhost in Magento 2?

texts: I am getting image in my custom email template but image is not showing in email sent from my localhost. I just need to know why the images are not loading/visible in my email?


texts:
I add custom billing address below shipping address in checkout. Before I choose the payment method I have filled in 2 different shipping and billing information. But one thing is that after I refresh the page, billing data is lost and it takes billing data. So who has a good solution to help me?

Before:

After refresh page:


texts: Remove top navigation bar from top and make it on left side in magento 2

texts: I want to remove top navigation bar from top and make it on left side in magento 2 also my directory structure is this as in image . could any one suggest any plugin or total step by step coding. I'm having a hard time finding a solution to this


texts: Redirect to cms page if searched product is not found

texts:
I need to redirect the customer to a cms page if the product customer searches are not found and if the product is found then Magento redirects it to result in a page which is the default functionality.

How can I prevent redirect to result in the page if no product matches search query?

Can someone please help me out with this.


texts:
How to save customized field of  sales_flat_quote_items table's in sales_flat_order_item table?

 <fieldsets>
    <sales_convert_quote_item>
        <recipients_name>
            <to_order_item>*</to_order_item>
        </recipients_name>
    </sales_convert_quote_item>
    <sales_convert_order_item>
        <recipients_name>
            <to_quote_item>*</to_quote_item>
        </recipients_name>
    </sales_convert_order_item>
    <sales_convert_quote_item>
        <recipients_email>
            <to_order_item>*</to_order_item>
        </recipients_email>
    </sales_convert_quote_item>
    <sales_convert_order_item>
        <recipients_email>
            <to_quote_item>*</to_quote_item>
        </recipients_email>
    </sales_convert_order_item>
</fieldsets>

But no effect.


texts: How to change payment method title on checkout page?

texts: We would like to change the payment method group name on the checkout page in the magento2.3.5 version? Can anyone advise


texts: CatalogRules: calcProductPriceRule ignores Rule Priority

texts:
The method calcProductPriceRule in Mage_CatalogRule_Model_Rule can be used to apply product rules on a specific (custom) price. Unfortunately, this method does not apply the rules according to their priority. In my opinion that is because the method getRulesFromProduct() within the corresponding Resource-Model-Class does not add a "order by" condition.

Does anyone know if this is by purpose or just a bug?

PS: We do need to manipulate the price based on complex configuration options - that is why we want to call the calcProductPriceRule-Method.


texts: How to change all products titles in Magento 2?

texts:
How to change all products titles using script or coding in Magento 2.
I need to change all the products title on product description page.


texts:
How to get all the customer wishlist items in magento using admin panel.???

I want to get list of products which is been wishlisted by customers..


texts: How to customize ImageUploader component?

texts:
I am currently using an ImageUploader in a dynamic rows element. However, I have a couple of obstacles I need to overcome:

1) How to remove the "Upload" button?

2) When using the "Select from Gallery" feature, I can see the image I chose in the preview, but when I enter the product again this data is empty (I can't see the image in the preview square) - is there any mapping I'm missing?

3) How can I remove the upper "Image" label?

In the image below you can find what it looks like now, and highlighted in red are the sections I want to hide/remove.

Thank you all for your assistance.


texts:
I have the following Magento 1 code and i would like to know the Magento 2 equivalent of the code.

I've looked around on the web but unable to find a proper solution.

  Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);


texts:
Magento comes with the 'Default' group, but it is possible to create new groups based in attributes of 'Default' group.

I need get the names of the groups existing.

Example:

I have 3 groups, 'Default', 'Test', 'Test2' both have the
same tabs and attributes of 'Default'.

I want to generate a loop that returns me the three names, 'Default', 'Test', 'Test2' and not your tabs and attributes

I am creating a new attribute in my module, and precisso it to appear in all groups, so far only got on 'Default', because  not  got successful in getting the names of the groups.


texts: Add Custom Collection Pagination to Existing Category Page

texts:
To add pagination to a custom product or category collection in my magento store I've created a custom module. I then configure the toolbar, pager etc in my _prepareLayout() function in NameSpace_Module_Block_Collection. The URL of the page the module will be used on is then defined in etc/config.xml like so:

<?xml version="1.0"?>
<config>
    <modules>
        <NameSpace_Module>
            <version>0.1.0</version>
        </NameSpace_Module>
    </modules>
    <frontend>
        <routers>
            <collection>
                <use>standard</use>
                <args>
                    <module>NameSpace_Module</module>
                    <frontName>page-url-goes-here</frontName>
                </args>
            </collection>
        </routers>

My problem though is what if I want to do the above, but on an existing category page - Category X

On my category page: www.website.com/category-x/

I have the display mode set to static block only. The block content is:

{{block type="catalog/navigation" template="xxx/xxxx.phtml"}}

With this page calling a custom category collection

Is it possible to apply pagination to my custom collection but keep my category url page. Ideally I need to do so without using a redirect


texts: SQL is_in_stock field not updating to Website

texts:
I am updating is_in_stock field in cataloginventory_stock_item as follows:
UPDATE cataloginventory_stock_item ci SET ci.is_in_stock = CASE WHEN ci.qty = 0 THEN 0 WHEN ci.qty > 0 THEN 1 END WHERE product_id in (1968,1969);
I then Reindex All & Flush Cache: Changes have been applied to cataloginventory_stock_item
& cataloginventory_stock_status
But Products are still showing Out of Stock on website
Note: If I go to Magento Dashboard -> Catalog -> Products
and mark the product Out of Stock and then back to In Stock it works.
(But I don't want to do this for 2,000 products)
Any ideas?
Thanks in Advance!


texts: change list.phtml without changing core list.phtml

texts:
I've placed some coding in list.phtml in /app/design/frontend/ultimo/default/template/catalog/product
but I would like the core file not to be changed. Can somebody help me with this or is there a simple tutorial how to do this?


texts: Magento Installation Wizard screen after installing SUPEE-5994 patch

texts:
After installing the SUPEE-5994 patch, (http://magentary.com/kb/install-supee-5994-without-ssh/) I get redirected to \downloader\ with the Magento Installation Wizard screen.

What do I do now?


texts: What are the correct file permission settings for magento 2.2 on a single-user production environment?

texts:
I am setting up a Magento 2.2.5 instance on a production environment (single-user / shared hosting). When it comes to file permissions, I found two documentation pages:

https://devdocs.magento.com/guides/v2.2/install-gde/prereq/file-system-perms.html
https://devdocs.magento.com/guides/v2.2/config-guide/prod/prod_file-sys-perms.html

When following the instructions for a shared hosting environment at the first link, everything is fine. But, I assumed I had to follow the instructions at the second link as well since I am configuring a production environment. As soon as I run the command to "Make code files and directories read-only", I get an error like this: Backend fatal error: PHP Fatal error:  Uncaught Zend_Cache_Exception, because cache_dir var/page_cache is not writable.

This seems logical since the command made var read-only.

So, is the documentation wrong? Or should I somehow only follow the documentation at the first link, not the second?


texts: To remove product review tab in product page in magento 2

texts:
I need to remove review tab in product page.Please suggest a solution
catalog_product_view.xml in my custom module

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="reviews.tab" remove= "true"/>
        <referenceBlock name="product.info.review">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">XXX_YYYY::review.phtml</argument>
            </action>
            <block class="Magento\Framework\View\Element\Template" name="custom.review.popup" template="XXX_YYYY::popup.phtml">
                <block class="Magento\Review\Block\Form" name="custom.product.review.form" as="custom.review_form" template="XXX_YYYY::form.phtml"/>
            </block>
        </referenceBlock>
    </body>
</page>


texts: Magento 2 REST API get all enabled categories

texts:
Wanted to use REST API to get all categories where is_active attribute is true.

Here is endpoint I am calling https://www.domain.com/rest/default/V1/categories

Which giving me all the categories is_active is true and false.

I tried to add filters but didnt work either.

https://www.domain.com/rest/default/V1/categories?searchCriteria[filterGroups][0][filters][0][field]=is_active&searchCriteria[filterGroups][0][filters][0][value]=true&searchCriteria[filterGroups][0][filters][0][conditionType]=eq

Could someone help how to apply filter on category to get only active categories?


texts: How to find scss file for css file ? Magento 1

texts:
I have changes in a css file
/var/www/www.site.com/skin/frontend/site/site/css/styles.css

But i did not find this file in local.
How do i find the valid relevant css for it ?


texts: Which css format is best for Magento 2 theme?

texts:
I am aware that Magento 2 uses Less CSS Format, I have just one daught what if I am use Sass CSS?

Can anyone please answer below questions.

What if I am using a simple CSS format?
What are the benefits of use Sass CSS?
Which CSS format is preferable to improve theme performance?

Thanks in advance..!


texts: Filter magento product collection by category id but NOT category children

texts:
I am retrieving a product collection and filtering the list by category.

I have just had to add some sub categories to one of them and now the products in the sub-categories are appearing in the collection for the parent category and I cannot work out how to only show products directly assigned to the parent category.

Here is an example of the code:

$cat = Mage::getModel("[custom-namepace]/Categories"); //this just extends the native Categories model
$cat->load($catId);  //some number
$products = Mage::getResourceModel("catalog/product_collection")
                ->setStoreId(Mage::app()->getStore()->getId())
                ->addUrlRewrite()
                ->addCategoryFilter($cat)
                ->setOrder("name","asc");

I am unable to add a filter on category_id as that causes an error. I have tried:

->addAttributeToFilter("category_id",$cat->getId())

and

->addAttributeToFilter("category_id",array("eq"=>$cat->getId()))

and

->addAttributeToFilter("category_id",array("in"=>$cat->getId()))

These all throw a fatal error like.

  Fatal error: Call to a member function getBackend() on a non-object in  [...]\app\code\core\Mage\Eav\Model\Entity\Abstract.php on line 816

Any pointers on how to avoid picking up products in child categories?

UPDATE

I have now also tried to get the products list through the category and I still get products from the child categories.

$products = $cat->getProductCollection()
                ->addAttributeToSelect("name")
                ->addUrlRewrite()
                ->setOrder("name","asc");


texts: remove items from cart in controller - magento2

texts:
I need to remove all the items from cart, below method remove the items in chenckout/cart/index page but header minicart section still dispaly the items even after refresh page too.

I have try this logic in custom controller app/code/Gworks/Cart/Controller/Items/Remove.php

public function deleteQuoteItems(){
    $checkoutSession = $this->getCheckoutSession();
    $allItems = $checkoutSession->getQuote()->getAllVisibleItems();//returns all teh items in session
    foreach ($allItems as $item) {
        $itemId = $item->getItemId();//item id of particular item
        $quoteItem=$this->getItemModel()->load($itemId);//load particular item which you want to delete by his item id
        $quoteItem->delete();//deletes the item
    }
}
public function getCheckoutSession(){
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();//instance of object manager
    $checkoutSession = $objectManager->get('Magento\Checkout\Model\Session');//checkout session
    return $checkoutSession;
}

public function getItemModel(){
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();//instance of object manager
    $itemModel = $objectManager->create('Magento\Quote\Model\Quote\Item');//Quote item model to load quote item
    return $itemModel;
}

after some search, I am trying to refresh minicart section using <custom-module>/etc/sections.xml but still the problem exist.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
    <action name="checkout/cart/index">
        <section name="cart"/>
    </action>
</config>

it confuse me, what I need to mention in action name. Actually I delete all item from  checkout/cart/index page and their delete logic in separate ajax call in my custom controller gworks/items/remove. I tried both but nothing happen.

can anyone give a neat way to entirely remove all items from cart?

note: I know object manager is not recommended, If it is worked after that I can change to dependency injection method.


texts: How to list configurable product options in grid magento 2 product details page

texts: Is there any way to list all configurable options in grid view of product details page using custom module instead of showing in select box, so that user can add multiple products to cart in one step.


texts:
I am doing installation of one  module in fresh magneto setup on my local
first time installation time after running the setup upgrade command it showing "Area code is already set"
and again run the same command it showing "Unique constraint violation found"
what is an issue


texts:
Is it possible to create bundled products where Magento automatically gets the pictures for the simple products and shows in the gallery under the main picture?

If yes, how?


texts: Why so many tables for single entity in EAV model

texts: In magento EAV model, I want to know why we need to create so many tables depending upon data type? And, how we going to use it?


texts: Magento2: Decimal Price in Chinese traditional language display [object Object] instead of dot

texts:
I have multi language store. default language is English. there are few products have decimal price.

when i switch language to Chinese it is working fine.But when i switch to Chinese traditional the  [object Object]  appears instead dot in decimal price.

for example: price: $69.95 in English when i switch language to Chinese traditional the price will look like Price: $69[object Object]95

i really wanna remove this , need . how to do that.?


texts: Magento 2.3.5 Content Security Policy false script src

texts:
Some external script cannot be whitelisted I have called this app/code/modul_modul/etc/csp_whitelist.xml

    <policy id="script-src">
        <values>
            <value id="unsafe-inline" type="host">https://www.googletagmanager.com</value>
            <value id="google" type="host">wwww.gstatic.com/recaptcha</value>

        </values>
    </policy>

Any idea, I need to be whitelisted Google recaptcha some external script


texts: Magento 2 - Product with Multiple Options with Quantity

texts:
I'm basically trying to have a product(t-shirt) with multiple sizes with its own quantity.
Like this;

Is there any extension or tutorial to do this please?


texts:
I would like to changes in checkout page address fields,

how to remove the fields or update, the code is knockout js.

How to modify this.

Thanks


texts:
Even if RSS is disabled, it looks like the source is still generating these:

<link href="x://www.xxx.com/rss/catalog/special/store_id/1/cid/0/" title="Special Products" rel="alternate" type="application/rss+xml"/>

Tried to search for application/rss+xml in the theme files but no avail. Any ideas where do trim / remove this? As google keeps generating hundreds of 404 pages cause the source links to things that do no exist

Removing that from \app\code\core\Mage\Page\Block\Html\Head.php did nothing either.


texts: How to add Stock Status(default attribute) column in admin product grid Magento 2?

texts:
I want to add product stock status field in product grid and in filter options. How can I achieve this?

I am using Magento CE 2.1.4.


texts: M2 Confirmation Mail: prefix won't translate

texts:
Customers are saved in the DB with prefix "Mr." or "Mrs.".
Registration Confirmation Email Template looks like this

 {{template config_path="design/email/header_template"}}

{{trans "%prefix" prefix=$customer.prefix}} {{trans "%firstname" firstname=$customer.firstname}} {{trans "%lastname," lastname=$customer.lastname}}

{{trans "You must confirm your %customer_email email before you can sign in (link is only valid once):" customer_email=$customer.email}}

de_DE.csv like this

"Mr.","Herr"
"Mrs.","Frau"

Rebuild everything, still not translating "Mr." to "Herr"

Any Tipps?


texts: Captcha image is not showing at admin login

texts: This has just started happening, I can't login to the backend as it won't let me past the Catchpa which is showing as a broken image. How can I get in?


texts: Magento 1.9.3.4 USPS API First Class No Longer Working

texts:
Just noticed today that First Class Package no longer works and won't
  quote customers for shipments under 16oz.

  Looks like the USPS changed their API for First Class to First-Class
  Package Service - Retail from First Class Mail Package according to
  the USPS debug log file.  0_FCP was resulting in the wrong description
  so First Class USPS wasn't being offered to customers.

Edited app/code/core/Mage/USA/Model/Shipping/Carrier/Usps.php

line 703

was: 'First-Class Mail Parcel' => '0_FCP',
now: 'First-Class Package Service - Retail' => '0_FCP',

  Now USPS First Class is again being offered to customers.  Leave
  'First Class Mail Parcel' highlighted in Admin so the service is
  correctly calculated and offered as only this selection uses 0_FCP.  Your customers will now see First Class Package Service - Retail when First Class Package is offered.  Also, be sure to clear /var/cache or your Magento cache in Admin if the results don't appear.  Sorry, can't assist with Magento2.

  Has anyone else tested for this issue (it did not exist yesterday
  during checkouts) which appeared this morning?

Also wondering why this occurred and if I missed anything in the file edit.

EDIT:  Bad news is my fix will only pull First Class package rates for 12oz max (retail), however commercial discounted rates (if you use a PC Postage Product eg. Stamps or Endicia) which maxes out at 16oz is unavailable. This service will be named: 'First-Class Package Service - Commercial' which Magento doesn't have a code for.  So, here's the current situation:

If you don't use the fix above, you can't display or retrieve First Class Package rates for your customers
If you use the fix above, anything over 12oz will use Priority Mail rates and First Class rates will not appear in your cart

Currently there is no way to pull USPS First Class Priority Commercial rates using Magento.

Not sure if Magento is aware of this or if/when this will be fixed.


texts: Item (Mage_Admin_Model_Block) with the same id "0" already exist

texts:
When I am trying to add new block permission from System->Permission->Blocks->Add New Block .
Can any one tell me that how can I recover from this error.
Magento Version : 1.9.3.4


texts: add block to Authorize.net payment template

texts:
in the app/design/frontend/base/default/template/payment/form/cc.phtml template, around line 76, there is a spot to echo out child html.  how do I reference that block to add a child into it?

I'm trying to add a section in my layout class, but it doesn't appear to be working correctly.

<?xml version="1.0"?>
<layout version="0.1.0">
    <checkout_onepage_index>
        <reference name="payment.method.authorizenet">
            <block type="abt_authnet/foo_bar_baz" name="foobar" as="foobar" template="abt/foobar.phtml" />
        </reference>
    </checkout_onepage_index>
</layout>

Am I doing this wrong?  my feeling is I'm referencing the wrong block?


texts: Programmatically create admin order with pre-populated basket & customer

texts:
I'm working on a quote system where I want the admin to be able to activate it, which will then forward them to the create new order page in Adminhtml, sales_order_create.

I want this page to already have a customer assigned & products selected.

Edit:

I'd like to be able to pre-populate the quote for the Adminhtml page for creating an order.

Here's an example of creating a cart quote on the front-end:

$cart = Mage::getModel('checkout/cart');
$product = Mage::getModel('catalog/product')->load($productId);
if ($product){
    if ($product->isSaleable()){
        $cart->addProduct($product, array('qty' => $qty));
    }
}
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
$cart->save();

I want to do this, but in the backend (sales_order_place)

I'm looking at the code in app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php and it looks like adminhtml/session_quote would be the model I'd be aiming to use.

So the workflow would be:

Set up quote object
Call $this->redirect('*/sales_order_create');
The admin will then be redirected to the create new order page with a customer already selected and the basket already populated with products

Would really appreciate some input.


texts:
In magento 1 We are using admin session like this

$user = Mage::getSingleton('admin/session');
$userId = $user->getUser()->getUserId();
$userEmail = $user->getUser()->getEmail();
$userFirstname = $user->getUser()->getFirstname();
$userLastname = $user->getUser()->getLastname();

In magento 2 how can i get this detail ?


texts: Magento 2: How to stop event/observer if another already ran

texts:
I have 2 events running if subscribe to newsletter is checked on the checkout page.

sales_model_service_quote_submit_success
newsletter_subscriber_save_after

Can i prevent event #2 from happening if event #1 has already ran?


texts: How to get child simple Product Obj from configurable Sales Order Items

texts:
I want to get Configurable child simple products from order items.How can I get child simple Product from the configurable product?
I want to fetch only simple product object which associated with configurable product in order items

Here is my code.I can not fetch together configurable product Id and its associated child simple product object.

echo "<pre>";
$items = $order->getAllItems();
foreach($items as $item){
print_r($item->getProduct());
}


texts: Display all associated simple products, even if all of them are out of stock

texts:
Magento default behavior:  With option System > Configuration > Inventory > Display Out of Stock Products enabled, when configurable product has at least 1 associated simple product In Stock, then the rest simple products that are Out of Stock are "grayed out" but still visible.

In case when all simple products under the configurable are out of stock, no options(swatches) are shown whatsoever.

I would like to display all associated simple products, even if all of them are out of stock.

The same question has already been asked here, and I have tried it -

  Showing Out of Stock variants(simple) when all variants are out of stock?

But the answer provided was at least incomplete, I get the same result as the author of the question in his comments. Any suggestions?


texts: How can we set a google font family as a base font for the magento store

texts:
I have added the google font to my custom Magento 2 theme in default_head.xml file. Now I need to set the font family as my base font

Where do I need to set the font family?


texts: Hide stock status on product page depending on other product attribute

texts:
I have a dropdown product attribute named: shine_fine .
i want to hide stock status from product page when any option from shine_fine attribute is selected. i don't want to disable Magento stock status i just want to hide it.

update:

this is my shine_fine attribute code in view.phtml:

<?php if($_shineFine = $_product->getAttributeText('shine_fine')): ?>
    <img src="/media/atticons/<?php echo $_shineFine ?>.png">
<?php endif; ?>


texts: Magento 2.2.2 Where did var/generation and var/di go?

texts:
I've recently upgraded from 2.1.8 to 2.2.2 CE(Commerce). Seems that var/di and var/generation are nowhere to be found.

Also did the logic behind the code generation changed ? I've noticed some high dependencies on the order of the Child Classes constructor parameters in PHP Dockblock. Above order of parameters in dockblock (/.../) making the difference between a successful generation and a failed one.


texts: Add custom address attribute to checkout

texts:
I create custom address attribute, same as suggested here:
https://codeblog.experius.nl/magento-2-add-extra-billing-or-shipping-field-to-the-checkout/

But when I place an order there is error occurs:

Property "Example" does not have accessor method "getExample" in class "Magento\Quote\Api\Data\AddressExtensionInterface".

I know that this accessor must be in generated/code folder but it's empty there, I don't understand why it's not creating after I run di:compile. All other modules creating well.

This code must create it as well:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\AddressInterface">
        <attribute code="example" type="string"/>
    </extension_attributes>
</config>

Can you help, please?


texts: How to add a custom jquery file for custom shipping additional file in magento 2

texts:
I have created a custom shipping method + shipping form like below.

I want to add click event for the check box.

I tried this code in my phtml file.

<script>
require(
    [
        'jquery',
        'Magento_Ui/js/modal/modal'
    ],
    function(
        $,
        modal
    ) {

        $("#chk_shipusgovt").click(function(){
            if($(this).prop("checked") == true){
                alert("Checked");
                document.getElementById("txt_shipusgovt").style.display = "block";
            }

            else if($(this).prop("checked") == false){
                alert("Not Checked");
                document.getElementById("txt_shipusgovt").style.display = "none";
            }
        });
    }
);

This is not working, how can i add this JQuery function to be work.Great help if any one can help me to short it out this issue.