texts: How can I remotely debug Magento 2 using xdebug when I do not have the "generated" files locally?

texts:
I'm already familiar with xdebug, and debugging Magento 1 using it. Now that I'm working with Magento 2, I'm finding that my debugging sessions are failing with error messages like:

Cannot find a local copy of the file on server /my-magento-2-docroot/generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php

This is to-be-expected, since the code is on an actual server, running in "production" mode, with all dependencies compiled.

In Magento 1, the workaround for this was to simply not use code compilation, but I'm not sure if this is an option in Magento 2. Even when Magento 2 is in "developer" mode, it's trying to load files from the /generated directory.

How can I debug a Magento 2 store without copying all of the generated code files down to my machine?


texts:
I want to upgrade to Magento 2.1.9.
Entered command:

composer require magento/product-commu**m**ity-edition 2.1.9 --no-update

After command "composer update" I've got error message:

Problem 1
    - The requested package magento/product-commumity-edition could not be found in any version, there may be a typo in the package name.

Found the typo and changed the command to "..community-edition.."
But still get the same error message (showing "commumity"). There is no typo anymore. Checked it several times.

What is wrong?

Thanks!


texts:
My Magento version: 1.9
I already created a payment module, and it can post data to 3rd party
system. Now I want to display a select option (Yes and No) when click my
payment. Then I add this form:

<?php $_code=$this->getMethodCode() ?>
<ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">

    <label for="<?php echo $_code ?>_period" class="required">*<?php echo $this->__('Installment plan') ?>

        <select id="<?php echo $_code ?>_period" name="<?php echo $_code ?>_period" title="<?php echo $this->__('Installment plan') ?>" class="required-entry">
            <option value="0" selected="selected"><?php echo $this->__('No') ?></option>
            <option value="1"><?php echo $this->__('Yes') ?></option>
        </select>

After implementing this form, it will display on frontend.
And then I want to get the period value when I click place order.
So I add this code  on my class extend Mage_Checkout_Block_Onepage_Abstract

$payment = $this->getRequest()->getPost(payment);

But the $payment is empty. Do I miss something ?
Thanks for your help.


texts: Reload Magento frontend notification messages

texts:
I'm adding items to basket in Magento through my external JavaScript widget.  I'm also updating Minicart by calling reloadMiniCart() function in my widget:

    <script>
    function reloadMiniCart() {
    require([
    'jquery', 'Magento_Customer/js/customer-data'], function($, cd) {
        cd.reload(['cart'], true);
    });

    }
    </script>

It works and Minicart is updating but I'm facing an issue that message You added XXX to your shopping cart. is showing AFTER I refresh a page. How should I refresh notification messages? Adding cd.reload('messages'); seems to not work


texts: Ajax call on controller and get collection in grid

texts:
I am creating a functionality on my custom phtml.

I want simple ajax call on my controller and get product grid in response.

to ajax call I used this:

require(['jquery'], function($){
    $.ajax({
        url: "/mymodule",
        success: function(result){
            $("#div1").html(result);
        }
    });
});

How can i get product collection and assign it to Magento_Catalog::product/list.phtml file and in return send products collection in grid.


texts: What is the fastest way to check if a configurable product is salable?

texts:
A product is salable or not is determined based on below logic:

Product should be enabled.
Product should be marked in-stock.
qty -(minus) sum of reserved quantity in inventory_reservation table should be greater than 0. This is a important check. A product might have main quantity (qty), still it might not be salable.

Requirement: I have an array of configurable product skus and want to check if they are salable. To check a config is salable, assigned simple product should also be checked if they are salable.

<?php

namespace Algolia\CustomAlgolia\Observer;

use Magento\ConfigurableProduct\Api\LinkManagementInterface;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;

class ExcludeNotSalableProducts implements ObserverInterface
{
    /**
     * @var IsProductSalableInterface
     */
    private $isProductSalable;
    /**
     * @var LinkManagementInterface
     */
    private $linkManagement;
    /**
     * @var ProductRepositoryInterface
     */
    private $productRepository;

    /**
     * ExcludeNotSalableProducts constructor.
     * @param IsProductSalableInterface $isProductSalable
     * @param LinkManagementInterface $linkManagement
     * @param ProductRepositoryInterface $productRepository
     */
    public function __construct(
        LinkManagementInterface $linkManagement,
        ProductRepositoryInterface  $productRepository
    )
    {
        $this->linkManagement = $linkManagement;
        $this->productRepository = $productRepository;
    }

    /**
     * @inheritDoc
     */
    public function execute(Observer $observer)
    {
        $startTime = microtime(true);

        $configSkus = ['1001', '1002']; // sku of config products
        $parentSkusToExclude = [];
        foreach ($configSkus as $configSku) {
           echo $configSku  . PHP_EOL;
            $excludeParent = true;
            try {
                $childProducts =  $this->linkManagement->getChildren($configSku);
                foreach ($childProducts as $product) {
                    $isSalable = $this->productRepository->get($product->getSku())->isSalable();
                    if ($isSalable) {
                        $excludeParent = false;
                        break;
                    }
                }
            } catch (\Exception $exception) {
            }
            if ($excludeParent) {
                $parentSkusToExclude[] = $configSku;
            }
        }
        var_dump("done");
        var_dump($parentSkusToExclude);
        $endTime = microtime(true);
        echo 'took ' . ($endTime - $startTime) . ' seconds';
        exit;
    }
}

Above code takes around 50 second for 100 config products in my local system.

Question: What is the fastest way to determine if a config sku is salable?


texts: How to remove associated products from configurable product?

texts:
I want to remove all associated product from configurable product .

How can i do this

I m trying to do like this

$product = Mage::getModel('catalog/product')->load(11);
$product->getTypeInstance()->setUsedProductAttributeIds();
$product->save();

but its not working


texts: There has been an error processing your request

texts:
when i click the remove item in mini cart of my magento site  it shows the following error.

Invalid form key

Help me to find  solution.


texts: Using events vs overriding? Why events are better?

texts:
I was just reading article on "Understand Overriding in Magento: Models".

And one of the comments was that:

  Overriding Magento blocks, models, helpers and controllers is little
  dirty. My suggestion it to use events.

The author of the article agreed to it:

  I agree with you completely. Yes, as you've mentioned the first choice
  should be the events and if it's not possible through events, you
  should go for overriding. In fact, I had this specific use case
  (something which can't be done with event) in mind while I wrote this.

But there were no explanation. Please explain why events are better than overriding.

And if possible provide easy example which can be done either using events or overriding (with code snippets), where events will be preferred solution.


texts: Magento 2 call setTemplate return null data

texts:
I am calling below code in my addtocart.phtml to get cart item data

<?php echo $this->getLayout()->createBlock("Magento\Checkout\Block\Cart\Item\Renderer")->setTemplate("Magento_Checkout::cart/item/default_custom.phtml")->toHtml(); ?>

but it returns null array.Please let me know why this code is not working.


texts:
In my magento, I have added a product to cart - so I see the following on the checkout page:

I have a custom module with a TestController with a IndexAction where I want to retrieve the current contents of basket for custom processing. This will be used to provide a "get delivery cost estimate" type functionality.

I.e. customer will add bunch of items into basket (as guest), click a button on front end and it takes them to our module where they will enter the destination country and postcode and we will do some custom processing to let the customer know what the estimated delivery cost is going to be.

I tried to retrieve the basket contents like this:

$cart_contents = Mage::helper('checkout')->getQuote();
foreach ($cart_contents->getItemsCollection() as $item) {
   var_dump($item->getName());
}
exit;

This does not return anything.

I also tried a different approach:

$quote = Mage::getSingleton('checkout/session')->getQuote();
$cartItems = $quote->getAllVisibleItems();
echo "<pre>";
foreach ($cartItems as $item) {
    print_r($item->getData());
}
exit;

This is also returning nothing.

Bear in mind; this is a guest checkout (i.e. customer is not logged in).

To test there is a valid quote; I did the following:

echo "<pre>";
print_r(Mage::helper('checkout')->getQuote()->getData());
echo "<hr>";
print_r(Mage::getSingleton('checkout/session')->getQuote()->getData());
exit;

This is what I get back:

Array
(
    [store_id] => 5
    [is_checkout_cart] => 1
    [remote_ip] => 90.xxx.xxx.xxx
    [x_forwarded_for] => 90.xxx.xxx.xxx
)
Array
(
    [store_id] => 5
    [is_checkout_cart] => 1
    [remote_ip] => 90.xxx.xxx.xxx
    [x_forwarded_for] => 90.xxx.xxx.xxx
)


texts: Magento Double underscore translate function

texts: How can I check if $this->__("something") returned a translated version or not?


texts:
I have set tax for a magento site and it is working fine. Now I want to set the same tax calculation for the previous orders. I have decided to change the values manually in database. Is there any other way to set tax for previous orders?
Please help.


texts: Customer Load() returning code:0 for valid user

texts:
I was trying to load customer based on entity id for an api and tried to print it in postman. The user entity id is valid but it is throwing some exception during loading.

Can anyone help me identify why this is happening? Any help would me appreciated.

I am attaching the screenshot of the code snippet and postman response below.

PS: tried echoing $customerData->getId(), it is valid.


texts: How to escape output in templates in 2.2 - XSS security

texts:
I've noticed that the way we escape data in templates is changing as part of 2.2

Escape functions for templates
For the following output cases, use the specified function to generate XSS-safe output.
The upcoming release of Magento 2.2 will deprecate these functions.
Please check back on this page after the 2.2 release for updated documentation on new escape functions.

But I can't find any info on how this will work in 2.2.
My question is, how will escaping output in templates work in 2.2? Or how does it currently work in 2.2 if you're reading this after 2.2 has been released.
Link to XSS on the dev docs


texts: Magento 2 - validate shipping address before moving to payment page?

texts:
I am trying to do a custom check for the pin code associated with the selected shipping address in the checkout shipping step.

When a person clicks 'Next' I want to do a custom check whether the delivery for that pin code is available or not.

Currently I have tried every possible way of using JavaScript or jQuery click events to trigger on the next button click, but nothing worked.

As far as I noticed, Magento does an internal REST API call to the shipping information endpoint and after that it goes to the payment and billing section.

Can anyone help?


texts: NOINDEX,NOFOLLOW for specific template (phtml) file?

texts:
I am using a custom template file to display a form. This has content="INDEX,FOLLOW" set as this is the Magento standard. Is there a way to reset that to NOINDEX,NOFOLLOW for that single phtml file?

Magento 1.9.x

Thanks for helping


texts: Remove parent categories from subcategory in URLs in 1.9.2.3

texts:
Magento version is 1.9.2.3.

I have tried following solution which doesn't work for me.

Step 1: Go to app/code/core/Mage/Catalog/Model/Url.php copy this file to app/code/local/Mage/Catalog/Model/Url.php because it is core Magento file so that we have to copy that file into the app/code/local.

Step 2: Now search for the getCategoryRequestPath($category, $parentPath) around line 698 in Magento ver. 1.9.1.0

Step 3: Search if (null === $parentPath) around line 717 and comment the line as below:

/* if (null === $parentPath) {
$parentPath = $this->getResource()->getCategoryParentPath($category);
}
elseif ($parentPath == '/'){*/
$parentPath = ''; //DO NOT Comment this line
//}

Step 4: Now Go to the Magento admin and Clear Cache System->Cache Management and Reindex System->Index Management the data.

Step 5: Refresh your browser cache and navigate again now you will see only the Sub Category in Url not the Parent Category just like as: http://www.abcxyz.com/test-category-level-1-3.html
See more.

I have also tried this solution which doesn't work for me.

Suppose you want to remove parent category path from url such as
Url-> www.domain.com/cat1/cat2 to www.domain.com/cat2

USAGE :

Go to the Magento Admin Panel -> System -> Configuration -> Catalog -> Seo Options
Select yes or no from "Use Parent Category Path for Category URLs"
Refresh category url index.

Option YES => www.domain.com/cat1/cat2

Option NO => www.domain.com/cat2

Help me if you have another solution


texts:
I am using MAGMI and it's plugin Product Deleter to clean up my Magento catalog.
The products are correctly removed, but I just noticed that their image files are still there.

Does anyone know if it is possible to delete the product images with MAGMI?
Is there any other batch tool to do that?


texts:
I've set up a multicurrency shop with Magento (version 1.7.0.2) where all prices are set in euros. But people from the US should be able to pay in dollars.

The prices are simply converted from euros to dollars with the currency exchange rate.

The problem is that for products sold in the USA a 0.5% import duty tax must be added to the price. For some products this is different (Cacao is 9%).

I have already added an extension which allows me to add a factor to the currency rate, which I use to add 3% to the rate because of exchange costs when being paid in dollars.

How could I add this import duty fee? Adding them as a regular tax might confuse consumers. Also I need to apply the state and county taxes to the value of the price with the import duty tax included, not excluded. So a normal tax rule does not suffice.

I'd like to have like a fixed product tax, but instead of a fixed number, a percentage, that would be great.

Is such a thing possible? How do other Magento stores usually handle import duties?

Thanks in advance


texts: Magento2 - Category Filter not working with Amasty Layered Navigation after Magento2 Migration (2.2)

texts: Category Filter not working with Amasty Layered Navigation after Magento2 Migration (2.2). Others attributes filter working fine except category.


texts: Undefined index: catalog.topnav on local installation

texts:
I downloaded the code from the server, and once it's setup locally, I can access the admin area just fine, but when I go to the frontend I get this error:

Notice: Undefined index: catalog.topnav  in \path-to-folder\app\code\core\Mage\Core\Model\Layout.php on line 460

#0 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(460): mageCoreErrorHandler(8, 'Undefined index...', 'E:\\Code\\work\\pe...', 460, Array)
#1 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(472): Mage_Core_Model_Layout->createBlock('page/html_topme...', 'catalog.topnav')
#2 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(239): Mage_Core_Model_Layout->addBlock('page/html_topme...', 'catalog.topnav')
#3 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 \path-to-folder\app\code\core\Mage\Core\Model\Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#7 \path-to-folder\app\code\core\Mage\Core\Controller\Varien\Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#8 \path-to-folder\app\code\core\Mage\Cms\Helper\Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#9 \path-to-folder\app\code\core\Mage\Cms\Helper\Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#10 \path-to-folder\app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#11 \path-to-folder\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Cms_IndexController->indexAction()
#12 \path-to-folder\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#13 \path-to-folder\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 \path-to-folder\app\code\core\Mage\Core\Model\App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#15 \path-to-folder\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#16 \path-to-folder\index.php(84): Mage::run('', 'store')
#17 {main}

Does anyone know how to solve this?

Thanks


texts: Will magento remain open source after adobe acquire magento

texts:
I Heard news today that adobe is acquiring Magento. Below is the link from adobe.

Adobe to Acquire Magento Commerce

Now my concern is that magento will remain open source or in future we will see

paid version. I am talking about magento community version.


texts: Changing the Header cart item totals image background css when quantity is added

texts: I have a background image for the cart items totals on the homepage in the header and the quatity is display as a number in the middle of this image. It is an image of a bag in a gold color. I am using css for this background image. I would like it to turn green when the quantity in the cart is 1 or above. What I am wondering is how I can change the background image to another one when an item is added to the cart?


texts: Mage::getSingleton() causes fatal error / blank page

texts:
In my controller, I call

Mage::getSingleton('adornis_tps/piCertifiedImport')->download();

which works on my mirror installation.

Then I copied the module onto the live system and it caused a fatal error resulting in a blank page as soon as I ask Magento to get that singleton.

Another model that had been included in an earlier version of the module causes no such trouble, fetching the singleton of that model works perfectly fine and has always worked fine.

This would usually make me believe I haven't cleared my cache, but I have. Or I misspelled something, but I don't think I have. Here's my config.

<?xml version="1.0"?>
<config>
    <modules>
        <Adornis_TPS>
            <version>1.1.0</version>
        </Adornis_TPS>
    </modules>
    <global>
        <blocks>...
        </blocks>
        <helpers>...
        </helpers>
        <models>
            <adornis_tps>
                <class>Adornis_TPS_Model</class>
            </adornis_tps>
        </models>
    </global>
    <admin>...
    </admin>
</config>

There's nothing to be found in my log files or the apache log.

EDIT:

This is working:
AvailabilityUpdate.php (class name Adornis_TPS_Model_AvailabilityUpdate) targeted with 'adornis_tps/availabilityUpdate'

This is not working:
PiCertifiedImport.php (class name Adornis_TPS_Model_PiCertifiedImport) targeted with 'adornis_tps/piCertifiedImport'

EDIT:

Availabilityupdate.php and Picertifiedimport.php (leading upper case only) does not change anything, the first one works, the second doesn't... I don't think it's about the file names

EDIT:

I don't think it's about the naming, but I'm clueless as to what else it would be then...

EDIT:

Well... it works now. See my answer.


texts: Assign Attribute to only specific attribute set Magento 2

texts:
Here's my code:

<?php
namespace Demo\Mymodule\Setup;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;

class InstallData implements InstallDataInterface
{
    private $eavSetupFactory;
    private $attributeSetFactory;
    private $attributeSet;
    private $categorySetupFactory;

    public function __construct(EavSetupFactory $eavSetupFactory, AttributeSetFactory $attributeSetFactory, CategorySetupFactory $categorySetupFactory )
        {
            $this->eavSetupFactory = $eavSetupFactory;
            $this->attributeSetFactory = $attributeSetFactory;
            $this->categorySetupFactory = $categorySetupFactory;
        }

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

                // CREATE ATTRIBUTE SET
        $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);

        $attributeSet = $this->attributeSetFactory->create();
        $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
        $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
        $data = [
            'attribute_set_name' => 'NewAttributeSet',
            'entity_type_id' => $entityTypeId,
            'sort_order' => 200,
        ];
        $attributeSet->setData($data);
        $attributeSet->validate();
        $attributeSet->save();
        $attributeSet->initFromSkeleton($attributeSetId);
        $attributeSet->save();

                // CREATE PRODUCT ATTRIBUTE
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

            $eavSetup->addAttribute(
                    \Magento\Catalog\Model\Product::ENTITY,
                'text_new',
                [
                    'type' => 'varchar',
                    'label' => 'New Text',
                    'backend' => '',
                    'input' => 'text',
                    'wysiwyg_enabled'   => false,
                    'source' => '',
                    'required' => false,
                    'sort_order' => 5,
                    'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
                    'used_in_product_listing' => true,
                    'visible_on_front' => true,
                    'attribute_set_id' => 'NewAttributeSet',
            ]
        );

        $setup->endSetup();
    }

} ?>

All working fine but the attribute is assigning to all attribute set and I want on only one attribute set which I have created: NewAttributeSet


texts: magento change session name to PHPSESSID

texts:
We have a legacy application (raw PHP) that is loaded from an Iframe
  in the Magento Frontend View. Now we need to detect from that legacy
  application if the user is logged in or not.

  We had tried to store a value to $_SESSION from the Magento but while
  trying it, we realized that Magento uses different session name.

  Do you have any alternative on how we can detect if the user is logged
  in or not from the legacy application that is loaded in an iframe?


texts: Customer session isLoggedIn() not working properly due to the Magento Cache

texts:
I am checking if customer is logged in or not(also i have to display customer name) but sometimes it's not working and after flushing block_html cache it works.

I have tried all possible solutions:-

Tried following but still getting issue:-

Why Customer Session is not working on full page cache?

https://aureatelabs.com/magento-2/how-to-get-customer-session-data-when-a-cache-is-enabled-in-magento-2/

As i R&D and found throgh AJAX technique it can be resolved but not any idea of the same...here are the references:-

https://belvg.com/blog/customer-data-management-in-magento-2.html

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching/public-content.html#configure-page-variations

So please help me for the same.


texts: programatically cancel the order using order id - Magento 2

texts:
My requirement is programatically change the order status to Canceled by using order id.

How to achieve this?


texts: Move errors to the bottom in checkout Magento 2

texts: I need to move the error messages at magento 2 checkout to the bottom of the page. I noticed that payment errors are within the "payment-method-content" div, but I didn't find a way to move elsewhere. How can I do this?


texts: Running Import profile works through admin panel, but as cron job does not

texts:
I'm using below cron.php to run the import profile for updating the price field only (the csv file containds the sku and price). but it does not make any changes in db (source https://gist.github.com/Willboudle/da081bfd0fc1ccf6dbef )

<?php
 require_once 'app/Mage.php';
umask(0);
 ini_set("memory_limit","1024M");
//$_SERVER['SERVER_PORT']='443';
Mage::app();
$profileId = 7; //put your profile id here

$logFileName= "import.log";
$recordCount = 0;
// This won't work if Logging settings is disabled
// To activate it go to System->Configuration->Developer
Mage::log("Import Started",null,$logFileName);
$profile = Mage::getModel('dataflow/profile');

$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
Mage::getSingleton('admin/session')->setUser($userModel);

if ($profileId) {
    $profile->load($profileId);
    if (!$profile->getId()) {
        Mage::getSingleton('adminhtml/session')->addError('The profile you are trying to save no longer exists');
    }
}

Mage::register('current_convert_profile', $profile);

$profile->run();

$batchModel = Mage::getSingleton('dataflow/batch');
if ($batchModel->getId()) {
    if ($batchModel->getAdapter()) {
        $batchId = $batchModel->getId();
        $batchImportModel = $batchModel->getBatchImportModel();
        $importIds = $batchImportModel->getIdCollection();
        $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
        $adapter = Mage::getModel($batchModel->getAdapter());
        foreach ($importIds as $importId) {
            $recordCount++;
            try{
                $batchImportModel->load($importId);
                if (!$batchImportModel->getId()) {
                    $errors[] = Mage::helper('dataflow')->__('Skip undefined row');
                    continue;
                }

                $importData = $batchImportModel->getBatchData();
                try {
                    $adapter->saveRow($importData);
                } catch (Exception $e) {
                    Mage::log($e->getMessage(),null,$logFileName);
                    continue;
                }

                if ($recordCount%20 == 0) {
                    Mage::log($recordCount . ' - Completed!!',null,$logFileName);
                }
            } catch(Exception $ex) {
                Mage::log('Record# ' . $recordCount . ' - SKU = ' . $importData['sku']. ' - Error - ' . $ex->getMessage(),null,$logFileName);
            }
        }
        foreach ($profile->getExceptions() as $e) {
            Mage::log($e->getMessage(),null,$logFileName);
        }

    }
}

Mage::log("Import Completed",null,$logFileName);

// Catalog Rewrites
try {
    Mage :: getSingleton( 'catalog/url' ) -> refreshRewrites();
}
catch ( Exception $e ) {
    Mage::log($e -> getMessage(),null,$logFileName);
}
// LAYERED NAV
    try {
        $flag = Mage::getModel('catalogindex/catalog_index_flag')->loadSelf();
        if ($flag->getState() == Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING) {
            $kill = Mage::getModel('catalogindex/catalog_index_kill_flag')->loadSelf();
            $kill->setFlagData($flag->getFlagData())->save();
        }

        $flag->setState(Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED)->save();
        Mage::getSingleton('catalogindex/indexer')->plainReindex();
        Mage::log('Layered Navigation Indices were refreshed successfully', null, $logFileName);
    }
    catch (Mage_Core_Exception $e) {
        Mage::log($e -> getMessage(). "\n",null,$logFileName);
    }
    catch (Exception $e) {
        Mage::log('Error while refreshed Layered Navigation Indices. Please try again later', null,$logFileName);
    }
 ?>


texts: How to remove shipping method in checkout page?

texts:
How to remove shipping method from the checkout page?

But, If I am not select shipping method then I am not able to place the order.


texts: Trying to add delay and only on click expansion to menu.js

texts:
Currently when hovering over the topmenu the menu expands instantly, and other topics seem to not give insight that help my case.
I want to either add delay or to expand the menu only on click.
Any changes in menu.js seem to not even respond to changes on the website.

Here's the code of menu.js that should be relevant

define([
    "jquery",
    "matchMedia",
    "jquery/ui",
    "jquery/jquery.mobile.custom",
    "mage/translate"
], function ($, mediaCheck) {
    'use strict';

/**
 * Menu Widget - this widget is a wrapper for the jQuery UI Menu
 */
$.widget('mage.menu', $.ui.menu, {
    options: {
        responsive: false,
        expanded: false,
        delay: 300

    },


texts: Show selected out of stock products in front

texts:
My all out of stock products are not shown at front.

However, I would like to show some selected out of stock products in front.

I have a custom attribute called show_out_of_stock_product and is yes/no type.

I want to show only those out of stock products that are set show_out_of_stock_product to yes.

I have tried to do it through observer using catalog_product_collection_load_before event, but no luck so far.

My approach was:

    $layer = Mage::getSingleton('catalog/layer');
    $category = $layer->getCurrentCategory();

    $products = Mage::getModel('catalog/product')
        ->getCollection()
        ->addCategoryFilter($category)
        ;

    $showOutCollection = $products
        ->addAttributeToFilter('out_stock_show_product', true)
        ;

Is it possible to add this $showOutCollection to the category with all other products.


texts: Magento 2 How to Customize Checkout with adding login and signup page

texts:
I have worked on a Magento 2.2.6 version. I want the Horizontal Checkout please see the following screenshot. I also want the first step login and signup.

Thanks in advance


texts: Load different template for module on homepage

texts:
I can't make my homepage to load a different template for my module.

I created a theme based on Magento/blank and created a module that changes navigation menu to nice looking vertical mega-menu and they all work just fine.

But I want to make my module to look different on the homepage. So I created one more template file: module-homepage.phtml

So now there are two template files in my
app/code/frontend/Vendor/Module/view/frontend/templates folder

module.phtml
module-homepage.phtml

Then I created custom-homepage.xml file and put it here:
app/design/frontend/Vendor/Theme_name/page_layout/
with the following content:

 <?xml version="1.0"?>
        <page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

            <head>
                <!-- Add local resources -->
                <css src="css/whateverstyle.css"/>
            </head>
            <body>
                <referenceBlock name="block.name" template="Vendor_Module::module-homepage.phtml" />
            </body>
        </page>

I applied it and it did not work. Homepage loaded blank. Because it was page_configuration and NOT page_layout XML file.

Then I changed its contents to the following:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="2columns-left"/>
    <referenceContainer name="page.top">

        <referenceBlock name="block.name" template="Vendor_Module::module-homepage.phtml"/>

    </referenceContainer>
</layout>

Still no result. Homepage loads fine now, but with no changes. My module-homepage.phtml is probably being ignored.

system.log gives me these 5 lines:

[2017-06-21 12:40:40] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_4c7461af04bb11fe209659d7147d2c579 and handles default, cms_index_index, cms_page_view, cms_index_index_id_home: Please correct the XML data and try again.  [] []

[2017-06-21 12:40:40] main.INFO: Cyclic dependency in merged layout for handle: 2columns-left [] []

[2017-06-21 12:40:40] main.INFO: Cyclic dependency in merged layout for handle: 2columns-left [] []

[2017-06-21 12:40:40] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_4cdabc34b90cd18ffdcfe81ef0f5a7189 and handles custom-homepage: Please correct the XML data and try again.  [] []

[2017-06-21 12:40:40] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_46f1b068ec7ccf4878f9284dd1137afd1 and handles catalog_product_prices: Please correct the XML data and try again.  [] []


texts: How I can disable cache for one file that include in cms page?

texts:
I have including of phtml file in cms page (home page)
{{block type="catalog/product_new" product_ids="6747,4652,605,571,518,182,4432,4425" template="catalog/product/home_slider.phtml" }}, and I need no-caching this phtml file. How to disable cache for this?

{block type="catalog/product_new" product_ids="6747,4652,605,571,518,182,4432,4425" template="catalog/product/home_slider.phtml" cache_lifetime="null"}}  - not working


texts: How do I perform validation on a product import file before doing the import and get back any errors?

texts:
I would like to locate a tool that validates a product data import file before we actual perform the import.

I would like the tool to validate the file and let me know if the file is ok or if there are issues that need to be resolved. If there are issues, it would be nice to know what those issues are.

Does anything like this exist already?


texts:
We created an email template for (New Shipment)
in this template I use the variables : " Shipment Track Details, Shipment Items Grid, Shipment "  but when I receive the email the content of the variables is empty ,
on the back office side I filled in the information of tracking information.
I need to get the tracking info into the email content how can i do that ?


texts: 2.3.3 Admin Product Grid Filter/Sort by Quantity?

texts:
With the move to 2.3.3 and MSI it seems that in the main admin product grid

we have acquired a "quantity per source" column, non filterable
we have acquired a "salable quantity" column, non filterable non sortable
the "quantity-and-stock-status" field is a boolean
the "quantity" field has disappered

with that, there is no way to sort or filter products by stock quantity levels. It is kind of useful!

I understand that with multiple sources combined in multiple ways in multiple sites it gets complicated but still? Seems rather self defeating if I can't sort or filter by total quantity.

In sub grids like the bundle product picker, the quantity field appears, so why is it not in the main grid? How can we get it back, modifying the "override" by "quantity-and-stock" so both coexist?


texts:
Hi am trying to call a phtml file using controller but the form does not comes within the layout it goes above the page but i want to be within the layout below is my code kindly please take a look
$block = $resultPage->getLayout()
                ->createBlock('Vendor\Module\Block\Rfq')
               ->setTemplate('Vendor_Module::rfq_form.phtml')
               ->toHtml();
             $this->getResponse()->setBody($block);
            $this->_view->renderLayout();
            $this->_view->loadLayout();

update
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Vendor\Module\Block\Rfq" name="rfq_form" template="Vendor_Module::rfq_form.phtml"  />
        </referenceContainer>
    </body>
</page>

it gives blank when i hit controller


texts: Stop composer replacing the .htacces file

texts:
When updating Magento 2 via Composer, the .htaccess file in the Magento root directory gets overwritten with the default repository version. Therefore losing my customisations, which I have to go in and replace each time.

Is there a way that I can have Composer skip this file by editing the composer.json or something like that?


texts:
I want to disable some Cron jobs by group or specific cron tab in my staging environment because of some reason.

Please someone suggest me a solution, how to do that?


texts:
In this function-

 public function getResults()
{
    $results = [];
    foreach ($this->getLoadedProductCollection() as $product) {
        $data['img'] = $this->encodeMediaUrl(
            $this->getImage($product, 'amasty_xsearch_page_list')-
>toHtml()
        );
        $data['url'] = $product->getProductUrl();
        $data['name'] = $this->getName($product);
        $data['description'] = $this->getDescription($product);
        $data['sku'] = $this->getSku($product);
        $data['price'] = $this->getProductPrice($product);
        $data['is_salable'] = $product->isSaleable();
        $data['product_data'] = [
            'entity_id' => (string)$product->getId(),
            'request_path' => (string)$product->getRequestPath()
            ];
        $data['reviews'] = $this->getReviewsSummaryHtml($product,
   ReviewRendererInterface::SHORT_VIEW);
        $results[$product->getId()] = $data;
    }

    $this->setNumResults($this->getLoadedProductCollection()-
>getSize());
    return $results;
        }

I added this line-

$data['sku'] = $this->getSku($product);

I then created this function-

public function getSku(\Magento\Catalog\Model\Product $product)
{
    return $this->getResults()->get($sku);
}

On the page I am trying to display it on I have this code-

 <?= $product['sku'] ?>

The extension pulls the name and description so I tried to just copy what was done for those attributes but it doesn't seem to work.


texts: Magento2.3: How to load custom JS in custom module?

texts:
I have created a custom module and now need to add custom js file into that module. I have read many post about this but not having a clear answer.

Can anyone please help me with this?


texts:
I have created a new block to sit on the product detail page which contains dynamic content (the customer's recently-viewed products) that should not be cached. How can I switch off caching for that particular block?

I've tried the method mentioned in How to disable the cache for the block in Magento 2?, setting _isScopePrivate to false. That doesn't work, the block is still cached.

I have also tried disabling the cache for the whole page, which is not what I want but thought I'd see what happened. The page is still cached.

I have cleared out all folders under var and pub/static as well as running cache:clean. I have checked and the generated XML file definitely has cacheable="false" on the new block. But the page is still cached. This makes me think there is something else I'm missing.


texts: Magento 1.9 - Can't upload product images after patch 11314

texts:
I've this issues after I applied patch 11314 on Magento 1.9.4.2.
I got no errors or warning, just nothing happens but if I click on any other button I have to log in again.


texts: Punch hole in FPC for a static block inside a CMS page, without a custom module

texts:
On the homepage of our site, we have 3 banners which are contained in a static block inside the CMS page of my homepage.

The static block also contains a widget, the widget select random banners every time.

When i turn on FPC the banners are always the same, while i want that content to change.

So now i am wondering how to punch a hole for that section of the page.
It is a seperate phtml file if that makes things easier.

I have been reading about placeholders, which i may be able to implement but the "block" section in these refer to a model/action which i don't have...

If anyone has any ideas or suggestions, i am stuck and have no idea where to move from here.

Some Magento documentation says, i should be able to punch a hole (only) in Category view pages, Product view pages, CMS pages but doesn't explain how...

here's my static block which i want to exclude from FPC:

{{widget type="enterprise_banner/widget_banner" display_mode="fixed" rotate="shuffle" banner_ids="5,6,7" template="banner/widget/block.phtml" unique_id="5dc648821230ac32e92657639db02dbe"}}
Shop Jam &raquo;

{{widget type="enterprise_banner/widget_banner" display_mode="fixed" banner_ids="3" template="banner/widget/block.phtml" unique_id="9e62c67346ce7fc53bac7f15b927f916"}}
Shop &raquo;

{{widget type="enterprise_banner/widget_banner" display_mode="fixed" banner_ids="4" template="banner/widget/block.phtml" unique_id="2aa38aac002658c09283c8ad02626eaf"}}
Shop &raquo;


texts: Magento 2: Programmatically Updating Inventory

texts:
In the following code, I am able to store all the information with the exclusion of the stock data.  Has something changed in Magento 2?

public function __construct(
    ScopeConfigInterface $scopeConfig, CollectionFactory $product,
    Magento\Catalog\Api\ProductRepositoryInterface $productRepository
) {
    $this->scopeConfig = $scopeConfig;
    $this->product = $product;
    $this->productRepository = $productRepository;
}

public function update(\XXXXXX\XXXXXX\Api\Data\InventoryCollectionInterface $data) {
    foreach ($data['list'] as $d) {
        $product = $this->productRepository->getById($d['entity_id']);
        $product->setStatus(($d['quantity'] > 0 ? 1 : 0));
        $product->setUpc($d['upc']);
        $product->setStockData(array(
            'qty' => $d['quantity'],
            'is_in_stock' => ($d['quantity'] > 0 ? 1 : 0)
        ));

        $this->productRepository->save($product);
    }

    return "Done";
}


texts: Magento Fatal error: Uncaught SoapFault exception [HTTP] Internal Server Error

texts:
$options = array(
'stream_context'=>stream_context_create(
    array(
        'ssl' => array(
            'verify_peer'=> false,
            'verify_peer_name'  => false,
        )
    )
),
"trace" => 1,
"exception" => 0
);
$testClient = new SoapClient($apiHost.'/index.php/api/soap/?wsdl');
$session = $testClient->login($apiUser,$apiPass);

After this request I got the following error

Fatal error: Uncaught SoapFault exception: [HTTP] Internal Server Error

from phpinfo on host server I can see

Soap Client   enabled

Soap Server   enabled

Also I've tried with v2_soap, the result was the same.

I've compared Magento Core API configurations with another Magento instance where it works and they are same.

What else I check to fix this?


texts: 2 Seperate Freight Costs for local delivery and rural delivery areas

texts:
Normal delivery cost $4 but couriers deliver to rural areas for $7
need seperate option for customer to click

When customer is asked to input freight method ,at the moment there is 1 option for $4
i need another option for customer if there delivery is a rural delivery address
How can i achieve this?

thanks
malcolm


texts: Product attribute values resetting at midnight everyday

texts:
I've posted something similar before and no one replied with a decent answer, so I'm posting a new thread so it will have some fresh eyes.

I'm having huge problems with Magento 2, every night at midnight, the product attribute values will reset to default.

For example, if I set a product to be the colour 'RED', at midnight it will change to the 'Default' value.

I've been in touch with our developer and our hosting provider, and they are still unable to find the error.

Our developer said that it's due to a plugin that manages our stock levels (BrightPearl), however, the connection works on a SKU basis and does NOT touch product variants.

Our hosting provider has setup a ticket and will be monitoring the changes to the cron_schedule from 11:30pm to 12:30pm to see the changes and to see what is changing. However, they've done this before and they found nothing.

We've been told previously to ensure that we edit our products on 'All store views' to ensure that nothing will be affected, which is still has.

I hope someone has had a similar experience or problem with Magento 2 and has a fix. If you do, please share with me as we are a constantly growing retail business on Magento 1 who plan to launch our Magento 2 website with a fresh design as soon as possible.

Thanks so much in advance.


texts: Magento 2.1.3 : url_rewrite database table is huge

texts:
When trying to install an extension, or performing the average database backup, I've realized i have less then 200 products in my catalog, yet the backup takes FOREVER. In fact, there is a database table 800 megabytes large, while the biggest one after that is only 16 megabytes.

What can i do with this to lighten up my database?
Does this require a fresh new magento installation?

I will also mention that the same database once held 18000+ products.
In there, i currently see

Having nearly 30 links for the one flyer page makes absolutely no sense. Why is magento doing this and how can i fix it?

Is magento creating a store for every store view? because i should have 3 stores (demo 1, demo2 and demo3) with about 8 or 9 languages each... However even with 200 products, the database is still HUGE. There are over 2,200,400 records in the url_rewrite table!


texts:
I want to get all categories in store. so if set any category option not including in navigation menu the category not showing in list tree.

So My question: how i can get all tree categories both including and not including in navigation menu.

I've use below function :

public function getStoreCategories()
{
  $helper = Mage::helper('catalog/category');
  return $helper->getStoreCategories();
}


texts: Shipping address gets blank after , adding new billing address

texts:
Shipping address gets blanked , while adding new billing address
no errors in console , tried to debug and
found that quote.shipping is getting unset in the js file default.js /Magento/luma/en_US/Magento_Checkout/js/view/shipping-address/address-renderer  in initObservable() method , just when adding the new billing address. https://prnt.sc/rtji6n

Any fix ?


texts: How to hide country and state & state from cart page?

texts:
As I am new in Magento and  I stuck with a problem for 4 days. I want to hide the country selection dropdown and state from cart page as My requirements to provide shipping only single country. How can I achieve this?

I already tried this solution but it does not work for me

solutions

Thanks in advanced


texts: How to display multiple, fully detailed orders per page in the My Orders section of customer area?

texts:
I'm currently able to display single, detailed orders in the customer area of Magento's front-end. I log into my test account and I go to My Account > My Orders where I am presented with a summary of my previous test orders. If I click on one of the orders I'm taken to page via one of the following example URLs:

site.com/sales/order/view/order_id/1/
site.com/sales/order/view/order_id/2/

This page displays a shipping info, billing info and a summary products purchased.

My question: Is there a way to use this controller or URL to display every previous order with detailed info? The client would like a detailed summary of all past orders. If not, where would I begin to create this module?


texts: Adding gift message to the packing slip and one-page checkout

texts:
There doesn't seem to be an option to add the gift message to the packing slip and the one-page checkout.
I've found a few guides online but they're all rather old; I was hoping someone might have some more up-to-date advice.

I'm running Magento 1.9 and have currently tried the example outlined here but with no real success.


texts: magento 2 configurable product highest price product default selected

texts:
Now I am using Magento 2.1.5 setup.

I want to make default selected options for a configurable product based on highest price. And I have two configurable options  (like size and color swatches). I am using default swatches for it.


texts: Please advise. How can I export all product images at once Magento 2.2.5?

texts: I am having an product export issue with Magento 2.2.5. How can I download/export all of my product images (all at once)? They all are in different folders on server? Thanks!


texts: Catalog price rule from today does not apply

texts:
I am using Magento 1.9.1.0. I set up a catalog price rule which applies to all my products in my store with a discount of the 20 percent for just one day.
The catalogrule_apply_all action is supposed to be ran every day at 1am in the mornig (0 1 * * *).

I have a problem in setting the date range of the promotion. To test it, in my development environment, I set up the from_date and the end_date with the 'today' value. After applying the rule I can't see the promotion in the frontend. I need to set up the from_date back of one day to see it working.

Now I have to schedule the promotion, which will start in 2 days, for my production environment and I am not sure about which value assign to from_date field. Should I assign the day before it should be active or should i leave the real start date?


texts: How to use fetch_style parameter with custom query in Magento 2

texts:
I am trying to fetch assocaited data columns in Magento 2.

working code as below:

$tablename = $connection->getTableName('dummy_table');
$query = "SELECT title,identifier FROM $tablename ORDER BY title";
$resultLinks = $connection->fetchAll($query);

Now I am trying below but its not working

$tablename = $connection->getTableName('dummy_table');
$query = "SELECT title,identifier FROM $tablename ORDER BY title";
$resultLinks = $connection->query($query)->fetchAll(PDO::FETCH_ASSOC);

How can we use the PDO::FETCH_ASSOC?


texts: Query string to add product and apply promo code

texts:
I currently have set up a query string that automatically adds a set amount of products to the users cart when they click a specific button.  I already have everything set with with the FormKey() and this is working as expected.

Working - domain.com/checkout/cart/add/product/13/qty/6/

I can also in an entirely different URL apply a specific promo code to the shopping cart

Working - domain.com/checkout/cart/couponPost/coupon_code/PROMOCODE/

However, I am unable to do both at the same time.  I would like to build one URL that adds specific products to the users cart and then applies the promotional code.  I would expect this URL to work....

Does not work :(
domain.com/checkout/cart/add/product/13/qty/6/couponPost/coupon_code/PROMOCODE/

But it does not.  Is there any way to accomplish what I am looking for?

Thanks,


texts: Magento 2 in how to add all products website id in main website?

texts:
i will try to database table values in website id in main website but not working.?

how to bulk change the all products website id change?


texts: Is recovering SMTPPro configuration from a Magento installation that lost .modman directory possible?

texts:
Recently it has come to my attention that the .modman/ directory under Magento's primary home had gotten blown away.  I'm not sure when it happened, but the .modman/ directory, in entirety, had disappeared from the Magento top level.  This was discovered while researching issues that seem to have arisen from SMTPPro having disappeared.  Doesn't seem like it's that far of a leap, being as digging through previous versions of the site show that the extension was living there (at least in part-- in the directory: Magento-SMTP-Pro-Email-Extension, under .modman/).

Obviously it came as no surprise that the SMTPPro extension sub-menu under the admin page had disappeared as well.  So my question is, how would one go about 're-registering' this extension (hopefully in a manner where previous configuration and settings would not be overwritten)?  I've tried the most simplistic attempt, namely, replacing the entire .modman/ directory (salvaged from that previous version of the site stored in git) under Magento's home.  This did not work, and showed no promising signs.  IE there were still no admin page sub-menus for SMTPPro.

Does anybody have any advice for recovering this configuration, or any pointers to information that may be useful in this situation?  Anything you might be able to offer would be greatly appreciated, as I'm not really finding anything helpful via google regarding this issue.

Thanks for your time and help on this matter.

-Damon


texts: Editing the user dashboard existing pages without changing the core template file

texts:
How to edit a existing page of user dashboard in magento without changing the core template file. I want to add few more information on "My Account page" which is the home page of the user dashboard, if the user is a business user. I want to add one more block below the user information.

Thanks in advance :)


texts:
I have created a custom Tab on the product details page. Now I want to show the count of those articles, like how Reviews count are shown in tab title.

<arguments>
     <argument translate="true" name="title" xsi:type="string">Frequently Asked Questions</argument>
</arguments>

This is the code used to show the tab. Now how can I show the count.

I have tried to use the Class in my block class like -

use \Magento\Framework\DataObject\IdentityInterface as IdentityInterface;
use \Magento\Framework\View\Element\Template as Template;
class Customtab extends Template implements IdentityInterface

and then -

public function setTabTitle()
    {
        $title = 'Frequently Asked Questions';
        $this->setTitle($title);
    }

But it is giving -

  Fatal error: Class Vendor\Module\Block\Product\View\Details\Customtab
  contains 1 abstract method and must therefore be declared abstract or
  implement the remaining methods


texts:
I have added an extra field to the checkout page, and Now i want this field to be remembered if the customer is logged in.

So next time the customer doesn't have to fill the field again.
Actually the function that remember the address, so the customer doesn't have to fill it every time.

Can anybody help me with a solution to do that?


texts:
I used Increment & Decrement qty in Shopping Cart page

    <button title="Decrease Qty" onclick="changeQty1('<?php echo 'qty_'.$_item->getId() ?>',0); return false;" class="decrease"><?php echo $this->__('decrease') ?></button>

    <input id="<?php echo 'qty_'.$_item->getId() ?>" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />

    <button title="Increase Qty" onclick="changeQty1('<?php echo 'qty_'.$_item->getId() ?>',1); return false;" class="increase"><?php echo $this->__('increase') ?></button>

Script

in here Manual entry is working but  +/- Button Not working i don't know what is the problem?


texts: Admin field type with arbitrary number of subfields

texts:
I'm making some custom module for magento and need backend settings for my custom entity. So far all was ok, I made a section through xml, made general CRUD actions and some settings that are implemented through tabs (like CMS ones). I included there some inputs, image fields and all works good. But now I need some field that will have arbitrary number of sets of fields and these sets should also have a type (like it's done in custom options in product settings). So my entity should have an arbitrary number of sets and each set have some. The type of set of fields describes what fields should be included to form, so the text will produce an input field and image will give file upload to user. After some looking to custom field files I see that it's implemented differently, making own phtmls. I suppose this won't fit as just a fieldset child, because it's even doesn't have setChild method.

Is somewhere in Magento the such field type that will support this kind of stuff, with arbitrary number of fields. Could it cause some problems with saving/loading it?


texts: Integration test in magento 2, error display in cmd

texts:
Fatal error: Class 'Magento\TestFramework\Helper\Bootstrap' not found in /var/www/html/magento2/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php on line 17

above error are display in integration test for module.
How to solve this error?


texts: It is possible that users registering customers to sell

texts: I am creating an online store with Magento, but I wonder if it is possible to create an online store where users who register on the main page can create product catalogs and sell, as well as on ebay.


texts: How to patch Magento bugs which are fixed in later versions

texts:
We are running Magento2.2.6 and we are having a few session issues which are fixed in later version it seems, which we can see it from GitHub. But what is the procedure to get those commits should manually edit those files and apply it our current version? Following is the issue I would like to have in my current version, please suggest

https://github.com/magento/magento2/issues/12362


texts: Onepage Checkout registration redirects to cart; checkout/onepage/saveMethod returns 404

texts:
When a user proceeds to the checkout page and is not logged-in, it is presented with the form to login or create an account. "Allow guest checkout" is set to no. At this point, the user can log in just fine, but when the "register" button is clicked, the account creation form loads for a second but then the page redirects to the cart. No error messages displayed, no empty cart.

I looked at the browser console and found out that the AJAX call to the checkout/onepage/saveMethod action is failing with a "404 (Not Found)". If I the user is logged in though, the same action is available. I have searched a lot about this and everyone keeps saying that it is fixed by setting "Allow Guest Checkout" to yes, but that is not an option in this case. Someone said here that it should be fixed

  by setting “Require Customer To Be Logged In To Checkout” to No

but that also did not work.

Has anyone run into this before?

TL;DR:
Allow Guest Checkout is set to No.
Customer registration page in Chekout loads and then immediately redirects to the cart. Customer can login succesfully or register outside of the chekout and then place an order. Why is the registration form being redirected if it already loaded? Why is the action checkout/onepage/saveMethod returning a 404 in the ajax call?


texts: What is a reasonable amount of time to expect for the proper live deployment of a patch including testing on a dev site assuming there are no conflicts?


texts: How to get order event after placing order using observer in admin side?

texts:
i want to get the order event and want to use the order object data , tried this but something is missing, here is what i tried
and how can i use this data in my helper/block class or controller action?

  etc/adminhtml/events.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">

    <event name="test_order">
        <observer name="afterOrderObserver" instance="Vendor\Module\Observer\Order"/>
    </event>
</config>

  Observer/TestOrder.php

<?php

namespace Vendor\Module\Model\Observer;

use Magento\Framework\Event\ObserverInterface;

class TestOrder implements ObserverInterface
{
    /**
     * Order Model
     *
     * @var \Magento\Sales\Model\Order $order
     */
    protected $order;

     public function __construct(
        \Magento\Sales\Model\Order $order
    )
    {
        $this->order = $order;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
       $orderId = $observer->getEvent()->getOrderIds();
        $order = $this->order->load($orderId);

        //get Order All Item
        $itemCollection = $order->getItemsCollection();
        $customer = $order->getCustomerId(); // using this id you can get customer name

    }
}


texts: How to test correctly an observer in admin area?

texts:
I have to test an observer in adminhtml area on the event sales_order_item_collection_load_before (I declared it on adminhtml/events).

I found two different ways to test it, the first one loading the events of the adminhtml area, using:

Mage::app()->loadAreaPart(
    Mage_Core_Model_App_Area::AREA_ADMINHTML,
    Mage_Core_Model_App_Area::PART_EVENTS
);

The second one using my observer class directly, creating Varien_Event_Observer object  with sales/order_item_collection object.

The problem which I found with the first one is on load of the same collection in another method, because it given me problem on the session:

PHP Fatal error:  Uncaught exception 'Exception' with message 'Warning:
Unknown: Failed to write session data (files). Please verify that the
current setting of session.save_path is correct

With the second one I had all green tests, but I don't know if is correct make it in this way.

I don't know what is the correct way and if I have to call tearDown with the first one to make something (and I don't know what) or I have to test the result without using the real observer as the second one. Could you suggest me the correct way?


texts: Magento Vagrant installation does not generate classes

texts:
I have switched to windows for a new project, and just setup Magento 2 using this vagrant box: https://github.com/paliarush/magento2-vagrant-for-developers

I have it working, it is displaying frontend + backend in developer mode. (although very slow)
Now, when I set it to production mode and do a setup:di:compile, it looks like it does that without any errors, but the var/di and var/generation folders are not generated. When I add them myself and run the dependency injection, they stay empty.

Anyone has a clue what could cause this?


texts: Magento 2: How can I update tax and total programmatically on checkout?

texts:
I have a checkout field for tax exemption that is not related to a customer group. That would be too easy. Instead, I would like to update the tax amount and total to reflect those changes when this field is changed.

I have tried piecing together solutions to similar problems but nothing seems to do the trick.

So far what I have working is an observer on the sales_quote_address_collect_totals_after event that gets the value of my field from the address and updates the tax amount totals. This successfully updates the tax, but does not update the grand total. As far as I can tell I cannot update the grand total in the same way.

I have attempted to call $quote->collectTotals() and save the quote, but without success. It does not update the grand total to the correct amount.

I have attempted to trigger reloading the totals block via javascript, but this was also unsuccessful. If you believe either of these methods should be working I am happy to update with the code I used.

Simply put, I need to update the tax amount, and have that change reflected in the cart total.

Any help would be greatly appreciated!


texts: How to in Store View setting free shipping Amount

texts:
we hope is USA is setting free shipping Amount is $10, AUS amount is $20. it can do that?

Magento 2.2.X
please help


texts: 1st did Dataflow import which does not do custom options; Did a regular import after that few times - now have duplicate custom options

texts:
Magento 1.9.1 --) Magento 1.9.4

It's 2019 so you would think migrating All products from Magento 1.9.1 to Magento 1.9.4 would be smooth sailing right? I would expect to click Export on one system, take the file and Import it into 1.9.4. Instead:

- there were tons of Error messages when trying to do a regular Export/Import so I decided to do the Dataflow Export/Import instead...

That worked except for it did not transfer any custom options (colors, sizes etc.). So I decided to do a regular export and import of just the SKU and the custom options (because it gave Errors about websites, categories - I removed those columns from the CSV file).

Then it seemed all ready to go - after I cleared all the Errors and Magento says the file could be imported - it just showed the circle going around all the time and says Please wait. It never finished. I contacted the hosting company and they said it's not their problem and increasing the time-out will not help etc. and told me to contact a Magento developer. Then I split the file up into many - sometimes it worked and sometimes it did not.

Finally, I managed to get the custom options in but they are all duplicated like 10 times (looks like the number of times I tried the regular import).

What is my best plan going forward? Can I just delete all Products and start the process again and this time be careful only to import the specific part of a file once? Are there any undesired consequences to deleting 1000 products? Would it be better to do a full restore of the Magento 1.9.4? Any better way to do this?


texts:
I am trying to understand functionality of plugin method. for that i have created a custom module and i added below code in di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Adhikari\StudyPlugin\Model\StudyPlugin">
        <plugin name="studyPluginBefore" type="Adhikari\StudyPlugin\Plugin\Model\StudyPlugin" sortOrder="1" disabled="false"/>
    </type>
</config>

and model class code is

namespace Adhikari\StudyPlugin\Model;
class StudyPlugin extends \Magento\Framework\Model\AbstractModel
{
    public function getName($name){
            return $name;
    }
}

after that my plugin method code is

namespace Adhikari\StudyPlugin\Plugin\Model;
class StudyPlugin
{

    public function beforeGetName(\Adhikari\StudyPlugin\Model\StudyPlugin $subject, $name){
        die('hello');
        return ['(' . 'My name is '.$name . ')'];
    }

}

and at last i have created a block class and below is the code of that block class.

namespace Adhikari\StudyPlugin\Block\StudyPlugin;
use Magento\Framework\View\Element\Template;
class PluginBlock extends Template
{

    public function __construct(
        Template\Context $context,
        \Adhikari\StudyPlugin\Model\StudyPlugin $studyPlugin,
        array $data = []
    ) {
        parent::__construct($context, $data);
        $this->_studyPlugin = $studyPlugin;

    }

    public function getName($name){
        return $this->_studyPlugin->getName($name);
    }
}

but when i include that block in homepage and call block function getName('hello'); it doesn't code in before plugin method. but i calls model class method getName($name) and return value.

can someone please help me to understand the workflow of this or if i am doing some mistake..


texts: Simple product of configurabile discount issue

texts:
I have the following  situation:

i have  configurable product X which has the price let's say 50$.

Now for this product X there are 3 simple products associated on the Size attribute, let's say A,B,C product

Product A - has +1$ more then product X => total price - 51$

Product B- ...2$ more ..=> 52$

Now the problem:

If i set a discount the configurable product has the discounted price ok.

But for the simple products the discount it calculated like this:
The acctual price for the product  A = product X discounted(50%) + 1$

What I wish for the product A price is  to be like this: 51$ discounted price, not 50$(configurabile product discounted) and then add 1$ after this price.

Does anyone know  how can i solve this problem?


texts: Trying to upgrade extension with MySQL queries update

texts:
Here is my: mysql4-install-1.1.php:

<?php
$installer = $this;
$installer->startSetup();

$installer->addAttribute("order", "my_custom_input_field_one", array("type"=>"text"));
$installer->addAttribute("quote", "my_custom_input_field_one", array("type"=>"text"));
$installer->endSetup();

And then i've created an upgrade file: mysql4-upgrade-1.1-1.2.php :

<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute("order", "my_custom_input_field_two", array("type"=>"text"));
$installer->addAttribute("quote", "my_custom_input_field_two", array("type"=>"text"));
$installer->endSetup();

When the extension was created the my_custom_input_field_one was created. Then i have the need to created second column called my_custom_input_field_two so i've created an upgrade file.

After i created the upgrade file i changed my config.xml from:

    <modules>
        <VivasIndustries_Vshippingone>
            <version>1.1</version>
        </VivasIndustries_Vshippingone>
    </modules>

to:

    <modules>
        <VivasIndustries_Vshippingone>
            <version>1.2</version>
        </VivasIndustries_Vshippingone>
    </modules>

After that i've flushed the cache but the second column was not created.
Where is my mistake and how can i create this second column with the upgrade file?

Thanks in advance!


texts: Line break for invoice comment in magento

texts:
In magento while sending an invoice the commend is showing up in the same line. The line break is not working.

Please anyone help me to add line break in invoice comments.


texts:
I need to get all of the IDs with the category-name in my website like:

  Shoes - ID:448

  Hats - ID:233

Is it in the database? Sql queries that I can use?


texts: ReIndex after updating the Product name via API's in Magento 2?

texts:
Am re-indexing the Product programmatically every time its name is updated via API. But still, it shows old data. The code which I use to reindex a product,

$indexers = array('catalog_product_category');
$indexer = $this->indexerFactory->create();
foreach($indexers as $indexerId){
    $indexer->load($indexerId)
     ->reindexRow($productid);
}

Also, In Backend, I configured "Update on Save" in Index Management.
Is there any other way to do this?


texts: Best way to load my module phtml only if system config is enabled

texts:
I am trying to override /module-sales/view/frontend/templates/order/view.phtml by di.xml

<preference for="Magento\Sales\Block\Order\View" type="Myvendor\Mymodule\Block\Order\View"/>

The Block i added is

namespace Myvendor\Mymodule\Block\Order;

use Magento\Customer\Model\Context;

class View extends \Magento\Sales\Block\Order\View
{
    /**
     * Core registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry = null;

    /**
     * @var \Magento\Customer\Model\Session
     */
    protected $_customerSession;

    /**
     * @var \Magento\Payment\Helper\Data
     */
    protected $_paymentHelper;

    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Framework\App\Http\Context $httpContext
     * @param \Magento\Payment\Helper\Data $paymentHelper
     * @param array $data
     */

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\App\Http\Context $httpContext,
        \Magento\Payment\Helper\Data $paymentHelper,
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        array $data = []
    ) {
        $this->_paymentHelper = $paymentHelper;
        $this->_coreRegistry = $registry;
        $this->httpContext = $httpContext;
        $this->scopeConfig = $scopeConfig;
    parent::__construct($context,$registry,$httpContext, $paymentHelper, $data);
        $this->_isScopePrivate = true;
    }

    public function getTemplate()
    {
            $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
            $customOrderViewConfig = $this->scopeConfig->getValue('customorderview/enabled/fieldid', $storeScope);
            if ($customOrderViewConfig) {
                return 'corder/view.phtml';
            }
            return parent::getTemplate();
    }

    public function setTemplate($template)
    {
            $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
            $customOrderViewConfig = $this->scopeConfig->getValue('customorderview/enabled/fieldid', $storeScope);
            if ($customOrderViewConfig == 1) {
            $_template = 'corder/view.phtml';
            }
        else
        {
                $template = 'Magento_Sales::order/view.phtml';
        }
        return parent::setTemplate($_template);
    }
}

This is working fine , but i want to load my Phtml file when my module is enabled.

I tried

If condition in phtml file looks bad.
No way to add ifConfig in layout ( There is no layout in my module ).
beforeToHtml function in block ( Not working ).
setTemplate function in block ( Not working ).

Any Help would be appreciated.


texts:
Upgraded to 1.9.0.1

When we now attempt to manage customers we can search a customer record but when we choose any record to look at it or edit it we get:

  Fatal error: Call to undefined method Mage_Customer_Helper_Data::getIsRequireAdminUserToChangeUserPassword() in /home1/{oursite}/public_html/[oursite].com/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Account.php on line 205

I cannot tell what it's actually asking me to do here. Help?!


texts:
In checkout page loader stuck and spinning forever. There are no js errors in console. HTML of spinner looks like this

        <img src="<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
             alt="<?php /* @escapeNotVerified */ echo __('Loading...'); ?>"
             style="position: absolute;">

File checkout-loader.js looks like this

define([
'rjsResolver'
], function (resolver) {
'use strict';

/**
 * Removes provided loader element from DOM.
 *
 * @param {HTMLElement} $loader - Loader DOM element.
 */
function hideLoader($loader) {
    $loader.parentNode.removeChild($loader);
}

/**
 * Initializes assets loading process listener.
 *
 * @param {Object} config - Optional configuration
 * @param {HTMLElement} $loader - Loader DOM element.
 */
function init(config, $loader) {
    resolver(hideLoader.bind(null, $loader));
}

return init;
});

I tried console.log on init() function and it works, but not in hideLoader() function - so it is not called.

Also site using IWD_Opc extension.

Can you please give a hint where to look up the error

UPDATE

Here is some dirty fix that works for me.
I added line

resolver($loader.parentNode.removeChild($loader));

to init() function in checkout-loader.js

and line

$(document).find(blockLoaderClass).remove();

to removeBlockLoader() function in block-loader.js


texts: I just implemented Bootstrap 4 in my magento 2.2.5 website. Require.js 166 Error

texts:
In my environment implemented Bootstrap 4 in Magento 2.2.5 at first glance it seemed to work. all of my js and css worked perfectly without any error's. But after sometime, I got error: Uncaught Error: Mismatched anonymous define() module: function (exports, $) { 'use strict'; Line 141 Require.js. I followed the instructions given by Manoj Deswal and Vivek
Magento 2 : Add Bootstrap 4 in theme

It seems that the css as in grid system and so on still works, its just that the js/jquery is giving me troubles.

It worked as I said be for, but what ever I try, the error does not disappear.

Does anyone has a suggestion?

Full error Message : https://pastebin.com/103izvSJ
Disclaimer, it is one heck of a error!

I have found out it is just the bootstrap.bundle.js is giving me this error. the file as a hole is giving me: ' Mismatched anonymous define() module: function (exports, $) { 'use strict';' i have linked it in my Default_head_block.xml, and i have linked it in the Requiredjs-config.js file as followed, (correct me if im wrong):
paths: {
        'jquery/ui': 'jquery/jquery-ui',
        'bootstrap':'Magento_Theme/js/bootstrap.bundle'
    },
    shim: {
        'bootstrap': {
            'deps': ['jquery']
        }
    },

and i added
<script type="text/javascript">
        require(['bootstrap']);
        </script>

In the header.phtml file as instructed. but it just won't stop giving me an error.

i even try'ed to link it by external source, but it gives me the same error as befor, or something like net::ERR 404, Not found.


texts: Newsletter subscription problem during registration in magento2

texts:
I am getting both subscribe and unsubscribe email once i register the customer with selecting subscribe for newsletter with ticking the checkbox.

I am getting both emails one is subscription and unsubscription email.

Why it is like that, is it magento2 bug, Please anyone help me out with this issue.


texts: Magento 2 : Replace final_price.phtml on certain categories

texts:
I'm using 2.2.4 and need to be able to load a different final_price.phtml dependant on which category we are in (and I need to do it as a layout update in admin for the category as I need someone non techy to be able to copy the code into a new category).

I have created the new final_price.phtml in /app/design/frontend/Infortis/base/Magento_Catalog/templates/product/price/ and renamed it final_price_sl.phtml

Is there a way to add code to the layout update so on specific categories it loads final_price_sl.phtml instead of final_price.phtml?


texts: How to build a "price-range" display for simple products

texts:
As far as I can see, there is no way for us to display a price range instead of a static product price for simple products. Ideally we want something like '$1000 - $1250' on the product page and category pages.

I could not find any extensions that will do this, and Magento does not have the out-of-the-box capability.

This may be unsolvable or require more work than we thought, because we will also need the ability to input these prices in the Admin panel somehow.


texts: Magento 2: How to add custom Block/Widget/Page on Checkout?

texts:
Would like to add CMS Page/Block/Widget on Checkout Page before Shipping Method section.

How to achieve this?

Need to overwrite magento\app\code\Custom\Module\view\frontend\layout\checkout_index_index.xml

Prefer Block When it's enabled from Admin it will display otherwise not.


texts:
app/etc/env.php has the following for cache settings:

'cache' => [
    'frontend' => [
        'default' => [
            'backend' => 'Cm_Cache_Backend_Redis',
            'backend_options' => [
                'server' => '/var/run/redis/redis.sock',
                'port' => '0',
                'persistent' => '0',
                'database' => '0',
                'force_standalone' => '0',
                'connect_retries' => '1',
                'read_timeout' => '10',
                'automatic_cleaning_factor' => '0',
                'compress_data' => '1',
                'compress_tags' => '1',
                'compress_threshold' => '20480',
                'compression_lib' => 'gzip'
            ]
        ],
        'page_cache' => [
            'backend' => 'Cm_Cache_Backend_Redis',
            'backend_options' => [
                'server' => '/var/run/redis/redis.sock',
                'port' => '0',
                'persistent' => '0',
                'database' => '1',
                'force_standalone' => '0',
                'connect_retries' => '1',
                'read_timeout' => '10',
                'automatic_cleaning_factor' => '0',
                'compress_data' => '0',
                'compress_tags' => '1',
                'compress_threshold' => '20480',
                'compression_lib' => 'gzip'
            ]
        ]
    ]
],

I'm wondering if these should be removed or atleast the page_cache when enabling varnish?


texts:
I am facing that is slider images on my site does not appear on the first attempt and I get the following error but when I refresh page sliders appears

Uncaught TypeError: $(...).swMegamenu is not a function
Uncaught TypeError: $(...).owlCarousel is not a function
collapsible.js:20 Uncaught TypeError: $.widget is not a function

Can anyone please help me with this


texts:
I am using Porto theme, In Porto the navbar is after the header block. Now, I want the navbar after the logo. How can I do that,
here is the default.xml

    <referenceContainer name="head.additional">
        <block class="Smartwave\Porto\Block\Template" name="porto_custom_head" template="html/head.phtml" before="-"/>
    </referenceContainer>

    <referenceContainer name="page.wrapper">
        <block class="Smartwave\Porto\Block\Template" name="porto_header" template="html/header.phtml" before="main.content">
            <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
                <arguments>
                    <argument name="css_class" xsi:type="string">header links</argument>
                </arguments>
            </block>
            <block class="Smartwave\Porto\Block\Form\Login" name="header_customer_form_login" ifconfig="porto_settings/header/login_popup" template="Smartwave_Porto::html/login.phtml"/>
            <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/>
            <block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch" template="Magento_Search::form.mini.phtml" />
            <block class="Smartwave\Porto\Block\Template" name="custom_block" template="html/header_custom_block.phtml" ifconfig="porto_settings/header/static_block" after="-"/>
        </block>
    </referenceContainer>
    <move element="navigation.sections" destination="porto_header"/>
    <move element="top.search" destination="porto_header"/>
    <move element="minicart" destination="porto_header"/>
    <move element="logo" destination="porto_header"/>
    <move element="page.top" destination="page.wrapper" after="porto_header"/>

    <referenceContainer name="header.container" remove="1"/>
    <referenceContainer name="header.panel" remove="1"/>
    <referenceContainer name="header-wrapper" remove="1"/>

    <referenceContainer name="footer-container">
        <block class="Smartwave\Porto\Block\Template" name="footer_block" template="html/footer.phtml">
            <block class="Magento\Store\Block\Switcher" name="footer.store_switcher" template="switch/stores.phtml"/>
            <block class="Magento\Newsletter\Block\Subscribe" name="footer.newsletter" template="subscribe_footer.phtml"/>
        </block>
    </referenceContainer>

    <referenceBlock name="header.links">
        <block class="Smartwave\Porto\Block\Template" name="custom_link" before="-" template="html/custom_link.phtml" />
    </referenceBlock>


texts: Magento 2.1 paypal express requires customer login

texts:
I'm trying to configure PayPal express checkout in Magento 2.1.8 unfortunately without success. Every time I try to checkout out from the minicart with PayPal express checkout Magento asks me to login in. In my understanding it should get all information from PayPal, isn't it?

I'm also not able to login to manager.paypal.com getting the error message:
Error: This feature is currently not available for your account. We are working to bring this feature to you soon.

Tried to configure it according to:
http://docs.magento.com/m2/ce/user_guide/payment/paypal-express-checkout.html

Any idea/help welcomed. If you need further information let me know ...

best

/David


texts: Magento 2: Fetch products with layered navigation programatically

texts:
I want to get products with layered navigation. I found sample code for Magento 1 below. How it can be done in Magento 2 ?

http://www.credevator.com/magento-fetch-products-with-layered-navigation-programmatically/


texts: Add company field to Magento registration form

texts: how to add Company field to Magento 2 registration form https://prnt.sc/u0i06g


texts:
I have created a custom shipping method. I need to implement the following logic:

  Shipping rate = Item weight * Item quantity * Zone rate

How to get zone rates in collectRates method?


texts: CE 1.9.2.4 on virtual server: SOAP-API V1 not working

texts:
Problem: i have a virtual server with Plesk (Ubuntu 14.04) and the SOAP-API not working. I have many trouble with this issue, because i have a second server with the same configuration and there no issues. In my etc/hosts is the server name 127.0.0.1 www.example.com example.com example localhost.

Following error cames from the

SOAP-Script: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://www.example.com/index.php/api/soap/index/?wsdl=1' : failed to load external entity "https://www.example.com/index.php/api/soap/index/?wsdl=1"

A cache refresh will not affect.

Have anybody the breaking idea? Thanks!


texts: How to Sort Products Based on Custom Attribute in Magento

texts: I would like to sort front end products in a category based on the custom attribute (say promote). I give value for promote attribute for every product in the website like 1,2,3,4,5..100,101..1000 etc. Here the requirement is, products need to be sorted based on the integer value irrespective of the category it exists. For example: If the promote attribute value is 1 then it should be the first product where ever category it exists. In other way highest promote attribute value should be top of every category. Please guide me in this.


texts: I have a list of pending SUPEE to patch, My magento is Magento ver. 1.7.0.2 and the pending SUPEEs that I need to patch are 7405, 8788, 9652,10266, 10415,10570 and 752. Is it better to upgrade to 1.9 or to patch all of this>? Will I avoid these patches if I will upgrade to 1.9? Thanks


texts: Filter Collection with result of previous collection

texts:
I have doubts about what is more optimal or if there are better ways to filter collections with the result of a previous collection.

I can do this:

$orders_id = Mage::getModel("custom/custom_order")->getCollection()
             ->addFieldToSelect("order_id")
             ->addFieldToFilter("attribute_id",array("eq"=>"some"));

$orders = array();
foreach ($orders_id as $order) {
    array_push($orders, $order->getOrderId());
}

$orders_filtered = Mage::getModel("sales/order")->getCollection()
                    ->addFieldToFilter($orders);

Or I can also do this:

$orders_filtered = Mage::getModel("sales/order")->getCollection();
$orders_filtered->getSelect()
                ->join(
                    array('custom_order' => $this->getTable("custom/custom_order")),
                    "main_table.entity_id = custom_order.order_id and custom_order.attribute_id = 'some'",
                    "array('custom_order.*')"
                );

Are there other ways to make it optimal?

Greetings!


texts:
Is it possible to echo a image / images from a static block? So something like this:

echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId($optionText)->getImages()


texts:
Whenever I make some changes through ftp (to the files manually) the changes take very long to display. I clear the cache numerous times before it takes effect.
I am also using Cloudflare CDN, I always enable development mode before making any changes.
What all do I have to do; like what is the right process to follow after one has made changes to styles.css etc?


texts: Shipping method based on ZipCodes In Magento 2

texts:
I want to show shipping method based on ZipCodes.

Like if zipcode isn't match with my list than shipping method doesn't need to show.

How can i achieve that ?


texts: SQL Syntax error when getting collection on listing

texts:
I've created my own module for managing leaflets in home page and i wanted to have a listing with existing leaflets. I've created UI_Component for listing (by Magicento) but when I go to listing page i have an error with SQL syntax.
[2021-05-14 07:50:23] main.CRITICAL: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order ASC LIMIT 20' at line 1, query was: SELECT `main_table`.* FROM `example_widgets_leaflet` AS `main_table` ORDER BY order ASC LIMIT 20

From error I know it is something about ORDER BY statement. Sorting is made by adding this three lines of code in listing xml file (in column -> data -> config node):
<item name="sorting" xsi:type="string">asc</item>
<item name="sortable" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">10</item>

Is there any fix for this?


texts:
I am trying to reorder the table header on the order PDF, but I can't find the file anywhere. It's not in the Mage/Sales/Model/Order/Pdf. I managed to trace down and modify everything, but this part is somewhere else.

Any idea where else can this code be?


texts: Store specific related, upsell or cross sell products in Magento

texts: Magento by default stores related, upsell and cross sell products in general scope. Is there an extension to store them at store scope? Does anyone have experience implementing this feature?


texts:
I have a page that needs to behave a little different than similair pages, so I want to add an if else statement for only one ID. How can I do that for magento 1.9?

On the view.phtml I need to add something like:

if($pageid == 44){
    echo 'do this';
}

What do I add for $pageid ?


texts: Anyone else having third-party modules with data integrity issues in M2's checkout?

texts: Using Amasty for a shipping calendar and orders randomly (It seems?) come through to the admin with shipping date missing. Very annoying but there is no obvious pattern and the bug can't be replicated by Amasty, although they were able to see it happen once in testing. I heard from a couple of devs that they have heard other people having issues with data integrity using third-party extensions with Magento 2's checkout. Has anyone seen anything like this? Thoughts?


texts: What is PSR in php ? Please explain with example

texts:
How PSR is useful in Magento 2 .

I learned

PSR-0 – Autoloader Standard
PSR-1 – Basic Coding Standard
PSR-2 – Coding Style Guide
PSR-3 – Logger Interface
PSR-4- Autoloader Standard

but I want to learn from example .
can anyone show me examples .


texts: CSS and JS merging options is not working on Magento 1.9.2.4

texts:
I am simply trying to enable the option of merging JS and CSS on configuration > system > developer and I have cleared the cache and even tried to delete the VAR folder and still having CSS and JS not merged.

How can I diagnose this problem or there any advice that could fix it?


texts: How to add a link in Order email template in Magento 2.3.3

texts:
Here i am trying to attach a dynamic link with every order in order email template.
for  eg:

Download Pdf

And i have troied

Please download PDF

Please download PDF

and much more i cant get my exact url with  Order id.
Is there any way where i can attach a link with order id in pub media url.
Small help will be  greatly appreciated.
Thanks in Advance :)


texts: How to adding sender's name to order comments in Magento2 admin?

texts: How to adding senders name to order comments in the magento2 admin panel. I don't know how to implement this task. Can you please help me? The below screenshot is my required output screenshot.https://prnt.sc/jtx9di


texts: How to get landing page after successful transaction

texts: Could you please guide me how do I get a landing page after successful transaction - landing page which says "your order has been placed successfully"


texts:
In Magento 2, would it be wrong to create a Factory model that allows me to get a factory for any of the models in my module? The reason I ask is that injecting model factories into my blocks/controllers where I need them and it is becoming quite difficult to manage. The proposed Factory of factories model I propose would still use DI to inject the factory classes so nothing would be hardcoded.

Here's some example code:

namespace Vendor/Module/Model;

class Factory
{
    protected $_factories = null;

    public function __construct(
        FirstModelFactory $firstModelFactory,
        SecondModelFactory $secondModelFactory
    ) {
        $this->_factories = array(
            'FirstModelFactory' => $firstModelFactory,
            'SecondModelFactory' => $secondModelFactory
        );
    }

    public function getFactory($class)
    {
        return isset($this->_factories[$class])
            ? $this->_factories[$class]
            : false;
    }
}


texts: What exactly is Dependency Injection in Magento?

texts:
I'm learning Magento 2 and couldn't able to understand some of the below things

Dependency Injection
Javascript bundling (Because some suggest to enable and some don't)
Third party module override

Could anyone please guide me with practical example for these?


texts: Base url issues which sometimes doesn't allow me to login in admin panel

texts:
Following the explanation, I run the suggested command n98-magerun.phar sys:check

Invalid Unsecure BaseURL Store: default Wrong hostname configured. Hostname must contain a dot
Invalid Unsecure BaseURL Store: french Wrong hostname configured. Hostname must contain a dot
Invalid Unsecure BaseURL Store: sot_eng Wrong hostname configured. Hostname must contain a dot
Invalid Unsecure BaseURL Store: sot_fra Wrong hostname configured. Hostname must contain a dot
Cookie Domain (secure) of Store: default OK - No domain set
Cookie Domain (secure) of Store: french OK - No domain set
Cookie Domain (secure) of Store: sot_eng OK - No domain set
Cookie Domain (secure) of Store: sot_fra OK - No domain set


texts: how can I let my customer choose the quantities in a bunded product?

texts:
I'm creating a bundled product. I would like to have an option where in the front end a customer can choose the QTY of the each option given.

E.G
we have the choice of charms for an item of jewellery
at the moment by QTY are defaulted at 1 but i would like for them to have the option of adding as many as they like e.g 4 diamond charms 3 tourmalines..
added to the same basket- Is this possible?


texts: CLI command for Flush JavaScript/CSS Cache

texts: Which CLI commands are executed when pressing this button in system/Cache Management?


texts: Magento 2 - How to return custom json response from API

texts:
I'm working with Magento 2 API and I'm really struggled with response of it

How can I return some kind of response like this:

{
    "status": 200,
    "error": false,
    "message": "Request processed successfully.",
    "data": {
        "id": "1",
        "email": "us@test.com",
        "first_name": "user1",
        "last_name": "user01"
    }
}

It's simple with other framework like Laravel or Express. But it seems really hard to achieve this with Magento 2 API.

Anyone has idea?
Thank you.


texts:
my Site is working fine but when i open orders from admin panel then it shows error.

i googled and try to fix issue but i failed, i got this problem after configuration of payment method.

If anyone Know , kindly help me


texts: How can i get the order total value on success page easily? Magento 2.2

texts:
I am trying to get the order value from success.phtml page so that I can report it back in the facebook pixel.

I am just looking for the simplest way to get the order value. Yes, a shortcut pretty much.

I tried this:

$orderTotal = round($block->getGrandTotal(), 2);

and also

$lastOrderId = $block->getOrderId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->load($lastOrderId);
echo "order id: ". $lastOrderId;
echo $order->getGrandTotal();

and several other methods but the total order value seems to be hard to find.


texts: How to remove resend confirmation dialog from firefox in magento2

texts:
When I refresh my magento2 website with ctrl+f5 then firefox popup showing with below message

  "To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

This problem are coming when i change store view from frontend and refresh page.
How to disable this firefox pop on magento2 website


texts: Magento 2 - Duplicating the Shipping Method Section

texts:
I am trying to split the order (creating 2 orders) based on product attribute selection which has been done. but now i want to add two separate shipping method section so i can send order with different shipping selection.

Please let me how to override the shipping section


texts: Magento2: Need To change Purchase Order Payment Code

texts:
I want to change Magento2 Offline payment method "Purchase Order" payment Code,with separate module. Do not suggest Make a new Offline payment methods like purchase order.

Current-code: "purchaseorder"

Thanks