texts: How to hide the product price for all the pages in magento 2

texts:
I have created one module and it has system configuration on the admin side, where the admin has the functionality to enable/disable the module. As per system configuration, I need to hide the price from every place on the front end.

  i.e. "catalog, category, wish-list, a related product, up-sell products, cart, checkout, orders, email, account dashboard, etc.."

from everywhere I need to hide the price if the module is enabled.

Is there any global file for the price which can be overridden and add the code for hiding price?

I found one file, But if we override \Magento\Catalog\Pricing\Render\FinalPriceBox and change in wrapResult() function, it works but it will affect only product page and home page not for wish-list and other places.

how can I achieve this functionality? Is anyone have any idea about it?


texts:
I want to create a custom tax rate percentage calculation for bundle products.

I have a standard rate of 20% tax set up to be applied to all products that have taxable goods tax class set on them. I have a bundle product that has 2 simple products associated with it. 1 has a tax class of 'Taxable Goods', the other has a tax class of 'None'. The bundle product has a fixed price and SKU.

When this product is added to the basket the tax rate applied to the product should be 10%. This is because 50% of the products being purchased are taxable, therefore only 50% of initial tax rate (20%) applies. See my example below of how I would like this to work.

C * ( B / A ) = Tax rate to be applied to the bundle product

20 * ( 1 / 2 ) = 10

A = Total number of products in the configured bundle.
B = Total number of taxable products in the configured bundle.
C = Tax Rate (20%)

Does anyone know where in the core code I could plugin to implement such a feature?


texts: How to find the list of blocks that must be added to white list after patch 6788 is applied

texts: In our multi store magento we have many blocks which some are disabled. Is there any way that provides the list of blocks which need to be added to white list instead of going through all cms blocks one by one?


texts: Magento 1.9 How to install slick and make a slideshow

texts:
I put the slick folder in magento/skin/frontend/rwd/theme/ and I don't know what else to do. Please help me make a slideshow. I put these lines in my local.xml and i want the slideshow to be on my homepage.

   <action method="addItem">
       <type>skin_css</type>
       <item>slick/slick.css</item>
   </action>
   <action method="addItem">
       <type>skin_css</type>
       <item>slick/slick-theme.css</item>
   </action>
   <!-- add jquery if not present -->
   <action method="addItem">
       <type>skin_js</type>
       <item>slick/slick.min.js.css</item>
   </action>


texts: Redirect to checkout cart after individual product update

texts: So I added a product in my cart. Now I decided to edit the quantity of this individual product. Now I want it to redirect back to checkout/cart instead of a page refresh. Is there a way to do this using an event/observer? I tried using checkout_cart_update_items_after but not sure if this is correct as I would assume this will only handle updates when you're in checkout/cart page but not in the individual product view page


texts: Missing atributte in conditions in widget

texts:
I use in my custom widget in /etc/widget.xml
            <parameter name="condition" xsi:type="conditions" visible="true" required="true" sort_order="10"
                   class="Magento\CatalogWidget\Block\Product\Widget\Conditions">
            <label translate="true">Conditions</label>
        </parameter>

but some attributes are missing. How to use such conditions as in sales rule in my custom widget??


texts: Magento2 setup:upgrade Undefined index notice

texts:
Using the latest version of Magent2; 2.3.5 currently. When running the setup:upgrade query, we are hitting the below error:

Notice: Undefined index: store in /siteurl/public/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 152

Looking at the store table, the admin ID has at somepoint changed from 0 to 2. Which is the likely issue. When restoring an old backup of this table, the id of 2 remains.

How is the above error rectified?


texts: Magento2 - observer equivalent to admin_user_save_before

texts:
I'm rewriting a home-grown M1 extension for M2. The M1 extension utilises an observer on the admin_user_save_before event.

I can't find any equivalent event for Magento2 - is there something I'm missing?


texts: Unable to set up cron job in magento 2.1.4. cpanel

texts:
I am unable to setup cron job. I have installed Magento CE 2.1.4 and had tried to setup cron job through cpanel.

I have used this command for cronjob :

* * * * * wget  -o  -q http://www.domain.com/public_html/cron.php

I keep getting this error in mail :

/bin/bash: /dev/: Is a directory

Please help. I am new to magento and am unable to understand how to set it up and also how to set success messages to my mail.

Thanks in advance


texts: Uncaught SyntaxError in RWD theme when using double quote (") as configurable attribute

texts:
When using the RWD theme with configurable products that have associated products with a size option using double quotes (") I am getting an error that is shown below.

  Uncaught SyntaxError: Unexpected string.

This does not occur if I switch back to the default theme.

Does it sound like it is not being escaped properly?

The error appears in the console as follows:-

SyntaxError: JSON.parse: expected ':' after property name in object at line 1 column 23 of the JSON data
jquery-1.7.2.min.js
Line 2

Error screenshot

Update: I have managed to fix this issue by using the addslashes function which successfully escapes the JSON output.

The file affected is: app/design/frontend/rwd/default/template/configurableswatches/catalog/media/js.phtml

Line 35 was:

ConfigurableMediaImages.setImageFallback(<?php echo $imageFallback['product']->getId(); ?>, $j.parseJSON('<?php echo $imageFallback['image_fallback']; ?>'));

Changed to:

ConfigurableMediaImages.setImageFallback(<?php echo $imageFallback['product']->getId(); ?>, $j.parseJSON('<?php echo addslashes($imageFallback['image_fallback']); ?>'));

I am not aware whether this is a bug in the code or not, but it worked when implemented into the Ultimo Magento theme as well as RWD.


texts: Magento 1.x Product Attribute Sets Not Showing on product edit page

texts: On the product edit page in the admin, only the system attribute groups are showing (Inventory, Categories, Related Products, etc), and none of the group tabs from the products attribute set are showing (General, etc)  Also the website selector above is not showing either.  I have tried re-indexing, and have checked the database, and the product is assigned to the correct attribute set and that set has groups in it with attributes assigned to them.  Also, I can create new attributes, which show up in the database, but not in the attribute admin, or as unassigned attributes in the attribute set editor.


texts: core customer module external database connection magento

texts:
I have an application which is supposed to share same database with another application ...Basically the customers are supposed to share among these two applications..Example..
www.test.com wants to read the customers of www.test1.com...So my question is ....

1)Can it be done by sharing same cookies on both the applications

2)I have tried connecting the  core customer module with external db but unable to do the same....The core connection is always from the main db witten in local.xml file of the application...hOW IT CAN BE DONE


texts: Boorstrap grid layout not working in chrome

texts:
The layout on our website was fine until I opened it today and instead of 4 columns of products there was only 3. I opened the site in firefox and its working fine 4 products wide. In chrome its like the 4th column on the grid is just empty?

I also have a live site which is producing the exact same results. I haven't changed any css or coding for some time.

Also when I change the layout option to 3 or 5 columns it produces 1 less column than it should. Firefox is fine.

If I reduce the resolution to <1200px The grid system changes to Medium size and it now produces the correct results.

I have been trolling through the code trying to work out why its not rendering correctly but I can't find anything.

Link Removed

Please Help


texts: where is function filter counter function?

texts:
catalog/layer/filter.phtml

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

Where is getCount function? and how to modify it? I need to get count without filter affection.


texts: Magento2 get invoice detail based on tax percent group

texts:
I want to get invoice detail based on TaxGroup percentage, How can I achieve this.
Using sales_order_save_after event observer.
InvoiceObject = {
    'orderId': 2324234,
    'invoiceId': 443322,
    'amountGroup':[
        {
         VatPercent: 20%,
         InvoiceSubTotal: $200,
         VatTotalAmount: $20
        },{
         VatPercent: 10%,
         InvoiceSubTotal: $100,
         VatTotalAmount: $10
        }
    ]
}


texts: Which REST API can be used to add and fetch product reviews?

texts: I checked the V1/modules API and found that "Magento_Review" is present. What I couldn't find is the REST API to access and add reviews for a product.


texts: Key constraint error while importing simple products

texts:
I am getting an error when I am importing simple products in Magento 2.2.

The error is :

  Category " has not been created. URL key for specified store already exists. in row(s): 1 General system exception happened
  Additional data: SQLSTATE[23000]: Integrity constraint violation: 1452
  Cannot add or update a child row: a foreign key constraint fails
  (`acbwqvzgyr`.`catalog_category_product`, CONSTRAINT
  `CAT_CTGR_PRD_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY
  (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON
  DELETE CASCAD), query was: INSERT INTO `catalog_category_product`
  (`product_id`,`category_id`,`position`) VALUES (?, ?, ?), (?, ?, ?) ON
  DUPLICATE KEY UPDATE `product_id` = VALUES(`product_id`),
  `category_id` = VALUES(`category_id`)

How can I solve this issue?


texts: Bug or Feature: sales_flat_quote_item table has same value of price and base_price

texts:
Observed in Magento EE 1.14.2.0, sales_flat_quote_item table has same value of price and base_price even the base currency and store currency are different.
But the strange thing is unit price and row totals are showing correct values in cart & checkout pages.

After further investigation it is found that unit price is calculated as converted value of price.

If this is the case why the Magento team didn't use the base_price.
And what's the point of having same values for price and base_price if the base currency and store currency are different?

Can anyone shade some lights on it?


texts:
Loading product file CSV using columns from a product export from magento, system, export, dataflow-profiles.

After loading, I get an error that states "no sku", But i have a sku in that column.

What am I missing?


texts:
We are using magneto 2.3 as well as using Control S server but our website very slow response time apex 30 seconds.
we have same website upload on AWS server its take 10 second maximum.
we have already perform all setting like merge css and magnify css as well as js file.

I assume when requests on server its take 30 second.Please let me know how can improve the speed.


texts: Caching / invalidating cached responses to Magento 2's REST API?

texts:
I'm using Magento 2 as something of "commerce engine" for a project I'm working on, which means extending and accessing a lot of Magento's functionality via REST API.

To speed things up I intend to add a caching layer in front of the API to at least optimize some of the "low hanging fruit" responses. A primary (and perhaps sole use at launch) example of this would be product information. I would ideally like to cache this data so that any GET requests for product data is cached (this data may be requested a LOT by the frontend, so I don't want to have to hit Magento with every request!).

My question comes around cache invalidation. I'm new to Magento 2 (but long time Magento 1 developer) and am wondering if there are any sorts of mechanisms built in for cache invalidation for this type of request. I've heard that Magento 2 is supposed to be "better" when it comes to the REST API, and I've also heard that in general Magento 2 is "made" to have a cache sitting in front (aka Varnish, which is what I'm guessing we'll be using at this point).

What I'm wondering is how much of the invalidation of cache might be handled on the REST API level "out of the box", or if this is something we'll have to write ourselves (i.e. listening to specific events and sending ban requests to Varnish myself)?


texts: How can i add default tax to all products

texts:
How to add default tax rate to all products in a store.

I am using magento 1.9 version

ex: I want to add 5.5% tax to all my products.


texts: Menu Items Showing up Behind Remove Item dropdown Magento 2.2

texts:
Getting this issue with our magento e-commerce site,

The remove item popup is showin below the menu,
as you can see in the picture below the menu text appears over the dropdow menu,
and are clickable if you hover over them,

Any Idea of how to fix this?

Thanks in Advance,
Gavin


texts: how to add toolbar in magento2 custom product listing page?

texts:
I have created a custom product listing page and add toolbar in the custom layout,it throws an error

  Call to a member function getSize() on null in /opt/lampp/htdocs/setec/vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml on line 18

how can i solve this??
Custom page layout

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceContainer name="sidebar.main">
    <block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="layer/view.phtml">
        <block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalog.navigation.state" as="state" />
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </block>
</referenceContainer>

<referenceContainer name="content">
    <block class="Pits\Theme\Block\Homepage\Categories" name="product_filter" template="Pits_Theme::homepage/product_list.phtml" />
    <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
    <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
    </block>
      <action method="setToolbarBlockName">
                    <argument name="name" xsi:type="string">product_list_toolbar</argument>
                </action>
</referenceContainer>
</page>


texts: How to add Advanced Search form in Pages on homepage in Magento 2?

texts:
I am trying to add advanced search form as a block in Pages, but the following code is not working?

  {{block class="Magento\Framework\View\Element\Template"
  template="Magento_CatalogSearch::advanced/form.phtml"}}

Thanks


texts: Magento 2 Add to Cart Submit Button Value

texts:
I have added custom add to cart submit button on product detail page.

On submit, i am getting other form fields values but not getting submit button name and value.

So how can i get the name or value of submit button in post.

Does anyone know how to solve it ?
Thanks in advance.


texts: Categories as well as products not showing

texts:
I'm using magento 1.9.1 on my godaddy windows server and installed the istudio7 theme. In the description it says 1.8 is the last supported version. but in responses they say it works on 1.9 and on a later response it's said that they are working on 1.9 support so this is a little confusing.

I followed the instructions they sent me with the download and changed my package name under Configuration > general > design into istudio7 changed colors to my liking and added banner images/favicon/logo etc. This is all working fine.

Then I went on and imported the Default theme settings.

after that I created a custom block for my category and assigned my category and product to this. Deleted the cache and gave it a look on my site, but it isn't showing up in my menu bar and the product isn't being shown in the new products section. Actually the entire section isn't visible at all.

Does anyone have a clue of what I'm doing wrong? I already tried to assign the category to the standard menu block but this didn't change anything.


texts: Proper User for Ubuntu Nginx PHP-FPM when running php bin/magento and composer Command Line

texts:
So on the setup mentioned in the title, I want to confirm how the user should be for command line. Using the default setup there is a user "nginx" that is used for php-fpm and for nginx.

Should that user "nginx" be used for composer install and updates, as well as php bin/magento commands? So I would log into SSH as that user?

I tried making all the files/folders owned by nginx:nginx and creating another user and putting them in the same group as "nginx", logging in as that new user and then running the php bin/magento commands like clear cache but it gives errors like cache is not writable (even though it is for nginx user).

I have already reviewed the docs https://devdocs.magento.com/guides/v2.3/install-gde/prereq/file-sys-perms-over.html but this is still not clear to me


texts: Magento 2 Where is Product attribute Website_id stored in DB?

texts:
In Magento 2, when editing a product, we can choose which website this product belongs to. But I can't find where is this information stored in the database.

I have checked eav_attribute, and I found out that the attribute website_id has attribute_id 1

I tried to look at the table catalog_product_entity_int, but I can't find any attribute_id = 1. So where is the relation for website_id and products stored in the DB?

EDIT,

Oh, that website_id I found in table eav_attribute is actually for the customers. So where is the website attribute for products?


texts: How to check shopping cart empty magento 2?

texts:
I calling a button proceed to checkout on title page shopping cart.

but when cart empty, button still show.

how to check if cart empty and hide button proceed to checkout?
Please help me!


texts:
I'm trying to move the category image and description into a single div.
They're both in the catalog module under view/frontend/layout/catalog_category_view.xml
 <referenceContainer name="columns.top">
            <container name="category.view.container" htmlTag="div" htmlClass="category-view" after="-">
                <block class="Magento\Catalog\Block\Category\View" name="category.image" template="Magento_Catalog::category/image.phtml">
                    <arguments>
                        <argument name="image" xsi:type="object">Magento\Catalog\ViewModel\Category\Image</argument>
                        <argument name="output" xsi:type="object">Magento\Catalog\ViewModel\Category\Output</argument>
                    </arguments>
                </block>
                <block class="Magento\Catalog\Block\Category\View" name="category.description" template="Magento_Catalog::category/description.phtml"/>
                <block class="Magento\Catalog\Block\Category\View" name="category.cms" template="Magento_Catalog::category/cms.phtml"/>
            </container>
        </referenceContainer>

This is my code
<move element="category.description" destination="category.view.container" before="category.image" />

Nothing is happening


texts: Not able to send email using custom template in magento 1.9.2 community edition

texts:
Hello guys i am trying to send an email in magento using custom email templates. But I am getting exception I have installed SMTP Pro Extension.

I am listing code here:-

My config.xml

<template>
  <email>
    <custom_abc_email_template  module="custom_abc">
      Custom Template
      <file>custom_abc_templates/customTemplate.html</file>  // this specifies the path where the custom template is located
      <type>html</type>
    </custom_abc_email_template>
  </email>
</template>

code of my controller action

$emailTemplate  = Mage::getModel('core/email_template')->loadDefault('custom_abc_email_template');
$emailTemplate->setSenderName('custom template');
$emailTemplate->setSenderEmail('abc@demomail.com');
$emailTemplate->send('abc@demomail.com','Forgot Password');

My Template file code

Custom Abc,

Your new password is: trolled

You can change your password at any time by logging into your account.

In exception.log

2016-04-11T10:03:18+00:00 ERR (3): exception 'Exception' with message
'This letter cannot be sent.' in /var/www/html/MMM/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php:40

In aschroder_smtppro.log

2016-04-11T10:03:18+00:00 DEBUG (7): Email is not valid for sending,
this is a core error that often means there's a problem with your email templates.

setting of email in backend


texts: how to run commands in command prompt in window

texts: I am getting error in command line in window. "command is not recognized as an internal and external command. operable program or batch file". this error occurs when i run any command.


texts: Unable to run Magento 2 Web Setup on nginx

texts:
I've downloaded Magento 2 and try to setup but getting blank page.

When I have checked nginx log file and I found below the log.

  FastCGI sent in stderr: "Access to the script
  '/var/www/html/magento2/demo/setup/index.php/navigation' has been
  denied (see security.limit_extensions)" while reading response header
  from upstream, client: 127.0.0.1, server: 224.example.com, request:
  "GET /setup/index.php/navigation HTTP/1.1", upstream:
  "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "224.example.com",
  referrer: "http://224.example.com/setup/"; 2018/05/23 16:58:47
  [error] 18961#18961: 319 FastCGI sent in stderr: "Access to the script
  '/var/www/html/magento2/demo/setup/index.php/navigation/side-menu' has
  been denied (see security.limit_extensions)" while reading response
  header from upstream, client: 127.0.0.1, server: 224.example.com,
  request: "GET /setup/index.php/navigation/side-menu HTTP/1.1",
  upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host:
  "224.example.com", referrer: "http://224.example.com/setup/";
  2018/05/23 16:58:47 [error] 18959#18959: *377 FastCGI sent in stderr:
  "Access to the script
  '/var/www/html/magento2/demo/setup/index.php/navigation/header-bar'
  has been denied (see security.limit_extensions)" while reading
  response header from upstream, client: 127.0.0.1, server:
  224.example.com, request: "GET /setup/index.php/navigation/header-bar HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host:
  "224.example.com", referrer: "http://224.example.com/setup/";

If anyone faces the same issue then help me.


texts: How overwrite magento core block and model for Catalog advanced search

texts:
I have modified following files in Magento

app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php
app/code/core/Mage/CatalogSearch/Model/Advanced.php

Please suggest me how to overwrite the core files of magento. I have already created a module named 'Custom' for another purpose. So to overwrite the catalogsearch folder first i copied the Form.php file into my own module’s(custom) Block folder and created same structure as magento does. I have renamed the class name and it extended Mage_CatalogSearch_Block_Advanced_Form. I also added the following code in config.xml file inside my module/etc folder.

<global>
 <blocks>
            <custom>
                <class>Company_Custom_Block</class>
            </custom>

            <advanced>
                <rewrite>
                    <form>Company_Custom_Block_Advanced_Form</form>
                </rewrite>
            </advanced>
        </blocks>
</global>

But it didn't work for me. Please suggest me the needful.Thanks!


texts:
Magento 2.4.0 supports MySQL 8, but Is Magento 2.3.5 supports MySQL 8?
In Magento official doc says, You must run MySQL version 5.6 or late, which means does it support MySQL8?
Ref: https://devdocs.magento.com/guides/v2.3/install-gde/prereq/prereq-overview.html#mysql


texts: Order Status Processing after Shipment and Generate Invoice also Invoice status showing pending in Magento2

texts:
Shipment completed and generate invoice but order status showing Processing  and invoice is in pending.

  Also invoice showing a Capture button.

why? Anyone Know?


texts: Magento 2 search result sort order changes(shuffles) every time result page is refreshed

texts:
We have a Magento2 EE configured with Solr and Manadev layered navigation extension. When we perform a search:

Search result yields correct and as expected result
Result is displayed and sorted by Relevance (e.g  1. A, 2. B, 3. C, 4. D)
Up to this point, there is nothing unexpected.All good.
Now, we just refresh the page ( No changes made anywhere at all)
Result and count is same but with different order (1. B, 2. D, 3. A, 4.C)

This is strange. Which one is culprit here ? Magento EE itself or Manadev Extension or Solr ?

FYI, not matter how many searches we make directly on solr console with the same query string, result ORDER(sorting) remains the same. This makes solr end somewhat non suspicious.

Has anyone faced this issue before ?

Any hint for this issue will be appreciated.

Thanks in advance.


texts:
I'm trying to programmatically manipulate the product relations in a Magento store.

From what I've read, setRelatedLinkData should be the way to go.

As I simple test, I'm just trying to replace a products related products with nothing (i.e. an empty array), however it's not working - the product in question is still showing the related product in the backend.

The test code I'm working with is:

                $product = Mage::getModel('catalog/product')->load($product->getId());
                $linkData = array();
                print_r($linkData);

                $product->setRelatedLinkData($linkData);
                echo "Save\n";

                $r = $product->save();

As mentioned above however the product still has a related product when I reload it in the backend.

NOTE: I don't only want to remove related products, eventually I want to be able to add new ones as well, so a DELTE FROM... SQL query isn't what I am looking for. However if I can't get it to work to remove products, then it's certainly not going to work to add them, so one step at a time :-)


texts: Where can I find the functions/SQL pulling custom options for a product in admin?

texts:
I have a site that has been up for some time and functioning without issue.

There are a number of products which have 10-20 custom options configured in admin. I logged in recently to discover that I can only see the last 4 custom options configured for any given product. All of the custom options are still appearing correctly on the frontend; it's only the backend where they're missing. I checked the database and all the product option entries still exist and appear to be in order. I've cleared all caches and reindexed everything, but there was no change.

Unfortunately I have no idea when the problem arose, and all of the product entry and configuration was done for the site 7-8 months ago. I've made numerous changes to the site and installed a couple extensions since then.

The only other thing I can think to check at this point is to see where the options are being pulled for the admin view and try to see what's going wrong, but I'm having trouble figuring out where to start. Can anyone point me in the right direction? Site is on version 1.9.2.3.


texts: How do I add values to core config data when a module is being installed.?

texts: I have a set of config that I need to add to core config data table when my module is being enabled. Data also needs to be deleted when the module  is being disabled


texts:
I have Magento 1.9.2.2

I was using mirasvit full page cache, now I am using potato full page cache.

My server VDS, 8CPU, 16GB RAM

Now I am using seperated redis servers for 1-sessions and 2-cache+fpc. I also tried via 3 seperated redis server.
1- Sessions
2- Magento Cache
3- Full Page Cache

It is working but after website fully cached, FPC is missing %30 of cached pages. This problem was same at mirasvit. What is the problem? Is this normal as a cache logic? After nearly website fully cached website is going slower.

Second question about Redis cleanup..
Should I use Scheduled Redis cache clean up. I tried to clean via redis-cli.php but I couldnt see any cahnge at key size.

Thank you.


texts: Creating multiple product layouts - best practice?

texts:
I am trying to decide the best method of creating two or more template layouts for the template I am working on.

I need to be able to change a number of blocks between the templates along with keeping some default elements across the templates.

For example I want to remove the standard product image gallery on one of the layouts and include a larger main product image whilst the others will retain a smaller product image and the 'more views' gallery.

Whats the best way to accomplish this?

Many thanks


texts: Error Running script with shell_exec from custom controller

texts:
I created a script that I run off a CSV of which I manipulate the data and create a new CSV (for imports through magmi).

When I run it through the command line it goes without a hitch.

I then proceeded to create a custom module on my magento site to allow the client to upload the csv from the admin.

I then have a controller that moves the uploaded file to my script and proceed to call shell_exec which I assumed would be doing exactly what I did when running from the command line.

Instead i got the following error

  PHP Fatal error: Call to undefined function snappy_uncompress() in /chroot/home/mywebsite.com/html/lib/Cm/Cache/Backend/Redis.php on line 888

I believe this is due to the fact that my script is loading Mage.

This is my controller:

    public function postAction(){
    if($_POST){

        //Get target directory and file name
        $upOne = substr(getcwd(), 0, strrpos( getcwd(), '/')  );
        $targetDir = $upOne . '/MyScriptDirectory/';
        $targetFile = $_FILES['myFile']['name'];

        //Upload file
        if (move_uploaded_file($_FILES['myFile']['tmp_name'], $targetDir . $targetFile)) {
           // Mage::getSingleton('core/session')->addSuccess('Success');
        } else {
            Mage::getSingleton('core/session')->addError('Failed to upload file');
        }

        //Run script with $targetFile as argument
        exec (  "cd SunberryImport/ && php main.php "  . $targetFile. " 2>&1",$output, $val );

        //Get output and print to screen
        Mage::getSingleton('core/session')->addError(implode($output));

    }
    $this->loadLayout();
    $this->renderLayout();
}

When I moved my script within the magento application and stopped loading mage within the script I no longer got that error.

I rather keep my script separate from the main application.

Is the problem due to running mage twice in the same php session?

  Sorry if I'm not being clear I'm new to both magento and this is my first Magento stack overflow question.


texts: Not Saving image correctly - $_FILES OR $_GET

texts:
I'm trying to upload an image in a PHTML file. When I try to save an image to the new folder location it saves but as an empty image file. I've tried to use $_FILES['pic']['name'] but it doesn't return any image. I think it doesn't read anything as it always return a blank value, so I've been using $_GET['pic']. It was working yesterday but for some reason it isn't now. Could someone please look at my code because i don't know where i'm going wrong?

Code to save the image file:

if (isset($_GET["formCheck"])){
    if (isset($_GET["pic"]) ) {
        $link= $_GET["pic"];
        echo "name: " . $link . "
";
        $extension = end(explode('.', $_GET["pic"]));
        $hashedimg = md5($link.time()) . "." . $extension;

        echo $hashedimg . "
";
        $destdir = Mage::getBaseDir('media') . DS . 'library' . DS;
        echo "dir: " .$destdir . "
";
        $img=file_get_contents($hashedimg);
        file_put_contents($destdir.substr($hashedimg, strrpos($hashedimg,'/')), $img);

        echo "end: " . $extension . "
";
        echo "fileloc: " . $destdir . $hashedimg . "
";
        $fileloc = $destdir . $hashedimg;

        $_GET["pic"] = $fileloc;
        echo $_GET["pic"];
    }
}


texts:
Magento 2 admin grids are not loading. In console I'm getting the following warning message.

  No template was found by selector: null template.js:59:17


texts: can not able to delete the images of products

texts:
I want to delete the uploaded images. what i tried is

I went  to backend and than go to catalog > Manage products, i opened single product and went to Images section. i checked on checkbox below Remove as in below image and i saved the product. but still those images are not deleting.


texts: Magento2: Block with shipping methods dissapper after 1 sec

texts:
When i try configure shipping methods after select this tab. Blocks They appear on the second and disappear. How to solve it?

M 2.3.4

log:

[2020-04-10 18:55:43] main.ERROR: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/tinymce.js' [] []
[2020-04-10 18:55:43] main.CRITICAL: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/tinymce.js' [] []
[2020-04-10 18:55:47] main.ERROR: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/tinymce.js' [] []
[2020-04-10 18:55:47] main.CRITICAL: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/tinymce.js' [] []

I try deploy, delete pub/static etc but still no work. Any other solution?


texts:
I have an image in:

/var/www/html/app/design/frontend/Alothemes/milano/web/images/natale/IMG_7300.JPG

How can I refer to this image in CMS block? I know I should use:

<img src="{{media url="..."}}" alt="" />

What shall I put instead of "..." ?

Thanks


texts: Show/Hide Products on Category page on button click

texts:
I want to show/hide the Product listing on Category page on button click.

On my category page i am displaying one static block before products, this block contain one button.
My requirement is on click of that button i want to show/hide the Product listing which appears below, and not to be displayed by default
See Screenshot https://prnt.sc/qtze4v

Can i get the block name that shows product listing?


texts: 'Class' not found error in Magento 2 frontend

texts:
This is a screenshot of the error.

My code is

  app/code/Prayag/Module/view/frontend/layout/cms_index_index.xml

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

       <referenceContainer name="content">
           <block class="Magento\Framework\View\Element\Template"  name="order_total" template="Prayag_Module::orders.phtml">
            </block>
        </referenceContainer>
        <referenceContainer name="sidebar.additional">
    <block class="Magento\Framework\View\Element\Template" name="order_total_sidebar" template="Prayag_Module::orders.phtml">
    </block>
    </referenceContainer>
    <referenceContainer name="content">
    <block class="Magento\Framework\View\Element\Template" name="cart_total_sidebar" template="Prayag_Module::cart_view.phtml">
    </block>
    </referenceContainer>

    </page>

  app/code/Prayag/Module/view/frontend/templates/orderes.phtml

    <?php

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $customerSession = $objectManager->create('Magento\Customer\Model\Session');
    $customerID = $customerSession->getCustomerId();

    $order = $this->helper('Prayag\Module\Helper\Data')->getCollection($customerID);

    foreach($order as $items){ ?>
    IncrementId :<a href="<?php echo $block->getUrl('sales/order/history'); ?>"><?php echo $items->getIncrementId(); ?>

    <?php
    echo "Subtotal :". $items->getSubtotal(). '
';
    echo "Order Status :". $items->getStatus(). '
';
    echo "Date :". $items->getCreatedAt().'
';

    }

  app/code/Prayag/Module/Helper/Data.php

    <?php
    namespace Prayag\Module\Helper;
    class Data extends \Magento\Framework\App\Helper\AbstractHelper
    {
    public function __construct(
    \Magento\Sales\Model\OrderFactory $orderFactory
    ) {
    $this->orderFactory = $orderFactory;
    }
    public function getCollection($customerID)
    {
    $collection = $this->orderFactory->create()->getCollection()->setOrder('entity_id', 'DESC')
    ->addAttributeToFilter('customer_id',$customerID);
    $collection->setPageSize(5)->setCurPage(1);
    return $collection;
    }
    }


texts: Magento 2 : Buy X and get Y Free in custom module..How it set in admin and fronted?

texts: Magento2 default in set Cart Rule get X qty get the Y free same logic in my custom module in the set but I was confused about which file in set code?


texts: How to get updated cart subtotal in checkout_cart_product_add_after event observer in Magento 2?

texts:
I want to add a free product to cart with another product. For that I wrote checkout_cart_product_add_after event observer. My problem is, I don't get the updated cart subtotal(after adding first product, it returns subtotal as 0). This is my observer code.

namespace StwBuyXGetY\BuyXGetY\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Registry;

class AddfreeProduct implements ObserverInterface
{
    protected $_productRepository;
    protected $_cart;
    protected $formKey;
    public function __construct(
        \Magento\Checkout\Model\Cart $cart,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Form\FormKey $formKey){
        $this->cart = $cart;
        $this->formKey = $formKey;
        $this->logger = $logger;
    }
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $totals = $this->cart->getQuote()->getTotals();
        $subtotal = $totals['subtotal']->getValue();
        $this->logger->debug($subtotal);
    }

}

Any help will be greatly appreciated.


texts: Magento 2 pub/media/catalog folder size too big

texts:
I have magento2 setup with ~6000 products and the size of the pub/media/catelog folder was 23GB,

Now suddenly it has increased to ~51GB and the server storage is started showing 100%.

I am not sure that is intended behaviour or do I need to increase the storage of the server?


texts: Magento 2 Admin Front controller reached 100 router match iterations

texts:
Magento is relentless and notorious for error like this one I got on admin and with not an accurate fix for it.
Is there anyone here came across this issue and why this happen out of the blue.


texts:
I have PayPal express on my Magento website

How can I receive the PayPal express field "Notes to Seller" or "Instructions to Merchant" that the user enters?

I can't seem to see that information anywhere in Magento.


texts:
I'm manually creating some configurable products but whenever I save them and try to access my site, it shows a blank page. I found out the error occurs when I add the simple products. If those aren't added the site works just fine.

I've looked at the logs and there is only a system.log present which shows a notice for undifined indexes for images, but nothing else.

I've also added ini_set('display_errors', 1); to index.php but it doesn't display any errors.

So my guess is that the simple products are wrongfully configured. I checked them and all seems fine, they are configured in the same way the other products are and those are working just fine.

My question is does anybody by change know what causes this error? Or at least some tips on how to further debug it?


texts: What is the difference between the navigation and menu widgets

texts:
I've just noticed Magento 2 has two widgets that sound very similar, the menu widget and the navigation widget.

They are both customised versions of the Query UI Menu widget and they both use the same source - lib/web/mage/menu.js

What differences are there between these widgets?


texts: Top Menu (Nav Bar) Not Showing on RWD Template

texts:
I have downloaded Magento 1.9 from the 1&1 App Center. It's a fresh install that is using the RWD template by default. I am new to Magento but have some web design experience.

My issue is that the top menu is not showing and has never shown. Is it disabled by default? I have one category with one item that I'm testing the store with, but how do I enable the top menu? http://camilouscloset.com/


texts: I am building my ecommerce store in Magento 1.9.4. I have installed Ashroder SMTP Pro extension manually through FTP. It installed successfully. I have done RUN SHELL test but I am getting connection refused error. I have attached the screenshot. I am using Custom SMTP option & used my email login & password that I purchased from my hosting account, please confirm is it correct. Also confirm the info I have filled is correct. Please help me in this concern. New error is coming. Please take a look.


texts: Move more views images to the left of the main product image

texts:
I would like to move the more views product images from bottom of the main product image to the left of the main product image, with all the existing functionality intact.
It would be very nice if someone can guide me towards it.


texts: Magento 2: Order getCreatedAt() returns null?

texts:
I meet a very strange situation while working with event observer in Magento 2.

My custom module hooked into sales_order_save_after (which returns \Magento\Sales\Model\Order), and its magic methods work fine but getCreatedAt()

The only way to get date time in this case is using this getCreatedAtFormatted() instead of getCreatedAt().

Anyone can please tell me what was happening?


texts: How to add special price for customer group in admin

texts:
In magento products, admin have option to add customer group price. I also want to add customer group special price. There is already special price option in the products but it is for all customer groups.

Here is group prices screenshot:

So in the group price option I want to add one more input field named 'special price'. so this price can be used as special price for specific customer group.

Does someone have a suggestion?


texts: Magento 2 - admin form show textbox on dropdown change

texts:
I have a form in admin with dropdown and textbox.

I want to show textbox only if dropdown value is set to yes.

I have not used UI-component for this.

I have tried below code but its not working.

<?php
namespace Company\Module\Block\Adminhtml\Syncpolicy\Edit\Tab;
class Listrules extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface
{
    /**
     * @var \Magento\Store\Model\System\Store
     */
    protected $_systemStore;

    protected $_resources;

    /**
     * @param \Magento\Backend\Block\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Framework\Data\FormFactory $formFactory
     * @param \Magento\Store\Model\System\Store $systemStore
     * @param array $data
     */
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Data\FormFactory $formFactory,
        \Magento\Store\Model\System\Store $systemStore,
        array $data = array()
    ) {
        $this->_systemStore = $systemStore;
        parent::__construct($context, $registry, $formFactory, $data);
    }

    /**
     * Prepare form
     *
     * @return $this
     */
    protected function _prepareForm()
    {
        /* @var $model \Magento\Cms\Model\Page */
        $model = $this->_coreRegistry->registry('module_syncpolicy_format');
            $isElementDisabled = false;
        /** @var \Magento\Framework\Data\Form $form */
        $form = $this->_formFactory->create();
        $form->setHtmlIdPrefix('page_');

        $htmlIdPrefix = $form->getHtmlIdPrefix();

        $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('Synchronization Policy')));
        if ($model->getId()) {
            $fieldset->addField('id', 'hidden', array('name' => 'id'));
        }

        $selectField = $fieldset->addField('select_field', 'select', array(
                'label' => 'Show/Hide Selection',
                'name' => 'select_field',
                'values' => array(
                    array(
                        'value' => 1,
                        'label' => 'Yes',
                    ),
                    array(
                        'value' => 0,
                        'label' => 'No',
                    ),
                ),
                'onChange'  => 'showHideField()',
            ));

        $fieldset->addField('field_to_hide', text, array(
            'label'  => $this->__('Test'),
        ));

        $selectField->setAfterElementHtml('
                                <script>
                                function showHideField() {
                                    $("field_to_hide").toggle()
                                }
                                </script>
                            ');

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

        return parent::_prepareForm();
    }

    /**
     * Prepare label for tab
     *
     * @return string
     */
    public function getTabLabel()
    {
        return __('List Rules');
    }

    /**
     * Prepare title for tab
     *
     * @return string
     */
    public function getTabTitle()
    {
        return __('List Rules');
    }

    /**
     * {@inheritdoc}
     */
    public function canShowTab()
    {
        return true;
    }

    /**
     * {@inheritdoc}
     */
    public function isHidden()
    {
        return false;
    }

    /**
     * Check permission for passed action
     *
     * @param string $resourceId
     * @return bool
     */
    protected function _isAllowedAction($resourceId)
    {
        return $this->_authorization->isAllowed($resourceId);
    }
}


texts: how to choose the same theme for each store-view

texts:
I'm new to magento and i have a store contains 2 store views.
I want to use the default theme (RWD) for both store views.
But each store have its own layout and alignment.
So i need 2 copies from (RWD)theme for each store view.
I tried to make a copy of the (RWD) CSS file but didn't know where to locate it.

so how to make this copy and point each store to the correct theme?


texts:
I'm trying to put the conversion event snippet into my success page, but I dont know how do I get the order_id to pass with.
My code is:
gtag('event', 'conversion', {
        'send_to': '...',
        'transaction_id': '<?= $orderId ?>'
    });

But how do I define the $orderId on success page's head tag?


texts: Magento is not sending confirmation after B2B registration

texts: I have a Magento website that has b2b registration enabled. When I visit the link  www.mysite.com/b2b it gives the ability of registration and after the customer clicks on submit a message pops up that says You will receive a confirmation e-mail. The e-mail never arrives though. Where could the problem be?  Thank you in advance


texts:
What is the base_discount_tax_compensation_amount field in the Order, Invoice, and Credit Memo objects of the Rest API in Magento 2.

The only thing it says in the schema is: "The base discount tax compensation amount for a {object type}".

How do I get a non-zero value for this? What type of settings do I need in Magento 2 and what type of order do I need to place to have something other than 0 in this field?


texts: Change a Category Name without affecting the existing products within that category

texts: I just realized that I incorrectly named a sub category and its url on a Magento 2.2.7 site. This category currently has approximately 150 products in it. Can I just simply edit the Category Name or will that affect the existing products under that category?


texts: get join table's all rows with collection magento2

texts:
I am fetching a collection (of user table), that is retrieving correctly. Now I have one more table (ex.- address) that has multiple row related collection table primary key.
I want to fetch them all with collection query.

Like -  If I print the collection object data via -> $obj->getData() then
It is returning data like this

Array=>(
[id] => 1   //====Primary key of user table
[name] => xyz
[marks] => 85

)

But The way I want is  - return data should be like  -

Array=>(
[id] => 1   //====Primary key of user table
[name] => xyz
[marks] => 85
[address] => Array(          //=====Data from related address table========
                1 => (
                    [row_id] => 1
                    [house_no] => 45
                    [id] => 1   //=====Forign Key of user table
                ),
                2 => (
                    [row_id] => 6
                    [house_no] => 45
                    [id]=> 1    //=====Forign Key of user table
                ),
            )

)

Can anyone let me know how I can achieve this. Because I tried with $this->getSelect()->joinLeft() but it works if related table have only one row .

Thanks


texts: difference between the Block and UI_Component to Make grid and Form at admin side?

texts: What is the Difference way to use of Block and ui_components to Make the Admin side grid and form and fields and elements in the form, can someone explain, which is better way to choose and Why ?


texts: Get all Magento Categories using SQL query

texts:
I have this SQL to get all Magento Categories.
SELECT DISTINCT
    cc.entity_id AS id,
    cc.`value` AS path,
    cc1.`value` AS `NAME`,
    cce.`level`,
    cce.parent_id
FROM
    catalog_category_entity_varchar cc
JOIN catalog_category_entity_varchar cc1 ON cc.entity_id = cc1.entity_id
JOIN eav_entity_type ee ON cc.entity_type_id = ee.entity_type_id
JOIN catalog_category_entity cce ON cc.entity_id = cce.entity_id
WHERE
    cc.attribute_id = '57'
AND cc1.attribute_id = '41'
AND ee.entity_model = 'catalog/category'

This returns all categories, but I created a new category from Magento backend but that is not showing.
That category is published and has no products in it.
Following image is from catalog_category_entity_varchar table.

entity_id = 449 is showing when I run that query, because it has attribute_id = 57 and 41
But I am talking about entity_id = 452 that is not showing, because it does not have attribute_id = 57.
I want to ask Magento experts, what does attribute_id = 57 belong to? and how can I fix this query to fetch all categories?


texts: How to update mini cart on mobile after custom add to cart form submits

texts:
Following my question here I have an issue where my form doesn't update the basket but only on mobile devices. How can I trigger from my phtml file that Magento needs to update the mini cart?

The gifts.phtml file I've created looks like:

<?php

$product_id = $block->getData('product');

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

$productHelper = $objectManager->get('\Magento\Catalog\Model\Product');
$_product = $productHelper->load($product_id);

$listBlock = $objectManager->get('\Magento\Catalog\Block\Product\ListProduct');
$addToCartUrl =  $listBlock->getAddToCartUrl($_product);

?>

<form action="<?php /* @escapeNotVerified */ echo $addToCartUrl ?>" method="post"
  id="product_addtocart_form"<?php if ($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
<input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $_product->getId() ?>" />
<input type="hidden" name="selected_configurable_option" value="" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
<?php echo $block->getBlockHtml('formkey')?>
<?php echo $block->getChildHtml('form_top'); ?>
<?php if (!$block->hasOptions()):?>
    <?php echo $block->getChildHtml('product_info_form_content'); ?>
<?php else:?>
    <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1'):?>
        <?php echo $block->getChildChildHtml('options_container') ?>
    <?php endif;?>
<?php endif; ?>

<?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2'):?>
    <?php echo $block->getChildChildHtml('options_container') ?>
<?php endif;?>
<?php echo $block->getChildHtml('form_bottom'); ?>
<button type="submit" title="Add to Cart" class="btn redButton">
    Add to Cart
</button>

<a href="#" data-post='<?php  echo $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) ?>' class="action towishlist gift-wish" data-action="add-to-wishlist">


texts:
In magento2 - Is it possible to configure continuous integration like Jenkins with Magento Functional Test Framework ?

We are using bitbucket for our private repositories and Allure for reporting. We are aiming for starting to trigger test suites from a commit in the bit bucket. If the tests are a success, this can trigger another job for deployment.


texts: User with custom role cannot access custom menu item in Magento 2 admin interface

texts:
I want to give permission to admin user for a custom module,
before creating a acl.xml the module name was not coming in list, after acl.xml its coming but admin user is not able to see in his menu.

Here is acl.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Magento_Catalog::catalog" title="Products" sortOrder="30">
                    <resource id="Magento_Catalog::catalog_inventory" title="Inventory" sortOrder="10">
                        <resource id="Sup_Brand::shopbybrand" title="ShopByBrand" sortOrder="10" />
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

Here's the menu.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 PinkBlue. All rights reserved.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../app/code/Magento/Backend/etc/menu.xsd">
    <menu>
        <add id="sup_brand::shopbybrand" title="ShopByBrand" module="Sup_Brand" sortOrder="21" parent="Magento_Catalog::inventory" resource="Sup_Brand::sample" action="sup_brand/items/"/>

    </menu>
</config>


texts: Magento 2 - Why is there a "order number" field in checkout at payment method "Purchase Order"?

texts:
If I select the payment method "Purchase Order" then a mandatory field shows where the customer has to enter a order number. Why?? And how does the customer know what he has to enter?!

This is a fresh magento 2.3.4 installation.


texts: Every time I change the page name formatting is deleted

texts: I recently purchased a Zonda theme for Magento. I am now trying to rename the URL Key  and Page Title, but when I do change the CMS > Page name the formatting is deleted. This happens even when I switch back to the original name. I then need o re-install the theme. How to I fix this issue?


texts: Products Weight not calculated at shipping

texts: Single products weight calculated perfectly, when i add three products, three products of weight not calculated. Am using WEBSHOPS MATRIX RATES


texts: We have over 1200 attributes sets. Every time we make a change to an attribute set, it takes about 5 minutes to save. We have indexing set to Manual. I'm not sure what else we can do to speed this up. Any suggestions?


texts: Magento 2 rest API - How to Manage API Authentication Lifecycle on Mobile Devices Application?

texts:
In Magento [2.2.4] web API when I pass username and password then it generates token for that specific customer (Which is only valid for 1 hour - it is configurable from Magento admin)

  http://magento.host/index.php/rest/V1/integration/customer/token?username=test.user@test.com&password=test@123

which returns token.

After generating token, when we pass that token in header.

Authorization :: Bearer *Token Value*

  http://magento.host/index.php/rest/V1/customers/me

Which returns customer details.

The above case I explained is working fine for webAPI in magento2 which I tested in POSTMAN.

Now the case is,

  Every hour regeneration of token and after that login again every hour
  is not logical for Mobile Application.

  Then how Magento manages user login data and authentication in Mobile
  application, if it is developed API As per Service Contracts

How long should I allow my access tokens to exist before
it expires in Mobile Application?

I don’t want to force my users to re-authenticate every hour in Mobile Application.
How to properly manage your OAuth2 API token life-cycle for Mobile Application.

Making changes in Access Token Lifetime hours would not be logical solution, Because Application and web should have different lifetime hours of Token


texts: How to create an object with constructor parameter in controller file

texts:
I am trying to create an object of third-party library class in controller file, I am facing issue while passing argument, below is a code I have written to create an object.

Sample_controller.php

protected $_third_party_object;
public function __construct(
\Magento\Framework\ObjectManagerInterface $objectManager
){
$this->_objectManager = $objectManager;
}

public function execute(){
   $this->_third_party_object = $this->_objectManager->create('\venodor_name\module_name\lib\class_name',$param);
}

param is the parameter that needs to be passed to the constructor of the third-party class.


texts:
Is there any way(Configuration setting or from xml) to skip Shipping method block in checkout.

Without any customization or installing any extension.


texts: Default active tab need to be Order info

texts:
I have added a custom tab in admin order detail page but when I open order detail page then custom tab is displaying by default.

how can I avoid it and display Order info tab by default

<referenceBlock name="sales_order_tabs">
            <action method="addTabAfter">
                <argument name="name" xsi:type="string">custom_tab</argument>
                <argument name="block" xsi:type="string">MyNameSpace\Sales\Block\Adminhtml\Order\View\Tab\CustomTab</argument>
                <argument name="after" xsi:type="string">order_transactions</argument>
            </action>
        </referenceBlock>


texts: Magento import tables from old database show error (errno: 150 "Foreign key constraint is incorrectly formed")

texts:
i want to import old customer data to new magento store i have imported all customer's table instead of customer_entity, when i import this table i am getting this error
1005 - Can't create table test.customer_entity (errno: 150 "Foreign key constraint is incorrectly formed")
Please help me out for this issue.


texts: Add to cart url returns invalid url in magento1.9.0.1

texts:
My add to cart url returns this. When i click it the products doesn't get added because it's invalid. This happens in the homepage.

http://localhost/mage/index.php/checkout/cart/add/uenc/aHR0cDovL2xvY2FsaG9zdC9tYWdlL2luZGV4LnBocC9wYWNrYWdlcy9wYWNrYWdlL2luZGV4Lw`,,`/product/13/form_key/D5FhQaqwv69PjG8q/

In url "/uenc/aHR0cDovL2xvY2FsaG9zdC9tYWdlL2luZGV4LnBocC9wYWNrYWdlcy9wYWNrYWdlL2luZGV4Lw,,/"  =>',,' causing issue.

First in my code it was using $this->getAddToCartUrl($_product) because of this issue i replaced it with this Mage::helper('checkout/cart')->getAddUrl($_product) Still the problem exists.

I clear cache but not working. Anyone have idea?


texts: How to Speed Up My Time To First Byte on Magento Site?

texts:
I am really bothered with my site speed. I have this magento site which has this site speed:

as you can see the total time is 2.15s and whole Site Speed is 2.71s(Full Waterfall View). All my resources are in good speed but my Time To First Byte is so Slow. How can I improve this? Any Solution to this?


texts: Magento 2 : When creating a product - Cannot add or update a child row: a foreign key constraint fails?

texts:
When creating a product, it throws this error

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails  (`vbm`.`catalog_product_entity`, CONSTRAINT `FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY (`attribute_set_id`) REFERENCES `eav_attribute_set` (`attribute_set_id`) ON DELETE), query was: INSERT INTO `catalog_product_entity` (`entity_type_id`, `attribute_set_id`, `type_id`, `sku`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, '2019-02-13 05:46:17', '2019-02-13 05:46:17')


texts: Unable to process binding on product page Magento 2.3.5

texts:
Hello i'm facing an error that i absolutly not understand. I just to upgrade my magento from 2.3.2 to 2.3.5 and i have a knockout.js error on my product page and an infinite loader .

I don't no where to search  Any idea?


texts: Magento2 moving from staging to live site

texts:
I have not found too much information on an efficient process for a rolling development of my site so I can add custom modules and other file changes on staging and then push those changes onto the live copy of my site with magento2.

In Magento 1.9 we just had a git clone of the files and git pulled all changes that were ready for the live site this obviously will not work in magento2 were my staging site is in developer mode and my live site is in production.

What is the best practice that involves the least live site downtime ?
(no downtime would be optimal if that is possible)


texts: "Service Temporarily Unavailable" after installing module on Magento site

texts:
I have installed a plugin, after that my site is showing the below message:

"Service Temporarily Unavailable"

Please help. My site is www.arrgosy.com


texts: Trucating magento cart and then adding product to cart gives 500 error

texts:
Here we have firstly truncate our magento cart,

$cart = Mage::getModel('checkout/cart');
  $cart->truncate()->save(); // remove all active items in cart page
  $cart->init();

  Mage::getSingleton('checkout/session')->clear();

After this, we tried to add products

$cart = Mage::getSingleton('checkout/cart');
   $cart->init();
   $cart->addProduct($id,$qty);

Its giving 500 Internal Server Error

Note: Its only giving error when we apply adding product quantity to max.

Ex. available qty. 100
here in my case $qty=100

Editedcode :

<?php
include 'app/Mage.php';
Mage::app();

Mage::getSingleton('core/session', array('name' => 'frontend'));
// Need for start the session
$cartHelper = Mage::helper('checkout/cart');
 $items = $cartHelper->getCart()->getItems();
 echo count($items);
 foreach($items as $item)
 {
  $itemId = $item->getItemId();
  $cartHelper->getCart()->removeItem($itemId)->save();
 }
try {
    $product_id = '7896'; // Replace id with your product id
    $qty = '99'; // max qty with your qty
    $product = Mage::getModel('catalog/product')->load($product_id);
    $cart = Mage::getModel('checkout/cart');
    $cart->init();
    $cart->addProduct($product, array('qty' => $qty));
    $cart->save();
    Mage::getSingleton('checkout/session')->setCartWasUpdated(true);

} catch (Exception $e) {
    echo $e->getMessage();
}

Note : Our code is working perfectly for first time only, rest of all time its giving this error

Kindly help


texts: jQuery - redirect immediately when session is expired or destroyed

texts:
I have a simple question.

How can i make an page immediately redirect to other page in example www.google.com when a specific session is expired or destroyed.

Here is how i get an session in PHP:

<?PHP
$Logged = $_SESSION['LoggedIn'];
?>

There are two important things that the jQuery script must do:

Without any refresh/reload needed on the page where the script is listening to make a redirect when the session is destroyed for example from another tab in the browser/or the session was expired by a period of time.
The script must do a check on every 5 seconds for example.

I am new to jQuery so i'll be very thankfull to you if you can help me for the creation of this script.

Thanks in advance!


texts: How to relocate Attribute on product page?

texts:
I am developing my first e-commerce website on magento 1.9.3.1. In main product page, i like to move / relocated few attributes such as SKU, Manufacturer and so on from Additional Tab to Under Product Title.

How would I go about this ?


texts: Rewriting collection function in Magento 2 - no results are returned?

texts:
I am rewriting a Magento 1 function for Magento 2. See 2 comments in the code for details please. This is the Magento 1 version:
$this->_optionValueTable = Mage::getSingleton('core/resource')->getTableName('eav/attribute_option_value');
$this->_productOptionValueTable = Mage::getSingleton('core/resource')->getTableName('catalog/product_index_eav');
$this->_productEntityTable = Mage::getSingleton('core/resource')->getTableName('catalog/product');
...
public function setUsedInProductFilter($attributeSetId,$storeId=null)
    {
        $this->getSelect()
                ->joinLeft(array('product_option'=>$this->_productOptionValueTable),
                    'product_option.value=main_table.option_id '
                        .'AND '.$this->getConnection()->quoteInto('product_option.store_id=?', $storeId),
                    array())
                ->joinLeft(array('product_entity'=>$this->_productEntityTable),
                    'product_entity.entity_id=product_option.entity_id '
                        .'AND '.$this->getConnection()->quoteInto('product_entity.attribute_set_id=?', $attributeSetId),
                    array())
                ->where('product_entity.entity_id IS NOT NULL')
                ->group('main_table.option_id');
        return $this;
    }

This is the Magento 2 version:
$this->_optionValueTable = $this->_coreResource->getTableName('eav_attribute_option_value');
$this->_productOptionValueTable = $this->_coreResource->getTableName('catalog_product_index_eav');
// catalog_product does not exist in Magento 2, so I guess catalog_product_entity is correct?
$this->_productEntityTable = $this->_coreResource->getTableName('catalog_product_entity');
...

public function setUsedInProductFilter($attributeSetId, $storeId=null)
    {
        $connection = $this->getConnection();
        $this->getSelect()
                ->joinLeft(['product_option'=>$this->_productOptionValueTable],
                    'product_option.value=main_table.option_id '
                        . 'AND '.$connection->quoteInto('product_option.store_id=?', $storeId),
                    [])
                ->joinLeft(['product_entity'=>$this->_productEntityTable],
                    'product_entity.entity_id=product_option.entity_id '
                        .'AND '.$connection->quoteInto('product_entity.attribute_set_id=?', $attributeSetId),
                    [])
                ->where('product_entity.entity_id IS NOT NULL') // Removing this line gives me results, but too many
                ->group('main_table.option_id');

        return $this;
    }

Any idea what might be wrong?


texts: Magento Add Configurable Product to shopping cart

texts:
how can i add Configurable Product to shopping cart in magento ? i try this code to add simple product to shopping cart but it`s not work for configurable product

    $result = $proxy->shoppingCartProductAdd($sessionID, $cartID, array(array(
    'product_id' => $productID,
    'sku' => $sku,
    'qty' => $qty,
    'options' =>array(0 =>array('key' => $option1id ,'value' => $option1value),1 =>array('key'     => $option2id ,'value' => $option2value)),
    'bundle_option' => null,
    'bundle_option_qty' => null,
    'links' => null
    )));

how can i do this for configurable products ? thanks

edit :
i change my code :

        $product = array(
    "product_id" =>"1300",
    "qty" => 2,
    "super_attribute" => array(
        152 => 28

    )
);
 $result = $proxy->shoppingCartProductAdd($sessionID, $cartID, array($product));

but it`s return me this message :

  please specify product options

152 is attribute id and 28 is option value id


texts:
I am using an object manager to get the attribute value even though it's not recommended.
I am getting NULL in product-object which causing error "GetattributeText() on NULL". Below is the code that so far I tried

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
        echo gettype($product);
        $slot_break = $product->getAttributeText('choose_slot_break');

when I echo gettype it shows "NULLObject". I have done so much googling before posting this question and have already tried almost all the solutions in the Magento stack exchange

The above code-sniffer is working well to show the value in a PHTML but here I am trying to get this inside a function which I needed for some calculation which is in a programmatically created dropdown attribute class which extends "\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
". Pardon me if this ain't met the qualification to ask as a question.


texts: Magento custom block shows Fatal error: Call to a member function setTemplate() on a non-object

texts:
I have created one block inside my custom module but it's not working. My module is working fine but my block is not working when I call my block from footer.phtml file it shows 'Fatal error: Call to a member function setTemplate() on a non-object'. Actually I want to show some message in my frontend using my custom block.I have mentioned my code below

local/Monojit/Custom/controllers/IndexController.php

<?php
class Monojit_Custom_IndexController extends Mage_Core_Controller_Front_Action
{
   public function indexAction()
    {

        $this->loadLayout();

        $block = $this->getLayout()->createBlock(
            'Mage_Core_Block_Template',
            'my_block_name_here',
            array('template' => 'custom/test.phtml')
        );

        $this->getLayout()->getBlock('content')->append($block);
        $this->renderLayout();
    }

}
?>

local/Monojit/Custom/Block/Mycustomblock.php

<?php
class Monojit_Custom_Block_Mycustomblock extends Mage_Core_Block_Template

{
//public function _prepareLayout()
//    {
//      return parent::_prepareLayout();
//    }

    public function _construct() {
        parent::_construct();
        $this->setTemplate('custom/test.phtml');
    }
    public function getmessage()
     {
       $msg = "showing my custom block";
       return $msg;
     }
}
?>

local/Monojit/Custom/etc/config.xml

<?xml version="1.0"?>

<config>

<global>

<modules>

<monojit_custom>

<version>0.1.0</version>

</monojit_custom>

</modules>

<blocks>

<custom>

<rewrite>

<custom>Monojit_Custom_Block_Mycustomblock</custom>

</rewrite>

</custom>

</blocks>
<helpers>
  <custom>
      <class>Monojit_Custom_Helper</class>
  </custom>
</helpers>
</global>

<frontend>

<routers>

<custom>

<use>standard</use>

<args>

<module>Monojit_Custom</module>

<frontName>custom</frontName>

</args>

</custom>

</routers>

<layout>

<updates>

<custom>

<file>custom.xml</file>

</custom>

</updates>

</layout>

</frontend>

</config>

I have created one theme (copied modern theme) inside frontend/default/monojit
Changed admin design configuration as well,created necessary folder as well inside skin.screenshot pic

design/frontend/default/monojit/template/custom/test.phtml

//want to fetch data from my block

This is your custom block called programatically.

localhost/magento/index.php/custom page shows my message correctly but when I call my block from footer.phtml page

<?php echo $this->getLayout()->createBlock('custom/mycustomblock')->setTemplate('custom/test.phtml')->toHtml(); ?>

It shows 'Fatal error: Call to a member function setTemplate() on a non-object' Do I need to create any layout.xml file? Please help me how can i fix my issue.thanks


texts: Change product quantity having a list of SKUs and quantities

texts:
I have product SKU.

using that i have to change product quantity As stock so how to do this.

I am getting a SKU and quantity like this

Array
(
    [minimalVS] => 1
    [seaglassin] => 0
    [half_moon_knuckle_ring] => 90
    [unique_Walnut_and_Cherry] => 8
    [half_eternity_ring_Sapphire_ring] => 11
    [ear_jacket] => 2
    [short_Thin_Line] => 44
    [totally_Awesome] => 1
    [handcrafted_Leather_Briefcase] => 5
    [militaryexpedition] => 5
)

Key as SKU and Value as Quantity means [sku] => quantity so how to change quantity


texts:
I am receiving this error, when i try to login through ADMIN.

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO admin_user_session (session_id, user_id, status, ip) VALUES (?, ?, ?, ?)

But, once i go back to PHPMYADMIN and EMPTY the MYSQL TABLE - admin_user_session, it works again.


texts: When implementing an SQL upgrade script, do I need an install script for stores that have never had a previous version of the module?

texts: I understand how to execute an install or upgrade script with my Magento module. My question is, when someone installs the latest version of a module and has never had a previous version installed, does Magento cycle through the previous version installs until the final upgrade script is ran or, in addition to each versions upgrade script, do I need an install file?


texts: How to give condition for Contact Form Only For Registered Customer?

texts:
Below is my Contact Form Email id Box :

                    *<?php echo Mage::helper('contacts')->__('Email') ?>

                        <input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />

How can i give condition here like registered customer only submit enquiry form. this condition should check from my customer Database, if email id is not registered enforced to signup.

I am getting so many spam emails every day.


texts: Adding custom xml to CMS page's Layout Update XML fails to load the script

texts:
I am trying to add Java script to a specific CMS page to be loaded in the <head> area. The scripts fails to load.
name.min-1.0.js and name.Mode.js are placed in {magentoroot}/js.
The following is placed in a specific CMS page, under Layout Update XML area. I do flush the Magento cache after save also!
<reference name="head">
<action method="addJs"><script>name.min-1.0.js</script></action>
<action method="addJs"><script>name.mode.js</script></action>
</reference>

What am I doing wrong?  Is this conflicting with another script? How can this be fixed?


texts: I am on Magento 1.9.4.4. Server freezes for about 1' every now and then (10 times or more a day)


texts: Magento - Fatal error: call to a member function getid() on null in app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line this line

texts:
I am exporting related images data from CWS Extensions extension
and I am getting an error by this line.

public function getConfigurableAttributesAsArray($product = null)
{
    $res = array();
    foreach ($this->getConfigurableAttributes($product) as $attribute) {
        $res[] = array(
        'id'             => $attribute->getId(),
        'label'          => $attribute->getLabel(),
        'use_default'    => $attribute->getUseDefault(),
        'position'       => $attribute->getPosition(),
        'values'         => $attribute->getPrices() ? $attribute->getPrices() : array(),
        'attribute_id'   => $attribute->getProductAttribute()->getId(), // i am getting  error in this line
        'attribute_code' => $attribute->getProductAttribute()->getAttributeCode(),
        'frontend_label' => $attribute->getProductAttribute()->getFrontend()->getLabel(),
        'store_label'    => $attribute->getProductAttribute()->getStoreLabel(),
        );
    }

    return $res;
}


texts: Static Content is not loading after upgrade

texts:
After upgrade from the Magento 2.1.0 to the Magento 2.1.3 (using composer) static content is not loading anymore. In the browser console I can see that all files is unavailable (404):

I don't see directories with the name version* in the pub directory.

What I already made but it didn't help:

set all permissions to 777, but without success.
cleaned cache
removed the pub/static/*
regenerated static content few times
replaced the .htaccess file (in the pub/static directory) with the file from an official repository.

Another info:

mod_rewrite is enabled
FollowSymLinks is allowed (in the default host configuration and local .htaccess)
This configuration worked fine with Magento 2.1.0 before the updating to the 2.1.3
pub/static is writable

Any suggestions?


texts: Show parent product images also when child product option is selected in magento 2.3.2

texts:
My magento 2 site consist of configurable products.
On product detail page, when the page loads, the product image shown is the parent product image along with its associated images also https://prnt.sc/ua6r08
My requirement is, on Product detail page, when we select any child product options like https://prnt.sc/ua6pl6 The image shown is the child product image, which is correct. But the parent product images should also be shown at the bottom along with that. https://prnt.sc/ua6saz
How can we do this?


texts: How to change image according to the color on homepage

texts:
I get the configurable products on homepage and now i have to add a color slider at the bottom of the image so than when i click on the particular color the image of the product can change accordingly.
Can anyone please help me how can i do that.
Thanks in advance.


texts: Need to remove decimal from Discount Price Magento 2

texts: I want to remove decimal digits from discount price on product details page in magento 2.Any solution.


texts: Magento send order email wihout going to checkout

texts:
What I want to do is.

I need to disable the checkout process.
When logged-in users go to view cart page after added some products, the page will have order by email button. So when click on that button I need to send email to admin+user with order details and need to save order details at my account section.

Any idea really appreciate...


texts: I want to upgrade magento enterprise edition from 1.12.0.2 to 1.14.3.7. So we can upgrade directly to latest version or we should go first to 1.13.x and then 1.14.x ?


texts: Extension method call throwing fatal error

texts:
I'm using an extension for marketing emails on a magento site.

On certain pages a phtml file is called that uses some javascript. For the js to get rendered an if statement has to pass

   if(Mage::helper('connector')->getPageTrackingEnabled()) :?>
     //some js
   <?php endif; ?>

getPageTrackingEnabled() is a method inside data.php which checks the value of system config global variable. It looks like this:

   public function getPageTrackingEnabled()
{
    return (bool)Mage::getStoreConfig(self::XML_PATH_PAGE_TRACKING_ENABLED);
}

But causes this error

   Fatal error: Call to undefined method Dotdigitalgroup_Email_Helper_Data::getPageTrackingEnabled()

Any suggestions on where I should go from here. I've done the done the cache, disabled compilation and tried calling the method differently but with no luck unfortunately

EDIT
config.xml

   <helpers>
        <connector>
            <class>Dotdigitalgroup_Email_Helper</class>
        </connector>
    </helpers>


texts: Unable to toHtml a block: Invalid parent block for this block

texts:
So, I switched the template of order_info to add some more information by adding a child block to it in adminhtml_sales_order_view. The order account information in the admin is updated correctly, and I see what I added.

Layout update

<adminhtml_sales_order_view>
    <reference name="order_info">
        <!-- Replace it with my template -->
        <action method="setTemplate"><template>qwer/sales/order/view/info.phtml</template></action>
        <!-- Add a child block -->
        <block type="qwer_sales/adminhtml_sales_order_view_info_ax" name="ax_account_info" template="sdm/sales/order/view/ax.phtml" />
    </reference>
</adminhtml_sales_order_view>

My custom class below has some additional methods to retrieve what I want.

class QWER_Sales_Block_Adminhtml_Sales_Order_View_Info_Ax extends Mage_Adminhtml_Block_Sales_Order_View_Info

However, when I try to toHtml() on this child block from a controller action, I get an error saying Invalid parent block for this block because getParentBlock() in _beforeToHtml() returns null. I'm actually rendering the child block using a layout update as well, but the issue comes down to this - see below.

In a controller action...

$html = $this->getLayout()
    ->createBlock('qwer_sales/adminhtml_sales_order_view_info_ax')
    ->setTemplate('qwer/sales/order/view/ax.phtml')
    ->toHtml();

Any ideas why this is not working and what I need to do to fix it?

Update:
Solved it. See my answer.


texts: Avoid displaying out of stock products in upsell section

texts:
Under Configuration -> Inventory -> Display Out of Stock Products I have set it to Yes because out of stock products are accessible by Search Engines though I don't want the out of stock products to show up in Upsell section. Is there any way to achieve this by applying filters? Below is the entire code of my upsell.phtml.

<?php if (count($this->getItemCollection()->getItems())): ?>

<?php echo $this->__('You may also be interested in the following product(s):') ?>

            <?php // $this->setColumnCount(4); // uncomment this line if you want to have another number of columns. also can be changed in layout ?>

            <?php $this->resetItemsIterator() ?>

            <?php for ($_i = 0; $_i < $this->getRowCount(); $_i++): ?>

                    <?php for ($_j = 0; $_j < $this->getColumnCount(); $_j++): ?>

                        <?php if ($_link = $this->getIterableItem()): ?>

                            <?php $_link = Mage::getModel('catalog/product')->load($_link->getId()); ?>

<a href="<?php echo $_link->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'small_image')->resize(125) ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_link->getName()) ?>" />

<a href="<?php echo $this->getUrl($_link->getUrlPath()) ?>"><?php echo $this->htmlEscape($_link->getName()) ?>

                                <?php //echo $this->getPriceHtml($_link, true) ?>

                                <?php //echo $this->getReviewsSummaryHtml($_link) ?>

                        <?php else: ?>

                            &nbsp;

                        <?php endif; ?>

                    <?php endfor; ?>

            <?php endfor; ?>

<?php endif ?>


texts: Magento2.3.1 How to product detail page custom image gallery popup display?

texts:
I have to used Magento2.3.1 and in detail page i need to product image click after display popup image look like this type.if anyone idea how to achieved this by default magento. below share link Go to product image click than show popup inside image and thumbnail image display same look like.

https://www.amazon.com/Prextex-100-Count-Clear-Christmas-Decorations/dp/B075LQ4WTF


texts: Address not show all information on order addres information in backend

texts:
guys
I need to show all shipping information and edit in order backend.


texts:
Is there a way to customize the Magmi plugin so that an import.csv can be added directly from the browser?

Currently, we are using FTP but it is not practical for our admin to be logging in and out of FTP changing permissions on our firewall etc just to add products.

Failing this is there a way to upload files directly from the backend?


texts: Why its adding version_no in js and css url in magento2?

texts:
On my local system I am setting up an project. All setup done and its not showing any error. But its not picking css/js.

I run the following commands but no one making effect to work -

  sudo chmod -R 0777 var
  sudo chmod -R 0777 pub
  php bin/magento setup:static-content:deploy
  php bin/magento cache:flush
  php bin/magento indexer:reindex

As I see the view source its adding versionNumber in url like -

  pub/static/version1487053472/frontend/Cloudways/m2-theme/en_US/mage/calendar.css

and its showing 404 when I hit the url for respective css/js. And As I am checking respective css/js file to respective location without version1487053472, its available .

I am stuck ryt now, how to fix it. Please do a reply if you have any suggestion.


texts: Create attribute option using Data patch in Magento2

texts:
I am creating a product attribute with option using Magento 2.3 Data patch.

Used below code.

<?php
declare(strict_types=1);

namespace Vendor\Module\Setup\Patch\Data;

use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class AddFeatureAttribute implements DataPatchInterface
{

private $moduleDataSetup;
private $eavSetupFactory;
public $_storeManager;
private $logger;
protected $_dir;
public function __construct(
    ModuleDataSetupInterface $moduleDataSetup,
    EavSetupFactory $eavSetupFactory,
    \Psr\Log\LoggerInterface $logger,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Framework\Filesystem\DirectoryList $dir
) {
    $this->moduleDataSetup = $moduleDataSetup;
    $this->eavSetupFactory = $eavSetupFactory;
    $this->_storeManager = $storeManager;
    $this->logger = $logger;
    $this->_dir = $dir;
}

/**
 * {@inheritdoc}
 */
public function apply()
{
    /** @var EavSetup $eavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

    $fileName = 'attributes.csv';
    $pubPath = $this->_dir->getPath('pub');
    $attributeFile = $pubPath.'/'.$fileName;
    $arrResult = array();
    if(($handle = fopen($attributeFile, 'r')) !== FALSE) {
        $row = 1;
        while(($data = fgetcsv($handle, 1000000, ',')) !== FALSE) {
            $col_count = count($data);
            $arrResult[] = $data;
            $row++;
        }
        fclose($handle);
    }
    $i = 0;
    foreach ($arrResult as $line) {
        if($i > 0){
            $attributeCode = $line[0];
            $attributeName = $line[1];
            $inputType = strtolower($line[2]);
            $options = $line[3];
          $type = 'int';
      $eavSetup->addAttribute(
        \Magento\Catalog\Model\Product::ENTITY,
           $attributeCode,
           [
             'type' => $type,
             'group' => 'General',
             'backend' => '',
             'frontend' => '',
             'label' => $attributeName,
             'input' => $inputType,
             'class' => '',
             'source' => '',
             'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
             'visible' => true,
             'required' => false,
             'user_defined' => true,
             'searchable' => false,
             'filterable' => true,
             "filterable_in_search" => '1',
             'comparable' => false,
             'visible_on_front' => true,
             'used_in_product_listing' => true,
             'unique' => false,
             'option' => [
                'values' => $options,
               ],
             'system' => 1
             ]
           );
       }
     $i++;
   }

  }

public static function getDependencies()
 {
    return [];
 }

 /**
 * {@inheritdoc}
 */
 public function getAliases()
  {
     return [];
  }
}

The sample csv file is like below

The above code not creating the options, please someone help me on that how can we create a attribute with options. Thanks!!


texts: Error messages not translated in observer

texts:
I have placed the error messages like below in my observer.php

$msg = Mage::helper('mymodule')->__('You had already added the subscription in previous session.Add the subscription again and proceed to checkout');
Mage::getSingleton('core/session')->addError($msg);

and added the translation in

app/locale/es_ES/Mymodule.csv

But the still the messages are not translated.
Can anyone suggest a workaround ?


texts: M2: How to get Customer Cart Rules in My Account page

texts:
I want to filter cart rules list in my account page.
I've list cart rules in My Account page "Dashboard". But I want to filter cart rules list by condition.

I've configure the conditions in cart rules by date of birth.  I just want to show the rules if the customer date of birth is same with my conditions.

I got the Data from \Magento\Customer\Block\Account\Dashboard\Info. but I dont know how to filter cart rules list.

$datax = $helper->getSalesRule();
echo '<pre>';
print_r($datax->getData());
echo '</pre>';

and the result

[
    conditions_serialized
]=>{
   "type":"Magento\\SalesRule\\Model\\Rule\\Condition\\Combine",
   "attribute":null,
   "operator":null,
   "value":"1",
   "is_value_processed":null,
   "aggregator":"all",
   "conditions":[
   {
"type":"Magento\\CustomerSegment\\Model\\Segment\\Condition\\Segment",
     "attribute":false,
     "operator":"==",
     "value":"138,110",
     "is_value_processed":false
   }
 ]
}


texts:
Is it possible to change the order state via the REST API?

My issue at the moment is that I have orders stuck in the Payment Review state and I can not Invoice/Cancel/Ship them via the back end or the API.

I feel like I need to get the state of the order back to processing to be able to do any of these things but I can not find any way to move an order out of the Payment Review state either with the back end or the API.

As such these orders do not correctly track to customers or update stock information.


texts: Magento 2 - setup:di:compile throws No tokens were provided error

texts:
In magento 2 when I run setup:di:compile I get the following error:

  [Zend\Code\Exception\RuntimeException]
      No tokens were provided

How to solve this problem?

I disabled all additional modules, ran setup:upgrade, but still I get the tokens error.


texts: Magento 2 dynamically add rows to tier price

texts:
Task : To trigger Add button so that a new row is inserted in tier price block every time the loop runs via jquery

I have loop which is triggering the click on Add button but the issue is that the loop is adding only 1 row and that too is not selectable by jquery. The component formed is in knockout, could you please help me in figuring the correct way of doing this and how to add multiple rows to tier table via jquery trigger ?


texts: How can I add this JQuery plugin into Magento 2 store?


texts: How to get Product Custom Image attribute Iabel?

texts:
I have created one Custom Attribute of media image type.

  Attribute name = product_image_custom_1.

I need to display this custom image on Product Page at Footer.

I have used Below code in phtml file to print image.

<?php
        $_helper = $this->helper('Magento\Catalog\Helper\Output');
        $_product = $block->getProduct();

        $productImageAttr = $_product->getCustomAttribute( 'product_image_custom_1' );
        $productImage = $this->helper('Magento\Catalog\Helper\Image')
            ->init($_product, 'product_image_custom_1')
            ->setImageFile($productImageAttr->getValue());
?>
        <img src="<?php echo $productImage->getUrl() ?>" alt="<?php echo $block->escapeHtml($productImage->getLabel()) ?>" />

it prints image Fine, But Image label in Alt not display.
it prints Product Name.

how to print alt text attribute in frontend?


texts:
I've been having difficulties in downloading the patch. When I attempt to download the patch, I get prompted to login to MarketPlace. Then I get a form that asks about the site name, URL, and number of employees. After I click submit, I don't get anything and the form DOESN'T go away.

I've tried multiple browsers such as Chrome (the form doesn't change), and IE-Edge (after I click submit, I get the loading icon and that's it). I also used a different machine (Mac), I got the same result as on Chrome.

Any idea what's going on or how to get this patch downloaded?

Thanks


texts: me2pro - 500 error after install ( magento 1.9)

texts:
Tried to install the latest version of m2e pro (6.5) which is not, supposedly, available to the public yet but was passed to me by m2e after i inquired about the module.

i followed the install instructions Link spot on using filezilla to upload the contents of the archive to the base magento directory .

After deleting the var/cache and refreshing the admin page i was on i immediately got a 500 error.

I have reached out to m2e and they opened my email 2 days ago (love me some bananatag email tracking) they have yet to responded.

the issue for the log is:

  Warning:
  include(/home/qr2a1v2skyym/public_html/includes/src/Ess_M2ePro_Model_Cron_Strategy_Observer_KeepAlive.php):
  failed to open stream: No such file or directory  in
  /home/qr2a1v2skyym/public_html/includes/src/Varien_Autoload.php on
  line 94

My boss is freaking out that i am going to have to rebuild the entire install.

I have tried replacing the htaccess with the original, i have do a few other things (and reverted back after it did not help).


texts:
I am trying to get an attribute to the filter in my webshop. I have tried several things in the admin panel, but nothing seems to work.

At the moment there are two attributes in it, profile color and height, but i also want width in it.

The attribute is made with the correct settings. So what now?


texts: Magento2 How to get customer group name by using group id?

texts: How can I get customer group name by using group id in a template (phtml file) ?


texts: Get product Url in custom module Observer.php file Magento 1.9

texts:
In custom module Observer.php i am trying to get Product url

On view.phtml it gives correct working path like http://websitename.com/brave-gentleman-new-york-belt.html

But same code in Observer.php gives http://websitename.com/brave-gentleman-new-york-belt-120.html

$_product = Mage::getModel('catalog/product')->load($productId);
Mage::log( $_product->getProductUrl());

This code gives brave-gentleman-new-york-belt which is correct but it is not complete url

 $productURL = Mage::getResourceSingleton('catalog/product')
  ->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore());

This gives the result

$productUrl  = Mage::getBaseUrl().Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore()).Mage::helper('catalog/product')->getProductUrlSuffix();


texts: Trying to show more products with block type="catalog/product_list

texts:
I'm using

  {{block type="catalog/product_list" productCount="16" category_id="14" template="catalog/product/home_list.phtml" }}

for show products from in my home from one category but it only show me 9 products in 4 colums and 3 rows.

I tryied to put

  _productsCount=”10“

but no works, some sugestion please?

Thank you.


texts: How can I create and update static blocks via a module install script?

texts:
I have a number of static blocks and pages I need to create in a few shops and without doing it manually I copied the install script for the sample data for Magento2 to use a .csv to install these blocks.

Similar to this question Link, I am looking for a way I can later update these static blocks also over a .csv.

Based on this I have added the following files to upgrade the static blocks but it is not working.
http://www.learnmagento.com/magento-2-create-cms-static-blocks-via-setup-script/

I have added an UpgradeData.php with the following content

use Magento\Cms\Model\Page;
use Magento\Cms\Model\PageFactory;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;

class UpgradeData implements UpgradeDataInterface
{
      /**
     * @var \Magento\CmsSampleData\Model\Page
     */
    private $page;

    /**
     * @var \Magento\CmsSampleData\Model\Block
     */
    private $block;

    /**
     * @param \my\module\Model\Page $page
     * @param \my\module\Model\Block $block
     */
    public function __construct(
        \my\module\Model\Page $page,
        \my\module\Model\Block $block
    ) {
        $this->page = $page;
        $this->block = $block;
    }

    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    {
        $setup->startSetup();

        //handle all possible upgrade versions

        if(!$context->getVersion()) {
            //no previous version found, installation, InstallSchema was just executed
            //be careful, since everything below is true for installation !
        }

        if (version_compare($context->getVersion(), '0.0.3') < 0) {
            //$this->page->install(['my_module::fixtures/pages/pages.csv']);
            $this->block->upgrade(
                [
                    'my_module::fixtures/blocks/pages_static_blocks.csv',
                ]
            );

        }

        $setup->endSetup();
    }
}

And in /Model/Block.php I have added this function

public function upgrade(array $fixtures)
{
    foreach ($fixtures as $fileName) {
        $fileName = $this->fixtureManager->getFixture($fileName);
        if (!file_exists($fileName)) {
            continue;
        }

        $rows = $this->csvReader->getData($fileName);
        $header = array_shift($rows);

        foreach ($rows as $row) {
            $data = [];
            foreach ($row as $key => $value) {
                $data[$header[$key]] = $value;
            }
            $row = $data;
            $data = $this->converter->convertRow($row);
            $cmsBlock = $this->saveCmsBlock($data['block']);
            $cmsBlock->unsetData();
        }
    }
}

Anyone has an idea whats wrong or am I missing something essential?