texts: How to override Magento 2 REST API Product Search Results for Custom Attributes?

texts:
Magento 2 REST API returns product search results (V1/products) for custom attributes in the following way by default (exemplary product):

{
  ...
  "custom_attributes": [
    {
      "attribute_code": "description",
      "value": "
The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\n
\n
Dual top handles.
\n
Adjustable shoulder strap.
\n
Full-length zipper.
\n
L 29\" x W 13\" x H 11\".
\n
"
    },
    {
      "attribute_code": "image",
      "value": "/m/b/mb01-blue-0.jpg"
    },
    {
      "attribute_code": "small_image",
      "value": "/m/b/mb01-blue-0.jpg"
    },
    {
      "attribute_code": "thumbnail",
      "value": "/m/b/mb01-blue-0.jpg"
    },
    {
      "attribute_code": "required_options",
      "value": "0"
    },
    {
      "attribute_code": "has_options",
      "value": "0"
    },
    {
      "attribute_code": "url_key",
      "value": "joust-duffle-bag"
    }
  ]
}

What to do if I want to return it in the following way:

{
  ...
  "custom_attributes": [
      "description": "value": "
The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\n
\n
Dual top handles.
\n
Adjustable shoulder strap.
\n
Full-length zipper.
\n
L 29\" x W 13\" x H 11\".
\n
",
      "image": "/m/b/mb01-blue-0.jpg",
      "small_image": "/m/b/mb01-blue-0.jpg",
      "thumbnail": "/m/b/mb01-blue-0.jpg",
      "required_options": "0",
      "has_options": "0",
      "url_key": "joust-duffle-bag"
  ]
}

or:

{
  ...
  "description": "value": "
The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.
\n
\n
Dual top handles.
\n
Adjustable shoulder strap.
\n
Full-length zipper.
\n
L 29\" x W 13\" x H 11\".
\n
",
  "image": "/m/b/mb01-blue-0.jpg",
  "small_image": "/m/b/mb01-blue-0.jpg",
  "thumbnail": "/m/b/mb01-blue-0.jpg",
  "required_options": "0",
  "has_options": "0",
  "url_key": "joust-duffle-bag"
}

I will be grateful for working solutions or any clues.


texts: How to disable Ajax Add to Cart on Product page in Magento 2

texts:
Is their a way to disable ajax add to cart only on the product page but keep it working on other pages in Magento 2?

Edit:
After the answer of William. I have checked the addtocart.phtml file but their is no piece of code like he suggested. Their are code available which is as follows:

<?php  if($block->isRedirectToCartEnabled()) : ?>

    <script type="text/x-magento-init">

        {

            "#product_addtocart_form": {

                "Magento_Catalog/product/view/validation": {

                    "radioCheckboxClosest": ".nested"

                }

            }

        }

    </script>

    <?php else : ?>

    <script type="text/x-magento-init">

        {

            "#product_addtocart_form": {

                "Magento_Catalog/js/validate-product": {}

            }

        }

    </script>

    <?php endif; ?>

Please help me to figure it out.
Thanks


texts:
Somehow there have been many (many!) thousands of empty values entered into my 'Manufacturer' attribute. In the admin, if I go to Catalog->Attributes->Manage Attributes and try to load the manufacturer attribute, Chrome actually crashes after trying to load the page for several minutes. I got it to load once in Firefox, but there were too many empty records to delete manually.

If I select * from eav_attribute_option_value in mysql, I can't see any empty records at all...just valid records. So I'm really confused where these empty values are coming from.

Is there a table I am missing?


texts:
I am getting an error in the email that is received. The email has an error at the top and the bottom and it also appears the css isn't styling the template.
Located at the top of the email:
{Error in template processing} {{inlinecss file="email-inline.css"}}
Located at the bottom of the email:
{Error in template processing}
I just cannot seem to find the root of this issue. I am new to magento and need a little assistance. I am using 1.9.0.1 Magento


texts: Magento 2 redirect to a specific store view programatically

texts:
Magento 2 multi site is setup. I want to know redirect programatically to a specific storeview based on country

So I have something like the below however it is not working because I believe the Mage::app code I have is for Magento 1.x and not Magento 2.x ??

 //lets redirect user to a country specific store based on where they are from
$myipaddressis = $_SERVER['REMOTE_ADDR'];
$mycountryis = geoip_country_code_by_name($_SERVER['REMOTE_ADDR']);

if($mycountryis =='FR')
{
    //__store=fr
}
if($mycountryis =='GB')
{
    //__store=uk
}
if($mycountryis =='DE')
{
    //__store=DE
}
if($mycountryis =='US')
{
  $_storeCode = Mage::app()->getStore(2)->getCode();
  $_storeName = Mage::app()->getStore(2)->getName();
  $_storeId = Mage::app()->getStore(2)->getId();
}


texts:
I am having several serious problems on the site and I do not know what the reason may be.
I looked at several topics and did not see who had the same problem. I am not an expert, I bought a template for over a year and now I have seen the problem.

Examples of serious errors on my site:

1) The Shopping cart is being shared by visitors on different computers. (Eg if I add in my computer and / or a friend to refresh or add more articles in his computer, both see the articles entering or leaving the cart)

2) More serious, if I log in with my account, and my friend on his home computer click on the shopping cart or refresh the browser it will also enter my account. (It comes into my account.)

What can it be?

My Magento version is 1.8.1


texts: How to add product to cart with last ordered items options & configurable options in magento

texts:
I am developing a feature by name "Quick Order" in product page where I have to take the custom options and configurable options from the last ordered item and  add the same with the product which I am viewing ..

I tried to use the reorder functionality with some customization but it did not work ..it says "Please specify the product's option(s)."..

If anybody knows the how this can be achieved it will be very helpful ...


texts: Credit memo return to stock adds a quantity to configurable and simple

texts:
When a simple product that is configured to a configurable is bought then refunded and the 'return to stock' check box is ticked, it will return to stock the simple correctly but it will also add a quantity to the configurable product e.g configurable is set to 0 and the simples have their corresponding quantity, but when the refund goes through the configurable gets a 1 in quantity.

I have read that 'return to stock' can not be used when using a payment gateway?

Should my configurable be set to 'manage stock = no'? its currently set to yes as no will not show the 'return to stock' check box therefore can't return the stock back to the simple.


texts:
In M1 we have the option for Authorize.net or Authorize.net Direct Post, in the site I am migrating we use the former.

In M2 this option is missing, how would I go about getting it back?

What is the difference and why is the former no longer there?


texts: How to upload a file attachment to custom product attribute using Magento SOAP

texts:
This is in relation to my question; how-to-get-a-products-file-attachments

I'd like to make a script (not on the server) that can utilize the Intellimage_Attachs module in my other question.

I am going to use Magento SOAP if possible.

The problem I'm having at the moment is I can't get/put/update/w.e the product "samples/files".

return $this->handle->call($this->session,'product_custom_option.list', "productnamehere ");

Brings back a blank array on a product I have attachments on :(! Obviously using the wrong soap call, which one would be the correct one?
(as in product_custom_option.list is incorrect, my function works fine with other calls.)

UPDATE

tried:

return $this->handle->call($this->session, 'product_downloadable_link.list', array( $sku . " "));

But won't work as the products are not downloadable products, even though they use samples.


texts: How to overide ui component form in magento 2?

texts:
I want to add a custom field in cms page form in admin side.
cms_page_form is created by using ui component form. How can I override this form in my custom module?


texts: Unwanted url is coming with magento2 site url

texts:
Whenever I open my website it opens with an unwanted URL like

  www.mysite.com/?SID=gjc3knlipsmuhsbc73j0is36h2.

It should open like

  www.mysite.com/

Why this type of URL is coming. And when I clear cache, then site opens with normal url, but after some time same problem. Please tell me permanent solution of this problem.
Thanks


texts: magento multi store shows only place holder of product images on list view

texts: I have setup multi-store for magento and everything works fine except the list view page, Here I get the place holder of thumbnail images and not the actual images. In between I have chosen the correct website and other admin configuration for the store specific settings. please help me, let me know if anything else to configure.


texts:
I want to get skin URL in Magento Controller. I tried this

  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

but it returns

http://magento_root/skin/

How can I get the URL like the one give below.

http://magento_root/skin/frontend/rwd/default

I need this because I want to set an image path in API response in controller.


texts: Magento 1.9 Add wholesale price column and show wholesale price in products GRID using custom module

texts:
I want to add a Wholesale Price column in products Grid and show Wholesale price in that column.
I want to build it using a custom module. As I do not have much knowledge in Magento 1 so requesting for guidance. Please help.
Magento version 1.9.4.4
Admin Wholesale price field:


texts: Magento2: What is the trigger after order created in Admin

texts:
So as we know the trigger for frontend was

checkout_onepage_controller_success_action

I have an order with specific custom options. Admin should be able to create orders from back-end and add this specific value for custom option to product on order. After payment created (order created successfully) I need to get the input option value of current products.

How do I implement this?


texts: Magento2 : Product added to cart multi stores

texts:
In my sites having two stores A and B, I created stores using symlinks.

When I have added products to the cart in B store it added but at the same time products added to mini cart in A store as well.

Why it is showing like this?


texts:
How to achieve the below getParams() in Magento2?

$params = Mage::app()->getRequest()->getParams();


texts: Magento 1.9.3 Get OrderID from order view programmatically

texts:
I need to add my own function on Order View page, but how can I get the orderID programmatically on the current order I'm viewing?

I have tried this code so far, which is triggered when Adding Order Comment

public function commentSaveAfter($observer)
{
    $orderIds = $observer->getEvent()->getOrder()->getId();
    $from_shipment = false;
    if (!empty($orderIds))
    {

    }
}

it gives me an error,

Fatal error: Call to a member function getId() on null in


texts: error while installing magento on localhost

texts:
hello,i am new to magento and i installing magento2 on local,but i got the following error while i am installing magento on local server,even i installed composer on my system too but still it gives error when i execute this by command prompt.

now after following your step i got this error


texts: Show icon over images on specific category listing only

texts:
I'd like to show an icon only in my 'shoes' category listing page (ID: 3).

I've put in place the PHTML which will create the icon in the list.phtml file. But currently it appears in all categories, I want it to appear in just the category 'shoes' which has the ID: 3.

Here's my current code in catalog/product/list.phtml

Can anyone please suggest an edit to make this show only in the specific category?


texts: Don't know how to re-build javascript file

texts:
Problem

I'm currently seeing all of my javascript bundled into a single file, and then served from this file:  $MAGENTO_ROOT/media/js/276342d53ebc2b88700c238821ff7e8d-v2.18.js

I see this as a GOOD thing, however I'm not sure how to rebuild the file with updated code.

For example, I have a file in my source tree like this:

/skin/frontend/responsive/<sitename>/js/<namespace>/<module>/<module>.js

I can see that the contents of the <module>.js are embedded inside 276342d53ebc2b88700c238821ff7e8d-v2.18.js, but for some reason when I make changes to <module>.js they aren't reflected in 276342d53ebc2b88700c238821ff7e8d-v2.18.js even though I'm deleting it 276342d53ebc2b88700c238821ff7e8d-v2.18.js completely.  It just re-appears.  So apparently there is some other temporary cache holding on to it?  I've even tried flushing all the caches in Magento admin including clicking the "Flush Magento Cache" button and the "Flush JavaScript/CSS Cache" button.  Still, the same .js is returned.

Question

Any ideas?  Is there another directory on my disk that I should delete perhaps?

UPDATE #1

I also tried turning off System=>Configuration=>Advanced=>Developer=>Merge Javascript but the file is still coming back as 276342d53ebc2b88700c238821ff7e8d-v2.18.js when I fetch the page!

This brings up a related question. In my System=>Cache Management page, I see two buttons at the top "Flush Magento Cache" and "Flush Cache Storage".  The first one I've been using to flush the cache, but the second one has a warning "Cache storage may contain additional data. Are you sure that you want flush it?" so I've never actually done that.  What is the difference between these two?


texts:
Menu is not going to hide when I click on menu and if there is no link to another url (I am using #). How to hide the menu container (class="menu-box")

            <a href="<?php echo $this->getUrl('');?>" title="<?php echo $this->__('Home'); ?>" class="home_link"><?php echo $this->__('Home'); ?>&nbsp;

<a href="<?php  echo $this->getUrl('').'#viewproductlist'; ?>">View Products

<a href="<?php  echo $this->getUrl('').'delivery-and-returns'; ?>">Delivery & Returns

                    <a href="<?php  echo $this->getUrl(''); ?>">Product Advice

<a href="<?php  echo $this->getUrl(''); ?>">Services

<a href="<?php  echo $this->getUrl('').'about'; ?>">About Us

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

<a href="<?php  echo $this->getUrl('').'contact-to-us'; ?>" class="linkcontactico">Contact Us

            <?php //echo $this->getChildHtml('checkoutLinks') ?>
            <?php echo $this->getChildHtml('accountLinks') ?>

<div class="cart-icon fr <?php echo $this->getInCart() ? 'active' : '' ?>">
    <a href="<?php  echo $this->getUrl('checkout/cart'); ?>"><?php  echo $this->getChildHtml('topCart') ?>

I have mentioned '#viewproductlist' as href in one of the menu from menu list. And this will link to same page.


texts: Display x amount of products from category x in right / left block (similar to related products)

texts:
I'd like to display 4 random products from a specific category on the right hand side of my product page. The effect I'd like to achieve is exactly like the Related Products and Compare Products block that appear under those conditions.

So far I've taken the code from related.phtml and placed it in another file and updated my templates layout.xml.

However looking at the code, I cannot see where I would call a category or specify how many products to display.

How can I use the related.phtml file as a template to display 4 random products from a specific category in the right block?


texts: Programmatically create return - Enterprise

texts:
What function can be used to create a return in Magento Enterprise (RMA module).

It seems that all the regular functionality is built using the  $_POST variable, what if the data is being pulled from a third party, is there an easy way to do this without submitting a form


texts: I want Country of Manufacture in my filter. I am Using Magento 2


texts:
I am having an issue in my Magento installation where changes to .phtml files are not reflected on the frontend. I've verified that I am editing the right .phtml file by enabling the debug options for template hints. I've also cleared all Magento and Browser cache. Is there anything else I can do in addition to this to get frontend changes to show up?

Edit: The location of the file is

app/design/frontend/hewa/newdesign/template/catalog/category/sidebar/navigation.phtml

The line from the XML that defines this template is

<block type="hwcatalog/category_sidebar_navigation" name="catalog.sidebar.nav" after="currency" template="catalog/category/sidebar/navigation.phtml"/>

The layout xml file is located at

app/design/frontend/hewa/newdesign/layout/hwcatalog.xml

Here is the relevant section of the XML.

<catalog_category_layered>
    <remove name="category.products"/>
    <remove name="catalog.leftnav"/>

    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
    <reference name="left">
        <block type="hwcatalog/category_sidebar_navigation" name="catalog.sidebar.nav" after="currency" template="catalog/category/sidebar/navigation.phtml"/>
    </reference>
    <reference name="content">
        <block type="catalog/category_view" name="category.product.list" template="catalog/category/view.phtml">
            <block type="core/template" name="restricted" template="catalog/restricted.phtml" />
            <block type="hwcatalog/product_list_category" name="product_list">
            </block>
        </block>
    </reference>
</catalog_category_layered>

Here is the setting from the module's config.xml that points to the layout xml

<frontend>
    <layout>
        <updates>
            <hwcatalog>
                <file>hwcatalog.xml</file>
            </hwcatalog>
        </updates>
    </layout>
    <routers>
        <catalog>
            <args>
                <modules>
                    <Hwareh_Catalog before="Mage_Catalog">Hwareh_Catalog</Hwareh_Catalog>
                </modules>
            </args>
        </catalog>
    </routers>
    <events>
        <controller_action_layout_load_before>
            <observers>
                <add_additional_handle_on_product_view_page>
                    <class>Hwareh_Catalog_Model_Observer</class>
                    <method>addAdditionalHandleOnProductViewPage</method>
                </add_additional_handle_on_product_view_page>
            </observers>
        </controller_action_layout_load_before>
    </events>
</frontend>


texts: Replace special characters in catalog image names after upload

texts:
Germans have some special characters like ä, ü, ö and ß. They aren't very search engine friendly, so I want to replace them in the file names of uploading catalog images. That sounds not that complicated, I know... but:

Responsible for actions like that is the method getCorrectFileName() in the class Varien_File_Uploader, which looks like this:

/**
 * Correct filename with special chars and spaces
 *
 * @param string $fileName
 * @return string
 */
public function getCorrectFileName($fileName)
{
    $fileName = preg_replace('/[^a-z0-9_\\-\\.]+/i', '_', $fileName);
    $fileInfo = pathinfo($fileName);

    if (preg_match('/^_+$/', $fileInfo['filename'])) {
        $fileName = 'file.' . $fileInfo['extension'];
    }
    return $fileName;
}

We could simply extend it with strtr() or str_replace() or even preg_replace() before the original preg_replace() which could looks like this:

$fileName = strtr($fileName, [
    'Ä' => 'Ae',
    'ä' => 'ae',
    'Ö' => 'Oe',
    'Ü' => 'Ue',
    'ü' => 'ue',
    'ß' => 'ss',
]);

But no matter which of these functions I use, it ignores the special characters in the file name. When I'm overriding $fileName at the beginning with a string like "täst-file.jpg" everything works fine..

My first idea was an encoding issue, so I tried to convert the string to UTF-8, but mb_detect_encoding($fileName, 'UTF-8', true) said it was already a valid UTF-8 encoded string and I ran out of ideas..

Does anyone know what I'm doing wrong or what a solution for this problem is?

Thanks in advance. :)


texts: How can I show the same product multiple times in the shopping cart?

texts:
I don't want to set a min qty, customers should be able to buy many of the same product. But I would like to make it explicitly clear they have added more than qty=1 to their cart.

I've unsuccessfully dug around into enough nooks of the Mage core to believe this is anything trivial. But maybe it is? Anyone have an idea how I might approach this..

Thanks, Kev


texts: Customer Class Rewrite Magento Enterprise Edition

texts:
I am facing a strange issue. Bascially I need to rewrite the customer authentication logic. So as to rewrite authenticate() method I have created a small module. The code for the module is as below:

Config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Nutricentre_Customermigration>
            <version>0.1.0</version>
        </Nutricentre_Customermigration>
    </modules>
    <global>
        <models>
           <customer>
               <rewrite>
                   <customer>Nutricentre_Customermigration_Model_Customer</customer>
               </rewrite>
           </customer>
       </models>
    </global>
</config>

Customer.php

<?php
class Nutricentre_Customermigration_Model_Customer extends Mage_Customer_Model_Customer{
     public function authenticate($login, $password){
        echo $login;
        die;
     }
}

The rewrite works perfectly fine with Magento Community Edition but its not working on my Enterprise Copy.

Is there any change in rewrite logic for enterprise edition? Any ideas will be appreciated.


texts: Package sjparkinson/static-review is abandoned message in Magento 2

texts:
I am using the command to upgrade 2.2.2 but getting this problem, how can I do,
thank you!please help!

  composer update

  Running composer as root/super user is highly discouraged as packages,
  plugins and scripts cannot always be trusted

  Loading composer repositories with package information

  Updating dependencies (including require-dev)

  Nothing to install or update

  Package sjparkinson/static-review is abandoned, you should avoid using
  it. Use phpro/grumphp instead.

  Generating autoload files

update

composer require sjparkinson/static-review
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted Using version ^5.2 for sjparkinson/static-review ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - magento/product-community-edition 2.2.2 requires sjparkinson/static-review ~4.1 -> satisfiable by sjparkinson/static-review[4.1.0, 4.1.1] but these conflict with your requirements or minimum-stability.
    - magento/product-community-edition 2.2.2 requires sjparkinson/static-review ~4.1 -> satisfiable by sjparkinson/static-review[4.1.0, 4.1.1] but these conflict with your requirements or minimum-stability.
    - magento/product-community-edition 2.2.2 requires sjparkinson/static-review ~4.1 -> satisfiable by sjparkinson/static-review[4.1.0, 4.1.1] but these conflict with your requirements or minimum-stability.
    - Installation request for magento/product-community-edition 2.2.2 -> satisfiable by magento/product-community-edition[2.2.2].

Installation failed, reverting ./composer.json to its original content.


texts: PHP - How to get custom customer attribute

texts:
I am using Magento 1.9.0.1 and i have installed this module: http://www.magentocommerce.com/magento-connect/manage-customer-attributes.html

I've created attribute with attribute code sms_promo

My question is how can i select this attribute information in PHP ?


texts:
How to add image in controller success message right now its showing only message i want to add image with success message in controller

 echo "

";
    $this->_getSession()->addSuccess(
        $this->__('Your Success message')
    ) ;


texts: whenever i do any change in xml file i need to remove pub/static folder then it works

texts: I am trying to do some change in default.xml but whenever i do any change in xml layout i have to clear cache and remove pub/static folder var/cache folder . is there any way to skip these steps and to  speedup development. I have tried development mode , production mode but i am not getting any solution of this .server is ubuntu local. and magento 2.3 community is there anything i am able to do to speedup the development process .


texts: Change or extend, the behavior of save button product in Magento 2

texts:
help with the following.

I have to add more functionality to the save button product, checking I found that you can do with plug-ins that provides Magento2.

As I can change or extend the functionality or performance of the save button product in Magento 2?.

What is the class to observed?.


texts: Magento 2 - Stock inventory qty cache problem

texts:
I can successfully updated the inventory qty in my custom module using the following lines of code. But the old value is still cached and displayed. I have already added cacheable="false" in the layout xml .

But it does not work. How to flush the cache after I have updated the value? What is the proper way to do this?

I now disable the full page cache for a workaround.

$stockItem = $this->stockRegistry->getStockItem($product->getId());
$stockItem->setData('qty',$qty-1);
$stockItem->save();
$product->save();


texts:
I need to create two stores pragmatically using declarative schema. To do this, I created a module and inside the module I have date patch class.
I'm new here in magento.
Please explain in order how I can create a store from this and use the * declarative schema * in it. Then I will need to make the necessary configurations for each store.
Thank you in advance.


texts:
I do have 3 shipment methods set up in the admin and set to Active: Tables Rates, Free Shipping and Flatrate.

After adding a product to the cart and going to the One Page Checkout, all three are being listed. When I check "Flatrate", click through to the Order summary, and go back to the shipping method to choose another one and again proceed to the Order summary, it tells me that the shipping method is invalid - all of a sudden - when checkout/onepage/saveShippingMethod is fired.

This error is triggered in public function saveShippingMethod($shippingMethod) because $this->getQuote()->getShippingAddress()->getShippingRateByCode($shippingMethod);
is not returning a $rate.

What's weird is that even though I selected Flat Rate Shipping it didn't list the Flatrate shipping costs in the order summary.

After reloading the one-page checkout page, the only shipping method available is "Free shipping". The others are gone.

I'm running Magento 1.8.0 and I'm out of ideas.

The system.log and exception.log are empty. Changing the theme to the modern default theme doesn't have any effect. Anyone can confirm this behavior in Magento 1.8.0?


texts: Geting Fatal error: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

texts:
For a long time my Magento application was working fine. But suddenly it started showing this below error.

Fatal error:
Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /home/serverDir/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/serverDir/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/serverDir/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/serverDir/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/serverDir/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/serverDir/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('insert into csv...', Array)
#5 /home/serverDir/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('insert into csv...', Array)
#6 /home/serverDir/public_html/app/code/local/namespace/module/Model/Observer.php(638): Varien_Db_Adapter_Pdo_Mysql->query('inser in /home/serverDir/public_html/lib/Zend/Db/Statement/Pdo.php on line 234

I searched all about this over internet, But could not find the solution.

Please guide me as to why suddenly it started showing this fatal error.


texts: PHP Fatal error: Cannot redeclare __() (previously declared in /vendor/magento/framework/Phrase/__.php:15) in /app/functions.php on line 23

texts:
Hello I am facing the issue after upgrade from 2.2.6 to 2.3.0
Can you suggest what is needed to be modified?

file __.php :

<?php

declare(strict_types=1);

function __()
{
  $argc = func_get_args();

$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
    $argc = $argc[0];
}

return new \Magento\Framework\Phrase($text, $argc);
}

2.file - functions.php:

$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
    $argc = $argc[0];
}

return new \Magento\Framework\Phrase($text, $argc);
}


texts: How to get associated event name from observer

texts:
Say I have an observer, and I want to get the name of the event that's associated with it. What's the proper way to get this string, if it's possible?

e.g. customer_save_after or controller_action_predispatch_customer_account_createpost, etc.


texts: Invisible, not transparent images for inactive attribute options in Configurable swatches

texts: I use the same attribute "color" for different "textures" of the product. I am using configurable swatches with magento default rwd theme. The problem is, when a certain texture in frontend is selected, ALL the colors are displayed, those that are not used are transparent. My question is: can I make them invisible or not shown at all?


texts:
I create few contacts forms in Magento for example I have Contact1.phtml / Contact2.phtml / Contact3.phtml is there any way to setup transnational email for each contact form?

Right now I use only one transactional email for all with if statement, But I see a lot of blank spaces where the field not exist and is very ugly. The email now is look like this:

Thank you


texts: Country name missing magento 2 checkout page billing address section

texts:
Country name is missing on magento 2 checkout page billing address section
can anyone know the solution of this issue magento version is 2.3.5


texts: how to customize email template with header and footer of site?

texts:
I am sending a mail to users related to product now i want to design it according to site like header and footer should be site. and middle content will customize. What is the process for doing this?

thanks for any advice


texts: How to create a different theme specific 404 page in magento?

texts:
I have two themes called desktop and iphone.
In desktop the 404 page is created in the admin side cms page.
How can I create another 404 error page for the iphone theme only?
so that I can put some information for the iphone theme only.


texts: Magento : How to Change Shipping Tax Class Programmatically in Checkout

texts: I have a website in Magento 1.9 in which I have already configured a tax class for shipping rate from admin side. I want to change the tax rate for shipping if my cart contains some specific type of products and recalculate the total after the shipping tax class update. Is there any event for this or I need to override any core files?


texts: 401 unauthorized due to directory protection on magento 2 project

texts:
Is there a way to pass basic authorization and bearer authorization in postman for accessing Magento 2 rest api's. I have defined the directory protection using .htaccess and .htpassword.
For getting a token I can pass basic auth to get a token. But to use that token in other rest calls I need to pass the token using bearer in Authorization
When I submit a call it says 401 unauthorized. It is due to the directory protection credentials when the are not supplied. I need to know either we could bypass or is there a way we could both pass basic and bearer authorization for testing in postman or something to do in .htaccess file.

In short directory protection is for Magento 2 store and I need this, but for api's is there any solution to handle this?


texts: Magento 2.3 don't show products if price is 0

texts:
Is there a way to hide products that have the price at 0?

I tried with this Plugin but it shows the same all the products even those at price 0.

<?php

namespace Vendor\Namespace\Plugin;

use Magento\Catalog\Block\Product\ListProduct;
use Magento\Eav\Model\Entity\Collection\AbstractCollection;
use Magento\Framework\Exception\LocalizedException;

/**
 * Class ListProductPlugin
 */
class ListProductPlugin
{

    /**
     * @param ListProduct $subject
     * @param AbstractCollection $resultCollection
     * @return AbstractCollection
     * @throws LocalizedException
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function afterGetLoadedProductCollection(
        ListProduct $subject,
        AbstractCollection $resultCollection
    ) {
        $resultCollection->addAttributeToSelect('price');
        $resultCollection->addAttributeToFilter('price', ['gt' => 0]);

        return $resultCollection;
    }
}

Could anyone point me to the right direction?

Thanks


texts:
I have upgraded from magento 1.8 to 1.9 one month back.

In a module, I have a crontab describing a cron job to execute a function to cancel order automatically after 5 days if the status of the order remains HOLD. Since a year, this was not working and suddenly, few days back it ran and cancelled all the orders satisfying the condition and again it stopped working.

I am not getting like what could be the issue that it worked for the first time ever suddenly.

Is there anyone having any idea on this?


texts:
I am using below code to add BCC:

$transport = $this->_transportBuilder->setTemplateIdentifier($template)
                ->setTemplateOptions(['area' => 'frontend', 'store' => $store])
                ->setTemplateVars($templateVars)
                ->setFrom('sales')
                ->addTo($copy_to)
                ->addBcc('test@test.com')
                ->getTransport();
                $transport->sendMessage();

->addBcc('test@test.com') adds email ID to TO instead of adding it to BCC.


texts: CSS stopped working in my Magento 2 theme

texts:
I had been trying to set up a theme in Magento 2 several weeks ago and now when I try to continue the work, it seems that the CSS on the site has stopped working for my theme. The site loads without any CSS at all.

I have tried to clear the cache (and CSS merged cache) but it is still not working.

As I am still trying to get LESS figured out, I am wondering whether it might be some css I have changed which causes LESS to crash. Is there any way to determine if LESS is not working or what else the issue might be?


texts:
I am planning to build API's.

Which is better GraphQl or REST API?

How easy to customize either as per the developer perspective view?

https://www.howtographql.com/basics/1-graphql-is-the-better-rest/


texts:
For the last 8 days I've not been getting any order information from PayPal when a customer purchases something.

I've checked my IPN settings in my PayPal account and in the history log it shows:

HTTP response code 503

Delivery status Failed

My notification URL is https://example.com/paypal/ipn/

I've also tried it without https and with the www

I'm using PayPal Website Payments Standard. There's no errors in my logs and no paypal log (as the request obviously isn't reaching Magento.

I've whitelisted the PayPal domain on the server firewall.

I've upgraded Magento from 1.9.2.3 to 1.9.2.4 but that hasn't helped either.

When I check the URL with a server header checker I get a 200 response.

PHP Version 5.3.23

How else can I debug what's going on?


texts: Magento theme displays errors and responsive display after refresh

texts:
We have a Magento webshop (1.9.3.2) with Ultimo theme, which appears to have some strange problem in a few browsers - we've discovered it's only on Chrome and Opera so far. When you first watch the website (https://www.tuinkussengigant.nl) in Chrome, it displays correctly with no JS errors. When you refresh the page, the website changes to some weird responsive mobile view and suddenly JS errors show up too.

We've looked at the page resource of both versions (the correct one and the weird responsive view), but both of them are exactly the same. We have no idea where to look for what's wrong.

The only thing we could already find, was the JS noconflict thing, but that's already in one of the included .js files Magento minified, so that's not the case either.

Can somebody please push us into the right direction of where to look on how to solve this problem? Has it something to do with the async of the js file, since it's only after a refresh and not when the page is first loaded with CTRL+F5 for example?

Thanks in advance.


texts: Magento 2: unable to override form.phtml of review

texts:
I need to override the form.phtml in order to add a custom field, but I don't know why but it is not working.

Here is what I did:

/namespace/modulename/view/frontend/layout/catalog_product_view.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="review_product_form_component"/>
    <body>
       <referenceBlock name="product.info.details">
            <block class="Magento\Review\Block\Product\Review" name="reviews_tab" as="reviews" template="RLTSquare_ProductReviewImages::review.phtml" group="detailed_info">
                <block class="Magento\Review\Block\Form" name="review_form" template="RLTSquare_ProductReviewImages::form.phtml" as="review_form">
                    <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/>
                </block>
            </block>
        </referenceBlock>
    </body>
</page>

and then my form.phtml in: /namespace/modulename/view/frontend/templates/form.phtml

I'm using this module. Everything works, except the form.phtml.

...Just so you know, here was the original catalog_product_view.xml.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="RLTSquare_ProductReviewImages::rltsquare_productreviewimages.css"/>
    </head>
</page>

Please, help me!

Thanks!


texts: Is repo.magento.com's Source Available Anywhere?

texts:
Magento 2's composer repository, http://repo.magento.com, appears to be a session-ed composer repository.  That is, different users have access to different packages based on the HTTP Auth credentials.

Does anyone know of an off the shelf project that lets you host similar repositories? More specifically, does anyone know if Magento used off the shelf software to implement this, or if its a custom application?


texts: After upgrading from 1.7 to 1.9 - The address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract

texts:
I just upgraded our Magento instance from v1.7 to v1.9. And one of the stores websites is now receiving an error when the cart gets updated:

  The address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract.

I came across this similar SO post, where the OP encountered the same error, but it looks like it was caused by a different problem.

I grepped for the string The address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract., and can see it originates from the file base/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php. Here's the method containing the logic throwing the error:

    /**
     * Init model class by configuration
     *
     * @param string $class
     * @param string $totalCode
     * @param array $totalConfig
     * @return Mage_Sales_Model_Quote_Address_Total_Abstract
     */
    protected function _initModelInstance($class, $totalCode, $totalConfig)
    {
        $model = Mage::getModel($class);
        if (!$model instanceof Mage_Sales_Model_Quote_Address_Total_Abstract) {
            Mage::throwException(
                Mage::helper('sales')->__('The address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract.')
            );
        }

        $model->setCode($totalCode);
        $this->_modelsConfig[$totalCode]= $this->_prepareConfigArray($totalCode, $totalConfig);
        $this->_modelsConfig[$totalCode]= $model->processConfigArray(
            $this->_modelsConfig[$totalCode],
            $this->_store
        );

        return $model;
    }

I took the advice posted in the other thread and dumped the content of $model to see what class it was actually an instance of, the result:

object(Mage_Sales_Model_Quote_Address_Total_Nominal)#358 (5) {
  ["_code":protected]=>
  NULL
  ["_address":protected]=>
  NULL
  ["_canAddAmountToAddress":protected]=>
  bool(true)
  ["_canSetAddressAmount":protected]=>
  bool(true)
  ["_itemRowTotalKey":protected]=>
  NULL
}

So the Mage_Sales_Model_Quote_Address_Total_Collector::_initModelInstance()
method within base/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php is requiring the $method to be an instance of Mage_Sales_Model_Quote_Address_Total_Abstract, but it's actually an instance of Mage_Sales_Model_Quote_Address_Total_Nominal.

After grepping around for a bit, I can see that the Mage_Sales_Model_Quote_Address_Total_Nominal class is declared within the base/app/code/core/Mage/Sales/Model/Quote/Address/Total/Nominal.php file, and when I open it up, I see:

class Mage_Sales_Model_Quote_Address_Total_Nominal extends Mage_Sales_Model_Quote_Address_Total_Abstract
{

Mage_Sales_Model_Quote_Address_Total_Collector::_initModelInstance() is requiring $method to be an instance of Mage_Sales_Model_Quote_Address_Total_Abstract, but it's actually an instance of Mage_Sales_Model_Quote_Address_Total_Nominal, which is an instance of Mage_Sales_Model_Quote_Address_Total_Abstract.

So instead of:

  Mage_Sales_Model_Quote_Address_Total_Abstract -> $method

It's:

  Mage_Sales_Model_Quote_Address_Total_Abstract -> Mage_Sales_Model_Quote_Address_Total_Nominal -> $method

I'm not quite sure what to make of this. The abstract class is being extended, it's just one "level" further back than it's expected to be.

Any input or suggestions would be greatly appreciated.

Thanks!


texts:
I have two products from different category in my cart.

Product |  Price |    Category

Bike   |  $1000   |  Two wheeler

Car    |  $2000   |  Four wheeler

I have created a coupon code OFF10 (10% off) and set only apply to Category Two wheller.

When I apply this coupon in my cart. This should detect $100 only, but it detects $300.

Can anyone helps me how to solve this problem.

Note:
When I try to apply the same coupon code when I have only Car in my cart, it through error that wrong coupon code.


texts: Grey stripe started running through all my images

texts:
I've recently encountered a bizarre situation where a grey bar started showing up through all my generated images. The original image is clean and as it is being compressed a gray bar is added to all of the small images, thumbnails etc.

I've not altered any of the CSS and am pulling from parent Blank. I switched back to the parent theme to test if it was something in the theme. I also reverted back my files to when my images did not have the grey bar running through them. Neither of these efforts resolved the issue.

I had the DB reverted back to the date when the images were clean and this did fix the issue.

This made me quite curious to figure out what about the DB was causing the grey bar as I am about to begin importing products again and also would like to go to a flat catalog as I heard would make for a faster user experience.

In developer mode I switched to flat files but double checked and all seemed to be fine. It was only when I started importing products again after switching to flat file that this issue began. I am wondering if there is something in my import that could have caused this with having moved to flat files? Or if anyone out there might know how images are compressed and how reverting the DB might have fixed this issue.


texts: M2.2.4 Checkout: Adding New Shipping Address automatically sets address as Billing Address

texts:
When adding a new address to the shipping address list on the first part of the onepage checkout, I have noticed that it will automatically set the new shipping address as the billing address on the payment step.

This is not what I am looking for as it is intended for B2B and needs to maintain the same set billing address at all times, regardless of added shipping addresses. So even removing the billing address altogether from the checkout would be sufficient.

Any ideas?

If you pick an already set address, go the the next step, the billing is fine, and then going back and adding a new one, the billing is still fine. This issue only occurs when first initially loading the checkout page, immediately creating a new address and then moving onto the payment page, the billing is now changed to the newly created shipping address.

Would anyone know where or why this new address is being called from?

Thanks

EDIT:

I found the location of the New Address form, however it doesn't seem to have any indication anywhere that would make it end up being forced as the billing address.

/vendor/magento/module-checkout/view/frontend/web/template/shipping-address/form.html

Also saw this post: Magento 2 : Default billing address not selected by default on checkout page

Tried their method as well, to no avail.

EDIT 2:

I have found that

/vendor/magento/module-checkout/view/frontend/web/js/view/billing-address.js

appears to be where all the inner workings are, however I'm not sure what to change to essentially force the checkout to always use the default billing address of the account.


texts: DataFlow Export Duplicate SKUs in SKU Field

texts: I use the DataFlow Import/Export on a daily basis for updating product information. Last week we upgraded to the new 1.9.2 from 1.9.1 and besides the many other issues this upgrade has caused, now I am getting duplicates SKUs exporting and when I try to import to update pricing, the import freezes. I've attached an image!


texts: What are the preferred server resources needed to run a magento 2 ecommerce site? php memory limit, virtual and physical memory? ,

texts: When updating magento to 2.3, warning was given to set php memory to a minimum of 2048. Wondering what the preferred settings/resources are and if hosting on a shared server is fine.


texts:
This is current code for short description in default list.phtml

  <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>

Now instead of this short_description I want  to print quantity in list page.


texts: InstallSchema.php not working in magento2

texts:
I have been trying to create a table from InstallSchema.php, but some reason the table is getting created. I haved created a bare minimum module with the following files.

1. registration.php

    <?php
    /**
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */

    \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::MODULE,
        'Rehan_Test',
        __DIR__
    );

2. etc/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="Rehan_Test" setup_version="1.0"/>
     </config>

3. Setup/InstallSchema.php

    <?php
    /**
     * Copyright © 2016 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */

    namespace Learning\GreetingMessage\Setup;
    use Magento\Framework\Setup\InstallSchemaInterface;
    use Magento\Framework\Setup\ModuleContextInterface;
    use Magento\Framework\Setup\SchemaSetupInterface;

    /**
     * @codeCoverageIgnore
     */
    class InstallSchema implements InstallSchemaInterface
    {
        /**
         * {@inheritdoc}
         * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
         */
        public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
        {
            /**
             * Create table 'greeting_message'
             */
            $table = $setup->getConnection()
                ->newTable($setup->getTable('greeting_message'))
                ->addColumn(
                    'greeting_id',
                    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                    null,
                    ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
                    'Greeting ID'
                )
                ->addColumn(
                    'message',
                    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                    255,
                    ['nullable' => false, 'default' => ''],
                    'Message'
                )->setComment("Greeting Message table");
            $setup->getConnection()->createTable($table);
        }
    }

    ?>

After all this, I try to run the upgrade command like so

**sudo php bin/magento setup:upgrade**


texts: Declare javascript variable in observer method

texts:
I got some great advice on how to create a module to specify the price of a product when it is added to cart here: Dynamically calculated prices save before add to cart

I have a custom script within configurable.phtml that determines the price of an item depending on the configurable attributes (and other details). I need to pass this price string into the module's method within the Observer.php. How would I do this?

The /app/code/local/{namespace}/{yourmodule}/etc/config.xml:

<config>
    ...
    <frontend>
        ...
        <events>
            <checkout_cart_product_add_after>
                <observers>
                    <unique_event_name>
                        <class>{{modulename}}/observer</class>
                        <method>modifyPrice</method>
                    </unique_event_name>
                </observers>
            </checkout_cart_product_add_after>
        </events>
        ...
    </frontend>
    ...
</config>

The Observer class at /app/code/local/{namespace}/{yourmodule}/Model/Observer.php (see comment next to $price declaration):

 class <namespace>_<modulename>_Model_Observer
{
    public function modifyPrice(Varien_Event_Observer $obs)
    {
        // Get the quote item
        $item = $obs->getQuoteItem();
        // Ensure we have the parent item, if it has one
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
        // Load the custom price
        $price = "your custom price logic"; //I need the value generated in the javascript here
        // Set the custom price
        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);
        // Enable super mode on the product.
        $item->getProduct()->setIsSuperMode(true);
    }

}

The javascript function that declares price (I need this in module observer):

function selectAndAddToCart(value)
{
    var product_id= <?=$product_id ?>;
    var colorSelected = $j("#attribute92 option:selected").val();

    $j('#attribute136 option[value="' + value + '"]').prop('selected',true);

    $j('#attribute136').removeClass('validation-failed').addClass('validation-passed');

    var price = newPriceArray[value][colorSelected]; //the value I need to pass to module
    console.log('The newPriceArray in selectAndAddToCart ' + price); //this is logging correctly

}


texts: Catalog Search is not getting the Accurate Search Result Magento 2.3.5

texts:
In Magento 2.3.5 the catalog search result is not accurate i trying to get the accurate search result in the Frontend search. So i tried some ways

Catalog reindex
Removed the Unwanted attribute searching at the time of catalog search.
Increased the Search Weight for Product Name and SKU Attributes.

Still i can't get the perfect search result if i searched the product name the name product is coming at the end of page or it is going to next paginations but unwanted products are coming at first. How can we solve this problem in Magento 2.3.5
Thankyou


texts: magento import not working for products set with visibility of 1 (not visible individually)

texts:
I have a spreadsheet which I use to import my simple products. Originally, I only had products on there which had their visibility set to 1 (not visible individually) - as they were meant to be associative products for my configurables - and they uploaded perfectly.

Recently, however, I have added on products with visibility set to 4 and the import - though showing no errors - only seems to import those products which are set to 4 and not those set to 1!

Moreover, the same spreadsheet doesn't seem to work anymore even when it contains only products set to 1 as it had before. The import shows no errors but the products do not upload at all (not on the frontend and not on the backend).

The products set to 4 and set to 1 are otherwise identical.


texts: How to remove header footer from particular page in Magento 2

texts: I don't want header and footer from some particular page so how can I do this.


texts: Add product to cart with custom option using PHP

texts:
I am trying to add a product to the cart programmatically with some custom options. The item gets added to the cart correctly but none of the options ever get added. My code is:

require_once '../../app/Mage.php';
umask(0);
/* not Mage::run(); */
Mage::app('default');

Mage::getSingleton("core/session", array("name" => "frontend"));

$product_id = 2364;
$id_opt_value = 6072;
$final_opt_value = 6074;

$product = Mage::getModel('catalog/product')->load($product_id);
$cart = Mage::getModel('checkout/cart');
$cart->init();
$params = array(
    'product' => $product_id,
    'qty'     => 1,
    'options' => array(
        $id_opt_value => '123456',
        $final_opt_value => 'black gloss finish',
     )
);

$cart->addProduct($product, $params);
$cart->save();

I have double checked and the option values are correct. I am using magento ce-1.9.0.0


texts: M2.3.5 Order Confirmation Email - product upload file link not rendering a tag

texts:
I've recently updated to version 2.3.5 and when order confirmation emails are sent the link to the uploaded file used to work correctly but is now showing the a tag rather than rendering a link, I'm struggling to find why this is happening?
Below is the source code from an email, in my theme I've made no changes to the email design and it's based on the blank theme.
Upload a File or Image

&lt;a href=&quot;https://www.example.com/sales/download/downloadCustomOption/id/624/key/caeebb9b/&quot; target=&quot;_blank&quot;&gt;B75856C.png&lt;/a&gt; 229 x 292 px.


texts:
I have set catalog_product_save_after for the tracking the status of product, but it's run every time when we save the product without change any status of it. can anyone please suggest me the better way to call it only if we change product status.

thank in advance!.


texts:
After installing Magento 2.3 on the server, when I run the URL I am receiving 404 for pub/static.

I have given proper permission to magento folders. Also set ownership to apache for the codebase.

Now, while looking into pub/static folder, I found the user & group is set to root instead of apache. Is this causing issue to load the static content in Magento? If so, how can I set the ownership of newly created folders?

Please advise.


texts: Magento 2 Show checkbox checked in grid edit mode depending upon value?

texts:
I have 2 checkboxes
$fieldset->addField(
        'call_me_in_morning',
        'checkbox',
        array(
            'name' => 'call_me_in_morning',
            'label' => __('Call me in morning'),
            'title' => __('call me in morning'),
            'data-form-part' => $this->getData('career-form'),
            'onchange'   => 'this.value = this.checked ? 1 : 0;',

        )
    );
    $fieldset->addField(
        'call_me_in_aftenoon',
        'checkbox',
        array(
            'name' => 'call_me_in_aftenoon',
            'label' => __('Call me in aftenoon'),
            'title' => __('call me in aftenoon'),
            'data-form-part' => $this->getData('career-form'),
            'onchange'   => 'this.value = this.checked ? 1 : 0;',

        )
    );

Getting right values for both checkboxes.
You can see in following image
Getting value = '1' for 1st
and value = '0' for second
But when I'm going to edit row of grid then it remains unchecked.
What should I do to show checked whose value = '1'
Note : Highlited box in inspect element is for 2nd checkbox and  for 1st is above it.


texts: How to call functions in ui_component Magento 2

texts:
I have created two dynamic rows one by DataProvider way and one by ui_component.In Ven\Mod\Ui\DataProvider\Product\Form\Modifier\MyField getting currency symbol with this function.
In dynamic rows children I added:
'children' => [

            static::FIELD_PRICE_NAME => $this->getPriceFieldConfig(30)

        ]

and defined function as:
protected function getPriceFieldConfig($sortOrder)
{
return [
    'arguments' => [
        'data' => [
            'config' => [
                'label' => __('Amount'),
                'componentType' => Field::NAME,
                'component' => 'Magento_Catalog/js/components/custom-options-component',
                'formElement' => Input::NAME,
                'dataScope' => static::FIELD_PRICE_NAME,
                'dataType' => Number::NAME,
                'addbefore' => $this->getCurrencySymbol(),
                'addbeforePool' => $this->productOptionsPrice->prefixesToOptionArray(),
                'sortOrder' => $sortOrder,
                'validation' => [
                    'validate-number' => true
                ],
            ],
        ],
    ],
];
}

and defined

'addbefore' => $this->getCurrencySymbol(),

function as:
protected function getCurrencySymbol()
{
    return $this->storeManager->getStore()->getBaseCurrency()->getCurrencySymbol();
}

Same in screen shot(By DataProvider):

Below is screen shot of dynamic rows created by ui_component way:

I have xml code at Ven/Mod/view/adminhtml/ui_component/product_form.xml as Form fields like:
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="testingproduct">
           <field name="min_val">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="label" xsi:type="string">Amount</item>
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="source" xsi:type="string">faq</item>
                    </item>
                </argument>
            </field>
    </fieldset>
</form>

I want to know how can I get currency symbol in Amount field dynamic row created by DataProvider way into the Amount field created using ui_component.
It will be highly appreciated if you can give code example.
Thanks


texts: Magento 2 : Adding logo in a custom extension

texts:
I'm creating an extension where I should be able to call the logo which has been uploaded to Magento to show up in the home page.

So I upload the logo to:

  Content -> Design -> Configuration -> Edit (Global) -> Header -> Logo Image

I have been investigating how Magento calls the logo:

  vendor/magento/module-theme/Block/Html/Header/Logo.php

What would I need to add to my custom module in order to get this logo and show it. Thank you.


texts: Community Extension is taking precedence over my local extension

texts:
Hi I have a local plugin that extends the following class:

class Splitpixel_OrderGrid_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid

I use this to modify the following functions:

protected function _prepareCollection()
protected function _prepareColumns()

There is an extension in my community folder that does the same but changes a different function.

class AuIt_Pdf_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid

Which edits:

protected function _prepareMassaction()

The issue I am having is my code is not adding a column to the order grid, when using n98-magerun and running "n98-magerun.phar dev:model:rewrite:conflicts

This says three modules extend the same class, and the one that magento uses is another plugin in my community folder.

Ext4mage_Orders2csv_Block_Sales_Order_Grid,
AuIt_Pdf_Block_Adminhtml_Sales_Order_Grid,
Splitpixel_OrderGrid_Block_Adminhtml_Sales_Order_Grid

The following is used over mine:
AuIt_Pdf_Block_Adminhtml_Sales_Order_Grid

How can I make sure my class is being used and not masked by this one? Also why would they be conflicting? Even though I am overwriting the same class I am changing different functions?


texts: Magento 1.9 front-end custom page create

texts:
I need to create front-end custom page  URL like this www.demo.com/declaration/success

I have tried but page is showing 404 error. My codes are the following

D:\xampp\htdocs\ramesh\sliver-exchange\app\code\local\SilverExchange\Declaration\etc\config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <SilverExchange_Declaration>
            <version>0.1.0</version>
        </SilverExchange_Declaration>
    </modules>

    <frontend>
        <routers>
            <declaration>
                <use>standard</use>
                <args>
                    <module>SilverExchange_Declaration</module>
                    <frontName>declaration</frontName>
                </args>
            </declaration>
        </routers>
        <layout>
            <updates>
                <declaration>
                    <file>declaration.xml</file>
                </declaration>
            </updates>
        </layout>
    </frontend>
    <global>
        <helpers>
            <declaration>
                <class>SilverExchange_Declaration_Helper</class>
            </declaration>
        </helpers>
        <blocks>
            <declaration>
                <class>SilverExchange_Declaration_Block</class>
            </declaration>
        </blocks>
    </global>
</config>

D:\xampp\htdocs\ramesh\sliver-exchange\app\code\local\SilverExchange\Declaration\controllers\IndexController.php

<?php

class SilverExchange_Declaration_IndexController extends Mage_Core_Controller_Front_Action
{

    public function IndexAction()
    {
      $this->loadLayout();
      $this->getLayout()->getBlock("head")->setTitle($this->__("Declaration"));
            $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
      $breadcrumbs->addCrumb("home", array(
                "label" => $this->__("Home Page"),
                "title" => $this->__("Home Page"),
                "link"  => Mage::getBaseUrl()
           ));

      $breadcrumbs->addCrumb("demo", array(
                "label" => $this->__("declaration"),
                "title" => $this->__("declaration")
           ));

      $this->renderLayout();
    }

    public function successAction()
    {
         $this->loadLayout();
    }
}

D:\xampp\htdocs\ramesh\sliver-exchange\app\design\frontend\coolbaby\default\layout\declaration.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
<declaration_index_index>
  <reference name="root">
    <action method="setTemplate"><template>page/1column.phtml</template></action>
  </reference>
  <reference name="content">
    <block type="declaration/declaration" name="declaration_index" template="declaration/index.phtml" />
  </reference>
</declaration_index_index>

<declaration_index_success>
  <reference name="root">
    <action method="setTemplate"><template>page/1column.phtml</template></action>
  </reference>
  <reference name="content">
    <block type="declaration/declaration" name="declaration_success" template="declaration/success.phtml" />
  </reference>
</declaration_index_success>

</layout>

D:\xampp\htdocs\ramesh\sliver-exchange\app\design\frontend\coolbaby\default\template\declaration\success.php

Declaration Success


texts: How to know from which site a customer is redirected to our store

texts:
My client wants to advertise about their magento store on different sites, and they wanted to know from which site a customer is redirected that they can give some benefits to that site owner.

As my way, I suggest them that add a unique reference code in each advertisement URL which redirect to magento store. they are accepted it.

Now my question is how I need to find out which from site a customer is redirected to magento store.?


texts: I have both var and var1 folders in my directory - which one to use? (Magento 2.1)

texts:
I have both var and var1 folders in my Magento 2 directory.
I've no idea why, but I need to remove one of them due to space.
Could anyone help me understand why the second one appears, and which one do I remove?


texts:
I am having a little trouble with Magento's invoice PDF. Specifically, I want to change the address formatting. For example, currently Magento outputs names and addresses under the Billing Address heading like this:

John Doe
123 Fake Street Los Angeles,
California, 90210
T: (310) 555-5555

I want the output to have the following format:

John Doe
123 Fake Street
Los Angeles, California, 90210
T: (310) 555-5555

Where the city is on the same line as the State and Zip.

I have found how Magento formats the first example. I am trying to figure out how to modify Magento's code so that I get the second output.

In /app/code/core/Mage/Sales/Model/Order/Pdf/ -> Abstract.php there is a function _formatAddress() that takes in a string with the that looks like:

"John Doe| 123 Fake Street Los Angeles,| California, 90210| T: (310) 555-5555"

and parses the string with respect to the vertical bars ("|"). I've noticed that I need to place a vertical bar right after the Street in order to produce my desired output but I don't know what function inserts these vertical bars.

Also, _formatAddress() gets called like this:

$billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));

I have tried tracing the getBillingAddress() and format('pdf') but have had no luck.

Does anyone know where the vertical bars get inserted?


texts: CSS Merging (or) Minify is not working properly

texts:
We have installed some of the third party plugins on our Magento site. We have enabled minify CSS, JS for better performance.

But while looking source code, we have seen that the minification has not been applied for the third-party extensions.

Is this the case in Magento 2.2.6?


texts:
I need to find the template or layout file that contains this ul tag:

        Login

Create an account

I need only the
 tag. Where and how to find it?


texts:
I am new to magento. I am trying to show the first weight option of my weight dropdown box selected by default. my product page view is like this

like i want 400gm which is my first option in dropdown seleted while page loads.

can anyone please help me to get this


texts: Add the hreflang in link for each category

texts:
i have using the same url for different languages.

<reference name="head">
   <action method="addLinkRel">
      <rel>alternatve</rel>
      <href>https://www.example.com/</href>
      <hreflang>x-default</hreflang>
   </action>
   <action method="addLinkRel">
      <rel>alternatve</rel>
      <href>https://www.example.com/</href>
      <hreflang>de</hreflang>
   </action>
   <action method="addLinkRel">
      <rel>alternatve</rel>
      <href>https://www.example.com/top.html</href>
      <hreflang>de-de</hreflang>
   </action>
   <action method="addLinkRel">
      <rel>alternatve</rel>
      <href>https://www.example.com/</href>
      <hreflang>de-at</hreflang>
   </action>
   <action method="addLinkRel">
      <rel>alternative</rel>
      <href>https://www.example.com/</href>
      <hreflang>de-ch</hreflang>
   </action>
</reference>

But while using this code in category->custom design in manage categories.
I'm geting only i url in the page. i check it in page source

<link rel="alternative" hreflang="de-ch" href="https://www.example.com/" />


texts: Multiple Jquery Version for extension reason

texts:
I get some issue my custom theme and it's get from one of extension jquery version.
How can I fix this issue ?

extension .xml file;

<layout>
<default>
    <reference name="head">
         <action method="addItem"><type>skin_js</type><name>js/iyzicoonpagecheckoutform/jquery-1.7.1.min.js</name><params/></action>
        <block type="core/text" name="google.cdn.jquery">
            <action method="setText">
                <text>
                    <![CDATA[
                        <script type="text/javascript">izQuery = jQuery.noConflict(true);</script>
                    ]]>
                </text>
            </action>
        </block>

And local.xml file in my custom theme ;

<default>
    <reference name="head">
        <!--input js-->
        <action method="addJs"><script>smartwave/jquery/jquery-1.11.2.min.js</script></action>
        <action method="addJs"><script>smartwave/jquery/jquery-migrate-1.0.0.js</script></action>

I don't have any issue my custom theme version , everything get about extension jquery version.But I don't know how to fix is ?


texts: How to send an Confirmation email when customer has login successfully?

texts:
I want to send a confirmation mail to the customer when has customer login. Please let me know how can I achieve it. I am using Magento 1.9.2.

this is my _loginPostRedirect() function code

 protected function _loginPostRedirect()
{
    // send mail after login start here
    $customer = Mage::getSingleton('customer/session')->getCustomer();
    $templateId = 2; // USE YOUR OWN TEMPLATE ID
    $senderName = Mage::getStoreConfig('trans_email/ident_support/name');
    $senderEmail = Mage::getStoreConfig('trans_email/ident_support/email');
    $sender = array('name' => $senderName,
        'email' => $senderEmail);
    $recepientEmail = $customer->getEmail();
    $recepientName = $customer->getName();
    $store = Mage::app()->getStore()->getId();
    $vars = array('customerName' => $customer->getName());
     Mage::getModel('core/email_template')
->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
// send mail after login end here


texts: I want to create banner slider extension. How to configure the files and flow in magento2?


texts: How do I get the Area/City Name from Region ID for add address programmatically in Magento 2?

texts: I got the state list from country code by following this blog for my Magento 2 store. I want to get the Area/City name from the state/region id, is there a way or method to get it in Magento 2.3.x?


texts: Magento Channel Community Edition is not showing in Magento Connect Manager?

texts:
I am using Magento 1.9.3.6. In Magento Connect Manager, installed modules are showing in two parts

In first part all installed modules are working perfectly. No issue in reinstalling or uninstalling and Magento Channel is showing Community Edition

In the second part of installed modules there are issues in reinstalling or uninstalling and Magento channel is not community Edition

When I am trying to reinstall or uninstall the second part of any modules, error is showing

  no actions selected

Kindly help me to resolve this issue

Thank You


texts:
I'm testing email. When I subscribe newsletter, I got subscription success email immediately

but when I place test order, I got the order confirm email after 10 ~ 20 seconds (time is different whenever I test)

Can I know what should I check or solution?


texts: Fooman EmailAttachment = 'Payment Methods' is blank on the emailed PDF but not on the manually created PDF for Magento 1

texts:
I have recently installed Fooman EmailAttachment module and my order email PDF doesn't display Payment Method information. Only payment method information is missing from Order PDF.

Can anyone help me with this issue?


texts: update products based on attribute value

texts:
I am writing a cron job to update products, I cannot use SKU as that is magento only. For every product in magento I have an attribute auto_cool_number I need to update it by that value (which is varchar).

I found this script on magepsycho which is awesome, it works great and updates my price and qty based on SKU, how can I modify the query to inner jOIN attribute values and update all products which share that attribute value.

     function _updateStocks($data){
         $connection     = _getConnection('core_write');
         $sku            = $data[0];
         $newQty         = $data[1];
         $productId      = _getIdFromSku($sku);
         $attributeId    = _getAttributeId();

         $sql            = "UPDATE " . _getTableName('cataloginventory_stock_item') . " csi,
                            " . _getTableName('cataloginventory_stock_status') . " css
                            SET
                            csi.qty = ?,
                            csi.is_in_stock = ?,
                            css.qty = ?,
                            css.stock_status = ?
                            WHERE
                            csi.product_id = ?
                            AND csi.product_id = css.product_id";
         $isInStock      = $newQty > 0 ? 1 : 0;
         $stockStatus    = $newQty > 0 ? 1 : 0;
         $connection->query($sql, array($newQty, $isInStock, $newQty, $stockStatus, $productId)); }

     function _updatePrices($data){
         $connection     = _getConnection('core_write');
         $sku            = $data[0];
         $newPrice       = $data[2];
         $productId      = _getIdFromSku($sku);
         $attributeId    = _getAttributeId();

         $sql = "UPDATE " . _getTableName('catalog_product_entity_decimal') . " cped
                     SET  cped.value = ?
                 WHERE  cped.attribute_id = ?
                 AND cped.entity_id = ?";
         $connection->query($sql, array($newPrice, $attributeId, $productId)); }

~


texts: Custom Attribues in Frontend showing for wrong product

texts:
Steps to reproduce:

VERSION 1.9.3.2

Item with custom options... for example

  https://tiptopweddingshop.co.uk/funky-boys-socks-page-boy-ring-bearer-etc.html

In the backend, the Custom Options are correct:

Date / Field
Option / Dropdown / with options such as "Groom", "Best Man", etc
Text Colour / Dropdown / with options such as "Yellow/Orange", "White, etc

In the frontend, the Custom Options are displaying INcorrectly:

OK
Not all options show, repeats the first part of the list
Text Colour is showing options from ANOTHER PRODUCT!

Notes:

Backend shows the custom options and the correct selectable value
Data Export shows data is fine and matches the backend above in Note1
Have Flushed Cache, Reindexed, etc several times, still not working

Expected Result:

Custom Options display correctly in frontend

Actual Result:

This is ONLY in the frontend, the backend is fine and a data export shows the correct options.
2nd Custom Option is not showing all the options and appears to repeat the top half of the list
3rd Custom Option is showing the correct option title, but the option values are from a Custom Option FROM ANOTHER PRODUCT!


texts: Bundle Product Shipment error Cannot create shipment when shipment type is "Separately"

texts:
I'm creating a partial shipment for a bundle product using this api
POST /rest/V1/order/{orderId}/ship

And this is the body
{
    "items": [
        {
            "order_item_id": 87,
            "qty": 0
        },
        {
            "order_item_id": 88,
            "qty": 1
        },
        {
            "order_item_id": 89,
            "qty": 1
        },
        {
            "order_item_id": 90,
            "qty": 1
        }
    ],
    "tracks": [
        {
            "track_number": "TRK-0063-01",
            "carrier_code": "custom",
            "title": ""
        }
    ],
    "arguments": {
        "extension_attributes": {
            "source_code": "default"
        }
    }
}

where the first item (order_item_id = 87) is the bundle product. But I'm getting an error from the api
{
    "message": "Shipment Document Validation Error(s):\nCannot create shipment as bundle product \"\" has shipment type \"Separately\". Bundle product options should be shipped instead."
}

My main questions regarding this are:

Is the issue that the "Ship Bundle Items" option is set to "Separately"? If so then what should the request body be for this case.
Is there some other API that should be used for bundle products with the "Separately" option?


texts: How to capture transaction id in magento 1.9 admin?

texts:
I have problem in show Transaction ID to admin ( refer the image ), how can we store the transaction table in database. I'm new to magento.

I have searched for solution but haven't got success.

Please give me right solution for this problem.

Thanks in advance.


texts: Custom Column Sorting in Admin Grid - Magento 2

texts:
I have a custom grid with a column definition as below:

 <column name="practitioner_id" class="Amrita\Practitioner\Ui\Component\Listing\Column\Practitioner">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Practitioner</item>
                    <item name="sortable" xsi:type="string">true</item>
                </item>
            </argument>
        </column>

and from Amrita\Practitioner\Ui\Component\Listing\Column\Practitioner I'm preparing the data source as follows:

 /**
 * @param array $dataSource
 * @return array
 */
public function prepareDataSource(array $dataSource)
{
    if (isset($dataSource['data']['items'])) {
        foreach ($dataSource['data']['items'] as & $item) {
            $name = $this->getData('name');
            try {
                $practitioner = $this->practitionerRepository->getById($item[$name]);
                $item[$name] = $practitioner->getName();
            } catch (NoSuchEntityException $e) {
                $item[$name] = __('-');
            }
        }
    }
    return $dataSource;
}

So I'm using an external model to retrieve the practitioner name and display it in a grid (based on another model and associated practitioner_id).

The issue is that when I sort the column by clicking the header, it orders the column by the id rather than by the name, it needs to be sorted alphabetically.

How do apply this custom sorting to this column given i'm using another model to populate the data.

I can see there's the method \Magento\Ui\Component\Listing\Columns\Column::applySorting()

But I'm not sure how to manipulate this, can anyone help?


texts: Layout changes not working in Magento 1.9.2.3

texts:
trying to make a very simple change to the category page. Before 1.9.2.3 all I had to do was go into local.xml and add:

<catalog_category_default>
    <reference name="root">
        <action method="setTemplate">
            <template>path/to/template.phtml</template>
        </action>
    </reference>
</catalog_category_default>

I've tried doing the same thing in my local.xml but no change has occured. I then tried in my theme.xml specified xml file and again nothing. I'm not sure why it isn't updating. Here's my current file:

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="root">
            <action method="setTemplate">
                <template>page/customCategory2col.phtml</template>
            </action>
        </reference>
    </default>
</layout>

my folder structure:

app / design / frontend / lexel / coffeehit / layout / local.xml

I'm not sure what the cause is... I think it's something to do with the new inheritance setup. However, it just doesn't apply the layout change.. I've tried creating a module that uses local.xml to apply updates - nothing. I'm not sure where to even begin to find out how to go about this.. anyone know what to do?

Thanks


texts: Add an image product attribute in Magento 2 in module setup

texts:
I've been trying to find an article/question related to the creation of an 'image' type attribute for a product in Magento 2. That is: having just a browse field where the user can upload an image (something similar to the category image upload).

So far I've found this:
create product image attribute in magento2

But it doesn't seem to describe the whole way on how to do it. Is it really necessary to create a custom class to manage this?

Thanks!


texts:
How to Resize Image in custom Category Collection Magento 1.9

 $cats = Mage::getModel('catalog/category')->load(2)->getChildren();
        $catIds = explode(',',$cats);

        $categories = array();
        foreach($catIds as $catId) {
            $category = Mage::getModel('catalog/category')->load($catId);
            $categories[$category->getName()] = array(
            'url' => $category->getUrl(),
            'description' => $category->getDescription(),
            'img' => $category->getImageUrl()
            );
        }

        ksort($categories, SORT_STRING);

Call Image as below now i want to resize my image.

<img class="img-responsive" src="<?php echo $data['img']; ?>" />

Any one idea how to resize images.


texts: How to upload image file on product edit page in backend

texts:
I have added custom field-set to product edit page and trying to upload multiple (more than 8) images.

To add custom field-set I have added layout file in my custom module -

  /view/adminhtml/layout/catalog_product_new.xml

<referenceBlock name="product_form">
            <block class="Myvendor\Newtab\Block\Adminhtml\Product\Edit\Tab\Welcome" name="product.welcome" as="custom-tab" >
                <arguments>
                    <argument name="config" xsi:type="array">
                        <item name="label" xsi:type="string" translate="true">Design Tool Options</item>
                        <item name="collapsible" xsi:type="boolean">true</item>
                        <item name="opened" xsi:type="boolean">true</item>
                        <item name="sortOrder" xsi:type="string">2</item>
                        <item name="canShow" xsi:type="boolean">true</item>
                        <item name="componentType" xsi:type="string">fieldset</item>
                    </argument>
                </arguments>
            </block>
        </referenceBlock>

and created following template file to add custom file type fields

  /view/adminhtml/templates/catalog/product/edit/welcome.phtml

<input type="file" data-form-part="product_form" name="thumb">

To save data created

  /Controller/Adminhtml/Rewrite/Product/Save.php

 namespace Myvendor\Newtab\Controller\Adminhtml\Rewrite\Product;
    use Magento\Framework\App\Filesystem\DirectoryList;
    use Magento\Backend\App\Action;

    class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Save
    {

        public function __construct(
            \Magento\Backend\App\Action\Context $context,
            \Magento\Catalog\Controller\Adminhtml\Product\Builder $pbuilder,
            \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
            \Magento\Catalog\Model\Product\Copier $productCopier,
            \Magento\Catalog\Model\Product\TypeTransitionManager $productTypeManager,
            \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
            \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory)
        {
            $this->_fileUploaderFactory = $fileUploaderFactory;
            parent::__construct($context,$pbuilder,$initializationHelper,$productCopier,$productTypeManager,$productRepository);
        }

        public function execute()
        {
            $uploader = $this->_fileUploaderFactory->create(['fileId' => 'thumb']);
            $uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png']);
            $uploader->setAllowRenameFiles(false);
            $uploader->setFilesDispersion(false);
            $path = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath('images/');
            $uploader->save($path);
}
}

I am getting following exception -

  1 exception(s): Exception #0 (Exception): $_FILES array is empty


texts: Saved image in the admin grid is not fetching while editing the grid Magento 2

texts:
The image is already saved in the uploaded image. But when editing the form it shows No file Chosen. How can I fetch the previously save the image?

Here is the save.php code:

    <?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: How to repair Web Setup Wizard redirecting to 404 Not Found in Magento CE 2.2.5/2.2.6?

texts:
This is a very critical issue.

I recently upgraded from Magento CE 2.2.5 to CE 2.2.6 using the Web Setup Wizard.

The upgrade went fine and the site is working.

When I try to access Web Setup Wizard in 2.2.6, I get a 404 Not Found response.

What I already tried:

I removed all files and contents from /var/
I cleaned Magento cache
I tried accessing the setup from a different browser
Tried solutions such as accessing through http and https and activated/deactivated HTTP Strict Transport Security
The Document Root points to /path/to/magento/ and not /path/to/magento/pub/

Please note that I have a test instance on a different machine, this one was upgraded to 2.2.6 using composer. On this instance, /setup/ is working fine.

Any suggestion?


texts: Magento 2 - What is the Event name after customer edit address only

texts:
I need to use events 2 places
1 - When customer verified email
 <event name="controller_action_predispatch_customer_account_confirm">
        <observer name="insert_customer_info_cova" instance="Company\Namespace\Observer\InsertCustomerInfo"/>
    </event>

2 - When customer edit address information
<event name="customer_address_save_after">
        <observer name="update_customer_address_cova" instance="Company\Namespace\Observer\UpdateCustomerAddress" />
    </event>

It is working fine when customer registration page have no address fields but when we are showing address fields on registration page then this event is fire "customer_address_save_after"
So I need to block that "customer_address_save_after" event when customer register on registration page
Anyone know how to block that event ?


texts: Magento 1 Cache folder is not accessible when using shell command

texts:
I'm having a problem with getting a shell command to clear a specific product cache because the permissions in the cache folder are strictly restricted to www-data. For example, folder /var/cache/mage--a files are like these:

-rw-------  1 www-data www-data 7646 Mar  4 11:20 mage---c54_PRODUCT_CACHE_123
-rw-------  1 www-data www-data  184 Mar  4 11:20 mage---internal-metadatas---c54_PRODUCT_CACHE_123

So when the shell command runs, it calls Mage::app()->cleanCache('PRODUCT_CACHE_123'), which triggers down to _fileGetContents function defined in lib/Zend/Cache/Backend/File.php and it's unable to open the meta file in /var/cache/mage--a due to the permissions listed above.

Does anyone have a suggested fix for this?


texts: Add field to Shipping Address in Checkout

texts:
I need to add a field to the checkout process for my store. I have created a field on the frontend where a user can type in the 'Mail Hub' for their location.

How do I capture this information in the backend?


texts: How to get quantity added to cart on product page which promote to promotion

texts:
I wanted to get a way that i could get the quantity if a item that has been added to cart and display in the success message to prompt the user about a promotion. The site i'm working on has Any 3 items for £15.

So if a customer was to order a quantity of 2 for a item, i want something dynamic that looks at the quantity added and in the success page to say order 1 more to get "Any 3 items for £15".


texts: Shopping cart doesn not go to payment gateway, instead returns to a page "Shopping cart is Empty"

texts:
The shopping cart on proceeding for any mode of payment, leads directly to http://www.kkeautocare.com/checkout/cart/ which shows :

Shopping Cart is Empty

You have no items in your shopping cart.

Click here to continue shopping.

Tried almost everything I could find on Internet. Can somebody please help?


texts: Magento 2 - store media in module folder and access it in template

texts:
My extension comes with an icon, where can I place it in my module and how can I load it in the modules template?

Template:

<img src="/media/icons/new-badge.svg" class="new-icon" alt="NEW">


texts: How To Fetch And Display Last 4 Table Rows?

texts:
The following code currently outputs the first row matching the criteria is_read != 1', 'is_remove != 1'. I need to modify this code to output the last 4 table rows that matches said criteria. I tried a few things but none worked.

This current code displays the latest notification at the top of the admin page. i want it to display the last 4 notification, one after the other.

Please Help!

  ModuleName/Model/Resource/

public function loadLatestNotice(Mage_AdminNotification_Model_Inbox $object)
{
    $adapter = $this->_getReadAdapter();
    $select = $adapter->select()
        ->from($this->getMainTable())
        ->order($this->getIdFieldName() . ' DESC')
        ->where('is_read != 1')
        ->where('is_remove != 1')
        ->limit(1);
    $data = $adapter->fetchRow($select);

    if ($data) {
        $object->setData($data);
    }

    $this->_afterLoad($object);

    return $this;
}

Here are some other codes that are used...

  ModuleName/Model/

 public function loadLatestNotice()
{
    $this->setData(array());
    $this->getResource()->loadLatestNotice($this);
    return $this;
}

  ModuleName/Block/

public function getLatestNotice()
{
    return  $this->_getHelper()
        ->getLatestNotice()->getTitle();
}

  Template/

        <p id="notetitle" href="<?php echo $latestNoticeUrl ?>" onclick="this.target='_blank';"><?php echo $this->getLatestNotice() ?>

<?php echo $this->getLatestNoticeDate() ?>

ive tried changing the limited to 4, but i didnt see any changes. I've also tried using fetchall instead of fetchrow, which didnt show anything. I;m starting to wonder, do i need to do a array echo in the template code to display it?


texts:
Does somebody know why the xml bellow causes blank page on search result page ?

Im using luma theme and have custom theme with Magento_Theme/layout/default.xml.

All pages are shown correctly exept search result like catalogsearch/result/?q=xxx.

<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <referenceContainer name="header.panel">
        <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
            <arguments>
                <argument name="css_class" xsi:type="string">header links</argument>
            </arguments>
        </block>
    </referenceContainer>

    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_img_width" xsi:type="number">148</argument>
            <argument name="logo_img_height" xsi:type="number">43</argument>
        </arguments>
    </referenceBlock>
    <!--<referenceBlock name="header.panel" remove="true" />-->
    <move element="header.panel" destination="header-wrapper" after="logo"/>

    <referenceBlock name="header.panel.wrapper" remove="true"/>

    <move element="navigation.sections" destination="header-wrapper" after="logo"/>

    <!--<move element="top.search" destination="header-wrapper" after="-" />
    <move element="search" destination="header-wrapper" after="-" />
    <move element="catalog.compare.link" destination="header.links" />  -->

    <move element="top.search" destination="header.panel" after="header.links" />
    <move element="search" destination="header.panel" after="header.links" />
    <move element="catalog.compare.link" destination="header.links" />
    <move element="minicart" destination="header.panel" after="header.links" />

    <referenceBlock name="catalog.compare.link" remove="true"/>

    <referenceBlock name="header" remove="true"/>
    <referenceBlock name="footer_links" remove="true"/>
    <referenceBlock name="form.subscribe" remove="true" />
    <referenceBlock name="copyright" remove="true"/>
    <referenceContainer name="footer">
        <block class="Magento\Cms\Block\Block" name="footerlinks">
            <arguments>
                <argument name="block_id" xsi:type="string">footerlinks</argument>
            </arguments>
        </block>
    </referenceContainer>
</layout>

Thanks for help !


texts: How to create custom collection query in magento 2

texts:
Hello i create custom module with database i want to show data with filter by somw columns i want to convert  below query OR Can you tell what we do for it
How to use getSelect()->where() in magento2?
ex:-

select * from table where hello_status=1 AND ( location='blabla' OR location='bla')
AND (DATE<='' AND DATE IS NUll )


texts: I need to change all my products to the page layout "2column left". Now is everything set on 1column. How can I do this in one step for all the products?


texts: I have a magento site that I rarely check but is set to auto update on its own. Today I tried to go to /admin and I got a blank page. Has anyone had this issue after updating to version 1.9? I deleted cache and session folders and there are no applicable errors in logs on server or var folder.


texts:
In Magento 1.9 I just edited the admin_user table in database and set password to the hash of 'admin', so I got admin admin for short on development local installation.

How to do it in Magento 2? I did the same change, but it just broke admin account, so I no longer can log in.


texts: Magento 2.3 Bosnian language pack not working

texts:
I have installed Mageplaza's Bosnian language pack. I have set a store configuration local to Bosnian, but on the frontend, English is still shown. Also, I tried changing the admin locale, but that too not changing the language in the admin.
screenshot: https://nimb.ws/hZVOTL, https://nimb.ws/jRL7bY
Does anyone have idea? A cache is also cleared.