texts: solr cannot index attribute/sku in integer

texts:
I'm using magento enterprise 1.12, and I found that solr doesnt index and unable to search for some conditons:

(1) cannot search sku which is in all numbers

if the sku  is in all numbers (where i found that the field type is text), magento couldnt return correct result.   But if i search this number in solr admin, it returns results.
After investigation , i found that is due to "qt" parameter which generate "qt=magento_zh".
If the searching request contains qt parameter, it search text/fulltext only but not numbers and vice versa. How can i search numbers & text at the same time?

(2) cannot index integer attribute in solr
i have an attribute - book_isbn which is all numbers.

In solr, there are 2 relevent indexed columns: attr_book_isbn_zh  , attr_sort_isbn_zh

magento always request to search the first one , which is always empty, it should search the latter one which got value.  Something strange is the situation only happen on this attribute, i have another text attribute "book_author"(same attribute settings) which never get this problem.
So i would like to why solr doesnt index  this column ?

Thanks!!


texts: elevateZoom not working since upgrading from 1.9.0.1 to 1.9.1

texts:
Just upgraded from 1.9.0.1 to 1.9.1 and now the product zoom is not working.  It sort of works on some products but way of its focus. So not sure what has happened would really appreciate any advice.  This is a great feature of magento and enhances the shopping experience.
Many thanks
jagall


texts: Narrowing shipping method to only 1 option?

texts:
I have a product that weighs 30 lbs. However, when a customer orders multiples of this product--say, 10 of them--the total weight should be 300 lbs.

I have an extension for FedEx Freight that is configured for an activation weight of 141 lbs. The regular ground FedEx maximum weight is set to 140 lbs.

Considering these settings, only the freight option should be shown, but at checkout both methods are being given as options for shipping.

What do I need to configure to make sure total weight is taken into consideration, and only one shipping method is shown? I'm a newbie at this, so please be specific if possible.

My Magento version is 1.7.0.2


texts: Limiting search suggestions to a certain number?

texts:
I believe that Magento shows up to 1000 suggestions by default (if there are that many). I would like to limit this to 5.

I came across this topic: http://www.magentocommerce.com/boards/viewthread/21155/ .. but given that it's 6 years old I'm afraid to try it on our site (which is generating a lot of revenue and cannot risk going down). I couldn't find anything else related to this that seemed reliable.

Has anyone done this before? I really wish they would make this more convenient.


texts: Why do attribute codes have a maximum length?

texts:
When trying to create attributes, I've discovered that the maximum length of an attribute code is 30 characters. Turns out though, that this is NOT actually some sort of real restriction - it is a completely arbitrary value, defined by

Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH.

So given that, why is there a restriction at all? And why is the default 30, rather than for instance 255, which is the actual limit of the database column?

PS. If anyone can think of better tags for this question, please update them.


texts: Get sub-categories of parent with flat catalog enabled Magento 2

texts:
I have the following code in a phtml fill that is called in a static block and produces a list of sub-categories for the parent. It currently does not work when flat catalog is enabled. Can anyone suggest an update to get this code to work with flat catalog enabled?

CURRENT CODE IN CMS>STATIC BLOCK

{{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/categoryblockssteve.phtml"}}

CURRENT CODE IN TEMPLATE/PHTML

<?php

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$request = $objectManager->get('Magento\Framework\App\Action\Context')->getRequest();
//echo $request->getFullActionName();
if($request->getFullActionName() === "catalog_category_view"){ ?>

    <?php
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');
    /*print_r($category->getData());
    exit();*/
    ?>

    <?php if($category->getDescription()) { ?>
             <?php echo $category->getDescription(); ?>
             <?php /*

<?php echo $category->getName(); ?>

<?php echo $category->getDescription(); ?>

                 */ ?>
    <?php } ?>

            <?php

            //print_r($category->getData());
            //echo $category->getEntityId();

            $_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
            $object_manager = $_objectManager->create('Magento\Catalog\Model\Category')->load($category->getEntityId());
            $testse = $object_manager->getChildrenCategories()->getData();

            //exit();
            /*$sublist = $category->getChildren();
            $testse  = explode(",",$sublist);*/
            /*print_r($testse);
            exit();*/
            foreach ($testse as $subids) {

                $_objectManagers = \Magento\Framework\App\ObjectManager::getInstance();

                $object_managers = $_objectManagers->create('Magento\Catalog\Model\Category')->load($subids['entity_id']); ?>

                        <a href="<?php echo $object_managers->getUrl(); // URL  ?>" alt="<?php echo $object_managers->getName(); // Name ?>">
                            <?php echo $object_managers->getName(); // Name ?>

                        <a href="<?php echo $object_managers->getUrl(); // URL  ?>">

                            <?php if($object_managers->getImageUrl()) { ?>

 <img src="<?php echo $object_managers->getImageUrl(); //Img Path ?>" alt="<?php echo $object_managers->getName(); // Name ?>">

                            <?php }/* else{ ?>

 <img src="<?php echo ""; //Thamnel img ?>">

                                    <?php }  */?>

            <?php     } ?>

<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('all_cat_bottom')->toHtml();?>
<?php } ?>


texts:
Magento is installed in my root domain: mydomain.com

My support/ticket system is in mydomain.com/support

My favicon is correct in magento and support

BUT, when someone opens a .pdf file in my support system, the favicon is magento.

How do I force the favicon to be my favicon when a pdf is opened?


texts: Magento getting Order saving error: Disallowed file type. error when uploading image

texts:
When I'm uploading an image through admin panel, I am getting below error:

  Order saving error: Disallowed file type.

Can anyone help me what can I do to solve this?


texts: Blank admin page after successful login for one specific IP address ...

texts:
Since a few days logging in to our Magento (1.8.1) backend is impossible - but only from one specific IP address, the IP address that used to be set at System -> Configuration -> Advanced -> Developer -> Developer Client Restrictions.

The issue at hand is that the login seems to be successful, yet I receive a blank admin page instead of the dashboard.

While trying to troubleshoot this issue I have of course changed this IP address to another IP address (1.2.3.4), cleared sessions and caches, even rebooted our server, but no luck.

Still receiving a blank page.

I activated all of the possible logging / developer options hoping this would give me a clue of what's wrong, maybe even on infamous fatal error, but no. Just a white screen and no suspicious or clueful entries in nginx, php or magento logs.

What makes it more strange is that this problem happens on multiple computers/browsers behind one specific (and fixed) IP address, yet if - for instance - I connect one of these computers to a 3G Hotspot (and as such connect using a dynamic IP address) I am able to successfully login to our backend. Now if I disconnect from the hotspot and on to the regular wifi (and as such continue using the fixed / problematic IP address) it works perfectly. I can navigate all pages of the backend -including the dashboard- without any issues.

Once logged off or timed out the issue re-appears.

Someone somewhere any clue on why this is happening and how to solve this?


texts:
I followed this tutorial to have customer custom attributes :

http://www.extensions.sashas.org/blog/magento-2-1-3-how-to-make-customer-attribute-update.html

which was working fine since I updated from Magento 2.1.7 to 2.1.9.

The form is not working anymore.

The page reloads, but nothing happens, no error or success message and customer is not being registered.

When I delete app/design/frontend/{theme_company}/{theme_name}/Magento_Customer/templates/form/register.phtml, the registration works fine.

I also checked the new vendor/magento/module-customer/view/frontend/templates/form/register.phtml file, and saw no change in latest version.

The problem does not seem to come from

  app/design/frontend/{theme_company}/{theme_name}/Magento_Customer/templates/form/register.phtml

If I only copy

  vendor/magento/module-customer/view/frontend/templates/form/register.phtml

to

  app/design/frontend/{theme_company}/{theme_name}/Magento_Customer/templates/form/register.phtml

without making any changes, I have the same problem.

Looks like the file does not « connect » with files located in app/code/Sashas/CustomerAttribute/ anymore .. ?

I tried to setup:upgrade and setup:di:compile after Magento update, but no change.

I can't seem to find any changes made in customer registration files in versions 2.1.8 or 2.1.9.


texts: Why entity values are stored in different tables based on attribute type?

texts:
The values of customer entities stored in different tables based on the attribute type

ex:

customer_entity
customer_entity_datetime
customer_entity_decimal
customer_entity_int
customer_entity_text
customer_entity_varchar

can you explain the benefit/need to store the entity values like this?


texts:
We needed to have out of stock products show for configurable products. I have managed to get this working all ok, however I have a custom attribute called fulfilment which is a select option for the products so you can set an out of stock message such Available in 7 days etc.

I need to get the attribute text in app/code/local/ModuleCompany/ModuleName/Block/Catalog/Product/View/Type.php but don't seem to be able to however I try.

Inside of getJsonConfig() method I try

    $custom_stock_attribute = Mage::getModel('catalog/product')->load($currentProduct->getId())->getAttributeText('fulfilment');

But just can't seem to get it working. So the question is how do you get attribute value of a select field from a module?

Magento Version: 1.9.2.4


texts:
I followed this to setup a multi store and got the following output.

There was no Home CMS page configured or found.


texts:
Does anyone know if there is some kind log or something build in to magento, where i can find the number of products that text written to the search has retrieved and when it occurred in the front end (the text with time stamp fits too). I need to know the past queries not the future ones.
I am the beginner in magento.


texts:
Is it mandatory to reindex all indexes everyday? What are the mandatory ones and what are the optional ones? Below is the crontab details I have and I see some indexers run and some don't. The ones with Jan 7 date were run manually by reindex command yesterday.

* * * * * /usr/bin/php -f /home/site/web/site.com/public_html/bin/magento cron:run &> /dev/null
* * * * * /usr/bin/php -f /home/site/web/site.com/public_html/update/cron.php &> /dev/null
* * * * * /usr/bin/php -f /home/site/web/site.com/public_html/bin/magento setup:cron:run &> /dev/null


texts: Magento 2 : Cannot Read Property "quoteData" of undefined

texts:
I was seeing various errors on cart page of Magento 2.1.6.

Cannot read property "quoteData" of undefined (quote.js)
Cannot read property 'storeCode' of undefined (url-builder.js)
Cannot convert undefined or null to object (customer-addresses.js)

Incase someone else sees these errors, for me they were caused by removing certain blocks from checkout in XML.

<referenceBlock name="checkout.cart.shipping" remove="true"/>
<referenceBlock name="checkout.cart.coupon" remove="true"/>
<referenceBlock name="checkout.cart.crosssell" remove="true"/>
<referenceBlock name="checkout.cart.order.actions.gift_options" remove="true"/>

I fixed by re-inserting blocks and hiding relevant sections with css.


texts: Catalog price rule not excluding specific categories

texts:
I have set up a catalog price rule for a specific customer group. I want to exclude some different categories with this rule.

See setting in screen:

For some reason this is not excluding products OR categories.

This is in Magento 1.9.1.0

I have tested exact same settings in 1.7.0.2 where this works perfectly.

What am I missing here?


texts: Is it feasible to use negative values for prices if you want the option to reduce the base price of the product while adding Custom Options?


texts: Why is a cron task producing empty image URLs?

texts:
I'm working to troubleshoot an issue with a 3rd party extension which we have slightly modified.  The stock extension has as model that holds an instance of a product and offers methods related to that product.  One method is to retrieve the image URLs, which it does so via string concatenation and always uses the original image file.  We have overridden this method in order to have it return a scaled/cached image rather than the original.

The updated code works when its action is invoked via a click in the admin panel, but when run automatically via cron the URLs it returns are empty (and/or the entire result is null--I haven't been able to directly capture the output).

Here's trimmed-down versions of the code of the two:

The Original: String Concatenation return the original product Image URL

    $galleryImages = $this->getProduct()->getData('media_gallery');

    foreach ($galleryImages['images'] as $galleryImage) {

        $images[] = Mage::app()->getStore($this->getStoreId())
                        ->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA, false).
                        'catalog/product/'.ltrim($galleryImage['file'],'/');
    }

    return $images;

The Override: The catalog/image helper returns resized URLs

    $galleryImages = $product->getMediaGalleryImages();

    foreach ($galleryImages as $image) {

        $images[] = (string) Mage::helper('catalog/image')
            ->init($product, 'image', $image->getData('file'))
            ->keepFrame(false)
            ->constrainOnly(true)
            ->resize(700, 700);
    }

    return $images;

What would cause the override to produce null or empty results when invoked via cron, but produce the expected output when invoked by UI interaction with an active session?


texts: How to make a Category parent link not cliquable and just the subcatgories cliquables M2

texts: I have a category with id =41 and have 2 child i want to see the parent category and her child but just make the parent category link not cliquable any idea please and thanks in advance


texts: How I can set "Display Product Options In" via Magento2 Api?

texts:
does anyone know if you can set this option via Magento API

I couldn't find anything in the documentation, and I'm too unable to find it in the source code

https://devdocs.magento.com/redoc/2.3/admin-rest-api.html#tag/products


texts: How to send email on order status change

texts:
i'm using Magento 1.9.0.1.

I've created a function for mass order status change.

Here is my code:

public function NewMass1Action()
{
    $orderIds = $this->getRequest()->getPost('order_ids', array());
    $countHoldOrder = 0;

    foreach ($orderIds as $orderId) {
        $order = Mage::getModel('sales/order')->load($orderId);
        if ($order->canHold()) {
            $order->masscustom1()
                ->save();
            $countHoldOrder++;
        }
    }

    if ($countHoldOrder) {
        $this->_getSession()->addSuccess($this->__('%s order(s) have changed status.', $countHoldOrder));
    }

    $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/index'));
}

The problem is that this function is not sending an email to the customer when his order status is changed.

How can i make this function send an email for the status change?

Thanks in advance!


texts: Magento 2 Custom install script won't work

texts:
I am trying to create installation script that make a record to cms_page table.

So i created the next directory
/app/code/Magento/Page/

Here is my /etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Page" setup_version="1.0.0" />
</config>

And registration.php

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

Here is InstallData.php

<?php

namespace Magento\Page\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->getConnection()->query("INSERT INTO inviqa_example SET name = 'Test 1'");
    }
}

Problem is that after installing i have no inviqa_example table in mysql.

After command php -f bin/magento setup:upgrade i have long module list. Last rows are next:
Module 'Page':
Please re-run Magento compile command


texts: Magento 2 - Email Template insert variable in html format

texts:
I have create QR_Code on sales_order table and append   {{var order.qr_code }}
on template and only display as string on the email content
 translate into text form
example

< to &lt
> to &gt;

I try  {{var order.qr_code|raw}} but didn't work. As i want show QR code on new order new email.


texts: Is there any way to get where condition from the collection?

texts:
I want to get the where condition from a collection.I'm using it in my sales order grid.

$collection = $this->getCollection();
echo $this->getCollection()->getSelect();

When i apply getselect to the collection i could see the corresponding query with where condition:

 SELECT `main_table`.*, `myorder`.`customer_email` FROM `sales_flat_order_grid` AS `main_table`
     LEFT JOIN `sales_flat_order` AS `myorder` ON myorder.entity_id = main_table.entity_id
     WHERE (`main_table`.`status` = 'received')
     ORDER BY main_table.created_at DESC LIMIT 20

But I want to know is there any other way to get where condition directly from the collection itself.

I want to apply that where to another query of mine.


texts:
I add 2 js files to my theme using requirejs, but I get these error:

Uncaught TypeError: Cannot read property 'captcha' of undefined
Uncaught TypeError: Cannot read property 'autocomplete' of undefined

These errors are on files that I don't add, are magento 2 js files


texts: Prevent modal from appearting Ajax Cart Pro Magento 1

texts:
Basically, what I'm trying to do is to keep the old behaviour if condition 1, or use the modal if condition 2. But I can't find where Ajax Cart pro handle this.
I have a form which is working properly, handled by some javascript then by the Mage core (checkout/cart/add).
    var productAddToCartForm = new VarienForm('product_addtocart_form');
    productAddToCartForm.submit = function(button, url) {

        if (this.validator.validate()) {
            jQuery("#loading-mask").show();
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
                form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            console.log('after submit');
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }
    }.bind(productAddToCartForm);

Doing this without Ajax Cart pro works fine, when I have a notice message to print, it redirect me to the same page and print me the notice message
action_data: []
msg: [{text: "My message", type: "notice"}]
redirect_to: "http://website/oneproduct.html?options=cart"
success: true

Now I have Ajax Cart Pro activate, this request still works, but somehow, somewhere, there is a second request, that makes the modal appearing with no notice message.
block: {,…}
    options: "<div>↵        <script type="text/javascript">↵    "
msg: []
success: true

So, even if the first request is still doing her job, the Ajax Cart pro seems to erase the previous core result.
Here is the module : https://ecommerce.aheadworks.com/magento-extensions/ajax-cart-pro.html
Thanks


texts: Change product result collection for Advanced Search Results only

texts:
Our configurable product's visibility is set as catalogue/search and the associated simple products are marked as not visible individually which is all good.
Now, the website offers standard search along with advanced search.
What we want to achieve is:

On standard Magento search, for a matching search query, return configurable products only (achieved already by setting configurable product visibility to catalogue,search)
On advanced search i.e. example.com/catalogsearch/advanced/, we need to hide the matching configurable products AND only show the matching associated simple products (mind it the simple products are set as 'not visible individually' already)

So my question is, what is the best way to achieve this? I reckon the search module uses the same result collection to render results so I'm a bit stuck at this point.
Any help is highly appreciated.
Thanks


texts:
How can I get the ids and the names of a group of parent categories? I got an array of ids that belong to a product but I want to show their parent id names too.

With this code I get all current ids:

$currentCatIds = $_product->getCategoryIds();

This returns an array:

Array ( [0] => 15 [1] => 25 [2] => 66 [3] => 78 [4] => 79 [5] => 80 [6] => 81 [7] => 82 [8] => 83 [9] => 84 [10] => 85 [11] => 86 [12] => 87 [13] => 88 [14] => 89 [15] => 90 [16] => 91 [17] => 100 [18] => 179 )

I need the parentids of the above categories and their names.

For example:

Topcategory 1
 - Subcat 1
 - Subcat 2
 - Subcat 3
 - Subcat 4
 - Subcat 5

Topcategory 2
 - Subcat 6
 - Subcat 7
 - Subcat 8

All subcats are in the above array and shown on the product page, but I need the ids of Topcategory 1 and 2 and their names.


texts: Catalog search shows apostrophe a %27, finds nothing

texts:
When I search for Cee'd it converted as Cee%27d and shows nothing for search term.

If there is punctuation or diacritic, it doesn't search anything.

I don't know since when it started do it.

Any idea what might be the problem?


texts: Wondering if I can improve this PHP function?

texts:
I've added a function to a custom module and I'm just wondering if I can improve the code.

The function basically gets the collection of items (products) from the order and checks to see if any of them have a custom attribute, called DeliveryOption, with the value 'JKLMN', if it does it returns false.

public function checkForTrackingCode()
{
    $_productObject = Mage::getModel('catalog/product');
    $_isAnPost = true;
    foreach ($this->getItemsCollection()->getItems() as $item) {
        $_product = $_productObject->loadByAttribute('sku', $item->getSku());
        if ($_product->getDeliveryOptionValue() != "JKLMN") {
            $_isAnPost = false;
            break;
        }
    }
    return $_isAnPost;
}

Specifically I'm wondering if I should load the $productObject or rather just do it in the foreach loop with:

$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());

My thinking was if I put the Product Object into $productObject  it would save on resources rather than having to do it each time in the foreach loop, is this correct?

Also, I tried getting DeliveryOptionValue straight from the itemsCollection with from the $item->getProduct()->getDeliveryOptionValue(); but that just returned null, I thought that should have worked.

I should mention that our Module Class extends from Mage_Sales_Model_Order so $this is the salesOrder Object.


texts: Magento 2 styling / CSS not displaying in IE 9

texts:
For some reason any Less I have written inside the @media-common = true media query does not load in IE9. I can't find any specific code to prevent this from rendering out in IE9.

It happens whether it's client-side Less compilation or deployed to a server in production mode with server side compilation.

I've tried clearing the usual directories, clearing caches, running the deploy static content command.

All the CSS updates and loads in IE9 minus any styling within the & when (@media-common = true) {} mixin.

Example

For example ther following code should render the background to be green as it has important, this works as expected in every browser and device except IE9.When I load the website in IE 9 the background is blue.

//
//  Common
//  _____________________________________________
& when (@media-common = true) {
    body {
        background-color: green !important;
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    body {
        background-color: red;
    }
}

//
//  Tablet and above
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    body {
        background-color: blue;
    }
}

Question

Why is IE9 ignoring any code inside & when (@media-common = true) {}?


texts: First PDF download always redirects to the admin dashboard

texts:
The first time you try and download a PDF from the admin area after logging in (for example "Print" when viewing an order invoice) you get redirected to the administrators dashboard.

The next time you try it, it works as expected.


texts: Magento Session timeout when the browser close and doesn't browse for a while

texts:
I am new to Magento and I want to destroy the session when

the user doesn't browse through your site for a while (5 mins) and
the user closes the browser directly

In both cases the session should expire and redirect to login page. I Googled for this and I found that:

System->Configuration->Web->Session Cookie management->Cookie Lifetime

If I will set this value to 300(5 mins) then the session will expire and it's fine.
If I set the same value to '0' then it will work for second case(if browser close then session expire)

Suppose I want to expire session for above both cases then how can I get it work?


texts: What is Validation class for Floating Point numbers

texts:
magento 2 have Validation clases for admin forms
Like this for integer.
What is for floatting numbers like 12.00 or 23.33

        <item name="validate-integer" xsi:type="boolean">true</item>

Thanks for your valuable help


texts:
I am using Varnish cache on Magento 2.1, and I need to disable the cache for upgrading purpose.

I go to System > Tools > Cache Management, and select all the cache types, and choose "disable" and submit.

But I this error error:

  Deployment config file env.php is not writable.

I tried to chmod app/etc/env.php and app/etc/config.php to writable (777), but still can't disable the cache.

Any idea why this is happening?

thanks!


texts: Get Order datetime including timezone in email template

texts:
I try to modify default New Order email template.

Currently, I get order datetime by {{var order.getCreatedAtFormated('short')}}.
It results 6/18/2015 12:18 PM.

I want to include timezone following datetime, expected result is 6/18/2015 12:18 PM GMT+7.

I dive into Magento Core code to understand how it works, then I try

{{var order.getCreatedAtFormated('short')}} {{var order.getCreatedAtStoreDate().getTimezone()}} but it doesn't work.

I know that if it works, getTimezone() may result Asisa/Saigon instead of GMT+7 as expected.

So, how to get order datetime including timezone?


texts: how to solve 401 redirect on REST API on Custom tab between shipping and Payment option

texts:
I have created some steps between shipping and Payment form and add some field between then and applied ajax on that but i have facing an issue for not logged in user it will gave an error of 401 and redirect on login page on saving first field.
Will anyone help me how to successfully placed order without login.
i'm using Rest Api to save data in magento 2
<route url="/V1/carts/mine/set-save-data" method="PUT">
    <service class="Vendor\Module\Api\SaveNoteManagementInterface" method="saveSimpleNote"/>
    <resources>
        <resource ref="self" />
    </resources>
    <data>
        <parameter name="cartId" force="true">%cart_id%</parameter>
    </data>
</route>

This is my webapi.xml code it works properly for logged in user but for guest user it doesn't work and give 401 redirection.
If you want i will share my full code for saving the data.


texts: Please specify a valid grid column alias name that exists in grid table

texts:
Simply trying to create a backend Order in a fresh Magento CE 1.9.2.2 site. All I have done is install a PO Management Module, and imported some products.

Pretty much stumped as Googling the exact error returns few results.


texts: Magento 2 : cannot save customer phone number

texts:
Using Magento 2.2, Backend, Customers. I cannot update or save suctomer telephone number, but after Save no message Error.

  Customer -> All Customer -> Customers

NOTE: This is original code, not yet custom.

EDIT:
I see phone number in customer information edit form, But still not show in table.

  Customer -> All Customer -> Customers
  Customer Table -> Edit -> Address


texts: set default value for magento2 admin form text field?

texts:
I want to set default Value Set For Magento 2 Admin Form Text Field Default Value Set.So Plz If Any Idea Help.Thanks In Advance.
$fieldset->addField(
                'name',
                'text',
                ['name' => 'name',
                'label' => __('Name'),
                'title' => __('Name'),
                'required' => true,
                ]
            );


texts: Magento 2 : Restrict payment method by country not working

texts:
I am facing issue related payment method show for the specific country using Magento 2.2.6. Below are the steps followed by me

  Set "Payment from Applicable Countries" to Specific Countries and a select couple of countries.
  On Frontend - open checkout and select any allowed country and click NEXT. It will show desired payment methods in the next step.
  Go back to Step #1 and select any other country which doesn't allow Check and Money Order and click NEXT.
  It will still show Check and Money Order though it is set to NO for the selected country.

This issue is also available on git hub community but I didn't find any solution.
https://github.com/magento/magento2/issues/10234

Please help me to solve this default Magento 2 issue.


texts: How to Determine the Cron Job or Any identifier in the Running Model

texts: Let's say we have this, sales/observer::aggregateSalesReportBestsellersData run model in the cron, how can we determine the job_code (in this case, aggregate_sales_report_bestsellers_data) when the function run?


texts: Module Disable/Uninstall Issue - Magento 2.4.0

texts:
I installed a module, But that was conflicting with the account dashboard, So I uninstalled that module and remove that extension folder from Code. But now my account dashboard is still not working, First, it's working fine but after installation, that module now the issue is coming if I'll use that one then facing minor confliction error and if I uninstall that module then Magento login and register not working properly.
Please check below error is showing in system.log
main.CRITICAL: Exception message: Class Sparsh\MobileNumberLogin\Model\Attribute\Backend\MobileNumber does not exist

Kindly help me how to I can resolve this issue?
Thanks


texts: Magento 2 : base 64 is not defined error in image upload in admin grid

texts:
I want to upload an image from admin grid after selecting the image rounds goes loading and console base64 is not defined is coming.

screenshot


texts: Create ORDER through REST Api return error 500 (post SUPEE-6788)

texts:
I'm working with Magento CE 1.7.0.2.
I've deployed SUPEE-6788 security patch and related 3rd party extension compliant patches on my test and preproduction environment.

I went successfully across an exhaustive process checklist until my last test: order creation with REST Api.

The product read operations are working fine with GET method on both test and preprod environments.

But the problem happens when I try to create an ORDER with POST method.
The order is not created and empty response returned by the webservice.
I receive the following status Code in my Firefox REST client: 500 Internal Server Error
Note: Same operation is working fine on my test environment.

No script error is returned, even with activating developer mode and error_reporting.

I decided to start a "hard debug session" with adding some logs on different steps (only on my preprod environment scripts).

At the end, my debug session brought me to the _runCallbacks method from Mage_Core_Model_Resource_Transaction class.
The call_user_func() from line 106 is just blocked without throwing any Exception or error.

Any help/suggestion would be appreciate.


texts: Field Labels missing from my magento 2.3 site

texts:
Suddenly the labels for all of the fields of my magento 2.3 site is blank.
https://prnt.sc/p00avw

How to solve this?
Please help


texts: Unknown column 'main_table.custom_design_apply' in field list

texts:
I recently started monitoring the logs on my magento installation (version 1.9.1). I noticed an error recurring and strangely it originates from a core Mage class - specifically Mage_Catalog_Model_Resource_Category_Flat class on line 1391.

The code builds a Select object where it adds a field main_table.custom_design_apply from a table which resolves to catalog_category_flat_store_1. Now here is the problem, I tried inspecting that table and discovered that field really does not exist. The code below shows more for the construct.

$select = $this->_getReadAdapter()->select()
        ->from(
            array('main_table' => $this->getMainStoreTable($category->getStoreId())),
            array(
                'main_table.entity_id',
                'main_table.custom_design',
                'main_table.custom_design_apply', //<-- the strange field
                'main_table.custom_design_from',
                'main_table.custom_design_to',
            )
        )
        ->where('main_table.entity_id IN (?)', $pathIds)
        ->where('main_table.is_active = ?', '1')
        ->order('main_table.path ' . Varien_Db_Select::SQL_DESC);
    $result = $this->_getReadAdapter()->fetchAll($select);//here is line 1391

I am stuck between overriding the class and removing the field or add the column manually in the table. Nonetheless, why would this be. Is it a bug on Mage's side or I am not getting the whole picture.


texts: "Redis 'server' not specified." in Cm_Cache_Backend_Redis code

texts:
I have followed all the tutorials on github, did everything exactly as explained:
1. installed Redis
2. modmanned Cm_Cache_Backend_Redis
3. Tried with and without template.php in app\code\local\Mage\Core\Block
4. Obviously edited our local.xml and it has server specs:

    <host>127.0.0.1</host> <!-- or absolute path to unix socket -->
    <port>6379</port>

One thing remains no matter what we tried, we did verify with our host. Google gives only 4 unrelated results, so please... ;-)

We keep getting an error report containing this:
a:4:{i:0;s:29:"Redis 'server' not specified.";i:1;s:1585:"#0 /magento/domains/domain.com/public_html/.modman/Cm_Cache_Backend_Redis/Cm/Cache/Backend/Redis.php(122): Zend_Cache::throwException('Redis 'server' ...')

I'm lost. Who has an idea what to try next?

Edit:
Magento version 1.9.2
Did a PING on the server to redit and that came back with PONG as well.


texts: Magento 2: Does, and Should, the `crontab` Area Have its own di.xml

texts:
Does Magento 2's crontab area load a scoped di.xml file?  Or is this no longer used?  Or should it be used, but its not being loaded as part of the crontab application is a bug?  Or do I fundamentally misunderstand something?

In Magento 2, the "areas" feature allows you to load extra configuration information based on the request context (that's a little hand wavy, but accurate from a certain point of view).

For example, Magento will always load the following di.xml

./vendor/magento/module-tax/etc/di.xml

but will only load the following di.xml when in the frontend area

./vendor/magento/module-tax/etc/frontend/di.xml

It's not clear if this is true for the di.xml files for the crontab area.

The cron runner in Magento is a separate Magento System Application from the Magento System Application that handles HTTP requests.  When the cron application launches, its Magento System Application has a very minimal launch

#File: vendor/magento/framework/App/Cron.php
public function launch()
{
    $this->_state->setAreaCode('crontab');
    $this->_eventManager->dispatch('default');
    $this->_response->setCode(0);
    return $this->_response;
}

You can see the call to setAreaCode where the crontab area code is set. This ensures that requests for configuration trees will merge in any configuration located in a module's etc/crontab folder

app/etc/crontab/*.xml

However -- di.xml is different/special.  Because Magento needs access to the object manager earlier than the launch of the Magento system application, the object manager initially loads all the etc/di.xml files before the call to setAreaCode.

During an HTTP request, the Magento System Application (Magento\Framework\App\Http) loads the area specific di.xml files after setting the area code

#File: vendor/magento/framework/App/Http.php
public function launch()
{
    $areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
    $this->_state->setAreaCode($areaCode);
    $this->_objectManager->configure($this->_configLoader->load($areaCode));
    //...
}

Since this call to configure is missing from the cron Application's launch method, it seems like the crontab doesn't load any etc/crontab/di.xml files.  However, there are a few etc/crontab/di.xml files present.

$ find . -wholename '*crontab/di.xml'
./vendor/magento/module-captcha/etc/crontab/di.xml
./vendor/magento/module-catalog-rule-configurable/etc/crontab/di.xml

This creates some confusion about what the correct behavior of the system should be.  Has anyone here been following Magento 2 development closely enough to know what the correct system behavior is?


texts: Magento 2.2.4 : Unable to select all products in backend. Only visable

texts:
In the product grid, I want to disable 2000 products.

I'm only able to do so 200 at a time or whatever is visible."20,30.50,200".

I'm "selecting All" and not just selecting "select visible".

Does anyone know of a fix for this?


texts: How to overwrite lib template file - Magento 2

texts:
How can the HTML files from the library be overwritten?

I need to overwrite this template:

lib/web/mage/gallery/gallery.html

I have tried placing the file in my own theme in the below locations, I've cleared my cache between each file move.

app/design/frontend/**VENDOR**/**THEME**/web/mage/gallery/gallery.html
app/design/frontend/**VENDOR**/**THEME**/web/gallery/gallery.html
app/design/frontend/**VENDOR**/**THEME**/web/lib/mage/gallery/gallery.html
app/design/frontend/**VENDOR**/**THEME**/web/lib/gallery/gallery.html
app/design/frontend/**VENDOR**/**THEME**/mage/gallery/gallery.html
app/design/frontend/**VENDOR**/**THEME**/web/template/gallery/gallery.html

I've read through the dev docs and can't see anything mentioned in there either.


texts: Where is URL Key information stored in database?

texts:
I'm using a mass import extension to import product URL Keys for a Magento 2.3.0 site which recently went live. The URL key information in the backend product detail is correctly updated but Magento continues to use a different URL key (this may have been the original key when the product was created or it may be magento default - I'm not certain). This is causing indexing problems, our generated sitemap shows the correct URL, i.e. it uses the backend URL key, but that URL is ignored by Magento, is unavailable and hence we're getting soft 404 errors from search engines.
I can force the URL key to correctly update by adding the product to our 'main website' again in the backend either from product detail or by using a mass action. This isn't a practical solution when we have over 50K products in our catalogue. It takes about 4 minutes to update 200 products this way and there are often errors (URL key already exists).
My question is where in the DB is the URL key actually stored? Is it possible to force the database to 'see' the updated URL key using SQL?
TIA


texts: Magento2: new products added are not displayed on the frontend

texts:
Since yesterday, new products added are not displayed on the frontend.

I try rebuild website (regenerate cache etc) and reset indexes and reindex products.

Still no result. Aby solution?


texts: Move my-account to out of dropdown in top-link

texts:
I want to remove My Account out of dropdown in header, and remove this dropdown with customer name, how can i do this? i have this follow xml:

<referenceBlock name="top.links"  >

         <referenceBlock name="my-account-link"/>

            <referenceBlock name="register-link" remove="true" />
            <!-- <referenceBlock name="authorization-link" remove="true" />   -->
            <referenceBlock name="wish-list-link" remove="true" />
</referenceBlock>

In short: i want to remove this dropdown in customer name, and add my account side by contact for example.


texts:
can anyone tell me how I can find out if the registration of a new customer is done during the checkout or not. I need to know this information in the accountcontroller.

Edit:
My aim is to get rid of the message "If you are a registered VAT customer, please..." in success.phtml, but only if the customer was registered during the checkout.
Because I've disabled "account confirmation" and forwarding to "account overview" the customer can complete the purchase and after that this message appears - but doesn't make sense any more.

So in short I've got two use cases:

1.) normal registration -> message added to queue (in AccountController->_welcomeCustomer) -> message displayed after finishing registration -> OK
2.) checkout -> registration -> message added to queue (in AccountController->_welcomeCustomer) -> next steps in checkout-> purchase -> message displayed after purchase -> NOT OK

Thanks.


texts: Magento 2: Hide payment method if company name field got a value

texts:
Hi i'm trying to hide a payment method if the company field is filled. I did find a solution but it's for Magento 1 (see link below). Does anyone know how i would do this in Magento 2? I'm working in Magento 2.3.4 if that's relevant.

M1 solution: Hide payment method if company name field got a value

If i look on stackexchange there are some solutions for hiding a payment method (Magento 2: Hide payment methods depends on shipping method) but i'm not sure how to get the company name data in there?


texts: how to add another add to cart button in product page in magento2

texts:
I want to add customize add to add button near add to cart button and on that click, the product should add in the cart in magento2
I have followed this link:magento 2 Adding one more Add to cart button but no output is coming


texts:
I upgrade my Magento version from 2.2.2 to 2.3.2.

Now PayPal is not working.


texts:
having issues reimporting this table any ideas what im doing wrong

  Error SQL query:

  --

  -- Constraints for dumped tables

  --
  -- Constraints for table mg_catalog_product_entity_text
  -- ALTER TABLE  mg_catalog_product_entity_text ADD CONSTRAINT  FK_CATALOG_PRODUCT_ENTITY_TEXT_STORE_ID_CORE_STORE_STORE_ID FOREIGN
  KEY (  store_id ) REFERENCES  mg_core_store (  store_id ) ON
  DELETE CASCADE ON UPDATE CASCADE , ADD CONSTRAINT
  FK_CAT_PRD_ENTT_TEXT_ATTR_ID_EAV_ATTR_ATTR_ID FOREIGN KEY (
  attribute_id ) REFERENCES  mg_eav_attribute (  attribute_id ) ON
  DELETE CASCADE ON UPDATE CASCADE , ADD CONSTRAINT
  FK_CAT_PRD_ENTT_TEXT_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (
  entity_id ) REFERENCES   mg_catalog_product_entity (  entity_id
  ) ON DELETE CASCADE ON UPDATE CASCADE ;

MySQL said: Documentation

  1452 - Cannot add or update a child row: a foreign key constraint fails (freedomd_mage2.#sql-482_671e4, CONSTRAINT

  FK_CAT_PRD_ENTT_TEXT_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY
  (entity_id) REFERENCES mg_catalog_product_entity (entity_id) ON
  DELETE CASCA)


texts:
I have a CMS landing page and it will contain links to my store categories - I currently have the following setup:

Some text here...
Some text here...
Some text here...

I realise I can add a link in the usual way (e.g. mydomain.com/mycategory) but I want to add in such a way that should the category be updated in the future the link won't break.

Is this done via the "store url" method? I've seen that there's a widget that can do this but I need to keep the tags and classes shown above. So, I'm looking for a solution that will simply replace the "#".


texts: Getting Bool(False) on custom module when calling my model

texts:
I am not able to call my model each time it gives bool(False).
table is creating in database from below code. to check my model i stored some data manually in table.

I already tried
Mage::getModel('weebsly_dbscript/formdata');
and
Mage::getModel('dbscript/formdata');
setup.php file is also there


texts: Get admin quote details using adminhtml_sales_order_create_process_data

texts: I want to set shipping price for orders created in admin based on products in cart, how to get the quote items using adminhtml_sales_order_create_process_data?


texts: Amazon Prime like checkout process (ship prime sku fast, ship non prime sku slower)

texts:
Is there a amazon prime like magento addon available?
We sell spare parts. A product attribute stores if the sku is prime yes or no.
In the checkout process magento should group prime sku and non prime sku and user selects shipping method for each group (express for prime, standard for non prime or standard for all). This should improve our lead time from order to delivery as the warehouse people can priorize prime sku in one order.


texts: Magento 2 custom module override knockout template

texts:
How can we override a knockout template in a custom module?
I know how we can do this in our own theme but I need this in a module.

For example I like to override this file:
vendor/magento/module-checkout/view/frontend/web/template/shipping-address/form.html

Is this possible?


texts: Add custom sort to sort products using name and price both

texts: How can i add a custom sort to sort products in a category using the name and price both?


texts: Condition for fetching products having images first ? Magento 2

texts:
This is my function which is returning all products list on my homepage. I want to define a condition to fetch only products with images comes first then products with no images comes last.

I am using Magento 2.2.0

 protected function _getAllProductProductCollection()
    {
        $collection = $this->productCollectionFactory->create();
        $collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());

        $collection = $this->_addProductAttributesAndPrices($collection)
            ->addStoreFilter()
            ->setPageSize($this->getPageSize())
            ->setCurPage($this->getRequest()->getParam(self::PAGE_VAR_NAME, 1));

        $conditions = $this->getConditions();
        $conditions->collectValidatedAttributes($collection);
        $this->sqlBuilder->attachConditionToCollection($collection, $conditions);

        return $collection;
    }


texts: Magento2 - How can I make a widget or user prompt on the home page?

texts:
I want to make a widget/user prompt, so when a user goes to my website I would like to get their input, my website should prompt for their ship-to location.
I am new to Magento, how can I achieve this, make something like a pop-up window?
And how can I take the user input and do some stuffs with it?


texts: Override a method in Magento\UrlRewrite\Controller\Router class

texts:
I want to make some changes in the getNormalizedPathInfo method of Magento\UrlRewrite\Controller\Router class.
For this, I have created a module and tried to rewrite like below:

Step #1: app/code/Stack/FixPagination/etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\UrlRewrite\Controller\Router" type="Stream\FixPagination\Controller\Router" />
</config>

Step #2: app/code/Stack/FixPagination/Controller/Router.php

<?php
namespace Stack\FixPagination\Controller;

use Magento\Framework\App\RequestInterface;

class Router extends \Magento\UrlRewrite\Controller\Router {

    private function getNormalizedPathInfo(RequestInterface $request): string
    {
        $path = (string)$request->getPathInfo();
        if (!empty($path) && $request->getQuery()->count()) {
            $path = ltrim($path, '/'); // changed rtrim to ltrim
        }

        return $path;
    }
}

But my changes are not reflecting. What am I doing wrong?


texts: What API does the Magento Mobile Store native app use?

texts:
I'm curious to know if the Magento Native App uses the REST API, Soap v1 or Soap v2?

How is it able to access data with regards to features like configurable products while I can't do the same using the Soap v2. For example, I can't get the configurable attributes for a configurable product, while the mobile app can do that.


texts: Does Braintree work with magento2 for automated recurring billing? Or is authorize.net our only solution?


texts:
I added this code to my InstallData script:

     $eavSetup->removeAttribute('customer_address', 'erp_address_system_id');
     $eavSetup->addAttribute(
         'customer_address', 'additional_address_field', [
             'type' => 'text',
             'label' => 'Addtional address field',
             'input' => 'text',
             'required' => false,
             'visible' => true,
             'filterable_in_search' => true,
             'is_visible_on_front' => 0,
             'filterable' => true,
             'system' => 0,
             'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
             'position' => 500,
             'sort_order' => 500
         ]
     );

     $customAttribute = $this->attributeRepository->get('customer_address', 'additional_address_field');
     $setup->getConnection()
         ->insertOnDuplicate(
             $setup->getTable('customer_form_attribute'),
             [
                 ['form_code' => 'adminhtml_customer_address', 'attribute_id' => $customAttribute ->getId()],
             ]
         );
     $customAttribute ->save();

When I try to import customer and address data in one file (entity: customer_composite) and I add the attribute as column 'additional_address_field' the value is still empty in the backend. When I manually enter a value in the backend the value is stored.

Why's that? How can I import a custom address attribute?


texts: Adding code for create attributes in category general information Tab in adminsidde error

texts:
app\design\adminhtml\default\default\template\page\header.phml adding code for create attributes in category general tab i adding this code

    require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute  = array(
    'type' => 'int',
    'label'=> 'Your attribute label',
    'input' => 'boolean',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => true,
    'default' => "",
    'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'your_attribute_code', $attribute);
$installer->endSetup();

then i display error in magento category tab

Fatal error: Class 'Varien_Data_Form_Element_Boolean' not found in \magento\lib\Varien\Data\Form\Abstract.php on line 146

after remove this code after display this error what can do to solve this error


texts: Magento2 : Custom Category Attribute value Not Saving?

texts:
I've create a module to add a custom attribute to my categories, however my code doesn't seem to be creating the attribute in my eav_attribute table, the field shows on my category pages but  it doesn't save the values?

Can anyone advise why this isn't working.

  /app/code/Auto/CategoryAttributes/Setup/InstallData.php

<?php
namespace Autosmart\CategoryAttributes\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Catalog\Model\Category;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;

/**
 * @codeCoverageIgnore
 */
class InstallData implements InstallDataInterface
{
    /**
     * @var EavSetupFactory
     */
private $eavSetupFactory;

/**
 *
 * @param EavSetupFactory $eavSetupFactory
 */
public function __construct(EavSetupFactory $eavSetupFactory)
{
    $this->eavSetupFactory = $eavSetupFactory;
}

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
    $eavSetup->addAttribute(
        Category::ENTITY,
        'category_short_description',
        [
            'type' => 'text',
            'label' => 'Category Short Description',
            'input' => 'textarea',
            'visible_on_front' => true,
            'required' => false,
            'sort_order' => 1,
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General Information',
        ]
    );
}
}

  /app/code/view/adminhtml/ui_component/category_form.xml

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="autosmart_additonal_content">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Autosmart Additonal Content</item>
            <item name="collapsible" xsi:type="boolean">true</item>
            <item name="sortOrder" xsi:type="number">100</item>
        </item>
    </argument>
    <field name="category_short_description">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="sortOrder" xsi:type="number">1</item>
                <item name="dataType" xsi:type="string">string</item>
                <item name="formElement" xsi:type="string">textarea</item>
                <item name="label" xsi:type="string" translate="true">Category Short Description</item>
                <item name="required" xsi:type="boolean">false</item>
            </item>
        </argument>
    </field>

</fieldset>


texts:
First of all, sorry if the answer is obvious. I read the Devdocs, PWA-Studio Docs and some Tutorials, but somehow couldn't wrap my head around this.
Does using a PWA with Magento2, for example Magento's PWA-Studio, require me to add a GraphQL API to every module I use for this shop? Or can Magento somehow "skip" PWA-rendering when no GraphQL is in place?
For example, I mean modules we created ourselves, modules we bought from 3rd parties, as well as payment methods (where the PWA docs state that it's currently only compatible with Braintree, which is not much imho).
Also, I'd be glad to get any tutorials on how to make a custom module PWA-compatible.


texts: How to show add to cart in luma mobile theme?

texts:
In Luma theme (mobile version), how can I show the "add to cart" button under the products ?

In desktop + tablet it's shown.

Edit :

version I'm working is from  Magento 2.2.7, if it matters.

Thanks.


texts: How to get customer increment_id as extension_attribute in REST order search?

texts:
I'm trying to get the customer increment_id to be included as customer_increment_id as an extension_attribute in orders when I search orders through rest/V1/ordes?searchCriteria...

I added following to my modules etc/extension_attributes.xml but it doesn't seem to work.

<extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
    <attribute code="customer_increment_id" type="string">
        <join reference_table="customer_entity" reference_field="entity_id" join_on_field="customer_id">
            <field>increment_id</field>
        </join>
    </attribute>
</extension_attributes>

I have checked my permissions cleared var/generations/* var/cache/* runed magento setup:upgrade in all possible ways!

So what am I missing?

I have this extension in the same file and that one works fine searching customer via rest/V1/customer/search.

<extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
    <attribute code="increment_id" type="string">
        <join reference_table="customer_entity" reference_field="entity_id" join_on_field="entity_id">
            <field>increment_id</field>
        </join>
    </attribute>
</extension_attributes>

/Thomas


texts: 401 Authorization Required Magento 2 REST API

texts:
I'm trying to get the list of all magento2 products but I'm getting 401 authorization error. I tried the below methods and in all methods I'm getting the mentioned error!

First Method:

$userData = array("username" => "user123", "password" => "pass123");
        $ch = curl_init("http://shop.mysite.com/rest/V1/integration/admin/token");
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));

        $token = curl_exec($ch);

        $ch = curl_init("http://shop.mysite.com/rest/V1/products");
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));

        $result = curl_exec($ch);

        $mgtProducts = json_decode($result, 1);

Second Try:

        $consumerKey = 'key';
        $consumerSecret = 'key';
        $accessToken = 'key';
        $accessTokenSecret = 'key';

        $method = 'GET';
        $url = 'http://shop.mysite.com/rest/V1/products';

        $data = array(
            'oauth_consumer_key' => $consumerKey,
            'oauth_nonce' => md5(uniqid(rand(), true)),
            'oauth_signature_method' => 'HMAC-SHA1',
            'oauth_timestamp' => time(),
            'oauth_token' => $accessToken,
            'oauth_version' => '1.0'
        );

        $data['oauth_signature'] = $this->sign($method, $url, $data, $consumerSecret, $accessTokenSecret);

        $curl = curl_init();

        curl_setopt_array($curl, array(
            CURLOPT_SSL_VERIFYPEER => 0,
            CURLOPT_SSL_VERIFYHOST => 0,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_URL => $url,
            CURLOPT_HTTPHEADER => array(
                'Authorization: OAuth ' . http_build_query($data, '', ',')
            )
        ));

        $result = curl_exec($curl);
        curl_close($curl);


texts:
Is their any way we can get total amount that has been spend by customer in magento
2 ?


texts: Magento 2 : How to merge JS for frontend?

texts:
I want to merge all js request and for this I am using Merge JavaScript setting of Magento and set it to yes.

But still lots off js request in browser which are not merged.

How do I merge all these request ?


texts:
We have an issue, not anything major, more like an annoying issue, and we do not understand why.
One of our stores has low stock, so if we have 1 left and someone buys it, in Magento admin, it shows up as "out of stock" but says that we have 1 left, which causes issues when we do products count, etc.
If we have 2 left in stock and someone buys, then there is no issue. It lowers the stock to 1. It is only when the stock goes from 1 to 0 that it won't update.
Does anyone have the same "issue"? It isn't very pleasant when we do stock counting when we think we have something in stock.

Any help is appreciated
List of disabled modules:
Magento_Inventory
Magento_InventoryAdminUi
Magento_InventoryAdvancedCheckout
Magento_InventoryApi
Magento_InventoryBundleProduct
Magento_InventoryBundleProductAdminUi
Magento_InventoryCatalog
Magento_InventorySales
Magento_InventoryCatalogAdminUi
Magento_InventoryCatalogApi
Magento_InventoryCatalogSearch
Magento_InventoryConfigurableProduct
Magento_InventoryConfigurableProductAdminUi
Magento_InventoryConfigurableProductIndexer
Magento_InventoryConfiguration
Magento_InventoryConfigurationApi
Magento_InventoryDistanceBasedSourceSelection
Magento_InventoryDistanceBasedSourceSelectionAdminUi
Magento_InventoryDistanceBasedSourceSelectionApi
Magento_InventoryElasticsearch
Magento_InventoryExportStockApi
Magento_InventoryIndexer
Magento_InventorySalesApi
Magento_InventoryGroupedProduct
Magento_InventoryGroupedProductAdminUi
Magento_InventoryGroupedProductIndexer
Magento_InventoryImportExport
Magento_InventoryCache
Magento_InventoryLowQuantityNotification
Magento_InventoryLowQuantityNotificationAdminUi
Magento_InventoryLowQuantityNotificationApi
Magento_InventoryMultiDimensionalIndexerApi
Magento_InventoryProductAlert
Magento_InventoryRequisitionList
Magento_InventoryReservations
Magento_InventoryReservationCli
Magento_InventoryReservationsApi
Magento_InventoryExportStock
Magento_InventorySalesAdminUi
Magento_InventorySalesFrontendUi
Magento_InventorySetupFixtureGenerator
Magento_InventoryShipping
Magento_InventorySourceDeductionApi
Magento_InventorySourceSelection
Magento_InventorySourceSelectionApi
Magento_InventoryShippingAdminUi
Magento_InventoryGraphQl
Amasty_Feed
KraftMedia_CustomStoreSwitcher
Litespeed_Litemage
Mageplaza_LayeredNavigation
Wyomind_ElasticsearchCore
Wyomind_ElasticsearchAutocomplete


texts: Why is setPageSize() and setCurPage( ) functions not working with the collection created with \Magento\Framework\Data\CollectionFactory?

texts:
This is my block file, everything is working fine except setPageSize() and setCurPage() functions at last. Regardless of these two filters it is allowing all the rows to be fetched. What could be the reason?

public function __construct(
    //.....
    \Magento\Framework\Data\CollectionFactory $collectionFactory
) {
    //.....
    $this->collectionFactory = $collectionFactory;

}

public function getListProduct()
{
    $collection = $this->collectionFactory->create();

    $fromDate = date('Y-m-d H:i:s', strtotime("-6 month"));
    $product = $this->customCategoryFactory->create()
        ->addFieldToFilter('user_id', ['eq' => $loggedInUser])
        ->addFieldToFilter('logged_at', ['from' => $fromDate])
        ->addFieldToSelect('cat_id')
        ->distinct(true);

    $product1 = $this->anotherCustomCategoryFactory->create()
        ->addFieldToFilter('user_id', ['eq' => $loggedInUser])
        ->addFieldToFilter('logged_at', ['from' => $fromDate])
        ->addFieldToSelect('cat_id')
        ->distinct(true);
    //I'm getting the correct collection of products.

    foreach ($product as $key => $value) {
        $varienObject = new \Magento\Framework\DataObject();
        $varienObject->setData($value->getData());
        $collection->addItem($varienObject);
    }
    foreach ($product1 as $key => $value) {
        $varienObject = new \Magento\Framework\DataObject();
        $varienObject->setData($value->getData());
        $collection->addItem($varienObject);
    }
    //now I need to use this collection for pagination.

    $page = ($this->getRequest()->getParam('p')) ? $this->getRequest()->getParam('p') : 1;
    $pageSize = ($this->getRequest()->getParam('limit')) ? $this->getRequest()->getParam('limit') : 1;

    $collection->setPageSize($pageSize);
    $collection->setCurPage($page);
}


texts:
How can we create form in admin backend that takes product_id and attributes like color=='red' or price>100 and category selection to which that related product should be added and displayed in frontend.
Thanks in advance. :-)


texts: Magento Model call Resource model function

texts:
As far as I know, in Resource we put connection with the database, and functions like get one data and this low level stuff.

And in the Model you have more complex functions to get and set data, working with them.

All of this in is a big view. The real problem is:

If I have a function called getCustom in the resource, how can i call this function from the model?. I think that I only need $this->getCustom(). Both are in the same extension but it doesn't works... why?

My code:

config.xml
<custom>
    <class>Example_Name_Model</class>
    <resourceModel>custom_resource</resourceModel>
</custom>
<custom_resource>
    <class>Example_Name_Model_Resource</class>
    <entities>
        <custom>

example_custom

        </custom>
    </entities>
</custom_resource>

model
class Example_Name_Model_Custom extends Mage_Core_Model_Abstract
{
    [...]
    public function firstFunction() {
        $this->getCustom();
    }
    [...]

Resource
class Example_Name_Model_Resource_Custom extends Mage_Core_Model_Resource_Db_Abstract
{
    [...]
    public function getCustom()
    {
        return 'Eureka';
    [...]

Regards

UPDATE
Maybe the problem is in the construct

Model
protected function _construct() {
    $this->_init('custom/custom');
}

ResourceModel
protected function _construct()
{
    parent::_construct();
    $this->_init('custom_resource/custom', 'customer_id');
    // I tried $this->_init('custom/custom', 'customer_id'); too
}


texts: Magento 2 Connection to External Database

texts:
Can anyone provide a tutorial, or link to a tutorial for adding a connection to an external database in Magento 2?
Slowly getting my head around the new structure and procedures in M2, but this one is eluding me.


texts: Websites with different tax classes for one country

texts:
What is the best way to have different taxes in different websites for one country?

Scenario:

Website 1:

Tax Rate for Germany -> 19%
Tax Rate for Austria -> 20%

Website 2:

Tax Rate for Germany -> 19%
Tax Rate for Austria -> 19%

The only way I see is to create a new product tax class for website 2. I would then add a tax rule with a tax rate of 19% for Austria and set the new product tax class to all products of website 2.

Is this the correct way or are there any other possibilites?


texts: magento Adminhtml Users Grid by Role Id add column

texts:
I can filter the adminhtml users grid to only show users with a specific role ID as code in

\app\code\local\Mage\Adminhtml\Block\Permissions\User\grid.php

=> for collection

 protected function _prepareCollection()
{

    $collection = Mage::getResourceModel('admin/user_collection');
    $collection->getSelect()->join(array('ar' =>'admin_role'),'ar.user_id = admin_user.user_id')
    ->reset('columns')->columns(array('role_id'));
    $this->setCollection($collection);
    return parent::_prepareCollection();

}

=>and for add column

 protected function _prepareColumns()
{
  parent::_prepareColumns();
    $this->addColumn('role_id', array(
        'header'    =>Mage::helper('adminhtml')->__('Role ID'),
        'index'     =>'role_id',
        'align'     => 'right',
        'width'    => '50px'
    ));

But still not getting roll id in column ..


texts: Need to customize a function in Model/Sitemap in Magento-2

texts:
I need to customize the function _getStoreBaseUrl() from the core file magento\module-sitemap\Model\Sitemap.php.

I have tried to override the Model file using preference method and also tried to implement Plugin, but it's throwing error when I write a constructor method in it.

Fatal error: Uncaught Error: Call to a member function isExist() on null in \vendor\magento\module-sitemap\Model\Sitemap.php:351 Stack trace: #0 \vendor\magento\framework\Model\ResourceModel\Db\AbstractDb.php(406): Magento\Sitemap\Model\Sitemap->beforeSave() #1 \vendor\magento\framework\Model\AbstractModel.php(647): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Vendor\Sitemap\Model\Sitemap)) #2   \vendor\magento\module-sitemap\Controller\Adminhtml\Sitemap\Save.php(84): Magento\Framework\Model\AbstractModel->save() #3   \vendor\magento\module-sitemap\Controller\Adminhtml\Sitemap\Save.php(150): Magento\Sitemap\Controller\Adminhtml\Sitemap\Save->saveData(Array) #4   \generated\code\Magento\Sitemap\Controller\Adminhtml\Sitemap\Save\Interceptor.php(24): Magento\Sitemap\Controller\Adminhtml\Sitemap\Save->execute() #5   \vendor\magento\framework\App\Action\Action.php(107): Magent in   \vendor\magento\module-sitemap\Model\Sitemap.php on line 351

I need to use the dependency injection way in this overrided file to get some custom values from the ScopeConfig.

My Model file is,

My di.xml is,

Can anyone tell me how to fix this ?


texts: Magento 2.X : How can I add a new tab in the admin panel?

texts: How can I add a new tab (Custom Menu section) in the left side bar of admin panel ?


texts: Shared PHP functions across multiple PHTML files

texts:
I'm working on cleaning up some codes where the previous person wrote a whole bunch of PHP code in PHTML files. So, for example, I made the PHP code put in list.phtml as part of the overriden List.php.

Now, I'm looking at view.phtml for the product-view page, and it calls a lot of child HTMLs. In particular, I'm looking at media.phtml and configurable.phtml, where there is very similar set of PHP codes. How can I integrate these PHP codes into one place (similar to what I did with List.php), so that each of these PHTML can call the same function (for example, getProductUrls())?

Additionally, is it possible to have variables available in media.phtml also available in configurable.phtml without having to call getProductUrls() twice (once in media and once in configurable)?


texts: Magento 2 Checkout session lost custom data

texts:
I have created Custom checkout session in controller :

public function execute()
{
     $productData = $this->getRequest()->getPostValue();

     $this->_checkoutSession->setData("product", $productData);
     ...
     ...
}

And access that session in block but which close tab and open it again the lost its data.
Even in few time session lost data.

Any suggestion ?


texts:
When I run the first time:

magento setup:perf:generate-fixtures /var/www/setup/performance-toolkit/profiles/ce/small.xml

I got this error:

Generating simple products... Error in data structure: entity values are mixed

Now I run it again and get this error:

Generating categories... URL key for specified store already exists.

Is there something that I should delete before running it again? I can't see anything here http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-perf-data.html


texts:
It is very often that we take a site from another firm and now we are stuck with a conglomeration of code and potentially dozens of people who have worked on a site. I am looking for a punch list of items to ask of a security person to ensure the Magento site is hardened. This would be required if someone were to take full responsibility for all the code and the client did not want to rebuild from scratch.

My question: Is there a top 10 or top 20 list of items to ask and to document?


texts: Custom Add to Cart on Bundle product page: Magento2

texts:
I want to customize my bundle product page on magento2 store and want different "add to cart" buttons for all the simple products of that bundle product i.e. if there are 3 products available in a bundle product then there should be 3 "add to cart" buttons each with there respective qty field.
Currently I have overided my bundle page "catalog_product_view_type_bundle.xml" with following code

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

    <referenceContainer name="product.info.main">
        <block class="Magento\Catalog\Block\Product\View" name="customize.button" as="customize_button"
               template="PHPCuong_Cart::catalog/product/view/customize.phtml" after="product.info.price" />
    </referenceContainer>

And in the customize.phtml I have used following code

    <?php
$_product = $block->getProduct();
$__product = $block->getProduct();

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $listBlock = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');
    $selectionCollection = $_product->getTypeInstance(true)
        ->getSelectionsCollection(
            $_product->getTypeInstance(true)->getOptionsIds($_product),
            $_product
        );
    foreach ($selectionCollection as $product) {
      $addToCartUrl =  $listBlock->getAddToCartUrl($product); ?>

      <?= $block->getChildHtml('', true) ?>

      <form data-role="tocart-form" action="<?php echo $addToCartUrl; ?>" method="post">

        <?php
            echo $block->getBlockHtml('formkey');
            echo $product->getData('name');

        ?>
          <input type="hidden" name="product" value="<?php echo $product->getData('entity_id'); ?>">
          <input type="hidden" name="related_product" id="related-products-field" value="">
          <?= /* @escapeNotVerified */ __('Qty') ?>

                <input type="number"
                       name="qty"
                       id="qty"
                       value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>"
                       title="<?= /* @escapeNotVerified */ __('Qty') ?>"
                       class="input-text qty"
                       data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
                       />

          <input type="hidden" name="selected_configurable_option" value="">
         <button type="submit" title="Add to Cart" id="product-addtocart-button" class="action tocart primary">

           Add to Cart
         </button>
          <?= $block->getChildHtml('', true) ?>
     </form>
<?php
    } ?>

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

<?php else : ?>

<?php endif; ?>

Now whenever I am adding any product in the cart then its adding but no data is showing in the mini cart. After checking the local storage in the browser I found that cart data is not creating properly.

Any help will be Appreciated.Thanks


texts: Email is not received after subscribe but I got a success message in the home page. How to fix it?


texts: Overide local.xml to Set Meta Robots for specific products

texts:
In my Magento CE-1.9.0.1 store I set the meta robots tag for all my products pages like so In my layout.xml file :

<PRODUCT_ATTRIBUTE_SET_custom>
<reference name="head">
    <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
</reference>

So for all products with the attribute set of custom I set the NOINDEX, NOFOLLOW tags to stop them being indexed/crawled.

However I now need to change this to INDEX, NOFOLLOW to some of these products on a product by product basis.

I have tried putting the below into Design > Custom Layout Update in the product page in admin:

<reference name="head">
    <action method="setRobots"><value>INDEX,NOFOLLOW</value></action>
</reference>

But the product is still keeping the value set in my local.xml. I have cleared the cache and reindexed to be sure.

Is this because layout.xml is loaded last so whatever I put in the custom layout update section in admin is pointless?

How can i override local.xml?


texts:
How we can Create layered navigation filter for rating .
please see attachment.


texts: M2: Sending data by clicking Next on checkout

texts: I had some customization on Shipping page of checkout on Magento2, now I want to send out some data back to my module by the user hitting "Next" button and add to the current cart, so in which way should I do this?


texts: Add CC or BCC to Magento Community Contact form

texts:
Referring to this thread: https://stackoverflow.com/questions/30679036/how-to-add-bcc-or-cc-in-magento/51149678?noredirect=1#comment89282991_51149678

Kindly note I test it on my Magento Comunity Magento ver. 1.9.0.1 but didn't work and it's really important to me to have Copy and Blind Copy once the end user hit the submit button in my website contact form: https://www.khouryhome.com/contacts


texts: Magento 1.9 - The export error after customizing grid on shipment page

texts:
I got a issue about export our shipment information.
Before i start with this issue, i add the "shipping method"column, is called customizing column, on shipment grid!

Like this,

  app/code/core/Mage/Adminhtml/Block/Sales/Shipment/Grid.php

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    /*$collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('shipping_method'));*/
     $collection->getSelect()->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('shipping_method'));

    $this->setCollection($collection);
    return parent::_prepareCollection();
}

protected function _prepareColumns()
{
parent::_prepareColumns();

$this->removeColumn('created_at');

$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
$shippingmethods = array();
foreach($methods as $_ccode => $_carrier) {
    if($_methods = $_carrier->getAllowedMethods())  {
        if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
            $_title = $_ccode;
        foreach($_methods as $_mcode => $_method)   {
            $_code = $_ccode . '_' . $_mcode;
            $shippingmethods[$_code]= $_title;
        }
    }
}

$this->addColumn('created_at', array(
    'header'    => Mage::helper('sales')->__('Date Shipped'),
    'index'     => 'created_at',
    'type'      => 'datetime',
    'filter_index' => 'main_table.created_at'
));

$this->addColumn('shipping_method', array(
    'header'=> Mage::helper('sales')->__('Shipping Method'),
    'width' => '80px',
    'type'  => 'options',
    'index' => 'shipping_method',
    'options' => $shippingmethods,
));

$this->addExportType('//exportCsv', Mage::helper('sales')->('CSV'));
$this->addExportType('//exportExcel', Mage::helper('sales')->('Excel XML'));

return $this;
}
I can see the column i created but after export
On the sales -> shipment on back-end page, i faced this issue!

And log said

ERR (3): Warning: SimpleXMLElement::__construct(): &lt;/html&gt; in /home/kbethos/public_html/wh-clone/app/code/core/Mage/AdminNotification/Model/Feed.php on line 173

I guess it is resulted from that i deal with nothing with database. So The back-end page didn't bring the shipping method value from the table.

Do i need to join the tables directly?

The table which has the shipment grid informaion is "sales_flat_shipment_grid"
And there is shipping description(shipping method) on "sales_flat_order"

Then, How can i export these grid info ? Thank you


texts: How to stop turpentine from caching my "header" block, and only use page cache?

texts:
In my header.phtml, I have a front page-specific HTML (H1 tag) under $this->getIsHomePage() condition. I need this H1 to appear only on front page.

The problem is: under Turpentine, this H1 tag appears on every page. I believe it's because Turpentine caches the block for the whole site.

By default, turpentine_esi.xml has the following configuration for header block:

    <!--
    A default Magento site includes a logged in user's name in the welcome
    message and the number of items in the shopping cart so it must be
    cached per-client.
    -->
    <reference name="header">
        <action method="setEsiOptions">
            <params>
                <access>private</access>
                <flush_events>
                    <wishlist_item_save_after/>
                    <wishlist_item_delete_after/>
                    <sales_quote_save_after/>
                </flush_events>
            </params>
        </action>
    </reference>

I don't have the login info in the header template, so I believe I can just drop the header block from the configuration (or rather override it in local.xml).

The solution I can think of is: don't cache header block in Turpentine at all, cache it in the full page HTML. So I removed this piece from turpentine_esi.xml.

Problem is: the H1 block is still rendered on all the pages.

I have restarted varnish, php5-fpm, physically deleted Magento's var/cache, flushed blocks, ESI blocks and page HTML cache in admin... and I still see the wrong version of header template, with H1 on every page.

Another way, I tried to change the header caching options to public - this didn't help either:

    <reference name="header">
        <action method="setEsiOptions">
            <params>
                <access>public</access>
            </params>
        </action>
    </reference>

I'm using Magento 1.9.0.1.


texts: My website is being forwarded to another url after 15 seconds

texts:
I'm not sure if I was hacked, but my website gets forwarded to a blogger website after 15 seconds.  Here is the URL
https://www.blogger.com/blogin.g?blogspotURL=http://get-yourfree-giftnow.blogspot.com/2016/05/get-your-free-gift-now.html
I certainly didn't insert that in the code and ipage my server host said they have nothing to do with it.  Please help.  Thank you in advance.
-John


texts:
I need to access customer information in JS, I have a analytics js file, I need to get some customer information like email, name etc. How do I access this in a JS file in magento.

If we are transfer the customer data from php to JS, where in the file structure will I put this code


texts:
I have 1 module with model, resource model and collection. Now I can get data with SQL query: SELECT main_table.* FROM table_abc AS main_table;
I want to customize this query by adding WHERE clause (for example: WHERE 3 = 3). How can I do that?
I tried to add $this->getSelect()->where('3 = ?', 3); into _initSelect method of collection but It didn't work (When I see SQL log I realize SQL not change)
Here is my full code (Collection class):
<?php

namespace ScPortal\SubscriptionItems\Model\ResourceModel\SubscriptionItems;
use Zend\Log\Writer\Stream;
use Zend\Log\Logger;

/**
 * Class Collection
 *
 * @package ScPortal\SubscriptionItems\Model\ResourceModel\SubscriptionItems
 */
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    /**
     * @var string
     */
    protected $_idFieldName = 'subscription_items_id';

    /**
     * Define resource model
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init(
            \ScPortal\SubscriptionItems\Model\SubscriptionItems::class,
            \ScPortal\SubscriptionItems\Model\ResourceModel\SubscriptionItems::class
        );
    }

    protected function _initSelect()
    {
        parent::_initSelect();
        $this->getSelect()->where('3 = ?', 3);
    }
}


texts: Indexer stuck at processing Design Config Grid, Customer Grid, and Catalog Search

texts:
My indexer always stuck at processing for Design Config Grid, Customer Grid, and Catalog Search

i already ran php bin/magento indexer:reset , but when the cron indexer run the result still the same, i tried to invalid all the indexer state in the database
update indexer_state set status = 'invalid'
but the result still the same.

When i checked the cron_schedule table in my database, the job code for indexer_reindex_all_invalid is always too late for the schedule:


texts: Automatically cancel orders after 30 minutes when payment is not completed

texts:
We have integrated the CCAvenue payment module. Some time customer not complete the payment. So the product stock decreased in the product table at submit the order. We need to cancel the order with stock added the relevant products for the order.

How to implement this?


texts: I'm trying to display second image of a product in a category page on hover. I managed to get images by $_product->getMediaGalleryImages() but I have problems with resizing them to category_page_grid or category_page_list size. My question is: how can I resize those images to default category page image size or maybe is there a way to get second image with the same method as default image by $productImage = $block->getImage($_product, $imageDisplayArea)?


texts: How to Upgrade Magento 2.1.5 to latest version using via composer

texts: I have installed my previous Magento 2.1.5 years ago by downloading , Now I want to  upgrade to 2.3.2 using the composer. Can I directly do that.  What issues may occur ?


texts:
This is probably something I should know, so excuse the question, but why does Magento use  inside buttons, and especially inside the checkout it binds the data (which I understand why but not why it is better - it is not like this could ever handle translations, the raw text is still in there).

For example, as is:

<button data-role="review-save" type="submit"
        data-bind="click: placeOrder($parents[1]), attr: {title: $t('Place Order')}"
        class="button action primary checkout"></button>

Can I change it to:

<button data-role="review-save" type="submit"
        data-bind="click: placeOrder($parents[1])"
        class="button action primary checkout">Place Order</button>

When I am working through customising the cart to suit us, is there a legitimate reason to avoid?

Now time to tell me why I am so wrong with this simplified version :)


texts:
I got an error on this block:

 Client ID not found for env: production paypal

On code:

        validate(client, props) {
        const env = props.env || config.env;

        if (!client[env]) {
            throw new Error(`Client ID not found for env: ${ env }`);
        }

        if (typeof client[env] === 'string') {
            if (client[env].match(/^(.)\1+$/)) {
                throw new Error(`Invalid client ID: ${ client[env] }`);
            }
        } else if (!ZalgoPromise.isPromise(client[env])) {
            throw new Error(`Expected client token to be either a string or a promise`);
        }
    },


texts: How to enable recently viewed products in product details page?

texts: In magento 1.9.2.4, in the product details page, I want to display 'Recently viewed products' in place of description. How to do that? How to call the product_viewed.phtml into the place where description section is residing now as below:


texts: How to retrieve the value of custom category attribute?

texts:
I had a module installed in Magento in my old shop store and now I migrate to the new one. What module did is it basically added some custom text fields to the categories that were then displayed on the category page. The following code in the sql folder of the module made corresponding entries in the database:

$installer = $this;
$installer->startSetup();

$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = 4; // 4 = General Information

$installer->addAttribute('catalog_category', 'textfield_name', array(
    'type' => 'varchar',
    'label' => 'Textfield Title',
    'input' => 'text',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => TRUE,
    'required' => FALSE,
    'user_defined' => FALSE,
    'visible_on_front' => TRUE,
    'is_html_allowed_on_front' => FALSE,
    'default' => ''
));

$installer->addAttributeToGroup(
    $entityTypeId,
    $attributeSetId,
    $attributeGroupId,
    'textfield_name',
    '30'
);

$installer->endSetup();

After module was installed I got this new field displayed on the category properties page in the new store backend. I stored some text in it and then tried to retrieve it as follows:

Mage::getSingleton('catalog/layer')->getCurrentCategory()->getTextfieldName();

but I didn't get anything. Also I made certain that Mage::getSingleton('catalog/layer')->getCurrentCategory() was indeed the right category.

There was though one significant detail that I have changed in the new store. In the layout that defines the block which runs the latter code I had to change the scope from catalog_category_layered to catalog_category_default in order for the block to be displayed. I suppose it is relevant, but I don't know what to do next.

Thank you in advance!


texts:
I am using Magento 2. I made a small mistake unfortunately i am unable to find

Index.php

public function getBannerCollection(){
        $collection = $this->_bannerModel->getCollection()
        ->addFieldToSelect('*');
        return $collection;
    }

phtml

<?php $bannerCollection =  $block->getBannerCollection();
print_r($bannerCollection);?>

error

localhost:8080 is currently unable to handle this request.
HTTP ERROR 500

I made a small change but i can't find out can any one help me on this

But i can able to loop it


texts: Programmatically update name of category in specific store

texts:
I have a magento 2 multi store setup (e.g. stores with the id 1 - 3) and I want to update the name of the category with the entity_id 3.

I've tried

$cat = $this->_categoryRepository->get(3, 3);
$cat->setName('Test in Store 3');
$this->_categoryRepository->save($cat);

with $this->_categoryRepository being an implementation of Magento\Catalog\Api\CategoryRepositoryInterface obtained via constructor based dependency injection.

But this just updates the value of the current store. I ran this code inside a cli command and it updated the name attribute of store 1 and not store 3.

The save method in Magento\Catalog\Model\CategoryRepository obtains the store via

$storeId = (int)$this->storeManager->getStore()->getId();

which always yields the current store.

What is the correct way to update a store specific attribute of a category? I know I could directly hack the database or use the resource model, but that would totally defeat the purpose of the repository pattern.


texts: Howto setup cronjob to automatically start a import profile?

texts: There should be a possibility to setup a cron, which does the dump click on "start profile" button. I want to automatically start an import profile which I have setup in Magento CE 1.8.1, which is getting it's csv from local destination.


texts: Magento 2 Admin Console - Performance Issues

texts:
For one of our big projects, our client is using the Magento backend Admin Console for their Project Managers to create orders/customers etc.
Our Customer has time and again reported that the performance of few screens like Order Listing, Create Order, Create/Edit Customer, Customer Listing screens etc. in Magento Admin Console is not up to the mark.
For Frontend, our team has already implemented Varnish. We have done JS/CSS minification etc.
But beyond a point there isn't any major change in the backend performance, also we didn't find any specific performance enhancement recommendations for Magento Admin backend screens.
Any suggestions in this regard would be really helpful.


texts: How to show a loader before the page fully loads?

texts:
I want to show the loader before my website fully load as the customer is trying to click the some of the links before the page gets loaded.
To show the order, where I have to update?
Any help will be appreciated!


texts: magento attribute display in product page

texts: i want to display a attribute just below to the price in product view page and should be dependable with price. that is I select one from attribute price should change.


texts: Magento 2: Paypal Payment Authorize Now and Capture later

texts:
I have requirement that need to "Authorize" PayPal payment for now.

Capture/Process after X days.

On Magento side it's storing info info

sales_order_payment
sales_payment_transaction

I think need to use API, may be one of the Method

https://github.com/paypal/PayPal-PHP-SDK/tree/master/sample/payments

magento\vendor\magento\module-paypal\Model\Express.php

We have below methods

canCapture()
capture()

Can anybody have any idea how to achieve this?


texts: How many shipping addresses may be selected for an order during the checkout process?

texts:
A. One shipping address per line item is possible
B. Only one shipping address per order is possible
C. One shipping addresses per unit of quantity is possible
D. One shipping address per product type is possible


texts: Magento 1.9.4.3 - Separate the same products in the cart

texts:
I would like to separate the same virtual products in the cart that are added several times by different product pages.
Consequently I would like the subtotal to be calculated based on this separation.

Of course I would like to do this without risking duplicating the products in the database once I save the order in this way.

How can I do?
Thanks


texts: How to find products being viewed right now

texts:
One of our clients has a specific requirement to show some products(let's say 4 or 5) in the home page that are being viewed at the moment by other users. Your suggestions about how to begin with this would be greatly appreciated.
Thanks.


texts: Not able to create order from backend (Magento 2.3.4)

texts:
Hello i am trying to place order from backend using credit card
but it shows the following error
i saw ajax request response after "submit order" button
its seems ok
{"payflowpro":{"fields":{"result":"0","securetoken":"3C5lcEtAOj0WOS78aCfHP1gqH","securetokenid":"K4Kw7aNqhWsiuFfqp8cTiDtl0bFVYcZs","respmsg":"Approved","result_code":"0"}},"success":true,"error":false}

Still order does not gets created & page does not redirected
i get this just after the clicking the "submit order button"
in system.log file"
[2020-08-12 12:12:19] main.ERROR: No such entity with cartId = 0 [] []

any thoughts on this ?


texts: How do I specify a different view template for Anchor categories?

texts:
I need different views for my categories and anchor categories, so far I have this in my local.xml which seems to kind of work, but shows no products [there are products in the categories]

<catalog_category_layered>

   <reference name="content">
       <block type="catalog/category_view" name="category.products" template="catalog/category/view_2.phtml"/>
   </reference>

</catalog_category_layered>

this also loads the view_2.phtml twice.

how do I do this correctly?


texts:
I'm using rwd package, Magento 1.8. I'm getting two blocks on left sidebar, Popular Tags and COMPANY block containing About Us, Contact us, Customer Service,
Privacy Policy. I can remove Popuar Tags using <remove name="tags_popular"/> in local.xml but can't get rid of COMPANY block. Any suggestions how this can be done from local.xml?


texts: Magento2 development and speed of compilation

texts:
I have a lot of experience working with both, Magento 1, as all front-end tools like less, grunt and so on.

But now working in Magento2 i have some concerns i've not been able to solve this weekend. I've been searching like crazy. I do hear many other developers experiencing the same.

The bottom line of the issue is. The site is slow. (10sec load times per page is not strange)

I walked through the entire devdocs of magento.
But in production mode Magento re-generated the CSS and such. But this taks a huge amount of time. I used Vagrant and Digital ocean server. Even though Digital Ocean is quicker its not useable to develop on.

Whats the best way to proceed?


texts: I want to use NetCommerce API with magento store , any suggested extensions ?


texts: Call Menu design of header.phtml into 1Column.phtml file

texts:
I am working on front end design changes for my website. My requirement to change position of Top Menu design which is written in header.phtml page and i want to use this line into 1Column.phtml page. How can i call this line,

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

on 1column.phtml. So that i can get output.


texts: If indian currency is selected, show in billing address country “india” only

texts:
If a user selected "indian" currency, and in checkout page billing address show only "india" in country list.

How can i do this ?

please help me someone. I am using magento 1.9.3.9


texts: change the background color of default home page

texts: How do I change the background color of the default home page?