texts: Get Sub Category List of a Current Category as Select option

texts:
Currently in a Category view page, its sub categories are displayed in a list format. I would like to change the list to select option so when there are too many sub categories users does not have to scroll all the way to the bottom to view the content.

Current Code:

<?php foreach ($this->getCurrentCategory()->getChildrenCategories() as $_subcat): ?>

<a href="<?php echo $_subcat->getUrl() ?>"><?php echo Mage::helper('catalog/output')->categoryAttribute($_subcat, $_subcat->getName(), 'name') ?>

<?php endforeach ?>

How can I accomplish this so the sub-categories is displayed in a select option?


texts: Getting Value of product attribute on cart page even not assigned to that particular product Magento 2

texts:
I am getting the product attribute from quote. It seems there is wrong value comes. Please check my below code.

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $cart = $objectManager->get('\Magento\Checkout\Model\Cart');
 $itemsCollection = $cart->getQuote()->getItemsCollection();
 $itemsVisible = $cart->getQuote()->getAllVisibleItems();
 $items = $cart->getQuote()->getAllItems();

 $product_object = $objectManager->create('Magento\Catalog\Model\Product');

 foreach($itemsVisible as $item){
      if($option = $item->getOptionByCode('simple_product')) {
           $productId = $option->getProduct()->getId();
           $item_s = $product_object->load($productId);
           echo $screen_size =   $productId."/".$item_s->getScreenFrameSize()."/".$item_s->getFiberglassScreenRollSize()."/".$item_s->getScreenCornerSize()."<br>";
      }
 }

Please check below image for better understanding. Is there any error in my collection or loop?

Please help me!!!


texts: How to change layout and template from module?

texts:
When creating a theme I can override the Magento header by placing files under
app/design/frontend/company/mytheme/Magento_Theme/layout/default.xml and app/design/frontend/company/mytheme/Magento_Theme/templates/header.phtml
This works as expected. But I want to move my custom header into a module as I'd like to use it on other themes.
If I place the same files under the module directory (instead of them) the header doesn't update:
app/design/frontend/company/module/Magento_Theme/layout/default.xml and app/design/frontend/company/module/Magento_Theme/templates/header.phtml
How can I make layout and template changes from within a module?


texts: Questions for migrating differential data from Magento 1 to Magento 2

texts:
Magento 1.9 runs on a production server.
Magento 2.2 runs on a test environment server.
I have finished setting up the migration tool. No errors.
We built a database on the test environment server based on the Magento 1.9 dump file.
The first migration is over. No errors.

Currently, data is not added, deleted or updated from the administrator screen.

You are ready to migrate the incremental data.

But I have a question.

During the initial migration, tables with names starting with m2_* were created in the Magento 1.9 database.

Dumping the Magento 1.9 database in the production environment and building it on the validation environment server will delete the m2 _ * tables.

How can I migrate incremental data?

I need help.


texts: have a form created for user input with add to cart button but not able to get product accordigly

texts:
<!DOCTYPE html>

    <title>Practice page</title>

   <select id="height">
      <option value="select">Select</option>
      <option value="12">12</option>
      <option value="18">18</option>
      <option value="22">22</option>
      <option value="26">26</option>
      <option value="custom">custom</option>
    </select>

<select id="width">
    <option value="select">Select</option>
    <option value="12">12</option>
    <option value="18">18</option>
    <option value="24">24</option>
    <option value="30">30</option>
    <option value="36">36</option>
    <option value="42">42</option>
    <option value="custom">custom</option>
 </select>
<button onClick="GetSelectedItem('width','height');">Add to cart </button>


texts: Could not create cart for customer using magento-2 REST API

texts:
I need to create cart and get the quote id for the customer using magento-2 REST API but I am getting the following error.

  Error:

stdClass Object
(
    [message] => No such entity with %fieldName = %fieldValue
    [parameters] => stdClass Object
        (
            [fieldName] => customerId
            [fieldValue] => 83
        )

)

I am explaining my code below.

$adminUrl1='http://example.com/index.php/rest/V1/integration/customer/token';
    $ch1 = curl_init();
    $data1 = array("username" => $uemail, "password" => $upass);
    $data_string1 = json_encode($data1);
    $ch1 = curl_init($adminUrl1);
    curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch1, CURLOPT_POSTFIELDS, $data_string1);
    curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch1, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string1))
    );
    $token1 = curl_exec($ch1);
    $result = json_decode($token1, 1);
    if (!isset($result['message']) && $result) {
        $quoteUrl ='http://example.com/index.php/rest/V1/carts/mine';
        $chQuote = curl_init($quoteUrl);
         curl_setopt($chQuote, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token1)));
         curl_setopt($chQuote, CURLOPT_RETURNTRANSFER, true);
         $quote = json_decode(curl_exec($chQuote));
         print_r($quote);exit;
    }

Here I need to create the cart and get the quote id so that I can add the item into cart. Please help me to resolve this error.


texts: Product Attribute text string str_replace

texts:
I have a situation where I need to display a product attribute that contains text phrases separated by semicolon.  The goal is to replace the semicolon with a  I can call up the attribute using the code below however I am stuck on how to do the replacement.  I'm assuming a str_replace of some sort?

<?php echo $this->htmlEscape($_product->getData('attribute_id')); ?>


texts: Installation Recaptcha fails on Magento 2.3.3

texts:
I'm trying to install Recaptcha on Magento 2.3.3. with the following command in SSH composer require msp/recaptcha

but it stated the following error:

  Your requirements could not be resolved to an installable set of
  packages.

  Problem 1
      - magento/product-community-edition 2.3.3 requires msp/recaptcha 2.1.3 -> satisfiable by msp/recaptcha[2.1.3] but these conflict with your requirements or minimum-stability.
      - magento/product-community-edition 2.3.3 requires msp/recaptcha 2.1.3 -> satisfiable by msp/recaptcha[2.1.3] but these conflict with your requirements or minimum-stability.
      - magento/product-community-edition 2.3.3 requires msp/recaptcha 2.1.3 -> satisfiable by msp/recaptcha[2.1.3] but these conflict with your requirements or minimum-stability.
      - Installation request for magento/product-community-edition 2.3.3 -> satisfiable by magento/product-community-edition[2.3.3].>

  Installation failed, reverting ./composer.json to its original
  content.

Can somebody helpm or hint me how to solve this problem?


texts: is there a way to alter translate.csv for ADMIN without altering core file?

texts:
The file I am looking at is app/design/adminhtml/default/default/locale/en_US/translate.csv

I would like to change translations in the admin back-end without editing this file (in case there is an update that overwrites it in the future

Is there a method to create a separate translate.csv file that will be checked in priority for back-end changes like there is for the front-end?


texts: I have setup Magento2 on my local system but when i go to git bash and run any command i am getting this error bash: php: command not found.


texts: Why my multistore (www.domain2.com) still redirect to www.domain1.com?

texts:
I made a website www.domain1.com

and I also a multistore to different domain in magento that is www.domain2.com.

My question is :
Why my multistore (www.domain2.com) still redirect to www.domain1.com ?

Can you help me ?

I want every multistore to be standalone and not redirect in www.domain1.com but in one data base (magento Multistore).


texts: Magento 1.9 Use Base Currency To Checkout On Payment Gateway

texts:
I have a multi-currency website (MYR & USD) while MYR is the primary currency, When a user try to purchase i want to pass the value in MYR to the payment gateway since  it supports on MYR, below my code in redirect.phtml, Is there any way i can fix this. TIA

<?php
// Retrieve order

$order = $this->getOrder();
$_helper = Mage::helper('managepay');
$phone = substr(str_replace(' ', '', $order->getBillingAddress()->getTelephone()), 0, 20);
?>

You will be redirected to the Manage Pay website in a few seconds.

<form name="managepay_form" method="post" action="<?php echo $_helper->getGatewayUrl() ?>">
    <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Submit')) ?>" class="button"><?php echo $this->__('Click here if you are not redirected within 10 seconds...') ?></button>
    <input type="hidden" name="secureHash" value="<?php echo $_helper->secureHash() ?>">

    <input type="hidden" name="mid" value="<?php echo $_helper->getMerchantId() ?>">

    <input type="hidden" name="invno" value="<?php echo $_helper->getInvoiceNo() ?>">

    <input type="hidden" name="amt" value="<?php echo $_helper->getAmount() ?>">

    <input type="hidden" name="desc" value="<?php echo $this->getProductDesc() ?>">

    <input type="hidden" name="postURL" value="<?php echo $this->getResponseUrl()  ?>">

    <input type="hidden" name="phone" value="<?php echo $phone ?>">

    <input type="hidden" name="email" value="<?php echo $order->getCustomerEmail(); ?>">

</form>


texts:
My client's Magento site page load speed is very slow. What can I do to decrease page load time?

The site url is desibazaar.pk.


texts: How to get price without currency symbol?

texts:
How can i echo grand total without the $ symbol attached to it?

Am using the following code to display grand total

echo Mage::helper('checkout')->formatPrice(Mage::helper('checkout')->getQuote()->getGrandTotal())

right now it is displaying $50.00 but i want to get only 50.00, how can i do the same?

Thank you in advance.


texts: Magento master-slave replication error on update

texts:
I have setted up a MySql master-slave replication in magento enterprise 1.14.2.4. The master-slave replication works fine e.g if I create a new database in Master db, same database automatically gets created into the Slave db.
The issue I am facing is that whenever I save any system configuration I am getting a slave replication error and the values doesn't get saved.

The replication error clearly tells me that you are using a READ database connection in order to perform a WRITE (update or insert) query in the slave database. Below is my local.xml's database connection settings for this magento db replication setup.

<default_setup>
            <connection>
                <use />
                <host><![CDATA[server-1]]></host>
                <username><![CDATA[dev]]></username>
                <password><![CDATA[5YCSDQGU56DEW5GRNrOfMA]]></password>
                <dbname><![CDATA[dev.test]]></dbname>
                <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                <model><![CDATA[mysql4]]></model>
                <type><![CDATA[pdo_mysql]]></type>
                <pdoType><![CDATA[]]></pdoType>
                <active>1</active>
            </connection>
        </default_setup>
        <default_read>
            <connection>
                <use />
                <host><![CDATA[/var/lib/mysql/mysql.sock]]></host>
                <username><![CDATA[dev]]></username>
                <password><![CDATA[5YCSDQGU56DEW5GRNrOfMA]]></password>
                <dbname><![CDATA[dev.test]]></dbname>
                <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                <model><![CDATA[mysql4]]></model>
                <type><![CDATA[pdo_mysql]]></type>
                <pdoType><![CDATA[]]></pdoType>
                <active>1</active>
            </connection>
        </default_read>

Any help or guidance would be much appreciated!


texts: Class Mage not found in Shell Script on some servers

texts:
We have a custom script in shell with
require_once 'abstract.php'; and our class extends Mage_Shell_Abstract.

On our dev environments this is working fine, but on staging we get the error

PHP Fatal error:  Class 'Mage' not found in /var/www/foo/public/shell/abstract.php on line 86

What can be the reason?


texts: Updating multiple products stock script slows over execution time

texts:
I'm tring to update all products of an eshop with a php script ( magento command ).
I'm preparing an array with all stock data and while looping over all shop products i'm updating the stock using the code bellow in a function
enter code here
   if ($isInStock === null)
        $isInStock = ($quantity > 0 ? SourceItem::STATUS_IN_STOCK : SourceItem::STATUS_OUT_OF_STOCK);

    $inventorySourceItem = $this->objectManager->create('\Magento\Inventory\Model\SourceItem');

    $existingInventorySourceItem = $inventorySourceItem->getCollection()
        ->addFieldToFilter('sku', $sku)
        ->addFieldToFilter('source_code', $inventorySourceCode)
        ->getFirstItem();

    $existingInventorySourceItem->setQuantity($quantity);
    $existingInventorySourceItem->setStockStatus($isInStock);
    $existingInventorySourceItem->setStatus($isInStock);
    $existingInventorySourceItem->setSku($sku);
    $existingInventorySourceItem->setSourceCode($inventorySourceCode);
    $existingInventorySourceItem->save();

    try {
        $this->objectManager->get('Magento\InventoryApi\Api\SourceItemsSaveInterface')->execute([$existingInventorySourceItem]);
    } catch (Exception $e) {
        echo $e->getMessage();
    }

The problem is tha as the loop continues, the execution of the SourceItemsSaveInterface goes slower, and the script consumes more cpu, untill it reaches 90% of cpu.
As far as i've seen in my code, everything is looking good, and the same code executes well at my development machine so i think there is something related with the server although i cant find any clue. Keep in mind that mysql doenst seem to have a hard time during the process.
Already tried to add limit to the existingInventorySourceItem query and a sleep function beetween loops


texts:
UPDATE SCRIPT WORKS The issue was with google experiments being enabled

I am trying to save a product after updating the price via a new module in admin. I can update and view the prices from the page, but saving always results in empty white screen, if I remove the save function from the chain on the template page everything works as expected. Any help whatsoever would be greatly appreciated. I have included what I believe to be the relevant code below including how far I can trace the error below.

I have followed the code through Magento\Framework\Model\ResourceModel\Db\AbstractDB::updateObject() which reports the data is saving, I havent figured out how to debug getConnection()->update() yet. But all I get on screen is the white page when ever I include save in the chain. I am under the assumption that because the abstract db model shows the error_log after it updates the connection that this is not causing the WSOD?

The block (Vendor\Module\Block\Adminhtml\Index):

protected $_PRODUCTMODEL = NULL;
protected $_OBJMANAGER = NULL;

public function __construct(
    \Magento\Backend\Block\Template\Context $context,
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
    array $data = []
)
{
    $this->_productCollectionFactory = $productCollectionFactory;
    parent::__construct($context, $data);
    $this->_OBJMANAGER = \Magento\Framework\App\ObjectManager::getInstance();
    $this->_PRODUCTMODEL = $this->_OBJMANAGER->get('Magento\Catalog\Model\Product');
}

public function productModel()
{
    return $this->_PRODUCTMODEL;
}

public function productData($sku)
{
    return $this->productModel()
        ->loadByAttribute("sku", trim($sku));
}

The template (adminhtml/template.phtml):

<?php
foreach ($this->getProducts() as $product) {
    //$product->setPrice("19.11");
    //$product->save();
    $productModel = $this
        ->productData($product->getSku())
        ->setData("price", "22.1111")
        ->save();
    echo "ID:<pre>" . print_r($productModel->toArray(), 1) . "</pre>";
}
?>

How far I can trace the error:

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

namespace Magento\Framework\Model\ResourceModel\Db;

abstract class AbstractDb extends AbstractResource
{
    protected function updateObject(\Magento\Framework\Model\AbstractModel $object)
    {
        $condition = $this->getConnection()->quoteInto($this->getIdFieldName() . '=?', $object->getId());
        /**
         * Not auto increment primary key support
         */
        if ($this->_isPkAutoIncrement) {
            error_log("auto inc jamesk");
            $data = $this->prepareDataForUpdate($object);
            if (!empty($data)) {
                error_log("data not empty jamesk");
                error_log(json_encode($data));
                $this->getConnection()->update($this->getMainTable(), $data, $condition);
                error_log("done saving jamesk"); <<should be succesful if it displays in error_log?
            }
        }
}


texts: add new function in controller in newsletter 404 found

texts:
I need to modify on Mage module newsletter to add new action for amp requirement
but adding new function amp showing 404 result .


texts: I would like to know if there is an extension or if someone has successfully added a Google reCaptcha to the admin login so it makes it harder to try automated password attacks


texts: Magento 2: Error when clicking custom column on grid

texts:
I have created a custom column updated_at on customer grid. I have displayed it with data. But when I click the column header, this error pops out (Something went wrong with processing the default view and we have restored the filter to its original state.)

I added customer_listing on adminhtml/ui_components.

This is the code inside my xml:

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="customer_columns">
        <column name="updated_at" class="Mvn\Cam\Ui\Component\Listing\Column\CustomerList">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">dateRange</item>
                    <item name="dataType" xsi:type="string">date</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
                    <item name="dateFormat" xsi:type="string" translate="true">MMM d, Y hh:mm a</item>
                    <item name="label" translate="true" xsi:type="string">Updated At</item>
                    <item name="sortOrder" xsi:type="number">1</item>
                    <item name="sorting" xsi:type="string">asc</item>
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                    <item name="sortable" xsi:type="boolean">true</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

Here is my code at Ui\Component\Listing\Column

<?php
namespace Mvn\Cam\Ui\Component\Listing\Column;
use Magento\Customer\Model\CustomerFactory;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use Magento\Framework\Api\SearchCriteriaBuilder;

class CustomerList extends Column
{
    protected $customerFactory;
    protected $_searchCriteria;
    protected $helperReferralCode;

    public function __construct(
        ContextInterface $context,
        UiComponentFactory $uiComponentFactory,
        \Magento\Customer\Model\CustomerFactory $customerFactory,
        SearchCriteriaBuilder $criteria, //my custom module from which i want to add new column
        array $components = [], array $data = [])
    {
        $this->customerFactory = $customerFactory;
        $this->_searchCriteria  = $criteria;
        parent::__construct($context, $uiComponentFactory, $components, $data);
    }

    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {
                $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                $updatedat = $objectManager->create('Magento\Customer\Model\Customer')->load($item['entity_id']);
                $item[$this->getData('name')] = $updatedat->getUpdatedAt();
            }
        }
        return $dataSource;
    }
}

Here is the Screenshot of the page


texts:
I am sending data to the database by checking duplicate data. But I can't be inserting/updating data in the database.

protected function saveEntityFinish(array $entityData, $table) {
        $collection= $this->PostTableFactory->create();
        $item = $collection->getCollection();

        if ($entityData) {
            $tableName = $this->_connection->getTableName($table);
            $entityIn = [];
            $entityInup = [];
            foreach ($entityData as $id => $entityRows) {
                    foreach ($entityRows as $row) {
                        $item->addFieldToFilter('rule_id',$row['rule_id']);
                        $item->addFieldToFilter('store_id',$row['store_id']);

                        if(count($item->getData()) == 0){
                            $temp= $item->getData();
                            $logger->info('one');
                            $collection->setRuleId($row['rule_id']);
                            $collection->setStoreId($row['store_id']);
                            $collection->setStatus($row['status']);
                            $entityIn[] = $row;
                            $collection->save();
                        }else{
                            $entityInup = $row;

                            $collection = $this->PostTableFactory->create();
                            $collection->load($item->getData()[0]['p_id']);

                            $collection->setRuleId($entityInup['rule_id']);
                            $collection->setStoreId($entityInup['store_id']);
                            $collection->setStatus($entityInup['status']);
                            $entityIn[] = $entityInup;
                            $collection->save();

                        }

                    }
            }

        }
        return $this;
    }

can I get help on it? Thank you in advance


texts: Dropdown for add to cart qty in Magento 2 only goes up to qty 4

texts:
I found the script below here to make a dropdown of the quantity on a product detail page. This works but it only gives a max of 4 while there is more (or less) in stock. How can I set it to the correct quantity/stock? Using Magento 2.2.5

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

// @codingStandardsIgnoreFile

/** @var $block \Magento\Catalog\Block\Product\View */
?>
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php if ($_product->isSaleable()): ?>

        <?php if ($block->shouldRenderQuantity()): ?>

            <?php /* @escapeNotVerified */ echo __('Qty') ?>
            <select class="select" name="qty" id="qty" title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
                   class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>">
                   <?php $i = 1 ; ?>
                    <?php
                     while( $i <= $_product->getExtensionAttributes()->getStockItem()->getQty()) { ?>
                        <option value="<?php echo $block->getProductDefaultQty() * $i; ?>"><?php echo $block->getProductDefaultQty() * $i; ?></option>
                        <?php $i++; ?>
                     <?php } ?>
            </select>

        <?php endif; ?>

            <button type="submit"
                    title="<?php /* @escapeNotVerified */ echo $buttonTitle ?>"
                    class="action primary tocart"
                    id="product-addtocart-button">
                <?php /* @escapeNotVerified */ echo $buttonTitle ?>
            </button>
            <?php echo $block->getChildHtml('', true) ?>

<?php endif; ?>

<?php if (!$block->isRedirectToCartEnabled()) : ?>

<?php endif; ?>

This is the result:


texts:
I'm using below script to connect for my another database.

https://www.maxpronko.com/blog/new-database-connection-in-magento-2

I stuck after

  Next step is to configure resource model to use new connection. The
  di.xml configuration file will help to set new resource name to
  resource model.

Or any better way?


texts: How to remove street city field from billing address in checkout?

texts:
Is it possible to remove the address street city field from billing information in checkout page in magento?

As already try in abstract page but it's not done, then to try in database to change eav_attribute but not done. Would you please give some information how to remove these particular compulsory field from this billing information? Please give me suggestion


texts: How can I make images of an old Magento work with a fresh installation (with the old db attached)?

texts:
I dont know how exactly to put it in words, so heres my problem
I have an old corrupted Magento server (2.3). I have installed a fresh Magento (2.3) and used the sql dump from the old one, the products and everything else works fine. I also copied /media folder from the old server to the new installation, same path/directory. Doing this doesn't show up the images in my fresh Magento site.
Can you tell me how I can make this work? I just need the data to show up completely on the new site, not concerned with rebuilding the site or other content than products.
Thanks


texts: $_product->getAttributeText gives a "Notice: Array to string conversion"

texts:
Why does getAttributeText() is giving a "PHP Notice" from time to time?

$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();

// Get new brand name

echo $_product->getAttributeText('new_brand');

This breaks the page and gives me following error:

Notice: Array to string conversion  in /www/sites/mysite/files/html/app/design/frontend/default/bluemoon/template/catalog/product/view/attributes.phtml on line 48 (this template is modified, I know)

But it seems the code does not breaks the page for each product.
Thanks a lot.


texts: Modal Window with Youtube video stop video playing

texts:
I am having issues with Youtube video playing in Magento 2.2 store using modal popup to display video.

Here is what I am using to for modal window:

Problem is that after modal closes the video keeps playing.
I have tried to remove the iframe, but that ends up removing all iframes if there are more than one modal on a cms page.
Ie:

 $(".action-close").click(function(){
         $("iframe").remove();   //For Safety
            });


texts: How would I configure Magento 1.9 product pages to be configured in a 2 page method. I am doing development for a Jewelry Retailer and in this industry, generally you would select the Ring Setting first and then add that to cart and then the next page would be to pick the diamond that fits the ring. So, it would need to flow from the ring setting page directly to the diamond selector page and once that is selected, then the customer will be directed to the shopping cart. Let me know and thanks.


texts: Ignore a product for shipping rate calculation

texts:
Is there some way to ignore a product price and weight for the shipping rate calculation?

I´m working with the FedEx module and I don´t want FedEx to add extra shipping rate when certain products are added to the cart because I will add a specific amount to the shipping rate manually for each of the specific types of products.

Thanks!


texts: Magento 2.1.9 Admin Panel Styles & JS not loading correctly

texts:
I have installed Magento 2.1.9 using magento installer https://magento.com/tech-resources/download.

All tables on admin panel loading as the attached image. Any solution for mentioned error?


texts: How to different Permission give in User Marketing,Sale,Accounting in magento?

texts:
My question is permission Roles.

Marketing user access only in Rating of Vender,Dashboard,Promotion
etc.
Sale Manger user access only in order,shipment,status,Product
edit/delete/ etc..
Accounting user access only  in payment,Vender
Dashboard,Credit memo...


texts: Magento 2 Enterprise edition Staging is not applying for sales price rule

texts:
I have added some campaigns for the sales price rule. But even after start date it is not applying. I have executed the indexer, cron and flush the cache but still it is showing the Upcoming.

You can see the screenshot

Can you please help me to find the reason? Thank you very much.


texts: Uploading Extension in Magento Marketplace

texts:
I'm uploading extension in magento marketplace but while uploading extension file which in is TGZ format i'm getting error "The "package.xml" file does not exist; please verify the archive."

Folder Structure

App->code->local->AffilNow->Module->etc,helper,Model
     etc->Modules->afillnow.xml


texts:
I often find myself wanting to store a simple piece of information such as 'last exported id' or 'last import date' for retrieval at a later point in time. This is the kind of information that will always have a value, but will change frequently. Does anybody have any recommendations of a best practice, or even just passable place for storing this information?

I've considered making them config options, but since they are the kind of information that will change frequently in an automated fashion, and I don't want the end-user to modify the information, this doesn't feel like a good fit.

It needs to be global and permanent (changeable, but always available) so something like storing it in the session is out of the question.

I recently came across core_variable, which may be appropriate, but I've never come across a single use of it, so have no idea if it's suitable or even stable, let alone how to use it. If anybody has any examples that would be grand.


texts: Overriding Template: How to find Controller Name

texts:
I am overriding a template for the product page, like this: Magento 2 - editing module structure and functions

Then, I want to make a link based on the url (to only show for certain items). Basically, I want information from the route in the phtml file that I am editing.

To do this, should I create a plugin to extend the functionality of the controller that serves up this template to have the information stored? Can I get the information from the controller or block easily from the template code? Is there a good way to find out which controller I would need to extend?


texts: Not able to sent the confirmation mail to the user?

texts:
I'm working on the Magento 1.9.2.4.

When the user (guest or logged in) type their email for subscription they don't receive the confirmation email while all the setting for has been done by me.


texts: ImportExport problem with new destructor of Varien_Image_Adapter_Gd2 in 1.9.2.0

texts:
Can someone explain, what the following Code introduced between Magento CE 1.9.1.0 and 1.9.2.0 is used for?

class Varien_Image_Adapter_Gd2:

public function __construct()
{
    // Initialize shutdown function
    register_shutdown_function(array($this, 'destruct'));
}

/**
 * Destroy object image on shutdown
 */
public function destruct()
{
    @imagedestroy($this->_imageHandler);
}

After those two functions has been added, our import of product gallery images with the ImportExport interface stopped working. The error is due to a memory limit (which comes out to be the max open file size limit).

My idea is, that the files opened by the import won't be closed correctly.

I also saw that there were some empty destruct() functions introduced (Mage_ImportExport_Model_Import_Adapter_Abstract) - but extending those to match the parent logic doesn't help.


texts:
Is this a magento bug or is something I am doing it working

I had created my translation file in my module i18n. For testing purpose I just modified few text.

  app/code/Vendor/Namespace/i18n/en_US.csv

"Do you want to remove the item from cart?","Just Remove?"
"Login","Sign In"

In My JS File I have this piece of code which I need to translate

        deleteItem: function (data) {
            var self = this;
            confirm({
                content: $t('Do you want to remove the item from cart?'),
                actions: {
                    confirm: function () {
                        alert('Done');
                    },
                    always: function (event) {
                        event.stopImmediatePropagation();
                    }
                }
            });

        },

But the translation for the code does not work. When I deploy static content it does not adds the translation in js-translation.json file.

Does any one have a workaround?


texts: Products are not visible after update 2.2.8 -> 2.3.3 (CE)

texts:
After update the category view won't show any products:
"we can't find products matching the selection"

Some products will show up if I filter the results enough, but usually none will show up.

I have tried clearing all the caches multiple times, clearing static files, reindexed, imported the products again, etc. but nothing has helped so far.

Even if I import only 2 products, I got the result "we can't find products matching the selection" in any category. Both of the items will show up in search and in category page if I filter the results.

No errors in log files.

Any ideas?


texts: Magento 2.1.3 Availible api resources empty

texts:
I would like to set some apis for user. When I'm trying to choose any:

there are empty space.
What could happens?


texts: Magento 2 : Add custom text in invoice pdf header

texts: I need to add custom text below the Invoice No and before the Order No. I have tried with modifying insertDocumentNumber() method in  vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php. I have printed it but it is overlapping on the Invoice No label. Any help will be appreciated.


texts: Magento: Product Image upload permission for website specific admin user

texts:
We have implemented multi website functionality like

1) test1.com
2) test2.com
3) test3.com

We have created admin user based on each website. Here some product is shared with multiple website.

Example: Product 1 is shared with 3 websites. We want the feature to display image differently based on each website.

Super admin can able to upload and save image store specific.

The problem here is website specific admin users ex:test3.com admin user couldn't able to upload/save image for Product 1 because that product is shared in multiple website.

Is there any solution for this problem?

Duplicate of : https://stackoverflow.com/questions/32559763/magento-product-image-upload-permission-for-website-specific-admin-user


texts: Default configuration value for serialized_array settings is ignored

texts:
I have an extension which adds panel to System > Configuration, but suddenly in 1.9.3 it ignores default values for settings with <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>. So after installing the module settings are empty instead of having default data configured.

I have setting defined in system.xml file like:

<setting_name>
    <label>My label</label>
    <frontend_model>my/frontend_model</frontend_model>
    <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
    <sort_order>10</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <comment><![CDATA[...]]></comment>
</setting_name>

And in config.xml file I have defined default values:

<correct_group_name>
    <setting_name>a:1:{s:18:"_1450089283397_397";a:3:{s:4:"name";s:5:"pages";s:5:"label";s:5:"Pages";s:11:"hitsPerPage";s:1:"2";}}</setting_name>
</correct_group_name>

It works in all versions >= 1.6.2 and <=1.9.2.1. Did something changed in 1.9.3? I'm not able to find anything in relase notes.

Version 1.9.2.1:

Version 1.9.3.1:

Thanks for any help or suggestions.

P.S. All other settings' default values (like text inputs, select boxes, ...) work correctly.


texts:
I have an issue with the redirection from the third party. After redirection from the third party, the user has logged out automatically. This is happening because of the PHP SESS ID.
Can someone please help me?
Thanks


texts:
While exporting (CSV) data from admin grid, if I select single entry, even though it is exporting entire sheet. I am not able to export single entry.using below code. Please suggest something.

<?php
/**
 *
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Sm\Sample\Controller\Adminhtml\Sample;

use Magento\Backend\Block\Widget\Grid\ExportInterface;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\App\Filesystem\DirectoryList;

class ExportCsv extends \Magento\Backend\App\Action
{
/**
     * @var \Magento\Framework\App\Response\Http\FileFactory
     */
    protected $_fileFactory;

    /**
     * @var \Magento\Framework\View\Result\LayoutFactory
     */
    protected $resultLayoutFactory;

    /**
     * @param \Magento\Backend\App\Action\Context $context
     * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
     * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\App\Response\Http\FileFactory $fileFactory,
        \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
    ) {
        $this->_fileFactory = $fileFactory;
        $this->resultLayoutFactory = $resultLayoutFactory;
        parent::__construct($context);
    }

    /**
     * Export subscribers grid to CSV format
     *
     * @return ResponseInterface
     */
    public function execute()
    {
       $fileName = 'exportCsv.csv';
        $content = $this->_view->getLayout()->createBlock(
            'Sm\Sample\Block\Adminhtml\Sample\Grid'
        )->setSaveParametersInSession(
            true
        )->getCsv();

        return $this->_fileFactory->create($fileName, $content);
    }
    /**
     * {@inheritdoc}
     */
    protected function _isAllowed()
    {
        return $this->_authorization->isAllowed('Sm_Sample::sample');
    }

}


texts: How to fix Magento 2 MSI inventory reservation inconsistencies directly via DB?

texts:
I see orders that are closed, canceled or completed that were created in the reservation table but never removed and they won't be removed since it's triggered when the order changes the status.
I check the reservation running this command below.
select * from inventory_reservation where sku='822189036724';

I don't have the lasted version of MSI which includes a command to fix it, so how could I fix it in the DB directly?


texts: Delete products from a single website through CSV

texts:
I need to remove some products from a single website, but I need to do it through CSV. I saw this question but it isn't what I need, since I have only read access to the Magento database for my store, so I need to do this through CSV import.
In our Magento2, we have 2 stores/websites at present. I want to erase the products from the 'base'/'default' website, while leaving them intact from the other website.
I tried two CSVs, for a single configurable product and its associated simple products, in our staging/testing environment. I import the CSVs at System > Data Transfer > Import > Products > Delete.
I first tried with a CSV that had this structure, specifying product_websites and store_view_code:
sku,url_key,product_websites,store_view_code
sku_to_delete,url_of_product,base,default

And it did nothing (similar to the results in this question).
Then I tried with a CSV with the following structure, specifying only product_websites:
sku,url_key,product_websites
sku_to_delete,url_of_product,base

And the product was fully deleted from Magento, all websites.
The links above were the closest I could find to solutions I needed, but they didn't exactly address/solve this issue. So, is there a way to effectively remove a product from one website (which happens to be the 'base' website) through CSV data import?
Thank you in advance!!


texts: What is the order of order calculation in magento 1.9

texts:
What is order of order calculation means which is first calculate in order calculation process.

  -> Tax

  -> Discount

  -> Shopping cart rule

  -> Product price rule

  -> Tire prices

Please describe order of calculation.


texts: Block with PHP methods only - preferable inheritance

texts:
I often create blocks containing PHP methods, not binded with any template by design. They are sometimes used only in one place, sometimes throughout an app. So far, I was making them inherit from \Magento\Framework\View\Element\Template, but I am not sure if it is the best way. Maybe there is some other abstract block class most suitable for such a 'php-only' blocks?

example - this one is used on product pages in order to check if provided product is in cart already (it has no template assigned):

namespace [Vendor]\[ModuleName]\Block\Catalog\Product;

use \Magento\Catalog\Api\Data\ProductInterface;
use \Magento\Checkout\Model\Session;
use \Magento\Framework\View\Element\Template;
use \Magento\Framework\View\Element\Template\Context;

class IsInCart extends Template
{

private $checkoutSession;

public function __construct(
    Session $checkoutSession,
    Context $context,
    array $data  = []
)
{
    parent::__construct($context, $data);

    $this->checkoutSession = $checkoutSession;
}

public function isInCart(ProductInterface $product)
{
    $productId = $product->getId();
    $cartItems = $this->checkoutSession->getQuote()->getAllVisibleItems();
    $itemsIds = array();
    foreach ($cartItems as $cartItem) {
        $itemsIds[] = $cartItem->getProduct()->getId();
    }

    return in_array($productId, $itemsIds);
}

public function countItemsInCart()
{
    $cartItems = $this->checkoutSession->getQuote()->getAllVisibleItems();
    $cartItemsCount = count($cartItems);

    return $cartItemsCount;
}


texts:
I have the following code in my admin controller:

if ($data = $this->getRequest()->getPost()) {
    if (is_uploaded_file($_FILES['csv_dealers']['tmp_name'])) {
        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
        try {
            $connection->beginTransaction();

            $connection->query('TRUNCATE TABLE `dealer`');

            $handle = fopen($_FILES['csv_dealers']['tmp_name'], "r");

            while (($data = fgetcsv($handle, 1000000, ",")) !== false) {
                $import = "INSERT INTO `dealers` ..."

                $connection->query($import);
            }

            Mage::getSingleton('adminhtml/session')->addSuccess('...');

            fclose($handle);

            $connection->commit();
        } catch (Exception $e) {
            $connection->rollback(); //this doesnt work
            Mage::getSingleton('adminhtml/session')->addError('...');
        }
    } else {
        Mage::getSingleton('adminhtml/session')->addError('...');
    }
}

It's supposed to rollback the table if some error occurs, but it doesn't. What am I missing here?


texts: After upgraded magneto 2.3 to 2.4.2 error create() null file Category/DataProvider.php:

texts:
Have upgraded from magneto2.3 to magneto 2.4.2 getting following error when open "Categories In Admin"
main.CRITICAL: Error: Call to a member function create() on null in
/public_html/vendor/magento/module-catalog/Model/Category/DataProvider.php:663

Can anyone suggest a solution?


texts: Catalog View and CatalogSearch Layer equivalent class in Magento2

texts:
How to override this method in Magento2 from the below class?

\Block\Catalog\Layer\View.php

\Block\CatalogSearch\Layer.php

canShowBlock(){...}

Does both the classes above override \app\code\Magento\LayeredNavigation\Block\Navigation.php class in Magento2 , cause both classes have canShowBlock() in Magento 1
??


texts: Magento 2: How to give Admin Input Field Validation

texts:
I have below code

$this->addColumn(
                    'qty[]', [
                'header' => __('Qty'),
                'type' => 'number',
                'index' => 'qty',
                'editor' => 'text',
                'class' => 'validate-number',
                    ]
            );

How to validate this field. I need to validate for only numbers allowed?


texts:
I have store which sell glasses products.
A glasses can be rx glasses and non-rx glasses.
Their price is different.
A non rx glasses will have taxes applied to it but an rx glasses won't have any tax.
Is there any simple way to apply this by using custom options?
Basically those are the same glasses so I don't think I need to manage its inventory by using configurable products.
And I don't really like the idea of creating configurable products as I don't like duplicating the products one by one but I don't see any other enlightment other than using configurable products.
Any advice?


texts: How to show additional column from sales_order_item to order view information

texts:
I'm trying to show additional column in the order view -> information page this is the url page : rootDomain/admin_an2/sales/order/view/order_id/40/key.

From what I understand this data is coming from the sales_order_item table, now I have added additional column to that table called expected_delivery_time But I don't know how can show it there?

I found out that this UI is created from here : `/rootProject/vendor/magento/module-sales/view/adminhtml/templates/order/view/items.phtml

<?php
/**
 * @var \Magento\Sales\Block\Adminhtml\Order\View\Items $block
 */
$_order = $block->getOrder() ?>

                <?php $i = 0;
                $columns = $block->getColumns();
                $lastItemNumber = count($columns) ?>
                <?php foreach ($columns as $columnName => $columnTitle):?>
                    <?php $i++; ?>
                    <th class="col-<?php /* @noEscape */ echo $columnName ?><?php /* @noEscape */ echo ($i === $lastItemNumber ? ' last' : '')?>"><?php /* @noEscape */ echo $columnTitle ?>
                <?php endforeach; ?>

        <?php $_items = $block->getItemsCollection();?>
        <?php $i = 0; foreach ($_items as $_item):?>
            <?php if ($_item->getParentItem()) {
                continue;
            } else {
                $i++;
            }?>
            <tbody class="<?php /* @noEscape */ echo $i%2 ? 'even' : 'odd' ?>">
                <?php echo $block->getItemHtml($_item) ?>
                <?php echo $block->getItemExtraInfoHtml($_item) ?>

        <?php endforeach; ?>

I tried to find a block Items class.
I get the getColumn()  :

/**
 * @return array
 */
public function getColumns()
{
    $columns = array_key_exists('columns', $this->_data) ? $this->_data['columns'] : [];
    return $columns;
}

How to add my column to the $this->_data['columns'] ? getting stuck here.
any idea?


texts: How to call model method in other model file in magento2?

texts:
I want to call model method in other model file. i have created file (mobiledetect.php) in my "model folder" and i want to call this in service.php in in my custom function in same model folder.

please find my code here where i want call another model method. anyone have an idea for that please?

<?php

namespace Mymodule\Custom\Model;

use Mymodule\Custom\Api\ServiceInterface;

class Service implements ServiceInterface
{
    /**
     * @var \Magento\Checkout\Helper\Data
     */
    private $checkoutHelper;

/**
 * @var \Magento\Store\Model\ScopeInterface
 */
private $storeManager;

/**
 * Constructor
 * @param \Magento\Checkout\Helper\Data $checkoutHelper
 * @param \Magento\Store\Model\ScopeInterface $defaultConfigProvider
 */
public function __construct(
    \Magento\Checkout\Helper\Data $checkoutHelper,
    \Magento\Store\Model\StoreManagerInterface $storeManager
) {

    $this->checkoutHelper = $checkoutHelper;
    $this->storeManager = $storeManager;
}

/**
 * Return URL
 * @return string
 */
public function redirect_url()
{

    //want to call model here of  mobiledetect.php
if(isMobile)

{

    //Return statement modified by Ravikant Varma

    return $this->checkoutHelper->getCheckout()->getCustomRedirectUrl();
}
else {

    return $this->storeManager->getStore()->getUrl('checkout/onepage/success/');

 }

}

}


texts: -OR- text displayed under paypal checkout after removing CC checkout options

texts:
I've disabled all payment options except Paypal, however on the checkout page an "-OR-" text is still visible beneath the Paypal checkout button (see pic) on the checkout page.

Does anybody know why this is happening, and how it can be fixed?


texts:
I want to send from data to my controller function from phtml file but I'm not sure how to catch sent data in variables in my controller.
phtml code is like

<form method="post" action="<?php echo Mage::getUrl('adminhtml/pharmacist/orderapprove'); ?>">

            Item
            Qty
            Qty Dispensed
            Cost / Unit
            Sub Total
            Current Status
            Action
            Comment

        <?php foreach($ordered_items as $item){ ?>

            <?php echo $item->getName() ?>
            <?php echo $item->getQtyOrdered() + 0?>

            <?php echo round($item->getPrice(),2) ?>
            <?php echo round($item->getRowTotal(),2) ?>

            <?php
             $itemStatus = $item->getApprovalStatus();
        // Load the option text
        $itemOptionText = Mage::getResourceSingleton('catalog/product')
                                ->getAttribute('approval_status')
                                ->getSource()->getOptionText($itemStatus);
        echo ($itemOptionText);
             ?>

            <td id="status-<?php echo $item->getId();?>">
            <button data-item_id type="button" id="approve-<?php echo $item->getId();?>" value="Approved" onclick="saveApprovalStatus('<?php echo $item->getId(); ?>', 'Approved');">Approve</button>

            <button type="button" id="reject-<?php echo $item->getId();?>" value="Rejected" onclick="saveApprovalStatus('<?php echo $item->getId(); ?>', 'Rejected');">Reject</button>
           <div style="display:none" id="item-status-<?php echo $item->getId();?>">

                 <textarea id='comment-<?php echo $item->getId();?>' placeholder="Give reason for rejection"  name='comment' value="abc"></textarea>

        <?php } ?>

    <input type="submit" id="order-approve" value="Approve"></button>
    <input type="submit" id="order-reject" value="Reject"></button>

</form>

Controller function

public function orderapproveAction()
{

          $orderItemId = $this->getRequest()->getPost('order_item_id');
          $approvalStatus = $this->getRequest()->getPost('approval_status');
          $approvalDescription = $this->getRequest()->getPost('approval_description');
            echo ($approvalStatus );
            echo ($approvalDescription );
        exit();
    }

But these values are not echoing.


texts:
according to Magento http://merch.docs.magento.com/ee/user_guide/store-operations/permissions.html

  In addition, you can further restrict Admin access to only a specific site, or set of sites and their associated data. If you have multiple brands or business units with separate stores on the same Magento installation, you can provide Admin access to each of your business units but hide and protect their data from other Admin users. If an Admin user’s access is restricted to a specific set of websites and/or stores, the websites and stores for which they are not authorized will either not appear or be grayed-out as inactive. Only the sales and other data for allowed websites and stores is shown.

I cannot figure out how to restrict an admin login to a specific storeview - has anyone done this?


texts: Shipping and Handling Information' tab shows 'No shipping information available' in Sales Order admin

texts:
For few orders, shipping description in 'Shipping and Handling Information' tab  show 'No shipping information available'.

I am using the onepage checkout.
All I've found is that some orders have an empty shipping_description column in 'sales_flat_quote_address' table, where as shipping_method column is always correct. I tried to reproduce the same problem,but till now  I haven't found any pattern yet.

Any help will be much appreciate


texts: I need to add payment method for customer in customer_register_success event, Magento2

texts:
I need to add a default payment method for customers, is it possible to do it in time this event customer_register_success ? I added a drop-down list in the registration form and show active payment methods, when a customer chooses a payment method, it should be added as a payment method

OR , I want to put this block in reg form


texts: Magento2.3.3 add to cart button doesn't redirect to cart after adding in cart

texts:
I'm facing a weird issue after upgrading from magento 2.2.3 to 2.3.3.

When adding to cart from product page, I've enabled setting After Adding a Product Redirect to Shopping Cart to Yes.

After the product is added to cart, under function Magento_Catalog/js/catalog-add-to-cart::ajaxComplete doesn't go to success, while it goes to error.

The data coming under res.responseText has string with value "cart add{"backUrl":"https://m232.test/checkout/cart/"}".

I'm guessing that's due to the invalid response I got because cart add is added to the response but not sure how. Has anyone faced the same issue?


texts: Magento 2 Full Page Cache issue while adding product to the cart in custom theme

texts:
I created the custom theme in magento 2 and am using custom REST API for adding the product to the cart. It works well when i disabled the FPC, but while enabling FPC, the added products in the cart disappers when the page is refreshed.
It seems to be creating fresh quote id whenever am refreshing the page after adding the product.
Any help is appreciated.


texts: Include JQuery script to every CMS page within theme

texts:
How can I include a JQuery script to every CMS page within a theme.

Placing the .js file in:

app/design/frontend/<company>/<theme>/web/js/file.js

and using script tags(below) in the CMS page doesnt work.

<script src="js/file.js">


texts: Intermittent 503 errors with Redis enabled

texts:
I recently switched a store cache and session backend to Redis 3.0.3. I used the Cm_Cache_Backend_Redis and Cm_RedisSession extensions and the example configs provided. It works as expected and Redis stores the sessions and cache in 2 separate DB's. However, the site gets intermittent Magento 503 service unavailable errors (as reported by customers and observed by loading several pages at once). If I disable the extensions and go back to the standard file session_save's the problem goes away and can no longer be reproduced.

Is there some tuning that needs to be done to Redis to handle higher volume? Has anyone else every experienced this?


texts: How to customise invoice pdf layout in magento2?

texts: I want to customize layout of PDF invoice by css and by adding product image on invoice in magento 2.


texts: Magento2 error ltrim() expects parameter 1 to be string, array given

texts:
I moved my Magento 2.2.5 based website into another existing site in-order to make them both a multi-site website. I used a paid migration tool and all seemed to go fine, now when I am editing some products to add them to a category for one of my store views I am getting the below error. I even tried deleting the category from the admin panel and then tried for re-creating the category thinking, maybe something with the category just didn't migrate over correctly.

  No such entity with id = 128

 Warning: ltrim() expects parameter 1 to be string, array given in vendor/magento/module-catalog/Model/Category/FileInfo.php on line 102

I am not sure how to find out what entity id 128 is . I checked all my other categories which have category images and descriptions added to them all that looks fine.

Any suggestions on how to troubleshoot this further and or how to fix it? I also checked my folder and file permissions already


texts: How to add datepicker to admin panel forms

texts: Is there a predefined class, helper, etc that is to be used when creating a back-end, admin panel form? I am in the process of developing a custom module that includes several DATETIME fields and I would like to make this easier for the end-user.


texts: When I create many products I wish to add an automatic quantity value and an automatic "In Stock" value.


texts: How to reload order summary section on payment page in Magento 2

texts: I need to reload order summary section on selecting the payment method in magento 2


texts: How to create an Integration environment in Magento Cloud?

texts:
I have the Production and Staging environments in my Magento Cloud, but I don't see any Integration environment.
Checking this link I see that it's supposed to exits.
https://devdocs.magento.com/cloud/architecture/pro-develop-deploy-workflow.html


texts: Make dropdown list for field city in magento 2 checkout

texts:
I want to custom field "City" to dropdown list in checkout page (magento 2.1.5).

Is it possible? How can do that?

New update:

Thank you!


texts: to download samples the user should login or create an account first

texts: i want to restrict the user so that if he wants to download the sample data he would have to login or create an account first otherwise he would be not be able to download the sample data.


texts: Show images for each attribute selection in Magento 1.9.3

texts:
I have an attribute named "Special"
For each selection of this attribute I want to show some icons-images in the frontend of the product.
For this specific product I want to have a "Bio Product" icon, a "Gluten free" icon and a "Salt free" icon
Any ideas?


texts: How to get all the shopping cart rules that are set as auto generated coupon code?

texts:
I want to list all the shopping cart rules that are set with auto-generate coupon code options in admin,

what model i should use? and what are the conditions?


texts: Render header and footer in custom controller

texts:
I'm creating a custom controller that uses the same header and footer as the rest of the site, but will be using custom code to serve content, but I also need to exclude them based on query parameters (hence why I'm not using a template file in a cms page for this)

My question is how can I call upon these in a controller? Does renderLayout() accept parameters such as renderLayout('header'), etc.?


texts:
I am trying to rewrite Grid in Magento Admin for Newsletter Subscribers. I am using code below to rewrite Grid in Custom module:

config.xml (only required part is added)

<global>
    <blocks>
        <custommodule>
            <class>Namespace_Module_Block</class>
        </custommodule>
        <adminhtml>
            <rewrite>
                <!-- Extra column in newsletter subscribers grid  -->
                <newsletter_subscriber_grid>Namespace_Module_Block_Adminhtml_Newsletter_Subscriber_Grid</newsletter_subscriber_grid>
            </rewrite>
        </adminhtml>
        <catalog>
            <rewrite>
                <product_list_toolbar>Namespace_Module_Block_Product_List_Toolbar</product_list_toolbar>
                <product_view>Namespace_Module_Block_Product_View</product_view>
            </rewrite>
        </catalog>
    </blocks>
<global>

Namespace_Module_Block_Adminhtml_Newsletter_Subscriber_Grid

    <?php
    class Namespace_Module_Block_Adminhtml_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Newsletter_Subscriber_Grid
    {
        protected function _prepareColumns()
        {
            // extra grid column added
        }
    }

But Grid is not updating in Admin... Anything wrong I am doing here...??


texts: Customer custom attribute not showing in magento2

texts:
I have created custom module for creating custom attribute in Magento2. I installed a custom module in local system there is working fine.

My Local Magento version is 2.1.6, I installed this custom module in Production environment and it doesn't work.

The Production Magento version is 2.2.3  custom attribute is showing in eav_attribute table but, not showing in admin dashboard !

eav attibute table shows custom attribute:


texts: Left join on custom collection, to get product name by product ID

texts:
There's a collection which contains product ids. I'd like to join it with the magento table that stores paroduct names, in order to add product name to collection.

$collection = Mage::getModel("productquestions/questions")->getCollection();
$this->setCollection($collection);

$collection->getSelect()
            ->joinLeft(I_NEED_HELP_IN_THIS_PART_OF_CODE);

The table that's used to get collection is "nbpq_product_questions" and the column that stores product id is "product_id".

I've seen some code examples about left join collection, but I can't make it work in this particular case. Can you help me please?


texts: Emergency - our site down for 2 days. Ready to deploy on a new server but missing custom options; any way to put same custom options on all products?

texts:
Magento 1.9.4

Our old Magento store (1.9.1) hosted at Hostforweb just stopped working (long story - first it was extremely slow = unusable; then the hosting company says they can move it to another node, which they did and the pages would not even load so now they are moving it back but we have been DOWN for days).

We have another hosting account with another company. I managed to set everything up and import all products via the Dataflow Import but this Dataflow import does NOT import custom options at all. I tried to do a regular Export/Import but it does not work - it says it's ready to import but then hangs at Please Wait.

The import file has 137 KB in size

According to our new hosting company:

  22-Feb-2019 22:57:55 UTC] PHP Fatal error: Allowed memory size of
  2147483648 bytes exhausted (tried to allocate 8192 bytes) in
  /home/oursite/public_html/app/code/core/Mage/Core/Model/File/Validator/Image.php
  on line 101

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

This is a real emergency for us and we need to switch the domains to the new host where a site is all ready but missing custom options on products.

Is there an easy way to set up the very same custom options on all 1050 products?


texts: Magento front end only printing "local.xml"

texts: I went to do a test customer registration and right after I submitted form, the page only loads what you see below. I deleted cookies and loaded the main page, and it has what you see below as well. My coworker was messing with permissions as well, but we think we have all the permissions correct now. There are no errors in magento logs. The only error on server that may be applicable "client denied by server configuration: /var/www/Staging/public_html/app/etc/local.xml" but I know this is a common error and it's been there. Any ideas about what the issue is?


texts: How to display child categories a filter

texts: I currently have a shop by filter that displays parent category and sub category, I would like to add a child category as a drop down to the sub, please have a look at the link of what I currently have http://yaubrothers.xist2test.com/index.php/products.html


texts: 'Zend_Currency_Exception' with message 'No region found within the locale 'en'' in lib/Zend/Currency.php:553

texts:
I'm getting this error in exception.log

This is happening only on Romanian Locale.

Also, in system.log I am getting this error:

  2014-02-04T09:42:15+00:00 ERR (3): Warning: simplexml_load_file():
  /lib/Zend/Locale/Data/ro.xml:637: parser error : Input is not proper
  UTF-8, indicate encoding ! Bytes: 0xE2 0x80 0x3F 0x3C  in
  b/Zend/Locale/Data.php on line 161

In checkout, on Romanian store view, the countries dropdown is empty.
And, also in backend, I can not set the backend language to Romanian.
For English ( for example ) it is like this: English (United States) / English (United States).
For Romanian ( on my webshop ) is like this: () / Romanian (Romania)

Any help is appreciated. Thank you ! I'm using Magento ver. 1.7.0.2

Stack trace:

> #0 public_html/lib/Zend/Currency.php(101): Zend_Currency->setLocale(NULL)
> #1 /app/code/local/Mage/Core/Model/Locale.php(617): Zend_Currency->__construct('RON')
> #2 /app/code/core/Mage/Directory/Model/Currency.php(233): Mage_Core_Model_Locale->currency('RON')
> #3 /app/code/core/Mage/Directory/Model/Currency.php(238): Mage_Directory_Model_Currency->formatTxt(0)
> #4 /app/code/local/Mage/Core/Model/Locale.php(723): Mage_Directory_Model_Currency->getOutputFormat()
> #5 /app/code/core/Mage/Catalog/Block/Product/View.php(168): Mage_Core_Model_Locale->getJsPriceFormat()
> #6 /app/design/frontend/magento-boilerplate/default/template/catalog/product/view.phtml(69):
> Mage_Catalog_Block_Product_View->getJsonConfig()
> #7 /app/code/core/Mage/Core/Block/Template.php(241): include('/home/mediaswit...')
> #8 /app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/magent...')
> #9 /app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
> #10 /app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
> #11 /app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
> #12 /app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
> #13 /app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
> #14 /app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
> #15 /app/design/frontend/magento-boilerplate/default/template/page/2columns-left.phtml(53):
> Mage_Core_Block_Abstract->getChildHtml('content')
> #16 /app/code/core/Mage/Core/Block/Template.php(241): include('/home/mediaswit...')
> #17 /app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/magent...')
> #18 /app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
> #19 /app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
> #20 /app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
> #21 /app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
> #22 /app/code/core/Mage/Catalog/Helper/Product/View.php(147): Mage_Core_Controller_Varien_Action->renderLayout()
> #23 /app/code/core/Mage/Catalog/controllers/ProductController.php(132):
> Mage_Catalog_Helper_Product_View->prepareAndRender(901,
> Object(Mage_Catalog_ProductController), Object(Varien_Object))
> #24 /app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_ProductController->viewAction()
> #25 /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250):
> Mage_Core_Controller_Varien_Action->dispatch('view')
> #26 /app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
> #27 /app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
> #28 /app/Mage.php(683): Mage_Core_Model_App->run(Array)
> #29 /index.php(87): Mage::run('', 'store')
> #30 {main}


texts:
I have installed Magento 2 a month ago on a server. The framework location is

\vendor\magento\framework

I just downloaded a new archive to load it into my IDE, but the strange thing is it has a different path for the framework.

\lib\internal\Magento\Framework

Edit: \app\code\Magento was what i had as a path in the first place. But those seems to be the modules just like Magento 1? To be clear, my server doenn't have this path or any contents. To sum up: I am confused.

What is the difference? Which one is preferend and why? And, how can i get the same version locally without having to download all the files from the server?


texts: Magento 2 - Argument 2 missing error on overriding file

texts:
I am trying to override Magento\Catalog\Block\Category\View

added this code in di.xml

<preference for="Magento\Catalog\Block\Category\View" type="Naheed\AllProducts\Block\Category\View" />

And my new file is this Vendor\Module\Block\Category\View

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Vendor\Module\Block\Category;

/**
 * Class View
 * @api
 * @package Magento\Catalog\Block\Category
 * @since 100.0.2
 */
class View extends \Magento\Catalog\Block\Category\View
{
    /**
     * Core registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry = null;

    /**
     * Catalog layer
     *
     * @var \Magento\Catalog\Model\Layer
     */
    protected $_catalogLayer;

    /**
     * @var \Magento\Catalog\Helper\Category
     */
    protected $_categoryHelper;

    protected $priceHelper;

    protected $_storeManager;

    protected $categoryRepository;

    protected $_request;

    protected $productFactory;

    protected $eavconfig;
    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Catalog\Helper\Category $categoryHelper
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
        \Magento\Framework\Registry $registry,
        \Magento\Catalog\Helper\Category $categoryHelper,
        \Magento\Framework\Pricing\Helper\Data $priceHelper,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Catalog\Model\CategoryRepository $categoryRepository,
        \Magento\Framework\App\Request\Http $request,
        \Magento\Catalog\Model\ResourceModel\ProductFactory $productFactory,
        \Magento\Eav\Model\Config $eavconfig,
        array $data = []
    ) {
        $this->_categoryHelper = $categoryHelper;
        $this->priceHelper = $priceHelper;
        $this->_catalogLayer = $layerResolver->get();
        $this->_coreRegistry = $registry;
        $this->_storeManager = $storeManager;
        $this->_request = $request;
        $this->categoryRepository = $categoryRepository;
        $this->productFactory = $productFactory;

        parent::__construct($context, $data);
    }

    ...
}

Now I am getting error Argument 2 passed in __constructor


texts: static deploy not taking correct files to Pub/Static folders

texts:
I've made an update to one of my scss files, and updated the corresponding css file, in the web/css folder of my theme but when I re-run static deploy for en_GB it's not taking the new changes forward, it's still the pre-change version. I'm on Magento ver. 2.1.3.

I've run:

php bin/magento setup:static-content:deploy en_US en_GB

And then

php bin/magento indexer:reindex
php bin/magento cache:flush

But it's still bringing the wrong files even if I delete the scss and css file from the pub/static web/css folder and re-run the commands.

I've checked and the server definitely has my changes in the theme web/css folder.

Any idea how to correct this?


texts: Magento 2 : Dynamic PDF and image attachement with order email

texts:
I need to attach PDF and images with order email. I have dynamic PDF and image path which is stored in quote_item table. I have debugged code to attach image/PDF to order email.

<preference for="Magento\Framework\Mail\Template\TransportBuilder" type="vendor\moduleName\Model\Mail\MailTransportBuilder"></preference>
<preference for="Magento\Sales\Model\Order\Email\SenderBuilder" type="vendor\moduleName\Model\Mail\SenderBuilder"/>

<?php

namespace vendor\moduleName\Model\Mail;

class MailTransportBuilder extends \Magento\Framework\Mail\Template\TransportBuilder
{
    public function addPdfAttachment($fileContent, $filename)
    {
        if ($fileContent) {
            $this->message->createAttachment(
                $fileContent,
                'application/pdf',
                \Zend_Mime::DISPOSITION_ATTACHMENT,
                \Zend_Mime::ENCODING_BASE64,
                $filename
            );

            return $this;
        }
    }

    public function addImageAttachment($fileContent, $filename)
    {
        if ($fileContent) {
            $this->message->createAttachment(
                $fileContent,
                \Zend_Mime::TYPE_OCTETSTREAM,
                \Zend_Mime::DISPOSITION_ATTACHMENT,
                \Zend_Mime::ENCODING_BASE64,
                $filename
            );

            return $this;
        }
    }

}

<?php
/**
 * @author     Kristof Ringleff
 * @package    Fooman_EmailAttachments
 * @copyright  Copyright (c) 2015 Fooman Limited (http://www.fooman.co.nz)
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace vendor\moduleName\Model\Mail;

use Magento\Framework\Mail\Template\TransportBuilder;
use Magento\Sales\Model\Order\Email\Container\IdentityInterface;
use Magento\Sales\Model\Order\Email\Container\Template;

class SenderBuilder extends \Magento\Sales\Model\Order\Email\SenderBuilder
{
    /**
     * @var Template
     */
    protected $templateContainer;

    /**
     * @var IdentityInterface
     */
    protected $identityContainer;

    /**
     * @var TransportBuilder
     */
    protected $transportBuilder;

    /**
     * @param Template $templateContainer
     * @param IdentityInterface $identityContainer
     * @param TransportBuilder $transportBuilder
     */
    public function __construct(
        Template $templateContainer,
        IdentityInterface $identityContainer,
        TransportBuilder $transportBuilder
    ) {
        $this->templateContainer = $templateContainer;
        $this->identityContainer = $identityContainer;
        $this->transportBuilder = $transportBuilder;
    }

    /**
     * Prepare and send email message
     *
     * @return void
     */
    public function send()
    {
        $this->transportBuilder->addPdfAttachment(file_get_contents($data),$data);

        parent::send();
    }

}

How can I inject order object in SenderBuilder class.


texts:
I dare say this is a newbie question but I've not found anyone else asking it.
I am going through a steep learning curve having just taken over a site running magento 2.2.6 on magestack on nginx (none of which I know!).
There is an extension which is creating a google shopping feed in  /pub/feeds/ but although I can download it over ftp, the feed file returns a 404 to a browser so I infer that google won't be able to pull it.
I already hit the same issue trying to verify the site with the google merchant account by uploading a file to the root (which also returned a 404) but I was able to work around that with a tag instead.
nginx doesn't have htaccess files and if it were something every magento operator had to do I think my searching would have turned something up by now, so any pointers to what's going on would be appreciated.
Edit: having set up a fresh install I see that it's not default magento behaviour.
Further Info:
nginx configuration can include location rules to route urls to paths. In this case the magento root is the domain root and the configuration routes requests to eg.
domain.com/media/catalog/product/1/1/image.jpg to the path
/var/usr/domain/html/pub/media/catalog/product/1/1/image.jpg.
It's set up so that any routes without a matching rule return a 404
so that a further location rule would be needed to route requests to pub


texts: Any Observer or plugin event for specific module disable?

texts:
I want to perform some action when my custom module gets disable.  Is there any observer event or plugin event that being fired when i disable my module?

Any help would be appreciated.

Thank you,


texts: (resolved) Magento 2 : Setup\InstallSchema.php seems ignored, why and how to debug

texts:
Magento 2 (0.74.0-beta10) seems to ignore the Setup\InstallSchema.php of my module. The module is correctly enabled - and i can see him on frontend with the route. I don't find what script load the InstallSchemas, to debug it. Anyone knows what's going on ?

Here's my InstallSchema.php :

<?php

namespace Tb\Staff\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

/**
 * @codeCoverageIgnore
 */
class InstallSchema implements InstallSchemaInterface, UpgradeSchemaInterface
{
    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();

        /**
         * Create table
         */
        $table = $installer->getConnection()->newTable(
            $installer->getTable('staffmember')
        )->addColumn(
            'id',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            null,
            ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
            'Id'
        /*)->addColumn( 'Staff_id',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            null,
            ['unsigned' => true, 'nullable' => false, 'default' => '1'],
            'Staff Id'
        )->addColumn( 'customer_id',
            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
            null,
            ['unsigned' => true, 'nullable' => true ],
            'Magento Customer Id of this Staff Staff'*/
        )->addColumn(
            'firstname',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            55,
            [],
            'First '
        )->addColumn(
            'lastname',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            55,
            [],
            'Last name'
        )->addColumn(
            'job',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            55,
            [],
            'Job intitle'
        )->addColumn(
            'bio',
            \Magento\Framework\DB\Ddl\Table::TYPE_BLOB,
            null,
            [],
            'Biography'
        )->addColumn(
            'picture',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            255,
            [],
            'Picture URL'
        )->addColumn(
            'email',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            128,
            ['nullable' => true],
            'User Email'
        )->addColumn(
            'twitter',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            255,
            ['nullable' => true],
            'User Twitter @username'
        )->addColumn(
            'linkedin',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            255,
            ['nullable' => true],
            'User LinkedIn URL'
        )->addColumn(
            'username',
            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            40,
            ['nullable' => true],
            'User Code'
        )->addColumn(
            'is_active',
            \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN,
            null,
            ['nullable' => false, 'default' => 1],
            'Is Active flag'
        )->setComment(
            'Eca Staff Members'
        );

        $installer->getConnection()->createTable($table);

        $installer->endSetup();

    }
}

The module is found by setup:upgrade, but do nothing with it.

$ php bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
C:/xampp/htdocs/www/tb/mage2/var/
Updating modules:
Schema creation/updates:
Module 'Tb_Staff':
Module 'Magento_Store':
Module 'Magento_Directory':
Module 'Magento_Backend':
Module 'Magento_Backup':
.....


texts: What is the best and fastest way to create products in Magento 2?

texts:
I am developing a connector between Magento 2 and an ERP system. And I have to import 1000s of products from ERP to magento. And Update them using cron.

So I want to know what is the best way to bulk import products. And how they can be achieved?


texts:
I have some databases which we use for our staging servers to test changes to code, and I want to import them and use them locally.

I've managed to import the database fine, but my admin panel is still linking to the staging servers instead of locally. I'd like to change the base_urls in core_config_data so that I can use the admin panel locally.

So far I've done this:

Changing the base_urls to point to my localhost. But this seems to have given me 504 gateway timeouts.

I'm running nginx and php7.0-fpm.


texts: Assign two valide classes in one input field form

texts:
js/prototype/validation.js

I have two classes: validate-email, validate-mobilePhoneNumber

customer/form/login.phtml

In email input, the customer can log with the email address or a phone number, so what I would like to do is that when the user enters an email address, I validate the email class: validate-email and if he enters a phone number I validate it the phone class: validate-mobilePhoneNumber

    *<?php echo $this->__('Email address or phone number')  ?>

         <input type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry " title="<?php echo $this->__('Email address or phone number') ?>" />

EDIT: On the basis of the answer of Jaimin Sutariya

In js/prototype/validation.js we need to add a custom validation

Validation.add('validate-email-or-phone', 'Please enter a valid Email address or phone number.', function(v) {
return Validation.get('IsEmpty').test(v) || Validation.get('validate-email').test(v) || Validation.get('validate-mobilePhoneNumber').test(v)

})


texts: Problem when download dompdf in magento 2.4.1

texts: Hi am trying to install dompdf in Magento 2.4.1 using composer v1 but no success


texts:
If I update the prices, SKU's etc.. in admin they will reflect on the front end but the grid inside admin still shows the old data.

I have tried re-indexing and optimising the database but this doesnt resolve the problem.

Could it be todo with code cache? Recently upgraded to Magento 2.1.14


texts: adding an item to the shopping cart does not add the first time; it does add the second time

texts:
This has been happening for a long time - when I add an item to the shopping cart the first time - it does not add to cart! The second time it does add...

My Magento version is  Magento 1.9.1.0

This does not happen always but every once in a while. Magento Cache is enabled.


texts:
I just have installed the module ajax login and register from youama (url:http://www.youama.com/free-ajax-login-and-register-module-magento/). I followed the steps  about install. Somehow the module works fine on every page off my website, exept the homepage. does anyone have experience with this module or does anyone knows how i can fix this problem?
tnx!


texts: How to pass variable from phtml and how to get variable in require js file

texts:
How to pass parameter form .phtml to require js file

Template file

<script type="text/javascript">
        require(['Namespace_Module/js/custom'], function () {
        });
</script>

JS file

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

//here need to get parameter

});


texts: Magento 2: how to get shipment id by product id?

texts: For a single order, I want to get shipment id by product id if shipment created in that order.


texts: Calling an Javascript function after adding an item

texts: I have an javascript function to display div block once i added any item to cart. How can i achieve this?


texts: How to modify datepicker input template and js file?

texts:
I want to change date input data bind attributes and I don't know exactly which file I should overwrite. I changed these files but output is still the same.
map: {
    '*': {
        'Magento_Ui/templates/form/element/date': 'Netweb_Shamsi/templates/form/element/date',
        'Magento_Ui/js/lib/knockout/bindings/datepicker' : 'Netweb_Shamsi/js/persian-datepicker'
    }
}


texts: How can I reverse create Quote for Order in Magento 2?

texts:
I want to validate some data in the quote using rule conditions, but the quote gets delete after a period of time.
How can I reverse create Order -> Quote programmatically?


texts:
I'm trying to create a custom block in the theme I created for Magento 2.1.8.

When I add the  element to the default.xml layout, I got the following exception:

Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: frontend\Custom\Simple\Block\Services
Exception #1 (ReflectionException): Class frontend\Custom\Simple\Block\Services does not exist

In the Custom/Simple/Block/Services.php I have the following code:

<?php

namespace Custom\Simple\Block;
use Magento\Framework\View\Element\Template;

/**
* Services block
*/
class Services extends Template {
    public function getTitle() {
        return "Services";
    }
}

In the default.xml I've added this code:

<referenceContainer name="content">
    <block class="frontend\Custom\Simple\Block\Services" name="services.test" template="Custom_simple::test.phtml">
        <arguments>
            <argument name="something" xsi:type="string">Value</argument>
        </arguments>
    </block>
</referenceContainer>

I've tried to change the class to: Custom\Simple\Block\Services and I got the same error.

Thanks for your help!

Edit:

In the registration.php I have the following code:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/Customdac/Simple',
__DIR__
);


texts:
I'm getting the following error message when I select some category in the main manu:

Fatal error: Maximum execution time of 60 seconds exceeded in home/magento19.test/public_html/app/code/core/Mage/ConfigurableSwatches/Helper/Data.php on line 82

The error message got back after upgrade from Apache 2.2 to 2.4 and PHP 5.4 to 5.5, but the error message had appeared already some weeks ago and dissappeared after I setted the max_execution_time directive at 60 seconds in the php.ini config file.

The line in question is inside the method normalizeKey and call to mb_strtolower and trim:

public static function normalizeKey($key) {
    if (function_exists('mb_strtolower')) {
        return trim(mb_strtolower($key, 'UTF-8'));
    }
    return trim(strtolower($key));
}

The code to display thumbs swatches in the result searches was deleted, but I guess there's must be some around related.

mbstring PHP module was installed yesterday (to solve an obvious issue with email templating), so it shouldn't be the cause.


texts: Product image not visible in category listing

texts:
I did update m2_catalog_eav_attribute set used_in_product_listing = 0; to reduce the size of flat table. Now the product image is not visible in category view.

The image is not being displayed because "Use in product listing" has been disabled for all attributes. I need to enable it again for the specific attribute. But I don't know which attribute. I tried to enable it for all attributes with "image" in its name, but no success.

Which attribute is for the product image?


texts: Email is send but email content is empty

texts:
Email code:

public function getNotification() {

    return Mage::getStoreConfig('example/general/notification');
}

public function sendEmail() {
$storeId = Mage::app()->getStore()->getId();
        $templateId = Mage::helper('example')->getNotification();
        $emailTemplate = Mage::getModel('core/email_template')->loadDefault($templateId);
        $senderMail = Mage::helper('example')->getEmailAddress();
        $senderName  = Mage::helper('example')->getName();
        $receiver = array(
                $senderMail => $senderName,
                $authorMail => $authorName
            );

        $emailTemplate->setTemplateSubject("New Notification Added For ". $productName);
        $emailTemplate->setSenderEmail($senderMail, $storeId);
        $emailTemplate->setSenderName($senderName, $storeId);
        $emailTemplate->send(array_keys($receiver),array_values($receiver), $post);
 }

my code in config.xml

<template>
            <email>
                <general_notification translate="label" module="example">
                    Notifications
                    <file>notification.html</file>
                    <type>html</type>
                </general_notification>

            </email>
        </template>

system.xml

<notification>
Notification send to admin and customer
    <frontend_type>select</frontend_type>

    <source_model>adminhtml/system_config_source_email_template</source_model>
        <sort_order>90</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>

</notification>

Now In System > Transaction Email I m add New template and save that template In config I m get template name but using this template my mail is send but Email is empty. there is no content display


texts: Import Woocomerce product variation into magento 1.9 configurable products via CSV

texts:
Hello I need some information on how to set my CSV file to import configurable products in magento.

I am using Data Flow Profile to export the sample product I created in magento. But I cant find a columnn for configurable products.

What column should I enter the data of my product variation from my Woocomerce to magento configurable products?


texts: Magento 2 : How affects Enable Single-Store Mode Yes/No?

texts:
I have 1 single website with single store. When I enable Single-Store Mode to Yes/No

Not able to change Product Url.

https://github.com/magento/magento2/issues/5929#issuecomment-238170690

What is actual concept of Single-Store Mode & when it requires to set to Yes?

It saves data in store_id to 0 or 1.


texts: I need to add to tables to database using InstallSchema.php How can i do that?

texts:
Below class is my InstallSchema.php

<?php

namespace Test2\Helloworld\Setup;

use \Magento\Framework\Setup\InstallSchemaInterface;
use \Magento\Framework\Setup\ModuleContextInterface;
use \Magento\Framework\Setup\SchemaSetupInterface;
use \Magento\Framework\DB\Ddl\Table;

class InstallSchema implements InstallSchemaInterface
{
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        $tableName = $setup->getTable('base_price');

        if ($setup->getConnection()->isTableExists($tableName) != true) {
            $table = $setup->getConnection()
                ->newTable($tableName)
                ->addColumn(
                    'id',
                    Table::TYPE_INTEGER,
                    null,
                    [
                        'identity' => true,
                        'unsigned' => true,
                        'nullable' => false,
                        'primary' => true
                    ],
                    'ID'
                )
                ->addColumn(
                    'width',
                    Table::TYPE_INTEGER,
                    null,
                    ['nullable' => false],
                    'Width'
                )
                ->addColumn(
                    'height',
                    Table::TYPE_INTEGER,
                    null,
                    ['nullable' => false],
                    'Height'
                )
                ->addColumn(
                    'price_component',
                    Table::TYPE_INTEGER,
                    null,
                    ['nullable' => false],
                    'Price Component'
                )
                ->setComment('Test2_Helloworld - price');
            $setup->getConnection()->createTable($table);
        }

        $setup->endSetup();
    }
}

I need to add another table for color price with 3 columns id, color and price_component

Is there a way to do that?


texts: How do I log calling function or class? Warning: include(): Filename cannot be empty

texts:
we see

  Warning: include(): Filename cannot be empty

in our logs

and there is hardly a trace (other then "app/code/core/Mage/Core/Block/Template.php on line 24") ...

  ERR (3): Warning: include(): Filename cannot be empty  in /app/code/core/Mage/Core/Block/Template.php on line 241
  ERR (3):
  Warning: include(): Failed opening '' for inclusion (include_path=
  many directories here)

question: is there a way to log the calling function or log the calling class or calling file?

This way we hope! to find out what is causing this error


texts: I am getting Fatal error: Class 'IntlDateFormatter' not found in Magento2

texts: I am getting the error Fatal error: Class 'IntlDateFormatter' not found in Magento2 after installation.


texts: Magento 2. What is the entity/class responsible for calculating the discount amount?

texts:
What is the entity/class responsible for calculating the discount amount?
Where is this discount amount calculated?


texts: Migrate to magento 1.7.0.2 to 1.9.2.4 ( last version )

texts: I want to upgrade my store ( orders, products, categories ) from magento v.1.7 to v. 1.9 ( last ). How i can proceed without lost or broken a webiste/DB ?


texts: Magento 2 Add block to custom layout via admin panel widget

texts:
I've made a custom theme and custom homepage layout that renders a custom container and inside it a block with a custom template:

custom_homepage.xml inside Magento_Theme/page_layout folder

    <?xml version="1.0"?>
    <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
        <update handle="empty" />
        <referenceContainer name="page.wrapper">

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

            <container name="custom.container" as="customContainer" label="Custom Container" htmlTag="div" htmlClass="custom-container">
                <block class="Magento\Framework\View\Element\Template" name="testing" type="cms/block" template="Magento_Theme::test.phtml" />
            </container>
        </referenceContainer>
    </layout>

I also have a layouts.xml which is:

<?xml version="1.0" encoding="UTF-8"?>
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd">

    <layout id="custom_homepage">
        Custom Homepage
    </layout>
</page_layouts>

So in my admin section I can go to content -> pages -> and set this layout as custom homepage. Everything renders and I get the text from test.phtml inside Magento_Theme/templates which is:

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem suscipit, adipisci, cum quos, alias similique ad eum at deserunt eligendi enim dignissimos, unde vero ipsam voluptatibus cumque accusantium! Obcaecati, quasi.

Now I want to go and add another block to my custom container from above as widget from admin panel.. So I go to admin/content/widget/new widget and under 'Add Layout Update' I select Page Layout and under Page tab I do not see my custom homepage here, neither 1 column, 2 columns with right bar and other made by default..

Also under container tab I do not see my label (Custom Container), only the default ones like (Page Footer Container, After Page Header, etc..)

What am I doing wrong?

Thanks!


texts: How to add fake CSV column names to custom importexport models to make them validate on import?

texts:
I have created an importexport module for csv import for a custom model. This module is to support CSVs supplied from multiple sources, so are not all marked up the same. Generally, this is not a problem as long as the correct table column names are used in the right place.

The problem arises from a number of the CSVs containing two, or more, lots of data for the item, depending on the state of the existing items.

Is it possible to specify "valid" column names in the importexport models that don't exist in the custom table? I want a way to add custom column names to the CSV, at which point I will filter the data and break the single rows into multiple, valid rows with the right column names.

For example, here is the first-row of a CSV I have been given:

Afghanistan, 12.5, 160, 13.98, 143, 16.88, 59, 30, 18.88, 53, 26

If the item in the database has a price of £20, then I want the data from columns 1 and 3. For all other values, I want the data from columns 5 and 7. (And in all cases I want the country name - column 0).

As I have said, I want to add custom column names to the above, for example "20rateOne":

country,20rateOne,,20rateThree,,rateOne,,rateThree,,,

My importexport entity models extend Mage_ImportExport_Model_Import_Entity_Abstract.


texts: Static content deploy - Compilation from source

texts:
Doing a setup:static-content:deploy never finishes deploying files on a custom theme. Instead gives Compilation from source:  frontend/Vendor/theme/en_US/css/email-fonts.less and then stops compiling.

Ran a grunt clean, grunt exec to remove all files in pub/static, var/*

No luck. Store is currently stuck in Client Side Compilation Mode, setting it to Server Side Compilation Mode renders no styles

Store is in Development mode, I am also unable to set to Production mode using deploy:mode:set production

Any help, insight is appreciated.