texts: Notice: Undefined index: inventory_stock on magento setup:upgrade

texts:
I was following the below tutorial https://www.integer-net.com/make-magento-2-small-again/ and removing modules etc from magento and trying to get setup:di:compile to work in my dev environment. Everything seemed fine (other than compilation) for a bit however after fiddling (removing modules and adding them back trying to get setup:di:compile to work) for a while I started getting below issue:

Running bin/magento setup:upgrade below error shows during Schema creation/updates:

Schema creation/updates:
Notice: Undefined index: inventory_stock in /var/www/magetest/public_html/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 152

I restored all the modules (did not work) and I tried reindexing however that had no effect. Then restored an old database etc however the problem persists continuously.

The problem seems to be due to a missing table however that table seems to exist in my database. I'm running Magneto 2.3.3 however the backup database that i've had to go back from are a 2.2.7 instance that i'm now trying to upgrade.

I've also tried stating a fresh new vanilla instance and update the old database however the issue persisted again when running setup:upgrade.

I have also tried updating from 2.2.7 to 2.3.0 instead in hope that would fix however same error agian. I am out of ideas and so any simple suggestions to fix this may help me save some time!

UPDATE

OK really unhappy with what I had to go to fudge this into operation but will explain an may help someone figure out a better fix.

So I conditionally removed out the section which was giving an error for the case where the reference table was "inventory_stock":

  Magento\Framework\Setup\Declaration\Schema\Db\SchemaBuilder;

        foreach ($referencesData as $referenceData) {
            //Prepare reference data
            if($referenceData['referenceTable'] != "inventory_stock") {
                $referenceData['table'] = $table;
                $referenceTableName = $referenceData['referenceTable'];
                $referenceData['column'] = $table->getColumnByName($referenceData['column']);
                $referenceData['referenceTable'] = $this->tables[$referenceTableName];
                $referenceData['referenceColumn'] = $referenceData['referenceTable']->getColumnByName(
                    $referenceData['referenceColumn']
                );

                $references[$referenceData['name']] = $this->elementFactory->create('foreign', $referenceData);
                //We need to instantiate tables in order of references tree
                if (isset($tables[$referenceTableName]) && $referenceTableName !== $tableName) {
                    $this->processReferenceKeys([$referenceTableName => $tables[$referenceTableName]], $schema);
                    unset($tables[$referenceTableName]);
                }
            }
        }

For some reason the build function was not adding the table "inventory_stock" to the tables array and when trying to process reference keys for the table  "inventory_stock_sales_channel" the referenceTable "inventory_stock" did not exist so threw an error (not sure if the table shuoldn't of existed in referenceData and so threw an error because of reverse of above).

Removing the above was just a test but allowed me to get to another error about cannot create the "inventory_stock" table as it already existed.

So I decided to remove it from DB and let Magento recreate it properly.

I then removed the mod above and tried again and all worked. I had to recreate stock codes as was getting errors about stock codes not existing.

Feel this is a long way around and recreating the table correctly may have been the easiest approach however nothing seemed to work for me until Magento created it. Or possibly just deleting the table but sure I tried that.


texts: Magento 1.9.2.3 won't send order confirmation email based on shipping/payment method

texts:
After upgrading a magento website from 1.9.0.x to 1.9.2.2/3 Magento has stopped sending the order confirmation email when a customer picks anything but the icepay (iDeal) payment option. The other payment options are banktransfer, free shipping (used as an option to pay in their physical store) and cash on delivery.

The cron is configured properly and the core_email_queue table is empty, and when send from the backend it also sends out the email. I have placed some logging in the email process and it seems it never actually gets to trying to send anything even though Magento claims it has send the email.

We are also using mandrill to send email and the mandrill logs are also empty, there are no warnings/exeptions related to the email process in any of the log files either.


texts: Redirect to Checkout after ShoppingCart > New Account Creation - Magento 2

texts:
When a user places an order, then click to checkout, then has to choose to create an account...after he or she submits the form it redirects to account dashboard page (even i chose in settings of magento not to do it).

I want it to redirect to checkout after the user creates an account. (i mean the user creates it after they put items in cart and want to check out).


texts:
How can we apply custom class for landing page and product page?
Ex: i want 100% width on landing page and custom width on product page


texts: Magento 2 . How to hide 'Add to cart' button while not logged in

texts:
This is how I tried but its not working
Bodak/DisableAddToCart/etc/adminhtml/system.xml

    <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>

            <group id="frontend">
                <field id="catalog_frontend_disable_add_to_cart_for_guest" translate="label comment" type="select" sortOrder="250" showInDefault="1" showInWebsite="1" showInStore="1">
                    Disable Add to cart button for Guests
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>

    </system>
</config>

Then in Bodak/DisableAddToCart/etc/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">
    <type name="Magento\Catalog\Model\Product">
        <plugin name="Bodak_IsSalablePlugin::after" type="Bodak\DisableAddToCart\Plugin\IsSalablePlugin"/>
    </type>
</config>

Then after that Bodak/DisableAddToCart/Plugin/IsSalablePlugin.php

<?php

declare(strict_types=1);

namespace Bodak\DisableAddToCart\Plugin;

use Magento\Framework\App\Http\Context;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

/**
 * Class IsSalablePlugin
 *
 * @category Plugin
 * @package  Bodak\DisableAddToCart\Plugin
 */
class IsSalablePlugin
{
    /**
     * Scope config
     *
     * @var ScopeConfigInterface
     */
    protected $scopeConfig;

    /**
     * HTTP Context
     * Customer session is not initialized yet
     *
     * @var Context
     */
    protected $context;

    const DISABLE_ADD_TO_CART = 'catalog/frontend/catalog_frontend_disable_add_to_cart_for_guest';

    /**
     * SalablePlugin constructor.
     *
     * @param ScopeConfigInterface $scopeConfig ScopeConfigInterface
     * @param Context              $context     Context
     */
    public function __construct(
        ScopeConfigInterface $scopeConfig,
        Context $context
    ) {
        $this->scopeConfig = $scopeConfig;
        $this->context = $context;
    }

    /**
     * Check if is disable add to cart and if customer is logged in
     *
     * @return bool
     */
    public function afterIsSalable(): bool
    {
        $scope = ScopeInterface::SCOPE_STORE;

        if ($this->scopeConfig->getValue(self::DISABLE_ADD_TO_CART, $scope)) {
            if ($this->context->getValue(CustomerContext::CONTEXT_AUTH)) {
                return true;
            }
            return false;
        }
        return true;
    }
}


texts:
I am trying to find event when admin mass update product status from productgrid.

I have found catalog_product_status_update but this not seem to dispatch on bulk update of status.

I need event for observer to call extern webservice when product status change.

When i update single product from i have it working with catalog_product_save_after.

Any suggestions to help me archieve what i want?

This is what i have so far.

Config

<?xml version="1.0"?>
<config>
    <modules>
        <DM_Microcom>
            <version>0.1.0</version>
        </DM_Microcom>
    </modules>
    <global>
        <helpers>
            <microcom>
                <class>DM_Microcom_Helper</class>
            </microcom>
            <admin>
                <rewrite>
                    <data>DM_Microcom_Helper_Admin_Data</data>
                </rewrite>
            </admin>
        </helpers>
        <models>
            <microcom>
                <class>DM_Microcom_Model</class>
                <resourceModel>microcom_mysql4</resourceModel>
            </microcom>
        </models>
        <events>
            <catalog_product_save_after>
                <observers>
                    <catalog_product_save_after_handler>
                        <type>singleton</type>
                        <class>microcom/observer</class>
                        <method>SetWebVare</method>
                    </catalog_product_save_after_handler>
                </observers>
            </catalog_product_save_after>
            <catalog_product_status_update>
                <observers>
                    <catalog_product_status_update_handler>
                        <type>singleton</type>
                        <class>microcom/observer</class>
                        <method>SetWebVare</method>
                    </catalog_product_status_update_handler>
                </observers>
            </catalog_product_status_update>
        </events>
    </global>
</config>

Observer

<?php
class DM_Microcom_Model_Observer{

            public function SetWebVare(Varien_Event_Observer $observer)
            {
                $user = "USERNAMEHERE";
                $pass = "PASSHERE";
                $product = $observer->getProduct();
                $sku = $product->getSku();
                $newStatus = $product->getStatus();
                $oldStatus = $product->getOrigData('status');
                $status = ($newStatus == 2 ? 0 : 1);

                if ($newStatus != $oldStatus) {

                    $params = array(
                        'Brugernavn' => $user,
                        'Adgangskode' => $pass,
                        'VNr' => $sku,

                'Status' => $status
                );

                Mage::log('SetWebVare sku:' . $sku . '. Status: ' . $status, null, 'microcom.log');
                $soapclient = new SoapClient('http://example.com/webservices?wsdl');
                $response = $soapclient->V01_SetWEBVare($params);
            }
        }

}


texts:
My requirement is, to add Delivery Note section in cart page, I have an idea, when click "proceed to checkout" want to add it to cart session then checkout success should it save with order.

Any one have any idea about this, please give me an idea and events.


texts: Magento Hosting recommendations to speed up dynamic pages

texts:
We have a pretty huge and complex setup in Magento, but are experiencing some speed issues.

The static pages generally are not fast enough, although Varnish has been setup, which has helped quite a bit.
The dynamic pages are too slow - it takes up to 30 seconds to open up the payment window.

Our developers have optimized the site completely, and our host has upgraded the server and database several times, but it seems as if the communication between them, is not going as smoothly as it should, and we are now stuck.

What are your experiences with hosting? Do you have any recommendations?

We currently have 1000 visitors a day, and it's growing rather fast.

We currently have:
Firewall, 1 CPU, 512mb RAM
Loadbalancer, 1 CPU, 2GB RAM
Webserver, 2 CPU, 4GB RAM, Apache 2.4 and PHP-FPM 5.6
Data-server, 1 CPU, 2GB RAM
Db1-server, 6 CPU, 12GB RAM
Memcache server, 1 CPU, 512mb RAM


texts: Magento2 Change bundle item price in cart

texts:
I would like to change the price of the bundle product items after its has been added to cart and recalculate the bundle product price and changing the bundle item price.

I was thinking of using the checkout_cart_product_add_after event but I am not sure how to modify the bundle item prices.

I have seen some of the answers here but they show how to modify the bundle product price not the bundle item prices


texts:
Content security policies for custom modules can be added by setting up a csp_whitelist.xml file, i.e. app/code/Vendorname/Modulename/etc/cps_whitelist.xml, this is more or less excessively described in the docs.
However, the docs also mention

Configure CSPs for your custom code/extension/theme

Yet, I seem to be unable to get a working whitelist addition from within a custom theme, i.e. app/design/Vendorname/Themename/etc/cps_whitelist.xml?
etc/csp_whitelist.xml:
<?xml version="1.0" encoding="UTF-8"?>
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
    <policies>
        <policy id="style-src">
            <values>
                <value id="fontsGoogleapisCom" type="host">fonts.googleapis.com</value>
            </values>
        </policy>
    </policies>
</csp_whitelist>

This very same whitelist is working and brings me the expected result when moved to a custom module (i.e. app/code/Vendorname/ThemenameCsp).
Am I supposed to create a custom-theme-related custom module just to allow my custom theme to load an external font? Seems a bit nasty to me if that's actually the case.


texts: Magento 2 How to notify user when it's customer group has changed?

texts:
I want to find a solution for sending an email to the customer when the administrator in backend changes its customer group.
I have 3 customer groups, each one has different discounts in the store, so if I switch the user to another customer group, I want to send an email telling about the new discount.

I was thinking in an observer because I have made some observers to send an email with different events.
But what would it be the event for this situation? something like adminhtml_customer_update.

I also guess I would need to get the group where the customer is assigned.
Thank you!
Plugin code:

public function afterSetGroupId(\Magento\Customer\Api\Data\CustomerInterface $customer, $result)
    {
        //$groupId = $customer->getGroupId();
        //$this->sendYourCustomEmail($customer);

        $customer_group = $customer->getGroupId();
        /* Receiver Detail the person who is going to receive the info that user logged in*/
        $receiverInfo = [
            'name' => 'Admin',
            'email' => 'ovazquez@transom-group.com'
        ];

        $store = $this->storeManager->getStore();

       $templateParams = ['store' => $store, 'administrator_name' => $receiverInfo['name'], 'customer_group' => $customer_group];

        $transport = $this->transportBuilder->setTemplateIdentifier(
            'phpcuong_transactional_email_customer_group'
        )->setTemplateOptions(
            ['area' => 'frontend', 'store' => $store->getId()]
        )->addTo(
            $receiverInfo['email'], $receiverInfo['name']
        )->setTemplateVars(
            $templateParams
        )->setFrom(
            'general'
        )->getTransport();

        try {
            // Send an email
            $transport->sendMessage();
        } catch (\Exception $e) {
            // Write a log message whenever get errors
            $this->logger->critical($e->getMessage());
        }
    }


texts:
Input:  Given the array of dynamic values .

For EX:

i=array(1,2,3,4,5,6,7,8,9);

Expected Output: (array of i)/n

For EX:(array of i/3)

1)1,2,3

2)3,4,5

3)6,7,8

How to do this

Thanks


texts: Is a "special price" not the same as a "rule"?

texts: We use special pricing (and adding dates) a lot more than using a rule. So if I made a coupon code, with "stop further rules from processing" will it just make special priced products even lower basically ignoring the option?


texts: Is possible to delete folder var/session in Magento?

texts: I have 4.4 GB file in var/session folder. The free space is very limited so is possible to delete that folder?


texts:
If you want to create url rewrites programmatically what factory should you use?

Tried a few of them but none have the right methods (like setStoreId, save, setTargetPath and setRequestPath):

Magento\UrlRewrite\Model\UrlRewriteFactory or Magento\UrlRewrite\Model\ResourceModel\UrlRewriteFactory or
Magento/UrlRewrite/Service/V1/Data/UrlRewriteFactory (missing save method)

Thanks!

Update:
If these are the only factories available how does one save a rewrite?

For example if you use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory there is no save method:

$urlRewriteModel = $this->urlRewriteFactory->create();
$urlRewriteModel->setStoreId($storeId);
$urlRewriteModel->setTargetPath("yes");
$urlRewriteModel->setRequestPath("yes2");
$urlRewriteModel->save(); //this fails with no save method

Update2:

Thanks for the help, the final solution looks like this:
https://github.com/ClaudiuCreanga/magento2-store-locator-stockists-extension/blob/master/src/Model/UrlRewrite.php#L139


texts: how to customize form.mini.phtml in magento 2

texts:
I need to make some changes in form.mini.phtml

I found it here:

  vendor/magento/module-search/view/frontend/templates/form.mini.phtml

Where in my theme do I need to place that file to make changes?


texts: Adding new currencies in product lists page

texts:
My client wants to display 3 different formats of currency which should be displayed on the product list page. Here is the screen shot for reference.

Do you see that $23.00 on right side? My client wants to display Euro and INR values to be displayed right under that USD value. How to do that. I took USD as default currency and INR and Euro as allowed currencies and imported standard conversion rates by using webserviceex. Please help me out.... I'm not understanding that where should I add the following line of codes...

$baseCode = Mage::app()->getBaseCurrencyCode();
    $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
    $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
    var_dump($rates);

Help me


texts:
I have a magento site and would like a feature like this, where a customer can build there own unique piece of furniture.
the site below has something i thing would work

http://www.buildabasket.com/build

However since i am not a programmer, I was wondering if anyone knew how i could get the theme or extension information to continue my research as far as cost.


texts: Order Confirmation Observer Giving Internal Server Error Magento 2

texts:
Updated:

I am trying to make an observer which on order confirmation, prints This Works in debug.log file.

When clicking on Place Order in checkout, the Observer gives 500 Internal Server Error with this in console with this in the error log:

Fatal error:  Class 'My/Plugin/Observer/Dummy' not found in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 97

Also, my checkout hangs when clicked on Place Order.

My app/code/My/Plugin/Observer/Dummy.php File:

<?php

namespace My\Plugin\Observer;

use Magento\Framework\Event\ObserverInterface;

class Dummy implements ObserverInterface
{

    protected $_logger;

    public function __construct(
        \Psr\Log\LoggerInterface $logger,
        array $data = []
    ) {
        $this->_logger = $logger;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)    {
        $event = $observer->getEvent();
            $quote = $event->getQuote();
        $myfile = fopen("var/log/debug.log", "a+") or die("Unable to open file!");
        fwrite($myfile, print("This Works"));
        fclose($myfile);
    }
}

My app/code/My/Plugin/etc/events.xml File:

<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_save_commit_after">
        <observer name="my_sales_observer" instance="My/Plugin/Observer/Dummy" />
    </event>
</config>

Any Idea where am I doing wrong??


texts: Magento 2 : AddAttributeToFilter with AND Condition

texts:
In product collection, I want to do like :

$productCollection = $this->productCollectionFactory->create();
$productCollection->addCategoriesFilter(['in' => $catalog_id])->addAttributeToSelect('*');
$productCollection->addAttributeToFilter('color', ['eq' => 2650]);
$productCollection->addAttributeToFilter('size', ['eq' => 10]);

This above code working properly. But, my attribute collection will be dynamically. So, I want to do like just single addAttributeToFilter and this both filter apply.

How to do that?

Any help would be appriciated.


texts: can not display quantity_and_stock_status attribute in layered navigation in magento 2

texts: I have tried to set quantity_and_stock_status attribute to make filterable on the product list page. I have set it from the admin panel(Stores -> Attributes -> Product) but I can not see a stock filter on the front end. What could be the issue? Please provide a solution. Thank you


texts: $_item->getOptionByCode('simple_product') in Order Mail

texts:
In the checkout-cart (template/checkout/cart/item/default.phtml) I have this code:

$simpleProduct = $this->getItem()->getOptionByCode('simple_product')->getProduct();

I want to use the same code in the Order Mail (template/email/order/items/order/default.phtml)

<?php $_item = $this->getItem() ?>
...
$simpleProduct = $_item->getOptionByCode('simple_product')->getProduct();

This leads to this error:

PHP Fatal error:  Call to a member function getProduct() on a non-object

So how can I get the simple_product of configurable product in mail order?


texts: Trigger Content Update event javascript Magento 2?

texts:
I saw a lot of events trigger('contentUpdated'). For example: vendor/magento/module-catalog/view/frontend/web/js/catalog-add-to-cart.js. My question is:

Where is the function contentUpdated?
Can anyone give me a brief description about it?


texts: Why is the add to cart button not working on product page?

texts:
The add to cart button is not working on my product page, the following error shows up in the console:

Uncaught TypeError: Cannot read property 'submit' of undefined at HTMLButtonElement.onclick

This is the code on the add to basket button -

<button type="button" title="Add to Basket" class="button btn-cart" onclick="productAddToCartForm.submit(this)">Add to Basket</button>

Having had a look I think I may have found the reason that it is not adding to cart. The form which the button submits has a different id to the actual form. Is this the reason for not submitting? And if so, how do I change this?

<form action="https://cbccomputers.com/checkout/cart/add/uenc/aHR0cHM6Ly9jYmNjb21wdXRlcnMuY29tL3Bjcy1sYXB0b3BzLXRhYmxldHMvY29tcHV0ZXJzL3Bjcy9kZWxsLXZvc3Ryby0zMjY4LWkzLmh0bWw_X19fU0lEPVU,/product/61297/form_key/Qj8R0mDVuAViFpbP/" method="post" id="product_addtocart_form">

Relatively new to Magento and developing so any advice is helpful as it is quite urgent?

Thanks.


texts: How to copy file from one folder to another folder in Magento 2

texts:
I want to copy pdf file from one folder
i.e /pub/media/xyz to another /pub/media/abc programmatically.
And create target folder if does not exist.


texts: Magento:Save Product image from external url

texts:
I want to save a simple product programatically.I have used the following link http://inchoo.net/magento/programming-magento/programatically-manually-creating-simple-magento-product/

All fields are saved except image. The image url is from an external link as (for example) http://test12.net/test/public/uploads/shanks/shank-for-test-2.png

I want to copy the image and save as product image .Please help.


texts: How to restrict shipping address per product?

texts:
I want to restrict shipping per product. Is there maybe a way/module that makes the following possible:

Create an attribute called for example: restrictedcountries
Multiple choice box on product edit page so we can choose where the product CANNOT be shipped to.
Note on front-end where it says 'This product cannot be shipped to your country'
Extra possibility: to import/export CSV file with 2 rows: SKU and restrictedcountries
For example:

SKU,restrictedcountries

115,MY;NA;PG;VC;CH;AE;RS

253,MD;MP;RU;LK;TN;WF
GeoIP would also be handy, so a customer can see at the product page if this product can't be shipped to the customer's country.

Someone who know's how to do this would be very welcome!


texts: Get All Carrier Lists in a Core PHP file

texts:
Want to fetch all Carrier Names in a .PHP file
In a Core PHP file which is available in a inner folder of Magento,

For Ex. MagentoRootFolder/CorePHPFolder/File.php**

For Using Magento Code Externally I am using following Code :

<?php
require_once('../app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
// extra code
?>
<select>
    <?php
        // **Here I need Code** to Get *All Shipping Carrier List*
    ?>
</select>


texts: I m trying to integrate exotel COD app with my magento website which sends a confirmation to the customer when the order is placed. In order to integrate this app it requires a URL which returns http 200 when a order is made successfully or some other code when it fails. I wanted to ask whether magento does something like this on the backend? or how to i write a new script for this ?


texts:
Issue

I have a module that allows users to login as the customer (Spadar_Login). This modules uses user permissions. It works for admin roles and it prevents access to roles without permission. The issue is roles that are given permission do not work.  It receives "Access denied" as though it did not have permission.

Troubleshooting

Cache has been cleared and disabled, compilation disabled, logged out and in.

The message is displayed on the admin side, for an admin route calling an admin controller. I removed any isAllowed() check in controllers. The controller being called has had all code removed and the issue still occurs, which tells me the access is denied before it reaches the controller. I tried removing the acl tag in the config.xml but the issue still persists. I have triple checked the the user is in the right role, and that the role has permission to the user.

Code

Here is the acl in the etc/config.xml

    <acl>
        <resources>
            <admin>
                <children>
                    <customer>
                        <children>
                            <login>
                                <title>Login as Customer</title>
                            </login>
                        </children>
                    </customer>
                </children>
            </admin>
        </resources>
    </acl>

Here is the route

<admin>
    <routers>
      <spadarloginadmin>
          <use>admin</use>
          <args>
              <module>Spadar_Login_Adminhtml</module>
              <frontName>spadarloginadmin</frontName>
          </args>
      </spadarloginadmin>
   </routers>
</admin>

What is causing this user role not to be able to access this controller?


texts: Code before a controller's action is executed?

texts:
I would like to write some custom code before any actions in a controller is executed. It would seem like an easy one, but i am unable to find help anywhere in google. I tried to override preDispatch() function in my controller, but it ends up getting weird (instead of showing my page, it shows the default page without any content in it)

Its a admin controller and i need to do some custom validation before any action in it is executed. Based on the validation, the request may be forwarded to some other controller.


texts: Magento 2: Admin listing take long loading time on WAMP

texts:
I'm using Magento 2 CE Version 2.1.0. It's installed on WAMP on Windows 10 64- Bit.

However I have noticed, if there are only 3-4 records, still it takes long loading time (Approximately 15-20 seconds).

Did any one face this issue?

How to increase page loading time?


texts: Custom ajax not working in magento admin

texts:
I have created custom module for store credits, for this I have used ajax which are working at frontend but when calling adminhtml controller using ajax at admin it returns 404 not found error.

My config.xml is here :

<?xml version="1.0"?>
<config>
    <modules>
        <Assel_Customajax>
            <version>0.9.0</version>
        </Assel_Customajax>
    </modules>
    ...
    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <Assel_Customajax before='Mage_Checkout'>Assel_Customajax_Checkout</Assel_Customajax>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Assel_Customajax before="Mage_Adminhtml">Assel_Customajax_Adminhtml</Assel_Customajax>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
   ...
</config>

Ajax for calling controller at admin

new Ajax.Request("<?php echo Mage::getUrl('assel_customajax/adminhtml_credits/usecredits') ?>",
{
    method: 'post',
    onComplete: function(result)
    {
        ...
    }
});

I have created function in customajax/controllers/adminhtml/creditscontroller :

public function usecreditsAction()
{
   ...
}

But ajax return 404 not fount error.
How to call controller function successfully?


texts:
I am receiving the following error

Fatal error: Class 'Ns_Module_Model_Mysql4_Setup' not found in /Users/tony09uk/Sites/magentoDevTest/app/code/core/Mage/Core/Model/Resource/Setup.php on line 234

I have added this file in my config and the exact same file path has been created for the setup file

etc/config.xml

<global>
    <models>
        .....
    </models>

    <resources>
        <module_setup>
            <setup>
                <module>Ns_Module</module>
                <class>Ns_Module_Model_Mysql4_Setup</class>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </module_setup>
        .....
    </resources>

The file path is Ns_Module_Model_Mysql4_Setup

class Ns_Module_Model_Mysql4_Setup
extends Mage_Core_Model_Resource_Setup
{}

Why can't magento find this? I have checked the file paths are the same and checked the casing is the same, what am I doing wrong?


texts: Magento 2: Get names of all people who ordered the product

texts:
Our client would like to have names of all people who ordered a product included into the Out of Stock notification email. I seem to have issue with getting such info ...

Code I have to get the orders by product sku is (in helper):
($orderFactory is \Magento\Sales\Model\ResourceModel\Order\CollectionFactory)

public function getOrdersWithProductSku($productSku)
    {
        try {
            if ($productSku)
            {
                $orderCollection = $this->orderFactory->create();
                $tableName   = $this->orderFactory->getTableName('sales_order_item');
                $orderCollection->addFieldToSelect('*');
                $orderCollection->getSelect()
                ->join(
                    $tableName,
                    'main_table.entity_id = ' . $tableName. '.order_id'
                )->where('sku LIKE '.$productSku);

            $orderCollection->getSelect()->group('main_table.entity_id');

            return $orderCollection;
            }
        }
        catch (\Exception $e)
        {
            return [];
        }
    }

Then parsing that collection in the Observer as:

try
                        {
                            $orderCollection = $this->helperData->getOrdersWithProductSku($productSku);
                            if ($orderCollection && !empty($orderCollection))
                            {
                                foreach ($orderCollection as $order) {
                                    array_push($names, $order->getBillingAddress()->getName());
                                }
                            }
                            else
                            {
                                array_push($names, "Customer names list is either null or empty");
                            }
                        }
                        catch(\Exception $e)
                        {
                            array_push($names, "Error generating customer names: ". $e->getMessage());
                        }

Is there an easy way to do this .... simply get an array of names who ordered the product based on SKU

Thanks


texts: How to show advanced search in custom.phtml?

texts:
i am try to call advanced search in custom.phtml

<?php   echo $this->getLayout()->createBlock('catalogsearch/advanced_form')->setTemplate('catalogsearch/advanced/form.phtml')->toHtml()  ?>

like this when i try to search it goes to

http://127.0.0.1/magento-19/index.php/cms/index/result/?name=saf&description=&short_description=&sku=&price%5Bfrom%5D=&price%5Bto%5D=&type_cartridge=&merk=&eancode=

if i mannually add catalogsearch/advanced instead cms/index it shows me fine.

Pst: custom.phtml directly shows through cms/page

<p>{{block type="categorydrop/navigation" template="categorydrop/custom.phtml"}}</p>

so, how can i use advanced search in custom.phtml ?

also my default search is not working? i want to work as autosearch but its not show me result?

i use <?php echo $this->getChildHtml(‘topSearch’) ?> this in custom.phtml for use default search its not show me.

Thanks in advanced...


texts: How can I Auto reorder product when i choose only date of shipping in Magento frontend?

texts:
Users can re-order without the effort of re-ordering. Enter the date of every month when you want the products to be shipped in Magento.

Any idea, please??

How can I use recurring profiles in Magento??


texts: magento1 migrate to multiple magento 2 stores

texts:
Anyone knows what happen for all the migrate changes tables in m1, if I want to start migration to a new m2 store.
E.g. I migrated m1 data to the first m2 store and all the deltalog tables (with prefix m2_cl_*) and triggers (for tracking changes) have been created in the M1. Now I want m1 data to migrate to an another m2 store. What will happen will all the deltalog tables and triggers. Will they be dropped and recreated? I use Magento data migration tool.


texts: Magento Enhanced Ecommerce Google Analytics Implementation

texts: How do i implement enhanced ecommerce google analytics on magento?


texts: Custom extension adding extra step in the onepage checkout page

texts:
I am using magento 1.9.1.

I am working on a extensions which is allowing the users to pay part of they order, everything is cool and i've done everything what i wanted so far.

The next step that i should do is to create an extra step in the checkout onepage.

My extensions is located like that: /app/code/local/Vivas/PercentPayment/and here are all folders and files of the extension

My questions is how i can create new step in the onepage checkout from the extension. I mean i want to create the new extra step in the checkout's onepage from my extension files. Is that possible and how ?

Thanks in advance!


texts: Magento2: Product not added in cart by admin panel

texts:
When I add the new product in the cart by admin panel for the customer, Product is not adding.

Magento 2.0


texts: How to create customer attribute progrmatically in magento (not from setup script)

texts:
I have csv with customer attributes .

there is a button in the admin side.
when i click that button it should read csv & create all attrbutes in that csv.

I have idea to read csv file.but I'm not able to get syntax to create customer attributes programtically


texts: Indexing Not working after installed Smile Elastic search extension Magento 2

texts:
I have installed Smile Elasticsearch extension successfully.But i am not able to reindex catalogsearch_fulltext indexer.
I have installed elasticsearch successfully on my local server.

Please check below screenshots and let me know proper solution.
Please help!!!

Magento Version: 2.1.6
Module Version: 2.2.3
Elastic Engine: 1.7.2

Please check my configuration from below screenshot,
http://nimb.ws/Cu7aEX

Your help would be appreciated.!!!


texts: Is it legal to use Opensource modules with Magento Commerce?

texts:
I was just reading the Magento Commerce Software License Agreement v1 today. (https://magento.com/sites/default/files/magento-commerce-software-license-agreement.pdf)

Under the section 2B, it says

  Customers shall not (g) use any Copyleft Software in connection with
  the Software

Does this mean I cannot use any open-source modules or extensions on Magento Commerce? As far as I know, all popular open-source licenses like OSL are copyleft.


texts: How to send param to mui/index/renderer in listing grid

texts:
I'm building an admin grid, i'm sending a parameter to the controller, but when de datasource updates grid via ajax on mui/index/renderer, this url parameter is losing, how can i send this parameter to mui/index/renderer.
this is the datasource.

    <settings>
        <storageConfig>
            <param name="indexField" xsi:type="string">entity_id</param>
        </storageConfig>
        <updateUrl path="mui/index/render">
            <param name="indexField">entity_id</param>
        </updateUrl>
    </settings>
    <aclResource>Magento_Customer::online</aclResource>
    <dataProvider class="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider" name="customerdocs_wholesaler_documents_list_data_source">
        <settings>
            <requestFieldName>id</requestFieldName>
            <primaryFieldName>entity_id</primaryFieldName>
        </settings>
    </dataProvider>
</dataSource>


texts:
It is code to show category name in product listing.

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
$categories = $_product->getCategoryIds(); /*will return category ids array*/
foreach ($categories as $category) {
    $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category);
    echo $cat->getName();
}
?>

How would I get a category with a link?


texts:
We are developing our Magento site and wished to migrate over our company news stories.

Can anyone suggest a good extension to use for this purpose?


texts: What are the steps to send a email from customer to an admin in magento2

texts: My Requirement: I need to set General feedback link in footer in frontview , After clicking that link it would show a form, After submitting a form it will send a email to magento admin. Please help me What I need to do, How would I need to get the overview... Please provide me a solution


texts:
Has anyone tried to translate their magento one website?
We are looking at applejetty. Any suggestions?
Has anyone ever used applejetty or similar ?
Thanks


texts: Magento 2 - How to remove options from mass action in sales order page in admin?

texts:
I want to remove Print Invoices and Print Shipping Labels from mass action select menu available on order view page.

I tried adding

<action name="pdfinvoices_order">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="componentDisabled" xsi:type="boolean">true</item>
        </item>
    </argument>
</action>

in /app/code/Company/Module/view/adminhtml/ui_component/sales_order_grid.xml

but it is not working.


texts: Remove fonts but default theme is still loading them

texts:
I am customizing rwd theme, i have removed railway font from the theme using local.xml file and i have verified it checking inspect element in browser below is my local.xml code.

<?xml version="1.0" encoding="UTF-8"?>
<!--
Local.xml
Local Layout Modifications For Our Local Theme
-->
<layout version="0.1.0">
<default>
    <reference name="head">
            <action method="addItem"><type>skin_css</type><name>css/bootstrap.css</name></action>
            <action method="removeItem"><type>skin_css</type><name>css/madisonisland.css</name></action>
            <action method="removeItem"><type>skin_css</type><name>css/styles.css</name></action>
            <action method="addItem"><type>skin_css</type><name>css/styles.css</name></action>
            <action method="addItem"><type>skin_css</type><name>css/font-awesome.min.css</name></action>
            <action method="addItem"><type>skin_css</type><name>css/custom.css</name></action>
            <action method="removeItem"><type>link_rel</type><name>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</name></action>
    </reference>
</default>
</layout>

And then i am loading google fonts in my scss file. Below is my code

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600|Allerta);

$black: #000;
$white: #fff;
$red: #d22629;
$orange: #f57f20;
$gray: #f2f3f5;
$opensans: 'Open Sans';
$allerta: 'Allerta';

body {background:$gray; font-family:$opensans !important;}

But still it is loading the default railway font. I don't understand where it is coming from.


texts: Why are there 3 identical tables in Magento2?

texts:
We came across three absolutely identical in structure tables in M2 DB:

cataloginventory_stock_status
cataloginventory_stock_status_idx
cataloginventory_stock_status_tmp

Anybody has any idea why such redundancy has been introduced?


texts: How do I get Bestseller Product with REST API

texts:
I'm developing an Angular frontend that uses Magento 2 REST API.
I want to get the list of my bestseller products but can't find a way to get this with the APIs.

How do I retrive this list?

Thank you!


texts: $block is not working in override phtml file

texts:
I override totals.phtml, but when I am calling my custom block in it, its not working.

File path:

  Magento/vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml

Override File path:

  SimpleMagento/RewardPoint/view/adminhtml/templates/order/totals.phtml

File: sales_order_view.xml

    <referenceBlock name="order_totals">
        <action method="setTemplate">
            <argument name="template" translate="true" xsi:type="string">SimpleMagento_RewardPoint::order/totals.phtml</argument>
        </action>
    </referenceBlock>

Override totals.phtml:

  /* @var \SimpleMagento\RewardPoint\Block\Sales\Order\ShowReward $block */
 ?>

    Customer's Reward Point:
    <?php $getValue = $block->getReward(); ?>
        <?= $getValue ?>

$getVaue displays null, however, I when I change in sales_order_view.xml

  <referenceContainer name="order_additional_info">
        <block class="SimpleMagento\RewardPoint\Block\Sales\Order\ShowReward" name="sales_order_view_custom" template="order/view/custom.phtml" />
  </referenceContainer>

File: ShowReward.php

FilePath:

  SimpleMagento\RewardPoint\Block\Sales\Order\ShowReward

public function getReward(){
    $id = $this->getRequest()->getParam('order_id');
    $getOrder = $this->factory->create()->load($id);
    return $getOrder['reward_point'];
}

and its displayed value perfectly, but its not showing in order totals box, so I override totals.phtml


texts:
Can we set developer to production mode on the local server?

Magento 2.x
Php 7.x


texts: Magento2: Need help to create custom export

texts:
I'm creating a custom module(multi-vendor) where i need to create one feature where admin can export the product details(CSV) data along with vendor details (which is assigned to some specific product).

I have all the tables available working only trucked in this feature...

find the points below I want to achieve..

1. Export product & sales details for the selected vendor

2. Export Vendor/Vendors for selected products with sales


texts: Magento2 Passing Custom Parameters to Cron Jobs

texts:
How to pass custom arguments/parameters for cron jobs in Magento2.

I found an article related to this for Magento 1.x, I am trying to figure out how to do the same for Magento 2.x


texts: Export invoices with old price and special price Magento 1.7

texts:
Is it possible to export invoices having these fields on exported file: Invoice number, Old price (total for old prices on invoice) and Special price (total for special price)?

I am interested in viewing the total discount for each invoice.

Thank you!


texts: How to add a block at the very top of every page?

texts:
I would like to know how to add a block at the very top of every page in my website.

It would be just a 'bar' with the purpose of displaying important information periodically, like - for example - when I am on holiday and unable to process orders.  Or perhaps when there is a promotion running.

It's position would be above the site's header section - exactly where the cookie restriction banner gets placed by default.

Ideally I'd like it to be a block so that it's easily enabled/disabled and edited.


texts: Admin product grid filtered by multi SKUs

texts:
I need to find a way to enhance the admin products grid with capability to fill in the SKU field more than one reference.

For example, get copy/paste from an Excel list multiple sku and get the matching list on Magento.

I've already a solution in place based on default grid block rewriting but there is a conflict with a new cleaner extension I want to use with (Enhanced Admin Grids from Magento connect).

What is the best way to achieve this? Rewriting how the default sku field is working or adding a new custom one?


texts: Magento 2: How to add less file that will have effect on installed Extension?

texts:
Basically I have developed extension.

Now I am finding by which user of extension can add styling using less that have effects on extension?

Is there any way to do this ?


texts:
I can't change the image size of the swatches of my product.

In My/Theme/etc, I have a view.xml file.

I've added this :

    <image id="swatch_image" type="swatch_image">
        <width>50</width>
        <height>50</height>
    </image>
    <image id="swatch_thumb" type="swatch_thumb">
        <width>150</width>
        <height>130</height>
    </image>
    <image id="swatch_image_base" type="swatch_image">
        <width>50</width>
        <height>50</height>
    </image>
    <image id="swatch_thumb_base" type="swatch_thumb">
        <width>150</width>
        <height>130</height>
    </image>

Inside

<images module="Magento_Catalog">

I've refreshed my cache, used catalog:images:resize but there no changes.

I've seen that's a known issue, but can find the way to fix it. I'm on magento 2.2.4


texts: extending a non-code (Varien) class in Magento located in lib - Varien_Db_Adapter_Pdo_Mysql

texts:
I have extended classes from core in Magento before, but am uncertain how to extend this class:

Varien_Db_Adapter_Pdo_Mysql
//located in lib/Varien/Db/Adappter/Pdo/Mysql.php

How would I do this?


texts: Magento 2 : Get Product Attribute values By Group

texts:
I would like to show the various attributes divided into groups as created in the set of attributes, such as

general

attribute_label1 :attribute_value1
attribute_labe2 :attribute_value2
...

other info

attribute_label1 :attribute_value1
attribute_labe2 :attribute_value2
...

How do I retrieve the attribute groups and their labels?

or is there a module to do this?
I have override theme and change catalog_product_view.xml file

<block class="Magento\Catalog\Block\Product\View" name="catalog.product.specification" template="Magento_Catalog::product/view/specification.phtml" after="catalog.product.extra.info"/>

And wants collection within this file specification.phtml


texts: Magento 2 - Customer account custom tab not working

texts:
In Magento 2, I try to add a new tab in My account page next to My Account, My Orders, My Wishlist, ...

I follow exactly this tutorial :
https://www.mageplaza.com/devdocs/add-custom-tab-customer-account-magento-2.html

My new tab is created, but the route is not working, I have a 404 error when I click on this new tab.

Do you have any idea how to solve this problem ?

Thanks


texts: Wholesale extension for fashion industry?

texts:
I am looking for a wholesale extension.

Fashion wholesale has a property for pack composition.

For example, product A is sold by pack of S/M/L 2/2/2, which means 2 smalls, 2 mediums, and 2 larges in size.

Is there an extension for that?

Thanks.


texts: How do I change the front-end language in Magento 1.9.3.6?

texts:
I have made a Webshop and I want that the store can be seen in different languages: English, Dutch, and Turkish. The admin language should stay English.

I don't know how this works. I tried this already but when I try this I am only able to see the front-end site in Dutch but when I change the language to English or Turkish I get the message

  There was no Home CMS page configured or found.


texts: Merge cart product on the basis of custom option value

texts:
I want to separate (or we can say Marge) cart product on the basis on dynamic option. For this i am using following approach -

$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');

$productID = $_POST['productId']; //-- Clicked Product Id
$storeID = $_POST['productStoreId']; //-- Current Selected VendorStore Id
$selectedQty = $_POST['selectedQty']; //-- Quentity selected for add to card

//-- Get Special Price according selected vendor store
$sql = "SELECT special_price FROM cr_stores_product WHERE AND cr_store_id = " . $storeID . " AND product_id = " . $productID;
$result = $readConnection->fetchRow($sql);
$price = $result["special_price"];

//-- Create parameter for add to cart
$params = array('qty' => $selectedQty, 'price' => $price);
Mage::getSingleton('core/session', array('name' => 'frontend'));

//-- Add to cart functionality
$product = Mage::getModel('catalog/product')->load($productID);
$cart = Mage::getModel('checkout/cart');
$cart->init();
$cart->addProduct($product, $params);
$cart->save();
foreach ($cart->getQuote()->getAllItems() as $item) {
    if ($item->getProduct() == $product) {
        $item->setData('cr_store_id', $storeID);
        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);

        //-- Add 'cr_store_id' as custom option for managing/diffrentiate cart product accodting vendor_store
        $item->addOption(array(
            "code" => "cr_store_id",
            "value" => serialize(array($storeID))
        ));
    }
    $item->save();
}

Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
Mage::getSingleton('core/session')->addSuccess('Product added successfully');

But it's create different-different row for every cart product. But i want a bit differ. I want to create one row for each product from a store. If user add more qty for product with same store this will increase quantity in cart instead of creating new row. And if user add same product from different store this will create a new row.

In Detail - I want to add cart product in different – different row but on the basis Vendor Store Id (i.e custom option).
Means i setup custom multi vendor functionality. So user can add same product multiple times with different – different seller/vendors. If i am using above code this will create separate row for each seller. But the problem is, when user choose items multiple times with same seller. I need to increasing quantity of item at corresponding seller-item row.

Can anyone please guide me how could i achieve this functionality?


texts: Add a class or id to the homepage before the page loads

texts: How can I add a class or id to a magento 2 homepage before the page loads? I need the page to render with the class in place, not added after it loads.


texts: How to send data from html template to controller magento 2

texts:
My controller is calling but how to send data and retrieve data?

My template:

        <form data-role="save" data-bind="submit:save" method="post">
            <input type="text" name="spendpoints" id="spendpoints"
                   data-bind="text: getValue()" value="20"/>
            <input type="submit" class="submit"/>
        </form>

My js:

define(
    [
        'Company_Module/js/view/checkout/summary/fee',
        'mage/storage',
        'jquery'
    ],
    function (Component, storage) {
        'use strict';
        return Component.extend({
            /** Your function for ajax call */
            save: function (data) {

                // fullScreenLoader.startLoader();
                storage.post(
                    'custom/spendpoints/index',
                    JSON.stringify(data),
                    true
                ).done(
                    function (response) {
                        /** Do your code here */
                        alert('Success--' + data);

                        // fullScreenLoader.stopLoader();
                    }
                ).fail(
                    function (response) {
                        // fullScreenLoader.stopLoader();
                    }
                );
                // return data;
            },
            /**
             * @override
             */
            isDisplayed: function () {
                return true;
            }
        });
    }
);

My controller:

<?php
namespace Company\Module\Controller\Spendpoints;
class Index extends \Magento\Framework\App\Action\Action {
protected $_pageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
)
{
$this->_pageFactory = $pageFactory;
$this->resultJsonFactory = $resultJsonFactory;
return parent::__construct($context);
}

public function execute() {
$result = $this->resultJsonFactory->create();
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/spendpoints.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$request = $this->getRequest()->getPostValue();

$logger->info('spendpointsdata'.print_r($request));

$this->_view->loadLayout();
$this->_view->getPage()->getConfig()->getTitle()->set(__(' My Reward Points '));
$this->_view->renderLayout();
}
}

PS: I followed this link - https://magento.stackexchange.com/a/175850/55981


texts: Fields “Website”, “Store” and “Store view” are set to null in newsletter after checkout

texts: Does anybody know why, when a customer process an order, the field "store_id" on "newsletter_subscriber" mysql table is reset to "0". This cause me problem when I want to send newsletter to a specific store.


texts:
We sell clothing and have configurable products that consist of simple products with sizes S,M,L,XL etc.

When we choose a product and click on the size dropdown the sizes turn up in random order:

M
XS
L
S

How can we put them in ascending order?
XS
S
M
L

Thanks,

Stefania


texts: How to correctly add an extra charge to a Magento 2 order's total amount?

texts:
We're using a custom module to calculate an amount we need to include in the grand total of the order, i.e. the customer will be charged for the product PLUS this custom amount.

The result is our custom amount goes as Total Due and Stripe only charges the customer for the original value of the product and its shipping without our custom calculation.

Custom module code is as follows:

class CustomAmount extends \Magento\Quote\Model\Quote\Address\Total\AbstractTotal
{
    public function collect(
        \Magento\Quote\Model\Quote $quote,
        \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
        \Magento\Quote\Model\Quote\Address\Total $total
    ) {
        parent::collect($quote, $shippingAssignment, $total);
        $amount = 187; // fixed amount as example, but this will change
        $total->setTotalAmount('installation', $amount);
        $total->setBaseTotalAmount('installation', $amount);
        $total->setCustomAmount($amount);
        $total->setBaseCustomAmount($amount);
        $total->addTotalAmount($this->getCode(), $amount);
        $total->addBaseTotalAmount($this->getCode(), $amount);
        return $this;
    }
}

and we're seeing this on admin panel


texts: Even after disabling some tabs from admin , it still comes on frontend

texts:
I want to hide two tabs . as per theme guide  i disabled them from admin pannel.
.

It still comes on frontend.

            <?php
                $tab_contents = $block->getTabContent() ;

            $count=0;
            foreach($tab_contents as $tab) {
                ?>
            <li rel="tab_<?php echo $tab['id'];?>"  class="<?php if ($count==0): ?>first active<?php endif; ?>" > <?php echo $tab['name'];?>

                <?php
                $count ++;
            }
            ?>

This is the section in phtml which shows tabs name.

My question is how to check that weather the loop depends on admin on/off event or its just shows all the three tabs by default.

I can hide them by css but i want to debug this.

Any suggestions.


texts: Magento2 Catalog - Record the product change and changer

texts:
In Magento2.1, I want to make a module to record the product change and changer in database. I think I can use events and observers to achieve it. The catalog_product_save_after event maybe is a good beginning.

But, when I use the event, how can I know what is the specific attribute the user changed? For example, the price change. How can I know the user changed the price, instead of changing anything else?

Maybe Magento2 has a better event for the specific attribute change? Or a good way to distinguish the price change or anything else? Any suggestion is welcome, thanks :)


texts:
The banner of this magento site (http://mushkaperfumes.com/) isn't displaying when viewing with mobile phone. Please how can i make it display in the home page of the mobile phone view. The version is Magento 1.8.1.

Thanks for your help


texts: Payment methods not appearing for admin orders

texts:
We recently upgraded our 1.8 installation to 1.9.2.4 and now when we try to add a product to an order via the admin area (Admin > Sales > Orders > Create New Order) none of the set up Payment methods appear.

As far as I can see all configuration is correct. I've found a similar question here but there is no answer and the suggestions do not work either.


texts: How to get all filters even after filtered applied magento 2?

texts:
How to get all filters even after filtered applied in Magento 2 Layered Navigation.I need this for Rest API Magento 2.
If I filter by color. All other Options of color did not get in response.
Please Help me. thanks


texts: in madison island demo, some words aren't being translated

texts:
I need madison island theme in Spanish . But some words are in English
For example, say "account ", "cart " in the header..
other texts, for example : "empty cart" , is not in spanish..

ideas ?


texts: Magento 1.9 - issue creating coupon rule. An error occurred while saving the rule data

texts:
I can create a new Shopping Cart Price Rule, but when using Actions or Conditions it won't save, resulting in a red error:

  An error occurred while saving the rule data. Please review the log
        and try again.

Reviewing the exception.log file shows an error about duplicate key in MySql table

    EXCEPTION
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8-1-0-160' for key 'PRIMARY'' in /root/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /root/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /root/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /root/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /root/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /root/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sa...', Array)
#5 /root/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sa...', Array)
#6 /root/lib/Varien/Db/Adapter/Pdo/Mysql.php(2100): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sa...', Array)
#7 /root/lib/Varien/Db/Adapter/Pdo/Mysql.php(2073): Varien_Db_Adapter_Pdo_Mysql->insertArray('salesrule_produ...', Array, Array)
#8 /root/app/code/core/Mage/SalesRule/Model/Resource/Rule.php(293): Varien_Db_Adapter_Pdo_Mysql->insertMultiple('salesrule_produ...', Array)
#9 /root/app/code/core/Mage/SalesRule/Model/Resource/Rule.php(133): Mage_SalesRule_Model_Resource_Rule->setActualProductAttributes(Object(Mage_SalesRule_Model_Rule), Array)
#10 /root/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_SalesRule_Model_Resource_Rule->_afterSave(Object(Mage_SalesRule_Model_Rule))
#11 /root/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_SalesRule_Model_Rule))
#12 /root/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php(163): Mage_Core_Model_Abstract->save()
#13 /root/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Promo_QuoteController->saveAction()
#14 /root/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
#15 /root/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 /root/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#17 /root/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#18 /root/index.php(86): Mage::run('', 'store')
#19 {main}

After much digging and troubleshooting, I found in pdo_mysql.log the exact INSERT INTO query that was generated by the system, and it appears that the first array has an empty value for customer_group_id field - which ends up as "0" in MySql (since the filed is NOT NULL), thus resulting in a duplicate key error for the next array!

See below:

INSERT INTO `salesrule_product_attribute`
(`rule_id`,`website_id`,`customer_group_id`,`attribute_id`)
VALUES (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?), (?, ?, ?, ?)
BIND: array (
  0 => '8',
  1 => '1',
  2 => '',
  3 => '160',
  4 => '8',
  5 => '1',
  6 => '0',
  7 => '160',
  8 => '8',
  9 => '1',
  10 => '1',
  11 => '160',
  12 => '8',
  13 => '1',
  14 => '2',
  15 => '160',
  16 => '8',
  17 => '1',
  18 => '3',
  19 => '160',
)

I have not touched the Customer Groups in Magento, only got the 4 default groups that are 0 1 2 3.

So why is this extra empty array generated, and how do I prevent it from happening?


texts: How can I remove "As low as" in Magento 2.3.1, if all the prices of the variants are the same?

texts: How can I remove "As low as" if all the prices of the variants of the configurable product are the same? It doesn´t make sense to me to show "As low as" when all the colors and sizes are equally expensive. I have some products that have different prices for the sizes, so they are absolutely correct with the addition "As low as". Simply the ability to disable it at all with display:none is not my goal. Help really appreciated!


texts:
I am new to Magento and willing to make frontend theme in Magento. but it is so slow. It takes 2-3 mins to load every page. This is wasting so much time. can any one help me out. I have tried many solution like cache flush and di compile but all efforts are in vain.

I am using Magento 2.1.7 on localhost.


texts: Disable Basic Modules to Improve Performance

texts:
I want to disable modules I don't use to improve performace on System -> Advanced -> Advanced

I found this Disabling modules - performance improvement?

but only few modules are mention and I think there are other basic modules we can disable

Is there a link which explain each module? So I can decide I disable or not

or any recommend setting?

e.g.) I still can't figure what Mage_Usa do

Also anyone have used this? curious this works well

'Transparent auto detecting of disabled core modules and providing mock objects for not breaking Magento.'

https://github.com/Zookal/magento-mock


texts: Using variables within CMS Static Blocks with {{depend}}

texts:
I have used the {{depend}} template functionality before using email templates and I am wondering if this is possible within CMS Static Blocks, for example:

Login/Account

Could be updated to:

  {{depend loggedIn}}Account{{/depend}}
  {{depend loggedOut}}Login{{/depend}}

Which could be useful to allow customers the option to update these within the CMS Block whilst keeping the dependency functionality.

Obviously this dependency depends on the variables being available to the block itself which the email template achieves using the following (which could be applied to the cms block/model with a rewrite):

public function setTemplateParams(array $templateParams)
{
    return $this->setData('template_params', $templateParams);
}

What I am unsure on is how the templating language used within the block accesses this information, adding {{depend}} tags to a block simply outputs as plain text. I assume there is a compilation step applied before the html is rendered, but a nudge in the right direction as to how to proceed would be of great help.


texts: In Magento 2, when should I use an observer instead of a plugin?

texts: I wanted to know when should I use observers instead of a plugin.


texts: Replace the product price ($0.00) with text (for free) if it match a certain price

texts:
I want to replace the price (incl. label if there is any) with a text if it matches a certain price. For example:

Replace Price: $0.00 with for free

This supposed to happen global - on product view, category page, cart, checkout etc. It shouldn't show $0.00 anywhere but the text only. But I'm not sure whats the 'best' approach to achieve this.

A javascript which replaces/appends the elements based on the price value?

Or should I insert a little logic in each required template?

How would you do it? I appreciate any suggestion. Thanks.


texts: How to avoid redirection to "enable-cookies" page during controller unit test?

texts:
I'm doing a very simple controller test using Ecomdev_PHPUnit:

class Foo_BarWishlist_Test_Controller_IndexController
    extends EcomDev_PHPUnit_Test_Case_Controller
{

    /**
     * @test
     * @loadFixture ~Foo_BarWishlist/default
     */
    public function fromcartAction()
    {
        $this->dispatch('checkout/cart/add', array('product' => 10));
        $this->assertRequestDispatched();
        $body = self::getResponse()->getOutputBody();
        $this->assertResponseBodyContains('success-msg');
    }

  ...

This test fails because $body is empty. When checking self::getResponse() more closely, I see that a redirect to the enable-cookies CMS page was sent.

How can I take care of this? Do I have to set the check-cookie manually? Do I have to open another page before (I tried already a $this->dispatch('/') before the actual dispatch)? Or is there a general cookie issue during the controller tests?


texts:
From what I read the installation wizard runs only if there is no local.xml. I do have this configuration:

ls -la app/etc/local.xml
-rwxrwxrwx. 1 apache apache 2317 Dec 10 12:31 app/etc/local.xml

But wizard is still showing up. I did an magento upgrade and don't like to do the wizard again. Clearing cache did not help.

How do I close the installation wizard?


texts:
I got free module from magento connect. Module name is Ecommerceoffice_Mostpopular.xml. I have uploaded files in respective folder but it is not reflected in frontend.

Can anyone explain its logic and how it works?


texts: Editing Universal Page Header - Header.phtml.txt

texts:
I'm not very familiar with Magento at all and I've been tasked with fixing something without a lot of training on the subject so please forgive me if my knowledge is lacking here.

I need to update the text on our website's home page from "4 pm" to "5 pm".  After quite a lot of googling I found that apparently that piece of text isn't a static block or a proper page.  What I did find, after downloading something like 30,000 files from the FTP to do a ctrl-f out of frustration is that there's a file called header.phtml.txt in

app/design/frontend/default/<store_name>/template/page/html/

That contains the string I'm looking to edit.  So I made the edit, dropped the file back into the FTP and refreshed the site's caches.

The change didn't take effect and I gave up.

I'm hoping someone can help me figure out why these changes aren't taking effect.


texts: How do you change the color of buttons to a custom color?

texts:
I've tried to define a custom color in my custom less stylesheet in my theme css/source folder and pulling it in with _styles.less but it doesn't seem to work although it is seeing the custom text styles defined in my custom less.
But, my custom color remains undefined when I deploy it. Do I define it in _theme.less? that didn't seem right as it appears to be for altering Magento variables that have already been defined.
Do I add it to the list in the _color.less file in my lib?


texts: Unable to Load Category Tree after creating Category Programmatically

texts:
I have created a new category using the script below. Once I have created the category using the script, then added a subcategory through admin, The category checkbox tree will not load on the Catalog Price Rules page.

Marketing->Catalog Price Rules->Add New Rule->Conditions->(+)->Please Select a Condition to Add->Category->(...)->(open Chooser)(This is the option right next to the input field

It appears there is an error causing the script to reload the category in an infinite loop.

<?php
//creating categories in magento 2
//last verified Magento 2.2.0  27 Oct 2017
use \Magento\Framework\App\Bootstrap;
echo 'code by harshvardhanmalpani';
include('./app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
function createCategory($a='',$b=1,$c=true,$d='',$e='',$f='',$g='') {
        global $objectManager;
        $category = $objectManager->get('\Magento\Catalog\Model\CategoryFactory')->create();
        $category->setName($a);
        $category->setParentId($b); // 1: root category.
        $category->setIsActive($c);
        $category->setCustomAttributes([
'description' => $d,
'meta_title' => $e,
'meta_keywords' => $f,
'meta_description' => $g,
]);
$objectManager->get('\Magento\Catalog\Api\CategoryRepositoryInterface')->save($category);
}
createCategory("Abc");
?>


texts: what is .htaccess file for in Magento, is it important in anyway?

texts:
I see this file in both Magento one and two, I would like to know what is its functionality in Magento because I have read some articles about it that explains that this .htaccess

"file is a configuration file that affects how a web server responds to various requests. It is supported by several web servers, including the popular Apache software used by most commercial web hosting providers."

can Magento function without the file, any edit you can do for extra or advanced functionalities?

this is all I found in my Magento website.

Order deny,allow
Deny from all


texts:
I'm using Magento 2.3.0 with PHP 7.2.15-0ubuntu0.18.04.1 (cli) (built: Feb  8 2019 14:54:22) ( NTS ), and I'm not sure which is the php.ini file that I should modify. I am currently modifying these two with the same information:

/etc/php/7.2/fpm/php.ini
/etc/php/7.2/cli/php.ini

But I guess the system only use one of the two, where can I check which of the two files is the one using the system?


texts: Magento Component Manager: SSL certificate problem: unable to get local issuer certificate

texts:
In Magento Component Manager, I am trying to Sign in to sync your Magento Marketplace purchases:

I get the following error:

SSL certificate problem: unable to get local issuer certificate

What's wrong?


texts: Magento REST API: how to get custom table information in API?

texts: How to create REST API which will fetch data from custom table?


texts: how to merge two collection in magento 1.9

texts:
$collection = Mage::getModel("manager/campus")->getCollection()
        ->addFieldToFilter('regionalmanager',array('finset' => $arr))
        ->addFieldToFilter('status', array('eq' => 1));
    /* GET citymanager collection */
    $citycollection  =  Mage::getModel("manager/campus")->getCollection()
        ->addFieldToFilter('citymanager', array('eq' => $cust_id))
        ->addFieldToFilter('status', array('eq' => 1));`enter code here`


texts: No link works after magento 1.9.1 sample data installed

texts:
Installed lattest magento 1.9.1 and sample data on parallel plesk and everything look ok except no link works on front end. Backend is fine.
here is the link
http://munchmeonline.co.uk/ap1/
I am new to Magento.


texts:
I want to override prices in catalog module.

What I did was to test on actual phtml

 vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml

It works as intended.

Now, to do it properly, I left file as it was originally and copied files and directory into my theme, made same modifications. Path where I copied files:

app/design/frontend/mysite/test/Magento_Catalog/base/templates/product/price/final_price.phtml

But changes are not being applied. is that the path I have to use?


texts: Where is HTML code for admin page: Product -> General

texts:
Regarding the following admin page:
Catalog -> Manage Products -> Click on any product -> General

Where is the HTML code located for this page?

I have turned on template paths hints for admin, but after following up a few templates, I couldn't seem to find it.


texts: How can I get image url with product data in one json file?

texts:
public function productDataToJson(Varien_Event_Observer $observer)
{
  $array = array();
  $products = Mage::getModel('catalog/product')->getCollection();
  foreach ($products as $_product) {
      $array[] = $_product->getData();
  }
  $gallery_images = Mage::getModel('catalog/product')->getMediaGalleryImages();
  $items = array();
  foreach ($gallery_images as $g_image) {
      $items[] = $g_image['url'];
  }

  $jsonData = Mage::helper('core')->jsonEncode($array,$items);
  echo $jsonData;
  file_put_contents("c_node.json", $jsonData);
  exit;
}


texts: Simple module that displays a template on every single page

texts:
I'm very new to magento development. I got stuck on creating a template or block extension that shows some php on every single page if you're logged in and an admin.

I got the block working (I think) and i make a test.php page to test it and it worked fine.

My blockdesign.php file:

class McDefault_locationreminder_Block_Blockdesign{
    private $content;
    private $loco;

    public function __construct(){
        $this->content = $_SERVER['SERVER_ADDR'];
        $this->loco = 'local';//TODO: Fetch from db
    }

    public function showBlock(){
        echo '
'.$this->loco.': '.$this->content.'</button>
';
    }
}

The test.php file:

<?php

require_once 'app/Mage.php';

Mage::app();

$product = new McDefault_locationreminder_Block_Blockdesign;
$product->showBlock();

Now the only part is to made it a template and show on all pages (as admin).

This is where i need help because i have no clue on where to create all these xml files or phtml files.

I need help with the path to create these files and the content of them.
namespace is McDefault and name is locationreminder.


texts: Invalid auth/bad request. Magento rest api

texts:
I followed http://devdocs.magento.com/guides/m1x/api/rest/authentication/oauth_configuration.html

I am able to login to "My first application" with admin.

But not with customer.

I got $_SESSION like

Array
(
    [secret] => 7664a04e54256c135a18b313a9d06872
    [state] => 2
    [token] => fc5be1e6d0cd1cde0ed614281b61894f
)

I got error in this line

$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));

Saying that

Invalid auth/bad request (got a 500, expected HTTP/1.1 20X or a redirect)

Service temporary unavailable

Please help me solve this.


texts: Magento 2: Ui form not loading after adding select field

texts:
I have a ui-form for adding new record to my table. But the form is not loading when I add a new select field into it. Here is the field component in the form.xml file,

    <field name="product_type">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Trust\Orders\Model\Pickups\Source\Options</item>
            <item name="config" xsi:type="array">
                <item name="componentType" xsi:type="string">field</item>
                <item name="formElement" xsi:type="string">select</item>
                <item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="label" xsi:type="string">Product Type</item>
            </item>
        </argument>
    </field>

The model Trust\Orders\Model\Pickups\Source\Options is returning the array of value and label. The form is loading when I comment out this component. I also tried with the sample source code found in official magento2 documentation,

<field name="select_example" formElement="select">
        <settings>
            <dataType>text</dataType>
            <label translate="true">Select Example</label>
            <dataScope>select_example</dataScope>
        </settings>
        <formElements>
            <select>
                <settings>
                    <options>
                        <option name="1" xsi:type="array">
                            <item name="value" xsi:type="string">1</item>
                            <item name="label" xsi:type="string">Option #1</item>
                        </option>
                        <option name="2" xsi:type="array">
                            <item name="value" xsi:type="string">2</item>
                            <item name="label" xsi:type="string">Option #2</item>
                        </option>
                        <option name="3" xsi:type="array">
                            <item name="value" xsi:type="string">3</item>
                            <item name="label" xsi:type="string">Option #3</item>
                        </option>
                    </options>
                    <caption translate="true"> Please Select </caption>
                </settings>
            </select>
        </formElements>
    </field>

This is showing an error in the console as below,

select.js:67 Uncaught TypeError: data.some is not a function

Could someone please tell me what need to be done to add a select field in the form.


texts: Show message on specific custom option select Magento 1.9

texts:
I would like to show a message when user select any specific custom option in Magento 1.9.

I have two checkbox options: 'disposal' and 'installation'.

Current Issue

At the moment I can only show the message based on the headline title of the custom option, which is 'Delivery Options' (please see current code below).

Desired Result

If the custom option states 'disposal' I would like the message 'please disconnect device' to appear underneath. If the custom option states 'installation' I would like the message 'please connect device' to appear underneath.

select.phtml code requiring edit/update

    <?php if ($_option->getTitle() == 'Delivery Options')
    echo '
Please disconnect device for disposal.

Please connect device for installation.
' ?>

select.phtml code in full

<?php /* @var $this Mage_Catalog_Block_Product_View_Options_Type_Select */ ?>
<?php $_option = $this->getOption() ?>

<label<?php if ($_option->getIsRequire()) echo ' class="required"' ?>><?php if ($_option->getIsRequire()) echo '*' ?><?php echo  $this->escapeHtml($_option->getTitle()) ?>

<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>

        <?php echo $this->getValuesHtml() ?>
        <?php if ($_option->getTitle() == 'Delivery Options')
        echo '
Please ensure device is disconnected and empty prior to disposal collection.
Please ensure you have the correct fittings in place for installation (i.e. plumbing, power points etc.)
' ?>
        <?php echo $_option->getLabel() ?>
        <?php if ($_option->getIsRequire()): ?>
            <?php if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX): ?>
                <span id="options-<?php echo $_option->getId() ?>-container">
            <?php endif; ?>
        <?php endif;?>

Can anyone please suggest an update to my select.phtml file below, to get this working as desired? I presume it will be a jquery on click event.


texts: Is there an extension to log messages in db and then browse them in backend?

texts:
I'm dealing with a development task that needs the client to be able to read log messages. The client has no access to filesystem, so common log files are not usable.

I was thinking about logging messages in the DB and then make them readable from Magento backend. I'm aware of the performance drawbacks of DB logging vs file logging, but that logging infrastructure would be used only for a specific task, so there should be only few messages per day.

Does an extension like that exist?


texts:
I am trying to do a query of the form:

SELECT TableA.id, TableB.id

FROM TableA

INNER JOIN TableB ON TableB.a_id = TableA.id

WHERE

TableB.field1 = ( SELECT TableB.field1 FROM TableB WHERE TableB.a_id=TableA.id ORDER BY TableB.created_at DESC LIMIT 1 )

GROUP BY TableA.id, TableB.field1 ORDER BY TableA.id ASC

the important thing being that the where clause has a subquery.

My question is, how would you use addFieldToFilter() or even ZendDB functions to implement the subquery?


texts: Magento 2 ,category and flush magento cache error

texts:
magento 2.0.2

there are an error when doing flush magento cache

and we found out when the products in one of the category ,all operation around the product will error, we cant deselect that cateogry ,only we can del the product,same warning as flush magento cache error

warning, is_File() expects parameter 1 to be vaild path, string given in File.php line 508


texts: cannot define a correlation name more than once

texts:
we are using this extension : https://github.com/r-martins/Magento-OutOfStockLast for following purpose.

if we click on any category link, initially we are displaying in-stock-products and than we are displaying out-of-stock products as below.

ex : http://sitename.com/testing.html

like same way, when we search in search bar, we want to display In-stock-products first and than out-of-stock products

we are using this extension for this: https://mirasvit.com/magento-extensions/sphinx-search-ultimate.html its working fine.

once we use both extension, than we are getting this error when we search something :

http://sitename.com/catalogsearch/result/\?q=funskool

You cannot define a correlation name '_inventory_table' more than once
[![enter image description here][1]][1]


texts: How to get shipping quote on product view page?

texts:
I want to display  smalll utility like shipping calculator on product view page.

we know native magento provides this section at Cart Page.

How I can implement it on product view page ?

I have a small form which content fields like Country Dropdown & Zip Code.

When someone click on Calculate then shipping quote should be display using Ajax.

I stuck here pretty. Please help me.

I have created controller & calculateAction() method. What code I can write into that calculateaction() function ?


texts: MAGENTO 2.4 EXPORT CSV FILE STUCK IN QUEU AND NEVER APPEARS TO DOWNLOAD IT

texts:
HELP..!! I am on Magento 2.4
trying to export products but EXPORT FILE STUCK IN QUEUE....
it never appears.. what can i do?
Thanks in advance!


texts: Why Magento Go link is still coming in admin header?

texts:
There is a link in Magento 1.9+ admin still coming in header. Something like

Try Magento Go for Free

But Magento Go was closed. Is it a bug, or something missed? Or Why is it there?


texts: Magento 2: After adding products to cart programmatically, cart is not refreshing until reloading page

texts:
Hello Magento 2 Friends.

I have an ajax call to an controller, which adds some new products to the cart programmatically. This works fine, but the problem is that the cart and the mini cart are only refreshed after reloading page. Is there any code I can add, so I don't need to reload the page?

This is my ajax call:

jQuery.ajax({
  type: "POST",
  url: myurl,
  data: {
    productIds: response._productId,
    amounts: response._amount,
  },
  success: function (data){
    console.log(data);
  },
  error: function(data, data1){
    console.log(data);
  },
});

Controller.php

<?php

namespace MassiveArt\ShoppingCart\Controller\Index;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Data\Form\FormKey;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Checkout\Model\Cart;
use Magento\Catalog\Model\Product;

class Index extends Action
{
    /**
     * @var FormKey
     */
    protected $formKey;

    /**
     * @var Session
     */
    protected $checkoutSession;

    /**
     * @var Cart
     */
    protected $cart;

    /**
     * @var Product
     */
    protected $product;

    /**
     * Constructor.
     *
     * @param Context $context
     * @param \Magento\Checkout\Model\Session $checkoutSession
     * @param \Magento\Customer\Model\Session $customerSession
     * @param JsonFactory $resultJsonFactory
     * @param FormKey $formKey
     * @param Cart $cart
     * @param Product $product
     */
    public function __construct(
        Context $context,
        \Magento\Checkout\Model\Session $checkoutSession,
        \Magento\Customer\Model\Session $customerSession,
        JsonFactory $resultJsonFactory,
        FormKey $formKey,
        Cart $cart,
        Product $product
    ) {
        $this->checkoutSession = $checkoutSession;
        $this->customerSession = $customerSession;
        $this->formKey = $formKey;
        $this->resultJsonFactory = $resultJsonFactory;
        $this->cart = $cart;
        $this->product = $product;
        parent::__construct($context);
    }

    public function execute()
    {

        try {

            // Set result data and pass back
            $result = $this->resultJsonFactory->create();

            if(!$this->customerSession->getCustomer()->getId()) {
                $result->setData(['error' => __('Invalid session ID')]);
            }

            // Get parameters
            $productIds = $this->getRequest()->getParam('productIds');
            $amounts = $this->getRequest()->getParam('amounts');

            for ($i = 0; $i < count($productIds); $i++) {// Load product by ID
                $product = $this->product->load($productIds[$i]);
                // New product params
                $params = array(
                    'form_key' => $this->formKey->getFormKey(),
                    'product' => $productIds[$i],
                    'qty'   => $amounts[$i],
                );

                // Save Product
                $product->save();

                // Add product to cart
                $this->cart->addProduct($product, $params);
            }

            //Save cart
            $this->cart->save();

            $result->setData(['message' => __("Products added succesfully")]);

            return $result;
        } catch(\Exception $e) {
            $result->setData(['error' => __($e->getMessage())]);
            return $result;
        }
    }
}

Thanks in advance!


texts: 'enctype' => 'multipart/form-data Issue in admin form when uploading file

texts:
I added some extra fields to store_group admin entry, the issue is that i can't upload a image file because i hanven't the enctype="multipart/form-data" in my form when i inspect the HTML code,and Im sure that the issue comes from this, i tried to add it like this but it doesn't work !

Namespace/Module/Block/Adminhtml/System/Store/Edit/Form.php

protected function _prepareForm(){

    $form = new Varien_Data_Form(array(
        'id'        => 'edit_form',
        'action'    => $this->getData('action'),
        'method'    => 'post',
        'enctype' => 'multipart/form-data' //My add for enctype upload image !important
    ));
    $form->setUseContainer(true);
    $this->setForm($form);
    parent::_prepareForm();

    if (Mage::registry('store_type') == 'group' && Mage::registry('store_action') == "edit")
    {
        $groupModel = Mage::registry('store_data');
        $fieldset = $this->getForm()->getElement('group_fieldset');

        //The extra fields
        ...
        $fieldset->addField('group_storelocator_image_url', 'image', array(
            'name' => 'group[storelocator_image_url]',
            'label' => 'Store Image',
            'required' => false,
            'note' => $groupModel->getStorelocatorImageUrl() != NULL ? "getStorelocatorImageUrl() . "\" target=\"_blank\" >getStorelocatorImageUrl() . "\" width=\"60\" />
" . $groupModel->getStorelocatorImageUrl() . "" : "",
            'disabled' => $groupModel->isReadOnly(),
        ));
    }
    return $this;
}

        Namespace/Module/ModuleController.php

class Namespace_Module_ModuleController extends Mage_Adminhtml_Controller_Action
{
    public function saveAction()
    {
        if ($data = $this->getRequest()->getPost()) {
            if (isset($_FILES['storelocator_image_url']['name']) && $_FILES['storelocator_image_url']['name'] != '') {
                try {
                    $path = Mage::getBaseDir() . DS . 'store' . DS;  //desitnation directory in store folder
                    $fname = $_FILES['storelocator_image_url']['name']; //file name
                    $fullname = $path . $fname;
                    $uploader = new Varien_File_Uploader('storelocator_image_url'); //load class
                    $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); //Allowed extension for file
                    $uploader->setAllowCreateFolders(true); //for creating the directory if not exists
                    $uploader->setAllowRenameFiles(false);
                    $uploader->setFilesDispersion(false);
                    $uploader->save($path, $fname);
                } catch (Exception $e) {
                    $fileType = "Invalid file format";
                }
            }
        }
        if ($fileType == "Invalid file format") {
            Mage::getSingleton('adminhtml/session')->addError(Mage::helper('foundation')->__($fname . " Invalid file format"));
            $this->_redirect('*/*/');
            return;
        }
    }
}


texts: Magento 2 - Show template hints in backend

texts:
Is there a way to show template hints in the backend?

I need to add a new description field in catalog/product/edit and have to find out where the templates are located.

UPDATE: Just a hint, you don't need to fiddle with templates to add a new field. Just create a new attribute in Stores -> Attribute: Product and add it to the attribute set at Stores -> Attribute: Attributeset


texts: Re-index flat tables without having them enabled?

texts: Is it possible to reindex flat product and category tables without having them enabled?  I need to enable them but it hasn't been done in 2 years so don't want to leave a live site for 20 mins+ with products and data from 2015!


texts:
We have some process issues with our store, just throwing it out here to see if anybody has a bright idea.

We have a product that is under development but we want people to reserve the product so we know roughly how much we need to create. Currently what we have is a payment method called "Reservation". This payment method allows you to create the order without paying. Problem we have is that sometimes people choose Reservation for other products and we need to cancel them etc.

I tried a payment method restriction module but that doesn't work in our show due to our payment provider module. And we always have the problem "What if they put a normal product in the cart and a reservation product"

So that's why I added this subject, When product X only allow that product in the cart and show specific payment method

any thoughts?


texts: Magento 1.9 REST API - updating/creating products with custom attributes

texts:
Is it possible to use Magento 1.9 REST API to create or update products that have custom attributes?

example:
http://magentohost/api/rest/products/8

Request Example: JSON

    {
     "attribute_set_id":"4",
     "type_id":"simple",
     "sku":"wedding dress",
     "name":"Dress_test",
     "custom_attr1":"test",
     "custom_attr2":"test2",
      ............
     }


texts: Magento : Admin Form Input Type "file" Value not Working

texts:
In magento admin edit form section, file attribute value is empty.
my file buttons code is :-

$fieldset->addField('actionc', 'file', array(
            'label'     => 'Upload',
            'name' =>'actionc',
            'disabled' => false,
            'readonly' => true,
            'tabindex' => 1

        ));

   $form->setValues($model->getData());
    $form->setUseContainer(true);
    $this->setForm($form);

How can I solve this problem.


texts: Magento 2 : admin form image file validation not working in server

texts:
In my form i am using this code to upload the file.

$fieldset->addField(
        'banner_image',
        'image',
        [
        'name' => 'banner_image',
        'label' => __('Banner Image'),
        'title' => __('Banner Image'),
        'note' => __('Allowed File Types : (JPG,JPEG,PNG).'),
        'path'=> $model->getImagePath(),
        'required' => true,
        'value' => $model->getImagePath()
        ]
        )->setAfterElementHtml('
        <script>
        require([
        "jquery",
        ], function($){
        $(document).ready(function () {
        if($("#page_banner_image").attr("value")){
        $("#page_banner_image").removeClass("required-file");
        }else{
        $("#page_banner_image").addClass("required-file");
        }
        $( "#page_banner_image" ).attr( "accept", "image/x-png,image/gif,image/jpeg,image/jpg,image/png" );
        });
        });
        </script>
        ');

In the edit form $("#page_banner_image").attr("value") its is not working in the server not in localhost.Its always return empty value even if i have value for the image field.

I tried .val() method too.Its also not working correctly


texts: What Block / Controller creates an order in Magento2?

texts: What block creates an order in Magento2? Basically I need a plugin or observer to make an api call right after the order is created.


texts:
How enable mod_pagespeed to Magento 2 website?
Magento 2.3.5-p2 and Centos 7 + Apache + CloudLinux
curl -Is http://server_ip/ | grep X-Mod-Pagespeed

X-Mod-Pagespeed: 1.13.35.2-0
curl -Is http://my_website_url/ | grep X-Mod-Pagespeed

Nothing information?
http://my_website_url/phpinfo.php

Not found X-Mod-Pagespeed


texts:
today i got a message to update my Magento Shop with a new patch (MD5 Algorithm to SHA).
How can i check, if my shop needs that update too? I never heard about "Authorize.Net Direct Post payment method".

Currently I am using "SaferPay" and Authorize.Net is not showing up for payment methods. So im not using it?!

Thank you
Chris


texts: Magento 2: Get price for every attribute

texts:
I want to get price per attribute (this price will change when I change color or other attributes).
Here is the method that shows the estheics swatch:
protected function extractNecessarySwatchData(array $swatchDataArray)
{
    $result['type'] = $swatchDataArray['type'];

    if ($result['type'] == Swatch::SWATCH_TYPE_VISUAL_IMAGE && !empty($swatchDataArray['value'])) {
        $result['value'] = $this->swatchMediaHelper->getSwatchAttributeImage(
            Swatch::SWATCH_IMAGE_NAME,
            $swatchDataArray['value']
        );
        $result['thumb'] = $this->swatchMediaHelper->getSwatchAttributeImage(
            Swatch::SWATCH_THUMBNAIL_NAME,
            $swatchDataArray['value']
        );
    } else {
        $result['value'] = $swatchDataArray['value'];
    }

    return $result;
}

I want to have something like this:
        $result['value'] = $swatchDataArray['value'] . '-' . $_price;

For example, I want to have Silver - 1200 EUR, Bronze - 1000 EUR, Metal - 800 EUR.
Like in this website: https://www.backmarket.fr/iphone-8-64-go-or-debloque-tout-operateur-pas-cher/36829.html#?l=3


texts: Need to change the `signin` name in header links in Magento 2

texts:
I am building a custom theme and I need to change the signin link name which is not contained in the layout file nor in the phtml file but only in the block class file.
So should I build a module in the app/code directory or could I put this block class into the app/design directory?