texts: Magento2 need to check if varnish cache is applied or not

texts:
How can I verify whether my Varnish Cache is properly configured or not.
Here are the things that appeared

page_cache is not getting regenerated
Site speed as per Google page speed is improved

My site is set on http://x.x.x.x & is redirected to https://x.x.xx.x
HTTP/1.1 200 OK
< Date: Wed, 22 Jul 2020 13:59:25 GMT
Date: Wed, 22 Jul 2020 13:59:25 GMT
< Server: Apache
Server: Apache
< Pragma: cache
Pragma: cache
< Cache-Control: max-age=86400, public, s-maxage=86400
Cache-Control: max-age=86400, public, s-maxage=86400
< Expires: Thu, 23 Jul 2020 13:59:26 GMT
Expires: Thu, 23 Jul 2020 13:59:26 GMT
< X-Magento-Tags: store,cms_b,cat_c,cat_c_38,cat_c_20,cat_c_41,cat_c_3,cat_c_58,cat_c_39,cms_b_,cms_b_31,cms_b_em0144-fashion-area-footer-inner-payment,cms_b_60,cms_b_em0144-jewelry-area-footer01-information-footer07,cms_b_48,cms_b_em0144-jewerly-main-slideshow,cms_b_52,cms_b_em0144-jewelry-top-banners,cms_b_54,cms_b_em0144-jewelry-area-main01-new-arrivals-grid12,cms_p_7
X-Magento-Tags: store,cms_b,cat_c,cat_c_38,cat_c_20,cat_c_41,cat_c_3,cat_c_58,cat_c_39,cms_b_,cms_b_31,cms_b_em0144-fashion-area-footer-inner-payment,cms_b_60,cms_b_em0144-jewelry-area-footer01-information-footer07,cms_b_48,cms_b_em0144-jewerly-main-slideshow,cms_b_52,cms_b_em0144-jewelry-top-banners,cms_b_54,cms_b_em0144-jewelry-area-main01-new-arrivals-grid12,cms_p_7
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
X-Frame-Options: SAMEORIGIN
< Set-Cookie: PHPSESSID=3fe21bcb4a2d0cd17f4304ff6c6346ca; expires=Wed, 22-Jul-2020 14:59:26 GMT; Max-Age=3600; path=/; domain=monogramshop.com.au; secure; HttpOnly
Set-Cookie: PHPSESSID=3fe21bcb4a2d0cd17f4304ff6c6346ca; expires=Wed, 22-Jul-2020 14:59:26 GMT; Max-Age=3600; path=/; domain=monogramshop.com.au; secure; HttpOnly
< Content-Length: 101554
Content-Length: 101554
< Vary: User-Agent
Vary: User-Agent
< Connection: keep-alive
Connection: keep-alive
< X-UA-Compatible: IE=edge
X-UA-Compatible: IE=edge
< Cache-Control: max-age=86400, private, must-revalidate
Cache-Control: max-age=86400, private, must-revalidate
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8

The above is output of curl -I -v --location-trusted 'https://x.x.x/'
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Wed, 22 Jul 2020 14:02:19 GMT
Date: Wed, 22 Jul 2020 14:02:19 GMT
< Last-Modified: Mon, 07 Oct 2019 08:45:22 GMT
Last-Modified: Mon, 07 Oct 2019 08:45:22 GMT
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Content-Type: text/html
Content-Type: text/html
< Content-Encoding: gzip
Content-Encoding: gzip
< Vary: Accept-Encoding
Vary: Accept-Encoding
< Pragma: no-cache
Pragma: no-cache
< Expires: -1
Expires: -1
< Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
< Via: HTTP/1.1 forward.http.proxy:3128
Via: HTTP/1.1 forward.http.proxy:3128
< Connection: keep-alive
Connection: keep-alive

The above is output of curl -I -v --location-trusted 'http://x.x.x/'


texts: Magento 2 : what is the use of getFacetedData() in category filter?

texts:
Magento 2 Category layered navigatoin,

In magento category layered navigation content comes from below file

vendor/magento/module-catalog-search/Model/Layer/Filter/Category.php

In this file, inside _getItemsData() function one line,

$optionsFacetedData = $productCollection->getFacetedData('category');

I want to know what is the use of getFacetedData('category') in magento.


texts: Customer street address second line not getting populated

texts:
I have address the 2nd street text box(2nd street line), but when I enter the address on both text boxes.

code for 1st street line

<input type="text" name="street[]"
    value="<?= $block->escapeHtmlAttr($block->getStreetLine(1)) ?>"
    title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?>"
    id="street_1"
    class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/>

code for other street lines

      <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
       <?php for ($_i = 1, $_n = $this->helper(\Magento\Customer\Helper\Address::class)->getStreetLines(); $_i < $_n; $_i++): ?>

                 <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>">
                  <?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?>

                            <input type="text" name="street[]"
                                   value="<?= $block->escapeHtmlAttr($block->getStreetLine($_i + 1)) ?>"
                                   title="<?= $block->escapeHtmlAttr(__('Street Address %1', $_i + 1)) ?>"
                                   id="street_<?= /* @noEscape */ $_i + 1 ?>"
                                   class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>">

                <?php endfor; ?>

I checked the address from street_1 and street_2 are saved as one in street column of the table customer_address_entity separated by a newline "\n"

When I print this <?= $block->escapeHtmlAttr($block->getStreetLine(1)) ?> in php echo but gives me empty result, but somwehow the street address is set in the textbox.

I need to get the street address and split it into for street_1 and street_2

I don't see any value set to value attribute in chrome inspect as per code.
Then how value is getting populated.
And how can I get that value and split to get the first line of street and 2nd line of the street address?


texts: Programmatically invoice a single product off of an order

texts:
How could I go about programmatically invoicing a single product off of a sales order of more than one product?

I.E Order X has three products,
SKU1, SKU2 & SKU3. I only want to create an invoice for SKU1.

I've looked into

  \app\code\core\Mage\Adminhtml\controllers\Sales\Order\InvoiceController.php

Though I get a little stuck when I see the _getItemQtys() method.

Could really use some advice.


texts: Magento 2.2.3 Getting an Error While Saving Product?

texts:
I am facing one issue while saving/update the product in magento 2.2.3 CE

  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
  error in your SQL syntax; check the manual that corresponds to your
  MySQL server version for the right syntax to use near '' at line 1,
  query was: UPDATE catalog_product_entity set updated_at='2018-07-03
  05:47:23' where entity_id =

Note:- able to save the product but getting an error like as shown in the below w screen shot

Could you please suggest how to overcome this error?

Exception log:-

  main.CRITICAL: SQLSTATE[42000]: Syntax error or access violation: 1064
  You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near '' at line 1, query was: UPDATE catalog_product_entity set
  updated_at='2018-07-25 06:29:22' where entity_id =
  {"exception":"[object] (Zend_Db_Statement_Exception(code: 42000):
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
  error in your SQL syntax; check the manual that corresponds to your
  MySQL server version for the right syntax to use near '' at line 1,
  query was: UPDATE catalog_product_entity set updated_at='2018-07-25
  06:29:22' where entity_id = at
  /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:2228


texts: Magento 1.8 admin username and password correct but not login & menu click redirect to other page

texts:
Am new in Magento, I'm using Magento 1.8 and local server Xampp. I was migrating my Magento store Live Server to localhost. After migrating some error are defining.

When i try to login admin enterd this link http//127.0.01/magento/admin or click front-end store menu it automatically move to http://127.0.0.1/dashboard/
admin panel username and password correct but not redirect to dashboard.

In databse am changed core_config_data that are following

web/unsecure/base_url as http://127.0.0.1/magento/
web/secure/base_url as http://127.0.0.1/magento/

And clear all cache files in var/cache folder and session files var/session folder. Then local.xml changed dbname, username, password.

How can i solve this errors.

Thanks in advance


texts: How to convert mysql query in magento collection

texts:
this is my mysql query . I want to convert in magento collection.

reference link
https://stackoverflow.com/questions/34253461/repeat-a-result-row-multiple-times-by-value-in-row

select Item , ItemName ,  Quantity
from yourtable A
cross join (select num from numbers) b
where a.Quantity <= b.num

I tried below code but not work

$collection = Mage::getModel('sales/order_item')->getCollection()->addFieldToSelect(array('sku','qty_ordered'));

        $collection->getSelect()->joinCross(array('num' => 'new_table_qty_numbers'),array('main_table.sku','main_table.qty_ordered'))
        ->where('main_table.qty_ordered >= num.qty'); //also tried main_table.qty_ordered <= num.qty
        echo "<pre>";
        print_r($collection->getData());


texts: Magento 2 : How to detect if payment has failed

texts:
How can I check a payment process failed while ordering in Magento 2?

I want to set some logic if payment failed during order placing. Payment can be done from any payment method like PayPal, debit card, etc.


texts: Add Custom block and changes for specific category

texts: I have created the category and added my custom code in that, I have also my custom block which I created for that I have used catalog_category_view.xml file but it affects in all other my category pages I want changes for this specific category can anyone tell me how can I do that?


texts:
On my category page I am trying to show all it's products, even though they are all disabled.

On the category page I am using:

$categoryModel = Mage::getModel('catalog/category');
$_category  = $this->getCurrentCategory();
$_category_id  = $_category->getId();

$products = $categoryModel->load($_category_id)
->getProductCollection()
->addAttributeToSelect(array('id', 'name','etc...'))
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_DISABLED);

But my collection is always empty.

I have also tried using:

->addAttributeToFilter('status', 2)

Without success. If i switch the filter to enabled products with either:

->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)

->addAttributeToFilter('status', 1)

Then (in any other category where products are enabled) then the collection shows all products.

I have flat catalog turned off/set to No in my configuration.


texts:
I want to add new method Mage_Eav_Model_Form, so I want to extend it. Doing as it suppose to be, but extension simply not working. Here is my part from config:

<models>
<vendor_mymodule>
    <class>Vendor_Mymodule_Model</class>
    <resourceModel>tw_subscriptionheader_resource</resourceModel>
</vendor_mymodule>
<vendor_mymodule_resource>
    <class>Vendor_Mymodule_Model_Resource</class>
</vendor_mymodule_resource>
<eav>
    <rewrite>
        <form>Venor_Mymodule_Model_Eav_Form</form>
    </rewrite>
</eav>

Here is original model:

abstract class Mage_Eav_Model_Form

And mine:

class Vendor_Mymodule_Model_Eav_Form extends Mage_Eav_Model_Form

For example I want to add:

public function something() {}


texts:
I'm trying to implement the following scenario:

Host downloadable product on AmazonS3
Make S3 files private (not accessibile by direct url)
Enable access if Referrer is mywebsite

If I try to point on a webpage to product url, referrer il trasferred and download start but if I try to buy a product and to use the url autogenerated by magento, I get "not authorized" error from Amazon S3.

I think that the problem is that Referrer header are not set, is there a way to add this to download link?

Edit 28/12:
I tried to debug download url and I have the following result:

Request URL:***mydomain***/downloadable/download/link/id/MC41MTUzODgwMCAxNTEzNzYxNDk4MjEzMTg1NjU1Nw,,/
Request Method:GET
Status Code:302
Remote Address:*****
Referrer Policy:no-referrer-when-downgrade

I think that the problem is Referrer Policy. How can I change it? I tried to edit Download.php class as following with no success

                $headers = 'GET ' . $path . $query . ' HTTP/1.0' . "\r\n"
                . 'Host: ' . $urlProp['host'] . "\r\n"
                . 'User-Agent: Magento ver/' . Mage::getVersion() . "\r\n"
                . 'Referrer-Policy: origin' . "\r\n"
                . 'Connection: close' . "\r\n"
                . "\r\n";
            fwrite($this->_handle, $headers);


texts: Magento 2.2.3 Related Products add to cart button issue

texts:
i'm just wondering if anybody faced with following issue.
I have enabled "add to card" button on my Related products as per this
article

Now button appeared but the problem is that is actually does not work, it point just to checkout/cart/ link

will really appreciate any comments, thanks!


texts:
Images are not displaying in magento2.3.1.

https://www.depoto.com/test-product.html

I gave the permissions for media folder 777 already.
We are not using any extension which relates to the product

I have run all the following commands, but no use.

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:flush


texts: Magento 2 : Load admin grid with pre-defined filter

texts:
I looked for hours but I'm not able to pre-filter a default admin grid like the admin product grid.
Does anyone know how to do this ?

Thanks !


texts: How to customize the footer magento 2 custom theme

texts: I have create custom magento 2 theme based on magento blank theme. how can i customize the footer as show image below


texts: How to show base image on minicart in magento2.1.7?

texts:
I want to show base image in minicart and checkout, Right now it is showing thumbnail images in magento2.1.7

I don't have any thumbnail images for my product so I need to point it as base image.

Any help would be appreciated.


texts: Magento2 : I am getting this error when i upload two custom module and css and js file

texts:
I am getting this error on my live site as production mode and I uploaded only two custom module and js and css and two overwrite file in our theme.Below share error as warning showing I apply all command upgrad ,deploy,flush,reindex.

  "Warning:
  include(/home/andrew/public_html/XXXXX.co.uk/var/view_preprocessed/pub/static/vendor/magento/module-theme/view/base/templates/root.phtml):
  failed to open stream: No such file or directory in
  /home/andrew/public_html/XXXXX.co.uk/vendor/magento/framework/View/Result/Page.php
  on line 327"


texts: Magento uploaded images and 777 permissions

texts:
When I upload images from Magento 1.9 products page, they get permissions 777. I also found a few other 777 folders, such as media/catalog/product folders, and cached images.

Also var/cache folders are created with 777, files inside are 600.

I've run the following to make all my folders 644 and all the files 755:

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

After the above, I still get new uploaded images with 777 permissions.

Any ideas?

Update #1: Checked Mage_Cache_Backend_File, files are set on 644 and folders on 755.
Update #2: Checked umask, was 022, also added it to ~/.bashrc, no change.
Update #3: changed umask(0) to umask(022) in index.php.

When I upload a new image, i.e. demo.jpg, then the first folder gets created with 755 params:

media/catalog/product/d 755
media/catalog/product/d/e 777
media/catalog/product/d/e/demo.jpg 777

Edit:

As Fiasco Labs proposed, I searched with Notepad++ inside files for 0777 entries and changed them to 0644 or 0755 depending if files/folders.

It resulted as the first folder created to be 755 and the second folder to 777, but the files inside are now 644. So, issue is almost solved, need to dig a bit more.

So I re-set the permissions from time to time just to be sure it's OK.


texts: How can I filter the products by a custom attribute [text field]?

texts:
I have a map and the products displayed on the list page. Each product has a text attribute to fill pin code.

My question is how can I filter the products by pin code?

on selecting the location in the text box, it has to search the products which match the location pin code.

note: I can't keep the drop-down or multiple for the pin code attribute because I can't add all the pin codes over the country in the options.

Now i need something like this

$collection->addAttributeToFilter('pincode', array('like' => '%560102%'));

but I don't know where to add this code, I need layered navigation filter too


texts:
Is it possible to completely bypass PHP with the magento full page static cache?

With other application such as WordPress that use a full page static cache I write a rule in the webserver that checks the cache folder for the requested route first and if it doesn't exist then it requests the path from PHP.  This gives really good performance and its just ajax calls that stress the server and they can be managed separately.

I can't see anyway to do this with magento.  I have setup magento to work with varnish (provided by hosting) and the response times are OK but it can't take much concurrent usage without drastically slowing down.

I ran xdebug profiler and had a look at cachegrind file and can see that there is a lot of cpu cycles to methods labeled "non-cache".

To my mind if an app contains a full page static cache then it should be possible to serve the pre-compiled page independant of PHP via webserver.

Am I missing anything?


texts: Add select options dynamically to admin form in magento2

texts:
I have created a model.

$fieldset->addField(
        'test1',
        'text',
        array(
            'name' => 'test1',
            'label' => __('Test 1'),
            'title' => __('Test 1'),
            /*'required' => true,*/
        )
    );

  $fieldset->addField(
        "test2",
        "select",
        [
            "label"     =>      __("Test 2"),
            "name"      =>      "test2",
            "values"    =>      [
                ["value" => 1,"label" => __("Option 1")],
                ["value" => 2,"label" => __("Option 2")],
                ["value" => 3,"label" => __("Option 3")],
                ["value" => 4,"label" => __("Option 4")],
                ["value" => 5,"label" => __("Option 5")],
            ]
        ]
    );

This is working well, but i need to add the option values dynamically, that is i need to get the result from one of the custom table and add them as values.

my custom table have the record like below.

  table custom_table;

  id   options

  1   Option 1

  2   Option 2

  3   Option 3

  4   Option 4

  5   Option 5

How to read this table and add the result as value for my admin form field there.

Can anyone look into this and update me your ideas please.

Thanks


texts: Migrate data from Magento ver. 2.3.2 to Magento ver. 2.3.5

texts:
I have a website with Magento ver. 2.3.2 and I need to move data from it to a new website with Magento ver. 2.3.5
I need to copy all (Categories, products, customer, and orders) with corresponding images
Any ideas or ready-made extension I can use to do this
NOTE: the new website has a different theme so I can not take the whole database and replace it


texts: Security Patch SUPEE-8788 - Problem hash_equals Encryption.php

texts:
I applied the patch correctly, but trying to log (admin) in is giving the following error:

error_log:
PHP Fatal error:  Call to undefined function hash_equals() in /app/code/core/Mage/Core/Model/Encryption.php on line 103

Encryption.php on line 103

/**
 * Validate hash against hashing method (with or without salt)
 *
 * @param string $password
 * @param string $hash
 * @return bool
 * @throws Exception
 */
public function validateHash($password, $hash)
{
    $hashArr = explode(':', $hash);
    switch (count($hashArr)) {
        case 1:
            return hash_equals($this->hash($password), $hash);
        case 2:
            return hash_equals($this->hash($hashArr[1] . $password),  $hashArr[0]);
    }
    Mage::throwException('Invalid hash.');
}

I use the following version:

PHP Version 5.3.29

Magento Version 1.9.2.4

I've already done what was suggested in this post, but the problem at the time of logging remains.

Security Patch SUPEE-8788 - Possible Problems?


texts: Magento will not make database backup anymore!

texts:
I have a problem with the backup feature in Magento 1.8.1.0

I can't create backups anymore, using "System - tools - backup". It has been working fine before, but the last month, I will not work anymore.

When I start a backup, I can see it's working, but when it is finish, there is no backup file in the Var folder.

Someone who can guide me here ?


texts: Product details dont display on sales email or invoice

texts:
I don't get the product details of sold item on the invoice of sold email.
Any idea how I can get that right?


texts: How can I create category page for product listing?

texts: Can anyone help me for create page for showing products in one or some category in magento 2.3.1 .


texts: Magento1 How to extract image from content?

texts:
I have static block with below content.

lorem ipsum.

What i have tried so far?

$html = '

lorem ipsum.
';

$dom = new domDocument;
    $dom->loadHTML($html);
    $dom->preserveWhiteSpace = false;
    $imgs  = $dom->getElementsByTagName("img");
    $links = array();
    for($i = 0; $i < $imgs->length; $i++) {
       echo $links = $imgs->item($i)->getAttribute("src");
    }

its give me result :

{{media url=


texts: Magento2 one checkout page button missing

texts:
I have problem with magento checkout page..

After upgrade from magento2.1.8 to Magento2.2.0 i get this issues:

When i add product to cart, if i click to cart, i can't go further, i think that

the cart button is missing from the process page.


texts: Search all products with attributes color & size REST API : Magento 2

texts: How can I filter and get all products which has specific color or size REST API ?


texts:
Can a product be available on multiple stores with multiple views that belong to a single website, for example, on the default website I have created 2 stores: and to each of them 2 views:

Store 1 English
Store 1 Spanish
Store 2 English
Store 2 Spanish

I want some products to be available in both stores and all views, and other products to be available to just one of those stores but to both views. I can't find that functionality. It appears, that a product can be added to all the views of a store or only to one of them and there is no other option ?


texts: how to set default value for multi select field e.g specificcountry?

texts:
I've a field in system.xml

    <field id="specificcountry" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
    <label>Ship to Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
    </field>

but how can i set the default value in config.xml, what is the syntax should be? like the following?

<default>
    <carriers>
        <mymodule>
             <specificcountry>HK,US,AU</specificcountry>
        </mymodule>
    </carriers>
</default>


texts: error 500 after upgrade to 1.9.2.4 from 1.9.2.3

texts:
After after upgrade to 1.9.2.4 from 1.9.2.3, I do not manage to get the site online. Any idea?

2016-03-05T04:01:14+00:00 ERR (3):
exception 'Zend_Mail_Protocol_Exception' with message '
'your host here' does not match the expected structure for a DNS hostname,
'your host here' does not appear to be a valid URI hostname,
'your host here' does not appear to be a valid local network name'
in lib/Zend/Mail/Protocol/Abstract.php:145

Stack trace:

#17 app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#18 app/Mage.php(684): Mage_Core_Model_App->run(Array)
#19 index.php(83): Mage::run('', 'store')
#20 {main}

I do not understad the errolog clearly


texts: Multiselect Attribute created through module can't be set programatically

texts:
I am on a Magento 2.1 installation using a Venus Theme Module called Brands 2.0.
The module creates a product_brand multi select attribute with the following code:
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
        $data = array(
            'group' => 'General',
            'type' => 'varchar',
            'input' => 'multiselect',
            'default' => 1,
            'label' => 'Product Brand',
            'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
            'frontend' => '',
            'source' => 'Ves\Brand\Model\Brandlist',
            'visible' => 1,
            'required' => 1,
            'user_defined' => 1,
            'used_for_price_rules' => 1,
            'position' => 2,
            'unique' => 0,
            'default' => '',
            'sort_order' => 100,
            'is_global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
            'is_required' => 0,
            'is_configurable' => 1,
            'is_searchable' => 0,
            'is_visible_in_advanced_search' => 0,
            'is_comparable' => 0,
            'is_filterable' => 0,
            'is_filterable_in_search' => 1,
            'is_used_for_promo_rules' => 1,
            'is_html_allowed_on_front' => 0,
            'is_visible_on_front' => 1,
            'used_in_product_listing' => 1,
            'used_for_sort_by' => 0,
            );
        $eavSetup->addAttribute(
            \Magento\Catalog\Model\Product::ENTITY,
            'product_brand',
            $data);

Now we are trying to add products through an API, and everything is working fine except for setting this product_brand attribute. When using:
$product->setData('product_brand', $authCSV);

where $authCSV is a CSV list of option IDs. This works for other multi selects but not for product_brand. No errors are thrown but the attribute does not get saved along with the rest of them.
Any help would be appreciated.


texts: Should I use dynamic variables in cache tags?

texts:
TL;DR

Can/should cache tags in Magento be dynamic?

Background

I'm creating a CMS integration from an external CMS into Magento. The data is stored in Elasticsearch in AWS. I have a custom controller which the page's URL is rewritten to, which uses the URL as a key and loads the data from a custom block I created called content/dynamic.

Now I want to add block caching to it.

I know that the pertinent settings here are the cache tags and the cache key.

I'm thinking of using Mage_Cms_Model_Block::CACHE_TAG as well as the store as base cache tags, then adding a custom cache tag e.g. Me_Content_Model_Dynamic::CACHE_TAG, and the appropriate <global><cache><types> entry for that so that I can clear all cached dynamic content from the Cache Management screen in Magento admin.

One of the features I need to implement is to be able to refresh content caches for the content/dynamic block for a specific CMS page, as well as any content blocks underneath it.

Specifics

I'm thinking of adding another cache tag that is dynamic, e.g. dynamic_content_hashofURLhere to each page's instance of content/dynamic and all child blocks of it, so that I can easily identify dynamic page's cache entries for all content relating to a certain page.

Question

Is this the right way to use the cache tags?

It seems to me to be an easy way to target and invalidate a whole page worth of block cache entries for a page (no matter how many there are) without having to construct the cache key for each content block in the page and invalidate them individually.

Are dynamic cache tags used in the Magento code base already?

Is this best practice?

For clarity - I don't want to be able to clear any of the dynamic cache tags from the Cache Management page. I'd want to do this programatically. From the Cache Management page I'd only target a static cache tag that I add separately from this dynamic one.


texts: Magento 2 how to disable 'add new address' button from customer address book page, in account section?

texts:
I want to disable 'add new address' button from customer account address book and customer account section with checking if my custom module is - enable/disable.

file name is :
vendor\magento\module-customer\view\frontend\templates\address\book.phtml

how can I override it and disable the button and edit/delete address link also?

Thanks


texts: How to send automatically a newsletter when a new product is added?

texts:
my client wants to send automatically a newsletter every time a new product is added. The newsletter should be segmented by categories and stores, so the user has to choose which would subscribe.
Is there any plugin/module as starting point?

thanks


texts:
I need to add a new method to the Product model, those are the files I created:

app/etc/modules/Overrides_All.xml

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

app/code/local/Overrides/Customs/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Overrides_Customs>
            <version>1.0.0</version>
        </Overrides_Customs>
    </modules>
    <global>
        <models>

            <customs>
                <class>Overrides_Customs_Model</class>
            </customs>

            <catalog>
                <rewrite>
                    <product>Overrides_Customs_Model_Product</product>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>

app/code/local/Overrides/Customs/Model/Product.php

<?php
include('Mage/Catalog/Model/Product.php');

class Overrides_Customs_Model_Product extends Mage_Catalog_Model_Product {
    public function isNewProduct() {
        $newFromDate = Mage::getModel('catalog/product')->load($this->getID())->getNewsFromDate();
        $newToDate = Mage::getModel('catalog/product')->load($this->getID())->getNewsToDate();
        $now = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
        if(($newFromDate < $now && $newFromDate != NULL) && ($newToDate > $now || $newToDate == "")){
            return true;
        }
        return false;
    }
}

Everything looks good, but my custom model is not loaded. Where is the problem?


texts: Magento 2.3.4. Product Description tab is missing

texts: I am using a custom theme by Swissup on my Magento store. The code that used to get all the product related tabs is $block->prepareTabsData() Strangely enough, this is now returning  all the tabs except 'Product Description' which is the first to appear before feature tab. Is there an alternative function to retrieve the tabs?


texts: Can anyone tell how can we use knockout js within custom theme's phtml file with any simple example?


texts: How to decerement the product quantity after place an order?

texts:
I am tring to add multiples of x products in to cart, that is working fine as expected after check out i want to decrement the product quantity, how can i do that? I am using an event observer for this.

  Example:- i have a product which is $2 and i am adding this single
  product to the cart, in the cart it will show customergivenQty(1) x
  multiplier_value(5) x price($2) so the total amount is $10 and the
  quantity which i want to reduce is customergivenQty(1) x
  multiplier_value(5)

class Custom_Module_Modulename_Model_Observer
{
    public function _construct()
    {
    }

    public function getNewPrice()
    {

        $login  = Mage::getSingleton('customer/session')->isLoggedIn();
        $roleId = Mage::getSingleton('customer/session')->getCustomerGroupId();
        $userrole   = Mage::getSingleton('customer/group')->load($roleId)->getData('customer_group_code');
        $userrole   = strtolower($userrole);
        $quote = Mage::getSingleton('checkout/session')->getQuote();
        $cartItems = $quote->getAllVisibleItems();
        foreach ($cartItems as $item) {
            $productId = $item->getProductId();
            $product = Mage::getModel('catalog/product')->load($productId);
        }
        $batch_qty = $product->getBatchQty();
        $actualPrice = $product->getPrice();
        $specialPrice = $product->getFinalPrice();
        if (isset($batch_qty) && $userrole=="retailer") {
            if (isset($specialPrice)) {
                $newprice = $specialPrice*$batch_qty;
            } else {

                $newprice = $actualPrice*$batch_qty;
            }

        } else {
            $newprice= $actualPrice;
        }

        return $newprice;
    }

    public function updatePrice($observer)
    {
        $event = $observer->getEvent();
        $product = $event->getProduct();
        $quote_item = $event->getQuoteItem();
        $new_price = $this->getNewPrice();
        $quote_item->setOriginalCustomPrice($new_price);
        //$quote_item->save();
        $quote_item->getQuote()->save();
        //Mage::getSingleton('checkout/cart')->save();
    }

}

config.xml file look like this

<events>
          <sales_quote_add_item>
              <observers>
                  <Custom_Module_Modulename_model_observer>
                    <type>singleton</type>
                    <class>Custom_Module_Modulename_Model_Observer</class>
                    <method>updatePrice</method>
                 </Custom_Module_Modulename_model_observer>
              </observers>
           </sales_quote_add_item>
      </events>


texts:
Where do I find the valid parameter for setPaymentMethod()?

$quote = Mage::getModel('sales/quote');
$quote->setPaymentMethod('adyen_hpp');

setPaymentMethod('checkmo') did work find but I disabled this option and replaced it with the adyen module. Where do I find the correct parameter now?

I tried adyen_hpp because of

class Madia_Adyen_Model_Adyen_Hpp extends Madia_Adyen_Model_Adyen_Abstract {

    protected $_code = 'adyen_hpp';

Also there is a config.xml that might be involved?

<default>
    <payment>
        <adyen_hpp>
            <customer_id backend_model="adminhtml/system_config_backend_encrypted"/>
            <currency>EUR</currency>
            <model>adyen/adyen_hpp</model>
            <title>Adyen HPP</title>
            <logofilename></logofilename>
            <secret_wordt></secret_wordt>
            <secret_wordp></secret_wordp>
            <delivery_days>14</delivery_days>
            <ws_username_test></ws_username_test>
            <ws_password_test></ws_password_test>
            <ws_username_live></ws_username_live>
            <ws_password_live></ws_password_live>
            <order_status>processing</order_status>
            <payment_pending>pending</payment_pending>
            <payment_authorized>processing</payment_authorized>
            <allowspecific>0</allowspecific>
            <disable_hpptypes>0</disable_hpptypes>
        </adyen_hpp>


texts:
I have a multi-store magento install and I am trying to find out how can I assign a CMS page to multiple store.

I created a CMS page which is let say FAQ. Accessible from store1.com/faq.
I want the exact same page to be accessible from store2.com/faq.

How can I do that via the backend?

Thanks a lot for the help.

Below, I cant see any Store View selection.


texts: To generate a new report, the admin selects 1 or more products and/or 1 or more categories, sets the (order) date from and date to. create custom Reports extension for this any idea related to this


texts:
We have a third party vendor that is working on fixing an extension that has been problematic from the beginning. The extension works fine on their staging server but when I upload it to QA it on our main stage it has issues. This vendor says that they traced the issue back to modifications to one of the core files by the company that built and hosts the site for us. This is the path to the file:

app/code/core/Mage/Core/Model/Config.php

The change they point to is here:

foreach ($events as $event) {
   $eventName = strtolower($event->getName());

This is the original code:

foreach ($events as $event) {
    $eventName = $event->getName();

Apparently the modified version causes all JavaScript events to be converted to lower case (hence the strtolower function) which would  definitely create problems for any function or variable that wasn't strictly lower case. That all seems to make sense, but it seems odd that after a full year of the site being live this is the first time it's been an issue. We've had a few other vendors work on projects for us and it hasn't come up. Obviously, core file changes are rarely a good thing and this definitely seems like it could be an issue moving forward.

So my question is:

How significant is this alteration? Will it have an impact on future updates or new extension installations?
Is changing a core file like this a totally unacceptable solution or is there a justifiable reason to do so in this case?
Anyone care to speculate on what could have been the reason this change was made?

(I realize this is partially a subjective response and doesn't completely fit the mission statement of this site but I don't know where else to pose this question.)

Thanks in advance...


texts: How to Change URL of Magento Site After Modifying Apache DocumentRoot?

texts:
My question is similar to How to do redirect the URL of site but I want to do the opposite. And there is a further challenge or two I cannot understand yet.

Our setup is a Magento 2.3.3 store running on a dedicated (not shared) Linux host. We have full root access and can edit all files as needed. The httpd server is Apache 2.4.41.

Upon advice received recently, we followed this procedure:

Modify docroot to improve security | Magento 2 Developer Documentation

Now the Magento site is served at https://www.example.com/ and it is working correctly. The Magento DocumentRoot is /var/www/html/magento2/pub/. All is good for that step. But we cannot reconcile that step with the next steps we need to accomplish.

We will be installing WordPress at /var/www/html/wordpress/. And we will have Question2Answer at /var/www/html/q2a/.

We need to accomplish the following:

Magento store landing page served at https://www.example.com/shop
WordPress blog page served at served at https://www.example.com
Question2Answer landing page served at https://www.example.com/qa

I know about Apache Alias directives and reviewed this answer but the following approach does not meet our goals:

<IfModule alias_module>
    Alias /shop     /var/www/html/magento2/pub/
</IfModule>

While the URI https://www.example.com/shop works, the problem is that https://www.example.com also serves the Magento site. We want the WordPress blog to be served at https://www.example.com.

How can we accomplish our goal with Magento and our two other virtual hosts (all at the same domain www.example.com)?

All pages are served via HTTPS exclusively using a Let's Encrypt certificate. Here are the current virtual host files (only Magento is installed so far).

<VirtualHost *:80>
        ServerAdmin webmaster@example.com
        DocumentRoot "/var/www/html/magento2/pub/"
        ServerName www.example.com
        Redirect permanent / https://www.example.com
</VirtualHost>

<IfModule alias_module>
        Alias /shop     /var/www/html/magento2/pub
</IfModule>

<Directory "/var/www/html/magento2/pub/">
        AllowOverRide None
        Include /var/www/html/magento2/pub/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/errors">
        AllowOverRide None
        Include /var/www/html/magento2/pub/errors/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/media">
        AllowOverRide None
        Include /var/www/html/magento2/pub/media/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/media/customer">
        AllowOverRide None
        Include /var/www/html/magento2/pub/media/customer/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/media/downloadable">
        AllowOverRide None
        Include /var/www/html/magento2/pub/media/downloadable/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/media/import">
        AllowOverRide None
        Include /var/www/html/magento2/pub/media/import/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/media/theme_customization">
        AllowOverRide None
        Include /var/www/html/magento2/pub/media/theme_customization/.htaccess
</directory>

<Directory "/var/www/html/magento2/pub/static">
        AllowOverRide None
        Include /var/www/html/magento2/pub/static/.htaccess
</directory>

And for HTTPS:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@example.com
    DocumentRoot "/var/www/html/magento2/pub/"
    ServerName example.com
    ServerAlias www.example.com

    SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
    SSLCipherSuite HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128
</VirtualHost>
</IfModule>


texts: How to assign guest orders to registered customers by email via SQL?

texts:
I'm using this SQL below to manually assign guest orders to registered users.

UPDATE sales_order SET customer_id = {YOUR CUSTOMER ID}, customer_is_guest = 0 where entity_id = {YOUR ORDER ID};
UPDATE sales_order_grid SET customer_id = {YOUR CUSTOMER ID} where entity_id = {YOUR ORDER ID};
UPDATE downloadable_link_purchased SET customer_id = {YOUR CUSTOMER ID} WHERE order_id = {YOUR ORDER ID};

How could I automatically assign every order made by guest users assigned to registered clients by email?


texts: Magento 2.3 - The correct way to get custom attribute

texts: I have added the custom attribute referral_code of type static to the customer entity. The attribute showing up correctly, and I can get/set it in easy way with $customer->getReferralCode() and with $customer->setReferralCode(value). But these methods, of course, don't really exist inside the Customer Model (I think that behind the scene there is some magic method). The problem is that in this way I don't have any hint/intellisense by IDE. The others developer, if they don't know the existence about the attribute,don't receive any suggestion by theirs IDE. So, it's "normal" that this happen or I can extend the Customer Base Model and add the get/set methods of my custom attributes? If it's possible to do this, what are the steps to reach it?


texts:
I added the following code to the head

<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle() ?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<meta name="author" content="Hope Collective" />
<meta property="og:type" content="website"/>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:description" content="<?php echo htmlspecialchars($this->getDescription()) ?>"/>
<meta property="og:image" content="https://hopecollective.com/hope_collective_logo@3x.png"/>
<meta property="og:url" content="<?php echo $this->getCurrentUrl() ?>"/>
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>"/>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@HopeCollect" />
<meta name="twitter:title" content="<?php echo $this->getTitle() ?>" />
<meta name="twitter:description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="twitter:image" content="https://hopecollective.com/hope_collective_logo@3x.png" />
<meta property="fb:app_id" content="125773904784788" />
<?php if($isResponsive){?>
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
<?php }?>
<?php $product = Mage::registry('current_product');
if ($product): ?>
<meta property="og:type" content="product" />
<meta property="og:title" content="<?php echo $product->getName(); ?>" />
<meta property="og:description" content="<?php echo strip_tags($product->getShortDescription()); ?>" />
<meta property="og:url" content="<?php echo $this->helper('catalog/product')->getProductUrl($product); ?>" />
<meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($product, 'image')->resize(300, 300); ?>" />
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>" />
<meta name="twitter:card" content="product">
<meta name="twitter:title" content="<?php echo $product->getName(); ?>" />
<meta name="twitter:description" content="<?php echo strip_tags($product->getShortDescription()); ?>" />
<meta name="twitter:image" content="<?php echo $this->helper('catalog/image')->init($product, 'image')->resize(300, 300); ?>" />
<meta name="twitter:data1" content="$<?php echo number_format($product->getPrice(),2);?>">
<meta name="twitter:label1" content="PRICE">
<meta name="twitter:site" value="@HopeCollect">
<meta property="fb:app_id" content="125773904784788" />
<?php endif; ?>

Its pretty much working fine except for 2 issues with facebook debugger is not calling the correct product image (og:image). Its calling the default og:image which i added above if product part. But the code is working perfectly fine on twitter card validator. Its show the correct product image. Also the og:type comes as website for products.

Any idea where I'm going wrong??


texts:
I want to set the review product list as a 2 column left template.

I currently use this in my review.xml file:

<review_product_list translate="label">
    <label>Catalog Product Reviews List</label>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
<reference name="content">
</reference>
</review_product_list>

But that does not work.
What am I doing wrong?


texts: Remove / Disable extension from Magento Connect

texts:
I have my developer account in Magento Connect. I have two extensions uploaded and now I want one of them to be disabled or removed from my developer listing.

In the Versions tab, I try changing the Show on Frontend value set to No, but no luck.

How can I achieve this ?

Please help.

Thanks.


texts: Magento 2.2(checkout page): Uncaught SyntaxError: Unexpected end of JSON input

texts:
I have read other posts here in this forum but I am having a hard time finding the solution to my problem.

On the checkout page, the shipping method does not show and is only loading forever. (we are using the normal checkout page, not the one step checkout)

  Uncaught SyntaxError: Unexpected end of JSON input
          at JSON.parse ()
          at Object.process (error-processor.js:28)
          at Object. (customer-address.js:61)
          at fire (jquery.js:3232)
          at Object.fireWith [as rejectWith] (jquery.js:3362)
          at done (jquery.js:9842)
          at XMLHttpRequest.callback (jquery.js:10311)


texts:
I have created one attribute "text field" and added

<a href="{{media url='wysiwyg/smartwave/porto/Data_sheets/1.pdf'}}"  target="_blank">Kaifeng Products Overview </a>

in text field but link is not getting created .

I am getting this url:

  http://eeusa.abc.com/%7B%7Bmedia%20url='wysiwyg/smartwave/porto/Data_sheets/1.pdf'%7D%7D


texts: Magento2 Rest API reset password with different store id getting default email template

texts: I am using Rest API to reset password of customer, i have already passed websiteId for different store but when i am getting reset password email, it is coming of default store not the store i have passed, can anyone let me know what should i do? Please find below screenshots for your reference:


texts: Magento 2 Send Admin Customer Registration Email

texts:
I'm trying to set up an observer that sends an email to the admin when a user registers on the website. I am following a tutorial but have hit a dead end. The observer is working correctly however I am getting this error in the browser:

Type Error occurred when creating object: Ubr\NotifyEmail\Observer\SendMailToAdmin

And this error in system.log:

[2019-03-12 07:21:11] main.CRITICAL: Type Error occurred when creating object: Ubr\NotifyEmail\Observer\SendMailToAdmin, Argument 1 passed to Ubr\NotifyEmail\Observer\SendMailToAdmin::__construct() must be an instance of Magento\Framework\Mail\Template\TransportBuilder, instance of Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor given, called in /home/ubuildro/public_html/mag/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 116 [] []

Here is my events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="customer_register_success">
        <observer name="sendmail_toadmin" instance="Ubr\NotifyEmail\Observer\SendMailToAdmin"/>
    </event>
</config>

And my SendMailToAdmin.php

<?php

namespace Ubr\NotifyEmail\Observer;

use Magento\Framework\Event\ObserverInterface;

class SendMailToAdmin implements ObserverInterface
{

    const XML_PATH_EMAIL_RECIPIENT = 'trans_email/ident_general/email';
    protected $_transportBuilder;
    protected $inlineTranslation;
    protected $scopeConfig;
    protected $storeManager;
    protected $_escaper;

    public function __construct(
        \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
        \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\Escaper $escaper
    ) {
        $this->_transportBuilder = $transportBuilder;
        $this->inlineTranslation = $inlineTranslation;
        $this->scopeConfig = $scopeConfig;
        $this->storeManager = $storeManager;
        $this->_escaper = $escaper;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {

        $customer = $observer->getData('customer');

        $this->inlineTranslation->suspend();
        try
        {
            $error = false;

            $sender = [
                'name' => $this->_escaper->escapeHtml($customer->getFirstName()),
                'email' => $this->_escaper->escapeHtml($customer->getEmail()),
            ];
            $postObject = new \Magento\Framework\DataObject();
            $postObject->setData($sender);
            $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
            $transport =
                $this->_transportBuilder
                ->setTemplateIdentifier('3') // Send the ID of Email template which is created in Admin panel
                ->setTemplateOptions(
                    ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, // using frontend area to get the template file
                    'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,]
                )
                ->setTemplateVars(['data' => $postObject])
                ->setFrom($sender)
                ->addTo($this->scopeConfig->getValue(self::XML_PATH_EMAIL_RECIPIENT, $storeScope))
                ->getTransport();
            $transport->sendMessage(); ;
            $this->inlineTranslation->resume();

        }
        catch (\Exception $e)
        {

        }

    }

}

Like I said the observer is working correctly so the error is occuring in SendMailToAdmin.php please help.


texts: Values of attributes not shown frontend after import products

texts:
How can i solve values of attributes not shown frontend.

my excel format :

And my back end have all details :

And my front end look like :


texts: Get Sku, Name and Description Joined With 'Value' from `catalog_product_entity_media_gallery`

texts:
In order to migrate data between ERP systems, I need to rename images to conform to a specific format for the new system, coming from Magento. I'm going to write a script to automate this but need some data to start.

I'm able to pull sku, name and description using the query in this Post

Currently all the paths for file images are in the 'value' column of the catalog_product_entity_media_gallery table.

I'm wondering if there is a way to join the above query with the catalog_product_entity_media_gallery table in order to retrieve the sku, name, description, and image file path.


texts: Auto generate email when customer place the order?

texts:
When i place the order then mail is not generate. My admin panel show:-

Order # 100000091 (the order confirmation email was sent)

Order and Order Comments setting in the System->Configuration->Sale Emails are Enabled Yes.
But i am not receiving the mail to my gmail account.


texts: Magento2: Redirect to dashboard menu in admin panel?

texts:
I have created the custom menu in the admin panel. When I click on menu option then redirect to dashboard.

My Magento v2.0.17

Menu

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
    <add id="Pfay_Contacts" title="Pierre FAY Contacts" module="Pfay_Contacts" sortOrder="20" dependsOnModule="Pfay_Contacts" resource="Pfay_Contacts::contacts"/>
    <add id="Pfay_Contacts::index" title="Pierre FAY Contacts" module="Pfay_Contacts" action="contacts/test/index" parent="Pfay_Contacts" sortOrder="20" dependsOnModule="Pfay_Contacts" resource="Pfay_Contacts::contacts"/>
</menu>

Route

<?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="admin">
    <route id="contacts" frontName="contacts">
        <module name="Pfay_Contacts" before="Magento_Backend"/>
    </route>
</router>

Block Page

<?php
namespace Pfay\Contacts\Block;
use Magento\Framework\View\Element\Template;

class Contactslist extends \Magento\Framework\View\Element\Template
{
public function __construct(Template\Context $context, array $data = array())
{
    parent::__construct($context, $data);
    $this->setData('contacts',array());
}

public function addContacts($count)
{
    $_contacts = $this->getData('contacts');
    $actualNumber = count($_contacts);
    $names = array();
    for($i=$actualNumber;$i<($actualNumber+$count);$i++) {
        $_contacts[] = 'nom '.($i+1);
    }
    $this->setData('contacts',$_contacts);
}
}

Controller

<?php
namespace Pfay\Contacts\Controller\Adminhtml\Test;
use Magento\Backend\App\Action;

class Index extends \Magento\Backend\App\Action
{
public function execute()
{
    die('test admin view');
}
}


texts: where to add meta tag to stop robots/spiders in magento site

texts:
In magento site, 32 gb is wasted by "Not viewed traffic includes traffic generated by robots, worms, or replies with special HTTP status codes."

Googlebot alone is using 29.41 gb. I wanted to avoid all these "Robots/spiders" consuming bandwidth.

SO I added robots.txt file :

But I need more security.

Where to add  in magento

to stop all robots/spiders/googlebot to stop indexing or crawling magento site.

Let me know if you need any clarifications.

Thanks in advance.


texts: How can data parameters be passed to a factory create( ) in Magento 2?

texts:
I have this snippet:

// In __constructor arguments:
\Magento\Framework\FlagFactory $flagFactory
...
// This is not called in __constructor:
$flag = $this->flagFactory->create(['flag_code' => 'something']);
var_dump($flag->getFlagCode());

It displays null.
I var dumped into Magento\Framework\Flag::_construct() this var_dump($this->getData('flag_code')); exit; and still null.

Anyone has an ideea how to set a parameter in $data array of the create() function ?
I'm in developer mode.
The object manager factory would be Magento\Framework\ObjectManager\Factory\Dynamic::create


texts: Pagination missing in Magento 2.1.9 category pages

texts:
I've reviewed similar posts about this topic but none seem affiliated. It seems like after I disabled a few products that pagination disappeared. I also cant see pagination options in the backend at

  stores > configuration > general > design


texts: Magento 1.9 - get signed in user detail with token and custom API

texts:
I want to access Logged In user detail with Oauth 1 Token and Custom API.

I have an Angular app that I can log in with OAuth 1 but I need to show Firstname and Lastname and profile picture in my App.

I use Magento Version 1.9


texts: How to Fix the error on saving category in magento 2

texts:
I need to show products of the sub categories in parent category page. To achieve this, i tried setting anchor option in display settings tab of category edit page at backend to Yes. But i get the following error

The value specified in the URL Key field would generate a URL that already exists.
To resolve this conflict, you can either change the value of the URL Key field (located in the Search Engine Optimization section) to a unique value, or change the Request Path fields in all locations listed below:

I am unable to save the category. How to solve this?


texts:
I try to override a router, and I encounter some difficulties.

I try an override in the following way:

In my module2 DI : namespace2/module2/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="{Namespace1}\{module1}\Controller\Router" type="{Namespace2}\{module2}\Controller\Router" />
</config>

In my module2 frontend routes : namespace2/module2/etc/frontend/routes.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="{namespace2}">
            <module name="{namespace2}_{module2}" before="{namespace1}_{module1}" />
        </route>
    </router>
</config>

In my module2 router : namespace2/module2/Controller/Router

<?php
namespace Namespace2\Module2\Controller;

use Magento\Framework\App\RequestInterface;

class Router extends \Namespace1\Module1\Controller\Router
{
    public function __construct()
    {
        die('ok');
    }
}

But after DI compile, my override not works.

Can you help me ? Thanks


texts:
I'm using Ubuntu 18.04 with PHP 7.3.14. I was in my root directory and entered the command bin/magento setup:install and got this error. What is going on?

PHP Fatal error:  Uncaught Error: Cannot instantiate interface Project\Crawler\Api\CrawlerItemRepositoryInterface in /var/www/html/root/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
    Stack trace:
    #0 /var/www/html/root/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Project\\Crawler...')
    #1 /var/www/html/root/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Project\\Crawler...')
    #2 /var/www/html/root/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Project\\Crawler...', NULL, 'crawlerItemRepo...', 'Project\\ImageCr...')
    #3 /var/www/html/root/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Project\\ImageCr...', Array, A in /var/www/html/root/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

I have been looking at these but they didn't work for me:

Magento2: Fatal error: Uncaught Error: Cannot instantiate interface
https://community.magento.com/t5/Magento-2-x-Version-Upgrades/upgrade-to-2-3-2-error-developer-php/td-p/136666
https://community.magento.com/t5/Magento-2-x-Version-Upgrades/upgrade-to-2-3-2-error-developer-php/td-p/136666
Cannot instantiate interface Magento\\Catalog\\Model\\Layer\\FilterableAttributeListInterface


texts: MySQL attribute values auto increment count values of 1

texts:
I require to bulk update a set of attribute values in magento. After some struggle i have come up with the following which updates my attribute values starting with 400100 adding +1 for the next and so on.

I run this in phpmyadmin

SET @i := 400100;
UPDATE catalog_product_entity_varchar
SET value = @i:=@i+1
WHERE attribute_id = 136 AND value !='' ;

After running the above this is partially working but i still have thousands of empty values.

Would anyone have any idea where i am going wrong?

Thanks!


texts:
I want to add a new field consultant name, in the magento signup form. I can simply do that by adding custom field using my module, and overriding these http://www.suncrescent.net/2012/07/magento-login-register-onepage/ template files.

But I don't want to override magento's core template files, instead I want a way using which I can add my templates and override that field only.

Do anyone knows any such way to simply add one field in magento signup form, without touching the core phtml files?

Please check and advise!


texts: Entered details in registration page are getting cleared when user navigates to Edit cart page from order review page

texts:
When iam trying to purchase a product in magento frontend shopping cart as a guest / register user. after entering the details in billing information, shipping information, shipping method, payment information. later in order review form I pressed Edit cart link then goes to add another product in to my cart. then the data entered in billing, shipping information is missed, need to re-enter the data.

I want to maintain these data in session, so that no need to re enter the data.

can you please help me out ASAP...

thanks in advance...


texts:
I'm trying to change a couple error messaging strings on the frontend in 2 places.  First in the regular customer login.

And also in the tooltip in the checkout login.  I've tried editing translations, overriding validation js files and nothing seems to be working.


texts: Magento Fatal error: Class 'Mage_Shoppersettings_Helper_Image' not found in

texts:
I’ve installed an extension, and after installing it started giving me this error:

Fatal error: Class ‘Mage_Shoppersettings_Helper_Image’ not found in /home/default/public_html/app/Mage.php on line 547

even after disabling the extension the error remain, I tried to see if the was something I changed in the Mage.php, but my file is still the same the the default file.

does anyone know what can be causing the problem?


texts: Removing Adminhtml order grid column using layout update

texts:
I'd like to know how to remove a column in the sales order grid using an layout update.

I have the following layout update for add a column to the sales order grid. The Something column gets added as the first column and removeColumn (to remove the Order # column ) action does nothing because when this layout update is performed, there are no columns added yet.

<layout>
    <sales_order_grid_update>
        <reference name="sales_order.grid">
            <!-- removeColumn doesn't work because no columns have been added yet -->
            <action method="removeColumn">
                <columnId>real_order_id</columnId>
            </action>
            <!-- This column gets added as the first column in the grid -->
            <action method="addColumnAfter">
                <columnId>new_column</columnId>
                <arguments>
                    <header>Something</header>
                    <index>new_column</index>
                    <type>text</type>
                </arguments>
            </action>
        </reference>
    </sales_order_grid_update>
    <adminhtml_sales_order_grid>
        <update handle="sales_order_grid_update" />
    </adminhtml_sales_order_grid>
    <adminhtml_sales_order_index>
        <update handle="sales_order_grid_update" />
    </adminhtml_sales_order_index>
</layout>

Is it possible to remove one of the default columns of the sales order grid with a layout update? If so, is this the right XML for it? I know I can remove that column with an observer or by rewriting the appropriate block class, but I'd like to see if an layout update can achieve the same while being as minimally intrusive as possible.

This is the approach I'm taking: http://www.atwix.com/magento/column-to-orders-grid/.


texts:
i have created steps on checkout page and every step has number like 1 2 and 3 now i want to create those number through a loop like

  $i = 1; $i++

how i can do this in KO Js.

image is attached http://prntscr.com/n8x2so


texts: How would I go about prewarming cache for Logged In users?

texts:
We have implemented a Full Page Cache extension as well as a redis backend for cache storage and session storage (separate redis instances). One issue we currently have is that although our basic cache warmer crawls and caches the pages for non logged in users, it doesn't cache it for logged in users.

Currently they way the FPC extension works for logged in users are:
1) User A logs in and visits a number of pages
2) User B logs in and when visiting same pages as User A it is served from Cache.

I am looking for some way that we can crawl and warm the cache for a few specific pages for logged in users (or a specific user group). The reason being some of our products are extremely complicated in terms of customization options so if Magento loads those pages without cache it can take up to 11 seconds versus with cache it's under 3 seconds. This problem is limited to a few products due to the complexity of the product.

Any suggestions or pointer in the right direction on how I could do this is greatly appreciated.


texts: How to create/add a personal model in module-customer in magento 2?

texts: That model will be linked with the table rpt_customer_personal_info will call carry three fields like company, country, mobile. Please provide some help or give the links which can be helpful.


texts:
I have been receiving a 404 on my admin module, after a lot of trouble shooting I realised it was something to do with this block of code in the config.xml file

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <some_module>Some_Module_Adminhtml</some_module>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

To fix the 404 I changed it to this

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <some_module after="Mage_Adminhtml">Some_Module_Adminhtml</some_module>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

This worked but I wanted to understand it.

I tried adding before="Mage_Adminhtml" and expected to receive a 404, instead it worked again.

Why do I need to add a before or after for my page to load? (I'm assuming it loads before or after a core module and it would be used for when one of my module is dependant on one of the core module)

I have always assumed that the admin modules followed the same loading as any other module i.e. local, community, mage (this track of thought had me assuming that before="Mage_Adminhtml" would be the default behaviour).

I have looked through Mage_Core_Controller_Varien_Router_Admin to try and get my answers but couldn't find it and can't think where else to look


texts:
I check some answers here but no one seems to work properly in my case.

I have an magento 2.3 store, that works well in my localhost windows.
When I send to my host site every page except index.php give me whoops 404.

This commands won't work properly:

  php bin/magento setup:upgrade
  php bin/magento setup:static-content:deploy
  php bin/magento cache:clean

If I use mysite.com.br/index.php/otherpage.html it works.

Have some way to chance all the URL to remove index.php from them?


texts: How to get order id using "sales_order_place_after" event

texts:
I have an event Observer for sales_order_place_after

namespace Company\Ordertool\Observer;

use Magento\Framework\Event\ObserverInterface;

class OrderComplete implements ObserverInterface
{
    /**
     * @var ObjectManagerInterface
     */
    protected $_objectManager;

    /**
     * @param \Magento\Framework\ObjectManagerInterface $objectManager
     */
    public function __construct(
        \Magento\Framework\ObjectManagerInterface $objectManager,
        \Magento\Quote\Model\QuoteFactory $quoteFactory,
        \Magento\Sales\Model\Order $order
    ) {
        $this->_objectManager = $objectManager;
        $this->order = $order;
    }

    /**
     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return void
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {

        $order = $observer->getEvent()->getOrder();
        $orderId = $order->getId();

        $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/debug.log');
        $logger = new \Zend\Log\Logger();
        $logger->addWriter($writer);
        $logger->info( $orderId );

    }
}

$order does appear to be the order ... but $orderId is empty. I feel like I'm missing something obvious here...


texts: soap product quantity not updating return exceptions

texts:
In magento1.9 - I am trying to update product quantity using soap but it return error here is my code

 public function update($data){
    //return $data->sku;
    $_sku = $data->sku;
    $_catalog = Mage::getModel('catalog/product');
    $_productId = $_catalog->getIdBySku($_sku);
    $product = Mage::getModel('catalog/product')->load($_productId);
    /*$product->setStoreId($this->_getStoreId())
        ->load($productId);*/
    //return $product->getData();

    if (!$product->getId()) {
        $this->_fault('not_exists');
    }

    if (!$stockData = $product->getStockData()) {
        $stockData = array();
    }

    if (isset( $data->qty)) {
        $stockData['qty'] =  $data->qty;
    }

    if (isset($data->is_in_stock)) {
        $stockData['is_in_stock'] = $data->is_in_stock;
    }

    $product->setStockData($stockData);

    try {
        $product->save();
    } catch (Mage_Core_Exception $e) {
        $this->_fault('not_updated', $e->getMessage());
    }

    return $stockData;

}

then i am getting below erros :

  ==> Error: Uncaught SoapFault exception: [1] Internal Error. Please see log for details. in C:\xampp\htdocs\shubhajay_magentonew\app\code\core\Mage\Api\Model\Server\Adapter\Soap.php:196 Stack trace: #0 C:\xampp\htdocs\shubhajay_magentonew\app\code\core\Mage\Api\Model\Server\Handler\Abstract.php(139): Mage_Api_Model_Server_Adapter_Soap->fault('1', 'Internal Error....') #1 C:\xampp\htdocs\shubhajay_magentonew\app\code\core\Mage\Api\Model\Server\Handler\Abstract.php(48): Mage_Api_Model_Server_Handler_Abstract->_fault('internal') #2 [internal function]: Mage_Api_Model_Server_Handler_Abstract->handlePhpError(256, 'Some transactio...', 'C:\xampp\htdocs...', 4039, Array) #3 C:\xampp\htdocs\shubhajay_magentonew\lib\Varien\Db\Adapter\Pdo\Mysql.php(4039): trigger_error('Some transactio...', 256) #4 [internal function]: Varien_Db_Adapter_Pdo_Mysql->__destruct() #5 {main} thrown


texts: Paypal IPN: issue with `chargeback_settlement` orders (emails do not match)

texts:
IPN is actually failing for all the order in status PayPal Canceled Reversal these orders produce the following errors:

Requested  and configured mymail@mail.com merchant emails do not match. in .../Model/Paypal/Ipn.php:257 ( Mage_Paypal_Model_Ipn::_verifyOrder())

Looking a the request I can see the correct email is present but it is stored into payer_email while the _verifyOrder() is checking for values stored in business or receiver_email

I'm quite sure this is a bug in Magento IPN.

Can somebody confirm if experience the same issue ?


texts:
What does this line in di.xml do?

<type name="Magento\Framework\Search\EntityMetadata" />

It's just a type tag that closes immediately. There are no arguments passed to it, no plugins declared inside it...nothing. Just a type with a name.

I have a strong feeling that this does nothing and it's just a forgotten line, but I want to make sure.


texts: Invalid template file issue in Magento 2.3

texts:
I am seeing invalid template file error

  Invalid template file: 'Sam_Options::after_nav_banner.phtml' in module: '' block's name: 'header.right.custom.area'

I have tried doing view in small letters and View in camel case letters but nothing works , I have tried template and templates both but no success .

  .phtml file is in Sam/Options/view/frontend/templates/after_nav_banner.phtml

I have cleared cache delete cache folders tried everything.
What can be the issue?

Block code is this:

<block class="Magento\Framework\View\Element\Template" name="header.right.custom.area" template="Sam_Options::after_nav_banner.phtml" after="navigation.sections">

template file C:\xampp\htdocs\learnm2\app\code\Sam\Options\view\frontend\templates\after_nav_banner.phtml
xml file
C:\xampp\htdocs\learnm2\app\code\Sam\Options\view\frontend\layout\default.xml


texts: Magento 2 cannot update module with composer

texts:
I'm trying to update a module from Mageworx , currently I have the version 2.31.0, it's "mageworx/module-seosuiteultimate": "^2.30", there is not something like an specific module called module-seosuiteultimate in vendor folder.
So everytime I try to update it to version 2.31, with this commad:
composer require mageworx/module-seosuiteultimate:2.31

It throws this error:
Problem 1
    - Installation request for mageworx/module-xmlsitemap (locked at 3.0.4) -> satisfiable by mageworx/module-xmlsitemap[3.0.4].
    - mageworx/module-seosuiteultimate 2.32.2 requires mageworx/module-xmlsitemap 3.2.1 -> satisfiable by mageworx/module-xmlsitemap[3.2.1].
    - Conclusion: don't install mageworx/module-xmlsitemap 3.2.1
    - mageworx/module-seosuiteultimate 2.32.0 requires mageworx/module-xmlsitemap 3.2.0 -> satisfiable by mageworx/module-xmlsitemap[3.2.0].
    - mageworx/module-seosuiteultimate 2.32.1 requires mageworx/module-xmlsitemap 3.2.0 -> satisfiable by mageworx/module-xmlsitemap[3.2.0].
    - Conclusion: don't install mageworx/module-xmlsitemap 3.2.0
    - Installation request for mageworx/module-seosuiteultimate ^2.32 -> satisfiable by mageworx/module-seosuiteultimate[2.32.0, 2.32.1, 2.32.2].

So then I try to update mageworx/module-xmlsitemap to the version that is required 3.2.1. and it showes me this error:
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - mageworx/module-seosuiteultimate 2.30.4 requires mageworx/module-xmlsitemap 3.0.4 -> satisfiable by mageworx/module-xmlsitemap[3.0.4] but these conflict with your requirements or minimum-stability.
    - mageworx/module-seosuiteultimate 2.30.4 requires mageworx/module-xmlsitemap 3.0.4 -> satisfiable by mageworx/module-xmlsitemap[3.0.4] but these conflict with your requirements or minimum-stability.
    - mageworx/module-seosuiteultimate 2.30.4 requires mageworx/module-xmlsitemap 3.0.4 -> satisfiable by mageworx/module-xmlsitemap[3.0.4] but these conflict with your requirements or minimum-stability.
    - Installation request for mageworx/module-seosuiteultimate (locked at 2.30.4, required as ^2.30) -> satisfiable by mageworx/module-seosuiteultimate[2.30.4].

So practically, I cannot update any of those 2 modules, what is going on?
Thanks!


texts: How to add a custom field in customized checkout step?

texts:
I have referred the below link for adding a custom field in the checkout

http://vagento.com/magento-2-add-custom-field-checkout-address-form/

It's working fine. How to do the same in a customized checkout step?.

Please reply with your suggestion.


texts: Need to get gift card Id or gift card code from order id

texts:
I need to get a gift card Id or gift card code from order id.
Need to match the data between giftcards_card & sales_order_item.

Basically, I need to upload data from live_giftcards_card like recipient email, recipient name, order id, etc to the sales_order_item table inside product_options column.

Here live_giftcards_card is table of M1 & sales_order_item is table of M2


texts: Get sample File URL for downloadable product in Magento 2

texts: How to get sample file url for a downloadable product


texts: Magento 2 - How to show tax and shipping costs in mini-cart pop up

texts: How to show tax and shipping costs in mini cart popup in Magento 2?


texts: Cannot edit order or send the email from "sales - orders" inside admin

texts:
We updated to magento 1.9.2.1 but now we can't edit any order or send the email from the order itself inside "sales - orders"; what could be the reason? CronJobs are working properly.
When I click "edit order" or "send email" inside Firefox error console I read:

  SyntaxError: missing ) after argument list


texts: How to validate quantity being added to cart from frontend?

texts:
I'm trying to validate and correct quantities of certain products being added from the frontend. I've found the checkout_cart_save_before event that fires during all frontend cart modifications. This is good, but I'm trying to see if there's a better and more efficient way of doing this, as, when listening to this event, I'll have to iterate through all of the products each time the cart is updated. This event also fires twice during a single cart update.

I've thought about rewriting specific controller actions, but that can be too intrusive as some actions don't have a convenient events to listen to modify quote item quantities.

There's also a Javascript method for each of the pages.. I understand the answers may be kind of an opinion, but I'd still like to obtain some feedback on this.


texts: Magento2: Remove product image magnifier for bundle products only

texts: How can I remove image magnifier for bundle products only.


texts: Efficient & Productive Way of Uploading Products

texts:
I am looking for some advice and tips on how to go about uploading hundred of thousands of products onto a Magento store in my lifetime.

Today, I discovered Magmi which is a godsend for uploading CSV files at a fast speed however it still requires you to manually enter in the data. I have timed myself for each product I add, and on average I take about 5 minutes. I have quite a few extra product attributes :) So if you do the math, 5 minutes times lets say 10,000 products or more, well you get the idea.

I'm thinking of hiring a freelancer that will write a script to scrape the appropriate data from my suppliers and export it as a CSV file however since I have quiet a few suppliers this might be expensive. Also some of my suppliers provide spreadsheets of their products, while some don't.

Is there an efficient and productive way of accomplishing a task like this?


texts: Get Sql Query LoggerAbstract in Observer M2

texts:
How to get Sql Query LoggerAbstract to find bind value of last column update.
I try to use LoggerAbstract Code to my Observer, but I just got like this.

## 7435 ## a ** TIME: 0.1047

Not like i want.

## 2018-02-06 06:41:10
## 7816 ## QUERY
SQL: SELECT `catalog_product_entity`.`entity_id` FROM
`catalog_product_entity` WHERE (sku = :value)
BIND: array (
   ':value' => 'PALELU',
)
AFF: 0
TIME: 0.0245

I want to get some BIND value  'PALELU'.

Here is my Observer Code.

Getstats (from LoggerAbstract)

public function getStats($type, $sql, $bind = [], $result = null)
{
    $sbind = var_export($bind, true);
    $holiShit = $sbind[0];
    //$getBind = $bind->value;
    $message = '## ' . getmypid() . ' ## ' . $holiShit . ' ** ';
    $nl   = "\n";
    $time = sprintf('%.4f', microtime(false));

    if (!$this->logAllQueries && $time < $this->logQueryTime) {
        return '';
    }
    switch ($type) {
        case self::TYPE_CONNECT:
            $message .= 'CONNECT' . $nl;
            break;
        case self::TYPE_TRANSACTION:
            $message .= 'TRANSACTION ' . $sql . $nl;
            break;
        case self::TYPE_QUERY:
            $message .= 'QUERY' . $nl;
            $message .= 'SQL: ' . $sql . $nl;
            if ($bind) {
                $message .= 'BIND: ' . var_export($bind, true) . $nl;
            }
            if ($result instanceof \Zend_Db_Statement_Pdo) {
                $message .= 'AFF: ' . $result->rowCount() . $nl;
            }
            break;
    }
    $message .= 'TIME: ' . $time . $nl;

    $message .= $nl;

    return $message;
}

Execute

public function execute(Observer $observer)
{
   $fuckthis = $this->getStats($bind = [],$result = null);
   $options = array(
        "email" => $userEmail,
        "information"   => $fuckthis
    );

    $getLog = json_encode($options);
    $this->_customLoggerHelper
            ->log(
                $getLog
            );
 }

I don't know how to get BIND value like SqlQuery Log with di.xml.

Thank's in Advance


texts: Magento 1 end of life - where can I download Magento 1.5.1 patch to run PHP 5.4?

texts:
Magento has just removed all support to 1.* as it reached end of life. I need to create an tests environment like my client that uses 1.5.1. I understand that it is way too old but it is his choice to use old versions.
Anyone knows where can I get the patch to make Magento 1.5.1 work with PHP 5.4 ?
Thanks !


texts: Add Option or Custom Option To Cart Without Adding It To Product In Admin Programatically

texts:
Is there a way to add a custom option to cart without first adding it to the product in the admin and saving it? I want to programatically add a note that shows on checkout below the product (just like custom options do) but I don't want to add this custom option to all products in the admin. If I can't do it like this, any suggestions? I want the info to show on emails and in the admin order view too.

I want something on cart like:

Product Name

 Custom Label: Custom Value

I have this code, but it doesn't allow adding a custom option if it doesn't already exist, so I don't know if it's possible:

$params = array(
        'product'   =>  $id,
        'qty'       =>  $qty,
        'options'   =>  array(
            1       =>  'value 1', // works cause is saved to product on edit product
            'Custom Label' => 'custom value' // doesn't work
        )
    );

    $request = new Varien_Object();
    $request->setData($params);
    $cart->addProduct($product,$request);
    $cart->save();
    Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
    $this->_redirect('checkout/cart');


texts: How Does Magento Include the admin-icons.svg File?

texts:
In Magento 2, the icons for the backend Menu are Unicode code points that are part of the Private User Area code point range, and appear to be defined via the file

vendor/magento//theme-adminhtml-backend/web/fonts/admin-icons/admin-icons.svg

How does admin-icons.svg get included into a Magento Admin Page's "font space" (for lack of a better word).


texts:
I am new to Magento.

I am trying to make changes in CMS homepage.

The page looks like this:

I am able to change page title and heading from cms_page table.

But not able to find way to change the icon containing Luma by replacing it with image I have.

How should I proceed with that?


texts: Magento 2 Customize price sent to Paypal Express Checkout

texts:
I have not found nowhere a solution for my problem, so i'll ask to this beautiful community directly. I'm trying to customize the Paypal Express Checkout cause for our payments we have a Different Payment Provider from Magento, so all I need is to peel off the BAID ( Billing Agreement Identification ) code from Paypal and pass it to my Payment Provider that will sent all the payments directly on the Paypal account of the client.
I've already configure Paypal Express on my site, I've configure Paypal Express Checkout with Payment Action -> Authorization and in Advanced setting Billing Agreement Signup -> Auto , cause i want only to take the Billing Agreement ID from Paypal. I have sandbox credentials for now.
What I want to do is to display the product in the cart without change his price, after a customer click on Paypal Express Checkout button and the Paypal pop-up shows up, i want that the Authorization order of Paypal set product price at 0, so after that I can send that authorization order and detach the BAID, after which I will send it to my Payment Provider who will continue with everything else.
I've tryed different solutions, like :
https://webkul.com/blog/add-custom-pricefee-order-total-magento2/ -> setting a custom Price Fee but i recieved this error :

[2021-03-11 14:16:56] main.CRITICAL: PayPal NVP gateway errors: The
totals of the cart item amounts do not match order amounts (#10413:
Transaction refused because of an invalid argument. See additional
error messages for details). Correlation ID: 1630fdd2edef9. Version:
72.0

so after that i've tried this :
https://webkul.com/blog/manage-custom-amount-paypal-magento2/ -> but it doesn't work for me cause I receive the same error and it's also not a solution that suite my case.
I also tried to modify the paypal sdk code to be able to insert the value of the product to 0 manually, although it is not an optimal solution, but it doesn't work that way either.
Someone could help me to find a solution?
Thanks in advice for everyone!


texts:
I recently updated my Magento store from 1.5.1 to 1.9.2.3 and noticed a weird error. When I add an item to my shoppingcart, the amount is being doubled:

This didn't happen before the update. I tried turning off my modules (and clearing my cache) but this didn't work. I've seen a lot of issues like this, but it seems like there aren't really any answers. Also a lot of people seem to experience this sporadically, but it happens to me all the time; it doesn't matter whether I'm logged in or not or something like that.

How do I fix this problem?


texts: Get list of all modules using code in Magento 2

texts:
I am working on creating a base module for all other modules under one namespace.

I want to show a list of all modules (with their version and their status as enabled or disabled).

I have injected dependency of \Magento\Framework\Module\ModuleListInterface in my block file, but I am not getting the module in the list if I disable it.

I have tried getAll() and getNames() functions. No function is returning disabled module names in the list.

Previously it was possible to get the list of all modules because there was a section in admin panel (Advanced), where all modules were listed with respective module output.

Kindly help me to get the list of all modules.


texts: Can't upload images in backend, buttons missing

texts: Can someone please help? In the backend of my magento store the button allowing me to download/upload images has disappeared so I cannot upload new images for the products that I add. For exsiting products I can see the image on the frontend but no image is showing in the backend. Any ideas?


texts: Is it possible to setup magento databse without the php files stucture?

texts:
I have the following archtecture to a simple load balance magento store that I made with NGINX.

So far I have created a round-robin mechanism with NGINX in mySIte.com that redirects the client (user) to the srvMag-1, srvMag-2, srvMag-n,srvMag-1, srvMag-2, srvMag-n, ...,  etc (round-robin).

As I am not specilalist in Magento (I am a begginer), my point now is if it is possible to create a server to deal only with the magento databse? The idea is to set srvMag-1, srvMag-2, srvMag-n point to that server db.

If is that possible how to setup only a databse for magento, without to setup the php files and in the other hand how to setup only the magento php files without the database?

To be clear:

In srvMag-1, srvMag-2, srvMag-n I will only need the complete structure (php files, etc) but I dont want the database.
In srvDB I only need the databse, but not the complete structure (php files, etc).


texts: If I type in the search box as HP then the search results not showing. I have products already as HP laptops and accessories. Can you guys help me, please?


texts: Mageplaza SMTP: 5.7.9 Application-specific password required

texts:
After install Mageplaza SMTP on Magento 2.3.3 i got this issue. Please help.
5.7.9 Application-specific password required.
Learn more at 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor m3sm778013pjs.22 - gsmtp


texts: Issues updating Magento 2 Extension Namespace to uppercase

texts:
I think there were previous issues with Magento 2 allowing extensions namespaces to be lower case when we initially submitted ours. But now, it seems that Magento 2.2.x enforces uppercase first character, as we got this error:

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'class': [facet 'pattern'] The value 'vendorname\extensionname\Block\BlockName' is not accepted by the pattern '[A-Z][_a-zA-Z\d](\[A-Z][_a-zA-Z\d])'.*

However, when we updated our extension code to use uppercase everywhere (except the name in the composer.json file), our extension can't seem to find the various classes we now have within Model and Block, and got the following error after compiling:

PHP message: PHP Fatal error: Class 'Vendorname\Extensionname\Block\BlockName' not found in /var/www/magento89/generated/code/Vendorname/Extensionname/Block/BlockName/Interceptor.php on line 7" while reading response header from upstream

The code for the Block in question looks like this (fairly straight forward):

<?php

namespace Vendorname\Extensionname\Block;

class BlockName extends \Magento\Catalog\Block\Product\AbstractProduct
{
    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        array $data = []
    ) {
        parent::__construct($context, $data);
    }

    public function getProductsCollection()
    {
        $block=$this->getLayout()->getBlock('category.products.list');
        return $block->getLoadedProductCollection();
    }
}

Edit: adding in the Interceptor code

<?php
namespace Vendorname\Extensionname\Block\BlockName;

/**
 * Interceptor class for @see \Vendorname\Extensionname\Block\BlockName
 */
class Interceptor extends \Vendorname\Extensionname\Block\BlockName implements \Magento\Framework\Interception\InterceptorInterface
{
    use \Magento\Framework\Interception\Interceptor;

    public function __construct(\Magento\Catalog\Block\Product\Context $context, array $data = array())
    {
        $this->___init();
        parent::__construct($context, $data);
    }

    /**
     * {@inheritdoc}
     */
    public function getImage($product, $imageId, $attributes = array())
    {
        $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage');
        if (!$pluginInfo) {
            return parent::getImage($product, $imageId, $attributes);
        } else {
            return $this->___callPlugins('getImage', func_get_args(), $pluginInfo);
        }
    }
}

Is there somewhere in the database that might contain the old namespace somewhere, and it's using that instead of the new updated uppercased namespace?

Any help would be greatly appreciated!


texts: How to add pagination at top and bottom of the product page in magento 2

texts: Please help on adding pagination at top and bottom of the product page in magento 2 .


texts: How to get second field value from data base based in first field id in magento2 admin block form?

texts:
here i get the layer id in drop down now i have get layer type in second field in based on layer is select

can any one help me how can i do that.i try
    $fieldset->addField(
        'layer_id',
        'select',
        [
            'name' => 'layer_id',
            'label' => __('Layer Name'),
            'title' => __('Layer Id'),
            'required' => true,
            'values'=> $layer_data,
            'disabled' => $isElementDisabled
        ]
    );

     $fieldset->addField(
        'layer_type',
        'text',
        [
            'name' => 'layer_type',
            'label' => __('Layer Type'),
            'title' => __('Layer Type'),
            'readonly' => true,
            'disabled' => $isElementDisabled
        ]
    );


texts: Magento 2 - Error displaying Shipping Rates with UPS XML configuration

texts:
I am trying to setup UPS XML method for Shipping Rates, and it seems to work for any address in California. When I try an address outside of California, I do not get any shipping rates back.

So I looked at the Magento debug.log and saw the below response. My assumption is that it is replacing the StateProvinceCode for CA when its sending the request to UPS.

I looked at the following link https://github.com/magento/magento2/issues/6875 thinking the issue could be fixed, but its still ignoring the region in the Shipping Method.

'accessRequest' => '<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
  <AccessLicenseNumber>XXXXXXXX</AccessLicenseNumber>
  <UserId>****</UserId>
  <Password>****</Password>
</AccessRequest>
',
  'request' => '<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
  <Request>
    <TransactionReference>
      <CustomerContext>Rating and Service</CustomerContext>
      <XpciVersion>1.0</XpciVersion>
    </TransactionReference>
    <RequestAction>Rate</RequestAction>
    <RequestOption>Shop</RequestOption>
  </Request>
  <PickupType>
          03
          <Description>Customer Counter</Description>
  </PickupType>

  <Shipment>      <Shipper>      <Address>
          <City></City>
          <PostalCode>90034</PostalCode>
          <CountryCode>US</CountryCode>
          <StateProvinceCode>CA</StateProvinceCode>
      </Address>
    </Shipper>
    <ShipTo>
      <Address>
          <PostalCode>28607</PostalCode>
          <CountryCode>US</CountryCode>
          <ResidentialAddress>01</ResidentialAddress>
          <StateProvinceCode>CA</StateProvinceCode><ResidentialAddressIndicator>01</ResidentialAddressIndicator>      </Address>
    </ShipTo>

    <ShipFrom>
      <Address>
          <PostalCode>90034</PostalCode>
          <CountryCode>US</CountryCode>
          <StateProvinceCode>CA</StateProvinceCode>
      </Address>
    </ShipFrom>

    <Package>
      <PackagingType>00</PackagingType>
      <PackageWeight>
         <UnitOfMeasurement>LBS</UnitOfMeasurement>
        <Weight>8</Weight>
      </PackageWeight>
    </Package>  </Shipment>
</RatingServiceSelectionRequest>',
  'result' => '<?xml version="1.0"?>
<RatingServiceSelectionResponse><Response><TransactionReference><CustomerContext>Rating and Service</CustomerContext><XpciVersion>1.0</XpciVersion></TransactionReference><ResponseStatusCode>0</ResponseStatusCode><ResponseStatusDescription>Failure</ResponseStatusDescription><Error><ErrorSeverity>Hard</ErrorSeverity><ErrorCode>111285</ErrorCode><ErrorDescription>The postal code 28607 is invalid for CA United States.</ErrorDescription></Error></Response></RatingServiceSelectionResponse>


texts: Magento 2 : Product details page loading slowly?

texts:
In the site category page loading properly but when click on product detail page it's loading too slow. I have been checking exception log and it throws following error.

main.CRITICAL: The element 'product.info.options' already has a child with alias 'text' {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element 'product.info.options' already has a child with alias 'text' at /home/shavershop/public_html/vendor/magento/framework/Data/Structure.php:611)"} []

can you help on this issue? It will be great.


texts: Bulk delete product images from a single category

texts:
I had a csv upload issue, and now one category of products has 4 of the same image. How can I bulk delete images form these 1000 products?
Thanks


texts: When Going To Sales > Orders Page, Magento Crashes with 500 Error

texts:
When going to the Sales Orders page (Sales > Orders) I receive an 500 Internal Server Error. I found one post which appears similar in that it discusses this problem, but which doesn't seem to really address my problem fully:

https://stackoverflow.com/questions/12466312/magento-site-crashes-when-going-to-the-sales-orders-page

Checking the PHP logs, I can reproduce the following error when going to the Sales Orders page:

 PHP Fatal error:  Call to a member function setSaveParametersInSession() on a non-object in /data/html/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php on line 66

I've found a number of references while researching this error; however they refer to the problem resulting from a custom grid and this error I believe is coming from a stock install. Here is one such article:

 http://magento.stackexchange.com/questions/43343/magento-fatal-error-setsaveparametersinsession-on-a-non-object

Can anyone give me some pointers on how to move forward? This is Magento ver. 1.14.2.1, running on a 64 bit CentOS box.


texts: Changes to CSS and JavaScript applies only after deploying static content

texts:
I installed Magento 2 from the Magento site. I have activated the developer mode by

{project directory}>php bin/magento setup:mode:set developer

Then I have installed my custom theme and finally I deployed my static content by

{project directory}>php bin/magento setup:static-content:deploy

My problem is I have to delete pub/static directory and deploy static content every time to apply the css and javacript changes. The static content deploy process is slow and taking so much time that it is very frustrating. I develop something and have to deploy to get the change to be appeared. Even for very small change. Flushing cache is not helping. Any help would be appreciated. Thanks in advance.


texts: How to make radio button active on load?

texts:
I have a few radio buttons on the checkout page, I want one of them to be checked on page load. How can I do that?
   <input type="radio"
               name="payment[method]"
               class="radio"
               data-bind="attr: {'id': getCode()}, checked: isChecked, click: selectPaymentMethod, value: getCode(), visible: isRadioButtonVisible()" />

I tried to add checked attribute and isChecked: true, it didnt work, the page still loads with all radio buttons unchecked.


texts: I want to override an xml file of an extension module into my custom module, how can I do it?