texts:
I want to Limit Checkout Order or Add to Cart Limit to allow only 6 types of products/items.
These 6 items can have variable Qty value.
Eg:
One Checkout/AddCart Maximum 6 Items:
Item-1 25Qty, Item-2 125Qty, Item-3 Sample, Item-4 50Qty, Item-5 100Qty, Item-6 Sample,
So for I have created an extension using Event Observer but it is not working.
code of Vendor/Module/etc/events.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch_checkout_cart_add">
        <observer name="limit_items_in_cart_checkout_before" instance="Vendor\Module\Observer\Checkout\Cart\Add" />
    </event>
</config>

code of Vendor/Module/Observer/Checkout/Cart/Add.php
<?php

namespace Vendor\Module\Observer\Checkout\Cart;

use Magento\Checkout\Model\Session;
use Magento\Framework\App\ActionFlag;
use Magento\Framework\App\Response\RedirectInterface as ResponseRedirect;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Message\ManagerInterface as MessageManager;

class Add implements ObserverInterface
{
    /** @var Session $session */
    private $session;

    /** @var ActionFlag $flag */
    private $flag;

    /** @var ResponseRedirect $redirect */
    private $redirect;

    /** @var MessageManager $messageManager */
    private $messageManager;

    /**
     * Add constructor.
     *
     * @param Session          $session
     * @param ActionFlag       $flag
     * @param ResponseRedirect $redirect
     * @param MessageManager   $messageManager
     */
    public function __construct(
        Session $session,
        ActionFlag $flag,
        ResponseRedirect $redirect,
        MessageManager $messageManager
    ) {
        $this->session         = $session;
        $this->flag            = $flag;
        $this->redirect        = $redirect;
        $this->messageManager  = $messageManager;
    }

    /**
     * @param Observer $observer
     *
     * @return $this|void
     * @throws \Magento\Framework\Exception\LocalizedException
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function execute(Observer $observer)
    {
        $quote      = $this->session->getQuote();
        $itemsCount = $quote->getItemsCount();

        if ($itemsCount > 6) {
            $request = $observer->getRequest();
            $request->setParams([
                'product'    => false,
                'return_url' => $this->redirect->getRefererUrl(),
                'backUrl'    => $this->redirect->getRefererUrl()
            ]);

            $this->messageManager->addErrorMessage(
                __('Only 6 types of products per purchase allowed. Please complete this order first and place another order afterwards.')
            );

            $action = $observer->getEvent()->getControllerAction();
            $this->flag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
            $action->getResponse()->setRedirect('/checkout/cart');

            return $this;
        }
    }
}


texts:
When I select some products inside the product catalog and I try to update them, I get the following error:

An error occurred while updating the product(s) status.

Magento ver. 1.9.2.4

How can I solve that and where can I check the problem?

Solved:

Needed to increase the size of innodb_log_file_size.

Screenshot:


texts: Adding Custom massAction to Orders Grid in Magento 2

texts:
I added the custom massAction to Orders List and it's executing my massAction method but it's redirecting to dashboard. for these I have written below code.

 protected function massAction(AbstractCollection $collection)
    {
        $count = 0;
        $model = $this->_objectManager->create('Magento\Sales\Model\Order');
        /** @var \Magento\Sales\Model\Order $order */
        foreach ($collection->getItems() as $order) {
            if (!$order->getEntityId()) {
                continue;
            }
            $loadedOrder = $model->load($order->getEntityId());
            $count ++;
        }

        if ($count ) {
            $this->messageManager->addSuccess(__('A total of %1 record(s) were sent to Nav.', $count ));
        }

        $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
        //$resultRedirect->setPath($this->getComponentRefererUrl());
        $resultRedirect->setPath('sales/orders/index/');
        return $resultRedirect;

    }

I have given to stay same page URL $resultRedirect->setPath($this->getComponentRefererUrl()); and $resultRedirect->setPath('sales/index/orders') but it's redirecting to dashboard.

Anything I missed? please suggest. I need to stay on the same page after executing my function.


texts:
I recently upgraded from Magento 1.5.1 to Magento 1.9.2.3 and noticed that a block on my webshop doesn't work anymore. I've got a static block called "Bestsellers" and in that block I have this peace of code:

{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml"}}

This worked on my old webshop, but not a the new one. I've tried changing the type to core/template, I've tried adding the blocks to System -> Permissions -> Blocks:

core/template
catalog/product_bestseller

And I've tried adding the bestseller.phtml to other templates, like my base folder. I also looked on stackexchange, but the "solutions" I found didn't work for me. What do I do to fix this?

Edit:
My system.log says the following: Security problem: catalog/product_bestseller has not been whitelisted.

But I did allow catalog/product_bestseller and core/template like I said above:


texts: show category name in product detail page

texts:
I am trying to get the name of a category in the addtocart.phtml. I know products could be assigned to more then one category so I am fine with having a loop if need be. Anyway here is my code which i thought would display the name of the category that the product is in/being viewed in.
does anyone know how I should alter this?

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');//get current category
    $category_name = $category->getName();


texts: Set custom select options from database table in checkout layout using OptionSourceInterface

texts:
I've added a custom form in the checkout section of Magento that contains a select field.
I'm now trying to provide the options for this select from the database (I've created a custom table from which the options should be fetched), and I'm trying to achieve this using the layout configuration (instead of using afterProcess on a LayoutProcessor plugin, which I find quite ugly).

Here's an extract of the config I have in <Vendor>/<Module>/view/frontend/layout/checkout_index_index.xml (I've only pastedthe config for the select for readability)

<!-- More config -->
<item name="custom-checkout-form-fields" xsi:type="array">
  <item name="component" xsi:type="string">uiComponent</item>
  <item name="displayArea" xsi:type="string">custom-checkout-form-fields</item>
  <item name="children" xsi:type="array">
    <item name="custom-select" xsi:type="array">
      <!-- Below is the important line -->
      <item name="options" xsi:type="array">Vendor\Module\Model\Source\CustomSelectOptions</item>
      <!-- Above is the important line -->
      <item name="component" xsi:type="string">Magento_Ui/js/form/element/select</item>
      <item name="config" xsi:type="array">
        <item name="customScope" xsi:type="string">customCheckoutForm</item>
        <item name="template" xsi:type="string">ui/form/field</item>
        <item name="elementTmpl" xsi:type="string">ui/form/element/select</item>
      </item>
      <item name="provider" xsi:type="string">checkoutProvider</item>
      <item name="dataScope" xsi:type="string">customCheckoutForm.customField</item>
      <item name="label" xsi:type="string">Custom Select</item>
      <item name="sortOrder" xsi:type="string">1</item>
      <item name="validation" xsi:type="array">
        <item name="required-entry" xsi:type="boolean">true</item>
      </item>
    </item>
  </item>
</item>
<!-- More config -->

I've seen somewhere (but can't seem to find the source, of course), that you could give the <item name="options"> node of a Magento_Ui select component the namespace of a class that implements the OptionSourceInterface to provide this component the array of its options.

Here's the content of the Vendor\Module\Model\Source\CustomSelectOptions:

<?php

namespace Vendor\Module\Model\Source;

use Magento\Framework\Data\OptionSourceInterface;

class CustomSelectOptions implements OptionSourceInterface
{

  public function toOptionArray()
  {
    return [
      [
        'value' => '',
        'label' => 'Please select an option'
      ],
      [
        'value' => 1,
        'label' => 'First option'
      ],
      [
        'value' => 2,
        'label' => 'Second option'
      ]
    ];
  }
}

  Note that the options are currently hard-coded ; I've not injected my custom repository to fetch the data from the server and map it to the desired structure yet.

With this configuration, the select is propertly displayed in the checkout form, but it has no options at all: the list is empty.
Note that there's no apparent error message when loading the checkout page.

Why aren't my options not displayed in the frontend select component? Am I missing something? Is this technique even possible or is it required to use a LayoutProcessor plugin?

  I'll try using a plugin for the time being, but if at all possible, I'd very much like to be able to use layout configuration instead


texts: Set order of multiselect attribute options within setup script

texts:
In one of the modules we are developing we require to create a multi-select attribute with several options. It's highly important that these options are given a certain order by default.

This is the current code for adding the attribute:

$installer->addAttribute('catalog_product', 'tariffplan_sms_slider', array(
    'attribute_set'     => 'Randomattributeset',
    'group'             => 'Sample',
    'type'              => 'varchar',
    'default'           => 0,
    'required'          => false,
    'visible'           => true,
    'backend'           => 'eav/entity_attribute_backend_array',
    'frontend'          => '',
    'label'             => 'Random label',
    'note'              => '',
    'input'             => 'multiselect',
    'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
    'option'            => array ('value' =>
                            array(
                                'one' => array("Low"),
                                'two' => array("Medium"),
                                'three' => array('High'),
                                'four' => array('Unlimited')
                            )
                        ),
    'visible'           => true,
    'required'          => false,
    'user_defined'      => true,
    'default'           => 0,
    'visible_on_front'  => false,
    'used_in_product_listing'   => false,
    'unique'            => false
));

As you can see I'm giving an array of options for this attribute that will be created. On top of that I would like to set the order (see Position input fields in the backend) of each option.

I have tried the following below but it isn't working:

 'option'           => array (
                            'value' => array(
                                'one' => array("Don't care"),
                                'two' => array("Low"),
                                'three' => array('High'),
                                'four' => array('Unlimited')
                            ),
                            'order' => array(
                                'one' => 0,
                                'two' => 1,
                                'three' => 2,
                                'four' => 3
                            )
                        ),

Version: Magento ver. 1.7.0.1

Anyone got an idea?


texts: change default limit of products per page in admin panel

texts:
I tried changing default limit of product per page but its not changing. I want to change default limit from 20 to 10 without making changes in core file . And I want to do this in admin panel (Product View page) not in frontend.

Any suggestions?


texts: Disable catalog price rule on coupon code

texts:
Before I start to code this I just wanted to ask:
is it possible to create a shopping price rule that will disable catalog price rule calculations?

Thanks


texts: Magento 2: How to Disable System/Exception Log

texts:
In Magento 2 not getting Log Setting option in admin under developer,

How can Disable System log and Exception Log.


texts: ajax autocomplete search with image result

texts:
I tried to install some extensions regarding Ajax search form
I would like search in the catalog via ajax, so have suggestions and images in the results (see image)
When i Install any extensions, once back in the backend, the menu: system>>configuration don't appear, this is the error message:

  "Fatal error: Class 'Magebuzz_Searchautocomplete_Helper_Data' not
  found in /home/catoccim/public_html/app/Mage.php on line 547"

I have to uninstall the extension for continue working.
I tried different extension but the result is the same.


texts:
I need the correct URL for my form action!
In app/design/adminhtml/default/default/template/customertab/action.phtml
This is file code, Is there any things I'm missing?

<form action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/customertab_customertab/reset"); ?>" method="post">
    <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
    <input type="submit" value="Post This Form" />
</form>

In app/code/local/Sean/CustomerTab/etc/config.xml I have:

<config>
    <modules>
        <Sean_CustomerTab>
            <version>0.0.1</version>
        </Sean_CustomerTab>
    </modules>
    <adminhtml>
        <layout>
            <updates>
                <customertab>
                    <file>customertab.xml</file>
                </customertab>
            </updates>
        </layout>
    </adminhtml>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <customertab before="Mage_Adminhtml">Sean_CustomerTab_Adminhtml</sean_customertab>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <global>
        <blocks>
            <customertab>
                <class>Sean_CustomerTab_Block</class>
            </customertab>
        </blocks>
    </global>
</config>

In app/code/local/Sean/CustomerTab/controllers/Adminhtml/CustomerTab/CustomerTabController.php:

<?php

class Sean_CustomerTab_Adminhtml_CustomerTab_CustomerTabController extends Mage_Adminhtml_Controller_Action
{
    function resetAction()
    {
        die("Sean was here controller");
    }
}

When I click the form submit button it takes me to mywebsite.com/index.php/power/customertab_customertab/reset/

and it's a 404 Not Found


texts: Why would some products show aggregate ratings half what they should be?

texts:
We have a couple products in Magento 1.14.0.1 enterprise that their aggregate rating is 50% the amount stored in the database.

Once a product rating is wrong, it won't go ri. I've added additional ratings to force it to recalculate it to no avail.

If I go into review_entity_summary and double the rating_summary it displays correctly. The next person that reviews will make it recalculate and it's off on the page again.

You can see a product that displays it here if you're curious. The number should be 98 as what is in the database, which would cause the width of the stars to be 98%, instead it shows 49%.
https://www.atbbq.com/plowboys-bbq-yardbird-competition-bbq-rub.html

It can strike any category, any product. Our staging server shows the same behavior and the same products with the issue except for one. Comparing that product on both servers shows no difference. Nothing odd in the pull of the value and turning off Javascript shows nothing is changing it after it hits the page.

<?php if ($this->getReviewsCount()): ?>

    <?php if ($this->getRatingSummary()):?>

            <div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%">

   <?php endif;?>

      <a href="<?php echo $this->getReviewsUrl() ?>">
         <?php echo $this->__('%d Review(s)', $this->getReviewsCount()) ?>

      |
          <a href="<?php echo $this->getReviewsUrl() ?>#review-form">
              <?php echo $this->__('Add Your Review') ?>

<?php elseif ($this->getDisplayIfEmpty()): ?>

      <a href="<?php echo $this->getReviewsUrl() ?>#review-form">
            <?php echo $this->__('Be the first to review this product') ?>

<?php endif; ?>


texts:
I want to create the view more's button. I have:

  app/design/frontend/{Name}/{theme}/Magento_Catalog/layout/catalog_product_view.xml

<referenceContainer name="product.info.main">
...
<block class="Magento\Framework\View\Element\Template" name="description.more.js" as="description" template="product/js.phtml"/>
...

  app/design/frontend/{Name}/{theme}/requirejs-config.js

var config = {
    map: {
        '*' : {
            'descriptioncontent' : 'js/descriptioncontent',
        }
    }
};

  app/design/frontend/{Name}/{theme}/web/js/descriptioncontent.js

define('jquery', function($) {
    $.fn.ContentManagement = function() {
        alert('Here');
    }
}(jQuery));

  app/design/frontend/{Name}/{theme}/Magento_Catalog/templates/product/js.phtml

<script>
// <![CDATA[
    require([
        'jquery',
        'description'
    ], function ($) {
        $(function () { // to ensure that code evaluates on page load
            alert('Check js.phtml');
            $('.product-info-main').ContentManagement();
        });
    });
// ]]>
</script>

For the moment i only have "alerts" to know if the files are correct, but i don't see nothing


texts: Why do I get 404 on magmi/web/magmi.php for Magmi in Magento 2.3 - Lemp?

texts:
After download magmi from https://github.com/macopedia/magmi-m2 ( Branch: magento2) and paste into root folder, then run www.giri.local/magmi/web/magmi.php  getting 404 error page not found.
How to solve this issue?


texts: Despite best efforts, I have images in cache that aren't loading, primarily because they are not present in the cache directory. I have tried clearing the media images cache. Short of deleting all contents of that directory or manually trying to import the images (which I would need to resize to the respective size before importing), I have tried everything to get the images stored in the cache directory. The images were previously loading, but aren't anymore. Does anyone have a solution?


texts: How to convert entire Magento2 Site to Hindi language

texts: how we can convert all the content in the Magento 2 site in to different language like Hindi.


texts: H2 headers missing in Product Description RWD base theme

texts:
I have noticed that all of the h2 headers within my product descriptions are not shown.

If I view the source within a browser all of the information is there, its just not visible.

h1,h3,h4,h5,h6 all work perfectly

I have now tested this on 3 different customer installs of Magento 1.9.

The h2 headers work perfectly within the category description.

Has anyone else seen this?

we added the following so it is easy to see.

H1

H2

H3

H4

H5

H6

http://www.seadog.com.au/propulse-adjustable-pitch-propeller-6902-10-4-13-splines.html
http://www.deckside.com.au/test-product-111.html


texts: How to programmatically register customer if email_id not exist

texts:
I have created a custom page in magento, from this I want to send coupon code to customer which are new and already registered both. For this I have created a custom form with all information I needed, on submit form I am calling a ajax and my custom module handle this request.

But How to identify there that it is new customer and How to create a new customer account in controller action?


texts:
On a 1.9.1 install we've had Free Shipping on orders over a certain amount, but need to remove this.  I've tried everything short of coding it.  All settings in Sys>Config>Sales>Shipping Methods is set to disable.  Free shipping is disabled, Free shipping in USPS, UPS, and FedEx is disabled.

There are no catalog or cart rules that offer free shipping.  I've turned everything off, and set the minimum value for free shipping to be 100,000, but it still shows up on every order over $200.

There's only so many settings that can control this, and they all look correctly disabled.  Anyone run into this?

Edit: I see that the company is using Webshops Matrix Rate to control the shipping.  Even though...its completely disabled in the admin.  The mystery deepens.  I am trying to just code that out of the file displaying it, the search continues.


texts: List all failed payment attempts in Magento

texts:
Is there a way to list all failed payment attempts, regardless the payment method used?

Edit: The basic idea is to create failed payment transaction report from existing Magento order data.


texts: Error setting attributes for 1 product not every product

texts:
I have an issue where when I create an attribute/configurable, it gets set on every product and I just want them on one specific product, instead of every product I create having all these attributes I created.

For example:

250g/ 500g/ 1kg/ 2kg

but then every product gets this attribute.


texts:
I am having problems using the search in my Magento 2.3.3. shop. When I search for "diffusor", it finds products. Searching for "usor" on the other side, finds nothing. The search term is either contained in the name or in the description.
Any idea why this is not working and how to fix it?
Thanks!


texts:
I want to show best sellers products in home page, I searched about it and use this solution. It's worked so good but now I have 2 problems:

1-Product displays on what basis? And If I want to show best sellers in month what am I do?

2-When I added <?php echo $this->getPriceHtml($_product, true, '-new') ?> in my code to show price of product, it was show just price of simple product and grouped product's price doesn't show!! How can I fix it?


texts: How to set content-type header as JSON in controller Magento 2.3

texts:
I am having the controller which is responding with resultJson(\Magento\Framework\Controller\Result\JsonFactory), I have given setData. And I need to set header as JSON. I want the JSON result in the tree(PRETTY) format. Kindly help me.

This is my code:

\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
.
.
$resultJson = $this->_resultJsonFactory->create();
.
.
$resultJson->setHeader('Content-type', 'application/json',true);
$resultJson->setData(["view_url"=> "/","results"=>$results]);

return $resultJson;

which is resulting with:

{"view_url":"\/","results":[{"product_image":"\/p11.jpg","product_name":"name1","product_desc":"protection.","absorbency":"hik","special_size":"Yes","product_url":"\/"},{"product_image":"\/p1.jpg","product_name":"name2","product_desc":" protection.","absorbency":"high","special_size":"No","product_url":"\/"}]}

But i need like this: (with response header as JSON)

{
  "view_url": "/",
  "results": [
    {
      "product_image": "/p11.jpg",
      "product_name": "name1",
      "product_desc": "protection.",
      "absorbency": "hik",
      "special_size": "Yes",
      "product_url": "/"
    },
    {
      "product_image": "/p1.jpg",
      "product_name": "name2",
      "product_desc": " protection.",
      "absorbency": "high",
      "special_size": "No",
      "product_url": "/"
    }
  ]
}


texts: Magento 1.9 : Redirect url with store code

texts:
I have multi language website.

In my website, I want to redirect using controller to actual path of the website.

For ex. Currently, I redirect to

  www.example.com/testing/

But, I need to redirect like

  www.example.com/de/testing/

How to do it?

Anyone please help me.


texts: Possible to change block type in layout XML?

texts:
Is it possible to change a block type in layout XML?

I know how to change template using setTemplate method, but I am trying to change a block's type. Is this possible?


texts: Looking for a method to offer Order Sample Button to be display in particular categories

texts: I am wanting to place a "Order Sample" button underneath the price in my product page. Can anyone help? I need it to be placed under products using the category_id. There will be several categories needing this button.


texts: Magento2 - SEO strength and SEO Architecture

texts:
I have just installed Magento2 EE and noticed that the Front-End is built upon the default template and the luna template.

The page renders lots of ajax calls which get the html files of the templates. These templates have code calls like:

<% if(data.title){ %>

<%= data.title %>

<% } %>

Is this handlebars.js? I also see the use of RequireJS, KnockoutJS and packaged versions of jQuery. What is all this JavaScript and AJAX calls going to do to benefit SEO?


texts: How to select by default first swatches from dependent options color & size in magento 2

texts:
I have tier prices for the products but it is showing after selecting swatches.

I have two attributes  "Color & Size"
 for configurable products.

Color attributes have swatch image and Size attribute as dropdown.

I want to show selected by default first option for both attributes of the products.

I am using magento 2.2

I have tried another solution bt not getting success. Can anyone help?


texts: copy categories from other categories in same magento

texts:
I want to copy categories with sub categories and add it to another categories with same mangento with different stores.

For Example:

Store One Category
      Category 1
         Sub Category 1
         Sub Category 2
      Category 2
         Sub Category 1
         Sub Category 2

Store Two Category

Now from this I want to add all Categories of Store One Category to Store Two Category without any extention.


texts:
How can i solve this error:

  Warning: include(ArrayAccess.php): failed to open stream: No such file or directory in [...]/lib/Varien/Autoload.php on line 94

  ...

  Fatal Error: Interface 'ArrayAccess' not found in [...]/lib/Varien/Object.php on line 36


texts: Ajax request disable modal / loading-mask

texts:
new Ajax.Request('<?php echo $this->getUrl('adminhtml/notification/check') ?>', {
        //parameters: {isAjax: 'true', form_key: FORM_KEY},#
        method: 'post',
        onSuccess: function(transport) {
            try {
                    $('notification').replace(transport.responseText);
            }
            catch (e) {
                $('notification').replace(transport.responseText);
            }
        }
    });

I'm making this ajax request in an adminthml page. It makes the page modal and waits for the ajax request to complete showing the user please wait and the spinner, the user cannot click anywhere in the page whilst the spinner / ajax request is active.

I would like to disable the modal please wait spinner for this particular ajax request as I want it to update a div automatically in the background.


texts: How do I find all valid array keys for the EavSetup::addAttribute method?

texts:
When adding an EAV attribute in an install script (Setup/InstallData.php or Setup/UpgradeData.php), the third argument to the addAttribute method is an array of information customizing the created attribute. An example (from this related question) is shown below:

$eavSetup->addAttribute(
    \Magento\Catalog\Model\Product::ENTITY,
    'some_attr',
    [
        'type' => '',
        'backend' => '',
        'frontend' => '',
        'label' => 'Test Attribute',
        'input' => '',
        'class' => '',
        'source' => '',
        'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
        'visible' => true,
        'required' => false,
        'user_defined' => false,
        'default' => 0,
        'searchable' => false,
        'filterable' => false,
        'comparable' => false,
        'visible_on_front' => false,
        'used_in_product_listing' => true,
        'unique' => false,
        'apply_to' => ''
    ]
);

A lot of those array values are left blank, and many of them seem applicable only to certain entity types (e.g. the used_in_product_listing key probably wouldn't be added on a customer_address attribute).

Where can one find the range of possible keys for this array? Is it dependent on the attribute's entity type?


texts:
I've a standard newsletter top and bottom. What I change in my weekly newsletter are the products I'm advertising.

I wonder if there's any 3rd party or default solution in Magento that would allow me to simply paste the URL or select the products from within my shop and the app would spit out the HTML file.

Do you guys know anything?

Best

Gabriel


texts: How to show different logo when the user is logged in?


texts: M2.2.4 - Order comments in backend, make asc order instead of desc

texts:
We have some extensions that attach comments to the order comments area of an order, however we also have the customer comment order as well, which we would like to make the primary comment on the order in the backend.

The customer order is always the first one attached, then the others get attached right after, so they end up being the 'latest' order comment, putting it at the top, but when syncing into our inventory system, it grabs the most recent comment which we don't particularly need, and would like it to grab the very first comment. Changing the order to descending will allow for this to happen we believe.

I assume this is possible, where is the order comments sort order determined?


texts: Magento2: How can load all css and js files after 5 seconds on site load?

texts: I want to load all css and js files after 5 seconds when site load. actually I am doing optimisation and css and js files taking so much time of load. I have minify js/css and merged css/js also. Anyone have an idea for that?


texts: How to assign order comment in comment column in sales order grid

texts:
I'm trying to assign customer comment left in checkout page to comments column in sales grid.

I can see comment column and tried different cases none of them working.

Can you advice how to assign this?


texts: Magento URL rewrite from SEO friendly URL's to new store

texts:
I have a new domain and am trying to 301 all of the old products/categories/pages from the old site to the relevant pages on the new site. Some of the URL's have changed slightly so doing this through .htaccess as a whole domain would not really work.

I have tried doing this in batch through phpmyadmin and testing it on individual urls through Magento's url rewrite in the admin panel. The error message I am getting is “Request Path for Specified Store already exists” which makes sense because the SEO friendly URL is already being used by the system rewrite. (see image below)

The only way I can get this to work is:

SEO URL's enabled
Change the redirect of the system URL rewrite thats
added automatically when enabling SEO URL's to 301 (see the image)
Then create a custom URL rewrite from the ugly URL
(oldurl.com/catalog/product/view/id/2881/category/47) to the new
domain url (example.com/monitor) and set this to 301 redirect.

But it does not feel like the best way and does a double redirect still pass link juice?

What I want to do is:

SEO URL's enabled
Add URL redirect from the SEO friendly url
(oldurl.com/themonitor) that goes directly to the new site
(example.com/monitor) as a 301


texts: Magento 2 Add sort order for images in frontend

texts: I have a form in backend in which we save the details and the banner image is reflected on frontend. I can make multiple banners. Now i want to give them some sort order . For eg if i give the 2nd banner sort order of 1 it should appear first. I have attached the screenshots of frontend, backend form and backend entries


texts: Why session custom data lost after refresh in Magento 2?

texts:
I need to save data in session on one page and retrieve same data on multiple pages. After saving the data when i refresh page Or redirect to another page data flush off . Can somebody explain me why it's happening? What can do to fix this?

I have tried with all types of sessions in magento2(customer,checkout,backend,catalog) also phpsession($_SESSION) without any luck.

am using Magento 2.1.7 with Luma Theme.

Any help will be really appreciated.


texts:
I have been at this for sometime now. I have read article after article and watched videos on youtube and I STILL can't figure this out. So I am asking for help on explaining how to use URL Rewrites with Magento and what I am doing wrong.

Here is what I have and what I am looking to do. Could you please describe to me in detail what I need to do?

System > Configure > Web Settings

Add Store Code to Urls = No
Auto-redirect to Base URL = No
Use Web Server Rewrites = Yes

Navigational Bar

In my navigational bar I have a link called "Cost of Savings" . Nav path WHY ERG > Cost Of Savings

Name = Cost of Savings Comparison
URL Key = cos

CMS Page

I have a CMS Page created CMS > Pages > Cost of Savings Comparison

Name = Cost of Savings Comparison
URL Key = cos

URL Rewrite System Settings for cos

Type = System
ID Path = category/41
Request Path = about-erg/cos.html
Target Path = catalog/category/view/id/41
Redirect = No

Custom URL (I Created)

Type = Custom
ID Path = category/41
Request Path = about-erg/cos.html
Target Path = cos
Redirect = No

What I am doing

I go in to URL rewrites and I create the Custom rewrite using the info in step 4. Then before I save the new custom rewrite I delete the system rewrite magento created (step 3) because if I try to save the custom one it will error while the system one is present. After the system one has been deleted I then I save the new custom rewrite I created (step 4).
Once I do this I go to the front-end and refresh the site then click on Why ERG > Cost of Savings and the pages loads wonderfully. But if I go to Magento's Index Managment (system > index management) and re-index tables then go back to the front-end and refresh the site the Cost of Savings doesn't work any more and Magento replaces my deleted System URL rewrite (step 3).

Can someone please tell me what I am doing wrong and how do I get it so this doesn't happen and the Cost of Savings link works?

Please let me know if you have any questions. Thank you VERY very Much!!

Frank G.


texts: Add A Default Phone Number To Magento Order:

texts:
Sometimes when I get an order from PayPal Express the customer Phone Number is always missing?

And this only happens when a customer uses the Guest Checkout Option.

I have tried changing the settings on PayPal but still no luck.

Is there a way to add a default Phone Number to an Order in Magento? See attached image.

I know I can use Event Observer to accomplish this task, but I don't know the right one to use in this case.


texts: Can you disable an extension in the XML file for a specific browser?

texts:
I am having problems with Internet Explorer 7 (unfortunately 20% of our customer base still use IE 7). One of our extensions doesn't seem to be Internet Explorer 7 compatible and is mucking up the look and functionality of our configurable product pages.

Is there a way in the XML file that i can disable this extension or the JavaScript if the user is using IE7?


texts: Show the Lowest Tier Price of Grouped Product on List Page

texts:
The "FROM" price (on the Category List page) will correctly show the lowest price of a SIMPLE PRODUCT associated with the GROUPED product.

However, I am needing to show the Lowest TIER PRICE of the GROUPED Product on the Category List page.. because in reality.. this is the lowest price available to the customer for that product, and not the lowest Simple Product price as Magento calculates.

Can anyone help me with this please? I can get my way about phtml files etc but cannot work out how to achieve this.
Thank you very much for any support with this.

John.


texts: Magento 2 : Error when getting sub categories

texts:
I have this function in my block.

public function getSubcategoryByUrlkey($url_key)
{

    $categoryCollection = $this->_categoryCollectionFactory->create()
                ->addAttributeToFilter('url_key',$url_key)->getFirstItem();

    echo $categoryCollection->getSelect(); exit;

    return $childs = $categoryCollection->getChildrenCategories();

}

I cannot view anything from this collection. My Magento version is Magento ver. 2.2.2. What is the mistake I am doing here?

  echo $categoryCollection->getSelect();

this also not retrieve the query

Update
I am getting this error

  Fatal error: Uncaught Error: Call to undefined method Magento\Catalog\Model\ResourceModel\Category\Collection::getChildrenCategories()


texts:
I try to export particular order information in csv format but i can't able to download. What mistake i done here?

observer.php

public function adminhtmlWidgetContainerHtmlBefore($event)
    {
        $block = $event->getBlock();
        $message = Mage::helper('sales')->__('Are you want to Download...?');

        if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
            $block->addButton('download', array(
                'label'     => Mage::helper('Sales')->__('Download...'),
                'onclick'   => "confirmSetLocation('{$message}','{$block->getUrl('*/')}')", // < missed comma
                'class'     => 'go'
            ));
        }
    }

controller.php

public function downloadAction(){

      $orders = Mage::getModel("sales/order")->getCollection();
// prepare CSV header
$csv = '';
$_columns = array(
     "Order Id",
     "Product Name",
     "Sku",
     "Price"
);
$data = array();
// prepare CSV header...
foreach ($_columns as $column) {
       $data[] = '"'.$column.'"';
}
$csv .= implode(',', $data)."\n";
foreach ($orders as $order) {
         $items = $order->getAllItems();
         foreach ($items as $item) {
               $loadProduct = Mage::getModel('catalog/product')->load($item->getProductId());
               //prepare csv contents
                $data = array();
                $data[] = $order->getId();
                $data[] = $loadProduct['name'];
                $data[] = $loadProduct['sku'];
                $data[] = $loadProduct['price'];

                $csv .= implode(',', $data)."\n";
               //now $csv varaible has csv data as string
    }
}

$this->_redirect('*/*/');
$this->_prepareDownloadResponse('file.csv', $csv, 'text/csv');
    }

config.xml

 <?xml version="1.0"?>
<config>
    <modules>
        <Manoj_Csv>
            <version>0.1.0</version>
        </Manoj_Csv>
    </modules>
    <global>
    <blocks>

        <adminhtml>
            <rewrite>
                <sales_order_view>Manoj_Csv_Block_Adminhtml_Sales_Order_View</sales_order_view>
            </rewrite>
        </adminhtml>

    </blocks>

 </global>
    <adminhtml>
        <events>
            <adminhtml_widget_container_html_before>
                <observers>
                    <manoj_csv>
                        <class>Manoj_Csv_Model_Observer</class>
                        <method>adminhtmlWidgetContainerHtmlBefore</method>
                    </manoj_csv>
                </observers>
            </adminhtml_widget_container_html_before>
        </events>
    </adminhtml>
</config>


texts: Adding products to cart programmatically with custom price in controller: Magento 2

texts:
I am having a module that is creating quotes using the Magento quote module.

It is using the \Magento\Quote\Model\QuoteFactory for creating the quotes.

Now I have added a button "Proceed to checkout" that should add the quote items to the cart and the checkout page should be displayed to the user with those items that were in the quote.

Here I am creating the quotes as:

$quote = $this->quoteFactory->create()->load($quoteId);

The quotes are creating fine and I am getting the items in the quote as:

$items = $quote->getAllItems();

I am adding the products to cart as below,

$items = $quote->getAllItems();

foreach ($items as $item) {
    $formatedPrice = $item->getPrice();
    $quantity = $item['qty'];
    $productId = $item->getProductId();

    $params = array(
          'form_key' => $this->formKey->getFormKey(),
          'product' => $productId, //product Id
          'qty' => $quantity, //quantity of product
          'price' => $formatedPrice //product price
    );

    $_product = $this->_productRepository->getById($productId);

    if ($_product) {
        $this->cart->addProduct($_product, $params);
    }
}
try {
    $this->cart->save();
    $this->messageManager->addSuccess(__('Added to cart successfully.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
    $this->messageManager->addException($e, __('%1', $e->getMessage()));
}

The issue here is the items are getting added into the cart but in case there are products that have a custom price, I need to add those products to the cart, with a different price to what is configured for the products in the catalog.

That custom price is defined in,

$formatedPrice = $item->getPrice();

Also, I am getting an issue where whenever I am creating a new quote and adding a previous quote to cart it is displaying the items for the latest quote that was created. How can this happen when the quote id is correct here?

I have referred a link that looks similar however, I need to implement the same in Magento 2.
https://stackoverflow.com/questions/5104482/programmatically-add-product-to-cart-with-price-change

Please, can anyone help me in achieving this?


texts: how to add payment method to magento report

texts:
i have followed
http://inchoo.net/magento/how-to-create-a-custom-grid-from-scratch/comment-page-1/#comment-429849
to create costume report for magento 1.8 it work correctly
now i want to add new column for "Payment Method"

help

Thanks


texts: Magento 2 - Remove Category Image on top of Category Page

texts: I want to hide the large category image that shows on the category page. What phtml file and code do I need to edit?


texts:
I want to get file size. Currently I used get_headers function of php to get file size by Url.

$url = "http://www.example.com/magento2/pub/media/myfolder/m/a/myfile.zip";
$data = get_headers($url, true);
if (isset($data['Content-Length']))
echo (int) $data['Content-Length'];

But how can we do this in Magento 2 ?

Help appreciated.


texts:
Looks like Magento has recently announced that it is discontinuing updating Magento 2.0.

  Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento
  2.0.x will no longer receive security patches, quality fixes, or documentation updates. To maintain your site's performance, security,
  and PCI compliance, upgrade to the latest version of Magento.

Has anyone in the community heard if they plan on doing the same with 2.1 as they are with 2.0 within a similar timeline? It's not the easiest of upgrades from 2.1 to 2.2 and would be a little grateful if there any information on this at all.


texts: I am using Magento-EE 2.1.5 and facing one strange issue. Order placed by registered customer shows as a guest's one. When I dig in deep, I find that sales_order table's column customer_firstname is not updated when a quote is converted into an order. I checked that the quote table has the correct customer name for the corresponding order. Anyone have an idea about this issue resolution?


texts: Magento : REST API integration with paypal payment method

texts:
We are using REST API for mobile app from magento 2. We are try to place order using paypal express checkout method. But we get error. Check detail bellow.

API call.

Call Type : PUT

API URL : https://example.com/index.php/rest/V1/carts/302/order

Request Body

{
    "paymentMethod": {
          "method": "paypal_express",
          "additional_data": {
                 "paypal_express_payment_payload": {
                       "create_time":"2019-04-15T23:13:52Z",
                       "id":"PAY-6RV70583SB702805EKEYSZ6Y",
                       "intent":"sale",
                       "state":"approved"
                 }
          }
    }
}

Response of API call :

{
    "message": "Internal Error. Details are available in Magento log file. Report ID: webapi-5cb8df18c6197"
}

Magento Error log

    [2019-04-18 20:33:28] main.CRITICAL: Report ID: webapi-5cb8df18c6197; Message: Notice: Array to string conversion in /vendor/magento/framework/Reflection/TypeProcessor.php on line 473
{"exception":"[object] (Exception(code: 0): Report ID: webapi-5cb8df18c6197; Message: Notice: Array to string conversion in /vendor/magento/framework/Reflection/TypeProcessor.php on line 473
at /vendor/magento/framework/Webapi/ErrorProcessor.php:206, Exception(code: 0): Notice: Array to string conversion in /vendor/magento/framework/Reflection/TypeProcessor.php on line 473 at /vendor/magento/framework/App/ErrorHandler.php:61)"} []

Here is my postman screenshot.

Response after developer mode enabled


texts: I have implemented Magic ToolBox's Magic Zoom and Magic 360 viewers into my product pages.  I was wondering though how I can designate for the Zoom viewer to be the default viewer that initially comes up when the page is loaded.  Currently the 360 viewer is the one that initially loads for the product and I do not see anything within Magento Enterprise for this to be adjusted.


texts: Calling a custom phtml file in another phtml file, cms block, cms page, and XML layout in Magento 2

texts:
There may be situation when you are developing a Project, you may need to call a custome phtml file in

another phtml file
cms page
cms block (static block)
xml layout

How to do it ?


texts: Need to override Pepperjam\Network\Model\Beacon\Itemized.php

texts:
How to override this below file?
Pepperjam\Network\Model\Beacon\Itemized.php

I need to override protected function inside this file, I tried with reference but not working

I have add override using plugin method but it is not working please advise if I am wrong:

In etc/di.xml add below code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Pepperjam\Network\Model\Beacon\Itemized">
    <plugin name="cmarix-pepperjam-itemized-model" type="[VendorName][ModuleName]\Plugin\ItemizedPlugin" sortOrder="1" />
</type>
 </config>

And In [VendorName][ModuleName]\Plugin\ItemizedPlugin.php file add below code

<?php

namespace [VendorName][ModuleName]\Plugin;

class ItemizedPlugin
{
    protected function aftergetQuantity($item)
    {
        $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/afterlog.log');
        $logger = new \Zend\Log\Logger();
        $logger->addWriter($writer);
        $logger->info('Your text message');

        if ($item->getProduct()->canConfigure()) {
            return 0;
        } else {
            return (int) $item->getQtyOrdered();
        }
    }
}
?>

http://www.w3.org/2001/XMLSchema-instance


texts: Magento product export import not working?

texts:
So I exported all my products by using the magento exporter under

System -> Import-Export -> Dataflow Profile -> Export all products

and then on the other magento installation:

System -> Import-Export -> Dataflow Profile -> Import all products

But the products where not imported, even though the import claims to be successfull. There were a few errors though, like missing pictures or sku on some products.

Is the product exporter not working in general or was it my fault?


texts: Wrong Order ID - PayPal IPN Exception Magento 2

texts:
I keep getting the following email from PayPal:

Please check your server that handles PayPal Instant Payment Notifications
(IPN). Instant Payment Notifications sent to the following URL(s) are
failing:

http://mywebsite.com/paypal/ipn/

If you do not recognize this URL, you may be using a service provider that
is using IPN on your behalf. Please contact your service provider with the
above information. If this problem continues, IPNs may be disabled for your
account.

Thank you for your prompt attention to this issue.

Yours sincerely,

So, I checked my var/log/exception.log, and found the following message:

[2018-02-20 03:33:12] main.CRITICAL: Wrong order ID: "000000012".
{"exception":"[object] (Exception(code: 0): Wrong order ID: \"000000012\".
at /home/admin/web/mywebsite.com/public_html/vendor/magento/module-
paypal/Model/Ipn.php:140)"} []

We've been getting this email all weekend, and the only 2 orders it's happened for is 000000011 and 000000012, however these orders aren't orders within Magento sales (we're currently on order 000000026 or something).

Has anybody gotten any ideas please?

Much appriciated


texts: moving compare products block to the bottom of right side

texts: The compare products block currently appears at the top of right column. I want it to be at the bottom of the right column. How can I do this in my local.xml. I also want my cart to be at the top.


texts: I am updating the schema of customer_entity and add a field referral code and also add a new field on the registration form. Now I want to add this field data to the customer_entity new column. how can I do


texts: How to pass a value to modal while opening

texts:
Is it possible to pass a value while opening a modal(js component of magento)?
If the answer is yes, then how can i do it?


texts:
I've been looking for core_email_queue  and  core_email_queue_recipients  table for Magento 1.7. Both of them are not there.

The reason I am asking is, sometime Order confirmations send out twice to the same customer after order is placed. Two identical emails with order confirmation. It happens occasionally, and  I cannot find out why the system does it.

Any ideas how I can check the log of all emails send in magento?


texts: How to override shipping-addres item in Magento2.3?

texts:
I am trying to add the company name of customer to the shipping address.
I tried overriding the template in the "Magento_Checkout" module under

  design/frontend/../../Magento_Checkout/view/frontend/web/template/billing-address/details.html

Also tried

  design/frontend/../../Magento_Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

But neither of them seem to work.

Is there any other way of overriding this template in Magento 2.3?


texts: Copy array from product to quote item and order item

texts:
I am copying single valued attributes from product to quote item and converting to order item.
But is it possible to do that with an array? If yes - what's the process and what type should the table in the database be?


texts: How to add custom input field on product page in 1.9.2?

texts:
i am making a garments/dresses webstore and i need to have fields, on product page, like a user can enter certain number or name to print on a shirt or select something similar from a dropdown list. How can i achieve this??
For selecting sizes i have created an attribute but for above i am unable to do it by creating attribute.


texts:
We want to display the selected payment method on the review page.
We want to place this in review.phtml

I tried this, but it did not work:

$payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getTitle();

Does anyone know the correct code to fix this?

Thanks!


texts: can't edit product in magento 2. redirect to 504 connection error

texts: In magneto 2, after editing product its shows please wait loader and redirect to 504 connection timeout error.


texts: How do I get correct ajax url for backend?

texts:
I am trying to make an ajax call to reload the information on the category edit page.

I know the url I am trying to create is catalog_category/edit, but $this->getUrl('catalog_category/edit') returns catalog_category/index.

Why is it returning index instead of edit? How do I get the correct url for ajax calls? Or do I need to manually specify the full url, in which case what is the best way to get the form key?


texts: Change Position of Custom tab of product page

texts:
I have created a custom tab on Magento 2 product page. The custom tab appears at the left side but I want it after detail and review tabs like Details - | - Reviews - | - Custom Tab

Catalog_product_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View" name="tab.tab" template="Deno_Mymodule::extra_tab.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Extra Tab</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


texts: Magento 2.2.4 - Couldn't override block class

texts:
I am trying to override the Magento\ConfigurableProduct\Block\Product\View\Type\Configurable class.

I have added a preference in app/code/vendor/module/etc/di.xml file.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <preference for="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" type="vendor\ConfigurableProduct\Block\Product\View\Type\Configurable" />
</config>

After running the setup:di:compile command, I noticed that Magento is still using the old one.

I have added preferences number of times but had experienced such behavior.


texts: Magento current user with full page cache

texts:
I have a module that tracks users engagement in magento.
This module inserts the user data inside the HTML.

The problem is: some of my clients are using full page cache and the user data are cached in the HTML. If you log in a cached page, you will get the wrong user data.

To fix this, i was thinking if i could get the user data from a AJAX request. But i cant find the endpoint to do this.

Can someone help me with this?

Thanks.


texts: Magento displays current store only search results in multi store website

texts:
i have multiple store views, one website and i want the search results to be able to show results from different store views.  one store view is in english and the other in chinese.  if a customer searches on the chinese store view but in english, i want results from the english store view to show.  they don't though because these products in the chinese store view are written in chinese but it does not search the english text of these products.

any help please


texts: Magento2: How to hide product price from the website?

texts: I want to hide product price from the website.


texts:
I would like to know people's thoughts on the best way to patch/rewrite Varien lib files. Specifically whey looking into a couple of issues one with checkboxes and one with image type inputs I found that both these Varien elements have what I would deem as bugs.

So my What is the upgrade safe way of updating the following files?

Varien_Data_Form_Element_Image
Varien_Data_Form_Element_Checkboxes


texts: How to remove APS Payment Integration modify payment method option

texts: Can you circumvent the feature where when a customer puts their credit card information into APS Payments iframe, then the customer clicks "place order" and a notification appears above where the iframe was that says "Payment Info Received (Modify)"? This step should be eliminated as it creates confusion for the customer having to click on "place order" twice.


texts:
I want to define a new phtml block in the head of my module: I try to add something like this in my app/code/Custom/Module/view/frontend/layout/default.xml file:

<?xml version="1.0"?>
<page xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <referenceBlock name="head.additional">
            <block class="Custom\Module\Block\Hello" name="mycustom" template="Custom_Module::mycustom.phtml" />
        </referenceBlock>

</page>

the phtml file must be loaded in the head and in the phtml file I have only a small javascript that will call a slider.

$('.slideshow').banner({image :"images/slide1.png"});

How I can create Custom\Module\Block\Hello block and what must contain this file?

Thank you

UPDATE:

Text me


texts:
i need get all Custom Option in magento, get radiobutton, checkbox, textarea and etc..

Let me know how i can do this for my product template?

Thanks


texts: How can i set disable the glowing blue border on focus from the Header Search (minisearch)?


texts: How to load custom module js file in magento 2?

texts:
I have created banner slider module for magento 2.
I have called JS file using following ways and its working fine.
In block class I created following function

public function getBaseJs($fileName){

        return $this->_storeManager->getStore()->getBaseUrl(
                \Magento\Framework\UrlInterface::URL_TYPE_MEDIA
            ).'bannerslider/js/'.$fileName;
    }

and this function is called in bannerslider.phtml file as following manner.

<script type="text/javascript" src="<?php echo $this->getBaseJs('jquery-1.7.min.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getBaseJs('jquery.flexslider.js') ?>"></script>

  But, according to jQuery dependency mechanism of require.js How I
  can do it ?


texts: The url in my links shows index.php but the page are working without index.php in the url

texts:
Ok, so I have tried countless solutions and not one of them worked for me.

My problem is that every link in my Magento installation contains the infamous "index.php" string.

Now, if I click on one of these link I get a "no input file specified" error. But if I take the url and manually remove the "index.php" part, I get to the right page.

Example from my backend:

I want to get to my dashboard.
If I click on the "dashboard" button, my browser gets redirected to:
http://www.example.com/index.php/admin/dashboard/index/key/1871429d86978a097e7447672b3b12bw/
and I get a "no input file specified" error screen.

But if I take the url and edit this way:
http://www.example.com/admin/dashboard/index/key/1871429d86978a097e7447672b3b12bw/
I get to the right dashboard page, as it should normally work.

Obviously, I want to remove the index.php part from my urls.

My .htaccess currently file reads as follows (and I tried every combination found on the internet for it, some of them gave me a 500 server error, so I know that url rewrites are enabled for my hosting):

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ / [L]

In my settings I have enabled url rewrites, secure urls for both backend and frontend and the secure and unsecure urls are correct ("www.example.com/").

Can anyone help me? Thanks.


texts: Magento 2 Admin Menu Fatal Error-session time out

texts:
magento 2 admin grid session time out after getting error

  Fatal error: Uncaught Error: Call to a member function getId() on null in D:\Projects\xampp\htdocs\m2\vendor\magento\module-backend\Block\Menu.php:233 Stack trace: #0 D:\Projects\xampp\htdocs\m2\vendor\magento\framework\View\Element\AbstractBlock.php(1035): Magento\Backend\Block\Menu->getCacheKeyInfo() #1 D:\Projects\xampp\htdocs\m2\vendor\magento\framework\View\Element\AbstractBlock.php(1093): Magento\Framework\View\Element\AbstractBlock->getCacheKey() #2 D:\Projects\xampp\htdocs\m2\vendor\magento\framework\View\Element\AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache() #3 D:\Projects\xampp\htdocs\m2\vendor\magento\framework\View\Layout.php(558): Magento\Framework\View\Element\AbstractBlock->toHtml() #4 D:\Projects\xampp\htdocs\m2\vendor\magento\framework\View\Layout.php(534): Magento\Framework\View\Layout->_renderBlock('menu') #5 D:\Projects\xampp\htdocs\m2\generated\code\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('menu') #6 D in D:\Projects\xampp\htdocs\m2\vendor\magento\module-backend\Block\Menu.php on line 233


texts: Knockout.js breaks in /checkout in my theme

texts:
I use magento 2.2.1 with a purchased template and on "Enable Onepage Checkout" option enabled.

The problem is the template is broken by almost everywhere and the author is irresponsible (I sent tickets but he doesn't help me), I have already fixed many problems but I am stuck in this.

When you go to Checkout page, Knockout.js breaks with the following error:

I have been reviewing and I don't give with the solution, in the template of magento doesn't happen.

Can someone give me an indication of what to check?


texts: Magento 2 , How to add "Company Name" column to "Customer Grid"

texts: When we going to create a new order manually from backend, I need to add a "Company Name" column w.r.t. customer. Also need to add filter for the same. Please help.


texts: How To Properly Disable a (Model) Rewrite

texts:
There is a third-party extension which rewrites a specific Magento core class. It should not matter if it is a block, helper or model, but in this case it is a model. Now I encounter that this rewrite is bad and I would like to disable it without changing the third party extension. Hence, I write a custom extension which depends on the third party extension. What is the best way to disable the third party rewrite? The safe one I can think of is to define a custom rewrite, which is used instead of the third party rewrite:

<global>
    <models>
        <custom_extension>
            <class>Custom_Extension_Model</class>
        </custom_extension>
        <mage_core>
            <rewrite>
                <sth>Custom_Extension_Model_Sth</sth>
            </rewrite>
        </mage_core>
    </models>
</global>

Sth.php, class directly extends from the Mage class and therefore disables the third party rewrite:

class Custom_Extension_Model_Sth extends Mage_Core_Model_Sth
{

}

This works, but does not feel too good. Thinking about observers, it is possible to disable them only via config.xml by setting them to disabled. Is something like this possible with rewrites? I tried to use the following and it works:

<global>
    <models>
        <mage_core>
            <rewrite>
                <sth></sth>
            </rewrite>
        </mage_core>
    </models>
</global>

But is it safe to do that? Does it work in all versions? I never saw that in the wild, that is why I am asking.


texts: How to set Specific (dummy) image on the whole category products. Magento 2

texts: Actually I add many products in my Magento 2 but we still dont have any images for that products so I want to set the a Dummy image on whole category products e.g like on Men categories products I want to set xyz.jpg image and for Women categories I want to set abc.jpg image.... how is it will be possible?


texts: How to keep products in basket for multiple month?

texts:
how can we keep the chosen products in the basket for multiple month?
We are using Magento 1.9 with redis.


texts: Magento2.3.3 :Get Value of Custom Product Attribute on Magento2 Rest API V1/orders/

texts:
I am trying to get the Custom Product Attribute (uom). I want to get the Attribute value to display on the rest/V1/orders API call.
m using this https://magento.stackexchange.com/a/303780/68018

app/code/{Vendorname}/{ModuleName}/etc

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

namespace {VendorName}{ModuleName}\Plugin\ProductOption.php

<?php

namespace {VendorName}\{ModuleName}\Plugin;

use Magento\Sales\Api\Data\OrderItemInterface;

    class ProductOption
    {

        /**
         * @var \Magento\Sales\Api\Data\OrderItemExtensionFactory
         */
        private $orderItemExtensionFactory;

        public function __construct(
            \Magento\Sales\Api\Data\OrderItemExtensionFactory $orderItemExtensionFactory
        ) {

            $this->orderItemExtensionFactory = $orderItemExtensionFactory;
        }
        public function beforeAdd(
            \Magento\Sales\Model\Order\ProductOption $subject,
            OrderItemInterface $orderItem
        ) {
            $extensionAttributes = $orderItem->getExtensionAttributes();
            if(null=== $extensionAttributes){
                $extensionAttributes= $this->orderItemExtensionFactory->create();

            }
            $extensionAttributes->setCustomField($order->getCustomField());
            $orderItem->setExtensionAttributes($extensionAttributes);
        }
    }

app/code/{Vendorname}/{ModuleName}/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\Sales\Api\Data\OrderItemInterface">
            <plugin name="custom_attribute_uom" type="Devcrew\CustomAttribute\Plugin\ProductOption"/>
        </type>
    </config>


texts:
I think this is a simple question, but can't seem to find the answer.

I have used this code and it works fine:

<?php echo $_product->getAttributeText('my_attribute'); ?>

the only thing is, it is just showing the attribute value not the title.
How can I add the attribute title to this code/


texts: What is the best way to transfer data of Magento 2? + error "Unable to unserialize value."

texts:
I would like to change the server and move Magento 2.1.0 from server A to server B without any difference in data, theme, extensions, and configuration. only the domain will be a change from www.domaina.com to www.domainb.com. What is the best way to transfer it? I'm using Magento 2 CE.

edit:
now I decide to buy a new theme. so, I install Magento CE 2.2.0 from application wizard in Plesk but when I import database I can't enter to the dashboard.

edit: after transfer to a new server and import database, I git this error when trying to enter to the dashboard: There has been an error processing your request. Unable to unserialize value


texts: Magento 1.9 running slow on frontend on localhost and production servers

texts: I'm trying to speed up Magento 1.9.0.1.  It's taking something like a minute or so on localhost MAMP 5, and page speeds on production are loading over 10 seconds. I've tried full page cache extensions, removing overridden templates, disabling all third party extensions, and truncating large database tables. The site ran moderately fast for about 5 years. The first sign of problems was on the production server when the cart page started taking over 10 seconds to load.


texts: How to render html content into PDF invoice?

texts:
I'm trying to print some payment info using html tags, like  and
, but it's not working. I have this function in a file Info.php within the payment module:

public function toPdf() {
    $this->setTemplate('MOIP/transparente/info/pdf.phtml');
    return $this->toHtml();
}

And inside pdf.phtml, I have:

$info = $this->_prepareInfo();

Method: Credit card

Payment way: <?php echo $info['creditcard_parc']; ?>

Flag: <?php echo $info['cc_flag']; ?>

4 last digits: <?php echo $info['last4'] ?>

But, the output is not being the expected. There are 2 issues:

The lines are breaking unnecessarily.
The credit card icon is printed out like when we use htmlspecialchars, instead of the image rendered as it should.

Any help?


texts: Not valid template file: mini.phtml and sidebar_header.phtml

texts:
Got error in my logs:

CRIT (2): Not valid template file:frontend/base/default/template/checkout/cart/mini.phtml

and

CRIT (2): Not valid template file:frontend/base/default/template/checkout/cart/sidebar_header.phtml

Should there be a mini.phtml template file? In my rwd theme I have minicart.phtml but still no mini.phtml, same with sidebar_header.phtml, I have sidebar.phtml in my rwd theme but no such a template like sidebar_header.phtml.
Any ideas?
grep result:

/microcloud/domains/vamdev/domains/dev.domain.co.uk/http/includes/src/Amasty/Cart/controllers/AjaxController.php:176: $template = "checkout/cart/mini.phtml";
/microcloud/domains/vamdev/domains/dev.domain.co.uk/http/app/code/local/Amasty/Cart/etc/config.xml:164: checkout/cart/mini.phtml
/microcloud/domains/vamdev/domains/dev.domain.co.uk/http/app/code/local/Amasty/Cart/controllers/AjaxController.php:176: $template = "checkout/cart/mini.phtml";


texts: Ubuntu cron running but nothing happening in Magento

texts:
I have set up the Cron on my Ubuntu server and it is running every 5 minutes, everything ran fine for about a week, but now the cron still runs (it appears in the logs) but according to Magento the last cron was ages ago! There are no errors in the cron logs.

I missed a few sales from eBay because of this.

Any ideas of how to get Magento run cron again or to debug it?

EDIT: Similar question: https://stackoverflow.com/questions/10499471/m2e-cron-jobs-not-automatically-running-in-magento.
Maybe it is just the M2E extension not running in the cron.

EDIT 2: There is no cron.lock file, and the cron_shedule table is empty...


texts: View in the cart the product's regular price plus the custom options selected for each product added

texts:
is it possible to view inside a column in the cart, the regular price plus the custom options selected for each product added? (the cost should vary depending on the quantity of the product and the options selected)
wich code should I edit?


texts: add customer email in sales order grid magento

texts:
how can i add customer email in admin html grid magento. i get customer email in collection but not displayed in column of Customer Email. Please Help me.

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->join('order', 'main_table.entity_id = order.entity_id', 'customer_email');
    $this->setCollection($collection);
    return parent::_prepareCollection();
}
protected function _prepareColumns()
{
        $this->addColumn('customer_email', array(
        'header' => $this->helper('sales')->__('Customer Email'),
        'index' => 'customer_email',
    ));
}


texts: Copying deprecated module into newer version of Magento (1.7)

texts:
We have the find feed working in an older version of Magento (1.5).

I copied app/code/community/Find to our 1.7 installation.

I also copied app/etc/modules/Find_Feed.xml

The database table has been created.

After refreshing the Magento cache and re-logging into the Admin, "TheFind Feed" appears just where it is supposed to, under Catalog. It's sub-menu items "Manage Attributes" and "Manage Items" also appear there. But when I click on either of them, the result is a "blank" admin page.

Does anyone know why the admin interface for the module is not showing up?

EDIT:

I have gotten closer to solving this with programmer_rkt's help.

I completely forgot to copy the app/design/adminhtml/default/find folder. After that, and refreshing the Magento cache again, the admin interface showed up. But the feed file did not seem to save. I realized that some config settings saved in the database table core_config_data were missing. Here they are:

+-----------+---------+----------+-------------------------------------------+-------------+
| config_id | scope   | scope_id | path                                      | value       |
|           | default |        0 | advanced/modules_disable_output/Find_Feed | 0           |
|           | default |        0 | feed/settings/findfeed_filename           | thefind.txt |
|           | default |        0 | feed/settings/findfeed_update             | 0           |
+-----------+---------+----------+-------------------------------------------+-------------+

"thefind.txt" will, I believe, appear in the magento var/export/find_feed/ folder, although I may have added some custom code to achieve that. I'm not sure if that is the default.

The export still is not working for me on the new system, but at least the admin controls are visible now.


texts: Multiselct product attribute is not beign added into collection filtering

texts:
I have created a multi select attribute and assigned this to attribute set. Attribute is showing in product search results but I am unable to include this into product collection filtering as well as into addAttributeToSelct
Here is the section I am using this attribute to filter the prodcut collection.

$collection = Mage::getModel("catalog/product")
            ->getCollection()
            ->addAttributeToSelect(array('sku','speciality','name'))
            ->addFieldToFilter('speciality', array('eq' => $speciality));
echo $collection->getSelect();

And in my browser I have the following result for select query

SELECT `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, `e`.`sku`, `e`.`name` FROM `catalog_product_flat_3` AS `e` WHERE (e.status = 1)

Here are screen shot for the attribute configuration


texts: Adding cart costs more than two minutes to respond

texts:
Magento version: CE 1.9.2.2
host: Synology DS 1515+ (DSM version: 5.2)

There are two websites, one of which has 364 products, the other has none.
Recently, it takes more than two minutes for adding cart to respond from server.
If I don't login as a customer, it respond very fast(when I'm a visitor).

I've enlarged memories of opcache.ini, PHP runtime, and Mariadb,
there is no improvement.

I've tried to clean manually /var/cache and /var/session,
it's become fast for a very short time(, then it recovers to respond slowly).

I traced with Firebug, finding out that there are totally three places responding very slowly(more than two minutes or longer):
/checkout/onepage/add
/checkout/onepage/saveBilling
/checkout/onepage/savePayment


texts: Load a jQuery script after fully loading the page

texts:
I'm struggeling with this. My jQuery script works fin with every of my input, but not with the input loaded by AJAX, such as the mini-cart input.

The code (and the css) is used to do this : add to each input of quantity to right a + and - to have a better UI, instead of the small default arrows.

See my code :

define([
        "jquery",
        "bootstrap",
    ],
    function($)
    {
        "use strict";
        console.log(" ====== main.js is loaded====== ");

        $(document).ready(function()
        {
            $('

+

-

').insertAfter('.quantity input');
            $('.quantity').each(function() {
                                btnUp.on("click", function() {
                console.log("up");
                let newVal;
                let oldValue = parseFloat(input.val());
                if (oldValue >= max) {
                    newVal = oldValue;
                } else {
                    newVal = oldValue + 1;
                }
                spinner.find("input").val(newVal);
                spinner.find("input").trigger("change");
            });

            btnDown.on("click", function() {
                console.log("down");
                let newVal;
                let oldValue = parseFloat(input.val());
                if (oldValue <= min) {
                    newVal = oldValue;
                } else {
                    newVal = oldValue - 1;
                }
                spinner.find("input").val(newVal);
                spinner.find("input").trigger("change");
            });

            });
        });
    });

I tried thing like live, ajaxComplete, ready, even add the code into the default.html part of the checkout minicart.

But the script is not working with ajax loaded content. What should I do ?


texts: Can not login with customer emai1 in magento2

texts:
I am getting below error in my log file when try to login.

 main.CRITICAL: No such entity with customerId =  [] []

Tried below solution that didn't work.

Magento 2 - Moving site - 'No such entity'


texts: How to utilise the existing LESS variables in my new less file

texts:
As the title says, i want to use LESS variables that are already defined by Magento. for example,

there is variable called @color-white defined in following file.

  ROOT/lib/web/css/source/lib/variables/_colors.less

and i want to use that in my own less file that located in my new theme. by doing this is to keep style in consistency. any idea on how to do this?


texts:
I have created cron jobs @ every 1 min to run. And I run the http://localhost/magento/cron.php. but it's not working.

My Code is:

Observer.php

<?php
class Easylife_CJobs_Model_Observer {
    public function setStatus() {
        Mage::log("Cron Jobs Working Fine!",null,"cronjobs");
    }
}

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_CJobs>
            <version>0.1.0</version>
        </Easylife_CJobs>
    </modules>
    <global>
        <models>
            <cjobs>
                <class>Easylife_CJobs_Model</class>
            </cjobs>
        </models>
    </global>
    <crontab>
        <jobs>
            <cjobs>
                <schedule>
                    <cron_expr>*/1 * * * *</cron_expr>
                </schedule>
                <run>
                    <model>Easylife_CJobs_Model_Observer::setStatus</model>
                </run>
            </cjobs>
        </jobs>
    </crontab>
</config>

Please let me know is this procedure is correct else is another procedure?


texts:
I created a new template file (my-page.phtml) on /app/design/frontend/pkgName/themeName/template/page.

I'm aware of how the content, footer and other blocks are declared an what happens when getChildHtml() is called.

One thing I've been unable to wrap my head around is how do I create extra content areas (with different names) since I want to have, for example, /sales/orders/history, /customer/account/edit and other blocks to show on the same page but in a different areas (the commented out code in my template), so that I can style everything like I want in its own place within my intended layout (almost like a two column layout)

This template has the following code:

<!doctype html>

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

    <body<?php echo $this->getBodyClass()?'  class="'.$this->getBodyClass().'"':'' ?>>

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

            <?php echo $this->getChildHtml('global_notices') ?>
            <?php echo $this->getChildHtml('header') ?>
            <?php echo $this->getChildHtml('breadcrumbs') ?>

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

                        <?php echo $this->getChildHtml('global_messages') ?>
                        <?php echo $this->getChildHtml('content') ?>

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

        <?php echo $this->getChildHtml('before_body_end') ?>
        <?php echo $this->getAbsoluteFooter() ?>

How can I create extra content areas with different names? On pages.xml?


texts: Magento 2 custom module ui component admin form add fieldset within a field

texts:
Can one have a Fieldset within a field ?.
E.G:

<?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">
<fieldset name="custom_fieldset">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Custom Fieldset</item>
            <item name="collapsible" xsi:type="boolean">true</item>
            <item name="sortOrder" xsi:type="number">31</item>
        </item>
    </argument>
    <field name="is_master_category">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                 ....
                <item name="default" xsi:type="number">0</item>
            </item>
        </argument>
        <fieldset name="custom_fieldset_in_field_2">
         <field name="custom_field_whithin_field_set_2">
         ...
         </field>
        </fieldset>
    </field>
  </fieldset>
</form>


texts: change the default store and url with store name

texts:
i change the default store

after that URL display with store name

like this https://example.com/ca

the default store  URL only displayed URL

How can i remove the store name  in the URL?.


texts: Webshop matrixrate not working on multiple stores in magento2

texts:
We have installed webshop matrixrate extension for our magento2 store.

Its not working in checkout, Getting below error

Sorry, no quotes are available for this order at this time

Even we have records in table. Matrix rate is enabled in backend.

I have enabled the module in Main website, Please anyone suggest on this. Thanks


texts: Get Error SessionHandler::read() When installing Magento 2 with Nginx

texts:
I downloaded magento 2.2.5 and try installing with nginx server, but I got blank page in the installation and then I saw the this error in the report file  :

{"0":"Warning: SessionHandler::read(): open(\/usr\/share\/nginx\/html\/magento2\/var\/session\/sess_9207bsuqtdoet3h96dmv8vpc41, O_RDWR) failed: No such file or directory (2) in \/usr\/share\/nginx\/html\/magento2\/vendor\/magento\/framework\/Session\/SaveHandler\/Native.php

please somebody help


texts:
I notice the 'featured product' attribute exists in the latest version of Magento. How can I make my featured products display on the homepage in the RWD theme?

Thank you


texts: SVG images not showing in content blocks

texts:
One of my lovely product managers has supplied me with a few *.SVG files to display in a static content block.

now if I refer to the image via a remote URL is displays fine,
eg scr="http://path.to.some/remote/server/file.svg"  displays fine , however loading the file to the local server (permissions are fine I've tripple checked) and referencing similar to scr="{{media url="wysiwyg/path/to/file/file.svg" it does not render.

is it as simple as svg's are forbidden in magento and i need to allow? or is something more sinister happening?


texts: Top menu doesnot take the url key values as links

texts:
I have CMS pages with the url key values as shown

But in the top menu the

But in the front end top menu the links are not using the url keys.
For example the CMS page "gift registry" has url key "gift_registry". But the menu have link "gift-registry". So the page show 404 error


texts:
Setting up cron for a custom module what I believe I need to do is create a \etc\crontab.xml for the module.

What I also believe is happening is when the cron job magento cron:run runs  all jobs in the table cron_schedule are executed (as long as time <= scheduled_at).

If this is correct, how does my job run_my_module for my custom module (my\module) get in cron_schedule?  I've run magento cron:run manually but don't see my job in the table.  What am I missing?


texts: Magento Currency code in Transaction email showing only base currency code..

texts:
I have configured a uk store in my magento site.. Now in order invoices It is showing euro symbol which is the currency code of default store.. I need the The uk pound symbol..

In uk store frontend pound sterlink showing correctly.. I have this problem only in order emails.


texts: How to show categories instead of main navigation bar in magento iPhone theme

texts: I'm using default magento iPhone theme for mobile viewers of my website, but defaultly iPhone theme show main navigation bar on the home page. But I need to show category list instead of main navigation bar. How should I do it ?


texts: Create Order from Backend Shows Product options from another store on page refresh for multisite/store setup

texts:
1) I have setup of 2 websites (1 for retail and 2 for wholesale) and both has 1 store into it. retail: www.freshforsure.in, wholsale: wholesale.freshforsure.in.

2) Now I have created 1 product named "Dummy" and set website scope as both websites.

3) Next, I have set different Custom Options and Option Values of same product for both websites.

4) Now I am trying to create order from back end using admin credentials under web site wholesale.freshforsure.in by following the steps below.

a) Menu Option Sales -> Orders -> Create New Order
  b) Selected customer from the customer list
  c) Selected wholesale.freshforsure.in

5) Now I have selected and added product named "Dummy" with one of the custom option "30 kg - Rs.300" by clicking "Add Products" button. Selected Item is added to grid with correct options See screen shot

6) Now on refreshing the page manually or by adding more items, system is replacing wrong Product option (It is picking product option of another website/store) under grid for Item "Dummy" See screenshot after refresh
refer screenshot here

Please help.


texts: File show placeholder image, even existing

texts:
I imported files, but the cached image is the placeholder iamge.
How can I debug this?


texts: How to sort the Attribute Set list on the create new product

texts:
Can anyone tell me how to sort the order of attribute sets when creating new products in Magento.

From question: How to sort the Attribute Set list on the Manage Products Grid dropdown menu?
I can see how it is done for the manage product grid. But it is even more needed when creating new products


texts: How to enable modules (undo "Disable Modules Output") without admin access

texts:
i have just disabled some modules in magento. and i think we have disabled some important modules.
what i have done is:

  system > configuration > advanced > Disable Modules Output

i have disables every thing from there .the problem is now i can not access my admin panel. i have disabled some mage or important modules as well.

can some one tell me how to re-enable them from files?


texts: How to display discount on Special price in product detail page?

texts:
I overridden module-catalog/product/price/amount/default.phtml file in my theme

<?php
    echo $this->helper('Test\ProductDetail\Helper\Data')->DisplayDiscountLabel($_product);
?>

In helper file I have following code ;

 namespace Test\ProductDetail\Helper;

 class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
public function DisplayDiscountLabel($_product)
{
   $originalPrice = $_product->getPrice();
    $finalPrice = $_product->getFinalPrice();

    $percentage = 0;
    if ($originalPrice > $finalPrice) {
        $percentage = number_format(($originalPrice - $finalPrice) * 100 / $originalPrice,0);
    }

    if ($percentage) {
        return "(".$percentage."%)";
    }

   }
}

but problem is that in phtml file I am not getting value of $_product?


texts:
Take for example in app/design/frontend/base/default/layout/page.xml, in order to remove some of default js/css files, I have declared in app/design/frontend/{themename}/default/layout/local.xml removeItems.

Would it be best for me to declare a custom theme page.xml? Does Magento identify that a local theme xml file is declared and ignores the default page.xml or does Magento look at the custom theme xml file and crosscheck it against the default theme xml file?

The way I currently have it set, by removing items in the local.xml, is working, however, logically it seems to hinder performance and I wish to aim for best practice.

Thanks!


texts: Single module connect to local and external database

texts:
If a magento module "models" custom tables in the local Magento database, can it also be setup to "model" tables from an external database in parallel.

The config.xml global "models" tag appears to allow plural in it.
So can I define a parallel 'external db connection' in resources and be able to use it with additional models, alongside the modelling of the custom tables in the local database.

Another way to rephrase this question is.. Can a magento module talk to tables in the local database and also in parallel talk to an external database using the ORM/ Model layer offered by Magento ?

    <global>
    <models>
        <(modulename)>
            <class>(ClassName_Prefix)</class>
            <resourceModel>(modulename)_(resource_model_type)</resourceModel>
            <(modulename)_(resource_model_type)>
                <!-- definition -->
            </(modulename)_(resource_model_type)>
            <rewrite><!-- definition --></rewrite>
        </(modulename)>
    </models>
    <resources>
        <(modulename)_setup><!-- definition --></(modulename)_setup>
        <(modulename)_read><!-- definition --></(modulename)_read>
        <(modulename)_write><!-- definition --></(modulename)_write>
    </resources>


texts: Magento 2 decode widget code in category description

texts:
I have added widget(call static block) in category description http://prntscr.com/ko816y.But it is not call widget in front just showing output as it look in admin WYSIWYG editor.
So,I want to convert below code to html

{{widget type="Magento\Cms\Block\Widget\Block" template="widget/static_block/default.phtml" block_id="10"}}

How can I convert widget code to html?

EDIT
I have Call Description like this way

<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($block->getCurrentCategory(), $_description, 'description') ?>


texts: I need individual product counter on the product.


texts: Limit characters in product name attribute while adding a new product in Magento Admin Panel with a hint?

texts: Is there a way to limit the characters that can be entered in Magento Admin Panel while adding a new product? Please see the image below to understand the issue clearly. Also, provide a hint (doesn't have to exactly be like below, could be a js alert or anything) as long as it limits the user to enter furthermore characters?


texts: Magento2.3 - Programmatically setting order status to On Hold getting stuck

texts:
I have an observer in my module the fires when the order is placed, depending on a condition I use
$order->setState(\Magento\Sales\Model\Order::STATE_HOLDED, true)->save();
$order->setStatus(\Magento\Sales\Model\Order::STATE_HOLDED, true)->save();

To set the order status to "on hold", this works but when I try to take the order off hold from the admin it says "the order was not on hold" even though the status is on hold in both sales_order and sales_order_grid

I have also tried with object manager which does the exact same thing (also, the comment is added so it seems like its right):
$orderId = $orderIncrementId;
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $order = $objectManager->create('\Magento\Sales\Model\Order')->load($order_id);
        $currentStatus = $order->getState();
        $status = 'holded';
        $comment = 'Age verification failed';
        $isNotified = false;
        $order->setState($status);
        $order->setStatus($status);
        $order->addStatusToHistory($order->getStatus(), $comment);
        $order->save();

And I have tried through the order repository (but this didn't work as it's in the observer sales_order_save_after but still says "order id does not exist)
$holdStatus= \Magento\Sales\Model\Order::STATE_HOLDED;

$id = $orderIncrementId;
        try{
            $order = $this->orderRepository->get($id);
            $order->setStatus($holdStatus)->setState($holdSatus);
            $this->orderRepository->save($order);
        } catch (NoSuchEntityException $ex) {
            alert("not worked");
        }

Currently, I'm manually changing the order status to processing in the database to get the orders off hold but as we up-scale the module this won't be practical - does anyone have any idea about this before I create a button that manually changes the status in sales_order and sales_order_grid with direct SQL?


texts:
Is there a way to set up a coupon in M2 that allows you to only apply the discount to the highest ticket item in the cart?  Or do I have to buy an extension?
I am just a retailer with M2, so cannot code!  Thank you!


texts:
When I deployed magento project from one server to another server css and js didn't loaded. So I google and got this answer which worked for me.

<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

sudo a2enmod ssl

sudo a2ensite default-ssl

sudo a2enmod rewrite

sudo service apache2 restart

I used it blindly but I need to know what is purpose of enabling rewrite and these below commands

Options Indexes FollowSymLinks
AllowOverride All
Require all granted


texts:
I have question about add new customer fields. Trying to add two fields like this:

MyModules\CustomerMarketingFields\Setup\InstallData.php

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {

        $installer = $setup;
        $installer->startSetup();
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
        $entityTypeId = $customerSetup->getEntityTypeId(\Magento\Customer\Model\Customer::ENTITY);

        $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "regulation",  array(
            "type"     => "int",
            "backend"  => "",
            "label"    => "Regulamin",
            "input"    => "boolean",
            "source"   => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
            "visible"  => true,
            "required" => true,
            "default" => "",
            "frontend" => "",
            "unique"     => false,
            "note"       => ""

        ));

        $regulation   = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "regulation");

        $regulation = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'regulation');
        $used_in_forms[]="adminhtml_customer";
        $used_in_forms[]="checkout_register";
        $used_in_forms[]="customer_account_create";
        $used_in_forms[]="customer_account_edit";
        $used_in_forms[]="adminhtml_checkout";
        $regulation->setData("used_in_forms", $used_in_forms)
            ->setData("is_used_for_customer_segment", true)
            ->setData("is_system", 0)
            ->setData("is_user_defined", 1)
            ->setData("is_visible", 1)
            ->setData("sort_order", 100);
        $regulation->save();

        $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "process_personal_data",  array(
            "type"     => "int",
            "backend"  => "",
            "label"    => "Personal data",
            "input"    => "boolean",
            "source"   => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
            "visible"  => true,
            "required" => true,
            "default" => "",
            "frontend" => "",
            "unique"     => false,
            "note"       => ""

        ));
        $personalData   = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "process_personal_data");

        $personalData = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'process_personal_data');
        $used_in_forms[]="adminhtml_customer";
        $used_in_forms[]="checkout_register";
        $used_in_forms[]="customer_account_create";
        $used_in_forms[]="customer_account_edit";
        $used_in_forms[]="adminhtml_checkout";
        $personalData->setData("used_in_forms", $used_in_forms)
            ->setData("is_used_for_customer_segment", true)
            ->setData("is_system", 0)
            ->setData("is_user_defined", 1)
            ->setData("is_visible", 1)
            ->setData("sort_order", 100);
        $personalData->save();

        $installer->endSetup();
    }

After run setup:upgrade command i get error like this:

 [Zend_Db_Statement_Exception]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'adminhtml_customer-147' for key 'PRIMARY', query was: INSERT INTO `customer_form_attribute` (`form_code`,`attribute_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?)

  [PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admi
  nhtml_customer-147' for key 'PRIMARY'

When I add only one field everything is ok.
What is wrong with this config?


texts:
I tried to do what all the person have done without problems

$customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect(array('email'), 'inner');
Mage::getSingleton('core/resource_iterator')->walk($customers->getSelect(), array(array($this, 'customerCallback')));

function customerCallback($args)
{
    $customer = Mage::getModel('customer/customer'); // get customer model
    $customer->setData($args['row']); // map data to customer model
    echo $customer->getFirstname(); // set value of firstname attribute
}

But, for me, it doesn't works an i don't know why. The error is:

PHP Fatal error:  Uncaught exception 'Exception' with message 'Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object


texts: How to decrease quantity from database in item custom option

texts:
I have some clothing items in different sizes such as small, medium or large.

Now I want to manage each stock separately e.g. small 15, medium 25, large 30 without using configurable product option. Using this method I added quantity field in custom option and add quantity in database.

Here is the link to add quantity in custom option in magento

Above link works perfect for me but the problem is arising on frontend, when we place an order of clothes in any size with any quantity, it will not decrease or update from our database.

What should I do so that quantity can be decreased from our database?

Any suggestions are very welcome! :)