texts: Magento 1.9 - Media.phtml not showing on configurable products view page

texts:
I have recently been learning the ways of magento, and up until two days ago it was all going great, but then I started learning about different product types .eg Simple, Bundle, Configurable. So anyway i needed to create a configurable product for a plain t-shirt, which had an option for colour and size. I added the image as i would any other product and made sure it was in-stock and done everything i would have done with a simple product, assigned the simple products and everything seemed fine. So i went on to my front end and it shows fine in the category page which its in but when i go to the actual viewing page for the product the Media.phtml file seems to be missing. The main image isn't there and inside the product-img-box div there seems to be nothing there (where my media loads for every other product).

Any help would be appreciated, i have searched everywhere for some sort of answer but haven't found a thing.

Thanks in advance, Josh.


texts: Magento multiple stores creating gives error

texts:
I am creating multiple stores in magento on wamp .

I have used following steps.

Create category for new store.
Create website for new store.
create store view for new store.
created new folder in magento for store and copy paste index.php and .htaccess file.
Edited in index.php changed

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

Mage::run($mageRunCode, $mageRunType); to  Mage::run('store1', 'website');

where store1 is our new store .

I have changed url under web in admin section http:localhost/magento/store1 for new store
Changed in index.php app/mage.php to ../app/mage.php.

but giving error c:\wamp\www\magento\store1../app/Mage.php was not found

I am using http://localhost/magento/store1/ for new store.


texts: Get product original & small images by product id

texts:
I am trying to get all magento product images

include 'app/Mage.php';
Mage::app();

$product = Mage::getModel('catalog/product')->load($product_id);  //some ID

$productMediaConfig = Mage::getModel('catalog/product_media_config');

$baseImageUrl  = $productMediaConfig->getMediaUrl($product->getImage());
$smallImageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage());
$thumbnailUrl  = $productMediaConfig->getMediaUrl($product->getThumbnail());

echo 'Base URL      : '. $baseImageUrl.'
';
echo 'small URl     : '. $smallImageUrl.'
';
echo 'thumbnail URl : '. $thumbnailUrl.'
';

The output for Base, small and thumbnail images is the same image
So how can I get all other product images?


texts:
I got one lamalls dependency plugin error when i try to composer upgrade .

Please help me to resolve this.


texts:
When i try to change as 'enable' the complier status i got below issue.. please advice me that to resolve.

  'Warning:
  include_once(/chroot/home/test/my.mysite.com/html/includes/scr/Mage_Core_functions.php):
  failed to open stream: No such file or directory in
  /chroot/home/test/my.mysite.com/html/app/Mage.php on line 37

  Warning: include_once(): Failed opening
  '/chroot/home/test/my.mysite.com/html/includes/scr/Mage_Core_functions.php'
  for inclusion
  (include_path='/chroot/home/test/my.mysite.com/html/includes/scr:.:/usr/share/pear:/usr/share/php')
  in /chroot/home/test/my.mysite.com/html/app/Mage.php on line 37

  Warning:
  include_once(/chroot/home/test/my.mysite.com/html/includes/scr/Varien_Autoload.php):
  failed to open stream: No such file or directory in
  /chroot/home/test/my.mysite.com/html/app/Mage.php on line 38

  Warning: include_once(): Failed opening
  '/chroot/home/test/my.mysite.com/html/includes/scr/Varien_Autoload.php'
  for inclusion
  (include_path='/chroot/home/test/my.mysite.com/html/includes/scr:.:/usr/share/pear:/usr/share/php')
  in /chroot/home/test/my.mysite.com/html/app/Mage.php on line 38

  Fatal error: Class 'Varien_Autoload' not found in
  /chroot/home/test/my.mysite.com/html/app/Mage.php on line 56'

Thanks for advance..
Vishnu


texts:
Just upgraded to 2.1.2 from 2.1.0. I tried to open one of my configurable products but I get this error message
Cannot gather stats! Warning!stat(): stat failed for /
I put the image into the location but it still won't open or see the file.
The simple products associated with the configurable all pull their images fine.


texts: Should _super_attribute_code should be a static value or a dynamic one?

texts:
Title pretty much says it but let me flesh this out more.

For configurable products, is it better to use something like a dynamic value such as color for something such as

'_super_products_sku' => '10450242102',
'_super_attribute_code' => 'color',
'_super_attribute_option' => 'Tan',

or would it be better to use a static value such as the first 5 digits of a sku which are immutable and do not change, such as

'_super_products_sku' => '10450242102',
'_super_attribute_code' => 'refid',
'_super_attribute_option' => '10450',

Why would I use one over the other?


texts:
Quite new to magento, and I search for a solution for the following

At this moment if there are no products in shopping cart the checkout button is disabled and user can not click on it.

if products already exist in shopping cart then on click redirect to /checkout/cart/ and show checkout form.

Now I would like to enable checkout form even on empty cart and show to the user that is nothing has been added to  the cart so the ceckout form would have 0 products

the actual code looks like

public function cartCheck(Varien_Event_Observer $observer)
{
    try {
        $cart = Mage::getSingleton('checkout/cart');
        $quote = $cart->getQuote();

            // checks all quote items (coupon or free) for max quantity of 1
            foreach ($quoteItems as $quoteItem) {
                if ($quoteItem->getQty() > 1
                    && in_array(($quoteItem->getProduct()->getAttributeSetId()), array_keys($this->_maxQtyByAttributeSet))
                ) {
                    $this->addMessage(Mage::helper('cartrules')->__(
                        'The maximum quantity for %s is %d.',
                        $quoteItem->getProduct()->getName(),
                        1
                    ));
                    $quoteItem->setQty(1);
                    $quoteItem->getQuote()->save();
                }
            }
        }
        // no products in cart ... redirect to front page
        else {
            Mage::getSingleton('checkout/session')->addNotice(Mage::helper('cartrules')->__('Your shopping cart is empty.'));

            Mage::app()->getResponse()->setRedirect('/')->sendHeaders();
            exit;
        }
    } catch (Exception $e) {}
}


texts: Event to check quote for product on every page

texts:
I am programmatically adding a product to cart if a certain coupon code is applied to cart.

I would like to check this on every page so that the product only shows up when the coupon is applied and no issues with cookies, etc.

What event can I observe for this?


texts:
How to submit the magento 2.0.6 custom module admin config form using events and observers

i want to submit the my custom module form using events and observers


texts: Why I don't see any Magento projects in my Magento Cloud account?

texts:
I'm a new hired developer for a company that is using Magento CE as their CMS. I'm trying to set up a local development environment and it's telling me that I have to be authorized user on Magento Cloud account. When I log in to our Magento Cloud Account it doesn't show any projects in there, though we have 3 websites on Magento. I got a hold of the original developer and he told me that he developed all websites using the free Magento version.

So I have two questions. Is there any way to connect our websites to the Magento Cloud account? And can I have a development environment is using Magento CE?


texts:
I'm on Magento 1.9.2 and following these tutorials to learn Magento. On this page there are instructions to create a Module for loading blog posts. I followed the instructions to the point until this piece of code

public function testModelAction() {
        $blogpost = Mage::getModel('weblog/blogpost');
        echo get_class($blogpost);
}

where i was supposed to get this error:

include(Magentotutorial/Weblog/Model/Blogpost.php) [function.include]: failed to open stream: No such file or directory

Instead I got this

include(Mage/Weblog/Model/Blogpost.php) [function.include]: failed to open stream: No such file or directory

Notice the path starts from Mage and not Magentotutorial. I triple checked everything on the tutorial to make sure everything was exactly as they asked and it was.

After several minutes of searching I tried changing Magentotutorial_Weblog to Magentotutorial_weblog in the Magentotutorial/Weblog/etc/config.xml and the error resolved itself.

<config>
    <modules>
        <Magentotutorial_Weblog>
            <version>0.1.0</version>
        </Magentotutorial_Weblog>
    </modules>
    ...

I'm not able to understand why. I've used capital W everywhere else (Module names, directory names, global config file). The tutorial didn't mention the use of small letter here so I would appreciate if someone could explain why this is the case.

Complete XML file is here:

<config>
    <modules>
        <Magentotutorial_weblog>
            <version>0.1.0</version>
        </Magentotutorial_weblog>
    </modules>
<frontend>
    <routers>
        <weblog>
            <use>standard</use>
            <args>
                <module>Magentotutorial_Weblog</module>
                <frontName>weblog</frontName>
            </args>
        </weblog>
    </routers>
</frontend>
<global>

    <models>
        <weblog>
            <class>Magentotutorial_Weblog_Model</class>

            <resourceModel>weblog_resource</resourceModel>
        </weblog>
        <weblog_resource>
            <class>Magentotutorial_Weblog_Model_Resource</class>
            <entities>
                <blogpost>

blog_posts

                </blogpost>
            </entities>
        </weblog_resource>
    </models>
</global>
</config>


texts: Can't update or delete attribute options

texts:
I have a strange problem with Magento. Recently I'm not able to delete an attribute option or update the postion of an attribute option.

When I change the position i.e. from "3" to "0", it will just be the same position number after I save it.

And the same happens when I try to delete an attribute option.

The attribute has more than 200 options. Is maybe the high number of the options causing this problem?

I'm using Magento 1.9.1

Any solution would be very much appreciated.


texts: Magento 2.2.4 : Different group dependency not working

texts:
I'm using magento 2.2.4. In system configuration, I want to do apply dependency.

But, both groups and fields are different. It's working in same group. But, I can't get output for different group.

How to do it ? Please help me.

I added my system.xml file code :

  system.xml :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>

            Name
            <tab>TabName</tab>
            <resource>CompanyName_ModuleName::methodName</resource>
            <group id="groupID" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                General Configuration
                <field id="fieldID" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Enable
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="groupID2" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                Form Configuration
                <field id="fieldID2" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    Check
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="fieldID">1</field>
                    </depends>
                </field>
            </group>

    </system>
</config>


texts: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails when i upgrade mage

texts:
How can I resolve Foreign Key constraint 'SQLSTATE[23000]: Integrity constraint violation:
When I have tried to upgrade the Magento version from  2.2.6 to 2.3.4 and run php bin/magento setup:upgrade command then getting the following error message in the terminal:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
update a child row: a foreign key constraint fails
(Larsen.#sql-39e_1f5, CONSTRAINT
CAT_PRD_ENTT_TIER_PRICE_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY
(entity_id) REFERENCES catalog_product_entity (entity_id) ON
DELETE CASCADE), query was: ALTER TABLE
catalog_product_entity_tier_price MODIFY COLUMN entity_id int(10)
UNSIGNED NOT NULL DEFAULT 0  , MODIFY COLUMN customer_group_id
int(10) UNSIGNED NOT NULL DEFAULT 0  COMMENT "Customer Group ID",
MODIFY COLUMN value decimal(12, 4)  NOT NULL DEFAULT 0 COMMENT
"Value", MODIFY COLUMN percentage_value decimal(5, 2)  NULL  COMMENT
"Percentage value", ADD CONSTRAINT
CAT_PRD_ENTT_TIER_PRICE_CSTR_GROUP_ID_CSTR_GROUP_CSTR_GROUP_ID
FOREIGN KEY (customer_group_id) REFERENCES customer_group
(customer_group_id)  ON DELETE CASCADE, ADD CONSTRAINT
CAT_PRD_ENTT_TIER_PRICE_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY
(entity_id) REFERENCES catalog_product_entity (entity_id)  ON
DELETE CASCADE, ADD CONSTRAINT
CAT_PRD_ENTT_TIER_PRICE_WS_ID_STORE_WS_WS_ID FOREIGN KEY
(website_id) REFERENCES store_website (website_id)  ON DELETE
CASCADE, ADD CONSTRAINT UNQ_E8AB433B9ACB00343ABB312AD2FAB087 UNIQUE
KEY (entity_id,all_groups,customer_group_id,qty,website_id),
ADD INDEX CATALOG_PRODUCT_ENTITY_TIER_PRICE_CUSTOMER_GROUP_ID
(customer_group_id), ADD INDEX
CATALOG_PRODUCT_ENTITY_TIER_PRICE_WEBSITE_ID (website_id)


texts: Magento, new Module for custom login is not loading

texts:
I'm new to Magento, I have been stuck with this problem for a while. I want to create a custom URL for VIP members to login. I'm trying to create a new login page with a new module because the login process is not same as default process. My login page is not rendering correctly.

Module download link : https://drive.google.com/open?id=0B3l22y1w8j8_cmFkVnVZcUNzRUE

Please point out any mistakes I've made in my code please.


texts: Magento2 : How to compile SCSS to CSS in Ubuntu

texts: Any one have idea How to compile SCSS to CSS in Magento2


texts: Magento 2 - change block class in layout

texts:
I know I can change the template of a block with:

<referenceBlock name="copyright">
    <action method="setTemplate">
        <argument name="template" xsi:type="string">Dfr_Backend::page/copyright.phtml</argument>
    </action>
</referenceBlock>

But how can I change the block class?


texts: Stop Product 'Sort By' Manual Selections from Becoming Global?

texts:
If you are shopping our site and you change the product listing 'Sort By' selection from 'New' (or whatever it may be) to 'Price' manually on the front-end 'Price' will then become the new global 'Sort By' selection for that user's entire session. In other words, for the rest of their shopping session all categories on our site will 'Sort By' Price, Bestsellers, Brand or whatever they had selected and it will override all of our default product 'Sort By' settings for all categories.

What we would like to have happen (and what we are seeing on other e-commerce sites) is that if the 'Sort By' selection has been manually changed by the shopper that that selection only last as long as they are in that category. So, when they leave that category our default product 'Sort By' settings will override their manual selection if one had been made.


texts: What is the Magento ORM equivalent of "SELECT DISTINCT attribute FROM products"?

texts:
I need to retrieve a list of all values which are used for a specific product attribute, in (pseudo) SQL:

SELECT DISTINCT attribute FROM products;

How would I use the Magento ORM to generate an equivalent query?  I've tried the distinct() function but it doesn't perform as I'd expect:

// Returns an array of NULL with a length equal to all products in the catalog
Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('attribute')
            ->distinct(true)
            ->getColumnValues('attribute');

What I'm working to get would be an array of attribute values, without duplicates

array('some value', 'some other value', 'a really common value', 'etc...');


texts: Magento2 Event 'customer_register_success' or 'customer_login' for adding product to Wishlist

texts:
I've created Guest Wishlist and now I am trying to add products from cookie to a Customer Wishlist.

Problem is that if I observe 'customer_register_success' wishlist is not created until new customer is fully logged in.

If I observe 'customer_login' then problem is that I want to add products from cookie to a Wishlist ONLY if it is a new registered customer.

Not sure how to get newly registered customer wishlist?

Here is my observer ($list is array of product Ids, from a cookie named 'guestwishlist':

namespace Vendor\GuestWishlist\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Wishlist\Model\WishlistFactory;

class CreateAccount implements ObserverInterface
{
    /**
     * @var \Magento\Catalog\Api\ProductRepositoryInterface
     */
    protected $productRepository;

    /** @var WishlistFactory */
    protected $wishlistFactory;

    protected $_helper;

    public function __construct(
        WishlistFactory $wishlistFactory,
        \Vendor\GuestWishlist\Helper\Data $helper,
        \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
    ) {
        $this->wishlistFactory = $wishlistFactory;
        $this->_helper = $helper;
        $this->productRepository = $productRepository;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $customer = $observer->getEvent()->getData('customer');
        $customerId = $customer->getId();

        $list = $this->_helper->getGuestWishlist();

        if(isset($list)){

            foreach ($list as $productId){

                $product = $this->productRepository->getById($productId);

                $wishlist = $this->wishlistFactory->create()->loadByCustomerId($customerId);
                $wishlist->addNewItem($productId);
                $wishlist->save();

            }
        }
    }
}

Error that shows is 'We can\'t specify a wish list.' when I observe event 'customer_login'


texts: Magento 2: Failed to open the required lessc.inc.php

texts:
My server cant seem to run Failed opening required vendor/oyejorge/less.php/lessc.inc.php

PHP message: PHP Fatal error:  Magento\Framework\View\TemplateEngine\Php::main(): Failed opening required 'vendor/oyejorge/less.php/lessc.inc.php' (include_path='/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/vendor/magento/zendframework1/library:/home/hm3/public_html/vendor/phpunit/php-file-iterator:/home/hm3/public_html/vendor/phpunit/phpunit:/home/hm3/public_html/vendor/symfony/yaml:.:/usr/share/php') in /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml on line 54" while reading response header from upstream, client: 14.173.28.183, server: 209.2*******.71, request: "GET /admin HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "209.2*******.71"
2016/11/26 09:34:04 [error] 2629#2629: *3 FastCGI sent in stderr: "PHP message: PHP Warning:  Uncaught Exception: Warning: require_once(vendor/oyejorge/less.php/lessc.inc.php): failed to open stream: No such file or directory in /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml on line 54 in /home/hm3/public_html/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml(54): Magento\Framework\App\ErrorHandler->handler(2, 'require_once(ve...', '/home/hm3/...', 54, Array)
#1 /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml(54): require_once()
#2 /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/header.phtml(19): include('/home/hm3/...')
#3 /home/hm3/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/home/hm3/...')
#4 /home/hm3/public_html/vendor/mag...
PHP message: PHP Fatal error:  Magento\Framework\View\TemplateEngine\Php::main(): Failed opening required 'vendor/oyejorge/less.php/lessc.inc.php' (include_path='/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/var/generation:/home/hm3/public_html/lib/internal:/home/hm3/public_html/vendor/magento/zendframework1/library:/home/hm3/public_html/vendor/phpunit/php-file-iterator:/home/hm3/public_html/vendor/phpunit/phpunit:/home/hm3/public_html/vendor/symfony/yaml:.:/usr/share/php') in /home/hm3/public_html/app/design/frontend/Sm/clickboom/Magento_Theme/templates/html/complie_less.phtml on line 54" while reading response header from upstream, client: 14.173.28.183, server: 209.2*******.71, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "209.2*******.71", referrer: "http://209.2*******.71/admin"


texts: Error Using HTTPS to get the authentication token for Magento2 Rest

texts:
I am using Magento2 Rest API with token-based authentication.
http://example.com/index.php/rest/V1/integration/admin/token
It is working when using HTTP. However it doesnot work with HTTPS.

SSL Certificate is added to the website. I can access the front and admin pages using HTTPS. What is the problem? HTTP is not secure.


texts: Creating Quote and Order programmatically and the issue with ReservedOrderId

texts:
I was  trying to create orders and quotes programmatically, in an API resource that is consumed by a Mobile Application, and i was successful. However every now and then I got a UNQ_SALES_FLAT_ORDER_INCREMENT_ID error. I google around and realized that:

The (increment_last_id) field in the (eav_entity_store) table is incremented by 1on each order as it normally should
The (increment_id) field in the (sales_flat_order) table seems to jump/skip several number from the (increment_last_id), sometimes the difference is 20, sometimes the difference is 50, very random

So I digged deeper on how Magento assigns the order increment id and observed the following:

app\code\core\Mage\Sales\Model\Service\Quote.php

The $quote->reserveOrderId() line reserve the order id of this quote:

public function submitOrder()
{
    $this->_deleteNominalItems();
    $this->_validate();
    $quote = $this->_quote;
    $isVirtual = $quote->isVirtual();

    $transaction = Mage::getModel('core/resource_transaction');
    if ($quote->getCustomerId()) {
        $transaction->addObject($quote->getCustomer());
    }
    $transaction->addObject($quote);

    $quote->reserveOrderId();

app\code\local\Mage\Sales\Model\Quote.php

The Quote model then checks if the quote already have a reserved order id or not, if it does not have one, it assigns it automatically, and this is the part that is really causing the issue. I don't know why if a quote doesn't have a reserved order id, the id is automatically assigned, by adding the current store increment id + a random value:

/**
 * Generate new increment order id and associate it with current quote
 *
 * @return Mage_Sales_Model_Quote
 */
public function reserveOrderId()
{
    if (!$this->getReservedOrderId()) {
        $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this) + $this->getRandInt() );
    } else {
        //checking if reserved order id was already used for some order
        //if yes reserving new one if not using old one
        if ($this->_getResource()->isOrderIncrementIdUsed($this->getReservedOrderId())) {
            $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this) + $this->getRandInt() );
        }
    }
    return $this;
}

app\code\core\Mage\Sales\Model\Resource\Quote.php

And just for reference, this is where $this->_getResource()->getReservedOrderId($this) generates the next increment:

public function getReservedOrderId($quote)
{
    $storeId = (int)$quote->getStoreId();
    return Mage::getSingleton('eav/config')->getEntityType(Mage_Sales_Model_Order::ENTITY)
        ->fetchNewIncrementId($storeId);
}

So after all the above I came to the conclusion that I need to set the quote reserved order id manually before submitting the order, something like:

<!-- ... creating quote and adding products -->
$quote->getPayment()->importData(array('method' => 'cashondelivery'));
$quote->collectTotals();
<!-- do i need to manually assign it this way -->
$quote->setReservedOrderId($quote->getResource()->getReservedOrderId($quote));
$quote->save();
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$increment_id = $service->getOrder()->getRealOrderId();

So my question right now is:

should i assign the reserved order id to the quote the way im doing it above, so i don't get a random order increment id? Most of the answers on stackoverflow about creating an order by code doesn't mention this line, so not sure whether it has consequences or not.
why Magento is assigning the order incrementn id the way it does randomly, if it already does not have one.

Thanks and sorry for the lengthy post.


texts: Magento 2 - How to add video icon in dot if the gallery has video?

texts: I want to add video-icon class in dot if the gallery has video.


texts: No x-default hreflang implemented (Magento 2.2.4)

texts: This is a mention from a SEO scan. Is there an easy way to implement this?


texts: Magento : How to set up Buy 2 get 3 promotion on a particular sku

texts:
I wanting to set up a promotion, without a code where customer adds a particular configurable product to their basket with qty 3, then they get the third on for free.

For Exam : Customer add Product A with qty 3, then automatic promotion is applyied.

The product has different sku for the different flavours.


texts: Magento2 : how to add an observer only for a product type

texts:
In Magento2 I have a module that defines a new product type : "Myproducttype"

I would like to be able to dynamically set the price when a "Myproducttype" product is diplayed (product page).

One solution could be using an observer on the event "catalog_product_load_after", but is it possible to enable this observer only for "Myproducttype" (via xml maybe?) to avoid

if ($producttype=="Myproducttype") {
...}

thank you for your help


texts: Magento 2.3 localhost Blank page Frontend and admin

texts:
I'm trying to transfer my test site from web space to local (I'm running low on maximun allowed size)
I've downloaded my database and a copy of the site.
Through Xampp I've imported the database, I've then inserted a copy of the site under the folder /htdocs and proceeded to connect the new database.
This is what i see online

And this is the same site on localhost

It's the first time i try to use a site locally, so I don't know what to do.
Any idea?


texts:
I know this question has been asked before, but no matter what I try, it's not displaying. It doesn't break and there's no error. The admin menu just renders as if I had done nothing.

I've tried this extensive tutorial
I also tried using this as a guide

Is it because I'm using version 1.9.1? I know the tutorial is rather old and after researching, it seems a lot of things changed in 1.9. I've been adding my files and folders to /app/code/community/. Do I also need anything in the /app/code/local/ or /app/etc/modules/?

I've tried the tutorial step by step multiple times. Even just copying and pasting directly from the page. Same goes for the second link. I haven't had much luck on finding anything regarding this and version 1.9 specifically and I'm pretty new to Magento.

Would somebody be able to steer me in the right direction to accomplish this?


texts: Magento2.3.1 How to add customer grid mass action link reset forget password and custom reset forget email sent to customer

texts:
I am using Magneto 2.3.1 and how to add customer mass-action inside link add reset forget password and when select customer sent to email for customer, but email not use in default Magento our custom email assign and set it.

If this type of work and idea reply me...


texts: Magento 2 Get Tax Amount is 0.000 in cart page ?

texts:
I get tax amount in cart page but it's 0.000.Why ?
Can anyone help me ?

print_r($this->checkoutSession->getQuote()->getShippingAddress()->getBaseTaxAmount());


texts: Can't add custom script (leaflet) to Contact page

texts:
I'm trying to add a map in Contact page. In order to do that,I did the following:

In file: app/design/frontend/MyCompany/MyTheme/Magento_Contact/layout/contact_index_index.xml I added:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="cms_page_layout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact</title>
        <css src="css/leaflet.css" />
        <script src="js/leaflet.js" />
    </head>
</page>

Files are indeed added in page's <head>.

Then in:
app/design/frontend/MyCompany/MyTheme/Magento_Contact/templates/map.phtml I added:

<script type="text/javascript">
require(['jquery'], function($){
    jQuery(document).ready(function(){
         var map = L.map('mapid').setView([40.591110, 23.037170], 15);
    });
})
</script>

The last thing I tried was to wrap the code between require(['jquery'], function($){ ...... }) in leaflet.js file.

Based on similar issues, this should be enough to have the script working. But instead of that I'm getting javascript error in page:

ReferenceError: L is not defined

Please let me know if anyone.

-----SOLUTION BASED ON @PRINCE ANSWER----

app/design/frontend/MyCompany/MyTheme/Magento_Contact/layout/contact_index_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="cms_page_layout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact</title>
        <css src="css/leaflet.css" />
        <script src="js/leaflet.js" />
    </head>
</page>

app/design/frontend/MyCompany/MyTheme/Magento_Contact/templates/map.phtml

<script type="text/javascript">
    require(['jquery', 'leaflet', 'my-custom-contact-js'], function($, L, scriptContact) {
        scriptContact();
    });
</script>

app/design/frontend/MyCompany/MyTheme/Magento_Contact/web/js/custom-js-contact.js

define(['jquery','leaflet'], function($,L) {
    return function scriptContact() {
        Your js content goes here.
    }
});

app/design/frontend/MyCompany/MyTheme/requirejs-config.js

var config = {
    map: {
        '*': {
            'my-custom-contact-js' : 'Magento_Contact/js/custom-js-contact'
        }
    },
    paths: {
        'leaflet': 'js/leaflet',
    },
    shim: {
        leaflet: {
            exports: 'L'
        }
    }
};


texts: Magento 2 : Form Component changes through component are ignored

texts:
I think there is a "changed" event somewhere that needs to be called, but I don't know what element or component, here is my code:

requirejs(['jquery', 'uiRegistry', 'underscore'], function($, uiRegistry, _) {
    "use strict";

    // Note: there is a function here that makes sure everything is loaded, then move on to pointers.

    // customer components pointers
    var websiteId = uiRegistry.get('customer_form.areas.customer.customer.website_id');
    var groupId = uiRegistry.get('customer_form.areas.customer.customer.container_group.group_id');
    var storeId = uiRegistry.get('customer_form.areas.customer.customer.sendemail_store_id'); // store_id

    // address components pointers
    var addressCollection = uiRegistry.get('customer_form.areas.address.address.address_collection');

    // method A)
    // Example setter / getter thru component
    groupId.value('3');
    alert(groupId.value());

    // method B)
    // Example setter / getter thru DOM / jQuery
    $('#' + groupId.uid).val('3');
    $('#' + groupId.uid).val();

});

In method A the form data should get updated properly, bu it won't.
I need to make changes to the form (fieldset) FOR the user automatically.


texts: How to import related products in normal import process? How can I achieve this? Is there any method available for import related products?


texts:
Error: "Message is added to queue, wait to get your file soon"

enter code here Open admin panel/system/Data Transfer/Export

After that select all export setting and click the continue button.

When clicking on the continue button above the error show.

Why files are not export? How to export files?

Please suggest.

Thank you so much.


texts:
Since upgrading to Magento 2.4x and having to use ElasticSearch as default, I am unable to find a way to sort category products by newest (created_at).
I have tried enabling used_in_sort_by for created_at but it does not order products corretly.
I am using the following to sort products -
                case 'new_arrivals':
                $this->_collection
                ->getSelect()
                ->order('e.entity_id '. $this->getCurrentDirection());
                break;

I can get price and name sorting to work fine but sort by created_at does not. I've also tried sort by entity_id which does not work also.


texts: Css file not loading after static content flush in Magento 2.1.8

texts:
I have a custom CSS file created and loaded through code. The compile less option is set to yes in configuration settings. When I clear the static content flush from cache management in admin panel and reload frontend, it gives an error that the CSS file not found pub/static/frontend/vendor/modulename/en_US/css/test.css. But when I run command php bin/magento setup:static-content:deploy my test.css file is loaded. I have my apache run through user test and Magento ownership is also test.
How to fix this issue?


texts: Sort Order Issue Payflow Pro Checkout Magento ver. 1.9.3.9

texts:
in [Configuration > Payment Methods > PayPal Payment Gateways > Payflow Pro > Basic Settings - PayPal Payflow Pro] there is a "Sort Order" option but it does not work. I am setting this to 0 but the "Payflow Pro" option is showing up as #2, under the "Paypal Credit" option. Please see screenshot.

I've researched this and no one has an answer. I've attempted to reorder in the config.xml but this does not work either unless I am doing it wrong.

Thank you in advance for scoping this out.


texts: How to validate field type checkboxes in system.xml

texts:
I am using magento 1.9.
In my custome module,  In system.xml added field type checkboxes.

<show_featuredproduct translate="label">
    <label>Show Featured Product On</label>
    <frontend_type>checkboxes</frontend_type>
    <source_model>adminhtml/system_config_source_frequency</source_model>
    <validate>validate-one-required</validate>
    <sort_order>1</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
 </show_featuredproduct>

I want to add validation for this field. I used <validate>validate-one-required</validate> but its not working.
 Any Idea?


texts: How to add Schema markup for a custom attribute in Magento 1.9.4

texts:
I am trying to add the right Schema Markup metadata for a custom attribute in Magento 1.9.4

I tried this :

  <meta itemprop="gtin13" content="<?php echo $_product->getAttributeText('gtin_code'); ?>" />


texts: POS with Magento integration with club/loyalty

texts:
We need a POS system that will integrate with Magento that will do the following:

Inventory synchronization between Magento and POS (obviously).
Layaway
Barcode label maker.
Import customers(w/ their existing IDs) from our POS because we have a membership/loyalty program and want to continue providing discounts. We need to scan that during checkout to identify the user and provide their discount. We don't need anything for membership card printing, we have our own ID maker(we print customer ID in a barcode on the card).

Hardest part: We need to let members purchase membership online(print card later in store), check their balance online, and use their membership during online purchases.
Our membership provides 10% off and has reward points(that are earned by buying things from our store).


texts: What do I need to re-index after importing products

texts:
I'm importing a bunch or products with Magmi, after each import I need to re-index for the products to show up on the frontend.  Do I need to re-index everything?

This is what I'm re-indexing

Product Attributes
Product Prices
Catalog URL Rewrites
Product Flat Data
Category Flat Data
Category Products
Catalog Search
Stock Status
Tag Aggregation Data

Do I need to re-index all of these or just a select few?


texts: Ship button not showing at order section Magento ver. 2.2.6

texts:
Ship button not showing at order section Magento ver 2.2

Order section

https://i.stack.imgur.com/yOhL7.png


texts: How can i get the special price of the product if it is active using product id in magento 2?

texts: How can i get the special price of the product if it is active ?


texts: Trigger admin controller custom action on button click

texts:
I have 2 buttons for my form, currently the main save button works like:

$this->_updateButton('save', 'onclick', 'submitForm()');

and some JS so it shows the "Please Wait" javascript loader:

function submitForm() {
    $('edit_form').request({
         onComplete: function()  {
             window.location.href = document.URL;
         }
     })
}

This works well because it's just posting the form. I need to add another button to post the same form but call a different action other than saveAction, I am currently doing:

$postBackUrl = $this->getUrl('*/mymodule/custom');
$this->_addButton('sync', array(
    'label'     => Mage::helper('adminhtml')->__('My Action'),
    'onclick'   => "submitSyncForm('$postBackUrl')",
    'class'     => 'save'
),3,5);

I then have this Javascript to post the form:

function submitSyncForm(url){
    new Ajax.Request(url, {
        method:'post',
        onComplete: function()  {
            window.location.href = document.URL;
        }
    });
}

The form shows the Please Wait and posts to customAction correctly but the post values are empty when I try to access them via $this->request->getPost().

Could someone point me in the right direction on posting the form to a custom action other than saveAction please?


texts: Not able to Reindex Indexes when install magento by downloading code from magento connect

texts:
I have installed magento 2 by downloading code from magento connect. I have not used composer for it.

Now, I am not able to reindex indexes from CLI.

Please let me know how to reindex indexes in magento 2.


texts: Magento 2 | Deploy static content from only one source

texts:
I got some errors when trying to compile where CSS is not being generated for adminhtml.

I got this in the shell:

Compilation from source: /microcloud/domains/operm2/domains/dev.domain.co.uk/http/vendor/magento/theme-adminhtml-backend/web/css/styles.less

Compilation from source:
adminhtml/Magento/backend/en_US/css/styles.less
Unable to get content for 'adminhtml/Magento/backend/en_US/Magento_Checkout/css/source/_module.less'

..............................................................

Successful: 2662 files; errors: 2

When I add -vvv the generated result is almost unreadable.

Is it possible to run deploy command only from one source?

e.g.

php bin/magento setup:static-content:deploy adminhtml/Magento/backend/en_US/css/styles.less


texts:
I have good understanding of PHP (my strongs are JAVA and C, but php in very similar in many aspects) and I need to start learn how to code Magento modules.

I can only find tutorials for 1.7 or early, are these OK or do I need a tutorial for 1.9? Which tutorials or web courses you recommend?

cheers


texts:
I'm writing search functionality in root magento file.

<?php
 require_once('app/Mage.php');
 umask(0);
 Mage::app('default');
 $collection = Mage::getModel('catalog/product')->getCollection();
 $searchKeyword = 'kalmari123 abc'
$collection->addAttributeToFilter(
array(
    array('attribute'=>'sku','like'=>"%$searchKeyword%"),
    array('attribute'=>'name','like'=>"%$searchKeyword%")
));
foreach ($collection as $_product)
  {
    echo $_product->getSku();
  }

kalmari123 is the sku for product.
It's giving correct result if $searchKeyword = 'kalmari123'; but it shows nothing if I'm using $searchKeyword = 'kalmari123 abc'. How can I make it work? I want to search if any of the given keyword is matching.


texts: Magento 2: Which pages are cached via FPC?

texts: I'm having issues with cache and I would like to know which pages are natively cached and uncached by Magento 2?


texts: Magento2 How To Add Custom Step For Multi shipping Checkout

texts: Does anyone help me to add custom step for multi shipping checkout ?


texts:
Our site needs to search only by part number, and needs to be either an exact match, or start with they keyword the customer enters. We are using Magento 2.3 with Elastic Search.
I have found that I can modify the elastic search query by overriding:
\Magento\Elasticsearch7\SearchAdapter\Mapper
This is my current query:
{
  "index": "magento2_product_1",
  "type": "document",
  "body": {
    "from": 0,
    "size": "10000",
    "stored_fields": [
      "_id",
      "_score"
    ],
    "sort": [
      {
        "_score": {
          "order": "desc"
        }
      }
    ],
    "query": {
      "bool": {
        "must": [
          {
            "terms": {
              "visibility": [
                "3",
                "4"
              ]
            }
          }
        ],
        "should": [
          {
            "wildcard": {
              "short_description": {
                "value": "6203*",
                "boost": 11
              }
            }
          },
          {
            "match": {
              "manufacturer_value": {
                "query": "KOBE",
                "boost": 2
              }
            }
          }
        ],
        "minimum_should_match": 1
      }
    },
    "aggregations": {
      "price_bucket": {
        "extended_stats": {
          "field": "price_0_1"
        }
      },
      "category_bucket": {
        "terms": {
          "field": "category_ids",
          "size": 500
        }
      },
      "manufacturer_bucket": {
        "terms": {
          "field": "manufacturer",
          "size": 500
        }
      }
    },
    "min_score": 20
  },
  "track_total_hits": true
}

I get no results, but no error. If I switch the wildcard to a "match" and "value" to "query", it works fine. I'm not sure if I have an error in the query, or if I need to change something in the indexing process to make it amenable to wildcard searches.


texts: Magento 2 Category Collection doesn't show items not in Top Menu

texts:
I am trying to display certain categories along with their images on homepage. I've made sure the categories dont appear in the top menu and only in the code that I am trying to use. Below code only displays category which are in TopMenu.

Is there a way around?

<?php
  $categoryHelper = $this->helper('Magento\Catalog\Helper\Category');
  foreach($categoryHelper->getStoreCategories() as $category):
?>

     <a href="<?php echo $categoryHelper->getCategoryUrl($category) ?>">
       <?php echo $category->getName() ?>

<?php endforeach; ?>


texts: Magento 2 apply tax class programmatically to customer

texts:
I want to add the customs tax based on the selection of shipping method.

We have created the tax rule and rate on admin panel and assigned that to customs tax class.

I want to assign that custom tax rule to the customer.Is there any possibility to assigned the tax rule programmatically on the checkout page.

Please help on the above issue.Any references and suggestion are highly appreciated.

Thanks.


texts: "&" instead of "&" in language switch url

texts:
when using magento's language switcher, the generated URL is:

a href="http://www.shop.com/index.php/bags/eastpak.html?___store=en&amp;___from_store=default">

Magento version 1.7 is used.

How can I convert this &amp; to &?

Is Magento's Redirect class reason for this bug?


texts: Magento Admin/Backend is not showing properly after login

texts:
After Login into the admin panel, I have this screen, I am not sure how to fix this.

I have just moved from one hosting to other and added one Extension.
I am not able to see the extension so, wasn't available for remove
the extension.


texts: Logging in on frontend with a customer associated to "Admin" (website)

texts:
Is a customer assigned to Admin for the Associate to Website in the admin supposed to be able to log in on the frontend? If not, what is this account for? I can't seem to log on with a customer I made in the admin with website association to admin. This customer has website_id = 0 and store_id = 0.

Some background:

I have a set of customer migrated by someone else, and all of them have website_id = 1, which is correct, but the store_ids are all set to zero. Subsequently, they show up having Admin for their Associate to Website value in the admin. This seems to have been done incorrectly, as I don't think you can get the combination of values website_id  = 1 and store_id = 0.

Can someone verify?


texts:
I changed the secure options on Configuration -> Web 'use secure in frontend' and 'use secure in adminhtml' to 'yes' but it was not configurated yet. I cannot access the admin pannel from a browser because it redirects automatically to a https.

I tried to change via database with the commands:

UPDATE core_config_data
    SET value=0
    WHERE path='web/secure/use_in_frontend' OR path='web/secure/use_in_adminhtml' OR path='web/url/redirect_to_base';

And deleted the var/cache but nothing happens.

EDIT:

SELECT * FROMcore_config_dataWHERE path LIKE 'web/secure/use_in_frontend';
+-----------+---------+----------+----------------------------+-------+
| config_id | scope   | scope_id | path                       | value |
+-----------+---------+----------+----------------------------+-------+
|       327 | default |        0 | web/secure/use_in_frontend | 0     |
+-----------+---------+----------+----------------------------+-------+
1 row in set (0.00 sec)

SELECT *  FROMcore_config_dataWHERE path LIKE 'web/secure/use_in_adminhtml';
+-----------+---------+----------+-----------------------------+-------+
| config_id | scope   | scope_id | path                        | value |
+-----------+---------+----------+-----------------------------+-------+
|       328 | default |        0 | web/secure/use_in_adminhtml | 0     |
+-----------+---------+----------+-----------------------------+-------+
1 row in set (0.00 sec)

But nothing had changed.

EDIT 2:

Some pages have a strange redirection pattern. For example: http://www.mywebstore.com/customer/account/login/ sends me back to http://www.mywebstore.com/.

But http://mywebstore.com/customer/account/login/goes to https://mywebstore.com/customer/account/login/ witch is a 'Not possible to access this webpage' page.


texts: How to call helper of other module in magento 2?

texts:
class ClassName {
protected $_objectManager;
function __construct(
    \Magento\Framework\ObjectManagerInterface $objectmanager
) {
    $this->_objectManager     = $objectmanager;
}

public function callHelper(){
    $helperIdArr = array('Other Module Helper');
    foreach($helperIdArr as $helperId){
         $dataHelper = $this->_objectManager->get("$helperId\Helper\Data");
    }
    return $dataHelper;
}
}

I want to call my other custom module helper in this function.

This is working fine, but use of Object manager is not a good practice so what should i do to call my other helper.


texts: Why package depencies error is coming in Magento 1.9. please explain

texts: I am working on my eCommerce website called cravestore.in. My magento version is 1.9.4. I am not able to install any extensions from Magento Connect & Mage terminal both. I don't know how to fix this. I am getting package dependencies & skipping error. Also suggest how to get the extension key from Magento Marketplace. Attached are the screenshots.


texts: admin backend icon fonts missing in magento CE 2.18

texts:
I am a newbie to magento, besides the fact the it is too slow, I got to install it and the dashboard images and fonts are missing, I did some research and found this question

I applied the answer but got this error when I got to this point

php bin/magento setup:static-content:deploy

  [InvalidArgumentException]
  There are no commands defined in the "setup:static-content" namespace.
  Did you mean one of these?
      setup
      setup:config
      setup:cron
      setup:db-data
      setup:db-schema
      setup:db
      setup:di
      setup:performance
      setup:store-config

By the way my php version is 7.0.12


texts: Magento 2 unable to add a New Option (Custom Option section)

texts:
I will try to explain how it happened.
There were 3 options already created for a simple product (Custom Options)

size 1

size 2

size 3

when I removed the size 1 and saved, all options disappeared... then I tried to created a new one by clicking on Add New Option but the click doesn't work anymore

Anyone can tell me how to fix this error?

main.CRITICAL: Warning: Invalid argument supplied for foreach() in /home/xxx/public_html/xxx/vendor/magento/module-catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php on line 320 [] []


texts: How to use custom template for wp page using fishpig

texts: Is there any way to create a custom template for specific Page (ID or Title).


texts:
how can I call afterRender after generating all foreach elements? I want to initialize slider after rendering all slides.

I've tried:

...

but put console.log(jQuery('.slide').length) in renderedDelivery function. Sometimes it writes 0 elements, sometimes all generated. renderedDelivery fires ones.


texts: Magento2 - Removing inline translations does not revert to original string

texts:
I have a web site that was originally translated using inline translation. I am in the process of moving the translations to a .csv file. However when i remove the translations from the inline translation fields, instead of reverting back to the default string it becomes empty (showing nothing) and the editing field becomes broken.

Screenshot of the Inline Translation fields

Screenshot of Inline Translation form


texts: Should a development team use a single pair of repo.magento.com keys?

texts: I understand that in order to use composer with Magento 2, you need to set up your instance with a public key and private key per the documentation. If you’re working in a team, should the team use the same pair of authentication keys, or should each developer have their own unique pair?


texts: custom extensions - are hyphens allowed in the Extension name?

texts:
This is a follow up on the Magento 2 Extension naming convention question here.

I've learned thus far that you need

a Vendor Name
an Extension (or Module) name
a combination of both like Vendor_ExtensionName (to be used in a ~/etc/module.xml file).

Now something like ExtensionName (Capitals of both terms making it more readable) does not play all too nice in a git repository (which many may be using for development) so my question is:

Is it ok to use hyphens to separate words in the Extension name like Vendor_My-Extension (which makes a vendor_my-extension git repository) or does that run contrary to best coding practices?


texts: How to get secure baseurl (https) in magento 2?

texts:
with this code im getting http://url.com
i want to get https://url.com
using object manager. i'm using magento 2.0.4

 echo $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB); echo '<br>';


texts: How to create a simple products programmatically using CSV data in Magento 2 admin?

texts:
I have created a file uploader on my backend admin.
I want to update my products using programmatically by using an csv uploaded.
My controller file is
<?php
namespace Tym17\AdminSample\Controller\Adminhtml\SampleTwo;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;

class Index extends \Magento\Backend\App\Action
{
/**
 * @var PageFactory
 */
 protected $resultPageFactory;
 protected $csv;
/**
 * @var scopeConfig
 * Needed to retrieve config values
 */

/**
 * @param Context $context
 * @param PageFactory $resultPageFactory
 */
public function __construct(
    Context $context,
    PageFactory $resultPageFactory,
    ScopeConfigInterface $scopeConfig,
    \Magento\Framework\File\Csv $csv
) {
    parent::__construct($context);
    $this->resultPageFactory = $resultPageFactory;
    $this->scopeConfig = $scopeConfig;
    $this->csv = $csv;
}

/**
* Index Action*
* @return void
*/
public function execute()
{
    if (!isset($file['tmp_name']))
        throw new \Magento\Framework\Exception\LocalizedException(__('Invalid file upload attempt.'));

     $csvData = $this->csv->getData($file['tmp_name']);

     foreach ($csvData as $row => $data) {
         if ($row > 0){
             //Start your work
         }
     }
     die();
}
}

I have follow this post https://firebearstudio.com/blog/how-to-read-a-csv-file-convert-it-into-an-array-in-magento-2.html
Any help is appreciated.


texts: Multiple download of files at once in Magento 2.3

texts:
I have added a function where in when the user select multiple order then trigger the Download PDF button I added it will download PDF's with X number of PDF based from the number of selected orders. So basically when I select 3 PDF it should generate or download 3 PDF. But on my function it only download one pdf. How can I tell Magento 2 to download 3 pdf or more based from the number of selected items.

Below is my sample code

public function printPDF()
{
    $pdf = new \Zend_Pdf();
    $pdf->pages[] = $pdf->newPage(\Zend_Pdf_Page::SIZE_A4);
    $page = $pdf->pages[0]; // this will get reference to the first page.
    $style = new \Zend_Pdf_Style();
    $style->setLineColor(new \Zend_Pdf_Color_Rgb(0,0,0));
    $font = \Zend_Pdf_Font::fontWithName(\Zend_Pdf_Font::FONT_TIMES);
    $style->setFont($font,13);
    $page->setStyle($style);
    $width = $page->getWidth();
    $hight = $page->getHeight();
    $x = 30;
    $pageTopalign = 850;
    $this->y = 850 - 100;

    $style->setFont($font,14);
    $page->setStyle($style);
    $page->drawRectangle(30, $this->y + 10, $page->getWidth()-30, $this->y +70, \Zend_Pdf_Page::SHAPE_DRAW_STROKE);

    $style->setFont($font,13);
    $page->setStyle($style);
    $page->drawText(__("Cutomer Details"), $x + 5, $this->y+50, 'UTF-8');
    $style->setFont($font,11);
    $page->setStyle($style);
    $page->drawText(__("Name : %1", "Test Meetanshi"), $x + 5, $this->y+33, 'UTF-8');
    $page->drawText(__("Email : %1","test@meetanshi.com"), $x + 5, $this->y+16, 'UTF-8');

    $style->setFont($font,11);
    $page->setStyle($style);

    $page->drawText(__("PRODUCT NAME"), $x + 60, $this->y-10, 'UTF-8');
    $page->drawText(__("PRODUCT PRICE"), $x + 200, $this->y-10, 'UTF-8');
    $page->drawText(__("QTY"), $x + 310, $this->y-10, 'UTF-8');
    $page->drawText(__("SUB TOTAL"), $x + 440, $this->y-10, 'UTF-8');

    $style->setFont($font,10);
    $page->setStyle($style);
    $add = 9;

    $page->drawText("$12.00", $x + 210, $this->y-30, 'UTF-8');
    $page->drawText(10, $x + 330, $this->y-30, 'UTF-8');
    $page->drawText("$120.00", $x + 470, $this->y-30, 'UTF-8');
    $pro = "TEST product";
    $page->drawText($pro, $x + 65, $this->y-30, 'UTF-8');

    $page->drawRectangle(30, $this->y -62, $page->getWidth()-30, $this->y + 10, \Zend_Pdf_Page::SHAPE_DRAW_STROKE);
    $page->drawRectangle(30, $this->y -62, $page->getWidth()-30, $this->y - 100, \Zend_Pdf_Page::SHAPE_DRAW_STROKE);

    $style->setFont($font,15);
    $page->setStyle($style);
    $page->drawText(__("Total : %1", "$50.00"), $x + 435, $this->y-85, 'UTF-8');

    $style->setFont($font,10);
    $page->setStyle($style);
    $page->drawText(__("Test Footer example"), ($page->getWidth()/2)-50, $this->y-200);

    $fileName = 'meetanshi.pdf';

    $this->fileFactory->create(
       $fileName,
       $pdf->render(),
       \Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR, // this pdf will be saved in var directory with the name meetanshi.pdf
       'application/pdf'
    );
}

So in my execute() function I added this call

public function execute()
{
        $this->printPDF();
        $this->printPDF();
        $this->printPDF();
}

But it only download 1 PDF. How can I tell it to download multiple times?

Update:

I was also thinking of merging multiple files into single PDF file by adding multiple page in this PDF. How can I achieve this?


texts: Currency troubles with my shipping tables!

texts: So I created a shipping table (csv file) and set the cost for standard delivery for example for the USA to 17.00 (€) but when the customer is trying to checkout out he will see 14.20(€) as shippment cost. How can I fix this? My buissnes is located in Europe


texts: Adding items to Cache Storage Management

texts: I'm using FPC with redis.  I'd like to be able to flush the homepage or category pages from this page.  How to I add these items to the Cache Storage Management?  Hole punching?  But how do I link the hole punching to the Cache Storage Management?


texts: Adding to Cart with Querystring - Takes me to homepage?

texts:
I'm trying to add a product to my cart via query string based on the information on the Magento website.

I've tried the following:

/checkout/cart/add/product/3887/1/
/checkout/cart/add/product/3887/1/e8JDefUuLcGdLE1Q (Added Form Key)
/checkout/cart/add?product=3887&qty=1

The Product ID here is 3887 and it's a Simple product, with no special or custom options.
I'm trying to send it through Ajax but it doesn't get put in the cart and then when I attempt to enter the URL directly I just get redirected to the homepage.

I'm getting the Product ID from a custom page where customers will be able to enter a list of SKU's into 10 input boxes (Quickshop page)

Thanks in advance!

SOLUTION for others:

URL must follow this:

/checkout/cart/add/product/PRODUCTID/qty/NUMBER/form_key/WSFiE69HmvU854G2


texts:
I am overriding this file

  vendor\magento\module-backend\view\adminhtml\templates\widget\grid\extended.phtml

I am overriding it in

  app\code\Vendor\Module\view\adminhtml\templates\widget\grid\extended.phtml

Since it a template file i also need to create backend_widget_grid.xml at

  app/code/{Vendor}/{Module}/view/frontend/layout/

with the following content

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="widget.extended">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">{Vendor}_{Module}::widget/grid/extended.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

But I am not sure if the referenceBlock or if the backend_widget_grid.xml name I am entering is incorrect since my edit doesn't show?


texts:
I'm trying change the default magento logo in email template from Admin Panel, Content > Design > Configuration but it doesn't Update on the email. How can I fix this issue?

Design Configuration


texts:
Since I installed my store I see the SID code in my URLs but I don't know why it's there, I found an option in my admin panel to disable it.

Could you explain to me why do I need it?


texts: csv import of images does not work reliably

texts:
I am trying to import products with images into magento via a csv file. However, most of the  times, the images are not imported, neither in the frontend nor the backend.

I use columns "image", "small_image", "thumbnail" which all contain e.g. "/1.jpg"

For a certain product, where the image is in a file "/var/www/media/import/1.jpg", the values "image_label", "small_image_label", "thumbnail_label" are kept empty.

No matter what I do, the images are not appearing regularly for the products.

If I try several times, it works sometimes, I think with a higher probability if I use a small number of products.

What can the problem be and is there a method for importing images which works reliably?

Edit:
I use import/export. Some lines from my csv file:

sku,name,price,image,small_image,thumbnail,image_label,small_image_label,thumbnail_label,_media_image,_media_lable,_media_position,_media_is_disabled,_type,_attribute_set,_product_websites,description,short_description,weight,status,visibility,tax_class_id,qty,_media_attribute_id

---newline---

12412849,Produkt1,20.35,/12412849.jpg,/12412849.jpg,/12412849.jpg,,,,/12412849.jpg,,1,0,simple,Default,base,Default,Default,0,1,4,2,76,77

---newline---

10532469,Produkt2,27.75,/220x220/10532469.jpg,/220x220/10532469.jpg,/220x220/10532469.jpg,,,,/220x220/10532469.jpg,,1,0,simple,Default,base,Default,Default,0,1,4,2,76,77


texts:
Take this code for example:

$collection->getSelect()->order(array('status = 1 DESC', 'test ASC'));

Magento/Zend_Db turns this into the following:

ORDER BY `status = 1` DESC, `test` ASC

You can see this with Zend_Debug::dump($collection->getSelect()->__toString());

Notice that it wraps status = 1 with ` characters, as if it were escaping a field? This breaks the query. Is there any way to order by expression in Magento/Zend_Db?


texts:
I update schema newsletter_subscriber, certain I added firstname column which is a foreign key to customer_entity firstname, and when I post data the object with value is sent and in Magento insert method values are translated to "?", and then it throws the error.

Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`newsletter_subscriber`, CONSTRAINT `NEWSLETTER_SUBSCRIBER_FIRSTNAME_CUSTOMER_ENTITY_FIRSTNAME` FOREIGN KEY (`firstname`) REFERENCES `customer_entity` (`firstname`) ON DELETE SET NULL), query was: INSERT INTO `newsletter_subscriber` (`store_id`, `change_status_at`, `subscriber_email`, `subscriber_status`, `firstname`, `firstname`) VALUES (?, '2019-02-12 15:35:20', ?, ?, ?, ?)

CODE

Upgrade schema

 $con->addForeignKey(
                $setup->getFkName('newsletter_segment', 'firstname', 'customer_entity', 'firstname'),
                'newsletter_subscriber',
                'firstname',
                'customer_entity',
                'firstname',
                \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
            );

UI_COMPONENT

<field name="firstname">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">subscriber</item>
                    <item name="label" xsi:type="string">Firstname</item>
                </item>
            </argument>
        </field>

NOTE

When I post null value for the first name, a record is saved.


texts: Magento 1.9.3 error in catalog pages after compilation cms pages works fine

texts:
I've got a weird problem. Suddenly my Magento shops gave an error 500 when I try to open a catalog page or a product page. CMS pages are working stil fine and if I disable compilation in the backend, everything is working fine again.

What could this be? How to trace down this strange error? I already tried to set the show errors option in index.php, but instead of giving details of the error page it shows a blank page.

Already tried to flush cache reload indexes and checked if something changed at the hosting platform. Flushing caches and reindexing didn't work and nothing changed at my hoster.

Any ideas?

https://wifivoordezaak.nl


texts: Can’t find this function: getLockedDoInvoice

texts:
$item->getLockedDoInvoice()

this is a condition in canInvoice() of the order but I can’t find this function
I used editplus to search in all kind files with “getLockedDoInvoice” and it wasn’t able to find it

any clues?

Jonathan

Note: The original question is from this link: http://www.magentocommerce.com/boards%20/viewthread/177372/

I just find this very useful to me, so I am reposting it here for the benefit of other people.


texts: Free shipping price rule is not applying to Fedex rate

texts:
I believe I'm encountering a bug with the Fedex shipping calculation (might be problem with other carriers).

Steps to Replicate

Enable Fedex rates
Configure "Home Delivery" as the free method
Create a price rule to apply free shipping to a single sku (e.g. test-123)
Add sku test-123 to your cart
Add another item to your cart (sku somethingelse-456)

Expected Result

When shipping is calculated, sku test-123 should not be taken into account.
I.e. the shipping rate for a cart consisting of skus test-123 and somethingelse-456 should be the same as the shipping rate for a cart with sku somethingelse-456

Actual Result

The free shipping rule is not used and the Fedex rate includes the cost of shipping the test-123 item.

I have tested this on a clean CE 1.9.2.1 install with sample data.

For an example of how it should work, consider flat rate shipping.  With a $5 flat rate per item, the cost to ship my 2 items would be $10, however because of the price rule, it is only $5.

Is this a bug?  Has anyone else experienced this?  What is the solution?

Here are some screen shots to further explain the issue:


texts: Changing advanced search results query - Magento 2

texts:
I've extended the default layered navigation in magento 2 so that filter parameters are added like so:

?free_from=304_303_302

Where option ids are separated by an underscore, in the above example the product list displays all products with one or more of the 3 options selected.

This allows users to add more that one filter in each filterable category.

My question is how do i extend the way the advanced search builds the advanced search results query, so that it matches the way the layered navigation applies filters.

Currently, when I select multiple options from the advanced search and select search, it adds the query parameters in the form of an array,

?free_from%5B%5D=303&free_from%5B%5D=304&free_from%5B%5D=302

I need to change this so that it matches the layered navigation query, can anyone help me on this?

I can see the action of the advanced form is returned from \Magento\CatalogSearch\Block\Advanced\Form getSearchPostUrl(), and that this then retrieved the url from Magento\Framework\View\Element\AbstractBlock getUrl($route = '', $params = []), which method should i override and how do i retrieve the params and define the structure of the query?

Any help on this would be greatly appreciated.


texts: Magento 2. How to add recently viewed products programmatically

texts:
I have a page with a custom layout and I want to add Recently Viewed Products to one of the blocks on that page. How do I do it programmatically, e.g. using my own phtml template?
In Magento 1.9x it was super easy to do. In Magento 2 this function added using widget, but I cannot find the way to add it to my custom page.
Regards!


texts: 1000 Category Limit not working with 1.8

texts:
Since updating Magento to 1.8 I have noticed the fix I was using for the 1000 Category save "bug" (quotes as Magento stupidly don't consider it a bug) isn't working anymore.

I was using the one from here: Impossible to save category with more that 1000 products

Has anyone got any idea why not, I have compared the saveAction between versions but can't find what would be breaking the fix?


texts: Magento2: How to apply two sorting one magento default one and other sort by attributes?

texts:
I want to sort my products by attributes : that is working fine but I want to apply two sort together , like sort by name asc and sort by attributes asc also

How can I implement this ?.

Based on answer added below code in toolbar.php (where hour is input value attributes, i want to show all products with hour value as 320), but it seems not working

namespace VendoreName\ModuleName\Plugin\Product\ProductList;

class Toolbar
{
    public function aroundSetCollection(
        \Magento\Catalog\Block\Product\ProductList\Toolbar $subject,
        \Closure $proceed,
        $collection
    ) {
        $currentOrder = $subject->getCurrentOrder();
        $result = $proceed($collection);

        $subject->getCollection()->addFieldToFilter('hour','320');
        return $result;
    }
}


texts: Trigger Proceed to checkout button in Magento2

texts:
I need to execute my custom code on clicking proceed to checkout button.

Can we trigger the action, I need to insert quote Id with some other details to
custom table.

How this can be done, is there any methods like Plugin, event or something else to achieve this?


texts: Default Qty For Simple Products Associated to Grouped Products Not Saving

texts:
In a grouped product, associated simple products default quantity not saving.
The values are saved in database in catalog_product_link_attribute_decimal table, but not showing in admin (blank input on product save) or frontend.


texts: Specify from and to time as well as dates for promotions (Magento 2 CE)

texts:
I am wanting to add a Cart Price Rule within my Magento shop (Community Edition 2.1.4) that must be active within a certain date and time range.

Within the Admin, if you head to Marketing > Promotions > Cart Price Rules and either add or edit a rule, you can very easily pick a date when the rule is to be made active (From), and a date for when you want it to be made inactive (To). However there doesn't seem to be an option to select the time as well, especially if it's to happen on one day only (e.g. between 9am - 5pm).

I don't mind paying for an extension, however Google has come up with nothing that fits the bill, nor have I found a solution on Stack Exchange; many I have come across only supports version 1 of Magento.

So... are there any extensions available that will allow me to add in times as well as dates to indicate when a promotion should be available, and if not then how do I go about adding it in? This is my first Magento site I'm developing by the way, so don't be too surprised if I ask for further clarity on an answer. Thanks!


texts: Magento sub store is redirecting to main store

texts:
I have a Magento 2.3.3 install at akcustom.ink. I have configured a new subdomain in my cpanel for leisnoi.akcustom.ink. My problem is that when I navigate to leisnoi.akcustom.ink in a browser it redirects me to akcustom.ink. I know the subdomain works right because I uploaded a test.php file in the root folder of the subdomain and could access it fine in a browser. Below are the steps I have taken to configure this sub store.
I have configured the different store views:

I setup the Url Options for the Default Config view:

======================================================
I setup the Url Options for the Leisnoi Company Store English view:

I have added the following to my .htaccess file in the root folder of the main site:
SetEnvIf Host www.akcustom.ink MAGE_RUN_CODE='base'
SetEnvIf Host www.akcustom.ink MAGE_RUN_TYPE='website'
SetEnvIf Host leisnoi.akcustom.ink MAGE_RUN_CODE='LEICS_en'
SetEnvIf Host leisnoi.akcustom.ink MAGE_RUN_TYPE='store'

I have copied the index.php and .htaccess files from the main website to the subdomain folder. In the index.php file of the subdomain I have removed this block of code:
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

and replaced it with this:
$params = $_SERVER;
$domain2store = array(
  'leisnoi.akcustom.ink'=>'LEICS_en',
  'upperonestudios.akcustom.ink'=>'UOSCS_en',
  'denalimontessori.akcustom.ink'=>'DMSS_en',
);
if(isset($domain2store[$_SERVER['HTTP_HOST']])){
  $storecode = $domain2store[$_SERVER['HTTP_HOST']];
}
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = isset($storecode) ? $storecode : '';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('\Magento\Framework\App\Http');
$bootstrap->run($app);

Finally, I created symlinks in my subdomain root folder via SSH as follows:
ln -s /home/username/akcustom.ink/app/ app
ln -s /home/username/akcustom.ink/lib/ lib
ln -s /home/username/akcustom.ink/pub/ pub
ln -s /home/username/akcustom.ink/var/ var

Where you see username above I put my actual username.
After all of this, it still redirects to the main site. I have tried every possible solution that I have found and none have done the trick. What am I doing wrong?


texts: Dropdown for virtual product in frontend

texts: Is it possible to have dropdown list with different prices for a virtual product?


texts: Product URL Issue after changing product name

texts:
So, I updated many (thousands) of product names, which in turn updated the URL key for those items.

Example:
Old Url key: acme-rocket
New URL key: rocket

When I try to go to the new url: www.xyx.com/rocket I get a 404 error.


texts: Error PayPal thrown but it wasn't a PayPal payment

texts:
I have this error when I'm trying to pay an order:

Fatal error: Uncaught TypeError:
Argument 1 passed to Magento\Paypal\Model\Adminhtml\Express::isOrderAuthorizationAllowed() must be an instance of Magento\Sales\Model\Order\Payment, null given,
called in /var/www/axiane-portailclient/vendor/magento/module-paypal/Plugin/OrderCanInvoice.php on line 41 and
defined in /var/www/axiane-portailclient/vendor/magento/module-paypal/Model/Adminhtml/Express.php:169
Stack trace:
#0 /var/www/axiane-portailclient/vendor/magento/module-paypal/Plugin/OrderCanInvoice.php(41): Magento\Paypal\Model\Adminhtml\Express->isOrderAuthorizationAllowed(NULL)
#1 /var/www/axiane-portailclient/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Paypal\Plugin\OrderCanInvoice->afterCanInvoice(Object(Magento\Sales\Model\Order\Interceptor), false)
#2 /var/www/axiane-portailclient/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\Order\Interceptor->Magento\Framework\Interception\{closure}()
#3 /var/www/axiane-portailclient/generated/code/Magento/Sales/Model/Orde in /var/www/axiane-portailclient/vendor/magento/module-paypal/Model/Adminhtml/Express.php on line 169

I don't know why, because it's not a paypal step.

I'm on magento 2.2.5

Error is showing after save($order)

public function updateOrderStatus(){
    $increment_id = $this->loadOrderIncrementId();
    $order = $this->_order->loadByIncrementId($increment_id);
    $order->setState(Order::STATE_COMPLETE);
    $order->setStatus(Order::STATE_COMPLETE);
    $this->_orderRepository->save($order);
}


texts: Check database entry is null or not, In Magento

texts:
I need to check if total_invoiced field is has a value in sales_flat_order table in Magento. How can I check It?

My code in grid is,

 protected function _prepareCollection()
    {
        $collection = Mage::getModel('sales/order')->getCollection()->addFilter('total_invoiced','notnull');
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

I need to add orders having in value in total_invoiced field into a collection. How could I? Please share If anyone knows a solution.


texts: Magento 2: How do I enable or disable all modules (or subset) of a vendor in 1 command?

texts:
Seeing we are installing, upgrading, removing a new M2 (2.3.1) install we wouldlike a fast way to enable or disable modules from vendors in 1 go. Either by the Vendor name or for a Subset of modules belonging to the same extension.

When extensions are acquired we see the following. One acquires 1 extension call it Foo_Coolstuff but it can then be packaged either as

Foo_Core
Foo_Coolstuff

Or as

Foo_Core
Foo_Coolsub1
Foo_Coolsub2
Foo_Coolstuff

To us as a user this is 1 extension. I mean this is how it is offered and how it is acquired.

Question: So how can we easily enable or disable for example (only)

all modules from Vendor Foo_*
or all modules from Extension Foo_Cool*


texts:
When i perform a search in the shop. when the search result page turns up it is still in the default magento theme.

I cannot find an option in the cms to set this page to use the theme that i have downloaden.


texts: Magento 2 - Missing js files in a certain store view

texts:
In Magento 2, is there a way to disable a module for a single store view only in front-end, like Magento 1? Because that's what happened to me.

I have this module named Vendor_XXX that loads several js files on checkout page and it's working fine on every store view except 1 certain store view. In that store view, the js files aren't loaded, making XXX not working at all on that store view.

There are several things I checked:

Configuration of XXX on that store view: it's enabled.
app/etc/config.php: Vendor_XXX is enabled.
js files of other modules are loaded just fine for that store view.

Why is my module not working on that store view and how to make it work? Any help is appreciated, Thanks!


texts: How to add custom layout handles programatically for Category View in Magento 2

texts:
So, I want to add a custom layout handle for all category view pages.. the handle that is supposed to be loaded depends on certain category parameters, so the handle needs to be added programmatically with $page->addPageLayoutHandles()
Seems easy..? Apparently not
Magento 2 provides a nice Plugin system that I was naturally going to use, just define a afterExecute() plugin to be run after the original category execute() and push any updates into the Page object from there.
Unfortunately, it does not quite work that way.. reason being that the original execute() method (at the very end) will execute $page->getConfig()->addBodyClass() -- a call to this method will automatically force the layout to be completely loaded and generated, so any subsequent attempts to add new layout handles to Page are completely useless.
I looked around to find any not-so-elegant-ways to achieve the same thing (still using plugins).. did not find any.
I ended up running my own controller for category view, however, I would not prefer to leave it that way.
So my question is.. how can I add new page layout handles (programmatically) for category view? and do it elegantly.


texts: CE 1.9 - Create order in Backend and ask customer to pay for it on frontend

texts:
Is it possible to create an order on behalf of a customer from the backend, save it so that an order number is generated, and then somehow get/guide the customer to pay for it on the frontend?

I imagine something where the order will be created with the Order Status set to Pending Payment, and then the customer will either be asked to log in to access their cart with items pre-populated from where they can then checkout, or they will need to punch in some unique reference (perhaps under the Orders Information form).


texts: Display (random) category products on single product view

texts:
I would like to display (random) products of the same category on a product view page.
Such that when you're at a product page, there are other products of the same category listed below.

I've Googled for 2 days now but can't find any solutions.

I guess we first need to get the current category and use that to get products from the database. However, I have no idea where to start or how to create a custom module/plugin.


texts: How can I change the columns in contact page on Magento 2?

texts:
I would like to set 2 columns right to my contact page using XML on my specific theme.

How can I do that?

Thanks


texts: How to add download sample below export option

texts:
Hi i have custom import pincode option in my module but i want to include a download sample file just below the upload field but am not sure how to achieve this

Importpincode

<?php

namespace vendor\module\Block\Adminhtml\Importpincode\Edit\Tab;

class Importpincode extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface
{
    /**
     * Prepare form
     *
     * @return $this
     */
    protected function _prepareForm()

    {

        $form = $this->_formFactory->create();
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $storemanager = $objectManager->create('Magento\Store\Model\StoreManagerInterface');

        $fieldset = $form->addFieldset(
            'base_fieldset',
            [
                'legend' => __('Import Pincodes'),
                'class'  => 'fieldset-wide'
            ]
        );
        $fieldset->addField(
            'file',
            'file',
            [
                'name'  => 'file',
                'label' => __('Upload File'),
                'title' => __('Upload File'),
                'required' => true,
            ]
        );
        $this->setForm($form);
        return parent::_prepareForm();
    }

    /**
     * Prepare label for tab
     *
     * @return string
     */
    public function getTabLabel()
    {
        return __('Import Pincodes');
    }

    /**
     * Prepare title for tab
     *
     * @return string
     */
    public function getTabTitle()
    {
        return $this->getTabLabel();
    }

    /**
     * Can show tab in tabs
     *
     * @return boolean
     */
    public function canShowTab()
    {
        return true;
    }

    /**
     * Tab is hidden
     *
     * @return boolean
     */
    public function isHidden()
    {
        return false;
    }
}

Form.php

<?php

namespace vendor\module\Block\Adminhtml\Importpincode\Edit;

class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
    /**
     * Prepare form
     *
     * @return $this
     */
    protected function _prepareForm()
    {
        /** @var \Magento\Framework\Data\Form $form */
        $form = $this->_formFactory->create(
            [
                'data' => [
                    'id' => 'edit_form',
                    'action' => $this->getData('action'),
                    'method' => 'post',
                    'enctype' => 'multipart/form-data'
                ]
            ]
        );
        $form->setUseContainer(true);
        $this->setForm($form);
        return parent::_prepareForm();
    }
}

any help on this will be appreciated


texts:
I am using Magento 1.9.2.1 with "porto" theme.

I have created a few CMS info pages for things like "reasons to buy" etc. I have the pages set to 2 column with left sidebar but there is nothing showing in the sidebar.

How can I add blocks like recently viewed / categories etc to the CMS pages using Layout Update XML as it looks a bit empty at the moment!

Just to add I am not a coder, I have extremely limited and basic knowledge so to anyone that does reply please treat it as an "idiots guide" lol


texts: Downloadable products >2GB not displayed in backend - how to increase allowed file size

texts:
We have a store where we sell downloadable products only (video files). Since it's mostly large files we don't use the Magento uploader but put the files on the server via FTP and then edit the database for the correct path. This has worked great so far.

Now we have files that are larger than 2GB, we use the same process, but the files are not recognized by magento meaning the backend doesn't show the files in the download information tab in product backend.
Consequently the product can not be sold and or downloaded by customer.

Files up to 1.999999999999 GB work just fine so I guess it's not related to max_file_uploads in php.ini which is set way lower anyway.

Now in lib/Zend/Validate/FileSize.php I found

 // limited to 2GB files
 $size += @filesize($files);
 $this->_size = $size;
 if (($max !== null) && ($max < $size)) {
     if ($this->useByteString()) {
         $this->_max  = $this->_toByteString($max);
         $this->_size = $this->_toByteString($size);
         $this->_throw($file, self::TOO_BIG);
         $this->_max  = $max;
         $this->_size = $size;
     } else {
         $this->_throw($file, self::TOO_BIG);
     }

But i can't find where to set the 2GB Limit.
How can I increase the allowed file size?


texts:
Magento 2 page gets hanged during adding New Catalog Price Rule Condition

What I am trying to do is:

Open Marketing->Catalog Price Rule->New Catalog Price Rule.

When I add a condition like : "category is ------" and click the product category selector it hangs the page and category selector is never opened.

Console messages:

When the page gets hanged after too much time it shows the below in console:


texts:
I have created a form for my extension using this tutorial.

My problem is that I have no buttons (save, delete, etc) in my actions bar.

I can add Save and Continue Edit, as the tutorial has, and this shows. However, the other default buttons are missing.

Below is my Edit.php:

namespace Wildcard\QuantityGroups\Block\Adminhtml\Quantitygroups;

use Magento\Backend\Block\Widget\Context;
use Magento\Backend\Block\Widget\Form\Container;
use Magento\Framework\Registry;

class Edit extends Container
{

    /** @var  Registry $_coreRegistry */
    protected $_coreRegistry;

    public function __construct(
        Context $context,
        Registry $registry,
        array $data = []
    ) {
        $this->_coreRegistry = $registry;

        parent::__construct($context, $data);
    }

    protected function _construct()
    {

        $this->_objectId   = 'id';
        $this->_blockGroup = 'Wildcard_QuantityGroups';
        $this->_controller = 'adminhtml_quantitygroups';

        $this->buttonList->add(
            'save_and_continue',
            [
                'label'          => __('Save and Continue Edit'),
                'class'          => 'save',
                'data_attribute' => [
                    'mage-init' => [
                        'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
                    ],
                ]
            ],
            10
        );

        if ($this->_coreRegistry->registry('quantityGroups_quantityGroup')->getId()) {
            $this->buttonList->remove('reset');
        }
    }

    public function getHeaderText()
    {
        if ($this->_coreRegistry->registry('quantityGroups_quantityGroup')->getId()) {
            return __("Edit Quantity Group '%1'", $this->escapeHtml($this->_coreRegistry->registry('quantityGroups_quantityGroup')->getTitle()));
        } else {
            return __('New Quantity Group');
        }
    }

    protected function _isAllowedAction($resourceId)
    {
        return $this->_authorization->isAllowed($resourceId);
    }

    protected function _getSaveAndContinueUrl()
    {
        return $this->getUrl('quantitygroups/actions/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '']);
    }

Can someone please let me know what I am missing? I have gone through core extensions and other tutorials to see what I might be missing, but cannot find it!

I am using Magento 2.1.5.

Please let me know if I need to share more code.


texts: translation in file frontend/base/default/template/email/productalert/stock.phtml is not working?

texts:
i am trying to translate

<p>  $this->__('You are receiving this notification because you subscribed to receive alerts when the following products are back in stock:') </p>

in frontend/base/default/template/email/productalert/stock.phtml. but it is not working and still in english in product alert email.

does anyone knows it?


texts: How to get values from custom module to widget

texts:
I have a custom module that generate some custom values like quantity, Order total i need to get those values in custom widget .

Is there any standard way to achieve this?


texts:
I want to show navigation arrows in luma theme like blank theme nav of Magento 2.

Anybody can suggest me how can I do this ?


texts: Check if there are any products in the compare list in Magento 2

texts:
I'm using Magento v 2.2 and I'm trying to check if the customer/visitor (doesn't matter if logged in or not) has any products in their compare list and I'm trying to do this in
{theme_dir}/Magento_Catalog/templates/product/compare/link.phtml.

I tried doing this by calling the Magento\Catalog\Helper\Product\Compare helper's method hasItems(), but I'm having issues (I believe with caching).

<?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
if ($compareHelper->hasItems()) { ?>
    //default Magento code

        <a class="action compare no-display" title="<?php echo __('Compare Products') ?>"
           data-bind="attr: {'href': compareProducts().listUrl}, css: {'no-display': !compareProducts().count}"
        >
            <?php echo __('Compare Products') ?>
            ()

    //end of default Magento code
<?php } ?>

Example situation:
When customer is not logged in and adds a product to compare, the compare html doesn't show in the header.links block.

When the same customer logs in, the compare block shows on the page the customer is redirected to (which is currently the customer account page).

But when the same logged in customer switches to a different page, the compare block doesn't show again.

This seems to be a caching issue, but I'm not sure how to fix it.
Any suggestions?


texts: Why Is This Custom Module Helper Returning the Same Value In A Loop In A Template?

texts:
I have a custom module, called JLS_Composers, which is used to input a "composer." Each product can have one or more Composers associated with it (which is accomplished in the Product edit page). I now have a page which loops through all the products and displays a bit of information from each... which includes the composer(s). The problem is, the helper function in the JLS_Composer module is only returning the data for the first composer, and then repeats that for all subsequent products. I am getting the product collection via:

$products = Mage::getResourceModel('catalog/product_collection');
$products->addAttributeToSelect('*');
$products->addAttributeToFilter('visibility', array('neq' => 1));
$products->addAttributeToFilter('status', 1);
$products->addAttributeToSort('composer', 'ASC');
$products->addAttributeToSort('name', 'ASC');
$products->addAttributeToSort('entity_id', 'ASC');
$products->load();

Then, within a foreach loop of ($products as $product), the helper is:

$composers = Mage::helper('jls_composers/product')->getSelectedComposers($product);

Do Magento helpers persist data somewhere? How is it that I am calling the helper each time, with a new, distinct product, but get the same results? I have never experienced this behavior and am curious to solve the problem. I have tried various methods of getting the information through the $product object but all to no avail. I can supply additional code as necessary.

Has anyone experienced and solved this? Or have I approached the issue in the wrong direction?

The Helper method is:

public function getSelectedComposers(Mage_Catalog_Model_Product $product){
    if (!$product->hasSelectedComposers()) {
        $composers = array();
        foreach ($this->getSelectedComposersCollection($product) as $composer) {
            $composers[] = $composer;
        }
        $product->setSelectedComposers($composers);
    }
    return $product->getData('selected_composers');
}

EDIT: The getSelectedComposersCollection method is as follows:

public function getSelectedComposersCollection(Mage_Catalog_Model_Product $product){
    $collection = Mage::getResourceSingleton('jls_composers/composer_collection')
        ->addProductFilter($product);
    return $collection;
}


texts: How to exclude product images programatically?

texts: I want to mark some of the product images as excluded against some products. I tried this link http://www.magecoders.com/blog/2013/05/programmatically-exclude-product-images-in-magento/ so far. But didn't work.


texts: Working with Suppliers feeds and categories.

texts:
I use 3 different suppliers each having their own category structure, I have feeds set up with them that will be automatically imported into my store but how do i handle my own category structure? i.e. how would magento know where to put the products i'm importing?

I can include a column (categories) in each feed from the suppliers with their own category structure but that's the problem, they're all different and if I used them, categories will be all over the place.


texts: How to update cart THEN proceed to checkout

texts:
End-users are the ultimate test subjects...

I'm noticing a trend with a small percentage of users in my store but still enough to lead to customer service calls when they can't solve the problem on their own. They are not hitting "update quantity" in the shopping cart before proceeding to checkout. The majority of users get it but I'm trying to completely side-step the phone calls by just having it automatically update the quantity THEN proceed to checkout.

The HTML containing the JS that triggers the update:

update

I would like this event to happen when they hit Proceed to Checkout. Processing the onclick event returns Illegal return statement and the href link alone returns Undefined. Ideas?


texts: How can i enable mouse scroll up/down for attribute list

texts: How can i enable mouse rollover on attribute list for up/down list of attributes.


texts: Custom Product Options Not Displaying After Migration From 1.9.X to 2.3.X

texts:
I have migrated data from my old Magento store 1.9.3.6 to the new Magento 2.3.4 . everything is migrated properly instead of custom options of products. my old store have custom options with products but after migration it is not visible in magento 2. screen from magento 1 version

Screen from magento 2 Version

Meanwhile if i am adding this from admin panel then it's visible properly.

Can someone help me about fixing this issue.
Thanks


texts: Automate appending additional database connection to env.php

texts:
I have a customized env.php that has an additional customized database connection appended to it. This file is edited manually and is not in a source code repo because a new installation of Magento will overwrite it.

My objective is to ensure the customized env.php file is in place after every deployment regardless if it's a new Magento install or update.

What is the most secure and efficient approach to appending this extra db connection to env.php during every run of the deployment script (this script is in source code repo)?

I want to be careful not to interfere with the way Magento handles the env.php so the correct Magento commands and timing of the data being appended is key.

Thank you


texts: Magento 2 checkout page how to get country_id from selected shipping addresses?

texts:
How to get country id/country name from selected shipping address in the checkout page.

lets assume if the customer has multiple shipping addresses,
based on the shipping address choose, if country name is not United States we want to display some Text message on the top. (International Custom Duties........)

for this i have followed @Sarfaraz bheda answer for creating hook.js

Magento2 - How to trigger onchange event on Country/region in Shipping Address

thanks


texts: magento 2 frontend error after installing an extension

texts: Hello when i add an extension to magento 2 my frontpage disappears but at the backend everthing is fine and that extension is working. So plz let me know how to solve this issue. Thanks]1


texts:
When creating customers magento 2 and then adding addresses the address shows up like this:

Anyone knows why the addresses are not showing up correctly?
This also occurs on checkout.


texts: Apply coupon code only for specific category

texts:
I am working on magento 1.9.1.

I am offering 50 % off if customer add product to cart from particular category (Say Category A).

In the cart page, the customer have added other category products too.

Ex:

Product 1 - Category A, Product 2 - Category C, Product 3 - Category B

When we apply coupon code, its applying for all products in cart.

But, the coupon must not apply if Other category products are added (Say Category B & C).


texts: Is there a good program to run against the magento EE DB to analyze corruptions?

texts:
If core resource and other tables are corrupted.

Common errors would be certain core functions trying to re-instantiate tables or views. I notice i get lots of errors for weird install files from time to time.

Just curious if there is something out there or the best thing available is the database repair tool?

http://docs.magento.com/m1/ce/user_guide/magento/database-repair-tool.html

Additionally, does the DB repair tool generate a report after it fixes and repairs your DB?

Basically, I'm just looking for a tool that will run against my DB and generate a health report.

Cheers!


texts: Magento Catalog price rules not applying to product

texts:
We have created server Catalog Price Rules in our Magento 1 website, all rules working properly after clicking on "Apply Rules" button but next day all rules stop working automatically and not work until click on "Apply Rules" button again.

Every day we have to click on "Apply Rules" button to work all RUles. If not clicking every day then price resets to original price and Catalog price rules stop working.

Any help or suggestion will be appreciated. Thank you.