texts: Session in api-functional tests isLoggedIn always returns false

texts:
I have a function in an API call that checks $this->session->isLoggedIn().

The session-object is injected via the consturtor.

Now I have to write an api-functional test. But I just can't login the customer and isLoggedIn() will always return false in my service. My test-code currently looks like this:

    $historyId = 1;
    $download = 0;

    $serviceInfo = [
        'rest' => [
            'resourcePath' => '/V1/preorder-history/view/' . $historyId . '/' . $download,
            'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
        ]
    ];

    $loginInfo = [
        'rest' => [
            'resourcePath' => '/V1/customers/me',
            'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
            'token' => $this->token,
        ],
    ];

    $requestData = [
        'historyId' => $historyId,
        'download' => $download,
        'token' => $this->token
    ];

    $customer = $this->_webApiCall($loginInfo, $requestData);

    /** @var $session \Magento\Customer\Model\Session */
    $session = Bootstrap::getObjectManager()->get(\Magento\Customer\Model\Session::class);
    $session->loginById($customer['id']);
    $session->setCustomerId($customer['id']);

    $item = $this->_webApiCall($serviceInfo, $requestData);

EDIT:

within my test, the session object obviously returns that the customer is logged in. So I assume this is not the same object that is injected in my service which I want to test.

EDIT2:

spl_object_hash confirms this theory.


texts: After Installing and setup the Magento 2.3 how to run PWA in local ?


texts: site - is currently unable to handle this request Http error 500

texts:
once i clicked on "Proceed to checkout" button, we are getting below error

The sitename.com is't working
www.sitename.co.nz is currently unable to handle this request
Http Error 500

even in backend when we open some orders, than also same error in order-view page.

we are using hostgator for shared hosting.

Edit

It was the problem with one of checkout related file reset to 000 permission. once i gave 644 permission, it again start to work. but this problem is happening frequently.

why file is resetting to 000 permission


texts: Magento 1 How to modify transactional email template?

texts:
I need to add one more new variable in the Order email template, can anyone suggest me where to go (path) and edit the template?

Actually, what I want to do,

In the product page need to display the dropdown beside "Qty" dropdown which is mandatory, if the user didn't select the couldn't allow to next step add to cart
Based on the selection I need to bring that value to the front end in the order template, which show's the snapshot.


texts: How to calculate and store shipping rate in Magento 2.3.0?

texts:
I'm using Magento v 2.3.0.
I am trying to skip Shipping Address section and navigate directly to Payment section if customer has a default address.
I have overridden below class to change the link of checkout url

Magento\Checkout\Block\Onepage\Link

Function overridden

getCheckoutUrl

Now I also use the checkout session in above overridden class to get the quote and set the shipping address in it.
I use tablerate_bestway as shipping method.
How do I set the shipping method and recalculate the shipping rate and save it in the quote?


texts: Magento 2 How to set product minimum quantity selected to minimum qty configured in the Advanced Inventory product level

texts:
If 5 is the minimum Qty on Advanced Inventory product level for a product then in Product detail page it should as 5 default selected.

How can I achieve this.


texts: Setting Pdo_Mysql Driver Options through local.xml

texts:
The context for my question: forcing Pdo_Mysql driver for Magento to use SSL connection to an Amazon AWS RDS instance. The database user is set to use only SSL connection.

In order to use SSL connection, PDO::MYSQL_ATTR_SSL_CA must point to the public certificate in the client.

If I define the property manually in the Zend_Db_Adapter_Abstract, then I get the following array :

Array
(
    [use] =>
    [host] => *.rds.amazonaws.com
    [username] => user
    [password] => pass
    [dbname] => magento
    [initStatements] => SET NAMES utf8
    [model] => mysql4
    [type] => pdo_mysql
    [active] => 1
    [charset] =>
    [persistent] =>
    [options] => Array
        (
            [caseFolding] => 0
            [autoQuoteIdentifiers] => 1
            [fetchMode] => 2
        )

    [driver_options] => Array
        (
            [1012] => /path/to/amazon/cert/mysql-ssl-ca-cert.pem
        )

    [port] => 3306
)

Since most of the fields in the above array match the 'connection' node in the local.xml config file, I should be able to define 'driver_options' as follows:

<driver_options>
   <1012>/path/to/amazon/cert/mysq.pem</1012>
</diver_options>

Of course this is invalid and using variations of 'PDO::MYSQL_ATTR_SSL_CA' instead of 1012 isn't useful either. Has anybody managed to set this value either through XML or otherwise? I am trying to avoid rewriting any of the lib/Varien classes.


texts: Magento2 : How to call background image in PWA

texts:
I have created one Static block and added below content in and need to add arrow above TEST text.

Test

Test

Test

Test

Like below image

Anyone have idea how can I add arrow using css in PWA Magento2


texts: swatches with infinite scroll for category pages

texts:
I am creating an infinite scroll for category pages in magento 1.9.2.

the crux of it is

    jQuery.ajax({
        url: pageurl+'p='+next,
        success: function(result){
            jQuery('#page_' + next).html(jQuery(result).find('.products-grid'));
        }
    });

the problem I am having is when a product with configurable swatches is loaded the swatches do not work.

any ideas how to work around this


texts: Override Magento_UI field and add custom js

texts:
I'm trying to override vendor/magento/module-ui/view/frontend/web/templates/form/field.html and apply a custom function from a custom js file. But the problem is I don't know how to link that custom js to this view. So what I did was to copy the field.html and add it to my app/design/frontend/Vendor/Theme/Magento_Ui/web/templates/form/field.html. Now the new HTML override is working I just need to link the Custom JS to this file. But don't know how to do this. Below is the original code of field.html

    ...

And I want to do something like this

    ...

As you have notice I added the KO condition hasCustomCard() now this function is from the Custom.js that I created in my app/code/Vendor/Module/view/frontend/web/js/custom.js but I don't know how to tell Magento 2 to look at this file when using the field.html file..
This is the code of my custom.js
define([
    'jquery',
    'ko',
    'uiComponent',
    'mage/url',
    'Magento_Checkout/js/model/quote',
], function ($, ko, Component, urlBuilder, quote) {
    'use strict';

    return Component.extend({
        initialize: function () {
          this._super();
        },
        hasCustomCard: function() {
          return quote.isVirtual();
        },
    });
});

Really appreciate any help on this one please. Regards.


texts:
I have created block for sidebar.

I have added below code in my block for compare products. It's working fine

    {{block class="Magento\Framework\View\Element\Template" name="catalog.compare.sidebar" template="Magento_Catalog::product/compare/sidebar.phtml" /}}

I got output like this: http://prntscr.com/n4jcsj

Now i want to show shopping cart items there above compare. Can anyone help me with this.

I also try with minicart but it is not working as per my requirement. It gives me only link of minicart. I need to show content of minicart. I used this code in block.

        {{block class="Magento\Checkout\Block\Cart\Sidebar" name="mini_cart" template="Magento_Checkout::cart/minicart.phtml"}}

Which gives me output like this : https://prnt.sc/n3h35j

Please help me if anyone has some idea about this.


texts: Cant Access a Value on Input or Button with type Submit

texts:
I want individual add to cart buttons for grouped products but keep the original add to cart button so that multiple products can be added to cart if needs be with a single click. This was fine without ajax as I did not need forms. Nested forms are not valid however worked perfectly for everything except the first grouped product so am trying to find an alternative.

I thought i could add a button for each product that will include the ID and then modify the controller for add to cart server side to detect this button was clicked and modify the array of IDs down to just the item which add to cart button was clicked with a plugin before the add to cart execute function or something along these lines.

I have only tested this with ajax add to cart however want a second button which will change functionality and so added below button:

<button type="submit" name="singleadd" value="<?= $_item->getId() ?>">Add</button>

The above however whether and input or button, when submitted the singleadd paramater is not available using $this->getRequest()->getParam('singleadd') or $_POST['singleadd'] to get the value. I believe I should be able to do this and am wondering why not.

Is this the way the ajax add to carts are working that are just not sending the submit type elements?


texts: Display product base image in .phtml template file

texts:
SOLVED (See my answer below)

How can I display product base image in .phtml template file?

$relatedProducts = $product->getProduct()
        ->getRelatedProductCollection()
        ->addAttributeToSelect(['price','name','image','status']);

Can I put addAttributeToSelect to use for this?

I found this in one other post, but it doesn't work (I put it in Block/Product.php and called it in view/frontend/templates/related_products.phtml , the getImage() part doesn't get added to URL):

public function getProductImageUrl()
{
    return $this->_storeManager->getStore()
        ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product' . $this->getImage();
}


texts:
On the front page, I have a few "top seller" products. They respond by URL such as : www.website.com/bed-1546.html and www.website.com/chair-1284.html
When I click on those links, the product is not loaded, but I do not get a 404.

If I go to www.website.com/bedrooms/bed/bed-1546.html or www.website.com/livingroom/chair-1284.html , the products load correctly.

If I go back to www.website.com/bed-1546.html the product loads, until I visit another product, then it doesn't load again.

The website is using Magento 1.7.0.2.

Any hint would be greatly appreciated.


texts:
I need to make sure only menu items i.e. categories with the flag Include in Menu set to true to be shown in the main  menu.

As far as I understood, using $category->getIncludeInMenu() should do the magic by returning the value. My calls always return Null.

Now I thought: if I can call the method getIncludeInMenu() it should return the right value. Otherwise this method is useless ;-/

Code extracts:
Menu.php

protected function getActiveChildren($parent, $level)
{
    $activeChildren = array();
    // --- check level ---
    $maxLevel = $this->getConfig('is_level');
    if(!$maxLevel) $maxLevel = 3;
    if ($maxLevel > 0)
    {
        if ($level >= ($maxLevel - 1)) return $activeChildren;
    }
    $childs = $parent->getChildrenCategories();
    if (count($childs))
    {
        foreach ($childs as $child)
        {
            if ($child->getIsActive())
            {
                array_push($activeChildren, $child);
            }
        }
    }
    return $activeChildren;
}

When I change
if ($child->getIsActive())
to
if ($child->getIsActive() && $child->getIncludeInMenu()) all categories are hidden because getIncludeInMenu() return Null all the time...

Any hint appreciated.


texts: How to add an ajax reload script to a sidebar block

texts:
I am using Magento 2.1.3 and I've made a block that contains a div with an id of "tableHolder", then I added this script to my themes html head:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>

<script>
jQuery(document).ready(function(){
      refreshTable();
    });

    function refreshTable(){
        jQuery('#tableHolder').load('table.php', function(){
           setTimeout(refreshTable, 60000);
        });
    }
</script>

It is basically a table that needs to be refreshed every minute in my sidebar on every page.

Problem is that I'm getting jquery conflicts but the noconflict trick isn't working.

Then I thought maybe I could use the built in jquery and read that I need to do something with requireJS but I have yet to find useful information on actually using it. All of the guides give you the code you need to use but do not tell you where to use it.. for example: https://magecomp.com/blog/how-to-use-built-in-jquery-library-in-magento-2/

Does anybody have any suggestions? I have been trying to get this to work for days!


texts: How to change the email address in Forgot admin password template?

texts:
Magento 3.2.1. In forgot admin password template it says support@example.com and in the sender it says "owner"

I know I can override the html, I just want to know how to change the variables, aren't those system wide variables? Where are they located? not in customer store -> customer.


texts:
I want to log all 404 page in magento 2. Recently we have moved from woo-commerce to magento 2 and all the product/category/pages URL are now changed.

We want to log all 404 Page URL and take appropate action.

Suppose if a user clicked an old URL on search and got 404 on the website we want to log that url and want to redirect the user to corresponding new url for that page

So do anyone know the observer for 404 Event


texts: importing 12M products into magento2 instance?

texts:
For client, it is required to import 12M products into magento2 instance and I wonder, if it can handle such big dataset ?

The hosting platform is siteground's cloud, I insisted that customer should use dedicated server for this purpose but he wants to stay on this cloud platform.

Indexing is quite slow on one million, so I wonder is importing of this database is possible at all ?

Do anyone have experience with that huge lists of products?

Magento2 is CE of course, for importing i use custom edited magmi for magento2 which is working fine.


texts: Magento show tax rate for each tax - magento 1.9

texts:
System - configuration - Sales - Tax - Shop display Settings set to Yes the option "Display Full Tax Summary"
is showing tax like below

Grand Total Excl. Tax   Rs. 650.00
SGST (9%)
                                                              Rs. 117.00
CGST (9%)
Grand Total Incl. Tax Rs. 767.00

How to show each tax amount separately?

Grand Total Excl. Tax   Rs. 650.00
SGST (9%)                                 Rs.  58.5
CGST (9%)                                 Rs.  58.5
Grand Total Incl. Tax Rs. 767.00


texts:
Preconditions

php7.1

Steps to reproduce

I don't know why i in admin > setup upgradd >Update application is running ->will be show error upgrade. Did't suggest anything wrong?

Expected result

How to solve this issue?

Actual result

Update application is not running

Error in Update!
Please refer to documentation Doc link to perform manual rollback.

To attempt automatic rollback, please click the "Rollback" button.

[Module 'Magento_******':
Running schema recurring...Source class "\SignifydAvsDefault" for "SignifydAvsDefaultMapper" generation does not exist.

[2017-11-10 11:19:32 UTC] Job "setup:upgrade {"command":"setup:upgrade"}" has been successfully completed
[2017-11-10 11:19:32 UTC] Job "setup:static:regenerate []" has started

[2017-11-10 11:19:32 UTC] Cleaning generated files...
[2017-11-10 11:19:32 UTC] Clearing cache...
[2017-11-10 11:20:12 UTC] Cleaning static view files
[2017-11-10 11:20:12 UTC] Job "setup:static:regenerate []" has been successfully completed
[2017-11-10 11:20:12 UTC] Job "setup:maintenance:disable []" has started
Disabled maintenance mode

[2017-11-10 11:20:12 UTC] Job "setup:maintenance:disable []" has been successfully completed


texts: What is the event dispatching when abandoned cart save it's data?

texts:
I need to save some additional data in sales_flat_quote table. So what is the event which dispatching when the abandoned cart data saves in this table?

EDIT: I need to save item names comma separately in the sales_flat_quote table by adding a new column. Hope a data script can be used to fill the column. But How can I do this  without an event observer?

Please be kind enough to provide suggestions.

Thanks in advance.


texts: SUPEE-9767 - Hunk #1 FAILED at 225. 1 out of 1 hunk FAILED

texts:
Trying to install the security patch SUPEE-9767 onto M1 EE v1.13.1.0 and i'm receiving the following error:

  Hunk #1 FAILED at 225. 1 out of 1 hunk FAILED -- saving rejects to
  file
  app/design/frontend/enterprise/default/template/persistent/checkout/onepage/billing.phtml.rej

I've checked the line in file indicated in the error and here is the related block of code:

<div class="input-box">   <!--(this is line 255)-->
<input type="password" name="billing[confirm_password]" title="<?php echo
$this->__('Confirm Password') ?>" id="billing:confirm_password"
class="input-text required-entry validate-cpassword" />
</div>

Any help would be appreciated.


texts: Magento 2.3.0 Remove amazon pay button from different pages if current product in cart

texts:
I need to develop a feature in my custom module, I would like to hide Amazon pay button from product page, cart page, mini cart, shipping page upon condition.

If the current product is in the cart then hide Amazon pay button from the product page, cart page, mini cart, shipping page.

How can I achieve these things?. can someone help me to achieve these things.

Any help would be appreciated! Thanks.


texts: Getting current step in checkout in PHP in Magento 1

texts:
I got all of the steps using this:

Mage::getSingleton('checkout/session')->getData('steps')

But how do I get the current step? Not in prototype or js. I want it from PHP. I am using onestep checkout and ajax to get to the next step.


texts: How to get Creditmemo ID from sales_order_creditmemo_refund?

texts:
If I observe sales_order_creditmemo_refund event, there’s no entity_id or increment_id data in the passed object. I presume those are added before the sales_order_creditmemo_safe_after event.
However, if I use the latter, it fires even if I add comments to a previously saved credit memo.

Is there a way to distinguish whether the event is triggered after a freshly refunded credit memo or anything else, or to get Id from the _refund event?

Checking for a state is not an option as orders can have multiple credit memos.

Thank you!


texts: What should be the steps to be followed before working on a multistore website?

texts:
I am going to work on a Magento multistore website.
The site is already live , I need to setup a development environment and need to work on this development site.

What should be the steps which I should follow before starting to work this kind of setup?
Apart from checking the categories, are these different for all the stores? etc.


texts: Magento 2.3 color swatches with related products & upsell products?

texts:
I have added color swatches with related products using this code:

<?php

   if($_item->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE){

   $swatchBlock = $this->getLayout()->createBlock("Magento\Swatches\Block\Product\Renderer\Listing\Configurable")->setTemplate("Magento_Swatches::product/listing/renderer.phtml");
   echo $swatchBlock->setProduct($_item)->toHtml();
 }

?>

It is showing swatches fine but when I am clicking on color swatches then product image is not changing.I want to changed product image as well product listing page.

How can I do this?


texts:
what I have:

OS Windows 7
PHP Version 7.1.22
NodeJS 10.14.2
Yarn 1.13.0

I use instruction from
https://webkul.com/blog/magento2-3-pwa-studio-setup/
and
https://magento-research.github.io/pwa-studio/venia-pwa-concept/setup/

So, what I did:

installed fresh magento 2.3 from composer via command composer create-project --repository=https://repo.magento.com/ magento/project-community-edition:2.3.0 f:\OSPanel\domains\m2pwa2.local\
cloned pwa-studio (git clone https://github.com/magento-research/pwa-studio.git) into magento instance: f:\OSPanel\domains\m2pwa2.local\pwa-studio
cd pwa-studio and run yarn install
set MAGENTO_BACKEND_URL="http://m2pwa2.local/" in f:\OSPanel\domains\m2pwa2.local\pwa-studio\packages\venia-concept\.env
installed sample data of venia-theme

When I go to f:\OSPanel\domains\m2pwa2.local\pwa-studio\ and run yarn run build I see:

f:\OSPanel\domains\m2pwa2.local\pwa-studio>node -v
v10.14.2

f:\OSPanel\domains\m2pwa2.local\pwa-studio>yarn -v
1.13.0

f:\OSPanel\domains\m2pwa2.local\pwa-studio>yarn run build
yarn run v1.13.0
$ yarn workspaces run build
$ concurrently --raw yarn:build:cjs yarn:build:esm
$ BABEL_ENV=production babel src --out-dir dist --root-mode 'upward' --source-ma
ps
$ BABEL_ENV=development babel src --out-dir esm --root-mode 'upward' --source-ma
ps
'BABEL_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.
'BABEL_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.
error Command failed.
Exit code: 1
Command: C:\Program Files\nodejs\node.exe
Arguments: C:\Program Files (x86)\Yarn\lib\cli.js build
Directory: f:\OSPanel\domains\m2pwa2.local\pwa-studio\packages\peregrine
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspaces for documentation about th
is command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.

f:\OSPanel\domains\m2pwa2.local\pwa-studio>

I would appreciate any help!


texts: Magento2: Cross-sell not showing in cart, missing crosssell.phtml file

texts:
For some reason, my theme is missing the crosssell.phtml file that shows cross-sell products in the cart.

I found out from my Magento2 system.log file;

  [2017-03-26 21:21:11] main.CRITICAL: Invalid template file:
  'Magento_Catalog::product/list/crosssell.phtml' in module:
  'Magento_Checkout' block's name: 'checkout.cart.crosssell' [] []

I tried to search in other templates for the crosssell.phtml file, but could not find it. Does anybody know what code I should put in the crosssell file to make it show the crosssell products in cart?

I'm using Magento 2.1.5


texts:
I'm using http://www.starplugins.com/cloudzoom/quickstart to add hover zoom feature on single product page. Rollover on first product thumbnail shows the same image. However on second or subsequent rollover of other images the rollover image is always the 1st image.

I really need some help on this issue. I've searched all over but cant find any solution.

Media.phtml

<?php
$_product = $this->getProduct();
$_helper = $this->helper('catalog/output');
$_nativeZoom = false;
?>

<?php if (count($this->getGalleryImages()) > 0): ?>

        <?php /*
<?php echo $this->__('More Views') ?>
 */ ?>
        <?php
        $galleryImages = $this->getGalleryImages();
        $numGalleryImages = count($galleryImages);
        $i = 0;
        foreach ($galleryImages as $_image): $i++; ?>
            <div class="<?php
                if($i == 1) {
                    echo 'first';
                }
                if($i == $numGalleryImages) {
                    echo 'last';
                }
                ?>">
                <a href="#" data-large-image="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>"
                   title="<?php echo $_product->getName();?>">
                    <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(124); ?>"
                         alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" />

        <?php endforeach; ?>

<?php endif; ?>

    <?php
    $_img = 'helper('catalog/image')->init($_product, 'image')->resize(450).'" data-cloudzoom="zoomImage: \''.$this->helper('catalog/image')->init($_product, 'image').'\'" alt="'.$this->escapeHtml($_product->getImageLabel()).'" title="'.$this->escapeHtml($_product->getImageLabel()).'" />';
    echo $_helper->productAttribute($_product, $_img, 'image');
    ?>

jquery initialize script

jQuery(document).ready(function($) {
    if (jQuery('.catalog-product-view').length) {

        if (window.location.hash == '#_reviews') {
            //add scroll to down to product reviews list when pagination is used
            jQuery.scrollTo(jQuery('#reviews'), {duration: 1000, interrupt: true});
        }

        //cloudzoom configuration http://www.starplugins.com/cloudzoom/quickstart
        $('#main-product-image').CloudZoom({
            tintColor: '#6e4d56',
            tintOpacity: 0.43,
            zoomSizeMode: 'image',
            autoInside: 1000
        });
    }
});


texts:
I've made a new module and I would like to override the
vendor/magento/module-config/view/adminhtml/templates/system/config/form/field/array.phtml
I've copied the file in app/code/myVendor/myModule/view/adminhtml/templates/system/config/form/field/array.phtml
and I've added this xml file in app/code/myVendor/myModule/view/adminhtml/layout/config_form_field.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="myVendor\myModule\Block\System\Form\Field\Multi" name="config_field">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">myVendor_myModule::system/config/form/field/array.phtml</argument>
        </action>
    </referenceBlock>
</body>

But it doesn't take my new file, it still takes the file from vendor


texts: I want to add multiple catalogs from different Suppliers. Is it also possible in Magento to set a specific catalog per user. Next to that can a customer also choose their own catalog out of the multiple catalogs.


texts:
I'd like to hide actions block on the single product page (only certain products):

I thought magento managed to show this information with a single phtml so I'd overrided entirely and insert an if block to show/hide this section.

But I see it uses a lot of templates and don't know how to do it to take control on it.

I did a similar question only for add a block Add block on single product page, but in this case I need to control the existing block.

I'm trying to solve the problem like @chirag said but I can't figure out why it's not working, so I'll put the names and paths:

\app\code\GSP\Mto\view\frontend\layout\catalog_product_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="page.main.title">
        <block class="GSP\Mto\Block\Product\View\MtoSingle"
               name="product.view.mto"
               template="GSP_Mto::product/view/mto_single.phtml"
               after="-">
        </block>
    </referenceContainer>

    <referenceBlock name="product.info" template="GSP_Mto::product/view/form.phtml" />
</body>
</page>

app\code\GSP\Mto\view\frontend\templates\product\view\form.phtml

<p> test </p>

expected result: paragraph test instead of form qty and add to cart.

actual result: default magento template.

UPDATE: I'm looking around and I don't see nothing wrong, seems it has to be something about priorities. Magento just uses his template as default.
If I write

<referenceBlock name="product.info" template="GSP_Mto::product/view/form.phtml" remove="true" />

It works, the addtocart and qty disappears. But when I only indicate to use my template, magento just show it as default.

The only way it 'works out' is writing a line on di.xml:

<preference for="Magento\Catalog\Block\Product\View" type="GSP\Mto\Block\Product\View" />

And copy the entire class on my module. But this is just ridiculous. And then messies the button addtocart not showing it, seems breaks something

It has to be a silly thing but it kept me an entirely day and I couldn't fix it.

UPDATE2: Tried to write directly on vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml

<block class="Magento\Catalog\Block\Product\View" name="product.info" template="GSP_Mto::product/view/form.phtml" after="alert.urls">

My template. This is the only way that works everything but completely wrong way to do it.

I think I'm going to lose my head.


texts:
I have the below code on success.phtml to get some order info.  I also need to be able to get the discount amount (if any) on the order.  This would be the discount amount from any discount codes used.

<?php
/*Use this to get sale attributes - to get additional view the code in app>code>core>mage>googleanalytics>block>ga.php*/
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($lastOrderId);
$_grandTotal = $order->getBaseGrandTotal(); #order total
$orderNumber = $this->__($this->getOrderId()); #order number
$voucher = $order->getCouponCode(); #voucher code used
$_totalData =$order->getData();
    $_sub = $_totalData['subtotal'];
    $_sub = round($_sub,2);
    $currency = Mage::app()->getStore()->getCurrentCurrencyCode();
    $currency_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
?>

Any ideas?


texts:
How to show VAT number in magento2 checkout-page.

Is there any option available in magento2 backend?


texts: How to install japanese kuromoji analysis plugin in ubuntu 16?

texts:
I am using elasticsearch. I have the Japanese data. I want to create index on Japanese data. As I have searched how to install Japanese kuromoji analysis plugin in ubuntu 16, there are lot of sites showing the command. But no one has specified from where I need to use that command. Some references I have viewed are:

1.http://pppurple.hatenablog.com/entry/2017/05/28/141143

2.https://github.com/elastic/elasticsearch-analysis-kuromoji

None of them stating from where I need to enter that command, they just showed the command only. I did lot of google search, but I am not getting the proper guidance/link.

Can anybody please help me. Thanks in advance!


texts: How do I change the default attribute 'position' in layered navigation?

texts:
I'm organizing my attributes to show in a specific order in layered navigation. To do this I need to set the 'position' value of them all. Magento defaults them to 0 so to put an attribute (say color) at the top of the list, I'll need to change the position of them all, which can get tedious.

What code can I use to reset all my attributes to 100 and to change the defaults?

Bonus: To exclude specific attributes from being reset such as Mage::getResourceModel('catalog/attributes')->excludeFilter(array('color', 'size')->walk('delete');

Note: Changing the default position of a product has already been discussed. I'm looking to change the position of the attribute itself.

ANSWER:
  Thank you saravanavelu for your pointer.

Here is the code I was looking for:

UPDATE `catalog_eav_attribute` SET `position`= 100 WHERE `attribute_id` NOT IN (130, 140, 120)

where the numbers are attribute codes. Attribute codes are found in the URL of the Edit Attribute page.


texts: Error Cancelling Order... PayPal gateway has rejected request. Authorization has expired (#10601: Authorization expired)

texts:
We are trying to cancel an order where the PayPal Express payment has expired.  It was a duplicate order that needs to be cleaned up from the system.  However, when we try and cancel this order all we get is the following error...

  PayPal gateway has rejected request. Authorization has expired (#10601: Authorization expired).

There are no invoices or shipments on this order.  The status is just stuck on "Processing".

After walking through the code it appears to be attempting a void first inside Mage_Paypal_Model_express->cancel() which doesn't work since the original authorization is now expired.  I know with PayPal IPN, Magento is updated with the fact that it is now expired.  Is this a known issue with Magento 1.9 and PayPal Express?  Does anyone have a fix for this or am I just missing something here?


texts: Change Category Images from .png to .jpg

texts:
I have several hundreds of category Images containing a .png extension. But I want to convert that images to .jpg (outside of Magento and not part of that question) and then reupload them to media/catalog/category and tell Magento to use the new .jpg extension for all .png Category Images. Including Thumbnail Image and Image field.

I found the quite similar Question Migrating All Product Images in Magento from PNGs to JPEGs but the difference is that I want to change Category Images and not Product Images.

Can someone tell me how to change that script or a different approach, please? Updating all Categories in the backend manually would take to much time.


texts: Don´t show message in cart: We don't have as many quantity as you requested, but we'll back order the remaining 1

texts:
I want to don't show in cart and checkout the message that is in each product:
We don't have as many quantity as you requested, but we'll back order the remaining 1.
Thanks


texts: How to check which template /view file is used - rendered

texts:
I am trying to make changes to registration page and add the address info fields in registration / account creation page.
my browser reads mysite/customer/account/create

by following the instructions here on stack exchange I have taken multiple steps but non seems to be working.
for example I am using rwd inbuilt Magento theme. My Magento ver. is 1.9.2.4

commented the code - <?php // if($this->getShowAddressFields()): ?>
in /web/app/design/frontend/rwd/default/template/persistent/customer/form/registration.phtml
and in /web/app/design/frontend/rwd/default/template/customer/form/registration.phtml.
add local.xml file in /web/app/design/frontend/rwd/default/layout/
with code
<customer_account_create>
    <reference name="customer_form_register">
        <action method="setShowAddressFields"><param>true</param></action>
    </reference>
</customer_account_create>
cleared all cache after following these steps.

is there any tool which can be used to check which view file is used/rendered?

but nothing seems to work. can't make out what I am missing here.


texts: What steps/tasks are invloved in displaying the products list page

texts:
I am a complete newbie in magento. My site uses magento 1.

There are n number pf tasks that happen when we display products on products list page or when we filter the products(on the frontend part). I am required to find out the time each of those tasks requires to complete.

I have been searching for a whole day what tasks are involved in displaying products on products list page but to no avail.

So my question is what all tasks are happening while displaying the products list page and where can I find it in the code for magento.


texts: getting error when upgrading from Magento 2.1.5 to Magento 2.2.6

texts:
I want to upgrade my website with the latest version. I am using below commands:

  composer require magento/product-community-edition 2.2.6 --no-update

  composer update

I am getting below error:

Problem 1
    - magento/product-community-edition 2.2.6 requires composer/composer 1.4.1 -> satisfiable by composer/composer[1.4.1] but these conflict with your requirements or minimum-stability.
    - magento/product-community-edition 2.2.6 requires composer/composer 1.4.1 -> satisfiable by composer/composer[1.4.1] but these conflict with your requirements or minimum-stability.
    - Installation request for magento/product-community-edition 2.2.6 -> satisfiable by magento/product-community-edition[2.2.6].

How can I solve this error and complete upgradation of latest magento version?

My Composer.json code:

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.1.5",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/product-community-edition": "2.2.6",
        "composer/composer": "1.1.2 as 1.0.0-beta1",
        "magento/data-migration-tool": "2.1.5",
        "paradoxlabs/authnetcim": "^4.0",
        "ebizmarts/mailchimp-lib": "^3.0",
        "phpoffice/phpexcel": "^1.8"
    },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.2.2",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.0",
        "sebastian/phpcpd": "2.0.0"
    },
    "config": {
        "use-include-path": true
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": "app/code/"
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "alpha",
    "prefer-stable": true,
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },
        "magento": {
            "type": "composer",
            "url": "https://repo.magento.com"
        }
    },
    "extra": {
        "magento-force": "override"
    }
}


texts: Paypal - Things don't appear to be working at the moment

texts:
I am using Magento 2 for my website. I have configured Paypal Website Payment Standards. I am testing in sandbox mode. I can receive payment from Paypal account but i can not receive payment from Debit/credit card(Without logging in to paypal). I have enabled Guest Checkout Mode in Magento settings. I have double checked all the settings in Magento and my Paypal Sandbox account but still no solution. Please guide.

Attached is screenshot for the error i get.


texts: How do I add a buy X get Y free product to cart programmatically with shopping cart rule?

texts:
I have a shopping cart rule, Buy product with SKU XXXXX and get Product with SKU YYYYY discounted. I want to automatically add Y product to cart when X product is added.

What I've tried
Creating an observer for updateCartAfter

public function updateCartAfter($observer){

Getting the Applied rules

$appliedRuleIds = Mage::getSingleton('checkout/session')->getQuote()->getAppliedRuleIds();

Getting the promo SKUs for the rules applied

foreach($myrules as $key => $value){
    $promoSkus[$key] = $value['promo_sku'];
}

The problem is that my rule is only applied to the shopping cart when the Promo Item (Y) is already in the cart.

I want the rule to be applied when Product X is added so I can pull the promo item(Y) SKU from the rule and add it to the cart automatically.
If there's a better way to do this please let me know.


texts: Remove toolbar and reset collection on listing page

texts:
I am using magento default loaded collection for category in some cases.So i would like to disable toolbar on that category.

I make that but when load category it display only product that is preset in category toolbar.

I have just change listing template and remove that toolbar from my listing template.

But toolbar has already set the product display limit so how can i reset display limit on my page.

Here is my collection code.

    <?php
namespace Kite\Boxes\Block\Rewrite\Product;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Framework\Json\Helper\Data as jsondata;
class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
{
    /*protected $jsonHelper;*/

    /*public function __construct(\Magento\Framework\Json\Helper\Data $jsonHelper)
    {
        $this->jsonHelper = $jsonHelper;
    }*/
  protected $_productCollectionFactory;
  protected $priceCurrency;
  public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
        CategoryRepositoryInterface $categoryRepository,
        \Magento\Framework\Url\Helper\Data $urlHelper,
        array $data = [],
        jsondata $jsonHelper,
        PriceCurrencyInterface $priceCurrency,
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus,
       \Magento\Catalog\Model\Product\Visibility $productVisibility

    ) {
          $this->jsonHelper = $jsonHelper;
        $this->_catalogLayer = $layerResolver->get();
        $this->_postDataHelper = $postDataHelper;
        $this->categoryRepository = $categoryRepository;
        $this->urlHelper = $urlHelper;
        $this->priceCurrency = $priceCurrency;
        $this->_productCollectionFactory = $productCollectionFactory;
        $this->productStatus = $productStatus;
        $this->productVisibility = $productVisibility;
        $this->_coreRegistry = $context->getRegistry();
        parent::__construct(
            $context,
            $postDataHelper,
            $layerResolver,
            $categoryRepository,
            $urlHelper,
            $data

        );
    }

    public function getProductCollectionData()
    {

    $_productCollection = $this->_getProductCollection()->addAttributeToFilter('type_id','simple')->addTierPriceData();

   return $_productCollection
  }

I have tried to reset limit using

 $_productCollection->getSelect()->limit('all');

But not working.


texts: How to create an Image/avatar uploader for admin user

texts:
I want to add a avatar image upload field for admin users.

I want when you go to system > permissions > users, and click the "Add New User" button, a image upload section is within the add new user form.

My plan is to use the following code to create a new column in the "admin_user" database table, to store the image link.

$installer = $this;
$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('admin_user'),'avatar', 'varchar(255) NOT NULL DEFAULT "0"');

This would then make it easy to call and display said image wherever i need to.

$this->getUser()->getAvatar()

The issue is, i dont know how to add a image uploader and have it generate a link and place it in the database field.

Please provide as much info as possible. Any help will be greatly appreciated.

UPDATE 26/07/2015:
With the help provided in the accepted answer, I was able to create a module that provide some of the features I need. I see that the image uploader is now shown in the form, the image name is saved to the database, but unfortunately, I don't see the image in the media folder. Could someone help me to solve this last section please?

Please find the code used in accepted answer below.


texts: Magento 2 : Sales Representative Collect Items from catalog

texts:
I want functionality or extension where Sales representative collect items from catalog. After collecting all the necessary items, Sales representative send link to individual customer for checkout. Customer will have to click that link and directly checkout with payment information.

Any extension, similar functionality would be helpful.

Thanks
Yagnesh P.


texts: How to get top 3 most purchased category list in magento 2?

texts:
There are modules that get top best selling products list but I want to get the topmost purchased categories list instead of products. Please help me with this. Is there any free module available?

Thanks in advance..!


texts: add custom filters in search results in Magento 2.3

texts:
I want to override or add a custom filter in search results, for this I override ListProduct, all seams working fine, except the pagination and left navigation do not reflect the filter

here is my code, searching is fine, the only issue is pagination and left navigation is not updating as per new search filters.

use Magento\Catalog\Model\Product;

class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
{
    protected $_customerSession;
    protected $categoryFactory;
    protected $_productCollection;
    protected $_redirect;
    protected $_url;

/**
 * ListProduct constructor.
 * @param \Magento\Catalog\Block\Product\Context $context
 * @param \Magento\Framework\Data\Helper\PostHelper $postDataHelper
 * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
 * @param \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository
 * @param \Magento\Framework\Url\Helper\Data $urlHelper
 * @param Helper $helper
 * @param array $data
 * @param \Magento\Customer\Model\Session $customerSession
 * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
 */
public function __construct(
    \Magento\Framework\UrlInterface $url,
    \Magento\Framework\App\Response\Http $redirect,
    \Magento\Catalog\Block\Product\Context $context,
    \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
    \Magento\Catalog\Model\Layer\Resolver $layerResolver,
    \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
    \Magento\Framework\Url\Helper\Data $urlHelper,
    array $data = [],
    \Magento\Customer\Model\Session $customerSession,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory
) {
    $this->_customerSession = $customerSession;
    $this->categoryFactory = $categoryFactory;
    $this->_url = $url;
    $this->_redirect = $redirect;
    parent::__construct(
        $context,
        $postDataHelper,
        $layerResolver,
        $categoryRepository,
        $urlHelper,
        $data
    );

}

public function getFilteredProductCollection()
{
    return $this->_getProductCollection();
}

protected function _getProductCollection()
{
    return $this->_productCollection = $this->initializeProductCollection();
}

private function initializeProductCollection()
{
    $layer = parent::getLayer();
    $collection = $layer->getProductCollection()->addAttributeToFilter('MY_ATTRIBUTE', 'SOME VALUE');
    return $collection;
}

}


texts: Which File for /lib/web/legacy-build.min.js

texts: I'm trying to change comment display in admin order page, i found this file /lib/web/legacy-build.min.js to edit the submitAndReloadArea function but the legacy-build.min.js looks like a generated file, can you give me which file should edit?


texts: Native Magento search vs. SOLR vs. something else?

texts: At what point do I want to "upgrade" from the native Magento search engine to something like Apache SOLR, or a commercial product? Are there specific features I'd be looking for, or is it simply a function of traffic, SKU count, or something else?


texts: Magento2 - Change my account label to image

texts:
I tried to change the my account link to a  image but then found that it was called in xml in vendor/magento/module-customer/view/frontend/layout/default.xml as label .

So how could I change it to image instead of label.

I also tried to add a custom block having a image in the place of my account label but it doesnt workout.

Can anyone say how to change the label my account label to a image or icon?


texts: Magento 2 XML product_layout_view.xml conditional

texts:
I've got a simple block that I'm using to add a button directly next to "Add to Cart"
<referenceBlock name="product.info.addtocart">
    <block class="Magento\Framework\View\Element\Template" template="Vendor_Module::product/view/button.phtml" ifconfig="vendor/module/enable" before="product.info.addtocart.instantPurchase"/>
</referenceBlock>

The biggest problem I have is that the block product.info.addtocart is not shown when the product is out of stock, but i still wish my button to appear.
If I move the button to product.info.form.content then button appears on all products, but falls outside the add-to-cart container and loses it's CSS properties, and is displayed on a new line from "Add to Cart" instead of next to it.


texts: Is magepack 2.3.2 extension supports in magento 2.3.3 cloud environment

texts:
I am facing an issue in installing magepack 2.3.2 extension for js bundling in the Magento 2.3.3 cloud environment. Is this extension supports to cloud environment?

https://github.com/magesuite/magepack

Error log:
Installing nodejs build dependencies: magepack
/app/.global/bin/magepack -> /app/.global/lib/node_modules/magepack/cli.js
      > puppeteer@2.1.1 install /app/.global/lib/node_modules/magepack/node_modules/puppeteer
      > node install.js

      W: /app/.global/lib/node_modules/magepack/node_modules/puppeteer/lib/helper.js:91
      W:   static async releaseObject(client, remoteObject) {
      W:                ^^^^^^^^^^^^^
      W:
      W: SyntaxError: Unexpected identifier
      W:     at createScript (vm.js:56:10)
      W:     at Object.runInThisContext (vm.js:97:10)
      W:     at Module._compile (module.js:549:28)
      W:     at Object.Module._extensions..js (module.js:586:10)
      W:     at Module.load (module.js:494:32)
      W:     at tryModuleLoad (module.js:453:12)
      W:     at Function.Module._load (module.js:445:3)
      W:     at Module.require (module.js:504:17)
      W:     at require (internal/module.js:20:19)
      W:     at Object.<anonymous> (/app/.global/lib/node_modules/magepack/node_modules/puppeteer/index.js:17:18)
      /app/.global/lib
      └─┬ magepack@2.3.2
        ├── commander@5.1.0
        ├── consola@2.12.2
        ├─┬ glob@7.1.6
        │ ├── fs.realpath@1.0.0
        │ ├─┬ inflight@1.0.6
        │ │ └── wrappy@1.0.2
        │ ├── inherits@2.0.4
        │ ├─┬ minimatch@3.0.4
        │ │ └─┬ brace-expansion@1.1.11
        │ │   ├── balanced-match@1.0.0
        │ │   └── concat-map@0.0.1
        │ ├── once@1.4.0
        │ └── path-is-absolute@1.0.1
        ├─┬ gzip-size@5.1.1
        │ ├── duplexer@0.1.1
        │ └── pify@4.0.1
        ├── javascript-stringify@2.0.1
        ├── jsesc@3.0.1
        ├── lodash.merge@4.6.2
        └─┬ terser@4.7.0
          ├── commander@2.20.3
          ├── source-map@0.6.1
          └─┬ source-map-support@0.5.19
            └── buffer-from@1.1.1

      W: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: puppeteer@2.1.1 (node_modules/magepack/node_modules/puppeteer):
      W: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: puppeteer@2.1.1 install: `node install.js`
      W: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
      W:


texts:
I am developing an Ecommerce site and I want to remove the footer from selected CMS page.

I have refered this link, which say to remove the footer from entire CMS pages, but I dont need to remove for the entire pages.

So can anyone say me how to overcome in this. Thanks in advance.


texts: Magento2 rest api error on product search on extension attribute

texts:
I've an extension attribute on products, declared in the following way:

<attribute code="stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface">
    <resources>
        <resource ref="anonymous"/>
    </resources>
    <join reference_table="cataloginventory_stock_item"
          join_on_field="entity_id"
          reference_field="product_id">
        <field>qty</field>
        <field>item_id</field>
    </join>
</attribute>

And I'd like to filter by the qty attribute greater than zero, and i call :

  rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=qty&searchCriteria[filter_groups][0][filters][0][value]=0&searchCriteria[filter_groups][0][filters][0][condition_type]=gt

but I have got an error attribute name invalid

Is there a way to filter this? Am I missing something?


texts:
I try to generate a link, by using getURL, but some how it keep adding "admin" behind my hostname, what should I do? getURL cannot use in this case?

It use to send out transnational email, if sending thru admin panel, the path on email template will have "admin" which is I don't want this happen.

Please help


texts:
I have found a custom block that checks if the customer is logged in and edited it to this.  What I need it to do is check the custom customer attribute is_allowed is set to yes, too.  I want to use this in a block and call in it in phtml file.  Can you point me where I am going wrong?

the code is

<?php

namespace WorldSynergy\LoginPortal\Block;

use Magento\Customer\Model\Url;
use Magento\Framework\App\Http\Context;
use Magento\Framework\View\Element\Template;
use Magento\Sales\Model\ResourceModel\Order\Customer\Collection;
{

class Portal extends Template
{
    protected $_customerUrl;
    protected $_customer;
    protected $httpContext;
    /**
     * Constructor
     *
     * @param \Magento\Framework\View\Element\Template\Context  $context
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Sales\Model\ResourceModel\Order\Customer\Collection $customer,
        Url $customerUrl,
        Context $httpContext,
        array $data = []
    ) {
        $this->_customer->$customer;
        $this->_customerUrl = $customerUrl;
        $this->httpContext = $httpContext;

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

    /**
     * @return string
     */
    public function isLoggedIn()
    {
        if  $this->$_customer->create()->addAttributeToSelect('is_allowed') {
            return $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
        }
    }
}

I can't seem figure it out.  Help is appreciated.  Thanks


texts: Set action to custom module admin Button

texts:
I created a custom module, with a button in System > Configuration. Clicking on this button should call a function and then inform the user about the function's results (I suppose by reloading the same page and showing some messages.)

Could you please give me some instructions about how to do that?

system.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <tabs>
        <CustomModules translate="label" module="mymodule">
            CustomModules
            <sort_order>100</sort_order>
        </CustomModules>
    </tabs>
    <sections>
        <CustomModules translate="label" module="mymodule">
            Fix Products
            <tab>CustomModules</tab>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>

            <groups>
                    <fields>
                        <re_enable_configurables translate="label">
                            Click this button to manually fix products.
                            <frontend_type>button</frontend_type>
                            <frontend_model>mymodule/adminhtml_system_config_button</frontend_model>
                            <sort_order>30</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </re_enable_configurables>
                    </fields>
                </CustomModules_group>
            </groups>
        </CustomModules>
    </sections>
</config>

Block/Adminhtml/System/Config/Button.php

<?php
class CustomModules_Mymodule_Block_Adminhtml_System_Config_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
{

    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
    {
        $this->setElement($element);
        $url = Mage::helper('adminhtml')->getUrl("some_kind_of_url_idk");

        $html = $this->getLayout()->createBlock('adminhtml/widget_button')
                    ->setType('button')
                    ->setClass('scalable')
                    ->setLabel('FIX products!')
                    ->setOnClick("setLocation('$url')")
                    ->toHtml();

        return $html;
        $buttonHtml = $this->_getAddRowButtonHtml($this->__('FIX products!'));
        return $buttonHtml;
    }

}
?>


texts: Allowed memory size exhausted on category save Magento 2

texts:
I'm trying to to enable the "Anchor" flag on a category with about 1400 products. When I click save, the page loads for a very long time (about 45 minutes) and finally gives me an internal server error 500.

I tried the same with a category with about 500 products, there it worked after about 20 minutes (still much too long but no error).

I get the following error in the php error log:

  PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 33554440 bytes) in /Users/myuser/Sites/myproject/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3551

PHP settings:

memory_limit = 1024M  # in .user.ini
max_execution_time = 18000 # in .user.ini
post_max_size = 32M
max_input_vars = 100000

MySQL Settings:

max_allowed_packet = 1024M
wait_timeout = 180

Environment:

Installation: MAMP PRO
PHP-Version: 7.0.8.

Magento Settings:

Version: 2.1.7
All indexes are set to "UPDATE BY SCHEDULE" and were run
Use flat category: YES (also tried with NO)
Use flat product: YES (also tried with NO)
Caches are cleared
Tried clearing /var/generation folder

So basically, I tried everything I could find on the internet but nothing seemed to help. Of course I can now try to set memory_limit to 2056 but then it needs like 2 hours -  I don't think that's a solution.

What can I do?


texts: How to access to configurable product stock qty via js?

texts:
Someone knows how to get qty for each simple product of configurable product via javascript in product page?

It seems that spConfig retrieved with

#product_addtocart_form": {
    "configurable": {
        "spConfig": <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>
    }
}

hasn't data about qty.

I have to retrieve it with custom code or do you have some hints on how to find qty information?


texts: Magento 2: How to call Email template in email templates?

texts:
Is it possible to call email template in another email templates like we do for the header and footer

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

Maybe via template ID or we have to use Custom Variables and CMS blocks?

Thanks in advance for your help


texts: writing extension: add products dynamically to page

texts:
I need to write an extension that whenever a user view products grid, of any category, the extension will push additional 4 items to the products grid based on some backend magic.

I've done several magento turorials, read about the architecture and observers and all, and still uncertain how to start. do I need to listen to some event that is called when products are presented? to I need to write something to layouts that add my custom products? do I need to change phtml files?

this should be an extension that other sites will be able to download and use later, so it must be things that can be packed up nicely without changing any core etc.

thanks!


texts: Making edits to core controllers OnepageController.php in Magento 1.9 not working?

texts:
I am starting a new question for this because I created a clean magento install and still can't get any overwrites to work for the controllers. My edits for models and blocks all work fine but I have not been able to get it to work for the controller.

Could this be an issue with Magento 1.9 specifically? Are there new requirements to configure? All the examples and tutorials are based on an older version.

Here is what i have so far:

app/code/local/Paypalextended/Checkout/controllers/OnepageController.php

<?php
# Controllers are not autoloaded so we will have to do it manually:
require_once 'Mage/Checkout/controllers/OnepageController.php';
class Paypalextended_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
  public function indexAction(){

echo 'Hello World';
}

}

app/code/local/Paypalextended/Checkout/etc/config.xml

<?xml version="1.0"?>
<config>
<modules>
    <Paypalextended_Checkout>
        <version>0.1.0</version>
    </Paypalextended_Checkout>
</modules>
<!--
 If you want to overload an admin controller this tag should be <admin> instead,
or <adminhtml> if youre overloading such stuff (?)
-->
<frontend>
    <routers>
        <checkout>
            <args>
                <modules>
                <Paypalextended_Checkout before="Mage_Checkout">Paypalextended_Checkout</Paypalextended_Checkout>
                </modules>
            </args>
        </checkout>
    </routers>
</frontend>
</config>

app/etc/modules/Paypalextended_All.xml

<?xml version="1.0"?>
<config>
<modules>
    <Paypalextended_Checkout>
        <active>true</active>
        <codePool>local</codePool>
    </Paypalextended_Checkout>
</modules>
</config>

As I mentioned this is on a brand new install so there should be nothing interfering. Still it doesnt work. Is there a setting needed somewhere to allow controller overwrites?

I have tried moving the folder location to:

app/code/local/Paypalextended/Checkout/controllers/Checkout/OnepageController.php

and changing all the references appropriately. I saw this in a couple different tutorials. I tried everything in the wiki including the rewrite method and still nothing. I have made dozens of config.xml edits, instead of require_once include_once, changing the require_once line to:

require_once Mage::getModuleDir('controllers', "Mage_Checkout").DS."OnepageController.php";

I am beginning to think the problem is something specific to magento 1.9, has anyone ran into this or has successfully done a controller overwrite in magento 1.9? All advice appreciated!!!!

---------------------------------ANSWER--------------------------------------
So the problem ended up being that I had a leading empty line in my config.xml file... After that was removed both methods listed below worked perfectly. BIG thanks to Amit for his assistance!


texts: reindex command error (No alive nodes found in your cluster)

texts:
hi whenever i run reindex command in my console it keeps giving me following error : pleaae give me suggestion how can i resolve it ,

  Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive
  nodes found in your cluster in
  C:\xampp\htdocs\chase\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:51


texts: How to create credit memo programmatically in magento 2?

texts: I need to create credit memo and online refund programmatically in magento 2. I referred programmatic creation of credit memo in magento 1.x here. Any help for magento 2?


texts: Can I remove the clickable link on the sign in text?

texts:
Please help me with this,
I want to remove the sign in text clickable from the header section.
I just want that the arrow shows the sign in, contact us and create account.


texts: I am having the list of product sku. By using that Sku I need to disabled that products using a MySQL query. I don't know table structure and how to do it using sql query. Please advice me. Thanks in advance.


texts: Using Catalog Rules with Fixed Product Tax

texts:
A client has variable tax amounts per product therefore require the use of Fixed Product Taxes (FPT). We also require the ability to use Catalog Price Rules to apply discounts on the catalog. Unfortunately, even after ensuring "Apply Discounts To FPT" is enabled, the discount is being applied to the product price but not the Fixed Product Tax amount. I assume "Apply Discounts To FPT" only takes affect in Sales Rules as oppose to Catalog Rules.
For example
Normal Price Calculation:

Product costs: £34.16
FPT Amount: £6.83
Total: £40.99

Catalog Rule applies 30% off Price Calculation:

New Product Costs: £23.91
Total: £30.74
Therefore it is still applying £6.83 rather than 30% off £6.83.

Is there a way of applying Catalog Rules on FPT amounts?


texts:
I've tried running Magento's built-in integration testing using MySQL:5.7 docker container on a different port.

php bin/magento dev:tests:run integration

Question is, how can I use a different port?

The following is my dev/tests/integration/etc/install-config-mysql.php

/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

return [
    'db-host' => 'localhost',
    'db-port' => '33060', // <-- this is not working
    'db-user' => 'root',
    'db-password' => '',
    'db-name' => 'magento_integration_tests',
    'db-prefix' => '',
    'backend-frontname' => 'backend',
    'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME,
    'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
    'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL,
    'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME,
    'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME,
 ];

I also tried removing 'db-port' => '33060', and replaced 'db-host' => 'localhost', with 'db-host' => 'localhost:33060', and still it doesn't recognize the host.

Also, I can succesfully connect to the MySQL server using Workbench.

Anyone know how to change the port reference?


texts: As low as price wrong on Product Listing Page After Magento Upgrade

texts:
i have upgrade my magento from 1.7.0.2 to 1.9.3.2.
i am facing issue with As low as price on Configurable Product Listing Page .

currently price deduct price of custom option 2 times.

any help appreciated..


texts:
We have Tax defined as 7% GST in Tax configuration and is printed fine everywhere except the emails sent for order confirmation where there is a separate row as Tax and a mention of the 7% so with both there it is confusing for the users. Check the screenshot attached.
Is it possible to remove one of that? How to remove it? I checked the layout file for email and it had only Tax block defined as single block so if I take it out, then whole Tax will be gone from there.


texts: Magento 2: How to completely hide price from the store

texts:
I want to completely hide the price from the store. Be it in the catalog, product, minicart or cart. I need to do this through a custom module.

Any help is appreciated. Thanks!


texts: How to keep media mail from showing up as a shipping method when non-media items purchased

texts:
Most of my inventory I sell is books, which I offer to ship through media mail.

However I recently started selling other products which aren't media related items. How do I set up Magento that when one purchases one of these non-media items, automatically media mail won't show up as an shipping option?


texts:
Version: Magento 2.4 EE
I want to show the Recently Ordered Items Block in CMS page but when I call the block in page, the block is not displaying as expected and the page is empty.
In CMS page, my code is as follows
{{block class="Magento\Sales\Block\Order\Recent" template="Magento_Sales::order/recent.phtml"}}

The way which I have called the block is a right one?
Any help will be appreciated


texts:
i have create my custom add to cart controller my cart update but mini cart not update this is my code

   $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
   $request = $objectManager->get('\Magento\Framework\App\Request\Http');
   $resultJsonFactory = $objectManager->get('\Magento\Framework\Controller\Result\JsonFactory');
   $resultJson = $resultJsonFactory->create();
   $product_id = $request->getParam('product_id');
   $product_qty = $request->getParam('product_qty');

    $id = $product_id;
    $qty = $product_qty;
    $product = $objectManager->create('Magento\Catalog\Model\Product')->load($id);
    $listBlock = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');
    $cart = $objectManager->create('Magento\Checkout\Model\Cart');
    $http = $objectManager->create('Magento\Framework\App\Response\Http');
    $session = $objectManager->get('Magento\Checkout\Model\Session');
    $cart->addProduct($product,array('qty' => $qty));
    $cart->save();

    if($session->setCartWasUpdated(true))
    {
        $response="success";
    }
    else
    {
        $response = "fail";
    }
    $http->setRedirect('checkout/cart/index')->sendResponse();
    return $resultJson->setData(['success' => $response]);


texts: Insert Current Date as Widget or Variable in Magento CMS

texts:
Is there a way to insert the current data in Magento CMS as variable, widget, or any other method aside from including a .phtml file with php echo of date().?

Right now what I did is include a .phtml files with this contents:

<?php
echo "Today is " . date("Y/m/d") . "<br>";
?>

But is there any better or proper way? Like {{datetoday}} or something. Just like when I'm including a URL, I just type the variable {{store url}}


texts: How can i remove same image placed couple of times for my 100's of product

texts: How can i remove same image placed couple of times.


texts: Magento 2 : Custom payment on place order error "The authorize action is not available."

texts:
On click place order button we get error message

  "The authorize action is not available."

How to redirect on success page or custom success page. Please help me .
After I click, response message show :


texts: How to manage cross-sells most effectively?

texts:
I posted a question about adding a step in the regular Magento checkout (not one-step checkout) and I understand now that it is pretty much not possible. I am wondering now if there is a way to always show the same 6 cross-sell products? With the layout I have - it doesn't show them all...Maybe an extension or something? I need to increase my sales by offering additional items (balloons etc.)

EDIT after I've done all the steps posted below: I have created all these folders and files in the specified directories. I have also renamed everything that says: "mycompany" to "AccessShop" (the name of my theme) - is that correct? I uploaded all the files to the paths specified above but I don't see this extra page with cross-sell items anywhere on the front or back-end? Where shall I look for this?


texts: How to create Search "Textfield" filter in admin grid | Magento 2

texts:
I am trying to create Grid search feature based on strings entered in text fields as:

This functionality is in some of the default admin grids and few have filter button like this:

I wanted to implement 1st pic functionality for Sales Order Grid. Any help will be appreciated! Thanks


texts: Magento2.3 error on custom Luma default.xml

texts:
We have a Magento2.3 based website that uses a custom child theme of Luma. However, having an issue getting a custom CSS file to appear in the header. However, we are getting this error after adding the call to the CSS file.

    exception(s):
      Exception #0 (Magento\Framework\Config\Dom\ValidationException): Theme layout update file
 /var/www/html/romanjules/app/design/frontend/Lumachild/luma/Magento_Theme/layout/default.xml is not valid.
Opening and ending tag mismatch: referenceContainer line 6 and body
 Line: 68
Opening and ending tag mismatch: body line 3 and page
 Line: 69
Premature end of data in tag page line 2
 Line: 70

Below is the html from the page

    <!-- Header Elements -->
    <referenceContainer name="page.wrapper">

    <move element="minicart" destination="custom.header" after="-" />

    <referenceBlock name="logo">
       <arguments>
          <argument name="logo_file" xsi:type="string">images/yd_logo.png</argument>
          <argument name="logo_img_width" xsi:type="number">200</argument>
          <argument name="logo_img_height" xsi:type="number">200</argument>
       </arguments>
    </referenceBlock>

    <!-- Header Elements End -->

    <!-- Nav Elements -->
    <referenceBlock name="catalog.topnav">
        <block class="Magento\Cms\Block\Block" name="text.links" after="catalog.topnav">
            <arguments>
                <argument name="block_id" xsi:type="string">custom_menu_after</argument>
            </arguments>
        </block>
    </referenceBlock>
    <!-- Nav Elements End-->

    <!-- Footer Elements -->
    <referenceContainer name="footer">
          <block class="Magento\Framework\View\Element\Template"
            name="customfooter"
            template="Magento_Theme::html/custom/customfooter.phtml"/>
    </referenceContainer>

    <referenceContainer name="page.wrapper">
        <container
          name="custom.footer"
          htmlTag="section"
          htmlId="custom_footer"
          after="-"
        >
             <block
              class="Magento\Framework\View\Element\Template"
              name="footer_bar"
              template="Magento_Theme::html/custom/footer-links.phtml"
            >
            </block>
        </container>
    </referenceContainer>
    <!-- Footer Elements -->
    <referenceContainer name="footer">
          <block class="Magento\Framework\View\Element\Template"
            name="customfooter"
            template="Magento_Theme::html/custom/customfooter.phtml"/>
    </referenceContainer>

    <referenceContainer name="page.wrapper">
        <container
          name="custom.footer"
          htmlTag="section"
          htmlId="custom_footer"
          after="-"
        >
             <block
              class="Magento\Framework\View\Element\Template"
              name="footer_bar"
              template="Magento_Theme::html/custom/footer-links.phtml"
            >
            </block>
        </container>
    </referenceContainer>

    <!--this is use for remove default elements -->
    <referenceBlock name="copyright" remove="true"/>
    <referenceBlock name="report.bugs" remove="true"/>
    <referenceBlock name="footer_links" remove="true"/>
    <referenceBlock name="switcher-store" remove="true"/>
    <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="form.subscribe" remove="true"/>
    <!-- Footer Elements Ends -->

</body>


texts: Send email after 7 days if status is always "pending"

texts:
I need help or an explanation to send an email once, to people who do not pay bank transfer or bank check (status pending) after 7 days.

Example: A customer orders today by bank transfer.
If after 7 days I still have not received the transfer, I send one and only one email to the customer to restart the payment.

How can I do this?

I create a custom module with cron job and observer and helper:
This is my cronjob :

<crontab>
    <jobs>
        <custom_standbypayement>
            <schedule>
                <cron_expr>*/1 * * * *</cron_expr>
            </schedule>
            <run>
                <model>custom_standbypayement/observer::checks</model>
            </run>
        </custom_standbypayement>
    </jobs>
</crontab>

My Observer :

public function checks() {

   // $arrayEmail = Mage::helper('standbypayement/data')->cancelPendingOrders();
    $arrayEmailEmpty = Mage::helper('standbypayement/data')->cancelPendingOrders();

}

this is my helper who gets all order with state pending and sends email transactional

public function getPayementBankTransfertStandBy(){

    $olderThan = 7; //7 days
    $date = date('Y-m-d', mktime(0,0,0, date('m'), date('d') + $olderThan, date('Y')));

    var_dump($date) .'
';

    //get orders with no update in the last 7 days
    $collection = Mage::getModel('sales/order')->getCollection()
                ->addFieldToFilter('status', 'pending')
                ->addFieldToFilter('updated_at', array('lt'=>$date));

    return $collection;

}
public function cancelPendingOrders() {

    $arrayEmail = array();

    foreach ($this->getPayementBankTransfertStandBy() as $order) {

        echo $order->getIncrementId() .' - '. $order->getCreatedAt() .'
';
        $arrayEmail[] = $order;
        $this->StandByPayement($order);
    }

    return $arrayEmail;

}
 public function StandByPayement($order) {
    $storeId         = Mage::app()->getStore()->getId();
    $email           = $order->getCustomerEmail();

    $senderName      = Mage::getStoreConfig('trans_email/ident_support/name');
    $senderEmail     = Mage::getStoreConfig('trans_email/ident_support/email');
    $sender          = array('name' => $senderName,
                             'email' => $senderEmail);
    $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())
        ->setIsSecureMode(true);

    $paymentBlock->getMethod()->setStore($storeId);

    $paymentBlockHtml = $paymentBlock->toHtml();

    $vars       =   array(
        'order'        => $order,
        'billing'      => $order->getBillingAddress(),
        'payment_html' => $paymentBlockHtml
    );

    //var_dump($vars);
    //die();

    $templateIdEn          = 55;
    $templateIdDeutsch     = 56;

    $translate       = Mage::getModel('core/email_template');

    $translate->sendTransactional($templateIdEn, $sender, $email,'', $vars, $storeId);

}

Can you help me? I want to send just once email if the status of payment is always pending after the day of purchase

Thank you


texts:
I want to develop a module in which i want to call my api from every page of magento website How can i achieve that ?

I have tried with observer but unable to do that can any one give a solution for printing simple message on every page to website(including admin) at module level.


texts: What are good ways of monitoring a live shop?

texts:
Preface:
We want to extend the monitoring of one of our webshops as the provider had troubles with the PHP configuration and parts of the live webshop crashed (backend & checkout not working).
I don't want to discuss about moving to another provider here.

As we are now thinking about possibilities to monitor the webshop itself and the availability of certain parts (like "Is the checkout working?"), the question is:

What tools and strategies do you suggest to monitor a live website?

Some ideas:

Do you automatically check, if the checkout is still working on a live website?
What can be good parameters to monitor to detect failure? Last Order < 1 day ago, last user login,...
Using cron jobs: Checking for example for last order date/time and if it's too long ago, send an email and/or check manually if the checkout still works?
Using software/tools like Icinga, Uptime Robot,...
Sending out warning E-Mails to Admins,...

Looking forward to your answers :)


texts: Call custom_module phtml file in cms page

texts:
How to call a phtml file in cms page. my phtml file is located under the path
\app\code\Testing\Helloworld\view\frontend\templates\helloworld.phtml.Thank you in advance


texts: How to update configurable product description using sku via script in magento 2

texts:
How to update configurable product description using sku via script?? I have used below code for config product, It is failed to function properly for configurable product. Please suggest me a solution

<?php

require __DIR__ . '/app/bootstrap.php';

use Magento\Framework\App\Bootstrap;

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');

$productCollectionFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');

$collection = $productCollectionFactory->create();

$collection->addAttributeToFilter('sku', '5');

$collection->addAttributeToSelect('*');

foreach ($collection as $product) {
    echo 'hi';
    $product->setData('short_description', 'It is a good cloth to wear');
    $product->save();
    echo "Product Updated" . " ";
}


texts: I need to implement captcha while registering a customer, how?

texts: Is there any free extension or plugin for implementing captcha while registering a customer ? or I need to configure custom level?


texts: Updating the file app/Mage.php clears my cache and solves redirect problem. Why?

texts:
Last night I was in the process of launching an upgraded Magento site but ran into caching problems which ultimately caused me to postpone the launch.

My setup:

New site (1.9): new.domain.com -> no cache
Old site (1.7): domain.com -> memcache/redis/fpc

Both sites are on the same server in folders corresponding to their domain name

My process:

Rename folder domain.com to domain.com.backup
Rename folder new.domain.com to domain.com
Create maintenance.flag
Update .htaccess file to use domain.com instead of new.domain.com
Rename /app/etc/local.xml to /app/etc/local.xml.backup
Rename /var/cache to /var/cache.backup
Rename /var/session to /var/session.backup
Flush Magento cache, memcache and redis

At this point, I'm hoping to refresh the page and get the Magento installation page so I can upgrade the live database (after backing up of course). However, I received an error message about failing to open a stream in a PHP file at new.domain.com.

So the base URL of new.domain.com must have been cached by the Magento configuration but there was no way for me to clear it. Anyways, after several hours of trial and error I finally came up with a pretty ridiculous solution.

All I need to do when moving the site between domains is simply update the app/Mage.php file (e.g. download and reupload). No actual change to the file source is needed.

Now to my main question. Why does updating the Mage.php file seemingly result in the clearing of the Magento configuration cache?

@John

Thanks for the comment. I did suspect that the cache was invalidating due to the timestamp change to that file. I cleared the var/cache folder by renaming it but this had no effect since I'm using memcache instead of the file system for the standard Magento cache management.

It would seem that just simply using the Flush Magento Cache and Flush Cache Storage buttons do not actually cause the memcached configuration to be refreshed (along with flushing it from the command line). Updating Mage.php is the only thing that seems to trigger the refresh.


texts:
This is my array

Array
(
    [JANETS] => 2
    [ROYR] => 2
)

I want to convert this format.

Array
(
    [0] => Array
        (
            [name] => JANETS
            [count] => 2
        )

    [1] => Array
        (
           [name] => ROYR
           [count] => 2
        )
)


texts: Checking if child products of a configurable product have a special price?

texts:
The following code has been added to the list.phtml but is working only for simple products. When they have an special price with a date range, a sale label is attached to the product image on the category pages. This is also displaying a new label on products that are set as NEW with a date range (the new label is working for all products).
I am trying to find a way to combine a special price check that works for simple products and for configurable products in the case that all child products of a configurable product have an special price.
<?php
$specialprice = $_product->getSpecialPrice();
$specialPriceFromDate = $_product->getSpecialFromDate();
$specialPriceToDate = $_product->getSpecialToDate();
$now = date("Y-m-d");
$newsFrom = substr($_product->getNewsFromDate(), 0, 10);
$newsTo = substr($_product->getNewsToDate(), 0, 10);
$today = time();
$class_has_new = "";
if ($newsTo != '' || $newsFrom != '') {
    if (($newsTo != '' && $newsFrom != '' && $now >= $newsFrom && $now <= $newsTo) || ($newsTo == '' && $now >= $newsFrom) || ($newsFrom == '' && $now <= $newsTo)) {
        $class_has_new = " has-new";
    }
}
if ($specialprice) {
    if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) || $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)) { ?>
        <div class="label-product label-sale<?php echo $class_has_new; ?>">

                <?php echo __('Sale'); ?>

<?php }
}
?>
<?php
if ($newsTo != '' || $newsFrom != '') {
    if (($newsTo != '' && $newsFrom != '' && $now >= $newsFrom && $now <= $newsTo) || ($newsTo == '' && $now >= $newsFrom) || ($newsFrom == '' && $now <= $newsTo)) { ?>

            <?php echo __('New'); ?>

    <?php }
} ?>


texts:
There are two store views in the site - for EUR and USD. But when creating or editing a product you can set price only on EUR.
Is there a way to set product price in USD also?


texts: Display Products Attributes label is exported CSV file

texts:
I want to display product attributes label in exported csv file from backend file.Currently it display product attributes code in exported csv file.
Thanks


texts: Change all short_description field as empty

texts:
I added 1000+ products with dummy short description as short Description. Now I would like to remove all short description.

I did export all products and made the column empty. Changed short_description as not required in attribute list.

Then I reimported the products. But still those values are there. How to remove short decription value for all products ?


texts: After migrating a Magento webshop to a new host, there suddenly these 2 last days appears hundreds of fake user registration users. They have name like nzyaffmrtk , lrdrbzcuca  and weird emails.. Does anyone know why? What can I do to stop this? With out adding an extension that will rewrite the core files.


texts: How to override footer template in a custom theme

texts:
I'm trying to override the footer template from a custom theme:

vendor/magento/module-theme/view/frontend/templates/html/footer.phtml

Copying the file in my theme folder:

app/design/frontend/<Vendor>/<ThemeName>/Magento_Theme/templates/html/footer.phtml

Then I removed all the content leaving only this:

<div class="footer-container">
</div>

But still I see the whole footer from the Magento's module.

Where am I wrong?


texts: Magento some store configuration are 404

texts:
I have since years a Magento with around 20 stores for each country I sell my products. Recently, I don't know exactly when it started, I'm not able to access to the configuration for 3 stores I simply get a 404 when I switch the these store configuration. I have no problem with the other store.

Do you have any idea how can I debug this ? I tried to disable all the module but still can't access to the configuration...

Thanks a lot for your help !


texts: RGPD - GPDR : what did you do for the moment?

texts:
We try to find information about the famous law GPDR , but we can t see any example of a website which did something yet.
A user can ask to get all personnal information about him. How did you do that exactly ?
Do you have any example ?

Thank you
Thomas


texts: add filter in custom admin grid before load data in magento 2

texts:
Here i have to add filter in charity and fee column,if charity is filled then display in grid otherwise that data  should not show in grid.

But here all record's are displayed.
Thank you..


texts: In Magento 2, add link to admin grid values

texts:
In Magento 2.2.5, I have custom admin grid. I want to add the link(product edit details or customer edit details) for the table data(id).
It should have the product edit link. How to achieve this.


texts: Send email notification whenever people subscribed to recurring subscription product

texts: Is there a way I can send an email notification to user whenever magento recurring profile is created??


texts: Get/Pass Order Collection From Block/phtml to controller

texts:
I am using magento 1.9 version.
I am having custom order collection in Block and also i can get it in related phtml file too.

But i need the collection data in controller to export CSV.

I tried by setting collection in session and registry. No luck.

How to get it.


texts: Magento core/html_select: Set option class

texts:
Magento offers a function to generate a select from the backend: https://magently.com/blog/dropdown-selects-in-magento/

$select = $this->getLayout()->createBlock( 'core/html_select' )
    ->setName( 'addresses' )
    ->setOptions( $options );

This will give me something like this:

<select name="addresses">
    <option value="address1">address1</option>
    <option value="address2">address2</option>
</select>

but I want to set a class for the options:

<select name="addresses">
    <option value="address1" class="a">address1</option>
    <option value="address2" class="b">address2</option>
</select>

My options look like this:

$options[] = array(
    'value' => $address->getId(),
    'label' => $address->format( 'oneline' ),
    'parvw' => $address->getParvw()
);

parvw is the class parameter for the option

How can I set the class options?


texts: Add "View More" Functionality in Mega Menu

texts:
I have "bizarre magento theme". theme have mega menu default.client want to add "view more" functionality in that. for better understand see below image

From Above image you can see brands category, client want to display 5-6 category in the sub category and "view more" functionality. If user click on "view more" than display all the category in the same way display like image.

Any Kind of help will appreciate.
Magento Version:1.9.3.4

topmenu.phtml file

<?php
$_menu = $this->getHtml('level-top');
$menuStatus = Mage::getStoreConfig('meigee_categoriesenhanced/options/status');
if ($menuStatus == 1) {
    $navAttr = 'class="nav-wide"';
}
else {
    $navAttr = 'class="nav"';
}

?>

    <ul <?php echo $navAttr; ?>>
    <?php echo $_menu; ?>

here is my topmenu file.


texts: Adding single product in multiple quantity to wishlist at a time from product details page

texts:
On product details page, there is QTY textbox present, but that follows the "Add to Cart" button.
Whatever quantity I add to it, will be accounted for "Adding the product to cart in that particular quantity"

But what i want is a similar textbox, that follows the "Add to Wishlist" button. How do I accomplish the task of adding the product to wishlist in the quanitity specified in a textbox?????

Thanks in Advance


texts: Solved: If extension does not have adminhtml.xml and Adminhtml folder, how to solve 404?

texts:
After applying patch 6788, I know that config.xml must be edited. My extension does not have the Adminhtml folder and its xml file, so after making changes still I'm getting 404. Below is the config.xml. What would be the correct "action" statement?

<?xml version="1.0"?>

<config>
    <modules>
        <J_G>
            <version>1.0.0</version>
        </J_G>
    </modules>

    <global>
        <helpers>
            <g>
                <class>J_G_Helper</class>
            </g>
        </helpers>

        <blocks>
            <j_g>
                <class>J_G_Block</class>
            </j_g>
        </blocks>
    </global>

    <admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <J_G after="Mage_Adminhtml">J_G_Adminhtml</J_G>
                    <frontName>g</frontName>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

    <adminhtml>
        <menu>
            <gr>
                <children>
                    <custom translate="title" module="g">
                        <title>Custom</title>
                        <sort_order>90</sort_order>
                        <children>
                            <sales translate="title" module="g">
                                <title>Sales</title>
                                <sort_order>10</sort_order>
                                <children>
                                    <top translate="title" module="g">
                                        <title>Payment Method</title>
                                        <sort_order>10</sort_order>
                                        <action>adminhtml/g_sales_paymentmethod</action>
                                    </top>
                                </children>
                            </sales>
                        </children>
                    </custom>
                </children>
            </gr>
        </menu>....


texts: Checkout agreements data-bind is not working

texts:
Checkout agreements data-bind to HTML is not working after upgrade to Magento version 2.2.8

      <input type="button" class="action action-show 3"
            data-bind="click: function(data, event) { return $parent.showContent(data, event) }">

      </input>

On frontend showing HTML everything seems okay with js


texts: Magento 2: How to sort product on Category page by entity id in desc order?

texts: I need to show all the newly created products on top. So need to arrange all the products according entity id in descending order


texts: Attempted upgrade from 1.9.0.1 to 1.9.1.0 => Exception error: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'mage_core_email_queue'

texts:
To begin I already tried the following:

I located the root directory where my Magento is installed and searched for the “errors” directory.
I changed the filename of local.xml.sample to local.xml
I reloaded the page where it shows error message. I will paste this below.
I located magento_directory/lib/Zend/Cache/Backend/File.php and looked for:

protected $_options = array(

'cache_dir' => 'null',

I replaced it with:

protected $_options = array(
'cache_dir' => 'tmp/',

I saved the file and uploaded it to the server

I created “tmp” in the Magento directory
I refreshed the page and the error that is on every page of the site.

Here is the full error message, I am not sure what to do with it as I usually don't use Magento and am doing this pro-bono for a nonprofit.

Error in file: "/opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'mage_core_email_queue' already exists, query was: CREATE TABLE `mage_core_email_queue` (
  `message_id` int UNSIGNED NOT NULL auto_increment COMMENT 'Message Id' ,
  `entity_id` int UNSIGNED NULL COMMENT 'Entity ID' ,
  `entity_type` varchar(128) NULL COMMENT 'Entity Type' ,
  `event_type` varchar(128) NULL COMMENT 'Event Type' ,
  `message_body_hash` varchar(64) NOT NULL COMMENT 'Message Body Hash' ,
  `message_body` mediumtext NOT NULL COMMENT 'Message Body' ,
  `message_parameters` text NOT NULL COMMENT 'Message Parameters' ,
  `created_at` timestamp NULL default NULL COMMENT 'Creation Time' ,
  `processed_at` timestamp NULL default NULL COMMENT 'Finish Time' ,
  PRIMARY KEY (`message_id`),
  INDEX `747D3AF379628D00D009E037E2942C80` (`entity_id`, `entity_type`, `event_type`, `message_body_hash`)
) COMMENT='Email Queue' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci

Trace:
#0 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.6.0.4', '1.6.0.6')
#2 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.6.0.4', '1.6.0.6')
#3 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /opt/bitnami/apache2/htdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /opt/bitnami/apache2/htdocs/index.php(87): Mage::run('', 'store')
#8 {main}


texts: How to get current product id from registry in controller without use objectmanager in magento2

texts:
use \Magento\Framework\Registry;
class Test extends Action
{
   protected $registry;

   public function __construct(
        Registry $registry
    )
    {
        $this->registry = $registry;
    }

  public function execute()
   {
     $proid = $this->registry->registry('current_product')->getId();
   }

 }

  ->getId()` showing Error "Fatal error: Uncaught Error: Call to a member function getId() on null"


texts: Magento 2 phtml get store view being viewed

texts:
In Magento 2 I have a phtml file I am trying to get what store view is currently being seen by the website visitor.
However it does not seem to work.
I dont want to have to create a whole module or plugin .

if (Mage::app()->getStore()->getId() > '1')
{
      echo "you are 1";
}
elseif (Mage::app()->getStore()->getId() > '2')
{
     echo "you are 2";
}
 else
{
   echo "you are not 1 or 2";
}


texts: Magento2 : How to show custom notice message in checkout page on page load?

texts: I want to display Custom Notice message in Popup on page load in Checkout page.


texts: Access Session Variable within custom module

texts:
On my site i have several pages which set a core session variable as so:

Mage::getSingleton('core/session')->setSellYourArtCheck(1);

If i want to access this anywhere i can successfully do:

Mage::getSingleton('core/session')->getSellYourArtCheck();

But i now need to access this session variable in my custom module but it is showing as empty/null when i try and access it as above.

My Observer.php code for my module:

<?php
class Custom_RegisterArtist_Model_Observer
{
    public function registerArtist(Varien_Event_Observer $observer)
    {
        // other code....

        $is_artist = Mage::getSingleton('core/session')->getSellYourArtCheck();
        if($is_artist == 1)
        {
            $customer->setData('group_id', 4);
        }

        // other code....
     }
}

My $is_artist variable is always empty/null within my module but is fine on any of my pages