texts: Group products when showing recently sold items using sales/order_item

texts:
I can show the most recently sold items and sort them based on created_at using this:

$itemsCollection = Mage::getModel('sales/order_item')->getCollection()
->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC)
->addAttributeToSelect('*')
->setCurPage(1)->setPageSize(5);

/*$itemsCollection->getSelect()->group('product_id');*/

foreach($itemsCollection as $item) {
    echo $item->getName() . ' - ' . $item->getData('created_at') . '</br>';
}

This will show as:

Product_A - 2016-07-22 09:02:59
Product_B - 2016-07-22 07:03:44
Product_A - 2016-07-22 01:13:09
Product_C - 2016-07-21 23:13:00
Product_D - 2016-07-21 22:16:32

So there is two Product_A and 3 with a date 2016-07-22 Which is exactly how it should be but when I try and group the items, I do not see any item/order from 2016-07-22.

To group, I am using $itemsCollection->getSelect()->group('product_id');

This will show as:

Product_E - 2016-07-21 21:13:00
Product_A - 2016-07-21 16:07:08
Product_F - 2016-07-21 05:26:06
Product_G - 2016-07-20 08:03:11
Product_H - 2016-07-18 10:36:29

What is happening?

Is there a way around this? I want to display recently sold items but I do not want duplicates.


texts: Magento 2: update an existing backend menu item

texts:
Let's say there's a module that declares a custom admin menu item via menu.xml like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Vendor_Module::test" title="Test" module="Vendor_Module" sortOrder="100" parent="Magento_Backend::content" resource="Vendor_Module::test" />
    </menu>
</config>

How to update (let's say change the label) this menu item via another module's menu.xml ?


texts: Magento 2 : Favicon icon is not showing for Magento root txt files

texts:
I have manually created robots.txt file and pasted it in the Magento root folder. when I search for robots.txt file in the browser, It's not showing favicon icon. I thought I have missed something, but when I look for other text files which are pasted in the Magento root folder, that is also not showing favicon icon.

Could you please clarify and help me to display favicon icon for text files?

Your help will be greatly appreciated. Looking forward to your reply.

Thanks,


texts: Unable to login into admin site and change

texts: i am a layman. don't know anything much about magento based website. i can not open my website and it is not letting me login to admin page. it says  /home/himalaya/public_html/app/code/core/Mage/Captcha/Block/Captcha.php on line 43


texts: How to skip Shipping method step in checkout if only one shipping method in Magento 2?

texts: I have only one shipping method on my website. Do I want to skip shipping method step on the checkout page?


texts:
I'm new to Magento, and just did a fresh install of 1.9.0.1. After the installation I'm able to re-index every item in indexadministration except stock status. For some reason it can't do it.

I've tried to delete all files in var/Locks which doesn't help. Secondly I've tried to create a PHP script that would do the trick. The PHP-script returns the following error:

'SQLSTATE[42S02]: Base table or view not found: 1146 Table
'[my_db].cataloginventory_stock_status_idx' doesn't exist'
(I've edited out my domain..)

I checked for the index in PHPmyadmin, and it seems that it doesn't exists. If someone could tell me which they have on the table, I might be able to re-create them manually.

Any suggestions on what to do?

Thanks in advance.


texts: Magento 2 add category url in all products, frontend

texts:
I want to display all product url in frontend with category name inside, I had checked all the configuration, but didn't find anything.
Now I think I have to do it by coding, please guide me little bit how to start?


texts: White listed static block is not displaying in home page

texts: After upgarding to 1.9.2.2 the {{block type="cms/block" block_id="home-news-text" template="cms/content.phtml"}} in home page is not displaying the content of the block. I have added the block id in white list but still not appearing. What step am I missing?


texts: Magento 2 Decrease stock when invoice is placed

texts: I want change product stock when invoice is placed, not change when order is placed. Thanks everybody!


texts: Magento 2 delete product from shopping cart page (My remove button is in default.phtml file)

texts: Hi I moved my remove button to Magento_Checkout\templates\cart\item\default.phtml now how can i delete the product?


texts: Huge amount of Customer need to be import in short time

texts:
I am converting site from .net to magento. In the .net system there are nearly 15 lakh(1500000) customer records. I tried with magento default customer import method using csv. It takes 2 hours for 10k records.

So, I have written custom import function. Earlier it was working well. After importing 2 lacks records, the same time is problem coming now. Is there any solution to make fast in this situation?

Please advise my do to this thing in better way.

Thanks in advance.


texts: i getting the error "Access denied Please try to logout and sign in again. If this message persists, please contact the store owner." when i try to login in admin panel. i have no other username and password.I also tried to log out and login again but same problem. please tell me any solution.


texts: How to save configurable product with its attributes in magento 2

texts:
I wish to save  product with its attributes. I have tried below code,It works fine while saving simple products. but if i gave configurable product sku in my csv file, then  it shows an error as

 PHP Fatal error:  Uncaught Magento\\Framework\\Exception\\InputException: Option values are not specified.

Please proovide me a solution to save configurable product with its attributes

strong text
myfile.php

<?php

use Magento\Framework\App\Bootstrap;

require __DIR__ . '/../app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');

$file = 'csv/test.csv';
$headers = false;
$handle = fopen($file, "r");
if (empty($handle) === false) {
    while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) {

        if ($row[0] == 'sku')
            continue;
        // get all the attibute and options
        $sku = $row[0];
        $color = $row[1];
        $colorAttrOptionId = getAttrOptionId('color', $color, $objectManager);
        $productId = $objectManager->get('Magento\Catalog\Model\Product')->getIdBySku($sku);
        $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($productId);
        $_product->setColor($colorAttrOptionId);
        $_product->setWebsiteIds(array(1));
        $_product->save();
    }
}
fclose($handle);
echo "Sucess";

function getAttrOptionId($attributeCode, $attributeLabel, $objectManager)
{

    $eavConfig = $objectManager->get('Magento\Eav\Model\Entity\Attribute');
    $attributeId = $eavConfig->getIdByCode('catalog_product', $attributeCode);
    $attr = $objectManager->get('Magento\Eav\Model\Entity\Attribute')->load($attributeId);
    $attributeType = $attr->getFrontendInput();

    $attroptionid = array();
    if ($attr->usesSource()) {
        if (strpos($attributeLabel, ',')) {
            $multiselectLabel = explode(',', $attributeLabel);
            foreach ($multiselectLabel as $multiselect) {
                $multiattroptionid = $attr->setStoreId(0)->getSource()->getOptionId($multiselect);
                $attroptionid [] = $multiattroptionid;
            } return $attroptionid;
        } else {
            if ($attributeType == 'multiselect') {
                $optionid = $attr->setStoreId(0)->getSource()->getOptionId($attributeLabel);
                $attroptionid = $optionid;
                return $attroptionid;
            } else if ($attributeType == 'select') {
                $attrbuteoptionid = $attr->setStoreId(0)->getSource()->getOptionId($attributeLabel);
                return $attrbuteoptionid;
            }
        }
    }
}

csv file


texts: Magento 2.3.2 Admin Dashboard Page Data Charts Not Displaying

texts:
Our main Dashboard page is not showing any data such as graphs etc. otherwise, the page renders and works correctly. The page used to work, but I had the theme and 2 extension developers work on the site and now it doesn't work. All developers say it wasn't them.

Dashboard screenshot here

Charts are enabled in Stores/configuration/advanced/admin/dashboard -> Enable Charts = Yes.

User has administrator rights.

Inspect Console shows no errors and there are no issues in logs.

I have run the following:

rm -rf pub/static/* var/cache/* var/composer_home/* var/tmp/* var/view_preprocessed/* var/page_cache/* generated/code generated/metadata

php71 bin/magento setup:upgrade
php71 bin/magento setup:di:compile
php71 bin/magento setup:static-content:deploy en_AU en_US
php71 bin/magento cache:flush

php71 bin/magento cron:run

Has anyone got any idea what might be causing this?
Could it be something simple switched off that I'm not aware of?

We were going live with our site very soon but can't with this issue.


texts: Subtotal is doubled in the second attempt to invoice

texts:
I was testing various scenarios creating invoices and capturing them. I am using EE 1.13.1.0, and I noticed a strange behavior where if I do the following, the subtotal is doubled from the original ordered item list. [Update: I now know why this is happening. Please see the end of the post.]

Submit an order through authorize.net in test mode with authorize-only mode.
Create an invoice using the API and nothing more.

i.e.  $invoice = Mage::getModel('sales/order_invoice_api')->create($orderIncrementId, array());
Ship all of the order items.
Go to the admin, and cancel the pending invoice.
Create another invoice
Check out the subtotal. My instance always doubles the subtotal, tax, etc, and it cannot be modified in the second time creating the invoice.

UPDATE 1:

This is happening because when the API method is called to create the invoice and the process ends there, the sales_flat_order table's *_invoiced entries are not updated. When a non-capturing invoice is created, sales_flat_order's *_invoiced are updated.

Subsequently, when canceling this pending invoice, sales_flat_order is updated (subtracted) to reset values in *_invoiced. This is causing the negative dollar amounts in this table and causing problems when I try to re-invoice the order. I'm gonna try a couple more things and post an update here.

Update 2:

I've resolved this problem, and it was due to a logic problem and not inherently related to the core functions. I'll update my answer later.


texts: Magento 2 Update Ragion/State in Database

texts:
I found some regions in a specific countries are obsolete and new ones are missing.

I know how to add region by installData.php in a custom module but i dont know how to remove the obsolete ones.

What is the best way to do it?


texts: Unable to access front- and backend after changing to HTTPS

texts:
I looked for a way to change from HTTP to HTTPS.

By mistake I switched my insecure and secure URL in config-web-secure/, and added the word magento to them both. As a result I get a 403 error on my admin panel and website. I tried changing the URL in the PHP but that didn't work.


texts: Magento2.3.5-P1 - Fatal Error: 'Cannot declare class Zend_Http_Client, because the name is already in use

texts:
After upgrading to Magento 2.3.5-P1, I start getting below error. Any help would be appreciated!

  {"messages":{"error":[{"code":500,"message":"Fatal Error: 'Cannot declare class Zend_Http_Client, because the name is already in use' in '/var/www/html/project/vendor/magento/zendframework1/library/Zend/Http/Client.php' on line 72","trace":"Trace is not available."}]}}


texts: Magento 2 change buttons order in the shopping cart page

texts: I need to change the order in the shopping cart page, I want to add Checkout with Multiple Addresses above the - OR - text like the following image:


texts: Downloadable product "unknown network error" with CloudFlare ON

texts:
We have been fighting this for more than a week:

When CloudFlare is OFF - downloadable products work fine
When CloudFlare is ON - the download starts and reaches 100%, the speed drops down to 0 and the download gets corrupt with an "unknown network error" message

There is a Page rule set in CF which says not to cache files which are on domain.com/download* but that doesn't help. Even in CF "developer mode" the problem exists. Only when the cloud is paused and the server is accessed directly - things work fine.

The hosting provider suspected the reason was gzip encoding. So I made a simple test:

Create a directory domain.com/download-test
Add an .htaccess file to it with contents:

AddType binary/octet-stream .bin
SetOutputFilter DEFLATE

Generated a simple 10mb file in the directory:

dd if=/dev/urandom of=test.bin bs=1MB count=10
10+0 records in
10+0 records out
10000000 bytes (10 MB) copied, 1.45406 s, 6.9 MB/s

Downloaded the file with Cloudflare = ON without any problem and I see content-encoding:gzip in the HTTP headers. So the problem is definitely not gzip.

The hosting provider says they can't do anything as everything works directly to their server. Fair enough.

CloudFlare says "create a subdomain and serve downloads from there". But this is not possible because A) The store frontend runs entirely on HTTPS and our SSL certificate is only for domain.com and www.domain.com B) Magento has no option for serving downlodable products from a subdomain.

Desperately looking for a fix.

NOTE: Our downloadable products are not uploaded but linked to an external host (in case that matters).


texts: magento 2 argument code enable or disable from store config

texts:
I want to enable or disable from store config with the help of
ifconfig condition. How can I use this to execute my code depending on the ifconfig condition?

<body>
        <referenceBlock name="adminhtml.indexer.grid.grid.massaction">
            <arguments>
                <argument name="options" xsi:type="array">
                    <item name="unsubscribeSendy" xsi:type="array">
                        <item name="label" xsi:type="string" translate="true">reindex</item>
                        <item name="url" xsi:type="string">reindex/index/index</item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>

Please help if any one have idea


texts: Magento 2.2: moving configs from config.php to env.php after app:config:dump

texts:
I've dumped all the Magento configs with php bin/magento app:config:dump. All the configs are in env.php and config.php now. I've committed the config.php to version control.

My question is:
How can I move settings from config.php to env.php? Is there a CLI command for this?

For example; my sphinx IP address is now in config.php, this causes problems because our staging env has a different IP address then our production env. So this setting should not be shared (and therefore should not be in config.php).

What's the best way to solve this problem? I'm using Magento 2.2.3.


texts: Is there a way to execute an sql query to get all my customers emails+addresses? I know about doing it from the admin panel but it only lets me do so many at a time. I need to be able to do it all at once preferably with an sql query.


texts:
I was Created one Custom Module. In that Module Image uploaded from the Backend Side, now I want to Fetch Image on Frontend Side not image name.
Can Any one help me? Any kind of help will appreciated.

Here is my phtml file :

<?php
     $collection = Mage::getModel('recipe/recipe')->getCollection();

?>

    <?php   echo "

            Category Id
            Category Name
            Category Slug
            Category Image
            Parent Category
            Creation Time
            Update Time
            Status

";

    foreach($collection as $data)
    {
?>

            <?php echo $data->getId(); ?>
                <?php echo $data->getCategoryName();?>
                <?php echo $data->getCategorySlug();?>

                <?php echo $data->getCategoryImage();?>
                <?php echo $data->getParentCategory();?>
                <?php echo $data->getCreatedTime();?>
                <?php echo $data->getUpdateTime();?>
                <?php echo $data->getStatus();?>

<?php
    }

?>

And also in database my image filed name is category_image


texts: Magento 2: The value of attribute "is_new" must be set

texts: Whenever I try to save a category I get The value of attribute "is_new" must be set. How can I solve that?


texts: MySQL server has gone away Zend/Db/Statement/Pdo.ph

texts:
Because so much was broken in a vanilla install of Magento by my ISP (e.g. I could not create categories, I was told to do this:

/usr/bin/php-7.1 bin/magento setup:upgrade

This ran for about 15 minutes with a lot of output, then ended with this:

  Import failed: Warning: PDOStatement::execute(): MySQL server has gone
  away in
  /var/sites/j/xxxxx.store/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php
  on line 228

Is this normal?

linux, php 7.1, Magento version unknown as the site and control panel are now dead.


texts: Magento 1.9.4.0 DivisionByZeroError (PHP fatal error) when accessing Connect Manager

texts:
I'm getting a PHP fatal error when accessing Connect Manager in Magento 1.9.4.0.

I've updated to php 7.2 on Ubuntu with Nginx. The files and folders have nginx user as owner and the file permissions are correct.

Everything else seems to work ok, but just can't access the Connect Manager. If I put Magento in developper mode I still get no errors, just the 500 error from the server.

Here's the error:

FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught DivisionByZeroError: Modulo by zero in /path/to/magento/downloader/Maged/BruteForce/Validator.php:59

Stack trace:

0 /path/to/magento/downloader/Maged/Controller.php(844): Maged_BruteForce_Validator->isCanLogin()
1 /path/to/magento/downloader/Maged/Controller.php(518): Maged_Controller->dispatch()
2 /path/to/magento/downloader/index.php(36): Maged_Controller::run()
3 {main}

Any ideas how to fix this?


texts: Magento 2.2 Ajax not working on second time in category page

texts:
My site was working fine, suddenly the ajax on category pages is not working on second time. On first time it works fine, whether it is pagination or layered navigation but on second time it doesn't work. I found out that the url's are generating in-correct the second time.
On first click it is "headsets?p=2", while after the page ajax loads, it is "headsets&p=2?p=3"
and same case is for layered navigation, doesn't work on second time.

Also the code and database are working on local machine and stage site, I run deployment with git/Jenkins, so code and database are same on all platforms, and the issue is only on live site.

page-ul: https://www.thetelecomshop.com/au/headsets


texts:
I'm looking to make a 'backend' attribute encrypted, just like the Magento password. How doesn't magento handle the encryption and what's the best way to decypte as well for the php to run logic against it?

Thanks!


texts: Create Custom Drop down on registration page

texts:
I would like to create custom drop down on all registration pages.
That drop down will have customer from another group.

This is my Pro.php file which is stored in app/code/local/KitchOff/CustomerRegistration/Model/entity and show different dropdown options

<?php
    class KitchOff_CustomerRegistration_Model_Entity_Pro extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
        public function getAllOptions() {
            if ($this->_options === null) {
                $this->_options = array();
                $this->_options[] = array( 'value' => '', 'label' => 'Choose Option..' );
                $this->_options[] = array( 'value' => 1, 'label' => 'Pro1' );
                $this->_options[] = array( 'value' => 2, 'label' => 'Pro2' );
                $this->_options[] = array( 'value' => 3, 'label' => 'Pro3' ); }
                return $this->_options;
            }
        }
    }

This is my config.xml which is stored in app/code/local/KitchOff/CustomerRegistration/etc

<?xml version="1.0"?>
<config>
    <modules>
        <KitchOff_CustomerRegistration>
            <version>1.0.0</version>
        </KitchOff_CustomerRegistration>
    </modules>
    <global>
        <helpers>
            <kitchoff_customerregistration>
                <class>KitchOff_CustomerRegistration_Helper</class>
            </kitchoff_customerregistration>
        </helpers>
        <resources>
            <kitchoff_customerregistration_setup>
                <setup>
                    <module>KitchOff_CustomerRegistration</module>
                    <class>Mage_Customer_Model_Resource_Setup</class>
                </setup>
            </kitchoff_customerregistration_setup>
        </resources>
    </global>
</config>

This is my install-1.0.0.php which is stored in app/code/local/CustomerRegistration/sql/kitchoff_customerregistration_setup/
startSetup();

$setup = Mage::getModel('customer/entity_setup', 'core_setup');

$setup->addAttribute('customer', 'pro', array(
    'type' => 'int',
    'input' => 'select',
    'label' => 'Select PRO',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 1,
    'default' => '0',
    'visible_on_front' => 1,
    'source'=> 'customerregistration/entity_pro'
));

if (version_compare(Mage::getVersion(), '1.6.0', '<=')) {
    $customer = Mage::getModel('customer/customer');
    $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
    $setup->addAttributeToSet('customer', $attrSetId, 'Customer', 'pro');
}

if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
    Mage::getSingleton('eav/config') ->getAttribute('customer', 'pro') ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register')) ->save();
}

$installer->endSetup();

This is my CustomerRegistration.xml which is stored on app/etc/modules

<?xml version="1.0"?>
<config>
    <modules>
        <KitchOff_CustomerRegistration>
            <active>true</active>
            <codePool>local</codePool>
            <depends><Mage_Customer/></depends>
        </KitchOff_CustomerRegistration>
    </modules>
</config>


texts: Why Magento locks are stored in file system?

texts:
Maybe I'm missing something obvious but why Magento is storing database locks in a file system?

Storing them in a database instead will make it faster and will also resolve the clustering issue.

Any ideas?


texts: How to get _data:protected on printing customer data in Magento 2.2.6?

texts:
How to access this value from array [value] => 11113610 ?

 Array
 (
 [is_saml] => Magento\Framework\Api\AttributeValue Object
    (
        [_data:protected] => Array
            (
                [attribute_code] => is_saml
                [value] => 1
            )

    )

[uwid] => Magento\Framework\Api\AttributeValue Object
    (
        [_data:protected] => Array
            (
                [attribute_code] => uwid
                [value] => rs-build
            )

    )

[student_number] => Magento\Framework\Api\AttributeValue Object
    (
        [_data:protected] => Array
            (
                [attribute_code] => student_number
                [value] => 11113610
            )

    )

)


texts: How to allow orders for out-of-stock products?

texts:
We want to be able to take orders for products that are "out of stock" in Magento. I have enabled backorders in System > Config > Inventory, but the "Add to basket" button is still hidden for any products marked as "out of stock" (thus the backorder can't be taken).

For backorders to work properly, do products with stock quantity of 0 need to be marked as "in stock"?  I don't want to have to remove the if($_product->isSaleable()): from catalog/product/view/addtocart.phtml because that would be hardcoding something that should be configurable from the admin panel.

Have tested this on Magento 1.7 and 1.9, both with the same results.


texts:
I actually wanna add sub total, total excluding tax and sub total including tax in my refunded grid in the admin backend of magento (sales->Refunded, the 4th one). I don't have any idea of how I can do it. The only I know is that I will copy a core file in local to extend this.

Thanks a lot for your help =) -> I'm on Magento 1.8.1

EDIt:
Finally found the file I need to change :
app/code/core/Mage/Adminhtml/Block/Report/Sales/Refunded/Grid.php
But still don't know what I need to change in, because when I change others grid, I need to extend _prepareCollection() and add some attributes in _prepareColumns(), but in Refunded/Grid.php, there is no _prepareCollection(), so I'm in trouble


texts: Magento 2.3 - What is mean composer.json on Module Development?

texts:
I have created custom module without composer.json and my module working good,

Module Structure (Attached the screen shot here) :

What are all the disadvantages of creating custom module without composer.json file ?


texts: Magento : Configuration -> Advanced -> System Menu Not Displayed

texts:
In my magento, system does not send emails. so I would like to access email settings config menu as shown here.

However the Advanced -> System menu doesn't appear, under Advanced I can only see Admin, Advanced and Developper.

I can't find anything about this issue. Where should I look first?


texts:
I have two customer groups
Retailers and wholesalers.
The retailers showing prices with VAT
Is it possible for the wholesale group to show their prices whithout the VAT and show it only in cart?
The prices for those 2 groups are not the same
Magento 1.9.2


texts: Magento 2.1.2 Ui- Component formElement select from multiple dropdowns

texts:
I have two drop downs one for Hours and one for Minutes.I have managed to display the drop down for hours

But any one could assist - how do I display a drop-down for minutes,next to hours in th Ui Component form? like the one in the image.

<field name="start_date">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">NameSpace\ModuleName\Model\Xyz\Source\Hours</item>
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Monday Opening Time</item>
            <item name="visible" xsi:type="boolean">true</item>
            <item name="dataType" xsi:type="string">number</item>
            <item name="formElement" xsi:type="string">select</item>
            <item name="source" xsi:type="string">item</item>
            <item name="dataScope" xsi:type="string">start_date</item>
            <item name="sortOrder" xsi:type="number">220</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
        </item>
    </argument>
</field>

My Model returns the hours values

public function getHours()
{
    $availableOptions = [
        '0' => '00',
        '1' => '01',
        '2' => '02',
        '3' => '03',
        '4' => '04',
        '5' => '05',
        '6' => '06',
        '7' => '07',
        '8' => '08',
        '9' => '09',
        '10' => '10',
        '11' => '11',
        '12' => '12',
        '13' => '13',
        '14' => '14',
        '15' => '15',
        '16' => '16',
        '17' => '17',
        '18' => '18',
        '19' => '19',
        '20' => '20',
        '21' => '21',
        '22' => '22',
        '23' => '23',
    ];
    return $availableOptions;
}


texts: Overriding Magento\Framework\Stdlib\Cookie\PhpCookieManager in Magento 2

texts:
Is there anyway to override Magento\Framework\Stdlib\Cookie\PhpCookieManager::MAX_NUM_COOKIES ?

I tried everything, using preference in module di.xml or app/etc/di.xml
or using aliases in application.config.php and di.config.php but no luck.
I need to increase the value of MAX_NUM_COOKIES


texts:
I want to create a cron that runs every 30 minutes.

I am using another cron as an example - I have created the cron in a config.xml file, not using the admin interface.

The example I am using is the following:

<tracking_cron>
    <schedule><cron_expr>0 4 * * *</cron_expr></schedule>
    <run>
        <model>tracking/observer::cron</model>
    </run>
</tracking_cron>

My questions are as follows:

1) On what intervals is the above cron being run?

2) What would the cron_expr be for a cron that should run every 30 minutes?


texts: Change Order Status to custom status after order is complete

texts:
I need a way to change the Order Status after the order has been marked as complete.

I would also like a custom status so that my colleague understands the reason it has been changed

I want this to be done in Admin back end and not in the Database.

I don't know where to start.


texts:
Is it possible to have plain text next to the label in system config instead of an input field, something like:

<field>
    <label>Hey you</label>
    <plainText>Lorem ipsum...</plainText>
</field>

The closest I can get is using a label, but thats looks bad when I have more than 4 words in it. This is what it should look like:


texts:
I want to use this in my pre conf for the server

Header unset Content-Security-Policy
Header add Content-Security-Policy "default-src 'self'"
Header unset X-Content-Security-Policy
Header add X-Content-Security-Policy "default-src 'self'"
Header unset X-WebKit-CSP
Header add X-WebKit-CSP "default-src 'self'"

issue is this blocks jquery fontawesome google fonts etc and messes up my design anyone know how to tweak this to allow for imported fonts jquery etc. banging my head on this


texts: magento 1.9 google analytics ecommerce tracking not working

texts:
Orders not tracked in Google analytics, otherwise the number of visitors is tracked. Note that:

E-commerce enabled in ga account
Google API enabled + tracking code in place
I tried to implement js tracking code manually in success page as following https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#example
I'm testing with checkmo method in order to get native Magento behaviour but nothing works

Am I missing something? any ideas how to solve this problem?


texts: Magento 2: create object of other class as Psr or session in Plugins

texts:
I have created a Plugin to add custom buttons in grid, based on admin user login. If super admin logins all buttons will be displayed else for other admin users button will be removed, so that they can not edit.

<type name="Magento\Backend\Block\Widget\Button\Toolbar">
    <plugin name="restrict_admin_user" type="Singh\Import\Plugin\Toolbar" sortOrder="10"/>
</type>

Code for Toolbar.php

class Toolbar
{public function beforePushButtons(
ToolbarContext $toolbar,
    AbstractBlock $context,
    ButtonList $buttonList,
    \Psr\Log\LoggerInterface $log,
    \Magento\Backend\Model\Auth\Session $authSession){
if ($authSession->isLoggedIn()){
        $log->debug("user name=".$authSession->getUser()->getUserName());
    }
}}

I have run the compile also

php bin/magento setup:di:compile

But it throws exception

main.CRITICAL: exception 'Exception' with message 'Recoverable Error: Argument 4 passed to Singh\Import\Plugin\Toolbar::beforePushButtons() must implement interface Psr\Log\LoggerInterface, none given

same exception for \Magento\Backend\Model\Auth\Session
So how I can use log and other class object?


texts: magento 2 sales order grid add payment transaction column

texts:
How to add Payment transaction column to sales order grid in admin?

Can you please help me step by step?

Regards
Hiren Shah


texts: Magento 2 : Getting error - "Invalid state change requested" when placing order through my custom payment method

texts: I am getting error - "Invalid state change requested" when placing order through my custom payment method on checkout page.


texts:
I needed to create configuration form in Magento2 admin. After research, I found that forms had to be defined in xml (system.xml)

    <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
        Foo Configuration
        <field id="foo2" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="0" showInStore="0">
            Foo Email
            <comment>Defines the foo email.</comment>
            <validate>required-entry validate-email</validate>
        </field>

I found this solution very "clean"

Now I need to make form in frontend, and all examples I find are defining form in phtml files :

like Here

Is there a way to create frontend form in xml also?
If yes, What is the best way?
If No, Why this difference?


texts: Magento 2 Fulltext search not working properly!

texts:
I have products SKU like EX-1205, XY-2536 or 569845  and product Name like TEST-2569.

I am trying to use full-text search functionality so that a user should get the exact match for the product.

So, If user search 569845 then search is working with the exact result. But if user search EX-1205 or XY-2536 then showing no result.

Can anyone please help?


texts: Change payment method string to translatable string

texts:
The template > checkout > onepage > payment > methods.phtml file outputs the payment method string that is shown in the onepage checkout of Magento 1.9.

It's very weird that this string is not translatable by default:
I changed lines 81 to 87 from this:

<label for="p_method_<?php echo $_code ?>">
        <?php if ( isset($payment_map[$_code]) ) : ?>
            <img src="<?php echo $payment_logos_url . $payment_map[$_code] . $payment_logos_filetype; ?>" alt="<?php echo $title; ?>" /><?php break; ?>
        <?php else : ?>
            <?php echo $this->escapeHtml($title) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?>
        <?php endif; ?>

To this:

<label for="p_method_<?php echo $_code ?>">
        <?php if ( isset($payment_map[$_code]) ) : ?>
            <img src="<?php echo $payment_logos_url . $payment_map[$_code] . $payment_logos_filetype; ?>" alt="<?php echo $title; ?>" /><?php break; ?>
        <?php else : ?>

// changed line
                <?php echo $this->__($this->escapeHtml($title)) ?> <?php echo $this->__($this->getMethodLabelAfterHtml($_method)) ?>

            <?php endif; ?>

Is this something that should be default in Magento 1.9? If yes, should I make a pull request in the Magento 1.9 repo (if this is possible)?


texts: how to access magento site through API key by android platform

texts:
We want to know information about API key in magento

We are planning to develop an android app for our magento site. So we want some information about how we can do that.

Along with that how to get information about magento site through API key

Can anyone give me some guidance?


texts: How to change Product Options 'Please Select' Text?

texts: How can I change --Please Select-- Text to Something Select Size, Select Color


texts: Magento 2 : Development is extremely slow?

texts:
I spent a lot of time learning core concepts, and now I have a decent understanding of Magento 2.

However I am spending days, not hours, trying to make even tiny changes, like changing layout, I need to run and wait a lot of time whenever I make any changes to my website.

Commands like clearing cache,upgrading modules,deploying static content.

If you have missed one of these commands, you can spend a couple of days trying to find anerror in your code, but finally will find out that there are some generated files that are cached.

I am spending hours to change something in Magento 2that is done in seconds using other CMSes.

Whenever I make a change and it is not applied, I need to guess whether it is cached or I had made a mistake in my code.

Please suggest any way to speed up development time


texts: Can I use \Magento\Eav\Setup\EavSetupFactory outside of setup install scripts?

texts:
Can I instantiate Magento\Eav\Setup\EavSetup outside of setup install scripts in Magento 2?

I specifically want to use the function Magento\Eav\Setup\EavSetup::addAttributeToGroup to programmatically add category attributes to a group.


texts: Magento 2 - Shipping fee using table rates always zero when adding more items in cart


texts:
I have created custom module and also implemented API in that but I want to
know other two ways Auth base and Token base access.
My webapi.xml file:-

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd">
<route url="/V1/brand/getList" method="GET">
    <service class="Ktpl\BrandManagement\Api\BrandRepositoryInterface" method="getList"/>
    <resources>
        <resource ref="anonymous"/>
    </resources>
</route>

I am able to get all the brand list but want to make this request more safer using auth and token base request.


texts: Need Help in Magento 2 to select user select shipping address on checkout in dropdown?

texts:
We implement in Magento 2 shipping address dropdown using the following solution:
https://magento.stackexchange.com/a/298146/49007
Its working fine but on the product detail page we have the option if a user is logged in they have address book dropdown to choose their desire shipping address. When the user chooses that shipping address on the product detail page we save his/her shipping address with the quote. Now we are unable to access his/her chosen shipping in the dropdown on the checkout page.
please review my site: https://qanew.usinger.com/gifts/shop-all-gifts/holidays.html
Create your account and then save different shipping addresses then go to the above gifts store and open product detail page.
choose your address and proceed to check out.
Regards


texts: Display Promotion code as a donation not removed from total

texts:
I am using a Promotion code to give 25% of the sale (shipping and taxes not included) to charity. I would like to find a way to display the Total amount (ie: $200) and above it, Donation (ie: $50)The only thing that I am able to do at the moment is display a discount amount, and it subtracts that amount from the total. Doing it the way I want would display the "discount amount" however not subtract it from the total the customer has to pay.
So if the Promotion code pop1223 is applied this would show up.
Donation:  $50 (25%)
Subtotal: $200 (100%)
Taxes: $5
Shipping: $10
Total:  $215
So I have been thinking about what I really want to do after asking this question. The best way I can think to sum this up is that I want to add a new promotion action.
Right now there are 4 actions in the Apply function.
I want to add a 5th, call it "Percent of Product price as donation"
I could then enter 25 into the "Discount Amount" box.Then I would just have to edit the code to write it as Donation, not Discount, and not to subtract from the grand total.
That being said, I have no idea where to start.


texts: How can i get loaded product data in custom module

texts:
I try to get the product data in my module. I tried to find a solution without

Mage::getModel('catalog/product')->load($id)

My module is embedded in the product detail site. So, when I load the site the data of this product is already loaded. How and where can I access this data?

  Should I use any observers?
  Is it stored in session?

May be some body can help me :)


texts: How to make ajax call for product description

texts:
I am showing a button in product description. After button click it should translate the description using 3rd party PHP library. I checked some answers to find a solution (How to make a simple ajax call in Magento 2.1.0, Magento 2 - Send form data to Controller using AJAX and return Result to PHTML, ), but it didn't work out.

This is my file structure:

|   registration.php
|
+---Block
|       Index.php
|
+---Controller
|   \---Show
|           Translation.php
|
+---etc
|   |   module.xml
|   |
|   \---frontend
|           routes.xml
|
\---view
    \---frontend
        +---layout
        |       catalog_product_view.xml
        |
        \---templates
                attribute.phtml

Vendor/Module/Block/Index.php:

public function getBaseUrl()
    {
        return $this->_storeManager->getStore()->getBaseUrl();
    }

Vendor/Module/Controller/Show/Translation.php:

<?php
namespace Vendor\Module\Controller\Show;

use Stichoza\GoogleTranslate\TranslateClient;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;

class Translation extends Action
{
    protected $resultJsonFactory;

    public function __construct(
        Context                                             $context,
        \Magento\Framework\Controller\Result\JsonFactory    $resultJsonFactory
    ) {

        $this->resultJsonFactory            = $resultJsonFactory;
        parent::__construct($context);
    }

    public function execute()
    {
        $result                 = $this->resultJsonFactory->create();
        if ($this->getRequest()->isAjax())
        {
            $description = $this->getRequest()->getPost('description');
            $tr = new TranslateClient(null, 'lt');
            $text = $tr->translate($description);
            $translated = [
                'translation' => $text
            ];
            return $result->setData($translated);
        }
    }
}

Vendor/Module/etc/frontend/routes.xml:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="googletranslate" frontName="translateproduct">
            <module name="Vendor_Module" />
        </route>
    </router>
</config>

attribute.phtml has:

<button title="Translate" class="secondary" id="translateButton">
        Translate
    </button>


texts:
I wanted to link from a cms block within a product page to its corresponding amazon product which can be identified via an custom attribute called "asin".

So I have put the link like

...

and the idea was, that this injects the asin, stored in the repsective product...

But whats happening; it replaces the

  {{...}}

with somwething like

  "...ms_wysiwyg/directive/___directive/e3tibG9jayB0eXBlPSJjb..."

after I exit html mode and go back in wysiwig....

So I guess I am doing something totaly wrong here. How could i get the asin in the link?

  {{block type="core/template" template="amz/asinlinkinject.phtml"}}

which is doing

<?php
  echo Mage::registry('current_product')->getasin();
 ?>

and it works fine as text outside the  tag .


texts: How to show certain "preferred" products first in search results?

texts:
I have a Magento 1.9 shop containing ~22000 products. Products are added/updated/deleted every night.

There are certain products that are more attractive for us to sell because the margin is higher. We do not communicate to our customer that certain products are preferred. These products change on a weekly basis.

I have two questions:

How do I internally mark a product as "preferred"?
How do I make sure that a preferred product shows up first in the search results, while not showing the customer it's preferred?

Example:

Let's say I have two products that belong to the same category but have a different brand.

Product A - Category 1 - Brand X
Product B - Category 1 - Brand Y (Preferred)

If someone searched for products in category 1 at this moment, it would not show a certain preferred product first.

I would like it to show Product B, the preferred product, first. Followed by the rest.

How do I accomplish this?


texts: Cart Price Rule with two Rule in magento 1.9.3.x

texts:
I'm finding errors in calculating the rules in the cart when there are products in the shopping cart that apply two or more different rules.

For the two rules, conditions have been set for discounting for manufactor and sku. That is, only if the product in the cart is a specific manufacturer and is part of a list of selected products, the rule applies, otherwise no (as per image).

Conditions:

Actions:

How show in the cart:

Added the two products in the cart, which have a different discount rate. Magento makes discounts not on the price of the single product but on the subtotal and applies one rule at a time on the total of the two products.

Example:

total price of individual products:

p1 € 257.42

p2 € 213.35

instead, magento calculates:
p1 + p2 = € 470.77 -19% = 381.32 -20% = 305.06.

the correct calculation should be:

P1 must have only 19% discount, p2 only have to discount 20%

total cart = (p1-19%) + (p2-20%) = (257.42-19%) + (213.35-20%) = 208.51 + 170.68 = € 379.19

And a total discount of: 48.9 + 42.67 = 91.57.

How can I solve this issue?


texts: What are the 6 possible template fallbacks in the Magento Study guide excerise?

texts:
I'm trying to work through the exercises in the Magento study guide. I've come the following:

Add an additional hardcoded theme called “primary” that is always first in the fallback order in the configured package. Then add an additional fallback theme base/[configured-default-theme] that is always evaluated just before the base/default fallback. Create a test action that allows you to test all 6 possible template fallbacks at once.

But I am not clear what the '6 possible template fallbacks' are in question.

I came up with

default/primary
default/anothertheme
default/default
base/primary
base/anothertheme
base/default

Assuming I have set my default theme to 'anothertheme', but not sure if that is correct, as looking through the code only base/default is used, after the first 3

Any ideas?


texts:
In /app/code/local/Mage/Sales/Model/Order/Shipment.php I added the following lines in sendEmail() funtion:

$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($invoice));
$mailer->addAttachment($pdf, 'rechnung.pdf');

The file is correctly attached but the order items and invoice ID are missing.

For a test I added this in /app/code/local/Mage/Sales/Model/Order/Invoice.php :

$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($this));
$mailer->addAttachment($pdf, 'rechnung.pdf');

This works 100% correctly.

Anybody see the problem?


texts: FedEx rates unavailable after upgrade from 1.7.0.2 to 1.9.2.3

texts:
After upgrading a customer's site from CE 1.7.0.2 to 1.9.2.3, FedEx no longer returns any rates at checkout.  Everything is set up correctly, it worked great prior to the upgrade.

On SO, I noticed someone corrected this by replacing

app/code/core/Mage/Usa/Models/Shipping/Carriers/Fedex.php

with the version from 1.7.0.2, but I wasn't comfortable with it.

I didn't find the answer elsewhere on the Internets, so I decided to share it here.


texts: Send email from observer using smtp on magento 2

texts:
I have this observer, and now i send emails via php mail() function, but i want to use the SMTP.
Can anyone tell me which steep i need to follow?

public function sendNotification($to,$subject,$products,$shippingAddress)
    {
        // Always set content-type when sending HTML email
        $headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
        $headers .= 'From: <example@mail.com>' . "\r\n";

        $message = '

        <title>Email notification</title>

Customer data

                '.__('Name').$shippingAddress['firstname'].' '.$shippingAddress['lastname'].':

                '.__('Phone').$shippingAddress['telephone'].':

                '.__('Email').$shippingAddress['telephone'].':

                '.__('Address').$shippingAddress['street'].' '.$shippingAddress['city'].' '.$shippingAddress['postcode'].' '.':

Order details

                '.$products.'

        ';
        mail($to,$subject,$message,$headers);
    }

    /* send email notification for both, rent & lend products */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();
        $order_id = $order->getIncrementId();

        $shippingAddress = $order->getShippingAddress(); // shipping address
        $customer = $order->getCustomerId(); // using this id you can get customer name

        $productsRent = '';
        $productsLend = '';
        /* parse all products list from the order */
        foreach($order->getAllItems() as $item){
            $ProdustIds = $item->getProductId();
            $attribute_name = $this->getAttributeSetName($ProdustIds);

            if ($attribute_name=='rent') {
                $productName = $item->getName();
                $rent_price = $item->getData('rent_price');
                $rent_time = $item->getData('rent_time');

                $productsRent .= '

                    '.$productName.'
                    '.$rent_price.' '.$rent_time.'

';
            } elseif ($attribute_name=='lend') {
                $productName = $item->getName();

                $productsLend .= '

                    '.$productName.'
                    Gratis

';
            }
       }

       // send emails notification rent
       if($productsRent!='') {
            $this->sendNotification("example@mail.com","Rent email notification",$productsRent,$shippingAddress);
       }


texts: Magento 2.2: how to get out of stock products when managing stock

texts:
In one of my blocks I want to get a product collection including items that are out of stock, but the product collection always includes WHERE (stock_status_index.stock_status = 1) if you are managing stock.

I don't want out of stock items to show up in categories and search so I do want to manage stock, but in one instance I want to be able to get the products that are out of stock as well.

I have tried all solutions I could find, including:
->joinField('stock_item', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id', 'is_in_stock=0')

and

$cond = [
    '{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=1 AND {{table}}.is_in_stock=1',
    '{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=0'
];

$cond[] = '{{table}}.use_config_manage_stock = 1';

$collection->joinField(
    'inventory_in_stock',
    'cataloginventory_stock_item',
    'is_in_stock',
    'product_id=entity_id',
    '(' . join(') OR (', $cond) . ')'
);

But everything is negated by the WHERE (stock_status_index.stock_status = 1) part.

EDIT:
$collection->getAllIds() does return the IDs of out of stock products, so I can use that to get the out of stock products via a ProductRepository::getById.


texts:
I am getting the error whenever placed the order "There was an error processing your order. Please contact us or try again later" and exception log says below.

exception 'Mage_Core_Exception' with message 'Invalid block type: FavoredMinds_Vendor_Adminhtml_Block_Notification_Window' in /home/jail/home/gemsclip/gemsclip-sites/gemsclip-live/app/Mage.php:594


texts: In my magento admin area, admin can set a name to be displayed on the contact us page. For example, admin can set "contact-us" as the url-alias and I want to set that as the frontname of my contacts module. How to do that programatically?


texts:
All of a sudden I cannot log into Magento, at all.

I used the .htaccess to force SSL. This broke things so I have turned it off again.

It started with another User being unable to log in. Meanwhile I still could. No I cannot log in nor any other users.

I get no errors and submitting the log in form just redirects to /index.php/admin/index/index/key/bbdbb9580dbc6aec7b25c9cd96277058/ with no errors at all.

Nothing has changed other than turning on SSL and then turning it off via the .htaccess file. Apache has been restarted too.

EDIT

If I use the password reset form and reset my password and then log in it works. Log out and it fails again.


texts: Magento 1.9.3 calling a custom block in cart page unsuccessful

texts:
I have a very basic module:

app/code/local/Demo/Custom/Block/Giftproducts.php

class Demo_Custom_Block_Giftproducts extends Mage_Core_Block_Template {

  public function getGiftProducts() {
    //code omitted
  }

}

app/code/local/Demo/Custom/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Demo_Custom>
      <version>1.0.0</version>
    </Demo_Custom>
  </modules>
  <global>
    <blocks>
      <giftproducts>
        <class>Demo_Custom_Block</class>
      </giftproducts>
    </blocks>
  </global>
</config>

app/design/frontend/custom_theme/default/layout/custom.xml

<?xml version="1.0" ?>
<layout>
    <default>
        <reference name="content">
        </reference>
    </default>
    <checkout_cart_index>
        <reference name="checkout.cart">
            <block type="custom/giftproducts" name="giftproducts" template="custom/giftproducts.phtml" />
        </reference>
    </checkout_cart_index>
</layout>

app/etc/modules/Demo_Custom.xml:

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

app/design/frontend/custom_theme/default/tempalte/custom/giftproducts.phtml:

<?php

echo 'got here';

In cart.phtml I then call the block like this:

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

Everything is doublechecked, seems pretty clear, cache is cleared, however I just cannot get the template to bo executed. tired various combinations of declaration in xml file, but with no luck.

Any help or guidance is much appreciated.


texts: Cron Expression time change for core_email_queue_send_all

texts:
currently, core_email_queue_send_all cron expression is */1 * * * *

I want to change to */5 * * * *

How can I change the time?


texts: I am trying to import customers using .csv file. I did it using data flow profiles in magento. I have list of customers and passwords but I have passwords in string format. How to convert string password into password_hash?


texts:
I have simple products inside grouped products.
I am looking for a way, so that when I add a simple product to a grouped product, I can specify Not just the quantity of the simple products but also the value of a field (for example "color").
Example:
grouped product 1:

sku1 qty=1 color=red
sku2 qty=2 color=blue
sku3 qty=1 color=green

grouped product 2:

sku4 qty=2 color=blue
sku1 qty=2 color=green

So as you can see, in the first grouped product I want the simple product sku1 to have a red color and in the second grouped product I want the same simple product sku1 to have the color green.
Any ideas how I can achieve this?
I am using magento2.


texts: Get target url in layout before observer

texts:
I'm inside an observer
<event name="layout_load_before">
    <observer name="add_robot" instance="FranceTombale\Robot\Observer\NoindexfollowOnProduct" />
</event>

My goal is to alter the layout of some specific url
So inside the observer this is what I have :
use Magento\Framework\App\Response\RedirectInterface;

$redirectUrl = $this->redirect->getRedirectUrl();
$logger->info('Redirect url observer :'.$redirectUrl);
$linkCollection =$this->linkNoIndexCollection->getItems();
foreach ($linkCollection as $item) {
    $urlItem = $item->getData('url');
    if ($urlItem == $redirectUrl) { // .... the code logic updating the layout }
}

But this is not acting like I would like it act.
For example, if i'm on the page htpp://website/home and I try to go on the page http://website/myproduct then the value of $redirectUrl is htpp://website/home when what I would need for my logic to work is to get the value http://website/myproduct
Any ideas ?


texts: Salable quantity not updated after stock import in Magento 2.3

texts:
I have multiple websites and each website have single store and a single store view.

Due to which I have multiple inventory tables created in database as

inventory_stock_1 (view)
inventory_stock_2 (table)
inventory_stock_3 (table)

When I upload stock for store #2 which is linked with table inventory_stock_2, table inventory_source_item gets updated with quantity mentioned in the csv file uploaded, but no entries are created in table inventory_stock_2 for those products.

Because of this the products on that store #2 (front end) are shown in inconsistent state.

When I manually open the product in back end and save it without changing anything, the entry gets created in inventory_stock_2 and product is shown properly on front end.

Is there anything to fix this issue?


texts: Sort order items before inserting into DB

texts: Does anyone know how to sort order items before they are saved into DB? I mean after placing the order. Should I use the event sales_order_place_before?


texts: How to display products on a homepage in a list mode in Magento 2?

texts:
I tried to use Catalog Products list to display products on my homepage (not category page). By default, all products are shown in grid mode. And I see that there is only one option of grid mode in grid.phtml file.

I'd like to add a list mode as an option or make it as default.

As an alternative solution, I used the following code

{{block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" category_id="35" product_count="10" template="Magento_Catalog::product/list.phtml"}}

to display the products in a list mode. That worked well. However, pictures don't show up. I don't why.

I'll be grateful for any advice.


texts: Changing Default magento 2.3 datepicker format

texts: The default Magento date-picker format for birth-date on create account page is mm/dd/yyyy. how can i change it into dd/mm/yyyy format in Magento 2.3


texts: Magento 2 - How to get Base URL in cronjob

texts:
In other file I use this code to get base URL

$this->storeManager->getStore()->getBaseUrl()

where $this->storeManager is a instance of \Magento\Store\Model\StoreManagerInterface

My question is, how can I get base URL in cronjob? because the code gets store first before getting base url, and in cronjob, magento uses 0 as current store (Global store)

Any help would be appriciate.


texts: 500 when trying to create order on the backend

texts:
When I try to create an order from the admin and want to move from the cart on the left under Customer's Current Activities to the Items Ordered box on the top right side of screen i am getting the following message in the console
https://example.com/index.php/admin/sales_order_create/loadBlock/block/sidebar,items,shipping_method,billing_method,totals,giftmessage?isAjax=true 500 (Internal Server Error) this only seems to be a problem some of the time but I do not have a clear pattern any one have an idea how i can uncover the problem? thanks


texts:
I have size attribute (S,M,L,XL,2XL).
I want to sort it by this way, now its showing like (2XL,S,M,L,XL).
How can I sort it?
I am using following code:

$products_grid_ret = array();
$temparray = array();
foreach($products_grid as $key => $product) {
  $temparray[$key] = array();
  foreach($product['attributes'] as $att) {
    $temparray[$key][] = $att['value'];
  }
}
$sorted_array = $temparray;
sort($sorted_array);
foreach($sorted_array as $atts) {
  $key = array_search($atts, $temparray);
  $products_grid_ret[$key] = $products_grid[$key];
}
return $products_grid_ret;


texts:
In image the problem while adding cart value to order insert, link will be make blank but in my cart item has E-book and Print Book type link. how can i add in order table also. suggest me?

$_product = Mage::getModel('catalog/product')->load($product->getProductId());
$rowTotal = $product->getPrice() * $product->getQty();
$orderItem = Mage::getModel('sales/order_item')
->setStoreId($storeId)
->setQuoteItemId(0)
->setQuoteParentItemId(NULL)
->setProductId($product->getProductId())
->setProductType($_product->getTypeId())
->setQtyBackordered(NULL)
->setTotalQtyOrdered($product->getQty())
->setQtyOrdered($product->getQty())
->setName($_product->getName())
->setSku($_product->getSku())
->setPrice($product->getPrice())
->setBasePrice($product->getPrice())
->setOriginalPrice($product->getPrice())
->setRowTotal($rowTotal)
->setBaseRowTotal($rowTotal);


texts: Magento community version 1.9.0.1 and patch 9767

texts:
I am trying to apply the patch 9767 on the Magento community edition 1.9.0.1 by upload the files manually. But I am unable to find it's source that from where I can download the patch 9767 for Magento community edition 1.9.0.1. I have found for others such as at

  https://magentary.com/kb/install-supee-9767-without-ssh/

But not for 1.9.0.1.

If any one knows any link from where I can download it then can you please share?

Thank You!
Abbas


texts: I can't understand difference between quote/quoteitems and order/order Items Magento 2.3

texts: I can't Understand the difference between Order And Quote or Order Items And Quote Items please explain what is it and how it works


texts:
I tried with button add to cart and it not working,

  app/code/Moo/Custom/view/product.phtml

<?php
$product = $this->getData('product');
$postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
$postData = $postDataHelper->getPostData($block->getAddToCartUrl($product),
['product' => $product->getEntityId()]);

<button class="action description-button" data-post='<?php echo $postData; ?>'
<type="button" title="<?php echo __('Add to cart') ?>">
    <?php echo __('Add to cart') ?>
</button>

data-post button have action is null ? It look like :

data-post="{"action":null,"data":{"product":"7","uenc":"aHR0cDovLzUyLjE4My4yNi45OC9hcmR6YW5fc3VwZXJtYXJrZXQvaW5kZXgvbG9hZHByb2R1Y3Qv"}}"

Please help me, why it not work?


texts:
I am trying to display a comment on a system.xml field based on the results from a function,
This is what i have so far in my Vendor/Module/etc/system.xml

<group id="optional_configuration" module="vendor_module" translate="label" showInDefault="1" showInWebsite="1" sortOrder="20">
    Optional Configuration
    <frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
    <field id="option_1" translate="label" module="vendor_module" type="select" sortOrder="13" showInDefault="1" showInWebsite="1" showInStore="0">
        Initial Option
        <enable>1</enable>
        <source_model>Vendor\Module\Model\Config\Source\Custom</source_model>
        <comment> <model>vendor_module/field_comment</model></comment>

    </field>
</group>

In my Vendor/Module/Model/Field/Comment.php I have:

class Vendor_Module_Model_Field_Comment
{
    public function getCommentText()
    {
        //do some calculations here
        return 'Some string based on the calculations';
    }
}

After executing this nothing shows on the module's admin page and this is error in my var/log/system.log:

  main.CRITICAL: Class vendor_module/field_comment does not exist [] []

Can anyone help me out, I am new to Magento development


texts: Include custom module block within phtml file?

texts:
I've created a custom module for a distributor search with a php class/block inside.

Module Structure:

- /Distributor Search
    - /Block
         - DistributorSearch.php
    - /etc
        - module.xml
    - /view
         - /frontend
              - /template
                  - distributor-search.phtml
    - registration.php

I've tried to reference the DistributorSearch block when adding my phtml to the page in my default.xml in my theme.

<block class="Autosmart\DistributorSearch\Block\DistributorSearch" name="distributor.search" template="Autosmart_DistributorSearch::distributor-search.phtml"></block>

I've also tried to keep the phtml file within my theme and include like:

 <block class="Autosmart\DistributorSearch\Block\DistributorSearch" name="distributor.search" template="Magento_Theme::html/distributor-search.phtml"></block>

However I keep getting 500 errors and struggling to get the phtml to show on the page using our module class/block.

I can get the phtml to show on the page by but then I cannot use our methods inside my class DistributorSearch.php?

<block class="Magento\Framework\View\Element\Template" name="distributor.search" template="Autosmart_DistributorSearch::distributor-search.phtml"></block>

Any help to get this working would be appreciated.

UPDATE:

Block class content:

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

namespace Autosmart\DistributorSearch\Block;

/**
 * Local Distributor Search Header Block
 */
class DistributorSearch extends \Magento\Framework\App\Config\ScopeConfigInterface
{
    /**
     * Retrieve store name
     *
     * @return string
     */
    public function getStoreName()
    {
        return "testx";
    }
}

distributor-search.phtml contents:

<?php
echo $block->getStoreName();
?>
Test Content


texts:
I am adding multiselect custom attribute to Catalog.
/app/code/local/MyPlugins/Category/sql/category_setup/mysql4-install-0.0.1.php

<?php
$installer = $this;
$installer->startSetup();
$attribute  = array(
    'label' => 'Blog Category',
    'type' => 'varchar',
    'input' => 'multiselect',
    'backend' => 'eav/entity_attribute_backend_array',
    'frontend' => '',
    'source' => '',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => false,
    'searchable' => false,
    'filterable' => false,
    'comparable' => false,
    'option' => array(
        'value' => array(
            'optionone' => array('First Option'),
            'optiontwo' => array('Second Option'),
            'optionthree' => array('Third Option'),)),
    'visible_on_front' => false,
    'visible_in_advanced_search' => false,
    'unique' => false
);

$installer->addAttribute('catalog_category', 'blog_category', $attribute);
$installer->endSetup();

How can I change this options after creating attribute?

'option' => array(
    'value' => array(
        'optionone' => array('First Option'),
        'optiontwo' => array('Second Option'),
        'optionthree' => array('Third Option'),)),

I'm using magento 1.8.


texts: Adding words to over 4,000 products, does it have to be done manually?

texts:
I have a magento store that sells products but in the meta description of every single product I want it to be formatted like this.

Product Name 1
Product Name 2
Product Name 3

Is there any possible way I could add automatically do this instead of manually?

Changing it to:

Sell Product Name 1 Here
Sell Product Name 2 Here
Sell Product Name 3 Here

I want to add words to the beginning and the end automatically of every single listing if possible, if anyone knows a way please let me know. Manually doing this would be a two year job.


texts: Pagination for product reviews - SEO perspective

texts:
On Magento, when a product page has a lot of reviews (let's say 100), it would be nice to paginate the reviews. This way, users can click on the next page if they would like to read more reviews.

While it is possible to add pagination to reviews on a product page, I was wondering if you guys have any opinions on this topic specifically regarding SEO implications.

Ideally, I would want to index a 'view all reviews' link and display few reviews on a product page, with pagination.


texts: Magento 2 products showing intermittently on frontend

texts:
Hi I recently migrated my site from magento 1.9 to 2.1.
Everything looked good apart from the products now no longer show on the front end of the site.
However they do show counts in the layered menu on the left and they show up in the admin and when you use the search at the top.

It appears they dont show in the main grid view, however on occasion they do show and then disappear again.
Has anyone else had this issue or know what the problem may be?

I have tried reindexing and clearing the cache multiple times now too.

The website in question can be seen at http://dev.missbella.co.uk

Thanks!

Screenshot of issue


texts: How to add minicart in cms block magento 2

texts:
I tried adding this shortcode to my cms block

{{block class="Magento\Checkout\Block\Cart\Sidebar" template="Magento_Checkout::cart/minicart.phtml"}}

but it doesn't show the minicart dropdown when clicked.


texts: Magento 2: Add success message with Identifier

texts:
In Magento Message Collection
 /vendor/magento/framework/Message/Collection.php.

There are two method to get and delete message by Identifier, getMessageByIdentifier and  deleteMessageByIdentifier. But I didn't get any way to set message with identifier, Does anyone knows how to set identifier?


texts: Magento 2.3 File validation failed when uploading SVG image in CMS

texts:
I created a module, to override vendor/magento/module-cms/etc/di.xml, since SVG format is not supported by default

This is how di.xml looks like in my module.

<type name="Magento\Cms\Model\Wysiwyg\Images\Storage">
    <arguments>
        <argument name="extensions" xsi:type="array">
            <item name="allowed" xsi:type="array">
                <item name="svg" xsi:type="string">image/svg</item>
            </item>
            <item name="image_allowed" xsi:type="array">
                <item name="svg" xsi:type="string">image/svg</item>
            </item>
        </argument>
    </arguments>
</type>

But I'm still not able to upload SVG files.

It gives me "File validation failed",

What else should I do to be able to upload SVG format?

I'm using Magento 2.3.11


texts: How to send 2 different email from a single action in magento 2

texts: How can I send 2 different email with different template (one for client and second for admin) from a single action in magento 2


texts: Magento2: How to insert dynamic generated coupon code in email templates

texts:
Requirement: every time a customer place an order, a free shipping coupon will be sent which can only be used once.

So I need to insert the dynamic coupon code just like gift card code and abandoned cart rule coupon on normal email template.

Appreciate for any comment and solution.


texts:
We try to override two functions from the Mage_CatalogInventory_Model_Stock_Item model class but unfortunately nothing happens. Maybe we missed something?

#File: app/code/local/Namespace/Module/etc/config.xml
<blocks>
    <models>
        <cataloginventory>
            <rewrite>
                <stock_item>Namespace_Module_Model_Stock_Item</stock_item>
            </rewrite>
        </cataloginventory>
    </models>
</blocks>

#File: app/code/local/Namespace/Module/Model/Stock/Item.php
<?php
class Namespace_Module_Model_Stock_Item extends Mage_Core_Model_Abstract
{

    public function getMinSaleQty()
    {
        echo 'test';
        exit;
    }

    public function getQtyIncrements()
    {
        echo 'test';
        exit;
    }

}


texts: what is mean by $indexes in installschema?? what it do?

texts:
as i was creating new module in magento2 which has table so when i was going through existing modules i found this function

$indexes= array();

we are just  creating array ok fine.

but if you go further you find this function

foreach($indexes AS $index)
            {
                $table->addIndex(
                $installer->getIdxName($tableName,array($index)),
                array($index)
                );
            }

i did not get what exactly going through and why we are using this $indexes array.


texts: I want to create custom field in 'add new user' form of admin panel in magento 1.9

texts:
I am creating sub admin users from Magento Admin Panel (System->Permissions->Users->Add New User). Here I want to add 1 custom field to save mobile number of each sub admin. I searched it but I didn't got any clue. Please help me to achieve it.
Thanks in advance.


texts:
As we can see most viewed products in admin dashboard.

I want to use same attribute ( its from report ) to sort products on product catalog sort by dropdown (toolbar.phtml)

or is there any better way to do this?


texts: I need to show category tree, just like in admin section, in my custom page. I viewed this solution in magento.stackexchange.com. It was good but limited to 2 levels of category. I need all the categories. How can it be done?


texts: Magento 2 : Is there any idea how product will come in mailchimp after connect my magento with mailchimp?

texts:
I just need to use Product Recommendations block in mailchimp account. My magento store is already connected with mailchimp account but i can not seen any product inside this product block in mailchimp.

so is there any idea about how can i get my magento store product here?


texts:
I shared an administrator account with a 3rd party solution provider to debug one of the extensions installed in our store. Now that the problem is fixed I changed the account password.

However this doesn't seem to log out existing backend sessions. They are still logged in (via browser cookie) even after I changed the account password.

Is there any way to force a log out of ALL Magento backend sessions?


texts: How to organize categories to show one where are active products and another as after sale products?

texts:
forum on Magento is down and I am not sure what to do exactly (I know how to crate categories, I need advice, how to organize categories):

I have Magento 1.9.0.1, I am preparing shop, where I will sell only few products at a time, but I want also show products, which are after sale, without possibility to buy, just as gallery.
Shall I create one category for active products and another for gallery of products and move products manually?
...or there is also possibility to create 2 stores with these views and one store will be for selling and another just as gallery and move products between stores manually - is that possible? ...is it possible to set, that all products in store are not for sale? ...they should by just as catalogue, without possibility to buy it...

Thank you for help PeterB


texts: Logout user while preserving cart contents

texts: When user leaves checkout funnel I need to logout him while preserving his cart contents (so the just logged out user as a guest would see all cart items that he had in a cart when he was logged in). How can I achieve that?


texts: Magento Add to cart button in row with grouped Products

texts:
In magento 1 I want to add Add to cart button with qty .Is it possible please see the attached screen shot

Any Help Appreciated


texts: Magento 2 - cash on delivery fee "0" with Iways PayPalPlus module + Phoenix CashOnDelivery module

texts:
We are facing the problem, that the cash on delivery fee is zero ("0"), when the PayPal plus module is activated. We are really sure that the PayPal plus module causes this error. We searched the console for a long time but we didn't find anything. If we disable the Iways PayPalPlus extension the cash on delivery fee will be calculated the right way. But we want every payment solution over PaypalPlus so excluding CashOnDelivery isn't solution.

On line 110 in M2/app/code/Phoenix_CashOnDelivery/Model/Total/Quote.php it says

$quote->getCodFeeInclTax()

and it returns "0".

Do you guys have any idea where we can affect the calculation to work with PayPalPlus. After a long time of testing, searching and googling it's time to ask the pros.

Thank you very much in advance for any idea,.


texts:
We have an ongoing issue with our styles.less file that prevents the css being generated for the Magento 2.1.8 back end.

Whe i run the command

bin/magento setup:static-content:deploy

It throws this error

Compilation from source: /microcloud/domains/operm2/domains/dev.website.co.uk/http/vendor/magento/theme-adminhtml-backend/web/css/styles.less

Compilation from source:
adminhtml/Magento/backend/en_GB/css/styles.less
Unable to get content for 'adminhtml/Magento/backend/en_GB/Magento_Checkout/css/source/_module.less'

In the styles.less file it is failing to import any of the other _module.less.

We currently have around 20 imports in this file:

@import '../Magento_Checkout/css/source/_module.less';
@import '../Ess_M2ePro/css/source/_module.less';
@import '../Magento_AdminNotification/css/source/_module.less';
@import '../Magento_AdvancedCheckout/css/source/_module.less';
@import '../Magento_Backend/css/source/_module.less';
@import '../Magento_Banner/css/source/_module.less';
@import '../Magento_Braintree/css/source/_module.less';

When i comment out the first import line:

@import '../Magento_Checkout/css/source/_module.less';

The error will then change to:

adminhtml/Magento/backend/en_GB/Ess_M2ePro/css/source/_module.less

has anyone encountered this error before? The file paths for the imports all contain the expected files, could this be an issue with permissions?

Thanks.


texts: How to properly transalte All Categories to another language?

texts:
I have multi language store, what I want to accomplish is to have my search bar categories field translated into two languages. I cannot seem to find how to translate "All Categories" to another language. I saw that it is hard coded in a file called form.mini.phtml. This is just a small part of the file but so you can have the idea.

<?php if($currentCategory != ""): ?>
    <?php echo $currentCategory ?>
<?php else: ?>
    <?php echo __('All Categories'); ?>
<?php endif ?>

Is there any way I can have this part translate so whenever a user opens the German version of the website it will say "Alle Kategorien" and when the English version is opened "All Categories" Thanks.


texts: Magento 2.4.1: Configure elasticsearch to ensure searching for a specific product in the search box of the site returns only searched product

texts: Entering a product ID into the search box of our Magento site displays suggestions along with the searched product. Is there a way to ensure searching for a particular product in the search box of the site returns only the searched product without any suggestion?


texts:
I have got an issue with the search-bar on my magento website which keeps returning an unsecure url. Be aware I am a bit of a noob when it comes to php.
The url gets called in this form tag:

<form id="search_mini_form" action="<?php echo $this->helper('catalogsearch')->getResultUrl() ?>" method="get">

How do I get this o call the secure url ?


texts: WAMP error 500 when attempting to setup Magento2

texts:
I'm attempting to setup my own WAMP server and use Magento 2. I've installed to my machine however in my apache error log I get

IfVersion', perhaps misspelled or defined by a module not included in the server configuration

I'm not sure what to do. Any help would be much appreciated thanks.


texts: I want to have a single line header in my magento 2 site I'm using the default luma theme, can some one help me with this?


texts: Difference between Magento Composer install and release install

texts:
What are the differences between the various Magento installs?

I installed it using the released code from github(v2.3.0.zip) and I installed it using

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition <install-directory-name>

The composer install has a lot more options on the admin end.

Which is the preferred installation type?


texts: Check signup checkbox is check or not on checkout

texts: Hello currently i am using one page checkout and i want to know that signup check-box is check or not on checkout page. How can i know that sign up is checked or not?


texts: Had to restore site, when it came back it has index.php in the urls, how do I get rid of the index.php

texts:
Would like to say thank you up front for your help!!!  I have magento 1.4.0.1, I AM NOT A COMPUTER GEEK by any stretch of the word.  I do not have a developer so if someone can help answer this being very specific, step by step I would really appreciate it!!
I was trying to get an Amazon payment button on our site.  To make a long story short, I had to restore the site, when the site was back up and functioning in the URL's Index.php was present.

/index.php/admin/dashboard/
index.php/womens-gifts/purse-hooks.html

Since this has happened I also have 6800 NOT FOUND errors on Google webmasters.   Please for customer friendly circumstance and the Holidays coming I need to get this off.  I have spoke to our server support and they informed me that there was 3 access points  .htaccess file code.
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

Can somebody help me please.  However then they said if I made a mistake I could do something major to the site and I found this site, so I am hoping to get some help, help that I can understand, Thanks Again  Tracy


texts:
I have installed

  https://github.com/pavelleonidov/magento2-tinymce4

Still, getting admin error

Failed to load resource: the server responded with a status of 404 ()
require.js:141 Uncaught Error: Script error for: tinymce
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js:166)
    at HTMLScriptElement.onScriptError (require.js:1681)

Failed to load plugin: noneditable from url https://shopycatch.com.au/new/pub/static/version1592137818/adminhtml/Magento/backend/en_US/plugins/noneditable/plugin.js

tiny_mce_4 is the folder in between


texts: Magento 2 - How do I change the locale of admin backend?

texts: I checked ALL the settings under stores->configuration. Is there a view mode or something else?


texts: Get a list of products with Tiered or special pricing

texts:
Recently updated pricing for the year and have had a couple issues with customers making transactions with last years lower tiered pricing. Is there a way to quickly detect which products have tiered pricing? So we can review them.

An SQL query would work fine.


texts: Magento 2 - Backend (admin) login not working

texts:
I try to login to the backend. I entere the correct credentials, but the form just reloads and nothing happens.

I deleted all cookies, but it makes no difference.

UPDATE: I tried it again. I entered incorrect credentials on purpose and then after it I entered the correct ones, and now it works. Strange bug...


texts: Is this good idea to change current application mode from Env.php

texts:
I have see all  answer of question,
How do I set Developer Mode in Magento 2

All are good.

But suddenly i got another solution myself ,by directly change MAGE_MODE value at env.php(app/etc/  ) and here change current application mode from default to developer by MAGE_MODE' => 'default' to MAGE_MODE' => 'developer' .

and it been works.

But now my question is that this a good solution for change Application mode?.

Please put your views.


texts: How to add new column in sales_order_grid.xml dynamically or direct from class?

texts:
I have created a configuration for selecting fields from sales_order table to join with sales_order_grid table. I need to show these selected extra fields on the sales order listing page. like the screenshot below.

When enabling the fields from configuration it will be shown in the order listing page. Could you please help me to sort out this issue.
I have tried below code in app/code/Vendor/OrderGrid/view/adminhtml/ui_component/sales_order_grid.xmlsales_order_grid.xml
<columns name="sales_order_columns">
    <column name="customer_id" class="Venor\OrderGrid\Component\Fields">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/column</item>
                <item name="label" xsi:type="string" translate="true">Customer id</item>
                <item name="sortOrder" xsi:type="number">60</item>
                <item name="align" xsi:type="string">left</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="visible" xsi:type="boolean">false</item>
                <item name="filter" xsi:type="string">text</item>
            </item>
        </argument>
    </column>
</columns>

And extend Column class by Fields Vendor\OrderGrid\Component\Fields.
    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {
               $item['componentDisabled'] = 1;
               $item['visible'] = 0;
            }
        }
    return $dataSource;
    }


texts:
I followed below link to create custom api.
https://belvg.com/blog/how-to-create-custom-api-in-magento-2.html.

Where 2 methods are written in that first method is working but calling
rest/V1/test1 is showing error like Request does not match any route.

can anyone suggest where is wrong.


texts:
So i have created a Magento 2 theme based on Blank, and the customer wants the submenu of the navigation to be a big window instead of the little dropdown that comes out of the box. They also want custom links in this window..

Im totally lost, I have inserted the topmenu.phtml into the theme and from there i can only tweak so much.. It would be great if i could get the submenu out of the menu such as this:

    <?php /* @escapeNotVerified */ echo $_menu; ?>

    <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?>

But the function for $_menu is quite complicated and i havent managed to get the backend of topmenu.php into my project properly.

Moving stuff around in the default.xml doesnt help since i need to build a layout for the block/div with custom links and styling.

What do i do? Buying extensions like mega-menu is not an option..
Building a whole new module with the category-navigation seems super hard and overkill?


texts: I don't have access to the backend and need to disable all the modules. How can I disable them via database?


texts: Magento 2 - best way to install extension

texts:
I've made a new extension for my company, while developing everything seems to work properly. But when I've tried to install my extension I encountered some problems. At the beginning I've tried to install it by Web Setup Wizard, in version 2.1.2 I received some errors, log below:

[2017-01-11 13:40:11 CET] Job "maintenance_mode {"enable":true}" has been started
[2017-01-11 13:40:11 CET] Magento maintenance mode is
enabled.
[2017-01-11 13:40:11 CET] Job "maintenance_mode {"enable":true}" has successfully completed

[2017-01-11 12:41:03 UTC] Job "setup:cache:disable []" has started Changed cache status:
config: 1 -> 0
layout: 1 -> 0
block_html: 1 -> 0
collections: 1 -> 0
reflection: 1 -> 0
db_ddl: 1 -> 0
eav: 1 -> 0
customer_notification: 1 -> 0
full_page: 1 -> 0
config_integration: 1 -> 0
config_integration_api: 1 -> 0
translate: 1 -> 0
config_webservice: 1 -> 0

[2017-01-11 12:41:03 UTC] Job "setup:cache:disable []" has been successfully completed
[2017-01-11 12:41:03 UTC] Job "setup:module:disable {"components":[{"name":"Salesmanago_Integration"}]}" has started The following modules have been disabled:
- Salesmanago_Integration

Cache cleared successfully. Generated classes cleared successfully.
Please run the 'setup:di:compile' command to generate classes. Info:
Some modules might require static view files to be cleared. To do
this, run 'module:disable' with the --clear-static-content option to
clear them.

[2017-01-11 12:41:04 UTC] Cleaning generated files...
[2017-01-11 12:41:05 UTC] Complete! [2017-01-11 12:41:05 UTC] Clearing cache...
[2017-01-11 12:41:05 UTC] Complete! [2017-01-11 12:41:05 UTC] Job "setup:module:disable {"components":[{"name":"Salesmanago_Integration"}]}" has been successfully completed
[2017-01-11 12:41:05 UTC] Job "setup:cache:enable ["config layout block_html collections reflection db_ddl eav customer_notification full_page config_integration config_integration_api translate config_webservice"]" has started
Changed cache status:
config: 0 -> 1
layout: 0 -> 1
block_html: 0 -> 1
collections: 0 -> 1
reflection: 0 -> 1
db_ddl: 0 -> 1
eav: 0 -> 1
customer_notification: 0 -> 1
full_page: 0 -> 1
config_integration: 0 -> 1
config_integration_api: 0 -> 1
translate: 0 -> 1
config_webservice: 0 -> 1

[2017-01-11 12:41:05 UTC] An error occurred while executing job
"setup:cache:enable ["config layout block_html collections reflection
db_ddl eav customer_notification full_page config_integration
config_integration_api translate config_webservice"]": Could not
complete setup:cache:enable ["config layout block_html collections
reflection db_ddl eav customer_notification full_page
config_integration config_integration_api translate
config_webservice"] successfully: Warning: ltrim() expects parameter 1
to be string, object given in
/var/www/html/magento-212opt/vendor/magento/framework/Code/Generator/EntityAbstract.php
on line 152
[2017-01-11 13:42:03 CET] There was an error in previous
Update attempt.

I've read that it was connected with some errors in Magento 2, is this true ?

Later I was looking for alternative installation types.

First option:
Copy extension to app/code and add line to etc/config.php

'Salesmanago_Integration' => 1,

And after page reload it was ok on my local machine.

Second Option:
Paste extension to app/code and than run:

 php bin/magento setup:upgrade

 php bin/magentosetup:static-content:deploy

 chmod -R 777 var pub/static

This one also works on my local machine.

Not the questions, which option is the best? Why Web Wizard doesn't work ?  There is a problem with plugin ?


texts: Does anyone know how to remove the price from the email invoice template?


texts: Magento 2: Backup failed, Error received from server

texts:
I try to install an extension and can't continue because my backup failed:

Backup failed
Error received from server:

I setup file permission like this for shared hosting but it didn't help:
http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-system-perms.html

]1


texts:
I want to ask, how to hide as low as for product that I give a tier price
I just want to hide it in a category, not on the product page.

anyone knows how to do it? I searched for it but I didn't find the solution for it.

Magento 1.9


texts: How to Apply more then 4 price cart rules

texts:
I have the following scenario

Buy 2 items get 10% discount Buy 3 items get 12% discount Buy 4 items get 30% discount buy 5 items get 40% discount buy 6 or more get 50% discount

How to I get Magento to always take the discount from the original subtotal price. Currently Magento works okay for the first 10% discount but once it goes into the 2nd bracket it not applies the discount on subtotal i follow this rule

How to apply interval discounts to original shopping cart price


texts: Using local.xml, I'm getting "Invalid Nesting" errors

texts:
With the aim to simplify a lot of our layout XML, I've moved the pertinent parts of our individual files to one local.xml.  Everything works fine.  However, in the logs, I see errors like this:

  2013-03-05T21:44:53+00:00 DEBUG (7): [INVALID NESTING!] Found: layout/package_update: catalog_product_view | Expecting: layout/db_update: SHORTCUT_uk_popup

The expected <update handle="SHORTCUT_uk_popup" /> node is in paypaluk.xml.  I tried just adding it to the same area of my local.xml but didn't fix it.

I could just comment it out but I wanted to understand what the Best Practice way should be.  Could anyone advise?


texts: Magento 2.3.4: How to serve end-users updated static files

texts:
We recently upgraded from 2.3.1 to 2.3.4-p2. However we're getting reports from end-users of some core functionality, such as the checkout process, breaking due to their browser serving outdated files (I assume files from before the upgrade).
Asking them to manually clear their cookies / cache fixes the issue on their end, however that doesn't sound like the proper solution.
We've already ran the following:
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf generated/code/*
bin/magento s:up
bin/magento s:d:c
bin/magento s:s:d -f
bin/magento i:rei
bin/magento c:f

Is there any other proper ways to make sure end-users are being served up-to-date static resources?


texts:
I've made an static website with html and php, so I have my src folder with .html files, and folders img, css, fonts, img and js. How can I upload the entire folder to Magento. Like, I have my website with my products and stuff, and I want a link to this new website I made but it has to be in Magento, so my new website has all of the menus, footer, etc. of the "real" web.

I don't know if I'm explaining correctly, hope I do.

Thanks!


texts: Magento Create Category While Installing a Module

texts:
While creating the category via installer, category not created but the table is created,

below i added my installer script,

any wrong in this script?

$installer = $this;
$installer->startSetup();
$installer->run("
DROP TABLE IF EXISTS {$installer->getTable('membership/members')};
CREATE TABLE `{$installer->getTable('membership/members')}` (
      `memberid` int(11) NOT NULL auto_increment,
      `name` text,
      `email` text,
      `cateid` text,
      `date` datetime default NULL,
      `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
      PRIMARY KEY (`memberid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->run("
DROP TABLE IF EXISTS {$installer->getTable('membership/types')};
CREATE TABLE `{$installer->getTable('membership/types')}` (
      `mtypeid` int(11) NOT NULL auto_increment,
      `typename` text,
      `duration` text,
      `description` text,
      `price` text,
      PRIMARY KEY (`mtypeid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");

$allStores = Mage::app()->getStores();
foreach ($allStores as $_eachStoreId => $val)
{
    $_storeId = Mage::app()->getStore($_eachStoreId)->getId();
    $root_catid = Mage::app()->getStore($_storeId)->getRootCategoryId();

    $parentCategory = Mage::getModel('catalog/category')->load($root_catid);
    $childCategory = Mage::getModel('catalog/category')->getCollection()
        ->addAttributeToFilter('is_active', true)
        ->addIdFilter($parentCategory->getChildren())
        ->addAttributeToFilter('name', 'categoryname')
        ->getFirstItem()    // Assuming your category names are unique ??
    ;

    if ($childCategory->getId() == null) {
        $category = new Mage_Catalog_Model_Category();
        $category->setName('categoryname');
        $category->setUrlKey('att-membership');
        $category->setIsActive(1);
        $category->setDisplayMode('PRODUCTS');
        $category->setIsAnchor(0);

        $parentCategory = Mage::getModel('catalog/category')->load($root_catid);
        $category->setPath($parentCategory->getPath());

        $category->save();
        unset($category);
    }
}

$installer->endSetup();


texts: Function isContextCheckout( ) not working

texts:
I've checked that isContextCheckout() function is not working on the site. Where can I find it? I'm using the 1.8.1 version of Magento. Is there a bug reported for that function? It is being used in some template files, like account login (/template/persistent/customer/form/login.phtml):

<?php if (Mage::helper('checkout')->isContextCheckout()): ?><input name="context" type="hidden" value="checkout" /><?php endif; ?>

For me, its function is check if the buyer comes from checkout and add a parameter "context" with the value "checkout" in the url, so, in this way Magento can handle the success url and redirect to the checkout page. However, it's not working, I mean, the input hidden with name "context" doesn't appear in html because "isContextCheckout" probably is not working. I need that function because when the buyer wants to checkout, he/she is redirected to login page, and if he/she is not registered, it will be necessary make click on "Register" and to be taken to the registration page, however, the registration page url needs to have "?context=checkout" as a parameter.

Any helps?


texts: Magento 1.6.2.0 update to 1.9.x Now products have no category

texts:
Magento ver. 1.6.2.0 with Template-Master Classic (f002) theme - modified

The update to Magento 1.9.x did not go well and I restored my backup to 1.6x.
Now none of the products have any category.

Specifically the question is "Are the products in the expected category?" and the answer is no.

All the category for existing products are gone and say (0) in the quantity. Further since the products both in the admin and front-end have no category, the fornt-end says "there are no products in this category" and the back-end looks like this:

My problem description seems not to be anywhere to be found in any forum or help as everything seems to describe something close to an input error. I have well over a few thousand products so correcting them one by one would take me a year!!! I have looked in the database but I maybe don't know enough to see what is wrong or missing? I have many backups of the database but I do not know what table to import to correct this? And I do not want to loose my new inventory edits.

At one point I had a link as how to export and import just products but I can't find it as the last time I did something like this was Magento 1.4 something

thanks for your help

nilandtrading.com (formally nilandsplace.com)


texts: by default selected first color in color swatches in magento2

texts:
I have color swatches in around products I want get selected first color by default in magento2

https://i.stack.imgur.com/IBX7L.png as you can see in the image color, are shown I want to keep the first color by default
code to display color swatches

<?php
                        if($_item->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE){
                            $swatchBlock = $this->getLayout()->createBlock("Magento\Swatches\Block\Product\Renderer\Listing\Configurable")->setTemplate("Magento_Swatches::product/listing/renderer.phtml");
                            echo $swatchBlock->setProduct($_item)->toHtml();
                        }

                     ?>

jquery code

<script>
require(['jquery', 'jquery/ui'], function($){
 jQuery(document).ready(function(){

        var swatchLength = $('.swatch-attribute').length;
        if(swatchLength >= 1){
            if($('.swatch-attribute').hasClass("color")){
                $('.swatch-option').first().trigger('click');
            }
        }
    });

});


texts: How to assign simple product to configurable product programatically in magento 2?

texts:
I want to know any script where we can assign a simple product to configurable products with just add product Id.

can anyone give me script for it?