texts: Product images uploaded are in the cached folder with a different size. Why?

texts:
Just found this issue, and look forward to getting advice from you:

For the product image uploaded via admin page, when it shows in the product page, or at home page, the source codes shows that it is loaded from a path like this:

http://[magentosite]/media/catalog/product/cache/1/small_image/600x480/445dssfjdsjflsdrtowrs4343a67i/1/6/image.png

The actual product image has only dimension of 400x400, the cached image from the above path has dimension of 600x480.

The resized image (to 600x480) has a much bigger size, which causes slow site speed.

The list.phtml and media.phtml only resize the image to 135, 56, and 265.

Can anyone share your idea why this is happening? Thanks!


texts: can't load 2 products using load by id method in magento

texts:
Friends, I wanna load 2 bundle products using load by id method. this is the code that i have written for that...

<?php
$bundled = Mage::getModel('catalog/product');
$stdid=$bundled->getIdBySku('123457');
$compid=$bundled->getIdBySku('123458');

/*get additional options of the each products*/
 $y=$bundled->load($compid);
 $selectionCollection_complete = $y->getTypeInstance(true)->getSelectionsCollection(
            $y->getTypeInstance(true)->getOptionsIds($y), $y);

$x=$bundled->load($stdid);
$selectionCollection_standard = $x->getTypeInstance(true)->getSelectionsCollection(
            $x->getTypeInstance(true)->getOptionsIds($x), $x);

 /*store the option head name to an array for future
  reference*/
 foreach($selectionCollection_standard as $std_opt)
 {
    $opt_std_hd_names.=$std_opt->getName()."
";
 }
 foreach($selectionCollection_complete as $cmp_opt)
 {
   $opt_cmp_hd_names.=$cmp_opt->getName()."
";
 }

 $display="
".print_r($opt_std_hd_names."

".$opt_cmp_hd_names)."
"

?>

but my problem is $opt_std_hd_names and $opt_cmp_hd_names  returns the same output and they are those options of product which i have loaded first.(in this case $y. if i place the $x code at first, then it displays options of $x).the output is shown below.

 output:

   Preparation and Filing of Incorporation Documents
   Verify Business Name Availability
   Unlimited Phone/Email Support
   24/7 Access to Our Online Status Center
   FREE Registered Agent Service for 6 Months
   BizComply (free with your Registered Agent Service)
   500 Four-Color Business Cards
   Business License Application Package
   Palo Alto's Business Plan Pro

   Preparation and Filing of Incorporation Documents
   Verify Business Name Availability
   Unlimited Phone/Email Support
   24/7 Access to Our Online Status Center
   FREE Registered Agent Service for 6 Months
   BizComply (free with your Registered Agent Service)
   500 Four-Color Business Cards
   Business License Application Package
   Palo Alto's Business Plan Pro

you can see the outputs are same. why it happens like this?? please give your suggestions


texts: How zend libs file(Rewrite Zend_Pdf_Resource_ImageFactory) class in Magento 2

texts:
i am trying to override Zend libs class like magento2 using preference

My di.xml code is

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Zend_Pdf_Resource_ImageFactory" type="\Codility\Customers\Zend\Zend_Pdf_Resource_Image"/>
</config>

But it not override . it hit to core class Zend_Pdf_Resource_ImageFactory  how can we override zend lib class ?


texts: The image content is not valid in magento 2.2.2

texts:
I have below code with save configurable Image. But images are not save pragmatically showing below error
    /*Add Images To The Product*/
    $imagePath = "sample.png"; // path of the image
    $product->addImageToMediaGallery($imagePath, array('image', 'small_image', 'thumbnail'), false, false);
  $productRepository->save($product);

error

1 exception(s): Exception #0
(Magento\Framework\Exception\InputException): The image content is not
valid.
Exception #0 (Magento\Framework\Exception\InputException): The image
content is not valid.
0 /var/www/html/awardsideas/vendor/magento/module-catalog/Model/ProductRepository.php(590):
Magento\Catalog\Model\ProductRepository->processMediaGallery(Object(Magento\Catalog\Model\Product\Interceptor),
Array)
1 /var/www/html/awardsideas/vendor/magento/framework/Interception/Interceptor.php(58):
Magento\Catalog\Model\ProductRepository->save(Object(Magento\Catalog\Model\Product\Interceptor))


texts:
I am trying to override phtml file. for that, I have changed the path in layout for phtml and block. but my changes are not working. I have made an error in the file but nothing happens.

here is my layout file code which i am using to overriding.

<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_product_view"/>
<body>
    <referenceContainer name="content">
        <container name="product.info.details" htmlTag="div" htmlClass="product info detailed" after="product.info.media">
            <block class="XYZ\Custom\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Custom_Module::product/view/lists.phtml"/>
        </container>
    </referenceContainer>
</body>


texts: Magento-2.1.0 : add customer serialize grid to product edit page

texts:
I'm trying to create a custom module for Magento-2.1.0 that will add a new tab on product edit page in admin, with customer serialize grid.

Can anyone provide an answer?

I have already added tab to product edit page you can check my code in answer in this question


texts: How to make product image required and minimum 1 or maximum 6 images

texts: I am using Magento 2.3 and creating a product doesn't need any image. How do I make it required?


texts: Selling link to an external site as product

texts:
We want to include some products which are actually held in an external site - however, they're not files, just pages within the external site. The external site manages authentication, access etc. and we just want to use Magento to sell a product which consists of a link to the remote site.

Downloadable products seemed to be the best option, but these are tailored towards downloadable files and so try to download a file from the supplied link.

Any suggestions on how we can do this?


texts: Simple Product Quantity Stopping Grouped Product From Working

texts:
I am running M2.2.0 and have set up a store that only sells 4 products (bottled beer), my problem though is this: The boss only wants to sell them by the case of 8 bottles. I have set up a Simple Product for each beer with a price per bottle and edited the Advanced Inventory to be Min Qty of 8 and incriments of 8 so that customers don't order in values of 6, 10, 3 etc. I am now scatching my head as to how I can now do a mixed case containg 2 bottles of each beer? A grouped product gets rejected at the Cart page due to the quantity of bottles being 2 instead of 8.

Things to note: I'm new to this so please bear with me and accept newbie mistakes. The Simple Products are not visible but I have set up Grouped Products for each beer with a default of 8 bottles.


texts: SetAdditionalOptions is not working in Magento2.3.1

texts:
I am facing a weird problem with setAddtionalOptions for checkout. Following is my code to set options using observer.

This is my event.xml file, which calls the observer to set additional options.

<event name="catalog_product_load_after">
      <observer name="set_additional_options" instance="Vendor\ModuleName\Model\Observer\SetAdditionalOptions"/>
</event>

This is observer file Observer/SetAdditionalOptions.php

class SetAdditionalOptions implements ObserverInterface
{

    protected $request;

    public function __construct(
        \Magento\Framework\App\RequestInterface $request,
        \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
        Magento\Framework\Serialize\SerializerInterface $serialize,
        \Psr\Log\LoggerInterface $logger
    ) {
        $this->_request = $request;
        $this->timezone = $timezone;
        $this->serialize= $serialize;
        $this ->_logger = $logger;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        // Check and set information according to your need
        if ($this->_request->getFullActionName() == 'checkout_cart_add') {
            //checking when product is adding to cart

               $additionalOptions[] = array(
                 'label' => "Created at",
                 'value' => $this->timezone->date()->format('Y-m-d H:i:s')
              );
             $observer->getProduct()->addCustomOption('additional_options', $this->serialize->serialize($additionalOptions));

        }
   }
}

The same code is working in 2.3.0 without issue but when I try the same code 2.3.1 it is not allowing me to checkout and also not giving any error in the log.

It is calling and adding created at date in cart item but when I try to checkout, it will redirect to cart page without any issue. If i remove following line then checkout will work fine:

$observer->getProduct()->addCustomOption('additional_options', $this->serialize->serialize($additionalOptions));

Is it a bug or something else?


texts: Magento 2: How to display data from the database from the model?

texts:
In magento 1

$id = $this->getRequest()->getParam('feedback_id');
$data = Mage::getModel('feedback/block')->load($id);

how to access the model and display the data in magento 2 ?


texts: Two website two different layout invoices

texts:
How to edit two different separated invoices layout for two website in multistore magento configuration? Is that possible?

So in global.. is it possible to change core magento files according to website or store view?

For my example to edit core invoice layout file ( Mage_Sales_Model_Order_Pdf_Invoice class ) in for example that way according to website or store view?


texts: Imported database to local Magento install from prior SQL dump, now unable to access, always redirects to live site (dumped) URL?

texts: Imported database to local Magento install from prior SQL dump in order to restore products gone missing and export to import to live site. However now when I try accessing the local site it redirects to the live site. Where in the database can I disable this?


texts: Custom form validation on the checkout page

texts: My custom form located at middle before shipping methods and after shipping address and form validation check when we click on next button so anyone has idea how to I do?


texts: How to get customer first name and last name from billing address?

texts:
I am using below code to get customer firstname and lastname from billing address but it is not returning any value. Can someone please help how we can get those information from billing address. Any help will be great.

$order = Mage::getModel('sales/order')->loadByIncrementId('700590221');
$billingAddress     = $order->getBillingAddress();
echo 'FirstName: ' . $billingAddress->getFirstName() . PHP_EOL;
echo 'LastName: ' . $billingAddress->getLastName();


texts: Error in setup upgrade after 2.1 to 2.3 upgrade

texts:
I am getting error while running the setup upgrade command. This table is not creating. I tried manual to no luck. Please tell what mistake.
SQLSTATE[HY000]: General error: 1005 Can't create table `db`.`sales_invoice_item` (errno: 121 "Duplicate key on write or update"), query was: CREATE TABLE `sales_invoice_item` ( `entity_id` int(10) UNSIGNED NOT NULL  AUTO_INCREMENT COMMENT "Entity ID",  `parent_id` int(10) UNSIGNED NOT NULL   COMMENT "Parent ID",  `base_price` decimal(12, 4)  NULL  COMMENT "Base Price",  `tax_amount` decimal(12, 4)  NULL  COMMENT "Tax Amount",  `base_row_total` decimal(20, 4)  NULL  COMMENT "Base Row Total",  `discount_amount` decimal(12, 4)  NULL  COMMENT "Discount Amount",  `row_total` decimal(20, 4)  NULL  COMMENT "Row Total",  `base_discount_amount` decimal(12, 4)  NULL  COMMENT "Base Discount Amount",  `price_incl_tax` decimal(12, 4)  NULL  COMMENT "Price Incl Tax",  `base_tax_amount` decimal(12, 4)  NULL  COMMENT "Base Tax Amount",  `base_price_incl_tax` decimal(12, 4)  NULL  COMMENT "Base Price Incl Tax",  `qty` decimal(12, 4)  NULL  COMMENT "Qty",  `base_cost` decimal(12, 4)  NULL  COMMENT "Base Cost",  `price` decimal(12, 4)  NULL  COMMENT "Price",  `base_row_total_incl_tax` decimal(12, 4)  NULL COMMENT "Base Row Total Incl Tax",  `row_total_incl_tax` decimal(12, 4)  NULL  COMMENT "Row Total Incl Tax",  `product_id` int(11)  NULL   COMMENT "Product ID",  `order_item_id` int(11)  NULL   COMMENT "Order Item ID",  `additional_data` text NULL COMMENT "Additional Data",  `description` text NULL COMMENT "Description",  `sku` varchar(255) NULL  COMMENT "Sku",  `name` varchar(255) NULL  COMMENT "Name",  `discount_tax_compensation_amount` decimal(12, 4)  NULL  COMMENT "Discount Tax Compensation Amount",  `base_discount_tax_compensation_amount` decimal(12, 4)  NULL  COMMENT "Base Discount Tax Compensation Amount",  `tax_ratio` text NULL COMMENT "Ratio of tax invoiced over tax of the order item",  `weee_tax_applied` text NULL COMMENT "Weee Tax Applied",  `weee_tax_applied_amount` decimal(12, 4)  NULL  COMMENT "Weee Tax Applied Amount",  `weee_tax_applied_row_amount` decimal(12, 4)  NULL  COMMENT "Weee Tax Applied Row Amount",  `weee_tax_disposition` decimal(12, 4)  NULL  COMMENT "Weee Tax Disposition",  `weee_tax_row_disposition` decimal(12, 4)  NULL  COMMENT "Weee Tax Row Disposition",  `base_weee_tax_applied_amount` decimal(12, 4)  NULL  COMMENT "Base Weee Tax Applied Amount",  `base_weee_tax_applied_row_amnt` decimal(12, 4)  NULL  COMMENT "Base Weee Tax Applied Row Amnt",  `base_weee_tax_disposition` decimal(12, 4)  NULL  COMMENT "Base Weee Tax Disposition",  `base_weee_tax_row_disposition` decimal(12, 4)  NULL  COMMENT "Base Weee Tax Row Disposition",  CONSTRAINT  PRIMARY KEY (`entity_id`),  CONSTRAINT `SALES_INVOICE_ITEM_PARENT_ID_SALES_INVOICE_ENTITY_ID` FOREIGN KEY (`parent_id`) REFERENCES `sales_invoice` (`entity_id`)  ON DELETE CASCADE,  INDEX `SALES_INVOICE_ITEM_PARENT_ID` (`parent_id`) ) ENGINE=innodb DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_general_ci COMMENT="Sales Flat Invoice Item"


texts:
I am trying to setup a multistore market place for 3 different stores
For example:
.com/store1

.com/store2

.com/store3
I have tried to do that but it ended on every thing is in one place.
And I need each store to only display associates products and all these products can be navigated through the main website also (Main store .com )
Any pest practices or architecture !!!!


texts: Why is this category failing to display the theme properly?

texts:
Please see this link http://www.yolli.com/packaging
It is the ONLY category on our store which does not display correctly.

I have checked this category's settings and compared them to the other categories, nothing is missing or incorrect.

It has me stumped, hence this post. I hope one of you guys can point me in the right direction. Many thanks in advance.


texts: Place order Insert custom field value in sales_order or quote table using plugin

texts:
I want to insert custom field value in sales_order or quote table order place time using plugin.
THANKS.


texts: Remove delete customer option from a user role

texts:
How can I remove delete customer option from a user role ?
Like I have created a user role which has access to manage customers, but I do not want to give delete customer option to that particular user group/role. How can this be achieved? Is it even possible?


texts: Magento 2.3.0 - Set up multiple websites, stores, and store views

texts:
I have used this guide to setup multiple websites, stores, and store views. As follows
Multiple websites, stores, and store views

Turned on "Add the store code to the base URL"

Set Base URLS

Everything works fine except that the default website should have been the US shown in the screenshot above, which has a website and store ID of 1.
Now to access the US site you need yo go to xyz.com/us instead of it showing as the base url itself xyz.com
Is there something I'm missing in this setup? Cause the default home page xyz.com is now showing the following error.
**

Magento\Framework\Exception\NoSuchEntityException: The store that was
requested wasn't found. Verify the store and try again. in
/home/xyz/m230.xyz.com/vendor/magento/module-store/Model/StoreRepository.php:75
Stack trace: #0
/home/xyz/m230.xyz.com/vendor/magento/module-store/Model/StoreManager.php(168):
Magento\Store\Model\StoreRepository->get('') #1
/home/xyz/m230.xyz.com/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119):
Magento\Store\Model\StoreManager->getStore('') #2
/home/xyz/m230.xyz.com/vendor/magento/module-store/Model/Resolver/Store.php(30):
Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL) #3
/home/xyz/m230.xyz.com/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49):
Magento\Store\Model\Resolver\Store->getScope(NULL) #4
/home/xyz/m230.xyz.com/vendor/magento/framework/App/Config.php(69):
Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores',
NULL) #5
/home/xyz/m230.xyz.com/vendor/magento/module-developer/Model/Logger/Handler/Debug.php(63):
Magento\Framework\App\Config->getValue('dev/debug/debug...', 'stores')
6 /home/xyz/m230.xyz.com/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(31):
Magento\Developer\Model\Logger\Handler\Debug->isHandling(Array) #7
/home/xyz/m230.xyz.com/vendor/monolog/monolog/src/Monolog/Logger.php(344):
Monolog\Handler\AbstractProcessingHandler->handle(Array) #8
/home/xyz/m230.xyz.com/vendor/magento/framework/Logger/Monolog.php(48):
Monolog\Logger->addRecord(400, 'The store that ...', Array) #9
/home/xyz/m230.xyz.com/vendor/monolog/monolog/src/Monolog/Logger.php(707):
Magento\Framework\Logger\Monolog->addRecord(400, 'The store that ...',
Array) #10
/home/xyz/m230.xyz.com/vendor/magento/framework/App/Bootstrap.php(263):
Monolog\Logger->error('The store that ...') #11
/home/xyz/m230.xyz.com/index.php(39):
Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
12 {main}

**


texts:
I have this function:

jQuery('#sort_order_by').change(function(){
        var productUrl = 'product.phtml';
        var value = jQuery(this).val();
        jQuery.cookie('sortorderby', value);
        var url= productUrl + '?sort_by='+ value;
        window.location.href = url;
        jQuery('#sort_order_by').val(jQuery.cookie('sortorderby') || 'helpful' );
    });

When executed, jQuery.cookie('sortorderby') has value jQuery('#sort_order_by').val() not set value of
jQuery.cookie('sortorderby').

I think that after the location load it does not re-run the code. So I tried create:

`function jQuery(function {jQuery('#sort_order_by').val(
    jQuery.cookie('sortorderby') || 'helpful' );});`

This gives an error, jQuery.cookie not function.

Can anyone help?


texts: Create a Pick Up in Store Button that Auto fills out Shipping Address

texts:
I want to be able to click a button(pink) at "Shipping Info" to auto fill our the shipping address to my store's address.

I'm unsure how to go about this because when I select new address I can't even use jQuery to find and replace the form options with IDs.  Has anyone had experience with this?

I also don't want it to save a new address every time and if possible I want to do this without using or buying an extension!


texts: Do I have to create a new own page? can not understand the theme structure on which file or module I have which files. Can Explain me in details?


texts: Set Customer group using a custom register form field

texts:
I have read other questions about this issue. I did what people suggested as a solution but it's not working. Actually it seems that the code is not executed at all.

I created a module. Here are the module files:

CustomX_GroupRegister.xml

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

app/code/local/CustomX/GroupRegister/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <CustomX_GroupRegister>
            <version>0.1.0</version>
        </CustomX_GroupRegister>
    </modules>
    <global>
        <models>
            <groupregister>
                <class>CustomX_GroupRegister_Model</class>
            </groupregister>
        </models>
        <events>
            <customer_register_success>
                <observers>
                   <CustomX_Groupregister_Model_Observer>
                      <type>singleton</type>
                        <class>CustomX_Groupregister_Model_Observer</class>
                        <method>CustomerRegister</method>
                   </CustomX_Groupregister_Model_Observer>
               </observers>
            </customer_register_success>
        </events>
    </global>
</config>

app/code/local/CustomX/GroupRegister/Model/Observer.php

    Class CustomX_Groupregister_Model_Observer
    {
        public function CustomerRegister($observer){
            $data = Mage::getSingleton('core/app')->getRequest();
            $customer = $observer->getCustomer();

            //'customer_type' is a custom field in register form
            $customer_type = $data->getParam('customer_type');

            if($customer_type == 'wholesale'){
                $customer->setData('group_id',2);
            }else{
                $customer->setData('group_id',3);
            }
            $customer->save();
        }
    }

I have also tried to use the customer_save_before event. It didn't work either.

Any ideas?


texts: how to edit checkout onepage login and create ? the ptml in where?

texts:
how to edit checkout onepage login and create ?

i dont know the ptml in where ? who can tell me how to edit

thank uuu


texts: core_url_rewrite doesn't get written during indexing

texts:
Tired and extremely sleepy after 2 days of trying to find a solution, here I am on magento form requesting help and support.

Problem:

I truncated core_url_rewrite table and then tried to index. Though the indexing shows that it is writing to the table (phpMyAdmin shows the increment in size of table), when I actually browse the table, I do not find any data. It is clean and blank. I have checked the privileges and did the reindex from ssh using root login yet nothing seems to show up.

Already copied table structure from backup table but that doesn't seem to do the trick. All locks were removed from var/lock. Also reset the value in index_process from working to pending. Removed all cache files from var/cache.

Strangely, all other indexes work fine except catalog_url. :-(

Any help/suggestions is welcome as I am desperately looking for a solution to resolve this one.

Additional info: I am on a VPS and running 1.7 CE.


texts: Customization of total order and additional infos

texts:
When want to have the following style of totals on checkout/cart:

  Discount
  Subtotal
  Shipping fee OR Info Text: "excl. shipping"
  Additional text: "free shipping from 30EUR" (display always)
  Grand total
  incl. Tax

Problems

  Even if we set "Checkout Totals Sort Order" in the backend correctly, the grand total is always displayed at the end
  How to put any additional info blocks between the totals?
  How to display an info text, if one total is not present (shipping)


texts: No progression after static-content:deploy en_GB

texts: Running bin/magento setup:static-content:deploy en_GB and bin/magento setup:static-content:deploy however in both cases it randomly stops and doesn't carry on any further, I'm unable to use ctrl C in my SSH to force it out as well.


texts: Magento 2 creating configurable product programmatically

texts:
Am bit confused how to create a configurable product in Magento 2. The script runs with a self-written module but is executed with a Magento CLI command. I already tried a lot of examples found in google, and the following code is the first which is working without any errors - as result, only the product is changed from simple to configurable, but there are no products associated as configurable in the backend.
The background: I need to import products from csv with simple, parent and child's (configurable associated by size or by size and color). My script is working great and it creates all products as simple products. At the end of everything, the script calls this method to associate the created simple products to the parent products (also created already as simple products) through a loop.

I hope someone can help me to fix this issue!
here is my code (the file is too big to copy here, so I hope my method is enough)

public function createConfigurable($parentId, $childIds, OutputInterface $output){
    //$parentId = string, $childIds = array, $output = Magento output object

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $attributeModel = $objectManager->create('Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute');
    $position = 0;
    $configProduct = $objectManager->create('Magento\Catalog\Model\Product')->load($parentId); // Load Configurable Product

    $configProduct->setTypeId('configurable');
    #$configProduct->save();
    $output->writeln($configProduct->getSku());

    $configProduct->getTypeInstance()->setUsedProductAttributeIds([139,89],$configProduct); //attribute ID of attribute 'size' in my store
    $configurableAttributesData = $configProduct->getTypeInstance()->getConfigurableAttributesAsArray($configProduct);

    $configProduct->setCanSaveConfigurableAttributes(true);
    $configProduct->setConfigurableAttributesData($configurableAttributesData);

    $configurableProductsData = array();
    $configurableProductsData[25] = array( //['25'] = id of a simple product associated with this configurable
        '0' => array(
            'label' => 'M/L', //attribute label
            'attribute_id' => 139, //attribute ID of attribute 'size' in my store
            'value_index' => $this->_moduleHelper->createOrGetId('size', 'M/L'), //value of 'Green' index of the attribute 'color'
            'is_percent' => '0', //fixed/percent price for this option
            'pricing_value' => "5.55" //value for the pricing
        )
    );
    $configurableProductsData[26] = array( //['26'] = id of a simple product associated with this configurable
        '0' => array(
            'label' => 'S/M', //attribute label
            'attribute_id' => 89, //attribute ID of attribute 'color' in my store
            'value_index' => $this->_moduleHelper->createOrGetId('color', 'blue'), //value of 'blue' index of the attribute 'color'
            'is_percent' => '0', //fixed/percent price for this option
            'pricing_value' => "8.77" //value for the pricing
        )
    );

    $configProduct->setConfigurableProductsData($configurableProductsData);
    $configProduct->save();
    $output->writeln('done');
    return true;

}


texts:
When I try to run the reindex process for product flat data I get this error message

SQLSTATE[HY000]: General error: 1005 Can't create table 'mylal_mage233.#sql-4497_2115c' (errno: 121)

The query being executed is:

ALTER TABLE `mg_catalog_product_flat_1` ADD CONSTRAINT `FK_MG_MG_CAT_PRD_FLAT_1_ENTT_ID_MG_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `mg_catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE

This is usually a foreign key related issue. The problem is that other 4 store views related tables are created with no issue at all and I know there isn't another foreign key with the same name. I checked using this query

    SELECT
    constraint_name,
    table_name
FROM
    information_schema.table_constraints
WHERE
    constraint_type = 'FOREIGN KEY'
AND table_schema = DATABASE()
ORDER BY
    constraint_name;

EDITED:

Just to clarify: I cannot create a table with a Foreign Key called

FK_MG_MG_CAT_PRD_FLAT_1_ENTT_ID_MG_CAT_PRD_ENTT_ENTT_ID

As said before, there is no Foreign Key in my DB with the same name, which is the error MySQL is returning.

The following code will fail

CREATE TABLE `table_test` (
  `entity_id` int UNSIGNED NOT NULL COMMENT 'entity_id' ,
  PRIMARY KEY  (`entity_id`),
  CONSTRAINT `FK_MG_MG_CAT_PRD_FLAT_1_ENTT_ID_MG_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `mg_catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci


texts: Order Comments ignoring ahref links in Email Notification

texts:
Referring to the topic on this question, ahref links sent out from the order comments in Sales > Order are not showing on Email Notifications as shown on the screenshot below.

Order Comments with ahref links

Email received but not showing ahref links

I've check on the Email templates using FTP app > locale > en_US > template > email > sales > order_update.html , I can't configure anything to {{var comment}}. Can we do anything to enable HTML for {{var comment}}?

You can check the status of your order by logging into your account.

{{var comment}}

                        If you have any questions, please feel free to contact us at
                        {{config path='trans_email/ident_support/email'}}
                        or by phone at {{config path='general/store_information/phone'}}.


texts: Reset layer product collection filter in search

texts:
I am writing a block which subclasses Mage_Catalog_Block_Layer_Filter_Category to display a list of products in each category.  To do this I apply addCategoryFilter() to the layer product collection for each layer filter item, first using clear() to remove any other filters.  So I end up with $this->getLayer()->getProductCollection()->clear()->addCategoryFilter($category) for each item.

The problem is the last-displayed category filter is not being cleared before the rest of the page renders.  So the sidebar layered navigation is still filtered by it.  How can I clear it?? I have tried doing $this->getLayer()->getProductCollection->clear() in _afterToHtml() but with no luck. Any help much appreciated.


texts:
After a PHP upgrade to 7.1 my ssh (Magento) Commands are not executed anymore...

See picture below


texts: Magento custom add to cart doesnt update cart data until page refresh

texts:
I am creating a small ajax add to cart functionality which works but is proving to be relatively expensive from the performance side of things. I am hoping someone can provide a more efficient way to do it.

The problem i think is down to the fact that i need to do things in 4 steps:

Add item or update item
Save cart
Call cart->init()
Save cart

steps 3 and 4 seem redundant but they also seem needed in order to get the new cart contents.

Does anyone know how i can eliminate the last couple of steps but still get the updated cart data after adding or updating?


texts: Show shipping amount for entire order in custom report Magento2

texts:
I have created the custom sales report,

used below code in my listing.xml file,

<column name="shipping_amount">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">false</item>
                <item name="label" xsi:type="string" translate="true">Shipping Amount</item>
            </item>
        </argument>
    </column>

I am loading the collection from table "sales_order"

This will load the shipping amount column in the Grid,

Here my issue is, I have one order #000000001  which has 3 items,

Sku, 1000, 1001, 1002,

So 3 records are shown in the grid with the shipping amount of 50 for each item which is not correct,

So can we show shipping_amount in the last row of the order record,

is something like that possible?

This is the example pic,

Please anyone suggest me how this can be achieved. Thanks!!


texts:
I want to install Magento 2.0 on a server with Centos system. My problem is after installation the Admin Panel is look like in this image:

In the firebug console I have a lot of 404 errors:

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/frontend/Magento/luma/en_US/requirejs/require.js"

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/frontend/Magento/luma/en_US/css/styles-l.css"

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/frontend/Magento/luma/en_US/css/styles-m.css"

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/frontend/Magento/luma/en_US/mage/requirejs/mixins.js"

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/frontend/Magento/luma/en_US/mage/calendar.css"

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/frontend/Magento/luma/en_US/css/print.css"

  "NetworkError: 404 Not Found -
  http://example.com/pub/static/_requirejs/frontend/Magento/luma/en_US/requirejs-config.js"

  ReferenceError: require is not defined

I try to see what permissions are int hat folder pub/static/ with a ftp client and there are 770, so with my ftp user I get there permissions denied. I try to use:

php bin/magento setup:static-content:deploy

but nothing happend.

How I can solve this?


texts: Checkout page is not working after upgrading Magento to 1.9.3.7

texts:
I have upgraded my Magento to version 1.9.3.7.

On the checkout page, when I fill the billing information it does not continue the process of checkout.

I didn't find the error. Is anyone know where is the problem.

Thanks.


texts: Is it mandatory to give Namespace while creating custom module in Magento?

texts: Is it mandatory to give a Namespace while creating custom module in Magento?


texts:
What is not correct about this statement? It came from the theme developer's files.

ERR (3): Warning: date() expects parameter 2 to be long, object given  in /home/WEBSITE/public_html/app/code/local/Peerforest/MultiProduct/Block/Product/Default/Bestseller.php on line 53

line 53 - $currentDate = date ( 'Y-m-j' , $currentDate );


texts:
there is an issue in my Magento connect
first when I try to enter it shows like this http://prntscr.com/hzub6a
and when I enter it shows this http://prntscr.com/hzubks

anyone knows what's the problem here? Magento 1.9


texts: Unable to upgrade to Magento 2.1.0 GA via command line

texts:
I've already applied the patch MDVA-532.

When I run composer update magento/magento-composer-installer I got this error:

  Your requirements could not be resolved to an installable set of
  packages.

  Problem 1
      - The requested package magento/product-community-edition == 2.0.6.0 could not be found.

  Problem 2
      - Installation request for braintree/braintree_php == 2.39.0.0 -> satisfiable by braintree/braintree_php[2.39.0].
      - magento/product-community-edition 2.1.0 requires braintree/braintree_php 3.7.0 -> satisfiable by
  braintree/braintree_php[3.7.0].
      - magento/product-community-edition 2.1.0 requires braintree/braintree_php 3.7.0 -> satisfiable by
  braintree/braintree_php[3.7.0].
      - Conclusion: don't install braintree/braintree_php 3.7.0
      - Installation request for magento/product-community-edition 2.1.0 -> satisfiable by magento/product-community-edition[2.1.0].

  Potential causes:

  A typo in the package name
  The package is not available in a stable-enough version according to your minimum-stability setting    see
  https://getcomposer.org/doc/04-schema.md#minimum-stability for more
  details.

  Read https://getcomposer.org/doc/articles/troubleshooting.md for
  further common problems.

When I run composer update I got this error:

  Your requirements could not be resolved to an installable set of
  packages.

  Problem 1
      - Installation request for magento/data-migration-tool ~2.0.0 -> satisfiable by magento/data-migration-tool[2.0.5, 2.0.0, 2.0.2,
  2.0.7].
      - Conclusion: don't install magento/framework 100.1.0
      - magento/product-community-edition 2.1.0 requires magento/framework 100.1.0 -> satisfiable by
  magento/framework[100.1.0].
      - magento/product-community-edition 2.1.0 requires magento/framework 100.1.0 -> satisfiable by
  magento/framework[100.1.0].
      - Conclusion: don't install magento/framework 100.1.0
      - Installation request for magento/product-community-edition 2.1.0 -> satisfiable by magento/product-community-edition[2.1.0].


texts: Ｍagento 1 Update product categories to multiple root categories programmatically

texts:
In my Magento installation, I have created two root categories, one for each website.

Let's say in my UK website, it use root category that has categoryID 2. In my US website, it uses root category that has categoryID 100.

I can successfully assign a product to a category within root category 2. And the problem is, if I want to give this product to another category within root category 100, it will just remove the product from root category 2, and then add to root category 100. This is not what I want, I want to keep the product in both categories, instead of moving it around.

This is the code I'm using to update products. What should I change so it will add the product to a new category while still keeping the product in the old category?

    private function updateProductData(array $data, ProductAbstract $product)
{

    $_rootcatID = $this->util->getRootCategoryIdByWebsiteId($data['dataarea']);
    $category = \Mage::getModel('catalog/category')
        ->getCollection()
        ->addAttributeToFilter('custom_category', 'IG' . $data['category_id'])
        ->addFieldToFilter('path', array('like'=> "1/$_rootcatID/%"))
        ->getFirstItem();

    $path = '';
    if ($category->getId()) {
        $path = $category->getPath();
        $path = str_replace("1/$_rootcatID/", '', $path);
        $path = explode('/', $path);

        foreach ($path as $idx => $segment) {
            $path[$idx] = $this->getCategoryName($segment);
        }

        $path = implode('/', $path);
    }
    $name = str_replace('||', "\n", $data['name']);
    $name = trim($name);
    $name = str_replace("\n", " - ", $name);

    //Take multiple websites into consideration
    // Get website for existing SKU.
    $_product = \Mage::getModel('catalog/product');
    $_product->load($_product->getIdBySku($data['sku']));
    $websiteIds = $_product->getWebsiteIds();

    foreach($websiteIds as $websiteId){
        $_websites .= \Mage::getModel('core/website')->load($websiteId)->getData("code") . ",";
    }

    $_websites = $_websites . $this->util->getWebsiteCode($data['dataarea']);

    $product->set('name', $name)
        ->set('sku', $data['sku'])
        ->set('is_in_stock', 1)
        ->set('visibility', DataInterface::VISIBILITY_CATALOG_SEARCH)
        ->set('tax_class_id', 'Taxable Goods')
        ->set('store', $this->util->getStoreCode($data['dataarea']))
        ->set('websites',$_websites)
        ->set('weight', $data['net_weight'])
        ->set('url_key', $this->getUrlKeyFromName($data['name']))
        ->set('is_qty_decimal', $data['qty_is_decimal'])
        ->set('status', 1);

    //add the product to the correct category by id
    //(if 2 categories has the same name, it might use the wrong category which might me inactive)
    if ($category->getId()) {
      $product->set('category_ids', $category->getId());
    } else {
      $product->set('categories', $path);
    }

    foreach ($this->plainAttributes as $plain) {
        $product->set($plain, $data[$plain]);
    }
}


texts: Magento 2 how to add images to recently ordered / reorder products block in the sidebar

texts: How can we include product images in the recently ordered items block located in the sidebar? By default its only showing a checkbox and the product name


texts: how to Change label NEW to QUALITY in magento

texts:
Under Specail, you can see products with label " New" , "sale" , "best".

How to change the name from "sale" to "quality".

I need to the change in frontend of the site.


texts:
I have updated the subscribe.phtml file and cleared the cache as well reindexed everything but it has not worked. I have also go template path hints enabled and it give the path below.

frontend/default/magezon/template/newsletter/subscribe.phtml

which is the file I have changed. I am at a loss here. Any help will be really appreciated.

I am using Magento 1.9...


texts:
i have this piece of code, but:

i would like the span classes to appear when qty is 0
do you always need the else, because else i don't want it to do anything

So only when an item is sold out it should show the text SOLD with the span classes.

Thanks.

         <?php
                $qty = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
                if ($qty == 0) :
                    echo $this->__('SOLD');
                else :
                    echo $this->__('&nbsp;');
                endif;
        ?>


texts: Remove swatches only in layered navigation Magento 2.1.x

texts:
I enabled visual swatches for color attribute and they display correctly but I don't want them in layered navigation.
I tried to change code in Magento_LayeredNavigation/templates/layer/view.phtml without success.
Hope you can help me.

Update:
I forced it using this script

<script type="text/javascript">
    require(['jquery'], function($){
        $(document).ready(function(){
            $(".swatch-attribute.swatch-layered.color .swatch-attribute-options a").each(function(){
                var label = $(this).attr('aria-label');
                $(this).text(label);
            });
        });
    });

</script>


texts: Difference between module-layered-navigation-staging and module-layered-navigation

texts:
In magento 2 enterprise edition,there are two modules for layered navigation :
module-layered-navigation-staging and module-layered-navigation.

What is the difference between these two modules?


texts:
I'd like to remove products from a category after a set time (day/week).

My idea was to create a cron file, starting with this to get all products in that category:

$category_id = 6235;
$category = Mage::getModel('catalog/category')->load($category_id);
$products = Mage::getResourceModel('catalog/product_collection')
    ->setStoreId(Mage::app()->getStore()->getId())
    ->addCategoryFilter($category);

Then remove all products from that category:

foreach($products as $product){
    Mage::getSingleton('catalog/category_api')->removeProduct($category->getId(),$product->getId());
}

Is this the right direction?
I'm getting a cron error that the catalog_category_flat table doesn't exist. Looking into the db, only catalog_category_flat_1, _2 etc exist (e.g. per store). How do I resolve this error?

Full script:

<?php
require_once 'app/Mage.php';
Mage::app();

$category_id = 6235;
$category = Mage::getModel('catalog/category')->load($category_id);
$products = Mage::getResourceModel('catalog/product_collection')
    ->setStoreId(2)
    ->addCategoryFilter($category);

foreach($products as $product){
    Mage::getSingleton('catalog/category_api')->removeProduct($category->getId(),$product->getId());
}
?>


texts: How to add custom javascript in observer magento2

texts:
Im using sales_order_place_before event and want to execute some javascript when my observer executes.
 public function execute(\Magento\Framework\Event\Observer $observer)
    {
    $order = $observer->getEvent()->getOrder();
    //add something here
}

note:do not use object manager!


texts:
In a category page I have a product list, that's good, but, when the category is a parent (level-1) i want an other style page.

For example, I want to display one slider with a new product filtered by current category, one menu with subcategory but not the list of products with filters etc...

Basically, just one page without the listing products.

Please, could you give me the best practice ?


texts: How to set the cron job for indexing in magento2?

texts: I need to setup cron job for indexing. Cron job run every day once.


texts: magento 1.8 user Login not working and in Login page " /> code displayed

texts:
User login not working and it not displayed error message also.

And the following code will shows " /> in login page, chechout page

 <?php echo $this->getBlockHtml('formkey'); ?>

Already i faced this problem, but that automatically solved.

  Note : Am using coolbaby magento 1.8 theme


texts: Enable extension for one store and disable for other store view in Magento 2

texts:
Basically the scenarios are
I have two store view one is for Pakistan and the other is for America. I want to enable the extension for one store and disable for other store?

Is there any way to do this?


texts: How to use group by option for Mage_Core_Model_Resource_Db_Collection_Abstract?

texts:
I have non-EAV model which extends Mage_Core_Model_Resource_Db_Collection_Abstract.

This is my code:

$this->getCollection()
        ->removeAllFieldsFromSelect()
        ->removeFieldFromSelect('credit_id')
        ->addFieldToSelect('product_id')
        ->addExpressionFieldToSelect('income', 'SUM({{income}})', 'income');

I need to group by *product_id* but all parents classes doesn't have this function.
Is it possible to group by somehow?


texts:
I want to add data in database from front end using modules. So I created a form as given below:

<form>

  Title
  <input id="title" type="text" name="" />

  File Name
  <input id="file_name" type="text" name="" />

  Content
  <input id="content" type="text" name="" />

  Status
  <input id="status" type="text" name="" />

  <input id="add_button" type="submit" value="Add" />

</form>

Can anyone suggest me how can I insert data from frontend in database


texts: Product didn't added to wishlist after PATCH_SUPEE-9767 installed in version 1.9.2.1

texts:
I have added a product to the wishlist in following method (Magento Version 1.9.2.1)
1. Without login, click on "Add to wishlist" link in any product
2. Get redirected to Checkout login page
3. Enter user name password
4. Redirected to the particular user's Wishlist
Before installed the PATCH_SUPEE-9767, It worked. After Patched the product didn't added to wishlist.


texts: Magento 2 : Requested store is not found when store switching

texts:
In magento 2.2, I have 2 store in my website. When, I switch to default store to other store. Then, it will display error like this

  1 exception(s):
  Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Requested store is not found

How can I solve this??

Please help me.


texts: After Magento 2.3 to 2.4 upgrade Category page not loading in frontend

texts:
Magento 2.4 upgraded successfully. All are working in admin and storefront but only problem with category page showing error
" Error: Call to a member function getUrl() on null in /home/mydomain.com/dqgdqtpdwx/public_html/vendor/magento/module-catalog/view/frontend/templates/category/image.phtml:21 Stack trace: #0
/home/mydomain.com/dqgdqtpdwx/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include() #1 "
I can access product page but issue with category page access after show in above error.
This issue solve any tips please share with me. Thanks for advance


texts: how to check external inventory for stock system during checkout

texts:
I am trying to understand what are the steps involved to developed extension in Magento CE to check (by sending SOAP message) for product availability on external inventory system during checkout process.
Thanks
ray


texts:
I needed to add a line of code to my htaccess file so I downloaded it by FTP using Filezilla to my local machine

I now see that the size of the htaccess file on the server is now 0 while the one I downloaded to my machine is not

Seeing this issue is tried to upload the htaccess file back to the server from my local machine but it does not work and it gives the below error

Command:    TYPE I
Response:   200 Type set to I
Command:    PASV
Response:   227 Entering Passive Mode (87,76,19,25,195,177).
Command:    MLSD
Response:   150 Opening BINARY mode data connection for MLSD
Response:   226 Transfer complete
Command:    TYPE A
Response:   200 Type set to A
Command:    PASV
Response:   227 Entering Passive Mode (87,76,19,25,195,149).
Command:    STOR .htaccess
Response:   150 Opening ASCII mode data connection for .htaccess
Response:   552 Transfer aborted. Disk quota exceeded
Error:          File transfer failed

I then tried to edit the empty htaccess file on the server to add in the code but when i click edit i get the below message

I have tried freeing up some disk space but yet the same issue persists

I would be extremely greatful for any help on how to restore this


texts: I am using puTTY and its showing the error.


texts: Magento 2.3 Update Stock via Database - Multi Source Inventory

texts:
I was hoping to get a grasp on the how Stock levels(Qty of a sku in stock) are stored in the database with the changes to MSI. Now that we have stocks and sources I'm unsure what all tables we need to update when making direct stock changes to the database.
My understanding is that inventory stock qty is stored in both cataloginventory_stock_item and cataloginventory_stock_status.
Here is a example edit to these to change inventory levels.

UPDATE cataloginventory_stock_item item_stock,
cataloginventory_stock_status status_stock SET item_stock.qty =
'$qty', item_stock.is_in_stock = IF('$qty'>0, 1,0), status_stock.qty =
'$qty', status_stock.stock_status = IF('$qty'>0, 1,0) WHERE
item_stock.product_id = '$product_id' AND item_stock.product_id =
status_stock.product_id

So, now that we have Sources that the inventory needs to come from. Where is that information stored?
I believe the table is inventory_source_item. This list both the source_code, qty, and stock status by SKU.
Is it as simple as making the same changes to the appropriate sku/source in this table?
Is there possibly any other changes to tables that need to be updated for the new stock qty?


texts:
Is there a way to access the variables in $category without using  $category1->getId();

I want something link $category1[0]['id'] or something like that

$category = Mage::getModel('catalog/category')->getCollection();
            $category->addAttributeToFilter("Top_Menu" , array('eq' => '146'));
            $category->addAttributeToSelect('name','parent_id','entity_id','url');
            $category->setOrder("parent_id", "ASC");
            $category->load();


texts: Magento 2. Describe different types and uses of JavaScript modules. Which JavaScript modules are suited for which tasks?

texts:
Describe different types and uses of JavaScript modules. Which JavaScript modules are suited for which tasks?

This is a question for the certification study guide.
I know it's kind broad, but still there is no direct answer on this in the docs.

This is what I found in the Swift Otter guide.

  Magento 2 utilizes RequireJS to create a modular and extensible system
  in JavaScript.
  Javascript modules can be completely custom, can extend a UI Component module,
  or be a jQuery widget. They can be asynchronously loaded or embedded directly
  in a page using a plain  tag. Magento’s  allows for loading modules and passing even complex
  configuration info into them.
  These modules handle much interaction between the website user and the
  Magento PHP application. Using Javascript to load aspects of customer data is
  ideal because it allows Magento to cache the full page. You can keep all blocks
  cacheable and load in the customer-specific information in an AJAX request.
  For work with grids and forms in the admin panel or the checkout, a UI Component
  Javascript module would be a good approach. For using KnockoutJS for a customer
  area, a simple module that is initialized through  would work well. For handling smaller DOM manipulation
  tasks, a module that creates a jQuery widget would be good.

I would say that the Javascript Module types are ui components, jquery widgets and plain javascript components.

Any opinions, hints, resources (I looked through the docs, in my opinion the JS part skips on the fundamentals)


texts: What went wrong when trying to apply the Magento patch 5994?

texts:
I accessed the server through ssh ...

My files are in public_html so i uploaded patch in there

In ssh I ran commands to get in that folder

then:

chmod +x PATCH_SUPEE-5994_EE_1.14.1.0_v1-2015-05-14-05-05-02.sh

and finally:

./PATCH_SUPEE-5994_EE_1.14.1.0_v1-2015-05-14-05-05-02.sh

I received this output in terminal...

Can anyone help me understand this (being my first time doing this?)

Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
patching file app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
patching file app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
patching file app/code/core/Mage/Customer/Model/Customer.php
patching file app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php
patching file app/code/core/Mage/ImportExport/Model/Export/Adapter/Csv.php
patching file app/code/core/Mage/Install/Controller/Router/Install.php
patching file app/code/core/Mage/Install/etc/config.xml
patching file app/code/core/Mage/Sales/controllers/Recurring/ProfileController.php
patching file downloader/Maged/Model/Connect.php
patching file downloader/Maged/View.php
patching file downloader/template/connect/packages_prepare.phtml
patching file downloader/template/messages.phtml
patching file get.php
can't find file to patch at input line 347
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git lib/PEAR/PEAR/PEAR.php lib/PEAR/PEAR/PEAR.php
|index b4633bf..e6f8edc 100644
|--- lib/PEAR/PEAR/PEAR.php
|+++ lib/PEAR/PEAR/PEAR.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
42 out of 42 hunks ignored
patching file lib/PEAR/PEAR/PEAR5.php
patching file lib/Varien/Io/File.php


texts:
I am looking to present custom-options as a link to another product.

Maybe someone will be able to tell me, or maybe there is an existing module/tutorial that will help me implement this.

Example:
https://comfy.ua/smartfon-samsung-a305-galaxy-a30-4-64gb-black.html


texts:
There have been different threads upon similar issues, that sorrily couldn’t help me further.The situation:

Magento 1.9.1 isn’t processing sales e-mails, although I arranged crontab to be executed every 5 minutes via SSH
E-Mails are not sent out, table cron_schedule is empty, table core_email_queue is filled, but field processed_at is empty
To the E-Mail address I deposited I get an error-email every 5 minutes with this content: /direct/path/to/the/store/cron.sh: line 29: syntax error: unexpected end of file
Line 29 in cron.sh is an empty line

Has anyone similar experiences or an idea how to fix this issue? Any hint is highly appreciated.

I originally developed the shop under Windows on a local xampp-environment and then transferred it to a linux-hosting environment. Everything works fine, it is currently running on a test-URL under live conditions.
I set up crontab like this:

MAILTO=info@mywebsite.com
*/5 * * * * /bin/sh /direct/path/to/the/shob/cron.sh

This is the content of cron.sh, the last line being empty:

#!/bin/sh
# location of the php binary
if [ ! "$1" = "" ] ; then
    CRONSCRIPT=$1
else
    CRONSCRIPT=cron.php
fi

MODE=""
if [ ! "$2" = "" ] ; then
    MODE=" $2"
fi

PHP_BIN=`which php`

# absolute path to magento installation
INSTALLDIR=`echo $0 | sed 's/cron\.sh//g'`

#   prepend the intallation path if not given an absolute path
if [ "$INSTALLDIR" != "" -a "`expr index $CRONSCRIPT /`" != "1" ];then
    if ! ps auxwww | grep "$INSTALLDIR$CRONSCRIPT$MODE" | grep -v grep 1>/dev/null 2>/dev/null ; then
        $PHP_BIN $INSTALLDIR$CRONSCRIPT$MODE &
    fi
else
    if  ! ps auxwww | grep "$CRONSCRIPT$MODE" | grep -v grep | grep -v cron.sh 1>/dev/null 2>/dev/null ; then
        $PHP_BIN $CRONSCRIPT$MODE &
    fi
fi


texts: Hide out of stock price but product need to be showing on frontend

texts:
I have an in issue Magento 1.9

I want to hide product price when it's out of stock but item needs
to be showing on the website.
Only hide price and it will show out of stock.

I tried these codes but get no result

RWD Theme:

  Magento_root/app/design/frontend/rwd/template/catalog/product/view.phtml

Change

    <?php echo $this->getPriceHtml($_product); ?>
    <?php echo $this->getChildHtml('bundle_prices') ?>
    <?php echo $this->getTierPriceHtml() ?>

To:

<?php if($_product->isSaleable()): ?>

        <?php echo $this->getPriceHtml($_product); ?>
        <?php echo $this->getChildHtml('bundle_prices') ?>
        <?php echo $this->getTierPriceHtml() ?>

<?php endif; ?>


texts: How to change the links of header menu in magento 2?

texts:
`How to change the links of this this menu

Register here links in my account menu

any ideas


texts: How to override html file in magento 2.1

texts:
I need to customize Magento_Checkout module.

I have tried to copied that html files into my theme path but the override is not working

Override path mentioned in below

/app/design/frontend/Vendor/ThemeName/Magento_Checkout/web/template

But the file is taken from

/vendor/magento/module-checkout/view/frontend/web/template

How to override this template html files?


texts: Magento 2, address->getRegion() return object instead of string

texts:
I'm trying to get Region from shipping address.
Here's the code :

$customer = $this->customerRepository->get('xxx@xxx.com');
$shippingAddressId = $customer->getDefaultShipping();
$shippingAddress = $this->addressRepository->getById($shippingAddressId);
$shippingAddress->getRegion();

But I'm not getting string of region name, instead I got Object from  Magento\Customer\Model\Data\Region

The country is not United States, so Region is simply string ( input text form ) instead of select, so no Region Id / Region Code when I created the customer from admin.

So, how correct way to get Region from shipping when there are no region id / region code?


texts: Magento 2 Getting error when switching order grid to show 200 rows per page in admin

texts:
In Admin->Sales->Orders, I can view orders with no problem, but as soon as I choose to display 200 rows, I got the following error,

Something went wrong with processing the default view and we have restored the filter to its original state

I can fix this error by deleting records that is related to my admin user from the database table ui_bookmark, but as soon as I choose to display 200 rows again, the erros occurs again.

What caused this issue, and if there's a way I can fix this permanently?


texts: magento - unable to save products in cart

texts:
am working magento payment gateway.

$product_model = Mage::getModel('catalog/product');
$code = Mage::app()->getStore()->getCode();

$product_id = $product_model->getIdBySku('inv_'.$code);
$_product = Mage::getModel('catalog/product')->load($product_id);

// Add to cart (?)
$cart = Mage::getSingleton('checkout/cart');
$cart->init();
$params = array(
    'product' => $product_id,
    'related_product' => null,
    'qty' => 1
);
$customer = Mage::getSingleton('customer/session')->getCustomer();
$storeId = $customer->getStoreId();
//$cart->removeItem($product_id)->save();
$cart->addProduct($_product, $params);

$cart->save();

but when I refresh cart page then no new product added in to cart

Edited :

I found product is added in cart also i checked by output values

var_dump($cart->getQuote()->getHasError());
$products = $cart->getQuote()->getAllItems();
var_dump(count($products));

Then i can see new product added count is two but when i refresh cart page then can't see second product added by code


texts: How to remove "catalog/view/.." links from products?

texts: So despite having Use Categories Path for Product URLs checked to yes I still see some products with the ugly URL like /catalog/product/view/id/12019/s/ - the majority of products have the expected SEO-friendly url's but quite a few still don't. Why does this continue to happen and would it be possible to correct this in bulk? I have a few thousand products that have this URL structure.


texts: How to get products of a category and all its subcategories by category id?

texts:
I am trying to get all products of specific category whether these products are directly listed in the category or in the subcategories under this specific category
I really searched for this on google and Magento Stack Exchange and found nothing about Magento 2, all I found are some topics on Magento 1,

Here is What I just reached,

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;

class ChildProducts extends Action
{
    protected $resultJsonFactory;
    protected $_categoryFactory;
    protected $productCollectionFactory;
    public function __construct(Context $context, JsonFactory $jsonFactory ,\Magento\Catalog\Model\CategoryFactory $categoryFactory ,
    CollectionFactory $productCollection)
    {
        $this->_categoryFactory = $categoryFactory;
        $this->resultJsonFactory = $jsonFactory;
        $this->productCollectionFactory = $productCollection;
        parent::__construct($context);
    }

    public function execute()
    {
        // get parent category
        $categoryId = $this->getRequest()->getParam('category_id');

        $productCollection = $this->productCollectionFactory->create();
        $productCollection->addAttributeToSelect('*');
        $productCollection->addCategoriesFilter(array('in' => $categoryId));
        return $this->resultJsonFactory->create()->setData($productCollection);
    }


texts: My website giveing error again and again Decoding failed: Syntax error

texts: http://www.shoppingsamrat.com/ it's getting error on Decoding failed: Syntax error again and again. when we remove cash fine on var it's going fine but after cash its getting error.


texts: 2 routers in different module for the same mage controller

texts:
I have a question.

I would like to rewrite a method of the controller Mage_Checkout_OnepageController.

The method is: saveBillingAction

But I found in other module already a router on this controller. It rewrites the other method.

So i have  :

class Mage_Checkout_OnepageController extends Mage_Checkout_Controller_Action
{
...
  /**
     * save checkout billing address
     */
    public function saveBillingAction()
    {
     ...
    }
     protected function _getShippingMethodsHtml()
    {
     ...
    }
}

AN other module :

class Gfi_TNT_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
    protected function _getShippingMethodsHtml()
    {
      ...
    }
}

And I want to crete in my own module :

class Upecom_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
    /**
     * save checkout billing address
     */
    public function saveBillingAction()
    {
      ...
    }
}

Is it possible to do that?
I tried with :

<config>
    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <Upecom_Checkout before="Mage_Checkout">Upecom_Checkout</Upecom_Checkout>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>

But it doesn't work sadly :(
And I can't modify the gfi tnt controller

Do you have a solution for that?

Cheers

Thomas


texts:
I copy these file from core to local folder from app/code/core/Mage/SalesRule/Model/Quote/Discount.php.

**WHAT I NEED TO DO IS ROUND OFF DISCOUNT VALUE WHICH ALSO ROUND OFF TOTAL VALUE AS WELL **

I used round function  :

 public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
        $amount = round($address->getDiscountAmount()); /* round up value */

        if ($amount != 0) {
            $description = $address->getDiscountDescription();
            if (strlen($description)) {
                $title = Mage::helper('sales')->__('Discount (%s)', $description);
            } else {
                $title = Mage::helper('sales')->__('Discount');
            }
            $address->addTotal(array(
                'code'  => $this->getCode(),
                'title' => $title,
                'value' => $amount
            ));
        }
        return $this;
    }


texts:
I have created a transactional email template and sending mail using below code :

$to_user_email = 'test@gmail.com';
$to_user = 'test';

$emailTemplate = Mage::getModel('core/email_template')->loadByCode('My Template');
$senderName = Mage::getStoreConfig('trans_email/ident_support/name');
$senderEmail = Mage::getStoreConfig('trans_email/ident_support/email');
$sender = array('name' => $senderName,
            'email' => $senderEmail);
$store = Mage::app()->getStore()->getId();

// Set variables that can be used in email template
$vars = array();
$vars['order_id'] = 'order_id';
$vars['content'] = 'content';

$processedTemplate = $emailTemplate->getProcessedTemplate($vars);

$mail = Mage::getModel('core/email')
     ->setToName($to_user)
     ->setToEmail($to_user_email)
     ->setBody($processedTemplate)
     ->setSubject('Subject')
     ->setFromEmail($senderEmail)
     ->setFromName($senderName)
     ->setType('TEXT')
     ->setCc(array('test1@gmail.com','test2@gmail.com'));
$mail->send();

From above code email sent to $to_user_email but cc not sent to 'test1@gmail.com', 'test2@gmail.com'.

How to send cc or bcc to multiple email address?


texts:
I have just installed Magento 1.9.1 as an upgrade from 1.7 and thought the slideshow would automatically display on homepage with the rwd/default package/theme.

Is there code that I am supposed to add to a file to display the slideshow?


texts: Undefined index: label vendor/magento/framework/Data/Form/Element/Select.php on line 68

texts:
I'm getting this error when going to a custom extension's (IWD_Opc) admin configuration page.

Undefined index: label in .../vendor/magento/framework/Data/Form/Element/Select.php on line 68

Any ideas what this error means or how to go about fixing it?

Using Magento 2.2.2.

This seems to be connected with /etc/adminhtml/system.xml with one of the fields, still not sure which one or why this is happening...

EDIT

It's connected with a new custom payment method and the system config field:

<field id="default_payment_method" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
      <label>Default Payment Method</label>
      <source_model>IWD\Opc\Model\Config\Source\Payment</source_model>
</field>

Model code is:

use Magento\Payment\Model\Config\Source\Allmethods;

class Payment extends Allmethods
{
    public function toOptionArray()
    {
        $options = parent::toOptionArray();
        array_unshift($options, ['value' => '', 'label' => '-- Please select a payment method --']);
        return $options;
    }
}

So I presume that my custom payment method is not registered properly to be included in the Allmethods class?


texts: Product multiselect attribute not saving all the values

texts:
I have custom multiselect product attribute which contains more than 1000 values. I am using "text" for this attribute, still when I select all the values and save product it saves some values but not saving last 40-50 values.

Is there any solution to save all the values?


texts: Magento 1.x not showing default Catalogsearch Result Pages

texts:
I have removed Searchanise extetension from the code. After that my default Catalogsearch is not working. Control coming in Result, List in this blocks but phtml files related to those block was not loading.

Is there another way to resolve this.


texts:
We have make custom module as of this explanation: https://stackoverflow.com/questions/6384120/magento-read-only-and-hidden-product-attributes

We missing something, because it is not working, we have done this:

Create new module in app/code/community/Wescon/Hidden/

etc/config.xml

    <?xml version="1.0"?>

  <config>
<modules>
    <Wescon_Hidden>
        <version>1.0.0</version>
    </Wescon_Hidden>
</modules>
<adminhtml>
    <events>
        <catalog_product_edit_action>
            <observers>
                <Wescon_Hidden>
                    <class>hidden/observer</class>
                    <method>wescon_hidden</method>
                </Wescon_Hidden>
            </observers>
        </catalog_product_edit_action>
    </events>
</adminhtml>

Model/Observer.php

<?php

class Wescon_Hidden_Model_Observer
{

public function wescon_hidden($observer) {
    $event = $observer->getEvent();
    $product = $event->getProduct();
    $product->lockAttribute('price');
}

}

app/etc/modules/Wescon_Hidden.xml

<?xml version="1.0" encoding="utf-8" ?>

<config>
<modules>
    <Wescon_Hidden>
        <active>true</active>
        <codepool>community</codepool>
    </Wescon_Hidden>
</modules>
</config>

We have try with catalog_product_load_after but nothing work.

Does somebody have the solution?

Thanks in advance!


texts: How do i modify the layout of the default registration page

texts:
How would i move the custom PixelPin Connect block above the Personal information block?

Here's the layout page (pixelpin_connect.xml)

<customer_account_create>
        <reference name="head">
            <action method="addItem">
                <type>skin_css</type>
                <name>pixelpin_connect/css/styles.css</name>
            </action>
        </reference>
        <reference name="customer_form_register">
            <action method="setTemplate" >
                <template>pixelpin/connect/customer/form/register.phtml</template>
            </action>
            <block type="pixelpin_connect/register" name="pixelpin_connect_register">
              <block type="pixelpin_connect/pixelpin_button" name="pixelpin_connect_checkout_pixelpin_button" />
            </block>
        </reference>
    </customer_account_create>

register.phtml:

<div class="<?php echo $this->_getColSet(); ?>">
    <?php if($this->_pixelpinEnabled()): ?>
    <div class="<?php echo $this->_getCol(); ?> pixelpin-connect-register-pixelpin">

<?php echo $this->__('Pixelpin Connect') ?>

<?php echo $this->__('You can register using your Pixelpin account.') ?>

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

    <?php endif; ?>


texts: Get Option Label and Value of Simple Product with Customizable Options

texts:
I know the way to get the customizable options by this code below:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product

foreach ($product->getOptions() as $options) {
     $optionData = $options->getValues();
     foreach ($optionData as $data) {
            print_r($data->getData());
            echo   $optionPrice[] = $data->getPrice();
            echo $optionDuration[] = $data->getTitle();
     }
}

But I don't know how to get the option_type_id of that product. I want to know what option that product have selected like:
Size : 10 kg in the select 10kg,20kg,30kg.


texts: Unexpected Issues when Creating New Products in Code with Magento 1.9

texts:
I am trying to create products programmatically and I am not getting the results I am expecting.  I have truncated core_url_rewrite and rebuilt indexes before running this ( it isn't live ) , and reindexed afterwards.

The unexpected issues:  ( and I am only doing one product to start with in isolation )

1) After saving it , if I edit the product in the admin area then I need to set the tax class before it will save correctly.

Even if I run $targetProduct->setTaxClassId(2); before saving it still asks me to save.

2) The url rewrite adds "-1" ( without the quotes ) to the end of the url path for some reason.  There is only one url rewrite created.

I'm a bit baffled by this , it's not what I am expecting.

require_once '../../../app/Mage.php';
Mage::setIsDeveloperMode(true);
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$targetProduct = Mage::getModel('catalog/product');
// $productAttributes is an array of attributes
$targetProduct->addData($productAttributes);
$targetProduct->save();

EDIT: I fixed #2 by truncating the rewrites table and rebuilding.  there was obviously an entry in there that wasn't showing on the url rewrites list in Magento.


texts: how can I get an image to be used in mobile app by rest api

texts:
I've written the following function

public function getImg($sku){
    $product=$this->productRepository->get($sku);
    $image=$product->getImage();

    return $image;
}

as an api method and it returns me the name of the image.
how can I get an image to be used and viewed in mobile app by rest api


texts: Theme drop down missing in Stors > Config > Design

texts:
I have added a custom theme under app/design/frontend

The theme, along with blank and luma are visible under Content > Themes

However when going to Stores > Config > General and selection the Design tab there are no design related options visible. Only a single entry related to search. It's like all design options including theme selection have been removed.

Do I need to do something else to makes design options visible?


texts:
Is it possible to get the invoice from an order item?

To be more specific:
I'm iterating the order ItemsCollection and if the order-item has been invoiced

$item->getStatusId() == Mage_Sales_Model_Order_Item::STATUS_INVOICED

I'd like to get the corresponding invoice for it. Especially the invoice ID.

Has anyone a solution for this?

Thank you!

edit:
I'm iterating an Order-Item-Collection. If an order-item has been already invoiced, then I would like to look up, in which invoice it has been invoiced. If the order item has not been invoiced - I leave it as is.
It is just the opposite way of iterating an invoice item collection to look up the corresponding order. There I would just say

$invoiceItem->getOrder()->getId();

and I would be perfectly done.
It may seems ridiculous to do it the opposite way (looking up an invoice for an order item instead of iterating the invoice collection of the specific order), but I'd like to avoid refactoring the whole logic.

edit:

Thanks to Lee Saferite I have found the solution for my task:

$orderItems = $order->getItemsCollection();
try {
    if (!$orderItems->hasFlag('invoice_join')){
        $orderItems->getSelect()->joinLeft(
            array('oii' => $orderItems->getTable('sales/invoice_item')),
            'main_table.item_id = oii.order_item_id',
            array('invoice_id' => 'parent_id')
        );
        $orderItems->getSelect()->group('main_table.item_id');
        $orderItems->clear();
        $orderItems->setFlag('invoice_join');
    }
}
catch(Exception $e){
    Mage::logException($e);
}

Due to the fact, that I'm calling this code inside a big foreach loop (I'm just extending an existing module - had to deal with it) I set a flag, to avoid the problem, that the join get's applied multiple times (which would end in an exception). Thanks Lee!


texts: magento 2 how to display simple product image instead of configurable product image in order detail?

texts:
I can successfully display the configurable product image in order detail page with the following code.

/** @var  $block \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer */
$_item = $block->getItem();
$imageBuilder = $objectManager->create('\Magento\Catalog\Block\Product\ImageBuilder');

<?= $imageBuilder->setProduct($_item->getProduct())->setImageId('cart_page_product_thumbnail')->create()->toHtml(); ?>

But I want the image is the simple product one. Like if I buy the blue one, it shows the blue image I set in admin.

Thanks in advance.


texts: Magento 2 Save custom customer address attribute in customer edit form using extension attributes

texts:
I want to save custom customer address attribute in Customer Edit Form under My Account section. I have created an attribute using Setup script and save that attribute using extension attributes.

  Vendor/Module/etc/extension_attributes.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Customer\Api\Data\AddressInterface">
        <attribute code="city_id" type="string"/>
    </extension_attributes>
</config>

Here I couldn't extend Magento\Customer\Api\Data\AddressInterface, that's why I'm using extension_attributes. Then I created a plugin to get and set that attribute value as follows:

  Vendor/Module/etc/di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Customer\Api\AddressRepositoryInterface">
        <plugin name="customer_city_id" type="Vendor\Module\Plugin\CustomerCity"/>
    </type>
</config>

  Vendor/Module/Plugin/CustomerCity.php

<?php
namespace Vendor\Module\Plugin;

use Magento\Customer\Api\Data\AddressInterface;

class CustomerCity {

    public function afterGetById(
        \Magento\Customer\Api\AddressRepositoryInterface $subject,
        $address,
        $addressId
    ) {
        try {
            if ($address->getExtensionAttributes() === null) {
                $address->setExtensionAttributes($this->extensionAttributeFactory->create(AddressInterface::class));
            }

            $extensionAttribute = $address->getExtensionAttributes();
            $extensionAttribute->setCityId(
                ($address->getCustomAttribute('city_id')) ?
                $address->getCustomAttribute('city_id')->getValue() : ""
            );
            $address->setExtensionAttributes($extensionAttribute);
        }
        catch (\Exception $e) {
            // Don't handle exceptions
        }
        return $address;
    }
}

Unfortunately, I'm getting an error We can't save the address. As I printed an exception message, I'm getting this message: Class string does not exist.

Please anyone let me know what I'm doing wrong. Thanks in anticipation.


texts: Product images not showing on product page but loading fine everywhere including category pages

texts:
The product images are not showing up on the product pages. All I did was - optimized few images on the media folder and replaced the current ones via ftp.

I then cleared the cache, re-indexed but the images are not showing up on the product pages. The image box is just blank. The images show up everywhere else. I went through all the suggestions I found online

Increasing php memory limit
Changing file permissions
Indexes in htaccess
Cleaning out cache and re-indexing
Deleting .htaccess in media

But can't figure out the cause. Could anyone help me identify and fix the issue please?


texts: Override admin js file not working on Magento 2

texts:
I tried to override magento/module-ui/view/base/web/js/form/element/date.js

For this,  I have created a custom module with the following:

view/adminhtml/requirejs-config.js with the following content

var config = {
    "map": {
        "*": {
            "Magento_Ui/js/form/element/date": "namespace/module/js/form/element/date",

        }
    }
}

and in this path namespace/module/view/adminhtml/web/js/form/date.js I have my js.

After deploy,  I receive an error in the  console, that my js is not found in pub/....date.js

Why this is not created? What I am doing wrong?


texts: Add to cart the same product with different configurations

texts:
I'm working on a Magento product configurator.
In one page, you are able to configurate multiple file, then add to cart.

Let's say, we want to add to cart the same product twice but with 2 different config.

When I do that, I have 1 only item on the cart, but with a quantity of 2. The config of the second item is totally lost.

Here is my code :

    $product_id = $results["product_id"];
    $product = Mage::getModel('catalog/product')->load($product_id);

    $cart = Mage::getModel("checkout/cart");
    $cart->init();

    foreach($results["params"] as $params)
        $cart->addproduct($product, $params);

    $cart->save();

Thanks


texts: Magento 2.1: setup:di:compile error Constant MASK_FOR_HIDDEN_FIELDS already defined

texts:
When we run the setup:di:compile command we are seeing the following error. I would like to know what is going on here before I contact the extension developer.

I have searched for MASK_FOR_HIDDEN in all files and it only exists in the file in the below error and also in one other file. Is this the problem? Do they need to be unique in both files?

  [Exception]   Notice: Constant MASK_FOR_HIDDEN_FIELDS already defined
  in /public_html/app/code/Magenest/SagePay/lib/classes/SagepayUtil.php on line 4

Thanks


texts: How To Find the Right Price for a Magento Extension

texts:
So you want to start selling your Magento extensions. You developed your own store, found a cool domain name, clarified all the legal stuff and you are theoretically good to go. But what is the right price for the extension? If it is too low, you will "lose" money, because people would pay more, but do not have to. If it is too high, you will also "lose" money, because people who would buy it do not do so. So how do you find an optimal price? Things that come into my mind are:

"A/B Test" Different Prices: Try different prices and see at which price the extension sells best. This approach is also outlined in the excellent post "Stop guessing! Use A/B testing to determine ideal price for your product". This may not work if you sell very few products in the beginning. You need enough data for it. Additionally, it does not look good if your customers find out.
Conduct Customer Surveys: Ask potential clients what they would be willing to pay for it. This should give you a feeling for the price range. Unfortunately, thinking about prices and actually paying the price are different things, so this may not be a good help.

Finding the right price for a (digital) product is a quite general question, so that this may not be 100% Magento-specific. However, I hope there are some good answers and hopefully also some Magento-specific experiences.


texts: PayPal gateway has rejected request. Item amount is invalid (#10431)

texts:
when I place order in review page paypal throw error

  PayPal gateway has rejected request. Item amount is invalid (#10431:
  Transaction refused because of an invalid argument. See additional
  error messages for details).

I don't know why this happens and in error log I found

  [2019-01-05 06:59:09] main.CRITICAL: PayPal NVP gateway errors: Item
  amount is invalid (#10431: Transaction refused because of an invalid
  argument. See additional error messages for details). Correlation ID:
  ad29a838e6cf8. Version: 72.0. [] [] [2019-01-05 06:59:09]
  main.CRITICAL: Exception message: PayPal gateway has rejected request.
  Item amount is invalid (#10431: Transaction refused because of an
  invalid argument. See additional error messages for details).


texts: Sales OrderController.php moved to my app > local folder and added some custom code

texts:
THE ORIGINAL IS STILL IN PLACE.

I'm writing a custom module stored in (local folder) and API (restful api) and i need to know in admin when an ordered is cancelled manually through Sales > Orders. Would it be safe practices to pull the whole sales OrderController.php and right after the cancel function add my code to notify on cancels. Obvsiously that's not my user and pw:

like so:

/**
 * Cancel order
 */
public function cancelAction()
{
    if ($order = $this->_initOrder()) {
        try {
            $order->cancel()
                ->save();
            $this->_getSession()->addSuccess(
                $this->__('The order has been cancelled.')
            );

**// API Code Start**
$data = array(
'partner_conversion_id' =>  $order->getIncrementId(),
'event_status' => 'decline'
);

$ch = curl_init('https://api.ole.com/v3/events/approve?partner_conversion_id='.$order->getIncrementId().'&event_status=decline');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_USERPWD, "6111-1:142dd3d9864d2e858124244");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
$result = ($result);
**// API Code End**

        }
        catch (Mage_Core_Exception $e) {
            $this->_getSession()->addError($e->getMessage());
        }
        catch (Exception $e) {
            $this->_getSession()->addError($this->__('The order has not been cancelled.'));
            Mage::logException($e);
        }
        $this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
    }
}

Here's my etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Extole_Api>
            <version>0.1.0</version>
        </Extole_Api>
    </modules>

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Extole_Api before="Mage_Adminhtml">Extole_Api</Extole_Api>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

<global>
    <models>
        <extole_api>
            <class>Extole_Api_Model</class>
        </extole_api>
    </models>
</global>
</config>


texts: Refund order and invoice api not working

texts:
I am trying to create credit memo and refund order and invoice via following api call:-
'/V1/invoice/36/refund'

and my array is as below, which i am converting later to JSON

$postData = [
                            "items" => $invoice_item,
                            "notify" => true,
                             "isOnline"=> 0,
                                "arguments" => [
                                "shipping_amount" => $order->shipping_amount,
                                "adjustment_positive" => 0,
                                "adjustment_negative" => 0,
                                "extension_attributes" => [
                                    "return_to_stock_items" => $order_item_arr
                                    ]
                                ],
                            "appendComment" => true,
                            "comment" => [
                                "extension_attributes" => [],
                                "comment" => "string",
                                "is_visible_on_front" => 0
                            ],
                        ];

I am getting the following error "Creditmemo Document Validation Error(s):
We can't create creditmemo for the invoice.
The creditmemo contains product item that is not part of the original order.
The "MT07-S-Gray" product is not part of the current creditmemo."

Though I have checked well the existence of product.


texts: Configurable product with color swatches

texts: I have created a configurable product, but color swatches are not displayed at frontend.


texts:
I configured my shopping cart to have 4 types of options for shipping:
free delivery, store pick up, usps, and ups.

Every so often when checking out either usps or ups disappears.

Any ideas why?


texts: Magento 2.3.5 and elasticsearch 7.7 error - Undefined factory elasticsearch7

texts:
I installed Magento 2.3.5, elasticsearch 7.7 on Ubuntu 18

Setting up, testing connection went fine, reindexing also...

I get this error:

Undefined factory elasticsearch7

in debug log
when trying to use autocomplete search.

Site search is working fine.

Anyone any ideas? Or same problem? Solved?


texts: How to add Additonal charge on COD in magento 2?

texts:
I want to add additional charge as COD payment method in Magento 2.

How can I achieve this?


texts: Add company field in Customer grid in admin

texts:
I have added "Company" field in admin customer grid, but the issue i face is sorting not working.

I have override Mage_Adminhtml_Block_Customer_Grid Class and added below code:

 protected function _prepareCollection()
    {
        parent::_prepareCollection();

        $collection = Mage::getResourceModel('customer/customer_collection')
            ->addNameToSelect()
            ->addAttributeToSelect('email')
            ->addAttributeToSelect('created_at')
            ->addAttributeToSelect('group_id')
            ->addAttributeToSelect('company')
            ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
            ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
            ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
            ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
            ->joinAttribute('billing_company', 'customer_address/company', 'default_billing', null, 'left')
            ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');

        $this->setCollection($collection);

        return $this;
    }
    protected function _prepareColumns()
    {

        $this->addColumn('company', array(
            'header'    =>  Mage::helper('customer')->__('Company'),
            'width'     =>  '150',
            'index'     =>  'billing_company',

        ));
        $this->addColumnsOrder('billing_company', 'email');
        return parent::_prepareColumns();
    }

Can anyone have solution for above issue?


texts: security risk of require_once 'app/Mage.php'; in Magento root

texts:
I have a file in my Magento root that require_once 'app/Mage.php'; to give me access to Mage::getStoreConfig system variables.

Does this cause a security risk?  Should I place it in another folder?

This is my file, /twitter.php:

<?php
require_once 'app/Mage.php';
Mage::app();
$consumer_key = Mage::getStoreConfig("Social/twitterapi/consumer_key");
$consumer_secret = Mage::getStoreConfig("Social/twitterapi/consumer_secret");
$oauth_access_token = Mage::getStoreConfig("Social/twitterapi/access_token");
$oauth_access_token_secret = Mage::getStoreConfig("Social/twitterapi/access_token_secret");


texts: How to get latest order comment on the order grid column?

texts:
In magento 1.9 how we can get comment column in sale -> orders with the latest comment e.g Customer is redirected to Paypal
Any idea what will be the query for this?


texts: Magento CMS -> Pages not showing Store View selection

texts:
Recently i have discovered a problem in one of my magento websites.
When i try to create new CMS page, there are no Store View selection. So in result when i create it, i can't access it in frontend. I get 404 error. Does anyone faced this problem, and know how to fix it?


texts: Create Custom block on Product View with form

texts:
I'm trying to do a form and put this on Product View.
I did some fields and they are saving the results on DB, ok, everything is good. But, I need to insert this block there.
Any thing that I help me?


texts: How to display default footer links for my magento store?

texts: I installed new theme for my magento 1.9.0.1 but now the default footer links(sitemap,search terms,advanced search,my account ,order and returns) are disabled.how to display these menus in footer...


texts: Create Drop-down menu in shopping Cart Page

texts:
In given link , http://liferaybangalore.com/index.php add one product to cart and go to VIEW CART ,

Above PROCEED TO CHECKOUT Button i want to add custome code for drop-down menus like(Children Education, Womens Support etc...).

/app/design/frontend/em0122/default/template/checkout/cart/totals.phtml

At end to this total.phtml page am writing code, While selecting dropdown menu should attach in mail with other details.
Please refer the attached screen shot.

Please help me out.


texts: Magento 2 Make All Zero Values into Null

texts:
How to make all 0(zero) values in my custom grid into Null or Blank? because when I edit and I leave a field blank it automatically make column values 0 once I save it.

here's the code of my inline edit:

protected $jsonFactory;

public function __construct(
    \Magento\Backend\App\Action\Context $context,
    \Magento\Framework\Controller\Result\JsonFactory $jsonFactory
) {
    parent::__construct($context);
    $this->jsonFactory = $jsonFactory;
}

public function execute()
{
    /** @var \Magento\Framework\Controller\Result\Json $resultJson */
    $resultJson = $this->jsonFactory->create();
    $error = false;
    $messages = [];

    if ($this->getRequest()->getParam('isAjax')) {
        $postItems = $this->getRequest()->getParam('items', []);
        if (!count($postItems)) {
            $messages[] = __('Please correct the data sent.');
            $error = true;
        } else {
            foreach (array_keys($postItems) as $modelid) {
                /** @var \Magento\Cms\Model\Block $block */
                $model = $this->_objectManager->create('Cumbria\EventsRegistration\Model\Events')->load($modelid);
                try {
                    $model->setData(array_merge($model->getData(), $postItems[$modelid]));
                    $model->save();
                } catch (\Exception $e) {
                    $messages[] = "[Events ID: {$modelid}]  {$e->getMessage()}";
                    $error = true;
                }
            }
        }
    }

    return $resultJson->setData([
        'messages' => $messages,
        'error' => $error
    ]);
}

XML for item listing:

<column name="order_id">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="filter" xsi:type="string">text</item>
                <item name="editor" xsi:type="array">
                    <item name="editorType" xsi:type="string">text</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                </item>
                <item name="label" xsi:type="string" translate="true">Order ID</item>
            </item>
        </argument>
    </column>


texts: Magento 2 how to select/fetch data from database?

texts: I have created my custom module which posts data from magento to an API. How do I fetch the customer, category and order data from the Magento2 database? Will object manager help as a replacement for the Mage::getModel()?


texts: Magento2 Rest Api login customer using Website Id?

texts:
I am using login API magento2 but I want to use customer log in using website id
In URL/rest/Store_code/V1/integration/customer/token if I am using store code it's working but want use website id does not store code
In Body
{"username":"test@test.com", "password":"Abc@123456","website id":2}


texts:
I'm trying to utilize the menu or nav jQuery widget that comes with Magento 2 based on what I'm trying to accomplish. A secondary navigation section that will live on a sidebar element. It's just a vertical nav, nothing fancy - no ajax or actual calls for data. Just a list of links that needs to collapse for screen real estate's sake.

It is my understanding that I am going to have to style them, and for time's sake I'd prefer to utilize whatever will be responsive and require the most minimal styling on my part.

For the life of me I'm unable to get the jQuery to work on page. If someone could shoot me an implementation that is working as a vertical nav that will still render as something usable responsively I'd be forever grateful!

I'm open to pulling in outside js libraries, if that's the easiest solution.


texts: Magento 1.9.1: Bundle Items Doesn't Show All Products For Selection

texts:
Update: Digging through app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php and making some progress.  Commenting out the filters help...

protected function _prepareCollection()
{
    $collection = Mage::getModel('catalog/product')->getCollection()
        ->setStore($this->getStore())
        ->addAttributeToSelect('name')
        ->addAttributeToSelect('sku')
        ->addAttributeToSelect('price')
        ->addAttributeToSelect('attribute_set_id')
        ->addAttributeToFilter('type_id', array('in' => $this->getAllowedSelectionTypes()));
        //->addFilterByRequiredOptions();
        //->addStoreFilter();

Single store installation.

When I try to the "Please Select Products to Add" step I cannot see all the products that are available.  I've tried searching without any filters, by id or SKU to no avail.

See this example for the results on a backend catalog search with the same filters than in the "Please Select Products to Add":

Filter "rpi" for SKU on the catalog backend:

Filter "rpi" for SKY on the "Please Select Products to Add" within "Bundle Items" of a Bundle product:

Does someone have any suggestions why this is the case?

The problem is in the search within the Bundle Items, as the products exist and appear in both the backend and frontend (even categories) without a problem.


texts: How to add ajax to custom theme add-to-cart and Wishlist button?

texts:
I created my website using a custom theme, how to implement ajax to my add-to-cart and wishlist button?
I tried the following step, it not working,
vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml (For testing purpose added in core files)
<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "Magento_Catalog/js/validate-product": {},
            "catalogAddToCart": {
                "bindSubmit": true
            }
        }
    }
</script>


texts:
I'm currently using $_category->getImageUrl(); to return a category's image. How can I get a smaller thumbnail of the category image? I've tried $_category->getThumbnailUrl();, but that doesn't appear to work. It seems pretty easy to get a product thumbnail, but for some reason categories are a little trickier. Does anyone know how to get a smaller version of the category image?

Thanks in advance...