texts:
I've created a custom validator following this official guide but I'm getting this error and the checkout page gets broken:

"script error for: StoreLocator/js/view/store-code-validator"

I have added in the composer.json module:

"require": {
    "magento/module-checkout": "100.1.*"
}

In StoreLocator/view/frontend/web/js/model/validate-store-code.js:

define(
    [],
    function () {
        'use strict';
        return {
            /**
             * Validate store code before placing any order
             *
             * @returns {boolean}
             */
            validate: function() {
                return true;
            }
        }
    }
);

In StoreLocator/view/frontend/web/js/view/store-code-validator.js:

define(
[
    'uiComponent',
    'Magento_Checkout/js/model/payment/additional-validators',
    'StoreLocator_StoreLocator/js/model/validate-store-code'
],
function (Component, additionalValidators, validateStoreCode) {
    'use strict';
    additionalValidators.registerValidator(validateStoreCode);
    return Component.extend({});
});

Then I call the validation in StoreLocator/view/frontend/layout/checkout_index_index.xml like this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="billing-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="payment" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="additional-payment-validators" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <!-- Declare your validation. START -->
                                                                <item name="validate-store-code" xsi:type="array">
                                                                    <item name="component" xsi:type="string">
                                                                        StoreLocator_StoreLocator/js/view/store-code-validator
                                                                    </item>
                                                                </item>
                                                                <!-- Declare your validation. END -->
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>


texts:
I have an extension that has some code to save a custom object via REST API service.

I have a try and catch (\Exception $e) around the save method, but for some reason I get the following message:

{
    "message":"Internal Error. Details are available in Magento log file. Report ID: webapi-5c481b2831e76"
}

The log shows:

main.CRITICAL: Report ID: webapi-5c481b2831e76; Message: Property "aaa" does not have corresponding setter in class "Company\Module\Api\Data\MyCustomClass"

I assume the error is being thrown from within the REST API code - because the object (which is in the method signature) is not able to be instantiated.

So how to catch this.


texts:
I need to change the new order email. I need to edit this information:

Subtotal (Excl. Tax)

Subtotal (Incl. Tax)

Shipment (Excl.Tax)

Shipment (Incl.Tax)

Total
And this is in: design/frontend/default/mytheme/template/email/order/items.phtml

Here I need to edit this: $this->getChildHtml('order_totals');

Because this function is where appears the table with all prices and tax. Where is this information? In a layout? or in a phtml?


texts: VirtualType not created / class not found (after cache clear)

texts:
Virtual Type XML Declaration:

<virtualType name="SliderSlideImageUploader" type="Magento\Catalog\Model\ImageUploader">
    <arguments>
        <argument name="baseTmpPath" xsi:type="string">pub/media/tmp/slider/images</argument>
        <argument name="basePath" xsi:type="string">pub/media/slider/images</argument>
        <argument name="allowedExtensions" xsi:type="array">
            <item name="jpg" xsi:type="string">jpg</item>
            <item name="jpeg" xsi:type="string">jpeg</item>
            <item name="gif" xsi:type="string">gif</item>
            <item name="png" xsi:type="string">png</item>
        </argument>
    </arguments>
</virtualType>

Dependency Injection:

public function __construct(
    \Magento\Backend\App\Action\Context $context,
    \SliderSlideImageUploader $imageUploader
) {
    parent::__construct($context);
    $this->imageUploader = $imageUploader;
}

I have tried \SliderSlideImageUploader and SliderSlideImageUploader for the constructor class.

I have cleared the cache with bin/magento cache:flush, uninstalled and reinstalled the module...

I have deleted all of var/generation.

Result:

Exception #0 (RuntimeException): Class Vendor\Slider\Controller\Adminhtml\Slide\Image\SliderSlideImageUploader does not exist

Exception #0 (RuntimeException): Class Vendor\Slider\Controller\Adminhtml\Slide\Image\SliderSlideImageUploader does not exist

My only idea now is that it is failing because Magento_Catalog is not in my module.xml sequence.

Anyone have any ideas?

This could potentially solve my problem, testing now:
Receiving object specific class which was injected in constructor by three-part extension


texts: How to configure .csv table rates weight

texts:
I will set the delivery cost depending on the weight of the product.

I have created the tablerates.csv file on generator: https://www.elgentos.nl/tablerates/

I need to configure it in this way(sample):

Country: Czech Republic
Total order basket weight: 50kgs
Delivery cost to the Czech republic for order 50kgs: 300 euro

Country: Poland
Total order basket weight: 50kgs
Delivery cost to Poland for order 50kgs: 100 euro

Can anyone help set up my file tablerates.csv?


texts: Product attribute label not showing correctly

texts: Any help greatly received - I have a configurable product (trousers) with three attributes, waist, leg and colour.  When this displays on the product page the drop downs are fine but I get the labels showing leg, leg, waist instead of waist, leg and colour e.g. visit http://tuffstuff-workwear.co.uk/060814/tuffstuff-trouser-extreme-1024


texts: How to manually convert a series of quotes to invoices (orders)

texts:
For about 24 hours yesterday we were experiencing an issue where Magento could not create new invoices. It has since been resolved but I now have a series of orders (22) that are trapped in the sales_flat_quote tables. The customers' credit cards have been charged however their orders are not showing up in our order grid. I need to get these quotes out of limbo and into the order phase.

I initially tried switching sales_flat_quote.is_active to 0 but it requires more than that for Magento to move data to the sales_flat_order tables. Any idea how to proceed?

UPDATE: Currently investigating a programmatic approach that might trigger Magento quotes to be processed: http://inchoo.net/magento/programmatically-create-order-in-magento/


texts: Magento 2 : Getting error message on fishpig wordpress post view page after compilation

texts:
I'm getting following error after compilation on Fishpig Wordpress post view page, but error were removed when I remove /var/di directory.
But I need this to working fine after compilation.

  Fatal error: Call to undefined method
  FishPig\WordPress\Model\App::init() in
  /app/code/FishPig/WordPress_ACF/Helper/Core.php(1)
  : eval()'d code on line 21

I'm using Magento 2.1.7 and WordPress_ACF 1.0.0.23


texts:
When an order is placed, the date in the Magento backend is correct. When I check the database however, the timestamp is 2 hours earlier. The server time is correct, timezone in PHP and Magento backend is set to Europe/Brussels, which is correct. If I add a record in the database (Sequel Pro) with NOW(), date is also correct.

What am I missing here?
Must be Magento, right?


texts: restrict the "textfield" to accept only digits and maximum 10 digits in magento form

texts:
here is a code : http://pastebin.com/qCNGSKRn to display telephone filed to enter telephone number.

i want to restrict above field to accept only numbers and also maximum 10 numbers to be entered. all special charactars and special symbols and white spaces should not allowed.

that field should not accept more than 10 digits.

please help me to find solution.


texts: Can't override list.phtml in Magento 2.1.6

texts:
I'm trying to override Magento_Catalog list.phtml in magento 2.1.6 and it's not working. I have a theme working and others templates and layouts overrides are working correctly.

My custom list.phtml is here:

app\design\frontend\vendor\theme\Magento_Catalog\templates\product\list.phtml

If I remove "category.product.list" in my "catalog_category_view.xml" in

app\design\frontend\vendor\theme\Magento_Catalog\layout

with this funcion:

<referenceBlock name="category.products.list" remove="true" />

product grid disappears.

I've tried also to disable modules but it's not working.

I'm doing tests modifying list.phtml line 68 link class:

    <a class="product-item-link test"

And in my grid isn't showing this change.


texts: Order collection issue when filtering with created_at

texts:
I have a cron job to cancel orders with status pending after few hours of order creation.
$paymentMethod  = 'my_method';

$collection = $this->_orderCollectionFactory->create()->addAttributeToSelect('*');

$collection->getSelect()->join(
    ["sop" => "sales_order_payment"],
    'main_table.entity_id = sop.parent_id',
    array('method')
    )
    ->where('sop.method = ?',$paymentMethod);

$collection->addFieldToFilter('created_at', ['lteq' => $end_date]);
$collection->addFieldToFilter('state', ['eq' => 'new']);
$this->_logger->info($collection->getSelect());

foreach($collection as $_order) {
    $ordercomment = "Cancelling order since no payment";
    $order        = $this->orderFactory->create()->loadByIncrementId($_order->getIncrementId());
    $order->addStatusHistoryComment($ordercomment)->save();
    $this->orderManagement->cancel($_order->getId());
    $this->_logger->info("Cancel Pending Order - ".$_order->getIncrementId());

} // end of foreach orders

The select query prints like below...
SELECT `main_table`.*, `sop`.`method` FROM `sales_order` AS `main_table` INNER JOIN `sales_order_payment` AS `sop` ON main_table.entity_id = sop.parent_id WHERE (sop.method = 'my_method') AND (`created_at` <= '2021-04-22 08:48:06') AND (`state` = 'new');

When i am trying this query in mysql terminal, results are fine with date and time range.
But getting invalid date range rows when looping through foreach. eg: a row with created_at as '2021-04-22 05:52:18' ;
what will be the reason ?
Update
Just noticed, cron logs showing UTC time. But actually server, mysql and magento set with a different timezone.
This time difference has an impact on the above result. Because when printing the created_at, it shows that difference.
It's not printing same as what in database.


texts: How to remove static block in default_head.xml file?

texts:
First of all I am adding a template file in default_head.xml file.
In Template file i am calling a block using idetifier.
Now I want to remove block
In defaul_head.xml file

<referenceBlock name="ves.wizz">
   <arguments>
      <argument name="template" xsi:type="string"> Magento_Theme::html/wiz.phtml</argument>
   </arguments>
</referenceBlock>
<referenceBlock name="ves.wizz" remove="true" />


texts: How to hide upload file field using jquery in magento2

texts:
I want to hide upload file filed using jquery in magento2

    <field name="type">
                <argument name="data" xsi:type="array">
                    <item name="options" xsi:type="object">Ktpl\BannerManagement\Model\Config\Source\Type</item>
                    <item name="config" xsi:type="array">
                        <item name="label" xsi:type="string">Type</item>
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="dataType" xsi:type="string">select</item>
                        <item name="formElement" xsi:type="string">select</item>
                        <item name="dataScope" xsi:type="string">type</item>
                        <item name="component" xsi:type="string">Ktpl_BannerManagement/js/form/element/element</item>
                    </item>
                </argument>
            </field>
      <field name="default_image">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="elementTmpl" xsi:type="string">Ktpl_BannerManagement/form/element/defaultTemplate</item>
                        <item name="additionalClasses" xsi:type="string">bannerdefaultimageClass</item>
                    </item>
                </argument>
            </field>

code in js:

     var field4 = jQuery('body').find(".bannerimageClass");

        if (value == 1) {
            field4.hide();
        } else {
            field4.show();
        }

but it not working


texts: How to check if APC caching is working in Magento

texts: I have APC set up and installed in Magento. I was wondering if there is a way I can confirm it is caching and working correctly. The pages seem to be loading fine, but I need to verify.


texts: Check which modules are observing an event

texts:
How can see if some extension is observing the product_save_after event?

The problem is that my "Special price From" field seem to be connected to the "New product from" field, if I put a Special price automatically the "New product from" field will be filled so I was wondering if there are something that I can check to see this kind of automatic connections.


texts:
I created an observer to update the product, but it is not entering it.

  config.xml:

<cataloginventory_stock_item_save_after>
    <observers>
        <gestaobox_api>
            <class>Gestaobox_Api_Model_Observer</class>
            <method>SaveStockInventory</method>
            <type>singleton</type>
        </gestaobox_api>
    </observers>
</cataloginventory_stock_item_save_after>

  Observer.php:

public function SaveStockInventory(Varien_Event_Observer $event)
{
    $id = $event->getEvent()->getProduct()->getId();

    Mage::log($id, null, "testeStock.log");

    $product = Mage::getModel('catalog/product')->load($id);
    $name = $product->getName();
    $product->setName($name);
    $product->save();
}


texts:
public function getStatusLimit($array = array()) {
    $this->getSelect()->reset()
        ->union(
            $array
        );

    return $this;
}

$this->_collection->getStatusLimit(array($this->getCollection1()->getSelect(),$this->getCollection2()->getSelect()));

result of query

SELECT `main_table`.*, (SELECT COUNT(*) FROM gn_daily_bidding_history WHERE gn_daily_bidding_history.msisdn_id = main_table.msisdn_id) AS `total_bids`, (SELECT COUNT(DISTINCT(customer_id)) FROM gn_daily_bidding_history WHERE gn_daily_bidding_history.msisdn_id = main_table.msisdn_id) AS `total_bidders` FROM `gn_msisdn_bid_list` AS `main_table` WHERE (cat_id = '3') AND (msisdn_status = '1') AND (bid_start <= '2016-07-12 04:50:30') AND (bid_status != 1) AND (bid_status = 2) AND (bid_end >= '2016-07-12 04:50:30') ORDER BY `main_table`.`bid_end` desc

UNION

SELECT `main_table`.*, (SELECT COUNT(*) FROM gn_daily_bidding_history WHERE gn_daily_bidding_history.msisdn_id = main_table.msisdn_id) AS `total_bids`, (SELECT COUNT(DISTINCT(customer_id)) FROM gn_daily_bidding_history WHERE gn_daily_bidding_history.msisdn_id = main_table.msisdn_id) AS `total_bidders` FROM `gn_msisdn_bid_list` AS `main_table` WHERE (cat_id = '3') AND (msisdn_status = '1') AND (bid_start <= '2016-07-12 04:50:30') AND (bid_status = 3) AND (bid_end <= '2016-07-12 04:50:30') ORDER BY `main_table`.`bid_end` desc

not wrapping with query with "()"


texts: Prevent Magento setup resources from running automatically

texts:
What is the setting within app/etc/local.xml to prevent setup resources from being triggered to run automatically?

I have seen this somewhere but cannot locate it now.


texts: How can I change the status using mass update function?

texts:
Hi all I am able to create a admin grid for my custom module. In this grid I also provide the mass update functionality, and everything is working fine, thanks to some good tutorials on the internet.
The thing is when I use ->setStatus($this->getRequest()->getParam('status'))to set the status for my grid, it is not working, I don't know why ?
so I do it like this ->setStatus('Active') or ->setStatus('Inactive') to change the status for the table values.
I am a new in magento so maybe I didn't understand it properly.
Can anyone tell me why it is not working.
Here is my function in my Grid.php

protected function _prepareMassaction()
{
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setFormFieldName('id');

$this->getMassactionBlock()->addItem('active', array(
'label'=> 'Active',
'url'  => $this->getUrl('*/*/massActive', array('' => ''))
));

$this->getMassactionBlock()->addItem('inactive', array(
'label'=> 'Inactive',
'url'  => $this->getUrl('*/*/massInactive', array('' => ''))
));

$this->getMassactionBlock()->addItem('delete', array(
'label'=> 'Delete',
'url'  => $this->getUrl('*/*/massDelete', array('' => '')),
'confirm' => 'Are you sure?'
));

return $this;
}

and here is my controller function.

public function massActiveAction()
{
$catIds = $this->getRequest()->getParam('id');
if (!is_array($catIds)) {
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
} else {
try {
foreach ($catIds as $catId) {
Mage::getSingleton('blog/blog')
->load($catId)
->setStatus('Active')
->setIsMassupdate(true)
->save();
}
$this->_getSession()->addSuccess(
$this->__('Total of %d record(s) were successfully updated', count($catIds))
);
} catch (Exception $e) {
$this->_getSession()->addError($e->getMessage());
}
}
$this->_redirect('*/*/index');
}


texts: How to configure a 360 degree view to Product images?

texts:
I have to create a store with Products having 180 as well as 360 Degree View.
I had gone through many extensions like magic 360 and many more but Cant find anything relevant.

I wish to use the free and effective extension for my purpose.
Even if you are able to provide some paid solutions or magento tweeks you are welcome.

Also can you let me know about the how to change the product image if one of the attribute is changed in configurable product.(Except the color swatches because it is built in feature of magento.)


texts:
I find myself doing the same changes on my products again and again. Very often, the same products end up reverting product descriptions to what they where before I changed them, or even keep deactivating themselves.

How can this make any sense?


texts:
I'm trying to display an image from a phtml file. The following doesn't work.

<?php <img src="<?php echo $adress ;?>" /> ?>

Could you help me ?


texts: How to exclude third party extensions while upgrading magento 2.3.3 to 2.3.6?

texts:
I am upgrading Magento from 2.3.3 to 2.3.6 but one of my third-party extension is looking for an update from GitHub but that extension is not available in GitHub so I want to exclude that particular extension from an update.
For reference please please find the attached image.


texts: Inputting a suit as a product... option to choose different jacket and trouser size

texts:
Previously we had only used Config products in Magento. However we have taken delivery of suits and I want to offer these as a jacket and a trouser (Can only buy both from the same product page). However, I want users to be able to choose their jacket size and trouser size and manage stock.

I've tried to setup via as a config product, but can't manage stock this way as the product is fixed and users can't mix and match. I've played around with 'Grouped' and 'Bundled' products but not to much success.


texts: How to create my custom visual swatch color attribute in my own module Vendor/Module/Setup/Patch/Data/MyOwnColorAttribute?

texts:
I take from https://github.com/magento/magento2/blob/2.3/dev/tests/integration/testsuite/Magento/Swatches/_files/product_visual_swatch_attribute.php like example, but my own color attribute patch didn't create any options if I add those parameters. This is my code:
<?php
namespace Vendor\Module\Setup\Patch\Data;

use Magento\Catalog\Model\Product;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Eav\Model\Entity\Attribute\Source\Table;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Vendor\Module\Model\Attribute\Backend\Color as Backend;
use Vendor\Module\Model\Attribute\Frontend\Color as Frontend;

class AddColorAttribute implements DataPatchInterface
{
    /**
     * @var ModuleDataSetupInterface
     */
    private $moduleDataSetup;

    /**
     * @var EavSetupFactory
     */
    private $eavSetupFactory;

    /**
     * @param ModuleDataSetupInterface $moduleDataSetup
     * @param EavSetupFactory $eavSetupFactory
     */
    public function __construct(
        ModuleDataSetupInterface $moduleDataSetup,
        EavSetupFactory $eavSetupFactory,
    ) {
        $this->moduleDataSetup = $moduleDataSetup;
        $this->eavSetupFactory = $eavSetupFactory;
    }

    /**
     * @inheritdoc
     */
    public function apply()
    {
        $this->moduleDataSetup->startSetup();
        $eavSetup = $this->eavSetupFactory->create();
        $eavSetup->addAttribute(Product::ENTITY, 'visual_swatch_color_attribute', [
            'type' => 'int',
            'label' => 'Visual Swatch Color Attribute',
            'input' => 'select',
            'frontend' => Frontend::class,
            'backend' => Backend::class,
            'source' => Table::class,
            'required' => false,
            'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
            'visible' => true,
            'is_used_in_grid' => true,
            'is_visible_in_grid' => true,
            'is_filterable_in_grid' => true,
            'user_defined' => true,
            'searchable' => true,
            'filterable' => true,
            'comparable' => true,
            'visible_on_front' => true,
            'used_in_product_listing' => true,
            'is_html_alowed_on_front' => true,
            'unique' => false,
            'swatch_input_type' => 'visual',
            'swatchvisual' => [
                'value' => [
                    'Obsidian' => '#3a322d',
                    'Pure' => '#0000ff',
                    'Crimson' => '#dc143c',
                    'Emerald' => '#50c878',
                    'Ametyst' => '#9966cc',
                ],
            ],
            'optionvisual' => [
                'values' => [
                    'Obsidian' => ['Obsidian'],
                    'Pure' => ['Pure'],
                    'Crimson' => ['Crimson'],
                    'Emerald' => ['Emerald'],
                    'Ametyst' => ['Ametyst'],
                ],
            ],
            'default' => '1'
        ]);

        $eavSetup->addAttributeToGroup(
            \Magento\Catalog\Model\Product::ENTITY,
            'Default',
            'Product Details',
            'visual_swatch_color_attribute',
            18
        );
        $this->moduleDataSetup->endSetup();
    }

    /**
     * @inheritdoc
     */
    public static function getDependencies(): array
    {
        return [];
    }

    /**
     * @inheritdoc
     */
    public function getAliases(): array
    {
        return [];
    }
}


texts: Magento 1.9.01 (patched) Trouble with onepage checkout

texts:
Am having trouble with the onepage checkout on an installation of Magento 1.9.0.1.  Where the response of  /checkout/onepage/saveBilling is blank.  Form details are being passed through but the script effectively bombs out at a key point.

In

  OnepageController.php

$result = $this->getOnepage()->saveBilling($data, $customerAddressId);

just ends here.  I have added a lot of Mage::log()  into the Checkout/Model/Type/Onepage.php   saveBilling  function  and it seemingly gets all the way to the

return array();

  public function saveBilling($data, $customerAddressId)
  {
   ...
  Mage::log("this logs ok and data seems to be set prior",null,"mymag.log");
  return array();    // this seems to cause the process to stop
  Mage::log("Should have already returned an array() and not get here - this does not log",null."mymag.log");
  }

However  back in the Onepagecontroller.php

a   Mage::log() after the function call does not run

Mage::log("about to call saveBilling - this log works",null,"mymag.log");
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
Mage::log("this does not log...WHY!?!",null,"mymag.log");

Have spent ages trying to get this to work....help please


texts: change input renderer which already added by setup script

texts:
I have a custom setup script in a module like this

<?php

$installer = new Mage_Catalog_Model_Resource_Setup('core_setup');
$installer->startSetup();

$attributeSetDefault = 'Default';
$attributeGroup = 'test';
$attributeSetId = $installer->getAttributeSetId('catalog_product', $attributeSetDefault);
if ($attributeSetId) {
    $attributeGroupId = $installer->getAttributeGroupId('catalog_product', $attributeSetId, $attributeGroup);
}

// Attribut : Barcode EAN13
$attributCode = 'barcode_ean13';
$installer->removeAttribute('catalog_product', $attributCode);
$attribute = $installer->getAttribute('catalog_product', $attributCode);
if (empty($attribute['attribute_id'])) {

    $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, $attributCode, array(
        'type' => 'varchar',
        'input' => 'text',
        'backend' => '',
        'input_renderer' => 'test_catalog/adminhtml_product_helper_form_barcodeean13', //definition of renderer
        'label' => 'Barcode EAN13',
        'class' => '',
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'visible' => true,
        'required' => false,
        'user_defined' => true,
        'searchable' => false,
        'filterable' => false,
        'comparable' => false,
        'visible_on_front' => false,
        'unique' => false,
        'apply_to' => 'simple',
        'configurable' => false,
    ));

    $attributeId = $installer->getAttributeId('catalog_product', $attributCode);

    if ($attributeGroupId && $attributeId) {
        $installer->addAttributeToGroup('catalog_product', $attributeSetId, $attributeGroupId, $attributeId);
    }
}
$installer->endSetup();

My questions are:

How 'input_renderer' => 'test_catalog/adminhtml_product_helper_form_barcodeean13', //definition of renderer added in database? Where can i find this in database?
How to change the value of input_renderer? (the setup script was already ran)


texts: Magento 2 - Module Instalation without CLI

texts:
Hey guys I have created a php file in the public_html folder and writed the following code:

<?php system('php bin\magento module:enable Wisedat_PDFInvoiceFile');
system('php bin/magento setup:upgrade'); // You can change command as
you want.

And when I go to run the command in http://mydomain/command.php

the only thing that show´s up is a blank page !!

Can someone help?

Thanks


texts:
We have a multistore magento setup thats still half in development. But we have 1 of the stores open with a test url.

e.g test.domain.com

However when we go to: http://test.domain.com/index.php/api/index/?wsdl=1
I noticed that soap:address shows the main domain not the api url e.g:

<soap:address location="https://www.domain.com/index.php/api/index/index/?SID=vnl0ijdobf6ldj76pmc658rj92"/>

Which atm isn't live.
We have no issues with 3rd parties who come in on the V2 api but this doesn't seem to have a soap:address which I believe is the problem.

When I go to: http://test.domain.com/index.php/api/index/?wsdl=1 in a browser it shows xml.
When I try and make a soap call i get: looks like we got no XML document.

When I update my local hosts file with the new ip to point at the domain it will work.
But the 3rd party can't update their server because its shared hosting. Is there a way to change the API to point at the api url and not the base store url?


texts: If request path is already exist what should i do for redirecting url with 301?

texts:
How to rewrite URL with 301 redirecting if request path and id already exist.

There is any other option to do that or can we do with .htaccess file?


texts: Block not able to load in the Controller

texts:
$this->loadLayout();
    $sidebar_blocks = $this->getLayout()->getBlock('catalog.compare.list');
    $sidebar_blocks->setTemplate('catalog/product/compare/list.phtml');
    $sidebar = $sidebar_blocks->toHtml();
    $sidebar = $this->renderLayout();

setTemplate on a nonObject error.

I am trying to load this block in the controller function.


texts: CE 1.9.2.4 - Unreachable code in Core JavaScript files

texts:
On any category or product detail page that has a configurable product on it, I detect the following errors show up in the these files:

/js/varien/configurable.js : unreachable code after return statement, line 291
/js/varien/product.js : unreachable code after return statement, line 485
/js/calendar/calendar.js : unreachable code after return statement, line 138

In product.js the block of code in question is:

reloadPrice: function(){
    var price    = 0;
    var oldPrice = 0;
    for(var i=this.settings.length-1;i>=0;i--){
        var selected = this.settings[i].options[this.settings[i].selectedIndex];
        if(selected.config){
            price    += parseFloat(selected.config.price);
            oldPrice += parseFloat(selected.config.oldPrice);
        }
    }

    optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
    optionsPrice.reload();

    return price;

    if($('product-price-'+this.config.productId)){
        $('product-price-'+this.config.productId).innerHTML = price;
    }
    this.reloadOldPrice();
},

configurable.js is exactly the same as this, and calendar.js has a similar block of code with a return in the middle.

Now to me, it just seems a bit odd that there is a return in the middle of the function, instead of at the end or with a conditional statement wrapped around it. I'm considering moving the return to the end of the function block, or wrapping it in a conditional statement like if (price > 0) return price;

I know they are core files so I shouldn't be tinkering, but any advice/suggestions?


texts:
Magento 2 require js throw error

I am using Magento 2.2.0

var config = {
    paths: {
            'owlcarousel': "Module_Banners/js/owl.carousel.min",
            'custom': "Module_Banners/js/sp_banner"
        },
    shim: {
        'owlcarousel': {
            deps: ['jquery']
        }
    }
};

  Uncaught Error: Script error for: owlcarousel
  http://requirejs.org/docs/errors.html#scripterror
      at makeError (require.js:166)
      at HTMLScriptElement.onScriptError (require.js:1681)


texts: Images not showing on configurable products

texts:
I have all of the needed attributes in the attribute set, but none of the images are showing on configurable products.
They're visible on the backend, and I see them when I add the images to the cart, they just won't show up in gallery or product view.
What can I do about this?
There's a $fotoramaElement.fotorama is not a function error in the console which I think is related, but I don't know how to fix it
In my child theme requirejs-confing.js I added this, but it's not doing anything.
var config = {
    paths: {
        'fotorama/fotorama':  'fotorama/fotorama'
    },
    shim: {
        'fotorama/fotorama': {
            deps: ['jquery']
        },
    },

Thanks


texts: OnePage Checkout blank page after step 5 (no errors)

texts:
I have a very strange and redundant error on the OnePage Checkout of a Magento shop (ver. 1.9.3.6). After step 5 (Payment Information) I have a blank page only displaying the contact e-mail Address. It should show the order overview.
I viewed the console for any errors, checked server side error logs, activated and checked the Magento error log and update the index.php and changed PHP settings to display errors. Nothing! Not one error.
I've also wiped the cache and session files.
I'm totally clueless what the issue could be. I even copied onepage.phtml from base to the theme folder.
Also changed the PHP Version from 5.6.* to 7.0.* and updated memory_limit to 512M and max_execution_time to 600.

Any suggestions what I could try to solve the issue? Thanks in advance.


texts: Customer Forgot Password Rest Api In Magento 2

texts:
I am using magento 2 rest api,
when I try to run forgot password api for customer, it is showing an error message.

{"message":"Invalid value of \"%value\" provided for the %fieldName field.","parameters":{"value":"forgot_password","fieldName":"email type"}

I am using below api to send forgot password to user:
{base-url}/rest/V1/customers/password

I have created email template with name forgot_password

I am sending three parameters:
email,template and website

I would be great if anyone can help.


texts:
I want to separate the price and decimals, to use this html for the price 49,95.

49,
 95

I currently use this line to load the price:

<?php echo substr($_product->getPrice(), 0, -2) ?>

How can I fix that?


texts: How to override one method by two module

texts:
It is possible to override one method from core mode by two module.
I have two module that overrides send mail method and I can not combine these methods because each one does different another and is it a way to I keep methods?


texts:
The size of catalog_product_link in my magento database is 2.5 G with almost 22.7 million rows. My magento store has 190K products.

Is it normal to have such a large table for this number of products ?


texts: Magento2 Upgrade Data script for custom module

texts:
I am working on installer and upgrade script of Magento 2 In which my InstallSchema, UpgradeSchema and InstallData scripts are working but UpgradeData.php is not working.

Please check the following code and please help me to trace out the issue.

namespace Foggyline\Office\Setup;

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

class UpgradeData implements UpgradeDataInterface
{
    protected $departmentFactory;
    protected $employeeFactory;

    public function __construct(
        \Foggyline\Office\Model\DepartmentFactory $departmentFactory,
        \Foggyline\Office\Model\EmployeeFactory $employeeFactory
    )
    {
        $this->departmentFactory = $departmentFactory;
        $this->employeeFactory = $employeeFactory;
    }

    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        /**************************************/
        //      Start Of Table Department     //
        /**************************************/

        $salesDepartment = $this->departmentFactory->create();
        $salesDepartment->setName('Sales');
        $salesDepartment->save();

        /***************************************************/
        //      End Of Table Department                    //
        //      Start of Employee Entity                   //
        /***************************************************/

        $employee = $this->employeeFactory->create();
        $employee->setDepartmentId($salesDepartment->getId());
        $employee->setEmail('john@sales.loc');
        $employee->setFirstName('John');
        $employee->setLastName('Doe');
        $employee->setServiceYears(3);
        $employee->setDob('1983-03-28');
        $employee->setSalary(3800.00);
        $employee->setVatNumber('GB123456789');
        $employee->setNote('Just some notes about John');
        $employee->save();

        /***************************************************/
        //              End Of Employee Entity             //
        /***************************************************/

        $setup->endSetup();
    }
}

Note: From above script I am able to make entries in Department table which is a flat table but unable to make entries for employee entity which is an EAV.

I get this error.

[PDOException] There is no active transaction

PHP Fatal error:  Uncaught exception 'Exception' with message 'User Error: Some transactions have not been committed or rolled back in /vagrant/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3774' in /vagrant/vendor/magento/framework/App/ErrorHandler.php:61


texts: Magento2: How to get product collection by full text search?

texts:
How to get product collection by full text search?

        $query = $this->queryFactory->get()->getQueryText();
        $collection = $this->_productCollectionFactory->create();

        $collection->addAttributeToFilter('name', array('like' => '%'.$query.'%'));
        $collection->setPageSize(10); // fetching only 10 products

Any one help in this?


texts: What is the rationale behind the ___store and ___from_store URL query parameter?

texts:
I need to decide whether I list these query parameters out in Search-Engine-Indexers (like it's advisable for SID) or if I can safely remove them from the pre-made templates (language switcher).

With my setup, I provide the store-code for run-type "store" already via the server configuration and therefore I would normally say that ___store is not needed (technically).

But I wonder a bit about the ___from_store key and whether it's useful or not.

I've also seen that cookies are used to keep the store code which I think can also be optimized away as the store-code - as written - is already provided via server configuration (environment).

Magento multistore, __store and ___from_store in URL
Why does Mage_Catalog_Block_Widget_Link add ___store query parameter?
https://magento.stackexchange.com/questions/85457/how-to-remove-from-store-0-store-uk-from-url


texts: Mails are going to spam is it because of Heartbeat not found?

texts:
we are getting below error through AOE scheduler extension

Last heartbeat is older than one hour. Please check your settings and your configuration!

& order , password reset and other  Mails are going to spam.

Is there any link b/w spam & heartbeat ?

because catalog price rules are working fine.

cron.php

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage
 * @copyright  Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

// Change current directory to the directory of current script
chdir(dirname(__FILE__));

require 'app/bootstrap.php';
require 'app/Mage.php';

if (!Mage::isInstalled()) {
    echo "Application is not installed yet, please complete install wizard first.";
    exit;
}

// Only for urls
// Don't remove this
$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);

Mage::app('admin')->setUseSessionInUrl(false);

umask(0);

$disabledFuncs = explode(',', ini_get('disable_functions'));
$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;
$isShellDisabled = true;

try {
    if (stripos(PHP_OS, 'win') === false) {
        $options = getopt('m::');
        if (isset($options['m'])) {
            if ($options['m'] == 'always') {
                $cronMode = 'always';
            } elseif ($options['m'] == 'default') {
                $cronMode = 'default';
            } else {
                Mage::throwException('Unrecognized cron mode was defined');
            }
        } else if (!$isShellDisabled) {
            $fileName = basename(__FILE__);
            $baseDir = dirname(__FILE__);
            shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");
            shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");
            exit;
        }
    }

    Mage::getConfig()->init()->loadEventObservers('crontab');
    Mage::app()->addEventArea('crontab');
    if ($isShellDisabled) {
        Mage::dispatchEvent('always');
        Mage::dispatchEvent('default');
    } else {
        Mage::dispatchEvent($cronMode);
    }
} catch (Exception $e) {
    Mage::printException($e);
    exit(1);
}


texts: Magento 2 translate the "You added ... to your shopping cart." line

texts:
I'm trying to translate the "You added ... to your shopping cart." line in my Magento 2 installation.
I have already a .csv file in: "app/design/themevendor/themename/i18n/" with all the lines translated,
and I have also translated the lines into "vendor/magento/module-checkout/Controller/Cart/Add.php" but the line that comes out when you add a to cart a product is still in English!

Also, this line has the last part, "shopping cart" as a link, the ones I have translated were just normal lines, so I think the one I'm trying to translate, is built from 2 parts, but I just can't find it.


texts: Dynamically add "Add More" button to magento configuration

texts:
I have created a module which allows to add menu items dynamically from admin panel configuration. For this, I have added a dynamic field with "Add more" button.
It works perfectly and the menu I have created is being displayed on top menu. Now I want to add submenu to that menu item.

You can see it in the image.
I have this code in my form field block

public function __construct()
    {
        $this->addColumn('menutitle', array(
            'label' => Mage::helper('adminhtml')->__('Menu Title'),
            'style' => 'width:120px',
            'class' => 'input-text required-entry'
        ));
        $this->addColumn('link', array(
            'label' => Mage::helper('adminhtml')->__('Link'),
            'style' => 'width:220px',
            'class' => 'input-text required-entry'
        ));

        $this->addColumn('order', array(
            'label' => Mage::helper('adminhtml')->__('Order'),
            'style' => 'width:40px',
            'class' => 'required-entry input-text validate-number'
        ));

        $this->_addAfter = false;
        $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Menu Item');
        Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract::__construct();
    }
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
    {
        $this->setElement($element);
        $html = $this->_toHtml();
        $this->_arrayRowsCache = null; // doh, the object is used as singleton!
        $html ='
'.$html.'
';
    return $html;
    }

I have tried adding a button in form but without success. I dont have any idea where or how to start. Please help.


texts: Is that possible to add Textarea in Order Grid view

texts: How to insert a personal note or text area on order grid page for each order, This should save when entered the text. is that possible using Renderer. If there is any module for this please suggest, or some code hints would be helpful.


texts: Magento 2 (2.0.7) How to edit a a .php file from module-theme for your own theme?

texts:
I want to adjust the header menu. It works a bit by editing topmenu.phtml, at least for the $outermostClass to add some classes but I think $childrenWrapClass has an error since in function _addSubMenu in topmenu.php it does not use the var.

Though anyway, I would need more than adding a class to submenus. I would need to make the links look like

<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">

So I would need to edit topmenu.php in any way.

How to edit the topmenu.php? It is located originally in module-theme/Block/Html/Topmenu.php

Can I place it in my theme directory somewhere simply?

Someone mentioned I would need to create a module for it. Does that mean creating a directory on the same level of Magento_Theme in my theme directory? If so then how to name that directory and where to place my topmenu.php in order to use this instead the original one?

Thank you!


texts: Removing home and all Categories from breadcrumbs

texts:
I am trying to remove the breadcrumb link home.

Also all categories just so it isnt to much writing as a lot of our categories names are rather long.

For example

So instead of it saying

  HOME->ALL CATEGORIES->TOPS->POLO-TOPS

I want it to say

  TOP->POLO-TOPS

I have tried to just add this if statement to the breadcrumbs.phtml

<?php if ($_crumbName != 'home' ){?>

Which seems correct but it isnt doing anything so i dont know if i have this in the wrong place or am just going about this wrong. I have entered my full code below.

  $crumbsLevels = $this->getAllBreadcrumbs();
?>
<?php if($crumbsLevels && is_array($crumbsLevels)): ?>

    <?php foreach ($crumbsLevels as $crumbs): ?>
    <?php if ($crumbName != home ){?>

        <?php foreach($crumbs as $_crumb): ?>
        <li <?php if ((!empty($_crumb['category_id']) || count($crumbs) >4) && !$_crumb['last']) { ?>typeof="v:Breadcrumb"<?php } ?><?php if (!empty($_crumb['hidden'])) { echo 'style="visibility: hidden;"'; } ?>>
        <?php if(!empty($_crumb['link'])): ?>
            <a href="<?php echo $_crumb['link'] ?>" title="<?php echo $this->htmlEscape($_crumb['title']) ?>" <?php if (!empty($_crumb['category_id'])) { ?>rel="v:url" property="v:title"<?php } ?>><?php echo $this->htmlEscape($_crumb['title']) ?>
        <?php elseif($_crumb['last']): ?>
            <?php echo $this->htmlEscape($_crumb['title']) ?>
        <?php else: ?>
            <?php echo $this->htmlEscape($_crumb['title']) ?>
        <?php endif; ?>
        <?php if(!$_crumb['last']): ?>

        <?php endif; ?>

        <?php endforeach; ?>

    <?php }?>
    <?php endforeach; ?>

<?php endif; ?>

I know i didnt mention the all categories but wanted to egt the Home link done first and i assume it will just be the same but using the category ID or the name 'All Categories'?

If someone could let me know where i am going wrong or what is should be writing in that would be great thank you.


texts:
I'm working on a Magento Enterprise site and I'm having an issue figuring out how catalog routing and rewrites work in EE 1.14.1.0.

In Magento CE, the core_url_rewrite table is used to transform a product's URL key into an MVC+ID routing path. You'll find entries in that table like this:

id_path: product/123
request_path: my-url-key.html
target_path: catalog/product/view/id/123

id_path: product/123/10
request_path: my-category/my-url-key.html
target_path: catalog/product/view/id/123/category/10

The problem is that at some point in this site's history, they upgraded to a sufficiently new version of Magento where this is no longer used for catalog rewrites. Any product with a sufficently high enough ID doesn't appear in this table. Yet I can still go to example.com/my-url-key.html or example.com/my-category/my-url-key.html to find my products.

Can someone enlighten me as to how EE 1.14.1.0 is doing rewrites now? I've searched the code base for anything that extends Mage_Core_Controller_Varien_Router in it, trying to find if maybe Mage_Catalog or Enterprise_Catalog has a new router, but I can't find one.


texts: How to access a function in a model outside the module in magento

texts:
I'm a magento newbie. I have two custom modules, let's say module A and module B. I need to access a function in a model in module A from module B.

How can I achieve it?


texts: Making rows clickable in Adminhtml Cms Block Grid?

texts:
We have inherited a development stage Magento site, where a lot of the blocks on the frontend are horribly misspelled. We are having to go through each block and edit them. One thing we noticed is that these rows generated by:

app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php

are not clickable by href, but rather by js ajax. Is there any way to create an href link so that they can be opened in the browser in tabs? As editing each of these one at a time and not having the option to have more than one block editor at a time is not very time efficient. How would I go about creating a column in this grid programatically to create an "Edit" link that uses an href for $baseUrl in the _prepareColumns() method? I can just copy this file to the local code pool, I do not intend to modify core code, any help is greatly appreciated. If there is a factory method I'm unaware of, google search has not been fruitful in this regard.


texts:
Let's say I'm building a Magento 2 extension that does....well...not important. Let's say it does super awesome stuff.
But I want to make sure that this is build using the proper standards so other developers can extend it.

When should I use the DI in combinations with interfaces and when I shouldn't?
To make it clear here is a core example.

The class Magento\Core\Helper\Data has a constructor like this:

public function __construct(
    \Magento\Framework\App\Helper\Context $context,
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Framework\App\State $appState,
    PriceCurrencyInterface $priceCurrency,
    $dbCompatibleMode = true
) {
    parent::__construct($context);
    $this->_scopeConfig = $scopeConfig;
    $this->_storeManager = $storeManager;
    $this->_appState = $appState;
    $this->_dbCompatibleMode = $dbCompatibleMode;
    $this->_priceCurrency =  $priceCurrency;
}

My question is focused on the var \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig (I know there are others in the same constructor, but one explanation will fit all cases I think).

According to the di.xml from the core module the var will be an instance of Magento\Framework\App\Config:

<preference for="Magento\Framework\App\Config\ScopeConfigInterface" type="Magento\Framework\App\Config" />

but I can easily change that if I need.

When should I use interfaces like that in my code?
I've created this incomplete sample module (sorry for advertising), where I've used such interfaces, but all of them come from the core. I haven't created one of my own. Should I?


texts: How to get last order status history comment and order status Magento 2

texts:
I need to change the order status and order status history comment based on the last value of the status, currently i've set order status and comment status like this:

$event = $observer->getEvent();
$order = $event->getOrder();
// need to check the previous order status history comment
$history = $order->addStatusHistoryComment('', $order->getStatus());
$history->save();
// need to check last order status
$order->setData('status', $order->getStatus())->getResource()->saveAttribute($order, 'status');


texts: Magento 2 How to get multiple table rates data programmatically?

texts:
I want to display a custom notice on cart page "if customer's order total above $299, then he is qualified for free shipping". For that I have imported following table rates:

Country | Region/State |  Zip/Postal Code |   Order Subtotal (and above) |    Shipping Price

US |    * | * | 0 | 15

US |    * | * | 299 | 0

I can get single table rate using collectRatesByAddress() function of \Magento\Shipping\Model\Shipping class, but I can't get multiple table rates. Please see sample code as follows:

$quote = $this->_checkoutSession->getQuote();
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setCountryId("US")
            ->setCity("New York")
            ->setPostcode("11209")
            ->setRegionId("")
            ->setRegion("")
            ->setCollectShippingRates(true)->collectShippingRates();

$shippingCarrier = 'tablerate';
$carriers[$shippingCarrier] = '';

$result = $this->_shippingModel->collectRatesByAddress($shippingAddress, array_keys($carriers))->getResult();

foreach ($result->getAllRates() as $rate) {
    echo $rate->getPrice();
}

Please give me any solution/suggestion/hint to resolve this problem.

Thanks in appreciation.


texts: Is there any working reference for Magento 1 custom rest api?

texts:
I have been searching source for magento 1 custom api but could not find any which worked as expected.
I know magento 1 is now out of service but still...


texts: Using composition in patches / install scripts

texts:
TL;DR:
Is there a way to declare virtual types and different arguments in di.xml of a module and have that configuration be picked up when the module gets installed without calling bin/magento module:enable Vendor_Module prior to installing it?

Long version.
I have the following task.
I need to import some attributes from a source when a certain module is installed.  (Please do not recommend me extensions for importing attributes. This is not the problem itself. It's just an example of a bigger problem.)
For this I've created a data install patch that looks kind of like this (it is actually bigger than that, but I left only what's important):

<?php
namespace Vendor\Module\Setup\Patch\Data;

use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Catalog\Model\Product;
use Magento\Eav\Setup\EavSetup;

class ImportAttributes implements DataPatchInterface
{
    /**
     * @var EavSetup
     */
    private $eavSetup;

    /**
     * ImportAttributes constructor.
     * @param EavSetup $eavSetup
     */
    public function __construct(
        EavSetup $eavSetup
    ) {
        $this->eavSetup = $eavSetup;
    }

    /**
     * {@inheritdoc}
     */
    public function apply(): void
    {
        $attributes = $this->getImportData();
        foreach ($attributes as $attributeCode => $attributeData) {
            $this->eavSetup->addAttribute(Product::ENTITY, $attributeCode, $attributeData);
        }
    }

    /**
     * @return array
     */
    private function getImportData(): array
    {
        //get data from somewhere
        return $attributeArray;
    }
 ....
}

Pretty simple and it works nicely.
Now the problem.
The addAttribute method I'm calling inside the apply method contains this:

    $data = array_replace(
        ['entity_type_id' => $entityTypeId, 'attribute_code' => $code],
        $this->attributeMapper->map($attr, $entityTypeId)
    );

This basically transforms the attribute data to a certain format that is used to insert the attributes in db later.
My data source sends me the attributes already formatted as they should and applying the effects of $this->attributeMapper->map leads to undesired results.

I was able to solve this again easily by creating an attribute mapper (implementation of interface Magento\Eav\Model\Entity\Setup\PropertyMapperInterface) that just returns what it receives.
And I declared that via di.xml

<type name="Vendor\Module\Setup\Patch\Data">
    <arguments>
        <argument name="eavSetup" xsi:type="object">VirtualEavSetup</argument>
    </arguments>
</type>
<virtualType name="VirtualEavSetup" type="Magento\Eav\Setup\EavSetup">
    <arguments>
        <argument name="context" xsi:type="object">VirtualEavSetupContext</argument>
    </arguments>
</virtualType>
<virtualType name="VirtualEavSetupContext" type="Magento\Eav\Model\Entity\Setup\Context">
    <arguments>
        <argument name="attributeMapper" xsi:type="object">Vendor\Module\Model\Attribute\Mapper</argument>
    </arguments>
</virtualType>

This works great, but only if I call php bin/magento module:enable Vendor_Module prior to calling php bin/magento setup:upgrade.
If I don't enable the module first my di.xml file is not taken into account when running the patch.

Is there a way to be able to take into account the di.xml of a module when it gets installed without enabling it first.
I need this because not everyone that installs the module will enable it first and this may lead to strange results.


texts: How to Add or customize product information for add product?

texts: How to customize or adding product information in the add product form.


texts:
I'm trying to import csv products but I get that error

1. Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1, 2, 3, 4, 5, 6

although the Images File Directory field  is `pub\media\import

image is from csv file


texts: How to hide Permission tab at Admin System Dropdown

texts:
I want to remove Permission Tab at the admin->system dropdown programmatically. Not its functionality, just want to hide the select option at admin.

How to do it?.


texts:
Magento seo question. Nofollow on top links like cart/login?

While reading up on seo I thought to add no follows to default links that exist on every page. Cart. Login. Checkout. TC. Faq.

When looking up my site on Google using site:domain I realized that the top pages were the ones that have links in headers and footers.

By adding rel=nofollow to functional links like cart/login/etc all the seo juice is given only to relevant category and content pages (that dofollow).

Question:
Is this smart to do seo wise? And how can this be done via xml or Phtml using no follow? Or can it be tackled via robots?

Many thanks
......


texts: Customer address attribute value is not saving in Magento 2

texts:
We are working on trying to create customer address attribute as input type is File, we have downloaded the code from silksoftware by selecting "Need to Add Customer Attribute" -> "Entity Type" -> "Customer Address", but the below code is not working/saving, can any one, please help us on this issue.

<?php
namespace Module\Vendor\Setup;

use Magento\Eav\Model\Config;
use Magento\Eav\Model\Entity\Setup\Context;
use Magento\Eav\Setup\EavSetup;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;

class CustomerSetup extends EavSetup {

    protected $eavConfig;

    public function __construct(
        ModuleDataSetupInterface $setup,
        Context $context,
        CacheInterface $cache,
        CollectionFactory $attrGroupCollectionFactory,
        Config $eavConfig
        ) {
        $this -> eavConfig = $eavConfig;
        parent :: __construct($setup, $context, $cache, $attrGroupCollectionFactory);
    }

    public function installAttributes($customerSetup) {
        $this -> installCustomerAttributes($customerSetup);
        $this -> installCustomerAddressAttributes($customerSetup);
    }

    public function installCustomerAttributes($customerSetup) {

    }

    public function installCustomerAddressAttributes($customerSetup) {

        $customerSetup -> addAttribute('customer_address',
            'customeridproof',
            [
            'label' => 'Customeridproof',
            'system' => 0,
            'user_defined' => true,
            'position' => 100,
            'sort_order' =>100,
            'visible' =>  true,
            'default_value' => '',
            'note' => '',

                        'type' => 'varchar',
                        'input' => 'file',
            ]
            );

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

    }

    public function getEavConfig() {
        return $this -> eavConfig;
    }
}


texts: Permissions for production environment in Magento 2.3

texts:
These are the permissions that I have applied to my system in the development mode:

sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R :www-data .
sudo chmod u+x bin/magento

Are these permissions correct for the development environment? Should I leave it for the production mode should the permissions be different? Do we have to do something else to use production mode?


texts: Migrated Magento 1 Customer address does not show (shows variables as output instead)

texts:
First off, I have searched for a solution here, and on Github, this has never been answered specifically from what I can see, none of the answered items work.
Migrated Magento 1 address information does not work in Magento 2.  I also see that people have this issue when running older Magento 2 versions as well.

Reference question: Magento 2 versions have this issue, resolve by 'upgrading'
The solutions claim to upgrade Magento 2 ~2.2, but I already run Magento 2.3.5 which means I should have the 'fixes applied' already.

I already have Magento 2.3.5 so this is related to migrated data rather than an older version issue

Reference question: Magento 2 Customer address not showing properly
The solution here is viable: by creating a new module (overriding AddressMetadataInterface) and changing a constant ATTRIBUTE_SET_ID_ADDRESS.

However, I personally feel that fixes for Magento 1 migrated data to 'work' to Magento 2 should not relate to overriding any Magento 2 files - overriding are for when Magento 2 works perfectly as it should. I have to create a MyVendor_Magento1FixesModule which feels strange.
While this might be a solution, its a 'hacky solution' that could get lost on new migrations. Changing a *CONSTANT by changing a constant value doesn't feel right either.
Besides, I even found code that does this : 'entity_type_id' => 2' **instead of ** 'entity_type_id' => AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS, so I really do not understand why constants aren't used everywhere.
(Imagine starting a new migration for another project with the default core Magento 2 installation files, without this module).   If possible, I want users to advise on database related fixes rather.
I would rather want to fix these Magento 1 migrated database issues directly inside the Magento 2 database, even if it might be more complicated.
The closest solution is discussed on Github Magento issue 5873, but discusses it from the point of view of deleting migrated attribute sets - which are already tied to data I use ('customer_address' entity_type_code for attribute sets used for another module), so I would like to prevent issues with that module.
Too much information?
I want users to see I have done my own research and see reason why this is not a duplicate, because there are various reasons described above why I need an alternative.
Question
I am currently investigating the issue by trying to figure out in the database.
For further investigation, I just need some advice either by a direct answer, or alternatively just information on which tables the customer_address entity_type_code data depends on.
Currently, I have customer_entity, customer_address_entity, eav_entity_attribute, eav_attribute_group, eav_attribute_set which relate to the customer_address entity.
Are there any others tables?
(I am already busy trying to join table data to see what I get).
Thanks so much!


texts: How to track whether the order confirmation mail is loaded in email queue or not

texts:
I have a problem which order confirmation mail sent twice.
I debug the cron.php file and it works good. My ecommerce send well all kind of email automatically but order confirmation mail.

I realize that it's not from cron job and it seems like order information is dupicated in email queue based on database problem.

What do you think of that? I'm really freaking out for 1 week.
And could you let me know the which php file manage the order information?

Thank you so much !


texts: Strict Notice: Declaration of ::helper() should be compatible with Mage_Core_Block_Abstract::helper($name)

texts:
I've been seeing an issue in the Magento system.log relating to the following but I'm a little bit of a novice and not certain how to resolve.

ERR (3): Strict Notice: Declaration of As_FreeShippingMsg_Block_Notice::helper() should be compatible with Mage_Core_Block_Abstract::helper($name)  in /app/code/community/As/FreeShippingMsg/Block/Notice.php on line 75

The below is the notice.php file which relates to the above error...

class As_FreeShippingMsg_Block_Notice extends Mage_Core_Block_Template
{
    public function __construct()
    {
        return parent::__construct();
    }

    private function getQuote()
    {
        return Mage::getSingleton('checkout/cart')->getQuote();
    }

    public function isFreeshippingMsgEnabled()
    {
        return $this->helper()->isEnabled();
    }

    public function getFreeshippingMsgAmount()
    {
        return $this->helper()->getAmount();
    }

    public function hasFreeShipping()
    {
        $total = $this->getTotal();

        if ($this->isFreeshippingMsgEnabled() && $this->getFreeshippingMsgAmount()) {
            return (float)$total >= $this->getFreeshippingMsgAmount();
        }
        return false;
    }

    public function getAdditionForFreeShipping()
    {
        $total = $this->getTotal();

        $freeShippingConfig = $this->getFreeshippingMsgAmount();

        if ($freeShippingConfig >= $total) {
            return $freeShippingConfig - $total;
        } else {
            return false;
        }
    }

    protected function getTotal()
    {
        $calculate_on = $this->helper()->getCalculateOn();

        switch($calculate_on) {
            case 'grandtotal' :
                $total = $this->getQuote()->getGrandTotal();
                break;
            case "subtotal" :
                $total = $this->getQuote()->getSubtotal();
                break;
            default :
                $total = $this->getQuote()->getGrandTotal();
        }

        return $total;
    }

    public function helper()
    {
        return Mage::helper('as_freeshippingmsg');
    }
}

And the following is the data.php helper file...

class As_FreeShippingMsg_Helper_Data extends Mage_Core_Helper_Abstract
{
    const PREFIX = 'freeshippingmsg/general/';

    public function getAmount()
    {
        return (float)$this->getConfig('amount', $this->getStoreId());
    }

    public function isEnabled()
    {
        return (bool)$this->getConfig('enabled', $this->getStoreId());
    }

    public function getEligibleText()
    {
        return $this->getConfig('eligible_text', $this->getStoreId());
    }

    public function getSpendMoreText()
    {
        return $this->getConfig('spend_more_text', $this->getStoreId());
    }

    public function getCalculateOn()
    {
        return $this->getConfig('calculate_on', $this->getStoreId());
    }

    protected function getStoreId()
    {
        return Mage::app()->getStore()->getStoreId();
    }

    protected function getConfig($field, $storeId)
    {
        return Mage::getStoreConfig(self::PREFIX . $field, $storeId);
    }
}

If anybody is able to confirm why I would be seeing this message and how to resolve that would be great.


texts: How to remove tax on product on in specific condition

texts:
Hello Friends I want to remove the tax of the product in specific condition.I tried to set taxclass id as 0 but it adds the total of tax and product orice I want to completely remove the tax please help .
Currently this is my code which I used to remove tax

 $tax=Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount');
 $inc_tax=$product->getPrice();
 $exc_tax=$inc_tax-$tax;$product->setPrice($exc_tax);
 $finalPrice=$exc_tax;
 $product->setTaxClassId(0);

Please help me .


texts:
I'm getting this error from an extension I installed but I don't know how to fix it.

Error message:

Fatal error: Uncaught TypeError: Argument 14 passed to Magestore\Giftvoucher\Model\Giftvoucher::__construct() must be an instance of Magento\Framework\Model\ResourceModel\AbstractResource, instance of Magento\Framework\Pricing\Helper\Data given, called in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 and defined in /var/www/html/app/code/Magestore/Giftvoucher/Model/Giftvoucher.php:105 Stack trace: #0 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Magestore\Giftvoucher\Model\Giftvoucher->__construct(Object(Magento\Framework\Model\Context), Object(Magento\Framework\Registry), Object(Magento\Framework\Data\FormFactory), Object(Magento\Framework\Stdlib\DateTime\Timezone), Object(Magento\SalesRule\Model\Rule\Condition\CombineFactory), Object(Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory), Object(Magestore\Giftvoucher\Helper\Data), Object(Magento\Framework\ObjectManager\ObjectManager), Object(Magento\Store\Model\StoreManager), O in /var/www/html/app/code/Magestore/Giftvoucher/Model/Giftvoucher.php on line 105

Full Method where error is from:

public function __construct(
        \Magento\Framework\Model\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Data\FormFactory $formFactory,
        \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
        \Magento\SalesRule\Model\Rule\Condition\CombineFactory $conditionsInstance,
        \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $actionsInstance,
        \Magestore\Giftvoucher\Helper\Data $helperData,
        \Magento\Framework\ObjectManagerInterface $objectManager,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
        \Magento\Framework\UrlInterface $urlBuilder,
        \Magento\Email\Model\Template $emailTemplate,
        \Magento\Framework\Pricing\Helper\Data $pricingHelper,
        \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
        \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
        array $data = []
    ) {
        $this->_conditionsInstance = $conditionsInstance;
        $this->_actionsInstance    = $actionsInstance;
        $this->_helperData         = $helperData;
        $this->_objectManager      = $objectManager;
        $this->_storeManager       = $storeManager;
        $this->_scopeConfig        = $scopeConfig;
        $this->_transportBuilder   = $transportBuilder;
        $this->_urlBuilder         = $urlBuilder;
        $this->_emailTemplate      = $emailTemplate;
        $this->_pricingHelper      = $pricingHelper;
        parent::__construct(
            $context,
            $registry,
            $formFactory,
            $localeDate,
            $resource,
            $resourceCollection,
            $data
        );
    }


texts:
I found a query so I can mass change something in my products description. With this script:

<?php
require_once('app/Mage.php');
Mage::app('default');
$collection = Mage::getModel('catalog/product')
    ->getCollection()
    //->addFieldToFilter('') //Use filters to select a specific group of products
    ->addAttributeToSelect('description');

foreach($collection as $product) {
    $desc = $product->getDescription();
    // Remove parts of your description here
}

But this is for remove a part of description.

I want something to change a part of the description with something new.
The scenario is that inside the description has some directs links like:

and must be changed like this:

But I don't have the knowledge to fix this query to select these descriptions in 2 different languages and replace the url with the new one.
Can anyone please help?


texts: Catalog search Next / Seite-Button not working

texts:
I am using version 2.2.5 and have the following problem. As soon as the search returns more than 1 page and I click on page 2/3/4 etc. Or the next button, nothing happens. Only when I click on the page Update new articles will appear.
When I click on it the page number in the address line changes but the articles remain the same as on page 1.


texts:
I recently encoutered a strage mangento2 behaviour which I cant fix...
Everytime i try to load my store (frontend & backend) I get 404 errors on every .css .js .svg and so on.

I tried:

• php bin/magento setup:static-content:deploy

• php bin/magento indexer:reindex

• php bin/magento cache:flush

• php bin/magento cache:clear

After checking the directory I saw that I don't got a version<numberhere>-directory. Everything is just placed in the pub/static folder and not pub/static/version<numberhere>.

Thanks in adivce.


texts:
I want to redirect the 'proceed to checkout' action in mini cart to a custom page. I can't set the new link in mini cart button.
http://i.prntscr.com/ZGS7nessQsSMlbjZHSFj0Q.png


texts:
I'd like to hide the price and add to cart button for guests not logged in to my Magento site. I'd also like to show a 'login or register to view prices' message for guests too.

I imagine this will be an if statement within price.phtml but I'm not sure exactly how to implement this. Can anyone please provide a solution?


texts: Long waiting time when trying to reach webshop without the www. subdomain

texts:
When I try to reach my magento website by filling in the domain name plus top level domain in the url bar it only takes 30 seconds at least to load.
Example: webshopA.com

When I try the same but with the www. subdomain then the waiting time is less than 1 second.
Example: www.webshopA.com

How is this possible? What can I do speed it up?


texts: How SELECT `e`.* is coming in Query while printing collection filter in magento 1.9

texts:
$collection = Mage::getModel("customer/customer")->getCollection()
             ->addAttributeToSelect('firstname')
             ->addAttributeToFilter('grisk_college_new_id', array('in' =>$collegeid))
             ->addFieldToFilter('group_id', array('in' => array(4, 5)))
             ->addAttributeToFilter('physical_verify', array('null' => true), 'left')
             ->addFieldToFilter('assigned_campus_manager',array('like' => '%_/' . $custid . "%"));

  SELECT e.*, at_grisk_college_new_id.value AS
  grisk_college_new_id, at_physical_verify.value AS
  physical_verify, at_assigned_campus_manager.value AS
  assigned_campus_manager FROM customer_entity AS e INNER JOIN
  customer_entity_int AS at_grisk_college_new_id ON
  (at_grisk_college_new_id.entity_id = e.entity_id) AND
  (at_grisk_college_new_id.attribute_id = '275') LEFT JOIN
  customer_entity_int AS at_physical_verify ON
  (at_physical_verify.entity_id = e.entity_id) AND
  (at_physical_verify.attribute_id = '209') INNER JOIN
  customer_entity_varchar AS at_assigned_campus_manager ON
  (at_assigned_campus_manager.entity_id = e.entity_id) AND
  (at_assigned_campus_manager.attribute_id = '183') WHERE
  (e.entity_type_id = '1') AND (at_grisk_college_new_id.value
  IN('')) AND (e.group_id IN(4, 5)) AND (at_physical_verify.value IS
  NULL) AND (at_assigned_campus_manager.value LIKE '%_/%')

How can I make it more efficient ?


texts: How do I get order details in sales_order_before_save

texts:
I'm trying to debug code that updates inventory data when an order is placed. I have an observer that gets all order details and logs qty data after the order is placed, but I want to be able to log the qty before an order is saved for debugging purposes.

I have also tried observer sales_order_place_before. Neither observer gives me stock data from before the sale is saved and qty reduced.

<sales_order_before_save>
    <observers>
        <vampower_createebaydescription>
            <class>vampower_createebaydescription/observer</class>
            <method>logAssemblyQtyPreSale</method>
            <type>singleton</type>
        </vampower_createebaydescription>
    </observers>
</sales_order_before_save>

public function logAssemblyQtyPreSale(Varien_Event_Observer $observer)
{
    $orderData = $observer->getEvent()->getOrder();
    $LogFile = 'Update-Qty-After-Sale.log';

    Mage::log("-------------------  Before Order - Log Assembly Qty-----------------", null, $LogFile);

    if ($orderData->getId())
    {
        foreach ($orderData->getAllVisibleItems() as $item)
        {
            $ProductID = $item->getProductId();
            $OrderQty = $item->getQtyOrdered();
            $_product = Mage::getModel('catalog/product')->load($ProductID);
            $_stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);

            $isAssembly = $_product->getData("is_assembly");
            $ProductQty = $_stock->getQty();
            $OrderQty = $item->getQtyOrdered();

            Mage::log("  --------- ITEM IN ORDER -------", null, $LogFile);

            $LogMsg = "     " . $OrderQty . ' - ' . $item->getProductId() . ' - '.$_product->getName();

            Mage::log($LogMsg, null, $LogFile);
            Mage::log("Current Qty: " . $ProductQty, null, $LogFile);
            Mage::log("OrderQty: " . $OrderQty, null, $LogFile);
        }

    }

    Mage::log("-------------------  END - Before Order Log Assembly Qty-----------------", null, $LogFile);
}


texts:
How can I programatically remove a tag relation from a product?

I have the following function that creates a tag relation, which is working well.

public function setTag($product, $tag){

    $store_id = Mage_Core_Model_App::DISTRO_STORE_ID;

    $tagRelationModel = Mage::getModel('tag/tag_relation');

    $tagRelationModel->setStoreId($store_id)
                     ->setProductId($product->getId())
                     ->setActive('1')
                     ->setCreatedAt( $tagRelationModel->getResource()->formatDate(time()) );

    $tagRelationModel->setTagId($tag->getId());

    $tag->saveRelation($product->getId(), null, $store_id);
}

How would I achieve the reverse of this?


texts: How to bring Catalog page default sidebar to Product Detail Page

texts:
I'm using Codazon Fastest Theme (food-drink) variant. I have enabled layout="2columns-left" in /app/design/frontend/Codazon/fastest/food_drink/Magento_Catalog/layout/catalog_product_view.xml

Now all products have sidebar enabled. But it is empty. I can add widgets like static block and it shows up there.

But I need the default sidebar with filters to be shown there

How can I bring the default sidebar shown in the catalog listing pages to the product detail page?


texts: Patch SUPEE-8788, MageReport.com says no, but I say yes

texts:
I recently went with all the workarounds that Magento supplied after the v1 of the patch had some issues, and now have finally successfully installed v2 of SUPEE-8788.

sh PATCH_SUPEE-8788_CE_1.9.0.1_v2-2016-10-14-09-37-14.sh
Checking if patch can be applied/reverted successfully...
Patch was applied/reverted successfully.

As well as being listed in the applied.patches.list.

However when scanning through magereport.com to assure everything is working correctly, it still alerts me stating that I am unpatched for 8788. Should I just bypass this as a possible error on their side or could there still be something more I need to do?


texts: ReferenceError: Translator is not defined in Magento 1.7.0.2

texts:
I am trying to add shopping cart price rule by going through Admin -> Promotions -> Add New Rule.

But when I try to apply condition by clicking on "Condition" tab and clicking on plus icon, it generates following error in console:

ReferenceError: Translator is not defined

Please see following screenshot. I tried to disable some extensions but not solved. Hopefully someone hint me about it.


texts: Add new column in existing database table

texts:
I have created file mysql4-upgrade-1.6.0.1-1.6.0.2 in which code is like,

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

$installer->getConnection()
->addColumn($installer->getTable('newsletter_subscriber'),'subscriber_name', array(
    'type'      => Varien_Db_Ddl_Table::TYPE_TEXT,
    'length'    => 255,
    'after'     => 'subscriber_email', // column name to insert new column after
    'comment'   => 'Subscriber Name'
    ));
$installer->endSetup();
?>

Also changed in config file. It is like,

<modules>
        <Mage_Newsletter>
            <version>1.6.0.2</version>
        </Mage_Newsletter>
</modules>

But still column is not added in the database 'newsletter_subscriber' table. Any help?


texts: Magento 2 customer login not working on my centos 7 server but works in test server

texts:
Magento 2 login is not working as expected on my centos 7 server. If i enter wrong credentials into the login form and hit submit, the page refreshes and the following happens:
1. No error message is returned
2. The form clears off the inputted login credentials.
3. Customer is not logged in even if the credentials are correct.

I went further to install a fresh Magento 2.2.6 on the same server. I tried to login as a customer, even though I did not register. I expected to get an error feedback but I got the same result as above.

Please note that admin backend login is working fine.

Things I have done
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

I have also made the following folders writable: generated, var/*, pub/static

I need your help as I have been on this for 3 days. Thanks in anticipation.

Issue has been resolved
I noticed a timezone difference between the database server and application server. I sync the two and it worked.


texts: Programmatically run single product indexing in magento EE 1.14

texts:
I want to reindex single product via programmatically. As i know, in enterprises edition there is update on save mode for product. It re-indexed the single product added via UI ( From admin ).

Is there any way to re-index single product programmatically ?

Also can anybody explain how reindex works on "Update on save" mode.

Any help would be appreciated  !

Thanks in advance


texts: Spiltting Magento Order Error: Invalid method Mage_Sales_Model_Quote::removeItemByKey()

texts:
I'm spliting the magento order separately like different vendors, I'm fallowing the Vinai Answer from previous post. But it's returning an error.

Error:
 Invalid method Mage_Sales_Model_Quote::removeItemByKey()

Mage_Sales_Model_Quote this class have this method but it's returning error WHY?

my code is

<?php

class Easylife_SplitOrder_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
{

    public function saveOrder()
    {
        $quote = $this->getQuote();

        // First build an array with the items split by vendor
        $sortedItems = array();
        foreach ($quote->getAllItems() as $item) {
            //$vendor = $item->getProduct()->getVendor(); // <- whatever you need
            $product = Mage::getModel('catalog/product')->load($item->getProductId());
            //Mage::log($product->getVendor());
            $vendor = $product->getVendor();
            if($vendor != 0){
                if (! isset($sortedItems[$vendor])) {
                    $sortedItems[$vendor] = $item;
                    //Mage::log('vendor');
                }
            }
            //Mage::log('$vendor');
        }

        Mage::log('One');
        foreach ($sortedItems as $vendor => $items) {
            // Empty quote
            foreach ($quote->getAllItems() as $item) {
                $quote->removeItemByKey($item->getId());
            }
            foreach ($items as $item) {
                $quote->addItem($item);
            }
            // Update totals for vendor
            $quote->setTotalsCollectedFlag(false)->collectTotals();

            // Delegate to parent method to place an order for each vendor
            parent::saveOrder();
        }
        Mage::log('2');
        return $this;
    }

}

How can I solve this?

Thanks in advance..


texts: Magento 2.3.5-p1 still shows out of stock product Color Swatch in the frontend

texts:
we have updated our Magento from 2.3.3 to 2.3.5-p1.
Before we did this Magento never showed color swatches of "out of stock" child products.

Now after updating to 2.3.5-p1 it shows them but they are not clickable.
I would like to be able to cross or greying the color swatch of unavailable colors but how can I do this?
I think right now it is irritating for customers to see but not being able to click them.
Setting "Display Out of Stock Products" to "no" is not an option because I want simple "out of stock" products be shown in the frontend.

Any help is appreciated.


texts:
Using mageworx advance product options extension i have created option templates and associated to the products and saved.
in the magento 1.9.2.4

Now i came to product and clicked on 'custom options' tab but not showing anything. but other tabs like 'categories', 'upsells'...etc can able to access and view.

Not getting any console log errors in the firebug.

please help me how can I overcome this?


texts: Magento 2: How to use redirect in Router.php file [SOLVED]

texts:
As following  Magento 2: How to define Scope For Router.php we already have

if ($condition->getRedirectUrl()) {
    $this->response->setRedirect($condition->getRedirectUrl());
    $request->setDispatched(true);
    return $this->actionFactory->create(Redirect::class);
}

But I have some condition due to that redirect other ways.

$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$redirectURL = $request->getServer('REQUEST_SCHEME')."://".$request->getServer('SERVER_NAME').$request->getServer('REQUEST_URI');
$resultRedirect->setUrl($redirectURL);

Above is giving BLANK page.

$this->_redirect($redirectURL);

Above one is giving

  Call to undefined method Custom\Module\Controller\Router::_redirect()
  in D:\wamp\www\magento2\app\code\Custom\Module\Controller\Router.php
  on line 116


texts: In Magento 2 is there a way to "force" kick-out all existing 'customer' sessions?

texts: Is there a way to "force" kick-out 'ALL' existing 'CUSTOMER' sessions in Magento-2? SO they have to re-login to the website?


texts: I need the tax to be added from external source. But I have hard time to find when should I alter the tax. Any idea?


texts:
I am working on a default Magento setup and facing the default rest API not responding on checkout and throwing 401 error.

{"message":"Consumer is not authorized to access %resources"...}

For example below APIs not working for logged in users.

/rest/default/V1/carts/mine/estimate-shipping-methods
/rest/default/V1/carts/309215/estimate-shipping-methods-by-address-id
/rest/V1/wishlist

is there any missing configuration?

is there any session/cookies related issue?

is they are customer specific?

Please share your thoughts on the same.


texts: How to get the path of config status for (ifconfig=" ") xml - Magento 1.9

texts:
I want to know how we get the path of a config status for a natif and a custom module.

Assuming that i want to get a config path of:

  1) System>Configuration>Design>View demo store warning message>
  No.

  2) System>Configuration>Web>Add store code to URLs> Yes.

  3) System>Configuration>CustomModule>CustomField> 1.

My layout.xml:

<?xml version="1.0"?>
<layoutupdate>
    <catalog_product_view>
        <reference name="head">
             <action method="addItem" ifconfig="path/to/config/status/enabled" condition="1"><type>skin_js</type><name>js/script_one.js</name></action>
              <action method="addItem" ifconfig="path/to/config/status/enabled" condition="0"><type>skin_js</type><name>js/script_two.js</name></action>
        </reference>
   </catalog_product_view>
</layoutupdate>


texts: Move "Default welcome msg!" from right to left Magento 2

texts:
I'm trying to move the "Default welcome msg!" from the top bar on the right side, where is now, to the left side, so this way I have just the login, account ecc links on the right, and just the message on the left.
I'm using Luma theme, on Magento 2.


texts: Magento 2 - How to add a custom checkbox above place order button in checkout page

texts: I want to add a custom checkbox just above the place order button. The user should be allowed to click the Place Order button only after the checkbox is checked. Thanks in advance!


texts: Is there any custom code, which provides feature to add price slider in Layered Navigation in Magento 1?


texts: Magento 2 - Failed to assign configurable products programmatically

texts:
$configurableProduct = $this->_objectManager->create('\Magento\Catalog\Model\Product');
    $configurableProduct->setSku($sku);
    $configurableProduct->setName($name);
    $configurableProduct->setAttributeSetId(4);
    $configurableProduct->setStatus(1);
    $configurableProduct->setTypeId('configurable');
    $configurableProduct->setWebsiteIds(array(1));
    $configurableProduct->setCategoryIds(array(4));
    $configurableProduct->setStockData(array(
        'use_config_manage_stock' => 0, //'Use config settings' checkbox
        'manage_stock' => 1, //manage stock
        'is_in_stock' => 1, //Stock Availability
        )
    );
    $configurableProduct->save();

    $productId = $configurableProduct->getId(); // Configurable Product Id
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $product = $objectManager->create('Magento\Catalog\Model\Product')->load($productId); // Load Configurable Product
    $attributeModel = $objectManager->create('Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute');
    $position = 0;
    $attributes = array(160); // Super Attribute Ids Used To Create Configurable Product
    foreach ($attributes as $attributeId) {
        $data = array('attribute_id' => $attributeId, 'product_id' => $productId, 'position' => $position);
        $position++;
        $attributeModel->setData($data)->save();
    }
    $product->setTypeId("configurable"); // Setting Product Type As Configurable
    $product->setAffectConfigurableProductAttributes(4);
    $objectManager->create('Magento\ConfigurableProduct\Model\Product\Type\Configurable')->setUsedProductAttributeIds($attributes, $product);
    $product->setAssociatedProductIds($associatedProductIds);// Setting Associated Products
    $product->setCanSaveConfigurableAttributes(true);
    $product->save();

This is what I've done so far and the products are created successfully.

But the problem is that, when I view the configurable products, there are no associated products in the panel Configurable products. What did I do wrong? Please help me to fix this problem.

Thanks in advance!


texts: Magento 2 live website transfer from one hosting to another

texts:
Well, first good day to you, and i really beg you to excuse me if this is off-topic, but I just don't know what to do anymore.
Here is a little problem i face while I'm making transfer of live Magento2 website from one hosting to another.
As is shown in many posts here like this - How do I fix my Base URLs so I can access my Magento site?
And this also - How to migrate Magento 2.0.x from one server to another?
For me the process was from one hosting to another cause the boss here is not happy with the old hosting at all.
So, he bought new one, we set up the server with CentOS7 and WHM and cPanel so he can manages the things on his own when he want.
The boss didn't want to waist time to install new Magento 2 system on the servers, and my question is: Do I have to make a new installation of the Magento 2 or I can simple transfer of the website described below.
I did like this:

Exported the data base - PhpMyAdmin - export.

On the new hosting from cPanel i crated a new database with a specific name and then I did a successful import of the the database.

I've uploaded all the files of the website via FileZilla to the Public_HTML folder without no sub folders (like examp: - public_HTML/websitename/filesandfoldersofthewebsite) - just all the files of Magento 2, the theme, everything that was working on the old hosting

Edited the core_config_data to the new urls

edited the app/etc/env.php:
  array (
     'host' => 'localhost',
     'dbname' => 'nameofmynewdatabase',
     'username' => 'root',
     'password' => '',
     'active' => '1',
   ),
 ),

),

the new DNS is redirected to point to the new hosting and the new servers.

Also the new servers and hosting are requirements ++ to Magento2 system

Checked the composer, PHP version, MySQL, Cron, everything. Also edited the memory limits, said simple I did all the requirements.

it was really a mess while to run commands cause terminal return me a lot of mistakes like :
php - no such a command, but at the end with some google I did :
php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy -f

php bin/magento cache:flush

php bin/magento cache:clean

and the terminal just executed the commands with no output.
The website is not loading in the browser - www.best-welding.com
What I'm doing wrong or all this is just not possible ?


texts: Magento 2 - Navigation Menu Disappears when Flush Cache

texts:
When i flush the cache the navigation menu disappears. I can get it back by changing the theme and then changing it back.

This is added to default.xml within Magento_Theme/layout folder of my custom theme.

    <referenceBlock name="store.menu">
        <block class="Ves\Megamenu\Block\Menu" name="catalog.topnav" template="Ves_Megamenu::topmenu.phtml" cacheable="true">
            <arguments>
                <argument name="alias" xsi:type="string">menu-top</argument>
                <argument name="cacheable" xsi:type="string">true</argument>
            </arguments>
        </block>
    </referenceBlock>

This is a custom menu but seemed to work perfectly until recently. Initially it stopped when adding varnish until i removed the ttl attribute and then worked fine. Now however it's having this new strange behavior and am unsure when it started or how to debug at the moment.


texts: How to implement tab panel in product page for magento enterprise version?

texts:
I want to add tab panel in product page. currently my tab is https://i.imgur.com/XxnH0Gp.png

so please advise me


texts: Magento2 admin create order. Can we add Js variable to order object using config provider like frontend?

texts: I am working on customization on creating order in admin and I want to access some product attribute in JS. I am looking for model from where I can set order object data and get by window.order.myvariable. Similar to window.checkoutconfig in frontend.


texts: How to apply coupon code on Custom tab in Magento 2?

texts:
I have created Custom Tabs in Magento 2 Between Shipping and Review and Payment.
I want to remove Discount Coupon Code from Review and Payment to my Custom Tabs.How will i do it ?
I think this part is used to show coupan in checkout_index_index.xml
<item name="summary" xsi:type="array">
<item name="children" xsi:type="array">
    <item name="discount" xsi:type="array">
        <item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>
        <item name="children" xsi:type="array">
            <item name="errors" xsi:type="array">
                <item name="sortOrder" xsi:type="string">0</item>
                <item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount-messages</item>
                <item name="displayArea" xsi:type="string">messages</item>
            </item>
        </item>
    </item>
</item>

But doesn't show up the fields.