texts: Magento2 CSS groups in styles-m.css in wrong order

texts:
my themes "_extend.less" file looks like this:

//common
& when (@media-common = true) {
...
}
//mobile
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
...
}
//tablet
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
...
}

in the generated styles-m.css everything under the common block is put at the end of file after the @media blocks, which breaks the order of precedence for mobile styles.

shouldn't the common block come first in styles-m and than the @media rules in the generated file?


texts: Magento 2: Modal form submit not working with KO

texts:
Modal popup from submit not working after KO binding for input magento 2
I have working on form submit using popup to send email from homepage to checkout for that I have created popup which was working earlier with custom field in modal. phtml code below

<?php echo $block->escapeHtml(__('Start Your')) ?> Free 14-DayTrail

        <form id="free-trail-form" action="<?php echo $block->getFormAction() ?>" method="post">
            <fieldset class="fieldset">

                <?php if($block->isLoggedIn()): ?>
                    <?php //$customerEmail = $block->getEmail(); ?>
                 <?php endif; ?>

                        <?php echo $block->escapeHtml(__('Email Address')) ?>

                        <input data-validate="{required:true, 'validate-email':true}" type="email" id="email" class="input-text" <?php echo ($block->isLoggedIn()) ? 'disabled' : ''; ?>
                        data-bind="value: customer().email"
                        name ="email" placeholder="Enter your email address" />

            </fieldset>
        </form>

but form submit not working which I add ko binding in customer email input field


texts: newsletter need to confirm disabled but unconfirmed from new account form

texts:
I have the Newsletter need to confirm disabled

When I subscribe from footer or from a logged account it works, but when I subscribe from the new account form then the subscription status is set to unconfirmed.

By default new customers are disabled, and need to be manually activated from backend, but when I activate the new customer then the newsletter status is set automatically to unsubscribed and an unsubscription email is sent to customer.

In this image customer with id 916 is not yet activated, and customer with id 917 is activated. So the status from 917 went from unconfirmed to unsubscribed. (both are fake emails).

Why are the new customers unconfirmed despite need to confirm is disabled? Why are they unsubscribed when this customers are activated?

Edit: I wanted to be sure that need to confirm is off, so just now I  changed the subscribe function in app/code/core/Mage/Newsletter/Model/Subscriber.php to this:

// $isConfirmNeed   = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
$isConfirmNeed = false;

But even with this change the new customers subscribed to the newsletter are unconfirmed.


texts: Magento1.9 - How to rewrite exact url using xml

texts:
I want to rewrite /custom link from /catalogsearch/result/?q=some&attr=value for this I have added below code in my module config.xml

...
<rewrite>
    <mymodule>
        <from><![CDATA[/custom/]]></from>
        <to><![CDATA[catalogsearch/result/index/q/some/attr/value/$1]]></to>
        <complete>1</complete>
    </mymodule>
</rewrite>
...

From above code url /custom showing content of search page, but the other url including custom also rewritten from above code. for example /custom-page or custom-page1.

How to rewrite exact url?


texts: Magento 2 call static block in the top menu navigation

texts:
How to add the static block in top menu navigation in the home page in magento 2?

Ie) in the below menu, i need to add a static block(image) to the top or right

Something like this:

I have just created the static Block from admin from Content->Blocks,
I need to know like how to use the static block in the top menu.

Please give an example.


texts: Magento 2.2.1 - how to give discount on payment methods?

texts:
I go to Magento 2.2.1 Admin > Marketing > Promotions > Cart Price Rules and create a new Rule: Conditions.

Option "Payment Method" is not showing up in Conditions Tab. I want to give some discount on specific payment methods.

Screenshot :

Please help :)


texts: Show Order Comments on Invoice shipping PDF Magento ver 2.3.0

texts:
How to show order comments history in PDF shipping

vendor/magento/module-sales/Model/Order/Pdf/invoice.php


texts: Can customers reorder configurable products?

texts:
Does anyone know how you can get it so that configurable products can be reordered as well as simple products?

I have to set up a product that a customer will pick size, colour and material. But it will often be the procurement department ordering and they will just want to reorder the product again.

Is this possible?


texts:
I have upgraded the Magento version to 2.3.3 successfully, but when I try to run the command

php bin/magento setup:upgrade

I am getting this error:

error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: ALTER TABLE sales_order_grid MODIFY COLUMN base_grand_total decimal(20, 4)  NULL  COMMENT "Base Grand Total", MODIFY COLUMN base_total_paid decimal(20, 4)  NULL  COMMENT "Base Total Paid", MODIFY COLUMN grand_total decimal(20, 4)  NULL  COMMENT "Grand Total", MODIFY COLUMN total_paid decimal(20, 4)  NULL  COMMENT "Total Paid", MODIFY COLUMN subtotal decimal(20, 4)  NULL  COMMENT "Subtotal", MODIFY COLUMN shipping_and_handling decimal(20, 4)  NULL  COMMENT "Shipping and handling amount", MODIFY COLUMN total_refunded decimal(20, 4)  NULL  COMMENT "Total Refunded"

Does anyone have an idea?


texts: Magento-2.0.7 Admin dashboard's links are not working after installing

texts:
I have installed magento-2.0.7

When I logging in to the admin dashboard, I can't see any icon of options(like broken). And they are not working.

Can anyone help me please on this issue?


texts: Adding checked products to cart from wish list in magento 2.1

texts:
In wishlist I am having 5 products, I am selecting only 2 products from wishlist and clicking on Add all to cart button, it adds all five products to cart rather than adding only checked products from wish list.
Can any one help to fix this.


texts: Magento 2 : style-m.css and style-l.css is not appearing in frontend

texts:
I am facing a weird issue with magento 2.1.3. style-m.css and style-l.css is not appering in frontend. Due to this frontend designs are messing up. I have tried following command to fix this issue but unable to get resolution.

php -f bin/magento setup:static-content:deploy
php -f bin/magento indexer:reindex
php -f bin/magento cache:flush

Mode : Development
Cache Status : Disable

Thanks in advance


texts: API to automatically import Woocommerce orders to Magento

texts:
I'm looking for the best way to automatically import orders from a Woocommerce shop to Magento.

Do you guys have any ideas how to do that ? CSV auto export/import ?


texts:
I'm trying to pull through the gallery images on the product page because customizing the gallery with code:

<?php $_product = $block->getProduct(); ?>
<?php $gallery = $_product->getMediaGalleryImages(); ?>

<?php foreach ($gallery as $galleries): ?>
  <figure><?php echo $galleries ?></figure>
<?php endforeach; ?>

But first image is not loading. How fix this?


texts: How to get Started Creating a Configurable Product

texts:
I am trying to follow the Magento 2 documentation on creating a configurable product.

The very first step in the doc fails.

screen shot 1 (Magento Doc makes it look easy)

screen shot 2 (my Magento does not work)

Amendment #1

I have built 14 attribute sets so far

Amendment #2

If it helps anyone troubleshoot the issue, here are the user instructions I have created for my client as pre-requisites to setting-up products. These are the 2 steps to setup an Attribute and an Attribute Set. Thank you for any comments or help in how to create Configurable Products in Magento 2.0.2


texts:
I have extended Mage_Cms_IndexController so that I can log my 404 pages. Within that class I have...

public function noRouteAction($coreRoute = null)
{
    $this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
    $this->getResponse()->setHeader('Status','404 File not found');
    //Begin Modification
    Mage::log('My log data', null, '404s.log');
   //End modification
    $pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_NO_ROUTE_PAGE);
    if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
        $this->_forward('defaultNoRoute');
    }
}

System logs are enabled and /var as well as /var/log are chmod to 777.


texts: Specific Search Terms/Query Entered (NSFW)

texts:
(Warning: NSFW website. 18+)

The search panel on my company's website seems to be searching for individual words rather than for the query entered.

For example, when I search for o ring 104 products come back in the search results (whereas we sell less than 10 items with the words 'o ring' in the title) (http://rougegarments.co.uk/catalogsearch/result/?q=o+ring)

How would I go about changing this to search for query as opposed to specific terms. I am running the Buyshop ver 2.3.1 Theme in Magento.

Any help is much appreciated :)


texts: Using Bundle products in two different cases in the same site

texts:
I am developing a site which has many products that are going to be collections of individual books.
So we have a collection A and that collection must have an SKU and be made of 4-5 individual simple products. These collections when they belong to one category(let's say category A) they should be with fixed quantities.I mean if you buy collection A you are buying one copy of the individual products.
My idea is to do that with bundle products.So far so good.

The problem is that for the same collections i want the customer to be able to choose the quantity of each individual product if that collection is on a different category(let's say category B).

So i want to use the bundle products in both cases but in case one with fixed quantity and in the second the user will be able to change the quantity.(By the way i use a module in order to be able to change the quantity).
Can i use an observer for example when the product is loaded to change the template of the product or hiding the quantity? Is this a bad approach? Any other idea is welcome.
Thanks in advance and i hope it make sense.


texts: How can i remove index.php from Categories URL & Products URL?

texts:
In my base url not have index.php, but my all categories and products url  consists index.php. How can i remove this.

Note : Base url have not index.php


texts: folder and files permission for magento 2?

texts:
I am download magento 2.0. Please tell me the folder and files permission for magento 2.0.

I give the 777 permission to all folders and files, setup wizard not working.

Thank you.


texts: Catalog Search looking at descriptions = returning irrelevant search results

texts: The Catalog Search seems to be returning irrelevant search results probably because it is searching also based on descriptions. What are the proper CATALOG SEARCH settings? Also - layered navigation seems to be connected with this somehow - what is layered navigation and how do I know if I have it or not?


texts: Magento 2 - After adding to cart, cart page showing empty

texts:
I have a magento 2 website and I am facing an issue where After you add to cart, cart page is showing empty.

It's not happening all the time but most of the customers are facing this issue.

Thanks


texts: I want to override the grid of customer to delete some columns from and add others so how to proceed. I overrided the customer_listing.xml but no result


texts: Magento 2: Is there a way to import more than 200 products at a time?

texts:
My import is only addressing the first 200 parts, is there somewhere to change this setting?

I am using the built in import function

My inventory is 8870 lines but it only is importing the first 200.

Is this a limitation that is set somewhere?  I see people mentioning importing much more than this but I cannot find where a setting might be.


texts: Currency switch Cannot login or Error after login and switch currency

texts:
Can't login after changing the base currency, Store standard currency is EUR.

I have registered a customer with base currency EUR. And after I change the base currency to GBP i cant login with that customer account, its keeps loading but nothing comes. After a while it throws an error Service Temporarily Unavailable. But the same user can login when the base currency is EUR . Problem is with switching currency.

Same thing hapens when login with base currency EUR en when logged in switch to GBP or other currency we get the same error.

After that have to delete cache and cookies to get back to site.

Basically we are trying to implement Currency switcher, it works well for guest users. But doesn't work when the user is trying to login and the current currency does not match to the currency at the time of user registration.

magento version is 1.9.3.4 CE
Theme Ultimo


texts: How to get All product max and min range in layered Navigation magento 2.2

texts:
I want to make Magento 2 filter option like this

but don't have any idea how to get max and min price range of all products in product listing page in Magento 2

thanks in advance


texts: Translate modal confirm buttons in arabic Magento2

texts: How to translate modal confirm buttons in arabic?


texts:
I scanned my site from the New Magento Security Tool available from magento partner portal.

The report showed me two Vulnerability issues

1) SSL TLS - Your server supports TLSv1.0. Please update your configuration to discontinue TLSv1.0 support.

How can i fix this issue?


texts: Related product not adding to cart in Magento 2

texts:
I made a custom module for adding products to cart with help of ajax. Here I'm adding related products too. But the problem is that related products are not adding to cart. In my controller

public function execute()
{

    $productId = $this->getRequest()->get('id');
    $currentProduct = $this->_productFactory->create()->load($productId);
    $this->registry->register('product', $currentProduct);
    $resultRedirect = $this->_pageFactory->create();

    $message['html']= $resultRedirect->getLayout()
        ->createBlock("Magento\Catalog\Block\Product\ProductList\Related")
        ->setTemplate("Magento_Catalog::product/list/items.phtml")
        ->setData('type', 'related')
        ->toHtml();

       return $this->getResponse()->representJson(
            $this->jsonData->jsonEncode($message)
        );

}

I debugged in related-products.js and found that when I clicked on checkbox it is getting attached to function but not adding to cart.


texts: How to assign associate products to a grouped product programmatically?

texts:
I've created a grouped product programetically. And want too map associate products to it. I tried the following code which didn't work.
first way:

$gProduct->setGroupedLinkData(array($id1,$id2));

second way:

$gProduct->setAssociatedProducts(array($id1,$id2));

Any suggestions will be appreciated.

Thanks in advance.


texts: Programatically can we use load in magento for array of products ids for getting product details

texts:
I am working on product collection. I am using

$product = $productModel->load(42);

I have array of products like :

$productArray = array('1','15','25','35','42');

I want to pass this array in load but it is not working and giving error. How we can multiple entity ids into load for getting all details once.


texts:
I need to load the customer by using customer repository to check if this customer is exists i used dependency injection in controller but it doesn't work. Can anyone help me?
Many thanks

 namespace ThuyNT\SSO\Controller\Account;

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

protected $resultPageFactory;

public function __construct(
    Magento\Customer\Api\CustomerRepositoryInterface $customerRepo)
    \Magento\Framework\App\Action\Context $context,
    \Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
    $this->resultPageFactory = $resultPageFactory;
    $this->customerRepo = $customerRepo;
    parent::__construct($context);
}

public function execute()
{
    try{
        $customerId =1;
          $customer =  $this->customerRepositoryInterface->getById($customerId);
          return $customer;
    }
    catch (\Exception $e) {
        return $this->_messageManager->addError('failed');

}

}


texts: SOLVED Createblock definition in magento 2

texts:
i search around a lot about references of this function. but the documentation have a big lack. does somebody explain me this part of code (deeply) ?

            $this->getLayout()->createBlock(
            ClassElementLikeSelect::class,
            '',
            ['data' => ['is_render_to_js_template' => true]]
            );

i don't understand this solution. i find this everywhere but nobody explain why you set that argument (is_render_to_js_template for example) .

UPDATE:

the createBlock is definite with block Factory and are inside these classes

https://github.com/magento/magento2/blob/0eb8677b0b4e35606032e856cc1ef7c80e68829f/lib/internal/Magento/Framework/View/Layout.php

https://github.com/magento/magento2/blob/0eb8677b0b4e35606032e856cc1ef7c80e68829f/lib/internal/Magento/Framework/View/Layout/Generator/Block.php


texts: Magento create simple product from configurable for multiple stores not working

texts:
I have a problem on my Magento store. I have multiple stores (for different languages, let's say English and German). I also have configurable products, which work ok. My problem is that when I create new simple product from within configurable product (on associated products tab) the simple product is only created for default store (0), and the appropriate name, description, eg. is not copied to it from configurable product.

So if I create a product like this, go to check in german store, the title, desc. etc. is still in default language (eng).

I went to investigate how these products are created and discovered that it is done by these function:

public function quickCreateAction()
Which is located in app\code\core\Mage\Adminhtml\controllers\Catalog\ProductController.php, around line 984.

So my question, how to rewrite these function, so that it would save product for all stores?


texts:
I have the next problem:

I have my custom module for testing and i try open a csv file and import products.

My problem is that i can open a csv in a file.php and show data but in file.phtml i cant open csv file.

My code is this:

            $file="ejemplo_productos.csv";
            if (file_exists($file)){
                $gestor = fopen($file, "r");
                var_dump($gestor);
            }
                while (($data = fgetcsv($gestor, 1000, ";")) !== FALSE) {
                    echo 'Importing product: '.$data[0].'
';
                    foreach($data as $d)
                    {
                        echo $d.'
';
                    }
                    $num = count($data);

                    $row++;
                }
                fclose($gestor);

This code in file.php works fine, in file.phtml dont found.

Help me, Ty!!


texts: Magento2 - Set value for dropdown type product custom attribute programatically

texts:
I have a custom attribute with code 'manufacturer'.

Its Catalog Input Type for Store Owner is 'Dropdown'.

How can i set the value for this attribute programmatically on product save.
I am trying this, but unsuccessful

  $product->setManufacturer('ICM');
  $product->save();

What is the correct syntax for saving this type of attribute value


texts: Store Specific string from Html Page into PHP variable

texts:
i have complete html page, i need to store a specific string value in php variable.

specific value i can only select by css selector. but i have to store it in php variable.

however i can do complete this work in javascript with some easy code but i have to do this by php can somebody advice.

javascript solution.

<script>
    <script>  var xa = document.querySelector("span.posted_in a").text;
    document.write(xa);
    </script>


texts: How to move Admin notification block to header?

texts:
I would like to move the notification toolbar thats located under the menu of Magento's admin panel and place it in a div i have in the header.

I tried achieving this by cutting the following line from app/design/adminhtml/default/default/template/page.phtml

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

and pasting it in app/design/adminhtml/default/default/template/page/header.phtml

but that didn't work.

could someone advise me on how to move the notification block to the header section, please.


texts: Magento2 importer importing only 400 rows everytime

texts:
I need to import 19000 price list in Magento system. My client break it into bunch of 5000 each.
While importing we noticed a weird behaviour that everytime when importing every batch only 400 products price get updated, after that it stuck in an endless loop only loader "Please Wait" comes.
No error is been displayed and the status is in-progress.
Every time it get stuck after 400 SKUs.
I checked in network and receiving a 502 badgateway. Any Suggestions ???
Any idea or suggestions why ??
Thanks


texts:
I'm trying to include a custom child
catalog/product/view/type/options/sizechart.pthml into catalog/product/view/type/options/configurable.phtml.

So far it doesn't show on front-end.

Here is my catalog.xml

<block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml">
     <block type="catalog/product_view_type_configurable" name="product.info.options.configurable.sizechart" as="sizechart" template="catalog/product/view/type/options/sizechart.phtml"/>

And my configurable.phtml

<?php echo $this->getChildHtml('sizechart.pthml'); ?>

Any idea why it doesn't show?

BTW if I use this code in configurable.phtml it works but I don't think it's the proper way to do it

<?php  echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/view/type/options/sizechart.phtml')->toHtml();?>


texts: Magento 2 email_order_set_template_vars_before observer triggers only when I resend email in the admin

texts:
I created a new template var using email_order_set_template_vars_before observer and it works when I send email new order through the Magento admin. But it does not trigger when new order is placed. Here is my code.

events.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">

    <event name="email_order_set_template_vars_before">
        <!-- <observer name="shipperhq_save_email_variables" disabled="true"/> -->
        <observer name="cd_shipperhq_save_email_variables" instance="Foobar\ShipperHQDeliveryDate\Observer\SaveEmailVariables"/>
    </event>

</config>

SaveEmailVariables.php

namespace Foobar\ShipperHQDeliveryDate\Observer;
use Magento\Framework\Event\ObserverInterface;

class SaveEmailVariables implements ObserverInterface
{
    private $carrierGroupHelper;
    public function __construct(\ShipperHQ\Shipper\Helper\CarrierGroup $carrierGroupHelper) {
        $this->carrierGroupHelper = $carrierGroupHelper;
    }
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $transport = $observer->getEvent()->getTransport();
        $order = $transport->getOrder();
        $orderDetail = $this->carrierGroupHelper->getOrderCarrierGroupInfo($order->getId());

        if($order != null)
        {
            foreach ($orderDetail as $orderData) {
                $ddate = array_key_exists('delivery_date', $orderData) ? $orderData['delivery_date'] : '';

                $transport['cddeliveryDate'] = date( 'F d, Y', strtotime( $ddate ) );

            }
        }
    }
}```


texts: Strange redirect after Magento transfer from an old website to new website

texts:
I have moved my database and Magento files to my new domain as had problem with my old domain. I have changed the local.xml file to point to the new database and I've changed web/unsecure/base_url and web/secure/base_url in the database and I searched for any other section in the database that had my old domain name.

My problem is that if you put my domain name www.example.co.uk gets redirected to www.example.com, I have spoken to my host company and they say the domain is setup correctly and it's a problem with the Magento files. If I remove all Magento files it doesn't redirected to the old domain.

If anyone can advice what other file I need to look at to stop the redirection I will be very grateful.

I look forward in hearing back from you.


texts:
I am trying to create custom variable in Magento, but how do I get the discount label for the code used and variable for discount description.

I have found the following code, but am not sure how to get the correct field from the database.

Mage::getModel('core/variable')->setStoreId(Mage::app()->getStore()->getId())->loadByCode('custom_variable_code')->getValue('text');

also do I use the variables in this format?

{{var custom_variable}}


texts: Edit Magento "Product Comparison page" template

texts:
I want to customize the product comparison page but i can't seem to find the file that manages this.
I'm pretty new to Magento.


texts:
I have added product to customer cart programmatically with custom
prices as quatation.
Now customer should not add,remove or update cart items as it is
fixed quatation.

How can i achieve this?


texts: Can I increase the width of the column layout on default magento theme

texts: I want to know is there a way to increase the default width of the columns in magento default theme, version 1.8.1? If so, where do i access this information and how do i update it? I know that by default we have 2 column with right bar.


texts: Catalog Search Index not changing status "required index"

texts: I ran many time reindex process and system always returning the status "required index". I truncate the table without success.


texts: Carousel on CMS page from different categories

texts:
I would like to have product carousels on my homepage using 3-4 different product categories.

That means i would have my left and right sidebar and then in the middle I would like to have the following

Carousel 1 (3 products Category 1)

Carousel 2 (3 products Category 2)

Carousel 3 (....

and so on similar to this one

Is that somehow possible?


texts: After migration product page & category page giving 404 error page

texts:
I have migrate in magento 1.7.0.2 to Magento 2.0.4.

All things are working fine except product page & category page giving 404 error.

Is there any idea to resolve it ?

Thanks


texts:
I am getting below error while migrating data from Magento 1.9 to 2.

  [UnexpectedValueException]
    Invalid parameter configuration provided for $sourceDocument argument of Migration\RecordTransformer

I just saw someone were also getting same issue previously.
Did you get any solution on this ?


texts: Convert SQL Select to Magento getCollection statement

texts:
I have a complex sql select query that I want to load as collection so as to display the data in a custom grid but I'm not able to convert the query into Magento's equivalent getCollection statement.

SELECT
t1.increment_id AS "Order #",
t1.created_at as "Purchased On",
t1.billing_name as "Bill to Name",
t1.shipping_name as "Ship to Name",
t1.status as "Current Status",
IFNULL(MAX(CASE WHEN t2.status = "pending" THEN t2.created_at END), '') AS "Pending at",
IFNULL(MAX(CASE WHEN t2.status = "processing" THEN t2.created_at END), '') AS "Processing at"
FROM `sales_flat_order_grid` as t1
INNER JOIN `sales_flat_order_status_history` as t2 on t1.entity_id = t2.parent_id
GROUP BY t1.increment_id
ORDER BY t1.created_at DESC

Joins are easy but the main problem are the complex columns. Please suggest on how to go about it.


texts: Side Effects when allowing longer Meta Descriptions

texts:
Since the meta_description attribute has a varchar backend type, the input is limited to 255. However nowadays Google supports longer meta description.

If the backend type of meta_description is changed from varchar to text, the descriptions will no longer be stored in catalog_product_entity_varchar, but catalog_product_entity_text instead. Will this have any negative side effects? Should the old meta descriptions be imported into catalog_product_entity_text and removed from catalog_product_entity_varchar?


texts: Observers don't get called if wrapped within , but get called without

texts:
I run into this odd situation where the observer doesn't get called if I wrapped it under adminhtml. For example the following observer is called when I saved a product.

 <events>
    <catalog_product_save_after>
        <observers>
            <testname_testmodule>
                <class>testname_testmodule/observer</class>
                <method>logUpdate</method>
                <type>singleton</type>
            </testname_testmodule>
        </observers>
    </catalog_product_save_after>
</events>

However, if I wrapped event within  like below, then it doesn't work.

<adminhtml>
    <events>
        <catalog_product_save_after>
            <observers>
                <testname_testmodule>
                    <class>testname_testmodule/observer</class>
                    <method>logUpdate</method>
                    <type>singleton</type>
                </testname_testmodule>
            </observers>
        </catalog_product_save_after>
    </events>
</adminhtml>

Am I missing something here?


texts: How to get a database table data in a new module?

texts: I want to create a new module in which I would like to have data of a specific database table. Is it possible ? If yes, please guide !


texts: Magento 2 change urlkey and set custom product urlkey

texts:
I want to change my Magento 2 product urlkey and set something like example.com/product-name/product-id instead of example.com/product-name.html.

Where do I have to change it while saving product from admin ?

I found this file but it does not work .

vendor\magento\module-catalog-url-rewrite\Model\ProductUrlPathGenerator.php

I changed in this file and then created a new product. Should I change another file?
Please help me.


texts: How to get Analytics on this site? The SEO people say they are unable to install webmaster tools because the code isn't in the  section

texts:
The SEO company keeps bugging me to put the Analytics code in the <head> section because they say:

"...the code isn't in the <head> section, I am unable to install webmaster tools, which is essential to us tracking keywords for the campaign. Could you please move the analytics code to the <head> section or paste the following code in the  section?"

How do I do that? Or is there a place in the Admin where this can be added and it would allow the SEO people to install the Webmaster tools?

NEW INFO: Magento 2.1.0

Update: I tried putting the code into:

Content -> Design -> Configuration -> Open your theme for edit -> HTML Head

but it didn't include the Google Analytics code before the end HEAD tag so I put it at the bottom of:

/public_html/app/design/frontend/myTHEME/MYtheme/my_THEME/templates/html/head.phtml

Is this a good solution?


texts: How can I add a block or div on product page to add video and pictures after product info main?

texts:
I want some thing like this image

 .Mean to say I want to make a div or block like this and add video and images of product. ?


texts: How to echo Admin user name for current session and Save into database table?

texts:
Here I will add the solution to the question just in case someone else has the same issue/extension. I have also sent the Code updates to [link]http://www.boostmyshop.com/english/magento/product-return-rma.html to add to a possible upgrade of their RMA's extension.

I needed to add the name of the logged in admin that created an RMA in Magento CE 1.7 using the above extension that I purchased along with their Embedded ERP solution.

Here's the code:

add this to AdminController.php (Not sure if it is really neccessary)

    public function getUser()    {

   return Mage::getSingleton('admin/session')->getUser();

}

At the top of info.phtml add this:

 <?php $user = Mage::getSingleton('admin/session');$userName = $user->getUser()>getUsername();?>

Then this around line 10

<input name="data[rma_admin]" type="hidden" value="<?php echo $userName ?>" />

Then create an additional tr/td and add this:

<?php echo $this->__('Updated by'); ?>	<?php echo $this->getRma()->getrma_admin(); ?>

You must also add the additonal columns to display the admin name in the Grid.php files

 $this->addColumn('rma_admin', array(
'header'=> Mage::helper('ProductReturn')->__('Updated by'),
'width' => '100px',
'type'  => 'text',
'index' => 'rma_admin', ));

Finally inside the rma Database table ceate a new column called "rma_admin"

Done!!!


texts:
We are moving out site from single dedicated server to AWS. AS part of the AWS implementation we will be using a load balancer across multiple web hosts (to a single DB). In order to support this configuration we need to move from file based session data to DB but in testing this breaks the site.

The process we are testing is to change local.xml to DB session and then clearing session/cache of server. Going to the site root works, but as soon as you try logging in or go through checkout you are prompted with the Magento installation screen?!? Same happens when you go to the admin page.

So, it appears that it's working for HTTP but not HTTPS? Also noticed that no cache is being created in var - the cache folder is created but no subfolder/files. Permissions are 777 on var.

Any help appreciated.


texts: Set the default id of items in a custom collection

texts:
What I have

I've created a grid in admin area which fills with this collection:

protected function _prepareCollection() {
    $collection = Mage::getResourceModel('mymodule/mymodel_collection')
        ->addFieldToFilter('ce2.attribute_id', array('eq' => array(5)))
        ->addFieldToFilter('ce3.attribute_id', array('eq' => array(7)))
        ->addFieldToFilter('ce4.attribute_id', array('eq' => array(862)))
        ->join(array('customerTable' => 'customer/entity'),
            'customer_id=entity_id',
            array('entity_id', 'email')
        );

    $collection->getSelect()
        ->join( array('ce2' => 'customer_entity_varchar'), 'ce2.entity_id=customerTable.entity_id', array('customer_first_name' => 'value'))
        ->join( array('ce3' => 'customer_entity_varchar'), 'ce3.entity_id=customerTable.entity_id', array('customer_last_name' => 'value'))
        ->join( array('ce4' => 'customer_entity_varchar'), 'ce4.entity_id=customerTable.entity_id', array('customer_store_name' => 'value'));

    $this->setCollection($collection);

    parent::_prepareCollection();

    return $this;
}

I've prepared some columns in _prepareColumns and I've set it up to manage export the rows in CSV format:

protected function _prepareColumns() {
    ...

    $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
    return parent::_prepareColumns();
}

And in my controller class I have nothing but generating CSV:

public function exportCsvAction()
{
    $fileName = 'export.csv';
    $grid = $this->getLayout()->createBlock('mymodule/adminhtml_myblock_grid');
    $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
}

The Problem

The problem is I'm getting Item (Myvendor_MyModule_Model_Mymodel) with the same id "{id}" already exist, whenever I hit the export button.

What I've Found

I've tracked down the issue in lib/Varien/Data/Collection.php:367:

public function addItem(Varien_Object $item)
{
    $itemId = $this->_getItemId($item);

    if (!is_null($itemId)) {
        if (isset($this->_items[$itemId])) {
            throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
        }
        $this->_items[$itemId] = $item;
    } else {
        $this->_addItem($item);
    }
    return $this;
}

And looking into $this->_getItemId($item) I can see that it's just getting the item's id with getId() magic method:

/**
 * Retrieve item id
 *
 * @param Varien_Object $item
 * @return mixed
 */
protected function _getItemId(Varien_Object $item)
{
    return $item->getId();
}

The Question

I think all I need to do is setting the id of each item in my collection, which I don't know how. Do you have any ideas?

More Info

Here's the definition of my table in database:

+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| id          | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
| customer_id | int(11) unsigned | NO   |     | NULL    |                |
| login_date  | datetime         | NO   |     | NULL    |                |
+-------------+------------------+------+-----+---------+----------------+


texts: Error in Manage Catalog page in admin after upgrade to magento 1.8 when category flat data is enabled

texts:
We have the below error displaying in the browser when we navigate to Catalog > Manage Categories

  Fatal error: Call to undefined method
  Mage_Catalog_Model_Resource_Category_Flat::loadAllAttributes() in
  /includes/src/__default.php on line 27697

We have compiler enabled. When compiler is disabled the error reads:

  Fatal error: Call to undefined method
  Mage_Catalog_Model_Resource_Category_Flat::loadAllAttributes() in
  /app/code/local/Mage/Catalog/Model/Category.php on line 289

When we change "use flat catalog category" to disabled, the error disappears and we can use our manage categories area as normal. This only started occuring after upgrading to Magento 1.8 from 1.7.0.2 last week.

We have tried reindexing all processes etc, but no change.

Everything else in our site is fine, we just cannot access this page from the admin area! :(

Any ideas on how to resolve?


texts: magento 1.9 Show products ONLY to logged in customer

texts:
I need a way that products should be visible for only logged in customers
Someone said me that I should use catalog_product_collection_load_before Event
How can I use it?


texts: What does "Sandbox Mode" mean in FEDEX setup?    Also, what does "Debug" mean?  What is the difference when you answer yes vs no in both cases.  We are just setting up a new website with the community edition 1.9.


texts: layout on home page and positioning of products on home page

texts:
Hi i'm working on website called headsetsindia.com i want to do some changes on this site how can i...?

How to align submit button on checkout page so that person entring the values should not drag the page to rite to click submit button.

How to change the position(Sequence) of products to be displayed on home page in magento


texts:
Magento 2 mini cart delete not works
Magento 2 mini cart delete not works


texts: magento 2: js function not working from template file

texts:
I have created a js file in my custom module: components.js which contains the following code:
require([
    'jquery',
    'jquery/ui'
], function($) {
    function checkFormValues(inputs, radio) {
        var empty = false;
        $(inputs).each(function () {
            if ($(this).val() == '') {
                empty = true;
                return false;
            }
        });
    $.each(radio, function(index, value) {
        if (!$("input[name='" + value + "']:checked").val()) {
            empty = true;
        }
    });
    return empty;
}

function checkEnableSubmit(inputs, radio, button) {
    if (checkFormValues(inputs, radio)) {
        $(button).attr('disabled', 'disabled');
    } else {
        $(button).removeAttr('disabled');
    }
}
});

I am then requiring the js file in my template file via requirejs and referencing the functions, however the console outputs error
<script>
require([
    'jquery',
    'jquery/ui',
    'ms.ux'
], function($, ui, ux) {
    checkEnableSubmit('.form-service-plan input', ['plan_code', 'is_scb'], '.js-submit');
    $('.form-service-plan input').change(function () {
        checkEnableSubmit('.form-service-plan input', ['plan_code', 'is_scb'], '.js-submit');
    });
});
</script>

which outputs:
Uncaught ReferenceError: checkEnableSubmit is not defined

The components.js file is loading fine, so I believe the issue is with js function declarations but am not sure how to resolve.
Update:
I was able to get functions to work if i removed the requirejs wrapper and change $ to jQuery in components.js.
function checkFormValues(inputs, radio) {
    var empty = false;
    jQuery(inputs).each(function () {
        if (jQuery(this).val() == '') {
            empty = true;
            return false;
        }
    });

    jQuery.each(radio, function(index, value) {
        if (!jQuery("input[name='" + value + "']:checked").val()) {
            empty = true;
        }
    });
    return empty;
}

function checkEnableSubmit(inputs, radio, button) {
    if (checkFormValues(inputs, radio)) {
        jQuery(button).attr('disabled', 'disabled');
    } else {
        jQuery(button).removeAttr('disabled');
    }
}

Should I not use requirejs wrapper for any shared functions or libraries?


texts: Home page product slider image resize issue

texts:
I want a image of size 550x550 for single product slider, but my slider is getting small_image and resize into size 270 x270, this leads image to be blur.
I have checked at my end and found that it is not bringing image field in product information.


texts:
I am getting this error when I open single product page. Due to this page is not getting load. I have done some workaround for this... but did not get any clue.

it is theme based issue. I am using Magenest - Couture Fashion theme of Magento.

  1) Uncaught TypeError: $(...).hideshare is not a function

  2) Uncaught ReferenceError: $ is not defined

welcome for any decent solution...


texts: Category Image Information not displayed once image uploaded after version upgrade to 2.3.3

texts:
I have one strange issue previously i was using magento 2.2.2 version in which category image upload works perfectly, after upgraded to magento 2.3.3 version image was uploaded first time but after that if i only save the category that image was not found the image name will "_1", "_1_1" and saved into database.

For this issue i have followed this patch https://github.com/magento/magento2/issues/25209, after that image saved properly but the information below image preview have some issue as seen in below screenshot:

https://prnt.sc/s8kwip

Does anyone face this type of issue after version upgrade to 2.3.3?

  Note: In Fresh version of magento 2.3.3 doesn't have issue it occurs
  only after version upgrade to 2.3.3 from command line as per magento
  devdocs guideline.

Thanks in Advance. !


texts: Create Magento2 JS template ("x-magento-template") and process via javascript

texts:
I have a page with a form where the user can add multiple items to the form by using a [+] button. The plus button is adding another set of fields to enter more data every time it is clicked.

Right now the javascript code is just appending some HTML string with jQuery, but I'd like to do this in a cleaner way just like Magento 2 is doing this with their x-magento-template blocks, like:

How can I now take this template and render it with the input of a data object? And after that, append it to my form?

The JS I have (of which I'm going to put the HTML in newField into the x-magento-template):

define([
    "jquery",
    "mage/translate",
    "domReady!"
], function($) {

    $("button#js-add-more").click(function(e) {
        e.preventDefault();

        var newField = '
<input id="field-' + ($('form#myform input[id^=field-]').length + 1) + ' " name="field[]" placeholder="' + $.mage.__('Enter data') + '" />
';

        $('form#myform').append(newField);
    });

});


texts: Magento 2: Is it possible to add a canonical link to a page through it's layout file?

texts:
I have a custom page and I'm trying to add a canonical link to it. I see that in the layout file I can specify meta data in the head node. Is it possible to add the canonical link in the layout as well? Or what is the "right" way to add it to a custom page?
Thanks


texts:
I have a module which is rewriting core module (module-fedex), the constructor is the following:

public function __construct(
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
    \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
    \Psr\Log\LoggerInterface $logger,
    Security $xmlSecurity,
    \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory,
    \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
    \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
    \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory,
    \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory,
    \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory,
    \Magento\Directory\Model\RegionFactory $regionFactory,
    \Magento\Directory\Model\CountryFactory $countryFactory,
    \Magento\Directory\Model\CurrencyFactory $currencyFactory,
    \Magento\Directory\Helper\Data $directoryData,
    \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Framework\Module\Dir\Reader $configReader,
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
    array $data = [],
    Json $serializer = null,
    \Magento\Checkout\Model\Cart $cart
) {
    $this->_storeManager = $storeManager;
    $this->_productCollectionFactory = $productCollectionFactory;
    $this_cart = $cart;
    parent::__construct(
        $scopeConfig,
        $rateErrorFactory,
        $logger,
        $xmlSecurity,
        $xmlElFactory,
        $rateFactory,
        $rateMethodFactory,
        $trackFactory,
        $trackErrorFactory,
        $trackStatusFactory,
        $regionFactory,
        $countryFactory,
        $currencyFactory,
        $directoryData,
        $stockRegistry,
        $storeManager,
        $configReader,
        $productCollectionFactory,
        $data = [],
        $serializer,
        $cart
    );

}

After i added
\Magento\Checkout\Model\Cart $cart, there is an error

Exception #0 (BadMethodCallException): Missing required argument $data

anyone know what is the problem?


texts: Assigning Products to Catalog Categories

texts:
I have a question related to this post:

Parent category is showing products in subcategories, even though product was not assigned to parent category

As in the post, let's assume that I have a Clothing category and that this category
has a subcategory, T-shirts.

When defining or editing an Product via Catalog -> Manage Products -> click on the
product to be modified -> Product Information -> Categories -> Product Categories
what is the difference between the following scenarios:

I check the box next to Clothing.
I check the box next to T-Shirts.
I check both the box next to T-Shirts and the box next to Clothing.

Perhaps the most puzzling is the distinction between 2. and 3., because
when I click a subcategory all of the ancestor categories don't automatically
get ticked.

Thank you for your clarification.


texts: Remove Tax / Vat and Shipping Cost information from the Category pages (custom module)

texts:
I am using firegento magesetup in my magento 1.9.3.4 store.
Magesetup adds tax-details and shipping cost details to my category pages which i don't need/want as it hurts my SEO. In their Faq they advice to make a custom module with an event/observer that removes these details.

I've made a custom module based on their faq but it doesn't work..

Here is my setup:

app/etc/Modules/
app/code/local/Mycustom/
app/code/local/Mycustom/Taxremover/
app/code/local/Mycustom/Taxremover/etc
app/code/local/Mycustom/Taxremover/Model

app >> etc >> modules >> Mycustom_Taxremover.xml

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

app >> code >> local >> has a Mycustom directory with
Taxremover directory that has etc and Model directories in it

etc has> config.xml with

<?xml version="1.0"?>
<config>
    <modules>
        <Mycustom_Taxremover>
            <version>0.0.1</version>
        </Mycustom_Taxremover>
    </modules>
    <global>
        <models>
            <mycustom_taxremover>
                <class>Mycustom_Taxremover_Model</class>
            </mycustom_taxremover>
        </models>
    </global>
    <frontend>
                <events>
                        <magesetup_after_product_price>
                        <observers>
                                <mycustom_taxremover>
                                <type>singleton</type>
                                    <class>mycustom_taxremover/observer</class>
                                    <method>removeMageSetupPriceHint</method>
                                </mycustom_taxremover>
                        </observers>
                </magesetup_after_product_price>
            </events>
       </frontend>
    </config>

Model has> Observer.php

<?php
/**
     * @mageEvent magesetup_after_product_price
     *
     * @param type $event
     */
    public function removeMageSetupPriceHint($event)
    {
        if(in_array('catalog_category_view', Mage::app()->getLayout()->getUpdate()->getHandles()) || in_array('catalogsearch_result_index', Mage::app()->getLayout()->getUpdate()->getHandles()))
        {
            $obj = $event->getHtmlObj();
            $obj->setPrefix('');
            $obj->setHtml('');
            $obj->setSuffix('');
        }
    }
?>

the result is that only 1 product is shown on a category page and only the product Image and Title is  visible, all other divs and the spans with the tax details and shippings cost details are gone. inlcuding the product price.


texts: Create order from quote with existing payment method, but do not place payment?

texts:
I am working on a webhook endpoint that will take quotes and turn them into finished orders.

As part of this, I want to set the quotes payment method to a custom existing payment method, but I do not want it to "place" the payment; I just want the order to have the payment details.

I know I can pass "checkmo" as the payment method, but that is not a viable option for what I want. I need to pass the custom payment method.

Part of the order process is to place the payment, see /vendor/magento/module-sales/Model/Order.php line 1176, public function place()

    public function place()
    {
        $this->_eventManager->dispatch('sales_order_place_before', ['order' => $this]);
        $this->_placePayment();
        $this->_eventManager->dispatch('sales_order_place_after', ['order' => $this]);
        return $this;
    }

How can I stop $this->_placePayment() from being triggered?


texts:
I'm working with a new install of Magento ver 2.2.5. After the vm booted and i logged in, I saw a message One or more integrations have been reset because of a change to their xml configs..

After clicking the link, it takes me to "Integrations" and in there I see "Magento Analytics user". I looked it up in the Magento Glossary and Magento Docs under functional areas "integration" and don't see an official answer for this. Is it part of "Magento_Analytics module"? What are all of its uses? I see under API that it has access to Analytics/API resource access.

What is "Magento Analytics user" in Magento v2? Where are the docs that specifiy what that is?


texts: How can i remove Bulk unwanted image label

texts: How can i remove 1000 products unwanted image label from single step.


texts: How to share one phtml file variable output to another phtml file

texts: In custom modules, I want to share my module A output variable $value = "one" to module B, print like $value How to share this?


texts: Magento2 Product you've requested does not exist

texts:
I've deleted product from backend.

Now I'm loading product in batch by using productRepository in helper.

In that process I've that deleted product Id so when ever process comes to following line

return $this->_productRepository->getById($id);

I'm getting that error. So now what can be done to check if product is deleted then just return null.

if($this->_productRepository->getById($id))
{
   return $this->_productRepository->getById($id);
}
else
{
   return ;
}

Above code also return the same error and execution get stopped.


texts: Long file names and Magento Connect extension packager

texts:
Has anyone noticed that Magento Connect packager and installer (mage script) cannot handle long file paths inside the tgz archive?
I've got a file app/code/community/Eepohs/EestiPostLt/Model/System/Backend/Config/Source/Sending/Additionalservice.php inside an installer package.
When I install this package by using mage script it creates directory named app/code/community/Eepohs/EestiPostLt/Model/System/Backend/Config/Source/Sending/Additionalservice.p

After a long investigation I discovered that the unarchiver Mage_Archive_Tar does not handle paths longer than 100 characters correctly. Has anyone noticed that, too? Is there any quick fix to that?


texts: Selling packages: which product type should I use

texts:
I would be really grateful for any advice about how to model my product packages within Magento.  Below are my 4 requirements:

I would like to sell packages which consist of several products.
I would like the stock levels of the constituent products to be recorded and managed within Magento.
I would like to set the base price of the packages as a whole, not have it calculated as the sum of the constituent products.
Some consituent products will be configurable products, which can change the price of the package depending on selection.

Currently I have experimented with "Bundled" product types for the packages. The problem with this, is that configurable products (4. above) can only change the price if I set the Bundled product to be dynamic price rather than fixed, which breaks my #3 requirement.

Any help would be really appreciated.


texts: How to get the value of an EAV attribute from a model class in Magento2

texts: I have got an object of this model magento/catalog/model/product and I want to use one of the EAV attributes values of it. How to access this EAV attribute through model object.There is no issue with non-EAV attributes to be used.


texts: Product price calculation on order emails and pdfs

texts:
I have a client that needs to increase product prices using catalog price rules.

Unfortunately Magento shortsightedly min() the catalog price rules wherever they are found.  I managed to change this functionality everywhere EXCEPT the order confirmation emails/pdfs.  Does anyone know where those product prices are pulled from and the catalog price rules applied at?

I've changed:

file: app/code/core/Mage/Weee/Model/Mysql4/Tax.php

change:

‘value’ => 100-max(0, min(100, $row[’action_amount’])),

to:

 ‘value’ => 100-$row[’action_amount’],

file: app/code/core/Mage/Catalog/Model/Product/Type/Price.php

change:

$finalPrice = min($finalPrice, $rulePrice);

to:

$finalPrice = $rulePrice;

file: app/code/core/Mage/CatalogRule/Model/Observer.php

change (2x):

$finalPrice = min($product->getData(’final_price’), $this->_rulePrices[$key]);

to:

$finalPrice = $this->_rulePrices[$key];

Like I said this is working on the frontend and the admin, everywhere as far as I can tell EXCEPT the order email/pdfs, so I'm thinking that these are calculated in yet another location that I have yet to identify.


texts: How to get customer gender options Magento 2

texts:
I want to display select input field which contain customer gender options in my custom layout block in magento 2 ? how can i do this?

/Vendor/Module/Block/Customer.php

public function getCustomerGenderOptions(){
  //how?
}

/Vendor/Module/view/frontend/templates/customer.phtml

<select name="gender">
 <?php foreach ($block->getCustomerGenderOptions() as $genderOption): ?>
    <option value="<?= $genderOption['value'] ?>"><?= $genderOption['label'] ?></option>
 <?php endforeach; ?>
</select>


texts: How to get tax amount of product in magento 2?

texts: I have called API to calculate Tax for products, I need to show the tax amount for each and every product individually . How can i make it possible? can any one help me to solve this?


texts: new from date is populated with current date during mass update

texts:
i am mass updating bundle product and during the update i observed that though am not adding the new from date for that product than also the current date is added to it.

what i found on web is this link which pointed me to these class Mage_Catalog_Model_Product_Attribute_Backend_Startdate for below method

protected function _getValueForSave($object)
{
    $attributeName  = $this->getAttribute()->getName();
    $startDate      = $object->getData($attributeName);
    if ($startDate === false) {
        return false;
    }
    if ($startDate == '' && $object->getSpecialPrice()) {
        $startDate = Mage::app()->getLocale()->date();
    }

    return $startDate;
}

[SOLUTION]

rewrite the above method with below

protected function _getValueForSave($object)
    {
        $attributeName  = $this->getAttribute()->getName();
        $startDate      = $object->getData($attributeName);
        if ($startDate === false) {
            return false;
        }
        //added this condition to return null value when date field is set to balnk
        if ($startDate == ''){
            return false;
        }

        if ($startDate == '' && $object->getSpecialPrice()) {
            $startDate = Mage::app()->getLocale()->date();
        }

        return $startDate;
    }


texts:
I've a form in which I'm using ajax to get product sku and quantity from user.

I successfully got those entered data in form to my custom module's controller.

Now I need to verify that user's entered value with actual product sku in my site.

How can I do that inside my controller's execute() function?


texts: Is it possible to determine the process id of specific entry in cron_schedule?

texts:
I'm working on troubleshooting and cleaning up problematic cron jobs.  It's fairly often for some jobs to fail and leave their entry with a status of running in cron_schedule.  Meanwhile there are other jobs which are very slow, but do eventually complete.

I'd like to have a quick way to locate jobs in cron_schedule whose cron process is no longer running (e.g. find all running cron_scudule entries that aren't actually running).

So far I've been unable to find a way to correlate a magento cron job with the linux process which started it, is there a way, or would I need to build this myself?


texts: Magento2 in windows IIS server - Pub/static appends version

texts:
I have installed magento2 in one of our windows server which uses IIS.

Followed the following blog, which helped for most part

http://blog.winhost.com/how-to-install-magento-2-1-2-on-winhost-iis/

I ran all the commands that is needed. Ran the main command as well

php bin/magento setup:static-content:deploy

However, when i run my application on browser. The css and js will return in 404 error. Here are the few files that gets loaded.

/pub/static/version1483704562/frontend/Magento/luma/en_US/mage/calendar.css Failed to load resource: the server responded with a status of 404 (Not Found)

pub/static/version1483704562/frontend/Magento/luma/en_US/mage/requirejs/mixins.js Failed to load resource: the server responded with a status of 404 (Not Found)

Here, if you notice. version1483704562 this version gets added up in URL. Not sure why this occur. The files are actually present, because of this version inclusion it throws error.

Please let me know on how to solve this. NOTE: Application is in windows IIS server


texts: Product image not coming in mobile view in magento 2

texts:
I am not able to find out what is the issue. Product Image aren't display on the product page in mobile view.

How to solve this.


texts: How to upgrade from 1.8 alpha (1.8.0.0-alpha1) to 1.8 FINAL

texts:
I've built a Magento site around 1.8 alpha release.
Now 1.8.0.0 final is out, and I wish to upgrade my installation.

What would be the easiest path of accomplishing this?

Please note that my site is not yet in production.


texts: How do I override/rewrite a block class in Magento 1?

texts:
Note: This is intended as a canonical question that fully explains how block rewrites work and can be used as duplicate target for more specific "How do I override block X" or "Why does my rewrite not work" questions.

  See also: Looking for canonical questions about Magento 1 overrides

Let's say, I have to make changes to a core block class in a custom module (change methods or add methods). How do I do this, step by step?


texts: I have developed custom  grid which shows list of orders placed by customers.I also want to set hyper link to the particular order in sales-> order tab please help me to achieve this.


texts: MySQL "SELECT would examine more than MAX_JOIN_SIZE rows" error when reindexing catalog_product_price

texts:
I'm getting the following error when running the catalog_product_price indexer from the CLI tool (bin/magento indexer:reindex catalog_product_price):

  SQLSTATE[42000]: Syntax error or access violation: 1104 The SELECT
  would examine more than MAX_JOIN_SIZE rows; check your WHERE and use
  SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay,
  query was:

  DELETE `index_price`
FROM `catalog_product_index_price` AS `index_price`
LEFT JOIN `catalog_product_index_price_idx` AS `ip_tmp` ON
    index_price.entity_id = ip_tmp.entity_id
    AND index_price.website_id = ip_tmp.website_id
WHERE (ip_tmp.entity_id IS NULL)

The website has 8,419 products, and 4 websites.

Truncating the price index tables works for a while, however the error does come back after a few days.

Has anyone seen this issue before? Is it simply a case of tweaking the MySQL parameters? Or is this indicative of a larger problem?


texts: can't get session variable set before _redirectSuccess in controller

texts:
in rewrite customer controller, in session, custom var 'email' is set:

if(!empty($customer_data)){

    $session = Mage::getSingleton('core/session', array('name' => 'frontend'));
    // or $session = $this->_getSession();
    $session->setEmail($email);
    // or  $email   = $session->setData('email', $email);
    Mage::getSingleton(‘core/session’)->setMySessionVariable($email);
    $this->_redirectSuccess($this->_getUrl('*/*/customerChoice/'));

    ...

    }

then, on other customer controller's action, in which i redirect from the code above, i do:

public function customerChoiceAction()
{
    $session = Mage::getSingleton('core/session', array('name' => 'frontend'));
    // or $session = $this->_getSession();

    $email   = $session->getEmail();
    // or  $email   = $session->getData('email');

but i get null in result, where to dig and hove to solve? thanks!

UPDATE

THIS WAS ONLY GOOGLE CHROME ISSUE, IN FIREFOX EVERYTHIG IS OK


texts: How to set Local Timezone when saving time into DB in Magento

texts:
I have applied following things to make Default time zone to my local timezone i.e. 'Asia/Calcutta' --

1) changed in config.xml -

<general>
            <locale>
                en_US
                <timezone>Asia/Calcutta</timezone>
            </locale>
 </general>

2) Changed in Mage.php -

 if (is_readable($localConfigFile)) {
                $localConfig = simplexml_load_file($localConfigFile);
                date_default_timezone_set('Asia/Calcutta');
                if (($date = $localConfig->global->install->date) && strtotime($date)) {
                    self::$_isInstalled = true;
                }
  }

Now when I am trying to insert any time in db using this code

Mage::getModel('core/date')->date('Y-m-d H:i:s');,

it does not work according to current timezone and saves 5:30 hours ahead date in DB. can anyone tell me how can I do it or Have I done something wrong in default timezone settings.


texts: Magento 2 : checkout_cart_index.xml problem

texts:
When I copy checkout_cart_index.xml page to my theme it works fine but when I change

<block class="Magento\Checkout\Block\Cart\Grid" name="checkout.cart.form" as="cart-items" template="Magento_Checkout::cart/form.phtml" after="cart.summary">

to

<block class="Magento\Checkout\Block\Cart\Grid" name="checkout.cart.form" as="cart-items" template="Magento_Theme::cart/form.phtml" after="cart.summary">

For overriding a template file from my theme the discount coupon form disappears and it also disappears from from html too.

Thanks in advance.


texts: Disable asking for "current admin password" when changing a password

texts:
Changing a password for the admins or a customer requires the "current admin password."

That will require every admin to set memorable passwords, that have possibly been used in other sites, as opposed to using the corporate password manager, which does work with the login screen, but not in the random other backend screens through magento.

Update: It appears to be a bug with the form field, as Github currently features a password entry form when adding a new public key. In that form no username is required, but chrome allows you to choose a password to use. As such, eliminating the password reuse problem present in Magento.


texts: Custom order number or increment id in Magento

texts: I want to shorten order number (increment id) but I don't want to use any modules.


texts: Creating order in Magento 2 backend, how to find out the store?

texts:
I have a payment module used in Magento 2 backend order creation.

In Magento 2 the administrator first chooses the store where the order is to be created. However, when reading configuration I always get configuration from store 1.
Also using \Magento\Store\Model\StoreManagerInterface I always get store ID 1.

How can I find out which store the order is being created to?

Thanks.


texts:
I want to retrieve collection of product in frontend including OUT OF STOCK without changing System Configuration "Disaply OUT OF STOCK => YES".

Is there any way programmatically to change the frontend access behaves like back-end ?


texts: How do I get the Bing Revenue Conversion tracking to work on Magento?

texts:
I am using Magento 1.9.1. I have Google Analytics ecommerce tracking working fine but the same thing will not work in Bing Ads.

<?php

 $orderId = $this->getOrderId();
 $order = Mage::getModel("sales/order")->loadByIncrementId($orderId);
?>

<script>
var amount = <?php echo number_format($order->getGrandTotal(), 2); ?>;
window.uetq = window.uetq || [];
window.uetq.push({ 'gv': amount,})
</script>


texts: How can I add customer attribute in Magento 2?

texts:
Note: The question was referring to magento2-dev-beta and the code for setup scripts is not the same anymore in Magento 2.x.

I'm playing with Magento 2 and I'm stuck in adding attribute for customer entity. I got attribute properly installed using data installer, but I can't get it displayed in forms.

My data-install-2.0.0.php setup script looks as follows:

/* @var $this \Magento\Customer\Model\Resource\Setup */
$installer = $this;

$installer->startSetup();

// Add nickname attribute
$installer->addAttribute(
    'customer',
    'nickname',
    [
        'type' => 'varchar',
        'label' => 'Nickname',
        'input' => 'text',
        'required' => true,
        'sort_order' => 75,
        'visible' => true,
        'system' => true,
        'unique' => true,
        'position' => 75,
    ]
);

$nicknameAttribute = $installer->getEavConfig()->getAttribute('customer', 'nickname');
$nicknameAttribute->setData(
    'used_in_forms',
    ['customer_account_create', 'customer_account_edit', 'checkout_register', 'adminhtml_customer']
);
$nicknameAttribute->save();

$installer->endSetup();

This part works fine, after running setup/index.php update my attribute is visible in database tables (eav_attribute, customer_eav_attribute, customer_form_attribute). However it's not visible in forms.

I added following in etc/fieldset.xml in my custom module:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd">
    <scope id="global">
        <fieldset id="customer_account">
            <field name="nickname">
                <aspect name="create" />
                <aspect name="update" />
                <aspect name="name" />
            </field>
        </fieldset>
    </scope>
</config>

It looks it does nothing.

Then I added following in data_source/customer.xml:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Ui/etc/data_source.xsd">
    <dataSource
            name="account" label="Account Information"
            dataSet="Magento\Customer\Model\Resource\Customer\Collection">
        <fields entityType="customer">
            <field name="nickname" source="eav" dataType="text"/>
        </fields>
    </dataSource>
</config>

This actually does something, it breaks backend customer form with exception:

More than one node matching the query: /config/dataSource[@name='account']/fields/field

I guess adding to these two xml files from core module in custom module should be done in some other way.

At the end I did one more thing just for testing. I removed etc/fieldset.xml and data_source/customer.xml from my module and added that content in Magento_Customer core module. This resulted in having my field displayed in backend (hooray!), but saving still doesn't work and throws error message:

"Nickname" is a required value.

So my questions are:

What is a valid way to alter etc/fieldset.xml and data_source/customer.xml in custom module?
What else should be done to have custom attribute being saved?
How can I do this for frontend registration form? Adding field in form/register.phtml doesn't do the magic.


texts: Magento 2: How to add a phtml bloxk in cms page only?

texts: I want to add a phtml but this phtml should only visible in all cms page only ? how can I implement this using layout XML method ?


texts: code: {{block type="core/template" template="page/any.phtml"}} didnt work

texts:
given image is my file structure. I want to include any.php into my home page from admin panel. So i use code:

{{block type="core/template" template="page/any.phtml"}}

But this code didn't work.

Please help me for solve this.

Thank you


texts: Migrate magento 1 to magento 2 new column

texts:
I'm trying to migrate from Magento 1.7.0.2 to Magento 2.3.1

For that I use the migration tool :https://devdocs.magento.com/guides/v2.3/migration/migration-tool-install.html

All is working fine except a custom table.

I get this message for the col4 when i launch the import :

Destination fields are not mapped. Document: my_table. Fields: col4

I tried to fix thix with ignore and transform with no success :

    //file map.xml
<source>
    <field_rules>
        <ignore>
            <field>my_table.col4</field>
        </ignore>
        <transform>
            <field>my_table.col4</field>
            <handler class="\Migration\Handler\SetValue">
                <param name="value" value="1" />
            </handler>
        </transform>
    </field_rules>
</source>


texts: Save customer custom address attribute programmatically

texts:
I have created new address attribute hide_address with yes no value. Using setup script:

    if(version_compare($context->getVersion(), '1.0.2', '<')) {
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customerSetup = $objectManager->create('Vendor\Module\Setup\CustomerSetup2');
        $customerSetup->installAttributes($customerSetup);
    }

In CustomerSetup2.php I have used this code:

public function installCustomerAddressAttributes($customerSetup)
{
    $customerSetup->addAttribute('customer_address',
        'hide_address',
        [
            'label' => 'Hide Address',
            'system' => 0,
            'user_defined' => true,
            'position' => 100,
            'sort_order' => 100,
            'visible' => true,
            'default_value' => '',
            'note' => '',
            'type' => 'int',
            'input' => 'boolean',
            'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',

        ]
    );

    $customerSetup->getEavConfig()->getAttribute('customer_address', 'hide_address')->setData('is_user_defined', 1)->setData('default_value', '')->setData('used_in_forms', ['adminhtml_customer_address', 'customer_register_address', 'customer_address_edit'])->save();
}

Now I need to save it in a controller programmatically. I have used this code to save address:

$address = $this->addressDataFactory->create();
$address->setFirstname('Shoaib')
    ->setLastname('Munir')
    ->setCountryId('pk')
    ->setCity('ABC')
    ->setPostcode('12345')
    ->setCustomerId(2)
    ->setStreet(array('Line 1','Line 2'))
    ->setTelephone('1234567')
    ->setFax('12345')
    ->setVatId('12345')
    ->setIsDefaultBilling('1')
    ->setIsDefaultShipping('1')
    ->setHideAddress(1)
;

It is giving me this error:

  Call to undefined method
  Magento\Customer\Model\Data\Address::setHideAddress()

Then I have tried this:

$address->setCustomAttribute('hide_address', 1);

Using above code it is giving me this error:

  Exception #0 (Magento\Framework\Validator\Exception): "Hide Address"
  is a required value.

I have also tried this:

$address->setData('hide_address',1);

Using above code it is giving me this error:

  Exception #0 (Magento\Framework\Validator\Exception): "Hide Address"
  is a required value.

Please help me find the solution. I am unable to find any.
This is also not working for me:
Save or Update custom customer address attribute data


texts: Magento 2: Error in header at checkout due to module installation

texts:
Whenever I enable a custom module (payment) the header display with design errors:

Logo is removed
Search bar, header links and minicart don't disappear

I've tested 2 different modules (from different providers) and the result is the same, so I guess it's not a problem with those modules but something in my installation/theme.


texts: How to add a input field and save the value to the database to the new order creating page in admin side

texts: I have a field in the front end order creating page as order instructions for giving user to give any  instructions, so i wanted to add this field also to the admin side on order creation. how to add the field in the order creating page in admin side?.


texts: Associate simple products to configurable products programmatically

texts:
This is my first post here, and my first month of learning Magento 2.

I've been able to create configurable and simple products using PHP, but I can't find a way to associate those simple products to a configurable product.
The only resource I've found about it is this one.

But still, I couldn't make it work.

Basically I've created a custom product attribute for the sizes (later on I'll manually look into how to do it programmatically) and I have created products so that the end result is that you see one product of which you can choose multiple sizes.

This is just like Magento 2 with sample data. I've learned how to do it manually but I couldn't find out how to do it programmatically with PHP.

Are there any pointers that could help me solve this issue?


texts: How to create different page layouts for a theme

texts:
Consider I have a custom theme called MyTheme1 in default design package.

I want to create different page layouts ( like 1column, 2column, 3column ) for this specific theme. So if theme selected by the user in system configuration, then page layouts appears in different parts in magento, so that user can choose between them wherever he wants.

I've also another theme called MyTheme2 with different page layouts ( 1column, 3column and 5column). If user changed the theme to MyTheme2, I want the Page Layout drop down filled with those page layouts.

How can I accomplish this ?

I know I can create a module Mage_Page and edit config.xml and add my desired page layouts, but it adds for all themes. I want theme-specific page layouts. Is it possible in magento ? How can I have different page layouts for different themes in magento ?

Can you please help me?


texts: Magento 2 : how to add additional information in rest API response?

texts: I have one custom table 'vendor_info' with 5 fields and I want to add this table data along with this API http://www.hostname.com/rest/V1/products?searchCriteria


texts: Magento 2 Create Custom Field for Image Visibility same as hide from default page field

texts:
I want to create one more checkbox which set the image as default. If Image is set to default then only want to add one "default_image" class on the product image on listing page.

Any suggestions would be appreciated. Thank you.


texts: Magento 2 - How to render a block inside another?

texts:
On the PDP I am trying to create a new block (product.info.main.inner) inside of product.info.main so I can pass arguments to it and then move all off the child blocks inside product.info.main.inner. I'm trying to use the following but the section is blank on the frontend, does anyone know what is going wrong please?
   <referenceContainer name="product.info.main">
       <block class="Magento\Framework\View\Element\Template" name="product.info.main.inner">
         <argruments>
           <argument name="add_attribute" xsi:type="string">itemscope itemtype="http://schema.org/Product"</argument>
         </arguments>

           <block name="product.brand.logo" class="Magento\Catalog\Block\Product\View" template="Magento_Catalog::product/brand-logo.phtml" after="-" />

        </block>
   </referenceContainer>

   <move element="page.main.title" destination="product.info.main.inner" before="-" />


texts:
By default, in Magento 2 the order number starts from 100000001. But if I want to increase it by 55555.

So it would look like 100055555, what would be the SQL query to directly modify the table which is responsible for this.

I am not looking for any extension or additional coding.


texts: What's the difference between the Used and Redeemed states for Magento Enterprise gift cards?

texts: I'm trying to import some gift cards from an old community module, but I'm not sure what the difference is between the Used and Redeemed states in Magento EE 1.14 gift card accounts. Anyone got any insight?


texts:
I have a small problem.
 Basically I have two payment options on my site.
 The one is C/Card which redirects to my providers site.
 The second is a bank transfer method with no redirect.

So when using the bank transfer method it sends an order confirmation email to the customer.
 but with c/card it does not.

I then changed the following code: /app/code/core/Mage/Checkout/Model/Type/Onepage.php

$redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
 /**
  * we only want to send to customer about new order when there is no redirect to third party
  */
 if (!$redirectUrl && $order->getCanSendNewEmailFlag()) {
     try {
         $order->sendNewOrderEmail();
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }

to

$redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
 /**
  * we only want to send to customer about new order when there is no redirect to third party
  */
 if ($redirectUrl && $order->getCanSendNewEmailFlag()) {
     try {
         $order->sendNewOrderEmail();
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }

This then switched the whole thing around so now the order confirmation email is sent only when I choose the c/card option with the re-direct and not when I chose the bank trf method.

My question: How do I get it to send the email for both payment options.


texts: PHP 5.5 Bug - Deprecated functionality: preg_replace()

texts:
After we upgraded to PHP 5.5, we get the following error when adding a Website, Store or Store View. This bug is still present in Magento 1.9.0.1

Exception message: Deprecated functionality: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in app/code/core/Mage/Core/Helper/Abstract.php on line 238
Trace: #0 [internal function]: mageCoreErrorHandler(8192, 'preg_replace():...', 'app...', 238, Array)
#1 app/code/core/Mage/Core/Helper/Abstract.php(238): preg_replace('# <(?![/a-z]) |...', 'htmlentities('$...', 'New Store Name')
#2 app/code/core/Mage/Adminhtml/controllers/System/StoreController.php(175): Mage_Core_Helper_Abstract->removeTags('New Store Name')
#3 app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_System_StoreController->saveAction()
#4 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('save')
#5 app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#7 app/Mage.php(686): Mage_Core_Model_App->run(Array)
#8 index.php(87): Mage::run('', 'store')
#9 {main}

This is the code which produces the error

The code can be found in Mage_Core_Helper_Abstract

/**
 * Remove html tags, but leave "<" and ">" signs
 *
 * @param   string $html
 * @return  string
 */
public function removeTags($html)
{
    $html = preg_replace("# <(?![/a-z]) | (?<=\s)>(?![a-z]) #exi", "htmlentities('$0')", $html);
    $html =  strip_tags($html);
    return htmlspecialchars_decode($html);
}

This is, in my opinion, the easiest patch for the method:

/**
 * Remove html tags, but leave "<" and ">" signs
 *
 * @param   string $html
 * @return  string
 */
public function removeTags($html)
{
    $html = preg_replace_callback("# <(?![/a-z]) | (?<=\s)>(?![a-z]) #xi",
        create_function('$matches', 'return htmlentities($matches);'),
        $html
    );
    $html =  strip_tags($html);
    return htmlspecialchars_decode($html);
}

The method is only used by the Mage_Adminhtml_System_StoreController::storeAction().

There are three possible places to fix it:

Mage_Core_Helper_Abstract => that is where the method is located, but it sucks because it touches a core file.
Rewrite Mage_Core_Helper_Abstract => it is an abstract class, so it shouldn't/cant't be rewritten.
Rewrite Mage_Adminhtml_Helper_Data and add the method there. => I think this is the way to go.

What do you guys think?

Is option #3 the correct way to fix the issue.
Is the code in my patch correct?


texts: Add the 'Short Description' to the 'items ordered' table within a sales order admin view

texts:
Is it possible to add the 'Short Description' to the 'order view' within the 'Sales admin page'. Primarily in the 'items ordered' table so;

[Product][Item Status][Original Price][Price][Qty]...etc

to

[Short Description][Product][Item Status][Original Price][Price][Qty]...etc

This is the screen we'd like to edit.
url/sales_order/view/order_id....

The Short Description exists in a simple product.

If we could also add this functionality to the order grid, that would be great.

We've taken a look at mySQL and the entry exists in 'catalog_product_flat_1' and can probably cobble a custom SELECT query to achieve this but we were wondering if there is a better way?

Thanks in advance.


texts: how i can retrieve Minimum Amount in magento 2 using REST API?

texts:
Dears
I am using Magento ver. 2.2.7 as backend for my app,
i want to get "Minimum Amount" for orders when my users review them bascket.
So i am looking for API to retrieve value of  "Minimum Amount".
thank you for your help


texts: Onepage checkout error: Uncaught TypeError: Cannot read property 'style' of null

texts:
Does anyone know what is causing this error in Onepage Checkout?

I can't progress to the billing step when I click continue:

  'Uncaught TypeError: Cannot read property 'style' of null '

Shows in the error console.

I am using the default theme on the frontend but have a custom template for another store which doesn't have this issue.

I've searched and searched but cannot find a solution other than reinstall...

Can someone assist me please?
Link


texts:
If I install Magento on a site which does not have SSL certificates
configured then will I be able to configure Magento to use an SSL
certificate at a later time without having to reinstall. Is there
any reason why I would want to avoid this path?

Thanks for clarifying.


texts: Magento How to get tax rate for particular country

texts:
I am trying to get tax rate for particular country for example for India I used following code
but it returns 0

$taxClassId = $_product->getTaxClassId();
$country = 'IN';
$TaxRequest  = new Varien_Object();
$TaxRequest->setCountryId( $country );
$TaxRequest->setStore( Mage::app()->getStore() );
$TaxRequest->setCustomerClassId( $taxClassId );
$taxCalculationModel = Mage::getSingleton('tax/calculation');
$rate = $taxCalculationModel->getRate($TaxRequest);


texts: Cart/Catalog Price rule for a set of products only

texts:
I am trying to set cart price rules for some products if they are together in the cart.

I am using Magento 1.7.0.2

For example:

If product A and B are in the cart I want to make 11 percent for both but not for any other product.

For example:

If Product A and B are in the cart together with product C I want to apply the rule only to Product A and product B but not Product C.

I tried to set two different rules but it did not work, I tried to set one rule for both but then the quantity became an issue, cause I check if the cart has more than 1 products and that means the same product lets say Product A can have 2 as quantity and the rule is being applied on it in this case but I dont want it.

My statement must be like:

If there are more than 1 products and if one of them Is product A and one of the others is Product B set a discount only for Product A and Produt B but not for any other. So not to cart totals but to individual Products that I want to set a discount.

I also tried with catalog price rules but I couldnt get it work even this far.

Any help is appretiated.

Cheers


texts: Magento 2.3: Filter Purchase Date of Orders by month and year

texts:
Default Magento allow we filter purchase date from DD/MM/YYYY to DD/MM/YYYY

Now, I want to filter from MM/YYYY to MM/YYYY
Please help me.


texts:
I'd like to get a list of files stored in a sub directory of the /media directory in a controller.

I tried to use this one:

$dir = Mage::getBaseDir('media') . DS . $sub_dir . DS;
$files = scandir($dir);

But the array $files is empty.

I tried something like that:

$file = new Varien_Io_File();
$dir = Mage::getBaseDir('media') . DS . $sub_dir . DS;
$file->ls($dir);

Magento says Unable to list current working directory.


texts: Migrating magento 1.9 to magento 2.3 error

texts:
Hi am trying to migrate from magento 1.9 to magento 2.3.5 but am getting this error even though i dont have any prefix in my m1 db:-
Invalid parameter configuration provided for $sourceDocument argument of Migration\RecordTransformer

so i have tried to set prefix as this but it did not worked
<source_prefix>magento1.9</source_prefix>
<dest_prefix>m2.3.5</dest_prefix>

magento1 db name= magento1.9
magento2 db name= m2.3.5
any suggestion what's wrong am doing.


texts: What is automatic constructor dependency injection and how does it work in magento 2?

texts: As I'm reading further in Magento Books. I have learned a lot of its usages. But I am really curious why the team had moved using dependency injection.


texts: Magento 2: How to change order status from Complete back to Processing

texts: Is there a way to change the order status back to being Processing when order is already in Complete status? Is there some code way or MySQL way to achieve this?


texts: Magento2 How to display a text in between the shipping address street line 1 and 2

texts: I would like to display some text as a note between the shipping address street line 1 and line 2. Can anyone tell me how to do this ? I am not able to find the template of the text fields of street address.


texts:
getting some error in the console

Mixed Content: The page at 'https://www.xxxxx.com/bedroom/beds/beds-
without-storage' was loaded over HTTPS, but requested an insecure
image 'http://www.xxxxx.com/skin/frontend/rwd/yagotimber/images/home-
look.png'. This content should also be served over HTTPS.
beds-without-storage:358 Mixed Content: The page at
'https://www.xxxxx.com/bedroom/beds/beds-without-storage' was loaded
over HTTPS, but requested an insecure image
'http://www.xxxxx.com/skin/frontend/rwd/yagotimber/images/home-
look2.png'. This content should also be served over HTTPS.

secure url not show ??
how to fix it. any one help me.


texts: Custom widget's template doesn't show up in the front-end

texts:
So I have a custom widget with block defined in module's config.xml:

<config>
 <modules>
    (...)
 </modules>

 <global>
    <blocks>
        <gwidgets>
            <class>Phil_Gwidgets_Block</class>
        </gwidgets>
    </blocks>
 (...)
 </global>
</config>

Block's file is under app/code/local/Phil/Gwidgets/Block/Slider.php

I believe this is where the problem starts. I insert the widget into Wysiwyg editor in back-and, refresh the front-end and it doesn't appear. I check system log and there's this error:

Warning: file_exists(): open_basedir restriction in effect. File(/usr/share/php5/Mage/Phil/Gwidgets/Block/Slider.php) is not within the allowed path(s): (/home/www/xyz/:/usr/bin/)  in /home/www/xyz/html/app/code/core/Mage/Core/functions.php on line 145

So after setting up logging function in functions.php I've found out that these are the directories where autoloader attempts to find by block class:

/home/www/xyz/html/app/code/local/Mage/Phil/Gwidgets/Block/Slider.php
/home/www/xyz/html/app/code/community/Mage/Phil/Gwidgets/Block/Slider.php
/home/www/xyz/html/app/code/core/Mage/Phil/Gwidgets/Block/Slider.php
/home/www/xyz/html/lib/Mage/Phil/Gwidgets/Block/Slider.php
./Mage/Phil/Gwidgets/Block/Slider.php
/usr/share/php5/Mage/Phil/Gwidgets/Block/Slider.php

It nearly does it here:

/home/www/xyz/html/app/code/local/Mage/Phil/Gwidgets/Block/Slider.php

It would find it without '/Mage' in the path.

So the question is why Magento looks for Slider.php in ...local/Mage/... rather than ...local/....?

I'd appreciate any advice on how to fix this issue. :)


texts: Error Upgrading magento 2.0.7 to magento 2.1.0

texts: I'm having an error upgrading my magento 2.0.7 to magento 2.1.0


texts:
I am new to using magento collections and am receiving exhausted memory fatal errors. I just want to double check that my collection is pulling what i think it is.

I believe this is grabbing all products including the attribute 'part_num'. It then filters out all products with part_num == '' (blank) or ' ' (space).

$collection = Mage::getModel('catalog/product')->getCollection();

$collection->addAttributeToSelect('part_num');

$collection->addAttributeToFilter(array(
array('attribute'=>'part_num','neg'=>''),
));
$collection->addAttributeToFilter(array(
array('attribute'=>'part_num','neg'=>' '),
));

This would leave me with all products that have some data in the part_num attribute. Is this correct?


texts: Programatically set product attribute defaults - Magento 2

texts:
My specific use case is that I want to set the news_from_date and news_to_date for the a thirty day period from when the product is created. I would like this to work so when a user goes into the admin area to create the product this field will automatically be filled out with these values, and they can remove them if they would like.

I've looked at this post (Set default value to news_from_date and news_to_date) and this one (Get product from save event observer - Magento 2) which has helped me get it to set the default value before it is saved, but it doesn't help automatically fill in the values in the admin UI.

I created a module that does exactly what I want in Magento 1, but I can not get the same thing working in Magento 2.

Here is the code I am using:

/etc/adminhtml/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_new_action">
        <observer name="new_product_observer" instance="CrazyDog\NewProducts\Observer\Product" />
    </event>
</config>

/observer/Product.php

class Product implements \Magento\Framework\Event\ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $product = $observer->getEvent()->getProduct();
        $new_from_date = date('Y-m-d'); // --- Today
        $product->setNewsFromDate($new_from_date);
        $new_to_date = date('Y-m-d', strtotime('+30 days')); // --- 30 days from now
        $product->setNewsToDate($new_to_date);

        // --- These print in the admin area with correct values, so I know the observer is running
        echo $product->getNewsFromDate();
        echo $product->getNewsToDate();
    }
}

I can not figure out why these values aren't populating into the fields. I've tried with other attributes like the name as well, and they will print when trying to debug, but they do not populate into the fields. I'm not sure if this is an issue related to how javascript is now being used in the back end for a lot of this stuff.

Any insights would be helpful, thanks! :)


texts:
I want to Debug/Modify the behavior of the Submit function when you completely fillup all the details like the shipping info, billing info and payment method and card details. Now I'm having an issue that the subtotal is 0 even though there's a value for my product. Now I want to debug the issue for this. What function should I be looking at to debug this. I'm guessing it will be the function where the "SUBMIT" button on the last stage is calling. But i don't know what function is this. Can anyone tell me what to look at
Here's the sample of the order I made but the grandtotal was zero


texts: Why does Magento load the checkout html?

texts:
When you first visit the onepage checkout in Magento, only the first section is shown.  The HTML has been loaded for the other sections bt it is hidden.  When you move onto another section, an ajax request is performed an the HTML in the section is actually replaced with the server response.

My question is, if we're going to load the section HTML from the backend, then why load the HTML in the first place?


texts: Move SKU numbers to custom attribute and clear SKU afterwards for all products (SQL)

texts:
He Guys,

I'm hoping you can help me out. I'm a complete novice when it comes to SQL.

I'd like to move all the SKU values of every product to a new custom attribute (with attribute code: locaitenr)

after this is done I'd like to clear (reset) all the SKU numbers.
It would help me tremendously if someone could help me out with a SQL statement.

Cheers.


texts: Display Message On Thank You Page If Shipping Method Is Equal To

texts:
We have added an in-store pick up shipping method to our magento stores. We would like to display travel instructions to the store on the thank you page.

Any ideas on how I can go about displaying this information?


texts:
i need image in this url above the products
https://vitalticks.com/new-offer-zone.html
For reference please find the below link
https://pinkblue.in/special-offers/weekly-premium-deals.html


texts: Magento 2 add custom discount before cart rule discount in checkout

texts:
Here we add custom discount but here the problem is I want a custom discount to calculate before a cart rule.
But here first calculate cart rule then my custom discount.


texts: Magento 2 extention:how phtml file work and show admin view?

texts:
i have phtml file and i declare in theBlock\login.php as $_template = "phtml path,
its working fine but not for MEQP2 its giving WARNING | Property name $_template should not be prefixed with an underscore to indicate visibility;
when i remove the underscore with veriable of $template then magento view is not working. i already use the upgrade:setup command but not working fine. then what i do?


texts:
I would like to know if it is possible to fetch the Magento customer session outside Magento and how to go about it.
For example if my Magento instance is in a folder with the path : "public_html/Magento" and if I have a php file with the path "public_html/abc.php" i.e outside the Magento folder, can I check if a user is logged in on Magento (& also get cart details) on abc.php?

I've tried various solutions out there (like including Mage.php & fetching the session), which were mostly similar to How to Create session for customer login with session outside magentobut I wasn't able to check if the customer is logged in and get the cart item details on abc.php.


texts: Can we download Magento 2 Enterprise Edition for free?

texts:
I want to know whether we can download Magento 2 EE for free for development purpose?

Is it possible, please give me a link to download it.

Looking forward your reply.


texts: How add popup notify after adding products to cart, Magento 2?

texts:
How to add a pop-up notification after adding products to the basket, there should be two buttons in the popup, (Yes and No)
If the user clicks "yes", then we add the product. If "no", then stay on this page and close the popup.


texts: Magento2 : Show First placed order first in order history

texts:
In My order tab in customer account show last order first
i want there first placed order first.


texts: Magento 2 when deploying code cache generation 7 steps

texts:
I have one question regarding deploy code generation using command line

php/bin magento setup:di:compile

we always seen below line

  Compilation was started. Interception cache generation... 7/7
  [============================] 100% 1 min 264.0 MiB Generated code and
  dependency injection configuration successfully.

I am not understanding what are 7 steps(7/7 ) when cache generation.

Have anybody idea about these 7 steps?