texts: Cross-sell products are different in admin panel and UI

texts:
I have added cross-sells products for my product in the Admin panel of Magento 2.

Still, on UI its shows different product.

The helper function for getting cross-sell products is

 public function getCrossSellProducts(){
    $currentProduct = $this->_registry->registry('current_product');
    $collection =  $currentProduct->getCrossSellProductCollection();
    $collection->addAttributeToSelect('*');
    $collection->setPageSize(8);
    $this->_crossSellProducts =  $collection->load();
    return $this->_crossSellProducts;
}

Still, it shows different products than my admin panel products which I added.

What's the issue?

Where cross-sell products are stored in database/ tables


texts: Custom product name in cart from backend

texts: Is there a way to modify the name of a product when creating an order from backend? For example we have a product called "special order" and would like to rename with the specific name of the product when creating the order from backend. This product would have a different name and custom price everytime it is used.


texts: make a custom attribute on catalog to upload a file

texts:
I want to upload a file from admin side for a user to show on product description page.I just want to make a  file uploaded for now on admin. In store->attribute.  how to achieve this in magento2 ?

I need something like this but its not for file upload

https://magento.stackexchange.com/questions/162113/magento-2-add-product-attribute-programmatically

I found a extension maybe for same thing  , how I can check this ?

https://github.com/jahvi/FileUploadAttribute


texts: How to get Shipping Method Title Name in order confirmation email in Magento

texts:
I have set up shipping method in Magento admin Panel. like see below image-

This shipping method has set Title and Method Name as shown in above image.

When I get Order Confirmation Email after successfull checkout I get Shipping Method two times, see this image below-

how can I show shipping method title here only one time.


texts:
Using the SOAP API, how can I get URL for the product (when requesting from catalog_product.info) that will always work?

Using url_key and appending ".html" is not good enough because in many stores that won't work.

So at the moment I have this:

$url = $shop_url . '/catalog/product/view/id/' . $product_id;

The $shop_url being the domain eg http://www.store.com.

The only issue with that is that the product may not be visible on all stores.... E.g. a single magento may have more than one storefront, each with a different url and each showing a subset of products... so thats hard.

Any ideas?

EDIT: I will also accept an answer which would give me a way to test, positively, that the ID method above would work for different stores.


texts:
I'm trying to apply this code snippet (http://jsbin.com/binarenimi/edit?html,js,output) to my layered navigation with no success..
Where I'm wrong?

<?php foreach ($this->getItems() as $_item): ?>

        <?php if ($_item->getCount() > 0): ?>
        <?php
            $url = $_item->getUrl();
            $onclick = "ajaxFilter('".$url."')";
            echo ''. $_item->getLabel() . '';
         ?>
        <?php else: echo $_item->getLabel() ?>
        <?php endif; ?>
        (<?php echo $_item->getCount() ?>)

<?php endforeach ?>


texts: How to check the result of temp and replica table in Magento 2 indexing

texts:
I have running indexer index command in Magento 2 for 60 million products.
But when i check in back end after 2 days it will show processing catalog_category_product and when i have go to error log there is no error in log file.
When i go to db and check process list using (show proceslist) it will show that the data enter in a _temp table and somewhere i read after that it will enter the data in _replica table.
But when i search for that _temp table it will not shown and on checking the _replica table the table is empty.
So my issues are :

Is there a way to find out the process is still running or it will stuck.
Need to know the _temp table is created and shown on magento database when the process is running.
Any way to find out how much process is completed.

Any help is appreciated.


texts: Magento2 - How to export order grid data programmatically?

texts:
I want to export my order grid's data programmatically. I am calling the execute method of /vendor/magento/module-ui/Controller/Adminhtml/Export/GridToCsv.php by passing necessary parameters, like filters, namespace, etc. But it is giving me error as below:

  "DOMDocument should be created".

This is because it is trying to get the UIComponent based on the namespace that I pass i.e. sales.order.grid when generating the CSVFile and it's getting null in UIComponent. Should I create a mock of the UIComponent, if yes, then how can I do it and/or is there any other way ?

Here is what I tried so far:

//***************variables in construct start***************
    \Magento\Backend\App\Action\Context $context,
    \Magento\Framework\App\RequestInterface $request,
    \Magento\Ui\Model\Export\ConvertToCsv $converter,
    \Magento\Framework\App\Response\Http\FileFactory $fileFactory,
    \Magento\Framework\View\Element\UiComponent\Config\FileCollector\AggregatedFileCollector $fileCollector,
    \Magento\Framework\View\Element\UiComponent\Config\DomMerger $domMerger,
    \Magento\Framework\Component\DirSearch $dirSearch,
    \Magento\Framework\Filesystem $filesystem

    $this->context       = $context;
    $this->converter     = $converter;
    $this->fileFactory   = $fileFactory;
    $this->fileCollector = $fileCollector;
    $this->domMerger     = $domMerger;
    $this->dirSearch     = $dirSearch;
    $this->filesystem    = $filesystem;
    $this->request       = $request;
//***************variables in construct end***************

//*************main method code starts here***************
$filters  = [
'created_at' => ['from' => $fromDate, 'to' => $toDate],
'placeholder'=> true
];

$this->request->setParam('filters',$filters)
->setParam('namespace','sales_order_grid')
->setParam('search','')
->setParam('selected','false');

$obj = new \Magento\Ui\Controller\Adminhtml\Export\GridToCsv(
    $this->context,
    $this->converter,
    $this->fileFactory
);
$fileReader  = $this->filesystem->getDirectoryRead(DirectoryList::ROOT);
$fileContent = $fileReader->readFile('vendor/magento/module-sales/view/adminhtml/ui_component/sales_order_grid.xml');
$this->domMerger->merge($fileContent);
//$domDocument = $this->domMerger->createDomDocument($fileContent);
//$this->domMerger->setDom($domDocument);
$obj->execute();

//main method code ends here


texts: Load Product By Multiselect Option Value

texts:
How do I load a product by the value of one of its multiselect options, either option id or frontend value?

Example:

Product Attribute "Size", Values "Large", "Medium", "Small"

// Desired behaviour
$productSearch->loadByAttributeOption('size', 'large');


texts: How to set billing and shipping address to Quote

texts: I want to set billing and shipping address to Quote. Actually I am creating an API for which I need to get Shipping Price and other normal checkout information. So I am thinking that, if I can able to set billing and shipping address to quote then it will easy to fetch shipping price from quote. Please help me to achieve this. Many thanks.


texts:
I have a dev site on magento 1.9.4.2 . Now I am trying to redirect my web site to my domain (the server is the same)

I have changed the

web/unsecure/base_url
web/secure/base_url
and web/url/redirect_to_base to 0.

I have also cleared

var/cache
and var/session.
system/tmp/magento/cache

But I am still getting a redirect loop issue.

can someone help me?


texts: Sort by price in product collection get by magento rest api

texts:
I am using below web service to get a product collection sorted by price :

www.magentohost.com/api/rest/products?order=price&dir=asc

It is giving the following error:

  {"messages":{"error":[{"code":400,"message":"Resource collection ordering error."}]}}

What is the cause and how can I fix this?


texts:
I want to customize Success Page in Magento: frontend/base/default/template/checkout/success.phtml

I want to be exactly like in the attached image. And at very bottom to have "You may also be interested in" section. This section is already exist I use ultimo theme.

I found a code that seems to work but is not have all details like in this image.

the code is:

<?php
    $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
    $order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id);
    $shipping_address_data = $order_details->getShippingAddress();
    ?>

                    <?php echo $this->__('Description') ?></th
                    <?php echo $this->__('Description') ?>
                    <?php echo $this->__('Qty') ?>
                    <?php echo $this->__('Unit Price') ?>

            <?php foreach($order_details->getAllVisibleItems() as $item):
    $configItem = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
    ?>

                    <img src="<?php echo $this->helper('catalog/image')->init($configItem, 'small_image')->resize(200); ?>" width="200" height="200" class="media-object img-responsive" alt="<?php echo $this->getImageLabel($configItem, 'small_image'); ?>"/>
                    <?php echo $item->getName() ?>
                    <?php echo round($item->getQtyOrdered(), 0) ?>
                    <?php echo Mage::helper("core")->currency($item->getPrice()) ?>

            <?php endforeach ?>

            <?php echo "
" . $shipping_address_data['country_name']; ?>


texts: Remove category(Top menu) for specific customer or customer group

texts:
I m using magento 1.9.0.1 to remove cateogroy from frontend top menu for specific category for specific customer or customer group.
I m using below code for testing but it not work

/frontend/default/YOURTHEMENAME/template/catalog/navigation/top.phtml

    <?php $_menu = ''?>
<?php foreach ($this->getStoreCategories() as $_category): ?>
    <?php $_menu .= $this->drawItem($_category) ?>
<?php endforeach ?>
<?php if ($_menu): ?>

    <?php foreach ($this->getStoreCategories() as $_category): ?>
    <?php if (!in_array($_category->getId(), array(12,34,56))) : ?> <?php echo $this->drawItem($_category) ?>
    <?php endif; ?>
    <?php endforeach ?>

<?php endif; ?>

any help would be greatly appreciate.


texts: How Do I stop Magento from sending a double opt-in email for newsletter subscription? I want Mailchimp's only

texts:
I use Magento 2 and Mailchimp. Whenever I have "Need to confirm" set to YES, new subscribers get two emails asking them to confirm their email -- one from Magento and another from Mailchimp.

Because the one from Mailchimp appears in the customer's inbox (as against the promotions tab for Magento) I'd like for the customer to get just the one from Mailchimp.


texts: Add a Buy Now button on product detail page along with Add to cart

texts:
I want following actions to work on

Add to cart will add product in the cart only.
Buy Now will directly redirect the customer to the checkout page skipping cart step.


texts: Order made with PayPal, new order e-mail not sent

texts:
I have a problem with the orders with PayPal payment gateway. When order is made, the customer didn't receive any email for "New Order" placed.

I have established a sandbox for my PayPal and changed the IPN settings in my PayPal account, but nothing seems to make this work.
I am working on Magento 1.7.0.2 and I have setup multi shop magento system.

Please provide me solution of this problem if anyone have solution


texts: Magento2.1 Modifications on js file missing after content deploy

texts:
I have installed Magento 2.1.2 with Clickboom Magento Theme.

I did some modifications on following java script file under pub static folder.

pub/static/frontend/Sm/clickboom/en_US/Magento_Catalog/js/catalog-add-to-cart.js

But after running php bin/magento setup:static-content:deploy I lost all modifications.

Where i can modify this javascript.?

Thanks.


texts:
Is there a way to have my items into the home page instead of sub categories?
What I'm trying to achieve is to have an home page filled with my products.
I don't want to separate my products in different categories.


texts: Why the CatalogSearch is not installing during the integration test?

texts:
I'm trying to run my Integration test on magento2 but keep getting the same error.

  Module 'Magento_CatalogSearch':
  Installing data...

[Magento\CatalogSearch\Model\Indexer\Scope\IndexTableNotExistException]
  Temporary table for index catalogsearch_fulltext doesn't exist, which is inconsistent with state of scope resolver

Exception trace:
 () at /var/www/html/magento2/vendor/magento/module-catalog-search/Model/Indexer/Scope/IndexSwitcher.php:58
 Magento\CatalogSearch\Model\Indexer\Scope\IndexSwitcher->switchIndex() at /var/www/html/magento2/vendor/magento/module-catalog-search/Model/Indexer/IndexSwitcherProxy.php:79
 Magento\CatalogSearch\Model\Indexer\IndexSwitcherProxy->switchIndex() at /var/www/html/magento2/vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php:154
 Magento\CatalogSearch\Model\Indexer\Fulltext->executeFull() at /var/www/html/magento2/vendor/magento/module-indexer/Model/Indexer.php:412
 Magento\Indexer\Model\Indexer->reindexAll() at /var/www/html/magento2/vendor/magento/module-indexer/Model/Indexer/DependencyDecorator.php:248
 Magento\Indexer\Model\Indexer\DependencyDecorator->reindexAll() at /var/www/html/magento2/vendor/magento/module-catalog-search/Setup/InstallData.php:45
 Magento\CatalogSearch\Setup\InstallData->install() at /var/www/html/magento2/setup/src/Magento/Setup/Model/Installer.php:868
 Magento\Setup\Model\Installer->handleDBSchemaData() at /var/www/html/magento2/setup/src/Magento/Setup/Model/Installer.php:792
 Magento\Setup\Model\Installer->installDataFixtures() at n/a:n/a
 call_user_func_array() at /var/www/html/magento2/setup/src/Magento/Setup/Model/Installer.php:343
 Magento\Setup\Model\Installer->install() at /var/www/html/magento2/setup/src/Magento/Setup/Console/Command/InstallCommand.php:146
 Magento\Setup\Console\Command\InstallCommand->execute() at /var/www/html/magento2/vendor/symfony/console/Command/Command.php:242
 Symfony\Component\Console\Command\Command->run() at /var/www/html/magento2/vendor/symfony/console/Application.php:843
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/magento2/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->doRun() at /var/www/html/magento2/vendor/magento/framework/Console/Cli.php:104
 Magento\Framework\Console\Cli->doRun() at /var/www/html/magento2/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at /var/www/html/magento2/bin/magento:23

I've tried the following:

rm -rf vendor/* composer.lock
composer update
composer upgrade
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile php bin/magento indexer:reindex

But nothing worked.

I installed a clean magento2 setup and here It works.
But I can't figure out why al my custom code from app/code/{myvendor} from the original project was copied to the fresh install and still it works on the fresh install.


texts: Issues in upgrading from Magento 2.1.10 to 2.2.0

texts:
I am trying to upgrade from Magento 2.1.10 to 2.2.0 but I am getting the below error when running:

  bin/magento setup:upgrade

SQLSTATE[23000]: Integrity constraint violation: 1062 , query was: ALTER TABLE eav_attribute_group ADD UNIQUE CATALOG_CATEGORY_PRODUCT_ATTRIBUTE_SET_ID_ATTRIBUTE_GROUP_CODE (attribute_set_id,attribute_group_code)

I'm not great with SQL so any help would be much appreciated.

Thanks in advance.


texts: How to add radio button in custom option in magento2

texts:
I want to add radio button in custom option .

I refer this link Magento2 adding radio buttons in customoptions.

But not working.

If anything i want to chage it.

Thanks.


texts: display error message under payment method if "COD " is not available

texts:
i am using this following code to restrict the "cash on delivery" payment method based on pin code.

/app/code/core/Mage/Payment/Model/Method/Cashondelivery.php

Please check code here

now if cash on delivery payment method is not visible means i want to display "cod is not available" under

payment method.

please help me to find solution.


texts:
I would like to display my products in a table format on my sub-category page. Currently the products are by default populated either in a grid view or a list view.

All I want to do is to display products in a table format something like this

Columns: No.,   SKU,   Product Title,   Quantity,   Add to Cart Button

and each row will be the product belonging to the sub category.

Basically want to change the design of the grid/list layout to Table Layout


texts: How do we change customer email programmatically in Magento 2?

texts: How do we change a customer's email programatically in Magento 2?


texts: MAGENTO: Server Down when access Media Storage

texts:
Basically whenever I try to access Media Storage. Usually by going to CMS->Pages->click on any page from the list->Content->Insert Image->Storage Root.
The moment I click on Storage Root the server image tumbnails start to load but the server load raises highly and server restarts. Site is down for good 2-3 minutes.

I have approximately 100 picture that are stored in Storage Root and only about 30% of thumbnails load before the server crashes.

Any ideas what could be the issue?


texts: How to get reference token for google business api

texts:
I am getting a response from OAuth 2.0 Playground when i hit the URL in the browser i am getting the following error,
URL: https://mybusiness.googleapis.com/v4/accounts/123456789/locations/987654321/reviews
{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED"
  }
}

How to set OAuth to my URL?
How to get a reference token and how to view the response in the browser?


texts: Move a product-review summary below add to cart button

texts:
I want to move product-review-summary in products listing page above the price which is at the bottom of product-information. that is after add to cart button . How should I do this?

what is the name of the xml file I should edit.? and what is the block and destination names to give in move command?


texts:
Internal Error. Details are available in Magento log file. Report ID: webapi-5a291a13d9760

I am using Magento 2.1

I am hitting the url to place order:-

Method:- PUT

https://www.xxxxxx.com/index.php/rest/V1/guest-carts/ddaae427f0a12acf52a73b056b78++++/order

My Payment Method is COD!

I am sending in Body

{
    "paymentMethod": {
        "code": "cashondelivery",
        "title": "Cash On Delivery"
    }
}

Expected result:
Order_ID

Actual result it is returning:

{
    "message": "Internal Error. Details are available in Magento log file. Report ID: webapi-5a291a13d9760"
}

Log.FILE:
Next Exception: Report ID: webapi-5a291a13d9760; Message: Property "Code" does not have corresponding setter in class "Magento\Quote\Api\Data\PaymentInterface". in /var/www/vhosts/myserverexample.com/httpdocs/vendor/magento/framework/Webapi/ErrorProcessor.php:195


texts: Override and extension class which in turn overrides a magento core class

texts:
I have a requirement which would need me to write an extension that overrides a class from another extension which in turn uses the rewrite to override a core module.

Whilst I have the feeling that it would mostly relate to the config.xml file in my extension it have tried the following:

<config>
<modules>
    <Leafcutter_CustomMenu>
        <version>1.0</version>
    </Leafcutter_CustomMenu>
</modules>
<global>
    <blocks>
        <custom_menu>
            <rewrite>
                <topmenu>Leafcutter_CustomMenu_Block_Topmenu</topmenu>
            </rewrite>
        </custom_menu>
    </blocks>
</global>

With the above code what I am intending on doing is try to override the WP_CustomMenu_Block_Topmenu block from the custom menu extension, which in turn overrides the Mage_Page_Block_Html_Topmenu block.

I have tried the above but it keeps on getting the WP_CustomMenu_Block_Topmenu and not my extended class. I know that if I removed the above code and replaced it with this:

<config>
    <modules>
        <Leafcutter_CustomMenu>
            <version>1.0</version>
        </Leafcutter_CustomMenu>
    </modules>
    <global>
        <blocks>
            <page>
                <rewrite>
                    <html_topmenu>Leafcutter_CustomMenu_Block_Topmenu</html_topmenu>
                </rewrite>
            </page>
        </blocks>
    </global>
</config>

and removed the code responsible in the original plugin, I can achieve what I want. But for curiosity's sakes how would I override that extension without having to go into the config file in the extension and comment it out, as I consider this pretty hacky.

Thanks.


texts: Want to make changes in Sub Admin and their views in admin panel

texts:
I created a one main admin account name xyz ( Full Access of all modules) and three different sub-admin user account names are xyz1, xyz2 and xyz3 and this three sub-admin have only access of only modules (Dashboard, Sales, Catalogue, Customers, and Reports).
My requirement is all three sub-admin has a separate admin panel of the module of because all three sub-admins are sited in three different our country offices.
So, obliviously they are individual sales, customers, and products and they are not interrelated to each other.
Our aim is to make the separate view of backend admin for all three sub-admins. E.g. xyz has a separate admin panel view and he can’t see either xyz1 & xyz2 admin panel & vice versa.


texts: Send welcome email when creating an order from admin

texts:
I am using Magento 1.8 and finding that when I place an order from admin for a new customer, they don't receive the welcome email, only the order email. What this means is that they don't receive their username and password.

This is quite important as if they purchase a PDF then they really do need it.

Should this be happening automatically, or is a there a way so that they do receive it?


texts: Magento2: How to install MSI for M.2.4.2

texts:
I'have removed all modules MSI for 2.4.2 via this module
https://github.com/yireo/magento2-replace-inventory

composer unistall yireo/magento2-replace-inventory
Currently I need rewrite all modules MSI 2.4.2. Any solution how can I to do?


texts: Magento 2.2.2 - Web setup wizard stuck on Rollback

texts:
My website is stuck on rollback, how do I disable this?

Does anyone have any solution?


texts: Magento Administration Panel icons missing

texts:
I've had a Magento ver. 1.9.0.1 store up and running for a few weeks for a client.

Since the beginning of the week, the default icons have gone missing all of sudden. I originally thought it might have been a browser cache issue, but I've tested it on multiple devices and different connections.

I've attached some pictures of the problem

http://i.stack.imgur.com/wTtBK.jpg
http://i.stack.imgur.com/GreE7.jpg

If anyone could shed any light on whats happening I would appreciate it.


texts: Magento 2 : How To Apply Authorize.net Direct Post Signature Key Patch?

texts:
Read
https://support.magento.com/hc/en-us/articles/360024368392
Issue :

Magento implements the Authorize.Net Direct Post payment method, using Authorize.Net's AIM (Advanced Integration Method) and DPM (Direct Post method) APIs, which use MD5 based hash.
Authorize.net will stop supporting MD5 based hash usage on March 14, 2019. Starting from this date, Magento Open Source, Magento Commerce and Magento Cloud merchants will not be able to process payments using Authorize.Net Direct Post payment method. To be able to continue successfully process payments using these methods, merchants need to apply the patch provided by Magento and replace the existing MD5 hash with a Signature Key in the Magento Admin configuration settings.


texts:
I'm trying to collect all phrases for a customer. When I ran bin/magento i18:collect-phrases I get all the phrases in the admin section and I don't want that because it is way to much.

I thought of collecting all phrases from /code/desing/frontend, the problem with this is that it will not collect core templates that are not overridden by my custom theme.

Is there a way / tool to collect only frontend phrases?

note: I know inline translations exists but I want a csv file with all labels / phrases to be translated.


texts: OrderController of Adminhtml/Sales not properly overriden

texts:
I want to override OrderController from

Adminhtml/controllers/Sales/OrderController

In my config.xml I have written this,

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Neo_Recurring before="Mage_Adminhtml">Neo_Recurring_Adminhtml</Neo_Recurring>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

But still the controller is not getting overriden, also this is my controller definintion

<?php
require_once "Mage/Adminhtml/controllers/Sales/OrderController.php";
class Neo_Recurring_Adminhtml_OrderController extends Mage_Adminhtml_Sales_OrderController
{


texts:
I am creating order CSV file which is creating fine now I added item detail in order and show column in my CSV now I want if order has 2 items then 2 row creates in 1st row master column field like order id etc but and 1st item detail in 2nd row just 2nd item detail shows other columns should blank how I do that this is my code

foreach ($orders as $order) {
        foreach($order->getAllItems() as $orderItem){
        $fieldsss[] = array(

             $orderItem->getName(),

        );
   }
        $billingCountryCode = $order->getBillingAddress()->getCountryId();
        $billingCountry     = Mage::getModel('directory/country')->loadByCode($billingCountryCode);
        $billingCountryName = $billingCountry->getName();

        $shippingCountryCode = $order->getShippingAddress()->getCountryId();
        $shippingCountry     = Mage::getModel('directory/country')->loadByCode($shippingCountryCode);
        $shippingCountryName = $shippingCountry->getName();

        if ($order->hasInvoices()) {
            $oInvoiceCollection = $order->getInvoiceCollection();
            foreach ($oInvoiceCollection as $oInvoice) {
                $transaction_id = $oInvoice->getTransactionId();
            }
        } else {
            $transaction_id = '';
        }

        $payment = $order->getPayment();

        $fields[] = array(

            $order->getIncrementId(),

          $fieldsss,

        );

     }
    generateCsv($fields, $io);


texts: How to import tier pricing using CSV in magento 2

texts:
I am trying to import tier pricing for configurable product, example csv format is like below.

sku      tier_price_website  ALL GROUPS  tier_price_customer_group  tier_price_qty  tier_price
1000-101         1               1                0                     1                5
1000-101         1               1                0                     5                4.8
1000-101         1               1                0                    10                4.5

But while trying to import getting error like "Please enter a correct entity model"


texts: Dynamically add extra price on subtotal on cart

texts:
I need your help in solving one of my issue related to adding extra/custom price on subtotal on cart page. I have called a observer for checkout_cart_product_add_after and sales_convert_quote_item_to_order_item event and in which I am trying to add dynamic price from below code

$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);

This is allow me add in unit Price but I want to add in Subtotal of product. Also I have to tried to add price via custom options but it adds in Additional_optional field and not stored in info_buyrequest so might it not reflect to the subtotal price.

Please advise for suggestion.

Thanks


texts: Magento form key invalid after page becomes inactive for extended period of time

texts:
Running a recently upgraded instance of Magento CE 1.9.1.0 (from 1.7.0.2). Form key support was built in to the theme and is functioning a-okay when browsing the website with different browsers and caching enabled.

I have noticed however that if a single browser leaves a page open for an extended period of time (roughly 2 - 3 hours), upon resuming activity on that page and clicking the add to cart button does not work the first time it is clicked. The cart is still empty but after a page refresh it becomes functional again.

I'm assuming that this is because the form-key rendered on the page at the time it was generated and output to HTML is no longer the same as what Magento's core/session model references in the database. After the page refresh this resolves itself.

Has anyone else experienced this? Is there a way to resolve this issue?


texts: Magento 2 : Add to Cart Button redirect to contact page

texts: I am using Magento 2, How to redirect to contact us page when adding a product to add to cart?


texts:
I am trying to implement cron job to write a log file with 1min interval. I have an issue while doing the same. I notice that cron job is not running automatically.

Each time when I run "PHP bin/Magento cron: run " then only cron job gets executed and the database gets populated. If each time I need to run that command then it does not serve as the purpose of corn job.

I follow this link to implement:

https://devdocs.magento.com/guides/v2.2/config-guide/cron/custom-cron-tut.html

Please help me for the same


texts: I can't erase the Categry name because it is required by magento!


texts: Magento 2 grunt exec does not actually create symlinks

texts:
I am following:

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html#grunt_prereq

it says grunt exec:<theme> does:

Republishes symlinks to the source files to the pub/static/frontend/Vendor/default/<locale> directory.

But that does not seem to happen!

pub/static/frontend/Vendor/default/de_DE/css/source contains regular files where I would expect symlinks to app/design/frontend/Vendor/default

Is this a bug or am I doing something wrong?

edit I am just having this s ame problem again with Magento 2.1 - even if the patch of issue https://github.com/magento/magento2/issues/1619 should already be contained in Magento 2.1


texts: How can I move quantity box after product title in magento 2.3?

texts:
I want to move quantity box after product title without moving add to cart button on product detailed page.

I have tried to move quantity box using jQuery but after that always single quantity (Default) added in the cart

Can anyone help me to move it?


texts:
I'm creating a widget to display ratings. (Already created -> activated -> added in a page)

Calling this widget by {{widget type="widgetreviewtab/list"}} on a cms page named sample

Now when access http://site.com/custom.html it's empty.

Below is my WidgetReviewTab/Block/List.php where i'm trying to get rating lists.

class Review_WidgetReviewTab_Block_List extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface
{
    protected function _toHtml()
    {
        $html = $this->getChildHtml('review_list');
        return $html;
    }

}

If i use $html = 'custom text'; i'm getting result as custom text so widget's function is fine.

Is it proper to call $this->getChildHtml('review_list'); in widget.

I think i'm missing something ? Did any one have any idea to make it work ?


texts: Error Last 5 orders Dashboard Missing Customer Name

texts:
Before a critical path update, i was missing the customers name on my dashboard BE.

ON

  adminhtml/block/dashboard/orders/grid.php

Here is the column with the fault on line 87:

$this->addColumn('customer', array(
    'header'    => $this->__('Customer'),
    'sortable'  => false,
    'index'     => 'customer',
    'default'   => $this->__('Guest'),
));

Now, it returns a white space.

What i should check?


texts: Configurable products - Get product options in list.phtml

texts:
I'm having configurable products with 2 Attributes. Size and Color

It's been linked like this,

Size | Color
--------------------------------
 30  | Red (5 available), Green (1 available), Black (2 available)
 32  | Green (2 available)
 34  | Black (3 available), Blue (0 available)
 36  | Black (0 available)

Basically i'm trying to display available sizes in category list page (list.phtml)

like this

Size: 30 , 32 , 34, 36 (36 not bold coz it's not available)

so far i;ve tried this in list.phtml

$data = array();
    if($_product->isConfigurable()){
        $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
        foreach ($allProducts as $subproduct) {
                $sizes[] = $subproduct->getAttributeText('waist');
                    $data[] = array(
                        'name' => $subproduct->getAttributeText('waist'),
                        'qty' => $subproduct->getStockItem()->getQty()
                    );
        }
        if(count($data)>0) {
            sort($data);
            ?>

            Size : <?php echo '
'; print_r($data); echo '
'; ?>

            <?
        }
    }

It's working but it's giving me lot of duplicated values, coz every size is linked to one or more colors.

I can solve this by array sort & group, but i'm sure that it's not the proper way?

Coz i'm having more than 300 Configurable products and all associated to 25 + simple products.

Is there any way to achieve the same in magento way ??


texts:
This is my collection:

$collection = Mage::getModel('customer/customer')->getCollection()
                    ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
                    ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
                    ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
                    ->addFieldToFilter('billing_city', ['like' => '%'.$customer->getAddresses()[0]->getData('city').'%'])
                    ->addFieldToFilter('billing_street' , ['like' => '%'.$customer->getAddresses()[0]->getData('street').'%'])
                    ->addFieldToFilter('billing_telephone', ['like' => '%'.$customer->getAddresses()[0]->getData('telephone').'%'])
                    ->addAttributeToFilter('email', array('neq' => $customer->getData('email')))
                    ->addAttributeToSelect(['email', 'firstname', 'lastname'])

This generates me a query condition with AND . I want to change it into OR for  3 elements billing_city or billing_street or billing_telephone. I tried this:

 $collection = Mage::getModel('customer/customer')->getCollection()
                    ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
                    ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
                    ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
                    ->addFieldToFilter(
                        ['billing_city', 'billing_street', 'billing_telephone'],
                        [
                            ['like' => '%'.$customer->getAddresses()[0]->getData('city').'%'],
                            ['like' => '%'.$customer->getAddresses()[0]->getData('street').'%'],
                            ['like' => '%'.$customer->getAddresses()[0]->getData('telephone').'%'],
                        ]
                    )
                    ->addAttributeToFilter('email', array('neq' => $customer->getData('email')))
                    ->addAttributeToSelect(['email', 'firstname', 'lastname']);

but when I want to display the query with getSelect() I got this message:
invalid Attributname: a


texts: Magento 2: How to get the theme url in the phtml file?

texts:
Magento version:2.0.0

How to get the theme url in the phtml file? there has a global function for it?


texts: How to add slick slider to magento 2 product grid

texts: I have a added a product grid to magento 2 homepage. I need to slide the product using slick slider


texts:
I want Functionality in my Product Page as once I shared Product from my PDP (Product Description Page).

After Successful Shared product in Twitter and Instagram, I want Response on my Website, On the Basis of that I can do Further Functionality.

Thanks


texts: Magento 2 Ajax pagination for grid on front end

texts:
On custom tab of product detail page on front end i have added a table and used Pager for pagination.

  Magento\Theme\Block\Html\Pager

But this reloads the entire page when pagination is used. I don't want to reload the entire page.

Is their any way to use ajax along with Pager?

If not then can you recommend some other way around?

Thanks.


texts:
I have tried below code but it is not working.

<crontab>
    <jobs>
        <send_customer_emails>
            <schedule>
                <cron_expr>0 0 */7 * *</cron_expr>
            </schedule>
            <run>
                <model>emailmodel/observer::sendEmails</model>
            </run>
        </send_customer_emails>
    </jobs>
</crontab>

I have checked when I use below expression, it works.

* * * * *

Is it a magento bug? Or am I doing something wrong.


texts: Magento Error 405 When Logging In Backend

texts:
I have a aggravating problem with my magento. When I go to login first thing every morning and go to my domain.com/admin panel and click login after entering my credentials. When I hit the login button it just loads and loads and loads until it shows error 405 Not Allowed. When I inspect the page it shows

Failed to load resource: the server responded with a status of 405 (Not Allowed) for https://MY DOMAIN.com/index.php/admin

I do eventually get in after logging in over and over and over again. I have tried using IE, Firefox, and Chrome with no success.

Can someone please help me out here. Im lost for words. Its acting like a permission issue however it does eventually work. So I just dont know.

Magento 1.9 is my version


texts: Magento2 - How to change product view Grid or List without reload page?

texts:
I have search many hours to accomplish this but not get success to achieve last I tried Stack overflow link

and also add my custom jQuery in list.phtml file

<script>
    require(['jquery'], function ($) {
        jQuery(document).ready(function () {
            $(".mode-grid").click(function () {
                    alert('call Grid');
                    $('.mode-grid').addClass('active');
                    $('.mode-list').removeClass('active');

                }
            );
            $(".mode-list").click(function () {
                alert('call List');
                $('.mode-list').addClass('mode-list active');
                $('.mode-grid').removeClass('mode-grid active');
            });
        });
    });
</script>

but not get success, please help me to solve this ,I am new in Magento so also inform me where I make mistakes.

Thank you.


texts:
We had to print all shipping invoices but the email was at that time not sent. Now all orders are complete.

Is there a way to resend all the shipping emails en bulk?

Many thanks


texts: How to Add an icon next to Payment Method for Amazon Pay?

texts:
I have looked up a few similar question but can't figure how.
It's the default amazon pay module that came with Magento 2
I'm editing this file

  /var/www/html/vendor/amzn/amazon-pay-module/view/frontend/web/template/payment/amazon-payment-widget.html

but it's not making an effect ( also did setup:upgrade, s:s:d, c:f ..)

/**
 * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

                <input type="radio"
                       name="payment[method]"
                       class="radio"
                       data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>

                        <button class="action primary checkout"
                                type="submit"
                                data-bind="
                                click: placeOrder,
                                attr: {title: $t('Place Order')},
                                css: {disabled: isPlaceOrderDisabled()},
                                enable: (getCode() == isChecked())
                                "
                                disabled>

                        </button>


texts: i have a problem with the Magento CE 1.9. I can't find the field or option for the custom tax class.


texts: Issue with Overriding cart in Magento2.3.1

texts:
I want to add a custom button having a different value on the cart page I am facing issues with JS and won't understand what below line will do:

data-mage-init='{"Magento_Checkout/js/action/update-shopping-cart":
          {"validationURL" : "/checkout/cart/updateItemQty"}

Do I need to override things for the files mentioned here?

How many files do I need to override?
1. I override the template file.
2. UpdatePost controller
3. JS file named: shopping-cart.js (error: https://prnt.sc/no1y6o )

Anything that I am doing wrong here, or some more files I need to override.


texts: Business question about "Pending Payment" state/status

texts:
It's a business question but I hope someone will answer.

Why "Pending Payment" state/status is not visible on frontend by default?

I'm implementing right now Magento 2 integration with some payment gateway and the flow there looks like that:

Place order
Redirect to gateway
Make payment
Redirect to store (success or error page)
Wait for gateway to notify your store about payment status change

"5." usually takes a few seconds and sometimes even more. Because of that, when redirecting to success page, the transaction is often not finished and order status remains "Pending Payment". This leads to the weird behavior that properly placed order is not visible for customer right after paying.

Maybe I shouldn't use "Pending Payment" state at all in my case? Or maybe should I create module's own "Pending Payment" status which will be visible on frontend and force order to change its status to it?


texts:
So I am trying to create a dropdown on my homepage that will allow the user to select a brand and it will bring them to a page with each product that has that attribute selected.

So I took a post (http://www.blog.magepsycho.com/magento-utility-function-how-to-easily-create-select-box-for-drop-down-attributes/) and made a few changes to how it is called since it was throwing a fatal error.

function getSelectBox($attributeCode, $label = '', $defaultSelect = null, $extraParams = null){
    $options            = array();
    $product            = Mage::getModel('catalog/product');
    $attribute          = $product->getResource()->getAttribute($attributeCode);
    if($attribute->usesSource()){
        $options = $attribute->getSource()->getAllOptions(false);
        array_unshift($options, array('label' => $label, 'value' => ''));
    }

    $select = Mage::app()->getLayout()->createBlock('core/html_select')
            ->setName($attributeCode)
            ->setId($attributeCode)
            ->setTitle($label)
            ->setValue($defaultSelect)
            ->setExtraParams($extraParams)
            ->setOptions($options);
    return $select->getHtml();
}

This is the code that is calling the attributes inside of a dropdown.

The code I used to call it was:

<?php echo Mage::helper('function')->getSelectBox('manufacturer', 'Select Manufacturer'); ?>

This worked and called all the manufacturers for me however the issue is that if I select one of the manufacturers in the dropdown it does not bring me to another page with the products.

Each product in my store is assigned a manufacturer. Each manufacturer is listed in the dropdown. I just want it so when I click on one of the manufacturer options that it will bring me to a list of those products that have said manufacturer assigned.

I do not want an extension for this at all. Please refrain from suggesting them.

I do realize I can create categories for each of the brands as well however I am unsure if that would be the smartest way to do this.

Thank you! I would really appreciate any help here. :)


texts: Error in M2E Pro invoice/shipment increment ID duplicate key

texts:
I am using M2E Pro and sometimes Magento shows me an error stating that invoice or shipment is not created.

Error for invoice creation: Invoice was not created. Reason: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '53000000066' for key 'UNQ_SALES_FLAT_INVOICE_INCREMENT_ID'

Error for Shipment creation: Shipment was not created. Reason: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '53000000001' for key 'UNQ_SALES_FLAT_SHIPMENT_INCREMENT_ID'

May I please know how can I solve these errors?


texts: How to get products list by category ID?

texts:
How can I get a products list by category ID? I need to display them with products name or ID.

My code so far:

$productCollection = Mage::getModel('catalog/product')->load($currentctid)
                    ->getCollection()
                    ->addAttributeToSelect('name')
                    ->addAttributeToFilter('status', array('eq' => 1))
                    ->joinTable('pdp/productstatus', 'product_id=entity_id', array('*'));


texts: Magento 2.2 search does not find 2 number skus - like 21, 46, 54 etc

texts:
I am having the hardest time with this. We have skus that are of the form NN or NN-NN where N is a number below 10. We also have skus that are CC-CCCC where C is a character form a-z.
I have set the minimum word length in search to 2, and also set the word length for mysql.
BUT - I still cannot get the front end search to work for searches like 21, 46, 46-54 etc.
Has anyone else encountered this problem? Are there any settings else where? Is there a section of code I can modify?
Thanks very much
Sam


texts: Once the installation is completed, is there a posibility to change admin url? If yes how can I do that?


texts:
Here is my Directory structure of controller file in Magento 2 -
app/code/Namespace/Modulename/Controller/Adminhtml/Blacklist/Index.php

In Index.php i write the below code -

namespace Mynamespace\Modulename\Controller\Adminhtml\ModuleDirectoryname;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;

class Index extends Action
{
    protected $helper;
    protected $context;

    public function __construct(
        Context $context,
        \VT\Blacklist\Helper\Data $helper
    ) {
        $this->viewHelper = $viewHelper;
        parent::__construct($context);
    }

    public function execute()
    {
        echo "hello"; die;
    }
}

I am using this Inject - \Magento\Backend\Model\UrlInterface $urlBuilder, in my another __construct function and printing url through -

echo $url = $this->urlBuilder->getUrl('namespace_modulename/adminhtml/moduledirectoryname/index');

but once i m running above printed url its redirecting to Dashboard not printing 'hello' ;

Can you plz let me know What I m missing here ?


texts:
I need to get a .csv file of all products (over 30000) from a Magento 2 store. Problem is when I start the export from backend, Magento dies after a few minutes and throws 500 error.

Any idea how can I make this happen with such a large number of products without Magento dying?


texts: Paypal express is redirecting to paypal gateway instead of displaying payment in pop up

texts: I am having issue that in my magento 2 site I am using paypal express but at front end when we click on paypal express at checkout. it is redirecting to paypal site instead of displaying pop up to payment. Please let me know how to enable pop up/ modal box payment window. Thanks


texts: How to install Multiple Extensions in Magento 1.9 using CLI

texts:
Ok , I realise there is an opinionated side of this question , but I don't want to do this wrong and break an install.

I am relatively new to Magento , and when I install an extension there is a process :  usually something like:

Copy the first directory to your magento root folder , then
Copy the second folder to the same place. I assume that this is so that
magento doesn't try to install the extension while the files are
still being copied.

I want to roll out a new site , and I want to do the whole thing with a script preferably rather than sitting there for ages installing extensions one by one.

Is it safe to copy ALL the extension files ( maybe 10 different extensions ) excluding their .xml files that go in /etc/modules - then copy the .xml files and run the whole lot by going to the site ( clearing cache ,  logging out etc ).

OR

Should I use a command line to install some other way? ( they are files so I won't get from the magento marketplace directly ) .

Thanks for your time.


texts:
I am trying to show a inquiry form in a new static block, this is what I have done.

{{block type="core/template" template="app/design/frontend/default/default/template/imedia/productinquiry.phtml"}}

However it does not show anything. I am using Version magento 1.8.1


texts: create file attribute to customer image error occur in magento 2.3.6

texts:
create custom file attribute for customer, it is not compulsory or required to field but if file is not uploaded then throw error Uncaught TypeError: preg_match() expects parameter 2 to be string, bool given in C:\xampp73\htdocs\magento236\vendor\magento\module-customer\Model\Customer\Attribute\Validator\File.php.
How to solve it in Magento 2.3.6?


texts: Convert from quote item to order item is not working

texts:
There is custom field in quote_item table same as sales_order_item both column name and type are same.

I want to convert quote_item table to sales_order_item table. so I have used fieldset.xml to convert those data,

my fieldset.xml file is,

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
<scope id="global">
    <fieldset id="quote_convert_item">
        <field name="customcolumn1">
            <aspect name="to_order_item" />
        </field>
        <field name="customcolumn2">
            <aspect name="to_order_item" />
        </field>
    </fieldset>
</scope>
</config>

but its not working so strange


texts: Magento 2 - Save value from custom input field to quote_item

texts:
I have created an extra field Delivery in quote_item, I have also created a input field that customers can type in the delivery date they wished, on product page.

How can I save the value from this input field to the table quote_item when customer click on the add to basket button?

I can in this file \vendor\magento\module-checkout\Controller\Cart see that values to be added to the quote_item is taken from,

$params = $this->getRequest()->getParams();

So maybe I could just ask how I can pass my custom value from input field to the $params = $this->getRequest()->getParams(); ?


texts: Magento 2 Updating Other Products in catalog_product_save_after event Observer

texts:
I had created an Observer of this event:catalog_product_save_after
I am trying to update other products and loading them on the basis of their id, but it is giving me an error. I am Sharing my code here.

Code:-

    $product = $observer->getProduct();
    $productId = $observer->getProduct()->getId();
    $brand = $product->getBrand();
    $model = $product->getModel();

    $collection = $this->_productCollectionFactory->create();
    $collection->addAttributeToSelect('*');
    $collection->addAttributeToFilter('model', $model);
    $collection->addAttributeToFilter('brand', $brand);
    $collection->addAttributeToFilter('visibility', 4);
    $collection->addAttributeToSort('price', 'ASC');

    $i = 0;
    $prodId = [];
    foreach ($collection as $value) {
        if($i != 0) {
            $prodId[] = $value->getId();
        }
        $i++;
    }
    foreach($prodId as $mypro) {
        $productRepository = $this->_objectManager->get('Magento\Catalog\Model\Product')->load($mypro);
        $productRepository->setData('best_price', 0);
        $productRepository->save();
    }

What I Tried:-
I tried to save one product first without using foreach loop but it also gave the same error.
I tried to do it by this as well, but received the same error:-

$i = 0;
foreach ($collection as $value) {
if($i != 0) {
$prodId = $value->getId();
$productRepository = $this->_objectManager->get('Magento\Catalog\Model\Product')->load($prodId);
                $productRepository->setData('best_price', 0);
                $productRepository->save();
}
$i++;
}

Error:

  SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: UPDATE catalog_product_entity SET attribute_set_id = ?, type_id = ?, sku = ?, has_options = ?, required_options = ?, created_at = ?, updated_at = ? WHERE (entity_id = '5263')

Expected Result:
I wanted to save my custom attribute of other's product when one product is saved.

Please help me. I am trying to fix it from a couple of hours but didn't solve. Please guide me.


texts: Magento 2 - Why before function param is null , and then get value of param in func has value?

texts:
In Magento 2, Why before function param is null , and then get value of param in func has value?

I get value before:

I get value in function:

And result:


texts: How to confirm that the reindex is working or not?

texts:
We have added a new product in one of the categories on our site using the Magento admin panel. But the added product is not visible in the frontend.

We have set the reindex mode to Update on save but still the product which we uploaded newly is not visible in the frontend.

Do I need to manually reindex the data every time whenever I add any new things on our site even though I set the index mode to Update on save?

Please reply with your thoughts.

I manually reindex the data using the below command but the Product Categories and Catalog Product Rule haven't been updated. Please refer the below screenshot:


texts: (Solved) Magento 2.2.2 - Update product price per website programmatically not working

texts:
I'm trying to import product prices from an XML file, which contains prices in two different currencies for the same product (EUR and DKK).
I've created a website for each currency and set the "Catalog Price Scope" to "Website".

We also have websites for B2B and B2C, so we use the following website setup:

B2B - EUR
B2B - DKK
B2C - EUR
B2C - DKK

The problem is in the code below. In the foreach($storeIds as $storeId) loop, only the first store get updated correctly and the following stores will be set to "Use Default Price". Has anyone experienced something like this?

/**
 * Update product price
 * @param $line
 */
private function _updateProduct($sku, $price, $currency) {
    //EUR website store Ids
    $storeIds = $this->moduleHelper->getStoreIdsByCurrency($currency);

    foreach($storeIds as $storeId) {
        try {
            $product = $this->productRepository->get($sku, false, $storeId);

            if($product->getId()) {
                if ($product->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) {
                    //set price on associated simple products
                    foreach ($product->getTypeInstance()->getUsedProducts($product) as $_product) {
                        $this->_updateProductPrice($_product, $price, $storeId);
                    }
                } else {
                    //set price on simple product
                    $this->_updateProductPrice($product, $price, $storeId);
                }
            }
        } catch (\Exception $e) {
             // Intentionally left empty.
        }
    }
}

/**
 * Update product price for specific store
 * @param $_product
 * @param $price
 * @param $storeId
 * @return bool
 */
private function _updateProductPrice($_product, $price, $storeId) {
    try {
        $product = $this->productRepository->getById($_product->getId(),false, $storeId);
        $product->setStoreId($storeId);
        $product->setPrice($price);
        $product->save($product);

    } catch (\Exception $e) {
        // Intentionally left empty.
        return false;
    }

    return true;
}

If I change the array $storeIds to only have one store id, then the product price will be set correctly for that specific website.

I've found a working solution using ProductResourceModel instead of ProductRepositoryInterface.

/**
 * Update product price for specific store
 * @param int $productId
 * @param string $price
 * @param int $storeId
 * @return bool
 */
private function _updateProductPrice($productId, $storeId, $price) {
    try {
        $product = $this->productFactory->create();
        $this->productResourceModel->load($product, $productId);
        $product->setStoreId($storeId);
        $product->setPrice($price);
        $this->productResourceModel->saveAttribute($product, 'price');
    } catch (\Exception $e) {
        return false;
    }

    return true;
}


texts: how can i add a two year filter to my reports in magento 1.9

texts:
I want to add a two year interval filter to customer order by report grid ,but I have no idea about this.Anyone who have tried it please find me a way ,thanks in advance.
I found to add  code here in this path
app\code\core\Mage\Reports\Model\Resource\Report\Collection.php and code for a year interval is

$t['title'] =  $dateStart->toString('yyyy');
                        $t['start'] = ($firstInterval) ? $dateStart->toString('yyyy-MM-dd 00:00:00')
                            : $dateStart->toString('yyyy-01-01 00:00:00');

                        $lastInterval = ($dateStart->compareYear($dateEnd->getYear()) == 0);

                        $t['end'] = ($lastInterval) ? $dateStart->setMonth($dateEnd->getMonth())
                            ->setDay($dateEnd->getDay())->toString('yyyy-MM-dd 23:59:59')
                            : $dateStart->toString('yyyy-12-31 23:59:59');
                        $dateStart->addYear(1);

                        if ($dateStart->compareYear($dateEnd->getYear()) == 0) {
                            $dateStart->setMonth(1)->setDay(1);

                        $firstInterval = false;
                        break;
                        }

How can i modify this for two year interval period.


texts: Using ORM get all disabled products with qty > 0

texts:
Before I start, I have read over a dozen stack exchange posts related to this, all of them suggesting pretty much what I'm using, which doesn't work for me hence the question.

I want to get all disabled products with quantity > 0 and for this I am using the following:

        $products = Mage::getModel('catalog/product')->getCollection()
        ->addAttributeToSelect('name', 'sku', 'qty', 'status')
        ->addStoreFilter($this->storeId)
        ->joinField('qty',
            'cataloginventory/stock_item',
            'qty',
            'product_id=entity_id',
            '{{table}}.stock_id=1',
            'left')
        ->addAttributeToFilter('qty', array('gt' => 0))
        ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED));

    // debug
    $query = $products->getSelect()->__toString();

The query shows as this with no where clause:

SELECT 1 AS `status`, `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, `e`.`name`, `at_qty`.`qty` FROM `catalog_product_flat_1` AS `e` LEFT JOIN `cataloginventory_stock_item` AS `at_qty` ON (at_qty.`product_id`=e.entity_id) AND (at_qty.stock_id=1)

My results show everything in the store i.e with qty = 0 or any other qty and with any status.

I've tried every variation I can think of and find on stack exchange to no affect.

I would be grateful if anyone has any answer for this.

Many thanks


texts: Add transparancy in ->backgroundColor(array(0, 0, 0))

texts:
I want to add Transparancy in this code line. I'm using Magento 1.9.3.10. I already tried ->backgroundColor(array(0, 0, 0, 0.4)) but this does not seem to work. It just show's black background.

Full code:

$_images = $_product->getMediaGalleryImages();
$_count = 0;
foreach ($_images as $_key => $_image) {
    if ($_count > 3) {
        $_images->removeItemByKey($_key);
        continue;
    }
    $_image->setThumbnailUrl(
        $this->helper('catalog/image')
            ->init($_product, 'image', $_image->getFile())
            ->backgroundColor(array(0, 0, 0))
            ->keepFrame(true)
            ->resize(100, 100)
            ->__toString()
    );
    $_image->setClickUrl(
        $this->helper('catalog/image')
            ->init($_product, 'image', $_image->getFile())
            ->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)->resize(400)
            ->__toString()
    );
    $_count ++;
}


texts: I'm very new on Magento 2 framework. Can anyone help me from this problem? I Don't know how it actually product returns work. Is there any standard Magento logic for returns or can you advise on plugin?


texts: Actions dropdown too far right in Admin Listing

texts:
I've managed to add a second action to the actions column in the admin product listing. It works fine until I add another column to the display. The dropdown menu doesn't "follow" the actions column and stays on the right :

Is there any way to fix this ?
I'm running Magento 2.3.3
EDIT
Here's my code
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">
  <!-- Plugin that adds an action to the default admin panel product listing -->
  <type name="Magento\Catalog\Ui\Component\Listing\Columns\ProductActions">
    <plugin name="pluginname" type="Vendor\Module\Plugins\AddStatsActionToProductListing" sortOrder="1" disabled="false" />
  </type>
</config>

Plugin Class
public function afterPrepareDataSource(\Magento\Catalog\Ui\Component\Listing\Columns\ProductActions $subject, $result)
{

    foreach ($result['data']['items'] as &$item) {
        $item[$subject->getData('name')]['stats'] = [
            'href' => $this->_urlBuilder->getUrl(
                'vendor_module/groups_perproduct/index',
                ['product_id' => $item['entity_id']]
            ),
            'label' => __('Stats'),
            'hidden' => false,
            '__disableTmpl' => true
        ];
    }

    return $result;
}


texts: GraphQL Error in Magento 2.4.1: Cannot query field "uid" on type "ConfigurableProductOptionsValues"

texts:
I'm having trouble getting the uid for my Configurable product options via GraphQL.
Testing with this simplified query:
{
    products(filter: { url_key: { eq: "test-product" } }) {
        items {
            sku
            ... on ConfigurableProduct {
                configurable_options {
                    attribute_code
                    values {
                        uid
                        label
                    }
                }
            }
        }
    }
}

Remove uid and the query works fine. With it, the response is Error: Cannot query field "uid" on type "ConfigurableProductOptionsValues".
Similarly, I have the same issue with
ConfigurableProductOptions and attribute_uid (attribute_id and attribute_id_v2 both work, but the docs suggest using attribute_uid instead)
Even if I use the exact examples in the documentation, I get the same error.
Is this an environment setup issue? Or maybe the documentation is incorrect? Can't figure it out. Thanks for any help.


texts: How to get Simple product Customizable Options in a phtml file

texts: How to get a simple product Customizable option value and key in a .phtml file using product id or Sku Magento 2 ?


texts: Magento 2 is not updated when updating custom module

texts:
I create a custom module for magento 2. When I update the code, the update is not reflected on my shop.
I did set the mode to developer. Clean all the cache bin/magento cache:clean
What is the best practice for this while developing magento module?


texts:
How should I convert following sql statement into magento statement.

select value from customer_address_entity_varchar where attribute_id = 143 and entity_id = 567;


texts: Magento Sub Total Discounted Price and Original Price

texts:
am using this code to get Sub Total (Special Price)

  $price=Mage::helper('checkout/cart')->getQuote()->getSubtotal();

How can i get the Original Price and Special Price


texts: How to remove unselect event after select magento 2 configurable product

texts:
I have Magento 2(2.2.4) website, where I have 3 options(simple product) for a configurable product. I see Magento 2 behavior allow the user to unselect the option after selection.

So I want to remove the unselect event after selecting any option. The user should be able to use another option but should not be able to unselect the selected option.

Note: I am not a developer, so when you reply request you to reply with exact file path where to edit. That will really help me to fix my issue.

Thanks in Advance!!


texts:
I want to switch my language menu with flags. I am using Fasony theme.
my current code for the language_custom.phtml is :

<?php if (count($block->getStores())>1): ?>
<?php $id = $block->getIdModifier() ? '-' . $block->getIdModifier() : ''?>

    <?php /* @escapeNotVerified */ echo __('Language') ?>
    <?php /* @escapeNotVerified */ echo __('Your Language : ') ?>

        <strong class="view-<?php echo $block->escapeHtml($block->getCurrentStoreCode()) ?>">
            <?php echo $block->escapeHtml($block->getStoreName()) ?>

        <?php foreach ($block->getStores() as $_lang): ?>
            <?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
                <li class="view-<?php echo $block->escapeHtml($_lang->getCode()); ?> switcher-option">
                    <a href="#" data-post='<?php /* @escapeNotVerified */ echo $block->getTargetStorePostData($_lang); ?>'>
                        <span class="flag-icon flag-icon-<?php echo $_lang->getCode() ?>"> <?php echo $block->escapeHtml($_lang->getName()) ?>

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

<?php endif; ?>

and it looks like this :

I changed it with this code :

<?php if(count($this->getStores())>1): ?>

    <?php foreach ($this->getStores() as $_lang): ?>
        <?php if ($_lang->getCode() != 'default'): ?>
        <a class="lang-flag" href="<?php echo $this->getCurrentUrl().'?___store='.$_lang->getCode();?>" style="text-decoration:none;" title="<?php echo $_lang->getCode();?>">
            <img src="<?php echo $this->getSkinUrl('images/flags/'.$_lang->getCode().'.gif');?>" alt="<?php echo $_lang->getCode();?>">

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

<?php endif;?>

But I can't get the pictures :

in the code inspector I get empty src="":

I want also to change the icon of the setting with the current language flag.

My flag icons english.png and deutsch.png are in the folder : app/design/frontend/Venustheme/fasony/web/images/flags/


texts: Magento 2: Add password strength meter in custom form

texts: Hello i have created custom form in which i need to add password strength meter, i just copy the customer form as my custom registration form but password strength meter not work how can i do that?


texts: Magento cart - get the bundle parent and children product

texts:
When looking at the cart from code (for example in the checkout_cart_save_after event), how do I tell which items are part of bundles and which are not?

For example, lets say I have a bundle which is a pack of 4 shirts together with a discount, and those same shirts can also be purchased separately, as simple products.

Now a user added this bundle to cart + 2 of those shirts without any bundle.
If I look at the products in cart, by using something like this:

Mage::getModel('checkout/cart')->getQuote()->getAllItems();

I will get a total of 7 items - the bundle product, and 6 shirts.

How can I tell which of the shirts are part of the bundle and which were bought separately?

Thanks!


texts: Magento, disable Export Products from Manage products

texts: I need to disable the export products function of magento sites for users that will have only permission to add or manage products.


texts: Update product programmatically not updating quantity in Magento 2

texts:
I am updating a Configurable product to just set quantity.but it keeps showing 0 in admin and not updating it.

$product->setQuantityAndStockStatus(['qty' => 32, 'is_in_stock' => 1]);


texts: Magento 2: Maintain Database Changes on Git Versioning

texts:
I'm using Magento 2 CE Version 2.1.2.

As we are multiple users are working on Same Project. We have Main Copy of Code + DB on Our Server.

We have done git clone <repository url> so everybody has local copy of Code + Database Individually.

The code will manageable. What about database modifications? Everybody is working on different Module & they have coreDB Table changes also.

For custom module will be managable using InstallSchema.php, UpgradeSchema.php.

What about Magento Core Tables Example: core_config_data,customer_entity, etc.

How to manage Versioning of that & Upload Changes with File as well.

Have already gone through http://devdocs.magento.com/guides/v2.0/migration/migration-tool-install.html


texts: Set Base currency in magento2 by programmatically

texts:
I am trying to set base currency pro-grammatically with below code.

class Currency extends \Magento\Framework\App\Action\Action
{
  protected $_storeManager;
   public function __construct(
     \Magento\Backend\Block\Template\Context $context,
     \Magento\Store\Model\StoreManagerInterface $storeManager,
     array $data = []
      ) {
      $this->_storeManager = $storeManager;
      parent::__construct($context, $data);
   }
   public function execute() {
    $currencyCode = 'USD';
    $this->_storeManager->getStore()->setCurrentCurrencyCode($currencyCode);

  }
}

The above code is not setting the base currency, can anyone tell me where i am wrong? Thanks in Advance!!.

Update

I followed Rohan answer, then getting below error.

Here product prices in basket showing with changed currency, but order summary still showing with the old currency.


texts:
Invalid Form Key. Please refresh the page?

My chrome browser always give this error even if I have changed the php.ini
configuration

max_input_vars = 75000

I am using nginx server and public IP (hosted the site in public server).
in Firefox it works very well.


texts: recently viewed product collection is empty in magento 2

texts:
I have added a code in Magento_Catalog/layout/catalog_product_view.xml

<referenceBlock name="product.info.details">

       <block class="Magento\Reports\Block\Product\Widget\Viewed" name="recently_viewed" template="Magento_Reports::widget/viewed/content/viewed_grid.phtml" group="detailed_info">
            <arguments>
              <argument translate="true" name="title" xsi:type="string">Recently Viewed</argument>
              <argument name="sort_order" xsi:type="string">50</argument>
            </arguments>
            <action method="setPageSize">
                    <argument name="page_size" xsi:type="number">4</argument>
                </action>
        </block>
    </referenceBlock>

The above code showing only the recently viewed tab, but products are not showing.

Here i am attaching the screenshot,

Please anyone look into it and update me. Thanks


texts: Need help to stop malicious code in index.php file


texts: jQuery DataTables.js How to Apply It On Admin Grid

texts:
I'm very new to Magneto, I'm trying to add jQuery DataTables in Magento 2.3, in below image i get error in console:

Here is my Code:

Add file in /EC/Downloads/view/adminhtml/requirejs-config.js.

var config = {
    map: {
        '*': {
            dataTableJs: 'ES_Downloads/js/jquery.dataTables.min'
        }
    }
 };

includ css file like below in /EC/Downloads/view/adminhtml/layout/downloads_index_reports.xml

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

I moved my css and js files into respective folders. e.g
/EC/Downloads/view/adminhtml/web/js/datatables.min.js
/EC/Downloads/view/adminhtml/web/css/datatables.min.css

I used below code in my template file to load DataTable.

<table>
  ....
</table>

<script type="text/javascript">
require(['jquery', 'jquery/ui','dataTableJs'], function($){
    $(document).ready(function($){
        $('#example').DataTable();
    });
});
</script>

Seems DataTable is not loading, getting below error in console:

Thanks in advance


texts:
I want to overwrite the class Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection. But my new classes is ignored at the frontend. Any idea how to fix that? Is my config.xml wrong? Cache renewed several times.

Magic_Base.xml ( app/etc/modules )

<config>
    <modules>
        <Magic_Base>
            <active>true</active>
            <codepool>local</codepool>
        </Magic_Base>
    </modules>
</config>

/app/code/local/Magic/Base/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php ( which is the overwritten class )

Magic_Base_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
    extends Mage_Core_Model_Resource_Db_Collection_Abstract

config.xml ( Magic/Base/etc/config.xml )

 <config>
    <modules>
        <Magic_Base>
            <version>0.1</version>
        </Magic_Base>
    </modules>
    <global>
       <models>
          <catalog>
              <rewrite>
                  <resource_product_type_configurable_attribute_collection>Magic_Base_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection</resource_product_type_configurable_attribute_collection>
              </rewrite>
          </catalog>

           <catalog_resource_product_type_configurable_attribute>
              <rewrite>
                  <collection>Magic_Base_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection</collection>
              </rewrite>
          </catalog_resource_product_type_configurable_attribute>

       </models>
    </global>
</config>


texts: Magento set customer address as default address in address book page itself

texts:
How can I set address as default billing address when a radio button is added in customer address book without going to edit address page. Please find the below screenshot,

https://prnt.sc/ihngmf

Thanks


texts:
I've just installed a plugin and now magento isn't working anymore. Firstly i thought this was due to the plugin but even after disabling/removing the plugin the problem persists.

Magento backend is working just fine, the problem is solely on the frontend which just shows a blank page.
Error from the log:

include(): Failed opening 'Mage.php' for inclusion (include_path='/var/www/magento/app/code/local:/var/www/magento/app/code/community:/var/www/magento/app/code/core:/var/www/magento/lib:.:/usr/share/php:/usr/share/pear') in /var/www/magento/lib/Varien/Autoload.php on line 93

Now mage.php is located in /var/www/magento/app so i get the error message but adding this directory to the include path raises other errors. Mage.php is also included in index.php so i was wondering why is it included throughout the autoloader anyways?

Furthermore i tried reseting file/folder permissions to 644/755 but still no results. I'm running version 1.8.1.0

Afterwards PHP tries to look for the Mage class in the functions.php file which also fails.

[Wed Apr 09 20:46:23 2014] [error] [client 195.240.204.196] PHP Warning:  include(Mage.php): failed to open stream: No such file or directory in /var/www/magento/lib/Varien/Autoload.php on line 93
[Wed Apr 09 20:46:23 2014] [error] [client 195.240.204.196] PHP Warning:  include(): Failed opening 'Mage.php' for inclusion (include_path='/var/www/magento/app/code/local:/var/www/magento/app/code/community:/var/www/magento/app/code/core:/var/www/magento/lib:.:/usr/share/php:/usr/share/pear') in /var/www/magento/lib/Varien/Autoload.php on line 93
[Wed Apr 09 20:46:23 2014] [error] [client 195.240.204.196] PHP Fatal error:  Class 'Mage' not found in /var/www/magento/app/code/core/Mage/Core/functions.php on line 244

Hope anyone can help, thanks.


texts: Magento 1.9 checkout stuck on shipping methods

texts:
I am having a problem with Magento 1.9 one page checkout- it gets stuck on shipping options. The shipping is set up as flat.
When trying to checkout it gets stuck on shipping methods- no error just not going further.
I have opened the console and got the error Failed to load resource: net::ERR_CACHE_MISS

the log says this

  2015-01-06T11:17:42+00:00 ERR (3): Warning: curl_setopt():
  CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set
  in /home/pmtesten/public_html/downloader/lib/Mage/HTTP/Client/Curl.php
  on line 510 2015-01-06T11:17:43+00:00 ERR (3): Warning: curl_setopt():
  CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set
  in /home/pmtesten/public_html/downloader/lib/Mage/HTTP/Client/Curl.php
  on line 510 2015-01-06T11:17:46+00:00 ERR (3): Warning: curl_setopt():
  CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set
  in /home/pmtesten/public_html/downloader/lib/Mage/HTTP/Client/Curl.php
  on line 510 2015-01-06T11:17:46+00:00 ERR (3): Warning: curl_setopt():
  CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set
  in /home/pmtesten/public_html/downloader/lib/Mage/HTTP/Client/Curl.php
  on line 510 2015-01-06T11:17:47+00:00 ERR (3): Warning: curl_setopt():
  CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set
  in /home/pmtesten/public_html/downloader/lib/Mage/HTTP/Client/Curl.php
  on line 510 2015-01-06T11:25:36+00:00 DEBUG (7): HEADERS ALREADY SENT:
  [0]
  /home/pmtesten/public_html/app/code/core/Mage/Core/Controller/Response/Http.php:52
  [1]
  /home/pmtesten/public_html/lib/Zend/Controller/Response/Abstract.php:768
  [2]
  /home/pmtesten/public_html/app/code/core/Mage/Core/Controller/Response/Http.php:84
  [3]
  /home/pmtesten/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php:184
  [4]
  /home/pmtesten/public_html/app/code/core/Mage/Core/Model/App.php:354
  [5] /home/pmtesten/public_html/app/Mage.php:684 [6]
  /home/pmtesten/public_html/index.php:87


texts:
How do I add so the customer can see which email they have entered in "Shipping Address" in the checkout?

Is it possible do it in the "Address Templates" (configuration->customers->customer configuration)? I have already tried {{var email}} without any luck.

Hoping someone can help me with this.

Thanks in advance!
/Daniel


texts: Magento 2 - How to hide/remove custom attribute from backend Account Information tab in customer page?

texts:
I have a custom attribute showing in the account information tab page. how can I remove them?

Right now I can see the following


texts: Can't save new CMS/Pages because URL Validation

texts:
I'm on Magento 1.9.0.1 and everything is working well but if i try to generate Content via CMS/Pages/New Page i´ve got a big problem.

When i fill out the forms for a new Page I get this error under the URL Key Field in the "Page Information" Area:

Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".

I can't save this page due to this error. Even if I try to edit an existing page i get this error.

Do I have to define special URL Keys anywhere? What can I do?

Thanks

Tamás


texts: How to get stock quantity of configurable product in Magento 2

texts:
I am able to get all the available sizes of configurable product calling

  getJsonConfig()

of below class

  Magento\ConfigurableProduct\Block\Product\View\Type\Configurable;

But I need stock of each options.


texts: Remove js file for specific type of product view

texts:
I need to remove/disable a js file which is loaded in page.xml, within the block <block type="page/html_head" name="head" as="head">, but just for "Grouped" products.

The file name is jquery-ui-1.8.23.custom.min.js and I tried to disable it by adding:

<action method="removeItem"><type>skin_js</type><name>js/jquery-ui-1.8.23.custom.min.js</name></action>

Inside: <PRODUCT_TYPE_grouped translate="label" module="catalog"> in catalog.xml file.
This didn't worked. How can I achieve this?.
I've already tried to disable this js file by adding a script in view.phtml file, but didn't work neither.

Thanks for your help


texts: 5.5.52-MariaDB with Magento 2 will it work properly

texts:
I am trying to import Magento 2 database on 5.5.52-MariaDB.
while it was import I got an error the import stop at admin_user
ERROR:
"MySQL Error There can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause"

I am wondering if 5.5.52-MariaDB isn't the right version and that's why I am getting this error.

As per Magento 2 Docs it does not say which version of MariaDB it requires.
Does anybody knows or have more imformation about this?
Thank's in advance.


texts: Save Form data to database Gives error: Call to a member function addData() on boolean

texts:
Have the following fields in my from:

    protected function _prepareForm()
{
    $form = new Varien_Data_Form(array(
        'id' => 'edit_form',
        'action' => $this->getUrl('*/*/save'),
        'method' => 'post',
        ));

    $form->setUseContainer(true);
    $this->setForm($form);

    $helper = Mage::helper('optfirst_reviewmycompany');
    $fieldset = $form->addFieldset('display', array('legend' => $helper->__('Select Social Icons'),
            'class' => 'fieldset-wide'));

    $fieldset->addField('facebook', 'text', array(
        'name' => 'facebook',
        'label' => $helper->__('Facebook'),
        ));
    $fieldset->addField('google', 'text', array(
        'name' => 'google',
        'label' => $helper->__('Google'),
        ));
    $fieldset->addField('twitter', 'text', array(
        'name' => 'twitter',
        'label' => $helper->__('Twitter'),
        ));
    $fieldset->addField('linkedin', 'text', array(
        'name' => 'linkedin',
        'label' => $helper->__('Linkedin'),
        ));
    $fieldset->addField('yelp', 'text', array(
        'name' => 'yelp',
        'label' => $helper->__('Yelp'),
        ));

    if (Mage::registry('optfirst_reviewmycompany')) {
        $form->setValues(Mage::registry('optfirst_reviewmycompany')->getData());
    }

    return parent::_prepareForm();
}

Here is my Modal:

     class OptFirst_ReviewMyCompany_Model_Review extends       Mage_Core_Model_Abstract
     {
    public function _construct()
     {
     parent::_construct();
     $this->_init('optfirst_reviewmycompany/review');
    }
   }

And here is my controller function to save data:

public function saveAction()
    {

    $data = $this->getRequest()->getParams();
if ( $data ) {

    print_r($data);

    $this->_getSession()->setFormData($data);
    $model = Mage::getModel('reviewmycompany/review');
    $id = $this->getRequest()->getParam('id');
    try {
        if ( $id ) {
            $model->load($id);
        }
        $model->addData($data);
        //saves data
        $model->save();

        $this->_getSession()->addSuccess(
                $this->__('Data was saved'));

        $this->_getSession()->setFormData(false);

        if ( $this->getRequest()->getParam('back') ) {
            $params = array('id' => $model->getId());
            $this->_redirect('*/*/edit', $params);
        } else {
            $this->_redirect('*/*/list');
        }
    } catch ( Exception $e ) {
        $this->_getSession()->addError($e->getMessage());
        if ( $model && $model->getId() ) {
            $this->_redirect('*/*/edit', array(
                'id' => $model->getId()
            ));
        } else {
            $this->_redirect('*/*/new');
        }
    }

    return;
}

When I save form it gives following error:

  Call to a member function addData() on boolean in
  C:\xampp\htdocs\magento-new\app\code\community\OptFirst\ReviewMyCompany\controllers\Adminhtml\AdminformController.php
  on line 77

I need help to solve this issue so the form successfully save data to database table


texts: Magento 2 How to change attribute filter position in layered navigation

texts: I want to move the climate product attribute position from the bottom to the third position. Can you please help me out?


texts: Magento 2: How to add a tracking number to an order using REST API

texts:
I use the following code to add a tracking number to an order:
        $url = 'https://xxxxx/rest/V1/order/514/ship';

        $authorization = "Authorization: Bearer ".$json; //I get $json in other part of the code, this work fine

        $data = [
            "items" => [
                [
                    "order_item_id" => 614,
                    "qty" => 1
                ]
            ],

            "tracks" => [
                "track_number" =>"1111111111",
                "title" => "Pedido enviado",
                "carrier_code" => "DHL"
            ]
        ];

        $data_string = json_encode($data);

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
        $result = curl_exec($curl);
        curl_close($curl);
        $json2 = json_decode($result);

But I get the following error:
"Shipment Document Validation Error(s): Please, introduce a tracking number.
What is the problem?
Thank you very much!!!


texts: Moving extension from Connect to Marketplace problem

texts:
Magento announced they will close Magento Connect site just 30 days before closure. Everything would be OK if they would provide a fast way to move extension from Connect to Marketplace, but this is not a case.

It took almost 1 week to get approved business review. Now I need to submit extension to pass technical review. But when I try to upload extension it shows this error:

You have already created the "company/module_name" extension. Use the edit form for adding new versions.

I don't have any existing extension inside, only the one with business review status. I contacted their support, I even contacted their partnership program and was ready to pay almost $5000 for their partnership program to get priority support, but they simply ignored my message and after 1 week I still don't have any reply from them. I get main revenue from Google serp (1st position) but if they close Connect site before they move my extension to Marketplace I will lose this position and most of the revenue.

Do anybody face the same problem about "You have already created the..." error? I am lost here, I can not get their support but they will close the site in 4 days. Not very professional from them.


texts: Magento 1.9 cron maximum execution time exceeded

texts:
I've got custom module to generate feeds for google shopping and others.

When i'm running from magento cron i've got this error:

PHP Fatal error:  Maximum execution time of 1800 seconds exceeded in...

but if i check the php option i've got this:

[root@mail ~]# /opt/plesk/php/5.6/bin/php -i | grep max_execution_time
max_execution_time => 0 => 0

and i can't find 1800 value in any php.ini in the server.

So where cron.php get this value for max_execution_time?


texts: Magento 2 Custom Theme : Which files to edit in order to customize home page / category css?

texts:
I'm trying to insert some CSS changes, after already inserting the html changes in the "content" part of the Home Page cms page.Changes to category pages will follow the same process, once proven that it works.

I'm trying to install a Custom Bootstrapped CSS Grid (it doesn't matter which one, I just need to insert one and edit it to suit my layout needs)

http://cf.dev.thedt.com/  is my M2 working station

Please help me understand which files i need to edit in order to customize my layout. I have attached an images with the structure as best as it can fit

I've tried modifying

/web/app/design/frontend/Smartwave/porto/Smartwave_Porto/layout  -> default.xml

(as explained under devdocs.magento -> override theme layouts)

It doesn't change anything on the home page.
(I can't paste it, it's too long)

Either I inserted the css modification in the wrong place, or it's the wrong file, or something cache related (all cache disabled with custom theme by default)

To identify easily the structure, I'll post two screenshots :

By browsing I've also discovered :

Porto/web/css/source content - less files
Should I change the less files instead? _theme.less? _layout.less?

Please help me sort this out. I only need one example, I'll copy and adapt it as much as it takes after that.

p.s. I'm modifying the Porto Parent Theme because the Child Theme doesn't have any files in it (I did create it)


texts: I need a common tax rate for all countries, cities and everything. Just common 25$ VAT for the whole world. Is there any way to do that?


texts: Switching to developer mode not working in M2

texts: Good day everyone, We have recently migrated our site from one server to another server and configured Varnish and Redis. Now when I try to switch my magento mode from default to developer using bin/magento deploy:mode:set developer my layout is breaking up and I am not able to see any products. Any help is highly appreciated.


texts:
We are using an extension called Mass Product Import & Update. My colleague gets SQL error when he is trying to upload a CSV file to add/update products/group products in this extension, but I have no issues, I can use the same CSV file as him and that goes through successfully.

If he logs in with my credentials he is able to upload the CSV file but when he logs back to his profile he gets the error again.


texts: Optimized way to get Total Delivered Items in Magento 2

texts:
I am looking for an optimized way to get the total number of shipped/delivered items from the entire purchase history of a customer.

This is the code i am using right now.

/* $this->order = Magento\Sales\Model\Order */
/* Get Total numbers of delivered items */
$customerEmail = 'abc@test.com';
    $ordercollection  = $this->order->getCollection()
        ->addAttributeToFilter('customer_email', $customerEmail);
    $totaldelivereditems = 0;
    foreach ($ordercollection as $orderobj){
        foreach ($orderobj->getAllVisibleItems() as $item) {
            $totaldelivereditems += $item->getQtyShipped();
        }
    }

But it doesnt seems to me an optimized code in case if customer has more than 100 orders or more in his purchase history. This loop might take some time.
If anyone knows better way to achieve the same data (total delivered items), I would really appreciate his help.


texts: I want to add my custome links in header? I tried but it did not work. .Here is my default .xml file code.Someone Please help me

texts:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <!--Add Logo-->
            <referenceBlock name="logo">
                <arguments>
                    <argument name="logo_width" xsi:type="number">100</argument>
                    <argument name="logo_height" xsi:type="number">100</argument>
                    <argument name="logo_file" xsi:type="string">images/logo.jpg</argument>
                </arguments>
            </referenceBlock>

       <referenceBlock name="header.panel">

            <block class="Magento\Framework\View\Element\Html\Link" name="top.links" after="authorization-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Checkout</argument>
                    <argument name="path" xsi:type="string" translate="true">checkout</argument>

                </arguments>
            </block>

             <!--  you can easly Remove  links with following code -->
            <referenceBlock name="register-link" remove="true" />
            <referenceBlock name="wish-list-link" remove="true" />
            <referenceBlock name="my-account-link" remove="true" />
            <referenceBlock name ="footer" remove="true" />

</referenceBlock>

    </body>
</page>


texts:
I am using Magento 1.9 and using the theme elegance
. I have installed the theme manually from extracting the files in root directory and by following the instructions in the site domain. But my theme isn't loading correctly and if I check in the developer's console. I see the theme source file is just skin/frontend/ instead of skin/frontend/luxury/. All the CSS and page contens are also not working properly. You can check here - http://stuffkart.com

Also, some js and css files are loading from skin/frontend/base/

I am a bit new to Magento. Searched a lot, but can't find anything that could've solved it.


texts: Magento2 - Create block on product page before tabs & details but after product media and product info via xml

texts:
I have created a phtml file which I want to add to my product pages.

I know that there are two containers at the top which are product.info.media and product.info.main. Then there is product.info.details, the area where the tabs are and the description starts (product.info.description).

My problem: I can't reference the exact spot where I want to place my block. It is supposed to be displayed just between the two div classes product media and product info detailed.

I have tried

<referenceContainer name="product.info.media">
    <container name="product.info.afterprice" after="-" label="Product info afterprice" htmlTag="div" htmlClass="product-info-after-price">
        <block class="Magento\Framework\View\Element\Template" name="product-extra"  template="Magento_Theme::html/added/product-extra.phtml" />
    </container>
</referenceContainer>

OR

<move element="product.info.afterprice" destination="product.info.details" before="-" />

but never shows where I want it to be. How can I reference the main product content area and say after="product.info.media" or before="product.info.details"?


texts: Magento 2 How to pass collection of custom attribute using multiselect options from block

texts:
In list.phtml I am fetching newly created block's function.
like e.g.

$blockObj= $block->getLayout()->createBlock('Custom\Module\Block\Entree');

$dataget = $blockObj->getProductdata($_productCollection);

Now I am using this $dataget variable by replacing of $_productCollection variable. But product count showing wrong.
How can I use below $call variable and return it from this block to my phtml, coz having problem as its in foreach loop.
I have created block, but collection is showing wrong.
Please find below my block code:

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

 namespace Custom\Module\Block;

class Entree extends \Magento\Framework\View\Element\Template
{
protected $_productRepository;
protected $attributeRepository;
protected $_categoryFactory;
private $registry;

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
    \Magento\Catalog\Model\ProductRepository $productRepository,
    \Magento\Catalog\Model\Product\Attribute\Repository $attributeRepository,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory,
    \Magento\Framework\Registry $registry,
    array $data = []
)
{
    $this->registry = $registry;
    $this->_categoryFactory = $categoryFactory;
    $this->attributeRepository = $attributeRepository;
    $this->_productRepository = $productRepository;
    $this->productCollectionFactory = $productCollectionFactory;
    parent::__construct($context);
}
public function getProductdata($_productCollection)
{
     $currentCategory = $this->registry->registry('current_category');
     $ids = $currentCategory->getParentCategory()->getId();//$currentCategory->getId();

        $category = $this->_categoryFactory->create()->load($ids);

        $filterOptionIds = array();
        foreach($_productCollection as $products){
            if($products->getFilterType()){

                $filterOptionIds[][$products->getId()] = explode(",", $products->getFilterType());

            }
        }

        foreach ($filterOptionIds as $filterOption) {

            if($filterOption != ''){

            $coll = $this->productCollectionFactory->create()->addAttributeToFilter('filter_type', array('eq' => $filterOption))->addCategoryFilter($category)->load();

            }
        }


texts: How to add a Product option value programmatically in magento?

texts:
I have a product with a custom option named as Instructions which is a textarea type and is not required.

Now suppose some one doesn't fill it. how to add this value through by program.

What i have done so far is , I have managed to update the option value through a action :

$options = $item->getOptions();

foreach ($options as $option)
    {

    switch (true)
        {

            case (strtolower($option->getCode()) == 'info_buyrequest') :
                $unserialized = unserialize($option->getValue());
                $unserialized['options'][2] = $info_option_value;
                $option->setValue(serialize($unserialized));
                break;

                case ($option->getCode() == "option_2") :
                $option->setValue($info_option_value);
                break;
        }

    }
    $item->setOptions($options)->save();
    Mage::getSingleton('checkout/cart')->save();

But I am not getting how to create a similar action which adds the option value.

Hope anyone can help