texts: How can change layout arrangement and animation effects of minicart Magento 2?

texts:
Is that possible to make new animation effect and layout to mini cart in magento 2.

Thanks


texts:
I am finding a tutorial for AJAX in magento 2. How can I use javascript to trigger a PHP function in Magento 2. In Wordpress, we have this:
https://codex.wordpress.org/AJAX_in_Plugins
I don't know if it is the same for Magento or in Magento world, we use different thing.


texts: Where is the HTML file relating to the line of options below the search bar?

texts: I am trying to add/remove a few links from this line in the header. However, the code is not a block, and so is not available through the backend. Each part is its own block, and though I found the search bar, I have not found the part relating to the links. And help at all would be great.


texts: Adding rel="next"/"prev" tags based upon pagination

texts:
For SEO purposes, I'm attempting to add link tags to the head block so that I can reference the previous and next blog pages like so:
<link rel="prev" href="http://citygear.dev/blog?p=4">
<link rel="next" href="hhttp://citygear.dev/blog?p=6">

FWIW, I'm using the AW_Blog extension, though that's not of great consequence here.
Question
How can I retrieve the paginated collection as it is loaded in the content block so that I can add these tags to the header?
The snippet of my layout XML:
    <reference name="head">
        <block type="core/template" name="canonical_blog" template="page/html/canonical_pager.phtml" />
    </reference>
    <reference name="content">
        <block type="blog/blog" name="blog" template="aw_blog/blog.phtml">
            <block type="blog/product_toolbar" name="aw_blog_list_toolbar" template="catalog/product/list/toolbar.phtml">
                <block type="page/html_pager" name="product_list_toolbar_pager"/>
            </block>
        </block>
    </reference>

What I've tried
Per the layout file above, I've tried to add a template to the head so that I can render the link tags.  I've tried within that file to reference the product_list_toolbar_pager block (as shown below), but the collection isn't available when loaded in the header.
$pager_block = $this->getLayout()->getBlock('product_list_toolbar_pager');
$pager_block->getCollection()->getSize() returns a fatal error because $pager_block->getCollection() is null
EDIT
Per Amasty's answer below, I tried the following, but $this->pagerBlock->getCollection() is still null.
Add a new Block (AW_Blog_Block_Relpager) with the following constructor:
protected function _construct()
{
    /**
     * @var Mage_Core_Model_Layout
     */
    $layout = Mage::app()->getLayout();

    /**
     * @var Mage_Page_Block_Html_Head
     */
    $headBlock = $layout->getBlock('head');

    /**
     * @var Mage_Page_Block_Html_Pager|null
     */
    $pagerBlock = $layout->getBlock('product_list_toolbar_pager');
    $this->pagerBlock = $pagerBlock;

    $this->setTemplate('aw_blog/blog_rel.phtml');

    /**
     * Append block to header block
     */
    $headBlock->setChild('rel_paginator', $this);

    parent::_construct();
}

Referring to the layout above, I added  the following immediately underneath product_list_toolbar_pager
                <block type="blog/relpager" name="rel_paginator" />


texts: How to Install github magento extension?

texts:
Bit of a daft question, but I need some advice.
I have found an extension on github and downloaded it to my PC.
When it comes to uploading it to my server via FTP, I know I should copy across the ‘app’ folder but there are also files called ‘composer.json’ and the ‘LICENSE’ file.
Do I also have to upload them too?
Thanks for any help.
Sam.


texts: Address Verification Failure - Error Message (Authorize.net) - Server Error

texts:
When a customer checks out on my Magento 2 website, and the credit card is rejected due to an AVS mismatch (Authorize.net), Magento 2 only says "server error". Where can I edit this to say "Address verification failure"?

On Magento 1, I was able to install a plugin that allowed for Authorize.net to provide customers with custom messages. This is not available for Magento 2, so I would just like to change "server error" to "address verification failure" so the customers know that is why their order did not go through.


texts: Magento 2: SQL get orders with specific option id

texts:
I'm trying to get all orders with a specific option id to see what percentage of orders are ordered with measurement of centimeters.

Not very good with database queries and I can't seem to figure it out.

I've looked inside the sales_order_item table but it doesn't have an option_id column.

I need to find another way around this.


texts: 4 different orders need to be assigned to one customer

texts: So this is frustrating me a little, I joined the company 8 months ago, Magento is used and I have been learning how to use it and make it better for the company. This has been successful, however upon updating the database and training staff to input correctly, some orders are created as new with details missing etc, I need to combine these processed orders with the original account. Is this possible? Highly frustrating. Please help.


texts: How to restrict add to cart for GENERAL group

texts:
I have restricted add to cart for not logged customer, but need also funcionality to restrict it for General group. How to do it?
Part off my code

<!--moj kod usun add to cart-->
                <?php if (Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
                    <div class="add-to-box">
                          <?php if($_product->isSaleable()): ?>
                            <?php echo $this->getChildHtml('addtocart') ?>
                        <?php endif; ?>
                        <?php //echo $this->getChildHtml('addto') ?>
                    </div>
                    <?php } ?>
                    <!--koniec mojego kodu-->


texts: Magento 2 - How to debug Repository SQL?

texts:
How to debug generated sql query/s from repository.

i need to debug: $this->addressRepo->getList($cirteria)->getSearchCriteria(); on this example.

public function getSuperUserCompanyAddresses(){
    $objectManager =   ObjectManager::getInstance();
    /**
     * @var $criteria SearchCriteriaBuilder
     * @var $filter_1 FilterBuilder
     */
    $criteria = $objectManager->create(SearchCriteriaBuilder::class);
    $filter_1 = $objectManager->create(FilterBuilder::class);

    $filters[] = $filter_1
        ->setField(self::ADDRESS_COMPANY_KEY)
        ->setConditionType('eq')
        ->setValue((int) ($this->getCustomAttribute('company_id')->getValue()) )
        ->create();

    $cirteria = $criteria->addFilters($filters)->create();
    /**
     * @var $addresses \Magento\Customer\Api\Data\AddressInterface[]|null
     */
    $addresses = $this->addressRepo->getList($cirteria)->getSearchCriteria();

    $this->setAddresses($addresses);
    return parent::getAddresses();
}


texts: How to automatically change shipping price to free shipping if product price is higher than "500"?

texts:
I currently have a one-step-checkout page.

In the following example i'd like the shipping price to automatically be "0" (free shipping) or the string "Free" if the price is higher than xxx.

I've looked around for options to do this in the Magento backend, but cant seem to find anything to do this. I also looked in the Magento extensions library for something there, but no luck.

Guess hardcoding something on frontend-only doesn't quite do it, since this should also reflect/show in emails and invoices.

Any ideas on anything smart out there that could solve this?


texts: How to manage payment after splitting order in Magento 2

texts:
I am having schenario where I need to split order on seller basis. Let's say if customer adds 10 products in a cart which are from 3 different seller A, B, C  out of these 3 are from seller A, 3 from seller B and 4 from seller C in that case I create 3 orders which is working till now.

Now my question is how to manage payment if I am using any online payment gateway systems.

As we need to store transaction Id for these order which we need in case of refund.

Can any one please tell me the correct approach? Is it possible?


texts:
I'm using the Cart2Quote quotation extension for my webshop. Since a day or 2 we have been receiving errors once a new quote is submitted. Clients submitting a quotation get the following error:

Fatal error: Call to a member function getValue() on a non-object in /home/hotelsup/domains/hotel-supply.com/public_html/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php on line 755

Magento is currently running on 1.8.0, and has been running for 3 weeks now with not errors at all. No additional extensions have been installed or any changes made to the system (upgrade etc).

I've contacted C2Q and they told me that this is a Magento error and has nothing to do with the extension. Can someone enlighten me a bit on this error and how I could solve this problem?

Also the quotation is visible in the backend as being submitted, however, when opened the same error is displayed.

Thanks in advance.


texts:
In magento1 we used to have an event controller_front_init_routers which could be used to add any route name dynamically based on some logic.

I would like to add a route name which is saved in the database (System Conifguration).

Is there any way we could do something similar in magento2 ?


texts: Remove newsletter link from customer account navigation

texts:
How do you remove the newsletter link from the customer account navigation in Magento?

We have started using the Advanced Newsletter extension and now have two newsletter links in our customer account navigation, one for the the default newsletter and the other for the default newsletter.

I can see that the default newsletter link is added to customer account nav in app/design/frontend/base/default/layout/newsletter.xml on ln 48 with:

<customer_account>
    <!-- Mage_Newsletter -->
    <reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
    </reference>
    <remove name="left.newsletter"/>
</customer_account>

I've tried removing this link in our theme's local.xml with:

<reference name="customer_account_navigation">
    <!--<action method="removeLinkByName"><name>newsletter</name></action>-->
    <!--<remove name="newsletter"/>-->
    <action method="removeLinkByUrl"><url helper="newsletter/manage/"/></action>
</reference>

None of these methods have worked for me & I get an error when I try to remove them with an action method.

<action method="removeLinkByName"><name>newsletter</name></action> gives this error: Invalid method Mage_Customer_Block_Account_Navigation::removeLinkByName(Array

<action method="removeLinkByUrl"><url helper="newsletter/manage/"/></action> gives this error: Fatal error: Class 'Mage_Newsletter_Helper_Manage' not found in /app/Mage.php on line 546

While <remove name="newsletter"/> gives no error but does not remove the link


texts: How to avoid options reset after changing an option for a configurable product?

texts:
I have a configurable product with 3 options (all dropdowns).
The first problem is that only the first dropdown is active but other 2 remain inactive until the first is selected. How to enable all the dropdowns?
The second problem is that if I select all 3 options and then, change 1 option, I have to select again the other 2 options. How to save the other chosen options?

Thank you!


texts:
I am adding breadcrumb block on layout file contact_index_index.xml but not showing on contact page.

Following code for contact_index_index.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact Us</title>
    </head>
    <body>
        <referenceContainer name="content">
             <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
            <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                <container name="form.additional.info" label="Form Additional Info"/>
            </block>
        </referenceContainer>
    </body>
</page>

I want to show breadcrumb on contactus page.


texts: Multi Site any page getting 404 any time

texts:
I am working on multi-site store but I have found I am getting 404 error page for second store any time and any page but after refresh that page works fine.

After investigating this I have found that if I disable configuration cache than all problems have been resolved.

Is that module specific issue or other? I am not getting that. Anyone have an idea?


texts: Items Out of Stock. even though they have been just added

texts:
I realized that our latest added list of products that been just uploaded disappeared from our front-end. So I checked Magento, and the all those products had their stock at "zero" even though they just have been "replenished".

what could be causing this? and how should I solve this issue?


texts:
I am using Magento-2.1.7 and I want to change order, invoice and shipment number from 10000001 to 20000000.

How can I do this?


texts:
I'm trying to install extensions using the extension manager, I have my access keys set, when entering the extension manager page, it's always stuck on "Please wait". The console log shows the below:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
angular.js:533 Possibly unhandled rejection: {"data":"","status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"index.php/extensionGrid/extensions","headers":{"Accept":"application/json, text/plain, */*","Cache-Control":"no-cache, no-store, must-revalidate","Pragma":"no-cache","Expires":0}},"statusText":"Internal Server Error","xhrStatus":"complete"}
(anonymous) @ angular.js:533
/setup/index.php/extensionGrid/extensions:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
angular.js:533 Possibly unhandled rejection: {"data":"","status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"index.php/extensionGrid/extensions","headers":{"Accept":"application/json, text/plain, */*","Cache-Control":"no-cache, no-store, must-revalidate","Pragma":"no-cache","Expires":0}},"statusText":"Internal Server Error","xhrStatus":"complete"}
(anonymous) @ angular.js:533
angular.js:12571 POST https://website.com/setup/index.php/session/prolong 500 (Internal Server Error)
(anonymous) @ angular.js:12571
n @ angular.js:11748
(anonymous) @ angular.js:11263
(anonymous) @ angular.js:6988
$digest @ angular.js:8414
$apply @ angular.js:8817
(anonymous) @ angular.js:12941
23angular.js:12571 GET https://website.com/setup/index.php/session/unlogin 401 (Unauthorized)


texts: Remove second level category from product url

texts:
I need to display only first level category inside product url. If visitors browse and click product inside categorylevel1/categorylevel2.html, I need to show domain.com/categorylevel1/product.html and NOT domain.com/categorylevel1/categorylevel2/product.html

Is there any easy way to do that?


texts: Product List Page Sort by Most View ( can we sort this by page views/hits)

texts:
I Want To Sort By Product Listing Page using Most View. Most View means highest Product visited Display First. means highest show product to Lowest
Product. What Can Change i Don't Understand. Can You Give any Idea about that.

This want to create in select box sort by MOST VIEW


texts: Set skin url as unsecure in email template at the backend

texts:
Is there a way to set skin url to be unsecure in img tag in email template content at the Magento backend.

My tag would be:

<img src="{{skin url="images/registration-email/logo.jpg" _area="frontend" _package="xyz"}}" />


texts:
PayPal are dropping SSLv3 support in December, how can I ensure my store will still function when this happens.

Are there any tests I can run to check?


texts: Magento 2.3 - Hook into customer attribute value save logic

texts:
I need to keep a log of customer attributes value changes. For every update on the user's account information, both from admin and frontend, I'm inserting a row in a flat log table with the old and the new value of every customer attribute that was changed. For this purpose I've created a custom module and implemented a pretty standard CRUD functionality to persist and manage all log entries. The next step is to find the appropriate location to capture customer attribute value update to hook my save logic . So far I've identified some potential locations but I'm not 100% sure it's they are the right ones:

\Magento\Customer\Model\Customer::updateData
\Magento\Customer\Model\Plugin\CustomerRepository\TransactionWrapper::aroundSave
(this is already a plugin)

Am I on the right path?


texts:
Due to the business logic and requirement, I need the order item price not to be rounded. Because if you are purchasing the product with high quantity, the loss could be numbered.

E.g:
Product price: $48.9383
Qty: 10

The collect total process will give a result at below
Cart Subtotal: $48.94

I see the roundPrice function they used in currency interface but I wonder how can I just skip the round step for only a few specific places and not touch or mess up other processes.


texts:
I'm trying go get parameters from my submitted form (my form is devided in two parts). When I submit my first form, my page go to the second part (on the right view). But I'm stuck here. I have that :

class Form extends Action
{
    protected $_resultPageFactory;

    public function __construct(Context $context, PageFactory $resultPageFactory)
    {
        $this->_resultPageFactory = $resultPageFactory;
        parent::__construct($context);
    }

    public function execute()
    {
        $name = $this->getRequest()->getParam('name');
        $resultPage = $this->_resultPageFactory->create();
        return $resultPage;
    }

How do I display $name on my view ? Here's my view, I tried :

<?php echo $name; ?>
<?php echo $this->name; ?>

None of these worked.

EDIT : in post method in my form, my url is like that :

http://dev.site.com/connexion/connexion/Form/name/nameofclient/code/00theCode00/

EDIT SOLUTION :
This one didn't work :

$params = $block->getRequest()->getParams();

But this one did :

echo $block->getRequest()->getParam('name');

Thank you very much for your answer, it was helpful !


texts:
I am currently creating my first widget. The goal is to create an extended version of the existing Product Link Widget, which allows you to add your own image that links to the product detail view.

So far, my widget code looks like this:

widget.xml

<?xml version="1.0" encoding="UTF-8"?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget class="Vendor\ImageTeaser\Block\Widget\ImageTeaser" id="vendor_imageteaser_imageteaser">
        Image Teaser
        <description>catalog product teaser with image</description>
        <parameters>
            <parameter name="id_path" xsi:type="block" visible="true" required="true" sort_order="10">
                Product
                <block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser">
                    <data>
                        <item name="button" xsi:type="array">
                            <item name="open" xsi:type="string" translate="true">Select Product...</item>
                        </item>
                    </data>
                </block>
            </parameter>
            <parameter name="anchor_text" xsi:type="text" visible="true">
                Anchor Custom Text
                <description translate="true">If empty, we'll use the product name here.</description>
            </parameter>
            <parameter name="title" xsi:type="text" visible="true">
                Anchor Custom Title
            </parameter>
            <parameter name="image_path" xsi:type="text" visible="true">
                Image Path
                <description translate="true">Relative image path from public root</description>
            </parameter>
            <parameter name="image_alt" xsi:type="text" visible="true">
                Image Alternative Text
                <description translate="true">If empty, we'll use the product name here.</description>
            </parameter>
        </parameters>
    </widget>
</widgets>

link_image.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>

    <a <?= /* @noEscape */ $block->getLinkAttributes() ?>>
    <img src="<?= $block->getData('image_path'); ?>" alt="<?= $block->getData('image_alt'); ?>" />

<?= $block->getData('id_path') ?>

My problem is that I do not know how to create the link from the id_path attribute in the template.

I am grateful for every hint!


texts: I want to create admin role and assign a user to it with only sales and catalog resources by installer is any one having idea for this.


texts:
this is my config.xml file code. I want to add my module Matrid_FeedManager submenu in Catalog but its not working

</admin>
<adminhtml>
    <menu>
        <catalog>
            <children>
                <web module="web">
                    <title>Matrid_FeedManager</title>
                    <sort_order>30</sort_order>
                    <children>
                        <items module="web">
                            <title>Manage Items</title>
                            <sort_order>8</sort_order>
                            <action>web/adminhtml_web</action>
                        </items>
                    </children>
                </web>
            </children>
        </catalog>
    </menu>
    <acl>


texts:
I just copied the data form the site on which I'll work but after replacing that data with my custom luma first it gives me the Permission error I give them permission but after that it gives me

  1 exception(s):
  Exception #0 (InvalidArgumentException): Required parameter
  'theme_dir' was not passed

  Exception #0 (InvalidArgumentException): Required parameter
  'theme_dir' was not passed #1
  Magento\Framework\View\Design\Fallback\Rule\Theme->getPatternDirs(array('area'
  => 'frontend', 'locale' => 'en_GB', 'file' => 'i18n/en_GB.csv', 'theme_dir' => NULL)) called at
  [vendor/magento/framework/View/Design/FileResolution/Fallback/Resolver/Simple.php:124]

n also when I go to admin panal its not going to admin panel i.e. I'm using Localhost as you can see from the image but when I tries locahost/magento/admin it goes to https//locahost/magento/admin without my permission.

So how to solve this error I'll be really thankful


texts: How do I specify unique constraint for multiple columns in InstallSchema.php?

texts:
In the InstallSchema.php, I would like to add an unique contraint on a combination of column.

In SQL, it would be done with this request:

ALTER TABLE `linked_cities` ADD UNIQUE `unique_index`(`vendor`, `zip`, `city`);

Is there a way to do that with the Magento ORM in order to avoid any further intervention on the database?

Regards


texts: Export products to csv/excel for comfortable view additional attributes

texts:
When I do export of products to csv all 'additional_attributes' are in one column.

This is not comfortable to read for client or content manager via MsExcel for example.
Need that all the custom attributes were in separate columns.

Any ideas how to implement this feature or how to make this manually?

Maybe somewhere exist a free or paid module with required functionality?


texts: Can you define a custom target_path for specific products

texts:
I have a unique situation being thrown at me here.

I have a product which in every way is a standard Magento catalog product.  Has an entity id, sku, attributes the whole works.

None of this can change.

However, the powers that be would like any users hitting this product's request_path to go to another url, not the standard catalog/product/view target_path.

I've tried accomplishing this via the Url Rewrite Management panel, but Magento will not allow it since (if I select Product Rewrite) it locks the catalog/product/view in the target_path input field, or (if I select Custom) it will throw a duplicate record error if I try to direct the current request_path to the new target_path.

Is there any way to specify a custom target_path for a catalog product that does not follow the standard catalog/product/view/id/# format, or are they asking to force a square peg in a round hole?

To be clear, what we have is:

id_path        request_path       target_path
product/12345  this-product.html  catalog/product/view/id/12345

and what we want to accomplish is:

id_path        request_path       target_path
product/12345  this-product.html  custom/url/path

Editing the record directly, as I understand it, is pointless, since the url indexing will just overwrite the custom target_path. Or am I wrong?


texts: Extend tier_price.phtml in child theme of a custom theme Magento 2

texts:
From:

  /vendor/magento/module-configurable-product/view/base/templates/product/price/tier_price.phtml

To:

  /app/design/frontend/Mgs/claue_child/Magento_Catalog/templates/product/tier_price.phtml

I create child theme now want to extend few files but i am stuck.

Flushed cache and added the site in developer mode.

Tried : How to overwrite tier_price.phtml in Magento 2

Update Solution: Correct path:

  app/design/frontend/Mgs/claue_child/Magento_ConfigurableProduct/templates/product/price/tier_price.phtml

Command used : sudo rm -rf var/ && sudo rm -rf pub/static && sudo php bin/magento setup:static-content:deploy -f && sudo php bin/magento cache:flush && sudo chown www-data:www-data  -R *

Thank you @chirag-patel and @ylgen-guxholli for your support.


texts: How does it get determined which layout handles a request will use?

texts:
Which rules exist?

Is it just a question of configuration?

Can I manipulate it?

Is the order relevant (which I have seen with the Layoutviewer module)?


texts: Magento 2: how to declare a custom email template for your module

texts:
In Magento 1, you could declare email templates directly in the config.xml like this:

<template>
    <email>
        <custom_email_template translate="label" module="modulename">
            <label>Custom Email Template</label>
            <file>vendor/modulename/custom_email_template.html</file>
            <type>html</type>
        </custom_email_template>
    </email>
</template>

Then you only had to create the following file app/locale/<lang_LANG>/template/email/vendor/modulename/custom_email_template.html

How can we achieve that in Magento 2 ?


texts: Magento 2: Remove requirejs in checkout phase

texts:
I have a question over Magento 2 checkout phase.
I don't want to talk about the decision of force developer to user requirejs knockoutjs and so on...

Exist an extension which reproduce the checkout phase without the dependency of requirejs?


texts: Onepage Checkout, unable to place the order getting Prototype.js error

texts:
When i click on  Checkout as Guest or Register, I'm getting this error,Unable to proceed on any steps.

TypeError: e is not a function

...complete:!1,initialize:function(e,t,n){e(n),this.transport=Ajax.getTransport(),t...

How can i fix this..?
Thanks


texts: Right way of calling Block in controller magento 2

texts:
I need to call my custom class like below as it is done in magento 1x:

I need to Generate New Layered Navigation Menu

$viewPanel = $this->getLayout()->getBlock('catalog.leftnav')->toHtml();

$productList = $this->getLayout()->getBlock('product_list')->toHtml();

Should i use pageFactory like as:

$viewPanel= $resultPageFactory->getLayout()->createBlock('Vendor\Module\Block\Product\ListProduct');

Or use:

$viewPanel= $this->_view->getLayout()->createBlock('Tagalys\Tglcatalog\Block\Product\ListProduct');

and _view is from use Magento\Framework\View\LayoutInterface; ?

Which is correct way of calling ?


texts: How to create core module for my other modules?

texts:
I need to know how to create a core module for dependency of other my modules? Like so: amasty_core amasty_layerednavigation that layered navigation needs core module.

I need it on Magento 2.1.9

Thanks a lot in advance.


texts: How to add same product with different price for multiple cities

texts:
I am creating a multi store Magento website in 1.9.2.4, feel free to see the demo Demo of My site

I also added few products(Grocery & Frozen) under different cities - Jamnagar, Ahmedabad, Surat.

Prices of the products price & taxes (if applicable)vary from city to city, now I'm in panic thinking that for same product I have to create each of them with  different price and taxes for each each respectively.

My question is - What I am thinking is correct, is this only way to add products for each cities, or is there any easy or convenient method preset in Magento. Kindly suggest the best option.


texts: Error on loading Algolia instant search page

texts:
I'm using Algolia search with the Magento AlgoliaSearch integration (https://github.com/algolia/algoliasearch-magento).

Now I'm facing the problem, when hitting enter in the autocomplete search as long as there are any suggestions, I receive an JS error on loading the instant search results page.

At the moment the autocomplete search returns that there are no results found, the instant search results load correctly and I'm also able to refine the search/perform a search on other terms in the searchbox on the instant results page without any issues.

I've already found out, that the problem is loading the template that is done in this line (instantsearch.js: 28)

var wrapperTemplate = algoliaBundle.Hogan.compile($('#instant_wrapper_template').html());

As long as the autocomplete search returns any results, $('#instant_wrapper_template').html() is undefined.

From the moment on the autocomplete search has no results the correct content contained in $('#instant_wrapper_template').html() (defined in algoliasearch-magento/app/design/frontend/base/default/template/algoliasearch/instantsearch/wrapper.phtml) is loaded.

I'm not sure if I'm missing something, but I hope that someone of you can help me.


texts: I'm having problems with the credit card payment transaction and I'm kind of sure that the quote_id is the cause of it. The problem is I don't know how to increment manually the quote_id in order to find out if I'm right or I'm wrong.


texts: Magento Invalid method isStateProvinceRequired

texts:
I am receiving following error when i put a product into the shopping cart and go to the shopping cart i am receiving following error:

a:5:{i:0;s:88:"Invalid method Amasty_Shiprules_Block_Cart_Shipping::isStateProvinceRequired(Array
(
)
)";i:1;s:3968:"
app/design/frontend/vitacatalog/default/template/checkout/cart/shipping.phtml(42): Varien_Object->__call('isStateProvince...', Array)
app/design/frontend/vitacatalog/default/template/checkout/cart/shipping.phtml(42): Amasty_Shiprules_Block_Cart_Shipping->isStateProvinceRequired()
app/code/core/Mage/Core/Block/Template.php(241): include('/home/checkvit/...')
app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/vitaca...')
app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('shipping', true)
app/design/frontend/vitacatalog/default/template/checkout/cart.phtml(127): Mage_Core_Block_Abstract->getChildHtml('shipping')
app/code/core/Mage/Core/Block/Template.php(241): include('/home/checkvit/...')
app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/vitaca...')
app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true)
app/design/frontend/vitacatalog/default/template/page/1column.phtml(48): Mage_Core_Block_Abstract->getChildHtml('content')
app/code/core/Mage/Core/Block/Template.php(241): include('/home/checkvit/...')
app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/vitaca...')
app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
app/code/core/Mage/Checkout/controllers/CartController.php(181): Mage_Core_Controller_Varien_Action->renderLayout()
app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_CartController->indexAction()
app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
app/Mage.php(684): Mage_Core_Model_App->run(Array)
index.php(83): Mage::run('', 'store')
{main}";s:3:"url";s:15:"/checkout/cart/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

I have checked the required state provinces in the backend but still getting it.


texts: Running magento admin code in external script for import

texts:
I'm trying to import products from csv by calling an external script. I've done the same for export and this has been smooth. However, import is failing, as it doesn't seem to properly translate the attribute options.
Also Error messages aren't properly translated.

See this minimized code:

Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
//already tried all of the following....
Mage::getSingleton('core/translate')
    ->setLocale(Mage::app()->getLocale()->getLocaleCode())
    ->init('adminhtml', true);
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
Mage::app()->loadArea(Mage_Core_Model_App_Area::AREA_ADMINHTML);
//very basic import code
$import = Mage::getModel('importexport/import');
$import->setEntity('catalog_product');
$import->validateSource("/tmp/test.csv");
foreach ($import->getErrors() as $errorCode => $rows) {
     echo $errorCode . ' in rows: ' . implode(', ', $rows);
}

Now, this gives all rows invalid. Strangely, I get something like this

0 in rows: 1, 1, 8, 8, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, 32, 32, 44, 44{{{Orphan rows that will be skipped due default row errors}}{{Orphan rows that will be skipped due default row errors}}{{Orphan rows that will be skipped due default row errors}}{{Mage_ImportExport}}} in rows: 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47Checked rows: 47, checked entities: 9, invalid rows: 47, total errors: 5673

I debugged my way through the magento code base. The first Error "0" is actually
Mage_ImportExport_Model_Import_Entity_Abstract saying:

 $this->addRowError(Mage::helper('importexport')->__("Invalid value for '%s'"), $rowNum, $attrCode);

And this again because it can't match an attribute option "Konfiguration verwenden" against the attributes options, because there something similar to the other error messagesgoes havoc with the translation, i.e. it has multile {{{/}}} seperated string.

Any clue? Sounds like I'm missing a single line.

regards
Alex


texts: Using media on Cloud Storage method with own domain

texts:
I have a Magento 2 with a Marketplace module running in Google Cloud. I want store images on Google Cloud Storage.
What is the best solution thinking that the store have vendors that store images all the time?
I did some research and i found two options

rsync media folder with the bucket
mount the bucket in the VM with google cloud storage FUSE

Did someone have this kind of integration working on a Magento 2?


texts: How $this in a Template Stands for Its Associated Block Type?

texts:
So point is simple. If I have a template that is defined like this

<block type="custom/block" name="custom.block" template="custom/template.phtml" />

Then $this that I am going to use in the template custom/template.phtml will stand for the block class Namespace_Modulename_Block_Custom_Block. How it is making possible in Magento.

Recently I have tried to do the same trick in a core php work. But when I try to do

$this =  new someClass();

It says, you cannot alter $this variable like that.

This doubt is with me from the start time. I really need a nice explanation(using relevant codes) for this.

So can you enlighten me with your knowledge on this?


texts:
I want to know, if

 controller_action_predispatch_checkout_cart_add

will only be called, when a product is added to cart from product page, or if this event will also be called, when I add a product, which is on the wishlist of the customer to the shopping cart.

I have to deal with inconsistencies regarding my shopping cart, since I want to remove other products with certain attributes, which shouldn't be able to buy them together.

On my platform, every product which can be sold is UNIQUE and they all have a quantity of one. But sometimes it happens, that the computation of the price will take a product twice into account of the calculation.

Do you have any ideas or experience with altering the quote of the current shopping cart and even with old quotes that might be loaded, when a current quote is not used anymore?

I can provide code examples, if you think, that they might help you to better understand my problem.

It may work, if I change this code

        <controller_action_predispatch_checkout_cart_add>
            <observers>
                <customoptions>
                    <type>singleton</type>
                    <class>Namespace_Module_Model_Observer</class>
                    <method>checkoutCartProductAddBefore</method>
                </customoptions>
            </observers>
        </controller_action_predispatch_checkout_cart_add>

to

        <sales_quote_product_add_after>
            <observers>
                <customoptions>
                    <type>singleton</type>
                    <class>Namespace_Module_Model_Observer</class>
                    <method>checkoutCartProductAddBefore</method>
                </customoptions>
            </observers>
        </sales_quote_product_add_after>

What do you think?


texts: Is anybody aware of a Magento 2 theme based on SASS and Bootstrap 3 or 4?  I found this SASS based theme https://github.com/SnowdogApps/magento2-theme-blank-sass , but it's using LESS.  How much effort would it take to convert it to bootstrap?


texts:
I have tried to reset the password via "forgot password" link in the login page. After I fill in the email address and clicked submit. I have got the below message

  If there is an account associated with this@gmail.com you
  will receive an email with a link to reset your password.

But I'm not receiving any email related to change the password. Checked Spam folder as well but without success.

Could anyone please help me?

Magento version: 2.3 Community Version


texts: Search results containing Chinese pages?

texts:
I'm struggling with a, once hacked, Magento 1.9 webshop that somehow keeps generating malicious pages that are crawled by Google.

The client came to us as he thought the shop could be hacked.
We discovered that the webshop was indeed hacked and that pretty much all necessary security patches were missing.

We first cleaned the site, installed all the patches and rechecked the webshop several times only to find out that everything was back to normal.
However, starting a couple of weeks ago many "Chinese" results are appearing in the search engines.

The URL's look like - http://www.mywebsite.com/5iadl2930d9e3d.html both titles and descriptions are filled with Chinese text.

What would be the place to start and where are these URL generated from?


texts: Display shipping method for special customer group only

texts:
I want to display certain shipping methods - like "collection by customer" for special customer groups only.
All I found is the Amasty "Shipping & Payment By Customer Groups" extension. Is there a free way to do that?


texts: Redirect from /en/page.html to page.html

texts:
How can I automatically redirect custom pages from this URL

site.com/en/page.html

to this URL

site.com/page.html

In order to avoid problems with Google Search Console?


texts: How to Observe 'add to cart' multiple option of a product

texts:
I am new to Magento.I have extended core module checkout/cart to add to cart with multiple options of product. How can I use the observer with the following event : controller_action_predispatch_checkout_cart_add

My code:

config.xml

<controller_action_predispatch_checkout_cart_add>
            <observers>
                <flycart_disable_shopping_cart_page>
                    <type>singleton</type>
                    <class>flycart/observer</class>
                    <method>cartAdd</method>
                </flycart_disable_shopping_cart_page>
            </observers>
        </controller_action_predispatch_checkout_cart_add>

file Observer.php

    <?php   class Custom_Flycart_Model_Observer{
public function cartAdd(){
    // CODE Here    }
        }?>

How can I get multiple products in array post: This is post

I don't know how to use observers in Magento.

sorry about my english because I'm not British


texts: Magento 2 : Can the REST API return plain text?

texts:
I'm trying to make an endpoint for the Magento 2 Web API that simply returns plain text. Is this possible and if so, how?

I'm currently trying this:

webapi.xml:

<route url="/V1/export/txt" method="GET">
    <service class="Vendor\Module\Api\ExportManagementInterface"
             method="getListForExportInTxtFormat"/>
    <resources>
        <resource ref="anonymous"/>
    </resources>
</route>

Method implementation:

/**
 * @return string
 */
public function getListForExportInTxtFormat(): string
{
    $lines = [];
    $items = $this->getListForExport();
    foreach ($items->getItems() as $item) {
        try {
            $lines[] = $this->createLine(
                $item['status'],
                $item['sku']
            );
        } catch (\Exception $exception) {
            // Not a valid status probably
        }
    }

    return implode("\n", $lines);
}

Now when I use this request, the output is wrapped in a single <response> XML node:

<?xml version="1.0"?>
<response>O;       CBAA80511
O;       CBAA80571
A;       CBAA80570</response>

Is there a way that the REST API call can just return the plain TXT, without the wrapping <response>-node? Like this:

O;       CBAA80511
O;       CBAA80571
A;       CBAA80570

I'm using Magento 2.1.2


texts: Move Category Description to Before Layered Navigation

texts:
I have managed to move my category description to the left sidebar, however it is stuck at the bottom, how can I move it to above the layered navigation.

<move element="category.description" destination="sidebar.main" before="-"/>

I have tried using catalog.leftnav but that doesn't seem to work.

Any advice would be appreciated.

Many thanks


texts: How to Override jquery widget method in Magento 2?

texts: I'm trying to override Magento_Checkout/js/sidebar.js _initContent method. I need to delete two events from it and create my own events instead. Is it possible without copying the full method from the original sidebar.js? I created mixin and I can call the original method by this._super() but I don't know how I can access events array in my mixin. Thanks in advance.


texts: Magento2 how to configure code sniffer for git commits

texts:
I would like to set up a code sniffer tool for git commits can anyone have an idea and suggestions or reference link.

My magento verision is 2.3.2 EE

Could you please explain the step by step how to configure it.

I have tried this link https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer but no luck.


texts: Magento 1.9 : What event used before order placed and get shipping information for the order

texts:
For my condition how to get the shipping methods before order placed

My Observer : https://gist.github.com/ZusZus/66da0a7aaeb0db53eff38d8bb89ae941


texts: How to read the csv file in controller in Magento-2?

texts:
I want to read the CSV file for stock update.

My CSV file contains :sku ,qty.

How to read these values?

If anyone knows please explain it to me.


texts: resolution conflict in magento extensions

texts:
I have two modules.

<sales>
   <rewrite>
       <order>Extension_A_Model_Sales_Order</order>
   </rewrite>
</sales>

<sales>
   <rewrite>
       <order>Extension_B_Model_Sales_Order</order>
   </rewrite>
</sales>

I found the following way to fix conflict in them:

<config>
 <modules>
   <Extension_B>
      <depends>
          <Extension_A/>
      </depends>
   </Extension_B>
 </modules>
</config>

Then

I need to use <depends>, what else shall I do to complete this task? Do I need to remove  when using  to fix conflict.

Thanks in advance:)


texts: How to change the Magento 2 email sender called Owner?

texts: I'm receiving the emails from the sender called Owner, as you can see in this image below, how could I change it?


texts:
I have updated the checkout_index_index handle via observer. Now I want to remove the "progress Bar", "Shipping Address", "shipping methods" via observer. So I have tried the below event.

    <event name="layout_load_before">
        <observer name="load_custom_handler" instance="NameSpace\Module\Observer\LayoutLoadBefore" />
    </event>

LayoutLoadBefore:

        public function execute(\Magento\Framework\Event\Observer $observer)
    {
           $layout = $observer->getLayout();
           $layout->getUpdate()->addHandle('checkout_index_index');
           $layout->unsetElement('checkout_onepage_shippingmethod');
           $layout->unsetElement('checkout_onepage_progress');
           //$layout->unsetBlock('shipping-step');
           $layout->getUpdate()->addUpdate('<referenceBlock name="checkout.cart.shipping" display="false"/>');
           //$layout->unsetChild('checkout.steps.shipping-step.shippingAddress');
           return $this;
    }

Still the child elements like "Progress Bar", "Shipping address was not removed". Is there any way to remove this via Event.


texts: i need to change bundle product option design and remove option label in invoice pdf magento2

texts:
I want to change the bundle product option design display in invoice pdf
I want to remove the option name from the invoice pdf of the bundle product invoice
how can I do that?


texts: How do I get Order invoice details from order id

texts:
I need order invoice details such as subTotal, Tax, shipping amount, Discount amount and Grand total..etc.

This is my code :

$orderId = $this->getRequest()->getParam('orderNum');
$order = $this->orderFactory->create()->loadByIncrementId($orderId);
// I need to get invoice details here ...


texts: Remove Add New Address and delete buttons on adminhtml

texts:
I want to remove these 2 buttons denying the ability to create or delete addresses.

How Magento renders this layout? It seems it has to be this file: /module-customer/view/base/ui_component/customer_form.xml

There is the definition of Customer and Addresses fieldset, but where are defined these 2 buttons: add new addresses and delete?

I only can see this:

<fieldset name="address">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="is_collection" xsi:type="boolean">true</item>
            <item name="label" xsi:type="string" translate="true">Addresses</item>
            <item name="removeMessage" xsi:type="string" translate="true">Are you sure you want to delete this item?</item>
        </item>
    </argument>
(...)

The removeMessage is the text displayed when you try to delete an address. But how I remove it?


texts: How to create ui-component and get it in custom block?

texts:
In Magento 2.1.4, I created custom template in backend.

Company/Module/Block/Adminhtml/Edit/Custom has template Company_Module::html/custom.phtml.

custom.phtml code:

<div class="sample">
    ..........
</div>

Now I want to create a custom_ui.xml and set this into block. How to made it?


texts: In hiding price plugin add to cart not working

texts:
I have an extension of mage me which helps to hide the price for not logged in customers and shows for logged in customers.
But add to cart button is not showing in PDP page it is showing in listing page and other places but not in PDP page.
The extension I am using is https://mageme.com/magento-2-hide-price-extension-free.html (it is a free extension anyone can use).
The code required to block the price and add to cart is default.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="product.info.form.options">
        <action method="unsetChild" ifconfig="hideprice/general/enable">
            <argument name="alias" xsi:type="string">product_options_wrapper_bottom</argument>
        </action>
    </referenceBlock>
    <referenceBlock name="product.info">
        <action method="unsetChild" ifconfig="hideprice/general/enable">
            <argument name="alias" xsi:type="string">product_info_form_content</argument>
        </action>
    </referenceBlock>
    <referenceBlock name="product.info.addtocart">
        <action method="setTemplate" ifconfig="hideprice/general/enable">
            <argument name="template" xsi:type="string" />
        </action>
    </referenceBlock>
</page>

Any idea why add to cart is not coming only there.


texts: Magento Value '29,990000' has to be numeric

texts:
I just updated my zendserver. then when I tried to access /admin on my magento local I get the following error Value '29,990000' has to be numeric

I tried to replace

$price = sprintf("%f", $price);

with

$price = (float) $price;

in app/code/core/Mage/Directory/Model/Currency.php
but the above didn't work at all.

Then I tried to change "precision = 14" to "precision = 8" in my php.ini
but still I could find a solution on this issue


texts: Magento2 : How to override less variable value

texts:
How to override default blank theme less variable value?
Generally veriable are declare in lib\web\css\source\lib\variables directory.
i.e from file
    lib\web\css\source\lib\variables_typography.less

@font-family__sans-serif: 'Helvetica Neue', Helvetica, Arial, sans-serif;
@font-family__serif: Georgia, 'Times New Roman', Times, serif;
@font-family__monospace: Menlo, Monaco, Consolas, 'Courier New', monospace;

@font-family__base: @font-family__sans-serif;

I want to change value of above attribute.

From where can I override these varable?
How can I change font-family in body?


texts:
I would like to add module On/Off option in Configuration for custom extension.

I have used below code and add into my system.xml but when I select option No module is not off.

<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
       <label>Enabled</label>
       <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>

Is there any anther code I have to do in other file ?

Or is there wrong in this code ?


texts: Added column to sales_flat_shipment_item, how can I commit value to this new field on order shipment?

texts:
I'm developing a dropship extension.  Everything is going really well.  The integration so far is seamless.  I've added a column to sales_flat_shipment_item, called 'dropshipped'.  Boolean data, defaults to false.  This way normal shipments do their thing the same way as always, but a dropshipped item has this extra flag.  So, when I choose to 'Submit Dropship', how can I attach this custom field to the save?

I have used proper extends calls to use the same system as the normal Order->Shipment workflow.  So, when a use clicks submit, it is effectively all the same class as a normal Shipment submit. (Mage_Adminhtml_Sales_Order_ShipmentController)

I have tried to add the new field to my global fieldset, as shown below.

    <fieldsets>
        <sales_order_shipment>
            <dropshipped>
                <to_shipment_item>*</to_shipment_item>
            </dropshipped>
        </sales_order_shipment>
    </fieldsets>

I am fairly certain something about this config.xml entry is wrong.

So, the new column is called 'dropshipped'.  It is a boolean, by default false.  This way, when the user executes a normal shipment, all the regular functions work normally.  Now, on a dropship, I want to set this field to 'true', or 1.  For example:

 $shipment->setDropshipped(1);

or

 $shipment->setData('dropshipped', 1);

In my custom controller,

Namespace_Module_Adminhtml_Sales_Order_DropshipController extends Mage_Adminhtml_Controller_Sales_Shipment

The code is a copy of Mage_Adminhtml_Sales_Order_ShipmentController except for some descriptive text changes ('shipment' changed to 'dropship' in messages that the user sees) and a couple routing changes to support my custom routes.  In other words, saveAction and _initShipment are unchanged from the Mage core.

My theory is that this is the simplest, most straightforward solution to implementing dropshipping.  One field that flags a sales_flat_shipment_item record as 'dropshipped' is elegant and simple.  So far, my module works with Magento rather than against it, and I'm pretty happy with it.

I'm sure the solution is fairly straightforward, my config.xml might be setup incorrectly, and I'm looking forward to a bit of assistance.  Thanks!


texts: Add Customize Compare Product to Customer Account Page

texts:
I'm new to magento, and I'm struggling with this problem. I want to add Customize Compare Product to Customer Account Page, so i created my customize block in

\template\catalog\product\compare\mycompare.phtml

and in my local.xml I add

<action method="addLink" translate="label" module="catalog">
     <name>catalog.compare.list</name>
     <path>index.php/catalog/product_compare/index/</path>
     My Compare
</action>

<catalog_product_compare_index>
        Catalog Product Compare List

        <update handle="customer_account"/>
        <reference name="my.account.wrapper">
        <block type="catalog/product_compare_list" name="catalog.compare.list" template="catalog/product/compare/mycompare.phtml"/>
        </reference>
</catalog_product_compare_index>

It's work, but that block was called 2 times. And original compare products (one with new windows when clicked) also changed it's layout! How should I do to fix it??


texts: Magento2 : Update translation using API response

texts:
I want to know how to update some translation through Magento 2.1.9 REST API.

For example, when I add a configurable product in the cart thanks to the Magento 2.1.9 REST API, if the user do not select an option, the default error message response is You need to choose options for your item.

Which is translated here vendor/magento/module-configurable-product/i18n/en_US.csv:30

And trigger here : vendor/magento/module-configurable-product/Model/Product/Type/Configurable.php:1095

I want to update the default translation, but I do not find a way to solve it, I try :

I added the updated translation in my theme : app/design/frontend/Vendor/theme/i18n/en_US.csv:5 but it seems that the theme is not load in the API mode
I forced the current area and store with $this->appEmulation->startEnvironmentEmulation($storeId, \Magento\Framework\App\Area::AREA_FRONTEND, true);

Without success.

I do not find any resource how to translate through API area.

I prefer keep all the translation in Magento and not delegate this to the frontend application.

All ideas are appreciated.

EDIT:

I just found a workaround.

You need to emulate the correct store with the frontend area, and then reload the translation data :

// Emulate store frontend
$storeId = $this->storeManager->getStore()->getId();
$this->appEmulation->startEnvironmentEmulation($storeId, \Magento\Framework\App\Area::AREA_FRONTEND, true);

$this->translator->loadData(null, true);
echo __('your text to translate');
$this->appEmulation->stopEnvironmentEmulation();

But it is just a workaround for custom API where you manage the result, not for native Magento API.

Let me know if there is a proper way to manage this.

Does language packages can solve my problem ?


texts: How to create custom XHTML template system in magento 2?

texts: Hey guys, I want to know how to create a custom XHTML system with the custom module or via core file system in Magento 2 & how it works?


texts: Magento 2.2.2 Database install leads to error

texts:
I'm using php bin/magento install to install a fresh DB (i've achieved this successfully several times with Magento 2.1.8)

Everything goes smoothly untill step 538. I get the following

[Progress: 538 / 913]
Module 'Magento_GiftCardAccount':
Installing data... Upgrading data...

  [Zend_Db_Statement_Exception]
  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sales_order.gift_cards' in 'field
  list', query was: SELECT MAX(entity_id) as max, COUNT(*) as cnt FROM (SELECT `sales_order`
  .`entity_id`, `sales_order`.`gift_cards` FROM `sales_order` WHERE (gift_cards IS NOT NULL)
   AND (`sales_order`.`entity_id` > 0) ORDER BY `sales_order`.`entity_id` ASC
   LIMIT 50000) AS `t`

  [PDOException]
  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sales_order.gift_cards' in 'field
  list'

Any tips?


texts: Update Product attributes only if order successfull

texts:
I tried to change the attribute value of Product's attribute [cart_status] once we click on Place Order button and make the payment.

Means Only if order is successfull. I guess this is correct event : <sales_order_payment_capture> as i saw here

config.xml  :

<sales_order_payment_capture>
    <observers>
        <example_place_order>
            <class>Amasty_Example_Model_Observer</class>
            <method>PlaceOrder</method>
        </example_place_order>
    </observers>
</sales_order_payment_capture>

app/code/local/Amasty/Example/Model - Observer.php

public function PlaceOrder($observer)
{
    $product = $observer->getEvent()->getProduct();
    Mage::getSingleton('catalog/product_action')->updateAttributes(
    array(
        $product->getId()),
        array('cart_status' => 0),
        $storeId = 0
    );
}

Result :

Fatal error : Call to a member function getId() on a non-object in array($product->getId()),


texts: How to set up a promotion rule which enable users to get additional discount for certain bank card holder?

texts:
Does anyone know how to set up a promotion rule which enable users to get additional discount for certain bank card holder?
Can we create it in Magento 2 default or can anyone suggest an extension if needed.
Thanks a lot.


texts:
I want to echo the description and title of the page.
I tried to load this by:

Name:

<?php echo Mage::app()->getStore()->getName(); ?>

Description:

<?php echo strip_tags($this->getDescription()) ?>

But it does not dispaly anything.
Do I need to load a helper?


texts: How to list all products from API with curl command line?

texts:
I've been trying a lot of things and can't seem to figure out what should be pretty simple... How can I make a request with curl in command line to /index.php/rest/V1/products so that I simply get the list of all products?

Everything I tried got me this error:

{"message":"%fieldName is a required field.","parameters":{"fieldName":"searchCriteria"}}

If I start from this, what should I add?

curl -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxx" "http://example.com/index.php/rest/V1/products"

Thank you!


texts:
I've just copied an M2 site from one server to another.

Emptied var/

Emptied pub/static

Ran setup:static-content:deploy

Ran indexer:reindex

chown -R user:group *

The homepage and other pages work great.  The admin page is not loading any CSS for some reason.  The stylesheets are 404ing.  LEMP server.

Any thoughts?

Thanks


texts: Magento 2 - get customer address list with ajax in checkout page

texts: Is there any way to call customer address list with ajax in checkout page? or maybe Magento already provide an API service to do this?


texts: How to Rearrange Blocks on the Category Sidebar

texts:
How can I rearrange the blocks on the sidebar? Where can I edit it?
Currently the tag block is on the bottom most part of the sidebar. I want to move it up. How am I suppose to do it?


texts:
I'm trying to redirect from block but it's not working. But same methods work in different projects.

1. Process 1

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Vendor\PaymentGateway\Helper\Data $storeHelper,
    \Magento\Sales\Api\Data\OrderInterface $order,
    \Magento\Framework\App\Response\Http $response,
    \Magento\Sales\Model\Order $orderModel,
    \Vendor\PaymentGateway\Model\CreateorderFactory $createorder,
    \Vendor\PaymentGateway\Model\PaymentresponseFactory $paymentResponse,
    \Magento\Checkout\Model\Session $checkoutSession,
    \Magento\Sales\Model\OrderFactory $orderFactory,
    \Magento\Sales\Model\Order\Email\Sender\OrderSender $orderEmailSender,
    \Magento\Framework\Controller\Result\RedirectFactory $redirectFactory,
    array $data = []
) {
    parent::__construct($context, $data);
    $this->storeHelper  = $storeHelper;
    $this->order = $order;
    $this->response = $response;
    $this->orderModel = $orderModel;
    $this->createorder = $createorder;
    $this->paymentResponse = $paymentResponse;
    $this->checkoutSession = $checkoutSession;
    $this->orderFactory = $orderFactory;
    $this->orderEmailSender = $orderEmailSender;
    $this->redirectFactory = $redirectFactory;
}
public function redirectAccordingToStatus($status='30')
{
    echo 'redirect from here  ' , $this->getBaseUrl().$this->REDIRECT_URL[$status] ;
    //return $this->redirectFactory->create()->setPath($this->REDIRECT_URL[$status]);
    $this->response->setRedirect($this->getBaseUrl().$this->REDIRECT_URL[$status]);
    exit;
}

2. Process 2: With same constructor but different approach.

return $this->redirectFactory->create()->setPath('paym/payment/cancel');

None of these methods are working. I thought some of the classes could be conflicting with it that is why I have pasted the whole code of constructor.

Also there is no error during setup:di:compile and in logs. If you know of any another approach then please suggest that one.


texts: Need a faster way of removing all disabled products from all categories

texts:
We recently dropped a bunch of vendors, and need to get the disabled products out of the categories to make merchandising easier.  Also just for sanity so we don't have to keep looking at them in the category product lists.

Here is the script I came up with

$category = Mage::getModel('catalog/category');
$catTree = $category->getTreeModel()->load();
$catIds = $catTree->getCollection()->getAllIds();
$cats = array();
if ($catIds){
foreach ($catIds as $id){
    $cat = Mage::getModel('catalog/category');
    $cat->load($id);
    $collection = Mage::getModel('catalog/product')
        ->getCollection()
        ->addCategoryFilter($cat)
        ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED)) //filter commented, show all products
        ->load();

    foreach ($collection as $prod) {
        var_dump("Removing product id " . $prod->getId() . " from  category " . $id);
        Mage::getSingleton('catalog/category_api')->removeProduct($id,$prod->getId());

    }
}

}

Obviously this will take forever, since we have umpteen bazillion categories.  I need something that works like this:

Get Category
Get all disabled products, and create an array of their IDs.
Set the array of products on the category to that array of product ids.
Save the category.

Right now i'm digging through

\app\code\core\Mage\Catalog\Model\Category.php

and

\app\code\core\Mage\Catalog\Model\Category\Api.php

to find a function i might be able to use.

Any takers?


texts: Coupon for specific product not for subtotal of cart

texts:
I would like to setup a promotion in my Magento system, I not sure defualt magento can do this,

Anyway here is the task:

I have Three products in cart
•Product A: $50
•Product B: $100
•Product C: $70

And I have 10% off coupon code, this coupon is applicable only for price of "Product B" not for subtotal of "Product A", "Product B" and "Product C".

If I am following default Magento "Shopping Cart Price rule"  discount will be $22(50+100+70*10/100) so GrandTotal is $198(50+100+70-22).

But I need discount $10(100*10/100) so GrandTotal is $210(50+100+70-10)
Please help me on this, suggest me to a module which can do this.

I am using Magento ver. 1.7.0.2

Thanks!


texts: Magento Test Automation Framework (Custom Application Area)

texts:
I've already setup Magento Test Automation Framework. I've already run the Test Files that comes with it. I would like to know how to create a custom application area. I have this admin extension that doesn't have the admin front name (www.mymage.com/admin) but instead it has this url (www.mymage.com/myextension). As I run the custom test, I'm getting an error of Area "mymanager" is not found in admin. As I traced back the code, I'm noticing in the config.yml file having the "frontend" and "admin" areas being declared so I've tried creating a node under it with this value

myextension:
                url: 'http://vm.maps.com/index.php/mymanager'
                base_page_uimap: 'log_in_to_admin'
                uimap_path: 'myextension'

I don't know if this is correct but I'm still getting errors.


texts: Using Magento resize vs uploading already resized images

texts:
We have custom magento review module that have lots of 70x70 image icons which when clicked load big images.

Currently we manually resize them and upload 2 version of files - big image 640x480, and icons 70x70.

Are we getting any performance boost from this comparing to using magento resize function?

As far as i understand we improve website performance only for the first visit of the page(cause we already resized files for magento), and after cache is build it's exactly same thing speed wise.

p.s. it takes too much time to resize and upload 2 version of files, so would like to use magento resize functionality if there is no loss in site speed.


texts: Content / Design / Configuration page empty

texts:
I have installed a theme I bought with Magento CE 2.1.5, but the page under Content / Design / Configuration is completely blank:

I reinstalled everything several times, I tried reindexing, flushing the caches, etc., with no success.

How to fix this?

Thanks


texts: Invoices - capture online vs capture offline

texts:
Regarding invoices, can anyone explain the difference between the online amount capture and offline amount capture.

I really don't understand the difference between these two options.


texts: How to change the base image of configurable product by selecting the dropdown value?

texts:
I have created an attribute variants and added it in an attribute set. It is created to be used for configurable products.After creating a configurable product with this attribute set, the attribute variantsis displayed in product details page as dropdown. But the base image is not changed when any value from the dropdown is selected. I gave the labels for the images too. But its not changing.

Is there any other thing that I have to do in order to change the base image when the dropdown value is selected in configurale products?
Somebody help me.


texts:
I'm trying to get the header to look a little like this:

I'm having a hard time with the search and mini cart buttons, it seems they're nested within header-wrapper by default and I can't seem to separate them from that container and move them around individually.

This is where I'm up to:

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

<body>
        <referenceContainer name="header.container">
            <container name="header.panel.wrapper" htmlClass="panel wrapper" htmlTag="div" before="-">
                <container name="header.panel" label="Page Header Panel" htmlTag="div" htmlClass="panel header">
                    <block class="Magento\Framework\View\Element\Template" name="skip_to_content" template="Magento_Theme::html/skip.phtml">
                        <arguments>
                            <argument name="target" xsi:type="string">contentarea</argument>
                            <argument name="label" translate="true" xsi:type="string">Skip to Content</argument>
                        </arguments>
                    </block>
                    </block>
                    <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/headercontact.phtml" name="headercontact"/>
                </container>
            </container>
            <container name="header-wrapper" label="Page Header" as="header-wrapper" htmlTag="div" htmlClass="header content">
            <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/headercolumn1.phtml" name="headercolumn1"/>
            <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/headercolumn2.phtml" name="headercolumn2"/>
            <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/headercolumn3.phtml" name="headercolumn3"/>
          </container>
        </referenceContainer>
</body>
</page>

So - I created 3 columns inside the header-wrapper container, and then moved the top search and mini cart with CSS.
Ideally I would be able to get them both into columns 1 and 3 so that I can put them in DIVS and style them but adding this to headercolumn1.phtml doesn't seem to work

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

so they're both currently sitting below the columns from the header-wrapper container.

Any ideas how I can achieve this?


texts: Magento 2: How to call REST Api from helper

texts:
i have created REST Api how can i use those REST Api directly from helper?

Curl call is a option is there any other method that we can use?


texts:
I used data-migration-tool and did migration from 1.9 to 2.3 but lost all the products which were already in M2.

Before the migration there were around 2000 products and now they lost. I have backup of complete M2-database before migration.

How to get those product back in magento2.

Update:

I followed answer of @Mitro and it worked with some efforts but images are still not displaying though images can be open by media-url.

I tried command php bin/magento catalog:image:resize  but didnt work


texts:
I want to make swatches in sorting in natural sorting order.
Like using below PHP function:
"strnatcasecmp"

I know it can be done through admin like drag and drop to size/color option. But I only want this done by programmatically as no matter what is the position set in the admin for these options.

Below is the file where these swatches are rendering:

vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml

Below is the screenshot is attached:


texts: Are Magento's cron jobs a suitable tool for running things just once?

texts: I want to notify customers in 24 hours after they've done some specific thing in my store. I have an idea how to do that with Magento's cron jobs. But are cron jobs a suitable tool for this? Cron is usually used to run tasks repeatedly rather than once. Is there a better suited tool in Magento? For example, I would use at instead of cron to run a task once at specific time on my Linux machine.


texts: Add custom calculation to cart total and grand total in magento

texts:
I am working on site where i want to add/subtract fee to cart total and grand total.I am firing this event to capture the cart details.sales_order_save_after. while in observer i got the price using this code

public function modifyPrice(Varien_Event_Observer $obs)
        {

          $getotal = Mage::helper('checkout')->getQuote()->getGrandTotal();
          $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
           $subtotal = $totals["subtotal"]->getValue();
}.

But i don't know how to add/subtract amount from total and than update accordingly.Thanks in advance


texts:
Do you usually use vagrant for magento? Our live sites are very fast but only because of varnish. We reach under 1 sec load time. However on vagrant it takes ~30 seconds for a page load. With Mamp it takes ~10 seconds.

I've checked the settings, there is no difference between mamp and vagrant instances. Having varnish in developing mode quite pointless, so how do people manage to use vagrant with magento?

Thanks!


texts:
I want to display the tax percent in invoice without decimal. Now my invoice display:

Tax (21.0000%):

How can I put that without decimal? 21%


texts: Magento 2 how to add extra fields for radio button option in checkout page

texts:
Give option in Address Information tab on checkout page

I want to add separate option after shipping Information on checkout page

Billing by weight
Billing by length

Radio buttons user can  select.

How I add this functionality?


texts: Magento session storage: Redis vs. Memcached

texts:
I'm running a Magento EE 1.12.2 (equally in CE 1.7.2) where we have Redis for caching (Cm_Cache extension, Redis v 2.2.12), but we use Memcache for session storage.

Redis is not supported out of the box on these Magento versions. So my concern here is:

Is it worth the hassle to get session storage into Redis in terms of effort vs. speed improvement?
Isn't Memcache just as good or maybe even better?

In this project we have large session files as we need to store third-party XML files into the session, so optimizing session read and writes can have a considerable impact.

From local.xml:

<session_save><![CDATA[memcache]]></session_save>

And:

<cache>
    <backend>Cm_Cache_Backend_Redis</backend>
    [...]
</cache>


texts:
I've migrated my database of my store when access store front or admin panel I get the following error

1 exception(s): Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found #0 \app\code\Magento\Store\Model\StoreRepository.php(124): Magento\Store\Model\StoreRepository->getById('1')
#1 \app\code\Magento\Store\Model\StoreResolver.php(167): Magento\Store\Model\StoreRepository->getActiveStoreById('1')
#2\app\code\Magento\Store\Model\StoreResolver.php(98): Magento\Store\Model\StoreResolver->getDefaultStoreById('1')
#3\app\code\Magento\Store\Model\StoreManager.php(154): Magento\Store\Model\StoreResolver->getCurrentStoreId()
#4\var\generation\Magento\Store\Model\StoreManagerInterface\Proxy.php(119): Magento\Store\Model\StoreManager->getStore(NULL)
#5 \app\code\Magento\Store\Model\Resolver\Store.php(29): Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL)
#6 \lib\internal\Magento\Framework\App\Config\ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL)
#7 \lib\internal\Magento\Framework\App\Config.php(79): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL)
#8 \var\generation\Magento\Framework\App\Config\Interceptor.php(24): Magento\Framework\App\Config->getValue('admin/url/use_c...', 'stores', NULL)
#9 \app\code\Magento\Backend\App\Area\FrontNameResolver.php(96): Magento\Framework\App\Config\Interceptor->getValue('admin/url/use_c...', 'store')
#10 \app\code\Magento\Backend\App\Area\FrontNameResolver.php(79): Magento\Backend\App\Area\FrontNameResolver->isHostBackend()
#11 \lib\internal\Magento\Framework\App\AreaList.php(73): Magento\Backend\App\Area\FrontNameResolver->getFrontName(true)
#12 \lib\internal\Magento\Framework\App\Http.php(130): Magento\Framework\App\AreaList->getCodeByFrontName('admin_6y3w8w')
#13 \lib\internal\Magento\Framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#14 \index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#15 {main}


texts: Magento 1 show pop when product added to cart

texts:
Is there an easy way to show a popup that a product is added to the cart in Magento 1.9? The popup message itself will be no problem to create, but I need the code-part that checks and shows the message when a product is added.

We disabled the default method to redirect directly to the cart when the product is added. Magento does show the message in the message block, can we use some code from that?

I am not looking for a AJAX solution, it will be fine that the page reloads and the message is then displayed.

Some any ideas?


texts: One Invetory / Multiple Stores / Multiple Users / One Admin

texts:
I need to build a project using Magento but I don't know if it can be built with such complexity.

This is the project's configuration:

Only one Admin, which can do:

Manage all the inventory and can edit/exclude them all and its atributtes
Handle all orders, shipping, clients data
Manage all stores and users inside the software
Receive a comission-based value in every order received by the users

Multiple Users, which can do:

Build his own store with custom sub-domain (eg. .store.com)
Change only the prices in all products in the inventory (with the minimum price set up by the admin).
Can see all orders from his store (can't edit or cancel)
Can make small changes in configuration (eg. main theme colors, logo, banner)
Receive his profit in his own account

Is there a extension/module that does it? Or multiple extensions that can help with all these needs? It is possible to build it using Magento?


texts: Magento 2.1.2 Child-theme front end no display

texts:
I have duplicated the theme in app folder and modified the theme.xml accordingly. But it displays like below screen shot.

  http://brick.learnup.ro/lux/

It should be look like this -

  http://brick.learnup.ro/

I have to mention that I have successfully ran all the commands in SSH:

setup:upgrade
setup:di:compile
cache:flush
setup:static-content:deploy

and set the permissions right.

The problem occurs only with the duplicates of this theme

Thank you


texts:
How do I get Fix this Error?

Check Component Dependency
We found conflicting component dependencies. Hide detail

Command "update" failed: Loading composer repositories with package information

[Composer\Downloader\TransportException]
The "https://repo.magento.com/packages.json" file could not be downloaded: allow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found)

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>].


texts: Custom javascript is not loading through requirejs-config

texts:
I've been trying to add a custom script to my Magento stores, however I can't get it to load. I've created the js file in my web/js folder in my theme, and added it to the theme's requirejs file. It will also load the file into the static folder eventually, but it doesn't work at all.

This is the js file I've been trying to load for testing purposes:

define([
'jquery',
'jquery/ui'], function($) {
alert('start openMenu');
$.widget('rvdk.openMenu', {
    _create: function() {
        alert('open-menu.js');
        console.log('open-menu.js');

        $(window).on("scroll", function () {
            alert('open-menu-scroll.js');
        });
    }
});

return $.rvdk.openMenu;

});

requirejs-config:

var config = {
map: {
    '*': {
        'open-menu'             : 'js/open-menu',
        'header'                : 'js/header',
        'products-masonry'      : 'js/products-masonry',
        'image-grid'            : 'js/image-grid',
    }
}};

It loads a few more files, but I don't think those are important. Header.js works fine for example, and I can change this file and the changes will be displayed. However it still doesn't load open-menu.js, even though it is in the static files.


texts: sudo php bin/magento setup:upgrade No such entity magento 2

texts: I get this error when running the setup:upgrade. I have changed the secure url to the new url but nothing changed please any help


texts: Magento 2.1.2, Remove "region" from the Address

texts:
I would like to remove "Region" from all the address forms (checkout, billing address, shipping address, customer's addressbook).
I've set the Backend setting for "Allow to Choose State if It is Optional for Country" to No (under Stores > Configuration > General > General, State Options), but the State Option still gets displayed on the Frontend, but is disabled.

What would be the the right way to remove region option from the address forms?

If I update the Backend settings to:

State is Required for: remove all selected country from here.

Allow to Choose State if It is Optional for Country: Set it as "No"

does not remove the Region (Bundesland/Provinz) on the forms, it only disables it.


texts: How to echo the configurable product price?

texts:
Im trying to echo the price of a configurable product in the description but it doesn't update when I select some options.

I have a bed thats starts at £149.00 and with each different size you select 2.6, 3', 4', 4'6", 5', 6' the price goes up by £20 - £150, but when I echo the price it only echos the base price of the configurable product and does not update the price when I select different sizes.

This is the code from

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

<?php
 echo $_prodcut->getFinalPrice();
 echo number_format($_product->getFinalPrice(), '2', '.', ',');
?>

now Ideally I want the price to be echoed at the top where it is originally and at the bottom because on mobile customers are having to scroll to the top to view the adjusted price, and I simply want to echo it at the bottom aswell so they don't have to go back and forth, any ideas ?


texts: Get Order Id from Order Item id in Magento 2

texts:
How to get order details based on order item id using simple way.
I can get the order id from sales_order_item table and then can lookup in sales_order table to fetch sales order details.
Is there a direct way to fetch order details by using \Magento\Sales\Model\Order using order item id


texts: Magento 2 Rest API get product image from order id

texts:
I get order details using order id API.I require product image in order list in mobile App.
Please help how to get product image in order API list.


texts:
DeleteButton.php

<?php
namespace Xxx\Faqs\Block\Adminhtml\Faqcat\Edit;

use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;

/**
 * Class DeleteButton
 */
class DeleteButton extends GenericButton implements ButtonProviderInterface
{
    /**
     * @return array
     */
    public function getButtonData()
    {
        $data = [];
        if ($this->getId()) {
            $data = [
                'label' => __('Delete'),
                'class' => 'delete',
                'on_click' => 'deleteConfirm(\''
                    . __('Are you sure you want to delete this Category?')
                    . '\', \'' . $this->getDeleteUrl() . '\')',
                'sort_order' => 20,
            ];
        }
        return $data;
    }

    /**
     * @return string
     */
    public function getDeleteUrl()
    {
        return $this->getUrl('*/*/delete', ['id' => $this->getId()]);
    }
}

GenericButton.php

<?php
namespace Xxx\Faqs\Block\Adminhtml\Faqcat\Edit;

use Magento\Search\Controller\RegistryConstants;

/**
 * Class GenericButton
 */
class GenericButton
{
    /**
     * Url Builder
     *
     * @var \Magento\Framework\UrlInterface
     */
    protected $urlBuilder;

    /**
     * Registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $registry;

    /**
     * Constructor
     *
     * @param \Magento\Backend\Block\Widget\Context $context
     * @param \Magento\Framework\Registry $registry
     */
    public function __construct(
        \Magento\Backend\Block\Widget\Context $context,
        \Magento\Framework\Registry $registry
    ) {
        $this->urlBuilder = $context->getUrlBuilder();
        $this->registry = $registry;
    }

    /**
     * Return the synonyms group Id.
     *
     * @return int|null
     */
    public function getId()
    {
        $post_id = $this->registry->registry('id');
        return $post_id ? $post_id->getId() : null;
    }

    /**
     * Generate url by route and parameters
     *
     * @param   string $route
     * @param   array $params
     * @return  string
     */
    public function getUrl($route = '', $params = [])
    {
        return $this->urlBuilder->getUrl($route, $params);
    }
}

Delete.php

<?php
namespace Xxx\Faqs\Controller\Adminhtml\Faqcat;

use Magento\Backend\App\Action;

class Delete extends \Magento\Backend\App\Action
{
    public function execute()
    {

         $id = $this->getRequest()->getParam('id');

        if (!($faq = $this->_objectManager->create("Xxx\Faqs\Model\Faqcat")->load($id))) {
            $this->messageManager->addError(__('Unable to proceed. Please, try again.'));
            $resultRedirect = $this->resultRedirectFactory->create();
            return $resultRedirect->setPath('*/*/index', array('_current' => true));

        }
        try{
            $faq->delete();
            $this->messageManager->addSuccess(__('Your FAQ Category has been deleted !'));
        } catch (Exception $e) {
            $this->messageManager->addError(__('Error while trying to delete faq: '));
            $resultRedirect = $this->resultRedirectFactory->create();
            return $resultRedirect->setPath('*/*/index', array('_current' => true));
        }

        $resultRedirect = $this->resultRedirectFactory->create();
        return $resultRedirect->setPath('*/*/index', array('_current' => true));
    }
}

But this button not working in admin form in magento2.If any error in my code.


texts:
How to get Magento 2 customer group ID if user is logged in, in a .phtml file?
I have already tried with:

protected $_customerSession;

public function __construct(
    \Magento\Customer\Model\Session $customerSession,
) {
    $this->_customerSession = $customerSession;
}

public function getGroupId(){
if($this->_customerSession->isLoggedIn()):
    echo $customerGroup=$this->_customerSession->getCustomer()->getGroupId();
endif;
}

but it doesn't work, I get this error:

Parse error: syntax error, unexpected 'protected' (T_PROTECTED), expecting end of file in..


texts: Filtering product collection by combination of attributes

texts:
I have two sets of product attributes:

Att1 {a, b, c, d}
Att2 {e, f, g, h}

These attributes are multiple select fields.

Then I have a collection of 3 products:

Prod1 (Att1: {b, d, a}, Att2: {g})
Prod2 (Att1: {a, c},    Att2: {h, f})
Prod3 (Att1: {a, d},    Att2: {e, f, g})

From this collection I'd like to extract product with these attribute combination

Att1 LIKE 'a, d' AND Att2 LIKE 'g'

so that the result would be Prod1 and Prod3

$_productCollection->addAttributeToFilter

accepts only one attribute but I'd like to add a combinaiton of two.

How can I do this?


texts: How to change In stock/Out of stock message at product detail page in magento 2

texts: I am trying to to show different messages as per product like limited stock, available stock, product will come soon etc. For this i have to change default things. So can we achieve this.Thanks in advanced


texts: The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later

texts: I am trying to log in for the first time and I have unlocked the admin user in cmd with (php bin/magento admin:user:unlock admin) I see admin user has been unlocked but when I go back to the login i get the same issue again.


texts:
I put custom module in app/code/. Layout is not loading. On my custom route is blank white page. Debug showing that handles =null. This is code
/app/code/Namespace/ModuleName/view/frontend/layout/test_index_index.xml

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

    <referenceContainer name="content">
        <block class="namespace\Modulename\Block\ModuleBlock" name="form" template="namespace_ModuleName::form.phtml" />
    </referenceContainer>

Namespace/Modulename/Controller/Index/Index.php

 namespace Namespace\ModuleName\Controller\Index;

class Index extends \Namespace\ModuleName\Controller\Index
{
    /**
     *
     *
     */
    public function execute()
    {

        $this->_view->loadLayout();
        $this->_view->renderLayout();
    }
}

**/app/code/Namespace/ModuleName/Controller/Index.php

<?php
namespace Namespace\ModuleName\Controller;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\App\RequestInterface;
use Magento\Store\Model\ScopeInterface;

/**
 * Contact index controller
 */
abstract class Index extends \Magento\Framework\App\Action\Action
{
    /**
     * Recipient email config path
     */
    const XML_PATH_EMAIL_RECIPIENT = 'trans_email/ident_general/email';

    /**
     * Recipient email config path
     */
    const XML_PATH_EMAIL_RECIPIENT_2 = 'contact/email/recipient_email';

    /**
     * Sender email config path
     */
    const XML_PATH_EMAIL_SENDER = 'contact/email/sender_email_identity';

    /**
     * Email template config path
     */
    const XML_EMAIL_TEMPLATE = 'custom_cats_email_template';

    /**
     * @var \Magento\Framework\Mail\Template\TransportBuilder
     */
    protected $_transportBuilder;

    /**
     * @var \Magento\Framework\Translate\Inline\StateInterface
     */
    protected $inlineTranslation;

    /**
     * @var \Magento\Framework\App\Config\ScopeConfigInterface
     */
    protected $scopeConfig;

    /**
     * @var \Magento\Store\Model\StoreManagerInterface
     */
    protected $storeManager;

    /**
     * @param \Magento\Framework\App\Action\Context $context
     * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder
     * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
        \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Store\Model\StoreManagerInterface $storeManager
    ) {
        parent::__construct($context);
        $this->_transportBuilder = $transportBuilder;
        $this->inlineTranslation = $inlineTranslation;
        $this->scopeConfig = $scopeConfig;
        $this->storeManager = $storeManager;
    }

    /**
     * Dispatch request
     *
     * @param RequestInterface $request
     * @return \Magento\Framework\App\ResponseInterface
     * @throws \Magento\Framework\Exception\NotFoundException
     */
    public function dispatch(RequestInterface $request)
    {
        return parent::dispatch($request);
    }
}

/app/code/Namespace/ModuleName/view/frontend/templates/form.phtml

Hello

route.xml

<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
    <route id="test" frontName="test" >
        <module name="Namespace_ModuleName" />
    </route>
</router>


texts:
In product listing page I need to rearrange product listing price.

$_productCollection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSort('price', 'ASC')
            ->load();

I tried above code in list.phtml page it's working in initial list.

Not working in ajax scroll


texts: How can i edit default Magento 2 New Products widget template?

texts:
I want to edit default Magento 2 New Products Grid widget content:

The file located here:

  vendor/magento/module-catalog/view/frontend/templates/product/widget/new/content

But when I'm done with editing its going removed on every update.

So how can I edit on my own temlpate?


texts:
I cannot find a simple tutorial for this simple task 'Theme product page'

I created a theme
under magento/app/design/frontend/elia/tst
in admin content > configuration click edit and choose the new theme
copy files from magento\module-catalog\view\frontend\templates\product\view to magento\app\design\frontend\elia\tst\Magento_Catalog\templates\product\view
add a static test string to each file
in admin Cache Management, click on Flush Magento Cache
Go to product page and reload

Expected result - to see the test string in the browser product page

Actual result -product page didn't changed.

I also tried to change the template directory in the source directory magento\module-catalog\view\frontend\templates\product\view and clear the cache, but still the display didn't change.

So, people will probably mark it as duplicate, or point a link to some lengthy documentation about Magento 2 tutorial: how to use the new frontend templating system

But the bottom line is that I couldn't find ANY WHERE a simple working example of theming a Magento 2 site

BTW each click on the admin/frontend takes 30-60 second on a fresh install (wamp64), is that normal?


texts: Magento : Create an Account Loop in Chrome

texts:
Website is using HTTPS. I try to create an account in frontend, it loops only in Chrome and Safari.

However, I can login in both frontend and backend.

Ive set System > Config > Web > Cookies :

Use HTTP Only: No

Cookie Lifetime : 3600

Still I have problem.


texts:
I setup some category with free shipping but the thing is the free shipping is applied on other shipping option such as expedited.

Is there any way I can make free shipping on the standard shipping only for the category. Please let me know.


texts: Magento2 Login Link Redirecting to Homepage

texts:
plz, help me my magento2 login URL is redirecting to the homepage I'm struggling it with from last two days but unable to fix it. any help highly appreciated.

(this is happened after installing stripe and blog module I'm not sure it is an issue or not)

my website speed also becomes very very slow. plz help me for the login link which is very very compulsory at the moment

http://muzikhausberlin.de


texts: I want to show configurable products on list page.so instead of going into detail page of products, user can directly add product to cart from list.phtml page.any idea how to imple this?


texts: Magento 2.1.2 - Importing multiselect attribute values from CSV

texts:
Is it possible to create values for a multiselect attribute via CSV upload?

For example we want to populate a multiselect attribute for Car Year. We added a few sample entries and the additional_attributes data we exported was:

make=Audi,model=A3,year=1990|1991|1992

We then tried to test import a whole load more dates but these weren't created in the system, we're looking for a process where we could potentially add hundreds of entries.

Are we even close thinking this is possible...?

Thanks,


texts: Is it possible to get cart abandonment statistics? What is the best cart abandonment solution?

texts:
Magento 1.9.1.0

Is there a way to get cart abandonment statistics? I don't mean the number of visitors but the actual not finished sales. And what do you recommend as a solution that would send out a reminder (you have items in your cart - click here to check-out) kind of a solution?


texts: M2: How to change URL after switch language

texts:
I want to change end URL after switch language

from:

to

domainname.com /pl/

Any solution ?


texts: I want to store a value in session and to remove it on browser close. How can I do this?


texts: Magento 2 is it possible to get Magento Version via REST API

texts: I want to use different functionality depending on the Magento version. Is it possible to get version via REST API?


texts: Magento Buy Now Button for Configurable Products

texts:
I Need Add a Buy Now Button For Direct Checkout.

I Have Coded But Not Working For Configurable Products.

If There Are Any Extension For That Please Suggest Me.