texts: Sort Magento categories alphabetically using SQL query but for specific root category

texts:
I found this SQL query (Magento Sort Categories Alphabetically using SQL Query) and I've been successfully using it to re-sort all of our 30000+ categories but the problem I have is that it re-sorts all categories. I only have one category that needs re-sorting every now and then so my question is, how do I modify below query so that it only sorts all subcategories for a specific category (ID: 38744)?

SET @i=0;
SET @j=0;
DROP TABLE IF EXISTS AAA_NEW_POSITION;
CREATE TABLE AAA_NEW_POSITION SELECT e.entity_id AS 'entity_id',
    vn.value AS 'name',
    e.position AS 'old_position',
    @i:=@i + 1 AS 'new_position' FROM
    catalog_category_entity e
        LEFT JOIN
    catalog_category_entity_varchar vn ON e.entity_id = vn.entity_id
        AND vn.attribute_id = 41
ORDER BY vn.value;

ALTER TABLE AAA_NEW_POSITION ORDER BY name;
UPDATE AAA_NEW_POSITION
SET
    new_position = @j:=@j + 1
ORDER BY name;

UPDATE catalog_category_entity e
        LEFT JOIN
    AAA_NEW_POSITION np ON e.entity_id = np.entity_id
SET
    e.position = np.new_position;

DROP TABLE IF EXISTS AAA_NEW_POSITION;


texts: Magento Low Stock RSS has stopped refreshing

texts:
My Problem

Notify Low Stock RSS is not updating automatically. It is only updating feed data after I modify Configuration > Inventory > Product Stock Options.

I can confirm that Magento's cron job is running - not sure where to check to see whether or not the RSS part of that cron is running or not running.

Possible Cause:

A while back modified app/code/local/Mage/Rss/Block/Catalog/NotifyStock.php so that the pubDate is the date that the item went out of stock rather than the date the feed was generated. I don't think that this is the reason since the feed did update for a while after this change was made. Either way, my mod to the feed is below. The two modifications are /* commented */.

public function addNotifyItemXmlCallback($args)
{
    $product = $args['product'];
    $product->setData($args['row']);
    $url = Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit/',
        array('id' => $product->getId(), '_secure' => true, '_nosecret' => true));
    $qty = 1 * $product->getQty();
    $description = Mage::helper('rss')->__('%s has reached a quantity of %s.', $product->getName(), $qty);
    $rssObj = $args['rssObj'];

    /* Begin Modification */
    $resource = Mage::getSingleton('core/resource');
    $readConnection = $resource->getConnection('core_read');
    $tableName = $resource->getTableName('cataloginventory_stock_item');
    $getLowInventoryDate = 'SELECT low_stock_date FROM ' . $tableName .' where product_id='.$product->getId().' limit 1';
    $lowInventoryDate = $readConnection->fetchOne($getLowInventoryDate);
    /* End Mod */
    $data = array(
        'title'         => $product->getName(),
        'link'          => $url,
        'description'   => $description,
            /* Continue Mod */
        'lastUpdate' => strtotime($lowInventoryDate),
            /* End Mod */
    );
    $rssObj->_addEntry($data);
}


texts:
Is it possible to add a addional option inside the cart, just as the screenshot?
The additional option is different for each category.

I already use the up and cross sell options, so I can not use them.

How can I fix this?


texts:
How to add extra product while creating order from admin only. Let's say I added "test1" product from admin, so "test2" product will be added automatically to that order.

I have created Observer for that.


texts: How to create an image upload product attribute in magento?

texts:
I know to create new product attribute in magento by catalag->manage attributes. By the same way i have created an image upload product attribute.It was suceessfully created and also i have added this attribute to default attribute set.

But that image upload attribute doesn't show on product creation page.(Text,Yes/No,etc...I got these kind attributes)

I have searched a lot regarding this issue. I can't find how to reslove this issue. Please save me guys


texts: Generated files deleted when first running bin/magento

texts:
Bit of a wierd one this and haven't got the bottom of it yet, nor have I seen it before.  So I'm setting up the prod server of a new store and when deploying to the server, the first time bin/magento is run, even without any arguments, just bin/magento on it's own, everything under generated/code and generated/metadata gets deleted.  Worth noting that with all further runs of bin/magento the files aren't deleted.  I'm using deployer.org to deploy which isn't relevant apart from that it makes releases for each deployment so I believe that as far as Magento is concerned when bin/magento is run after a simple git clone and then composer install it's the first time the command has been run.  The config in env.php sets the mode to production

Can anyone shed any light on what is going on exactly?  I have deployed plenty with a closely equivalent method for other stores and never come across this oddity.  I also can't seem to find any examples of tickets, threads etc of others having this same issue.


texts: I'm sure that I setted the meta keywords for my website. I added them to CMS home page and to Configuration>Design>Head>default keywords, but if I analyze my site with an online SEO tool, it appears without meta keywords. How can I solve?


texts:
I want a custom home page. Design with layout "Empty" or a new layout created by me.

The only magento 2.1 standard block I want on this home page is the languages picker.

    <block class="vendor/magento/module-store/view/frontend/templates/switch" name="languages" template="languages.phtml"/>

I tired by creating my own layout file.

The problem is that this includes the "logo", "search entire store" and "shopping card" blocks/items and I only want the top bar with the language picker.

Any help would be greatly appreciated.


texts: my "run self test" is not working while installing SMTP Pro Email extention..i face following error msg

texts:
SMTP Pro Self Test Results
Sending test email to your contact form address: test@test.com from: owner@example.com. Unable to send test email.
Exception message was: 5.7.8 Username and Password not accepted. Learn more at 5.7.8 https://support.google.com/mail/answer/14257 cn1sm79814635pad.11 - gsmtp
Please check the user guide for frequent error messages and their solutions.
Default templates exist.
Email communications are enabled.

Testing failed, please review the reported problems and if you need further help visit the support page or contact me via support@aschroder.com for support.

UPDATE AFTER USE CUSTOM SMTP[![i got this error][2]][2]
thank u in advance


texts: Magento and Wordpress integration on multiple languages

texts:
I am trying to sketch the structure of my project, which is to use different Wordpress installations, each one with a subdomain representing each one a different country / language. The Wordpress is great to handle the pages and blog. I know that Magento lets you use a single Magento backend / stock for different sites.

What i want to do is to translate each wordpress on its language and subdomain, and then use the CART and ADD TO CART / CHECKOUT of Magento, but all the translated stores will use only one Magento stock / backend. The user login should be also integrated across WP / Magento.

For the Wordpress side I have found this:

https://wordpress.org/plugins/magento-wordpress-integration/

And this

http://codecanyon.net/item/single-signon-for-magento-and-wordpress/861453/comments

That should do the trick with the login, but will the cart / check out be able to be integrated too ?

And, can someone confirm this is even possible ? I really want to use Magento as backend of the same store but on different sites / languages. Maybe you can add the products by SKU, making them independent of the product name / language ?

Thanks


texts: show custom text field only when it's populated

texts:
Having trouble with a custom field. It's a plain text field, called special_note.

<?php $specnote = $_product->getResource()->getAttribute('special_note');
  if ($specnote) {
    echo "
".$specnote->getFrontend()->getValue($_product)."
";
  }
?>

The specialnote div is always showing up, even when there's data. I've tried variations like if (!empty($specnote)) and if (!isnull($specnote)) to no avail.

How do I make is so that the div only shows up when it's been populated?

Additional info: this is in the file /app/design/frontend/mytheme/theme/template/catalog/product/view.phtml

Field is set up in magento as a 'text field' - and the settings "Visible on Product View Page on Front-end" and "Used in Product Listing" are both set to yes.


texts: How to display Shop by options before the product details/ items in mobile view only?

texts:
When viewing my website in mobile view, is there a way to show the "Shop by" category first before showing the individual items?

Also I want the shop by category options to be shown without having to click the "+" sign.

I want to have the customer choose the "year, make, model, door, etc" first before showing them the default product items.


texts: XML attribute "after" throwing error after upgrade to Magento 2.2

texts:
We just upgraded a development site from Magento 2.1.X to 2.2.

I have a custom CSS file called in the default_head_blocks.xml of my specific theme (which had no issues working at all with 2.1.X).
The file was called in like this...

<css src="css/tires-custom.css" after="-" />

After our upgrade to 2.2 it now gives the following error...

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

I changed nothing in the file but not get the error.  I don't understand why it would cause an error simply due to the upgrade.

If I remove the attribute after="-" the site loads juts fine.  The problem is I need to have my custom CSS loaded last.


texts: Changed admin url from index.php/admin to somthing else don't remember it

texts: changed my admin url from index.php/admin to something else don't remember it. Can anyone tell me how to get back into my dashboard.


texts: How to add address to customer after register using REST API

texts:
I have used This API as in the first image to create customer
now I want to add the address for this customer please tell me how to do so?
Thanks,


texts: Dynamic row in magento admin form with generic class

texts:
I am trying to add dynamic row using generic form class and it show like below.

But the problem is that this value is not posting data.
Here is how i have implemented this.
DynamicDiscount.php
    <?php

namespace Vendor\Module\Block\Adminhtml\Form\Field;

use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;

/**
 * Class AdditionalEmail
 */
class DynamicDiscount extends AbstractFieldArray
{
    /**
     * {@inheritdoc}
     */
    protected function _prepareToRender()
    {
        $this->addColumn('discount_label', ['label' => __('Discount Label'), 'class' => 'required-entry']);
        $this->addColumn('discount_per', ['label' => __('Percentage'), 'class' => 'required-entry']);
        $this->_addAfter = false;
        $this->_addButtonLabel = __('Add New Row');
    }

}

Form.php and _prepareLayout function
    $layoutBlock = $this->getLayout()->createBlock(
            \Vendor\Module\Block\Adminhtml\Form\Field\DynamicDiscount::class
        );

        $fieldsetRow = $form->addFieldset('discount_update', ['legend' => __('Layout Updates')]);
$fieldsetRow->addField('discount_data', 'note', []);
        $form->getElement('discount_update')->setRenderer($layoutBlock);

can anyone guide me please how to post this data and save in custom table and make it populated in form when edit it.


texts: Is it possible to display the gross profit of a product as an attribute in the admin page of a product?

texts: Simply looking to create an area/block in the admin area of a product page that displays what the current gross profit is on that product. I.e. calculating the difference between the cost price and selling price of the item. So for example we have a cost attribute, and either a price or special_price attribute for the selling price. Some products have a special (sale) price active, some don't, so this probably requires an if statement. Initially I explored creating an attribute to do this, but that didn't really work out, so looking to hard code something into the admin page. Ideally creating small module to do this. Any ideas on the best way to go about or detail some of the code involved to get me started?


texts: Customer attribute is not being saved after migration

texts:
I have migrate database from Magento 1.9.3.1 to Magento 2.2.3 via data-migration-tool and it went without any errors in proccess. Everythink I need was mograted to new database. But I have noticed that one of my custom customer attribute is not being saved. Neither in backend or programmatically via repository or facroty.

I've compare it's data in eav_attribute and in customer_eav_attribute tables with other attributes like firstname which are being saved fine and its similar. is_system value is set to false, so it can not be the case.

Is there somethink i'm missing or should I update this attribute? If so then how?


texts: Fatal error in composer during payment form install - Magento ver. 2.3.1 - PHP 7.2

texts:
please, someone can help me here?

composer require pagseguro/magento2

Using version ^1.12 for pagseguro/magento2
./composer.json has been updated

Fatal error: Uncaught TypeError: Return value of Magento\InventoryComposerInstaller\Plugin_composer_tmp1::initModuleDeployment() must be an instance of Magento\InventoryComposerInstaller\void, none returned in phar:///opt/cpanel/composer/bin/composer/src/Composer/Plugin/PluginManager.php(195) : eval()'d code:69

Stack trace:
#0 [internal function]: Magento\InventoryComposerInstaller\Plugin_composer_tmp1->initModuleDeployment(Object(Composer\Script\Event))
#1 phar:///opt/cpanel/composer/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
#2 phar:///opt/cpanel/composer/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///opt/cpanel/composer/bin/composer/src/Composer/Installer.php(204): Composer\EventDispatcher\EventDispatcher->dispatchScript('pre-update-cmd', true)
#4 phar:///opt/cpanel/composer/bin/composer/src/Composer/Command/RequireCommand.php(18 in phar:///opt/cpanel/composer/bin/composer/src/Composer/Plugin/PluginManager.php(195) : eval()'d code on line 69


texts: How could a customer be charged multiple times?

texts: One of our customers was charged 10 times via Authorize but in Magento there is only 1 order, 1 invoice, and 1 transaction. So she was charged 9 additional times. All but three of them have different invoice numbers. The other three share the same number and none of these numbers can be found under the admin panel. What scenario could even cause something like this to happen?


texts: Customer can't login - Page refreshes but nothing happens

texts:
When I try to login as a customer it does nothing!

If I use a valid email address and password it reloads the page but doesn't log me in or display an error.

If I use an invalid email address and password it shows me the usual ‘account doesn't exist’ error message.

Anyone have any ideas?

Thanks


texts: Uninstalling the Featured Products modules doesn't remove the field in Catalog

texts:
I've been trying several modules that provide "Featured Product" feature on for my store.

I've tried:

Inchoo
Daffodil

and a couple of others.  When I uninstall them the field "Featured Product" or similar one in the Catalog doesn't seem to go away.

Is there a way to get rid of this field?


texts: I have compilation error like Incompatible argument type: Required type: \Magento\Shipping\Model\Rate\ResultFactory. Actual type: array; File:

texts:
use Magento\OfflineShipping\Model\Carrier\Flatrate\ItemPriceCalculator;
use Magento\Quote\Model\Quote\Address\RateRequest;
use Magento\Shipping\Model\Carrier\AbstractCarrier;
use Magento\Shipping\Model\Carrier\CarrierInterface;
use Magento\Shipping\Model\Rate\Result;

class Flatrate extends \Magento\OfflineShipping\Model\Carrier\Flatrate
{
    protected $_code = 'flatrate';

    protected $_isFixed = true;

    protected $_rateResultFactory;

    protected $_rateMethodFactory;

    private $itemPriceCalculator;

    public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory,
        \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
        \Magento\OfflineShipping\Model\Carrier\Flatrate\ItemPriceCalculator $itemPriceCalculator,
        array $data = []
    ) {
        $this->_rateResultFactory = $rateResultFactory;
        $this->_rateMethodFactory = $rateMethodFactory;
        $this->itemPriceCalculator = $itemPriceCalculator;
        parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data);
    }


texts: Mirroring the Offical Magento Commerce Subversion

texts:
Call me paranoid but I like having a mirror of codebases we actively develop with at work. I see that Magento Commerce allows you to checkout (via svn) a particular branch via http://svn.magentocommerce.com/source/branches/{version no}

However I want to setup a mirror of the entire repository. I also noticed that http://svn.magentocommerce.com/svn/ requires a login and guest access has been denied. Is there a way to mirror the entire repository?

As a side note I'm only looking to mirror the community edition.


texts: Watermark images, but only orginal images (the large ones)

texts: I would like to protect my images with the watermark. I know there is the functionality in Magento for the watermark. My web site has functionality where visitors are able to click on base image and then load larger size of that image (lightbox), and that is the image that I want to protect. When I use Thumbnail Watermark in Magento, all images are watermarked, which is not what I would like to accomplished.


texts:
I am using FPC caching on my site. My problem is if customer visit some products page without login, and then want to write a review, he goes to login page and after log in when he come back to product page he wants to write review, he see the "You must be log in to write review" notice instead of review form. I need to clear cache by myself manually to show them logged in product page.
Thanks in advance


texts: Magento 2 how to get tax percentage for the shipping from order object

texts: How we can get the tax percentage or tax class from the order object like $order in Magento 2.


texts: How to add a section in checkout above shipping method

texts:
I want to add a section in mentioned location. but its showing in shipping method section and i need a seperate section
Checkout_index_index.xml

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

    <referenceBlock name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="steps" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="shipping-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="shippingAddress" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <item name="before-shipping-method-form" xsi:type="array">
                                                        <item name="children" xsi:type="array">
                                                            <item name="our-delivery-component"
                                                                  xsi:type="array">
                                                                <item name="component"
                                                                      xsi:type="string">
                                                                    Magento_checkout/js/view/option-delivery</item>
                                                                <item name="config" xsi:type="array">
                                                                    <item name="message" xsi:type="string" translate="true">Your new message above the shipping form. Welcome!</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>

option-deliver.js

define(
    [
        "uiComponent",
        'ko'
    ],
    function(
        Component,
        ko
    ) {
        'use strict';
        return Component.extend({
            defaults: {
                template: 'Magento_Checkout/option-delivery'
            },
            initialize: function () {
                this._super(); //you must call super on components or they will not render
            }
        });
    }
     );

delivery-option.html

testing


texts:
I am working on modifying email templates. {themeName}/template/email/order/items/order/default.phtml

The above template triggers when the user (guest or customer) has placed the order.

In the above template, there are some variables like:

$_item = $this->getItem();
$_order = $this->getItem()->getOrder();

if I use any debugging methods like Mage::log or zend_debug::dump, the checkout page is hanging up and the order is never being processed.

So, my question is what should I use to debug email templates here?

I also used echo which is always showing an empty string or array for an array holding variable.


texts: unable to get customer data from session in custom module?

texts:
I am developing custom module which needs to use customer data from session. Here I am having some problem with session. I am unable to get any customer data in my custom module from session even if the user logged in.

I logged below code in my index controller.

Mage::getSingleton('core/session', array('name' => 'frontend'));
        $customer_id = Mage::getSingleton('customer/session')->getCustomer()->getId();
        Mage::log("Index - customer id check: " . $customer_id);

A failure to get customer Id.

After that added customer_login event and tried to log the same in the observer method. Here it worked.

But, still not working in the index controller.

Please help


texts: Magento-2 exception printing is disabled by default

texts:
I was having an error on my webpage exception printing is disabled by default
so I looked for solution and I found an answer to change the local.xml.sample. into local.xml after doing this I have a new error called Item (Magento\Catalog\Model\Category\Interceptor) with the same ID "40" already exists.

Can somebody tell me what to do here because i can't found magento/catalog/model/category/intercepter anywhere?


texts: copy orders of a customer to other customer in magento

texts: Is it possible to fetch all the orders of a customer and copy into other customer in magento?


texts: How to get the configuration of field having multiple columns and values in magento 2

texts:
How to get the values separately for the fields of the following type:

I am using

$objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('ced_wallet/requestwallet/percentage');

in Block/Adminhtml/Blockname/Grid/Renderer/Approve.php

Please suggest any solution to get these type of configurations.


texts: Magento 2 : How Can Directly Upload Video to Product

texts:
I know that, we can upload video via Vimeo and Youtube video url in the product from admin.

However I cannot find a way to directly upload video file same as product image.

Does this means that I cannot host product video in my Magento server?


texts:
I have some problem with the installation of magento.
This is the config:

Dedicated Server,
CentOS Linux release 7.3.1611 (Core),
Apache,
Mysql,
Magento CE 2.1.6

I have a user named web and the web service user is named apache:
$ id web
uid=1000(web) gid=48(apache) groups=48(apache)
$ id apache
uid=48(apache) gid=48(apache) groups=48(apache)

I had a permission problem which I will talk about here, so I have givenchmod -R 777 for all files and directories inside my Magento dir.

Also, I have done chown -R web:apache for all files and dirs inside my Magento dir.

Now permissions are as follows:

drwxrwxrwx.  4 web apache   4096 Apr 22 00:03 app
drwxrwxrwx.  2 web apache     36 Apr 22 00:03 bin
-rwxrwxrwx.  1 web apache 435065 Mar 28 23:07 CHANGELOG.md
-rwxrwxrwx.  1 web apache   1843 Mar 28 23:05 composer.json
-rwxrwxrwx.  1 web apache 344410 Mar 28 23:07 composer.lock
-rwxrwxrwx.  1 web apache   3381 Mar 28 23:07 CONTRIBUTING.md
-rwxrwxrwx.  1 web apache    631 Mar 28 23:07 COPYING.txt
drwxrwxrwx.  5 web apache     59 Apr 22 00:03 dev
-rwxrwxrwx.  1 web apache   2864 Mar 28 23:07 Gruntfile.js.sample
-rwxrwxrwx.  1 web apache   1368 Mar 28 23:07 index.php
-rwxrwxrwx.  1 web apache    315 Mar 28 23:07 ISSUE_TEMPLATE.md
drwxrwxrwx.  4 web apache     47 Apr 22 00:03 lib
-rwxrwxrwx.  1 web apache  10376 Mar 28 23:07 LICENSE_AFL.txt
-rwxrwxrwx.  1 web apache  10364 Mar 28 23:07 LICENSE.txt
-rwxrwxrwx.  1 web apache   5071 Mar 28 23:07 nginx.conf.sample
-rwxrwxrwx.  1 web apache   1427 Mar 28 23:07 package.json.sample
-rwxrwxrwx.  1 web apache    814 Mar 28 23:07 php.ini.sample
drwxrwxrwx.  2 web apache     55 Apr 22 00:03 phpserver
drwxrwxrwx.  6 web apache   4096 Apr 22 00:03 pub
drwxrwxrwx.  7 web apache   4096 Apr 22 00:03 setup
drwxrwxrwx.  7 web apache   4096 Apr 22 00:03 update
drwxrwxrwx.  6 web apache     88 Apr 22 19:02 var
drwxrwxrwx. 29 web apache   4096 Apr 22 00:03 vendor

Still I get File Permission Check Error on installation:

File Permission Check
4 file permission not met. Hide detail

The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables.
For help, see our File Permission Help or call your hosting provider.

"/var/www/html/zibajooyan/app/etc" - Not writable, change the permissions. Show details
"/var/www/html/zibajooyan/var" - Not writable, change the permissions. Show details
"/var/www/html/zibajooyan/pub/media" - Not writable, change the permissions. Show details
"/var/www/html/zibajooyan/pub/static" - Not writable, change the permissions


texts: Magento 2: Convert HTML code into PDF file and Download?

texts:
In my custom module, I have HTML code and I want to convert HTML code into PDF and after conversion download PDF.

Please suggest me Magento-2 default functions or classes for Create PDF and Download.


texts:
In the UK, we refer to our postcodes as either "SW1A 0AA" or "SW1A0AA" (with/without spaces).

The issue with this, is that when you Filter your Orders by Shipping Address (backend Sales Order Grid) you get 2 different results depending on whether you enter "SW1A 0AA" or "SW1A0AA".

Is there a wildcard or other method I could implement that would allow either entry to return the same results?


texts:
I am using C # to search for orders from last month (last 30 days). Magento version 2 using REST, I am using the call as follows:

http://magentoserver/index.php/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=created_at&searchCriteria[filter_groups][0][filters][0][value]=2017-08-01&searchCriteria[filter_groups][0][filters][0][condition_type]=gt

The remote server returned an error: (401) Unauthorized.

If the call is:

http://magentoserver/index.php/rest/V1/orders?searchCriteria=

The server returns all orders.

It's not an authorization error, I really don't find the right way to build the search criteria. I don't find any documentation that explains how to do it


texts:
Top navigation menu not displaying in my Magento. I refreshed cache and made reindexing.

I followed many links and made all the possible options provided from the links. Still, it's not showing the menu.

I just have a main menu with a submenu, in the "All stores" already have associated the menu, but even so, the menu is not displayed.


texts:
When I want to create a new attribute set, magento can not complete the process and the browser error "This page isn’t working" and if I want edit a attribute set that I created before magento error unable to edit it.

How can I fix it?


texts:
Simple one but cant find it. How do i display quantity of a product for a group only (wholesale)?

Thanks!


texts: Apply discount if 2 of the different item from a category are added

texts:
I'm looking to build the following Shopping Cart Rule and I have no idea how to do it.
I have multiple sku available, if you add 2 different sku in your cart from the same category, you get 10% off. It can be any combination of sku,any quantity , and the discount is only applied once.


texts: How can I require reindexing in magento backend

texts: I made a custom module and I want the user to be prompted to reindex a certain index table. How can I show this prompt progmatically?


texts: Obtain final price(s) of item(s) after promotion rules applied?

texts:
How can I obtain the actual final cost of items?

Let's say a customer's out-of-pocket payment for an order is

$1000
and tax is $100
and shipping is $50

So subtracting, all his items AFTER discounts and promo rules (whether it's shopping cart rules or catalog rules) applied would be $850.
Out of the $850, he may have varying items with varying discounts applied and prices (e.g. $250 + $100 + $300 + $200).

The values $250, $100, $300, $200 are is what I want..

How do I obtain them?


texts: Magento 2: edit order items without cancel

texts:
There are many extensions in magneto 2 market place for editing the order info without canceling it.
I know I can edit the shipping and billing info but I don't know how to edit the items quantities and add/remove items. does anyone know how to do it, note that the stock qty needs to be updated accordingly.


texts: Set multiple multiselect values for product

texts:
I am working on a magento extension that automatically creates products from an import file. Everything is going great, except for one small issue i can't seem to figure out.

I have created a few multiselect attributes for all products, but my setData function does not process multiple values for those attributes. Assigning 1 value is no problem though.

my current code (simplified):

$magentoProductModel->setData('multiselect_attribute', array(1, 3, etc));
$magentoProductModel->save();

This doesn't do anything. When i assign only 1 id like this:

$magentoProductModel->setData('multiselect_attribute', 1);
$magentoProductModel->save();

It will assign the correct value.

But i really want to assign more than 1 value. It isn't a multiselect attribute for nothing.

Methods i have tried so far:

$magentoProductModel->setData('multiselect_attribute', array(1, 3, etc));
$magentoProductModel->save();

$magentoProductModel->setData('multiselect_attribute', [1, 3, etc]);
$magentoProductModel->save();

$multiselect_ids = array(1, 3, etc);
foreach($multiselect_ids as $multiselect_id) {
  $magentoProductModel->setMultiselectAttribute($multiselect_id);
}
$magentoProductModel->save();

None of the above methods work. Can't seem to figure out the right way to fix this. Does anyone know how to get this to work?


texts: Magento Enterprise Cache Displaying Same Product Multiple Times in Related Products

texts:
I am trying to figure out why a Magento Enterprise website is displaying the same item four times in the 'related item' section of the page.

CORRECT BEHAVIOR:
- After clearing caches, four different items are shown on the first page load (this is the correct behavior)

PROBLEM:
- Additional page loads show not just the same four items, but the exact same item repeated four times (see screenshot)
- The item which is repeated is always the last item that was displayed in the original page load. In other words if there are a,b,c,d related items shown on the first page load after a cache fush, it is 'd' that will be repeated four times on future page loads. d,d,d,d

BACKGROUND:
- Page uses a custom theme.
- This problem only takes place when full page caching is turned on.
- If the page is returned to the 'default' theme, the problem no longer takes place, even with full page caching turned on
- To recap: the problem only occurs with the custom theme and full page caching turned on
- Magento Enterprise ver. 1.13.0.0

The related products portion of the page is inserted with the following code:

<?php echo $this->getChildHtml('relatedProducts', false) ?>

I would be grateful for:
- A specific lead on what this issue may be
- Reliable ways to disable a specific cache related to this (in GUI? In code? In terminal?)
- Tests and steps I can take to narrow this down to code, db, or files.

Thank you in advance!


texts: Listener when message is set in Magento 2

texts:
I am deleting the mage-messages cookie, how sometimes it's not getting deleted for iPhone Safari browser. I have even added set timeout for 5 sec. The issue is the notification persists on other pages too.
The reason is the mage-messages cookies doesn't get cleared and if it does get cleared it somehow get set even after the 5-sec timeout.

 this.cookieMessages = _.unique($.cookieStorage.get('mage-messages'), 'text')[_.unique($.cookieStorage.get('mage-messages'), 'text').length-1];

 this.messages = customerData.get('messages').extend({
                disposableCustomerData: 'messages'
            });

 if (!_.isEmpty(this.messages().messages)) {
                customerData.set('messages', {});
            }

 setTimeout(function()
 {
   YX_UI_UTIL.eraseCookie("mage-messages");
 }, 5000);

It's not working, even after the 5-sec timeout, I think, mage-messages is still getting set.

So is there any listener when mage-messages cookie is set. so that I can clear the cookie when it set even after the 5-sec timeout.

Even when the mage-messages cookies are not cleared, I cleared it from the browser console while debugging and it worked. The notification messages don't persist on other pages.


texts: Magento 2 remove add to cart button for specific products?

texts:
I have tried to remove the Add to cart button with many solutions out there, but none has worked.
I'm using this solution: How to remove the Add to Cart button from Catalog pages in Magento 2?.

Also tried this one but the products were disabled, not the add to cart button: How to disable add to cart in magento 2

What I need to do, is something very simple, I just need to check in an if() condition if the ProductID of the product is different than 2 ids, so customer won't be able to add to cart products that are not the ones that can be bought.

Something like this is what I need to accomplish.

$productId = $product->getId();

if($productId != "2078" || $productId != "2079"){
    //disable the add to cart button of the rest of products
}
else{
//products ID are 2078 or 2079
return true;
}

Greetings!


texts: "customer_eav_attribute " Table what is "input_filter" and what values can you have in there

texts: I See in the customer_eav_attribute table there is a column "input_field", what is that? I see most values are "null2, but i do see "date" and "datetime", what other values can you have?


texts: How to delete a “not applied” catalog price rule?

texts:
I tried to apply a Catalog Price rule but I received a "502 Bad Gateway" error message. When I returned in the Catalog Price Rules page/interface I deleted that rule but, after that, I had the "There are rules that have been changed but were not applied. Please, click Apply Rules in order to see immediate effect in the catalog." system message. It seems that rule is hanging in the queue so I can't apply any rules because the first rule in queue is that wrong.

How can I delete (from the database, I suppose) that wrong rule to apply?

Thans in advance.


texts:
I would like to know in which class and function can I get my client ID, the same bank saved ID as entity_id

I would like to echo my script so that I can manipulate it for other functions later.

This ID is from the connected client.

Magento 2.3.3
windows xampp
composer installation


texts: How to add padding between two different elements magento 2

texts:
I am trying to separate two elements and create a bit of space between them.

I want there to be a certain amount of space between the Logo and the navbar. Is it possible to do it using default.xml? This is the content of my defualt.xml in Magento_Theme of my custom theme.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="top.links">
        <block class="Magento\Customer\Block\Account\Link" name="my-account-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">My Account</argument>
                <argument name="sortOrder" xsi:type="number">110</argument>
            </arguments>
        </block>
        <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
            </arguments>
        </block>
        <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link"
               template="Magento_Customer::account/link/authorization.phtml"/>
    </referenceBlock>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_img_width" xsi:type="number">148</argument>
            <argument name="logo_img_height" xsi:type="number">43</argument>
        </arguments>
    </referenceBlock>
    <move element="navigation.sections" destination="header-wrapper" after="logo" />
    <referenceContainer name="footer">
        <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="Magento_Store::switch/stores.phtml"/>
    </referenceContainer>
    <referenceBlock name="report.bugs" remove="true"/>
    <move element="copyright" destination="before.body.end"/>
</body>

If not, what's the way to do it?


texts:
i patched ver1.9.2.1 with the latest version by downloading from the prepatched files from https://magecomp.com/blog/how-to-install-supee-7405-with-or-without-ssh/#SUPEE7405withoutSSH

after patching I am unable to open the backend link it gives the error
Fatal error: Class 'Mage_Core_Helper_UnserializeArray' not found in /mydomain.com/app/Mage.php on line 547

I not so familiar with magento patching. could anyone help me with step by step solution


texts:
Magento 1.9.x
I am trying to configure a different VAT rate on website scope. I added a new product tax class PTC and a new tax rule TR. The new tax rule has my new product tax class PTC selected as tax class and the tax rate I selected has 20% VAT configured.
Now when I go to a product in the admin area and switch over to the website scope I want to change the tax rate for, I select my newly added product tax class PTC. The result: It calculates no tax, please also see https://i.imgur.com/JjPJMki.png.
Any idea what I might be missing?
Thanks!


texts:
I have a strange behaviour on this Magento website: http://us.karinherzog.com
It happens sometimes for some customers and finally also to me today.

The Magento admin is fully accessible but the frontend is not. I have a "Fatal error: Allowed memory size" error message.
The error message is always different each time I refresh the page. Here are some examples:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /var/www/karin-herzog-usa/magento/app/code/core/Mage/Catalog/Model/Resource/Collection/Abstract.php on line 119
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /var/www/karin-herzog-usa/magento/app/code/core/Mage/Sales/Model/Resource/Quote/Item/Option/Collection.php on line 71
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 512 bytes) in /var/www/karin-herzog-usa/magento/lib/Varien/Object.php on line 270
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /var/www/karin-herzog-usa/magento/lib/Zend/Db/Adapter/Abstract.php on line 1016
...

Here is what I have noticed:

On the browser I usually used the error is not display. The website works great. I have used this browser these last days to go on this website.
On the others browsers I have on my computer, it doesn't work, I have the error message. It's the first time I open the website on these browser since a few weeks.
If I clear the cache of one of this browser, the error message disappear and the website works again.

Does one you know what could be the problem? Why not everyone has this error and why if I clear the cache of the browser the error goes away?

Thank you in advance for your help.

Additional notes : As I have mentioned above, the website was working on my usual browser. Today after creating a new cart price rule in the admin, the same problem appear in this browser. To fix the problem I had to clear the cache and cookies on this browser. After that I have tried to edit this cart rule and the problem came back again... I hope this information will help someone discover what the problem is.


texts:
Magento2 MSI How can we set 1 source to ship from, but not to sale from?
We currently use backorders. Sales are made from stock sources and backorders (min_qty).
Suppose

Local stock 2
Incoming stock 0
Backorder Min Qty -1
Customer orders 3 utilizing stock and all backorders

This order cannot be shipped because it needs 3 but only has access to 2.
The backorder is then processed and backordered at the suppliers. Then stock is received and scanned and updates the INC Incoming source with +1. We then go to shipment
The only problem here is that when Incoming stock is scanned and updated to +1 that the salable qty is adjusted and that a customer can order this item in he frontend. So as a result : you would want to have a source that does not affect the salable qty, but is however available for shipping in the backend.
Question: how can we setup a source that can be used as a source for shipping but ont for sale?


texts: Styles are not loading after removing pub/static and run setup:static-content:deploy in Magento 2

texts:
I have been facing strange issue, as the part moving modifications in static content. we removed pub/static and deployed setup:static-content:deploy.
After doing this, files are generated properly in pub/static folder but when i load front end, styles are vanished.
As in the source the file paths are loading with version1483082446

  root/static/version1483082446/frontend/Smartwave/porto/en_US/mage/calendar.css

I have followed below commands, but my styles are not loading in frontend.

Remove pub/static
Remove var/cache
Remove var/composer_home
Remove var/generation
Remove var/page_cache
Remove var/view_preprocessed
run php bin/magento setup:static-content:deploy

Any help would be appreciated.


texts: Table rates shipping option showing in frontend while it is disabled

texts:
In my magento store when I disable table rates shipping option from admin still it is showing on checkout page as shipping option.

How to disable table rates shipping option?


texts: Differences between Magento 2 Community and Enterprise extensions in coding wise

texts: I need to install community extension to enterprise, before this I need to know What are the differences between Magento 2 Community and Enterprise in code wise


texts:
I wanted to make a copy of my site on my local server in order to use it as a development site. I made a backup of the database and restored it in the server, then I changed the values of web/unsecure/base_url and web/secure/base_url to point to my local server (http://xxx.xxx.xx.xxx/mySite/). I copied the whole directory into my server, then I proceeded to manually delete the content of sessions and cache and also I ran the re-indexing script. After that I changed the values of /app/etc/local.xml to point to my database. That's all the process, right? Well, nothing happened, I can't see my store. I got this error:

Warning: simplexml_load_string(): Entity: line 73: parser error : Opening and ending tag mismatch: reference line 72 and customer_logged_out  in /var/www/chromo/includes/src/__default.php on line 28352

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/var/www/chromo...', 28352, Array)
#1 /var/www/chromo/includes/src/__default.php(28352): simplexml_load_string('getFileLayoutUpdatesXml('frontend', 'chromo', 'default', '1')
#3 /var/www/chromo/includes/src/__default.php(28255): Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
#4 /var/www/chromo/includes/src/__default.php(28154): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
#5 /var/www/chromo/includes/src/__default.php(28132): Mage_Core_Model_Layout_Update->merge('default')
#6 /var/www/chromo/includes/src/__default.php(13760): Mage_Core_Model_Layout_Update->load()
#7 /var/www/chromo/includes/src/__default.php(11176): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 /var/www/chromo/includes/src/__default.php(11119): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#9 /var/www/chromo/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#10 /var/www/chromo/includes/src/__default.php(13872): Mage_Cms_IndexController->indexAction()
#11 /var/www/chromo/includes/src/__default.php(18234): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 /var/www/chromo/includes/src/__default.php(17768): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /var/www/chromo/includes/src/__default.php(20368): Mage_Core_Controller_Varien_Front->dispatch()
#14 /var/www/chromo/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#15 /var/www/chromo/index.php(87): Mage::run('', 'store')
#16 {main}

But I do have access to my backend. Any ideas of how to solve this?

Thanks.


texts: How can I update shipping price in the checkout page using controller Magento 2

texts:
I have delivery timeslot options on the checkout page. I have added the delivery charge according to the timeslot.
I want to update the shipping amount if a customer selects a timeslot. I have used a controller which is working onchange timeslot & getting timeslot & delivery charge inside the controller.
Now I want to update the shipping amount on that basis.
My controller code:
<?php

namespace Ktpl\Custom\Controller\Dateslot;

use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Request\Http;
use Magento\Quote\Model\Quote;
use Magento\Checkout\Model\Session as CheckoutSession;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;

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

    protected $_http;
    protected $_quote;
    protected $_checkoutSession;
    protected $_result;
    private $timeZoneResolver;

    public function __construct(
        Context $context,
        Http $http,
        Quote $quote,
        CheckoutSession $checkoutSession,
        TimezoneInterface $timeZoneResolver
    ){
        parent::__construct($context);
        $this->_http = $http;
        $this->_quote = $quote;
        $this->_checkoutSession = $checkoutSession;
        $this->timeZoneResolver = $timeZoneResolver;
    }

    public function execute()
    {
        $results = array();

        $timeslot = $this->getHttp()->getParam('timeslot');
        $deliveryCharge = $this->getHttp()->getParam('delivery_charge');
        $quote = $this->getQuote();

        try{
            $quote->setTimeslot($timeslot);
            $quote->save();
            $this->_result['status'] = 200;
            $this->_result['message'] = __('timeslot has been applied successfully.');
        }
        catch(Exception $e){
            $this->_result['status'] = 201;
            $this->_result['message'] = $e->getMessage();
        }
        echo json_encode($this->_result);exit;
    }

    public function getHttp(){

        return $this->_http;
    }

    public function getQuote(){

        return $this->_checkoutSession->getQuote();
    }

    /**
     * Get prepared date/time
     *
     * @param string $date
     * @param int|null $time
     * @return string
     */
    private function getPreparedDateTime($date, $time = null)
    {
        $timezone = $this->timeZoneResolver->getConfigTimezone();
        $date = new \DateTime($date, new \DateTimeZone($timezone));
        if ($time) {
            $date->add(new \DateInterval('PT' . $time . 'S'));
        }
        return $this->timeZoneResolver->convertConfigTimeToUtc($date);
    }
}

Can anyone suggest how can I update the shipping amount from this controller?


texts: Magento 2 : "Invalid option value" error while create product custom option(Field type image) programmatically

texts:
I just trying to creating product custom option using code ... when Field type image at that time I am getting an error
"Invalid option value"

Here is my code
$product = $this->product->create()->load($productId);
foreach ($options as $optionArray) {
        $product->setHasOptions(1);
        $product->setCanSaveCustomOptions(true);
        $option->clearInstance();
        $option->setProductId($productId)->setStoreid($product->getStoreId())-
         >addData($optionArray);
        $option->save();
        $product->addOption($option);
}

Here is my Array
    array(5) {
  ["sort_order"]=>
  int(1)
  ["title"]=>
  string(26) "Demo"
  ["type"]=>
  string(5) "image"
  ["is_require"]=>
  int(0)
  ["values"]=>
  array(4) {
    [0]=>
    array(6) {
      ["title"]=>
      string(16) "Demo 1"
      ["price"]=>
      float(0)
      ["price_type"]=>
      string(5) "fixed"
      ["sku"]=>
      string(0) ""
      ["sort_order"]=>
      int(1)
      ["image"]=>
      string(54) "/pub/images/Alvi_Shop/Sommertraum/608_3_Stars_SS_2.jpg"
    }
    [1]=>
    array(6) {
      ["title"]=>
      string(17) "Demo 2"
      ["price"]=>
      float(0)
      ["price_type"]=>
      string(5) "fixed"
      ["sku"]=>
      string(0) ""
      ["sort_order"]=>
      int(1)
      ["image"]=>
      string(58) "/pub/images/Alvi_Shop/Sommertraum/608_6_Sommertraumsgr.jpg"
    }
    [2]=>
    array(6) {
      ["title"]=>
      string(18) "Demo 3"
      ["price"]=>
      float(0)
      ["price_type"]=>
      string(5) "fixed"
      ["sku"]=>
      string(0) ""
      ["sort_order"]=>
      int(1)
      ["image"]=>
      string(58) "/pub/images/Alvi_Shop/Sommertraum/608_9_Sommertraumsgr.jpg"
    }
  }
}

what wrong in my code is working for all field type aspect IMAGE... any help appreciated
Thanks


texts:
Just installed Magento 2 on a shared server, everything seemed successful, no errors, but the shop looks like this (css files not found, they return 403 Forbidden, but the files are actually missing):

It seems like the static content/css is not generated.

pub/static:

The only file in pub/static/frontend/Magento/luma/locale is requirejs-config.js, but there were supposed to also be other files, such as those CSS files:

I tried reinstalling it, changing folder permissions, different PHP version, nothing worked. It's strange that some folders are generated (also the requirejs file), but not the CSS.

How can I make sure the CSS is generated (without shell access) ?

Why would Magento clearly say installation was successful if it couldn't generate the static files? Can I somehow manually copy those static files?

Specs:

PHP Version 7.1
Magento CE 2.3.0
Installed on a shared server, only have cPanel access, no shell


texts: Export or save file on download to dropbox or google drive using Magento2 programmatically

texts: I want add new functionality on download product by adding download file to google drive or dropbox in magento2 programmatically either using extension or api.


texts: "403 Forbidden" if I run Magento 2.2.x with FastCGI (Nginx + PHP-FPM)

texts:
Ubuntu 18.04, PHP 7.1, Nginx 1.16.1, Magento 2.2.6

I have some errors in log-file:

2019/12/05 16:58:45 [error] 865#865: *14 directory index of "/var/www/www-root/data/www/mysite.com/" is forbidden, client: ***.**.26.41, server: mysite.com, request: "GET / HTTP/1.1", host: "mysite.com"
2019/12/05 16:58:48 [error] 865#865: *14 directory index of "/var/www/www-root/data/www/mysite.com/" is forbidden, client: ***.**.26.41, server: mysite.com, request: "GET / HTTP/1.1", host: "mysite.com"

How can I fix it? Thx.


texts:
I have a custom tab on the product page which at the moment shows a static block.

What I need it to do is to show a different static block based on the text of an attribute.

For example, the tab will show a phtml file checking the text of a custom attribute then displaying the correct static block.


texts: Top menu block not working in my Magento 1.9.0.1

texts:
I am changing in app/code/core/mage/page/block/html/Topmenu.php in my magento but I cannot see result. but when i change in topmenu.phtml file then it displays changes.
what is the issue? I am sure the Topmenu.php is the block file but menu still display. I don't know how is it possible. I am also trying in Navigation.php in Mage/catalog/block/navigation.php. it's also now working. how is it possible?

Means when I change code in Topmenu.php file's _gethtml() function, for example I write echo "hello"; then doesn't show. But when I am changing in topmenu. phtml file and  write any code it displays in the navigation.

In header.phtml I call top menu using

<

?php echo $this->getChildHtml('topMenu') ?>

 topphml.phtml file code

 <?php echo "hello"; ?>
    <?php $_menu = $this->getHtml('level-top') ?>
    <?php if($_menu): ?>

            <?php echo $_menu ?>

    <?php endif ?>


texts:
When I enter my Magento website, Most of the time, some images do not load (Sometimes they do load).

However, when I refresh the page, all the images become visible.

Please suggest how can I debug this Problem?


texts: how to display images stored in pub/media folder

texts:
hello everyone I want to display an image from the folder "pub/media" and concatinate it with my path from the image field from database but I can't display it in detail page with the ways that I have tested
can anyone help me please

this is what I have done with 2 ways

method 1

<?php echo __('image') ?>: <img src="<?= $user->getImg() ?>" alt="image" />

method 2
$pathmedia = "pub/media";
<img src="<?php echo $block->getUrl($pathmedia."/".$user->getImg())?>"/>


texts: What is the 100% correct way of changing Data Object class property in Magento 2?

texts:
I wanted to ask this question a long time ago)
It is A very simple thing - modify any property for data object dynamically  (product,category or something else).

Frankly I always used the observer class for this purpose.

But corresponding to a magento technical guidlines:

  4.3. Plugins SHOULD NOT be added to data objects.
  14.3. Events SHOULD NOT change a state of observable objects.

Can anybody explain how should I add timestamp, say, to the product meta_title property on the front conforming to these rules?

P.S. Please, do not suggest to change meta title in the template)
Let's assume, I need this modified meta_title in many places.

[Edited]
P.S.2 Formally the class rewrite (or reference) is a solution in this situation, but we know it is a bad practice overall and also it is too excessive to use reference to modify one property.


texts: Cannot load external module through require js

texts:
I'm trying to load highcharts in a custom admin form, but it comes out as undefined in my module.
My requirejs-config.js
var config = {
    paths: {
        'highcharts': 'http://code.highcharts.com/highcharts',
    },
    shim: {
        'highcharts': {
            deps: ['jquery']
        }
    }
}

How I'm calling it in my pthml:

I've looked at all the other posts about requirejs and highcharts and couldn't find any solution to my issue. Can you help ?


texts:
I have some code which displays all the catagories in my Magento store. What I want to do is add some similar code which will only display selected catagories (It is a group of subcatagories within Magento).

{{block type="catalog/navigation" name="catalog.category" template="catalog/category/home-list.phtml"}}

The home-list.phtml file contains the following code (Only pasting the start of it as I think thats the only bit that is relevant:

> $rootId = Mage::app()->getStore()->getRootCategoryId(); $categories =
> Mage::getModel('catalog/category')->getCollection()
>     ->addAttributeToSelect('*')
>     ->addAttributeToFilter('parent_id', $rootId)
>     ->setOrder('position') // ->addAttributeToFilter('include_in_menu', 1) //this is needed if you want only the categories in the menu*/ -->
>     ->addAttributeToFilter('is_active', 1);


texts:
I want to edit my Magento option type for 181 products, changing checkbox and radio to dropdown

Can i just create a mySQL query to change field in catalog_product_option, replacing checkbox and radio with dropdown? Like this example

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);

Where

FIELD_NAME = TYPE //this is my collumn/field name
TABLE_NAME = catalog_product_option //this is the tablename
find this string = radio //this is the part i want to replace
replace found string with this string = dropdown //this is what I want there instead

So

update catalog_product_option set type = replace(type, ‘radio’, ‘dropdown’);

^ left the template in there for other to look at and adapt

Thanks


texts: Dull Uploader not working after patch 8788 replaced flash uploader - Version 1.9.2.4

texts:
There are several links with similar issues to this such as the following:

Issue in Admin Panel after SUPEE Patch 8788 installation

https://community.magento.com/t5/Theming-Layout-Design-Questions/Magento-1-9-1-0-admin-image-upload-button-and-browse-file-are/td-p/28816

Image Upload issue after PATCH 8788 install on 1.9.2.4

Security Patch SUPEE-8788 - Possible Problems?

And the list goes on. None of the solutions or suggestions in any of these posts have worked for me.

My issue is that, after the patch, it dropped the flash uploader and replaced it with a new one, and the new one doesn't seem to work. I am able to browse for a file, choose the file, and click upload. The uploader shows it's uploading and then says complete as if everything worked normally, however, nothing is actually happening.

When inspecting the form for uploading in the browser console after the page has loaded:

<form action="{{url}}" enctype="multipart/form-data" encoding="multipart/form-data" method="post" target="uploadBlockIframe-{{id}}">
   <input type="file" name="image">
   <input type="hidden" name="Filename">
   <input type="hidden" name="form_key" value="{{formKey}}">
   <input type="hidden" name="Upload" value="Submit Query">

</form>

You can see that the 'action' attribute for the form and the 'value' attribute for the form_key input have not been set in app/design/default/default/template/dull/uploader/uploader.phtml

I should also mention that we are using CJM Color Selector Plus extension in which I had to change a couple lines very similar to the CreareSEO plugin here :
https://github.com/adampmoss/CreareSEO/pull/78

And also, the dull js files are being loaded properly.

Can anyone help me?!


texts: How to Add Html Link Additional Options in Magento 2.3.3

texts:
I've applied following solution, its working up to magento 2.3.2 version but its not working in magento 2.3.3
$printableDesignImagesLinks .= 'helperData->getMediaUrl() . $this->helperData->getPrintableDesignsPath() . '/' . $printableDesignImages[$i] . '" target="_blank">' . $printableDesignImages[$i] . '';

$additionalOptions[] = [
    'label' => "Printable Design Images",
    'value' => $printableDesignImagesLinks
];

$item->addOption(array(
    'product_id' => $item->getProductId(),
    'code' => 'additional_options',
    'value' => $this->jsonSerializer->serialize($additionalOptions)
));

Output :

Is there any solution for this issue? Just let me know
Thank you in advance!


texts: when i open my website showing this error .Mage registry key "_singleton/log/visitor" already exists

texts: I am a beginner in magento development . please help me


texts: Saving Form Data to Custom Table Magento2

texts:
I have a form that links to a controller and my goal is to save the data into my custom vendor_module_table

public function execute()
{
    $post = (array) $this->getRequest()->getPost();

    if (!empty($post)) {
        $customerId = $post['customer_id'];
        $make = $post['make_id'];
        $model = $post['model_id'];
        $year = $post['year_id'];

        # to do - add insert
        $this->messageManager->addSuccessMessage('Success!');

        $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
        $resultRedirect->setUrl('/module/controller/add');

        return $resultRedirect;
    }

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

I've come across a few posts online on how to do. My problem with the provided solution is that they all use object manager - and this to me feels like a bad practice. Especially when M2 is based on Symfony where I can just call a pre-built save/add function to my controller relating to my form and it just works.. has Magento2 tailored something for this?

E.g. code from my Symfony project:

if ($form->isSubmitted() && $form->isValid()) {
    $em = $this->getDoctrine()->getManager();

    # set non-form fields
    $category->setApproved(0);
    $category->setCreatedTs(new \DateTime());

    try {
        # this is how Symfony saves data to a table
        $em->persist($category);
        $em->flush();

        $this->addFlash('success', 'Category Submitted for Review.');
    } catch (Exception $e) {
        $this->addFlash('danger', 'Something went skew-if. Please try again.'. $e->getMessage(). '- ' .$e->getCode());
    }

    return $this->redirectToRoute('category_list');
}

Edit: Found this in the docs, but it doesn't have a clear example on how to implement - anyone know how to?

https://devdocs.magento.com/guides/v2.1/extension-dev-guide/persistent-entities.html


texts: Magento2 get system configuration shipping method value in phtml file

texts:
Inside admin from

Storage->Configuration->Sales->Shipping Method -> Free Shipping -> "Minimum Amount Value"

I want to get this textbox value in phtml file.
so how i can get that?


texts: Store id 0 for attributes added programatically

texts:
I have one website and one store. When I add product from admin, with some programatically added attributes (for example in table catalog_product_entity_int), they get store_id 0 (adminhtml). Is that ok?
Has it some negative consequences if later I want to add some store views for some other languages?


texts: Magento2: magnifier not working for product image on product details page

texts:
I've added below code in view.xml file in my custom theme:

<var name="magnifier">
            <var name="fullscreenzoom">2</var>  <!-- Zoom for fullscreen (integer)-->
            <var name="top">0</var> <!-- Top position of magnifier -->
            <var name="left">0</var> <!-- Left position of magnifier -->
            <var name="width">300</var> <!-- Width of magnifier block -->
            <var name="height">300</var> <!-- Height of magnifier block -->
            <var name="eventType">hover</var> <!-- Action that atcivates zoom (hover/click) -->
            <var name="enabled">true</var> <!-- Turn on/off magnifier (true/false) -->
        </var>

But the magnifier doesn't work. It's showing overlay image after hovering over product image but it's not zooming the image.

Any help would be appreciated.


texts:
I tried to validate a custom form but without success.

My form:

CLUBLOGIN

        <form data-mage-init='{"validation": {}}' action="<?php echo $this->getUrl("clubshop/index/index")?>" method="post" id="clubshop-form-custom">

                Naam

                    <input name="club-name" value="" autocomplete="off" id="club-name" type="input" class="input-text" title="Naam" >

                    Emailadres

                    <input name="club-mail" value="" id="club-email" type="input" class="input-text" title="email" >

<button type="submit" class="action login primary" name="send" id="send2">Inloggen</button>

        </form>

What I tried so far in my phtml:

and
for this method i changed my button into input but still no scuccess.

What i am doing wrong?


texts: How to get rid of Add All To Cart from Wishlist

texts:
Want to get rid of the Add All To Cart button from Wishlist as it's not particularly useful (it automatically adds 1 of every item even if I put 5 or 0 in quantity for one of the items). Plus it's supposed to keep the items in the wish list upon Adding All To Cart, which it mostly does but in some instances it'll take 1-3 items off the wishlist and keep the others.

Tried commenting out the public function allcartAction() in app/code/core/mage/Wishlist/Controller/Abstract.php but that made the wishlist not open at all.

Anyone have experience doing this?


texts:
I am new with Magento and I would like to configure new shipment emails, but I am having a problem with it.
I created a new email template like the one below:
{{template config_path="design/email/header_template"}}

    hi!

    tracking numbers {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}}.

    end!

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

and another one where the block variable is replaced with the following variable which are both suggested by magento:
{{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}

and when I create a new shipment, I receive the email but the part where the block or layout is supposed to be, it is empty in the email.
Anyone knows what is wrong? Basically, I want to display all the tracking numbers (some shipments have 2 or more tracking numbers) of the specific shipment.
Anyone has any ideas?
Thank you


texts: how to add drag n drop functionality on module's grid list in magento admin

texts: I want to add Drag n Drop functionality to custom module grid list(admin panel). So i can manage sort order like if i want to show post on frontend by changing sort order via drag-n-drop grid list. Please anybody can tell me how can i?


texts: How to add KnockoutJS Plugin to Magento2?

texts:
Goal: Add pager.js. pager.js is a JavaScript library based on KnockoutJS and jQuery that provides the possibility of creating single page applications in a declarative fashion - nesting subpages inside subpages where each subpage can be developed standalone but still communicate between each other.

Setup Instructions says to do

// extend your view-model with pager.js specific data
pager.extendWithPage(viewModel);
// apply the view-model using KnockoutJS as normal
ko.applyBindings(viewModel);
// start pager.js
pager.start();

Magento Files

I saved pager.js inside my module and added mapping to My_Module/view/frontend/requirejs-config.js:

var config = {
    paths: {
        "pager": "My_Module/js/pager"
    }
};

My_Module/view/frontend/templates/index.phtml:

My_Module/view/frontend/web/template/myapp.html

    container

        start page
        Show the second page.

        second page
        Go back to the first sub page.

My_Module/view/frontend/web/js/myapp.js to require pager and initialize it.

define(['uiComponent', 'ko', 'pager'], function(Component, ko, pager) {
    return Component.extend({
        initialize: function () {
            this._super();

            // extend your view-model with pager.js specific data
            pager.extendWithPage(this);

            // apply the view-model using KnockoutJS as normal
            ko.applyBindings();

            // start pager.js
            pager.start();
        }
    });
});


texts: Magento remove "default" store code from urls

texts:
I have installed Magento ce 1.9.2.4 for my website.

Now I have setup the stores in such a way that my every url has store code of the current store, visitor is in, appended to it.

For business(bedrift) store the store code being appended to url like http://example.com/bedrift is fine but I want to remove default store code from urls so my urls become from http://example.com/default to http://example.com but the store session is maintained.

I have tried with .htaccess but it creates infinite redirects and then browser shows error.

Can anyone help me fix this the Magento way ?


texts: Magento2: Move an element inside an existing element with XML Layout

texts:
I am trying to move the layered navigation to somewhere specific on the page.

Here is the layout XML at Magento_LayeredNavigation/page_layout/1column.xml:

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <move element="catalog.leftnav" destination="content" after="-"/>
</layout>

And this works fine, it moves the layered navigation into the content area. However I want to move the layered navigation into here (category.products):

<referenceContainer name="content">
            <block class="Magento\Catalog\Block\Category\View" name="category.products" template="Magento_Catalog::category/products.phtml">

Changing the layout XML at Magento_LayeredNavigation/page_layout/1column.xml to this doesn't work:

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <move element="catalog.leftnav" destination="category.products" after="-"/>
</layout>

Can anyone tell me the correct way to move an element inside an existing element?


texts: How to Add a "picture" Link next to the logo in the Header?

texts:
I am in charge of a Magento website created by a former guy and I followed this tutorial to add a new Picture Link in my header :

https://kamaradski.com/831/how-to-add-a-picture-link-in-magento-header

But it doesn't work, furthermore the " Free Shipping ..." commented in the tutorial is not displayed in my website whereas i didn't comment it out.
Any ideas of what's wrong ?

The code :

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

<?php echo $this->getLogoAlt() ?><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" />

    <?php else:?>
    <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><?php echo $this->getLogoAlt() ?><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" />
    <?php endif?>
     <p class="top-promo" title="<?php echo $this->__('Free Shipping on orders over 50$'); ?>"><?php echo $this->__('Free Shipping on orders over 50$'); ?>

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

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

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

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

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

Here it's what it looks like now

The red is the picture link added, how could I center it ?

Thanks


texts: Magento: How to redirect to a phtml page from a controller?

texts:
I have a controller and from there I want to redirect to a custom phtml file.
My controller path is app/code/Softadroit/Prescription/Controller/index/Save.php
The phtml file is stored in app/code/Softadroit/Prescription/view/frontend/templates/Success.phtml
How can I redirect to this page from my controller?
This is my controller code but it is not redirecting to that phtml file:
<?php

namespace Softadroit\Prescription\Controller\Index;

use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\ObjectManager;

class Save extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;

     public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $pageFactory,
        \Magento\Checkout\Model\CartFactory $cartFactory
        )
    {
        $this->_pageFactory = $pageFactory;
        $this->cartFactory = $cartFactory;
        return parent::__construct($context);
    }

    public function execute()
    {
        $post = $this->getRequest()->getPost();

        /* echo "<pre>";
        print_r($post);
        die(); */

        if (!empty($post)) {
        foreach($post['name'] as $key => $name) {
            $age    = $post['age'][$key];
            $weight = $post['weight'][$key];
            $height = $post['height'][$key];
            $gender = $post['subject_gender'][$key];
            $product_id = $post['product_id'][$key];
            $customer_id = $post['customer_id'][$key];

            $model = $this->_objectManager->create('Softadroit\Prescription\Model\Prescription');

            $model->setData([
                    "name" => $name,
                    "age" => $age,
                    "weight" => $weight,
                    "height" => $height,
                    "gender" => $gender,
                    "product_id" => $product_id,
                    "customer_id" => $customer_id
                    ]);

             $msg ="";
             $data =  $model->save();
            if($data != ''){
                //$model->save();
                $this->messageManager->addSuccessMessage('Thanks your form is submitted successfully!');
            }else{
                $this->messageManager->addSuccessMessage('Error in submitting data. Please contact on this email!');
            }
}
            echo $msg;

            $cartObject = $this->cartFactory->create()->truncate();
            $cartObject->saveQuote();

            // Redirect to your form page (or anywhere you want...)
            $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
            $resultRedirect->setUrl('/prescription/index/success');
            //$resultRedirect->setPath('checkout/onepage/successs');
            return $resultRedirect;
        }

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


texts: Magento Connect: extension submission still "Submitted" in status

texts:
I have submitted extensions to Magento Connect.
Some approved but some extensions are still Submitted in status more than 10 days. Extensions created by UMC by @marius


texts: Magento 2 - Really Bad Performance in Docker

texts:
we are using Docker on macOS for development and deployment and have massive performance problems especially in deployment.

Our deployment does a full project build with:

git clone
composer install
bin/magento setup:static-content:deploy en_US de_DE --exclude-theme Magento/blank --exclude-theme Magento/luma --force (take 3000 secs!!!!)
bin/magento setup:di:compile (take ~1000secs!!!!)

Does anyone know why these processes took that much time?

Update 08.2018

Now we are using docker-sync which "works", but adds an extra layer of complexity to all our M" projects which I want to avoid.

It's such a shame for Magento that it does not optimize for development workflow. All other projects like Laravel, Symfony, TYPO3, Drupal etc works like a charm but M2 sucks in performance caused by the count of files which needs to be read in a request lifecycle.

You can read more about this problem in this post:
https://docs.docker.com/docker-for-mac/osxfs-caching/


texts: send email to customer only after successful payment through paytm in magento

texts:
I have a website in magento(1.9.3) with multiple vendor and paytm as an payment solution. The problem that i am facing is when i am placing the order a order confirmation mail is being sent to the vendor even before the payment is being made and if the order is success from paytm, this time the admin and the user receive a invoice mail but not the vendor.

So if i stop the mail at the time of order placement from admin, the vendor won't receive any mail of order and so he won't be notified.

So is there a way to send invoice mail to all the vendor, user and admin after the successful payment from paytm.

Thank you.


texts: Error when click on continue in the checkout screen

texts: this error happens when the user tries to advance from the checkout screen.


texts: How to get qty of a product using rest api

texts:
I want to get product info including the product qty how can i achieve it.

Currently i am using

rest/default/V1/products?searchCriteria

To get all the product but it is missing qty attribute in it.

Here is the result

   [0] => stdClass Object
      (
        [id] => 346
        [sku] => WATCH
        [name] => WATCH
        [attribute_set_id] => 4
        [price] => 3
        [status] => 1
        [visibility] => 4
        [type_id] => simple
        [created_at] => 2018-06-03 05:36:33
        [updated_at] => 2018-06-03 05:36:33
        [weight] => 1
        [product_links] => Array
            (
            )

        [tier_prices] => Array
            (
            )

        [custom_attributes] => Array
            (
                [0] => stdClass Object
                    (
                        [attribute_code] => meta_title
                        [value] => WATCH
                    )

                [1] => stdClass Object
                    (
                        [attribute_code] => meta_keyword
                        [value] => WATCH
                    )

                [2] => stdClass Object
                    (
                        [attribute_code] => meta_description
                        [value] => WATCH
                    )

                [3] => stdClass Object
                    (
                        [attribute_code] => image
                        [value] => /p/i/pinking_swatch_sq_dia_beige_1.png
                    )

                [4] => stdClass Object
                    (
                        [attribute_code] => small_image
                        [value] => /p/i/pinking_swatch_sq_dia_beige_1.png
                    )

                [5] => stdClass Object
                    (
                        [attribute_code] => thumbnail
                        [value] => /p/i/pinking_swatch_sq_dia_beige_1.png
                    )

                [6] => stdClass Object
                    (
                        [attribute_code] => category_ids
                        [value] => Array
                            (
                                [0] => 4
                                [1] => 61
                            )

                    )

                [7] => stdClass Object
                    (
                        [attribute_code] => options_container
                        [value] => container2
                    )

                [8] => stdClass Object
                    (
                        [attribute_code] => required_options
                        [value] => 0
                    )

                [9] => stdClass Object
                    (
                        [attribute_code] => has_options
                        [value] => 0
                    )

                [10] => stdClass Object
                    (
                        [attribute_code] => url_key
                        [value] => watch
                    )

                [11] => stdClass Object
                    (
                        [attribute_code] => gift_message_available
                        [value] => 2
                    )

                [12] => stdClass Object
                    (
                        [attribute_code] => swatch_image
                        [value] => /p/i/pinking_swatch_sq_dia_beige_1.png
                    )

                [13] => stdClass Object
                    (
                        [attribute_code] => tax_class_id
                        [value] => 2
                    )

            )

    )


texts: Can I use a .sql file in my Magento 2 module installer?

texts:
I have this large file as an example data.sql and what it does is create table and insert the data when I run import from phpMyAdmin.

How could one use this file in a module installer?

I've found something but it's for Magento 1, here is the link

Thank you in advance.


texts: Changing City in Shipping to Drop Down options

texts:
I just want to change the city input field into a drop down list. I tried the Region Manager extensions to no avail.

Any help is much appreciated! The reason why I need this is because I am running a matrixtable that requires certain cities and if those are mispelled or left blank, the shipping rate will just be free.

I added this into the

  template/checkout/onepage/shipping.phtml

but then the shipping method fails to recognize the city selected:

<select id="billing:city" name="billing[city]" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" class="input-text required-entry <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);">
    <option value=" " disabled selected><?php echo $this->__('Select one...') ?></option>
    <option value="Woodbridge">Woodbridge</option>
    <option value="Maple">Maple</option>
</select>


texts:
Is there any special reason why I should use the Magento framework classes such as JSON Serializer vs just native PHP?

https://github.com/magento/magento2/blob/2.3/lib/internal/Magento/Framework/Serialize/Serializer/Json.php

For example, I would tend to use native PHP as then I don't need to use any dependency injection for something which is already available to me


texts: Is Magento_Text_Block's "_toHtml()" is the only option?

texts:
The situation is that I have some piece of functionality, that I decided to design as text block. It needs to output some code at after_body_start on every page as initialisation code (some scripts), and also some specific parts of code into specific positions of pages.

So, initialisation code fits fine to the standard _toHtml() method and I can use my block as following:

<layout>
    <default>
        <reference name="after_body_start">
            <block type="<my_type>" name="<my_name>" as="my_alias"/>
        </reference>
    </default>
</layout>

But what about other specific methods? Is there any way to write something like this:

<block type="<my_type>" name="<my_name>" as="<my_alias>" output="<my_method>"/>

And tell magento by this not to call _toHtml() but call only my_method of the block?

I tried this as workaround:

<block type="<my_type>" name="<my_name>" as="<my_alias>">
    <action method="<my_method>"/>
</block>

With this approach I can do what I want: within my_method set internal property named, for example, methodToCall to customMethod and then check in _toHtml() if the methodToCall is defined; if it is defined, then call it; or do initialisation stuff otherwise.

But it seems pretty bulky and unelegant. Should I use other block type (not Mage_Core_Block_Text) or it is even better to use a completely different approach? I'm pretty new to magento, that's why I do not know which is the best concept for this.


texts: Magento Banner replacement with slideshow left to right

texts:
I am new to magento. I wanted to learn some stuff, however i am doing websites with php hand code from few years.

I have a website with third party template already working. What i wanted to do replace main Banner slide show (1 to 3 images rotating one by one) with featured slideshow showing/scrolling products from left to right(4 at a time) and each product should be clickable and would be linkable to database with featured listings etc.

Any ideas, basic tutorials, plugins?


texts: Set Block Class Property from Custom Module Controller

texts:
I am trying to access block class method from controller and set some value to block class property. The method is being accessed but when I try to print the property in .phtml file it is NULL.
Here is my code:

app/code/local/Amactech/Events/controllers/IndexController.php

<?php

    class Amactech_Events_IndexController extends Mage_Core_Controller_Front_Action{
        public function indexAction(){

            $block=$this->getLayout()->createBlock('events/events');
            $block->setFeedback("wrwqerqwer fasdfasdf vxzcvzxcv");

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

    }

?>

app/code/local/Amactech/Events/Block/Event.php

<?php

  class Amactech_Events_Block_Events extends Mage_Core_Block_Template{

    public $_feedback;

    public function setFeedback($feedback){
      echo $feedback;
      $this->_feedback = $feedback;
    }

    public function getFeedback(){
      echo "get feedback"; /*This line is being printing which means I am getting in this method*/
      return $this->_feedback;
    }

  }

?>

app/design/frontend/base/default/template/events/events.phtml

<?php
    echo $this->getFeedback();
?>

So I am accessing block setFeedback() method and setting $_feedback value. I print something string inside setFeedback() and getFeedback() methods to check whether I am getting into these methods. The printing string is shown which means I am getting into the methods but when I assign some value to property and try to print the property is shows NULL.


texts:
I have a bundle of items with fixed quantities and a fixed price.

If I the items are "A, B, C, D, and E"...

I want to show instead "A, B, Group 1, and E".  Basically, hide products C and D.

The reason I have to hide some of the items is to fulfill a very specific business case where users aren't allowed to know what items are in Group 1.

The only approach I can think of so far is to use php to adjust the template code, but after a bit of thinking I realized I might have to make template changes for the product page, cart display, checkout, invoices, etc., and it sounds kind of messy.

If there's a simpler way to think about this or implement, I'd much appreciate any thoughts and suggestions, thanks!


texts: Magento 2 : How to check SQL INJECTION VULNERABILITY for all my Magento 2 modules?

texts:
In my current project we have installed lot third party extensions and created lot of custom extensions.

How to check SQL INJECTION VULNERABILITY in my all module.


texts: Magento 2: A field shows me duplicate values

texts:
I have this multiselect field, the data I get from a function and magento internally duplicates me the data at the time of showing them.

  customer_form.xml

     <field name="mod_seasons">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Mod\Seasons\Model\Entity\Attribute\Source\Group</item>
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">varchar</item>
                <item name="formElement" xsi:type="string">multiselect</item>
                <item name="source" xsi:type="string">customer</item>
                <item name="sortOrder" xsi:type="number">800</item>
                <item name="label" xsi:type="string" translate="true">Seasons</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                </item>
            </item>
        </argument>
    </field>

  Mod\Seasons\Model\Entity\Attribute\Source\Group

class Group extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
{
    protected $groupCollectionFactory;

    public function __construct(
        \Magento\Store\Model\ResourceModel\Group\CollectionFactory $groupCollectionFactory
    )
    {
        $this->groupCollectionFactory = $groupCollectionFactory->create();
    }

    public function getAllOptions()
    {
        return $this->groupCollectionFactory->toOptionArray();
    }
}

  InstallData:

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerSetup->removeAttribute(\Magento\Customer\Model\Customer::ENTITY, 'mod_seasons');

        $customerSetup->addAttribute(
            \Magento\Customer\Model\Customer::ENTITY,
            'mod_seasons',
            [
                'type' => 'text',
                'label' => __('Seasons'),
                'input' => 'multiselect',
                'source' => 'Gsp\Seasons\Model\Entity\Attribute\Source\Group',
                'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
                'required' => 0,
                'visible' => 1,
                'user_defined' => 0,
                'system' => 0,
                'position' => 800
            ]
        );

        $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'gsp_seasons')
            ->setData('used_in_forms', ['adminhtml_customer'])
            ->save();

    }

  UpgradeSchema:

public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        if (version_compare($context->getVersion(), '1.1.0', '<')) {

            $setup->getConnection()->addColumn(
                $setup->getTable('store_group'),
                'season_add_days_delivery_date',
                [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                    'nullable' => true,
                    'comment' => 'Seasons add days to delivery date',
                ]
            );

            $setup->getConnection()->addColumn(
                $setup->getTable('store_group'),
                'season_add_days_delivery_deadline',
                [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                    'nullable' => true,
                    'comment' => 'Seasons add days to delivery deadline',
                ]
            );
        }
        $setup->endSetup();
    }


texts: Vue Storefront Returns Something went wrong

texts:
Hi am trying to setup vuestorefront locally over windows 10 and it compiled successfully but on frontend it showing something went wrong
Something went wrong ...
We've noticed Internal Server Error while rendering this request.
If you need an assistance you can drop us a line on a contact page
also am getting this error in console
{"code":500,"result":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/vue_storefront_catalog/attribute/_search] contains unrecognized parameter: [_source_include] -> did you mean any of [_source_includes, _source_excludes]?"}],"type":"illegal_argument_exception","reason":"request [/vue_storefront_catalog/attribute/_search] contains unrecognized parameter: [_source_include] -> did you mean any of [_source_includes, _source_excludes]?"}}

searchAdapter.ts:78 GET http://localhost:8080/api/catalog/vue_storefront_catalog/attribute/_search?_source_include=activity%2Cattribute_code%2Cattribute_id%2Cdefault_frontend_label%2Cdefault_value%2Centity_type_id%2Cfrontend_input%2Cfrontend_label%2Cid%2Cis_user_defined%2Cis_visible_on_front%2Cis_visible%2Cis_comparable%2Coptions%2Ctier_prices&from=0&request=%7B%22query%22%3A%7B%22bool%22%3A%7B%22filter%22%3A%7B%22terms%22%3A%7B%22attribute_code%22%3A%5B%22color%22%2C%22erin_recommends%22%2C%22price%22%2C%22size%22%2C%22activity%22%2C%22final_price%22%2C%22id%22%2C%22image%22%2C%22name%22%2C%22new%22%2C%22original_price%22%2C%22original_price_incl_tax%22%2C%22price_incl_tax%22%2C%22product_links%22%2C%22sale%22%2C%22sku%22%2C%22special_price%22%2C%22special_price_incl_tax%22%2C%22special_from_date%22%2C%22special_to_date%22%2C%22status%22%2C%22tax_class_id%22%2C%22tier_prices%22%2C%22type_id%22%2C%22url_path%22%2C%22url_key%22%5D%7D%7D%7D%7D%7D&size=150&sort= 500 (Internal Server Error)


texts:
How Can I show elemnets by ID

 $collection = Mage::getModel('storelocator/stores')->getCollection();

    foreach($collection as $store){
        echo $store->getStreet();
        echo $store->getPostal_code();
        echo $store->getTitle();

    }

I tried  $collection = Mage::getModel('storelocator/stores')->load($currentId); but is not work


texts: How to use one database for each store or website?

texts:
Let's suppose that I will create an e-commerce for a restaurant chain that has several restaurants and in each restaurant the menu is a little different. The user will enter the website and input its zip code. Based on the zip code he will be redirected to the nearest restaurant menu.

How can I create multiple stores or websites in which each will have its own database?

The higher purpose of this is: speed (one database for the several restaurants would be slow) and sync (I need to figure some way to sync the products on the restaurant with Magento's database. To make sure that users can't buy something that is out of stock.)

The solution that I've thought is to have the homepage in one server and several other servers with one Magento installation for each restaurant. But this would be insane.

A similar question has been asked. But the answers were confusing and nonconclusive.


texts: How do i overwrite email/order/shipment/track.phtml

texts:
There is a core file named

  email/order/shipment/track.phtml

in the theme base default.

Now i have added a PHTML file to my own theme called ABC/Default and in the folder

  email/order/shipment/track.phtml

In the transactional email i have this code:

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

But it still picks the core phtml instead of the custom one.

How do i see my custom one in the transactional emails?


texts:
Hi I am working on a module that is supposed to import orders from an api.
The thing is the orders have to be imported as guest users and the final price has to be set.
So far my script is working ok, the only problem I am having is related with taxes.
Something is going on that is not adding taxes correctly.
I am using the following when adding a product to quote item:

$buyInfo = array(
    'qty' => $prod['qty'],
);

$quote
    ->addProduct($product, new Varien_Object($buyInfo))
    ->setOriginalCustomPrice($price)
    ->setCustomPrice($price);

I also have some questions that think may be related with, but am not sure.
When I add shipping and billing address I set the country but region is always incorrect from api so am not able to add it correctly (can this affect taxes?).

Is there any way to force the added product to calculate is taxes, what approachs can I try?


texts: How to add custom option type in Customizable Options

texts:
How can i add custom option type in customizable options? Is there any free extension which added this option?
I followed this link but i can not make it works....


texts: I am having an error while trying to upgrade magento and instal a new theme

texts:
Error in file:

"/var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Customer/sql/customer_setup/upgrade-1.6.2.0.4-1.6.2.0.5.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'customer_flowpassword' already exists, query was: CREATE TABLE `customer_flowpassword` (
  `flowpassword_id` int UNSIGNED NOT NULL auto_increment COMMENT 'Flow password Id' ,
  `ip` varchar(50) NOT NULL COMMENT 'User IP' ,
  `email` varchar(255) NOT NULL COMMENT 'Requested email for change' ,
  `requested_date` varchar(255) NOT NULL default '0000-00-00 00:00:00' COMMENT 'Requested date for change' ,
  PRIMARY KEY (`flowpassword_id`),
  INDEX `IDX_CUSTOMER_FLOWPASSWORD_EMAIL` (`email`),
  INDEX `IDX_CUSTOMER_FLOWPASSWORD_IP` (`ip`),
  INDEX `IDX_CUSTOMER_FLOWPASSWORD_REQUESTED_DATE` (`requested_date`)
) COMMENT='Customer flow password' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci

Trace:
#0 /var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.6.2.0.4', '1.6.2.0.5')
#2 /var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.6.2.0.4', '1.6.2.0.5')
#3 /var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Core/Model/App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /var/www/vhosts/mazali.co.uk/httpdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#6 /var/www/vhosts/mazali.co.uk/httpdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /var/www/vhosts/mazali.co.uk/httpdocs/index.php(83): Mage::run('', 'store')
#8 {main}

I am  beginner can you explain slowly.