texts: How to override or extend etc/view.xml file in custom module in Magento2?

texts:
I would like to override or extend some of gallery setting(view.xml) and catalog image size changes with my custom module.

I have tried to override in app/code/<vendor>/<module>/etc/view.xml, but not working.

How can I override etc/view.xml in custom module ?


texts: Magento 2- How to move custom options after cart button?

texts:
I want to move custom options below Add to Cart button and also want to move short description within form tag.How can I achieve this?

Also I want to know why my custom php code not working in addtocart phtml file?
Thanks


texts: call custom view.phtml on product detail page

texts:
I want to call my custom custom view.phtml

I updated category > custom design and added below code

<reference name="product.info">
    <action method="setTemplate"><template>catalog/product/test.phtml</template></action>
</reference>

test.phtml i called but i see path as

frontend\base\default\template\catalog/product/test.phtml

i want it to be called from current theme folder


texts: How session variable accessed from adminhtml/session?

texts:
I set Session variable for my array and I want to use on another page, but Nothing found in return.
Like:
(In My custom Module's Controller file)
Here $datas is My array.

Mage::getSingleton('adminhtml/session')->setDatas($datas);

And Use :

$my_data = Mage::getSingleton('adminhtml/session')->getDatas();

echo"<pre>";print_r($my_data);

But not get anything.
Please suggest what can I do.


texts: How to create a custom api for mobile app in magento 2.3

texts:
I want to create custom APIs for a mobile app tp cop up with my Magento 2.3 .x project.

Like APIs for plugins installed like cc avenue, store locator plugin.


texts: Serious problem with Email Deliverability when sending Order Confirmation Emails

texts:
Magento 1.9.4

Let me first define the terms so that we are on the same page as it’s vital to mention that Email deliverability isn’t the same as a delivery rate.

A delivery rate indicates what percentage of your Emails is received by subscribers’ mailboxes, even if they land in the SPAM folder. Meanwhile, deliverability is the inbox placing indicator:

Email deliverability is the ability to deliver emails to recipients’ inboxes.

Just to be clear - we are not having problems with the delivery rate but rather with Email deliverability:
We have had this problem now for many months where customer places an order, the Order Confirmation Email is sent and it does not reach their Inbox at all. Most often it ends up in customer's SPAM folder which they don't check and this results in customers calling us on the phone and/or cancelling their order/bad reviews.
We were initially set up on our own server (with a hosting company) for sending Email with our own dedicated IP. We then switched to Sendgrid (in hopes of making things better) where we set up with our own IP again for sending Emails (we do not send any Email campaigns out of that Sendgrid account). The problem is really bad even now with Sendgrid. We set just about everything we could up to help with this:

Domain authentication
reverse DNS
SPF and DKIM

The Sendgrid Technical Support says this:
"All of the technical aspects of your account setup are indeed working as expected."
Sendgrid tells us that they do not have any records of what happens to a message after handing it off to the recipient server and once they get that accepted message from that server, their job in the mail pipeline is complete.
Furthermore, Sengrid says:
"...there is nothing more that we can do about this issue. Everything in your account is setup correctly from a technical standpoint. You need to reach out to your recipients and ask them to check their entire inbox. Especially when it comes to Gmail as they have default filters set in place that will filter emails into different views. Did you ask this customer if they checked their spam box or any of the default filters that are setup in Gmail such as the promotions tab? It is very likely that the message ended up in somewhere in one of those filters."
"...I also wanted to suggest possibly moving back to the essentials plans. The only reason I wanted to bring this up is the reason you are seeing these messages landing in Spam might be because your daily sending volume might not be high enough to support a consistent sending reputation. And recipient servers can be very strict if they receive mail from an IP address that they don't have a lot of metrics on."
I am certain that moving back to a shared IP will not fix this because we were on this plan with them before we got our own IP address from them and were experiencing these same problems. (full disclosure - our sending volume is low = maybe 40 Emails/day including the order confirmation Emails)
We never ever sent any spam and this is really frustrating for us because we really loose orders because of the Email deliverability issue. Are there any solutions or even services (companies) you can recommend to deal with this problem?


texts: How to get current category subcategory id in magento 2?

texts:
Actually, I want to get a current category, subcategory name, and URL.

Below code is not useful...

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

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

I found this code and it is working fine for some products but for some products it's not working...

<?php

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');
    $catName = $category->getName(); // to get the category name
    $catUrl = $category->getUrl(); // to get the category Url


texts: How to add Newsletter optin to a checkout step in the shippingAddress block

texts:
I wish to add an optional newsletter during the checkout process in Magento 2( at the time of encoding the delivery address)

I think we need to update checkout_index_index.xml by overriding in the theme

but my knowledge ends there. Would someone kindly please explain to me how?


texts: How do I make this custom expression column I have developed for the customer grid display sortable?

texts:
I'm trying to add an expression column to collection in customer grid. But it not sortable. I'm not sure that using addExpressionAttributeToSelect or addExpressionFieldToSelect function can solve this problem. I don't know how to use them in my case.

As now,my code looks like as follows: (or view my old question here)

protected function _prepareCollection()
  {
    $collection = Mage::getResourceModel('customer/customer_collection')
      ->addNameToSelect()
      ->addAttributeToSelect('email')
      ->addAttributeToSelect('created_at')
      ->addAttributeToSelect('group_id');
    $collection->addSalesInfoPerCustomer();
    $this->setCollection($collection);
    return parent::_prepareCollection();
  }

My joined function:

public function addSalesInfoPerCustomer() {
    $this->getSelect()
      ->joinLeft(
        array('s' => new Zend_Db_Expr('(SELECT sum(o.base_grand_total) total_sales, COUNT(*) as order_count, customer_id'
          . ' FROM ' . Mage::getSingleton('core/resource')->getTableName('sales/order') . ' AS o'
          . ' GROUP BY customer_id)')),
        "s.customer_id = e.entity_id",
        array('total_sales', 'order_count')
      );
  }

Added Column:

$this->addColumn('order_count', array(
      'header' => Mage::helper('customer')->__('Total Orders'),
      'index' => 'order_count',
      'filter_index' => 'pages_with_number_of_views.order_count',
      'filter_condition_callback' => array($this, '_roleFilter'),
    ));

    $this->addColumn('total_sales', array(
      'header' => Mage::helper('sales')->__('Total Sales'),
      'index' => 'total_sales',
      'type' => 'price',
      'currency_code' => Mage::app()->getStore()->getBaseCurrency()->getCode(),
      'filter_condition_callback' => array($this, '_roleFilterTotalSales'),
    ));


texts:
Making use of the addImageToMediaGallery method against a Product, I am attempting to upload an image from our application to Magento.

The image is successfully being created on the server but the image is not being linked to the product using the PHP:

<?php

include_once '../../app/Mage.php';

try {

  Mage::app();

  $product = Mage::getModel('catalog/product')->load($_POST["product_id"]);
  $product->setStoreId($_POST["store_id"]);
  $bytes = base64_decode($_POST["image_bytes"]);

  $importDir = "Upload/" . $_POST["label"];
  $output = fopen($importDir, wb);
  fwrite($output, $bytes);
  fclose($output);

  if (file_exists($importDir) ) {

    $media = array();

    if ($_POST["is_thumbnail"] == "1") {
      array_push($media, 'thumbnail');
    }

    if ($_POST["is_small"] == "1") {
      array_push($media, 'small_image');
    }

    if ($_POST["is_base"] == "1") {
      array_push($media, 'image');
    }

    foreach ($media as $imageType) {
      if (file_exists($importDir)) {
        $product->addImageToMediaGallery($importDir, $imageType, false);
      }
    }

  } else {
    echo "Uploaded image not found at $importDir";
  }

  echo "true";

} catch(Exception $e) {
  Mage::logException($e);
  echo 'Message: ' .$e->getMessage();
}
?>

Any help would be appriecated


texts:
I have my basic product listing, which redirects to the product view page like this: <a href="<?php echo $_product->getProductUrl() ?>"> Now I want to add my own variable to the url but I have no idea how to achieve that.

I've tried just simply adding ?value=value but it returns errors


texts: Is there any events that are `specific layout handle based` or `specific controller based`?

texts:
So I have a situation where I really need to observe an event which is layout handle specific. In my case, I want to set a root template for the handle catalog_category_default. I think I can use controller_action_layout_load_before for this purpose. But as its name indicates it may call every time a controller tries to load a layout(I am not sure about this point). Since there are lot of controllers out there (We all know Magento is a giant system !!), I feel this event is inappropriate in my case. It is enough if I can listen to a catalog controller based layout loading event, so that unwanted observations can be avoided ? So my question is

Can we have particular layout handle based or a particular controller based  events ?
If I listen to controller_action_layout_load_before, is that making unwanted observations ? Is it affect magento performance ?


texts: Magento 2.3.5: Remove category page bottom toolbar title and filters and keep only pagination

texts:
I want to remove the title, filter and sort from the bottom toolbar on the category page and leave only the pager (pagination).
My toolbar phtml is located at
vendor/vendor_child/Magento_Catalog/templates/product/list/toolbar.phtml
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list toolbar
 *
 * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar
 */
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>

<?php
$list_count = $this->helper('Ecomwares\Wokiee\Helper\Data')->getSystemValue('wokiee_settings/product_listing/list_count');
?>

<?php if ($block->getCollection()->getSize()): ?>
    <div class="toolbar toolbar-products" data-mage-init='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'>

            <?php if ($this->helper('Ecomwares\Wokiee\Helper\Data')->checkPage() == 'catalog_category_view'): ?>

                <?= $block->getLayout()->getBlock('page.main.title')->getPageTitle(); ?>
                <?php if ($list_count): ?>
                    (<?= $block->getTotalNum(); ?>)
                <?php endif; ?>

            <?php endif; ?>
            <?php echo $block->getChildHtml('category.description'); ?>

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

                <?php if ($block->isExpanded()): ?>
                    <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter_custom.phtml')) ?>
                <?php endif; ?>
                <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter_custom.phtml')) ?>

            <?php if ($block->isExpanded()): ?>
                <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode_custom.phtml')) ?>
            <?php endif; ?>

        <?= $block->getPagerHtml() ?>

<?php endif ?>

and the category list.phtml file is located at
vendor/vendor_child/Magento_Catalog/templates/product/list.phtml
and the toolbar.phtml gets called for the top toolbar as such

    <?= $block->getToolbarHtml() ?>

and for the bottom toolbar as such

    <?= $block->getToolbarHtml() ?>

I want just the pager to show on the botttom toolbar so I changed it to

    <?= $block->getPagerHtml() ?>

However it doesn't work. Any idea what I'm doing wrong.


texts: Magento2, Checking if custom image attribute exist does not work

texts:
I'm using below code to print custom image in product page. But the condition does not work. However, if I remove the condition I get the image.

<?php
$_product = $block->getProduct();
$imageUrl = $block->getUrl('pub/media/catalog').'product'.$_product->getDesignerimage();
if (file_exists($imageUrl)):
echo "

";
endif;
?>


texts: Magento2 extension for auto renew of software license or any module/extension license

texts:
I need help with finding a magento2 extension for auto renews of the software license or any module/extension license.

I need the create product which is actually extension with a license which needs to be auto renew after a limited period of time or else that extension stops it working.

In auto renew needs functionality of auto payment.


texts: Does Magento have a logic for levels of being "logged in"?

texts:
I am new to magento but have programmed for years.  Does Magento have a concept of "presumed identity based on cookies and/or computer, but not logged in"?  Or perhaps a concept of "login remembered but, not authorized to change account or billing information unless they 'really' log in"?

Additionally, does Magento have a system to identify "logged in but not email-verified yet", and is this a separate condition from the above, or are they lumped in as on single series of values?  Thanks.


texts:
I've added a custom attribute for all the categories. It's currently positioned as the first element in the list when you configure a category. How would I go about about changing it's position in the list? I've tried using the position key in the setup script, but alas no luck. It does get saved in the database, other than that it has no (visual) effect.

setup script:

<?php
/** @var Mage_Catalog_Model_Resource_Setup $installer */
$installer = $this;
$installer->startSetup();

$installer->addAttribute('catalog_category', 'custom_menu', array(
    'type'     => 'int',
    'input'    => 'select',
    'source'   => 'eav/entity_attribute_source_boolean',
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'required' => false,
    'label'    => 'Is Custom',
    'default'  => 0,
    'group' => 'Menu',
    'position' => 100
));

$installer->endSetup();


texts:
By default Magento 2.3 dashboard have revenue, tax, shipping and quantity data under the chart.

I found that /vendor/magento/module-backend/Block/Dashboard/Totals.php have rows

    $this->addTotal(__('Revenue'), $totals->getRevenue());
    $this->addTotal(__('Tax'), $totals->getTax());
    $this->addTotal(__('Shipping'), $totals->getShipping());
    $this->addTotal(__('Quantity'), $totals->getQuantity() * 1, true);

How can I add "Grand Total (Base)" data to Dashboard?

I tried add $this->addTotal(__('Grand Total'), $totals->getGrandTotal()); but no any result

Can anyone please help me?


texts: Magento 2 : How can I stop SQL attack through search bar

texts: It's a bot that is continuously attacking, I try to hide these special characters suggestion form dashboard also try to delete them but all in vain, it comes again the next day(Magneto 2.3.1).


texts: Javascript Object : How to Remove Square Brackets

texts:
I have this Js Obect, I need to trim/remove one set of square braces "the outermost ones [  ]" from the object . Below is the structure:

[[{"id":"5","color":"red",nges":[{"monthindex":3},{"monthindex":3"}]},{"id":"5","color":"red""nges":[{"monthindex":3"},{"monthindex":3"}]}]]

How can this be done , I did via PHP before sending it to JS but that didn,t help.


texts: Magento2 Error when serach using 2 variables

texts:
I am getting following error

Exception #0 (Magento\Framework\Exception\LocalizedException): Sorry, something went wrong. You can find out more in the error log.

Exception #0 (Magento\Framework\Exception\LocalizedException): Sorry, something went wrong. You can find out more in the error log.
<pre>#1 Magento\Framework\Data\Collection\AbstractDb->_renderFilters() called at [app/code/Mageplaza/LayeredNavigation/Model/ResourceModel/Fulltext/Collection.php:415]
#2 Mageplaza\LayeredNavigation\Model\ResourceModel\Fulltext\Collection->_renderFilters() called at [vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php:1167

This happens when search keywords are less then 3 as 3 is defined in admin, above this everything is fine


texts: i am struggling to find the information i want regarding the location and method by which magento2 child themes inherit the custom css stylesheet. From my limited understanding of inheritance in magento2 i believe the child theme's custom.css location should mirror that of the parents theme. But will this replace the parent theme css or simply add the child theme's css at a higher priority?


texts: How to pass variable to external js in magento 2

texts:
In magento 1

we can call this prototype function in phtml for example

function ABC(){
     var a = '<?php echo $a;?>'
    alert(a);
 }

but in magento 2 we can not add this type of function in phtml,for that we have to create requirejs-config.js

var config = {
map: {
    '*': {
        'exam': 'js/example',
    }
}
};

like this and example.js

 function ABC(){

    alert(a);
 }

in phtml

require(['jquery','exam'], function($){
    var a= <?php echo $a; ?>;
});

I am trying to pass variable like this but its not working,how to pass variable from phtml to external js in magento 2


texts: How to get value from Ui-select in js magento2 at page load

texts:
I have created field in phtml and want to get values from multi-select dropdown inside js.
Inside phtml
 <form id="attr-form" action="<?php echo $block->getUrl('*/*/save') ?>" enctype="multipart/form-data" method="post"  data-mage-init='{"validation":{}}'>

    <fieldset class="fieldset">

                <?php echo __('Label') ?>:


texts:
How do i get my outside link (href as well getTrackNumber()) to work? Below is a small template for my shipment update email:

{{block type="core/template" template="email/header.phtml"}}

Dear {{htmlescape var=$order.getCustomerName()}},

    Your order # {{var order.increment_id}} has been shipped and now has a status of {{var order.getStatusLabel()}}.

You can check the status of your order by

        <a href="https://mystore.narvar.com/mystore/tracking/fedex?tracking_numbers=<?php echo $this->escapeHtml($_track->getTrackNumber()) ?>">logging into your account.

{{var comment}}

{{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

    If you have any questions, please feel free to contact us at
    {{config path='trans_email/ident_support/email'}}
    or by phone at {{config path='general/store_information/phone'}}.

{{block type="core/template" template="email/footer.phtml"}}

Instead of having them "logging into your account" I want them to go straight to that URL.


texts: How to show product availble quantity status for configurable products Magento 2?

texts: Available products shows in default simple product in product view page but not showing for configurable products.


texts: Magento2.3.1: How to Enable Flat Rate Shipping method on delivery not available products

texts:
I have installed Check delivery available extension in my website.

Here the options are as follows:

Delivery available
Delivery Not Available.

For Available delivery, We added dummy pin codes. If any user checked delivery with non added pin codes, They will get display a message as Delivery not available.

I have enabled the flat rate option at shipping methods. And want to show for this non delivered products only.

Here, If any product is having the status Delivery Not Available, The shipping method should be Flat rate only.

How to do that?


texts: How does Magento 2 Search work with '-'?

texts:
I have 4 products in catalog with names:

aaa

bbb

aaa-bbb

aaa_bbb

When I try to search "aaa", I get aaa, aaa-bbb and aaa_bbb products as a result (screen 1)

When my query is "bbb", I get only bbb and aaa-bbb (screen 2)

"aaa-bbb" query gives me all my products (screen 3)

And finally query "aaa_bbb" returns me only one product (screen 4)

So, can you please explain me how it works and how I can change this logic?
Specifically, I need to get only aaa-bbb product, when I search "aaa-bbb".

Did I understand correctly, Magento search engine explode my query by '-' symbol? I didn't found the confirmation of this in code, but as I see by search results it's looks like true.

Thank you for attention :)


texts: Paypal payment shows an error: PaymentAction of Authorization is not allowed with Unilateral and Non-Credentialed authentication (#10481)

texts:
I tried to use paypal express checkout on my Magento 2 (2.3) site. I tried to use sandbox. On the checkout page, I select the paypal express checkout option. I can see the paypal login form popup and can login successfully. But after I click 'Pay' button and the popup is closed then I saw a flash error message on my M2 site.

PayPal gateway has rejected request. PaymentAction of Authorization is not allowed with Unilateral and Non-Credentialed authentication (#10481: Transaction refused because of an invalid argument. See additional error messages for details).

I inspected the log file in var/log/payment.log. I see the debug message but I have no idea what is wrong. Here is the debug message:

[2020-02-01 04:40:06] main.DEBUG: array (
  'url' => 'https://api-3t.sandbox.paypal.com/nvp',
  'DoExpressCheckoutPayment' =>
  array (
    'TOKEN' => 'EC-5TP478471D8088941',
    'PAYERID' => '5YLR7L3UWZK6Y',
    'PAYMENTACTION' => 'Authorization',
    'AMT' => '499.00',
    'CURRENCYCODE' => 'AUD',
    'BUTTONSOURCE' => 'Magento_Cart_Community',
    'NOTIFYURL' => 'https://xxx.com.au/paypal/ipn/',
    'RETURNFMFDETAILS' => 1,
    'SHIPPINGAMT' => '0.00',
    'ITEMAMT' => '499.00',
    'TAXAMT' => '0.00',
    'L_NUMBER0' => NULL,
    'L_NAME0' => '(CLEARANCE) Shoei J.O Hawker TC-1 Helmet - Red/Black',
    'L_QTY0' => 1,
    'L_AMT0' => '499.00',
    'BUSINESS' => NULL,
    'EMAIL' => 'xxx@yahoo.com',
    'FIRSTNAME' => 'First',
    'LASTNAME' => 'Last',
    'MIDDLENAME' => NULL,
    'SALUTATION' => NULL,
    'SUFFIX' => NULL,
    'COUNTRYCODE' => 'AU',
    'STATE' => 'NSW',
    'CITY' => 'Melbourne',
    'STREET' => 'Second Ave.',
    'ZIP' => '3000',
    'PHONENUM' => '0489 849 999',
    'SHIPTOCOUNTRYCODE' => 'AU',
    'SHIPTOSTATE' => 'NSW',
    'SHIPTOCITY' => 'Melbourne',
    'SHIPTOSTREET' => 'Second Ave.',
    'SHIPTOZIP' => '3000',
    'SHIPTOPHONENUM' => '0489 849 999',
    'SHIPTOSTREET2' => '',
    'STREET2' => '',
    'SHIPTONAME' => 'First Last',
    'ADDROVERRIDE' => 1,
    'METHOD' => 'DoExpressCheckoutPayment',
    'VERSION' => '72.0',
    'USER' => '****',
    'PWD' => '****',
    'SIGNATURE' => '****',
  ),
  'response' =>
  array (
    'TOKEN' => 'EC-5TP478471D8088941',
    'SUCCESSPAGEREDIRECTREQUESTED' => 'false',
    'TIMESTAMP' => '2020-02-01T04:40:05Z',
    'CORRELATIONID' => '577d54e9fc5fa',
    'ACK' => 'Failure',
    'VERSION' => '72.0',
    'BUILD' => '54085969',
    'L_ERRORCODE0' => '10481',
    'L_SHORTMESSAGE0' => 'Transaction refused because of an invalid argument. See additional error messages for details.',
    'L_LONGMESSAGE0' => 'PaymentAction of Authorization is not allowed with Unilateral and Non-Credentialed authentication.',
    'L_SEVERITYCODE0' => 'Error',
  ),
)

I'd really appreciate if anybody can help. Thanks


texts: Create Column in Quote Payment Table in magento2

texts:
i want to add new column in Quote payment table i tried script but not working

<?php
namespace Ibnab\Additional\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
class InstallSchema implements InstallSchemaInterface
{
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        $setup->getConnection()->addColumn(
            $setup->getTable('quote_payment'),
            'bankowner',
            [
                'type' => 'text',
                'nullable' => true  ,
                'comment' => 'Bank',
            ]
        );
        $setup->getConnection()->addColumn(
            $setup->getTable('sales_order_payment'),
            'bankowner',
            [
                'type' => 'text',
                'nullable' => true  ,
                'comment' => 'Bank',
            ]
        );
        $setup->endSetup();
  }
}


texts:
I tried to remove .html from my categories from admin panel and it works. now I have example.com/test , but example.com/test.html is 404 now. how can I redirect all .html urls to non html one?
should I do it from nginx? how?


texts: How I can find controller at the start page, if my url is without some path. Just example.loc?


texts: SQL query to obtain all products info from a specific category

texts:
I have on the tree of categories one category named Trademarks and within this one, a category named Pharmatron (and many other). I am trying to get all products from this category (Pharmatron). The category Trademarks is just another way of providing access to the products in the frontend menu, in case the visitor just wants to check products from a specific brand.

The ID of Trademarks is 7 and the ID of Pharmatron is 411.

I am kind of guessing, but not quite coming clear..
select *

FROM cp8_catalog_product_entity_varchar as cepvar
LEFT JOIN cp8_catalog_category_entity_varchar as ccevar
ON cepvar.entity_id = ccevar.entity_id
LEFT JOIN eav_attribute AS ea
ON cepvar.entity_type_id = ea.entity_type_id
AND ea.backend_type = 'varchar'
AND cepvar.value = 'Pharmatron'

I am getting zero rows with that query. However, if I remove the WHERE clause I get basically a whole list of any product.

I have learned a bit about the EAV system and I understand why it has to have those JOINS, yet not grasped fully the interrelation between categories and products tables so as to solve the query.


texts: Notice: Undefined index: default in vendor/magento/module-catalog/......BatchSizeCalculator.php

texts:
I got this error when try to reindex catalog_product_price

php bin/magento indexer:reindex catalog_product_price

  Notice: Undefined index: default in
  /public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Indexer/Price/BatchSizeCalculator.php
  on line 55

and from system.log

  2019-11-27 20:03:04] main.ERROR: Cron Job indexer_reindex_all_invalid
  has an error: Notice: Undefined property:
  Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator::$_batchRowsCount
  in
  /public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Indexer/Price/BatchSizeCalculator.php
  on line 55. Statistics:
  {"sum":0,"count":1,"realmem":0,"emalloc":0,"realmem_start":138412032,"emalloc_start":134564184}
  [] []

BatchSizeCalculator.php as below ( unmodified)

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

namespace Magento\Catalog\Model\ResourceModel\Product\Indexer\Price;

/**
 * Ensure that size of index MEMORY table is enough for configured rows count in batch.
 */
class BatchSizeCalculator
{
    /**
     * @var array
     */
    private $batchRowsCount;

    /**
     * @var \Magento\Framework\Indexer\BatchSizeManagementInterface[]
     */
    private $estimators;

    /**
     * @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\CompositeProductBatchSizeAdjusterInterface[]
     */
    private $batchSizeAdjusters;

    /**
     * BatchSizeCalculator constructor.
     * @param array $batchRowsCount
     * @param array $estimators
     * @param array $batchSizeAdjusters
     */
    public function __construct(array $batchRowsCount, array $estimators, array $batchSizeAdjusters)
    {
        $this->batchRowsCount = $batchRowsCount;
        $this->estimators = $estimators;
        $this->batchSizeAdjusters = $batchSizeAdjusters;
    }

    /**
     * Retrieve batch size for the given indexer.
     *
     * Ensure that the database will be able to handle provided batch size correctly.
     *
     * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
     * @param string $indexerTypeId
     * @return int
     */
    public function estimateBatchSize(\Magento\Framework\DB\Adapter\AdapterInterface $connection, $indexerTypeId)
    {
        $batchRowsCount = isset($this->batchRowsCount[$indexerTypeId])
            ? $this->batchRowsCount[$indexerTypeId]
            : $this->batchRowsCount['default'];

        /** @var \Magento\Framework\Indexer\BatchSizeManagementInterface $calculator */
        $calculator = isset($this->estimators[$indexerTypeId])
            ? $this->estimators[$indexerTypeId]
            : $this->estimators['default'];

        $batchRowsCount = isset($this->batchSizeAdjusters[$indexerTypeId])
            ? $this->batchSizeAdjusters[$indexerTypeId]->adjust($batchRowsCount)
            : $batchRowsCount;

        $calculator->ensureBatchSize($connection, $batchRowsCount);

        return $batchRowsCount;
    }
}

tried running following doesn't work

bin/magento setup:upgrade

bin/magento setup:di:compile

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

bin/magento indexer:reindex

bin/magento cache:clean

bin/magento cache:flush

I also tried add the following to

  app/etc/di.xml

but doesn't work

<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator">
    <arguments>
        <argument name="batchRowsCount" xsi:type="array">
            <item name="default" xsi:type="number">1000</item>
        </argument>
    </arguments>
</type>


texts:
i have one configurable product and it doesn't show in frontend.
The reason is, there is a quantity of 0 in products overview in backend. But i can't change it in inventory.
In inventory, i choose Manage Stock = yes. But no configuration for quantity is showing.
What can I do?


texts: move all products from one category to an attribute

texts:
we have category called "shoes",
we gave discount for that category using promotions > catalog price rules

we have some 500 products in the category and now we are planning to delete the category and create an attribute and give discount for that attribute value.

using category using promotions > catalog price rules....

now we have to move all the products in that category to that attribute.

below @Marius  gave solution, but i am missing somewhere

please help me to find my mistake....


texts: Is it possible to configure one event Observer for all Magento events?

texts:
Is it possible (whether practical or not) to cut some configuration down by registering an observer to all Magento Events.

The purpose for this would be to build an Observer that works as a "service locator" plugin for a custom module.

I would want to do something like, but for all events:

 ...
 <events>
   <event_name>
     <observers>
       <mymodule_integration>
         <class>mymodule_integration/observer</class>
         <method>service_locator</method>
       </mymodule_integration>
      </observers>
    </event_name>
 </events>
 ...

And in the Observer:

 class My_Model_Observer
 {

    public function locateService(Varien_Event_Observer $observer)
    {
       $event = $observer->getEvent()->getName();

       // map (string) $event to (string) $model
       // .....

       if ($model && $event) {
           Mage::getModel(mymodule/$model)->$event;
       }

       return true;
     }

Any ideas?


texts: Magento 2.2.5: How to remove links on my account navigation by php code?

texts:
What's up guys, I'm looking for how to remove links on "My Account" page in magento 2 with PHP code.

So i've searched a lot and only saw this layout xml solution:
How to add/remove links on my account navigation magento2?
But what i want is do it by PHP code, because i have some special condition, for example, when customer is in wholesale group, then the "My order" is hiding.

The check customer part is an easy part and i've done it, but not with the "hiding my order" part

Any idea? Please help, thanks :)


texts: Magento 2 How to Store Contact us form in Database

texts: In Magento 2, User Enter Details in Magento Contact form and it should be stored in Database is it possible?


texts: Separate Checkout Flow in Magento bypassing Cart/Quote

texts:
I have been researching this for a while, did not find anything related to this anywhere.

Situation:

  Our client sells Groceries on his Magento store. We have implemented
  Store Credit feature using Magestore's Store Credit extension. We call
  this feature as Wallet. Customers would be able to add
  credits to the Wallet by purchasing them. This feature is inbuilt in
  the extension. In the extension, purchasing Wallet credits is
  like purchasing any other product. You have to go to the product page,
  add desired credits amount, add the "Store Credits" product to the
  cart and checkout.

Problem:

  We want to have a different checkout flow for purchasing store
  credits. We want to bypass the entire concept of cart/quote. When customer
  enters desired "Store Credit" amount and clicks "Buy", he should be
  taken directly to the checkout page or the payment page (whichever is
  easier). The concept of cart or quote should not be used.

  For
  example, let's say a customer adds some normal products to the cart.
  Then he tries to add some credits to his Wallet (Store Credit). When
  he clicks pay, he should be taken to the checkout/payment page, where
  he pays only for Store Credits amount. After payment he would be redirected back to Store Credits page.The products he added to the
  cart remains intact.

Is this possible in Magento? If yes, how complex would it be? Has anyone done this? Is there any extension?


texts: simulating adminhtml login redirect for a bootstrap file

texts:
I know that the following code detects login for a user:

if(!Mage::getSingleton('customer/session')->isLoggedIn()){
    //not logged in
}else{
    // logged in
}

However, what is the corresponding code to determine if a user is logged in as admin?

Also, what class and method would you use to redirect to admin login, along with a post-login redirect back to a specified page?

I'm thinking you just access a different model, however I don't know which one that is.


texts: How can I override admin create order controller?

texts:
I am trying to override adminhtml_sales_order_create controller. I have created a small module app/code/local/Akina/Sales/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Akina_Sales>
            <version>0.1</version>
        </Akina_Sales>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <sales before="Mage_Adminhtml">Akina_Sales_Adminhtml</sales>
                    </modules>
               </args>
            </adminhtml>
        </routers>
    </admin>
</config>

and created controller file as

app/code/local/Akina/Sales/controllers/Adminhtml/Sales/order/CreateorderController.php

<?php
require_once 'Mage/Adminhtml/controllers/Sales/Order/CreateController.php';
class Akina_Sales_Adminhtml_sales_Order_CreateorderController extends Mage_Adminhtml_Sales_Order_CreateController
{
    public function saveAction()
    {
        echo "test";die;
    }
}

My module declaration file

<?xml version="1.0"?>
<config>
    <modules>
        <Akina_Sales>
            <active>true</active>
            <codePool>local</codePool>
        </Akina_Sales>
    </modules>
</config>

I am unable to override this controller, where did I go wrong?


texts: Sql to delete category and its descendants

texts:
I am working with a Magento 2 store with a very large category tree (over 10000 categories). I used CategoryRepository and deleted one by one but this is very time-consuming since delete a brand with 2000 descendants take about 30 minutes.

Is there any SQL to delete a category and its descendants and related data from all tables? If so is using SQL faster than using PHP code?

Edit: I don't want to delete all categories, just delete a branch of category tree.


texts: Homepage block doesn't hold to column count

texts:
I copied my list.phtml template to make a featured items block on my homepage. However all items in the category are displayed and not the column count that I set in my placement.

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list-homepage.phtml" column_count="4" category_id="59"}}

Am I missing something?


texts: Swatch on listing page but image on Product Page

texts: First time posting here. Magento 2.4.0 I am trying to show color swatches on the product listing page but an image of the configurable products on the product page. By selecting use product image as swatch if possible I can see product images on both the product page and listing page but I don't want the product images on the listing page I just want color swatches as product images looks really messy on the listing. How can I achieve this?


texts: Add existing custom option to cart item if the option was not included initially

texts:
I can update existing cart values:

$item = $quote->getItemById($itemId);
$item->getOptionByCode('option_code')->setValue($value);
$item->saveItemOptions();

But this only works if the option already exists, e.g. an unchecked checkmark custom option will not be included in the item options when adding the product to cart. I tried adding the options with $item->addOption() but that doesn't work because the option is not included in the $item->getProduct()->getCustomOptions(), and trying to add the custom option there also modifies the actual product instead of just the cart item product.

Is there a way to add an existing custom option to an existing cart item without removing and re-adding the item?


texts: How can I show a product that is out of stock in a configured product

texts:
When a product is out of stock (and this is set up), it disappears from the configured product and its drop-down menu.

How can I make it continue to be shown there (as an option of the general product) and when someone selects it then the out-of-stock label to be shown.


texts: Magento 1.9 Show No Payment Methods But i enable Payflow Link

texts:
I set Enable Payflow Link in Payment Method on my website. but when i go to checkout on Payment Method it show "No Payment Methods"
I don't know why this issue is happen?


texts: Add Custom link in customer account navigation in Magento 2

texts:
How to add custom link in customer account navigation?

I am looking for code to show form upon clicking custom link on left navigation.

Can we submit form using custom link?


texts: How to extend sidebar.js to perform action on Qty change in Minicart Magento 2

texts:
I added a text field Box in minicart that need to perform some calculation on keyup to update Qty.

I Added box field by modifying

  module-checkout/view/frontend/web/template/minicart/item/default.html

Now I want to extend sidebar.js, To perform action on Knockout.js so that I update the Qty on keyup

  module-checkout/view/frontend/web/js/sidebar.js

I am not sure how to do this.

I created a module and extended the sidebar.js in requirejs-config.js, its not working.

var config = {
    map: {
        '*': {
            'Magento_Checkout/js/sidebar': 'new_ConfigProductDynamicName/js/sidebar',
        }
    }
};

I can see keyup of Qty to display update button in sidebar.js, I am not sure what will come at this.options.item.qty I am trying to do console.

 events['keyup ' + this.options.item.qty] = function (event) {
                console.log(this.options.item.qty);
                self._showItemButton($(event.target));
            };

How can I create a keyup function for the text field Box I created and perform action to update the Qty of that particular product in Mincart


texts: Magento2: I want to apply tax on specific products, not entire products

texts:
I am using Magento ver. 2.3.2 and I have configured the tax rules and tax rate in admin. Tax applied successfully on the products on cart page.
But now I want to apply tax on some specific products, not entire available products.
Can anyone help me in this, How can we do this?


texts:
I have created an attribute "bestsellers" integer, and I have assigned values to that attribute in many products, only numbers.

I have enable the attribute to sort by in the front end, but, when I try to sort by bestsellers, they are not correctly ordered by bestsellers attribute, some products with value = 0 are showing between the first.

Should I do something else?, somethink like reindex?, or is cache issue.?

I've print the sql and test it on my mysql and the order is correct, but in the front end doesn't.


texts: Create SQL Query to change SKU's from one attribute set

texts:
Need an SQL query that I can write in PHPmyAdmin to remove all spaces in SKU for all products that have attribute set seeds (which has id 10).

For example

AAA 2345 EE

needs to be

AAA2345EE


texts: How can I get email notifications for exceptions?

texts:
How do I setup email notifications for exceptions that are either logged or thrown on the site?

UPDATE: A few people have commented on the fact that you may expect to get way too many emails if you have every exception emailed to you.  I tend to like to keep my exception log pretty light.  Anything that goes in there I view as, well, an exception.  If it's expected functionality and not a problem, then I like to catch the exception, possibly log it to another file (maybe system.log) if needed, but not log it to exception.log.

But if you have a lot of noise in your exception.log that you don't want to clean, you're likely not going to want to do this.


texts: Making a subcategory slider at top of categorie page

texts:
I want to make a subcategoy slider on the top of a category page. I have it almost, but the arrows of previous and next are under the subcategory images. I want to have it on the side of the images, beside them. Please check  https://www.uitverkoopgigant.nl/wonen-slapen/tafelen/glazen.html. I have made an test slider. Here you can see the arrows at the bottom of the subcategory images.
Here is the code that I made:

Top Categorie

Theeglazen

Koffieglazen

Theeglazen

Koffieglazen

Theeglazen

Koffieglazen

Theeglazen

Koffieglazen


texts: Not update the shipping total and Order Total after change the shipping methods

texts:
Steps to reproduce
go to cart xxx.com/checkout/cart/
change the shipping methods

not update the shipping total and Order Total after change the shipping methods

i am usging 2.2.3


texts: Magento2 Multistore - direrent products in each Store

texts:
I have one website "My Brand" only one centralized URL domain for my customers, multiple stores for (USA, Europe, and Latin America) and three views for each stores (Spanish, English, Portuguese)

I have 50 SKUs that i want to have all of the in my centralized product catalog in my Brand Web Site.

How to do to show some products in the USA Store, some others in Europe Store and some others in the Latin America stores. Is there any way to assign products to each store... like SKU A active in Store 1 and 2, and SKU B active in Store 3 only etc...?

I know you can manage diferent prices for the same SKU in each store, but i dont know if you would need an extension to be able to show specific SKUs in each store.

Thanks

JLM


texts: What is the suggested value of max_execution_time and memory_limit for 20,000 products site for Bulk export

texts: I am not able to export bulk products because time expiration. What is the suggested value to export over 20,000 products?


texts:
I am trying to create 18 configurable products on our site.

I have created all the simple products (2688 of them), imported via csv. The simple products are common to all 18 configurable products.

I have created 7 products using Magento Admin area, and they are working correctly, and displaying correctly on the category page.

When I create product 8, and make status enabled, and assign to category, the category page becomes a blank white page.

This happens with all configurable products created after product 7.

I have

cleared cache
refreshed indexes
deleted configurable product and recreated (same problem)

Any ideas on what this could be?

I am on Magento 1.8.1.0

Cheers
Danielle


texts:
How can show the newest product up to 3 items only?

This is my new.phtml,

<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>

<?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_products->getItems() as $_product): ?>
        <?php if ($i++%$_columnCount==0): ?>

        <?php endif ?>
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?> col-lg-4" style="border:1px solid black;">
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_product->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image') ?>" width="355" height="auto" alt="<?php echo $this->escapeHtml($_product->getName()) ?>" class="img-responsive"/>

        <?php if ($i%$_columnCount==0 || $i==count($_products)): ?>

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

It shows as many items as in my product collection. Can I get 3 items only?


texts:
Update

Everything is working now but There are no commands defined in the "cache" namespace is still there. I tried chmod 777 -R var/generation, didn't fix a thing. AFAIK no module is enabled

   public_html]# bin/magento module:status
List of enabled modules:
Nosto_Tagging

List of disabled modules:
Magento_Store
Magento_AdvancedPricingImportExport
Magento_Directory
Magento_Theme
Magento_Backend
Magento_Backup
Magento_Eav
Magento_Customer
Magento_BundleImportExport
Magento_AdminNotification
Magento_CacheInvalidate
Magento_Indexer
Magento_Cms
Magento_CatalogImportExport
Magento_Catalog
Magento_Rule
Magento_Msrp
Magento_Search
Magento_Bundle
Magento_Quote
Magento_CatalogUrlRewrite
Magento_Widget
Magento_SalesSequence
Magento_CheckoutAgreements
Magento_Payment
Magento_Downloadable
Magento_CmsUrlRewrite
Magento_Config
Magento_ConfigurableImportExport
Magento_CatalogInventory
Magento_SampleData
Magento_Contact
Magento_Cookie
Magento_Cron
Magento_CurrencySymbol
Magento_CatalogSearch
Magento_CustomerImportExport
Magento_CustomerSampleData
Magento_Deploy
Magento_Developer
Magento_Dhl
Magento_Authorization
Magento_User
Magento_ImportExport
Magento_Sales
Magento_CatalogRule
Magento_Email
Magento_EncryptionKey
Magento_Fedex
Magento_GiftMessage
Magento_Checkout
Magento_GoogleAnalytics
Magento_GoogleOptimizer
Magento_GroupedImportExport
Magento_GroupedProduct
Magento_Tax
Magento_DownloadableImportExport
Magento_Braintree
Magento_Integration
Magento_LayeredNavigation
Magento_Marketplace
Magento_MediaStorage
Magento_ConfigurableProduct
Magento_MsrpSampleData
Magento_Multishipping
Magento_NewRelicReporting
Magento_Newsletter
Magento_OfflinePayments
Magento_SalesRule
Magento_OfflineShipping
Magento_PageCache
Magento_Captcha
Magento_Paypal
Magento_Persistent
Magento_ProductAlert
Magento_Weee
Magento_ProductVideo
Magento_CatalogSampleData
Magento_Reports
Magento_RequireJs
Magento_Review
Magento_BundleSampleData
Magento_Rss
Magento_DownloadableSampleData
Magento_Authorizenet
Magento_OfflineShippingSampleData
Magento_ConfigurableSampleData
Magento_SalesSampleData
Magento_ProductLinksSampleData
Magento_ThemeSampleData
Magento_ReviewSampleData
Magento_SendFriend
Magento_Ui
Magento_Sitemap
Magento_CatalogRuleConfigurable
Magento_Swagger
Magento_Swatches
Magento_SwatchesSampleData
Magento_GroupedProductSampleData
Magento_TaxImportExport
Magento_TaxSampleData
Magento_GoogleAdwords
Magento_CmsSampleData
Magento_Translation
Magento_Shipping
Magento_Ups
Magento_UrlRewrite
Magento_CatalogRuleSampleData
Magento_Usps
Magento_Variable
Magento_Version
Magento_Webapi
Magento_WebapiSecurity
Magento_SalesRuleSampleData
Magento_CatalogWidget
Magento_WidgetSampleData
Magento_Wishlist
Magento_WishlistSampleData
Sm_BasicProducts
Sm_Categories
Sm_Deals
Sm_ImageSlider
Sm_ListingTabs
Sm_Market
Sm_MegaMenu
Sm_QuickView

The issue was there long before I installed nosto, I initially installed SM quickstart then upgraded it the latest magento version. if I clear the cache from admin area, I see no error. I need to fix it otherwise I'll never be able to install any module or fix this

Update now I disabled nosto.


texts: Magento installation behind load balancer

texts:
I have magento setup behind a load balancer (it is not setup, but all the bits are present). Then I go to my load balancer endpoint and try to install magento. It looks like there are errors because, if the load balancer switches the request between nodes, the installation seems to fail (Specifically local.xml is not present on one of the node during installation, but it is present in other).

Does anyone know what is the correct way to install magento on a load balanced set of servers. All my media assets are in a shared volume - so I think once the installation phase is complete, the website should work.

Thank You


texts:
I'm struggling with the single product URL path.

If I go to horloges-mannen.nl/herenhorloges/casio.html (just an example), I can choose between the recommended and just watches brand itself. When I click on one from the recommended list, it gives this URL: horloges-mannen.nl/a158w.

But when I click by the other watches, it gives this URL: horloges-mannen.nl/herenhorloges/casio/a158w

How can I get them all the same way, like the /category/subcategory/product URL (2nd from those 2 links)?


texts: How to find file path in magento - Sales, Processing Order, Create New Order, Add Product, Add Selected Products to Order

texts:
I am new to Magento. Please can anyone tell me the path of file in Magento's admin panel - Sales, Processing Order, Create New Order, Add Product, Add Selected Products to Order - In that Update Items and Qty's button.

Where the code is written for updating products in admin panel?


texts: how to redirect to cart page by clicking go to check out button

texts: I need to redirect to cart page instead of checkout page as i click go to checkout button in cart drop-down.


texts: Adding an image form element to an add/edit form

texts:
I'm building a CRUD module for Magento 2 using ui components for admin list and form and one of my entities has an image field.
But I cannot make it work as it should.
Here is how it should work.
When in add mode or in edit mode with no uploaded image it should look like a simple file input.

When a file is uploaded it should show the image preview and a delete box below it.

I'm not looking for the exactly this design. It could look differently but have the same functionality.

In Magento 1 I was able to do this, just by creating my own block renderer

class {{Namespace}}_{{Module}}_Block_Adminhtml_{{Entity}}_Helper_Image extends Varien_Data_Form_Element_Image
{
    protected function _getUrl()
    {
        $url = false;
        if ($this->getValue()) {
            $url = Mage::helper('{{namespace}}_{{module}}/{{entity}}_image')->getImageBaseUrl().$this->getValue();
        }
        return $url;
    }
}

And adding this in my form block

    $fieldset->addType(
        'image',
        Mage::getConfig()->getBlockClassName('{{namespace}}_{{module}}/adminhtml_{{entity}}_helper_image')
    );

But I have no form block in Magento 2.
I know I can use a class name for a form field in the ui components file

    <field name="image" class="Class\Name\Here">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">text</item>
                <item name="label" xsi:type="string" translate="true">Resume</item>
                <item name="formElement" xsi:type="string">image</item>
                <item name="source" xsi:type="string">[entity]</item>
                <item name="dataScope" xsi:type="string">image</item>
            </item>
        </argument>
    </field>

Obviously I have to create this class, but what should I extend?
All I know is that I need to implement the interface Magento\Framework\View\Element\UiComponentInterface but I found nothing I can extend.
So my real question is: Can I extend some class to achieve the desired behavior? If not, how can I start creating this element renderer?


texts: bin/magento sampledata:reset tries to read nonexistent composer.json

texts:
I want to update a Magento installation with sample data from 2.0.2 to 2.0.7, so I am following the instructions here to update the sample data.

When running

bin/magento sampledata:reset

I get the following error message:

  [ErrorException]
  file_get_contents(/path/to/magento/src/Vendor/Module/src/composer.json):
  failed to open stream: No   such file or directory

The directory /path/to/magento/src/Vendor/Module/src/ contains the source code of a custom module which is not installed via composer.

The module registration file lies in /path/to/magento/src/Vendor/Module/registration.php with the following content:

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Module',
    __DIR__ . '/src'
);

The module has a composer.json file in /path/to/magento/src/Vendor/Module/composer.json, so if I can tell Magento to use that one it will be fine, but I wonder where the assumption is made that a composer.json is in the module source directory even if it has not been installed with composer.

The sampledata:reset command is the first one where I ran into trouble with this setup. What can I do to make it work?


texts:
During the creation of a layout handle you specify a node <label> which is some text to describe the layout handle. For example the layout handle catalog_category_default has the following defined.

<label>Catalog Category (Non-Anchor)</label>

As part of the layout handle you can specify to translate these labels <catalog_category_default translate="label">. Which makes sense if these labels are shown some place but I am not sure if or where they are shown to a user and so would require translation.


texts: Configurable product doesn't show simple product images

texts:
After updating to Magento 2.2

Configurable product only shows images assigned to its' own gallery but nothing of the simple products associated with it.

Even when I choose a product via swatch the image doesn't change.

Swatch attribute settings are correct, and has worked in previous version of Magento 2.1


texts: Update Magento 2.1.8 to Magento 2.2 is giving

texts:
I tried to following steps to upgrade from 2.1.8 to 2.2.1 as mentioned in linked question:

bin/magento maintenance:enable
composer require magento/product-community-edition 2.2.0 --no-update
composer update
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf var/generation/*
chmod +x bin/magento
bin/magento setup:upgrade
bin/magento maintenance:disable

but received the following error:

The requested package magento/product-community-edition 2.2.1 exists as magento/product-community-edition[2.1.8] but these are rejected by your constraint.

I can't see 2.1.8 anywhere in my composer.json file, but still received this error. Please let me know where should I fix?

Updating my Composer.json file:

    {
        "name": "magento/project-community-edition",
        "description": "eCommerce Platform for Growth (Community Edition)",
        "type": "project",
        "version": "2.2.1",
        "license": [
            "OSL-3.0",
            "AFL-3.0"
        ],
        "require": {
            "magento/product-community-edition": "2.2.1",
            "composer/composer": "@alpha"
 },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.4.0",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.0",
        "sebastian/phpcpd": "2.0.0"
    },
    "config": {
        "use-include-path": true
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": "app/code/"
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "alpha",

.......


texts: Change the name of the route in Magento 2?

texts:
Change the name of the route in Magento 2
For example http://magento2.loc/checkout changed to http://magento2.loc/supercheckout

Thank you for answer.


texts: I'm trying to locate where the dimensions for the Visual Swatches in Magento 2 are defined. Or if they are not longer configurable via the admin the block that defines them.


texts: How to stop calling paypal objects file on home page?

texts:
We don’t want to make a call out to PayPal (https://www.paypalobjects.com/api/checkout.js) file when loading the homepage.
We should only be making calls to PayPal on the cart page and checkout.

Module Name: Magento_Paypal

  File Path:
  vendor/magento/module-paypal/view/frontend/requirejs-config.js

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

var config = {
    map: {
        '*': {
            orderReview: 'Magento_Paypal/order-review',
            paypalCheckout: 'Magento_Paypal/js/paypal-checkout'
        }
    },
    paths: {
        paypalInContextExpressCheckout: 'https://www.paypalobjects.com/api/checkout'
    },
    shim: {
        paypalInContextExpressCheckout: {
            exports: 'paypal'
        }
    }
};


texts:
i wrote below code to change product price to custom one

<?xml version="1.0"?>
<config>
  <modules>
    <Mour_Customgroup>
      <version>0.1.0</version>
    </Mour_Customgroup>
  </modules>
  <frontend>
    <events>
        <checkout_cart_product_add_after>
            <observers>
                <setadiscountprice>
                    <class>Mour_Customgroup_Model_Observer</class>
                    <method>modifyPrice</method>
                </setadiscountprice>
            </observers>
        </checkout_cart_product_add_after>
    </events>
  </frontend>
</config>

Model/Observer.php

    $quote = $obs->getEvent()->getQuote();
    $item = $obs->getQuoteItem();
    $product_id=$item->getProductId();
    $_product=Mage::getModel('catalog/product')->load($product_id);
    $newprice=$_product->getPrice()+rand(10,100);

    Mage::log('My log entry', null, 'mylogfile.log');

    // Set the custom price
    $item->setCustomPrice($newprice);
    $item->setOriginalCustomPrice($newprice);
    // Enable super mode on the product.
    $item->getProduct()->setIsSuperMode(true);

}

}

the above code add same amount to all items in cart what if i want to add different prices


texts: Increased in crawl errors and unable to crawl as Google

texts:
From December 12th, crawl errors have increased on our website: www.digital-pianism.com

We have received today a warning email from Google Webmaster Tool saying that there was a significant increased in crawling errors so we connected to GWT and every page is flagged as unreachable (500 error).

Website is up, I can crawl it and we haven't done any modification on December 12th.

Worse, when I try to crawl as Google, state is "unreachable".

Has something changed in Google crawler recently ? What can I do to solve this ?

Only error in the server log is this one:

FastCGI: comm with server "/path/to/index.php" aborted: error parsing headers: duplicate header 'Content-Type'

My .htaccess has not changed for a while and there is definitely no blocking IP in here.

Could it be related to my automatic language detection in my index.php ?

Here's the code:

function getStoreForLanguage()
{
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
    {
        foreach (explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $accept)
        {
            if (preg_match("!([a-z-]+)(;q=([0-9.]+))?!", trim($accept), $found))
            {
                $langs[] = $found[1];
                $quality[] = (isset($found[3]) ? (float) $found[3] : 1.0);
            }
        }
        // Order the codes by quality
        array_multisort($quality, SORT_NUMERIC, SORT_DESC, $langs);
        // get list of stores and use the store code for the key
        $stores = Mage::app()->getStores(false, true);
        // iterate through languages found in the accept-language header
        foreach ($langs as $lang)
        {
            $lang = substr($lang,0,2);
            if (isset($stores[$lang]) && $stores[$lang]->getIsActive()) return $stores[$lang];
        }
        return Mage::app()->getStore();
    }
    return Mage::app()->getStore();
}

/* Auto redirect to language store view if request is for root */
if ($_SERVER['REQUEST_URI'] === '/') {
    header('Location: '.getStoreForLanguage()->getBaseUrl(), false);
    exit;
}

EDIT: problem is definitely caused by a 500 error but site is still displayed. See my solution for details.

EDIT 2: switching to the original Magento index.php keeps the 500 error -_-


texts: load magento controller method from Template

texts:
I have two simple method inside controller

<?php
public indexAction
{}
public TestAction{

echo "Kkkdfd"
}

I have a template named something.phtml
How do i call testaction from my template to display php echo?


texts:
Hi all, I'm trying to override the CatalogSearch module with a css style only for the module.
From Magento's documentation says to create folders and files this way /_/web/css/source/_module.less
My path is root_theme\Magento_CatalogSearch\web\css\source_module.less
I have this path with this file and the code inside to try this is

 button {background-color: chocolate;}
.action {
    .primary{
             background:#333;
             }
}

but it does not work.
How can I solve this problem?
Magento_CatalogSearch\web\css


texts: Am working on a shopping cart site now and am unable to sort the products based on the price.. I have drink size as the configurable product and there are several drink sizes for a single product e.g 100 ml, 250 ml, 500 ml.. The price should be sorted as per the minimum quantity but its not sorting like that..


texts: Magento 2.2.5 new customer account form not working for Chrome, Internet Explorer but works fine in Mozilla

texts:
New customer account form not working for Chrome and Internet Explorer but works fine in Mozilla. Both updated version of Magento and Fresh Installation of Magento 2.2.5, both are not working.

Magento version - 2.2.5 (Fresh Install)

XAMPP Version: 7.1.19


texts: Custom router in module "Sample New Page" wont work

texts:
I am a beginner in Magento Magento 2. I'm trying to learn how to develop module for mage but I have problem with custom routing in module.

Here's what I've done:

I cloned from their repo and installed by the composer.
I downloaded the 'sample-module-newpage' from the repo https://github.com/magento/magento2-samples
I placed sample-module-newpage in the app/code/Magento/sample-module-newpage.
Then I enable the module with command: enable Magento_SampleNewPage
Then I was executed command magento setup:update

Now couple things:

In Magento backoffice stores -> configuration -> advanced -> advanced in section Disable Modules Output I can see that Magento_SampleNewPage is enabled
I disabled Magento cache
I'm not sure if it should look like this but to the admin panel
I get through exaple.com/index.php/admin
After installation Magento wasn't able to load css and js depedencies because of wrong file path. To fix this I was run two commands magento setup:static-content:deploy and magento indexer:reindex

My problem

I'm not able to access example page which is created by my module. Readme says that page can be accessed at /newpage but I'm getting apache 404. I've tried also at  /index.php/newpage but I'm getting magento error that page doesn't exists.

What I'm doing wrong?


texts: From where the inline style in list page product-info coming from?

texts:
I want to give a height to product-info div in category page. when I inspect the element, already height property is defined inline. But when I inspect the code in list.phtml there is no inline style defined for product-info. I just dont know where those inline styles are coming from.

Someone explain me this please.


texts: Magento 2: Getting Module validation issue

texts:
I am getting the module validation error:

D:\marketplace-tools>php validate_m2_package.php Abc.zip

ERROR - "Abc.zip": "composer.json" found in unexpected place. Zip archive layout not to standard as described in the "Component File Structure" section of the PHP Developer Guide.

Does anyone have a solution for this?

Thanks


texts: how to import .csv file in defined table in command line?

texts:
I need to import.csv file throught windwos command line terminal in defined table.

I trying this command :

C:\xampp\mysql\bin\mysql -u root -p dbname dbtablename < C:\xampp\htdocs\site\csvfolder\import.csv

but it does not works. What i am doing wrong ?


texts:
I am trying to put log in observer

sales_order_save_after
Whenever I put logger in the execute I can’t do any checkout it complains about guest checkout payment
Is there any other way I could see the log

When I do var_dump it takes me to cart page from checkout because I am stopping the payment


texts: In Magento 1 the config.xml is placed under app/etc. Where it this file in Magento 2? Is it called di.xml instead?


texts: Magento 2: transactional e-mails not translated when triggered by code

texts:
I have created a custom module that automatically generates orders based on certain conditions. It is a subscription module.

When the orders get created via cronjob or command line (both point to the same code) everything works fine except that the resulting transactional e-mails are not being translated. They are supposed to be in german as they are when orders get created manuall via frontend.

How can I force the translation?

This is how the orders get created:

protected function _createOrder($data)
{
    /** @var $customer \Magento\Customer\Model\Customer */
    /** @var $quote \Magento\Quote\Model\Quote */
    /** @var $order \Magento\Sales\Model\Order */

    $store = $this->_storeManager->getStore();
    $websiteId = $this->_storeManager->getStore()->getWebsiteId();

    if (!isset($data['customer_id']) || empty($data['customer_id'])) {
        return false;
    }

    try {
        $customer = $this->_customerRepository->getById($data['customer_id']);
    } catch(\Magento\Framework\Exception\NoSuchEntityException $e) {
        $this->_log($e->getMessage());
        return false;
    }

    $quote = $this->_quoteFactory->create();
    $quote->setStore($store);
    $quote->setCurrency();
    $quote->assignCustomer($customer);

    $product = $this->_product->load($data['product_id']);
    $product->setPrice($data['price']);
    $quote->addProduct(
        $product,
        intval($data['qty'])
    );

    $quote->getBillingAddress()->addData((array)$data['billing']);
    $quote->getShippingAddress()->addData((array)$data['shipping']);

    $shippingAddress = $quote->getShippingAddress();
    $shippingAddress->setCollectShippingRates(true);
    $shippingAddress->collectShippingRates();
    $shippingAddress->setShippingMethod('tablerate_bestway');

    $quote
        ->setPaymentMethod('checkmo')
        ->setInventoryProcessed(false)
        ->setIsSubscription(true)
        ->save()
    ;

    $quote->getPayment()->importData(['method' => 'banktransfer']);
    $quote->collectTotals()->save();

    try {
        $order = $this->_quoteManagement->submit($quote);
    } catch(Exception $e) {
        $this->_log("Order creation failed: " . $e->getMessage());
        return false;
    }

    if (!$order) {
        return false;
    }

    return ($order->getEntityId() ? $order->getEntityId() : false);
}


texts: What is the best approach to sending the error logs from my Magento site to Graylog?


texts: How many price types available in magento 2

texts:
How many price types available in Magento 2.x.x
How it can be loaded on the checkout page?
What is the difference between group price and tier price in Magento 2


texts:
If I have the following code in a CMS page to call a template:

{{block class="Magento\Framework\View\Element\Template" name="gifts" template="Magento_Theme::html/gifts.phtml" product_id="68"}}'

How would I then retrieve the product ID in the phtml file?

I've tried:

$product = $this->getData('product_id');

But it returns empty, what is the correct way to retrieve this variable in Magento 2?


texts:
I have a collection of users and I want to create a backend grid to show only some user depending on a filter.

For example I want to show all the users in my table whith age greater than 18.

I created a new collection and i added my filter to _initSelect method.

...
protected function _initSelect()
{
    parent::_initSelect();
    $this->addUsersFilter();

    return $this;
}
...
public function addUsersFilter()
{
    $this
        ->addFieldToFilter('age', ['gteq' => 18]);

    return $this;
}
...

Bt my grid keeps showing me the whole table content regardless my filter.

Does anyone knows how to filter a grid directly from its source collection?


texts: Empty header after clearing cache in Magento 1.7.0.2

texts:
I have been puzzled for more then a week and I really hope someone can help.

Situation is that we have nm online store that works great wine online store
So far so good after testing all and going online I deleted dev site.
Some 3 weeks ago after running for some 6 months, out of the blue some funny started to go wrong, if I clear cache or try to deactivate compiler, the site goes down and front end appears without header.

So now I have copy entire site to development site. And strait from start it give front end without header I mean <head></head> appears empty.

I have tried about everything, clean install, new .htaccess, new php.ini. getting rid of all extentions, desactivating all static blocks, deleting core/local and reading hundreds of forums and nothing I just get this empty head.

PS: running on a dedicated linux server and consulted server senior admin aswell.


texts: Due to magento cache some attribute blocks are not showing on homepage

texts:
I have made some attribute so that client can select his desired products to show on homepage.

For each attribute i have one block and every one is allowed already in admin.

There are 10 rows of products. But some rows are showing and some are not due to magento cache. When i disable cache, everything shows.

What may be the cause? I tried deleting all cache many times.


texts: Magento2 In Store/Configuration/General/Design I can only see Search Engine Robots section

texts:
so all I see is this:

instead of this:

(On this second image is actual Store/Configuration/General/Design section)

Any idea what files might be missing?


texts: Magento 1.9.2.0 static block display issues

texts: I have a website with multiple static blocks which was working in 1.9.1.0, but with 1.9.2.0 the static blocks start displaying sporadically, as they sometimes show the wrong block rather than the correct block. Sometimes they display as desired. Does anyone know how to solve this issue which may be related to this issue?


texts:
I have a few links in the home page. for e.g. link1 , link2, link3
When I click link1 want to load the page link1.phtml , link2 to load link2.phtml and link3 to load link3.phtml

Know it is possible to create a page in admin cms and then loading the page. But is it possible to do it in the local.xml file without touching the admin .  The reason is I have about 15 links on the home page that needs to be showing some information.

Please can anyone help with the codes

                New Link

How to map this to a link or please correct me if my approach is wrong


texts: How to remove a duplicate sku via database?

texts:
I get this error when attempting to edit and save a few of my Magento products via admin: "The value of attribute "SKU" must be unique."

When I view my products in Magento admin a duplicate sku is nowhere to be found, but when I run a product export there are in fact some products with the same sku. In theory Magento should never have allowed this to happen, but alas, I'm dealing with a fairly large and mature (3+ year old) group of products that seems to carry the remnants of previous Magento bugs and quirks.

I'm guessing the only way to fix this issue is to manually remove one of the duplicate skus from the database, but I'm not sure of the best/safest way to do this. I have pretty much 0 experience working with databases, so any help is appreciated.


texts: How to create a custom form template in magento from admin panel?

texts: I had used web-forms extension which was a very good solution but my main problem is it is only allowing to create 10 fields whereas my form contains 18 fields... please provide a solution for this... thanks in advance


texts:
I have a custom attribute called m2_price, which is the Metre Squared price of a piece of carpet.

I've enabled it to be filterable with results in the layered navigation and this all works fine.

However, the prices are stored EXCLUDING tax, so the filter is generated based on these prices. Is there any way I can make the filter then add Tax on to the m2_price just how it works with the normal product price?

I've tried searching for this and I've been unable to find anything which even hints to a solution.


texts: Catalog price rules with date as conditions cannot possibly work due to strtotime() conversion

texts:
I reported the following issue as Magento Issue #9976 but I'd like to know if a fix for this is in the wild already and I'm just missing it.

I'm working on a Magento ver. 1.9.2.4 shop. I must create an additional catalogrule discount on products that have special_from_date attribute set. This is the interesting part of my rule:

My problem is: this rule doesn't work in a reliable way: sometime it does, sometime it doesn't.

I think I tracked down the issue in a apple-to-orange comparison in shop/app/code/core/Mage/Rule/Model/Condition/Abstract.php#614.

As you can see in this debugging session, the function Mage_CatalogRule_Model_Rule_Condition_Product::validateAttribute() is comparing $validatedValue <= $value, where the former ia a unix timestamp (1504310400) and the latter is a plain date 2018-01-18.

The former is coming from the special_from_date attribute, the latter is the date set in the rule

The main issue is that shop/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php#118 converts the product attribute into a unix timestamp, while no conversion is applied to the conditions of the rule.


texts: How to reduce a large Magento 2 installation?

texts:
I'm using Magento 2.4 and my installation is using 200GB, I'd like to reduce it.
I want to remove old logs, backups, caches, duplicated images and etc.
How could I optimize it?


texts:
I want to upgrade my magento 2.1.13 to magento 2.3.0. But i don't know how to do it. I try to run "composer require magento/product-community-edition 2.3 --no-update" in command but it show a bug.
http://prntscr.com/ls86ud


texts: When sort the products,product name displayed as ' UNDEFINED'  magento1.How to solve this.?


texts: 2 way syncing Magento Open Source and Salesforce

texts: Can this be done and how. Not finding any Connectors that sync both ways, just Magento to Salesforce. Do we need to create our own REST API?


texts: How to preload custom fonts in Magento 2.2

texts:
I have a custom font in my theme already added through the "web/css/source/_typography.less".
& when (@media-common = true) {
.lib-font-face(
    @family-name: @font-family-name__base,
    @font-path: '@{baseDir}fonts/poppins/light/Poppins-Light',
    @font-weight: 300,
    @font-style: normal
);

I am wondering how I can add a "preload" instruction? The problem is because due less the files will be preprocessed and generated. so I can not add a hardocded path in the "head" section of my site. The path will change each time I change the css / less files on the site i.e. the "version1612984603" will change when I flush cache or recompile the less files.
Example dynamic generated link by magento for that font file
https://example.com/static/version1612984603/frontend/<vendor>/<theme>/de_DE/fonts/poppins/light/Poppins-Light.woff2

Example preload instruction
  <head>
    <link rel="preload" as="font" href="/static/version1612984603/frontend/<vendor>/<theme>/de_DE/fonts/poppins/light/Poppins-Light.woff">
  </head>

So how can I do this?
Remark: I have seen that the <font>feature (see custom fonts) has been added in magento 2.3.x but I can not update my installation from 2.2 to 2.3 due the incompatibiity of some extensions.


texts: catalogProductInfo Returning 0.00 price for an item with a configured price

texts:
I am using the SOAP V2 API to pull back product information and the product in question has a price defined of 9.99 which is not returned with the item.  The clients magento has a bundle product (flagged as disabled) with no price, and the sku in question is a simple type which I am filtering on.

Why is the price of 9.99 not being returned with the simple item?  I am not sure what additional information to include but this works for other items.


texts: How to convert related products section to custom tab in products detail page in magento 2

texts: I need to convert related products section to custom tab in products detail page in magento 2


texts: Magento2 - Exception occurs when I update customer data using customer repository

texts:
Error:
Invalid value of UK provided for the countryId field.

Error File:
vendor\\magento\\module-customer\\Model\\ResourceModel\\AddressRepository.php

Error line:
133

Code is:

$customer = $this->customerRepository->getById($customer->getId());
$cattrValue = $customer->getCustomAttribute('username');
$customer->setCustomAttribute('username', $customerData['web_username']);

$customer->setFirstname($customerData['first_name']);
$customer->setLastname($customerData['last_name']);

$this->customerRepository->save($customer, $hashedPassword);


texts: Whats the correct way to change DB prefixes in Magento 2?

texts:
I made a mistake and left out the _ between the prefix and the table name in our new Magento 2 site. So I manually changed the table names to include it.
Now none of our products show in any search results.

They do show in the New Products widget on the homepage, but if I search it just returns a blank page with the layered navigation.

So I'm guessing I screwed up by manually editing the table names.

What would be the correct way to have done this?


texts: Why I'm seen "Invalid Form Key. Please refresh the page" in the frontend?

texts:
Sometimes I'm receiving this message below during the customer login after being changed the cookie domain through the admin panel.

Do you know why and when this message shows up?

  Invalid Form Key. Please refresh the page


texts: Dynamic Price with currency which differs from base currency

texts:
In my store I need to calculate dynamic prices. I found the following code in several tutorials.

checkout_cart_product_add_after

$item = $obs->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$price = "your custom price logic";
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);

For storeviews where BaseCurrency=StoreCurrency it works. But when the store Currency differs from the base currency i get unexpected results.

Example:

BaseCurrency = EUR
StoreCurrency = USD

Now I set the Price in my code to 1.

I would expect that magento displays either ~1.28$ or 1$

But it comes up with 0.78$


texts: How to delete a large website within a Magento Store?

texts:
I've a reasonably large Magento instance that holds two websites: a retail site and a wholesale site.

For business reasons I need to split these into two separate instances, preserving the full order history and product catalogues of each one as I do so but deleting (or at least hiding) the records that relate to the other store.

I thought that simply cloning the site to a second instance, changing the default store and then using the UI to delete the appropriate store in each would be the simplest way, however with 10,000 skus and 40,000 orders in the history deleting the sites fails - I've messed around with timeouts and even after running for an hour straight, cpu sitting on 100%, it still fails to delete the selected store.

Can anyone suggest a better strategy to do this? I'd thought of building up the two sites from scratch and importing products with Magmi, but that doesn't help with the customers and order histories and still leaves lots of other bits like CMS blocks/pages, tax settings, promotions that I'd need to pull in manually - so that becomes very messy.

Things to note about this scenario:

Customers are unique to each store
Most products are shared b/w stores
Some CMS content is shared
Config settings, shipping methods, tax etc are all very different per store


texts: Get first and last inovice # in every date

texts:
I am trying to show invoices for every single day, so for that purpose I used group by on created date and sum on subtotal. This is how I done it :

$orders = Mage::getModel("sales/order_invoice")->getCollection();

$orders->getSelect()
       ->columns(array(
            'total_sales' => 'SUM(subtotal)',
       ))
      ->group('DATE_FORMAT(created_at, "%m-%y")');

Its working, but I also want to get the Invoice # from and Invoice # to for every date. Is it possible to do it with single query ?


texts:
After install Magento2.2 using the .tar into a nanobox and setting up via /setup, the admin page and home page give an error

Fatal error: Class 'SessionHandler' not found in /app/vendor/magento/framework/Session/SaveHandler/Native.php on line 11

My boxfile.yml, which sets up the environment, modules, extensions etc looks like this:

run.config:
  engine: php
  engine.config:
    session_save_handler: 'files'
    session_save_path: 'var/session'
    memory_limit: '2G'
    date_timezone: 'US/central'
    cache_dirs:
      - vendor
    runtime: php-7.0
    webserver: 'apache'
    apache_modules:
      - version
      - alias
    extensions:
      - gd
      - pdo_mysql
      - pdo
      - curl
      - intl
      - ctype
      - tokenizer
      - dom
      - xml
      - xmlwriter
      - iconv
      - mbstring
      - simplexml
      - mcrypt
      - xsl
      - soap
      - zip

data.db:
  image: nanobox/mysql:5.6

I've been trying for hours to get this working through nanobox but i'm willing to work with docker as well.


texts: Add coupon to order programmatically with modified coupon code

texts:
I've modified the coupon validation function to check for grouped SKUs as well as the simple SKU. It works great on the Magento front end, but I have a process that creates an order programmatically, and I'm not able to get the coupon to work there. I've traced it down to the fact that since the programmatic order doesn't use the checkout/cart, it can't get the parent item.

Here's the validate function inside of local/Mage/Rule/Model/Condition/Abstract.php:

public function validate(Varien_Object $object)
{
    $parentCode = '';
    if($this->getAttribute() == 'sku'){
        $quote = Mage::getSingleton('checkout/cart')->getQuote();
        if($qItem = $quote->getItemByProduct($object)){
            if($parent = $qItem->getParentItem()){
                $parentCode = $parent->getSku();
            }
            else if($buyRequest = $qItem->getOptionByCode('info_buyRequest'))
            {
                $options = unserialize($buyRequest->getValue());
                if(!empty($options['super_product_config']))
                {
                    $prodID = $options['super_product_config']['product_id'];
                    $parentCode = Mage::getModel('catalog/product')->load($prodID)->getSku();
                }
            }
        }
    }
    return ($this->validateAttribute($object->getData($this->getAttribute())) || $this->validateAttribute($parentCode)) ? true : false;
}

And the relevant parts of my order creation:

function createQuote(){
    $quote = Mage::getModel('sales/quote');
    if (!$quote) {
        Mage::log("Error in quote! ".$parentId);
        return;
    }
    $this->quote = $quote;
}

function setCoupon($coupon){
    if(!empty($coupon))
        $this->_coupon = $coupon;
}

function setQuoteAddress(){
    $quote = $this->quote;
    $shippingAddress = new Mage_Sales_Model_Quote_Address;
    $billingAddress = new Mage_Sales_Model_Quote_Address;
    $billingAddress->setData($this->_billingAddr);
    $shippingAddress->setData($this->_shippingAddr);
    $quote->setBillingAddress($billingAddress);
    $quote->setShippingAddress($shippingAddress);
    $quote->getShippingAddress()->setSameAsBilling($this->_sameAsBilling);
    $quote->getBillingAddress()->setEmail($this->_billingAddr['email']);

    if(!empty($this->_coupon)){
        $quote->setCouponCode($this->_coupon);
    }
}

function setAddress($request){

    // Address validation here
    $this->setQuoteAddress();

    return false;
}

Edit It could possibly be because I wasn't adding the items to the cart, like I had thought, but when I try, the total is 0:

// Total is correct, cannot pull the ItemByProduct/getParentItem
$cart = Mage::getModel('checkout/cart');
if(!$quote->hasProductId($parentId)){
    $quote->addProduct($product, new Varien_Object($params));
//  $quote->collectTotals()->save();
    Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
}

// Amount is 0
$cart = Mage::getModel('checkout/cart');
$cart->init();
//Add product to cart with specified parameters and save the cart object
if(!$quote->hasProductId($parentId)){
    $cart->addProduct($product, new Varien_Object($params));
    $cart->save();
    //  $quote->collectTotals()->save();
    Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
}


texts: Disable cache for custom block file in Magento 2

texts: I want to show random product collection on custom template. But It is showing random product only after clear cache otherwise it shows same products.  Please help.


texts: Magento 2 - Call a static block in the footer

texts:
I created a static block in backend of my magento and now i would like to recall the created block in the footer, near to the footer link .

In what phtml files I retrieve it?

Thanks.

P.S. Where is the file of footer links for change the link and name?


texts: Magento 2 Installation error in Ubuntu system

texts:
In Ubantu System xampp server using install the Magento 2 erorr!

1.Magento 2.3.4 admin penal does not open gives Error 404 .

2.When I open the terminal and hit the magento command like:
php bin/magento c:c then gives error!

PHP Fatal error:  Uncaught Error: Undefined class constant 'PDO::MYSQL_ATTR_SSL_KEY' in /opt/lampp/htdocs/magento234/setup/src/Magento/Setup/Model/ConfigOptionsList.php:179
Stack trace:
#0 /opt/lampp/htdocs/magento234/setup/src/Magento/Setup/Model/ConfigModel.php(71): Magento\Setup\Model\ConfigOptionsList->getOptions()
#1 /opt/lampp/htdocs/magento234/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php(64): Magento\Setup\Model\ConfigModel->getAvailableOptions()
#2 /opt/lampp/htdocs/magento234/vendor/symfony/console/Command/Command.php(77): Magento\Setup\Console\Command\ConfigSetCommand->configure()
#3 /opt/lampp/htdocs/magento234/setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php(54): Symfony\Component\Console\Command\Command->__construct()
#4 /opt/lampp/htdocs/magento234/vendor/zendframework/zend-di/src/Di.php(512): Magento\Setup\Console\Command\ConfigSetCommand->__construct(Object(Magento\Setup\Model\ConfigModel), Object(Magento\Framework\Module\ModuleList), Object(Magento\Framework\App\DeploymentConfig))
# in /opt/lampp/htdocs/magento234/setup/src/Magento/Setup/Model/ConfigOptionsList.php on line 179

Thanks in advance!!


texts: How to pass custom parameters to parent construct?

texts:
I have extended \Magento\Sales\Controller\Adminhtml\Order to Custom class like below,but not able pass one more parameter($httpClientFactory) to this construct level.

How to pass custom parameters($httpClientFactory) to parent construct?

<?php
class Custom extends \Magento\Sales\Controller\Adminhtml\Order
{
    /**
     * @var \Magento\Framework\View\LayoutFactory
     */
    protected $layoutFactory;

    /**
     * @param Action\Context $context
     * @param \Magento\Framework\Registry $coreRegistry
     * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
     * @param \Magento\Framework\Translate\InlineInterface $translateInline
     * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
     * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
     * @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
     * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
     * @param OrderManagementInterface $orderManagement
     * @param OrderRepositoryInterface $orderRepository
     * @param LoggerInterface $logger
     * @param \Magento\Framework\View\LayoutFactory $layoutFactory
     *
     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
     * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
     */
    public function __construct(
        Action\Context $context,
        \Magento\Framework\Registry $coreRegistry,
        \Magento\Framework\App\Response\Http\FileFactory $fileFactory,
        \Magento\Framework\Translate\InlineInterface $translateInline,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
        \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory,
        \Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
        OrderManagementInterface $orderManagement,
        OrderRepositoryInterface $orderRepository,
        LoggerInterface $logger,
        \Magento\Framework\View\LayoutFactory $layoutFactory,
        **\Magento\Framework\HTTP\ZendClientFactory $httpClientFactory**
    ) {
        $this->layoutFactory = $layoutFactory;
        **$this->_httpClientFactory = $httpClientFactory;**
        parent::__construct(
            $context,
            $coreRegistry,
            $fileFactory,
            $translateInline,
            $resultPageFactory,
            $resultJsonFactory,
            $resultLayoutFactory,
            $resultRawFactory,
            $orderManagement,
            $orderRepository,
            $logger
        );
    }
}


texts: Magento 2 - What is the error in my observer - catalog_product_collection_load_before

texts:
I want to get selected attributes in product listing page using observer,
app\code\Zero\DescBlock\registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(

    \Magento\Framework\Component\ComponentRegistrar::MODULE,

    'Zero_DescBlock', __DIR__ );

app\code\Zero\DescBlock\etc\frontend\events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_collection_load_before">
         <observer name="ChangeDescBlock" instance="Zero\DescBlock\Observer\Data" />
    </event>
</config>

app\code\Zero\DescBlock\etc\module.xml
<?xml version="1.0" ?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Zero_DescBlock" setup_version="1.0.0"/>
    <!-- <sequence>
        <module name="Magento_Catalog">
    </sequence> -->
</config>

app\code\Zero\DescBlock\Observer\Data.php
<?php

namespace Zero\DescBlock\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Catalog\Model\Layer\Resolver as LayerResolver;

class Data implements ObserverInterface
{
    /**
     * @var \Magento\Catalog\Model\Layer\Category
     */
    protected $catalogLayer;

    /**
     * @param LayerResolver $layerResolver,
     */
    public function __construct(
        LayerResolver $layerResolver
    ) {
        $this->catalogLayer = $layerResolver->get();
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        // Get selected filters
        $layer         = $this->catalogLayer;
        $activeFilters = $layer->getState()->getFilters();
        $this->logger->info(print_r( $activeFilters, true));

    }
}

The logger not return selected attributes.


texts: Remove demo store notice from admin side in magento 2.2.5?

texts:
How to remove/disable demo store notice from admin side.
We want to remove from only admin side but we want that show in front.
Our site is in magento 2.2.5
Any one help me for solve this issue.


texts: Output attribute text on product view page from simple product which is associated with configurable product

texts:
The above question may sound confusing, so I'll simplify and explain it more below - I tried to look for this answer but couldn't find anywhere.

I have a configurable product for t-shirts which has sizes and colours, I am trying to show custom message on selection of each size (S, M, L), basically, the attribute value should change based on size selection, which has been set in simple product, however; it doesn't output anything. The below code output nothing at all.

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

I tried the same code for configurable product, and added the attribute to configurable product instead to simple product. This output the attribute text but the value supposed to change with each simple product.

So the above piece of code work when the attribute is assigned to configurable product, however; it doesn't work when assigned to simple product.

Any suggestion on how to output attribute text (dropdown attribute) which is linked with simple product but should display on frontend configurable product view?

Thanks


texts: How to check if the weight of the product is more than 20 kg

texts:
I have a simple shipping method implemented by this tutorial: https://www.mageplaza.com/devdocs/magento-2-create-shipping-method/
I added the Max Weight field
<field id="max_weight" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
    <label>Max Weight</label>
    <validate>validate-number validate-zero-or-greater</validate>
</field>

I need to write logic that will calculate the total weight of all added products and if it exceeds 20kg then return false
I see this logic as the weight multiplied by the number of products, I found the number of products but I cannot find the weight, tell me how to do it as much as possible correctly
public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request)
{
    $qty = 0;
    if ($request->getAllItems()) {
        foreach ($request->getAllItems() as $item) {
            if ($item->getProduct()->isVirtual()) {
                continue;
            }

            if ($item->getHasChildren()) {
                foreach ($item->getChildren() as $child) {
                    if (!$child->getProduct()->isVirtual()) {
                        $qty += $child->getQty();
                    }
                }
            } else {
                $qty += $item->getQty();
            }
        }
    }

    if($productsWeight > getShippingWeight()) {
        return false;
    }
    return parent::collectRates($request);
}


texts: Magento 2.2.4 Product sorting list by price on category page - How to fix Low to High Sorting Issue

texts:
Magento 2.2.4
It is expected that catalog category page show products sorted by price correctly, taking account that special price of the configurable product should not make difference to price indexer process

Indexer process is using configurable product special price to update catalog_product_index_price letting the category page sorting products in the wrong way.

How to fix Low to High Sorting Issue


texts:
This may not be a Magento issue but i am currently being asked to try and stop the our home page loading the way it does for one of my clients. I have been told the site never loaded like this before but now that its been noticed its driving my client crazy.

When our site www.calzeat.com loads you will notice it all loads in a line for a split second and then loads properly. I hardly notice it at all but i have decent connection here but my clients machine be it the internet or old machine this takes a good few seconds longer.

Has anyone ever experienced this before and is there a solution? I will be forever grateful as i am hearing about this issue daily :)