texts: How to resolve Migration Exeption "exception trace"

texts:
We want to Migrate MAGE1.9.4.3. to MAGE2.3.5 with migration tool. We use some plugins, I haven't installed in the MAGE2 installation yet (e.g. Fooman EmailAttachments, FireGento PDF, Hankeme Pprevival  (german), Autoshipping, j-ways paypal Plus) I corrected all table and field mappings. I still get an FAILED message. I activated trace with "-vvv". How can I resolve this error message to find the mistakes?
Thank you.
In Data.php line 97:

  [Migration\Exception]
  Integrity Check failed

Exception trace:
  at /vendor/magento/data-migration-tool/src/Migration/Mode/Data.php:97
 Migration\Mode\Data->runIntegrity() at /vendor/magento/data-migration-tool/src/Migration/Mode/Data.php:62
 Migration\Mode\Data->run() at /vendor/magento/data-migration-tool/src/Migration/Console/MigrateDataCommand.php:59
 Migration\Console\MigrateDataCommand->execute() at /vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /vendor/magento/framework/Interception/Interceptor.php:58
 Migration\Console\MigrateDataCommand\Interceptor->___callParent() at /vendor/magento/framework/Interception/Interceptor.php:138
 Migration\Console\MigrateDataCommand\Interceptor->Magento\Framework\Interception\{closure}() at /vendor/magento/framework/Interception/Interceptor.php:153
 Migration\Console\MigrateDataCommand\Interceptor->___callPlugins() at /generated/code/Migration/Console/MigrateDataCommand/Interceptor.php:104
 Migration\Console\MigrateDataCommand\Interceptor->run() at /vendor/symfony/console/Application.php:1009
 Symfony\Component\Console\Application->doRunCommand() at /vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /vendor/magento/framework/Console/Cli.php:115
 Magento\Framework\Console\Cli->doRun() at /vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /bin/magento:23

migrate:data [-r|--reset] [-a|--auto] [--] <config>

``


texts: Magento 2 : How to get custom module collection in module template file

texts:
I want to load custom module collection in module template file :

I have my custom module which has table name:tagdata

I want to load "tagdata" table data in my template file.

And yeah I created a grid with UI component.

Please check my model file :

<?php

namespace [vendor]\[module]\Model;

class Extratags extends \Magento\Framework\Model\AbstractModel
{
    function __construct(
        \Magento\Framework\Model\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
        \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
        array $data = []
    ) {
        parent::__construct($context, $registry, $resource, $resourceCollection, $data);
    }

    protected function _construct()
    {
        $this->_init('[vendor]\[module]\Model\ResourceModel\Extratags');
    }
}


texts: What is the meaning of the error : Perhaps you used the wrong -p or --strip option?

texts:
If I try to apply PATCH_SUPEE-10266 i am getting error like : Perhaps you used the wrong -p or --strip option? How can i solve this error?

Complete error :

  patching file
  app/design/install/default/default/template/install/create_admin.phtml
  patching file app/locale/en_US/Mage_Adminhtml.csv can't find file to
  patch at input line 720 Perhaps you used the wrong -p or --strip
  option?

My create_admin.phtml : https://justpaste.it/1eawg

Patch Error : https://snag.gy/hWXebp.jpg


texts: Is there any option to debug issue in config.xml?

texts: Is there anyone provide solution to debug the issue of config.xml in Magento ?


texts: Magento 2 - not recieved test email in SMTP extension

texts: We have installed Mageplaza SMTP extension in our magebto 2 store and configured the extension, But We are not able to receive emails. I have to below attached screen short.


texts:
I have to override magento 2 code model file in the custom module.

I have to override below method from Magento\Quote\Model\Quote\Address to my custom module and I have to change value of $amount.

public function validateMinimumAmount()
{
    $storeId = $this->getQuote()->getStoreId();
    $validateEnabled = $this->_scopeConfig->isSetFlag(
        'sales/minimum_order/active',
        \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
        $storeId
    );
    if (!$validateEnabled) {
        return true;
    }

    if (!$this->getQuote()->getIsVirtual() xor $this->getAddressType() == self::TYPE_SHIPPING) {
        return true;
    }

    $amount = $this->_scopeConfig->getValue(
        'sales/minimum_order/amount',
        \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
        $storeId
    );
    $taxInclude = $this->_scopeConfig->getValue(
        'sales/minimum_order/tax_including',
        \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
        $storeId
    );
    $taxes = $taxInclude ? $this->getBaseTaxAmount() : 0;

    return ($this->getBaseSubtotalWithDiscount() + $taxes >= $amount);
}

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

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Quote\Model\Quote\Address">
        <plugin name="my_address_plugin" type="vendor\module\Plugin\AddressPlugin" sortOrder="1" />
    </type>
</config>

can anyone please help? I'm not sure which method to use before, after or around and how to set custom value for $amount using my plugin.


texts:
I have not seen this case in the other topics: magento 1.9.2CE that has a reindex working for way too many hours seems stuck ; generally it takes few minutes to 1 hour.

Context
everyday at 02h10 a homemade script cronUpdateMagentoDaily.sh does stuff and then runs:
php5.6 /var/www/html/magento/shell/indexer.php --reindex catalog_product_price

Symptoms

folder var/locks is empty
process of reindexing still ongoing but time stuck at 0
database shows an ended_at value strange

process_id indexer_code              status          started_at          ended_at            mode
         1 catalog_product_attribute pending         2019-09-12 03:11:01 2019-09-12 03:11:01 real_time
         2 catalog_product_price     working         2019-09-12 03:11:22 2019-09-12 03:11:01 real_time
         3 catalog_url               require_reindex 2019-09-02 15:52:08 2019-09-02 16:08:30 manual

Why would catalog_product_price have an ended_at value anterior to its started_at value? How can it be precisely the same as catalog_product_attribute ended_at value?
May that explain what that reindexation is stuck doing (apparently) nothing?
Running processes (snippet of ps -afux) showing that it does nothing:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      3538  0.0  0.0  27732  1984 ?        Ss    2016   8:17 /usr/sbin/cron -f
root     30940  0.0  0.0  49044  2784 ?        S    02:10   0:00  \_ /usr/sbin/CRON -f
root     30954  0.0  0.0   4504   696 ?        Ss   02:10   0:00      \_ /bin/sh -c /var/www/html/magento/cronUpdateMagentoDaily.sh
root     30961  0.0  0.0  11244  2960 ?        S    02:10   0:00          \_ /bin/bash /var/www/html/magento/cronUpdateMagentoDaily.sh
root      7058  0.0  0.1 332556 46156 ?        S    05:11   0:00              \_ php5.6 /var/www/html/magento/shell/indexer.php --reindex catalog_product_price

May it be safe to kill its process and re-run it?


texts: Custom attribute update & value added/stored on save

texts:
I'm trying to store the sum of two attributes into a new custom field on save. One is just price, and the other one is a custom price attribute field called customtext. So when there's a value in the customtext field, it should add up both price and the value from that field and display it in the 'customprice'field in the backend. I'm kind of stuck, so I was hoping someone could take a look at what I have so far.

My config.xml:

<config>
<modules>
    <Namespace_AttributeUpdate>
        <version>0.0.1</version>
    </Namespace_AttributeUpdate>
</modules>
<global>
    <models>
        <Namespace_AttributeUpdate>
            <class>Namespace_AttributeUpdate_Model</class>
        </Namespace_AttributeUpdate>
    </models>
    <events>
        <catalog_product_save_before>
            <observers>
                <Namespace_AttributeUpdate>
                    <class>Namespace_AttributeUpdate/observer</class>
                    <method>updateAttribute</method>
                    <type>singleton</type>
                </Namespace_AttributeUpdate>
            </observers>
        </catalog_product_save_before>
    </events>
</global>

And my observer:

<?php

class Namespace_AttributeUpdate_Model_Observer extends  Varien_Event_Observer

{
public function updateAttribute(Varien_Event_Observer $observer)
{
    $product = $observer->getEvent()->getProduct();
    $price = $product->getPrice();
    $customtext = $_product->getResource()->getAttribute('customtext');
    $priceWithText = $price + $customtext;
    $product->setData('price_inctext', $priceWithText);
   }
}

Thanks in advance!


texts: Magento 1.11.0 returning empty set for custom model getCollection()->getData()?

texts:
Our extension uses a custom model for some data that we need to use. For CE Magento installs, (a la 1.6-1.8) this works fine, but in our client's 1.11 install this returns an empty set:

$mapping = Mage::getModel('syncer/mapping')->getCollection()->getData();
var_dump($mapping); // NULL

Any idea what's up with this?

I'm not very familiar with the Magento API code but by debugging this is what I found, if more code is relevant please let me know and I'l paste it here. I've tried searching for this problem but came fruitless.


texts: Disable customer attribute in magento admin form

texts:
I created custom customer attribute  is_institution with boolean value

My installData.php is

<?php
namespace xxx\xxxx\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;

class InstallData implements InstallDataInterface {

    private $_eavSetupFactory;
    private $_attributeRepository;

    public function __construct(\Magento\Eav\Setup\EavSetupFactory $eavSetupFactory,\Magento\Eav\Model\AttributeRepository $attributeRepository)
    {
        $this->_eavSetupFactory = $eavSetupFactory;
        $this->_attributeRepository = $attributeRepository;
    }

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) {

        $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);

        // add customer_attribute to customer
        $eavSetup->removeAttribute(\Magento\Customer\Model\Customer::ENTITY, 'is_institution');
        $eavSetup->addAttribute(
                \Magento\Customer\Model\Customer::ENTITY, 'is_institution', [
            'type' => 'int',
            'label' => 'Is Institution',
            'input' => 'select',
            'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
            'required' => false,
            'default' => '0',
            'sort_order' => 100,
            'system' => false,
            'position' => 100
                ]
        );

        // allow customer_attribute attribute to be saved in the specific areas
    $attribute = $this->_attributeRepository->get('customer', 'is_institution');
    $setup->getConnection()
    ->insertOnDuplicate(
        $setup->getTable('customer_form_attribute'),
        [
            ['form_code' => 'adminhtml_customer', 'attribute_id' => $attribute->getId()],
            ['form_code' => 'customer_account_create', 'attribute_id' => $attribute->getId()],
            ['form_code' => 'customer_account_edit', 'attribute_id' => $attribute->getId()],
        ]
    );
    }
}

It is displayed in admin customer form

But I want to disable it from admin form, so the admin cannot modify this attribute

I also tried 'readonly' => true, but it is not working


texts: How to get data from two different table to edit form in admin ui grid

texts:
Below is code For DataProvider in Edit form.
 Here it displays main tables data while i choose edit them.
 Can any one tell how to display data of another table

 <?php
 namespace My\Module\Model\Save;
 use My\Module\Model\ResourceModel\Save\CollectionFactory;
 class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
{
/**
 * @param string $name
 * @param string $primaryFieldName
 * @param string $requestFieldName
 * @param CollectionFactory $contactCollectionFactory
 * @param array $meta
 * @param array $data
 */

public function __construct(
    $name,
    $primaryFieldName,
    $requestFieldName,
    CollectionFactory $contactCollectionFactory,
    array $meta = [],
    array $data = []
) {
    $this->collection = $contactCollectionFactory->create();

    parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
}

public function getData()
{
    if (isset($this->loadedData)) {
        return $this->loadedData;
    }

    $items = $this->collection->getItems();
    $this->loadedData = array();

    /** @var Customer $customer */
    foreach ($items as $contact) {
        // notre fieldset s'apelle "contact" d'ou ce tableau pour que magento puisse retrouver ses datas :
        $this->loadedData[$contact->getId()]['contact'] = $contact->getData();
    }

    return $this->loadedData;

}
}

this is my collection

 <?php

 namespace My\Module\Model\ResourceModel\Save;

 use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;

 class Collection extends AbstractCollection
{
public function _construct()
{
    $this->_init('My\Module\Model\Save', 'My\Module\Model\ResourceModel\Save');

}
}

where my second table name is my_module_contact_add
and fields i want to join is address, zipcode and country


texts:
Have this problem for an API feed:

You cannot define a correlation name 'link_attribute_qty_decimal' more than once at public_html/vendor/magento/framework/Webapi/ErrorProcessor.php:208, Zend_Db_Select_Exception(code: 0): You cannot define a correlation name 'link_attribute_qty_decimal' more than once at public_html/vendor/magento/zendframework1/library/Zend/Db/Select.php:833)"}

To me it seems like there is a product with quantity like 10.5 that does not have decimals used in the quantity. Have checked all product and made the changes. But still gets the error.
Anyone that can help me here will be much appreciated :)


texts: My M2 site is feeding the less files to the page and not compiling the Less. Im in developer mode via the CLI, I've deleted the var/generation and pub/static folders. I'm not sure what else to do.


texts: Which is the block/template file for product edit page in Admin of Magento 2

texts: I would like to know which is the block/template file for product edit page in Admin of Magento 2. Using template hints to find this out displays a path to template that is not found where it shows it is.


texts: Getting 404 error when adding Typekit fonts to Magento 2.1

texts: I am attempting to add Typekit fonts to a Magento 2.1 install via Content > Design > Configuration > Default Store View > HTML Head. When I paste the Typekit provided embed code into the Scripts and Style Sheets and click Save Configuration I get a 404 Page not found error. If I edit any other field (for example I've updated the footer) there is no issue when I click Save Configuration.


texts: Get value from custom column from customer_entity

texts:
I'm having an issue with getting data from custom column I added in customer_entity. I added a column typo3_password in UpdateSchema.php and now I need to get data from this column. Trying to do that using getTypo3Password() method and adding CustomerInterface in module's Api\Data but it doesn't work.

 $customer       = $this->customerRepository->get($username);
 $customerId     = $customer->getId();
 $typoHashFromDb = $customer->getTypo3Password();

Any ideas? Do I need to add my custom Customer Model as well?

-- edit

Adding the custom CustomerInterface I created.

 const TYPO3_PASSWORD = 'typo3_password';

/**
 * Get Typo3 Password
 *
 * @return string|null
 */
public function getTypo3Password();

/**
 * @param string $typo3password
 * @return $this
 */
public function setTypo3Password($typo3password);


texts: Magento 2: Error 500 with correct Password in Magmi.ini with PHP7.2

texts:
My question relates strongly to Magento 2: Error 500 with correct Password in Magmi.ini

However I am not running PHP 7.1 but running PHP7.2.27 on centos 6 but still getting the sodium crypto error when using current version from github here https://github.com/macopedia/magmi-m2

when I try to use the version for php7.1 i get error returned

Performing Datasource Lookup...

Warning: fopen(/var/import/import.csv): failed to open stream: No such file or directory in /inc/magmi_csvreader.php on line 51

Warning: count(): Parameter must be an array or an object that implements Countable in /inc/magmi_mixin.php on line 28


texts: Magento2: How to set product wise different layout

texts:
I have Two product. Both are Downloadable.
I want different layout for both product.

Except below concept:

catalog_product_view_id_1.xml

The second concept I am using is with help of observer, But also this one is not working.
Below are my code. Please see and let me know if any change.

Path: etc/event.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="layout_load_before">
    <observer name="catalog_product_view_extension" instance="Custom\Extensionlayout\Observer\LayoutLoadBefore" />
</event>
</config>

Path: Observer/LayoutLoadBefore.php

<?php

namespace Custom\Extensionlayout\Observer;

class LayoutLoadBefore implements \Magento\Framework\Event\ObserverInterface
{
/**
 * @var \Magento\Framework\Registry
 */
protected $_registry;

public function __construct(
   \Magento\Framework\Registry $registry
)
{
    $this->_registry = $registry;
}

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $product = $this->_registry->registry('current_product');

    //echo ; die;

    if (!$product){
      return $this;
    }
    if($product->getName() == 'book2'){ // your condition

       $layout = $observer->getLayout();
       $layout->getUpdate()->addHandle('catalog_product_view_extension');
    }

    return $this;
}
}

And here is my custom layout path:
view/frontend/layout/catalog_product_view_extension.xml

<?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">
<body>
    <referenceBlock name="page.main.title" remove="true"/>
    <referenceBlock name="product.info.overview" remove="true"/>
    <referenceBlock name="product.price.final" remove="true"/>
    <referenceBlock name="product.price.tier" remove="true"/>
    <referenceBlock name="product.info.stock.sku" remove="true"/>
    <referenceBlock name="product.info.review" remove="true"/>
    <referenceBlock name="product.info.addtocart.additional" remove="true"/>
    </body>
    </page>

Here what happens, Observer is getting called but my custom handler not rendered.
Anyone did this kind of change.
Please suggest.


texts: How to insert data in custom table using REST API in Magento2

texts:
I Have custom table name like test_table and it contains fields like name, number and city.

I want to insert data using Magento 2 REST API.

Please Let me know if you have any idea?


texts:
Does anyone know where I can find a list of all the triggers for a transactional email?  Some of them are obvious or self explanatory (such as "forgot password" or "new order"), but others are not as self evident, and even the existing email templates give little help on what they should be about, such as "friend email template".

Any ideas?


texts: In my custom confirmation email template password is not displaying

texts:
This is the what I receive as mail.

Dear Abc,

Welcome! Your e-mail has been verified. To log in to mysite.com just click Login or My Account at the top of every page, and then enter your e-mail address and password.

Here’s a record of your account details:
E-mail: abc@gmail.com
Password:
If you have any questions about your account or any other matter, please feel free to contact us at info@mysite.com

In my custom template i was added this line but its not displaying the value

Password: {{htmlescape var=$customer.password}}

Kindly help me to proceed. Magento ver 1.9.0.1..


texts: How do I change the grey background in emails to a white background?

texts: I want to change the ugly grey background in my emails(templates). I'm using the rwd theme. Is there an easy way to do it? Nothing to fancy just practical. I already tried to change the background in email-inline.scss but nothing happened. Exte


texts: Profiler is enabled after a maintenance flag is created - malware?

texts:
It seems like the profiler on my site is automatically enabled after the site goes down in maintenance mode- Is there any reason why magento goes into maintenance mode and subsequently, the profiler is turned on?

Could it be some kind of malware or intrusion on the site?

Thank you!


texts: How to reterive order id from self develop block

texts:
I have developed a block and placed at order details page, and wanna get the order information but cannot use query_string

http://127.0.0.1/Magento2EE/sales/order/view/order_id/3/

I can get the order no. from query_string:
    $this->getRequest()->getParam('order_id');

For security issue I cannot use this method -> pass by query_string.

So, I try to use
$this->getOrder()->getOrderId();

but system retured error:

  Fatal error: Call to a member function getOrderId() on null


texts: I am getting an error General error: 1111 Invalid use of group function. What am I doing wrong?

texts:
I have this code

 $orderModel = Mage::getModel('sales/order');
    $ordercollection = $orderModel->getCollection()
        ->setPageSize(20)
        ->setCurPage(1)
        ->join(array('item' => 'sales/order_item'), 'main_table.entity_id = item.order_id');
    $ordercollection->addFilterToMap('large_total', 'SUM(subtotal_invoiced)');

    $ordercollection->getSelect()->columns('SUM(subtotal_invoiced) as large_total');
    $ordercollection->getSelect()->where('SUM(subtotal_invoiced) >= 200');
    $ordercollection->getSelect()->group('main_table.customer_email');

If I take out the line

    $ordercollection->getSelect()->where('SUM(subtotal_invoiced) >= 200');

then it seems to work fine.  I am not sure what I doing wrong here.  Thanks!


texts: how to install magento on customized sample database?

texts:
Is There any way to install magento with some Copy of production database?
Exactly like installing Magento with sample data
i want to Customize my current database (in used with old magento version 1.9.0.1) and install current version on magento (1.9.2.1) on that Database (some Upgrade way)
my question is: how to customize database for this?


texts: How to set email for Email on a Different Host from the Website?

texts:
Now I use the same host account for both email and website. But I plan to move email to new host.
I know about Configure the MX Records and Change Email Routing settings
My website is in Magento 2. Is there anything else I need to do to set email for new host in Magento?
Thank you


texts: Magento 2 which plugin can use for after invoice or shipment from admin

texts:
I am using this
di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Sales\Api\OrderRepositoryInterface">
        <plugin name="admin_plugin_order_save_after" type="CompanyName\ModuleName\Plugin\AdminPluginOrderSaveAfter"/>
    </type>
</config>

AdminPluginOrderSaveAfter.php
<?php
namespace CompanyName\ModuleName\Plugin;

use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Sales\Api\Data\OrderInterface;
use Magento\Framework\ObjectManagerInterface;

class AdminPluginOrderSaveAfter
{
    protected $objectManager;
    protected $orderRepositoryInterface;

    public function __construct(
        ObjectManagerInterface $objectManager,
        OrderRepositoryInterface $orderRepositoryInterface
    ) {
        $this->objectManager = $objectManager;
        $this->orderRepositoryInterface = $orderRepositoryInterface;
    }

    public function afterSave(\Magento\Sales\Api\OrderRepositoryInterface $orderRepo, $order)
    {
        $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/xuz.log');
        $logger = new \Zend\Log\Logger();
        $logger->addWriter($writer);
        $logger->info("------admin after save plugin start------");
        if($order->getStatus() == "complete")
        {
            $logger->info('----complete----');
            $order->setCustomAttributeFlag("1");
        }
        else
        {
            $logger->info("------else------");
            $order->setCustomAttributeFlag("0");
        }

        return $order;
    }
}

This only works when order is created, I need to update order after invoice and shipment is generated from admin.
I also use this event "sales_order_save_after" but it is calling 2 times.
Anyone know to update order after invoice and shipment is generated ?


texts: Set multiple amount for cart rule in single coupon code

texts:
I want to set multiple discount amount for cart rule in single coupon code

Example : If TEST10% coupon has 10 amount and if i apply this coupon
code then after deduction on subtotal i want to deduct custom amount
like 20 OR 30 as well

I want to achieve this with plugin or observer, Please guide me for same


texts:
I am trying to override: vendor/magento/module_catalog/i18n/en_US.csv

The file was copied to: app/design/adminhtml/vendor/theme/Magento_Catalog/i18n/en_US.csv

Then I ran: php bin/magento setup:static-content:deploy -f & php bin/magento cache:flush

When I look at the admin area the label hasn't changed.


texts:
My call is going to controller but not to the block.I am giving the code related with problem.
I am trying to make a product zoom module which fetch big image of product from database when user click on any product box.I am doing this on category pages not on the product page.if anything is needed please comment.

My js method is below:

function displayData(elem){
    var pro_id = jQuery(elem).attr("id");
    jQuery(".nzoom-div2").fadeIn("fast");
    var pd = $j("#nzoom-hide"+pro_id).val();
    var img_data = "pid="+pd;
    jQuery.ajax({
        url: "<?php echo Mage::getUrl('zoomer/ajax/index'); ?>",
        type: "GET",
        cache:false,
        data: img_data,
        dataType:"text",
        error:errorhandler,
        success: function(result) {
            console.log(img_data);
            jQuery('.nzoom-div2-inner1 img').attr('src', result);
            console.log(result);
        }
    });
}

Controller:

class Test1_Zoomer_AjaxController extends Mage_Core_Controller_Front_Action {

public function indexAction() {
Mage::log('zoomer controller', null,'zoomer3.log');
$this->loadLayout();
$this->renderLayout();
}

}

Layout file zoomer.xml

<?xml version="1.0"?>
<layout version="1.0">
    <zoomer_ajax_index>
 <reference name="content">
      <block type="zoomer/zoomer" name="root" output="toHtml" template="zoomer/zoomer.phtml" />
 </reference>
 </zoomer_ajax_index>

 </layout>

Block Zoomer.php

  class Test1_Zoomer_Block_Zoomer extends Mage_Core_Block_Template
{
/* protected function _construct()
{
    parent::_construct();
    $this->setTemplate('zoomer/zoomer.phtml');
}
*/

public function methodBlock() {
    Mage::log('zoom block', null,'zoomer3.log');
  return "working code";
}

   /*protected function _toHtml() {
    return parent::_toHtml();
   }*/

}

Template zoomer/zoomer.phtml

<?php methodBlock(); ?>

Config.xml inside the etc/

    <?xml version="1.0"?>
<config>
  <modules>
    <Test1_Zoomer>
      <version>0.1.0</version>
    </Test1_Zoomer>
  </modules>
  <frontend>
    <routers>
      <zoomer>
        <use>standard</use>
        <args>
          <module>Test1_Zoomer</module>
          <frontName>zoomer</frontName>
        </args>
      </zoomer>
    </routers>
    <global>
    <blocks>
    <test1_zoomer>
    <class>
    Test1_Zoomer_Block
    </class>
    </test1_zoomer>
    </blocks>
    </global>
    <layout>
      <updates>
        <zoomer>
          <file>zoomer.xml</file>
        </zoomer>
      </updates>
    </layout>
  </frontend>
</config>


texts: Add a button to each Product in category view by own module

texts:
I am very new to Magento and have to add a Button to each product in product category view and all other product lists (not detail product view).

I nearly found an answer in Add block to each product in category view, but I don't want to override any original files. So that solution seems not working for me.

I tried to extend Mage_Catalog_Block_Product_List, but I do not really find an appropriate function to use.

Please, can anybody help me?


texts:
Some magento websites load in milli seconds.
Mine takes 4 seconds, I have enables cache but still it takes so long.
How do these other websites load so quick?
I have done all the setting here

http://www.mgt-commerce.com/blog/magento-on-steroids-best-practice-for-highest-performance/

My server has 32GB ram and 12 cores


texts: Override Wishlist view.phtml from custom module not working

texts:
I tried to override wishlist view.phtml which loaded at customer account page like this:

  app/code/Test/Salesman/view/frontend/layout/wishlist_index_index.xml

<?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">
    <referenceBlock name="customer.wishlist">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Test_Salesman::wishlist/view.phtml </argument>
        </action>
    </referenceBlock>
</page>

  app/code/Test/Salesman/view/frontend/templates/wishlist/view.phtml

<h1> SUCCESS </h1>

but it always shows the original phtml file


texts: How to display my configurable products in the best sales static block

texts: I am having a small problem with my magento I can not make my configurable product appears in the best sales


texts: How to show magento default backorder notice message in minicart & sales emails(same like cart page)

texts:
Have tried looking into several blogs & stackoverflow answers but unfortunately didnt find any solutions.
I am using mage 2.4.0
Can someone please look into it?


texts: Magento 2 subscription products approach

texts:
I am working with the subscription related product, consider the following scenario.we are having two customer group like C1 and C2. then having the product P1, the price of the product will vary based on the customer group also based on the plan(Monthly,Yearly)

See the price below

If the C1 group customer logged in means, we will show the two plan

Monthly : 100
Yearly : 1000

The customer select any one of the subscription and added to the cart.

how can i achieve the above logic, i have two things in mind

Override custom option and add the subscription plan
Override tier-price and add the subscription plan

Which one is the suitable for accomplish the above logic and share any link how to achieve in Magento2 code

Note : I am working with the simple products


texts: Remove all products from wishlist for all customers

texts:
How can I remove all products from wishlist for all customers at once?

Thanks


texts: Adding a Product to the Cart via Querystring using SKU

texts:
I know that we can adding a product to cart via querystring.
but how do we add sku to cart via querystring in url without including product id
like this : domain/checkout/cart/add?sku=ABC or domain/checkout/cart/add/sku=BC


texts: Error: magento delete cannot complete this operation from non admin area

texts:
My Magento was running successfully till last couple of weeks back. All of a sudden, I am getting error as below

  Cannot complete this operation from non-admin area.

When I browse for the issue it suggests different reason but non of them matches with my current situation.

I found that in app/code/core/mage/Core/Model/Abstract.php file we have check point as below

protected function _protectFromNonAdmin()
    {
        if (Mage::registry('isSecureArea')) {
            return;
        }
        if (!Mage::app()->getStore()->isAdmin()) {
            Mage::throwException(Mage::helper('core')->__('Cannot complete this operation from non-admin area.'));
        }
    }

The condition Mage::app()->getStore()->isAdmin() always returns false despite user logged in as a admin.

Can someone assist me ?


texts: Magento After installing, images does not working correct; no graphics

texts:
I'm new on Magento .
I have started on Magento 2.1 .
The problem is that when i'm trying to install Magento in my localhost (Xampp) the images doesn't load correctly
I think it's not even inside my project because i tried to follow the directory and there are no images in it  .
anyone facing something like this before  ?


texts: Overriding Product view page in Magento 2

texts:
I am overriding product page for customization, but my template is not setting.

[Namespace]/[Modulename]/view/frontend/layout/catalog_product_view.xml

<?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="product.info.main">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">[Namespace]_[Modulename]::product/list.phtml</argument>
            </action>
        </referenceContainer>

</page>

[Namespace]/[Modulename]/view/frontend/templates/product/list.phtml

Product view Page

...
//core module code
...

and I run the flush, clean command also.

Any help?


texts: how do you prevent magento logging out after non activity

texts:
is it possible to prevent magento from logging you out of the admin area after non activity. It's difficult when entering products and then getting sidetracked on other jobs, and then when coming back then system logs you out.

Any way to prevent this ?


texts:
I have few HTML files.

I am a beginner in version 1.9.

I want to integrate those file into my custom theme.

What procedure should I follow to complete this task?


texts:
Sometimes I only need to change one static file, is it possible to do that?

Example I have changes to: /static/versionxxxxxxxx/frontend/Superlove/custom/da_DK/Magento_PageCache/js/page-cache.js

Can I just manually change it and do System > Cache Management > Flush JavaScript/CSS in the admin?


texts: Magento 2: minicart checkout button and cart subtotal display after item list

texts:
How to modify minicart in magento 2.
Minicart content display like:

Item list
subtotal
shopping-cart link
go to checkout button


texts:
USPS is not working in the magento 2. when checked the log its giving below error.
'request' => '2ALL088540885400.0000000000VARIABLEREGULARtrue
'result' => '-2147219500RateEngineV4;RateV4.ProcessRequestPlease enter the package weight.  ',


texts: Catalog Price Rules: Why my rule has not effect?

texts:
I'm on Mage 1.8 with custom data.

I have created a catalog rule that give 10% discount when sku = 'n2610' ( relative product id is 16 )
saved the rule
apply all the rule

Now I m testing the rule with the following code:

<?php
require_once './app/Mage.php';
umask(0);
Mage::app();
//Mage::setIsDeveloperMode(true);

$rule = Mage::getModel('catalogRule/rule')->load(5);

var_dump($rule->getData());
var_dump($rule->getMatchingProductIds());

getMatchingProductIds() gives me back an array() with all prod. here the part for the interested product.

RESULT:

16 =>
array (size=3)
  0 => int 0
  1 => int 0
  2 => int 0

I expect that the array contains some 1.

If I debug the following method, I can see that the $validatedValue is always empty so the rule never match.

Mage_Rule_Model_Condition_Abstract::validateAttribute($validatedValue)

Anyone can point me to the error ? is it a bug on 1.8 ( I'm quite sure I haven't touched any core file.)


texts: How to disable a virtual product, simple product using sql query in magento 2.2?

texts: I'm using Magento2.2. The website which I had developed is frequently update stock, price from ERP. I need to disable only a product whether it is virtual or simple when stock is 0. And enable it again when stock is 1 using SQL.


texts: Do Checkout Totals sort Order changes calculation also

texts:
I debugged through System->Configuration->Sales->Sales->Checkout Totals sort Order settings and understand that it changes the display order in totals section on cart page.
Do it affect the calculations also. For example can it make a difference in final grand total, in case shipping is shown above or after tax.


texts: my magento site suddenly gives this error can anyone help me out?

texts:
Warning: simplexml_load_string(): Entity: line 14: parser error : Opening and ending tag mismatch: layout line 2 and arithmetic_integer_multiply  in /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php on line 444

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/var/www/html/a...', 444, Array)
#1 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(444): simplexml_load_string('getFileLayoutUpdatesXml('frontend', 'smartwave', 'custom', '1')
#3 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(347): Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
#4 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(246): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
#5 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(224): Mage_Core_Model_Layout_Update->merge('default')
#6 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(306): Mage_Core_Model_Layout_Update->load()
#7 /var/www/html/app/code/core/Mage/Cms/Helper/Page.php(109): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 /var/www/html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'porto_home_11')
#9 /var/www/html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'porto_home_11')
#10 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#11 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 /var/www/html/app/code/local/NextBits/Marketplace/Controller/Router/Vendor.php(39): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): NextBits_Marketplace_Controller_Router_Vendor->match(Object(Mage_Core_Controller_Request_Http))
#14 /var/www/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#15 /var/www/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#16 /var/www/html/index.php(87): Mage::run('', 'store')
#17 {main}


texts: Which event observer will be triggered before customer mail send in Magento 2?

texts:
I need to assign value to my custom variable in new customer Email template.
For that I need to know which Event Observer will be triggered before customer mail send.


texts: Magento rewrite url not adding .html to category

texts:
when I am trying to add url rewrite for a category, selected sale category. it is adding as sale./ but I need sale.html/

how to change this sale./ to sale.html for url category or url product...?


texts: Accessing a JS function from another JS file

texts:
I'm trying to access a function from 'create-validation-list.js'.

define([
'jquery'
], function ($) {

return createValidationList = function () {
// Code
}

shipping.js

define([
'jquery',
'underscore',
'Magento_Ui/js/form/form',
'ko',
'Magento_Customer/js/model/customer',
'Magento_Customer/js/model/address-list',
'Magento_Checkout/js/model/address-converter',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/create-shipping-address',
'Magento_Checkout/js/action/select-shipping-address',
'Magento_Checkout/js/action/create-billing-address',
'Magento_Checkout/js/action/select-billing-address',
'Magento_Checkout/js/model/shipping-rates-validator',
'Magento_Checkout/js/model/shipping-address/form-popup-state',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/action/select-shipping-method',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/action/set-shipping-information',
'Magento_Checkout/js/model/step-navigator',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/model/checkout-data-resolver',
'Magento_Checkout/js/checkout-data',
'uiRegistry',
'mage/translate',
'BB_Checkout/js/action/create-validation-list',
], function (
$,
_,
Component,
ko,
customer,
addressList,
addressConverter,
quote,
createShippingAddress,
selectShippingAddress,
createBillingAddress,
selectBillingAddress,
shippingRatesValidator,
formPopUpState,
shippingService,
selectShippingMethodAction,
rateRegistry,
setShippingInformationAction,
stepNavigator,
modal,
checkoutDataResolver,
checkoutData,
registry,
$t,
createValidationList
) {
'use strict';

    return Component.extend({
     // other code

    /**
     * Set shipping information handler
     */
    setShippingInformation: function () {
        createValidationList.createValidationList();

        if (this.validateShippingInformation() && this.validateBillingInformation()) {
            setShippingInformationAction().done(
                function () {
                    stepNavigator.next();
                }
            );
        }

        $('#customer-email').on('keyup', createValidationList.createValidationList);
    }
});
});

I'm getting the error createValidationList is not a function.


texts: Magento 2 GD Reindex Error gd.jpeg_ignore_warning

texts:
I am trying to run reindex in Magento 2.2  apache 2.4 PHP 7.1
Elastic Search installed v 6.4
Search Engine (Amasty ElasticSearch) Tested and Successful.

For this reindex catalogsearch_fulltext

php bin/magento indexer:reindex catalogsearch_fulltext running this again gives below error

  Premature end of JPEG file  in
  vendor/magento/framework/Image/Adapter/Gd2.php on line 65

I checked the php.ini file being used for the magento site
Configuration File (php.ini) Path   /opt/cpanel/ea-php71/root/etc
Loaded Configuration File   /opt/cpanel/ea-php71/root/etc/php.inI

In researched this error and found other people were given this advice and it fixed the error

"You can the set default value of gd.jpeg_ignore_warning=1 in php.ini

OR

You can set it like this ini_set('gd.jpeg_ignore_warning', true); in your PHP script before calling imagecreatefromjpeg()

After implementing any of the above, GD Library will ignore the error where it use to fail and imagecreatefromjpeg() will return an image resource identifier.

Note: In PHP 7.1.0 the default value of gd.jpeg_ignore_warning has been changed from 0 to 1"

I uncommented the line in my php.ini file

FROM
;gd.jpeg_ignore_warning = 0

To
gd.jpeg_ignore_warning = 1

Restarted Apache and Nginx

Tried to run the reindex again and the same error

Our dedicated server has Multi Php I checked in CLI ssh and it showing the same php.ini is being used by the CLI

I then checked in my mydomain.com/php.info

gd.jpeg_ignore_warning  1 (local value) 1 (master value)

I noticed these are same settings as before I made any changes they were both set to 1  (in the php.ini file mentioned above path it was commented) so where can it be getting this setting from?

Please, can someone help me as I spent over a day looking for a fix on this.

Where else should I be checking or changing this so I can complete the reindex
Thank You


texts: Configurable Product attibute option selection from Wishlist in magento 1.9?

texts:
I want to Display all Configurable swatches and Attribute Dropdowns to Wishlist for Configurable Product, so the customer can select from there and directly move product to cart.
No need to go on Product page to choose options like size and color.


texts: How to add a video as background for all pages in Magento 2?

texts: I am trying to add a video as the background for the Magento frontend. Is it possible to do it? Or would gif be a better idea, despite bigger size?


texts:
AFAIK there is nothing that has been changed over the last week but for some reason checkout is not possible, I've whittled it down to a problem in op_checkout.js::Review::nextStep:

nextStep: function(transport){
    console.log('opcheckout.js => Review::nextStep');
    //console.log(transport);
    //console.log(transport.responseText);
    if (transport) {
        console.log(transport); // THE PROBLEM
        try{
            response = eval('(' + transport.responseText + ')'); //FAILS
        }
        catch (e) {
            response = {}; // GOES HERE
        }
        if (response.redirect) {
            this.isSuccess = true;
            location.href = response.redirect;
            return;
        }
        if (response.success) {
            this.isSuccess = true;
            window.location=this.successUrl;
        }
        else{
            var msg = response.error_messages;
            if (typeof(msg)=='object') {
                msg = msg.join("\n");
            }
            if (msg) {
                alert(msg);
            }
        }

        if (response.update_section) {
            $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
        }

        if (response.goto_section) {
            checkout.gotoSection(response.goto_section, true);
        }
    }
},


texts:
I am using Magento2.3.1 and i trying to override model in our theme.

our model file path app/code/XXXX/General/Model/Layer

<?php
namespace XXXXX\General\Model\Layer;

class FilterList extends \Magento\Catalog\Model\Layer\FilterList
{
    public function getFilters(\Magento\Catalog\Model\Layer $layer)
    {
        if (!count($this->filters)) {
            $this->filters = [
                $this->objectManager->create($this->filterTypes[self::CATEGORY_FILTER], ['layer' => $layer]),
            ];
            $i = 1;
            foreach ($this->filterableAttributes->getList() as $attribute) {
             echo "test";
           }

        }
        return $this->filters;
    }
}

app/code/XXXXX/General/etc our di.xml file path and below code

<?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\Layer\FilterList" type="\XXXX\General\Model\Layer\FilterList" />
</config>

please check it my code and reply me how to wrong?


texts: Assign products to category programatically in magento2

texts: How can I assign 'New products' to 'NEW PRODUCTS category' programatically in magento 2.


texts: Resize individual image in widget - magento 2.0.1

texts:
I have created customize theme which extends to magento blank. I am using widget to show latest products in home page.
Now, My page look like this

I want to resize the every image (catalog product list) in widget. I will expect my page look like this

Note : I could refer this link to change all image size but no luck. copy view.xml from blank theme, paste into app/design/..../mytheme/etc/view.xml. I change below content in view.xml
<image id="category_page_grid" type="small_image">
    <width>400</width>
    <height>400</height>
</image>
<image id="category_page_list" type="small_image">
    <width>400</width>
    <height>400</height>
</image>

but nothing get reflected
here I put two questions

How to resize individual image in product list

Why mytheme view.xml get not reflected


texts:
I've created a grid to list the invoices in my store and make decisions from it, but there are some invoices that the order that generated it is with status canceled or delivered. I need to list only the invoices that the base order is with the status processing.

My collection:

$collection = Mage::getResourceModel($this->_getCollectionClass())
            ->addFieldToSelect('entity_id')
            ->addFieldToSelect('created_at')
            ->addFieldToSelect('order_id')
            ->addFieldToSelect('increment_id')
            ->addFieldToSelect('order_increment_id')
            ->addFieldToSelect('order_created_at')
            ->addFieldToSelect('state')
            ->addFieldToSelect('grand_total')
            ->addFieldToSelect('base_grand_total')
            ->addFieldToSelect('store_currency_code')
            ->addFieldToSelect('base_currency_code')
            ->addFieldToSelect('order_currency_code')
            ->addFieldToSelect('billing_name')
        ;
        $this->setCollection($collection);
        return parent::_prepareCollection();

How to add filter by order status?


texts: Header customization ( Container Height )

texts:
I'm using a custom theme, i would like to reduce the height of the mega menu container.
Could you please help me out ?
Please find the attached image.


texts: Magento 2 - How to override Admin Gallery.phtml in custom module

texts:
I am trying to override admin file,

module-product-video\view\adminhtml\templates\helper\gallery.phtml

I am not able to find layout file for this because it set inside the block called,

magento\module-catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content.php

Can anyone guide me?

Updated code:

etc/di.xml

<preference for="Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content" type="Bhupendra\Helloworld\Block\Adminhtml\Product\Gallery\Content" />

BLOCK:

<?php

namespace Bhupendra\Helloworld\Block\Adminhtml\Product\Gallery;

use Magento\Backend\Block\Media\Uploader;
use Magento\Framework\View\Element\AbstractBlock;

class Content extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content
{
    /**
     * @var string
     */
    protected $_template = 'Bhupendra_Helloworld::product/gallery.phtml';
}

Template:

module-product-video\view\adminhtml\templates\helper\gallery.phtml

to

view\adminhtml\templates\product\gallery.phtml


texts:
I have tried different options but i am not getting the current time, time shows the gmt time, but actual time setting is asia/kolkatta, any one done this, please update the answer.

protected $datetime;

public function __construct(Context $context,
        ObjectManagerInterface $objectManager,
        StoreManagerInterface $storeManager,
        \Magento\Framework\Stdlib\DateTime\DateTime $datetime
    ) {
        $this->objectManager = $objectManager;
        $this->storeManager  = $storeManager;
        $this->datetime      = $datetime;
        parent::__construct($context);
    }
$current_time   = $this->datetime->gmtDate();// this will return only gmt time

Not the time i have set in the admin configuration locale timezone.


texts:
When open Admin Panel -> Customers most of the attributes are encoded like this: "ad05fac20be580518ea1f5163f21a063". Hex strings.

Any idea where this comes from and how can I decrypt it?
I have used Enterprise_Pci_Encryption -> decrypt() but don't get correct results.


texts: Magento 2: How to redirect to checkout page after product added to cart via Observer/Plugin from category page?

texts:
I have followed below & it works fine

Magento 2 : Add to Cart Button redirect to contact page

Only issue it should be redirected after product is added to cart.

I have tried different methods but seems not working http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html

I tried using Observer but unable to redirect from Observer because of AJAX. It it's not AJAX then it works fine.

If somebody can guide how to redirect from Checkout page after product is added to cart. It would be better.

I'm using Porto Theme. So don't want to remove AJAX feature while Add to Cart

[UPDATE]

Through plugin I have achieved. Need to achieve something using Observer

public function afterExecute(\Magento\Checkout\Controller\Cart\Add $subject, $result) {
    $result = [];
    $result['backUrl'] = $this->url->getUrl('checkout');
    $subject->getResponse()->representJson($this->objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($result));
    return;
}


texts: Error in printing invoice from admin panel

texts:
I'm facing an error when I try to print new order invoice, error details are given below,

  There has been an error processing your request

Image is not a PNG:

Trace:
#0 /home/.../public_html/lib/Zend/Pdf/Resource/ImageFactory.php(54): Zend_Pdf_Resource_Image_Png->__construct('/home/orangesna...')
#1 /home/.../public_html/lib/Zend/Pdf/Image.php(124): Zend_Pdf_Resource_ImageFactory::factory('/home/orangesna...')
#2 /home/.../public_html/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php(158): Zend_Pdf_Image::imageWithPath('/home/orangesna...')
#3 /home/.../public_html/app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php(123): Mage_Sales_Model_Order_Pdf_Abstract->insertLogo(Object(Zend_Pdf_Page), Object(Mage_Core_Model_Store))
#4 /home/.../public_html/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php(119): Mage_Sales_Model_Order_Pdf_Invoice->getPdf(Array)
#5 /home/.../public_html/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php(489): Mage_Adminhtml_Controller_Sales_Invoice->printAction()
#6 /home/.../public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_InvoiceController->printAction()
#7 /home/.../public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('print')
#8 /home/.../public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#9 /home/.../public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#10 /home/.../public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#11 /home/.../public_html/index.php(87): Mage::run('', 'store')
#12 {main}

Error log record number: 887679800526


texts: Magento : How can I sort it by newest products instead of price or name for product list page?

texts: Is there any way to sort the products listing by newest?


texts: Magento 2 remove shipping and payment method step

texts:
I need to remove shipping and payment method from checkout because in a site client don't want payment and shipping method.

I used this link Remove Payment Method - Magento 2

How I can achieve it in Magento 2.?


texts:
I have been following this tutorial on how to create a custom product type, but I ran into a little issue on this point:

Example/Block/Adminhtml/Catalog/Product/Edit/Tab/Event.php online 101 Minute 3.59 of the Video. I can't seem to see the whole screen any assistance will be appreciated. Thanks

Tutorial Link: https://www.youtube.com/watch?v=sIygO91ejaE

so far this is my code.

   public function getTicketData()
{
    $linkArr = array();
    $tickets = $this->getProduct()->getTypeInstance(true)->getTickets($this->getProduct());
    foreach ($tickets as $ticket){
        $tmpTicketItem = array(
            'ticket_id' => $ticket->getId(),
            'title'     => $this->escapeHtml($ticket->getTitle()),
            'price'     => $this->getCanReadPrice() ? $this->getPriceValue($ticket->getPrice()),
            'sort_order'=> $ticket->getSortOrder(),
        );
        $linkArr[] = new Varien_Object($tmpTicketItem);
    }
    return $linkArr;
}


texts: SUPEE 8788 patch - 'Unserialize_Reader_Null'

texts:
After apply SUPEE 8788 patch error appears when you log in to the admin:

Fatal error: Class 'Unserialize_Reader_Null' not found in /var/www/html/lib/Unserialize/Reader/Arr.php on line 105

Magento 1.7.0.2 installed SUPEE 8788v2

This solution won't work: SOLVED: new Unserialize_Parser class throws exceptions on NULL values


texts: After successfully installing Magento 2.2.2 I can't connect to admin

texts:
I installed successfully Magento, but I can't connect to admin.

I am suspecting that this is because I chose HTTPS for both store and admin page while installing. I can connect to the store if I use HTTP but I can't with HTTPS.

But unfortunately I can't choose HTTP in admin, it reverts back to HTTPS, and I can't connect after all.


texts:
I upgraded Package for Magento CE 1.9.1 to 1.9.3 with Magento Connect Manager and have now Error 500 when trying to log into admin. Backup uploading did not seem to help. File permission with magento-cleanup.php.
Any help would be greatly appreciated!

2017-08-13T22:41:39+00:00 ERR (3): Warning: Invalid argument supplied for foreach()  in /html/{magento-directory}/app/code/local/TSM/Maian/Helper/Data.php on line 30
2017-08-13T22:41:39+00:00 ERR (3): Notice: Undefined variable: rootCatId  in /html/{magento-directory}/app/code/local/TSM/Quicksearch/Model/System/Config/Source/ListCategory.php on line 50
2017-08-13T22:41:39+00:00 ERR (3): Warning: Invalid argument supplied for foreach()  in /html/{magento-directory}/app/code/local/TSM/Maian/Helper/Data.php on line 30
2017-08-13T22:41:40+00:00 ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Model_Design_Package::getBaseDir() must be of the type array, none given, called in /html/{magento-directory}/app/design/frontend/tsm_maian/default/template/tsm/blocks/related2.phtml on line 64 and defined  in /html/{magento-directory}/app/code/core/Mage/Core/Model/Design/Package.php on line 318
2017-08-13T22:41:40+00:00 ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Model_Design_Package::updateParamDefaults() must be of the type array, null given, called in /html/{magento-directory}/app/code/core/Mage/Core/Model/Design/Package.php on line 320 and defined  in /html/{magento-directory}/app/code/core/Mage/Core/Model/Design/Package.php on line 298
2017-08-13T22:41:40+00:00 ERR (3): Notice: Undefined index: _type  in /html/{magento-directory}/app/code/core/Mage/Core/Model/Design/Package.php on line 322
2017-08-13T22:41:40+00:00 ERR (3): Notice: Undefined variable: class  in /html/{magento-directory}/app/design/frontend/tsm_maian/default/template/tsm/blocks/product-block.php on line 8
2017-08-13T22:41:40+00:00 ERR (3): Notice: Undefined variable: uniqued  in /html/{magento-directory}/app/design/frontend/tsm_maian/default/template/tsm/blocks/product-block.php on line 94


texts:
I have following error in apache2 error log

  Symbolic link not allowed or link target not accessible: /var/www/magento2/pub/static/frontend/Smartwave/porto_child/en_GB/fonts/opensans/regular/opensans-400.woff, referer: /magento2/pub/static/frontend/Smartwave/porto_child/en_GB/css/styles-m.css

Suggest some solution.


texts:
When I upgraded a store from 1.3.2.4 → 1.7.0.2, suddenly the transactional emails (order confirmations) have slightly different formatting, even though none of those settings changed.

See the example below:

Old transactional email

P.S. I removed the item names & SKUs deliberately.

Note the line item color coding & light blue headers / grand total rows & text formatting of Grand Total

New transactional email

Note how the previously light blue column header row is now grey, Grand Total row is no longer light blue or formatted

Where can I begin to look into this?


texts: How to make a parent category show every 3 rows of subcategory which sorted by price asc

texts:
i have to make a parent category show every 3 rows of subcategory which sorted by price asc, for example

cat1
  cat-A
  cat-B
  cat-C

if i click cat1 , the page will show

  cat-A-product1     cat-A-product2     cat-A-product3
      $1.00                $2.00             $3.00

  cat-B-product1     cat-B-product2     cat-B-product3
      $1.00                $2.00             $3.00

  cat-C-product1     cat-C-product2     cat-C-product3
      $1.00                $2.00             $3.00

  cat-A-product4     cat-A-product5     cat-A-product6
      $4.00                $5.00             $6.00

  cat-B-product4     cat-B-product5     cat-B-product6
      $4.00                $5.00             $6.00

What techniques i can achieve this?

----------------------update-----------------------
Added in class

public function getTotalPage () {
    $products = $this->getCategory()->getProductCollection();
    return count($products)/9;
}

->setPage($page, $this->getProductLimit());

phtml:

$subcategories = $this->getSubcategories();

$total = $this->getTotalPage()+1;

for ($i=1; $i<=$total; $i++) {

    if ($subcategories && count($subcategories) > 0 ) : ?>

        <?php foreach ($subcategories as $subcategory) : ?>

            <?php

            $products = $this->getProducts($subcategory,$i);

            ?>

                <?php if ($products && count($products)) : ?>

<a href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName()?>

                        <?php foreach ($products as $product) : ?>

                                <a href="<?php echo $product->getProductUrl()?>"><?php echo $product->getName()?>
                                <a href="<?php echo $product->getProductUrl()?>">
                                    <img src="<?php echo Mage::helper('catalog/image')->init($product, 'small_image')->resize(200);?>" alt="<?php echo $this->escapeHtml($product->getName())?>" />

                                <?php echo $this->getPriceHtml($product);?>

                        <?php endforeach;?>

                <?php endif;?>

        <?php endforeach ?>

    <?php endif;

}

i have to print all products in the category list, so i added a for loop try to print all pages attach one by one

$products = $this->getProducts($subcategory,$i);  not work , but

$products = $this->getProducts($subcategory,1);
$products = $this->getProducts($subcategory,2);

are ok. i can't getProducts dynamically. Even the $i is changed to 2, the program still print the first page. So if the for loop $i is 2, the program print the first product page twice.

--------------solved--------------------
            //$this->_products[$subcategory->getId()] = $products;
        }
        return $products;


texts:
Hello I want to get the coupon code in a plugin. My code is:

  private $logger;
  private $checkoutSession;

  public function __construct(
    \Psr\Log\LoggerInterface $logger,
    \Magento\Checkout\Model\Session $checkoutSession
  ){
    $this->logger = $logger;
    $this->checkoutSession = $checkoutSession;
  }
  public function beforePlaceOrder(\Magento\Quote\Model\QuoteManagement $subject, $cartId, ?\Magento\Quote\Api\Data\PaymentInterface $paymentMethod = null){
    $this->logger->debug("Before Place Order");
    $order = $this->checkoutSession->getLastRealOrder();
    $orderId=$order->getEntityId();
    $couponCode = $order->getCouponCode();
    $this->logger->debug($couponCode);
  }

But $couponCode is empty.

Can someone help me?

thank you in advance


texts:
When I try to apply the patch on my Magento application this is what I get:

[http]$ bash PATCH_SUPEE-10266_CE_1.9.2.4_v1.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Admin/Model/Session.php
patching file app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
patching file app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
patching file app/code/core/Mage/Adminhtml/Controller/Action.php
patching file app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
patching file app/code/core/Mage/Adminhtml/controllers/CustomerController.php
patching file app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
patching file app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
patching file app/code/core/Mage/Checkout/controllers/CartController.php
patching file app/code/core/Mage/Core/Model/Email/Template/Abstract.php
patching file app/code/core/Mage/Core/Model/File/Validator/Image.php
patching file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
patching file app/code/core/Mage/Core/etc/config.xml
patching file app/code/core/Mage/Rss/Helper/Data.php
patching file app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php
patching file app/code/core/Zend/Serializer/Adapter/PhpCode.php
patching file app/design/adminhtml/default/default/template/backup/dialogs.phtml
patching file app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml
patching file app/design/adminhtml/default/default/template/customer/tab/view.phtml
Hunk #1 FAILED at 70.
1 out of 1 hunk FAILED -- saving rejects to file app/design/adminhtml/default/default/template/customer/tab/view.phtml.rej
patching file app/design/adminhtml/default/default/template/login.phtml
patching file app/design/adminhtml/default/default/template/notification/toolbar.phtml
patching file app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml
patching file app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml
patching file app/design/adminhtml/default/default/template/resetforgottenpassword.phtml
patching file app/design/adminhtml/default/default/template/sales/order/view/history.phtml
patching file app/design/adminhtml/default/default/template/sales/order/view/info.phtml
patching file app/design/install/default/default/template/install/create_admin.phtml
patching file app/locale/en_US/Mage_Adminhtml.csv
patching file downloader/template/login.phtml

Anyone know what could be the cause of patch not applying in full and how to solve the issue?


texts: How does the "Add the Store Code To Url" work?

texts:
Is there any way to implement a similar one but concatenating some string to the default store code?

Example:
I go to site.com/code
but I want to show store view code = code1


texts: How to allow oneday delivery option for specific zipcodes?

texts: I need to allow oneday delivery option for specific zipcodes?


texts: Populate categories in custom backend configuration field

texts:
I can populate the options on the multiselect like this in image below

in my system.xml

                .....
                <custom_field_four>
                        <label>Custom Multiselect Field</label>
                        <frontend_type>multiselect</frontend_type>
                        <source_model>customconfig/options</source_model>
                        <sort_order>3</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Example of multiselect field.</comment>
                    </custom_field_four>
                   .....

And as according to source model, in the file  app/code/local/Mycorp/CustomConfig/Model/Options.php loading options

<?php
  class Mycorp_CustomConfig_Model_Options{

    public function toOptionArray()
    {
      return array(
        array('value'=>1, 'label'=>'One'),
        array('value'=>2, 'label'=>'Two'),
        array('value'=>3, 'label'=>'Three'),
        array('value'=>4, 'label'=>'Four')
      );
    }
  }

Now instead of loading these dummy options i need to populate all categories(Both used and not used in navigation) ?


texts: CSS and JS move to footer in Magento 2 like head tag

texts:
I  want to push some CSS and JS files in the footer like head in default.xml.

How can I  do that?


texts: Hi, I've deployed my Magento store (v2.1.9) and logged into the back end admin panel successfully. However none of the buttons are working, and I'm getting these two errors in my console. Does anyone have any idea the potential cause and/or fix? Thanks!


texts:
I want to remove SKU from all email to customer

1) I create folder and copy file to not edit core

/app/design/frontend/my-theme/default/template/email/order/items.phtml

2) Delete this code

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

but Sku is still showing on email

What should I do..?


texts: I am trying to identify where magento checks for priority while applying rules. Can you point me to the correct place and whether the rules are loaded based on priority? or it happens while rule application.


texts:
In the email sent to customer for order confirmation, product unit price does not show. I did the following changes, but I am facing these issues,

Order is being processed, but I am not being redirected to Thankyou page. Before implementing these codes, when I click Place Order it will redirected to Thank you page.
No email confirmation as well, before implementing this code, I received email confirmation as well.
When I click Place Order it does not take me to the next page which is Thank You page, instead it stays in the Place Order page, but the order is been processed shows in the admin section

1) app/design/frontend/base/default/template/email/order/items.phtml

I added Unit Price under SKU

<?php echo $this->__('Unit Price') ?>

app/design/frontend/base/default/template/email/order/items/order/default.phtml

Below this line:

<?php echo $this->htmlEscape($this->getSku($_item)) ?>

I added the following code:

 `

<?php
if ($this->helper('tax')->displaySalesPriceInclTax($_order->getStore())) {
$itemprice = $this->helper('checkout')->getPriceInclTax($_item) ;
echo $this->helper('checkout')->formatPrice($itemprice);
} else {
echo $this->helper('checkout')->formatPrice($_item->getPrice()) ;
}
?>

	`

app/design/frontend/base/default/layout/sales.xml

In "sales_email_order_items", I changed the colspan from 3 to 4

<action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>

and changed it to

<action method="setLabelProperties"><value>colspan="4" align="right" style="padding:3px 9px"</value></action>

Any help here? Thanks!


texts: When change a swatch option how to get a selected simple product in category product listing page in magento 2

texts:
When change a  swatch option how to get a selected simple product id from configurable in category product listing page in Magento 2

when I select a swatch option, I was get a option id, from the option id how to get a  simple product id from configurable product

Refer image : https://prnt.sc/ntsay1

code:

  app\code\Cm\Preorder\view\frontend\templates\product\list.phtml

    <script type="text/javascript">
requirejs(['jquery','underscore'], function(jQuery,_){
    jQuery(window).load(function(){
        jQuery( '[class*="swatch-opt"]' ).on('click', '.swatch-option', function() {

            selpro();

        });
    });
    function selpro () {
        var selected_options = {};
        jQuery('div.swatch-attribute').each(function(k,v){
            var attribute_id    = jQuery(v).attr('attribute-id');
            var option_selected = jQuery(v).attr('option-selected');
            // console.log(attribute_id, option_selected);
            if(!attribute_id || !option_selected){ return;}
            selected_options[attribute_id] = option_selected;
        });
             console.log(selected_options);

    }
});

</script>


texts:
I need to display the Order custom attribute values in magento2 admin re-order page.
I tried the code like

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $session = $objectManager->get('Magento\Checkout\Model\Session');

but didn't get any value. Can you please anyone help me.


texts: Create product collection in PHTML with filter based on Category ID

texts:
We want to get a Product Collection based on a filter with the category ID.

In our case, we have the desired Category with ID 43.

Our Call looks like this:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
$productcollection = $productCollection->create()
                    ->addAttributeToSelect('*')
                    ->load();

I tried it with ->addFieldToFilter('category', '43'), but it didn't worked for me. I also tried it with the following: ->addCategoriesFilter(['eq' => 43]), but that also don't work. With the last statement my Query looks like this:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
$productcollection = $productCollection->create()
                    ->addAttributeToSelect('*')
                    ->addCategoriesFilter(['eq' => 43])
                    ->load();

What am I doing wrong here?


texts: SQL STATE Error while setup:upgrade in magento 2.3

texts: Getting this error when adding the new module, i don't have this table in database but i am getting this error, anyone can help?


texts: How can we add configurable products programmatically in magento 2?


texts:
I need to block RSS pages in htaccess, most importantly these

/rss/catalog/new
/rss/catalog/notifystock

and

/index.phprss/catalog/notifystock

Especially the last one, as you can see it's /index.phprss/ without a slash in between, it works when added in front of domain name, I need to block it.

Could someone please add a rewrite code?


texts: Magento 2 credit memo API observer/plugin

texts:
I'm interested to know if an observer or plugin will be trigger if a credit memo is created via API rest example: POST /V1/creditmemo/refund OR POST /V1/invoice/{invoiceId}/refund
ref:https://devdocs.magento.com/swagger/#/salesRefundInvoiceV1

ref:https://devdocs.magento.com/swagger/#/salesCreditmemoManagementV1/salesCreditmemoManagementV1RefundPost

I basically need to check/detect for external parties creating refunds in my Magento application.

That said I need to catch data before or after observer/plugin method for a refund and probably just log it somewhere in a file in Magento.

Any one done it b4 ? any help appreciated.


texts: Modify the knockout script on the checkout onepage

texts:
I want to like the items that are in the customers cart when he tries to checkout.

Right now, it looks like this:

And code looks like this:

The questions is, how can I get the <a data-bind="href: $parent.url"> element to actually hold the products URL? How can take a look at $parent anyhow? We are using Magento 2.0.6.


texts: I can't Move attributes in Magento - Catalog - Attibutes - Manage Attributes 1.9.2.4

texts:
I can't move the attributes in magento to unassigned attribute
anyone knows the solution ?


texts: Does anyone have experience with an email marketing plug in that adds a discount to the cart if the user comes in from an email link?

texts: I am looking for a plugin that will add a discount to a cart if coming from a clicked link in a marketing email. May I ask for a recommendation?


texts: Multi store views(3) and same CartController, why in one of them getting "Please specify the product required option(s)."

texts:
I have added a same simple product with custom options in all three views and getting

  Please specify the product required option(s).

upon adding to cart in one of them. What could be the reason as all are using same controller?


texts: How search category by name or new attribute in magento 2

texts:
How to get category by name and custom attribute programmatically?

Custom attribute is val_code. Custom code was added using InstallData


texts: Added Extra White Space in Products Image

texts:
My Products Image is,

Note : View image as new tab in chrome

Note : View image as new tab in chrome

By default magento added white space.

Website View:


texts:
Hello Magento Experts,
I have a strange issue in one of my Magento1.9.x site. In the admin panel, when I log in and then I click Sales -> Orders -> Edit any pending order, I click on cancel, it just refreshed the page and nothing happens.
To debug further, I created a clone of the site, and uploaded it on my server, in that I fixed the cancel order issue and I was able to successfully cancel my order.
So I went on the live site and uploaded the same code there, but on live site, I got an error on clicking cancel button: Invalid Form key, please refresh the page.
What I fixed is below :
In file: app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php,
Before :
public function getCancelUrl()
{
return $this->getUrlSecure('*/*/cancel');
}

After :
public function getCancelUrl()
{
return return $this->getUrl('*/*/cancel');
}

Can someone please help me what can be the issue on live site?
Thank you.


texts: How to remove required and non-required fields in checkout for Magento 2?

texts:
I need to remove some fields in Magento 2 in the checkout, for example fax and other. At the same time, i need to remove also some required fields, for example e-mail. In my place some old people do not use e-mail, therefore when they place an order they type thier phone, so the manager call to customer to now details of order. So, in my situation, i need to make required only this field in checkout:

Telephone

And i need to shows only following fields as non-required:
 - Name, Surname
 - E-mail
 - City

So, totaly 4 fields must be shown to customer, and the others (fax, address, etc.) must be hidden (or better disabled).
I'm only begginer in Magento, so kindly ask you to give me some guide how can i do this and explain in details. Also, please, say to me all the path to file that i need to edit. I have some knowledge of PHP, for some CMS before i write modules, but a cannot understand which file to edit to hide and disable required fields in case of Magento 2. Thx.


texts: How to include configurable swatches in Best sellers / Cart cross sell / any custom listing

texts: How to include configurable swatches on other listing like cross sell , bestseller or in a custom module product listing ?


texts: Category Filter in add product option when creating order from backend

texts:
When i am creating an order from backend and clicking on add a product option its showing me all products and showing fields of id, product name, sku, price, select, qty to add ... what i want to do is to add a field and drop down filter for category so that i can easily get products from a particular category and will save time in selecting my required product to add in order ... i found the block file from where these fields are called Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid ..... can anbody please give me solution for this

below is screenshot for order add product option where i want to add category


texts: How to clear unused product cache in magento2.2.5?

texts:
My storage space increasing day by day at same time product cache too (50GB Reached).
I'm used bitnami magento - AWS ubuntu 16.04
"pub/media/catalog/product/cache"
How to clear the product cache without affect my magento site.


texts: Using Magento's ORM to Insert a Specific ID Field

texts:
Is there a way to use Magento's simple ORM (Mage_Core_Model_Abstract and Mage_Core_Model_Resource_Abstract) to insert model rows with a specific primary key?

For example, if I ran the following against an empty Magento system

Mage::getModel('core/website')->setData(array (
    'website_id' => 2,
    'code' => 'foo',
    'name' => 'Main Website',
    'sort_order' => 0,
    'default_group_id' => 1,
    'is_default' => 1,
));

I'd expect a new entry in the core_website table.  However, Magento silently does nothing here.

Digging into the resource, it looks like I'm falling afoul of this in the database resource class

#File: app/code/core/Mage/Core/Model/Resource/Db/Abstract.php
if (!is_null($object->getId()) && (!$this->_useIsObjectNew || !$object->isObjectNew())) {
    //update stuff here
}
else
{
    //insert stuff here
}

Because the model has an id (i.e. I'm inserting a specific ID), and because _useIsObjectNew is hard coded to false, my save request is always routed to the insert path.

Is there a way to force an insert with the default Magento models? (without a rewrite/class-replacement).

Yes, raw SQL is an option, but then event functionality gets lost.


texts: Performance impact of adding columns to Magento 2 sales order grid

texts:
During extension development, we've used the following method to add columns to the sales order grid in Magento 2

Add custom table to installation
Add sales_order_grid.xml to add new columns config
Use plugin on the CollectionFactory -> aroundGetReport, inside which we use join on our custom table

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<plugin
        name="sales_order_shipperhq_columns"
        type="Company\Module\Plugin\Order\CollectionFactory"
        sortOrder="100"
        disabled="false"
/>

$result = $proceed($requestName);
if ($requestName == 'sales_order_grid_data_source') {
    if ($result instanceof \Magento\Sales\Model\ResourceModel\Order\Grid\Collection) {
        $select = $result->getSelect();
        $select->joinLeft(
            ['our_order_table' => $this->_resource->getTableName('custom_sales_order_grid')],
            'entity_id' . '=our_order_table.' . 'order_id' ,
            []
        );

    }
}

We are seeing severe performance impacts on loading the sales order grid when these additional columns are in place on a "live store" with a modest number of orders.

I'm looking for some advice on how best to add these columns without impacting performance. We also want to avoid extending the core Magento tables: this would aid performance but breaks compatibility with Enterprise split database architecture.


texts: Remove specific word's from url using .htacsess

texts:
I'm trying to rewrite and remove some words from the URL using .htaccess.

I have en url like this:

  http://example.com/es/ropita-de-bebe/chica/vestidos.html/

and I want to leave it like this:

  http://example.com/es/ropita-de-bebe/vestidos.html/

I'm not very familiar with .htaccess rewrites,

Can someone help me.

UPDATE
I didn't find the working solution using the .htaccees, in general the answer worked (did change the url's), but as a result, all the pages showed 404.

Thanks,


texts: While editing the customer in backend throws exception in magento 2

texts: I am trying to edit the customer in backend, while clicking edit it thows the below exception


texts:
When I trying to open my magento2 live site it showing error

www.store.vidya.sg

  redirected you too many times. Try clearing your cookies.
  ERR_TOO_MANY_REDIRECTS".

I have clear the browser catch and cookies. But still not open.

Admin panel also not open.


texts: How to add new state name in checkout State/Province dropdown list?

texts:
How to add a new state name in the checkout  State/Province dropdown list?
we have used the Amasty_Chekout extension.
I want to add a new state name field, it is possible,

if it is possible in custom form?
Please help me on this.


texts:
There are basically two list_modes in product/list/toolbar .
I want to add a third mode Gallery mode so that switcher can switch between

1- Grid,
2- List,
3- Gallery when products are listed.
Is this can be done through xml or by adding a value in db as code ??


texts:
When I run this code in a customer_save_after observer

$customer2 = Mage::getModel('customer/customer')->load(73);
try{
  $customer2->setDomain("");
  $customer2->save();
}
catch(exception $e){
  Mage::log($e);
}

Domain is a custom attribute.

I get the following error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 130968 bytes)

It says the error comes from Zend (Date.php)

Does anyone know where this comes from? The above works fine outside of this observer.

I have set the max_memory in php.ini to 1gb.


texts: Uncaught SyntaxError: Unable to parse bindings. checkout

texts:
I am getting knockout js error on checkout page so order summary not display to customers at checkout page in order summary section. can anyone suggest how can I debug this.

Uncaught SyntaxError: Unable to parse bindings.
Bindings value: mageInit: {'collapsible':{'openedState': 'active', , 'active': true}}
Message: Unexpected token ,
    at new Function (<anonymous>)
    at createBindingsStringEvaluator (knockout.js:2624)
    at createBindingsStringEvaluatorViaCache (knockout.js:2615)
    at ko.bindingProvider.parseBindingsString (knockout.js:2601)
    at ko.bindingProvider.getBindingAccessors (knockout.js:2583)
    at ko.dependentObservable.disposeWhenNodeIsRemoved (knockout.js:2931)
    at evaluateImmediate (knockout.js:1737)
    at Object.ko.computed.ko.dependentObservable (knockout.js:1946)
    at applyBindingsToNodeInternal (knockout.js:2929)
    at applyBindingsToNodeAndDescendantsInternal (knockout.js:2854)


texts: Relationship between file in controller and button

texts:
I am newbie in Magento, I saw some sources and have a question is if we have an add product button in the interface add products as follows:

I also see that the NewAction file in the Controller that controls this button.

but I cann't find any relationship between the add product button and the NewAction file

  Is there a file naming convention in the controller that corresponds
  to the button in Magento?

Can anyone answer this for me?

I would be very excited if you explain further me the Edit, MassDelete,...  files in the Controller.

Thanks in advance!


texts: How to list products in 2 sets of ordered  list in list mode?

texts:
I have set the Category products to List mode which shows products inside ordered list  which shows one set of ordered list. I would like to make the 2 ordered list. How do I accomplish it?

Update:

Below is the screenshot of the products how I wanted to list them and a link to JSFIDDLE

http://jsfiddle.net/#&togetherjs=AgdLgQLA7o


texts:
Any body have an idea about this ... !! What can we do in Magento 1.9.x versions.
 Authorize developer refferaral url

  Authorize.Net is phasing out the MD5 based transHash element in favor
  of the SHA-512 based transHashSHA2. The setting in the Merchant
  Interface which controls the MD5 Hash option will be removed by the
  end of January 2019, and the transHash element will stop returning
  values at a later date to be determined.

Thanks in advance


texts: Best way to define status field in database tables

texts:
I find that status fields are defined in 2 ways.

int/smallint/tinyint : each value represent some status
varchar : We save status text in databse directly. In general practice Models are defined with CONTANTS for statuses which are responsible for bringing up text.

What is best way among these in what kind of conditions or is there any other way that I dont know?

And why in Magento we never use enum data type, which is oftenly used in other systems?


texts: Magento 2 : Installation issue in magento2.x (ver 2.0.70)

texts:
I am trying to install new Magento 2 version of 2.0.7 and getting this error in last step in installation.

[ERROR] exception 'LogicException' with message 'Unknown module in the requested list: 'Magento_BundleSampleData'' in /var/www/html/magento2_7/setup/src/Magento/Setup/Model/Installer.php:417
Stack trace:
#0 /var/www/html/magento2_7/setup/src/Magento/Setup/Model/Installer.php(378): Magento\Setup\Model\Installer->readListOfModules(Array, Array, 'enable_modules')
#1 /var/www/html/magento2_7/setup/src/Magento/Setup/Model/Installer.php(325): Magento\Setup\Model\Installer->createModulesConfig(Array)
#2 /var/www/html/magento2_7/setup/src/Magento/Setup/Controller/Install.php(103): Magento\Setup\Model\Installer->install(Array)
#3 /var/www/html/magento2_7/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82): Magento\Setup\Controller\Install->startAction()
#4 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#5 /var/www/html/magento2_7/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#6 /var/www/html/magento2_7/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#7 /var/www/html/magento2_7/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#8 /var/www/html/magento2_7/vendor/zendframework/zend-mvc/src/DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#9 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#10 /var/www/html/magento2_7/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#11 /var/www/html/magento2_7/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#12 /var/www/html/magento2_7/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /var/www/html/magento2_7/setup/index.php(31): Zend\Mvc\Application->run()
#14 {main}


texts: Add category attribute to custom attribute group

texts:
I try to create a category attribute in a Magento 2 install script (or how do we call these now?)

In Magento 1, I could specify anything as group and the group would be created. In Magento 2 this seems not to be the case anymore, so I created the group explicitly first:

$eavSetup->addAttributeGroup(
    Category::ENTITY,
    $eavSetup->getDefaultAttributeSetId(Category::ENTITY),
    'My group name',
    99
);
$eavSetup->addAttribute(
    Category::ENTITY,
    'my_attribute_code',
    [
        'type'              => 'int',
        'input'             => 'select',
        'source'            => Boolean::class,
        'label'             => 'My attribute',
        'group'             => 'My group name',
        'visible'           => 1,
    ]
);

The attribute and attribute group is created in the database (eav_attribute and eav_attribute_group, as well as the relation in eav_entity_attribute) but I still do not see the attribute in the backend. What am I missing?


texts: Magento 1: How can we use different Customer registration Page

texts: I have multiple stores and i want to use different registration pages with some custom attributes is it possible we can use multiple registration page?


texts: Magento2: How to apply cart rules by condition?

texts:
I have accessories category products. If I add only accessories category product in the cart then apply to no free shipping for accessories category products. If I add accessories category product and also add with other category product rules apply to free shipping.

Can you tell me how to add condition above method?


texts: Add row to order totals in Order Admin View

texts:
I would like to add a row with the sum of a custom column values to the order view totals.

If you look at the image you can understand better what I mean.

The problem is that I found the .phtml file to edit but I don't know how to add a method to make a Sum of the values of the "PREZZO LISTINO" column.

PREZZO LISTINO column is custom column made using a custom attribute value from products. It is the "cost" of the good (is how much I pay it from the wholesaler).


texts:
So i have worked out this bit of code here

<block class="Magento\Framework\View\Element\Html\Links" name="top.links">
  <arguments>
     <argument name="css_class" xsi:type="string">header links</argument>
  </arguments>
</block>

Is giving me Compare Products My Account My Wish List Create an Account Sign In, That's great but what i am now trying to do is to get them outside of

div class="page-wrapper"

header class="page-header"

div class="header content"

I cannot work out how to get them out, Any ideas would help me out a lot all.

Many Thanks

Edit

Ive worked out how to get them outside now but they wont show in order. Inside of my home.xml i have this

<referenceContainer name="page.wrapper">
    <container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>
     <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
    <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" />
</referenceContainer>

But that shows in the html as

div class="page-wrapper"
div class="topbar"

So its the wrong way around im going to go back through the manuals but i can't remember seeing how to sort this.


texts: How to remove suffix from name on the frontend

texts:
I am making a Magento webshop for company that has a tourboat. I wanted an option when the customer registers an account, where they can select if they have already been on a trip with this boat.

First, I wanted to make a module for this extra Customer Attribute, and create a checkbox on the registration page, but I didn't know how to do it, and the tutorials didn't help me either.

This is why I decided to use the suffix dropdown for this. Normally the suffix dropdown would contain suffixes like: Jr., Sr., etc.

Now, I want to change the default suffix dropdown to the two choices:

Yes, I have already been on a trip
No, this is my first trip

But, when I select the above, my name on the account page changes to (for example):

John Doe Yes, I have already been on a trip

or

John Doe No, this is my first trip

How do I remove this suffix from the frontend?
(Or, how do I add a 'yes / no' option as a custom customer attribute to the registration form)


texts: Magento 2.3 programmatically refresh smart rules without saving category

texts:
In my magento enterprice I have set a smart rule on a category (let's call it category B) which populates it's products with the product of another category (let' s call it category A). From backend everything works: I place a product in category A, save category A and when I switch to category B I see that the product is listed here too.
I want to achieve the same thing in a cron class so I used the CategoryLinkManagementInterface class to assign my products to category A:
*/ Magento\Catalog\Api\CategoryLinkManagementInterface */
$this->categoryLinkManagementInterface->assignProductToCategories($productSku, $CategoryIds);

This code partially works: if I check category A from backend, I can see my products listed in the category, but if I switch to category B the products aren't there. This happens (I think) because the rule is refreshed on the category save event but I have called no save method in my code.
Because I have tons of categories to process via cron, I'd really like to avoid saving each category one by one (it would increase the time the cron is working) so now I wonder:

Is there a way to refresh the category smart rule without saving the category?
if I cannot avoid saving the category, is there a quicker way of bulk-saving a bunch of categories all at once instead of going with the $categoryRepository->save($category)  method for each category one by one?

Basically, I'd like to do what we already do with the products. With products, we don't save the whole category, we just call the link interface and assign the products that way. I was hoping I could use a rule interface to refresh the rules in the same way but I have not been able to find such code.


texts: Custom admin form save blank date as 0000-00-00 00:00:00

texts:
I have built a grid and admin form for editing a custom table with two date fields: "date_start" and "date_end"

It is saving correctly and if I enter a date it will save the date as I enter it. however if I do not enter a date it will instead save the date as if it was the current date. I need it to save an empty date as either blank or 0000-00-00 00:00:00 as this is later used in a method where a blank or empty date means we are not filtering by date.

The functionality could be replicated by adding two booleans for each date that say if you are filtering by that date but I find that is not the preferred method to do this.

I am assuming it would have to be in the controllers save action in the following section

$postData = $this->_filterDates($postData, array('date_start', 'date_end'));

// date code goes here

$shiprate_model->addData($postData);

But I am not sure what method would be needed.

The only other place I could think of is the table structure but they already have a default set

`date_end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',

Solution

$date_start_null = false;
$date_end_null = false;

if(!$postData['date_start']) $date_start_null = true;
if(!$postData['date_end']) $date_end_null = true;

$postData = $this->_filterDates($postData, array('date_start', 'date_end'));

if($date_start_null) $postData['date_start'] = '0000-00-00 00:00:00';
if($date_end_null) $postData['date_end'] = '0000-00-00 00:00:00';

Was able to get it working using a mixture of the solutions bellow, thanks for the help


texts:
How to create a new attribute with two text fields for product in admin

Please find the below screenshot