texts: Product stock alert - sent only once without unsubscribing

texts:
Why the Product Stock Alert / Notification is sent only once even when customer won't unsubscribe from product's alert?

Example situation:
Customer subscribe to receive notification about Product A and Product B.

Both comes into stock, he receives email alert as it should be.

Now product A is going out of stock again.

After a week Product A comes back to in stock.

Theoretically - customer should receive notification - he didn't unsubscribe from that product's alert.

While in the real world if the customer wants the notification he has to subscribe to the product again - why?

Considering that the table product_alert_stock has a column called send_count - which's counting the emails sent but only if the customer subscribes second time.

If this is a feature not a bug, what's the point of Unsubscribing from specific product alert?

P.S. I know about: Why there is a unsubscribe from product in a product stock alert e-mail? but this not straight answer to my question.


texts: Magento2: What is difference between configurable products and simple product with custom option?

texts: What is difference configurable products and simple product with the custom option?


texts: css issues display the horizontal line below Out of stock

texts:
please visit this link :

http://hotthjefj.com/x9460-disney-planes.html?___SID=U

here you can see  "out of stock" is separated by "Availability" through horizontal line.

but here it is fine

http://gfgfg.com/cbn10-disney-planes-avalanche.html

i want to display the Out of stock above that line

please help me to find solution


texts:
My accountant asked me an export of all my invoices at PDF (33972 invoice :/) . Is there a way to do it automatically ?

Thanks


texts: Facing error when upgrading schema in magento2

texts:
Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'st_m2_225_21082018.sentence_sentence' doesn't exist, query was: DESCRIBE SENTENCE_SENTENCE

<?php
    namespace Vendor\Module\Setup;

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

    class UpgradeSchema implements  UpgradeSchemaInterface
    {
        public function upgrade(SchemaSetupInterface $setup,
            ModuleContextInterface $context){
            $setup->startSetup();

            if (version_compare($context->getVersion(), '1.9.1') < 0) {

                // Get module table
                $tableName = $setup->getTable('sentence');

                // Check if the table already exists
                if ($setup->getConnection()->isTableExists($tableName) == true) {
                    // Declare data
                    $columns = [
                    'sentence' => [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                    'nullable' => false,
                    'comment' => 'sentence',
                    ],
                    ];

                    $connection = $setup->getConnection();
                    foreach ($columns as $name => $definition) {
                        $connection->addColumn($tableName, $name, $definition);
                    }
                    $connection->addIndex(
                        $setup->getIdxName(
                            $tableName,
                            ['sentence'],
                            \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
                        ),
                        'sentence',
                        ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE]
                    );

                }
            }

            $setup->endSetup();
        }
    }
    ?>


texts:
I have created module and trying to generate the coupon code,but here it generate the two coupon code, If I set 'qty => 10', then it generating 20 coupons. What things missing out here ?

Code:

public function getCouponCodecustom(){

try {

    $data = array(
        'rule_id' => 123,
        'qty' => 1,
        'length' => 8,
        'format' => Mage_SalesRule_Helper_Coupon::COUPON_FORMAT_ALPHANUMERIC,
        'uses_per_coupon' => 1,
        'uses_per_customer' => 1
    );
    $generator = Mage::getModel('salesrule/coupon_massgenerator');
    $generator->setData($data);
    $generator->generatePool();

} catch (Mage_Core_Exception $e) {
    $session->addException($e, $this->__('There was a problem with coupon: %s', $e->getMessage()));
}
catch (Exception $e) {
    $session->addException($e, $this->__('There was a problem with coupon.'));
  }
}

I have used the function in Newsletter template as follows:

Newsletter Subscription Success

{{if subscriber.couponCodecustom}}
Thank you for subscription, your coupon code <b>" {{var subscriber.couponCodecustom}} "</b>
{{/if}}


texts: How to merge 2 websites into 1 website with 2 storeviews

texts:
Before I continue to ask my question I would like to state that I am aware of the troubles I'm about to run into if I actually true to accomplish this. Yet, I want to be sure to that I checked all ins and outs so my answer to our client can be accurate and reliable. I think we've all been there.

In this case we have 1 Magento installation(1.9.0.1) which has 2 websites. One for Germany (.de) and one for Dutch visitors (.eu).

Both have just one store-view. The request we received is that our customer wants to have one system, containing one website that has 2 store-views.

Now I can create a new store-view in an existing website and connect that to the right design package but then: products, category's, attributes: all have to be 'moved' from their current website to the other one. I believe this is going to be manual labor, because moving them using sql queries is going to be tricky, dangerous and time consuming.

So, what are your idea's and suggestions in this situation? Do it manually or is there a way to do this quick and easy without a lot of risks?

Thanks for your help!

p.s. the current website uses a theme that is no longer available for updates, just as a couple of modules installed. Just adding this because I want you to have as much information as possible.


texts:
http://www.example.com/catalog/product/upload/option_id/

In webmaster tools it shows this address is linked to from a few of my configurable product pages. Any idea what it could be?


texts:
missly we did some  changes and now one of our phtml page is displaying as one page layout : here

we want to remove that . but we have no idea which xml file we need to look.

IS there any way we can find in which xml file we added the code to make it 1 column layout.? we checked in local.xml. its not there


texts: Magento 2 - How to apply custom function on admin grid column

texts:
I want to apply custom function on grid column.
I tried to apply from adminhtml/ui_component/CustomModule_order_lis.xml   also tried to modified Collection.php .

Like below image, I am getting order status (ready_dispatch, etc) from table column, now want apply CheckOrderStatus() function to change css, color, text & other activity on basis of order status.

$this->CheckOrderStatus('ready_dispatch');

<column name="seller_order_confirm">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="sorting" xsi:type="string">asc</item>
                    <item name="label" xsi:type="string" translate="true">Seller Order Status</item>
                    <item name="sortOrder" xsi:type="number">13</item>
                </item>
            </argument>
        </column>

I have already search about this but not found anything regrading same.
Hope this question not duplicate. Thanks in Advance.


texts:
Using 2.1.5, I'm getting an error message saying:

"Magento_Integration schema: current version - 2.2.0, required version - 2.0.1"

I've tried setup:update and setup:db-data:upgrade.

The site was installed via cPanel/installation version 2.0.7 and has been upgraded several times.

The only thing that brings the site back online is if I edit the Magento_Integration entry of the setup_module table which I would think is not a good idea.


texts: M2: How to enable Configurable Swatches on Catalogsearch page

texts:
How to enable configurable swatches option on catalog search?

I don't know why, the configurable swatches color is not showing on catalog search, but its working fine on Product list pages.

Catalog Search Page :

Product List Page :

Configurable Swatches color not showing on catalog search product list.

in catalogsearch result.phtml, I'm including the product list template to the result.phtml. But configurable swatches option still not showing on catalogsearch product list.

    <?php if ($messages = $block->getNoteMessages()): ?>

                <?php foreach ($messages as $message): ?>
                    <?= /* @escapeNotVerified */
                    $message ?>

                <?php endforeach; ?>

    <?php endif; ?>
    <?= $block->getProductListHtml() ?>


texts: Changing debug mode into magento 2.3 losses theme css content

texts:
My site was in production mode. i changed it to developer mode. i ran all the commands. Static content deploy command too.
But site is looking weird now.
Can you guys please suggest something.
https://e92rduand89atx1x.mojostratus.io/  link for reference.


texts:
How do I customize the HTML for the global messages block?  it's called in most templates:

<?php echo $this->getChildHtml('global_messages') ?>

But I can't find reference to what is generating the HTML anywhere - enabling template paths does not show if it is using a template or not.


texts:
I have made a custom module for sellers.

There, I want to add a functionality of commission invoice. For the same, I want to have an increment id like in sales_order. The increment id should start with CI.

How can I achieve this ?


texts:
I have a few problems with indexed pages, therefore i want to no-index a few url's with problems.

/brand/index/
/nieuw/

So these 2 url's and also all other url's below, for example /brand/index/color/... and /nieuw/brand/...

Who can help me and have a solution?


texts: Magento 2 Admin Page “Exception #0 (OutOfRangeException): Specified invalid parent id (Xtento_XtCore::extensions)”

texts:
I've installed xtento module in magento and I getting this error when I try to display admin login form.
``` 1 exception(s): Exception #0 (OutOfRangeException): Specified invalid parent id (Xtento_XtCore::extensions)```


texts: How do you programmatically remove a specific product from a specific category using?


texts: how to Placed order as another customer in Magento 2 checkout

texts:
At present in Magento 2 Checkout there are two ways you can place the order.

Guest user
Current logged in user

I have the following requirement from one of our client that add the following feature for one customer group under the checkout.

Step 1. they can search for customers or create customer account.

Step 2. Add/choose (if already have shipping address)

Step 3. Placed order for that customer.

Suppose I have customer with id 3 and I want to place an order for customer with id 4, Whereas checkout only allows order placement as a guest or with current logged in user

How is that possible because checkout uses the customerData storage which keeps the information of current logged in user. same for quote


texts:
How do I add the review block that is visible on the category pages, to the home on the right side FROM THE BLOG is located.
Do I need to just insert the block type in the cms page? I hoped just adding something like this:

{{block type="amreview/sidebar" template="amreviewamreview/sidebar.phtml"}}

www.fleshlight-expert.nl
http://www.fleshlight-expert.nl/men/shirts.html

http://codepen.io/anon/pen/BQMyre

Thanks.


texts: Why isn't Magento using my custom themes addtocart.phtml instead of the default?

texts:
I am trying to get my magento site to use the addtocart.phtml from my other theme within my main theme.

currently my themes are setup as follows

      app                                  skin
        frontend                             frontend
          mainTheme                            mainTheme
            default                              default
            store1                               store1
            store2                               store2

but even if store1 & store2 have their own addtocart.phtml file it uses the one from default, but when I delete the addtocart.phtml from default it still doesn't use the one from store1

I have gone to configuration --> design and set it so that the the skin is set to store1 , the template is set to store1 and default is default, but for some reason it just wont play ball, any ideas ?


texts: Magento 2 as composer dev requirement for extensions

texts:
When writing an extension, would it make sense to add magento/project-community-edition to the require-dev section of composer.json?

The idea behind that is that it would only require a composer install to spin up a complete Magento installation for development or CI.

To set up the database, I would add a post-install script with bin/magento setup:install.

To use the testing tools, you'd need to copy the autoload-dev and require-dev sections from magento/project-community-edition because those are only used from the root, not from requirements.

One disadvantage that I see is that you'd have to change the required version to test on more than two different versions (two because you can specify a range and install once with --prefer-lowest), but that's relatively easy to work around.

Anything else that I need to consider?


texts:
How to stop the DB log i had used the CLI to stop but it is not stopping it increasing to huge file. I used the below command but it is not stopping. It is in the path var/debug/db.log

  bin/magento dev:query-log:disable

  bin/magento cache:flush


texts: Extend checkout order summary section in Magento 2

texts:
I am trying to add custom text in beside shipping method section in Order Summary from Magento 2. But my data is not affecting.

For this, I have added custom text in root\vendor\magento\module-checkout\view\frontend\web\template\summary\shipping.html file. But it's not effecting.

Custom Text

Could you please suggest me which file I need to extend to add custom text?


texts: Magento2 data-migration-tool Integrity check failed

texts:
I migrated magento from 1.7.0.1 to 2.0, but I have encountered the following error:

The first time prompt:

Then I ignore it by map.xml file.

The second time prompt:

But the same prompt: Integrity check failed

Please help me!


texts: M2: Product ID error after update to 2.2.2

texts:
After updating to Magento 2.2.2 I'm receiving this error in admin while trying to edit bundle products:

  Item (Magento\CatalogInventory\Model\Stock\Status) with the same ID
  "XXXX" already exists.

Bundle products are not listed in frontend either.


texts:
On my magento product page I am having an issue which is quite strange I am not able to see additional details and tab data as I am seeing an array of values instead of data.

Upper portion is perfect that is I can view product-image,details, add to cart button etc but lower portion is all messed up.

Could you please direct me to resolve this issue?

http://i.stack.imgur.com/LvraV.jpg


texts:
I have a breadcrumb named "Home" in my checkout.xml. For some reason, at some point, I have translated this to something that I don't want it to be translated to anymore.

However, no matter how much I look in my Mage_Core.csv and Mage_Checkout.csv and, I can't find that specific translation. I have tried overwriting it as well and searching in all files on my computer for the translation - no luck..

Can someone please help me figure out where to find it and remove it again?

Thanks already!


texts: generated output custom option magento admin without any programming, but what I'm looking if default quantity set 0, product does not add in basket until any 1 field (greater then 0).


texts: How to find what simple products fall under a configured product with the SOAP API?

texts:
I'm having problems with using the SOAP API to get all the configured products with its simple products.

$productsList = $proxy->catalogProductInfo($sessionId, '40');

Returns a lot, but no associated products. There's about 2400 products in here, with over 300 of them configured. How to get all the configured products, with the associated products?

I've tried exploding the first part of the SKU, but as the client has named these awfully, there's no way this is going to work.


texts:
Got these warnings while accessing the localhost/magento ‘homepage’:

Warning: include_once(C:\xampp\htdocs\magento/errors/503.php): failed to open stream: No such file or directory in C:\xampp\htdocs\magento\index.php on line 65

Warning: include_once(): Failed opening ‘C:\xampp\htdocs\magento/errors/503.php’ for     inclusion (include_path=’.;C:\xampp\php\PEAR’) in C:\xampp\htdocs\magento\index.php on line 65

But, then On commenting/hiding these lines in index.phtml, the homepage was successfully accessed:

/*
if (file_exists($maintenanceFile)) {
include_once dirname(__FILE__) . ‘/errors/503.php’;
exit;
}
*/

Now the problem is that, though changing the ‘cart ‘s’ position or adding the products categories, it didnt showed up in frontend…
Dont' know what might have got 'misconfigured....'
Please help me to figure out these simple messed-up hussle…


texts: What MySQL Collation should I use for Magento 2.2?

texts:
Looked for a Magento 2 version of this question but only found a Magento 1.
There's 4 that come to mind:

utf8mb4_general_ci

utf8_general_ci

utf8mb4_unicode_ci

utf8_unicode_ci

Which one should I choose for Magento 2.2 and upwards?


texts: Magento 2: How to override Product View Attributes block?

texts:
How to override Product View Attributes block:

vendor/magento/module-catalog/Block/Product/View/Attributes.php in Magento 2?

Jsp/Attributes/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="Jsp_Attributes" setup_version="2.0.0">
        <sequence>
            <module name="Magento_Catalog"/>
        </sequence>
    </module>
</config>

Jsp/Attributes/etc/frontend/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Block\Product\View\Attributes"
                type="Jsp\Attributes\Block\Product\View\Attributes" />
</config>

Jsp/Attributes/registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
  \Magento\Framework\Component\ComponentRegistrar::MODULE,
  'Jsp_Attributes',
  __DIR__
);

Jsp/Attributes/Block/Product/View/Attributes.php

<?php

namespace Jsp\Attributes\Block\Product\View;

class Attributes extends \Magento\Catalog\Block\Product\View\Attributes
{
    public function getAdditionalData(array $excludeAttr = ['colorprueba'])
    {
        $data = [];
        $product = $this->getProduct();
        $attributes = $product->getAttributes();
        foreach ($attributes as $attribute) {
            if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
                $value = $attribute->getFrontend()->getValue($product);

                if (!$product->hasData($attribute->getAttributeCode())) {
                    $value = __('N/A');
                } elseif ((string)$value == '') {
                    $value = __('No');
                } elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
                    $value = $this->priceCurrency->convertAndFormat($value);
                }

                if (is_string($value) && strlen($value)) {
                    $data[$attribute->getAttributeCode()] = [
                        'label' => __($attribute->getStoreLabel()),
                        'value' => $value,
                        'code' => $attribute->getAttributeCode(),
                    ];
                }
            }
        }
        return $data;
    }
}


texts: Stop extra thumbnail appearing configurable product Magento 2

texts:
I have a configurable product and it has its associated simple products (which all have images associated). When I click on the swatch function the main image changes (this is desirable), however a thumbnail is also added to the gallery (this is not desirable).
How can I stop the thumbnail being added to the gallery on the configurable product page? And keep the function that changes the main image. Please see image below for clarity


texts: How to upload image files in database in magento?

texts:
I want to upload image files in a table. So I tried this code for uploading image

$fieldset->addField('image', 'file', array(
          'label'     => Mage::helper('menu')->__('Image'),
          'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'image',
      ));

This is my controller file for saving data

public function saveAction() {
        if ($data = $this->getRequest()->getPost()) {

            $model = Mage::getModel('menu/menu');
            $model->setData($data)
            ->setId($this->getRequest()->getParam('id'));

            try {

                $model->save();
                $menu_id = $model->getId();
                if(isset($data['links'])){
                    $customers = Mage::helper('adminhtml/js')->decodeGridSerializedInput($data['links']['customers']); //Save the array to your database

                    $collection = Mage::getModel('menu/grid')->getCollection();
                    $collection->addFieldToFilter('menu_id',$menu_id);
                    foreach($collection as $obj){
                        $obj->delete();
                    }
                    foreach($customers as $key => $value){
                        $model2 = Mage::getModel('menu/grid');
                        $model2->setMenuId($menu_id);
                        $model2->setCustomerId($key);
                        $model2->setPosition($value['position']);
                        $model2->save();
                    }
                }

                Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('menu')->__('Item was successfully saved'));
                Mage::getSingleton('adminhtml/session')->setFormData(false);

                if ($this->getRequest()->getParam('back')) {
                    $this->_redirect('*/*/edit', array('id' => $model->getId()));
                    return;
                }
                $this->_redirect('*/*/');
                return;
            } catch (Exception $e) {
                Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
                Mage::getSingleton('adminhtml/session')->setFormData($data);
                $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
                return;
            }
        }
        Mage::getSingleton('adminhtml/session')->addError(Mage::helper('menu')->__('Unable to find item to save'));
        $this->_redirect('*/*/');
    }

Ignore menu/grid model, my model is menu/menu

But I am not able to upload it. How can I do it? Thanks


texts: how to link to category page from phtml?

texts:
I have a category page called "team", which is nested in my menu structure.

How can I link to that page and url, from within a phtml page elsewhere? I am of course wanting it to be dynamic.

For images I've been using:

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).

but I am currently braindead on how to do that with category pages.

(side note - I use multi-language, multi-views.)


texts: Magento store wise order, customers and login

texts:
I am fully aware of Magento multi-store, multi-website functionality.  what I am looking for is store wise admin.  It means someone with admin credential can log in into my store and he can see only orders and customers of that stores.

For example:
There is one website A which have stores  store1, store2 and store 3.

store1, store2 and store 3 have different admin login credentials.  if I login in store 1 I can see orders of that store, customers and pages. I can not see the customers and order of store 2 and store 3.

Need help how to manage this.  is it possible with Magento? is there any module for that?


texts:
I got a problem in my Testunit in Magento I can't figure out the problem

This is the File
Mode.php

<?php
namespace Mxxxx\Category\Plugin\Model\Category\Attribute\Source;

use Mxxxx\Category\Model\Category\Category;

/**
 * Class Mode
 * @package Mxxxx\Category\Plugin\Model\Category\Attribute\Source
 */
class Mode
{
    /**
     * @param \Magento\Catalog\Model\Category\Attribute\Source\Mode $subject
     * @param $result
     * @return mixed
     */
    public function afterGetAllOptions(
        \Magento\Catalog\Model\Category\Attribute\Source\Mode $subject,
        $result
    ) {
        $result[] = ['value' => Category::DM_BUFFER_PAGE, 'label' => 'Buffer page'];
        return $result;
    }
}

This is the File of Unit Test
ModeTest.php

<?php
namespace Mxxxx\Category\Test\Unit\Plugin\Model\Category\Attribute\Source;

use Mxxxx\Category\Model\Category\Category;
use Mxxxx\Category\Plugin\Model\Category\Attribute\Source\Mode;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

class ModeTest extends \PHPUnit\Framework\TestCase
{
    private $model;

    public function testAfterGetAllOptions($subject, $validResult)
    {
        $validResult = ['value' => Category::DM_BUFFER_PAGE, 'label' => 'Buffer page'];
        $this->assertEquals(\Magento\Catalog\Model\Category\Attribute\Source\Mode );
    }

    protected function setUp()
    {
        $helper = new ObjectManager($this);
        $this->model = $helper->getObject(
            Mode::class
        );
    }
}

When I run the unit test using this command

./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Mxxxx/Category/Test/Unit/Plugin/Model/Category/Attribute/Source/ModeTest

I got this error

E                                                                   1 / 1 (100%)

Time: 14.26 seconds, Memory: 10.00MB

There was 1 error:

1) Mxxxx\Category\Test\Unit\Plugin\Model\Category\Attribute\Source\ModeTest::testAfterGetAllOptions
ArgumentCountError: Too few arguments to function Mxxxx\Category\Test\Unit\Plugin\Model\Category\Attribute\Source\ModeTest::testAfterGetAllOptions(), 0 passed and exactly 2 expected

/shared/httpd/Mxxxx/magento-v2/app/code/Mxxxx/Category/Test/Unit/Plugin/Model/Category/Attribute/Source/ModeTest.php:12

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Thanks in advance


texts: I was wondering if there was a way to add a video thumbnail on a product landing page. I know that there are extensions out there that allows me to put a video in the product detail page, but I want a video to automatically play when I hover over a product image. Suggestions are greatly appreciated.


texts: Magento 2 - admin backend not working correctly in production mode

texts:
I switched my store from development to production mode with
php bin/magento deploy:mode:set production

Then I executed
grunt clean
php bin/magento setup:static-content:deploy de_DE

But this is how my backend looks like:

If I click for example on "CATALOG", then usually a slider shows with multiple options, but nothing happens if i click on it.


texts: Magento 1.9 : When I tap thumbnails it doesn't change main image in mobile view only

texts:
When I tap in catalog page thumbnails (different views of products), It must change accordingly, but it shows the same image with url suffix "#" .
It only happens in mobile view, tablet view and in MAC.
It is working fine in Desktop view.
The URL of my website is https://mirakin.com/globe-trotters/europe-2019.html
when I click on thumbnails of any product ,URL changes to https://mirakin.com/globe-trotters/europe-2019.html#
Please help me to resolve it.
I have gone through the flex slider java script.
I am using Magento 1.9

Please mail me to my email id developer@mirakin.com (if possible).

Thank you in advance


texts: Set a COOKIE in Observer and use it in Javascript

texts:
I have an Observer for customer_login event where I want to set a cookie based on informations from customer session.

public function login(Varien_Event_Observer $observer)
{
    $customerData = Mage::getSingleton('customer/session')->getCustomer();
    $quote = $customerData->getQuotingEnabled();
    $cookie = Mage::getSingleton('core/cookie');
    $cookie->set('cookiename', 'cookievalue' ,time()+86400,'/');

    return true;
}

How it is possible to access that cookie in a javascript file? If I alert(getCookie('cookiename')); it just gives me null. In the Observer the cookie it is set.


texts:
How to set required field

    <form action="<?php echo $this->getUrl('modulename/index/controlleraction') ?>" id="requestfish">
    <input type="hidden" name="form_key" value="<?php //echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
    <input type="text" name="name" placeholder="Name" required="true" />
    <input type="email" name="email" placeholder="Email" required="true"/>
    <input type="mobile" name="mobile" placeholder="Mobile" required="true"/>
      <?php $addfish = Mage::getStoreConfig('mps_requestfish/enable/addfish');
        $array =  explode(',', $addfish);
        foreach ($array as $item) {
            echo "
<input class='the-terms' type='checkbox' class='checkbox required-entry' value='$item'>$item</input>
";
        }?>
    <textarea name="comment" id="comment" placeholder="Comment"></textarea>

    <input type="submit" value="enter" />

</form>

it add required for all Checkbox. In that if one checkbox i miss it show's error how to over come this?


texts: Magento 2 - How to custom calculate amount of order when user login?

texts: In Magento 2, How to custom calculate total amount of order when user login?


texts: custom customer attribute value in the e-mail template

texts:
I have install Clarion_CustomerAttribute and I don't know how to recall attribute value in the e-mail template

I have tried Address Templates configuration and nothing.

I use Port theme.


texts: Pagination in Custom Collection magento 2

texts:
I am retrieving data from third party as an object,
I am forcefully converting an object into array and collection.

I want to apply pagination with the data, I tried using core pagination logic and setting it into magento 2 but sometimes count doesn't work properly like if no data exists still pagination shows page number dropdown.

Here is the code I have done:

protected function _prepareLayout()
    {
        parent::_prepareLayout();
        $this->pageConfig->getTitle()->set(__('Coupons'));

        if ($this->getCouponBookOrderHistory()) {
            $pager = $this->getLayout()->createBlock(
                'Magento\Theme\Block\Html\Pager',
                'test.news.pager'
            )->setAvailableLimit(array(10=>10,15=>15))->setShowPerPage(true)->setCollection(
                $this->getCouponBookOrderHistoryTotal()
            );
            $this->setChild('pager', $pager);
            $this->getCouponBookOrderHistory()->load();
        }
        return $this;
    }

    public function getPagerHtml()
    {
        return $this->getChildHtml('pager');
    }
    public function getCouponBookOrderHistory()
    {
        $customerId = $this->customer->getCustomer()->getAcwCustomerId();
        /*echo '
';
        print_r($customerId);*/
        $result = array();

        $result = $this->coupons->getCouponBooks($customerId);

        //63498
        $result = (array)$result;
        //get values of current page
        $page=($this->getRequest()->getParam('p'))? $this->getRequest()->getParam('p') : 1;
        //get values of current limit
        $pageSize=($this->getRequest()->getParam('limit'))? $this->getRequest()->getParam('limit') : 10;

        $total = count( $result ); //total items in array
        $limit = $pageSize; //per page

        $totalPages = ceil( $total/ $limit ); //calculate total pages
        $page = max($page, 1); //get 1 page when $_GET['page'] <= 0
        $page = min($page, $totalPages); //get last page when $_GET['page'] > $totalPages
        $offset = ($page - 1) * $limit;
        if( $offset < 0 ) $offset = 0;
        $result = array_slice( $result, $offset, $limit );

        $master = array();
        array_push($master, $result);
        $collection=$this->_collectionFactory->create();
        // print_r($master); die;

        foreach($master as $row){
            $varienObject = new \Magento\Framework\DataObject();
            $varienObject->setData((array)$row);
            $collection->addItem($varienObject);
        }
        return $collection;
    }
public function getCouponBookOrderHistoryTotal()
    {
        $customerId = $this->customer->getCustomer()->getAcwCustomerId();
        /*echo '
';
        print_r($customerId);*/
        $result = array();
        $result = $this->coupons->getCouponBooks($customerId);
        //63498

        $result = (array)$result;
        $master = array();
        array_push($master, $result);
        $collection=$this->_collectionFactory->create();
        // print_r($master); die;

        foreach($master as $row){
            $varienObject = new \Magento\Framework\DataObject();
            $varienObject->setData((array)$row);
            $collection->addItem($varienObject);
        }
        return $collection;
    }

In my phtml file:

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

<?php echo $block->getPagerHtml(); ?>

<?php endif ?>

I have created 2 functions getCouponBookOrderHistoryTotal() for fetching total proper count so pagination works and other to fetch data from array using array_slice but I am missing something.

Can anyone help me out how can I directly convert this to apply filters to collection, I know
I tried like this:

// $collection->setPageSize($totalPages);
// $collection->setCurPage($page);

but still It didnt applied to filters as well.


texts: How to change the dropdown option on a product page?

texts:
I want to change the dropdown option on the product page.
Like there is a dropdown of size and I want that dropdown to change into the image icon of small, medium and large.
And when I click on the size option say small the related color images will appear below just like the default functionality of the magento.
Can anyone know how to do this.


texts: What is the definition of a frontend model and backend model

texts:
I see methods like getBackend* and getFrontend, could some one be able to define what the a backend/ frontend model is and its responsibilities?

Just really to give a definition in my head of what it is. I presume a back end model is related to the admin interface?


texts:
i am using following code in view.phtml :

$sellerProductInfo = $this->getSellerProductInfo($productowner['userid']);

if ($sellerProductInfo->getSize() == 0) {
$rowsocial= Mage::getModel('marketplace/userprofile')->getPartnerProfileById($productowner['userid']);
} else {
 $sellersProductInfo = $this->getSellerProductInfo();
 if ($sellersProductInfo->getSize() > 0) {
   $sellerId = $sellersProductInfo->getFirstItem()->getSellerId();
   $rowsocial = Mage::getModel('marketplace/userprofile')->getPartnerProfileById($sellerId);
 }
}

but i am getting error : Fatal error: Call to a member function getSize() on a non-object in line : if ($sellerProductInfo->getSize() == 0)


texts: Product names not updating in Magento 2.1.0

texts:
Porto theme

We have 2 stores (I just added a new one). In the new store - I initially put in 5 products:

The first one with the correct product name but the other 4 with:

Product 1
Product 2
Product 3
Product 4

as the names of the products.

I later changed those, deleted all the Cache and successfully re-indexed the main store/domain with SSH (Putty):

  php bin/magento indexer:reindex

But the products still show the old Product names (Product 1, 2, 3, and 4) INSTEAD of what it actually shows in:

Products --) Catalog --)  Product Name


texts: How to override payment.xml file from module-payment

texts: How to override following xml file vendor/magento/module-payment/etc/payment.xml in magento 2.x


texts:
I am trying to bulk upload images for products
I am getting the following error:

  imported resource (image) could not be downloaded from external
  resource due to timeout or access permissions in row(s): 1

The product uploading works fine via csv but images are not uploading via csv. I have attached an image for reference. there are total 56 products.

I have removed pub/media/import from the csv as well but that didn't make a difference, the folder permission is 711, the magento version is 2.2.5


texts: Magento 2: Show disabled/out-of-stock products in foreach loop

texts:
I am using \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory class to fetch the product collection.

  Magento version: 2.2.6

I am trying to fetch both enabled & disabled products with the following code

  status > 0, as in Magento, Enabled = 1 and Disabled = 2

$collection = $this->productCollection
                   ->addAttributeToSelect('*')
                   ->addAttributeToFilter('status', array('gt' => 0));

When I print the product collection data:

echo '
';
print_r($collection->getData());
echo '
';

I get the following result:

Array
(
    [0] => Array
        (
            [entity_id] => 27
            [attribute_set_id] => 4
            [type_id] => virtual
            [sku] => my-product-905546
            [has_options] => 0
            [required_options] => 0
            [created_at] => 2018-12-04 10:18:06
            [updated_at] => 2018-12-04 10:20:31
        )

    [1] => Array
        (
            [entity_id] => 26
            [attribute_set_id] => 4
            [type_id] => virtual
            [sku] => test-123-897069
            [has_options] => 0
            [required_options] => 0
            [created_at] => 2018-12-03 06:38:39
            [updated_at] => 2018-12-04 09:57:10
        )
)

In the above product result:

one of the product is disabled and out-of-stock (sku: my-product-905546)
the other product is enabled and in-stock (sku: test-123-897069)

When I loop through the product collection, it only prints the enabled product name.

foreach ($collection as $product) {
    echo $product->getSku();
    echo '
';
}

Result:

test-123-897069

Expected Result:

my-product-905546
test-123-897069

Why is this so?

Any solution to print the disabled/out-of-stock product inside the foreach loop (load both enabled and disabled products into the collection) please?


texts: I delete the category and the product detail page which belong to the category are not found!

texts:
I deleted a category and the product detail page which belong to the category are not found. It's a blank page now.

When I go to admin panel and edit the product's category and save it, the problem is solved.

But there are so many product pages that I can't edit one by one, is there another solution?


texts:
Without any reason my site stopped working. I've been trying to start the reindexing process, but it isn't working, only "Design Config Grid" can be reindexed:

user@serv [~/public_html]# php bin/magento indexer:status
Design Config Grid:                                Reindex required
Customer Grid:                                     Reindex required
Category Products:                                 Reindex required
Product Categories:                                Reindex required
Product Price:                                     Reindex required
Product EAV:                                       Reindex required
Stock:                                             Reindex required
Catalog Rule Product:                              Reindex required
Catalog Product Rule:                              Reindex required
Catalog Search:                                    Reindex required
user@serv [~/public_html]# bin/magento indexer:reindex catalog_category_product
user@serv [~/public_html]# php bin/magento indexer:status
Design Config Grid:                                Reindex required
Customer Grid:                                     Reindex required
Category Products:                                 Reindex required
Product Categories:                                Reindex required
Product Price:                                     Reindex required
Product EAV:                                       Reindex required
Stock:                                             Reindex required
Catalog Rule Product:                              Reindex required
Catalog Product Rule:                              Reindex required
Catalog Search:                                    Reindex required
user@serv [~/public_html]# bin/magento indexer:reindex design_config_grid
Design Config Grid index has been rebuilt successfully in 00:00:00
user@serv [~/public_html]# bin/magento indexer:reindex cataloginventory_stock
user@serv [~/public_html]# php bin/magento indexer:status
Design Config Grid:                                Ready
Customer Grid:                                     Reindex required
Category Products:                                 Reindex required
Product Categories:                                Reindex required
Product Price:                                     Reindex required
Product EAV:                                       Reindex required
Stock:                                             Reindex required
Catalog Rule Product:                              Reindex required
Catalog Product Rule:                              Reindex required
Catalog Search:                                    Reindex required
user@serv [~/public_html]# php bin/magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:00
user@serv [~/public_html]#

Any idea what should I do next? And what is the reason of this issue?


texts: What Js is deploying inline style to Submenu/Top navigation

texts:
I made some changes to a Top navigation (changing ul.submenu to div.submenu), all is fine, but I cannot find where in a Js is setup this inline style:

style="display: none; top: 53px; left: -0.453125px;"

It is part of this code:

<ul class="level0 submenu ui-menu ui-widget ui-widget-content ui-corner-all" role="menu" aria-expanded="false" style="display: none; top: 53px; left: -0.453125px;" aria-hidden="true">

I tried to find it in

magento/theme-frontend-blank/web/js/navigation-menu.js

but no luck.

I want to change this so that:

left: 0;
width: <calculate based on a platform used>;

Any help?


texts: Split the quantity box into three categories

texts:
I want to split the quantity text box into three text boxes,i.e., for child, adult and others separatly before add to cart for only bundled products. I did by adding the following code in the addtocart.phtml

 <?php if ($_product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE): ?>
            <?php echo $this->__('Adult Qty:') ?>
            <input type="text" name="qty" id="adult-qty" maxlength="12" value="1" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
            <?php echo $this->__('Child Qty:') ?>
            <input type="text" name="qty" id="child-qty" maxlength="12" value="1" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
            <?php echo $this->__('Infant Qty:') ?>
            <input type="text" name="qty" id="infant-qty" maxlength="12" value="1" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
        <?php endif; ?>

Now what i need is have to add these three quantities and save as a total quantity. Also have to view child,adult and others quantities separately in teh shopping cart page. Can anyone have idea on this?


texts: How to add this functionality on field limiter

texts: Also should have the display number of products on a page be: (20, 50, 100, all)


texts:
I am very new in magento and cracking my head for a week now. I would like to modify the checkout where some products/categories are not allowed to be shipped to some countries. I have seen a script online (thanks to the owner), it works fine with the default checkout page but it hangs when using a checkout extension. This is the Onepage Code, could you please enlighten me of what might be the best approach for this? Or what class to extend to override the checkout extension?

    <?php
       class Prohibited_Model_Onepage extends Mage_Checkout_Model_Type_Onepage {

    protected $Restricted_Countries = array(
        'SA', // Country Codes
        'CA'
    );

    protected $Restricted_Categories = array(
        62, // Category IDs
        30,
        40
    );

    protected $Error_Message = 'Shipping of these products are not available for this country.';

    public function saveShippingMethod($shippingMethod)
    {
        $quote = $this->getQuote();
        $country = $quote->getShippingAddress()->getCountry();
        if(in_array($country, $this->Restricted_Countries)){
            foreach ($quote->getAllItems() as $item) {
                $product = Mage::getModel('catalog/product')->load($item->getProductId());
                foreach ($this->Restricted_Categories as $cat_id) {
                    if(in_array($cat_id, $product->getCategoryIds())){
                        Mage::getSingleton('checkout/session')->addError($this->Error_Message);
                        Mage::throwException($this->Error_Message);
                        exit();
                    }
                }
            }
        }
        return parent::saveShippingMethod($shippingMethod);
    }
}

This is the config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Prohibited>
            <version>0.1.0</version>
        </Prohibited>
    </modules>
    <global>
        <models>
            <prohibited>
                 <class>Prohibited_Model</class>
            </prohibited>
            <checkout>
                <rewrite>
                    <type_onepage>Prohibited_Model_Onepage</type_onepage>
                </rewrite>
            </checkout>
        </models>
    </global>
</config>


texts:
tl;dr:  I want the black simple product image to show up when black is chosen from layered nav in any category, but when clicked to still navigate to the configurable.

Scenario:

We operate a store that sells dresses. We sell many dresses from many designers. We sell many sizes of many dresses in many colors.  For merchandising reasons we want to display a de-facto color (say, black) as the color of the product image on our configurable product. We have product shots in all of the colors, but the configurable product is set up to only have, say, the product shots with the color black.

We have colors configured in two attributes - color, and simplified color. Color would be the actual name of the designer's color - e.g. Burnt Sienna vs. Orange - but for the purposes of navigation we would like the layered navigation to display full counts of product colors by their primary color name. This attribute is a dropdown/global type as we use it for the pivot for simple-configurable association.

Problem:

When any color is chosen from the sidebar we want to display relevant images from the attributes on the simple products. In essence, if you click orange, we want to show the orange dress - not the black dress that also potentially comes in orange.  The same would be true for all other colors.

We have tried various plugins (Amasty Configurable Products, Gomage Navigation) and they all work well to improve the behavior and UX of configurable products in Magento, but the only way to get a black dress to show up when black is clicked that we have found so far is to set up multiple configurables, one for each product color, that have the images swapped out.

If clicked, the user is directed to the configurable product, preferably with the displayed color pre-selected (though this is not a hard requirement).

Questions:

What is the recommended configuration to achieve the above?
Is there a 3rd party tool to handle this - we would prefer this option, actually
Is there an argument to be made that from a UX perspective this is overkill or unnecessary?


texts:
A question for any magento devs:

Why is it that an enabled product has status 1, while a disabled product has a status of 2? Usually, "enabled" or "active" or whatever gets the status 1, while the converse is 0. Is there a reason why magento uses 2 here instead?


texts: CE1.9 Dashboard issues: Sales data wrong and missing info

texts:
Am having some issues in a CE1.9 dashboard whereby sales are under-reported by over 10% and customer names are missing from the last 5 table.

By way of background.

I upgraded from CE1.7 to 1.9 before Xmas in a convoluted process.

Basically, I:
- copied production/live DB
- installed CE1.9 over it, upgrading the tables
- new theme, new extensions
- installed all this in subfolder (old site in root)
- cut over with some rewrites etc

All was well until I noticed customer names weren't appearing in orders on the dashboards (but are definitely there) and the dashboard total is about 10% off.

I exported all sales to CSV and the numbers are correct.

I've cleared cache, refreshed lifetime stats to no avail. The payments are all via Paypal so it ought not be the issue. (?)

One thing I will note is in between replicating the site and building it, production continued taking orders, so I just migrated all customer, sales and inventory tables over.

Seemed fine until some sales went AWOL around 10 days ago, after running fine post-cutover for about 10 days.

Here's a screen cap of missing data.

Has anyone seen this before?


texts: Magento2 addFieldToFilter, Need 'and' and 'Or' in sql

texts:
I need magento sql collection.
Query need like that.
select * from custom_table where customer_id=xx or (customer_group=1 and custom_field=1)
I can add or operator like below
select * from custom_table where customer_id=xx or (customer_group=1)
But needs to and operator with second OR.
My Current collection:
   $collection = $this->customTableFactory->create()->getCollection()->addFieldToFilter(
       ['customer_id','custom_field'],
   [
       ['eq' =>$customerId],
       ['eq' =>1]
   ]);

Query From above collection:
SELECT main_table.* FROM custom_table AS main_table WHERE ((customer_id = 'xx') OR (custom_field = 1))
But I want collection like as below: Need to add And condition in second OR
SELECT main_table.* FROM custom_table AS main_table WHERE ((customer_id = 'xx') OR (custom_field = 1 and customer_group=1))
Please help me if anyone get solution.
Thanks!


texts: Magento 2.3.5-p1 CSP font-src self unsafe-inline

texts:
In regarding to CSP I create own csp_whitelist, but still I am getting:

  The Content Security Policy 'font-src 'self' 'unsafe-inline';
  form-action secure.authorize.net test.authorize.net
  geostag.cardinalcommerce.com geo.cardinalcommerce.com
  1eafstag.cardinalcommerce.com 1eaf.cardinalcommerce.com
  centinelapistag.cardinalcommerce.com centinelapi.cardinalcommerce.com
  'self' 'unsafe-inline'; frame-ancestors 'self' 'unsafe-inline';
  frame-src secure.authorize.net test.authorize.net
  geostag.cardinalcommerce.com geo.cardinalcommerce.com
  1eafstag.cardinalcommerce.com 1eaf.cardinalcommerce.com
  centinelapistag.cardinalcommerce.com centinelapi.cardinalcommerce.com
  www.paypal.com www.sandbox.paypal.com https://js.stripe.com/
  https://www.googletagmanager.com/ https://www.google.com/ 'self'
  'unsafe-inline'; img-src widgets.magentocommerce.com
  www.googleadservices.com www.google-analytics.com t.paypal.com
  www.paypal.com www.paypalobjects.com fpdbs.paypal.com
  fpdbs.sandbox.paypal.com *.vimeocdn.com s.ytimg.com
  https://stats.g.doubleclick.net/ data: 'self' 'unsafe-inline';
  script-src assets.adobedtm.com js.authorize.net jstest.authorize.net
  secure.authorize.net test.authorize.net geostag.cardinalcommerce.com
  1eafstag.cardinalcommerce.com geoapi.cardinalcommerce.com
  1eafapi.cardinalcommerce.com songbird.cardinalcommerce.com
  includestest.ccdc02.com www.googleadservices.com
  www.google-analytics.com www.paypal.com www.sandbox.paypal.com
  www.paypalobjects.com t.paypal.com js.braintreegateway.com s.ytimg.com
  video.google.com vimeo.com www.vimeo.com cdn-scripts.signifyd.com
  www.youtube.com https://js.stripe.com/v3/
  https://www.googletagmanager.com/gtm.js
  https://www.google.com/recaptcha/api.js https://www.gstatic.com/
  'self' 'unsafe-inline' 'unsafe-eval'; style-src getfirebug.com 'self'
  'unsafe-inline'; object-src 'self' 'unsafe-inline'; media-src 'self'
  'unsafe-inline'; manifest-src 'self' 'unsafe-inline'; connect-src
  geostag.cardinalcommerce.com geo.cardinalcommerce.com
  1eafstag.cardinalcommerce.com 1eaf.cardinalcommerce.com
  centinelapistag.cardinalcommerce.com centinelapi.cardinalcommerce.com
  'self' 'unsafe-inline'; child-src 'self' 'unsafe-inline'; default-src
  'self' 'unsafe-inline' 'unsafe-eval'; base-uri 'self'
  'unsafe-inline';' was delivered in report-only mode, but does not
  specify a 'report-uri'; the policy will have no effect. Please either
  add a 'report-uri' directive, or deliver the policy via the
  'Content-Security-Policy' header.

Can I fix it using csp_whitelist.xml?

Edit:
I tried to add some those domains as host to font-src, but it doesnt solve issue. I mean, domains didn`t disappear from warning

.

EDIT && Solutions:

For issue I wrote here (The Content Security Policy 'font-src 'self' 'unsafe-inline';). It is enough to set up report_uri in Your csp_whitelist.xml file.

For issue with data:xxx is enough to add

<policy id="font-src">
    <values>
        <value id="data" type="host">data:</value>
    </values>
</policy>

to Your csp_whitelist.xml file.
Of course You should add data: policy depends on scope where You have problem (policy id should be changed for example to img-src etc).
It is necessary to set is as host, cause right now Magento doesn`t read any other types.


texts: How to get current currency symbol in multi-currencies magento 2

texts:
I am trying to show item price with symbol in override email template on order create, and my site have euro and $ both currency.

Is there any way to get current currency symbol, Please share if have.


texts: Equivalent of the CMS Directive {{media url="..."}} in Normal Block Templates

texts: What is the equivalent of {{media url="wysiwyg/image.jpg"}} which can be used in CMS pages if we want to use this in a normal .phtml file (of the type core/template)


texts: How to get the payment details in magento2

texts:
I have added account number field in payment data.

I need to display it under payment details in sales_order_view, sales_order_invoice, sales_order_creditmemos.

SO, I have choosen magento/payment/block/info/instruction block...but i can't get the payment details in all mentioned layouts.

How do that... Or else any other way for do it.

Ideas welcome...


texts: Magento 2: How to include custom js file in phtml file

texts:
How to include js file in phtml file.

eg:

if(some text){
 add js file here.....
}

Any idea?

Thanks


texts: Is it possible to send email from observer using SMTP

texts:
Is it possible to send email to customer when he place an order

this is my event.xml

<?xml version='1.0'?>
<config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='urn:magento:framework/Event/etc/events.xsd'>
   <event name='checkout_onepage_controller_success_action'>
        <observer
                name='Pulsestorm_HelloWorldMVVM_HelloWorld'
                instance='Pulsestorm\HelloWorldMVVM\Observer\HelloWorld'
        />
    </event>
</config>

and this is my observer

<?php

namespace Pulsestorm\HelloWorldMVVM\Observer;

use Magento\Framework\Event\ObserverInterface;

class HelloWorld implements ObserverInterface
{
    /**
     * @var ObjectManagerInterface
     */
    protected $_objectManager;
    protected $_orderRepositoryInterface;

    /**
     * @param \Magento\Framework\ObjectManagerInterface $objectManager
     */
    public function __construct(
        \Magento\Framework\ObjectManagerInterface $objectManager,
        \Magento\Sales\Api\OrderRepositoryInterface $orderRepositoryInterface
    ) {
        $this->_objectManager = $objectManager;
        $this->_orderRepositoryInterface = $orderRepositoryInterface;
    }

    /**
     * customer register event handler
     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return void
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {

    $orderIds = $observer->getEvent()->getOrderIds();
    $order = $this->_orderRepositoryInterface->get($orderIds[0]);
    $items =$order->getAllVisibleItems();
    $productIds = array();
    foreach($items as $item) {
        $productIds[]= $item->getProductId();
    }

    //custoemr id
    $customerEmail = $order->getCustomerEmail();

   }

}

In $customerEmail i got customer mail id after that i have no idea how to send email using SMTP


texts:
How to hide  add to cart  button   for particular products on all page in magento 2

To hide add to cart button all page  using a below plugin:

  di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Model\Product">
        <plugin name="hidebutton" type="Vendor\Module\Plugin\HideButton" sortOrder="10" disabled="false"  />
    </type>
</config>

  HideButton.php

 <?php

    namespace Vendor\Module\Plugin;
    use Magento\Catalog\Model\Product;

    class HideButton
    {
        public function afterIsSaleable(
        \Magento\Catalog\Model\Product $subject,
        $result
    ) {
       if($subject->getId() == 36)
       {
         return false;
       }
       else
       {
        return  true;
       }

    }
    }

Above plugin works well but its shows an "Out of Stock" instead of "Add to cart"
 in listing and home page  how to hide a "out of stock" text.


texts: 1.9 - Redirect customer group to CMS page

texts:
I am trying to redirect a specific customer group to a single CMS page. Not just after logging in, but whenever they try to go to any page, it will just redirect them to the CMS page.

The only file I figured I could add code is in header.phtml.

$customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();

    if($customerGroupId == 5){

            $redirect_url = Mage::getUrl('uhoh');
         Mage::app()->getFrontController()->getResponse()->setRedirect($redirect_url)->sendResponse();
    }

This is what I currently have. It's purpose works, but it's not exactly what I want. The purpose is for a "blocked" customer group. This code sends the user into an endless redirect, but I want to have information displayed on the CMS page, which means no page is useless despite actually blocking the group from using the site.

Is there an issue with the code? Or would it be easier and more effective to create a module for this?


texts:
I've a form that performs an Ajax call to a controller, but the response always is You entered an invalid Secret Key. Please refresh the page.

  PereiraTech/Faturamento/Controller/Adminhtml/Ac/Index.php

<?php

namespace PereiraTech\Faturamento\Controller\Adminhtml\Ac;

class Index extends \Magento\Backend\App\Action
{
    /**
     * @var \Magento\Framework\Controller\Result\JsonFactory
     */
    protected $resultJsonFactory;

public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
        )
    {
        parent::__construct($context);
        $this->resultFactory = $resultJsonFactory;
    }

    public function execute()
    {
        return $this->resultJsonFactory->create()->setData(['a' => 'b']);
        //return 'test string';
    }

    public function indexAction(){

        //echo 'test string';
    }
}

  PereiraTech/Faturamento/view/adminhtml/web/js/form/element/options.js

define([
    'jquery',
    'uiRegistry',
    'Magento_Ui/js/form/components/button',
    'Magento_Ui/js/modal/modal'
], function ($,uiRegistry, select, modal) {
    'use strict';

    return select.extend({

    action: function(){
            var ajaxRequest;
            var param = 'ajax=1';
            ajaxRequest = jQuery.ajax({
                url: "http://localhost/magento/admin_ptech/faturamento_fat/ac/index",
                type: 'GET',
                data: {param, form_key: window.FORM_KEY},
                dataType: 'json'
            });
                //Show successfully for submit message
            ajaxRequest.done(function (response, textStatus, jqXHR) {
                console.log(textStatus);
                console.log(response);
            });

                //On failure of request this function will be called
            ajaxRequest.fail(function (xhr, status, error) {
                console.log(status);
                console.log(error);
                console.log(xhr.responseText);
                //show error
                console.log('rou');
            });
            return this._super();
        },
    });
});

  routes.xml

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

If I call just /faturamento_fat/ac/index/ I receive the dashboard html, so I've put the full url to post method.

Edit: If I change from GET to POST, the returned value is a 500 Internal server error problem


texts: How to Avoid Direct object instantiation for default library

texts:
I used default library of soap. I created a object using new keyword:

new \SoapVar(
            $this->merchantId,
            XSD_STRING,
            null,
            $nameSpace,
            null,
            $nameSpace
        );

but in magento2 Direct object instantiation is discouraged. So how can I get the object of new \SoapVar without calling it directly.


texts: Uncaught TypeError: Cannot call method 'select' of null in magento admin customer grid

texts:
I know there were similar problems like this but each and every problem is different.

I recently move my site to new server.

After that i am getting error(console) in magento customer grid.

Error is Uncaught TypeError: Cannot call method 'select' of null and accordian is also not loading properly.

I get this error after i click on each customer.

May be for this reason i am getting 500 internal server error on that page.

Memory limit is given in .htaccess in 512MB &
   permission is given 777 to all js->mage->adminhtml


texts: Checkout shipping address always shows State/Province

texts:
On Magento2 checkout I wish to hide the State/Region box for addresses to the UK.
I have the state/region box set to be hidden for countries that don't need it yet it shows when my default country is set to the UK. This is not the expected behaviour.

If I change country to somewhere else and then back to the UK again the box is gone.
I have tried to work out what to call at startup to rectify this behaviour but I have no idea what is going on due to the complexity of Magento2 and how it has been over-engineered in checkout with many, many things.
Backend options.

How do I fix this?


texts: How to add custom js to the order_status.phtml

texts: I want to add custom js to the order_status.phtml file. where to add the js file and link it to the order_status.phtml


texts: Price-box.js overriding via Mixin bug - Magento 2.3

texts:
Overriding 'Magento_Catalog/js/price-box' via mixin works in only Chrome and I can't understand why. Other jQuery widgets overriding works fine (breadcrumb, swatch-renderer)

$path-to-theme / requirejs-config.js

var config = {
  config: {
    mixins: {
      'Magento_Catalog/js/price-box': {
        'Magento_Catalog/js/custompricebox': true
      },
    }
  }
};

$path-to-theme / Magento_Catalog/web/js/custompricebox.js

define([
  'jquery',
  'Magento_Catalog/js/price-utils',
  'underscore',
  'mage/template',
  'jquery/ui'
], function ($, utils, _, mageTemplate) {
  'use strict';

  return function (priceBox) {
    return $.widget('mage.priceBox', priceBox, {
      _init: function () {
        this._super();
        console.log('Hello theme!');
      }
    });
  }
});

And it's works only in Chrome. Screenshots:

Chrome:

Firefox:


texts: Magento : I Can Not Find Local Code Pool

texts:
I am trying to create a new module using this tutorial
 http://www.codexpedia.com/magento/create-read-update-and-delete-with-magento-database/

But in the second step we have to go to local folder but I cannot find local folder. It only has core and community.

This is what it says:

anuja@anuja-VirtualBox:/var/www/html/magento/app/code$ cd /var/www/html/magento/app/code/
anuja@anuja-VirtualBox:/var/www/html/magento/app/code$ ls

community  core

What should I do?


texts: Can a virtual type be used as a dependency for a class?

texts:
I'm trying to do something new with virtual types. I understand that you can create these in your di.xml and use them as arguments for other types in di.xml. But can I also declare a virtual type and use it in a constructor in a PHP class?

For example: I'm trying to do something like this:

<virtualType name="Vendor\Module\Logger\Handler"
             type="Magento\Framework\Logger\Handler\Base">
    <arguments>
        <argument name="filePath" xsi:type="string">/var/log/custom.log</argument>
    </arguments>
</virtualType>

And:

public function __construct(
    \Vendor\Module\Logger\Handler $logger
) {
    $this->logger = $logger;
}

But this does not work. I also tried:

<preference for="Vendor\Module\Logger\Handler" type="custom_logger"/>
<virtualType name="custom_logger"
             type="Magento\Framework\Logger\Handler\Base">
    <arguments>
        <argument name="filePath" xsi:type="string">/var/log/custom.log</argument>
    </arguments>
</virtualType>

With the same PHP code, but the results are the same. I get a ReflectionException that class Vendor\Module\Logger\Handler does not exist.

I find this odd, because the way I always understood, the Object Manager uses reflection to see what classes are required in the constructur, and uses the di.xml configuration on it's turn to bring this back to a class. So why isn't this working with a virtual type?


texts: Confirmation email not sending to some of my customer

texts: Not sure what was wrong some of my customer are complains that they does not received their order confirmation emails, But when i tried to test it it works fine my side, i have tested with most of gmail hotmail yahoo id. I am suffering a lot by this issue, Can someone suggest me some idea how to overcome this issue to make a fix, thank-you.


texts: ifconfig does not work in  tags in Magento 2

texts:
ifconfig does not work in <css /> tags in Magento 2.

0 (Magento\Framework\Config\Dom\ValidationException): Element 'css', attribute 'ifconfig':

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Namespace_Module::css/ultra-megamenu/additional.css"
            ifconfig="ultramegamenu/mobilemenu/hide_blocks_below" />
    </head>
</page>

How to fix this ?


texts:
When creating a new dropdown attribute:

Magento claims that the attribute option is missing.  But what's missing?


texts: Product page load without main product image, but server return error 500

texts: My product pages are loading fine, but almost 2 or 3 products load photos without the main product image, the rest of the page load fine but using debug tools the browser report error 500


texts: Redirect to Previous page after FB Login

texts:
I'm using below function for redirection after FB login, But it's redirecting to Customers Account Dashboard, Instead of Account Dashboard I'd like to redirect to Home Page or the Previous Page.

 protected function _loginPostRedirect()
 {
    $session = Mage::getSingleton('customer/session');

    if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl()) {
        // Set default URL to redirect customer to
        $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());

    } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
        $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());
    } else {
        if (!$session->getAfterAuthUrl()) {
            $session->setAfterAuthUrl($session->getBeforeAuthUrl());
        }
        if ($session->isLoggedIn()) {
            $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
        }
    }
    $this->_redirectUrl($session->getBeforeAuthUrl(true));
}

I've tried

  $session->setBeforeAuthUrl(Mage::helper('customer')->getHomeUrl());

  $session->setBeforeAuthUrl(Mage::helper('customer')->getCurrentUrl());

But it's not working


texts: how to update Items Ordered order qty in magento 1

texts:
how to update order Items qty in admin panel?
(magento 1.9)


texts: Magento2 CE Memory limit has been reached when saving product

texts:
When changing settings in a product I get the message:

Memory limit has been reached magento-2

Why is that and what causes this? Is it a problem in the version 2.0.9 I have running? Or is it because of the php settings which are not suitable?
How to solve this? Any hints?


texts: Magento 2 Chekout - Inline translate the labels of Ui Components

texts:
Is there anyway to make the labels of Ui components added to the checkout via layout.xml (static) or LayoutProcessor (dynamic) inline translatable?

I tried adding translate="true" to the xml element so it'd look like below but it does not work.
<item name="label" xsi:type="string" translate="true">Label1</item>

In the LayoutProcessor I changed the 'label' => 'Label1', to 'label' => __('Label1'), there's no luck either.


texts: Creating copy of same product in different stores programmatically?

texts:
I have a scenario where I need to import translations of a product in different stores. At first this product exists in a single store, but after sometime when the translations will be available it has to be in other stores as well but with different information. I am working mainly with the text based fields, and can allow information like price etc to be same for all copies. I have done this previously in magento-1.9 but I am unable to figure it out yet with magento-2.1.8.

I have already tried setStoreId() method prior to saving the product but it is not helping much. Along with that I have also used the setWebsiteIds() but it will create product in different websites not in stores. Basically what I want is whenever the user select different store views he will get the required information of the product accordingly.

$this->storeManager->setCurrentStore($targetStoreId);
        $product = $this->productFactory->create();
        $product->setSku('mysku-' . $targetStoreId)->setAttributeSetId($oldProduct->getAttributeSetId())
            ->setPrice($oldProduct->getPrice());
        foreach ($data as $key => $value) {
            $product->setData($key, $value);
        }
        try {
            $product->getResource()->save($product);
        } catch (\Exception $ex) {
            var_dump($ex->getMessage());die;
        }


texts: Why does magento need to load all labels from universe to build color swatches?

texts:
I'm working on a store that has 23k of possible color values.
But, they are not used on every product of course.

Now, that we are working on 1.9.2.1, that has native swatches, I see that the produt page tooks 3 minutes to load.

It's because _loadOptionLabels method of Mage_ConfigurableSwatches_Model_Resource_Catalog_Product_Attribute_Super_Collection, that loads all of 23k colors each time a single product page is loaded.

Does anyone experienced the same problem, or have a guess of how to optimize it?

I also tried to clean all unused option values, but still take so many time to load and using Resource_Iterator to speed up foreach, but didn't work. The problem is the big query.


texts: Add sublabel or hover text to Custom Option

texts: I need to give the customer aditional information regarding the custom option. How can I add a hover text (to the label) or add a sublabel (additional text) under the label title of the custom option?


texts: Is there a quicker way to test css.less changes?

texts:
When making changes to my css.less file for my extension, I have to keep clearing my Static Files to see the css changes take effect in the browser.

I'm already in Developer Mode, but is there a quicker way to view my changes when I refresh my browser other than clearing the Static Files each time I make a change I want to see?


texts: How to Show Out of stock and discontinued items at last position in product listing

texts:
Can anyone please suggest on this .

I have more than 50k products in my website and I have created an attribute name "Discontinued Items" with yes/no option to show the product status like in stock or out of stock so there is no need to disable the products for SEO purpose if product is not longer exist in warehouse.

Now I want to list products in the below order at category page and search result page also product order  should be work with sort by filter(position, price, product name) options .

In stock Products
Out if stock Products
Discontinued Products

Currently I am using magento 2.2.3 version.

Can anyone please give the suggestion how it will be done.


texts:
I am debugging magento 2.3.1 before releasing it to production and I find that some products respond slowly and others make it faster. (then I will update it to 2.3.2)

In particular I have a query that takes 24 seconds to respond and I do not know what is wrong.

Can you help me ?

SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_flat_1` AS `e` INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 INNER JOIN `catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN `cataloginventory_stock_item` AS `at_inventory_in_stock` ON (at_inventory_in_stock.`product_id`=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) WHERE (e.entity_id IN((SELECT `cat`.`product_id` FROM `catalog_category_product` AS `cat` WHERE (cat.category_id IN('4', '40', '45'))))) AND (e.entity_id != '204031')

  SELECT COUNT(DISTINCT e.entity_id) FROM catalog_product_flat_1 AS e INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 INNER JOIN catalog_category_product_index_store1 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN cataloginventory_stock_item AS at_inventory_in_stock ON (at_inventory_in_stock.product_id=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) WHERE (e.entity_id IN((SELECT cat.product_id FROM catalog_category_product AS cat WHERE (cat.category_id IN('4', '40', '45'))))) AND (e.entity_id != '204031')


texts: How to Send email automatically once order complete?

texts:
Hi guys and girls just wondering how do you get Magento to send an email by itself once the order has been marked completed?

Also, whilst im at it: does magento have the capacity to edit the order statuses?

want to remove some of these statuses: they are not needed.

Okay, so I have been digging in further but no closer to the answer, but possible question which in return could help is how do I edit the list of filter options for order status?


texts: How can I implement e-commerce datalayer on success page?

texts:
I have installed Google Tag Manager and want to add an additional datalayer for ecommerce tracking on success page which contains the transition id, product specific data like sku, price, name, quantity and so on.

I want something like this for my success page after open body tag (pseudocode):

<body>
<script>
   <?php
       if ( $this->getOrderId() ) $transactionId = $this->getOrderId();
       $currentOrder = Mage::getResourceModel( 'sales/order_collection' )->byId( $transactionId );
       $transactionAffiliation = Mage::app()->getStore()->getFrontendName();
       $transactionTotal = $currentOrder->getTotal();
       $transactionTax = $currentOrder->getTax();
       $transactionShipping = $currentOrder->getShipping();
       $transactionProducts = $currentOrder->getProducts();
   ?>
   dataLayer = [{
     'transactionId': <?php echo "'".$transactionId."'" ?>,
     'transactionAffiliation': <?php echo "'".$transactionAffiliation."'" ?>,
     'transactionTotal': <?php echo $transactionTotal ?>,
     'transactionTax': <?php echo $transactionTax ?>,
     'transactionShipping': <?php echo $transactionShipping ?>,
     'transactionProducts': [
      <?php foreach( $transactionProducts as $product ): ?>
         {
         'sku': <?php echo "'".$product->getSku()."'" ?>,
         'name': <?php echo "'".$product->getName()."'" ?>,
         'category': <?php echo "'".$product->getCategory()."'" ?>,
         'price': <?php echo $product->getPrice() ?>,
         'quantity': <?php echo $product->getQuantity() ?>
         },
      <?php endforeach; ?>
      ]
  }];
</script>
...

So I have to replace this pseudocode with "real" Magento code to get the order details on succes page. But which correct functions should I use to implement this?

Hope you can help me :)


texts: 2 observers - How does the system decide which runs first

texts: If you have 2 extensions each with an observer on newsletter_subscriber_save_after how does the system decide which extension runs first?


texts: Magento 2 How to add onKeyUp to a text field in customer checkout address form?

texts: I want to add a auto complete function to the customer checkout address form, but I found that the address fields are rendered by knockout js, I can't add the "onKeyUp" attribute directly. How can I add the "onKeyUp" to the textfield in the checkout form?


texts: Need to override Mage_Core_Block_Abstract function _toHtml()

texts:
I have 4 different stores in the same Magento system, so I have 4 different themes. One of them is overriding on /code/community/mage/cms/block/block.php the function _toHtml() like this:

protected function _toHtml()
    {
        $blockId = $this->getBlockId();
        $html = '';
        if ($blockId) {
            $block = Mage::getModel('cms/block')
                ->setStoreId(Mage::app()->getStore()->getId())
                ->load($blockId);
            if ($block->getIsActive()) {
                /* @var $helper Mage_Cms_Helper_Data */
                $helper = Mage::helper('cms');
                $processor = $helper->getBlockTemplateProcessor();
                $html = NovaWorks_ThemeOptions_Helper_Filter::applyFilters($block->getContent(), array('object' => 'a', 'context' => 'page'));
                $html = $processor->filter($html);
            }
        }
        return $html;
    }

As you can see, this function is using this: NovaWorks_ThemeOptions_Helper_Filter::applyFilters($block->getContent(), array('object' => 'a', 'context' => 'page'));

which is an specific function of one of the themes. Rest of websites aren't working fine because of this function.

How can I do that to make that only one website/theme uses this function?

Many thanks.


texts: Magento2: Create Multi Select UI Field on Frontend as Admin

texts:
How to create a multi-selector dropdown with Category on frontend side as Admin Add Product Page.
Shown as here screenshot

I am trying this Tutorial Multi-selector on Frontend as admin side

But is not working I don't understand how to make a multi-selector

Can anyone guide me slightly or suggest me any link?

Thanks


texts: Configurable product sorting by ID in Magento 1.9.2

texts:
I have Magento 1.9.2 and a configurable product with size options (S,M,L,XL) those options are associated simple products. At the moment Magento is sorting the options by ID.

Is there anyway to sort by a specified order that I give?


texts: How to set cookies in Magento for WWW domain

texts:
I'm trying to make sure I have set the Cookie Domain correctly. I have my website set up for https://www.example.com. I have the Cookie Domain right now set like this: .example.com When I look at the cookies in Chrome I see cookies like .www.example.com (from _ga I think that is Google Analytics), and some like this, www.example.com (from cookies_lhc.js, that is from my Live Help Chat), and some like this: .example.com from "frontend".
The way I understand it, is that the "dot" stands for subdomains and www is considered a subdomain. I read elsewhere that I need to set the cookies like this: .www.example.com but that seems strange as any subdomains would be sub.www.example.com, but subdomains would really be like www.sub.example.com ...correct?

When I set the cookies like wwww.example.com without the dot I can't log in Magento admin. But I don't understand why Google adds cookies .wwww.example.com It looks like all these cookies need to be the same. I seems to work the way I have it but I don't have any subdomains set up yet (I have to upgrade my hosting for that, but soon). I don't know if there are long term ramifications to getting this wrong, there isn't really much information I can find on it. So should it be

www.example.com, .example.com, or .www.example.com

Do all the cookies need to match?


texts: Magento 2: I need to add a field to order form that will allow us to manually enter a shipping amount?

texts:
Need to add a field to order form that will allow us to manually enter a shipping amount?

Any idea?
Thanks


texts: very stanger order id, what is the cause for it

texts:
our system is magento 1.9, i found a stranger order#, 100005583, what is the reason?

Thank you

SongS


texts: how to add custom block in the module replacing configurable.phtml

texts:
I have created a custom module in order to add some functions to only configurable products page , I saw that I have configurable.phtml so i tried to create configurable_1.phtml and make my changes there
do i need to have a controller for this? I don't even know if I need that or not because I don't need to use any routers for that... but I need to have more functions on configurable products
 in local folder I created the module as fallow:

<config>
    <modules>
        <Scosche_ColorSwitch>
            <version>0.0.1</version>
        </Scosche_ColorSwitch>
    </modules>
    <global>
        <blocks>
            <scosche_colorswitch>
                <class>Scosche_Block_Product_View</class>
            </scosche_colorswitch>
        </blocks>
    </global>
</config>

also module is enabled I can see it in admin panel.

in catalog.xml I have this block for configurable.phtml:

 <reference name="product.info.options.wrapper">
            <block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml"/>
        </reference>

as a solution I did this:

   <reference name="product.info.options.wrapper">
         <remove name="product.info.options.configurable"></remove>
      <block type="catalog/product_view_type_configurable" name="product.info.options.configurable.scosche" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable_1.phtml"/>
     </reference>

It is working but I do not want to use the type of catalog/product_view_type_configurable I want the block type to come from my custom block that I created which is:

<block type="scosche_colorswitch/product_view" name="product.info.options.configurable.scosche" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable_1.phtml"/>

Unfortunately when I do this it does not work.


texts: Delete Configurable rather than Simple product on checkout_cart_product_add_before event

texts:
Im using
checkout_cart_product_add_before

observer event to call a class that removes the product from the card and re-adds it. I required this because i needed the quantity to equal what was entered in the qty text box rather than add it to the total (eg if cart qty was 10, and i put 5 in the qty box the default Magento2 functionality would make the quantity in the cart 15 - my script makes it 5)
The issue is it is only working for simple products, when it comes to configurable products (a product that might have 2 color swatches black and green) it is removing the whole product and re-adding the new configarable (for example if i have qty 5 of blue shirt, i add qty 8 of green shirt it removes the blue shirt completly and adds the green shirt.
I have wrapped my script in if not configurable to stop this happening but does anyone know how i can edit this script to remove the configurable id rather than the simple?
namespace XX\XX\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use \Magento\Checkout\Model\Session as CheckoutSession;
use \Magento\Checkout\Model\Cart;

class DeleteAndReAddFromCart implements ObserverInterface
{
    protected $request;
    protected $_cart;
    /** @var CheckoutSession */
    protected $checkoutSession;

    public function __construct(\Magento\Framework\App\RequestInterface $request, cart $cart, CheckoutSession $checkoutSession)
    {
        $this->_cart           = $cart;
        $this->request         = $request;
        $this->checkoutSession = $checkoutSession;

    }
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $product = $observer->getProduct();

        $productId = $observer->getProduct()->getId();
        $prodtype = $observer->getProduct()->getTypeId(); //is configarable or simple

        $items     = $this->_cart->getItems();
        $itemCount = count($items);
        if ($itemCount > 0) {
            foreach ($items as $item) {

                if ($prodtype != 'configurable') {
                    if ($item->getProduct()->getId() == $productId) {
                        $itemId = $item->getItemId();
                        $item->isDeleted(true);
                        $this->_cart->save();
                    }
            }
            }
        }

    }
}


texts: 2.1.8 CE - Unable to set attribute set for new product

texts:
I have a clean install of Magento CE 2.1.8 and then imported my data from Magento 1.9. Now when I want to add new products on my old attribute sets which were created on M1, page is loading over and over and I got below message in chrome dev tool console.

  Uncaught TypeError: Cannot read property 'length' of undefined
      at UiClass.getNewData (dynamic-rows-grid.js:180)
      at UiClass.initElements (dynamic-rows-grid.js:86)
      at setNested (objects.js:43)
      at Object.nested (objects.js:117)
      at UiClass.set (element.js:301)
      at updateValue (links.js:57)
      at Function.notifySubscribers (knockout.js:1103)
      at Function.observable.valueHasMutated (knockout.js:1300)
      at UiClass.observable [as recordData] (knockout.js:1285)
      at setNested (objects.js:43)


texts: Magento 2 remove unused product attribute values

texts:
Is it possible to remove any unused product attribute values? All the answer I find seem to be related to magento 1 and not 2.

I have a product attribute called size and it has around 100 different values connected to it. However I am not sure which ones are used and which ones are not. Therefore I would like to run a script or a sql statement to run to remove all of the ones which aren't connected to any products


texts: Have a option to enable/disable the module. I need to load admin page css when my module is enabled. No need to load css while module is disable

texts:
I write css in path
app/code/my/module/view/adminhtml/layout/default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="My_Module::css/menuformat.css"/>
    </head>
</page>

Above code apply menuformat.css to all the admin pages whether my module is enabled or not

I am replacing

<css ifconfig="My_Module/general/enabled" src="My_Module::css/menuformat.css"/>

It returns error

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'css', attribute 'ifconfig': The attribute 'ifconfig' is not allowed.

How can i write?. I need css only active when my module is enable otherwise no need .

I am using magento 2.2

I have a option to enable and disable the module . while click enable/disable button it reflects core_config_data table . Based on the table data i need to load the css . If enable load , disable no need to load the css.


texts: How to override top menu css in Magento 2?

texts:
I want to override top menu CSS and replace it with my own CSS.

  I don't know which CSS file is responsible to display top menu.
  I only need to override CSS and don't want to make any changes to the top menu.


texts:
I have one question about showing products. I dont want to show products for guest user. Even when they search for those products they will not get that. Only logged in user will get those.

Can anyone give me some tips how we can implement this?


texts: If I manually apply a patch due to an error when trying to install the patch via SSH, should I update the "applied_patches" file manually also?


texts: I need to create a search bar on sales order view page in customer login magento 2.3

texts:
I need to search and filter the orders in sales order page customer side as like admin side also need the search box. But i can't find any related documentations or solutions. whether this can do in this page magento 2.3
Result to be :


texts: Magento 2: Automatically cancel pending orders older than 10 minutes

texts:
How to do automatically cancel payment_pending orders in Magento 2.

Older than 10 minutes + status is Payment_pending.

This is my code

<?php

   namespace Arnavcancleorder\Cancleorder\Cron;

   use Magento\Sales\Model\Order;

   class CancelPendingOrders

   {

protected $logger;

/**
 * Constructor
 *
 * @param \Psr\Log\LoggerInterface $logger
 */

public function __construct(\Psr\Log\LoggerInterface $logger)
{
    $this->logger = $logger;
}

/**
 * Execute the cron
 *
 * @return void
 */

public function execute()
{
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $orders = $objectManager->create('\Magento\Sales\Model\Order')
               ->getCollection()
               ->addFieldToFilter('status', 'pending_payment');
               ->addFieldToFilter('updated_at', array('lt' =>  new Zend_Db_Expr("DATE_ADD('".now()."', INTERVAL -'10' HOUR)"))) ;

              foreach ($orders as $order) {

              $order->cancel()->save();

               }
            }

}


texts:
I try to override getSelectionTitlePrice() - function.
(vendor/magento/module-bundle/Block/Catalog/Product/View/Type/Bundle/Option.php)

if i have understood right the best way to do it is use preference.
Have been following lot of answers from everywhere but could not solve the problem.
How to Override Core Block, Model and controller in Magento2

when i override getProduct() - function (/Block/Product/View.php) everything work but with getSelectionTitlePrice() - function it doesn't

I tried to solve problem using Plugin but it just extend function not override it?!?

app/code/MySpace/MyModule/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option" type="MySpace\MyModule\Block\Catalog\Product\View\Type\Bundle\Option" />
</config>

app/code/MySpace/MyModule/Block/Catalog/Product/View/Type/Bundle/Option.php

<?php
namespace MySpace\MyModule\Block\Catalog\Product\View\Type\Bundle;

/**
* Bundle option renderer
*/

class Option extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option
{

public function getSelectionTitlePrice($selection, $includeContainer = true)
{
    /** will be removed **/
        $logger = \Magento\Framework\App\ObjectManager::getInstance()->get('\Psr\Log\LoggerInterface');
        $logger->debug('Block Override Test');
    /** will be removed **/

    $priceTitle = '' . $this->escapeHtml($selection->getName()) . '';
    $priceTitle .= ' &nbsp; ' . ($includeContainer ? '' : '')
        . $this->renderPriceString($selection, $includeContainer) . ($includeContainer ? '' : '')
        .' xxx->getTaxPercent(fromSomewhere)';
    return $priceTitle;
 }
}


texts: Magento 2 visual swatch doesn't show if I use Price slider

texts: I'm using magento 2 and I've installed a module for the price slider , is the emizentech price slider , but when I enable it , the visual swatch from the sidebar disappear , but not from the product listing or product page , just from the sidebar , how can I get them having also the price slider ? I've tryed to compare the files before and after enableing the module , and I've made some changes , but still not showing up..


texts: How can we pass table to an html variable in php code? Magento2 TCPDF

texts:
I am using TCPDF Library to get PDF Downloadable. I have to pass retrieved data through loops to single vaiable as:

$tcpdf->writeHTML($html, true, false, true, false, '');

I have to pass these values to $html varibable:

$html = '
'.'Order Number:    '.$OrderId.'
Customer Name:    '.$customerName.'
Item Name:    '.$itemName.'
';

but I have multiple records and have to pass this information many time through loops.

This is the table I want to pass from template to $html variable(PDF object):

Order Pick List

Col 1
Col 2
Col 3

<?php $Orders= $block->getOrders();
    foreach ($Orders as $order) {
        $Colone = $order->getID();
        $Coltwo = $order->getName();
        $items = $order->getitems();?>

            <?php echo $Colone; ?>
            <?php echo $Coltwo; ?>

            <?php foreach ($items as $item ) {
                $itemName = $item->getitemName();?>

                    <?php echo $itemName; ?>

            <?php } ?>

    <?php}
 ?>

Any help should be appreciated.


texts: Backend (Products / Catalog): Show all bundle items (no pagination please)

texts: we need a better overview on the product page (edit mode) and need to view all bundle items without pagination (for better sorting). How can I disable pagination and show all bundle items of the (bundle) product? Is there a config file? Do I have to edit a script file? I'm a web developer so I don't need a long explanation how to do it, I think - just a hint where to look at. Thanks for helping out!


texts:
I've got in a custom module created on module/view/frontend/layout/default.xml with:

<block class="\Magento\Framework\View\Element\Template" template="sample:module::sampletemplate.phtml" name="sampleblock" cacheable="false" _isScopePrivate="true"/>

I think that if i put the cacheable="false" to dont let the block to be cached, but it's not working.

How could i could remove cache of this block?


texts: When I am installing Magento 2.0.7 the Next button of the Web Configuration page is not working. When i click on Next it stay on the same page, no error message appearing on the page. What should I do? Please help me.


texts:
I have to change the paypal refund order state.
At moment the status is set to in progress. But I need complete.

So, i review the \Magento\Sales\Model\Order\Payment::refund method,
but this has no action, if the refund came from paypal.

Anyone an idea?


texts: what folders and files in module is reason for creating tables in database?

texts:
I saw one module folders and files in magento connect. in that only etc, Helper, & Module folder is present.

but there is no sql folder. but still that module created a text box in backend , so  that we can enter the zip codes in textfield and its going to be save in database.

so what is the reason behind that table. also how to find what is name of table craeted by that module ?


texts: Price not updating in cart when the store is switched to another magento

texts:
We have magento1.9 installed. In this site we have products with multiple options. We have added custom price for the options and it works fine. The product with the custom options and a total price can be added to the cart. The custom price is set using the code

$quote_item->setOriginalCustomPrice($new_price['price'])

My magento is multi language store with different currencies. The base price is in GBP. When we switch it to a different store the cart currency is updated but the price remains the same, it does not decrease or increase respectively with respect to the store currency.