texts: Extending REST API, route to custom method

texts:
I have a custom module that implements a few new REST endpoints, which is working correctly.

In my api2.xml I have the routes defined as this:

<routes>
   <route_catalog_rule>
      <route>/unir/catalogrule/:id_rule</route>
      <action_type>entity</action_type>
   </route_catalog_rule>

   <route_catalog_rules_by_any_field_id>
      <route>/unir/catalogrules/:id_name/:id_value</route>
      <action_type>collection</action_type>
   </route_catalog_rules_by_any_field_id>

   <route_catalog_rule_add>
      <route>/unir/catalogrules/add</route>
      <action_type>collection</action_type>
   </route_catalog_rule_add>
</routes>

And I have the appropriate _retrieve(), _retrieveCollection(), and _create() in the corresponding V1.php. All works as intended so far.

But... I need to add a new endpoint for this resource, hopefully handled by the same controller. It would also be a PUT/update (normally handled by _update()), but that I'd like to handle with a different method within my controller.

Basically, it comes down to either being able to specify a custom handler directly, something looking like:

<route_catalog_rule_disable>
  <route>/unir/catalogrules/disable/:id</route>
  <action_type>entity</action_type>
  <action_name>my_custom_handler</action_name>
</route_catalog_rule_disable>

Or at least to be able to pass an additional param through the route definition directly, something like:

<route_catalog_rule_disable>
  <route>/unir/catalogrules/disable/:id</route>
  <action_type>entity</action_type>
  <my_custom_param>disable</my_custom_param>

I guess that I could check do something like always going through _update checking pathinfo and decide according to that... but it doesn't seem too clean.


texts: Magento2, How to save cart in product page

texts:
Here I add a form above add to cart button as add to quote on product detail page.

Now I have to save the form in my custom database as Add to Cart process.

Can anyone please explain how to Add to Cart saving process was work?

I need to replace that Add to Cart process for my custom Add to Quote button.


texts:
I have magento 2.2.4 with a smtp server configured. I can send email test from the tool and i receive it correctly. But when i buy a product I do not receive any email.

What can be the error?

I have all activated on Configuration -> Sales -> Sales Email. it's all activated..


texts: We change the root category to sub category url key is already exists error

texts:
We change the root category to sub category in Magento 2

Error is : url key is already exists.


texts: How can I load image through api by using external image url?

texts:
I have my product images in my cloud store and those are public. I want to map those images to product through API. I have gone through the solution given in the below link. But I want to check if there is a way to specify a downloadable link in the payload and the Magento server would download the image in the system, So that I don't have to send image data through the payload.
Magento 2 - How to upload image to REST API (POST)
I understand that when we specify the image url in the product csv and import the file, magento does download it and display it on the product page. I want to use similar functionality through the API.
NOTE: I am working on java and I want to use magento 2 apis to do this. Basically I am looking for correct API call (if any) which will automatically load the image into Magento store by downloading it from the cloud store.
Thanks in advance.


texts: How to limit characters in system.xml for textarea in magento

texts:
I want to restrict textarea characters length to 150 characters, My system.xml code is below :

...
<orderPlaceMessage translate="label">
    <label>Message for order place: </label>
    <frontend_type>textarea</frontend_type>
    <sort_order>1</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>

    {how to limit character length }

</orderPlaceMessage>
...

How to to that?


texts: Magento disabling a module not working properly

texts:
I am using Magento 1.9.2.1 version in a WAMP Server.

I disabled a custom module through the Admin section (Configuration > Advanced > Disable modules output). Even after I did re-indexing and cleared cache, I am able to access a page that is created with the module.
After setting <active> from true to false in the etc/modules/Mymodule.xml file, I got the 404 page error.

For disabling a module in magento, should I follow both the above steps?

Or will it be done automatically when I follow the first step?


texts: Getting Warning: include(Mage/Pay/Model/Pay.php): in custom payment method

texts:
I've followed the following tutorial (part one and two) http://code.tutsplus.com/tutorials/create-a-custom-payment-method-module-in-magento-part-one--cms-23464

The payment is appearing correctly in the cms, but when I try using it on the website it doesn't appear. The system.log gives me the following error:

  2015-09-28T14:06:36+00:00 ERR (3): Warning: include(Mage/Pay/Model/Pay.php): failed to open stream: No such file or directory  in /var/www/html/magento/lib/Varien/Autoload.php on line 94
  2015-09-28T14:06:36+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Pay/Model/Pay.php' for inclusion (include_path='/var/www/html/magento/app/code/local:/var/www/html/magento/app/code/community:/var/www/html/magento/app/code/core:/var/www/html/magento/lib:.:/usr/share/pear:/usr/share/php')  in /var/www/html/magento/lib/Varien/Autoload.php on line 94

Even though there is no mention of the  Pay model anywhere in the config files, only my custom model which is paymentmethod..

What am I missing or doing wrong?

Edit: config.xml:

<?xml version="1.0"?>
<config>
  <modules>
    <Foomobi_Foopayment>
      <version>1.0.0.0</version>
    </Foomobi_Foopayment>
  </modules>

  <global>
    <helpers>
      <foopayment>
        <class>Foomobi_Foopayment_Helper</class>
      </foopayment>
    </helpers>

    <blocks>
      <foopayment>
        <class>Foomobi_Foopayment_Block</class>
      </foopayment>
    </blocks>

    <models>
      <foopayment>
        <class>Foomobi_Foopayment_Model</class>
      </foopayment>
    </models>

  </global>

  <default>
    <payment>
      <foopayment>
        <active>1</active>
        <model>foopayment/foopayment</model>
        <order_status>pending</order_status>
        <title>CustomPaymentMethod</title>
        <allowspecific>0</allowspecific>
        <payment_action>sale</payment_action>
      </foopayment>
    </payment>
  </default>

  <frontend>
    <routers>
      <foopayment>
        <use>standard</use>
        <args>
          <module>Foomobi_Foopayment</module>
          <frontName>foopayment</frontName>
        </args>
      </foopayment>
    </routers>
  </frontend>
</config>


texts: where can I find the main sidebar file location?

texts: I am trying to get the location of this sidebar list I have shared with the image. where can I get that??


texts: Magento 2 - Registering a new Grunt task without editing Gruntfile.js

texts:
Following on from this question: Magento 2 add new theme without changing core files. Grunt

The goal is to register a new Grunt task called "development". To do this, grunt.registerTask is needed, however I can't get access to "grunt" in my Gruntfile.theme.js to then use grunt.registerTask

My files are setup exactly as they are in https://magento.stackexchange.com/a/121350/28664 answer.

If any more information is needed, please let me know.


texts: Is there any language pack Magento officially provides?

texts:
I am using M2(EE) and wondering if there's any language pack Magento officially provides.

Thank you in advance.


texts: Magento 2.3.4 to 2.3.5-p2 upgrade composer google shopping error. Any ideas?

texts:
I am trying to upgrade Magento 2.3.4 to 2.3.5-p2 but i am facing a composer error regarding Google shopping.
First i upgraded from 2.3.4 to 2.3.5-p1 without any problems, but when trying to upgrade from 2.3.5-p1 to 2.3.5-p2 i am getting this error:
*Your requirements could not be resolved to an installable set of packages.
Problem 1

Installation request for magento/product-community-edition 2.3.5-p2 -> satisfiable by magento/product-community-edition[2.3.5-p2].
magento/product-community-edition 2.3.5-p2 requires magento/google-shopping-ads 4.0.1 -> satisfiable by magento/google-shopping-ads[4.0.1] but these conflict with your requirements or minimum-stability.*

I have tried to set composer setting to:
composer config minimum-stability dev
composer config prefer-stable true
But that does not solve the issue. Any ideas?


texts: migrating entire set of attributes and attribute sets to a fresh installation

texts:
I have a rather large set of attributes and a dozen attribute sets that I need to migrate to a  fresh installation of Magento of the same version down the road. I'd like to do this without carrying over the attribute values theselves.

Has anyone done this safely? I have exported-imported the eav_* and catalog_eav_attribute in the past to move all attribute-related data while testing some things, and it seemed to have work without problems that I could notice. But what if I want to just perfectly copy over attributes, attribute sets, and no attribute values that are new to the fresh installation (i.e. no products)?


texts: Magento 2: Proper way to utilize "ajax:addToCart" event

texts:
I found the following codes in /vendor/magento/module-catalog/view/frontend/web/js/catalog-add-to-cart.js at around line 100, when I was trying to find ways to add some custom JS handling after successfully adding a product to the cart, on a Magento Open Source 2.2.5:

$(document).trigger('ajax:addToCart', {
    'sku': form.data().productSku,
    'form': form,
    'response': res
});

I believe this is the event I could utilize to achieve what I wanted. I have tried to write a handler like this inside the /product/view/form.phtml template:

<script>
require([
    'jquery'
], function ($) {
    $('document').on('ajax:addToCart', function (event, data) {
        console.log(data.form.data());
    });
});
</script>

But nothing showed up in the console. So I am guessing there is something wrong with the binding of handler and triggering of the event. Could someone please help to give an example on how I could make use of the event?


texts: Magento Sever Configuration for large DB

texts:
I was developed the Social network related project in Magento,and then in my application having 3 lakhs(customer) record,when i was upload the files to our dummy demo server,with minimum record it was worked fine, but after import the 3lakhs record it is not loading, it throw max execution time exceeded.

After i increase the max-execution time,it throw memory exhausted error.

I was search in google to find the solution,most of the solution they mentioned only in my server configuration related.

So can you please suggest how much configuration server is needed to handle this kind of large DataBase.

I am looking quick response from your end.


texts: Using the same Coupon code for multiple Price Rules

texts:
Does anyone know if it's possible to use the same Coupon Code for multiple price rules. I want to give 10% off Category A and 7% off Category B, if they have any of the qualifying products in their cart.

Currently Magento throws the "Coupon with the same code already exists." but i read that you can disable this by removing the index and updating a core file, but i'm not sure what changes need to be made to the core file.

I'm referring to this comment:
https://magento.stackexchange.com/a/29360/15768

Grateful for any advice here. Thanks.


texts: Magento Invalid value for 'visibility' for a configurable products .csv

texts:
I created a spreadsheet to upload configurable products.

For the different sizes, Visibility is set to "Not Visible Individually".

The visibility setting for the parent product is "catalog,search".

Magento import keeps giving me this error:
"Invalid value for 'visibility' in rows: 1, 2, 3, 4, 5, 6, 7, 8".

What's wrong, please?


texts: How can I get the HEX code in Visual Swatch via Rest API

texts:
Could anyone help me to find the rest api to get hex or image of visual swatch attribute?

I need the api to return the following,
Label
Value
HEX or Image of the swatch.

Thanks


texts: Cannot setup Magento 2.3 in local due to autoload error?

texts:
I have done manual backup of my site and setup it on local bit getting the below error:

Autoload error:

Vendor autoload is not found. Please run 'composer install' under application root directory.

Can anyone please help me to rectify this error?


texts: Disable to purchase product during price 0 or out of stock

texts: How can I disable to purchase the product during price 0 or out of stock?


texts: Parent Role id G1 does not exist after importing dump to mysql 5.7

texts:
I created a DB dump and imported it to a new AWS RDS instance running MySQL 5.7 everything worked fine except for the admin panel. I could not login and got an error report page from magento. Then I imported the same DB dump to a AWS RDS MySQL 5.6 instance and everything worked fine.

Here is the error log:

a:5:{i:0;s:34:"Parent Role id 'G1' does not exist";i:1;s:2091:"
#0 /path/to/magento-folder/lib/Zend/Acl.php(160): Zend_Acl_Role_Registry->add(Object(Mage_Admin_Model_Acl_Role_User), 'G1')
#1 /path/to/magento-folder/app/code/core/Mage/Admin/Model/Resource/Acl.php(108): Zend_Acl->addRole(Object(Mage_Admin_Model_Acl_Role_User), 'G1')

I already tried the solutions posted here but to no avail.

Any ideas what the problem might be?


texts: in custommenu show recently viewed title and popout block only when there is any

texts:
We use a custommenu.phtml to show recently view items via a popup block.

        Recently Viewed

                <?php echo $this->getLayout()->createBlock('reports/product_widget_viewed')->setTemplate('reports/widget/viewed/content/viewed_grid.phtml')->toHtml(); ?>

Everything works great except we do not need the whole
to show when these is no recently viewed product.

I tried wrapping the whole div with the following:

<?php if ($_products = $this->getRecentlyViewedProducts()): ?>

<?php endif>

but the whole div disappears whether we have viewed products or not.

How do I achieve this?


texts: Why is Magento 2 checkout taking so long to load in local development enviroment?

texts:
I am trying to customize the Magento 2 checkout's styling and the page take minutes to load on refresh please help.

I am working on a Mac with Mamp.
My PHP memory limit is set to 4GB
I have turned on all cache but the full page, which is switched off.
I have disabled:

'dev/js/merge_files'
'dev/js/minify_files'
'dev/css/merge_css_files'
'dev/css/minify_files'

Please please any suggestions to help the page load in reasonable amount of time whilst developing locally?


texts: Retain the logo but remove all other elements of header and footer

texts:
The Magento Ver is 1.9 and the theme is a variant of the rwd theme.
For a home page design I need to remove the header and footer completely but retain only the logo. I have tried this with the following code in layout update CMS page :

<reference>
<reference name="root">
<remove name="header"/>
<remove name="footer"/>
</reference>

The above code also removes the logo.

The following code retains the logo but also some other elements like Account Icon, search icon & 2 lines etc

<reference name="header">
<remove name="top.links"/>
<remove name="welcome"/>
<remove name="breadcrumbs"/>
<remove name="minicart_head"/>
<remove name="top.search"/>
<remove name="catalog.topnav"/>
<remove name="accountLinks"/>
<remove name="menu"/>
</reference>

Is there any way to just retain the logo and remove every thing else ?


texts: How can i send a sms upon successfull check out in magento?

texts:
How can i send a sms upon successful check out in magento , as i have a third party

sms api integrated already with another project , how can i give all the module as

a library or any other workaround for this in magento ?


texts: Display Custom Text in all page in Magento 1.9 using module

texts:
I am new to Magento 1.9 and i am trying to create a module that going to display some static text in every page.Can you please suggest any idea.
Display Text in **frontend\rwd\default\template\catalog/msrp/popup.phtml
** area .I have attached screenshot of the image as below for the reference.


texts: Example to override phtml files from my custom theme

texts:
I need to override the phtml template using my custom theme.

1) I need to override the toolbar.phtml from Catalog module
except that i need to use my toolbar.phtml which is placed in my custom theme.

2) If we use this method, is there a need to use the layout xml files?
If so how to override the same.

Need example for both!


texts: how to get order details based on shipment increment id in magento 2

texts:
I tried to get an order details in shipment tracking page based on shipment  increment id.but unable to get order collection.

$parentBlock = $block->getParentBlock();
    $track = $block->getData('track');
    $email = $block->getData('storeSupportEmail');
    $shipId = $block->getData('ship_id');
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $shipmentCollection = $objectManager->create('Magento\Sales\Model\Order\Shipment');
        $shipment = $shipmentCollection->loadByIncrementId($shipId);
        $orderId = $shipment->getOrderId();
        echo $orderId;


texts: The image file was not uploaded error in Magento 2 while editing the grid form

texts:
I am getting the file was not uploaded error in Magento 2 when I edit the form in the Magento 2 backend.

When I try to save the form it shows an error. The problem is that it requires me to choose the image again even though it is already there. Kindly help me to resolve this problem.

My save.php file.

<?php

namespace Webkul\Grid\Controller\Adminhtml\Grid;

use Magento\Framework\App\Filesystem\DirectoryList;

class Save extends \Magento\Backend\App\Action
{
    /**
     * @var \AdminGrid\Grid\Model\GridFactory
     */
    var $gridFactory;
    protected $_mediaDirectory;
    protected $_fileUploaderFactory;

    /**
     * @param \Magento\Backend\App\Action\Context $context
     * @param \AdminGrid\Grid\Model\GridFactory $gridFactory
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Webkul\Grid\Model\GridFactory $gridFactory,
        \Magento\Framework\Filesystem $filesystem,
        \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory
    ) {
        parent::__construct($context);
        $this->gridFactory = $gridFactory;
        $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
        $this->_fileUploaderFactory = $fileUploaderFactory;

    }

    /**
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    public function execute()
    {
        $resultRedirect = $this->resultRedirectFactory->create();

        try{

            $target = $this->_mediaDirectory->getAbsolutePath('mycustomfolder/');

            $targetOne = "mycustomfolder/";
            /** @var $uploader \Magento\MediaStorage\Model\File\Uploader */
            $uploader = $this->_fileUploaderFactory->create(['fileId' => 'image']);
            /** Allowed extension types */
            $uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png', 'zip', 'doc']);
            /** rename file name if already exists */
            $uploader->setAllowRenameFiles(true);
            /** upload file in folder "mycustomfolder" */
            $result = $uploader->save($target);

        }
        catch (Exception $e)
        {
            $this->messageManager->addError($e->getMessage());
        }

        $data = $this->getRequest()->getPostValue();

        $data['image'] = $targetOne.$result['file'];

        if (!$data) {
            $this->_redirect('grid/grid/addrow');
            return;
        }

        try {
            $rowData = $this->gridFactory->create();
            $rowData->setData($data);
            if (isset($data['id'])) {
                $rowData->setEntityId($data['id']);
            }
            $rowData->save();
            $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
        } catch (\Exception $e) {
            $this->messageManager->addError(__($e->getMessage()));
        }
        $this->_redirect('grid/grid/index');

    }

    /**
     * @return bool
     */
    protected function _isAllowed()
    {
        return $this->_authorization->isAllowed('Webkul_Grid::save');
    }
}


texts:
I have a store with 2 languages arabic and english, and I want a phtml for arabic and another one for english

Can I do something like:

    <ar>
        <reference name="footer">
            <action method="setTemplate">
                <template>page/html/footer_ar.phtml</template>
            </action>
        </reference>
    </ar>

and

    <en>
        <reference name="footer">
            <action method="setTemplate">
                <template>page/html/footer_en.phtml</template>
            </action>
        </reference>
    </en>

the store code is base, english is default and arabic is eg_ar


texts: How is it possible for a block to appear only if cms page is set as home page

texts:
In the content  of a cms page I add a (non cms) block

{{block type="A/B" template="xxx/xxx.phtml"}}

If cms page is set as home page is ok

If is not set as home page is not appearing

Obviously I miss something but what ?Any ideas ?

  Myslider.php

class Mytheme_Myslider_Block_Myslider extends Mage_Core_Block_Template
{
    public function _prepareLayout()
    {
        return parent::_prepareLayout();
    }

    public function getDataSlides()
    {
        $data_slides  = Mage::getModel('Myslider/Myslider')->getCollection()
            ->addFieldToSelect('*')
            ->addFieldToFilter('status', 1);

        $data=$data_slides->toArray();
        $filtered_data=array();
        if(count($data['items']))
        foreach($data['items'] as $slide)
        {
            $stores=explode(',',$slide['store_id']);
            if(in_array(Mage::app()->getStore()->getStoreId(),$stores) || in_array(0,$stores))$filtered_data[]=$slide;
        }

        return $filtered_data;
    }

    public function getDataSlider()
    {
        if (!$this->hasData('Myslider'))$this->setData('Myslider', Mage::registry('Myslider'));
        else return $this->getData('Myslider');

    }

}

  myslider.phtml

    <?php
    $slides = $this->getDataSlides();
    foreach($slides as $slide)
    {
    ?>

<a href="<?php echo $slide['link'];?>"><img src="<?php echo Mage::getBaseUrl('media') . $slide['image'];?>" alt="" />

<a href="<?php echo $slide['link_1'];?>"><img src="<?php echo Mage::getBaseUrl('media') . $slide['image1'];?>" alt="" />

    <?php } ?>


texts: Magento issue with dates for catalog price rule

texts: I have set up a catalog price rule for my webshop, with a start date and a end date. Today is 21/04/2017. can someone explain to me why this setup (screenshot) is still working? I still have discount on the webshop even the end date has already passed. I have cleaned the cached.


texts: Unable to reindex Product Prices - Foreign Key Constraint Fails

texts:
I've just recently upgraded my magento store from 1.4.2 to 1.7.0.2.. And The upgrade went smoothly but when I try to reindex data after the upgrade.. It fails on the Product Prices..

I've tried using php shell/indexer.php --reindexall from SSH and it fails at the Product Prices with these errors (I use pastebin as the error are quite long):

http://pastebin.com/iV2tuzDX

From what I can see, the table catalog_product_index_tier_price is empty.. and I'm not sure if that is causing any issue?

I've tried many different ways of solving it but to no avail.. Things like:

Can't re-index new products after upgrading to version 1.6 <- I've tried the answer by Vijay Kumar
http://www.magentocommerce.com/boards/v/viewthread/312438/#t429612 <- I've tried flushing /site/var/locks
Magento: a foreign key constraint fails after update 1.4 -> 1.7 <- I've tried the answer by Tobias Zander
 -

None of them worked.. I am not an expert in MySQL but I do know a little bit.. So I hope someone is able to find out what is causing the error and help me out and I believe it might also help others too who are experiencing the same issue as me :)

Thanks!~


texts: How to get the shipping address by order ID?

texts:
How to get the correct shipping address for an order ID? I am using Magento\Sales\Api\OrderRepositoryInterface to get the order information by order ID, but there are no methods for getting the shipping address, despite a lot of people on the internet claiming otherwise.
I considered using Magento\Sales\Api\OrderAddressRepositoryInterface, and I am able to return a shipping address, but it is not the correct one.
It took me a long time to understand why the get() method from OrderAddressRepositoryInterface wasn't returning the right data when passing the same $orderId parameter as in OrderRepositoryInterface, but then I found out that Magento inserts two entries in the sales_order_address table for each entry in the sales_order table - for some reason.
The address row from sales_order_address is then relationally matched with the right order in the sales_order table by the column shipping_address_id in the sales_order table, which corresponds to the entity_id in the sales_order_address table.
It would be easy to use OrderAddressRepositoryInterface if there was a getShippingAddressId() method declared in OrderRepositoryInterface, but there is none!
So how can I find/match the right shipping address with a particular order ID? I would love to hear suggestions for how to use the service layer to solve this, and not the persistence or domain layers.


texts: Magento: Static blocks stuck to each other

texts:
I'm new in Magento and trying to build a homepage which contains multiple static blocks. Every block contains images, text and buttons and using CSS I try to position those texts and buttons on top of the images. The problem is that if I use position:absolute to my first static block all the other blocks move over to that first image. How to make all static blocks be individual blocks even if position:relative and/or absolute is used?

Thanks!


texts: Problem weight on different configurable products

texts:
We have 1 configurable product (Product A) related with 2 simple products (A1 and A2). Product A1 weights 120gr, Product A2 weights 150gr.

On the product page of Product A, there is a drop down menu to choose which product version you want to buy. So you can choose A1 or A2.

When you choose A1 or A2 the price on the page changes, but the weight no, even though the weight is different.
How can we make the weight also to change depending on which product one chooses?

Thanks.


texts:
I tried to hide the Postcode (zipp) field in the cart in the block shipping costs but nothing is working. The name of the DIV is 'shippingAddress.postcode'.

Hide with CSS is not working and also some jquery in a block does not work.


texts:
I am new to Magento 2 and trying to do a simple observer and event function for frontend (global to all module)

My understanding is that controller_action_predispatch will be run before anything else.

Expectation:
When I run any frontend site, eg: http://www.magentosite.com/xxx, an alert box will be displayed before any other action. when the user clicks ok on the alert box, only the page will be displayed.

But I can't see an alert box there.
Hope someone can hint me which part did I implement wrongly or did I missing execute any command?

Update:
Do I need to register my module (eg: add registration.php file)??? because I only actually have events.xml file and TestObserver.php inside the module name only currently?

app/code/Vendorname/Modulename/etc/frontend/events.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch">
        <observer name="test" instance="Vendorname\Modulename\Observer\TestObserver" />
    </event>
</config>

app/code/Vendorname/Modulename/Observer/TestObserver.php

<?php
    namespace Vendorname\Modulename\Observer\TestObserver;

    use Magento\Framework\Event\Observer;
    use Magento\Framework\Event\ObserverInterface;

    class TestObserver implements ObserverInterface
    {
        public function execute(Observer $observer)
        {
            echo "<script>javascript: alert('test msgbox')></script>";
        }
    }
?>

then run

php bin/magento cache:clean

php bin/magento cache:flush


texts: How can I apply Order Discount. Order Create By admin

texts:
How can I apply the discount for total order in custom order create for the customer?

Note : My discount amount may vary for every order

Is possible?


texts: how to get Category description to the bottom of the page magento 1.9

texts:
How can you move the categories description to the bottom .
all the answers on the web say go to theme/category/view.phtml
search description ......

copy that and replace it at the botto and voilla .

But that DON'T work,so is there somebody who can tell the method that does work


texts: Magento 2.3 can't place order with Paypal All-In-One

texts:
I've updated Magento from 2.2.7 to 2.3.5-p1 and now with the Paypal All-In-One order payment, something's not right.
It's all good until the payment part at PayPal website, you confirm the payment and the payment is accepted by PayPal but when you're supposed to go to the order success page it goes out and in the system.log appears:
main.CRITICAL: The following tag(s) are not allowed: img [] []

Then the order appears in the quote table in the database with the increment_id reserved but the order is not created.
What can cause this?
Thanks :D


texts: Disable Product Reviews but keep rating enabled

texts:
I would like to disable the review option on product page in magento CE 1.9.0.1 but like to keep rating feature.
I tried "Go to System>Configuration>Advance>mage_review >disable, but it then disables the rating also.

Also disabling mage_review takes off the Reviews and Rating tabs under catalog, which can be understood. But Ratings goes off with it too.

I would like to know the workaround over this. Thanks


texts: Magento 2.3.2 Call to undefined function Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\bccomp()

texts:
When I am inserting product to the cart then below error is occured.

  Fatal error: Uncaught Error: Call to undefined function Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\bccomp() in /home/public_html/vendor/magento/module-inventory-sales/Model/IsProductSalableForRequestedQtyCondition/IsSalableWithReservationsCondition.php:93 Stack trace: #0 /home/public_html/vendor/magento/module-inventory-sales/Model/IsProductSalableForRequestedQtyCondition/IsProductSalableForRequestedQtyConditionChain.php(222): Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsSalableWithReservationsCondition->execute('B007D38J3M', 1, 1) #1 /home/public_html/vendor/magento/module-inventory-sales/Model/IsProductSalableForRequestedQtyCondition/IsProductSalableForRequestedQtyConditionChain.php(162): Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsProductSalableForRequestedQtyConditionChain->processSufficientConditions('B007D38J3M', 1, 1) #2 /home/public_html/vendor/magento/module-inventory-s in /home/public_html/vendor/magento/module-inventory-sales/Model/IsProductSalableForRequestedQtyCondition/IsSalableWithReservationsCondition.php on line 93

How to solve this ?

Thanks in Advanced.


texts: Use API rest media management by storeView code (admin)

texts:
I'm having troubles using the catalogProductAttributeMediaGalleryManagementV1 API rest for manage the products images in a multiple storeView project.

The main problem, is when I use the

POST /V1/products/{sku}/media

for upload an image, it does alright for my default store but in the others the attributes 'label', 'position' and others stays on NULL value. So on the list products page, on my default storeView looks good but in the others the images are not showed, but if you go inside the product the image exists. I figured out the problem is because position is NULL, on the list page Magento doesn't know what image has to display.

This is the image result on my default storeView:

{
   "id": 3492,
    "media_type": "image",
    "label": null,
    "position": 0,
    "disabled": false,
    "types": [
        "image",
        "small_image",
        "thumbnail"
     ],
    "file": "/I/1/I16_264_10.jpg"
}

And this is on any other storeView:

{
    "id": 3492,
    "media_type": "image",
    "label": null,
    "position": null,
    "disabled": null,
    "types": [],
    "file": "/I/1/I16_264_10.jpg"
}

I know you can use API rest writing the storeView code after 'rest' segment for use only this storeview, like:

rest/es/V1/products/{sku}/media
rest/en/V1/products/{sku}/media

Playing with db I figured out that if I put storeView 0 which is "admin" it works all! So I tried to do that query:

rest/admin/V1/products/{sku}/media

But says route doesn't match. Why?
If I try with the others storeViews code it works!

I tried to extend the code that magento uses and I really don't know what is happening. And I don't know neither how the API manages this code you can write after the 'rest' segment...
I tried to change the code, when he gets the product, I put added the storeView code 0 (it's admin) and do all stuff, but I think then when it saves the product, it does with default storeView... so I couldn't fix anything.

I have the ultimate alternative which is use:

PUT /V1/products/{sku}/media/{entryId}

For every storeView after used POST, and changing the value of position and label... But we'll have a extremely issue of performance here...

or just use for every storeView the POST...


texts: Magento 2 Add custom attribute on order PDF Print All action Drop down

texts:
In admin orders how to include custom attribute on pdf print all action?

It spits out PDF with Products SKU Price Qty Tax Subtotal I need to add another which is warehouse_location I know to add label is ../../../vendor/magento/module-sales/Model/Order/Pdf/Invoice.php

How to add the values?


texts: Magento 2.4 - Express Checkout - Shipping Address Error

texts:
A fresh install Magento 2.4.x + theme, but having some issue related to express checkout, as seen from below picture on red-box area.

The form has missing some elements, like firstname, lastname etc.
When I compare things around, it should have it. Do I miss some setup?
Also, when I check on console, I've seen some javascript error that I'm not familiar with, as below
*edit - one additional error that I forgot to add
Uncaught ReferenceError: Unable to process binding "afterRender: function(){return oscAddress.fieldAfterRender(element.dataScope) }"
Message: oscAddress is not defined

Uncaught ReferenceError: Unable to process binding "foreach: function(){return { data:elems,as:'element'} }"
Message: Unable to process binding "if: function(){return element.visible() }"
Message: Unable to process binding "ifnot: function(){return (element.input_type =='checkbox'|| element.input_type =='radio') }"
Message: Unable to process binding "template: function(){return $parent.fieldTemplate }"
Message: Unable to process binding "afterRender: function(){return oscAddress.fieldAfterRender(element.dataScope) }"
Message: oscAddress is not defined

I'm not really familiar with front-end stack on Magento, so I don't know what I need to do.
Any suggestion? Do I miss some server / code setup? or maybe Admin setup?
I already tried to refresh cache etc, but the problem still remains.
Also, I already change to Luma / default theme, but the problem still persist. So, I'm wondering if there's something that I missed.

PS - I already fulfill the requirements to install Magento, like, PHP version, elasticsearch version, etc, as-per documentation. So, I'm wondering if there's something that I missed out.

Thanks. :)


texts: Magento 2 custom EAV to category tree API

texts:
I have two custom field sw_menu_icon_img and sw_menu_icon_hover_img on Category in Magento 2 to store the menu icons.

I tried to override \Magento\Catalog\Model\Category and \Magento\Catalog\Model\Category\Tree prepareCollection() + getTree() to include the custom fields, but Magento in Magento\Webapi\Controller\Rest processApiRequest() line 308 converts the array and remove the elements that don't have getters in `Magento\Catalog\Api\Data\CategoryTreeInterface'.

My search results didn't give me anything. Does anyone know how to append custom attributes to the API result ?


texts: Move the primary store out of the hosting to a new install on a different server and keep the secondary store/website still working on the old server?

texts:
Magento 1.9.1
Magento 1.9.4
Porto theme

We are moving to a new server. Our old store is Magento 1.9.1. I exported all products and imported them into the new Magento 1.9.4 on the new server. I've also already setup the design, categories and everything else. The idea was to move the primary website/store with the secondary together at the same time. Now we changed our mind and we would like to continue running the secondary website/store on the old hosting platform and the new one on the new server. Will that work when I redirect the primary domain to resolve on the new server? We have the secondary website/store setup this way:

https://www.properhost.com/support/kb/30/How-To-Setup-Magento-With-Multiple-Stores-And-Domains

(the secondary domain is parked in the Cpanel and configured in  the .htaccess file like this:

SetEnvIf Host www\.domain1\.com MAGE_RUN_CODE=domain1_com
SetEnvIf Host www\.domain1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain1\.com MAGE_RUN_CODE=domain1_com
SetEnvIf Host ^domain1\.com MAGE_RUN_TYPE=website

SetEnvIf Host www\.domain2\.com MAGE_RUN_CODE=domain2_com
SetEnvIf Host www\.domain2\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain2\.com MAGE_RUN_CODE=domain2_com
SetEnvIf Host ^domain2\.com MAGE_RUN_TYPE=website


texts:
We want to offer certain customer groups a discount on up to 3 items. We want to offer this discount on a 'per year' basis. is this possible to do?

Magento would have to track the customer's purchases each time they order. Once they get to the point of ordering 3 (of a certain category) the discount would be disabled.


texts: How to override Magento model file that extends PHP class

texts:
I want to override a model file of another extension into my extension in order to develop the compatibility between the two extensions

The class I want to override is class Customweb_PostFinanceCw_Model_OrderContext extends Customweb_Payment_Authorization_OrderContext_AbstractDeprecated implements Customweb_Payment_Authorization_IOrderContext this class also extends another class of PHP

Please help me in extending this file.


texts:
I want to redirect to home on customer login and i don't want to work this redirection on checkout login
here is my code
/app/etc/modules/Cusredirection_customer.xml

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

app/code/local/Cusredirection/customer/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Cusredirection_customer>
            <version>0.0.1</version>
        </Cusredirection_customer>
    </modules>
    <global>
        <models>
            <cusredirection_customer>
                <class>Cusredirection_customer_Model</class>
            </cusredirection_customer>
        </models>
        <events>
            <customer_login>
              <observers>
                  <cusredirection_customer>
                      <class>cusredirection_customer/observer</class>
                      <method>customerLogin</method>
                      <type>singleton</type>
                  </cusredirection_customer>
              </observers>
            </customer_login>
        </events>
    </global>
</config>

app/code/local/Cusredirection/customer/Model/observer.php

<?php
class Cusredirection_customer_Model_Observer
{
    public function setRedirectOnLogin(){
        $session = Mage::getSingleton('customer/session');
        if (strpos(Mage::helper('core/http')->getHttpReferer(), 'checkout') === false)
            $session->setAfterAuthUrl(Mage::getBaseUrl());
        else
            $session->setAfterAuthUrl(Mage::helper('core/http')->getHttpReferer());

        $session->setBeforeAuthUrl('');
    }
}
?>


texts: customize my dashboard in customer account?

texts:
I am customizing my dashboard panel in customer account. There are two things customer info and customer address.

However when I add the order we can see orders here, but in the dashboard in the magento_customer  > frontend > dashboard

there are only two .phtmlfiles which we can be customized info and address.

How I can customize the orders. Problem is orders are getting render at top but I want to render them in the last.
How I can add the wish list in the my dashboard?


texts: How to add multiple quantity through custom option?

texts:
i have to add the multiple qty option for the product detail page.

i have manage to get the qty into custom option.

but got getting how use that qty. Please find the below images for complete scenario.


texts: How to override Magento_ConfigurableProduct/js/configurable.js

texts:
I'm following this instruction to override "Magento_ConfigurableProduct/js/configurable.js" but it doesn't work.
I'm following this link:
https://magento.stackexchange.com/a/131852/70258

After i disable module and then enable the module again, then run setup:upgrade, content:deploy, then it become this:

Now i can't see the related product anymore, i guess that Magento_ConfigurableProduct javascript is broken.

Here are my files:

  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="Convert_ProductList" setup_version="1.0.0">
        <sequence>
            <module name="Magento_ConfigurableProduct"/>
        </sequence>
    </module>
</config>

  configurable.js

define([
    'jquery',
    'jquery/ui',
    'Magento_ConfigurableProduct/js/configurable'
], function($){

    $.widget('silvan.configurable', $.mage.configurable, {
        //code you want to override
    });

    return $.silvan.configurable;
});

  app\code\Convert\ProductList\view\frontend\requirejs-config.js

var config = {
    map: {
        '*': {
            configurable:'Convert_ProductList/js/configurable'
        }
    }
};

Here is my tree code:


texts: Magento 2.x.x extension attributes API add object array

texts:
Have added custom attribute to order API with following info here: https://www.atwix.com/magento-2/adding-custom-attribute-to-api-response-in-magento-2/

It adds the "customer_feedback": "this is my feedback" fine to api.

How to add an Json object array ? E.G:

"my_custom_object": {
    "Key1": "value!",
    "Key2": "value2"
}

Thanks


texts: Magento 2 - Customer address custom attribute option label from value

texts:
I am using Magento 2.2.8 Enterprise Edition
I have a custom address attribute area a dropdown attribute with multiple options.
Now when I am getting value of attribute by using this code, I am getting ID
$address->getCustomAttribute('area')->getValue();

I just want to get Label of the selected area option, can anyone tell me How can I get it?


texts:
I am trying to edit out the Quick Links and other Footer links so that I can install some widgets in that area that I created with Static Blocks. I cannot find where the links are located. I have tried all the pages that were default installations, same with Static blocks. I cannot find the links in the XML in the footer file.

I am a PHP developer, but brand new to Magento. It's driving me nuts that I cannot find these links and why my widget content aren't being added to the Footer section. Can someone please help? Every piece of Footer Links content I found on the Internet refers to Magento 1.7, which has a Footer Links page installed. Magento 1.9 doesn't have a page like that.

I loaded Magento 1.9 on my computer using XAMPP.


texts: Magento table CSS issue - Paypal Order Review page

texts:
I have a highly screwed up template file which uses tables to display order totals, quantity and grand totals... the template is paypal/express/review/details.phtml

I wanted to ask if anyone knows of a way I could get the layout to display the items in their correct positions? This has had me stuck for nearly two hours and although its a relatively simple task its had me banging my head of of the desk!!!

    <?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
    <col />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
    <col width="1" />
    <col width="1" />
    <?php endif; ?>

            <th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?>
            <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?>
            <th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?>
            <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?>

        <?php if ($this->helper('tax')->displayCartBothPrices()): ?>

                <?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?>
                <?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?>
                <?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?>
                <?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?>

        <?php endif; ?>

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

        <?php foreach($this->getItems() as $_item): ?>
            <?php echo $this->getItemHtml($_item) ?>
        <?php endforeach ?>

Anyone able to assist?


texts: How to add custom content to block layout render by jslayout

texts:
Inside customer module layout default

  vendor/magento/module-customer/view/frontend/layout/default.xml

<block class="Magento\Customer\Block\Account\AuthenticationPopup" name="authentication-popup" as="authentication-popup" template="account/authentication-popup.phtml">
      <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                     <item name="authenticationPopup" xsi:type="array">
                        <item name="component" xsi:type="string">Magento_Customer/js/view/authentication-popup</item>
                        <item name="children" xsi:type="array">
                            <item name="messages" xsi:type="array">
                                 <item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
                                 <item name="displayArea" xsi:type="string">messages</item>
                            </item>
                        </item>
                      </item>
                </item>
            </argument>
      </arguments>
</block>

Above is form login customer will popup when customer sign in while checkout
. So my question is possible to move and add custom block to this kind of "js block" ?
Example: I want to add my block to bottom of block name "authenication-popup"


texts: Magento 2.3 which is the fastest way of retrieving only one item?

texts:
I need to get the order id by increment id. I would normally do this by calling the order factory:
/* Magento\Sales\Model\OrderFactory */
$order = $this->_orderFactory->loadByIncrementId($incrementId);
$orderId = $order->getId();

However, in this particular class I'm already using the order collection class:
public function __construct(
...
\Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
...
)
{
...
$this->orderCollectionFactory = $orderCollectionFactory;
...
}

So I could use the collection to get what I need and return only the first item:
$orderId = $orderCollectionFactory->create()
  ->addAttributeToSelect('entity_id')
  ->addFieldToFilter('increment_id', $incrementId)
  ->getFirstItem()
;

So now I'm wondering: which way is the fastest? the model factory will load the whole order object data, which is a bit redundant since I only need the order id. The  collection will return only the data I need for the only order that match (because I asked for the first item only) and I would not need to use another class
PS: I know there are API and we should use those whenever we can. Unfortunately I cannot use them in this instance so they are not an option in this case.


texts: Tax price issue on the product and listing page in Magento 2

texts:
I am facing an issue with the price display on the listing page and product page.

There are three cases:

  Case 1: Display Product Prices In Catalog -> Including Tax

The price display on the front-end is 34,56 €

  Case 2: Display Product Prices In Catalog -> Excluding Tax

The price display on the front-end is 29,04 €

  Case 3: Display Product Prices In Catalog -> Including and Excluding
  Tax

The price display on the front-end is 33,99 € 28,56 €

I want to display 33.99€ with the including tax. I don't know why there is displaying 34.56 instead of 33.99.
The same configuration working for Magento 1 website. In the Magento 1 site, there is showing 33.99 € on the front-end.Can you guys help me? Your help would be appreciated.

Please see my configuration in below screenshots,


texts: How to remove index.php from url if we enter manually

texts:
How to remove index.php when we enter manually in the URL

My store path is /var/www/html/testfolder/

Thanks


texts: All orders creating with 0000-00-00 00:00:00 created_at

texts:
I'm using Magento 2.2.9 and i can't create order.
Before this i was getting

Undefined index: year in /var/www/html/vendor/magento/zendframework1/library/Zend/Date.php on line 2653 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []

I hardcoded it by this way
  $parsed = ['date_format' => "yyyy-MM-dd", "locale"=>"ru_RU",
  "year"=>"2020","month"=>"12","day"=>"02","fixed"=>0];

But now i'm getting orders with 0000-00-00 00:00:00 created at.
How can i fix it?


texts:
My store offers some 100% off coupons, including shipping. When I try to checkout, it asks for my credit card information. When I try to place the order, it comes back saying "Invalid amount for authorization". I'm using Authorize.net.

Any ideas?


texts: admin panel url not working after installing magento 2.2.5

texts:
i have installed theme based on magento 2.2.5 storefront looks good but admin panel is showing this error:

Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
localhost
Apache/2.4.33 (Win32) OpenSSL/1.0.2o PHP/7.0.30

I tried to download the xdebug and add this zend_extension = "C:\newxampp\php\ext\php_xdebug-2.7.0alpha1-7.0-vc14-nts-x86_64.dll" to the bottom of the php.ini file but url showing the same error.


texts:
I am new to magento and i want to install a custom module in magento.

The steps that i gone through as follows.

loged through the admin panel.
then selected system -> magento connect -> magento connect manager.
in magento connect manager under direct package file upload, i upload the module through upload package file.

The error appear as follows

CONNECT ERROR: Package file is invalid

Invalid package name, allowed: [a-zA-Z0-9_-] chars

Invalid version, should be like: x.x.x

Invalid stability

Invalid date, should be YYYY-DD-MM

Invalid channel URL

Empty authors section

Empty package contents section

And i also want to know the basic steps to create a module and its structure.

Please help me...


texts: magento connect manager not working in sub-sub-directory

texts:
After we transfer our magento folder inside another php framework, example.com/magento
the magento connect manager is not showing.. it show like it can't find the page.
do i need to configure something to make it work??

This is the error that i got.

The page you requested was not found, and we have a fine guess why.

UPDATE 27/07/2015

ahh add one the the root of your magento folder github.com/OpenMage/… and change this line  github.com/OpenMage/… to the sub folder your magento install is located.

Thanks to rob3000 !!


texts: Random products from same category with parent category fill up

texts:
I would like to do following on 1.9.0.1:

Getting 12 random upsell-products from same category as current product.
They have to be saleable.
They shouldnt be in related-products already.
They shouldnt be in cart.

And if there are not 12 in that category fill the rest with products from parent category.

I think this is getting complex but I can do it. Just not sure if I can do it good :-)

My Question is do I have to worry about performance with that select complexity? What do you mean?

Code examples would be great that I can compare them.


texts: Magento2: Editing attribute 'country_of_manufacture' is impossible

texts:
I want to edit the attribute country_of_manufacture by adding german translation(for german store view) for each value in the options section, but
I can't do so.

Is there a way how I can achieve this ?


texts:
I am creating a site that is subscription based and has a complete custom checkout page.  As you know, in Magento you can not have multiple recurring items in the cart at the same time which isn't an issue because people won't be allowed to sign up for multiple subscriptions.  However, if once they have added one of the subscriptions to the cart they change their mind and want to choose another one, I need Magento to automatically take the other item out of the cart before adding the new one.

I added these lines of code in my addAction() function in my cart controller:

foreach ($items as $item) {
$itemId = $item->getItemId();
$cart->removeItem($itemId)->save();
$this->_getSession()->setCartWasUpdated(true);
}

So while this works, if there was something in the cart and this code runs, the $cart->save() does not save the item that was added afterwards, even though my ajax call responds that the item was successfully added and there were no errors.

Any ideas?


texts: Magento2: getting error while submitting extension on marketplace

texts:
I tried to upload my Magento 2 module in Magento Marketplace while uploading the file, there was suddenly error came up and stopped to proceed.
Can anyone help with the error?
Error:
"Failed to validate composer.json - demo/registration.php file is missing.,demo/etc/module.xml file is missing."
I think I'm missing something or my extension file structure is not good. I've added composer.json on the root directory and in my module, there are five submodules.
My extension file structure is below:


texts:
I want to apply GST according to Product unit price and in case discount is applied hence GST is calculated on discounted amount.
For Intrastate(with in the state):

if unit price + discount  < Rs1000 : 5%  (2.5% CGST + 2.5% SGST)

if unit price + discount  > Rs1000 : 12% (6% CGST + 6% SGST)

For Interstate:

if unit price + discount <1000 : 5%  (IGST)

if unit price + discount  >1000 : 12% (IGST)

Thanks in advance:)


texts: Magento 2.1.6 - update cron.php permission denied

texts:
Running Magento 2.1.6 and after going through many other problems this I hope is the last one. When I attempt to run //update/cron.php in ssh I get permission denied, this don't natter if I am using root or web user access. I've followed the steps as per Magento documentation for directory permissions but problem still remains. I believe this is what is making the cron check fail on readiness check on extension installations.

Is there a way to get this command run?


texts: magento 2 : How to UPLOAD VIDEO FILE programmatically in product

texts:
I am developing custom module for android and ios applications. I am creating products using API and I am also uploading product images using APIs.
Just for note I don't want to use YouTube or Vimeo video urls. Rather I want to upload video files and want to assign it with product ID.
My Requirement is to upload video file to gallery and assign it to product ID.
Can anyone help me with sample code to do following into magento 2 with custom code sample.

Upload Video file to media gallery
Assign that video file to productID

Anyone can help me with this.


texts: How to remove extra divs in my Page Builder CMS blocks?

texts:
While I'm saving the static block extra div's are adding to static block.
How to avoid the divs in Magento 2.3?

I don't have the custom style enabled, and I just have HTML code in my custom block.


texts: How can I get a collection with all payment methods?

texts: I need to get a collection of all payment methods and list the quantity of orders on each of them, how can I do that programmatically?


texts:
Guys after a lot of research, I managed to create a module that sends an email to the store owner, but I also need him to send an email with the content to the customer. Does anyone know how I can change my controller so that it sends the content to the client as well?
<?php

namespace vendor\module\Controller\Index;

use Zend\Log\Filter\Timestamp;
use Magento\Store\Model\StoreManagerInterface;

class Post extends \Magento\Framework\App\Action\Action
{
    const XML_PATH_EMAIL_RECIPIENT_NAME = 'trans_email/ident_support/name';
    const XML_PATH_EMAIL_RECIPIENT_EMAIL = 'trans_email/ident_support/email';

    protected $_inlineTranslation;
    protected $_transportBuilder;
    protected $_scopeConfig;
    protected $_logLoggerInterface;
    protected $storeManager;

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
        \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Psr\Log\LoggerInterface $loggerInterface,
        StoreManagerInterface $storeManager,
        array $data = []

    ) {
        $this->_inlineTranslation = $inlineTranslation;
        $this->_transportBuilder = $transportBuilder;
        $this->_scopeConfig = $scopeConfig;
        $this->_logLoggerInterface = $loggerInterface;
        $this->messageManager = $context->getMessageManager();
        $this->storeManager = $storeManager;

        parent::__construct($context);
    }

    public function execute()
    {
        $post = $this->getRequest()->getPost();
        try {
            // Send Mail
            $this->_inlineTranslation->suspend();

            $senderName = $post['name'];
            $senderEmail = $post['email'];

            $sender = [
                'name' => $senderName,
                'email' => $senderEmail
            ];

            $sentToEmail = $this->_scopeConfig->getValue('trans_email/ident_general/email', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);

            $sentToName = $this->_scopeConfig->getValue('trans_email/ident_general/name', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);

            $transport = $this->_transportBuilder
                ->setTemplateIdentifier('customemail_email_template')
                ->setTemplateOptions(
                    [
                        'area' => 'frontend',
                        'store' => $this->storeManager->getStore()->getId()
                    ]
                )
                ->setTemplateVars([
                    'name'  => $post['name'],
                    'email'  => $post['email']
                ])
                ->setFromByScope($sender)
                ->addTo($sentToEmail, $sentToName)
                //->addTo('test@test.com', 'owner')
                ->getTransport();

            $transport->sendMessage();

            $this->_inlineTranslation->resume();
            $this->messageManager->addSuccess('sucess!');
            $this->_redirect('customemail/index/index');
        } catch (\Exception $e) {
            $this->messageManager->addError($e->getMessage());
            $this->_logLoggerInterface->debug($e->getMessage());
            exit;
        }
    }
}


texts:
I've followed some tutorials and referenced some questions on here yet my problem still festers.

Magento version is CE 1.9.1.1

The company I work for has purchased an extension that overrides Mage_Usa's shipping models. To do things the "right way" I want to override that extension to modify a function.

If I disable the extension that overrides Mage_Usa and just override "usa" model with the appropriate depends, my override works just fine. I'm super stumped.

Here's the extension pertinants (snipped sections) I want to override

  /app/etc/modules/Webshopapps_Shipusa.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Webshopapps_Shipusa>
            <active>true</active>
            <codePool>community</codePool>
            <depends>
               <Mage_Shipping />
               <Mage_Usa />
               <Webshopapps_Wsacommon />
           </depends>
        </Webshopapps_Shipusa>
    </modules>
</config>

  /app/code/community/Webshopapps/Shipusa/etc/config.xml

<global>
    <models>
        <shipusa>
            <class>Webshopapps_Shipusa_Model</class>
            <resourceModel>shipusa_resource</resourceModel>
        </shipusa>
        <usa>
            <rewrite>
                <shipping_carrier_ups>Webshopapps_Shipusa_Model_Shipping_Carrier_Ups</shipping_carrier_ups>
                <shipping_carrier_usps>Webshopapps_Shipusa_Model_Shipping_Carrier_Usps</shipping_carrier_usps>
                <shipping_carrier_fedex>Webshopapps_Shipusa_Model_Shipping_Carrier_Fedex</shipping_carrier_fedex>
            </rewrite>
        </usa>
    </models>
</global>

  /app/code/community/Webshopapps/Shipusa/Model/Shipping/Carrier/Ups.php

class Webshopapps_Shipusa_Model_Shipping_Carrier_Ups
    extends Mage_Usa_Model_Shipping_Carrier_Ups
    implements Mage_Shipping_Model_Carrier_Interface
{
    public function getFinalPriceWithHandlingFee($cost)
    {
        //snip
    }
}

My code that I'm trying to write to override the function getFinalPriceWithHandlingFee

  /app/etc/modules/Namespace_Shipusa.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Shipusa>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Webshopapps_Shipusa />
            </depends>
        </Namespace_Shipusa>
    </modules>
</config>

  /app/code/local/Namespace/Shipusa/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Namespace_Shipusa>
            <version>0.1.0</version>
        </Namespace_Shipusa>
    </modules>
    <global>
        <models>
            <namespace_shipusa>
                <class>Namespace_Shipusa_Model</class>
            </namespace_shipusa>
            <shipusa>
                <rewrite>
                  <shipping_carrier_ups>Namespace_Shipusa_Model_Shipping_Carrier_Ups</shipping_carrier_ups>
                </rewrite>
            </shipusa>
        </models>
    </global>
</config>

  /app/code/local/Namespace/Shipusa/Model/Shipping/Carrier/Ups.php

<?php

class Namespace_Shipusa_Model_Shipping_Carrier_Ups extends Webshopapps_Shipusa_Model_Shipping_Carrier_Ups
{

    public function getFinalPriceWithHandlingFee($cost)
    {
        file_put_contents('/tmp/muh', 'bye', FILE_APPEND);
        $old_cost = parent::getFinalPriceWithHandlingFee($cost);

        return $old_cost;
    }
}


texts: Why Magento 1.9 takes longer time for loading products above 50k? Any specific or good solution for it?

texts:
I have my web shop running and imported products above 50K. After import all categories pages taking longer time to load. e.g. 1 min. to 5 min. but before that the loading time was fair. Also, all the products are simple products type.

Does Magento application cannot handle products above 50k effectively and its getting slower?
Does I require to upgrade server infrastructure?
Although, 5 GB memory is free out of 12 GB. It has 6 cores CPUs.


texts: "]>" characters showing at top of Magento after upgrade

texts:
I upgraded from 1.7 to 1.9.1.1 for the most part successfully. Only one thing: there are these characters showing at the top of every page on the frontend: ]>

Any idea what might be causing this? I cleared the cache, logged out and back in to admin, etc.


texts:
I need some direction...

Within Magento 2, I am not finding exactly how to do a getCollection() that will allow me to see a list of all products.  I am developing an Rest API to allow me to get a list of products based on a defined set of attributes.  The code I have is the following:

class Inventory implements InventoryInterface {
    private $scopeConfig;
    private $product;

    public function __construct(
        Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        Magento\Catalog\Model\ProductFactory $product
    ) {
        $this->scopeConfig = $scopeConfig;
        $this->product = $product;
    }

    public function get($id = null) {
        $data = $this->product->create()->getCollection();
        $data->addFieldToFilter('status', 1);
        $data->addFieldToFilter('type_id', 'simple');

        if ($id) {
            $data->addFieldToFilter('entity_id', $id);
        }

        return $data->getData();
    }
}

with this, I am getting back the XML, but I am missing how to be able to select additional attributes to display.

Please be gentle in your responses...  I am new to this list AND Magento 2, so feeling a little stupid at this point.  Thanks in advance.


texts:
I've a fresh installation of Magento ver 1.9.1.0 on localhost. I'm following this tutorial closely to create a child theme of Magento responsive theme.

I've followed all steps clearly. I've created Magento directory structure, using this approach

[Magento Directory]/app/design/frontend/{package_name}/{theme_name}/etc

and created theme.xml file there. As can be seen

Exact location of the theme.xml file is:

[Magento Directory]/app/design/frontend/tutsplus/vstyle/etc

as my package name is 'tutsplus' and theme name is 'vstyle'. I've also correctly enabled this theme from admin panel. As can be seen in below screenshot:

The code of theme.xml file is:

<?xml version="1.0"?>
<theme>
    <parent>rwd/default</parent>
</theme>

Can someone point out what am I missing?


texts: I am working in sales order create item grid html file. Where i can find this function order.itemsUpdate()?


texts: How to configure SMS Gateway integration in Magento locally?

texts:
I am trying to configure SMS Gateway Integration in my local machine, but can't able to get proper guidance.

Anyone can help to fix that issue.

Thanks in Advance.


texts: Category name on product url still working after "Use Categories Path for Product URLs" set to no

texts:
"Use Categories Path for Product URLs" set to no on admin panel

But everytime I create a new product, it creates rewrite also for category/product url

So both of them work: example.com/category/product and example.com/product

But I don't want Magento to create automatically the category inside the product url automatically, does anyone know how to disable it?


texts: How to remove nav-bar from custom magento admin page

texts:
I want to remove navbar from a custom magento admin panel popup. I have already removed header and footer, but can not remove navbar panel.

Please help

<adminhtml_catalog_product_xyz>

    <remove name="footer" />

    <remove name="header" />
    <remove name="top.menu" />
    <remove name="top.links" />
    <remove name="top.container" />

    <reference name="content">
        <remove name="nav-bar" />
        <remove name="header" />
        <block type="core/template" name="xyz" template="abc/test/test.phtml" />
    </reference>

</adminhtml_catalog_product_xyz>


texts: Magento 2 | Exclude duplicate Item ID from a collection before foreach

texts:
When I foreach my collection filtered by tier price, qty and customer group I get the error: "Item (Magento \ Catalog \ Model \ Product \ Interceptor) with the same ID already exists".
This is my class:
namespace Vendor\Module\Block;
class ProductCollection extends \Magento\Framework\View\Element\Template
{

protected $_productCollectionFactory;

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        array $data = []
    )
    {
        $this->_productCollectionFactory = $productCollectionFactory;
        parent::__construct($context, $data);
    }

public function getProductCollectionSearch() {
        $collection = $this->_productCollectionFactory->create();
        $collection->addAttributeToSelect('*');
        $collection->setPageSize(3);

        $collection->getSelect()->join('catalog_product_index_price as price_index', 'e.entity_id = price_index.entity_id');
        $collection->getSelect()->join('catalog_product_entity_tier_price as tier', 'price_index.entity_id = tier.entity_id');

        $collection->addFinalPrice()
            ->addMinimalPrice()
            ->getSelect()
            ->where('tier.all_groups = 0')
            ->where('tier.qty = 1000')
            ->where('tier.value <= 0.20');

        return $collection;
    }
}

This problem arises when I try to foreach product in my phtml file.
This is my phtml file:
<?php
$blockProductColl = $block->getLayout()->createBlock('\Vendor\Module\Block\ProductCollection');
$collectionSearch = $blockProductColl->getProductCollectionSearch();

$count=0;

//echo $collectionSearch->getSize();
foreach($collectionSearch as $itemSearch){
    echo $itemSearch->getSku().'<br/>';
    $count++;
}
?>

Is there a way to exclude duplicate Item IDs before foreaching the collection?
Thanks!
SOLUTION:
public function getProductCollectionSearch() {
        $collection = $this->_productCollectionFactory->create();
        $collection->addAttributeToFilter('visibility', 4);
        //$collection->setPageSize(10);

        $joinConditions = 'e.entity_id = tier.entity_id';
        $collection->getSelect()->join(
             'catalog_product_entity_tier_price as tier',
             $joinConditions
            )
              ->where('tier.customer_group_id = 0')
              ->where('tier.qty = 1000')
              ->where('tier.value <= 0.10')
              ->where('tier.website_id = 0');
         return $collection;
    }


texts: Blank admin page after installing SUPEE7405

texts:
I'm new to Magento and installed today the SUPEE7405 patch without SSH.
Now I have a blank admin page and cant get it back running. I cleared var/session and var/cache. I checked the includes/config.php that the compiler is disabled. I activated the error message and received

  Fatal error: Class 'Mage_Core_Helper_UnserializeArray' not found in app/Mage.php on line 547

Has anybody got a idea to solve the problem.


texts:
I have created child theme for magento 2x and it's parent theme is porto theme. After create child theme everthing is working fine but sometime I have got the following error.

Uncaught TypeError: $.ui is undefined
Uncaught TypeError: owl.owlCarousel is not a function
Uncaught TypeError: $(...).swMegamenu is not a function
Uncaught TypeError: $(...).owlCarousel is not a function
Uncaught TypeError: Cannot read property 'timepicker' of undefined

I am not sure why I am getting these error randomly. I have also tried ->  Why is js breaking with requirejs in templates on Magento 2 and how to fix? but not working.

Any suggestions would be appreciated


texts: How to show rating on recent view products?

texts:
I want to show rating star on recently viewed products.
Is that possible?

 <?php foreach ($_products as $_item):  ?>
 <?php if($_item->getRatingSummary()){ ?>
                      <?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>

                     <?php }?>
 <?php endforeach; ?>


texts:
I am trying to apply a coupon code to a users session so that when they add a product to the cart and go to check the coupon is automatically applied to the cart.

This thing is that the user comes from a 3rd party system to a specific hidden url and based on some url parameters we will apply different coupon codes. The problem is that at this point the user does not have any products in their cart.

I found this and it works but only if you already have products in the cart. If a user go to this url and then adds a product to the cart the coupon code is not applied. Any ideas how this can be accomplished?

http://www.example.com/checkout/cart/couponPost/coupon_code/somecode/?return_url=http://www.example.com/products


texts:
On my site https://www.nattklubbar.net/se I have installed latest klarna checkout along with magento 2.3.5 and I have a problem with invalid form key once placing the order.
From Klarna logs response:
Date: Sun, 16 Aug 2020 17:54:43 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: mage-messages=%5B%7B%22type%22%3A%22error%22%2C%22text%22%3A%22Invalid+Form+Key.+Please+refresh+the+page.%22%7D%5D; expires=Mon, 16-Aug-2021 17:54:43 GMT; Max-Age=31536000; path=/
Pragma: no-cache
Cache-Control: max-age=0, must-revalidate, no-cache, no-store
Expires: Fri, 16 Aug 2019 17:54:43 GMT
X-Magento-Tags: FPC
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Location: https://nattklubbar.net/se/
X-UA-Compatible: IE=edge
CF-Cache-Status: DYNAMIC
cf-request-id: 049a01def5000000523aac1200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5c3d05ab28530052-LHR

I have tested Klarna and Magento 2.3.5 on a fresh magento installation and it works. So I think it has to have something to do with the enviornment of my magento , cookie domains etc.
Anyone that could help?


texts: Order E-mail is not sent automatically with credit card payments

texts:
My website has two different payment methods: bank transfer and credit card. Automatic order email works fine when bank transfer is selected, but it does not work with credit card (you must go back to admin and send the order email manually to the customer). When I  open Order view (in Sales), the message "the order confirmation email is not sent" appears.

Order status is complete on the admin.

To enable credit card payments on Magento I have installed my bank "official" extension, and the full card payment process is working ok at this time.

So any help is welcome to get automatic order emails sent correctly to the customer. Thanks.


texts: How to show text in newly added admin page

texts:
By using this article, I have created one page in magento admin.But I do not know how to show text in that page.Here is AdminhelloController.php

<?php
class Pulsestorm_Adminhello_AdminhelloController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        echo "Hello";
        $this->loadLayout();

        $this->renderLayout();
    }
}

But that "Hello" is printed above Magento Admin Panel Menu.


texts: Programatically get category collection by multiple root category id

texts:
I am working on a script, my requirement is to get child categories of multiple root categories. Root category is an array of ID's.

Example: $myrootcats = array('12,15,18,20');

And I want all active categories which belong to the above array.


texts: credit card information display in a magento 2 controller


texts: Can we redirect controller to another controller in another custom function rather execute function?

texts:
Can we redirect controller to another controller in such a way that previous controller continue its working in its execute method and next controller works render the layout at a same time? and after executing it returns the next controller

e.g

public function execute()
{
       //do what ever we want

    return $resultRedirect->setPath('abc/def/jklmno');
}
public function abc()
{
       $resultRedirect->setPath('abc/def/ghi');
}

is this possible?


texts: Rename(/usr/lib64/plesk-9.0/composer.phar): failed to open stream: Permission denied

texts:
I tried to run the composer self-update method and I'm getting this error message and I'm not sure where to start to fix this issue:

rename(/usr/lib64/plesk-9.0/composer.phar): failed to open stream: Permission denied


texts:
When I run any M2 command line scripts I get the follow error message:

Command line user does not have read and write permissions on var/generation directory.  Please address this issue before using Magento command line.

My user is a part of the group with admin rights and the file owner.

May I ask where else to check?


texts: Magento2 how to create custom module to Show related products in minicart

texts:
Can anybody guide me how can I add the related products ti recently added item to cart in minicart in Magento2

I know that the magento2 minicart content is loaded by the Js layout.

I have created one module override the Customerdata by adding di.xml in my module
But it did not work.

module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Mypackage_Minicartrelated" setup_version="1.0.0" schema_version="1.0.0">
        <sequence>
            <module name="Magento_Checkout"/>
        </sequence>
    </module>
</config>

app/code/Mypackage/Minicartrelated/etc/di.xml code

<config>
    <type name="Magento\Checkout\CustomerData\Cart">
        <plugin name="Mypackage_Minicartrelated" type="Mypackage\Minicartrelated\Plugin\CustomerData" sortOrder="1"/>
    </type>
</config>

app/code/Mypackage/Minicartrelated/Plugin/CustomerDataCart.php

<?php

namespace Mypackage\Minicartrelated\Plugin\CustomerData;
use Magento\Customer\CustomerData\SectionSourceInterface;
class Cart {
    public method afterGetSectionData(\Magento\Checkout\CustomerData\Cart $subject, $result)
    {
        // Get the previous data
        $data = $result;
        $data .="test";
        return $data;
    }
}

But it gives me error Error: [object Object]

  throw new Error(jqXHR);

Can anybody can give me right direction how can I show related products in Magento2 minicart.


texts: Magento 2 : AdvancedSalesRule override validate method

texts:
I need to validate custom quote item details, So I am overriding module AdvancedSalesRule "\Magento\AdvancedSalesRule\Model\Rule\Condition\Product" file. But Not getting quote item Id in model object. Below is code of override method.

/**
     * Validate Product Rule Condition
     *
     * @param \Magento\Framework\Model\AbstractModel $model
     * @return bool
     */
    public function validate(\Magento\Framework\Model\AbstractModel $model)
    {
        //@todo reimplement this method when is fixed MAGETWO-5713
        /** @var \Magento\Catalog\Model\Product $product */
        $product = $model->getProduct();
        if (!$product instanceof \Magento\Catalog\Model\Product) {
            $product = $this->productRepository->getById($model->getProductId());
        }

        if ($model instanceof \Magento\Quote\Model\Quote\Item) {
            echo $model->getItemId(); die; // Null


texts: Getting Please fix errors and re-upload file while csv product import Magento ver. 1.9.2.1

texts:
I am getting below error while product import from admin. As there is no particular error (mostly error in csv formats) i am not able to debug.

File permission of media folder

In Export of Products i am also getting

I know how to solve this error as per link to solve export but why this happen suddenly

UPDATE 1:
I checked log file and in log there is error as below

but i created a var/tmp folder with 777. still same issue.


texts:
I've installed magento ver. 1.9.3.6 on Ubuntu 16.04.3 LTS (Apache2, php 5.6.32).
I'm able to get SOAP api data using http://magento.local/api.php?wsdl=1
However, my need is to make REST api work locally as my customer uses it on prod.

POST http://magento.local/api.php?type=rest&products/oauth/initiate (with passed key and secret) returns 401 Unauthorized (oauth_problem=parameter_absent&oauth_parameters_absent=oauth_token).

I suppose, I'm using wrong path for the first step of oauth.
What is correct path for oauth/initiate ?
Url http://magento.local/oauth/initiate returns 404 not found error.

Please advise.


texts:
Using REST API it was working fine for a while and then I started getting the response:

{"message":"Unable to save product"}

When I POST a product.

Note the same product worked fine before and there is no exception in the logs (checked apache error.log and all logs for magento).

Site works fine.

Anyone else seen this?

Update: Picked up a page dump in mysql error.log. Probably something corrupt there?


texts: How to add / change group prices with Magento API 1.9.1

texts:
I can't find a way to add or change the group prices with the API.
Its only possible to change the tier prices.
Have anyone a idea, how to solve this?


texts: Display simple product SKU on config product pages after attribute selection

texts: I am looking to have the configurable sku change to the corresponding simple product sku when the configurable products attributes have been selected. Any help or suggestions would be appreciated.


texts: Magento 2 knockoutjs error data-bind even?

texts:
I have created custom template with knockoutjs in magento 2.1.7.

The file name mytemplate.phtml

This is the content of file Namespace_Module/web/js/template/listing.html

This is the content of file Namespace_Module/web/js/view/listing.js

define([
        'jquery',
        'ko',
        'uiComponent'
], function($, ko ,Component) {
    'use strict';
    var self = this;

    return Component.extend({
        initialize: function () {
            this._super();
        },
        /**
         * retrieve data to form update
         */
        myFunction: function () {
            console.log('is ok');
            return this;
        }
    });
})

when i load get error message is

  Unable to process binding "click: function (){return myFunction }"

pls let me know, what's wrong in my code? Many thanks!


texts:
I've created two product custom attribute to let admin se a starting and ending date for all group price, to let magento calculate correctly the group price only inside the date rage I've override the function getGroupPrice($product) inside the class Mage_Catalog_Model_Product_Type_Price like follow:

public function getGroupPrice($product)
    {

        $groupPrices = $product->getData('group_price');

        if (is_null($groupPrices)) {
            $attribute = $product->getResource()->getAttribute('group_price');
            if ($attribute) {
                $attribute->getBackend()->afterLoad($product);
                $groupPrices = $product->getData('group_price');
            }
        }

        if (is_null($groupPrices) || !is_array($groupPrices)) {
            return $product->getPrice();
        }

        $customerGroup = $this->_getCustomerGroupId($product);

        $matchedPrice = $product->getPrice();

        // retrive group price data range
        $group_price_from = $product->getData('group_price_from');
        $group_price_to = $product->getData('group_price_to');
        $paymentDate = date('Y-m-d');
        $paymentDate=date('Y-m-d', strtotime($paymentDate));

        foreach ($groupPrices as $groupPrice) {
            if ($groupPrice['cust_group'] == $customerGroup && $groupPrice['website_price'] < $matchedPrice) {
                if (($paymentDate > $group_price_from) && (($paymentDate < $group_price_to)||($group_price_to == null)))
            {
                $matchedPrice = $groupPrice['website_price'];
            };
                break;
            }
        }

        return $matchedPrice;
    }

Now it work greatly inside the product page so that group price is applied ONLY inside the date range... but it doesn't work in all other position: in cart, inside category page and listing product new... they are displayng the gruop price independently of the data range...

Probably I've missed something ore changed the wrong function.


texts: How to apply Custom CSS on magento 2 checkout page(shipping and checkout)

texts:
i have added two fields in my magento 2 checkout at shipping address tab.
My fields are check boxes and and i want to add some css to those check boxes therefore i have added custom css file but as i observer css gets applied after the page load.
Magento checkout is totally based on knockout js and other dependencies that why my css is not getting applied.
i have added a hook.js and that js file is getting applied.
i have also tried to add Css using jQuery.

        $("[name='shippingAddress.custom_attributes.displaynewsfeed']").css("padding-left","20%");
        $("[name='shippingAddress.custom_attributes.displayreceipt']").css("padding-left","20%");

But this is not getting applied so i have tried another method  in jQuery which delayed the function for 2 seconds its working but its not acceptable.
Is there any solution where i can add CSS withing the form load not after some seconds or before Form load.

Small Help will be Greatly Appreciated.
Thanks in Advanced :)


texts: How to add product tags in magento 1.9 from frontend

texts:
I was trying to add product tags from frontend ,it is not working or its disabled,

Anybody have an idea of why taging is disabled in front end ?

Although i can add tags from the backend .

screenshot given below .


texts:
I was having some issues yesterday with this, but I already managed to solve it using only API calls, as I was using both API and Magento Core.

This is my actual code:

        $proxy = new SoapClient($this->_api_url); // TODO : change url
        $sessionId = $proxy->login($this->_user, $this->_password); // TODO : change login and pwd if necessary
        $pageURL= $this->_page_url;
        $result = $proxy->catalogProductList($sessionId);

        $product_list = array();

        foreach($result as $p)
        {
            $starttime = microtime(true);

            $id = $p->product_id;
            $info = new stdclass();
            $info->attributes = array('sku', 'name', 'description', 'price', 'url_path');
            $product = $proxy->catalogProductInfo($sessionId, $id, NULL, $info);
            $image = $proxy->catalogProductAttributeMediaList($sessionId, $id, NULL, 'ID');

            $endtime = microtime(true);
            $timediff = $endtime - $starttime;

            echo "api calls $timediff

";

            $name = $product->name;
            $description = $product->description;
            $price = $product->price;
            $formatted_price = number_format($price, 2);
            $image_url = $image[0]->url;
            $product_url = $product->url_path;
            $product_url = $pageURL.$product_url;
            $sku = $product->sku;

            $my_product = new Product();
            $my_product->id = $id;
            $my_product->name = $name;
            $my_product->description = $description;
            $my_product->price = $formatted_price;
            $my_product->image_url = $image_url;
            $my_product->product_url = $product_url;
            $my_product->sku = $sku;
            $product_list[] = $my_product;
        }

        return $product_list;

The problem with this approach is, each product needs 2 API calls, one for name, description, sku, etc, and another one for the image url. This takes too long, as for 3 products that I have, it takes like 5 seconds to load the page (two api calls for each one is like 1.5s). Is this the normal behavior of Magento API, or there is a problem with my system? Will I need to change all my method?

BTW, I'm testing this in localhost.


texts: Magento 2.2.4 into Change Price Calculation from round to ceil (means if price 0.0001 then it will become 1.00)

texts:
I changed price rounding calculation from round to Ceil (PHP function). Its Means if price 0.0001 then it will become 1.00

Now the problem in price calculation.

Example:-
Product Price = 8249.25

5% tax = 412.4625

Total = 8661.7125

After using ceil function it's must be 8662.00, But now it's display 8663.00 price.

I changed in those files.

  Magento\Directory\Model\PriceCurrency

public function format(
    $amount,
    $includeContainer = true,
    $precision = self::DEFAULT_PRECISION,
    $scope = null,
    $currency = null
) {
    return $this->getCurrency($scope, $currency)
        ->formatPrecision(ceil($amount), $precision, [], $includeContainer);
}
/**
 * Round price
 *
 * @param float $price
 * @return float
 */
public function round($price) {
    return round(ceil($price), 2);
}

  Magento_Catalog/js/price-utils

function formatPrice(amount, format, isShowSign) {
    var s = '',
        precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;

    format = _.extend(globalPriceFormat, format);

    precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;
    integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired;
    decimalSymbol = format.decimalSymbol === undefined ? ',' : format.decimalSymbol;
    groupSymbol = format.groupSymbol === undefined ? '.' : format.groupSymbol;
    groupLength = format.groupLength === undefined ? 3 : format.groupLength;
    pattern = format.pattern || '%s';

    if (isShowSign === undefined || isShowSign === true) {
        s = amount < 0 ? '-' : isShowSign ? '+' : '';
    } else if (isShowSign === false) {
        s = '';
    }
    pattern = pattern.indexOf('{sign}') < 0 ? s + pattern : pattern.replace('{sign}', s);

    i = parseInt(
            amount = Number(Math.round(Math.ceil(Math.abs(+amount || 0)) + 'e+' + precision) + ('e-' + precision)),
            10
        ) + '';
    pad = i.length < integerRequired ? integerRequired - i.length : 0;

    i = stringPad('0', pad) + i;

    j = i.length > groupLength ? i.length % groupLength : 0;
    re = new RegExp('(\\d{' + groupLength + '})(?=\\d)', 'g');

    am = Number(Math.round(Math.ceil(Math.abs(amount - i)) + 'e+' + precision) + ('e-' + precision));
    r = (j ? i.substr(0, j) + groupSymbol : '') +
        i.substr(j).replace(re, '$1' + groupSymbol) +
        (precision ? decimalSymbol + am.toFixed(2).replace(/-/, 0).slice(2) : '');

    return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}


texts: Google Analytics Shopping Behavior Analysis Missing Data - duplicate

texts:
I've created an eCommerce store and created the analytics for this store, On Magento2 backend I've placed the Tracking Code and I start to check that the data is being sent into GA. The enhanced eCommerce is already enabled and collecting order data. The issue is the Shopping Analysis Behavior that is missing data on some steps
Sessions with Product Views
Sessions with Add to Cart
Sessions with Checkout


texts: How to add multi level dropdown filters to advanced search form in Magento?

texts: I want to add a search box to my header where search form will have two drop-down select input fields (for two product attribute). The options in second drop down should depend on the selection made in the first drop down field. for example two fields are laptop brands and screen size, if in the first drop down  HP is selected the second drop drown must update(through AJAX)and should contains screen sizes available  only for HP and when the user hit search all the individual product should show up. I know how to do this from scratch but i can tweak magento code to achieve this. Can someone please suggest a suitable way?


texts: Managing customer in Magento returns fatal error

texts:
I am using Magneto 1.9.3.2 and when i try to edit customer returns this massage:

  Fatal error: Declaration of
  Mage_Customer_Model_Customer_Attribute_Source_Website::getAllOptions()
  must be compatible with
  Mage_Eav_Model_Entity_Attribute_Source_Table::getAllOptions($withEmpty
  = true, $defaultValues = false) in /home/reprosty/public_html/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php
  on line 34

any suggestions?


texts: shoppingCartShippingMethod return with 1062: Shipping method is not available

texts:
i want to submit a shipping method to my magento cart object via SOAP (api/v2_soap?wsdl=1)
$data = array(
   'sessionId' => $sessionId,
   'quoteId' => $quoteId,
   'shippingMethod' => 'matrixrate_matrixrate_1211'
);

$this->_client->shoppingCartShippingMethod($data);

The message i get said that the shipping method is not available.
$data = array(
   'sessionId' => $sessionId,
   'quoteId' => $quoteId,
   'shippingMethod' => 'matrixrate_matrixrate_1211'
);

$this->_client->shoppingCartShippingMethod($data);

{
 "statusCode": 200,
 "data": "1062: Shipping method is not available"
}

so i try to get all shippingMethods
{
 "statusCode": 200,
 "data": [
   "env:Sender: Error cannot find parameter"
 ]
}

If i add the store_id (which is 0) i reveice a different message
{
 "statusCode": 200,
 "data": "1002: Can not make operation because quote is not exists"
}

The is_active state of this quote is also 0.
So i have several questions:

How do i get the shippingMethods to use them for adding to my cart object?

Why my quote not exists? I find the quote in my table sales_flat_quote (value is_active = 0 && value store_id = 0)

Why the quote has the status "is not exists"? And when i have to change this status?

This is my soap request order for the quote:

getSessionId
createCartId
addProductToCart
setCustomerForCart
addAddressToCart
setShippingMethod => this not work anymore

Did i have to update any backend settings? (to use shippingMethodList via SOAP)

Thanks in advance!


texts:
I am able to retrieve the real order id by

$order->getReadlOrderId();

I am unable to find any documentation or posts that show how to get the real shipment id, so far I am only able to get the Id by

$shipment->getId();

And that Id is not the Id shown on the adminhtml grids... any ideas on how I can get the real shipment id?


texts:
I tried to change the price, tax and discount of each product added to cart.
I could change the price of each item with observer and code below, but i cant change the discount and tax. How can i change it?

Observer :

$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);


texts: Copy core file to app/code/local/Mage can't overload!

texts:
I have 2 files need to be overload

core/Mage/Admin/Model/Session.php

and

core/Mage/Adminhtml/controllers/IndexController.php

I already copy it to local with same structure, but the bad news is it wasn't overloaded. I can overload Block in local folder before. Now, I want to know why and how to do it.


texts:
I am interested in knowing if and how Magento could be used to sell bulk product that is pulled from a common inventory and sold in several discrete package sizes?

An example would be Potatoes. They are stored in bulk and packaged upon demand. They would be sold as 5lb, 25lb or 100lb packages. So the product would have 3 variations.

A key element of this question is that these are discrete variations. IE the customer will be able to order one or more of each of these particular variations.


texts: configurable product always shows out of stock

texts: I've set my configurable product on "in stock" but it still shows out of stock! :S I don't understand why.. I don't have this issue with "simple producht"


texts:
I'm looking for a way to effectively extend attribute options.

The scenario is this. I have a brand attribute, and this attribute holds many attributes options (Brand1, Brand2, etc). What I'd like is to be able to store some extra information about those values, for example, for each brand I'd like some text maybe entitled "about the brand", maybe even an option to upload an image for the brand.

Now, I know there are various "Brand" extensions knocking around, but I'd like to use this functionality for other attributes (material, wattage, etc).

So I guess what I'm looking for is a way of making attributes of attributes.

Does anyone know of a way of achieving this?


texts: Adding brand logo works in product view but not in search result

texts:
I've added the brand logo in the product view phtml file like this:

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

It returns the correct url, for example for "acme" brand the resulting url is:

media/catalog/brand/acme.png

I tried to add the same code in the catalog/product/list.phtml file, but the link is broken and the generate url is:

media/catalog/brand/.png

So it seems like the brand attribute is not extracted. What's wrong?


texts: Magento 2 - Check if record with certain value already exist in table before creating it

texts:
I created a new table company_shipping_quote.
I am writing data into it like this:
$quoteId = $quote->getId();
$html = $this->_generateNote($expressRule);

$quoteModel = $this->_companyShippingQuoteFactory->create();
$quoteModel->setQuoteId($quote->getId());
$quoteModel->setExpressNote($html);
$quoteModel->save();

But this does not check if there is already an entry with the value for quote_id and it just creates duplicates.

How can I check if there is already a row with that quote_id before creating it?


texts: Exporting a Google Shopping feed with complex product types

texts:
There are a number of extensions available for creating Google Shopping data feeds, e.g. this one from the Magento Core Team, and this one from Wyomind.  What solution do you use for Google Shopping data feeds?

I'm particularly interested to hear experiences with complex products such as configurables and bundles.


texts: Magento is using the default tax rates for NY and CA

texts:
I am having a problem with my magento 1.9.1 deployment.  I have created custom tax rates:

However, I just received two orders with taxes charged based on the default magento tax rules:

Order from New York.  (No taxes should be charged here)

Order form California. (Should be charged 8.5%)

Both of these orders are using the default tax settings out of the box.  I'm not sure where these values are coming from.  I have checked the database tables and don't see anything there.  Any ideas?