texts: Home exception 'Mage_Core_Exception' with message 'Invalid block type: '

texts:
I get the error exception 'Mage_Core_Exception' with message 'Invalid block type: ' so no block is mentioned. Home is not loaded properly however. So kind of hard to debug this way. Complete trace is

2017-02-04T12:50:35+00:00 ERR (3):
exception 'Mage_Core_Exception' with message 'Invalid block type: ' in /home/user/prelaunch.domain.com/app/Mage.php:595
Stack trace:
#0 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'content')
#3 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'content')
#4 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#6 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#7 /home/user/prelaunch.domain.com/app/code/core/Mage/Adminhtml/Controller/Action.php(275): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true)
#8 /home/user/prelaunch.domain.com/app/code/local/Magestore/Megamenu/controllers/Adminhtml/MegamenuController.php(472): Mage_Adminhtml_Controller_Action->loadLayout()
#9 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Magestore_Megamenu_Adminhtml_MegamenuController->cacheAction()
#10 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('cache')
#11 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/user/prelaunch.domain.com/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/user/prelaunch.domain.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /home/user/prelaunch.domain.com/index.php(88): Mage::run('', 'store')
#15 {main}

Regular error log only reports an error from earlier on:

[Sat Feb 04 05:00:26 2017] [error] [client xx.xxx.xxx.xxx] File does not exist: /home/user/prelaunch.domain.com/js/lr_callprice/jquery.min.map

Any ideas how I can debug this properly?


texts: How to delete shooping cart before new add product cart and redirect checkout page?

texts:
I need to redirect product add to cart button to checkout page instead of cart page

and

also product will delete in cart before new add by custom module.

so how to do?


texts: Magento duplicates SKU in file export by DataFlow Export

texts:
I use the DataFlow Import/Export for updating product information. But now I am getting duplicates SKU in file results when I try to export product

Can anyone help me ?


texts: How can I use the protected function _initProduct() from a custom module Block

texts:
I want to initialise simple products of a configurable one, by using the protected function (or another one), but I can't get the it in my code.

I have called in my class file:

require_once 'Mage/Catalog/controllers/ProductController.php';

For info: my class are already extending anther class:

Mage_Catalog_Block_Product_View_Type_Configurable


texts: How to add Please Select option in programmatically created select attribute for products?

texts:
I have created a custom select attribute for products using InstallData, options of that attribute are shown using source model. It shows options correctly but when I add a Please select option with an empty value it shows Please Select option two times in dropdown. Please see the code below for both the cases.

InstallData.php

$eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY,
        'warranty_type',
        [
            'group' => 'Custom Options',
            'type' => 'varchar',
            'backend' => '',
            'label' => 'Warranty Type',
            'source' => 'VENDOR\MODULE\Model\Config\Source\Options\WarrantyTypeOptions',
            'input' => 'select',
            'visible' => true,
            'required' => true,
            'visible_on_front' => false
        ]
    );

WarrantyTypeOptions.php

class WarrantyTypeOptions extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource{
/**
 * Return array of options as value-label pairs
 *
 * @return array
 */
public function getAllOptions()
{
    $options = [
        ['value' => 'Local', 'label' => __('Local')],
        ['value' => 'International', 'label' => __('International')],

    ];

    return $options;
}

}

This works fine and shows two options only:

<option data-title="Local" value="Local">Local</option>
<option data-title="International" value="International">International</option>

But when I add Please Select option with an empty value:

$options = [
        ['value' => '', 'label' => 'Please Select'],
        ['value' => 'Local', 'label' => __('Local')],
        ['value' => 'International', 'label' => __('International')],

    ];

This gives two Please Select options in dropdown:

<option value="">Please Select</option>
<option data-title="Please Select" value="">Please Select</option>
<option data-title="Local" value="Local">Local</option>
<option data-title="International" value="International">International</option>

Any suggestion how to correct it.

Thanks in advance.


texts: Add child products of a product in magento

texts: I have created a online shop for saree.. Now I want to add saree blouse and other details in product view page with its attribute... how will I do this?


texts: How to remove different pages of a website from google indexing?

texts: In webmater , i have added only my base url ,but the other pages are indexed. do i have to enter all pages manually to remove each page form google indexing? please suggest a solution?


texts: How create and download excel file in magento 2.3

texts: I need to create excel file at front-end and need to download bu there is no any reference please help with some solution.


texts: Magento 2: How to fix incorrect permissions after executing setup:upgrade and/or setup:di:compile

texts:
After running setup:upgrade and di compile from the bin directory, permission and ownership is reset and the magento store stops working. It works if I manually reset the permission.

When the var/generation/Magento directory is owned by sohaib/www-data (sohaib is my current username) the website is loading properly.

When I run the bin/magento setup:upgrade command, the ownership has changed and the website is throwing errors.


texts: Adding new custom mass order status action

texts:
I am using Magento 1.9.1 .

I am working on a new extension which is adding new custom mass status action here:

Here is my code:

/app/code/local/VivasIndustries/MassCustomStatusses/etc/config.xml :

<?xml version="1.0"?>
<config>
  <modules>
    <VivasIndustries_MassCustomStatusses>
      <version>0.1.0</version>
    </VivasIndustries_MassCustomStatusses>
  </modules>
<global>
  <adminhtml>
    <events>
        <core_block_abstract_prepare_layout_before>
            <observers>
                <masscustomstatusses_core_block_abstract_prepare_layout_before>
                    <class>masscustomstatusses/observer</class>
                    <method>newMassAction1</method>
                </masscustomstatusses_core_block_abstract_prepare_layout_before>
            </observers>
        </core_block_abstract_prepare_layout_before>
    </events>
</adminhtml>
    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_grid>VivasIndustries_MassCustomStatusses_Block_Sales_Order_Grid</sales_order_grid>
            </rewrite>
        </adminhtml>
    </blocks>
</global>
</config>

/app/code/local/VivasIndustries/MassCustomStatusses/Block/Sales/Order/Grid.php:

<?php
class VivasIndustries_MassCustomStatusses_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
    protected function _prepareMassaction()
    {
        parent::_prepareMassaction();

        // Append new mass action option
        $this->getMassactionBlock()->addItem(
            'masscustomstatusses',
            array('label' => $this->__('New Mass 1'),
                  'url'   => $this->getUrl('masscustomstatusses/controller/action') //this should be the url where there will be mass operation
            )
        );
    }
}

/app/code/local/VivasIndustries/MassCustomStatusses/Model/Observer.php:

<?php
class VivasIndustries_MassCustomStatusses_Model_Observer
{
    public function newMassAction1($observer)
    {
        $block = $observer->getEvent()->getBlock();
        if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
            && $block->getRequest()->getControllerName() == 'sales_order')
        {
            $block->addItem('masscustomstatusses', array(
                'label' => 'New Mass 1',
                'url' => Mage::app()->getStore()->getUrl('masscustomstatusses/controller/action'),
            ));
        }
    }
}

So here is what i've done by this guide: http://www.blog.magepsycho.com/adding-new-mass-action-to-admin-grid-in-magento/

The actions is appearing but when i select it and try to update the order statuss i get error for not exising link like this: http://mymagento.com/index.php/masscustomstatusses/controller/action/key/59418867a73fa5784acb31a23b2a1510/

I know i must add some more things but i have no idea what i should add.

Can you help me out so i can make this thing update the status ?

Thanks in advance!


texts: Remove custom options only from cart item

texts: I want to remove only the custom options added with the cart item without removing the product. Is there any solution for this? I am using Magento 2.3.4 version.


texts: Magento 2: Walk through collection and delete

texts:
I was wondering if there was a way of walking through a collection on Magento 2 and deleting entries from the database.

In Magento 1, this could be done by doing something like the following:

Mage::getModel('foo/bar')->getCollection()
                    ->addFilter('baz', $filter)
                    ->walk('delete')

Is there a way of achieving something similar in Magento 2?


texts: how do you make the product attributes on view pages into drop downs

texts:
i am using magento 2.2. i want to make my configurable product attributes, like Product size, into dropdowns.

how do i do that. i noticed its possible from this picture on another forum


texts: Magento2: How to convert weight unit to grams from kg?

texts:
I have a website in Magento2. Mageto2 provides product weight unit in KG, how an I convert it into unit Gram.

I want to change the product weight unit from KG to Gram how it is possible ?.


texts: PHP Parse error in Magento 2 on CentOS 7

texts:
a website on centos 7 ec2 instance and get the following error

  PHP Parse error:  syntax error, unexpected 'foreach' (T_FOREACH) in
  /dir/www/html/app/code/Webkul/Marketplace/Block/Collection.php on line
  145

Although this line doesn't contain foreach , and when I go to the project directory I found all files and directories deleted and only app folder with code and  design folder. When i get into code folder I found only webkul folder.

Note: that's happend after stop and start the instance

So what's the problem ?


texts: Checkout Step Progess Doesn't Return Complete Status

texts:
I'm fairly new in the Magento environment. I've downloadet a free theme and it's all working great.
But when i want to checkout when logged in, the progress steps wont show billing address or shipping method.

I've copied almost all of the lines from the "base" theme to my custom theme.
But no luck.

How could that be?

It is as if onepage doesn't return "complete" when i click next step.

  Line 27 in "checkout/onepage/progress/billing.phtml"

  if ($this->getCheckout()->getStepData('billing', 'complete')):

I havn't changed anything en "opcheckout.js".

Let me know if you need more info.


texts: I am adding Widgets, Blocks and content from WYSIWYG editor from admin panel to a custom theme. Will the changes be saved?

texts: As the question said, I have added Widgets like Catalog Products List and cms blocks using admin WYSIWYG editor. While adding them, I am always selecting the custom theme I have created. Are these changes getting saved in the theme? If I were to copy this theme and paste it into a fresh Magento installation, will all the changes be reflected? If not, how to go about it so it does?


texts: Call custom Controller on billing informaion on change country

texts: Hello i want to call my custom controller on billing information page on-change country drop-down list.Whenever i change country form drop-down list it will call my custom controller.How can i do that?


texts: VirtualHost setup for multi site on shared hosting

texts:
In a shared hosting environment, I want to setup a multi site with both sites pointing to the same domain under different folders, i.e. mydomain.com and mydomain.com/ws2.

I have followed this tutorial.

Unfortunately I can't create a VirtualHost because I don't have access to Apache configuration file. The hosting support has told me that I can use a functionality called Parked Domains, but that doesn't accept folders under the same domain.

Are there any other ways?


texts: Location of Single Save Price Indexing Code

texts:
When you save a product in Magento's backend admin console application, the system will reindex the price information for that product.

Where in the core code does this "single save" product price reindex kick-off and happen?  Is it the same code path at the main price re-indexer?  Or is it somewhere else?


texts: Same product enabled in a view and disabled in other not appear in 2 front

texts:
I have a magento store with 2 view :

EN
FR

When i disable a product in the 1 of the 2 views, my product disappear of the 2 front's view.

Is there a solution to keep visible this product in 1 view ?


texts: how can we add multi level of categories programmitaclly?

texts: I have CSV file with categories data in parent child level. How can we add multi level of categories programmitaclly ?


texts:
I am adding a condition to product listing in magento, Mage_Catalog_Block_Product_List

But when I've added the condition using getSelect, its not returning as collection as some of functions are missing like setCurrPage().

Basically I want to join catalog stock table to the product collection. Is there any other way around for this?

Note:: I am trying to override the file Mage_Catalog_Block_Product_List so the collection

$products = parent::_getProductCollection()->getSelect()->joinLeft( array('css'=> 'cataloginventory_stock_status'), 'css.product_id = e.entity_id', array('css.stock_status'));

return $products;


texts: Magento 2 - How to hide order with specific status from the sales order grid

texts: I want to hide order from sales order grid with status like 'pending_payment'. How can I do in Magento 2?


texts: Magento 1.9.2.1 custom modules are showing 404 after SUPEE-6788

texts:
I have uploaded patch SUPEE-6788 on Magento 1.9.2.1 and tried the following:

Using This file I have fixed all the modules through command line after uploading the patch.
I have also fixed whitelisting issues using the same file.
Tried logging out of admin and re logged in.
Removed all cache from /var/cache.
Reindexed my store.

But still all custom modules are showing page 404 in admin.

Note: All the code of custom module is as per This Solution

The functionality is working fine on frontend but admin pages of these modules are not working.

As I have checked after using the FIX code the action in config is the same before and after fix. Check below:

<menu>
      <banners module="banners">
        <title>Banners</title>
        <sort_order>100</sort_order>
        <children>
          <banners module="banners">
            <title>Manage Banners</title>
            <sort_order>0</sort_order>
            <action>admin_banners/adminhtml_banners</action>
          </banners>
        </children>
      </banners>
    </menu>

  Update 1

After applying changes mentioned by Kunj following is my action code and controller file location:

<action>adminhtml/banners/banners</action>

Controller for above action :

app/code/local/{My_Package}/Banners/controllers/Adminhtml/Banners/BannersController.php

I have re-indexed, cleared cache, Logged out and logged in but it still shows page 404.


texts: Product Information Doesn't Show Until I Click Save in Magento

texts:
Products on my site show placeholder image and no product information (price, description etc) until I look them up in Magento and click "save". This works even if I don't change any information at all for the products.

I have about 6k products and most don't show until I do this. Please help!


texts:
I'm very interested in finding a way to create a very simple grouped product.  This is mostly like a simple product, but is made up of multiple simple products for inventory tracking purposes.

Unfortunately, neither Magento configurable products or bundles work the way I would like.  One problem is quantities of items are editable, and the other reason is the order shows a list of subproducts rather than a single product being purchased.

As I mentioned, the reason I want this to be a bundle of simple products is a) for inventory tracking, and b) shipping calculations.  Other than that I want the customer to think they are buying a single product rather than see a list of individual products on their order.

Anyone aware of any extensions that support this?


texts: DOB of customer changed in database for one store in magento 1

texts: customer signup during checkout in magento 1.I have using 2 stores in it, when I register a user for thai store and check DOB. It save wrong DOB in database but log file shows correct DOB.


texts:
I want to get the currently logged in account details.
I know it is possible to get this information using:

Mage::getSingleton('customer/session')->getCustomer();
Mage::helper('customer')->getCurrentCustomer();

But what is the difference between these two ways?

What is the best approach?


texts: The following tag(s) are not allowed: img [] [] after Magento upgrade

texts:
I recently upgraded from 2.2 to 2.3 but since then I get this on system.log
main.CRITICAL: The following tag(s) are not allowed: img [] []

Thanks :D


texts: How to change price, the price calculation in cart through custom module Magento 2?

texts:
Here
in my custom module:

This product with 50 quantities price is 6,000

But when I add to  cart this multiplies

So how I can fix this?

Can I use observer to change this or are there any other best way?
Thanks

 if ($quoteId != 0 && ($priceOne!=$item->getCustomPrice() || $quoteQty!=$item->getQty())) {
                $flag = 1;
                $item->setCustomPrice($priceOne);
                $item->setOriginalCustomPrice($priceOne);
                $item->setQty($quoteQty);
                //$item->setRowTotal($priceOne * $quoteQty);
                $item->setRowTotal($priceOne * 1);
                $item->getProduct()->setIsSuperMode(true);
                if ($helper->checkAndUpdateForDiscount($item)) {
                    $item->setNoDiscount(1);
                } else {
                    $item->setNoDiscount(0);
                }
                $item->save();
                $this->_messageManager->addNotice(
                    __(
                        "You can't edit quote items"
                    )
                );
            }
        }
    }


texts:
I have working enterprise edition of magento  site in my local machine.

I set up the same in the live with the same DB. But that is not working.

Showing browser errors like "The page isnt working" in firefox..

"page isn’t working, ERR_TOO_MANY_REDIRECTS" in chrome.

And it redirects to www.mysite.com/install/

I have cleared the cookies and tried with private window also. Nothing helps.

Let me know if anyone faced similar issue.

Thanks in advance


texts:
How does Magento 2 adjust the prices when configurable options clicked?

I'm trying to figure out how the price is getting changed or figure out which event listener gets called when those checkboxes are checked but so far had no luck.


texts:
I installed OPC and now I'm unable to checkout. So here's what's happening, when I click on "Place Order", the button gets disabled and the page goes nowhere. There is no order saved and the cart is still full.

I checked this in Firefox using the Console and everything happens fine, but it gets stuck at
POST http://www.mywebsite.com/onepage/json/saveOrder [HTTP/1.1 500 Internal Server Error 1340ms]

I tried increasing the Memory size to 256M in php.ini, but it still isn't working. Please help. Also disabled all third party extensions.

Thanks


texts: Magento 2: How to update order status programmatically in custom module?

texts:
$orderId = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')->load($orderId);
$order->setState("processing")->setStatus("processing");
$order->save();

Please tell me how I update the order status in Magento 2?


texts: Return order details in REST API Magento-2

texts:
I am writing a custom API which will use a customer token in authorization header and will able to fetch the order details.

Below is my code:

File : CustomerOrderRepositoryInterface.php

<?php
namespace Vendor\Modulename\Api;

interface CustomerOrderRepositoryInterface
{
    /**
     * Get Customer Order.
     *
     * @api
     * @param int $customerId
     * @param int $orderId
     * @return \Magento\Sales\Api\Data\OrderInterface Order interface.
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getOrder($customerId, $orderId);
}

File : CustomerOrderRepository.php

<?php
namespace Vendor\Modulename\Model\Resource;

use Vendor\Modulename\Api\CustomerOrderRepositoryInterface;
use Magento\Sales\Model\OrderRepository;
use Magento\Framework\Exception\NoSuchEntityException;

class CustomerOrderRepository implements CustomerOrderRepositoryInterface
{
    /**
     * @var \Magento\Sales\Model\OrderRepository
     */
    private $orderRepository;

    /**
     * CustomerOrderRepository constructor.
     *
     * @param \Magento\Sales\Model\OrderRepository $orderRepository
     */
    public function __construct(
        \Magento\Sales\Model\OrderRepository $orderRepository
    ) {
        $this->orderRepository = $orderRepository;
    }

    /**
     * Get Customer Order.
     *
     * @param int $customerId
     * @param int $orderId
     * @return \Magento\Sales\Api\Data\OrderInterface Order interface.
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getOrder($customerId, $orderId)
    {
        /**
        * Here I have put some custom checks before proceeding to fetch the order details and
        * based on that I am getting the $customerOrderId from my custom table.
        */

        if($customerOrderId == $orderId) {
            /** Here I am passing the correct order ID.
              *I am able to get the details with admin token for same orderId.*/
            $orderDetails = $this->orderRepository->get($orderId);
            return $orderDetails;
        }else {
            throw new NoSuchEntityException(__('There is no order with number "%1" is associated.',$orderId));
        }
    }
}

File : webapi.xml

<?xml version="1.0" ?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
    <route url="/V1/vendor/orders/:orderId" method="GET">
        <service class="Vendor\Modulename\Api\CustomerOrderRepositoryInterface" method="getOrder"/>
        <resources>
            <resource ref="self"/>
        </resources>
        <data>
            <parameter name="customerId" force="true">%customer_id%</parameter>
        </data>
    </route>
</routes>

I am getting the error below in the response. (I tried using use Magento\Sales\Api\OrderRepositoryInterface too)

{
    "message": "No such entity with %fieldName = %fieldValue",
    "parameters": {
        "fieldName": "orderId",
        "fieldValue": "17"
    }
}

How I can fetch the order details in this scenario?


texts: Getting page error 404 while calling Mage::getStoreConfig with current storeId

texts:
Using Magento 1.9.3 Mage::getStoreConfig is redirecting magento admin to 404 page instead of retrieving the store field value.

In controller

$store = $this->getRequest()->getParam('website');

if (!$store) {
    $storeID = 1; //use default store if none was given
} else {
    $storeID = Mage::app()->getWebsite($store)->getId();
}

Mage::helper('setstartordernumber')->getOrderNumber($storeID)

In helper

class Aschroder_SetStartOrderNumber_Helper_Data extends Mage_Core_Helper_Abstract {

    public function getOrderNumber($iStoreId=null) {
        return Mage::getStoreConfig('sales/setstartordernumber/order',$iStoreId);
    }
}

What could the code be missing? Any idea?

Update:

This issue arise only when calling Mage::getStoreConfig from Helper.


texts: magento getProductCollection add random order and exclude a product id only from output

texts:
I want to get random product from category id which is working find but i want to exclude a particluar product id from out and show output in random order

Below is my code , please help me with way i can get random order and exclude product id

$cateinstance = $objectManager->create('Magento\Catalog\Model\CategoryFactory');
$cateid = $allcatsmain;
$allcategoryproduct = $cateinstance->create()->load($cateid)->getProductCollection()->setPageSize(4)->addAttributeToSelect('*');


texts: Magento 2: Add border-radius to image on product page

texts:
Magento 2.2.1 using a custom theme which inherets from Magento/blank.

I would like to add a border-radius to the main image on the product page.

I have tried applying border-radius to parent containers without success, but the image itself is loaded with fotorama and I'm not sure how to cleanly alter the styles for this.


texts: QLSTATE[23000]: Integrity constraint violation: 1452 while saving Customizable Options

texts:
Each time i try to add Customizable Options to a product i got this error :

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
(`thailandnamage`.`catalog_product_option_title`, CONSTRAINT `CAT_PRD_OPT_TTL_OPT_ID_CAT_PRD_OPT_OPT_ID` FOREIGN KEY (`option_id`) REFERENCES `catalog_product_option` (`option_id`) ON DELETE CA),
query was: INSERT INTO `catalog_product_option_title` (`option_id`, `store_id`, `title`) VALUES (?, ?, ?)

Which says that magento cannot add orphan row to catalog_product_option_title, because the option_id don't exist into catalog_product_option but since it is new entry, why it can't add the row on that table first ? If the bug happen since the beginning i would understand, but why this bug start to happen ?

something wrong with the db ?

It start to occurs after i tried to add an article but the page didn't finish the task (504 error).

I have check the db, and it look ok... i even did a backup of the db from date before the bug occurs.

Does anyone know how was to check/fix ?

NB: When i try to import custom option from an other product i got this error (after saving the product):

No such entity.

Thanks !


texts: How to rename an existing custom table in Magento 2?

texts:
I created a table with name "Redeem_blanace" using InstallSchema.php as:

class InstallSchema implements InstallSchemaInterface
{
    /**
    * {@inheritdoc}
    * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
    */
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {

      $setup->startSetup();

      $table = $setup->getConnection()->newTable($setup->getTable('Redeem_balance')
      )->addColumn(
        'transaction_id',
        Table::TYPE_INTEGER,
        null,
        ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' =>true],
        'Transaction_Id'
      )->addColumn(
        'gift_code',
        Table::TYPE_TEXT,
        255,
        ['nullable' => true],
        'Gift_Code'
      )->addColumn(
        'redeem_amount',
        \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
          '20,4',
          ['nullable' => false, 'default' => 0],
        'Redeem_Amount'
      )->addColumn(
          'date_expires',
          Table::TYPE_TEXT,
          null,
          ['nullable' => true],
          'Date_Expires'
      )->addColumn(
        'expired_amount',
        Table::TYPE_INTEGER,
        null,
        ['unsigned' => false, 'nullable' => false],
        'Expired_Amount'
      )->addIndex(
        $setup->getIdxName('Redeem_balance', ['transaction_id']),
        ['transaction_id']
      )->setComment(
        'Redeem Balance Tracking Table'
      );
      $setup->getConnection()->createTable($table);

      $setup->endSetup();

      }
}

I wanted to change the table name to "pme_customerbalance"
How can I do this ?


texts: How to check whether a product already exists or not in a category?

texts:
In Manage Products, before saving the product, I want to check whether the product already exists or not under the category.
For example, I would like to check whether the Product ID 1 already exists or not under category id 1.

Thank you.


texts: We are facing an strange issue that products in listing pages are not showing in frontend. we are importing products from zoho and we have setup crons as update by schedule. Suddenly products got disappeared in listings page and there is no logs reported but when we reindex manually the products are showing.Does anyone faced this kind of issue , we are using magento 2.2.5 version.when we index catalog search, products are showing.can anyone know where to debug and to solve this issue.


texts: How to override productcollection.php from vendor?

texts:
I have to override the file ProductCollection.php from vendor/magento/module-catalog/Ui/DataProvider/Product.

I have read many posts but still not getting to override the file.

Can anyone please explain it to me step by step?

Your help is greatly appreciated.


texts: Magento 2 : Error When searching in the grid of a custom module

texts:
I have a problem in my custom module when search using title in the admin grid and also the next page of grid. Sorry for the image erasures.

Correct me if I'm wrong in my title of this question.

Thank you.

This will be the error message in the console when opened


texts: Magento 2: How to override theme LESS styles within custom module

texts:
I am running Magento 2.3 on Ubuntu 18.04 server with Apache 2.4, MariaDB and PHP 7.2. Magento is running in developer mode.

I have created a custom theme which inherits from the Magento/blank theme.

I have also created a module, which should override the theme's style and apply a background image to the header.

I have created a basic module according to Magento's documentation. Styles are contained within the module's _module.less file which are intended to override the backgroundproperty which was set within my custom theme.

Once I upload the module and issue the commands php bin/magento cache:flush, php bin/magento setup:upgrade and then php bin/magento module:status, I can see that my module has been successfully registered and enabled.

When I inspect the source of my website using my web browser's code inspector, I can see that the value I assigned is not compiled into the CSS files.

My initial thought was that I had bad syntax in my _module.less file, but I don't see any compilation errors, so I assume that either the _module.less file is never acknowledged during compilation, or that my theme's styles are prioritised over those of the module.

The [module_author]/[module_name]/view/frontend/web/css/source/_module.less file contains the following code:

// /**
//  * Copyright © Joshua Flood. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Variables
//  _____________________________________________

@header__background-image:  "../../images/header-background-image.png";
@header__background-color:  #EEF;
@header__background:        @header__background-image,
                            @header__background-color;

//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    //
    //  Header
    //  ---------------------------------------------

    .page-header {
        .lib-css(background, @header__background);
    }
}

The obvious solution to this problem would be to ensure that the syntax is correct and then to ensure that the module styles properly override the theme styles.

I would be happy, however, if someone could explain to me how I would go about integrating the background styling into my existing theme, but create a file upload form on the backend which would allow the admin user to replace the background image, although I'm not sure that this can be done without implementing a separate module.


texts:
I want cart items like product ids, product names of particular customer id.

Is there any solution for this?


texts: Magento 2 custom theme setup:static-content:deploy en_GB on production mode does not work!

texts:
I've been doing this for while and having to end up either going to developer mode then production to push e.g css changes or run setup:upgrade then setup:static-content:deploy en_GB && cache:clean && cache:flush but this also 99% percent of the time breaks styling and having to run again setup:static-content:deploy en_GB && cache:clean && cache:flush.

I would think that in production mode one would run setup:static-content:deploy en_GB && cache:clean && cache:flush would copy css changes from custom theme into magento system pub folder.

Anyone having any ideas and how do you go about deploy static on production mode?  thanks.


texts: Magento 2 Adding a custom block template to CMS page

texts:
I'm struggling including my custom module/block template into a static CMS page.

Here's my block code:

<block class="Magento\Framework\View\Element\Template" name="custom_slider_block" template="Custom_Slider::slider.phtml" />

How would I implement this in a static CMS page?

Edit:

I've added a block file with the following code:

<?php
 namespace Custom\Slider\Block;

 class Slider extends \Magento\Framework\View\Element\Template
 {
   public function _prepareLayout()
  {
    return parent::_prepareLayout();
   }
 }

and changed my block call to:

{{block class="Custom\Slider\Block\Slider" template="Custom_Slider::slider.phtml"}}

But now I get the error:

  Error filtering template: Invalid block type: Custom\Slider\Block\Slider

Edit 2:

Got it working, realised I hadn't included a registration.php file to actually enable the module.


texts: Would there be any tips or documentation of moving of the soon to be defunct magentogo to community edition?


texts: Images not loading and size and color dropdown also not loading with Apache and NGINX

texts:
im struggling with Magento 2.2.4, its giving so many errors.

Initially we had Apache web server with PHP 7.1 and NO nginx. In this scenario sometimes the color and size dropdown were not getting populated but when we refresh the page it loads the dropdown. So I searched for the solution and people recommended to have Apache + NGINX + PHP FPM.

So we installed NGINX and PHP FPM. But now there is a completely new problem. The images are not loading, the size and color dropdown also not loading. Even after refreshing the web page the situation remains the same. Its happening for every product.

Seriously speaking im tired of resolving issues with Magento 2.2.4, is this version not stable?

and im getting this error message in console

jquery-migrate.min.js:6 JQMIGRATE: Logging is active blue-and-gold-lehenga-for-little-girls-party-wear.html:14 Uncaught SyntaxError: Unexpected token , in JSON at position 3804 at JSON.parse () at getNodeData (scripts.min.js:5) at Array.map () at scripts.min.js:6 at HTMLDocument.apply (main.min.js:5) at fire (jquery.min.js:212) at Object.add [as done] (jquery.min.js:215) at jQuery.fn.init.jQuery.fn.ready (jquery.min.js:223) at jQuery.fn.init (jquery.min.js:200) at new jQuery.fn.init (jquery-migrate.min.js:27)

Pls check the screen shot.


texts:
I am new to this magento world and stuck on a problem: I need to create a attribute rule which can add 20% in all prices by default. In fact I created a rule with name "standard VAT" in Sales->Tax->Manage Tax Rules.

However, by default Magento is using "None" as the default Tax Class in Product > Price > Tax Class. How can we make Magento use my tax class "Standard VAT" by default instead?

I know one way is by selecting all products and editing the Tax Class attribute, but that is not a viable solution for us. If we go this route we have to apply that edit too often as our listing updates every 30 minute.

We need a 1 time solution so that all our newly add products and existing products can automatically use the new Tax Class.

If you know any way we can edit any file in magento please advise us with full file path, code to add and line number.

Thank you for your help in advance.

(I did what ever they recommenced here but this inst the solution for me: magentocommerce.com/knowledge-base/entry/ce18-and-ee113-vat-gst)


texts:
I know how to retrieve last order id by this code,

$this->_checkoutSession->getQuote()->getReservedOrderId();

Where _checkoutSession is obtained with the injection,

\Magento\Checkout\Model\Session $checkoutSession

I want to know how to get the current order ID in magento 2.


texts: Equivalent code of Mage::app()->getLocale()->getNumber() in Magento2

texts:
I would like to find out the magento2 equivalent of the below code from magento 1

Mage::app()->getLocale()->getNumber()

Can anyone assist me?


texts:
I am straggling making a module for a site that needs something like photo gallery.My problem is that i am trying to do the same media uploader that magento uses for products.I can't understand how it is implemented or how i can do it for my module.I tried to follow those links:
x
    Add Media Uploader to Custom Module
but i can't find the code attached or how to do it.So my question is how can i start with it?Is there anything i can read to understand what do i need to implement the same media uploding process that products have?


texts: update product quantity on check out page magento

texts: I want to provide functionality to update product quantity on checkout page of magento. so if user want to update the product quantity he can do it on checkout page rather to go back on cart page.


texts: How to upgrade Enterprise Edition of Magento 1.14.0.1 no data loss

texts:
I use Magento 1.14.0.1 EEdition, it is on low PHP version - 5. How do I have to proceed to upgrade to higher version of thr same EE Magento 2x? I saw lots of patches here: https://github.com/brentwpeterson/magento-patches/tree/master/EE1.14
How to proceed, if you could help me to proceed? It is important also to update the PHP version in the upgrade process. I already used data migration tool to upgrade to 1.9 community and then go to 2x but no success.
Thanks!


texts: How to add sub-menus to Magento admin dashboard in Magento2.2.5?

texts:
How to add sub-menu to Magento admin dashboard in Magento 2.2.5? I need to override the vendor file.

Refer my Screenshot.

Any help would be appreciated.


texts:
When i click buy button items are adding into the cart.But When I do checkout, after logging from account and then filling shipping details,the cart becomes empty.Normally the URL which is followed for checkout is www.mysite.com/checkout/onepage/ but as my cart is getting empty the URL redirects to www.mysite.com/checkout/cart/.I am working on php5, magento 1.7 and nginx as local host.I am clueless about what is happening here.
I am newbie.


texts: How to get last inserted attribute option Id?

texts:
I use the following code to add an option to my "dropdown attribute":

public function createAttributeOption($option){
    $arg_attribute = 'attribute_code';
    $arg_value = $option;

    $attr_model = Mage::getModel('catalog/resource_eav_attribute');
    $attr = $attr_model->loadByCode('catalog_product', $arg_attribute);
    $attr_id = $attr->getAttributeId();

    $option['attribute_id'] = $attr_id;
    $option['value']['any_option_name'][0] = $arg_value;

    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
    $setup->addAttributeOption($option);
    return '???';
}

and that perfectly inserts the option to my attribute.
The question is I need to return the inserted option's ID from this function. How can I get the id of this last inserted option?


texts: I'm trying to figure out the best way to interact with the Customer session using the service layer. I couldn't identify the proper repository to use. Any ideas?


texts: RLIMIT_NPROC is exceeded every night at 0:00

texts:
I'm getting following error, every night at 0:00 for like 20 minutes. Then the shop is back again. All other things on the server are running smothely, so I think it is an Magento Problem.

Error in line 838

cannot fork, most likely the process limit RLIMIT_NPROC is exceeded

What I've done so far is deactivated all cronjobs. The Mistakes keeps popping up. There is nothing to find in the php error logs.

I need hints how to analyse the problem or best - to get rid of it. Thanks for your help!


texts: Magento 2 : How connect Magento with Neo4j Graphical Database

texts:
Does any one know how to connect Magento 2 with Neo4j Graphical Database ?

There is a PHP client library (composer require graphaware/neo4j-php-client:^4.0) which i have updated in Magento project, resulted copied into the vendor directory.

Then i m trying to add following code which is not working properly.

<?php

require_once 'vendor/autoload.php';

use GraphAware\Neo4j\Client\ClientBuilder;

$client = ClientBuilder::create()
    ->addConnection('bolt', 'bolt://neo4j:password@localhost:7687')
    ->build();
$query = "MATCH (n:Person)-[:FOLLOWS]->(friend) RETURN n.name, collect(friend) as friends";
$result = $client->run($query);

foreach ($result->getRecords() as $record) {
    echo sprintf('Person name is : %s and has %d number of friends', $record->value('name'), count($record->value('friends'));
}

Any other libraries are required to get it work it properly?


texts: Magento 2 - Add configurable product and options to quote

texts:
I'm trying to add a configurable product (and the chosen options) to the quote.

In Magento 1 you could use this:

$storeId = Mage::app()->getStore()->getStoreId(); // get current store id
$quote = Mage::getModel('sales/quote')->setStoreId($storeId)->load(4); //4 is your quote id
$params = array(
        'product' => 1,
        'super_attribute' => array(
            132 => 3,
            133 => 8
        ),
        'qty' => 1,
    );
$product = Mage::getModel('catalog/product')->load(1); //your config product is
$quote->addProduct($product, new Varien_Object($params))->save();

I haven't been able to find any help for Magento 2 though.

Anyone have a clue for issue?

*EDIT - This is the code I have tried based on Rakesh's answer below

<?php

namespace Sulman\AddConfigurableToQuote\Controller\Add;
use Magento\Catalog\Model\Product;

set_time_limit(0);

class Index extends \Magento\Framework\App\Action\Action
{
    protected $productFactory;
    protected $quote;
    protected $session;
    protected $product;
    protected $formKey;
    protected $cart;

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Quote\Model\QuoteFactory $quote,
        \Magento\Catalog\Model\ProductFactory $productFactory,
        \Magento\Framework\Data\Form\FormKey $formKey,
        \Magento\Checkout\Model\Session $session,
        \Magento\Catalog\Model\Product $product,
        \Magento\Checkout\Model\Cart $cart,
        array $data = []
    ) {
        $this->productFactory = $productFactory;
        $this->quote = $quote;
        $this->session = $session;
        $this->formKey = $formKey;
        $this->cart = $cart;
        $this->product = $product;
        parent::__construct($context,$data);
    }

    public function execute()
    {
        $product = $this->productFactory->create()->load(3); /* config product id */

        /* 136 is finish id and 137 is length attribute id */
        $requestInfo = new \Magento\Framework\DataObject(
            ['qty' => 1,'super_attribute' => array(136 => 4, 137 => 6)]
        );

        /** @var $quote \Magento\Quote\Model\Quote $quote */
        $quote = $this->session->getQuote();
        $quote->setStoreId(1);
        $quote->addProduct($product, $requestInfo);
        $quote->save();
    }
}


texts: In admin panel dropdown's are not working

texts:
Mag v1.8.1.0

I tried opening system>transational emails>New but nothing is shown in the drop down.

When i did inspect element the following error is displayed.

<select id="template_select" name="code" class="select required-entry">
Fatal error:  Class 'Mage_CsVendorVacation_Helper_Data' not found in /home/rootname/public_html/app/Mage.php on line 547</select>


texts: I am creating a custom widget "SPONSORED BEST SELLER PRODUCTS" block to show on home page. Bestseller.phtml file not rendering in the front end

texts:
This is my registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
     \Magento\Framework\Component\ComponentRegistrar::MODULE,
     'Relabs_LabAPI',
     __DIR__
    );

  This is my module.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Relabs_LabAPI" setup_version="1.0.2" schema_version="1.0.0">
        <sequence>
            <module name="Magento_CatalogWidget"/>
        </sequence>
    </module>
</config>

  This is my widget.xml

<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget id="sponsored_bestsellerwidget" class="Relabs\LabAPI\Block\Widget\Bestseller">
        Bestseller
        <description>Widget in Magento2</description>
        <parameters>
            <parameter name="title" xsi:type="text" required="false" visible="true">
                Title
            </parameter>
            <parameter name="description" xsi:type="text" required="false" visible="true">
                Description
            </parameter>
        </parameters>
    </widget>

</widgets>

  This is my Bestseller.php

<?php

namespace Relabs\LabAPI\Block\Widget;
use \Magento\Framework\View\Element\Template;
use \Magento\Widget\Block\BlockInterface;

class Bestseller extends \Magento\CatalogWidget\Block\Product\ProductsList  {
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('widget/Bestseller.phtml');
    }
    public function createCollection()
    {
        $collection = $this->productCollectionFactory->create();
        $collection = $this->_addProductAttributesAndPrices($collection)
            ->setPageSize(2) // only get 2 products
            ->setCurPage(1)  // first page (means limit 0,10)
            ->load();
        return $collection->getData();
    }

}

  Till here everything is working fine.
  when I am printing $collection, below is the output

Array
(
    [0] => Array
        (
            [entity_id] => 1
            [attribute_set_id] => 15
            [type_id] => simple
            [sku] => 24-MB01
            [has_options] => 0
            [required_options] => 0
            [created_at] => 2018-10-09 06:27:13
            [updated_at] => 2018-10-09 06:27:13
            [price] => 34.0000
            [tax_class_id] => 2
            [final_price] => 34.0000
            [minimal_price] => 34.0000
            [min_price] => 34.0000
            [max_price] => 34.0000
            [tier_price] =>
        )

[1] => Array
    (
        [entity_id] => 2
        [attribute_set_id] => 15
        [type_id] => simple
        [sku] => 24-MB04
        [has_options] => 0
        [required_options] => 0
        [created_at] => 2018-10-09 06:27:13
        [updated_at] => 2018-10-09 06:27:13
        [price] => 32.0000
        [tax_class_id] => 2
        [final_price] => 32.0000
        [minimal_price] => 32.0000
        [min_price] => 32.0000
        [max_price] => 32.0000
        [tier_price] =>
        )

)

  This is my widget template(Bestseller.phtml)

<?php
  $blockObj= $block->getLayout()->createBlock('RecoSense\LabAPI\Block\Widget\Bestseller');
  $blockObj->createCollection();
?>

  What should I do here so that it can use existing theme block
  like "RECENTLY VIEWED ITEMS". I dont want to create custom
  html templates, I want to use the theme block template.
  Please suggest ???


texts: Admin Panel not displaying correctly under SSL

texts:
Running 1.7.0.2 and we just switched the Secure Admin flag to "yes."  However, when we navigate to admin using https:// text displays but no pictures/formatting/etc...

The error console shows multiple errors like this when trying to load CSS/JS files:

Mixed Content: The page at 'https://website.com/admin/' was loaded over HTTPS, but requested an insecure stylesheet 'http://website.com/skin/adminhtml/default/default/reset.css'. This request has been blocked; the content must be served over HTTPS.

"Use Secure URLs in Frontend" and "Use Secure URLs in Admin" drop down boxes are both set to 'Yes.'


texts: Setting up two seperate stores that share the same inventory

texts:
We have 2 stores in Magento, one for wholesale and one for retail. Both stores sell the same products, except the wholesale store will be selling only one category of the overall products.

We want the inventory to be shared between the two stores, except they are totally independent of each other.

Just to explain a scenario:

If I have 100 of the same product available, I want the 100 to be available in both wholesale AND retail stores (Lets say 70 are available in the wholesale store, and 30 in the retail store).  If a wholesale buyer purchases 30 in the wholesale store, immediately only 70 will be available in both stores, leaving 40 available in the wholesale store and 30 will still be left in the retail store.

We're currently on Magento Enterprise ver. 1.12.0.1

What extensions would be needed to set this up, or can Magento do this by default?


texts: How set 404 HTTP response status from a block?

texts:
I'm trying to set 404 HTTP response status from a block's function.

With this code works

http_response_code(404);
exit;

but no way to to set the 404 status without exiting, i've found only solutions for controllers.


texts: SUPEE-9767 Patch/CE 1.9.3.3 + checkout form validation breaks multishipping in default theme

texts:
On a clean install of CE 1.9.3.3, multishipping is broken when using the default theme and enabling checkout form key validation.

How to reproduce:

Change the theme from rwd to default
Enable the Enable Form Key Validation On Checkout setting
Add a product to the cart and go the checkout/cart page.
Click on "Checkout with Multiple Addresses" to go to the checkout/multishipping/addresses page.
On this page, observe that the following buttons do not have any effect:

"Enter a New Address"
"Update Qty & Addresses"
"Continue to Shipping Information"

This issue is also present on previous Magento versions with SUPEE-9767 installed.


texts:
An extension I'm using creates two custom pages in website:

app/design/frontend/mytheme/default/layout/scommerce_competition.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <competition_index_index>
        Competition
        <reference name="head">
            <action method="setTitle" translate="title"><title>Competition</title></action>
            <action method="addCss"></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="scommerce_competition/entry" name="entry" template="scommerce/competition/entry.phtml">
            </block>
        </reference>
    </competition_index_index>

    <competition_index_enter>
        Competition
        <reference name="head">
            <action method="setTitle" translate="title"><title>Competition</title></action>
            <action method="addJs"></action>
            <action method="addCss"></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="scommerce_competition/success" name="success" template="scommerce/competition/success.phtml">
            </block>
        </reference>
    </competition_index_enter>
</layout>

competition_index_index works ok but competition_index_enter page gives 404 not found error.

etc/config.xml

<frontend>
    <routers>
        <competition>
            <use>standard</use>
            <args>
                <module>Scommerce_Competition</module>
                <frontName>competition</frontName>
            </args>
        </competition>
    </routers>
    <layout>
        <updates>
            <competition>
                <file>scommerce_competition.xml</file>
            </competition>
        </updates>
    </layout>
</frontend>

What could cause this error? Any ideas?


texts: Updated version of patch SUPEE-7405 V.1.1

texts:
Yesterday (February 23, 2016) I received a notification about a new Version of the patch SUPEE-7405. At first I was a little confused as I applied this patch back in January.

What is changed in this new version?

As I understand there are no new security issues is just to make additional fixes to the security issues that were patch with V1.0. Is this correct?


texts: Why to keep id and frontName same in magento 2 routes config file?

texts:
Just curious about Why to keep id and frontName same in magento 2 routes config file ?

Below is Sample frontend route xml config file.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route id="mastering" frontName="mastering">
            <module name="Mastering_SampleModule" />
        </route>
    </router>
</config>

Thanks


texts: Magento 2 - Get data attribute value and check if has value per product

texts:
I create one custom date attribute for my products in backend:

I need to get the attribute value in the products list page and to check if the product have any data added for the product.

I try something like this but is not work well:

$expectedInDate = $_product->getResource()->getAttribute('expecdate')->getFrontend()->getValue($_product);
if(isset($expectedInDate)) :
...........
endif;

What is the correct way to get data attribute value and to check if has data setup per current product?

The entire code:

<?php $timezoneInterface = $objectManager->create('\Magento\Framework\Stdlib\DateTime\TimezoneInterface');  ?>
<?php $expectedInDate = $_product->getResource()->getAttribute('expecdate')->getFrontend()->getValue($_product); ?>
<?php if ($StockState->getStockQty($_product->getId(), $_product->getStore()->getWebsiteId()) > 0 ): ?>

<?= /* @escapeNotVerified */ __('In stock') ?>

<?php else: ?>
    <?php if($expectedInDate) : ?>
        <?php $date =   $timezoneInterface->date($expectedInDate)->format('m/d/Y');?>

<?= /* @escapeNotVerified */ __('Available in:') ?><?php echo $date; ?>

    <?php else: ?>

<?= /* @escapeNotVerified */ __('Out of stock') ?>

    <?php endif; ?>
<?php endif; ?>


texts:
I'm trying to add an extra data to the file:

/app/design/adminhtml/default/ad02/template/downloadable/sales/items/column/downloadable/name.phtml

Target idea: provide a link with  a href="....":

<?php if ($this->getLinks()): ?>

<?php echo $this->getLinksTitle(); ?>

            <?php foreach ($this->getLinks()->getPurchasedItems() as $_link): ?>

                  <a title="Download" href="<?php echo $_link->getLinkHref() ?>">
                    <?php echo $_link->getLinkTitle() ?>
                   (<?php echo $_link->getNumberOfDownloadsUsed() . ' / ' . ($_link->getNumberOfDownloadsBought()?$_link->getNumberOfDownloadsBought():Mage::helper('downloadable')->__('U')) ?>)

            <?php endforeach; ?>

    <?php endif; ?>
    <?php echo $this->htmlEscape($_item->getDescription()) ?>

I suppose to do that by extending a related Magento Block with a new method getLinkHref()(see above). This is current Block Class contents:

class Mage_Downloadable_Block_Adminhtml_Sales_Items_Column_Downloadable_Name extends Mage_Adminhtml_Block_Sales_Items_Column_Name
{
    protected $_purchased = null;
    public function getLinks()
    {
        $this->_purchased = Mage::getModel('downloadable/link_purchased')
            ->load($this->getItem()->getOrder()->getId(), 'order_id');
        $purchasedItem = Mage::getModel('downloadable/link_purchased_item')->getCollection()
            ->addFieldToFilter('order_item_id', $this->getItem()->getId());
        $this->_purchased->setPurchasedItems($purchasedItem);
        return $this->_purchased;
    }

    public function getLinksTitle()
    {
        if ($this->_purchased && $this->_purchased->getLinkSectionTitle()) {
            return $this->_purchased->getLinkSectionTitle();
        }
        return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE);
    }

    /* I want to insert this method */
    public function getLinksHref()
    {
        return 'http://google.com/'
    }
}

But. I don't want to edit the original file but I want to override this Block Class.
And actually the question is how to Override this block?

My Module's config.xml

<?xml version="1.0"?> <config>
    <modules>
        <AD_DownloadablesGeneratedLink>
            <version>1.0.0</version>
        </AD_DownloadablesGeneratedLink>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <order_items>AD_DownloadablesGeneratedLink_Block_Adminhtml_Sales_Items_Column_Downloadable_Name</order_items>
                </rewrite>
            </adminhtml>
            <AD_DownloadablesGeneratedLink>
                <class>AD_DownloadablesGeneratedLink_Block</class>
            </AD_DownloadablesGeneratedLink>
        </blocks>
     </global>

Thank you so much for you help in advance!

P.S. v1.4.0.1


texts: add a new dropdown to the product edit form, he data should come from a custom table I created magento 2.3

texts: I want to add a new dropdown to the product edit form in magento2. The data should come from a custom table I created in a custom module. How do I do this, is there a good example or tutorial out there?


texts: Show additional attribute on product page when logged in (magento 1.9)

texts:
I would like to show an additional product attribute on the product page in the same place as the rest, but only if I'm loggged in as a certain customer group.

So put simply I need to show an additional attribute on the front end when logged in as a certain customer group.

Any ideas?

Thank you very much in advance,


texts:
I am using Magento ver. 2.3.5-p2
& Mageplaza SMTP
Fatal error: Cannot declare class Zend_Mail_Transport_Sendmail, because the name is already in use in /home/customer/www/site.com/public_html/vendor/magento/zendframework1/library/Zend/Mail/Transport/Sendmail.php on line 0

While sending test email or any email it throws above fatal error.
Is their any quick fix for this ?
Feel free to share your thoughts.
Thankyou


texts: How to just remove extensions with composer.json

texts: I wish to just remove the not needed extensions by adding them to composer.json's "replace" section. However I'm afraid it will also update some of the extensions mentioned in the "require" section. Is there a way just to remove the extensions and not update others? Do I need to somehow lock the version of other extensions?


texts: "Canceled" order because of "Failed merchant rule check" - how to resubmit?

texts:
We had a user submit a large order that exceeded our Paypal security settings for a maximum transaction amount. I have fixed that setting and want to re-submit the order so it charges the user without them having to start a new cart.

Do I click "reorder"?

I want there to be little user interaction so I don't lose this sale. They have already been contacted and want the order to be processed.


texts:
I want to include a new css file styles.css. Steps I've taken:

1) switch to developer mode (magento deploy:mode:set developer);

2) edit dev/tools/grunt/configs/themes.js and include my theme with my new file styles:

my_theme: {
        area: 'frontend',
        name: 'My_company/my_theme',
        locale: 'en_GB',
        files: [
            'css/styles',
        ],
        dsl: 'less'
    },

3) In My_company/my_theme/Magento_Theme/layout/default_head_blocks.xml
I add it like this  <css src="css/styles.css" />

4) In My_company/my_theme/web/css/syles.less I add @import 'source/_theme.less'; and then have My_company/my_theme/web/css/_theme.less with different variables.

5) Run grunt clean, grunt exec, grunt less and it went along fine without errors:

Running "less:my_theme" (less) task
File pub/static/frontend/My_company/my_theme/en_GB/css/styles.css created: 435 B → 992 B

Tried removing everything from the var folder and from pub/static except the .htaccess. Cleared cache, regenerating static folder magento setup:static-content:deploy. Checked in the admin that my theme is selected in web > design. Reindexed.

In view page source magento is still looking for pub/static/frontend/My_company/my_theme/en_GB/css/styles-m.css (which returns a 404) and not including pub/static/frontend/My_company/my_theme/en_GB/css/styles.css

Where can I look next?

Thanks!


texts: Add second image upload tab for products

texts:
How do I create a second image upload tab for products similar to default one? I only need to upload images and so that they belong to that product.

I need this so that I can fetch those images in a template and display them in image gallery.

Has anyone done something similar or know how to do it?


texts: Magento2: Object DOMDocument should be created

texts:
I have installed the Tigren_Ajaxcompare extension. Got the error message below

Object DOMDocument should be created.

Block

<?php
/**
 * @copyright Copyright (c) 2017 www.tigren.com
 */

namespace Tigren\Ajaxcompare\Block;

use Magento\Framework\View\Element\Template\Context;
use Tigren\Ajaxcompare\Helper\Data;

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

    protected $_template = 'js/main.phtml';

    protected $_ajaxCompareHelper;

    public function __construct(
        Context $context,
        Data $ajaxCompareHelper,
        array $data = []
    )
    {
        $this->_ajaxCompareHelper = $ajaxCompareHelper;
        parent::__construct($context, $data);
    }

    public function getAjaxCompareInitOptions()
    {
        return $this->_ajaxCompareHelper->getAjaxCompareInitOptions();
    }
}


texts: Manually via phpmyadmin add magento table

texts:
I've given up trying to make the SQL script for my custom module work, tried all sorts of things online and realized I've spent an hour on it when I can just manually create the table.

Just checking there isn't any issues with this? Like is there any foreign key checks etc.

EDIT

My install script:

$installer = $this;

$installer->startSetup();

$installer->run("

CREATE TABLE IF NOT EXISTS `datasheetadmin_datasheetadmin` (
  `DatasheetAdmin_id` int(11) unsigned NOT NULL auto_increment,
  `attribute_set_id` int(11)  NOT NULL,
  `header_row` text NOT NULL default '',
  `product_row` text NOT NULL default '',
  `custom_product_id` int(11) NOT NULL default 0,
  PRIMARY KEY (`DatasheetAdmin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    ");

$installer->endSetup();


texts:
How to cut short the URL of a controller action page in magento2

For instance:

If custom modules controller page is in : Vendor/Module/Controller/Index/Index.php

in routes.xml: I had defined frontname as : i

Instead of navigating to : localhost/magento/i/index/index

How to optimize the URl to only localhost/magento/i

Basically , i need to achieve this (as in magento1) in Magento2.

<!-- url rewrite -->
<rewrite>
<mypage>
    <from><![CDATA[#^/([\w-]+)/m/?#]]></from>
    <to><![CDATA[/m/index/index/product/$1]]></to>
    <complete>1</complete>
</mypage>
</rewrite>
<!-- end url rewrite -->
<frontend>
<routers>
<mypage>
  <use>standard</use>
    <args>
       <module>Vendor_Module</module>
       <frontName>m</frontName>
    </args>
  </mypage>
 </routers>

For the above rewrite : we can get the controller action just by:

localhost/magento/m

Need to achieve the same in Magento2 ?

UPDATE:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
    <route id="m" frontName="m">
        <module name="Vendor_Module"/>
    </route>
</router>

Controller path:  \Vendor\Module\Controller\Result\Index.php

layout file name: m_result_index

URL: localhost/magento/m

I get 404 no found.

Cleared cache and gen


texts:
Below is my code how to write this code without object manager.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        //get current product
        $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
        $productId = $product->getId();


texts:
The challenge is that I have checkboxes on the page. This code finds all the checkboxes on the page and if the checkbox is selected, it adds it to a separate block.
I want to limit the amount that can be added to this block to 4x. And the idea is that if implement a counter in the widget, what will increase with each addition and decrease when the checkbox is removed, then I can control this process. Please help with this task.

Update

item:

    <img src="<?php echo $this->getViewFileUrl('Dv_BuildingBedPage::images/image3.png'); ?>" />

        <input type="checkbox" />

selected items block:

Selected Samples


texts: Magento 2: How to get store Email address?

texts: How to get the store email in my custom module in the controller file?


texts: Magento 2.3.2 - Your password reset link has expired

texts:
I use Magento 2.3.2. If I request a password reset via the admin, I immediately receive an email with a reset link. If I click on it immediately, I get the message "Your password reset link has expired".

If I request a password reset via the front of the website, I get the message "We cannot send the password reset email."

Is there anyone who can help me solve this problem.
I use the Porto theme.


texts: main.ERROR: Command returned non-zero exit code:`jpegoptim --all-progressive --strip-all -m 80

texts:
After upgrade to M2 2.4.2 we see the following two kind of errors for jpegoptim and optipng a lot of times in our Magento exception.log
Can anyone guide us in the right direction- Why do we get this error,  and how can we solve it?
Best regards,
Jesper
[2021-05-11 07:49:17] main.ERROR: Command returned non-zero exit code:
jpegoptim --all-progressive --strip-all -m 80 '/home/shop/www/pub/media/catalog/product/cache/1fed3ee755d711f7422be72672e4897b/b/6/b62f1e67d31399d5bad10ed77014a7c6.jpg' 2>&1 {"exception":"[object] (Magento\Framework\Exception\LocalizedException(code: 0): Command returned non-zero exit code:
jpegoptim --all-progressive --strip-all -m 80 '/home/shop/www/pub/media/catalog/product/cache/1fed3ee755d711f7422be72672e4897b/b/6/b62f1e67d31399d5bad10ed77014a7c6.jpg' 2>&1 at /home/shop/www/vendor/magento/framework/Shell.php:64, Exception(code: 1): /home/shop/www/pub/media/catalog/product/cache/1fed3ee755d711f7422be72672e4897b/b/6/b62f1e67d31399d5bad10ed77014a7c6.jpg  [ERROR] at /home/shop/www/vendor/magento/framework/Shell.php:63)"} []
[2021-04-28 02:44:50] main.ERROR: Command returned non-zero exit code:
optipng '/home/babygear/www/pub/media/catalog/product/cache/c5b405e6e4612c50e7ed5650f6c647ae/r/i/rice_aw20_094.png' 2>&1 {"exception":"[object] (Magento\Framework\Exception\LocalizedException(code: 0): Command returned non-zero exit code:
optipng '/home/babygear/www/pub/media/catalog/product/cache/c5b405e6e4612c50e7ed5650f6c647ae/r/i/rice_aw20_094.png' 2>&1 at /home/babygear/www/vendor/magento/framework/Shell.php:64, Exception(code: 1): ** Processing: /home/babygear/www/pub/media/catalog/product/cache/c5b405e6e4612c50e7ed5650f6c647ae/r/i/rice_aw20_094.png


texts: Magento attribute dropdown values(Yes/No) prints (numeric values)

texts:
I created an Attribute of type dropdown. I assigned two values of "Yes" & "No". While printing those attributes values, while comparing products i get the values like "133" / "134" . Is it because of systems predefined value or what it is ? How can i get the same value as i assigned for options "Yes" or "No" get printed as attribute value?

Note : I tried attribute type 'yes/no' , this prints '1' and ' ' (this will not be clear to visitors/customers).

The code below prints the numeric value for only dropdown attribute type where as its working nicely for input field attribute type

$valueattr = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_item->getId(), $_attribute->getAttributeCode(), $storeId);


texts: Product not found when searching by Title

texts:
There are some products in my store that are not displayed in search results, when searching by product name. Same products are found in search results when searching by sku.

I have tried re-indexing, re-assigning them to websites/stores.
Product name is a searchable attribute.

Also I have traced that searching a particular product by name, returns a row from catalogsearch_result table.

SELECT * FROM `catalogsearch_result` WHERE `query_id` = 2865

In the SQL result, the product_id is correct, but still product is not displaying in results.

Any ideas?

----- UPDATE -----

Product name is 'Forever'
Product is found when searching string is
'orever', 'rever', 'ever'
But product is not found when searching the
full name 'Forever'


texts: Combine or merge attribute options/labels in layered navigation

texts:
I have 1 attribute (dropdown) that i use in layered navigation.
Is there a way i can merge/combine multiple dropdown options/labels to just 1 label/option in the layered navigation?
I have tried mydomain.com/category1/?attribute1=option1&attribute1=option2 but i get not the results i want (it only shows products with option2).

For a complete picture:
I use the filter for suppliers (my own products, dropship and 3th party products). People can filter by supplier but the problem is with the dropship suppliers. I want to combine those suppiers with my own shop/products filter so those products show-up under that filter and don't have their own filters.

I can solve the problem with hiding the dropship suppliers from the navigation with a 1x1 blank image but that won't hide the product count (i can disable the counter if that is needed but i like it when i can still use it.)
I know there is a extension that will do almost the same but i don't want a extension and that extension is not hiding the attribute options i want to hide.


texts: Translate magento template from en_US to pt_PT

texts:
I tried the follow:

rm -rf vendor/mageplaza/core-m2
rm -rf app/code/Mageplaza/Core
composer remove mageplaza/core-m2
composer dump-autoload
composer require mageplaza/magento-2-portuguese-language-pack:dev-master
php bin/magento setup:upgrade

Nothing happens.


texts: Updating qty of products/simple products via API

texts:
I am trying to update the quantity of products via API but i don't really understand how the API works. I've copy pasted some code fragments which i found around the internet, and i've already made an output with print_r() of the product, so i am sure the authentication is working fine. I just don't get how the product qty is updated, and I've been googling for 3 hours.

<?
//Authentication rest API magento2.Please change url accordingly your url

//I HAVE CHANGED EXAMPLE.COM,USERNAME AND PASSWORD FOR SECURITY PURPOSES

$adminUrl='https://example.com/index.php/rest/V1/integration/admin/token';
$ch = curl_init();
$data = array("username" => "THEUSERNAME", "password" => "THEPASSWORD");
$data_string = json_encode($data);
$ch = curl_init($adminUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type=> application/json',
        'Content-Length=> ' . strlen($data_string))
);
$token = curl_exec($ch);
$token=  json_decode($token);

//Use above token into header
$headers = array('Authorization=> Bearer $token');

$requestUrl='https://example.com/index.php/rest/V1/products/{MY_SKU}/stockItems/827';
//Please note 24-MB01 is sku

$ch = curl_init();
$ch = curl_init($requestUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
$post ='{
  "stockItem": {
    "item_id": 12,
    "product_id": 0,
    "stock_id": 0,
    "qty": 4,
    "is_in_stock": true,
    "is_qty_decimal": true,
    "show_default_notification_message": true,
    "use_config_min_qty": true,
    "min_qty": 0,
    "use_config_min_sale_qty": 0,
    "min_sale_qty": 0,
    "use_config_max_sale_qty": true,
    "max_sale_qty": 0,
    "use_config_backorders": true,
    "backorders": 0,
    "use_config_notify_stock_qty": true,
    "notify_stock_qty": 0,
    "use_config_qty_increments": true,
    "qty_increments": 0,
    "use_config_enable_qty_inc": true,
    "enable_qty_increments": true,
    "use_config_manage_stock": true,
    "manage_stock": true,
    "low_stock_date": "string",
    "is_decimal_divided": true,
    "stock_status_changed_auto": 0,
    "extension_attributes": {}
  }
}';

$options = array(
    CURLOPT_URL=>$toURL,
    CURLOPT_HTTPHEADER=>array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($post)),
    CURLOPT_VERBOSE=>0,
    CURLOPT_RETURNTRANSFER=>true,
    CURLOPT_USERAGENT=>"Mozilla/4.0 (compatible;)",
    CURLOPT_POST=>true,
    CURLOPT_POSTFIELDS=>$post,

);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
$result=  json_decode($result);
print_r($result);

Thanks.


texts: Magento 2 - Create Admin Grid and show Custom Module list with Enable/Disable option

texts:
I have been working on custom module in Magento 2 which will perform some kind of calculations on frontend. Now I need to port those modules into Admin, where user can see menu and module list. Clicking on that list, admin can see all modules developed so far under Vendor namespace. Below is the code to create admin menu.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
       <add id="Vendor_Namespace::helloworld"
                title="Helloworld"
                module="Vendor_Namespace"
                sortOrder="51"
                resource="Vendor_Namespace::helloworld"/>

       <add id="Vendor_Namespace::modulelist"
                title="Concrete Calculator"
                module="Vendor_Namespace"
                sortOrder="1"
                action="Vendor_Namespace/modulelist"
                resource="Vendor_Namespace::modulelist"
                parent="Vendor_Namespace::helloworld"/>
    </menu>
</config>

How do I create Admin grid where clicking on Module List shows all
the modules developed ?
How can I add enable/disable button to any module, so that based on
selection, that module is shown/hidden on frontend ?
Do I need to create admin module separately or can I add menu.xml
in custom module ?

P.S. Is it necessary to create SQL script for admin grid? The purpose is to show all custom module list in Admin and enable/disable.


texts: Uncaught Error: Call to a member function setItem() on boolean on product grid: Magento 2

texts:
I have a custom module in which I am using the grid to add items in the admin end. The items are getting added properly and everything is working fine.

However, I face an issue often where after sometimes the product grid gives me error as

  Fatal error: Uncaught Error: Call to a member function setItem() on boolean in /var/www/html/xxxxx/magento2/vendor/magento/module-sales/Block/Adminhtml/Order/Create/Items/Grid.php:591
      Stack trace: #0 /var/www/html/quote2sales/magento2/app/code/Vendor/Module/view/adminhtml/templates/quote/create/items/grid.phtml(82):
      Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid->getItemUnitPriceHtml(Object(Magento\Quote\Model\Quote\Item)) #1 /var/www/html/xxxxx/magento2/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/html/q...') #2 /var/www/html/xxxxx/magento2/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid), '/var/www/html/q...', Array) #3 /var/www/html/xxxxx/magento2/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/var/www/html/q...') #4 /var/www/html/xxxxx/magento2/vendor/magento/module in /var/www/html/xxxxx/magento2/vendor/magento/module-sales/Block/Adminhtml/Order/Create/Items/Grid.php on line 591

Here I have created my own template and used the Magento sales module block

  /var/www/html/xxxxx/magento2/vendor/magento/module-sales/Block/Adminhtml/Order/Create/Items/Grid.php

In my template for the product grid I have called below function,

<?php echo $block->getItemUnitPriceHtml($_item); ?>

The block function is as below,

/**
 * Get the item unit price html
 *
 * @param Item $item
 * @return string
 */
public function getItemUnitPriceHtml(Item $item)
{
    $block = $this->getLayout()->getBlock('item_unit_price');
    $block->setItem($item);
    return $block->toHtml();
}

Why would this happen?
The error goes when I am logging out and logging in again or clearing the session.

Please, can anyone help?


texts: Magento 2: Need to add custom module grid link in system config tab

texts:
I have created a custom module grid in admin and need to add grid link to system config custom tab. I am struggling with this.

Custom module

System config field

How I can achieve this?

Thanks


texts: Set a custom html template for a specific shipping method?

texts:
While creating a custom shipping method works great, how to set up a specific template for specific shipping method in the checkout?

Seeing the vendor/magento/module-checkout/view/frontend/web/js/view/shipping.js there is a shippingMethodItemTemplate set to Magento_Checkout/shipping-address/shipping-method-item.

I believe i need to change this somehow for my custom shipping method but leaving others untouched, how can i accomplish that?

Do i need to create a mixin for vendor/magento/module-checkout/view/frontend/web/js/view/shipping.js and set the template for the custom shipping method?

My goal is to add a select tag for that specific shipping method, the save data afterwards i have it covered, i think.


texts: Klarna Payment Method throws 403 forbidden error with default Magento v 2.4.1

texts:
I am trying to configure Klarna payment method with fresh Magento version 2.4.1.
I have created new account in the Playground Klarna and using the below credential:
username: PN04063_a568b727a2a0
password: 3I0Q2PancGPnNdLJ
Please find this admin level setting which i did from Magento.

When we visit the checkout page then I can see "klarnaDebugLogger.ERROR: Bad Response: Client error: POST https://api-na.playground.klarna.com/payments/v1/sessions resulted in a 403 Forbidden" in the klarna log file, please check below detail log file(klarna_api.log).

If anyone has any idea on this please share your thought on this, thanks in advance.
Note: We have alreday connected with Klarna support team but no any positive response from them.


texts: How to setup Magento 2 in a different Apache and MySql port in Wampserver

texts:
I have different services running on Apache port 8080 and MySql port 3306 so in Wampserver I have set the Apache port as 8081 and MySql port as 3310.
I can access Apache Dashboard through http://localhost:81 and PhpMyAdmin through http://localhost:81/phpmyadmin but the Magento site which I have setup is showing "Internal Server error". I'm using Magento 2.3.2 and Php version 7.2.33
I have changed the web/secure/base_url and web/unsecure/base_url in Core_Config table as http://localhost:81/<folder_name> but its not working. I have also tried by changing localhost to localhost:81 in env.php but still its not working.
Do I need to make changes in other places as well?  Please suggest
I had setup an Opencart site in the same server and it is running fine on http://localhost/81<folder_name> so I believe the Apache and MySql settings are all fine


texts: Magento 2 Admin Notifications - what makes a notification popup when the admin user logs in?

texts:
Occasionally, an admin notification can pop up when an admin user logs into the Admin Panel.

The popup usually shows in an orange style box and can be closed easily, but not all poups show like this.

I would imagine that certain message severity (\Magento\Framework\Notification\MessageInterface) would decided this, but it appears not.

Does anybody know what logic is in place to decide whether an admin notification is displayed as a popup, rather than just sitting in the notifications area and never being presented to the user?


texts: Magento 2 - Move Product description out of Tab above the add to cart button

texts:
How can I move Product description out of Tab, above the add to cart button in magento 2 in luma theme

Why there is no view.phtml file as in magento 1.x


texts: Set store cookie not working in Magento 2

texts:
I'm trying to make my first Magento 2 module so I'm new to this...

Basically what I'm trying to achieve now is:
check if a store view was set in a cookie before
  if yes: do nothing.
  if not: set English store view.
this is my code:

<?php

namespace HeziDebby\GeoIpRedirect\Plugin;

use HeziDebby\GeoIpRedirect\Model\GeoIpRequest;
use Magento\Framework\App\FrontControllerInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Store\Api\StoreCookieManagerInterface;
use Magento\Store\Model\Plugin\StoreCookie;
use Magento\Store\Model\StoreFactory;

class GeoIpRedirectPlugin
{

    /**
     * @var StoreFactory
     */
    private $storeFactory;
    /**
     * @var StoreCookieManagerInterface
     */
    private $storeCookieManager;
    /**
     * @var GeoIpRequest
     */
    private $geoIpRequest;
    /**
     * @var StoreCookie
     */
    private $storeCookie;

    public function __construct(
        StoreFactory $storeFactory,
        StoreCookieManagerInterface $storeCookieManager,
        GeoIpRequest $geoIpRequest
    )
    {
        $this->storeFactory = $storeFactory;
        $this->storeCookieManager = $storeCookieManager;
        $this->geoIpRequest = $geoIpRequest;
    }

    public function beforeDispatch(
        FrontControllerInterface $subject,
        RequestInterface $request
    ){

        if(!$this->storeCookieManager->getStoreCodeFromCookie()){
            $store = $this->storeFactory->create();

            $store->load('EN','country_code');

            $this->storeCookieManager->setStoreCookie($store);
        }

        return null;
    }
}

There are 2 things which I do not understand:

1) I'm debugging with Xdebug and I have set a breakpoint on the condition line, the weird thing is that in one page load, the debugging stops on this breakpoint more then once, why is that happening?
**edit: it happens because of other non related requests to frontcontroller

2) The cookie is not being set after this line

  $this->storeCookieManager->setStoreCookie($store);

And in the next time the debugger stops on the condition, the cookie is set to the default store view(it actually loads the default store view the therefore the cookie is 'default).

Thanks in advance!


texts:
I have ungraded my Magento 2.2.x Store to Magento 2.3. After upgrade everything was working fine. I have observed a new issue in PHP CLI.

Once I run any CLI command I am getting PHP Warning Like below:

bin/magento indexer:reindex
Warning: set_error_handler() expects parameter 2 to be integer, string given in bin/magento on line 21

After that command works properly.

I am using the correct PHP CLI version: PHP 7.2.15 (cli)

I have no idea how this new warning get occurred and how to fix this.

Also I observed that a log file get created on my root folder with php_error log where the above warning is getting appended.

Can someone help me in fixing this issue?


texts: how to save register information at checkout permanently?

texts:
At checkout page I selected checkout method as register. Now I completed billing information (it is included also register info). After going to next step meanwhile I'm checking in the admin panel to see customer information. But nothing is there. I know that the entire steps stored in quote object temp. After placing the order it will store as a permanent thing. But I want to  store customer information permanently once I fill the billing information.
Thanks in advance


texts: How to put correct date on invoice PDF in Magento 2?

texts:
Invoice PDFs are generating the incorrect date, I have this on two sites both on 2.3.4 and en_GB locale

e.g.

  $order->getCreatedAt()

2020-02-14 11:14:40

becomes

  $this->_localeDate->formatDate(
                  $this->_localeDate->scopeDate(
                      $order->getStore(),
                      $order->getCreatedAt(),
                      true
                  ),
                  \IntlDateFormatter::MEDIUM,
                  false
              )

13 August 2019

This is coming form:

  vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php

Removing the scopeDate() function fixes it, but should I do this or is it a configuration error on my part somewhere?


texts: Invalid Form Key. Please refresh the page. magento 2.3.X

texts:
When I clicked on add to cart or add product in wishlist then showing error as below:

How can I fix this issue ? Where is the form key to change or what can I do ?


texts: Delta Delivering Failed - Deltalog for customer_entity, is not installed in Magento 2

texts:
How can the "Deltalog" be "installed"?

Migrating  magento 1.9.2.4 >> 2.1.0

Migration Tool Version 2.1.0


texts:
I am a junior developer and I have acquired a freelance contract to learn Magento 2 Community and customize a storefront for a start-up company.

I am familiar with Sinatra, Rails, and Node; however, Magento, PHP, and LESS are new to me.

So far, I have created a new theme and changed the logo and favicon of the theme.

I am trying to understand how to achieve the shortest feedback loop during the development process. Right now, although I am using Magento 2's developer mode, it seems I have to manually clear cache and deploy static assets to see any changes made in my example CSS file.

I am using Incognito mode in Chrome, so I do not have to clear the browser's cache.

I have the example CSS file at: /var/www/html/app/design/frontend/Gomato/base/web/css/all_stores_style.css

Since this is a custom CSS file, I have also declared this file in: /var/www/html/app/design/frontend/Gomato/base/Magento_Theme/layout/default_head_blocks.xml

The example CSS file includes only:

* {
  background-color: green;
}

I am unable to see the color change until I run the following command from the web root directory: sudo bin/magento setup:static-content:deploy en_CA

Then, I want to modify the color to blue. I edit the above CSS file to:

* {
  background-color: blue;
}

If I reload the web page, the color does not change.
If I deploy again, it still does not change. The CSS file in the pub directory is still the same.

I need to manually delete the file then deploy for Magento to copy the CSS file from the app directory into the pub directory.

Is this the correct development process? I find this painstakingly time consuming. I am used to making a change to a file and reloading the page to see the changes made. Is this possible, without any other steps (clearing cache, deleting a static file, deploying, etc)? Or, is this the Magento "way".

Thank you,

David


texts:
id like to add a quantity box for each color im my product.
im new to magento im looking a way to do it

i try to folow another tutorial that i found here :
Quantity box for each size of product
but its not working


texts: Magento2.3.5 Custom checkout field custom validation Amazon Error

texts:
I have a custom field and customScope added with LayoutProcessor which works fine!

But I need to add custom validation stop submission if my custom doesn't meet the requirements :

Is just trowing amazon error for some reason:

Uncaught TypeError: setShippingInformationAction(...).done is not a function
    at setShippingInformationAmazon (shipping.js:60)
    at UiClass.setShippingInformation (shipping.js:76)
    at HTMLFormElement.<anonymous> (knockout.js:4640)
    at HTMLFormElement.dispatch (jquery.js:5232)
    at HTMLFormElement.elemData.handle (jquery.js:4884)

no matter where I stop the form from submitting either Vendor_Module/js/action/set-shipping-information-mixin:

/*jshint browser:true jquery:true*/
/*global alert*/
define([
    'jquery',
    'mage/utils/wrapper',
    'Magento_Checkout/js/model/quote'
], function ($, wrapper, quote) {
    'use strict';

    return function (setShippingInformationAction) {

        return wrapper.wrap(setShippingInformationAction, function (originalAction) {
            var shippingMethod = quote.shippingMethod();
            if(shippingMethod['method_code'] === 'vendor_shipping') {
               console.log('vendor_shipping');
               return false;
            }
            return originalAction();
        });
    };
});

Or Vendor_Module/js/model/shipping-save-processor/default:

....
  return {
            saveShippingInformation: function () {
                console.log('OVER HERE');
                var payload;

                if($('select[name="vendor_selector_drop_down"]').val() === '') {
                    console.log('invalid here');
                    return false;
                }
                if (!quote.billingAddress()) {
                    selectBillingAddressAction(quote.shippingAddress());
                }
       ...

Why is Amazon interfering with it I haven't enable it ? Could this be a bug anyone else doing something similar and have seem this and any advice appreciated thanks!


texts: Class Mage_Catalog_Block_Product_List_Related gives zero related product result

texts:
I am currently trying to modify catalog/product/list/related.phtml, and I found out that it uses Mage_Catalog_Block_Product_List_Related.

I used $this->getItems()->getSize() to check the number of related products involve is correct. I verified that there is 1 related product owned by the current product. However, it says 0 in the result, and it would not display any related product, which does not make sense.

The block seems to work, but it does not display the related products although I verified that there is a related product. What should I do here?


texts: In magento 2 datepicker, how to disable a paritcular dates in frontend?

texts:
frontend

1.app/code/companyname/vendorname/view/frontend/web/template/delivery-date-block.html

Delivery Date

    <input class="input-text" type="text" data-bind="datepicker: true"   name="delivery_date" id="delivery_date" readonly="true"/>

2.app/code/companyname/vendorname/view/frontend/web/template/delivery-date-block.js

console.log(window.checkoutConfig.shipping.delivery_date.mapping_date);

var format = window.checkoutConfig.shipping.delivery_date.format;
var disabledDate =window.checkoutConfig.shipping.delivery_date.mapping_date;
var disabledDay = disabled.split(",").map(function(item) {
                return parseInt(item, 10);
            });

            ko.bindingHandlers.datepicker = {
                init: function (element, valueAccessor, allBindingsAccessor) {
                    var $el = $(element);
                    //initialize datetimepicker
                    if(noday) {
                        var options = {
                            minDate: 0,
                            dateFormat:format,

                        };
                    } else {
                        var options = {
                            minDate: 0,
                            dateFormat:format,

                            beforeShowDay: function(date) {
                                var day = date.getDay();
                                var string =
                         jQuery.datepicker.formatDate('yy-mm-dd', date);
                           return[disabledDate.indexOf(string)
                                                         == -1 ]
                            }
                        };
                    }

                    $el.datepicker(options);

                    var writable = valueAccessor();
                    if (!ko.isObservable(writable)) {
                        var propWriters = allBindingsAccessor()._ko_property_writers;
                        if (propWriters && propWriters.datetimepicker) {
                            writable = propWriters.datetimepicker;
                        } else {
                            return;
                        }
                    }
                    writable($(element).datepicker("getDate"));
                },
                update: function (element, valueAccessor) {
                    var widget = $(element).data("DatePicker");
                    //when the view model is updated, update the widget
                    if (widget) {
                        var date = ko.utils.unwrapObservable(valueAccessor());
                        widget.date(date);
                    }
                }
            };

output:

I have tried this example to disable date to solve this.

UPDATE:

Answer is

var disabledDate =
window.checkoutConfig.shipping.delivery_date.mapping_date;

beforeShowDay: function(date){
    var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
    return [ disabledDate.indexOf(string) == -1 ]
}


texts: On invoice creation sales_invoice table transaction_id column is null even if the payment done is online

texts:
I have gone through all the related questions to my queries but not able to figure out the issue I am facing, actually what I am facing here is my few orders are having transaction_id null and because of that I am not able to do an online refund .

I have checked the tables there is last_trans_id in sales_order_payment table . is it possible that the payment has been detected as fraud and because of that transaction_id is null ?  I have debugged and found that authnetcim orders are having null transaction_id .

Looking forward for your guidance .

Thanks


texts:
My language is Hebrew and when I print pdf of invoice, package slip(maybe other pdf's) the letters are flipped(last is first...),how can I fix this ?

  And if I need to edit a core file, how do I do it properly?

thanks.


texts: i call this file to enable header on checkout page checkout _index_index.xml like

texts:
this vendor/magento/theme-frontend-luma/Magento_Checkout/layout/override/theme/Magento/blank/checkout_index_index.xml

I am using luma theme

but header does not show on checkout page


texts: Wrong sort order in category product collection

texts:
I am trying to get the product collection based on the position (defined in Category Products in admin) in the category, but it doesn't work with product collection object whereas works correctly with product collection array (getData())

E.g. in Admin > Manage Categories > Category > Category Products
(Is Anchor = true but no sub-categories)
Product | Position
Prod A  | 1
Prod B  | 2

When I loop through product collection $_productCollection in catalog/product/list.phtml file, the product's order comes Prod B and then Prod A, whereas if I use $_productCollection->getData() and loop through it, it gives products in correct order.

foreach($_productCollection as $_product) //gives Prod B and then Prod A, which is not expected

foreach($_productCollection->getData() as $_product) //gives Prod A and then Prod B, which is correct

Any ideas why it would behave differently when accessing it as an object and as an array, on the same collection?

Thanks!


texts: Magento2 - How to return string as object in webapi response?

texts:
Can anyone let me know how to return success message with object like this same as magento does for the exception in REST webapi:

{
    "message": "A customer with the same email already exists in an associated website."
}

Above is the example of exception message, same i want to do with success response, i tried with array but it returns an array with an object like this:

[
    {
        "message": "this is test"
    }
]

I don't want array but only object returns inside it.I have used following code for it:

$msg[] = array("message"=>"this is test");
return $msg;


texts: magento 2 extension composer update error - Please update your modules: Run "composer install" from the Magento root directory

texts:
My Siteground shared hosting plan does not allow me to use composer (memory limit). How can I fix this issue? is there a way to manually update it without composer? or how can I disable this module? Thanks!

1 exception(s): Exception #0 (Magento\Framework\Exception\LocalizedException): Please update your modules: Run "composer install" from the Magento root directory. The following modules are outdated: Magefan_Community db schema version: defined in codebase - 2.0.2, currently installed - 2.0.3 Magefan_Community db data version: defined in codebase - 2.0.2, currently installed - 2.0.3

========================================================================

mmap() failed: [12] Cannot allocate memory

Fatal error: Out of memory (allocated 844111872) (tried to allocate 20480 bytes) in phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/Rule.php on line 76