texts: Magento Custom button add Custom Controller URL

texts:
I added a button in the Admin under Catalog->Category. Now I would like this button to have the URL or click function that redirects to my custom controller in the admin. But I can't seem to generate the proper URL format. I tested the Custom Controller and the endpoints works. I just need to incorporate it with a button. So whenever I click this button it redirects or calls an ajax to this button (but redirecting is ok for now) below is how I created the button

  File location: /app/code/Vendor/Module/Block/Adminhtml/Category/Edit/ClearCacheButton.php

<?php
namespace Vendor\Module\Block\Adminhtml\Category\Edit;

use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
use Magento\Catalog\Block\Adminhtml\Category\AbstractCategory;

/**
 * Class ClearCacheButton
 */
class ClearCacheButton extends AbstractCategory implements ButtonProviderInterface
{
    /**
     * Clear Cache button
     *
     * @return array
     */
    public function getButtonData()
    {
        $category = $this->getCategory();
        $categoryId = (int)$category->getId();
        $url = $this->getUrl('vendormodule/menu/index'); // This does not generate the desired URL for the custom module
        if ($categoryId) {
            return [
                'id' => 'clear_cache',
                'label' => __('Clear Cache Menu'),
                'onclick' => "setLocation(\'" . $url . "\')",
                'class' => 'save',
                'sort_order' => 10,
                'url' => $url
            ];
        }

        return [];
    }
}

Also added the ui_component as shown below

  File location: /app/code/Vendor/Module/view/adminhtml/ui_component/category_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <settings>
        <buttons>
            <button name="clear_cache" class="Vendor\Module\Block\Adminhtml\Category\Edit\ClearCacheButton"/>
        </buttons>
    </settings>
</form>

Here is the routes.xml

  File location: /app/code/Vendor/Module/etc/adminhtml/routes.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <!--Use router 'admin' for admin route -->
    <router id="admin">
        <!--Define a custom route with id and frontName -->
        <route id="vendormodule" frontName="vendormodule">
            <!--The module which this route match to-->
            <module name="Vendor_Module"/>
        </route>
    </router>
</config>

Note: Custom controller definition is correct as I have tested it and didn't bother to add it here.


texts: How to make google reCaptcha mandatory on contactus page

texts: I have set up google reCaptcha on contact us page but i dont know how to check its mandatory on submit for any other way.


texts: Move related products to "Details" tab on product page

texts: I would like to move related products to "Details" tab below description on product page.


texts: Magento 1.14.4.1: Not able to clean specific type of cache while using redis cache

texts:
I have redis which is hosted separably. I need to clean specific type of cache (i.e. block_html) using a script. The problem is that whenever I update product it doesn't reflect on the front-end side until I clean the cache type block_html.

I need to use a script to clean the cache. The script is working fine in default cache, however It doesn't clean cache while redis the cache is active. However Whenever I clean cache from backend It works.

I have searched a lot but I just found commands like redis-cli -h redis flushall which flush the cache of entire Magento however, I just want to clean / flush the cache of a specific type.

Is there any command/script to achieve this?

Script:

<?php
require_once("app/Mage.php");

Mage::app('admin');
Mage::register('isSecureArea', 1);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$type = 'block_html';

Enterprise_PageCache_Model_Cache::getCacheInstance()->cleanType($type);

Mage::getConfig()->loadEventObservers('adminhtml');
Mage::app()->addEventArea('adminhtml');
//Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $input->getArgument('type')));

Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $type));
//Mage::app()->getCacheInstance()->cleanType('block_html');
//$test->clean();
echo "success";

Used Source:

https://github.com/samm-git/cm_redis_tools

http://info2.magento.com/rs/magentosoftware/images/MagentoECG-UsingRedisasaCacheBackendinMagento.pdf

Please suggest.


texts: Get customer name from customer id using object manager

texts:
I try to use object manager to retrieve customer first name and last name using customer id like this:

$customer = $objectManager->get('Magento\Customer\Api\CustomerRepositoryInterface')->getById($customerId);
print_r($customer->getFirstName());

unfortunately, it prints empty string.


texts: Removing Star Rating View From Product Page

texts:
The issue is about my product page, I want the 5 starts at the right buttom in my product page not to be seen. How can I remove it to be seen on the right but still be seen in the review part as in the picture?

http://imgur.com/5jrUCEF
http://i.imgur.com/5jrUCEF.png

Thank you very much


texts: How to setup multiple websites and use language code in url

texts:
There are 3 websites with 2 languages for each of them.

www.site1.com/en
www.site1.com/fr
www.site2.com/en
www.site2.com/fr
www.site3.com/en
www.site3.com/fr

How to setup the system/configuration, index.php, .htaccess and apache conf?


texts: How to display shipping and billing forms at same time on checkout page?

texts:
So I need for my shipping and billing form on checkout to display both at the same time. Right now only the shipping address is being shown and the billing address has a checkmark where it says "my billing is the same as shipping" I need to be able to uncheck that box and have both shipping and billing open and displayed when a customer visits checkout.

I tried this and it has a bunch of bugs...


texts: How to generate ETD(Electronic Trade Document) in magento with FedEx API?

texts:
I can generate FedEx shipping label by FedEx Web-service in magento. That I have done by doing magento deafult FedEx shipping method configuration.There is no problem to do that But I can't generate ETD(Electronic Trade Document).I have attached two images which are some parts of my shipping label.In first One that I have generated through magento API.
Below quote describes what is ETD that I have derived from FedEx site.

  With Electronic Trade Documents shipping solution, you can submit your
  customs documents electronically, so you don’t have to print multiple
  copies and attach them to your packages. When you ship using FedEx
  ETD, you’ll gain operational efficiencies, save time and money and
  enjoy peace of mind.

In second one that I have generated through FedEx side for showing how actually the label should be.If this red circled label will appear then I can get a new pdf called Invoice pdf. I want that also.In magento admin I can get only to generate shipping label but not to generate invoice pdf which is meant for ETD.Can Any one please help me on that ?


texts:
I have requirement for listing,adding,deleting data using api call in magento 2 front-end site.
For above requirements i want to create custom extension, functionality of one Fronted Page and its display data using API Call.
If any one has any reference for the above functionality in magento 2, Please let me know.


texts: Magento 2.1.13 - Add custom link in contact email template

texts:
I want to add my custom link in contact email link. For that, I have created a new email template for the contact email but this is in plain text.

So how can I add a link to contact email template OR how can I overwrite the contact email template in my custom module/theme?

As per @VivekKumar answer, please check the below image.

As per @Akhilesh answer, I have overwrite the email_template.xml file in my theme as below. Clear the cache - run content deploy but it loads the template in the plain text.


texts: How to fetch dropdown options value on page load in magento 2.3.2 using jquery

texts:
I want to fetch the options value of a select element while the page load event occurs.
Below is the code i have tried but its not working for me.
<select class="swatch-select waz_length">
<option value="0" option-id="0">Choose an Option...</option>
<option value="85" option-id="85">Yards</option>
<option value="86" option-id="86">Swatch</option>
<option value="989" option-id="989" option-empty="true" disabled="disabled"
class="disabled">25 yards roll - Pre-Order</option></select>

Javascript code

Please help. what is wrong in this code?


texts: Magento 2 multiple website with subdomain

texts:
I have created multiple web site in magento 2 and also created the sub domain for it.
Hear my sub domain look like this

  1.www.a.example.com
  2.www.b.example.com

where a and b represent each country how can i point this to my website


texts: How to make third party magento extension compatible with store theme

texts:
What is best way to make third party extension compatible with store theme which is not default theme.

For example I'm Using
THEME: rwd
EXTENSION: http://www.magentocommerce.com/magento-connect/layered-navigation-seo.html
 extension works good in default theme but in rwd theme it is not compatible.
What should I update and where should I update it.
I ask this question in general, answer for the above example would be appreciated.

This type of issue become common with rwd theme, most of the old extensions works good with default theme but not with rwd theme. Many useful extension have such issues and most  of their authors are not active. That's why I asked this question here.

Reference: https://stackoverflow.com/questions/15263779

Thank you.


texts:
I want to create admin user who is access only read the products in magento 2.
Can i create Role for only read permissions of product in magento 2 admin panel.


texts:
I've built an image importer (due to some custom requirements on image name matching SKUs) and in it, I delete all of a product's existing images before importing new ones. My code looks like this:

/* @var $mediaApi Mage_Catalog_Model_Product_Attribute_Media_Api */
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");

$items = $mediaApi->items($product->getId());
foreach ($items as $item) {
    $mediaApi->remove($product->getId(), $item['file']);
}

This calls Mage_Catalog_Model_Product_Attribute_Media_Api::remove() which looks like this:

/**
 * Remove image from product
 *
 * @param int|string $productId
 * @param string $file
 * @return boolean
 */
public function remove($productId, $file, $identifierType = null)
{
    $product = $this->_initProduct($productId, null, $identifierType);

    $gallery = $this->_getGalleryAttribute($product);

    if (!$gallery->getBackend()->getImage($product, $file)) {
        $this->_fault('not_exists');
    }

    $gallery->getBackend()->removeImage($product, $file);

    try {
        $product->save();
    } catch (Mage_Core_Exception $e) {
        $this->_fault('not_removed', $e->getMessage());
    }

    return true;
}

The line $gallery->getBackend()->removeImage($product, $file); suggests that it deletes the image file, but if you look at Mage_Catalog_Model_Product_Attribute_Backend_Media::removeImage() you'll see that it doesn't:

/**
 * Remove image from gallery
 *
 * @param Mage_Catalog_Model_Product $product
 * @param string $file
 * @return Mage_Catalog_Model_Product_Attribute_Backend_Media
 */
public function removeImage(Mage_Catalog_Model_Product $product, $file)
{
    $attrCode = $this->getAttribute()->getAttributeCode();

    $mediaGalleryData = $product->getData($attrCode);

    if (!isset($mediaGalleryData['images']) || !is_array($mediaGalleryData['images'])) {
        return $this;
    }

    foreach ($mediaGalleryData['images'] as &$image) {
        if ($image['file'] == $file) {
            $image['removed'] = 1;
        }
    }

    $product->setData($attrCode, $mediaGalleryData);

    return $this;
}

Two questions:

Is there any normal Magento situation where a product's image is used in more than one place? (The CMS and WYSIWYG image tools don't let you link to product images that I know of.)
Before I go building a custom solution to delete unused images from the media directory, I want to make sure: Should I be expecting Magento to delete these images for me? From the code that I can find, it doesn't attempt to do that.


texts: How to apply a patch on plugins on Magento 1?

texts:
I should be applying security patches on a Magento 1 with several modules/plugins.

In addition to the files in /local/Mage, I should also apply the patch to plugins that extend the classes of the Magento core.

I work like this:

1) I open the .sh file and take note of all the changes

2) With my editor I perform a Find for all files containing the words "estends Mage_ *" inside the app/local and app/community folders

3) I apply any changes of the .sh file to these files

4) I apply any changes on templates (app/design/).

Is there a faster and more efficient way to apply a patch?


texts: 2.3.1 not able to show products with "out of stock" with new MSI

texts:
I recently updated Magento from 2.2.3 to 2.3.1

I´ve got a product which has 0 stock and is set to "out of stock" but the customer is able to buy it. (Setting is set to "show out of stock products")

Versions before we set the product to "Out of stock" and we could search and viewed that product, but could not put it into the cart.
Now, with the new Inventory Module from Magento, I´m just able to deactivate the product, which is not a good way for the search engine.

I also disabled all inventory modules but that leads to a problem showing categories with elastic-suite-extension.

How can I restore the old behavior so a customer can see my "out of stock"-product without putting it into the cart?
Someone a suggestion?

Best Regards
Logic


texts: jQuery not working in checkout page - Magento 2

texts:
I am customizing checkout page. I try set value in form field by using Jquery but did not work.

for making test I will try to hide all input elements in checkout page such a simple task but did not work. alert have came but input element dose not hide.

I have get some idea to why its not working from this link. I have set jquery trigger before and after set value but nothing work.

require([ 'jquery', 'jquery/ui'], function($){

  $(document).ready(function(){

       $(window).load(function(){

       //$("input").trigger('keyup');
       $("input").hide();
       $("input").trigger('keyup');
       alert("hiwq");

    });
  });

});


texts: How to extend the braintree module in magento2

texts: Currently, I'm migrating my custom magento1 braintree module into magento2. In magento1 I'm using the gene braintree extension. There are some methods I'm extended but the same methods are not there in magento2. can you please tell how to extend the methods.


texts:
I'm having trouble creating a custom layout. I have successfully created a layout called home_page.xml which is a copy of the default 1column layout.

I have selected this layout for my home page, but can't seem to add any content to it. Am I limited to only adding containers to the home_page.xml file? No HTML that I add will appear on my home page.

I've been reading on how to create and reference containers but it doesn't make a lot of sense, and I'm not sure what files I need to create in order to do so.

Here is my home_page.xml file:

<?xml version="1.0"?>

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="empty"/>
    <referenceContainer name="page.wrapper">
        <container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>

This is a test

        <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
        <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" />
    </referenceContainer>
</layout>

The div doesn't show up. I can successfully remove the header and footer containers however, so I know that the layout file is working successfully.

My ultimate goal is to add a full width content slider directly under the header on the home page. Any help is extremely appreciated. I've been searching around for a couple days and have run out of new content to study.


texts:
how do i remove automatic <p> tag on static block or static page, which js file(s) should i edit?

and also i don't want to disable the wysiwyg editor

already check on js/mage/adminhtml/wysiwyg/tiny_mce/setup.js still no idea where is it

var settings = {
            mode : (mode != undefined ? mode : 'none'),
            elements : this.id,
            theme : 'advanced',
            plugins : plugins,
            theme_advanced_buttons1 : magentoPlugins + 'magentowidget,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect',
            theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor',
            theme_advanced_buttons3 : 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen',
            theme_advanced_buttons4 : 'insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,pagebreak',
            theme_advanced_toolbar_location : 'top',
            theme_advanced_toolbar_align : 'left',
            theme_advanced_statusbar_location : 'bottom',
            theme_advanced_resizing : true,
            convert_urls : false,
            relative_urls : false,
            content_css: this.config.content_css,
            custom_popup_css: this.config.popup_css,
            magentowidget_url: this.config.widget_window_url,
            magentoPluginsOptions: magentoPluginsOptions,

thanks


texts: Magento 2 - Overwrite di.xml for Core Cms module

texts:
I've looked and looked, but can't find anything explaining what i need to do.

Problem is, i want to add an svg file to the image uploader in the WYSIWYG. I know i need to extend the core to do this, but im not sure how to go about it.

I've noticed in this answer he is modding the vendor folder, which to be honest isn't the right way to go about it. However the following does need adding to the xml:

<item name="svg" xsi:type="number">1</item>

What i've done so far, is inside of a folder i've made i've done the following:

  app/code/Magento/module-cms/etc/di.xml

But obviously this doesn't do anything, if anyone knows how to just do the di.xml that would be awesome.

edit* Looks as though there might be a slight issue in regards to security with this. But i guess thats the issue with any uploads.


texts: Product URL issue when same product assigned in multiple category

texts:
I need to know how exactly Magento creates URLs when the same product is added into multiple category and when include category path in product URL is set to "YES". Will it create two separate URLs for the same product?

In my case if product1 assigned into category A and Category B
and if I open this product1 from category B, it shows product URL like
www.site.com/category-b/product1.html, and when I open the same product from category A it is still show the same old URL www.site.com/category-b/product1.html.

Is this the default Magento URL behavior? How much this will effect on SEO?

In which case the product will use URL from category A i.e www.site.com/category-a/product1.html?

I am using Magento 1.14.2.4.


texts: Edit PayPal button to show that credit cards are accepted without account

texts:
I'm using Magento CE 1.9 and the Paypal Express Checkout option. I have it setup to accept Credit Cards without a PayPal account. However, during the checkout process, it is not clear to the customer that he can pay by credit card without a PayPal account:

Is it possible to edit or change the PayPal icon or text to show that credit cards are accepted without a PayPal account?


texts: Magento2 : How to create frontend layout files for controller's different action wise?

texts:
I have two controller action [1] /app/code/Mycustom/Custompage/Controller/Mypage/View.php and [2]
/app/code/Mycustom/Custompage/Controller/Mypage/View/Mytest.php .

I have cretead frontend layout file named selectpage_mypage_view.xml and it's working proper for both controller action but i want to call different layout files for both controller. For second controller action i have created layout file named selectpage_mypage_view_mytest.xml but no luck. Any help should be appriciated. Thanks.


texts: Number of Purchased Item on Each Product

texts:
I want to display the number of purchased item/s on a certain product.
I did use this code:

$resultQuantity = $this->getQuantityPurchase($_product);
$resultQuantity[0];

But it displays nothing. What should I do?
Could I use the Product ID for this?


texts: Why do I see the wrong static files path in my JS?

texts:
After installing and deploying the static files, Magento is looking for:
http://127.0.0.1/magento2/static/adminhtml/Magento/backend/en_US/requirejs/require.js
instead of:
http://127.0.0.1/magento2/pub/static/adminhtml/Magento/backend/en_US/requirejs/require.js
How can I fix it?
Regards.


texts: Magento Import: Media Gallery Image Position

texts:
I just wondered if this has come across before but I am importing products into Magento via CSV and would like to set the order of the images in which they appear.

Ideally to do this via the import.

I did some digging and do see a field in the code, '_media_position'

: ImportExport/Model/Export/Entity/Product.php

'_media_position'       => $mediaRow['position'],

I would happen to guess I use this in a CSV header item and can import the position of each image. As I opted to use Magmi to handle the import I would add this like

_media_position

1;2;3

This does not seem to work and open to suggests for this.

I am using Magento 1.8 but this does not seem to work on Magento 1.7 or 1.9. All other fields import successfully.

Thank you


texts: Cannot display db table content in magento 2

texts:
This is my Controller/index.php

<?php

namespace Wallet\Payment\Controller\Index;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Wallet\Payment\Model\CashbackFactory;

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

    protected $_modelFriendFactory;

    /**
     * @param Context $context
     * @param FriendFactory $modelFriendFactory
     */

     public function __construct(
        Context $context,
        CashbackFactory $modelFriendFactory
    ) {
        parent::__construct($context);
        $this->_modelFriendFactory = $modelFriendFactory;
    }

    public function execute()
    {

        $this->_view->loadLayout();
        $this->_view->getLayout()->initMessages();
        $this->_view->renderLayout();
         $friendModel = $this->_modelFriendFactory->create();
                 $friend = $friendModel->load(1);
        if($friend){
            echo $friend->getName() . " found with Id 1";
            echo "<hr/>";
        }

    }

}


texts:
I am working on a fix to a website in the company that I work, and we got a report from one of the users that the site was taking too long to process things and was told that they got a message saying that cookies were too big.

I tried to buy several times on localhost, but everything sounds fine, I could not replicate or find a way to replicate this.

Anyone in here knows how to help me out with this?

Good help could be:

a tool that could help me to find this spot that is generating a huge cookie
any module that could prevent this big cookie issue
I suspect that the frontend cookie might be the issue if someone has any suggestions about this (but on localhost I can't see this growing, only on the live, so I might need to test solutions over there)
any tips for Nginx, I also think that might be Nginx configuration


texts:
enter image description here

I have the venustheme with mega menu.When i edit some menuitem and add the custom link.And I have two case for it.
Case 1 customlink : the link to the menu item is one custome page or some page is liveable in this store.And it's really work fine.
But in case two category-link: i have the link below when save all menu item and menu and clean cache:
http://localhost/magento2.4/catalog/category/view/s/jackets/id/4/
and result is redirect to an error 404-page.
Help me improve it.And some idea for me.


texts: How to modify lang attribute in html tag by specific locale

texts:
I want to modify this attribute by programmatically
After many times research i found this class in lib magento

  Magento\Framework\View\Page\Config

Unfortunately magento team set locale in construct function so i can't use plugin (intercepts) to modify it

public function __construct(
    //Some injection here
) {
   // cut some lines here
   $this->setElementAttribute(
        self::ELEMENT_TYPE_HTML,
        self::HTML_ATTRIBUTE_LANG,
        strstr($this->localeResolver->getLocale(), '_', true)
   );
}

Is there a better way to modify this attribute ?

I have different page html with seperate locale config from backend, and i want to set lang attribute for my own page with selected locale


texts: Magento 2: Adding external CSS and JS to only one content page, and use jquery functions inside the content

texts:
I am trying to add some dynamic function to one content page of a Magento 2 site, but didn't manage to do it. Here is what I thought:

1) Adding the external javascript files at the "Layout Update XML" under "design":

<css src="https://xxxxxx.com/xxxx/css/abc.css" src_type="url" />

However, it didn't work. The console shows "jQuery" is not defined, and the xxyy is not a function.

I don't intend to add these JS files and CSS files globally, as I will only use this function at this content page only. What am I missing here?

Your help is much appreciated!


texts: How do I make sure that my extension’s observer is called last of all observers registered for the same event?

texts:
Each extension can add observers, so one can end up with multiple <observers> for the same <event>.

Sometimes I need to be sure that all essential data is initialised when my observer function kicks in. So I want my observer to be called last of the bunch.

Or sometimes I want it to be first, or at least before core's observer, so that all the data important to me is there before the core observer saves it.

Can I influence the order in which observer functions for the same event are executed?


texts: Overriding a layout file in magento2 is not working

texts:
What I want to override:

vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml

I copied the file to this location:

app/design/frontend/[Vendor]/[MyCustomTheme]/Magento_Catalog/layout/override/base/catalog_product_view.xml

I commented out the product.info.details block:

<!--block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="Magento_Catalog::product/view/details.phtml" after="product.info.media">
            <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" template="Magento_Catalog::product/view/attribute.phtml" group="detailed_info">
                <arguments>
                    <argument name="at_call" xsi:type="string">getDescription</argument>
                    <argument name="at_code" xsi:type="string">description</argument>
                    <argument name="css_class" xsi:type="string">description</argument>
                    <argument name="at_label" xsi:type="string">none</argument>
                    <argument name="title" translate="true" xsi:type="string">Details</argument>
                </arguments>
            </block>
            <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="Magento_Catalog::product/view/attributes.phtml" group="detailed_info">
                <arguments>
                    <argument translate="true" name="title" xsi:type="string">More Information</argument>
                </arguments>
            </block>
        </block -->

I still see the block on my products page.  I believe I followed every direction found here (using magento 2.2.4): https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/layouts/layout-override.html

I then performed these cli operations:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
php bin/magento cache:flush

Why am I not seeing any changes?


texts: Disabled categories still show products in search

texts:
I have a lot of disabled categories that are having a lot of products. Whenever I search for something a lot of those products still show up in the search.

Now I know that I can go manually to each product and set the Visibility to "Not Visible Individually" but this is a very tedious job. I first have to see what products that disabled category has. Then I have to copy it's SKU, then go to the products search, paste that SKU, edit the product, change the visibility, click save... and repeat.

I have at least 500 products in those disabled categories.

Is it possible to automatically look for the disabled categories and NOT show up the products that those categories have?

Thank You


texts:
Based on the answer for https://stackoverflow.com/questions/7597448/multi-select-filter-in-layered-navigation#24810688, I need to override

Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source

Here's the xml I've tried:

<models>
  <catalog_resource>
    <rewrite>
      <product_indexer_eav_source>CompanyName_MyModule_Model_Catalog_Resource_Product_Indexer_Eav_Source</product_indexer_eav_source>
    </rewrite>
  </catalog_resource>
</models>

But it has no effect. Any ideas?


texts: Magento 2. project/var/session folder Usage and Role

texts:
What is the usage and role of project/var/session folder?

What resides inside?
Should this folder be populated if memcached or redis is used for session storage?
What happens if I delete the contents of this folder?


texts: Install Magento on Amazon EC2 ( Error The requested URL /magento/ was not found on this server)

texts:
I try to install Magento 1.9.1.0 community edition (I follow these steps : http://www.comtechies.com/2014/03/how-to-install-magento-on-amazon-ec2.html ) but when I try to connect a Magento I get this error :
Not Found
The requested URL /magento/ was not found on this server.

The folder /var/www/:

root@ip-168-30-60-81:/home/ubuntu# ls -l /var/www/
total 61208

    -rwxr-xr-x  1 root   root    1117975 Aug 30 09:35 composer.phar
    drwxr-xr-x  2 root   root       4096 Aug 29 18:46 html
    drwxrwxr-x 13 ubuntu ubuntu     4096 Nov  5  2014 magento
    -rw-r--r--  1 root   root   23822215 Nov 21  2014 magento-1.9.1.0.tar.gz
    lrwxrwxrwx  1 root   root         21 Aug 29 19:15 phpmyadmin ->     /usr/share/phpmyadmin

The folder /var/www/html/ contains just index.html


texts: How do I configure the new products widget in 1.6.2.0

texts:
I'm trying to get a new products widget to show items based on the new_from and new_to dates, but I can't find where to configure it.  Right now, the /all-new-products page shows items that were added recently, but have a new_from and new_to date that doesn't include today's date.

This is what the new_from and new_to dates are for, right?  So where do I configure Magento to look at those?


texts: Child Theme showing strange labels on breadcrumbs, buttons, labels etc.( {{{Home}}{{Home}}{{Home}}{{themeVendor/ThemeName}}})

texts:
I have a problem with my child theme in Magento. On the products page it shows labels like "{{{Home}}{{Home}}{{Home}}{{themeVendor/ThemeName}}}" for the breadcrumbs or "{{{Add to Cart}}{{Add to Cart}}{{Add to Cart}}{{themeVendor/ThemeName}}}" on the "Add to Cart" button. Also, every label/phrase in the ordering process looks like this.
I tried to change some of the translations before, so maybe it has something to do with this?
Maybe this was answered before, but since I am completely new to Magento I have no idea what to search for in this case.
Thanks for your help!


texts: Magento2.3: How to create separate Myaccount dashboard?

texts:
We have a B2B registration with the options dealer, corporate and employee on our website. Customer can register any one of the option by filling the corresponding form.

Now what I wanted to implement is when a customer completed his/her registration, I want to show separate My Account dashboard with necessary links. How can I do that?

Any help will be appreciated.


texts: Magento 2 how to unserialize backend config

texts:
I've created Magento 2 module that saves a particular configuration. Screenshot:

Now I want to use this value in a frontend block. If I check the core_config table, the value is saved like this:

a:1:{s:18:"_1498478770604_604";a:4:{s:4:"name";s:12:"Number Pi";s:5:"image";s:23:"/media/wysiwyg/test.png";s:4:"text";s:606:"Lorum ipsum";s:20:"activation_attribute";s:1:"1";}}

How can I decode or unserialize this data? I want to turn this data into a (object) array that I can use on the frontend.

I've used the PHP function unserialize() but this didn't work. Also i've searched the Magento 2 JSON decode library, but I didn't find an answer there.

Any help would be appreciated.


texts: Creating invoice backend works but gives blank screen Magento 1.7

texts:
Every time I create an Invoice from Sales Order it gives me Blank screen (see attached) even though it's blank screen the invoice was created but not visible.

What is the solution for this?


texts: Custom tab in admin product page in magento2

texts:
I have created custom tab and added template for this tab using this link.

  app/code/Namespace/Modulename/view/adminhtml/ui_component/product_form.xml

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="demotab">
       <argument name="data" xsi:type="array">
           <item name="config" xsi:type="array">
               <item name="label" xsi:type="string" translate="true">Demo Tab</item>
               <item name="collapsible" xsi:type="boolean">true</item>
               <item name="sortOrder" xsi:type="number">100</item>
           </item>
       </argument>
       <container name="fieldname_container" >
           <argument name="data" xsi:type="array">
               <item name="config" xsi:type="array">
                   <item name="sortOrder" xsi:type="number">160</item>
               </item>
           </argument>
           <htmlContent name="html_content_demo">
               <argument name="block" xsi:type="object">Namespace\Modulename\Block\Adminhtml\Catalog\Product\Edit\Tab\Demo</argument>
           </htmlContent>
       </container>
   </fieldset>
</form>

  app/code/Namespace/Modulename/Block/Adminhtml/Catalog/Product/Edit/Tab/Demo.php

<?php
namespace Namespace\Modulename\Block\Adminhtml\Catalog\Product\Edit\Tab;

use Magento\Backend\Block\Template\Context;
use Magento\Framework\Registry;

class Demo extends \Magento\Framework\View\Element\Template
{
    /**
     * @var string
     */
    protected $_template = 'product/edit/demo.phtml';

    /**
     * Core registry
     *
     * @var Registry
     */
    protected $_coreRegistry = null;

    public function __construct(
        Context $context,
        Registry $registry,
        array $data = []
    )
    {
        $this->_coreRegistry = $registry;
        parent::__construct($context, $data);
    }

    /**
     * Retrieve product
     *
     * @return \Magento\Catalog\Model\Product
     */
    public function getProduct()
    {
        return $this->_coreRegistry->registry('current_product');
    }

}

  app/code/Namespace/Modulename/view/adminhtml/templates/product/edit/demo.phtml

<?php echo "This is demo tab content."; ?>

But, The template values does not post in product form save action.

How to solve this...

Thanks.


texts: What is meaning of below "'Cron timing "?

texts:
Please help me for understanding below cron timing because I have no idea about cron timing. (magento 1.9.3.0)

<schedule><cron_expr>0 * * * *</cron_expr></schedule>

<schedule><cron_expr>*/12 * * * *</cron_expr></schedule>

<schedule><cron_expr>0 8 * * *</cron_expr></schedule>

<schedule><cron_expr>0,30 * * * *</cron_expr></schedule>


texts: Magento2: Checking if a module exists, after being injected via class constructor

texts:
I know I can achieve this with object Manager - but just wanted to see if there is a better way.  Perhaps this case is a good candidate for using the object Manager; however, I would like to do things properly so it'd be good to get some feedback from more experienced developers.

I want to inject an object via a class constructor - and then within the body of the constructor decide what type of object it is.

I will use the Module Manager to check if a module exists - if so then I'd like to use one of its classes.  Otherwise, I'd like to use another class in core.

The reason it is possible is because both the classes (the one that might not be available and the one in the core) have the same class name and method that I need to use).

Obviously I can't inject the class that might not exist directly.  Here is some code as an example:

/**
 * MyClass constructor.
 *
 * @param {unsure how to define it} $object
 * @param \Magento\Framework\Module\Manager $moduleManager
 */
public function __construct({unsure how to define it} $object,
                            \Magento\Framework\Module\Manager $moduleManager,
)
{
    $this->_moduleManager = $moduleManager;

    if ($this->_moduleManager->isEnabled('ThirdPartyExtension_PerhapsNotInstalled')) {
        $object =  $classThatMightNotExist;
    } else {
        $object = $coreClass;
    }

    $this->_object = $object;
}


texts: My theme changes are not visible on frontend

texts:
I have a custom theme
dir app/design/frontend/Test/Theme
but my changes are not reflecting on frontend  and am using a custom css file
please help


texts:
I have a question about translation in block classes. In phtml files, $this->__() (A) is used to translate (or at least most commonly that I've seen). In Mage block classes, Mage::helper('helpername')->__() (B) is commonly used, but I've seen people use $this->__() in block classes, as well.

Whether it's Mage_Core_Block_Abstract::__() or Mage_Core_Helper_Abstract::__(), it doesn't effectivelty matter for now, as they are identical functions (EE 1.13).

Question 1

But which is more proper? I understand that this could be somewhat opinion-based, but to be more future-resistant, I would think using the helper is more proper.

Question 2

Is there a particular reason the functions defined in block classes use the helper's method, whereas the template uses the block's method?


texts: How to get all product details and sku using REST API in magento 2? using integration

texts:
<?php
$productUrl='http:yourlUrl/rest/V1/products?searchCriteria[page_size]=20';

$ch = curl_init($productUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/json",
    "Authorization: Bearer $token"
    )
);
$productList = curl_exec($ch);
$err      = curl_error($ch);
$products = json_decode($productList);
echo '<pre>';print_r($products );
curl_close($ch);

  Where to place this code in my module Directory?

Any help would Appreciate


texts: What can we use for exist query in magento2?

texts:
We have two approaches to find if the record exists in database or not

First

$select = $this->bookResource->getConnection()->select()
->distinct()
->from(
    $this->bookResource->getMainTable(),
    "author_id"
)
->where("author_id = ?", $authorId);
if ($this->bookResource->getConnection()->fetchOne($select)) {
      //record exist
}

second

$bookCollection->addFieldToSelect('author_id')
    ->addFieldToFilter("author_id", $authorId);
if ($bookCollection->getSize()){
    // record exist
}

which one to use and why


texts: Mixed Content Can some body help to fix SSL (mixed Content)

texts:
analytics.js:44 Mixed Content: The page at 'https://www.ringmastersports.co.uk/' was loaded over HTTPS, but requested an insecure image 'http://192.168.1.7/magento-amsport/magento2/pub/media/emthemes/themesettings/background/blank.gif'. This content should also be served over HTTPS.
Kc @ analytics.js:44
jquery-migrate.js:21 JQMIGRATE: Logging is active
(index):1 Mixed Content: The page at 'https://www.ringmastersports.co.uk/' was loaded over HTTPS, but requested an insecure image 'http://192.168.1.7/magento-amsport/magento2/pub/media/emthemes/themesettings/background/blank.gif'. This content should also be served over HTTPS.
blank.gif:1 Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
jquery.js:6631 Mixed Content: The page at 'https://www.ringmastersports.co.uk/' was loaded over HTTPS, but requested an insecure image 'http://192.168.1.7/magento-amsport/magento2/pub/media/emthemes/themesettings/background/blank.gif'. This content should also be served over HTTPS.
computeStyleTests @ jquery.js:6631
jquery-migrate.js:41 JQMIGRATE: jQuery.fn.andSelf() replaced by jQuery.fn.addBack()


texts:
My Magento installation is working as follow:

www.mywebsite.com/eu/it/ -> European store, Italian language
www.mywebsite.com/eu/en/ -> European store, English language
www.mywebsite.com/us/en/ -> US store, English language

In order to work like this I created in the website root the following paths:

/eu/it/
/eu/en/
/us/en/

Each one of them has an index.php file and an .htacess file with a different rewrite base:

RewriteBase /eu/it/
RewriteBase /eu/en/
RewriteBase /us/en/

Eveything is working fine except for when I try to register / login on the front end. I get the following error:

Invalid backend model specified: customer/customer_attribute_backend_store

How can I fix this?

--- UPDATE ---

In the backend of the website when I click on Customers -> Manage Customers I get the following error:

AH01797: client denied by server configuration: /home/svil01/workspace/mywebsite/app/etc/local.xml


texts:
i need to create custom sql function, use it and delete it  with magento install script. But it do not work. how to create sql function in magento install scipt?
P. S. if i create this function in my database and then only use it in script it works

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

$installer->startSetup();

$connection = $installer->getConnection();

try {
    $connection->beginTransaction();
    $sql = "
    DROP FUNCTION IF EXISTS `regex_not_match_replace`;
        DELIMITER ||
        CREATE FUNCTION  `regex_not_match_replace`(pattern VARCHAR(1000),replacement VARCHAR(1000),original VARCHAR(1000))
        RETURNS VARCHAR(1000)
        DETERMINISTIC
        BEGIN
         DECLARE temp VARCHAR(1000);
         DECLARE ch VARCHAR(1);
         DECLARE i INT;
         SET i = 1;
         SET temp = '';
         IF original NOT REGEXP pattern THEN
          loop_label: LOOP
           IF i>CHAR_LENGTH(original) THEN
            LEAVE loop_label;
           END IF;
           SET ch = SUBSTRING(original,i,1);
           IF NOT ch NOT REGEXP pattern THEN
            SET temp = CONCAT(temp,ch);
           ELSE
            SET temp = CONCAT(temp,replacement);
           END IF;
           SET i=i+1;
          END LOOP;
         ELSE
          SET temp = original;
         END IF;
         RETURN temp;
        END||
        DELIMITER ;

        UPDATE catalog_product_entity_copy
        SET  sku = regex_not_match_replace('^[ҐЄ-ЇА-ЯЁёA-Z0-9\\/~*#@$%^&.,|_?!+-}{[.left-parenthesis.][.right-parenthesis.]]{1,}$','', sku)
        WHERE not sku REGEXP '^[ҐЄ-ЇА-ЯЁёA-Z0-9\\/~*#@$%^&.,|_?!+-}{[.left-parenthesis.][.right-parenthesis.]]{1,}$';

    DROP FUNCTION IF EXISTS `regex_not_match_replace`;
    ";

    $connection->query($sql);
}
catch (Exception $e) {
    $connection->rollback();
    throw $e;
}
$connection->commit();

$installer->endSetup();
?>


texts: How to add count to my account custom link label

texts:
I am developing a custom subscription module for one of my projects. A customer can have multiple subscriptions for multiple products. The data is stored in a custom database table. In the my accounts section I have added a link in the menu as follows:

<customer_account>
    <reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="beyondroid_subscribepro"><name>subscriptions</name><path>subscriptions</path>My Subscriptions</action>         </reference>
</customer_account>
<subscriptions_index_index translate="label">
    <update handle="customer_account" />
    <reference name="my.account.wrapper">
        <block type="beyondroid_subscribepro/mysubscriptions" name="mysubscriptions" as="mysubscriptions" template="subscribepro/mysubscriptions.phtml" before="content" />
    </reference>
</subscriptions_index_index>

The link redirects to a custom block, where I list each of the subscription object for that customer. Each subscription item has a balance_amount field that shows how much amount for that subscription is left in the customers account.

Now what I am trying to achieve is to show the total of each subscriptions balance amount in the link label in the customer account navigation menu.

If you look at the code above you can see currently the label shows My Subscriptions. So if a customer has 3 subscriptions with $15 balance in each subscription item, I would like to show My Subscriptions (Balance : $45) in the link label.

If I have a php function that adds up the subscription amounts, How can I include it in the above xml code to the  tag ? Is this even possible at all ?


texts: Megnto 2 - table 'magento.store_website' doesn't exist

texts:
I am a newbie to Magento. My friend requested me to make some changes to his existing Magento 2 website and gave a Full CPanel backup. When I executed the Database dump, I noticed that only a few tables were present. Anyway, when I tried accessing the website from my local, I am getting this error

  table 'magento.store_website' doesn't exist.

I am not sure whether this is a difference between Production and Developer mode or is it the backup doesn't contain the actual database dump. Can anyone point out what I am doing wrong here?


texts: Magento 2: How to override default logger?

texts:
I want all my log files to be send to a certain server by using this snippet in a custom module

use Monolog\Logger;
use Monolog\Handler\SyslogUdpHandler;
$log = new Logger('Test');
$log->pushHandler(new SyslogUdpHandler("MyLogServer", 5000));
$log->addError("ERRORRRRRR::");

Is there a common place where I can register this new logger, so that every new log is processed by this handler and not written into files?

Thanks


texts: Moving related products from right sidebar to product view page template

texts:
I've been looking everywhere but no luck with anything that works. I have Magento ver. 1.9.2.0 and I'm trying to move the related products block to the product view template using the Local.xml. I found several ways described showing how to do it in catalog.xml and a couple using the local.xml but they didn't work for me. Here's what I've got so far:

In my Local.xml

<catalog_product_view>
<reference name="product.info">
<block type="catalog/product_list_related" name="catalog.product.related" after="upsell_products" template="catalog/product/list/related.phtml"/>
</reference>
<reference name="right">
    <remove name="catalog.product.related"/>
</reference>

In my view.phtml

<?php endforeach;?>
    <?php echo $this->getChildHtml('upsell_products') ?>
    <?php echo $this->getChildHtml('product_additional_data') ?>
    <?php echo $this->getChildHtml('related') ?>

I'm wondering if it's even possible to use only the Local.xml to do this. Thanks!


texts: Implementing ability to capture payments offline from orders

texts:
So we're trying to develop a way of capturing payments offline in Magento as a result of this thread.

If our client takes telephone/manual orders, they need the ability to capture the payment when Magento can't auto detect that payment has been made. I was hoping to achieve this in the simplest possible way like:-

A button that they can simply click on the order page to capture the payment manually and push the order to the next stage of the ordering process so that they can ship the order.

What would be the best approach for this?

In an ideal world, we would make this button trigger the function as detailed in Inchoo's suggestion which can also be seen at our previous thread on this.

Could anyone advise of a way this can be done effectively to achieve what we're after?

Thanks in advance.


texts:
I have created a validation for my checkout field that validates for a number (In our country every house has a number):

The thing is that sometimes customers would type the house number in the second field:

But, of course, the first field is still invalid.

I took a look with inspect element and validations are no longer classes that I could remove with JS, like in M1...

How can I make the validation for either of the fields? (So that only one field has to pass the validation)


texts: What are the best method's to check/test patches on site?

texts:
I have applied changes for following patches
SUPEE-10975
SUPEE-11086
SUPEE-11155
SUPEE-11219
SUPEE-11295
SUPEE-11314

For magento 1 website.
Please let me know what are the best method's to check/test patches on site.
(Automatic & manual)


texts: how to get customer group name using customer id magento2

texts:
I am not able to get Customer group name using customer id in magento2.
i have customer group id but i didn't get group name.

<?php
    $customerObj = $objectManager->create('Magento\Customer\Model\Customer')->getCollection()->addFieldToFilter('entity_id',  $group_id);

    print_r($customer_data->getCustomerData());
?>


texts:
I have an issue with https://www.milono.com/
If you add something to cart it will empty in 1-2 hours.
I have set session.gc_maxlifetime to 840000.
I appreciate for help.


texts: How to check whether the customer logged in using Events Observer

texts:
I have created events.xml in app/code/Demo/Mymodule/etc/frontend:

<?xml version="1.0">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="layout_load_before">
        <observer name="add_layout_handles" instance="Demo\Mymodule\Observer\AddHandles" />
    </event>
</config>

And AddHandles.php in app/code/Demo/Mymodule/Observer:

<?php

namespace Demo\Mymodule\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Customer\Model\Session as CustomerSession;

class AddHandles implements ObserverInterface
{
    protected $customerSession;
    public function __construct(CustomerSession $customerSession)
    {
        $this->customerSession = $customerSession;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $layout = $observer->getEvent()->getLayout();

        if (!$this->customerSession->isLoggedIn())
        {
            $layout->getUpdate()->addHandle('customer_logged_out');
        }
    }
}

On running php bin/magento setup:di:compile getting this error: arse error:  syntax error, unexpected 'public' (T_STRING
), expecting function (T_FUNCTION) or const (T_CONST)

Can anyone help me?

I am using Magento 2.2.4 version.


texts: Magento2 update products via csv gives url key dup error

texts:
I have a Magento 2.4 based website and I am trying to update the inventory, price and a custom attribute called part_id via a csv import.
My issue is that my excel only contains the below columns which I have read are the only required columns:
Sku, name, price, product_type, qty, attribute_set_code, additional_attributes, product_websites
however when I do the import and choose add/update I get an error that says
was already generated for an item with the SKU
and it does not let me update the product because it exists with that url already even though I do not even have a column in my excel that is updating the url key.
So how do I update a products data and make the system not try to write in a new url key? or complain that it exists.


texts: Magento 2.2.6 - New categories not showing products

texts: After created new category products not showing, it shows blank page with no error. But for other categories products shows. Any help should be appreciated.


texts: Add modal popup on multiple list elements

texts:
I would like to add modal functionality in a list of images wrapped in a div. It should work like so: when i click on a span element the next image should show in a modal. Html example below.

<?php foreach($datas as $data): ?>

            <img class='img-responsive' src='<?php echo $data->getImage(); ?>' alt='<?php echo $data->getAlt(); ?>'>

                <img class='img-responsive-full' src='<?php echo $data->getImage(); ?>' alt='<?php echo $data->getAlt(); ?>'>
                <?php echo $data->getDesc(); ?>

<?php endforeach; ?>

If more information is needed I will provide what is asked.

Thanks


texts: Copying a Magento 2 Site to New Domain 'Remembers' Old Site

texts:
I have copied a Magento 2 site from a test domain (testing.mytest.co.uk) to a live domain (mylive.co.uk). It has come time to upgrade the Magento version (2.2.5 to 2.2.6) and I receive the following error during readiness check:

    Found non-writable path(s):
/var/www/vhosts/mytest.co.uk/testing.mytest.co.uk/var/.htaccess

The reason it's not writable is because that is not the domain that relates to where the site is now. It's as if it is 'remembering' where it used to be? And I am unsure where this needs changing.

env.php and core_config_data have been updated.

Can anyone please advise?


texts: re-index fails stuck on processing even after server reboot

texts:
SO today the search index started reindexing forever just says processing.
followed all kinds of tutorials online about this nothing is working meanwhile the search for goes to http 500 ugh......

so after the admin panel just sits there and displays processing on reindex
I tried to reindex via putty and heres the error i get

root@ip-192-**** [/home/account/public_html/shell]# php indexer.php --reindex catalogsearch_fulltext

and i get

  Fatal error: Class 'Mage_Mstcore_Helper_Debug' not found in /home/account/public_html/app/Mage.php on line 547

all other indexes properly

I set them to manual and rebooted the server but its still stuck on processing ?? how do i kill that process. so i can trouble shoot further

what sql table is this the full text right? mage_catalogsearch_fulltext

Can I safely just empty that table ? i seen someone say something about that I havent tried it yet.

whenever a user searches for something they get a http500 timeout this sucks :(


texts: Magento 2 How to create table setting with image upload in admin system configuration?

texts:
I did it:

system.xml

<field id="active" translate="label" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="0">
    <label>active buy</label>
    <frontend_model>[Vendor]\[Ext]\Block\System\Config\Form\Field\Active</frontend_model>
    <backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>
</field>

active.php

....

protected function _prepareToRender() {
    $this->addColumn('col_1', ['label' => __('Column 1'),  'renderer' => false]);
    $this->addColumn('col_2', ['label' => __('Column 2'),  'renderer' => false]);

    $this->_addAfter = false;
    $this->_addButtonLabel = __('Add');
        $this->_addAfter = false;
        $this->_addButtonLabel = __('Add');
}

...

Standart field upload image.

As instead of "Column 2" to put the "Standart field upload image"?
Need that all worked successfully when you click the add button.


texts: I'm looking for a way to add a custom attribute to the order entity in Magento 2.2.1. We have multiple stores setup in our Magento instance and want to be able to save a certain id to each order depending on what store the order was placed in. I have done some research online about doing this but have yet to find anything that helps, any suggestions or references would be greatly appreciated.


texts:
I have a problem in my customer panel myorder tab.
In my order i see price 12,125.0000 and QTY: 5.0000
how should i remove decimal from them? it is just in my order and methods that i used is like below:

$block->escapeHtml($_item->getRowTotalInclTax())
$_order->getShippingAmount();
$block->escapeHtml($_item->getQtyOrdered())

All of them has 4 decimal like this 0.0000
Any help?


texts:
I need get all skus in a current category page, the code works only with getId, i want get skus: getSku, but doesnt work:

$products = Mage::getBlockSingleton('catalog/product_list')->getLoadedProductCollection();
                $category = Mage::registry('current_category');

                foreach ($products as $item) {
                        if($lista[0] != ''){
                        $lista[0][] = ' '.$item->getSku();

                        }
                        else{
                            $lista[0][] = $item->getSku();
                        }
                   $data['event'] = 'category';
                    $google_tag_params = array();
                    $google_tag_params['ecomm_prodid'] =  $lista[0];
                    $data['google_tag_params'] = $google_tag_params;
                     }

This return: [null, '  ', '  ', '  ', '  ', '  ', '  ', '  ' ]

What's wrong?


texts:
Right now i am using Magento 1.9.1.

I am working around on the code so i can add new Status in the mass Actions select menu http://mymagento.com/index.php/admin/sales_order/index/key/944964552ee91bc0eeeb09f63a57c97e/ page.

Right now when we select some orders we have this "Actions" select menu to change the status of all selected orders.

Here you can see for which "Actions" select menu i am talking about:

I created new Order status.

When i opened:
/public_html/beta/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

I see the following code:

    $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
         'label'=> Mage::helper('sales')->__('Print Credit Memos'),
         'url'  => $this->getUrl('*/sales_order/pdfcreditmemos'),
    ));

    $this->getMassactionBlock()->addItem('pdfdocs_order', array(
         'label'=> Mage::helper('sales')->__('Print All'),
         'url'  => $this->getUrl('*/sales_order/pdfdocs'),
    ));

These lines adds actions in this "Actions" select menu.

So in that manner i added my custom created Order status like this:

    $this->getMassactionBlock()->addItem('receive_in_our_office', array(
         'label'=> Mage::helper('sales')->__('Receive in our Office'),
         'url'  => $this->getUrl(''),
    ));

The problem is that when i select 'Receive in our Office' and press Submit just nothing happens. I am sure that this problem comes from my blank 'url'  => $this->getUrl(''),

So guys how i can properly set my 'url'  => $this->getUrl(''), to the correct URL for my custom order status with code "receive_in_our_office" ?

Thanks in advance!


texts: Custom script is loaded before javascript libraries sometimes

texts:
This is my requirejs-config.js in theme folder

var config = {
    deps: [
        "js/main",
    ],
    map: {
        '*': {
            'flexslider': 'js/jquery.flexslider-min',
            'typing': 'js/typed.min',
            'fancybox': 'js/jquery.fancybox'
        }
    },
    shim: {
        "flexslider": ["jquery"],
        "fancybox": ["jquery"],
        "typing": ["jquery"]
    }
};

And this is my main.js file in themfolder/web/js

define([
  "jquery",
  "flexslider",
  "typing",
  "fancybox"
],
function($,flexslider) {
    "use strict";
    $('.normalslider').flexslider({
        animation: "slide",
        initDelay:200,
    });
    $('.carousel').flexslider({
        animation: "slide",
        animationLoop: false,
        initDelay:200,
        itemWidth: 150,
        itemMargin: 5
    });
    $(".lightbox").fancybox({
        maxWidth    : 800,
        maxHeight   : 600,
        fitToView   : false,
        width       : '90%',
        height      : '90%',
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none'
    });
    return;
});

However, sometimes the script is loaded correctly and sometimes I got this error message

ReferenceError: jQuery is not defined[Learn More]  jquery.fancybox.js:46:1
TypeError: $(...).fancybox is not a function[Learn More]  main.js:128:2

Especially on the product catalogue page, it always give me that error message.
My Magento is still in developer mode and all cache have been disabled.

If anyone know how to fix the issue, please help me. Thank  you very much.


texts:
To create a custom menu in back-end we create adminhtml.xml with following code into this file. My question is which file(s) are responsible to process this adminhtml.xml file to add our new menu item to the menu.

<adminhtml>
        <menu>
            <[module] module="[module]">
                <title>[Module]</title>
                <sort_order>71</sort_order>
                <children>
                    <items module="[module]">
                        <title>Manage Items</title>
                        <sort_order>0</sort_order>
                        <action>[module]/adminhtml_[module]</action>
                    </items>
                </children>
            </[module]>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <[module]>
                            <title>[Module] Module</title>
                            <sort_order>200</sort_order>
                        </[module]>
                    </children>
                </admin>
            </resources>
        </acl>
</adminhtml>


texts: How to add attribute filter in product listing page in magento 1.9?

texts:
How to add attribute filter.For eg, When city attribute not set in any product then this product are showing after filter of city.

Here is my Product Collection List.php block file

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

            if (is_null($this->_productCollection)) {
                $layer = $this->getLayer();
                /* @var $layer Mage_Catalog_Model_Layer */
                if ($this->getShowRootCategory()) {
                    $this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
                }

                // if this is a product view page
                if (Mage::registry('product')) {
                    // get collection of categories this product is associated with
                    $categories = Mage::registry('product')->getCategoryCollection()
                        ->setPage(1, 1)
                        ->load();
                    // if the product is associated with any category
                    if ($categories->count()) {
                        // show products from this category
                        $this->setCategoryId(current($categories->getIterator()));
                    }
                }

                $origCategory = null;
                if ($this->getCategoryId()) {
                    $category = Mage::getModel('catalog/category')->load($this->getCategoryId());
                    if ($category->getId()) {
                        $origCategory = $layer->getCurrentCategory();
                        $layer->setCurrentCategory($category);
                        $this->addModelTags($category);
                    }
                }

                $this->_productCollection = $layer->getProductCollection(); //-old

                $this->prepareSortableFieldsByCategory($layer->getCurrentCategory());

                if ($origCategory) {
                    $layer->setCurrentCategory($origCategory);
                }
            }

            return $this->_productCollection;
        }

Load collection file - list.phtml

$_productCollection=$this->getLoadedProductCollection()->addAttributeToSort('sku', 'ASC')->addAttributeToFilter(array(
        array('attribute'=> 'city','null' => true),
        array('attribute'=> 'city','eq' => ''),
        array('attribute'=> 'city','eq' => 'NO FIELD')),
    '',
    'left');

check below link.
https://vidyutbazar.com/product-services/guntur
showing only set guntur city product not showing not set city product.
But i am not able to showing correct result.Please help me?


texts: How to create Rest API for Store Wise Site Map in Magento 2?

texts:
I want to create Rest API for sitemap according to the store-wise. Which include active, salable and visible products on front-end.

Can anyone suggest? How to do that task?


texts: Magento2: checkout method for one onepage

texts: By default, the guest checkout in Magento is enabled and visitors can place an order without registering to the website. Some websites require mandatory login for placing orders, and this default feature should be turned off to restrict the guest checkout.


texts: Add order status to mass update status menu

texts:
Right now I am using magento 1.9 and I'm trying to create a new extension, that is adding a custom order status to the Mass Update status select menu.

See the select menu "Actions" for which i am talking here:

When i opened:
/public_html/beta/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

I see the following code:

    $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
         'label'=> Mage::helper('sales')->__('Print Credit Memos'),
         'url'  => $this->getUrl('*/sales_order/pdfcreditmemos'),
    ));

    $this->getMassactionBlock()->addItem('pdfdocs_order', array(
         'label'=> Mage::helper('sales')->__('Print All'),
         'url'  => $this->getUrl('*/sales_order/pdfdocs'),
    ));

These lines adds actions in this "Actions" select menu.

So in that manner i added my custom created Order status like this:

    $this->getMassactionBlock()->addItem('receive_in_our_office', array(
         'label'=> Mage::helper('sales')->__('Receive in our Office'),
         'url'  => $this->getUrl(''),
    ));

The problem is that when i select 'Receive in our Office' and press Submit just nothing happens. I am sure that this problem comes from my blank 'url'  => $this->getUrl(''),

I was told that i have to create a new extension in order to make this thing work.

I created the following files:

/public_html/beta/app/code/community/VivasIndustries/MassUpdateCustomOS/controllers/Adminhtml/OSController.php

With content:

class MassUpdateCustomOS_Adminhtml_OSController extends Mage_Adminhtml_Sales_OrderController
    {
       public function statusAction()
        {
            $orders = $this->getRequest()->getPost('order_ids', array());
            foreach ($orders as $orderId)
            {
                $_order = Mage::getModel('sales/order')->load($orderId);
                $_order->setStatus("Receive in our Office");

                try {
                    $_order->save();
                } catch(Exception $e) {
                    Mage::getSingleton('adminhtml/session')->addError("{$e}");
                }
            }

            $this->_redirect('*/sales_order/');
        }
    }
?>

Then i created:

/public_html/beta/app/code/community/VivasIndustries/MassUpdateCustomOS/etc/config.xml

With content:

<config>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <MassUpdateCustomOS before="Mage_Adminhtml">MassUpdateCustomOS_Adminhtml</MassUpdateCustomOS>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

But when i go in my admin panel and open the Magento Connect Menager i don't see any module with name VivasIndustries or MassUpdateCustomOS installed ?

Why i do not see this module as installed?
So guys how i can properly set my 'url'  => $this->getUrl(''), to the correct URL for my custom order status with code "receive_in_our_office" ?


texts: Should I use Blank or Luma as a parent theme?

texts:
I want to create a custom theme for Magento 2 and I am curious if it is a good idea to use Luma as a parent theme or not.

I did some research and found out that Blank theme is supposed to be used for creating custom themes. But I also read that Magento changed their statement about Luma, at the beginning they stated that Luma is created for demo purposes and not for theming and now they came back on that statement.

Luma has some good benefits e.g. collapsible layered navigation and some other improvements.

I want to use Luma as a parent but I want to know if it's a good idea. I can imagine it could be better to clone and rename luma and use Blank as a parent or not use Luma at all.


texts:
What is difference b/w hosting Magento on AWS vs Magento Cloud.
Need to understand the difference and each one's advantage.


texts: How to clone a product while preserving attribute values set per Storeview?

texts:
In a Magento 2.4 store with a single website and several storeviews (i.e. one for each language), I want to duplicate an existing product (Save & Duplicate). This product has some storeview-specific attribute values, i.e. mostly translated Content in standard attributes. Only one of the storeviews inherits the default data.
However, the cloned product uses the default attribute values in all storeviews.

How can I make the clone retain the original translations?
Optional: Can I retroactively add the original attribute values without manually copy-pasting them?


texts: how to create order for guest in magento 1.9

texts:
I am trying to create an order for guest checkout programmatically. I have gone through a lot of articles. Finally, I got one stackExchange link for creating order. But In that code, they are not showing how to get cart product list and assign to guest checkout.

This is code for reference.

$checkout = Mage::getSingleton('checkout/type_onepage');
$checkout->initCheckout();

$checkout->saveCheckoutMethod('guest');

$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$emailaddress = $_POST["email"];
$confirmemailaddress = $_POST["cemail"];

if(isset($_POST['tel'])):
$telephone = $_POST['tel'];
else:
$telephone = "Not Applicable";
endif;

if(isset($_POST['postcode'])):
$postcode = $_POST['postcode'];
else:
$postcode = "Not Applicable";
endif;

if(isset($_POST['addr1'])):
$street1 = $_POST['addr1'];
else:
$street1 = "Not Applicable";
endif;

if(isset($_POST['addr2'])):
$street2 = $_POST['addr2'];
else:
$street2 = "Not Applicable";
endif;

if(isset($_POST['city'])):
$city = $_POST['city'];
else:
$city = "Not Applicable";
endif;

$billingAddress =  array (
'firstname' => $firstname,
'lastname' => $lastname,
'email' => $emailaddress,
'street' => Array(
    '0' => $street1,
    '1' => $street2
),
'city' => $city,
'postcode' => $postcode,
'country_id' => 'GB',
'telephone' => $telephone,
);

$shippingAddress =  array (
'firstname' => $firstname,
'lastname' => $lastname,
'email' => $emailaddress,
'street' => Array(
    '0' => $street1,
    '1' => $street2
),
'city' => $city,
'postcode' => $postcode,
'country_id' => 'GB',
'telephone' => $telephone,
);

$checkout->saveBilling($billingAddress,null);

$checkout->saveShipping($shippingAddress,null);

$checkout->getQuote()->getShippingAddress()->setShippingMethod('freeshipping_freeshipping')->collectTotals();

$checkout->savePayment(array('method'=>'free'));

$checkout->saveOrder();

foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
}

Please help to get code Asap.
Thanks.


texts: How can you override Mage_Adminhtml_Controller_Action

texts:
Specifically I'm interested in potentially overriding _isAllowed() so that it defaults to false instead of true.  Most of the things I've found related to overriding controllers deal with how to override a specific route's controller, but I don't think that applies here.

The reason I want to do this is so that in case 3rd party modules that I haven't developed haven't implemented _isAllowed() in their controllers, they will default to not being accessible.

I know this is a pretty low-level change to make and could break things in the core, in which case I might not be able to do it.  But I'll obviously test that once I implement it.

I looked a bit at the logic inside Mage_Core_Controller_Varien_Router_Standard::match() but not seeing anything that helps.


texts: Use frontend attribute values when creating orders from admin

texts:
When creating an order from admin that includes a configurable product, the option is displayed using the admin value of the attribute.

In my case, I use a different admin value and frontend value.

Does anyone know of a way to force the use of the frontend value?

Thanks


texts: Observer to be called after shipment is saved

texts:
I need to call observer which must be called when a shipment is created and after it is saved. I tried using the event

  sales_order_shipment_save_after

but it is called before shipment is saved and before there is an entry in the database.


texts: Page with anchor to form automatically scrolls down to that anchor on page load. How do I stop this?

texts:
I have a form towards the bottom of this page (http://ibixusa.com/find-a-distributor#distributor-form) - for some reason when the page loads it reads this anchor link and takes you down to the form automatically. I only want the anchor link to work when the text link "complete the form below." is clicked (not when page loads).

Also, is there a way to get rid of the 20x20 pixel grey square box that appears before the form (not sure where this comes from because there is no image there)

below is the code I have on this page:

To ensure your business is the go-to resource for high-quality portable surface blasting and coating equipment, you need to carry the best products available on the market. You need IBIX. Contact us today to find out more about IBIX's full range of products and how we can help your customers get the job done right!

If you would like to be connected to an authorized IBIX Distributor in your area, please complete the form below. We will be in touch!

Markets We Cover

Find A Distributor

{{block type="formbuilder/frontend_form" name="frontend_form" form_id="4" template="formbuilder/form.phtml"}}


texts: Magento 2 app:config:import does not import system section into database

texts:
I know that app:config:import is supposed to import data from config files (env.php and config.php) into database
and app:config:dump is supposed to do the opposite: export data from database into config files.
I am setting up a new Magento 2.3.5 installation with configurations from another installation's env.php and config.php files, and ran app:config:import.
When clearing everything and only leaving modules array, the website failed.
Investigating core_config_data has almost no data now!!!!!
Then I found this from Magento 2.3.5 article:
### System configuration
Magento directly uses values in the system array in the config.php or env.php files instead of importing
 them into the database because they require some pre- and post-processing actions.

For example, the value of the configuration path `web/secure/base_url` must be validated with backend models.

So, this is extremely inconvenient, my current config.php' system array section has around 3000 lines in the array.
So all those entries are now locked in backend, useless, can't change.
Also can't remove from config.php, because then they are not imported.
What can I do to import most of these system array settings into core_config_data?


texts: What are good debugging strategies for MFTF (v2) tests which only faily sometimes?

texts:
We have a MFTF test related to coupon codes that fail in 4 of 10 cases.
How can we debug this properly.
We already isolated the single test case and can reproduce it locally, it still takes 50 minutes to run 10 times.
Now we are looking for good strategies to debug that.


texts: find core files about where if product is out of stock redirect to cart page from checkout onepage

texts:
Just need little help,If I stay on checkout page and product is out of stock and if I process further step, magento automatically redirect cart page,now I want to find where is code in core files which is match product quantity and if qty is 0 or out of stock it redirect cart page,Just help me to find that code which is redirect cart page from onepage checkout if product is out of stock

I found in core files but still not find code which is redirect cart page from onepage checkout page.Please give me a hint please help me.


texts: How to get products attributes and use them as condition to set shipping price

texts:
Below is my setShippingCost function in my Observer.php:

public function setShippingCost($evt){
    $session = Mage::getSingleton('checkout/session');

    $quote = Mage::getSingleton('checkout/session')->getQuote();
    $quoteid = $quote->getId();

    $shipping_code = $quote->getShippingAddress()->getShippingMethod();
    $request = $evt->getRequest();

    $new_shipping_rate = $request->getParam('this_shipping_rate_'.$shipping_code, false);

    if($quoteid) {
        try{
            $address = $quote->getShippingAddress();
            if($address->getAddressType()=='shipping'){

                $rates = $address->collectShippingRates()->getGroupedAllShippingRates();

                foreach ($rates as $carrier) {
                    foreach ($carrier as $rate) {
                        $rate->setPrice($new_shipping_rate);
                        $rate->save();
                    }//endforeach
                }//endforeach
                $this->collectTotals($quote, $shipping_code, $new_shipping_rate);
            }//endif

            $quote->collectTotals();

        } catch (Exception $e) {
            Mage::logException($e);
            $response['error'] = $e->getMessage();
        }//endtrycatch
    }//endif

}//endfct

There conditions that need to be considered before setting the shipping cost. These are (custom attributes) length, thickness, and breadth and (default) weight.

How do I get each of the products attributes (mentioned above)? Or can this be done inside this function?

Sorry as I'm quite new to Magento.

Thank you!!


texts: Magento 2:Add another new Custom mini-cart?

texts: I want to add new Minicart like shown in the following screenshot, using KnockOut Js, Give me some logic how can I cater to this problem


texts: Is there a way to show products on frontend without indexing in Magento 2?

texts:
I have 60 million products in my store so I want to show products on front-end without using
php bin/magento indexer:reindex command.
Is there a way to show products on front-end without indexing.


texts: How to change type of Add-to-Cart button?

texts:
I am having problems with my add to cart button on product page. Its not submitting the form and it has been suggested that I should change the button type to fix this.

Here is the button code:

<button type="button" title="Add to Basket" class="button btn-cart" onclick="productAddToCartForm.submit(this)">Add to Basket</button>

How to fix the broken add to cart button?

Thanks.


texts: How to save data in custom column in sales_order table Magento 2

texts:
I need to save a string in a new column I created in the order table but I can not get any positive results, it does not save anything.

First I created the column:

<?php
namespace Vendor\Module\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Symfony\Component\Config\Definition\Exception\Exception;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\App\DeploymentConfig;

class InstallSchema implements InstallSchemaInterface
{
    /**
     * @var ResourceConnection
     */
    protected $_resource;
    /**
     * @var DeploymentConfig
     */
    protected $_deploymentConfig;
    public function __construct(ResourceConnection $resource,DeploymentConfig $deploymentConfig)
    {
        $this->_resource = $resource;
        $this->_deploymentConfig = $deploymentConfig;
    }

    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();
        $connection = $installer->getConnection();

        if ($connection->tableColumnExists('sales_order', 'ahimsa_selected_shipping') === false) {
            $connection
                ->addColumn(
                    $setup->getTable('sales_order'),
                    'ahimsa_selected_shipping',
                    [
                        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                        'length' => 0,
                        'comment' => ''
                    ]
                );
        }
        $installer->endSetup();
    }
}

Create the event:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_shipment_save_after">
        <observer name="sales_order_save_after" instance="\Vendor\Module\Observer\Sales\Order\SaveAfter"/>
    </event>
</config>

This event calls a observer class:

<?php

namespace Vendor\Module\Observer\Sales\Order;

use Vendor\Module\Helper\Data;
use Vendor\Module\Model\ShippingAndQuotes;
use Magento\Framework\App\RequestInterface;

class SaveAfter implements \Magento\Framework\Event\ObserverInterface
{
    /**
     * @var \Ebizmarts\MailChimp\Helper\Data
     */
    private $_helper;
    private $_request;
    private $_quote;

    /**
     * SaveAfter constructor.
     * @param \Ebizmarts\MailChimp\Helper\Data $helper
     */
    public function __construct(
        Data $helper,
        RequestInterface $request,
        ShippingAndQuotes $quote

    ) {
        $this->_helper = $helper;
        $this->_request = $request;
        $this->_quote = $quote;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getData('data_object');
        $order_id = $order->getOrderId();
        $request  = $this->_request->getParams();
        $selected_shipping_method = $request['shipment']['selected_shipping'];
        $this->_quote->saveSelectedShippingMethod($selected_shipping_method, $order_id);
    }
}

And in the saveSelectedShippingMethod is the logic to save:

<?php
namespace Vendor\Module\Model;
use Magento\Sales\Model\Order;

class ShippingAndQuotes
{
    private $_connection;
    private $_order;

    public function __construct(
        Order $order

    )
    {
        $this->_order = $order;
    }

    public function saveSelectedShippingMethod($quote_id, $order_id)
    {
        $quote = $this->getQuoteOrder($quote_id);
        $shipping_method = $quote[0]['method_title'];
        $order = $this->_order->load($order_id);
        $order->setData('ahimsa_selected_shipping', $shipping_method);
        $order->save();
    }
}

But when I look in the table, nothing was saved!

What I'm doing wrong?

Thanks!


texts: Discount the cheapest product in the basket

texts:
If a person buys products of the x brand, he should receive a 30% discount on every second product (ie the discount can be applied if he buys 2 products, 4, 6, 8, etc.). The discount should always be made for the cheaper product.
Thank you


texts: how can i get product in a custom module

texts:
I have a custom module for product view page and it does the exact functions that does by product view page. In default product view page, a product is getting  and load like this

<?php $_product = $this->getProduct(); ?>

Since I am using my own custom module, instead of using getProduct() method, i am using

<?php
     $id = 44;
     $_product = Mage::getModel('catalog/product')->load($id);
?>

Due to this, I couldn't do the add to cart functionality for my product.When I do console, it says 'productId' is not defined.
How can I add my product to cart as default case? what should i do for that...  please give your suggestions.


texts: Magento 2 How to set tax based on shipping?

texts:
How to set tax based on shipping?
if the user select shipping method store-pickup then we have to add tax 2% and if the customer select other shipping methods then we need to add tax 8%
It must be using programmatically.
Right now I am using events but the event is calling multiple time and first-time tax is not adding when we go on the shipping page from payment and then again click on "Next button" then tax is showing?
i am using this event - sales_quote_address_collect_totals_after


texts: Magento 2: Customer Account Reorder button not showing

texts:
I have activated reorder in my magento 2 website. Now I wanted to build the functionality where if the customer click on the reorder button it will add all the products in the cart except for disabled products but instead of doing that, if the order contains any disabled products then it removes the reorder button from the order even though that orders contains some of the items which are enabled.
I want that reorder button to show even if that order contains some disabled items.
How can I achieve this functionality?


texts: How can I list most recently viewed products by ALL users

texts:
As the title suggests, I am after a function that can display 30 recently viewed products by all users - possibly other than the active user.

The code below does it. I now just need to exclude the active user from the list - who might be a guest.

$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();

$this->_collection = Mage::getModel("reports/product_index_viewed")
                ->getCollection()
                ->addAttributeToSelect($attributes);

$this->_collection->excludeProductIds(Mage::getModel("reports/product_index_viewed")->getExcludeProductIds())
                    ->addUrlRewrite()
                    ->setPageSize(5)
                    ->setCurPage(1);

/* Price data is added to consider item stock status using price index */
$this->_collection->addPriceData();

$ids = $this->getProductIds();
if (empty($ids)) {
                $this->_collection->addIndexFilter();
} else {
                $this->_collection->addFilterByIds($ids);
}
$this->_collection->setAddedAtOrder();
if ($this-> _useProductIdsOrder && is_array($ids)) {
                $this->_collection->setSortIds($ids);
}

Mage::getSingleton('catalog/product_visibility')
                ->addVisibleInSiteFilterToCollection($this->_collection);
$_products = $this->_collection;


texts:
When we check the Sales Order in Magento, some of the order numbers are missing randomly. I have tried to find the Payment Log file to check what happened to the missing orders but I couldn't able to find the Payment Log file.

Could anyone please tell me where I can find the Payment Log file in Magento?

Magento Version: 2.2.3


texts: jQuery validation not working on pressing enter key in Magento2.2.5?

texts:
I have used jQuery validation, but it is not working on pressing enter key in Magento2.2.5?

But works on Submit button.

Refer my code.

    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script type="text/javascript">
require([
    'jquery'
], function($){

// jQuery(document).ready(function(){

// jQuery('.input').keypress(function(e) {
//    if (e.which == 13) {
//       alert('ok');
//       $('#custom-form').submit();
//       return false;
//     }
//     });

jQuery(document).keypress(function(event){

    var keycode = (event.keyCode ? event.keyCode : event.which);
    if(keycode == '13'){
        //alert('You pressed a "enter" key in somewhere');
        jQuery('#custom-form').submit();
        return false;
    }

jQuery("#custom-form").validate({
    rules: {
      first_name: "required",
      last_name: "required",
       email: {
        required: true,
        email: true
      },
      phone_no:{
        required:true,
        number:true
      },
      address1: "required",
      city: "required",
      region: "required",
      postcode: "required",
      authenticity: "required",
      style: "required",
      retailer: "required"
  },
  messages: {
      first_name: "Please enter your Firstname",
      last_name: "Please enter your Lastname",
      email: "Please enter a valid Email Address",
      phone_no: {
      required: "Please enter your Phone Number",
      number:"Please enter numbers Only"
      },
      address1: "Please enter your Address",
      city: "Please enter your City",
      region: "Please enter your State/Province",
      postcode: "Please enter your Zipcode",
      authenticity: "Please enter your Authenticity",
      style: "Please enter your Style",
      retailer: "Please enter your Retailer"
  },
    submitHandler: function(form, event) {
        event.preventDefault();
        // alert("Do some stuff...");
        form.submit();
        //submit via ajax
     }

  });
});
});
</script>

Any help would be appreciated.


texts:
Here is my website url of pub folder https://www.marketplace.jawadditaksal.org/pub/

when I installed Magento in the server by default Magento adds two .htaccess files: one in the domain directory and one in /pub, which I have renamed to ".htaccess_no" because at that time website css was not working so in the pub folder I renamed the htacess file from "htacess" to "htacess_no" and website was working and which is now working also.

But the problem is when user open the url https://www.marketplace.jawadditaksal.org/pub/ its shows the website in a wrong way, what is the solution of the pub folder index file, how normally Magento websites handle pub folder. should I add empty index file in the pub folder?


texts: Max length as input validation for product name attribute

texts:
I want that the maximum of character of product name attribute is 50 character per example in the back office.
I can not find that on default input validation on product name attribute managing.
Help plz


texts: After migration from M1->M2 Url rewrite issue

texts:
After migration M1->M2, in url_rewrite table more records found.

In m1-> core_url_rewrite table exists row:1000000

In m2(after migration)->url_rewrite table exists row:12000000

And some path exist in both request_path as well as in target_path

Like:

**in m1-> request path(favourites) **

in m2-> 2 rows found with

request path(favourites) target_path(wishlist)

request path(wishlist) target_path(favourites)


texts: Transactions - need id from saved objects

texts:
I have a transaction which saves 2 order objects.  The benefit of which is obviously that if any fail then it is all rolled back.

However, there are associated objects which need to reference the ids of the newly created orders.  What I am struggling with is how I can get the ids of the new orders without saving them?  So that I can have everything in 1 single transactions.  For example below i currently need 2 transactions:

$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($orderA);
$transaction->addObject($orderB);
$transaction->save();

$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($orderALog);
$transaction->addObject($orderBLog);
$transaction->save();


texts: Product Image default position not changed in magento

texts:
I tried to change the default position for each image in product.

            $products = mage::getModel('catalog/product')->load(1311);
            $attributes = $products->getTypeInstance(true)->getSetAttributes($products);
            $gallery = $attributes['media_gallery'];
            $images = $products->getMediaGalleryImages();
            foreach ($images as $image) {
             $attributes['media_gallery']->getBackend()->updateImage($products, $image->getFile(), $data=array('label'=>'good','position'=>10,'position_default'=>11));
            }
            $products->getResource()->saveAttribute($products, 'media_gallery');
            $products->save();

From the above code, the image position is changed but image position default is not changed.

        [value_id] => 25865
        [file] => /2/0/20_Tulips.jpg
        [label] => good
        [position] => 10
        [disabled] => 0
        [label_default] =>
        [position_default]=>


texts: how to remove my account,my wishlist in magento account link on home page

texts:
I want to show only log in and register option in account link which provided
rwd theme in magento 1.9 version.

By default rwd theme show my account,my wishlist, my cart,etc option.

but i dont want all of these just want log in and register option on front end


texts: Setting the list grid as default when products are displayed using the search bar

texts: How to set the list grid to be the default preview when product/products are displayed using the search bar?


texts: Is it fine to define module version in activation file?

texts: Usually we are defining the module version in app/code/local/Mymodule/Mynamespace/etc/config.xml file. But if we put the version in app/etc/modules/Mymodule_Mynamespace.xml it also works fine. I know this is because when rendering the Magento system it loads and merge all the *.xml files to one huge xml file. But the thing I want to know is it ok to use the version definition in activation config rather than etc/config.xml ? Any suggestions will be appreciated.


texts: Magento 2: Image not uploading in UI form "Attention: File was not uploaded”

texts:
I have created a custom form using Ui_Component,facing problem during image upload. I am using 2 column left layout ie, tab structure.

https://prnt.sc/nouwe5

When I try to upload the image it shows an  alert "Attention: File was not uploaded".

https://prnt.sc/nouwwm

The file upload is working fine when I use 1 column layout.
Here is the ui component

<field name="image_path">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="source" xsi:type="string">image_path</item>
                    <item name="label" xsi:type="string" translate="true">Image</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="formElement" xsi:type="string">fileUploader</item>
                    <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                    <item name="required" xsi:type="boolean">true</item>
                    <item name="visibleValue" xsi:type="string">image</item>
                    <item name="uploaderConfig" xsi:type="array">
                        <item name="url" xsi:type="url" path="example/example/imageupload"/>
                    </item>
                </item>
            </argument>
        </field>

I have found a related bug https://github.com/magento/magento2/issues/15675

Please help me to resolve this


texts:
$fieldset->addField('orderinfo', 'link', array(
      'label'     => Mage::helper('web')->__('Order Info'),
      'style'   => "",
      'href' => "*/".$url,
      'value'  => 'Magento Blog',
      'after_element_html' => '',
    ));

I have a link on my magento grid on a custom module as specified above. I want to redirect the field to a specific entry on the Orders tab but the url that I have generated is as follows:

/web/adminhtml_web/edit/id/67/key/62bc32b0168b446663ef7632a57a903a/*/admin/sales_order/view/order_id/47/key/f0ca76e31666c5bc62d802b0ff8404f4

And I wanted to have something like this, the existing url would be:

/web/adminhtml_web/edit/id/67/key/62bc32b0168b446663ef7632a57a903a

and the link URL would be

/admin/sales_order/view/order_id/47/key/f0ca76e31666c5bc62d802b0ff8404f4


texts: using cron.php in magento without using crond

texts:
I have to use this extension and I haven't access to cron jobs in my hosting.

I read that is possible to use cron.php also without access to cron jobs, how can I do this task?


texts: Store level Inventory for individual product Magento 2.2.0

texts:
Is there any way that have enable Store level Inventory.

Its not about user config Inventory at

  Catalog > Inventory

Its about

  Admin >> Catalog >> Product >> Open product which you want to add >> Inventory >> Minimum Qty

I need them on product level with store level, There is no way that it can be changed to Store level.

Ex => Two stored one is retail and other is wholesale, How can I set quantity increment only with wholesale So that user select bulk of 5  Qty and in Retail it should be one Qty increment.

Retail store = 1 Increment
Wholesale store = 5 Increment

This increment differ with product.