texts: Magento 2 How to save category selector data for custom module?

texts:
I've used below code to show category selector on custom module. Its show wihout any error. Below is code for showing category selector on form.

$fieldset->addType(
        'categories',
        '\Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category'
);

$fieldset->addField(
        'category',
        'categories',
        [
            'name' => 'category',
            'label' => __('Category'),
            'title' => __('Category')
        ]
    );

I've save data using controller using below code as its array i need to convert it in string to save.

if ($data['category']):
  $data['category'] = implode(",",$data['category']);
endif;

its saved successfully. but when i edit data its thorow me error.

[2017-05-03 12:54:58] report.CRITICAL: exception 'Exception' with message 'Notice: Array to string conversion in /var/www/html/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2930' in /var/www/html/magento/vendor/magento/framework/App/ErrorHandler.php:61

Am i missing something here?

Update:

below is form code:

class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface
{
     /**
     * @var \Magento\Cms\Model\Wysiwyg\Config
     */
    protected $_wysiwygConfig;

    /**
     * @var \Magento\Store\Model\System\Store
     */
    protected $_systemStore;

    /**
     * @param \Magento\Backend\Block\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Framework\Data\FormFactory $formFactory
     * @param \Magento\Store\Model\System\Store $systemStore
     * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
     * @param array $data
     */

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Data\FormFactory $formFactory,
        \Magento\Store\Model\System\Store $systemStore,
        \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
        array $data = []
    ) {
        $this->_systemStore = $systemStore;
        $this->_wysiwygConfig = $wysiwygConfig;
        parent::__construct($context, $registry, $formFactory, $data);
    }

    public function getTabLabel()
    {
        return __('Item Information');
    }

    public function getTabTitle()
    {
        return __('Item Information');
    }

    public function canShowTab()
    {
        return true;
    }

    public function isHidden()
    {
        return false;
    }

    /**
     * Prepare form before rendering HTML
     *
     * @return $this
     */
    protected function _prepareForm()
    {
        $model = $this->_coreRegistry->registry('current_kensium_advisor_items');
        /** @var \Magento\Framework\Data\Form $form */
        $form = $this->_formFactory->create();
        $form->setHtmlIdPrefix('item_');
        $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Item Information')]);
        if ($model->getId()) {
            $fieldset->addField('id', 'hidden', ['name' => 'id']);
        }
        $fieldset->addType(
        'categories',
        '\Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category'
       );

    $fieldset->addField(
            'advisor_name',
            'text',
            [
                'name' => 'advisor_name',
                'label' => __('Name'),
                'title' => __('Name'),
                'required' => true
            ]
        );

Update:
I've updated code here for module.

https://github.com/kul3101/Category-Selector/tree/master/Test/Category/app/code/Test/Category


texts:
We are using Magento 2.4.1 Enterprise Edition with B2B. Is Magento PWA venia setup support B2B features out of the box? or do we need to integrate separately?
Also, please provide a list of PWA that supports Magento 2 B2B.


texts: M2.3 - Best practice for adding CSS and js for CMS Block

texts:
I have added CSS design for a CMS block in the same block,

Welcome to store

Her is my text

Read More

how to create an external css file and include inside the static block, i am working on a custom theme that is inherited from a blank theme.
My custom css placed under app/design/frontend/mytheme/theme/web/css for some other design.
How to include my css file into CMS Block?


texts: max_nesting_level issue in component upgrade

texts:
Magento 2:

I am trying to install an extension (same error for system upgrade also) and it fails at readiness check with below error:

PHP Settings Check

  Your current setting of xdebug.max_nesting_level=100. Magento 2
  requires it to be set to 200 or more. Edit your config, restart web
  server, and try again.

Here is the output snippet from phpinfo(); I have already increased the value to 200, then 400 and then 10000.

xdebug.max_nesting_level    10000   10000

Any idea on how to resolve this?


texts: Admin category page constantly reloading after fresh install (Magento 1.9.1)

texts:
After fresh install on server, categories admin page keeps loading over and over again. I use NGINX 1.8 on ubuntu 14.04.

An additional symptom: catalog filters on front-end doesn't work too. I've tried this  but it doesn't work.


texts: Magento 2: Remove ReferenceBlock - Order Information

texts:
How to find referenceBlock name? Been searching for internet about it but nothing better works aside from some referenceblock that already ask.

Got this problem, I need to move or remove this reference block, but cant find out what it was called. Please help, I’m new here.

In this pic, I need to remove the Order Information & Shipping method,
I browse and explore vendor/Magento/Module-sales and find the xml of the sale,order,view but the referenceblock name or block name is not working when I remove it in my default.xml

I successfully customize my Account Dashboard cause there was given referenceblock name in net. But for Order Information cant find anything.


texts: I'm just wondering if it's possible to allow a customer to select a shipping method on the cart/basket page without entering country or postcode? I have added an image of a mockup to show what it is I'm looking to do. If anyone knows a tutorial or extension that would do this that would be great.


texts: how to show you save percentage in product page magento 2

texts:
I wanted to show you save percentage in product detail page for simple and configurable both.

I have added code in default.phtml file location

  Theme/Magento_Catalog/templates/product/view/type/default.phtml.

<?php

if($_product->getTypeId() == "simple") {
   $simplePrice = $_product->getPrice();
} else {
   $_children = $_product->getTypeInstance()->getUsedProducts($_product);
    foreach ($_children as $child){
    $simplePrice = $child->getPrice();
    break;
   }
}

$_finalPrice =$_product->getFinalPrice();
$_price = $simplePrice;
if($_finalPrice < $_price) {
   $_savingPercent = 100 - round(($_finalPrice / $_price)*100);
   **echo 'Your save '.$_savingPercent . '%';**

}
?>


texts: Magento 2.3: Automatically add HTML tags in a Static Block after save

texts:
Automatically adding HTML tags in a Static Block after save
When saving static block from admin then after saving static block it is automatically adding HTML tags
How can we solve it so that it will not add HTML body tags after saving static blocks ?
Please check screenshot


texts:
I have a directory in /pub called /configed_css. It's full of css files called things like design_default.css and design_.css
I don't want to make changes to those files, because they're clearly auto generated, but I can't figure out where or how.
Any idea where they might be generated?
Thanks


texts: how to add a image uploader in magento 2 checkout shipping address section?

texts:
I have a custom requirement to upload customer id during checkout.

I have created a custom module with a text type input file. data saved and everything fine the process was.

I want to update the text type to file uploading type.

i tried below method in my custom module. But i am getting an error.

Created a phtml file in

/view/fronted/web/template/form/element/newtempfile.phtml

<input class="input-file" type="file" data-bind="value: value,
valueUpdate: 'keyup',hasFocus: focused,attr: {
name: inputName,
placeholder: placeholder,
'aria-describedby': getDescriptionId(),
'aria-required': required,
'aria-invalid': error() ? true : 'false',
id: uid,
disabled: disabled }" />

And defined in the plugin file like below

<?php
namespace Ayakil\CheckoutCustomField\Plugin;
use Magento\Checkout\Block\Checkout\LayoutProcessor;
class SmsPlugin
{
public function afterProcess(LayoutProcessor $subject, $jsLayout) {
    $customAttributeCode = 'sms';
    $customField = [
        'component' => 'Magento_Ui/js/form/element/abstract',
        'config' => [
            // customScope is used to group elements within a single form (e.g. they can be validated separately)
            'customScope' => 'shippingAddress.custom_attributes',
            'customEntry' => null,
            'template' => 'ui/form/field',
            'elementTmpl' => 'Ayakil_CheckoutCustomField/form/element/newtempfile',
            'tooltip' => [
                'description' => 'Mobile (Courier text notifications)',
            ],
        ],
        'dataScope' => 'shippingAddress.custom_attributes' . '.' . $customAttributeCode,
        'label' => 'Custom SMS Attribute',
        'provider' => 'checkoutProvider',
        'sortOrder' => 0,
        'validation' => [
            'required-entry' => true
        ],
        'options' => [],
        'filterBy' => null,
        'customEntry' => null,
        'visible' => true,
    ];

    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$customAttributeCode] = $customField;

    return $jsLayout;
}
}

But i am getting an error.

 [2020-01-27 01:12:57] [ERROR] Failed to load the "Ayakil_CheckoutCustomField/form/element/newtempfile" template requested by "checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.sms".

How to upload and save an image in magento 2 checout in shipping form section.Please help me to solve this task.


texts:
I'm adding a tracking code to a Magento 2 demo in Stores > Configuration > General > Design > Footer > Miscellaneous HTML. However, after clicking on "Save Config" the code is showing in the Misc. HTML box, but it doesn't show in the code before the body tag. I added it to a M1 website and it's working fine. How can I fix the issue?

Here's the code:

Thank you


texts:
I have a problem with this module: https://marketplace.magento.com/mageplaza-module-smtp.html

Everytime I click on Test Now (send a test email), it throws me the following error

I have read tons of problems and all of them says that you need to download the latest core module, I did that and did not work either.
The exception.log and system.log have no errors about this, report folder neither.

The weird thing is that I have this module (older version) installed in other shops, and is working perfectly, but if I try to move the module to this store, it does not let me to activate the module, the Save Config button gets disabled.

I want to install this new version of smtp and core.

Thanks!


texts: How to rearrage breadcrumbs in list page `2-column-left.phtml` alone?

texts: I want to display the breadcrumbs  under col-main div instead of main in list page alone. Not in all pages that uses the  two-column-left layout. Is that possible?


texts:
I am having an issue with stores, magento is trying to find a store by id '3', it doesn't exist, due to which most of the functionality is not working. Website was migrated from 1.9.2.4 to 2.2.7, I have checked both databases for the store ID but it only exists in the new database.

I have checked Magento 2: Requested store is not found

But it isn't related to my issue and not working.

After some digging I found that store ID '3' should infact be '5' as that is the store which customers belong to.
I am trying to run a db query that changes store_id to 5 from 3, is this good practice or there is another way? How do I perform this for whole database instead of one table as in the query below.

UPDATE  `MySQL_Table` SET  `MySQL_Table_Column` = REPLACE(`MySQL_Table_Column`, 'oldString', 'newString') WHERE  `MySQL_Table_Column` LIKE 'oldString%';


texts:
I'm working on refactoring a backend extension which uses the global Mage::registry('current_shipment') to retrieve the current shipment for printing. I'd like to change this line to something that doesn't use a global.

How would I go about retrieving the current shipment value without using the Mage registry?


texts: How to disable price block from admin grid if this blocked in ACL

texts: In this question https://magento.stackexchange.com/a/324446/92235, there is an excellent solution related to hiding the price from a specific user group. But this one does not hide the price from the grid, how can this be implemented?


texts: Magento 2.2.2 How to add Buy Now button with add to cart button

texts:
I want to add both buttons Buy Now as well as Add to Cart, If user click on Buy-now it will redirect to Checkout page directly, for Add to Cart need default functionality. I'm using Magento 2.2.2 using third party theme

Please suggest how to add the buy now button functionality without extension.


texts: Magneto admin Url is not working . Need to clear cache always

texts:
I am using magneto 2.2.6 . The website is working fine until i installed new extension .
 When the time of installation i run the following command

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

When i installed new extension i can't access the admin panel . so i google it and find one solution . https://amasty.com/knowledge-base/magento-2-backend-is-not-working.html

After doing this the admin panel is working . But now the problem is after logout then again admin panel is not working . I have to clear cache using ssh always php bin/magento cache:clean .

How to solve this .

The current situation is for to login admin panel i have to do php bin/magento cache:clean always .
Also i can't update the product details . Fr to update product details also i have to clear cache always . Please help


texts: Finding source of $item reference in layered navigation

texts:
I have the following code that produces the output of the attribute filter in layered - as well as the name of the attribute it also produces the count of products associated with the specific attribute.

I am trying to remove the count next to each attribute (e.g. T-Shirts (1), Shorts (2) etc.). But I cannot for the life of me figure out where the $item phtml is being sourced.

FILTER_ATTRIBUTE.PHTML

<?php
$items        = $this->getFiltersArray();
$displayStyle = $this->getColumnsNum();
?>

    <?php if ($displayStyle <=1): // one column ?>
        <?php foreach ($items as $_item): ?>

<?php echo $_item?>

        <?php endforeach ?>
    <?php endif ?>


texts: Magento 2 Add attachment in email not working for multiple store

texts:
I am trying to send an attachment with Order success email.
I have 2 store default and custom. In default store attachment is working perfectly but in custom store. Email not sent.

After debugging I found a line where email stop working:

$this->_drawItem($item, $page, $order);

Under drawItem function code is:

protected function _drawItem(
        \Magento\Framework\DataObject $item,
        \Zend_Pdf_Page $page,
        \Magento\Sales\Model\Order $order
    ) {
        $type = $item->getOrderItem()->getProductType();
        $renderer = $this->_getRenderer($type);
        $renderer->setOrder($order);
        $renderer->setItem($item);
        $renderer->setPdf($this);
        $renderer->setPage($page);
        $renderer->setRenderedModel($this);

        $renderer->draw();

        return $renderer->getPage();
    }

in this file, execution stops after this the following line:-

$renderer->draw();

Please tell me how to send attachment with email in multiple stores.


texts: Product collection based on the total sales of a product within a period

texts:
What I need is the logic for creating a product collection based on the total sales of a product within a period.

So if a product costs 10 $ and I sold 540 I want the sorting to be based on the total sale 5400.

EDITED & SOLVED:

What I have so far is this:

$_productCollection = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
        ->addStoreFilter()
        ->addPriceData()
        ->addTaxPercents()
        ->addUrlRewrite()
        ->setPageSize($limit);

    $_productCollection->getSelect()
        ->joinLeft(
            array('aggregation' => $_productCollection->getResource()->getTable('sales/bestsellers_aggregated_daily')),
            "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$from}' AND '{$to}'",
            array('SUM(aggregation.qty_ordered) AS sold_quantity')
        )
        ->group('e.entity_id')
        ->order(array('sold_quantity DESC', 'e.created_at'));

    Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($_productCollection);
    Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($_productCollection);

But that gives me only a sorting based on the number of sold products. How to add the price multiplication to it?


texts: Admin->System->Index Management shows Reindex Required

texts:
Installed Magento 2.1.7 Community Edition, created cron jobs, but I still get Reindex Required on Indexed rule/product association.  What have I done wrong?

Note: When I do php bin/magento indexer:reindex I get the responses:


texts:
I need a unique ID for each image in Magento store for a special use case.

So I'm trying to figure a way to reliably obtain the product image ID. Is that the $image["value_id"] field?

I tried this:

 foreach ($collection as $product) {
     $imageUrl = (string)Mage::helper('catalog/image')->init($product, 'image')->resize(480);
     $galleryData = $product->getMediaGalleryImages();
     foreach($galleryData as $image) {
         $imageId = $image['value_id'];
     }
 }

Sometimes it works, sometimes it returns null, even when $imageUrl has a valid URL for the image. Is that because an image with a single product photo doesn't have a media gallery?

I need a reliable way to get the image ID for every product that has an image.


texts: I want To Display Magento PDF invoice in second page

texts:
I am New In Magento, I want to display Some PDF Invoice Part in Second Page So Please Suggest Me.
Please check screen shot also


texts: product sku collection not binding to drop down

texts:
I'm using ultimate module creator. And I created one entity.
And one of the  attribute is product attribute (SKU).

Its created SKU as an attribute in back end but its not binding product SKU collection.

following function returns null array.

public function getAllOptions($withEmpty = true, $defaultValues = false){
    $source  = Mage::getModel('eav/config')->getAttribute('catalog_product', 'sku');
    return $source->getSource()->getAllOptions($withEmpty, $defaultValues);
}


texts: How do you add multiple images with single REST API call?

texts:
I'm struggling to figure out how to add multiple images via single API call.
Documentation has an example
{
    "entry": {
        "id": 0,
        "media_type": "string",
        "label": "string",
        "position": 0,
        "disabled": true,
        "types": [],
    "file": "string",
    "content": {},
    "extension_attributes": {}
    }
}

which works fine for a single image and at the moment i'm using this call in the loop for multiple images.
retrieving multiple images on the same endpoint come in the different format though
[
    {
        "id": 9473,
        "media_type": "image",
        "label": null,
        "position": 2,
        "disabled": false,
        "types": [],
        "file": "/6/4/642.jpg"
    },
    {
        "id": 9474,
        "media_type": "image",
        "label": null,
        "position": 3,
        "disabled": false,
        "types": [],
        "file": "/6/4/643.jpg"
    }
]

i've tried this other 'array'esque format but for uploading images but it didn't work at all.
Any help is appreciated
Thank you


texts: Magento 2 - Move Product Details Tab Accordion

texts:
I am working on magento 2.2. On the product page, there is a detail accordion before the related product slider. Though the accordion is on the left side of the page only, I want this tab structure to cover the full page width. Take a look at this: https://prnt.sc/iztid6

I tried updating app/design/frontend/Sm/market/Magento_Catalog/layout/ catalog_product_view.xml and /public_html/vendor/magento/module-catalog/view/ frontend/layout/catalog_product_view.xml files but the closest that I have reached is that I got the full width structure but the order of tabs gets changed. The order of the tabs should be details, more info, review tabs.

Please guide me how can I achieve the full tab structure.


texts: Sample Data M2 dev 1.0beta install via cmd raise Undefined method

texts:
I'm using windows 8.1 with xampp 1.83 PHP5.5.15
i have cloned and installed magento by browser but when install sampledata step by cmd. It got error like below. I have config everything, setup depends packages like devdocs guide
what i'm missing?
Many thanks all you guys


texts: Magento2 Requested store not found error while registration

texts:
I am getting requested store not found error while registration
does anyone have idea about this ?


texts: Magento 2 Looking for configuration saved event

texts:
I'm trying to write something that automatically clears cache on magento, when user hits Save, on any pages under Backend / Stores / Configuration.

I'm only looking for the proper event to hook into for this function.

Thanks.

Edit: Or any tips on adding a Save And Clear button.


texts: Error: Header name must be a valid RFC 7230 (section 3.2) field-name in Magento2 custom payment module

texts:
$header_array = array('Accept: application/json',
                              "Content-Type: application/json; charset=utf-8",
                              'Accept-Charset: utf-8',
                              'Fecha: '.$fecha,
                              'Autorizacion: '.$firma);


texts: Using EE CMS Hierarchy in a custom theme

texts:
I can't seem to find an example of how to use the Enterprise Edition CMS Hierarchy functionality within my theme. The admin interface is simple enough, but its useless if I can't access that information to dynamically build menus! I've contacted Magento directly and they have not been able to provide me any kind of documentation and told me that they "do not support theme development." Awesome :)

Can someone please help me out? All I really need is that little piece of code that will give me either an object or an array with the CMS hierarchy info, page titles and links and I'll be good to go. Thanks!


texts:
OK I have taken over a store from a group of developers. In sub-cat.phtml they are ordering the sub-categories by their ID. I would like to change this to be either the order they're in within admin area or from A-Z. This is the code from the template file:

<?php
    $category = Mage::getModel('catalog/category')->load($subCategoryId);
    $object = new Mage_Catalog_Block_Navigation();
    $actualCategoryId = $object->getCurrentCategory()->getId();
    $actualCategory = Mage::getModel('catalog/category')->load($actualCategoryId);
    $subCategories = explode(',', $actualCategory->getChildren());
    $count_sub_cat = count($subCategories);
    $count_sub_cat_half = $count_sub_cat/3;
?>

<?php
    $count=1;
    $_iterator = 0;
    foreach ( $subCategories as $subCategoryId ) {
?>

<li class="sub-cat <?php if ($count%4 == 0): ?> last<?php endif; ?>">

        <?php

            $category = Mage::getModel('catalog/category')->load($subCategoryId);

            if( $category->getIsActive() ) {

                $_helper    = $this->helper('catalog/output');
                $_category  = $this->getCurrentCategory();
                $_imgHtml   = '';
                $thumb = $category->getThumbnail();
                echo '
getURL().'">';
                echo 'getBaseUrl().'media/catalog/category/'.$thumb.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($category->getName()).'" style="max-width:215px" />';
                echo '
';
                echo 'getURL().'">'.$category->getName().' ';
            }

        ?>

<?php if($count == $count_sub_cat) echo '
';
    else if ($count%4 == 0) {
        echo '

';
    }
?>

<?php  $count++; } ?>

I'm wondering if Magento provides an easy method for doing this?


texts: High CPU load due to Google crawling search terms

texts:
I'm experiencing a much higher than normal CPU load on my server since a few days mainly caused by excessive search term crawling by Google on my internal Magento search engine. This almost immediately started after I installed the "Sphinx Search" extension. I get the following kind of messages from my server:

1-0 8453 0/0/837 W 9.11 218 0 0.0 0.00 5.33 66.249.78.24 www.mywebshop.com GET /catalogsearch/result/?q=+searchterm+searchterm1+searchterm2 2-0

I've tried several solutions involving the robots.txt file all without any positive result on CPU load reduction. I could always include the following in my robots.txt:

Allowable Index

Allow: /*?q=

In order to stop Google crawlers to abuse my search engine but I don't know whether this is the right way to do it and possible consequences SEO wise. Someone who has dealt with this before and can provide some advise?

Thanks!


texts: Magento Category Navigation - Customising Topmenu.php, adding columns using "$colBrakes" + "shouldAddNewColumn"?

texts:
I am successfully customising the magento 2 navigation by extending 'vendor/magento/module-theme/Block/Html/Topmenu.php' (and also 'vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml', and .less). (was not easy..!)
I cannot find ANY INFO AT ALL on the web or in the source code about how to use the column functionality that is there.
There is this:
private function shouldAddNewColumn(array $colBrakes, int $counter): bool
{
    return count($colBrakes) && $colBrakes[$counter]['colbrake'];
}

and this:
if ($this->shouldAddNewColumn($colBrakes, $counter)) {
    $html .= '

';
}

A little  confusing. The only other place it is in the source code is 'vendor/magento/module-backend/Block/Menu.php' but that is not helpful either. Why can I not find any mention of it on the whole internet?
So my question is, what should the $colBrakes array be like if I want columns added..???
Thank You!


texts: Magento 2: If a module depends on 2 module which loads first?

texts:
In magento there is a module C and it depends on two module A and B. the module.xml of C is as follows:

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

Then the order of load module is A,B,C or B,A,C ???


texts:
I want to change the menu bar and some other elements on the luma theme for Magento.
I have not found a way to do this yet, anyone knows how to do it?
Any tips and help is appreciated
-JP


texts: When I Place Order Than The Error Ocuure "An error occurred on the server. Please try to place the order again." in Magento2

texts:
I have try the order placed but showing this error

  here i attach the link what was actuall problem face in magento 2

[http://prntscr.com/rd9oeq][1]


texts: Magento 2 Warning: Division by zero : vendor/magento/module-sales/Model/Order/Item.php

texts:
Please Advise on it,
i got this error,

main.CRITICAL: Warning: Division by zero in vendor/magento/module-
 sales/Model/Order/Item.php on line 411 {"exception":"[object]
 (Exception(code: 0): Warning: Division by zero in
  vendor/magento/module-sales/Model/Order/Item.php on line 411


texts:
We have a strange issue on one of our live websites.
Every now and then the websites frontend assets don't load. By looking at the paths it's trying to load it is because the base part of the URL is missing. e.g.

<script src="/js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript">

All data shows just not JS/CSS. Any idea's why this could be?


texts: validation class not calling in system.xml if I defined type image

texts: if I define 'type=file' than validation is calling but image icon is not displaying on screen. but if I define 'type=image' than validations not calling and image icon is displaying on screen. I want to call image validations & want to show image icon on screen using system.xml please let me know if anyone have idea about this.


texts: M2 remove forward slash from footer link

texts:
I am using the following code in default.xml to edit the privacy policy URL however it is adding a trailing forward slash.

<referenceBlock name="footer_links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="privacy-policy-link" after="contact-us-link">
            <arguments>
                <argument name="label" xsi:type="string">Privacy and Cookie Policy</argument>
                <argument name="path" xsi:type="string">privacy-policy.html</argument>
            </arguments>
        </block>
         <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="search-term-popular-link" after="sales-guest-form-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Search Terms</argument>
                <argument name="path" xsi:type="string">search/term/popular</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="contact/contact/enabled" name="contact-us-link" before="-">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Contact Us</argument>
                <argument name="path" xsi:type="string">contact</argument>
            </arguments>
        </block>
         <block class="Magento\Sales\Block\Guest\Link" name="sales-guest-form-link" after="catalog-search-advanced-link">
            <arguments>
                <argument name="label" xsi:type="string">Orders and Returns</argument>
                <argument name="path" xsi:type="string">sales/guest/form</argument>
            </arguments>
        </block>
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="catalog-search-advanced-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Advanced Search</argument>
                <argument name="path" xsi:type="string">catalogsearch/advanced</argument>
                <argument name="attributes" xsi:type="array">
                    <item name="data-action" xsi:type="string">advanced-search</item>
                </argument>
            </arguments>
        </block>
    </referenceBlock>

On my website my privacy policy URL is privacy-policy.html/ - how can I change this to privacy-policy.html ?


texts: "Blind SQL Injection" alert from one scanner for Magento site...legit?

texts:
I help manage a Magento site and one of the tools we use in our efforts to stay on top of site security is Decertify. I just ran a report & it came back with a warning about possible "blind SQL injection". We have all the patches installed (including SUPEE-5344), we haven't noticed anything out of the ordinary in the database or files, and we've run every malware scanner on the planet (all clean). Decertify tried the following code in the URL:

  http://yourstorename.com/?dir=-0;_=new%20Date();do%7B__=new%20Date();%7Dwhile(-_%3C100);_();/';=new%20Date();do%7B=new%20Date();%7Dwhile(-%3C100);();var%20x='%22;=new%20Date();do%7B=new%20Date();%7Dwhile(__-%3C100);();var%20x=%22*/
  HTTP/1.1

Note: there's an asterisk after the .com/ (it's deleting it)

I tried it myself & a 403 Forbidden comes up.

Decertify reasoning is:
"The graph describes two sets of requests. The most dominant one describes our active probes, which intentionally will make the server delay for a short amount of time. The other set contain passive probes that are made to be executed by the back end server but without any delay. The differences between these two sets indicate that an injection is present."

My questions:

   Does the fact that the 403 is coming mean that I shouldn't
  have to worry about this? That it's being blocked properly?
  Isn't this something that's supposed to be blocked by plugs made
  by the security patches? (specifically SUPEE-5344) Have you
  ever heard of a test like this done to determine whether an injection
  is present or not?

Any guidance or thoughts would be much appreciated!

UPDATE: I ran the scan again & it didn't show up this time. Still interested in what you all have to say.


texts: How to update existing CMS block content using data patches?

texts:
I have updated content for the existing cms page by using data patches in Magento 2.3.3, but the same approach not working for CMS block.

<?php

namespace Test\CmsExport\Setup\Patch\Data;

use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Cms\Model\BlockFactory;

class UpdateTest2Block implements DataPatchInterface, PatchVersionInterface {

  private $blockFactory;
  private $moduleDataSetup;

  public function __construct(
        PageFactory $blockFactory,
        ModuleDataSetupInterface $moduleDataSetup
    ) {
        $this->blockFactory = $blockFactory;
        $this->moduleDataSetup = $moduleDataSetup;
    }

  public function apply () {

      $this->moduleDataSetup->startSetup();
      $test2BlockContent = '
Test 2 block updated using data patches
';

      $test2Block = $this->createBlock()->load(
                  'test2',
                  'identifier'
              );
      $test2BlockId = $test2Block->getId();
        if ($test2BlockId) {
          $test2Block->setContent($test2BlockContent);
            $test2Block->save();
        }
      $this->moduleDataSetup->endSetup();
    }
    public static function getDependencies() {
        return [];
    }
    public static function getVersion() {
        return '1.0.1';
    }
    public function getAliases() {
        return [];
    }
    private function createBlock() {
        return $this->blockFactory->create();
    }
  }


texts: When I upload my extension in magento marketplace it show “Failed to open file composer.json. Please verify the archive”

texts:
{
    "name": "webgensis/module-faq",
    "description": "Magento2 FAQ Module",
    "type": "magento2-module",
    "version": "2.0.1",
    "license": "GPL-3.0-or-later",
    "authors": [
        {
          "name": "Webgensis",
          "email": "mail.info@webgensis.com"
        }
    ],
    "support": {
        "issues": "https://webgensis.com/"
    },
    "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "Webgensis\\Faq\\": ""
        }
    }
}


texts: Worldpay payment not showing up in the checkout page

texts: We are using the Magento Enterprise Edition 1.14.2.1. It supports the Worldpay option out of the box. I enabled it on the admin payment methods configuration page. But I don't see a credit card option in the Payment Information tab on the checkout page. I only see Paypal, which is the other option we provide users. Is there some other configuration I'm missing? if not how would I debug this?


texts:
I have an observer on the customer login event. I want to redirect the user to the cart page after login.

I have this in my function from my controller:

Mage::app()->getFrontController()->getResponse()->setRedirect('/checkout/cart/');
Mage::app()->getResponse()->sendResponse();
exit;

The fact is that in firefox this code works. In chrome it doesn't. In chrome I always get an empty cart , even if I have products in my cart, just after page refresh I got the items from my cart. What should I change in my code to make this work in chrome too ?   Thank you in advance !.


texts: FedEx service - "Free method" impossibly affecting rates

texts:
The FedEx shipping method allows one to set a free shipping method and set a minimum order amount for it to be applied.

Item in Cart

Product Weight = 22.17lbs
Qty = 7

Configuration A

Packages Request Type = "Use Origin Weight"
Free Method = "Ground"
Free Shipping w/Minimum Order = "Disable"
Minimum Order Amount = null
Allowed Methods = Ground
Max Package Weight = 150

Configuration B

Packages Request Type = "Use Origin Weight"
Free Method = "Disabled"
Free Shipping w/Minimum Order = "Disable"
Minimum Order Amount = null
Allowed Methods = Ground
Max Package Weight = 150

Configuration C

Packages Request Type = "Divide To Equal Weight"
Free Method = "Disabled"
Free Shipping w/Minimum Order = "Disable"
Minimum Order Amount = null
Allowed Methods = Ground
Max Package Weight = 150

Rates

Configuration A = 146.52
Configuration B = 69.68
Configuration C = 73.26

The rates returned by Configuration A are double that of Configuration C and it seems to be related to how Magento breaks the shipment up into number of boxes. Since the item weighs 22.17lb and there are 7 in the cart, the shipment exceeds 150lb maximum. If there are only 6 in the cart, both configurations return the same rates (as expected).

Additionally, as the quantity increases and the 150lb max is exceeded for each box that is needed, the price doubles again.

Aside from this, why the discrepancy in rates between Configuration A and B? Why would setting the free shipping method to Ground cause the price to double?


texts:
I am following tutorials about magento ,it use nginx as server ,I created 2 different stores and edit the file /etc/nginx/sites-available/magento as follows :

map $http_host $mage_run_code {
    default '';
    gizmo.com gizmo_com;
    widget.com widget_com;
}
map $http_host $mage_run_type {
    default store;
    gizmo.com webisite;
    widget.com website;
}
server {
    listen 80;

    root /var/www/magento;

    index index.php index.html index.htm;

    server_name magento.local gizmo.com www.gizmo.com widget.com www.widget.com;

    # Place PHP error logs in the Magento log folder
    set $php_log /var/www/magento/var/log/php_errors.log;

    # Replaces Apache rewrite rules
    location / {
        try_files $uri $uri/ @handler;
    }

    # Protect sensitive folders
    location /app/                { deny all; }
    location /includes/           { deny all; }
    location /lib/                { deny all; }
    location /media/downloadable/ { deny all; }
    location /pkginfo/            { deny all; }
    location /report/config.xml   { deny all; }
    location /var/                { deny all; }

    # Protect dotfiles (htaccess, svn, etc.)
    location /. { return 404; }

    location @handler {
        rewrite / /index.php;
    }

    # Remove trailing slashes from PHP files
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    # Pass PHP to a the PHP-FPM backend
    location ~ \.php$ {
        # Fix timeouts when installing Magento via web interface
        fastcgi_send_timeout 1800;
        fastcgi_read_timeout 1800;
        fastcgi_connect_timeout 1800;

        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_param HTTPS $fastcgi_https;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fastcgi_param MAGE_IS_DEVELOPER_MODE on; # Turn on developer mode
        fastcgi_param MAGE_RUN_CODE $mage_run_code;
        fastcgi_param MAGE_RUN_TYPE $mage_run_type;
        fastcgi_param PHP_VALUE error_log=$php_log;
        include fastcgi_params;
    }
}

The strange thing is ,that when I open widget.com it is not giving me error,but redirect me to magento.local/ ,actually the url stays widget.com ,but I tried to change the html of widget.com through the admin site of magento and it doesn't change so I think it loads the default magento index page.When I try to open gizmo.com it shows me 404 error.I restarted nginx and did everything as in the tutorial ,but still same thing.


texts: Call to a member function insert() on a non-object (During Installation Process)

texts:
I'm trying to install Magento 1.9 on my localhost, but when I add database details and click on "Continue button" during installation, I am getting below error.

Fatal error: Call to a member function insert() on a non-object in /var/www/magento/app/code/core/Mage/Core/Model/Resource/Resource.php on line 133

line 133 on  Resource.php

public function getConnections()
    {
        return $this->_connections;
    }

Why this error occurs and any solution to resolve this error?


texts: I want to display only tax it wont be include in grand total

texts:
I want to display subtotal after subtracting and i don't want to add that tax in to grand total .
Now, i have a product price with including tax.
I tried the solution from system-> configuration-> tax but its not giving me the result as expected


texts: Programatically Log User Out [Magento 2]

texts:
I have written a module which is basically an observer which triggers on 'customer_save_after_data_object' the content of this observer basically listens out for when the customers group is changed.

The issue we are having is that if the customers' group is changed when they are logged in it doesn't seem to take effect, meaning that they need to log out of the account and then back in.

My question is, is there a way to log the customer out of their dashboard programmatically when I don't have direct access to the customer session and only the observer data?


texts: Remove multi-language storeview code from the url - Magento1.9

texts:
I am using Magento multistore view for multiple languages like english, german, french etc.

To have clean urls i have enabled the settings "Add Store Code to Urls" to "yes".

Now it shows following url for stores:

  English: mystore.com/english/category1.html

  German:  mystore.com/german/category1.html

English language store is my default store. it loads when my site load first.
as it's default language i don't want to show  english in the url.

So how can i remove the english from the default store view url?

The url for english should be:

  English: http://mystore.com/category1.html

  German: http://mystore.com/german/category1.html

Not sure how to do this.


texts: HTTP Error 500 when customer logins 1.9.3.8

texts:
I'm experiencing ERROR 500 when I login as a customer. This only started happening after update to 1.9.3.8

I'm not able to find anything on the error logs from apache or magento log files.

Saw a similar problem with compilation ON here HTTP ERROR 500 in checkout when compilation is on and user is logged but I have compilation OFF

The back end works without issues.

Anyone with similar issues?

So, a error_log was being created on magento dir with the following

Call to undefined method Mage_Customer_Helper_Data::getPasswordTimestamp() in /XXXXXXXXXXX/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 530

So I checked if that function exists and it does.

USER@SERVER [~/XXXXXXXX/app]# grep -R "getPasswordTimestamp" .
./code/core/Mage/Core/Model/Session/Abstract/Varien.php:                Mage::helper('customer')->getPasswordTimestamp($this->_data['visitor_data']['customer_id']);
./code/core/Mage/Customer/Helper/Data.php:    public function getPasswordTimestamp($customerId)

For some reason it is not able to call it.


texts: Send Order Email to Custom email IDs when order by specific payment method

texts:
I have added one field in the configuration to add email IDS. When the order is placed by some payment method for example, "Cash on Delivery" I want to send New order email to those email IDs of the custom field.

I'm not understanding how to achieve this.

Please help me with this or give me some suggestions.


texts: Problem creating mock method for "core/store" with ecomdev phpunit

texts:
I'm trying to mock this method: getCurrentCurrency() from "core/store" (Mage_Core_Model_Store) in my unit test. Just a simple stub, nothing more.

private function _stubGetCurrentCurrency() {
    $mock = $this->getModelMock(
        'core/store',
        array(
            'getCurrentCurrency'
        )
    );
    $mock
        ->expects($this->any())
        ->method('getCurrentCurrency')
        ->will($this->returnCallback(array($this, 'signal')));
    $this->replaceByMock(
        'singleton',
        'core/store',
        $mock
    );
}

function signal() {
    echo "\n- Signal invoked -\n";
}

However it doesn't seem to work for me - when I do $this->_stubGetCurrentCurrency(); I don't see the signal() is being called at all. I've ascertained that the original method is being invoked instead. Looks like I'm missing something, but I can't find what's wrong.

I also have stubs for "sales/order_invoice" canCapture() and "salesrule/observer" addProductAttributes() in that test - they are instantiated in the same manner and both work perfectly fine.

Can anyone point out my miss?
Thank you.


texts:
I have a store with both English and German views

The tree structure has both language versions, so I have manually changed Product to equal Produkte in the category section for example.

My problem is how to handle links in such a setup. In the main product page, I have a link such as this: href="{{store direct_url='products/phones.html'}}"

When I change to the German view, that link returns a 404. It doesn't automatically redirect to the german version which is produkte/fones.html (as an example).

Shouldn't it automatically redirect? I don't have to recode all my links by hand do I ?

update:

adding some additional information to clarify the issue>

the category structure of the shop is setup in both English and German. The categories have been translated, so when you are in the EN shop and change to the DE shop, then menus update and work correctly.

So, the 'phones' menu item becomes 'fones' - and works as expected.

In my landing page, I have the same link hardcoded (as above). How can I get it to goto the right page automatically?


texts: Currency exchange not working on products

texts:
The default currency for my site is EUR but I want to change it to RON. I've followed the steps from Configuration->Currency Setup but I'm not exactly sure how this thing works. One of my product's initial price was 100 EUR and after the currency change it still remains at 100 RON (it should be 456 RON).

Any ideas how to make the currency exchange work?


texts: How to Inject a new Class to Overridden Class using Preference

texts:
I want to override __prepareLayout function from 'Magento\Sales\Block\Order\History' so I used the preference.
In my di.xml
<preference for="Magento\Sales\Block\Order\History" type="Custom\Module\Block\Order\History"/>

In my History.php
class History extends \Magento\Sales\Block\Order\History
{
    protected function _prepareLayout()
    {
        parent::_prepareLayout();
        $this->setTemplate('Custom_Module::order/history.phtml');
        return $this;
    }

}

To this point my code is working fine now I want to inject custom Helper in this class.
So I added this-
    public function __construct(
        \Custom\Module\Helper\Data $helper
    ) {
        $this->helper   =   $helper;
    }

After Injecting Class the code is not working. I have the option to use ObjectManager, but it is not recommended, so I preferred to ask from Community if you have any better Option!


texts: Most efficient way to populate customer's country field

texts:
Magento CE 1.9.2.1

Our store was recently migrated from Volusion to Magento. For customers in the United States, Volusion would store their country information as "US" however Magento refuses to recognize it because it doesn't store this data as "United States" in the database. This has resulted in a number of errors; the predominant one being USPS shipping method erroring out when it attempts to process a registered customer's address.

For customers who have "US" in there country field, it appears as if they don't have a country at all in the account section or in Magento's customer management area.

I need an efficient way to bulk update these customers with incorrect country data. I attempted to do this with the Import/Export option in Magento (not Data Profiles) and it seems to have never finished. I left it on for hours and it continued to say "Please Wait". I also looked into Magmi but it seems they don't have a customer plugin for importing/exporting.

What is the best way to bulk update customer addresses in Magento CE 1.9.2.1? Thank you.


texts: Unable to access Magento admin or frontend: SQLSTATE[HY000] [1203] User already has more than 'max_user_connections'

texts:
I am unable to access frontend or backend. The error is :

a:4:{i:0;s:108:"SQLSTATE[HY000] [1203] User website_superuser already has more than 'max_user_connections' active connections";i:1;s:2667:"#0     /home/website/public_html/includes/src/__default.php(55251): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/website/public_html/includes/src/__default.php(55731): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/website/public_html/includes/src/__default.php(53923): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /home/website/public_html/includes/src/__default.php(54981): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /home/website/public_html/includes/src/__default.php(55839): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /home/website/public_html/includes/src/__default.php(30069): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /home/website/public_html/includes/src/__default.php(30010): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /home/website/public_html/includes/src/__default.php(12175): Mage_Core_Model_Resource->getConnection('core_write')
#8 /home/website/public_html/includes/src/__default.php(12205): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#9 /home/website/public_html/includes/src/__default.php(12190): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
#10 /home/website/public_html/includes/src/__default.php(12215): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#11 /home/website/public_html/includes/src/__default.php(32099): Mage_Core_Model_Resource_Db_Abstract->getReadConnection()
#12 /home/website/public_html/includes/src/__default.php(24135): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Website))
#13 /home/website/public_html/includes/src/__default.php(24167): Mage_Core_Model_Config->getModelInstance('core_resource/w...', Object(Mage_Core_Model_Resource_Website))
#14 /home/website/public_html/app/Mage.php(491): Mage_Core_Model_Config->getResourceModelInstance('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#15 /home/website/public_html/includes/src/__default.php(5861): Mage::getResourceModel('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#16 /home/website/public_html/includes/src/__default.php(5866): Mage_Core_Model_Abstract->getResourceCollection()
#17 /home/website/public_html/includes/src/__default.php(21013): Mage_Core_Model_Abstract->getCollection()
#18 /home/website/public_html/includes/src/__default.php(20871): Mage_Core_Model_App->_initStores()
#19 /home/website/public_html/includes/src/__default.php(20754): Mage_Core_Model_App->_initCurrentStore('', 'store')
#20 /home/website/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21 /home/website/public_html/index.php(87): Mage::run('', 'store')
#22 {main}";s:3:"url";s:85:"/index.php/admin/customer/index/key/417da801f7f6439703a68329d25cd222/";s:11:"script_name";s:10:"/index.php";}


texts: Product attribute value visible in Catalog table but its field is empty in Edit Product form

texts:
I have a strange issue with Magento 2.2.5 where two of my product attributes have its values showing in the Catalog Table, but when you click into the product itself to edit, the field for that attribute is empty.

Catalog table:

Product edit form:

I've tried a full reindex, and cleared the Magento cache as well, but none of that helps.

I've compared the two attribute configurations on a database level using:

SELECT * FROM `mydb`.`eav_attribute` WHERE `backend_type` = "varchar"

But the configurations are exactly the same as other attributes where it doesn't have such an issue.

I have also compared the actual value in database with other attributes that don't have this issue:

SELECT * FROM `catalog_product_entity_varchar`

Again, exactly the same.

Interesting note, when I duplicate the product, the two attributes are the only fields that do not get cloned over to the duplicate product. This means that the duplicate product has these two fields set to the field's default values, and even these default values don't appear in the Edit Product form!
I have no idea what else I can try to fix this.


texts: Custom InstallSchema script for updated_at default column: as_defined

texts:
How to write the below using Install Scheme script .

I want initially the updated_at to be 0000-00-00 00:00:00

 CREATE TABLE IF NOT EXISTS `tgs_queue` (
`id` int(10) unsigned NOT NULL COMMENT 'ID',
`entity_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Product ID',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
 )

Is the below rite?

->addColumn(
            'created_at',
            \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
            null,
            [ 'nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT, ],
            'Created At'
        )
        ->addColumn(
            'updated_at',
            \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
            null,
            [ 'nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE, ],
            'Updated At'


texts: How to add custom product 'option' to container2?

texts:
I have some two options added to products via the admin panel. What I want to do is insert some custom html between these options. Is it possible to do this programmatically ?

Something similar to:

$_product->addOption(
    array(
        'type' => 'html',
        'value' => '<!--html to go here-->',
        'position' => 1
    ) );

where the type would require a new view script that would just echo the option value.

Alternatively, is there a way to echo out the options independently? e.g.:

echo $_product->getOption(0)->toHtml(), // echo first option
     $myHtmlHere,                       // echo my html
     $_product->getOption(1)->toHtml(); // echo second option


texts: Full page cache and developer restrictions

texts:
When you have the full page cache enabled the developer restrictions are only checked for the first user to hit the page. Then they are cached and never checked again for other users.

I know that this kind of makes some sense to develop it in this way but does mean that you cannot safely enable inline translations or other items for specific ip addresses while the FPC is enabled.

Does anyone have a work around for such an issue?

It can be solved by disabling FPC and simply using the normal block cache while your are working with translations, but this is not always ideal.


texts:
I have a php script I use to update an attribute. I have it set on ADMIN store at the moment, however I need it to update for each store that does not have default values set.

require_once('app/Mage.php');
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

How do I change this to either run for all stores, or get it to cycle through each store?


texts: Magento 2: How to get certification of Magento 2?

texts:
Anyone used to get certification of Magento 2.

May you show me how to get certification of Magento 2 ?


texts: Change order status after order placed regardless payment method

texts:
I am using Magento ver. 1.9.2.3.

I want the system to take the order as “Order Pending” status when any orders over $1100.00 regardless any payment method.

Now when a user pay with 'eway-Credit card' or with 'PAYPAL' then an invoice is generated and an email goes to customer with an invoice pdf as attachment. I also want to prevent this invoice email going to user in this  case when order is over $1100.00.


texts: Configurable products taking time to load

texts:
I wanted to have suggestion related to best extension for lazy load images. Currently I am using this extension :
https://www.magezon.com/magento-2-lazy-load.html
Have anyone of you has tried this extension:
https://github.com/gaiterjones/LargeConfigProducts
what is it's main functionality and do it optimize the configurable products ?
Your help is appreciated !!


texts: How to configure Nginx and Varnish with Magento

texts:
Recently we decided to go ahead and install varnish for use with Magento, along with Nginx for SSL termination.

Apache is serving to port 8080, Varnish is on port 80, and Nginx is configured to handle the SSL traffic on port 443.

The problem I'm encountering is with Nginx, when attempting to start the process we get the error Job for nginx.service failed because the control process exited with an error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

After running systemctl status nginx.service we get the following:

● nginx.service - A high-performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-01-04 12:26:38 MST; 27s ago
  Process: 6732 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 6729 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Jan 04 12:26:35 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:443, backlog 511 failed (98: Address alrea
Jan 04 12:26:36 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:8080, backlog 511 failed (98: Address alre
Jan 04 12:26:36 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:443, backlog 511 failed (98: Address alrea
Jan 04 12:26:36 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:8080, backlog 511 failed (98: Address alre
Jan 04 12:26:36 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:443, backlog 511 failed (98: Address alrea
Jan 04 12:26:37 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:8080, backlog 511 failed (98: Address alre
Jan 04 12:26:37 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:443, backlog 511 failed (98: Address alrea
Jan 04 12:26:37 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:8080, backlog 511 failed (98: Address alre
Jan 04 12:26:37 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] listen() to 0.0.0.0:443, backlog 511 failed (98: Address alrea
Jan 04 12:26:38 s132-148-86-33.secureserver.net nginx[6732]: nginx: [emerg] still could not bind()

And from there, I'm kind of lost as this is my first go around with either Varnish or Nginx. Anybody else ran into a similar issue or have any suggestions on where to go from here?


texts: getData() of User created in backend with specific Role id only

texts:
I want to get details of all user created from

  System->Permissions->Users

That are assigned to specific Role only.

For example details of users created with role id = '4'.

How to apply this condition and obtain details?


texts: Magento 2 - Breadcrumbs not showing full path

texts:
My breadcrumbs are only showing like Home > Productname

instead of Home > Category -> Subcategory -> Productname

Is there a way to fix this? I tried with the fresh mangento luma theme, to show that it is not a fault of my theme.


texts:
I need to change the category from a couple of products. The products I need to change are all from one category, but it's not possible to sort by category on catalog -> manage products, is it? On catalog -> manage categories it's possible to view all products from a certain category but you can't edit them, can you?

Greetings


texts: I'm using porto theme in magento 2.3.3, but when i try to edit the homeslider from the homepage in demo 1, it doesn't load anymore and doesn't display any error in console log. Anyone faced this issue?


texts: Ticking hide from product page randomly ? Magento2

texts: I migrated installation from magento 1.9.2.2 to 2.0.4 and everything went well, except its ticking hide from product page for some images of products, some products have this problem, some dont, there is no rule.I can resovle this by manually unticking hide from product page but it would take years. On products that have this problem I also have problem its showing product details raw text on top of page, I 'll attach screenshot of how that looks.  .


texts: change payment method of existing order to paypal_express without requesting paypal gateway

texts:
Is it possible to change the payment method of an existing order to paypal_express?

I found that question https://stackoverflow.com/questions/19425066/how-to-change-payment-method-from-one-to-another-of-the-existing-order-in-magento (How to change payment method from one to another of the existing order in magento by programming way?) but when I use it with paypal_express, I get an exception that the paypal gateway refused my request.
Is it possible to just set the data and not make another request since the payment via paypal has already been made?


texts: Orders don't display on customer panel after migrating server

texts:
After migrating server, the order of historical stopped appearing in the client panel, appears only in the backend.

This only occurs with registered customers before migration.

When these customers (registered before the migration) makes a purchase, after the payment, the order disappears off the customer panel.

I have already checked the config file, and all of the statuses are set 1 to frontend view, so what could it be?


texts: Is it possible to update order item price and order total after order is place

texts:
Hi want to update order item price and grand total and order details after order is placed.

suppose,I have place an order with item

Item A - order item price $10

Item b - order item price $20

Discount is $5

Grandtotal - $25

Now my order status is pending and want  update order item price  and other price just like it

Item A - order item price $40

Item b - order item price $30

Discount is $7

Grandtotal - $63

Is it possible?


texts: How to add a dynamic label In Magento 2?

texts:
I want to add a dynamic label in customer dashboard (label name set dynamically )

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-custom-product" ifconfig="mconnect_csproduct/cs_customer/display_on_dashboard">
                <arguments>
                    <argument name="path" xsi:type="string">vender/customer/products/</argument>
                    <argument name="label" xsi:type="string" translate="true">dynamic label add</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>


texts:
I need to know where catalog and cart prices are called to display so that I can calculate discounts via php and call the same function to display on screen.
The prices in question are those of the print below.
Searching I found the file Amount.php which is in "\ vendor \ magento \ framework \ Pricing \ Render" where I have the getDisplayValue () function
But changing only changes the prices of products without variations,
About the cart I have not yet found where the value is called and where the sum of the values is made.

Magento 2.3.3
Win 10 Xampp


texts:
I would like to check when a customer click on “Place Order”, if he has a default billing and shipping address.

If no, I would like to put the addresses of the order by default for this customer.

Can you help me?


texts: included translation inside block in email template

texts:
I'm wondering does it's possible to use translation inside the block that include in email template. It's my piece of code email template:

{{block class='Magento\Framework\View\Element\Template' area='frontend' template='Magento_Sales::email/shipment/shipment-link.phtml' shipment=$shipment order=$order }}

that block inside translation like that:

<?= /* @escapeNotVerified */ __('Shipped By') ?>
<?= /* @escapeNotVerified */ __('Tracking Number') ?>

and inside my file pl_PL.csv I have translation:

"Tracking Number","Numer śledzenia",module,Magento_Sales
"Tracking Number","Numer śledzenia",module,Magento_Shipment
"Tracking Number","Numer śledzenia",theme,frontend/MyVendor/B2C
"Tracking Number","Numer śledzenia",theme,frontend/Magento/luma
"Tracking Number","Numer śledzenia",theme,frontend/Magento/blank

neither of them works... Do you have any solution for that problem?


texts:
http://prnt.sc/ejvoda

Screen shot link above

If I change the default country to someother country cash on delivery starts showing for that country but not other countries that have cash on delivery in payment method assigned to it.

For example saudia arabia is also assigned cash on delivery but it only shows if I change saudia arabia to default country. Why is this happening? I have done this many times on other magento setups but never encountered this problem.

http://prntscr.com/ejw1ff

Screenshot link for cash on delivery payment methods


texts: Magento2 layered navigation product count for bundle items

texts:
There is a way to exclude from the count, in the layered navigation, child product that have the filter attribute?
For example: I have a product A with attribute region set to "tuscany", and I have also a bundle B which contains the product A, but the bundle doesn't have the region attribute set. What I get in layered navigation for region filter "tuscany" is 2, but I don't want to include in the count the bundle's child items.


texts: Need REST api for "Add to Wishlist" in Magento 2

texts: I want REST api for "Add to Wishlist" in Magento 2, and also need to know in which folder to place and the endpoint


texts:
Product Images are not showing after upgrade from Magento 2.2.5 to 2.3.1, instead, page keeps loading but nothing happens.

I am using porto theme


texts: How can I stop customers from writing reviews on products?

texts: I don't want customers to be able to review my products. How can I stop this?


texts: DB Table not creating on submit of form: Magento 1.9.2.4

texts:
I have form in admin created by custom module i created the function to auto create the table in Database if not exists but it is not working to me as follows:

    <?php
    $installer = $this; //Getting Installer Class Object In A Variable
    $installer->startSetup();
    $installer->run("
    -- DROP TABLE IF EXISTS {$this->getTable('optfirst_reviewmycompany')};
      CREATE TABLE {$this->getTable('optfirst_reviewmycompany')} (
      `id_optfirst_reviewmycompany` int(11) unsigned NOT NULL auto_increment,
      `facebook` varchar(255) NOT NULL default '',
      `twitter` varchar(255) NOT NULL default '',
      `google` varchar(255) NOT NULL default '',
      `linkedin` varchar(255) NOT NULL default '',
      `yelp` varchar(255) NOT NULL default '',
      `piintrest` varchar(255) NOT NULL default '',
      `gmaps` varchar(255) NOT NULL default '',
      `bing` varchar(255) NOT NULL default '',
      `coc` varchar(255) NOT NULL default '',
      `city_search` varchar(255) NOT NULL default '',
      `ezlocal` varchar(255) NOT NULL default '',
      `local` varchar(255) NOT NULL default '',
      `mcircle` varchar(255) NOT NULL default '',
      `show_me_local` varchar(255) NOT NULL default '',
      `superpages` varchar(255) NOT NULL default '',
      `topix` varchar(255) NOT NULL default '',
      `uscity` varchar(255) NOT NULL default '',
      `where_to_app` varchar(255) NOT NULL default '',
      `yellow_bot` varchar(255) NOT NULL default '',
      `yellow_wise` varchar(255) NOT NULL default '',
      PRIMARY KEY (`id_optfirst_reviewmycompany`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    ");
    $installer->endSetup();
   ?>

here is the config.xml file:

<global>
    <blocks>
        <optfirst_reviewmycompany>
            <class>OptFirst_ReviewMyCompany_Block</class>
        </optfirst_reviewmycompany>
        <reviews>
        <class>OptFirst_ReviewMyCompany_Block</class>
        </reviews>
    </blocks>

    <helpers>
        <optfirst_reviewmycompany>
            <class>OptFirst_ReviewMyCompany_Helper</class>
        </optfirst_reviewmycompany>
    </helpers>

    <models>
        <optfirst_reviewmycompany>
            <class>OptFirst_ReviewMyCompany_Model</class>
            <resourceModel>optfirst_reviewmycompany_resource</resourceModel>
        </optfirst_reviewmycompany>
        <optfirst_reviewmycompany_resource>
            <class>OptFirst_ReviewMyCompany_Model_Resource</class>
            <entities>
                <review>

optfirst_reviewmycompany

                </review>
                <contacts>

optfirst_contacts

                </contacts>
            </entities>
        </optfirst_reviewmycompany_resource>
    </models>

    <resource>
        <optfirst_reviewmycompany_setup>
            <setup>
                <module>OptFirst_ReviewMyCompany</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </optfirst_reviewmycompany_setup>
        <optfirst_reviewmycompany_write>
            <connection>
                <use>core_write</use>
            </connection>
        </optfirst_reviewmycompany_write>
        <optfirst_reviewmycompany_read>
            <connection>
                <use>core_read</use>
            </connection>
        </optfirst_reviewmycompany_read>
    </resource>
</global>


texts: I install Magento 2. All is good. When I arrive on the admin page, I have the reindex problem. I try to read many tutorial to correct this problem but, or I can't because I haven't SSH on my server, or I can't understand (and every tutorials are in english). I see tutorial with linux command, but I have windows. Somebody to explain me, point per point ?


texts: Magento 2 How to Remove a Top Link Using Layout ifconfig

texts:
In Magento 2 how can I remove a link from top.links via layout? I am assuming you can do this because every link is block in the top.links node is a its own block.

  This is was a question I had earlier today. Because there is little
  information on this I will answer my own question and hopefully this
  will be of help for other people.


texts:
At random times, magento sends order emails to random customers who had nothing to do with that order.
The order placed by the customer id 1 for example can get also sent to the customer with id 20 and/or id 12 without any particular criterion being applied or any reason for it.

I do not know of the problem and so my question is rather vague, but the conclusion of an order magento correctly sends the confirmation reception order, but sends it to casual users registered on the site. What are the files that manage the sending of these emails?


texts: Override Magento 1.9 CartController couponPostAction

texts:
I would like to override the cart controller in Magento 1.9.2 in order to change the wording of the coupon session messages.
There are lots of tutorials and answers which I have gone through, but my override does not seem to be working, I’m not sure if the location of my files are correct.

New Module: app/etc/modules/My_Module.xml

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

Config file: app/code/local/My/Module/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <My_Module>
            <version>0.1.0</version>
        </My_Module>
    </modules>
    <frontend>
        <routers>
            <checkout>
                <args>
                    <modules>
                        <My_Module before="Mage_Checkout”>My_Module</My_Module>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>

New controller
app/code/local/My/Module/controllers/CartController.php

<?php

require_once 'Mage/Checkout/controllers/CartController.php';

class My_Module_CartController extends Mage_Checkout_CartController
{

    /**
     * Initialize coupon
     */
    public function couponPostAction()
    {
        /**
         * No reason continue with empty shopping cart
         */
        if (!$this->_getCart()->getQuote()->getItemsCount()) {
            $this->_goBack();
            return;
        }

        $couponCode = (string) $this->getRequest()->getParam('coupon_code');
        if ($this->getRequest()->getParam('remove') == 1) {
            $couponCode = '';
        }
        $oldCouponCode = $this->_getQuote()->getCouponCode();

        if (!strlen($couponCode) && !strlen($oldCouponCode)) {
            $this->_goBack();
            return;
        }

        try {
            $codeLength = strlen($couponCode);
            $isCodeLengthValid = $codeLength && $codeLength <= Mage_Checkout_Helper_Cart::COUPON_CODE_MAX_LENGTH;

            $this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
            $this->_getQuote()->setCouponCode($isCodeLengthValid ? $couponCode : '')
                ->collectTotals()
                ->save();

            if ($codeLength) {
                if ($isCodeLengthValid && $couponCode == $this->_getQuote()->getCouponCode()) {
                    $this->_getSession()->addSuccess(
                        $this->__('Promo code "%s" was applied.', Mage::helper('core')->escapeHtml($couponCode))
                    );
                } else {
                    $this->_getSession()->addError(
                        $this->__('Promo code "%s" is not valid.', Mage::helper('core')->escapeHtml($couponCode))
                    );
                }
            } else {
                $this->_getSession()->addSuccess($this->__('Promo code was cancelled.'));
            }

        } catch (Mage_Core_Exception $e) {
            $this->_getSession()->addError($e->getMessage());
        } catch (Exception $e) {
            $this->_getSession()->addError($this->__('Cannot apply the promo code.'));
            Mage::logException($e);
        }

        $this->_goBack();
    }
}

The only thing I have changed in the controller is the word ‘coupon’ to ‘promo’
I do not have any error messages.

Thanks


texts: Couldn't retrieve customer_address_id from sales order (SOAP API)

texts:
Im trying to get customer_address_id from sales order address_id in shipping_address and billing_address, but it doesn't match customer_address_id.

Is there any way to get customer_address_id based on sales order through SOAP API ?


texts:
I've got two or so orders that were authorized in authorize.net, but didn't register as orders in Magento.   Any one have any ideas about debugging this particular kind of issue?  Payment bridge is not being used currently.

Thanks


texts: Magento 2 Remove paypal icon from category pages side bar

texts: want to remove paypal icon from category pages:


texts: Unfinished "Paypal Payflow" creates a phantom record

texts:
I recently had an issue while playing with Paypal payments in Magento 2.1.1.

I'm using Paypal payflow:

In checkout page:

And if we proceed to the checkout page and use the pay flow method, an order is created in the database right after the "CONTINUE" button being pressed.

The problem is that if I refresh the page or redirect elsewhere (I know it said "Please do not...", but I want to see the bad case), this order will be left in "Pending payment" state, whereas this record is not present on customer's account dashboard. Also, the catalog was affected and some products will be erroneously out of stock.

Other methods that require redirecting normally create order only after a successful payment, and abandoning checkout process doesn't really cause problems.

So... I'm wondering if this is totally normal and store owners just manually fix it in backend or the workflow should be changed?
(either by myself or report to Magento dev team)


texts:
How to Add Custom MassAction In Controller For Status?

My Status Having

Accepted
Not Process
Rejected
Re-Offer

So how can I Get These Values in change status in MassAction? I Put Default MassAction But Getting "Enable" And "Disable" Value for the Status.

MassAction

public function massStatusAction()
{

    $pricenegotiateIds = (array)$this->getRequest()->getParam('id');
    $pricenegotiateModel  = Mage::getModel('pricenegotiate/pricenegotiate')->load($pricenegotiateIds);
        print_r($pricenegotiateIds);exit;
    $status     = (int)$this->getRequest()->getParam('status'); //get Status
    if($status==2)
    {
        $couponcode=(rand(10,100));
        echo $couponcode."<br>";
    }
    print_r($status);die;
    //your logic
}


texts:
In the magento when I print the getOptionTimezones I get the result as follows

$data['timezone_array'] = Mage::app()->getLocale()->getOptionTimezones();

[timezone_array] => Array
                (
                    [0] => Array
                        (
                            [value] => Australia/Darwin
                            [label] => AUS Central Standard Time (Australia/Darwin)
                        )

                    [1] => Array
                        (
                            [value] => Australia/Melbourne
                            [label] => AUS Eastern Standard Time (Australia/Melbourne)
                        )

                    [2] => Array
                        (
                            [value] => Australia/Sydney
                            [label] => AUS Eastern Standard Time (Australia/Sydney)
                        )

                    [3] => Array
                        (
                            [value] => Asia/Kabul
                            [label] => Afghanistan Standard Time (Asia/Kabul)
                        )

I want to do same in the with php functions but not finding useful code.

What I done is $tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);

It outputs like

Array
(
    [0] => Africa/Abidjan
    [1] => Africa/Accra
    [2] => Africa/Addis_Ababa
    [3] => Africa/Algiers
    [4] => Africa/Asmara
    [5] => Africa/Bamako
    [6] => Africa/Bangui
    [7] => Africa/Banjul
    [8] => Africa/Bissau

How can i convert the timezone name to full name like the label in below array.

[value] => Australia/Darwin
[label] => AUS Central Standard Time (Australia/Darwin)


texts: Is setting up a payment method too difficult for a junior front end developer

texts: So basically my boss has me working on Magento, I am familiar with the admin panel and the basic structure of Magento in terms of where stuff goes and I've been told to set up a payment method with sprite, in my opinion I think it's too difficult he doesn't understand that magento is very php heavy and has a lot of concepts that just go over my head, would any of you guys give this sort of task to a junior front end developer or even just a junior web developer who has little experience in magento development ?


texts: Magento 1.9 - How to Debug 3rd party Extension which is affect Magneto Core Function?

texts:
I have installed free price extension, https://pluginarchive.com/magento/rp_display_price_free  the extension collapse my configurable product price. How to debug which part of the extension affects my Magento core function.

Note: https://snipboard.io/I2FrSH.jpg

Thanks in advance..!


texts: Only allow the last item added to cart in the cart

texts:
My client wants only one product of a particular type in the cart/quote.  And it should be the most recent product added to the cart.

For example, user finds product. Adds to cart.  User finds another product and adds to cart.  I need to remove the first item and add the second.

I found this article which shows how to monitor items in the cart. I have it working, but I'm lost on the next step.

Ideas???


texts: how to create drop down attributes for customer

texts:
I want to introduce a new field in customer admin area and I just want to have it two options "yes" or "no"

here is my code that is creating simple text fields but I am not sure how can I create drop down attribute for the customer?

$installer->startSetup();
$vCustomerEntityType = $installer->getEntityTypeId('customer');
$vCustAttributeSetId = $installer->getDefaultAttributeSetId($vCustomerEntityType);
$vCustAttributeGroupId = $installer->getDefaultAttributeGroupId($vCustomerEntityType,$vCustAttributeSetId);
$installer->addAttribute('customer', 'testveri', array(
    'label' => 'Working?',
    'input' => 'text',
    'type'  => 'varchar',
    'forms' => array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'),
    'required' => 0,
    'user_defined' => 0,
));
$installer->addAttributeToGroup($vCustomerEntityType, $vCustAttributeSetId,     $vCustAttributeGroupId, 'testveri', 0);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'testveri');
$oAttribute->setData('used_in_forms', array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'));
$oAttribute->save();
$installer->endSetup();

Can anybody help me in creating a drop down attribute for admin panel only?


texts: Can a shopping cart rule remove free shipping from cart?

texts:
I have been trying to set up a shopping cart rule to remove free shipping from cart items that fall into a specific category, say "Closeouts" for example. I have tried several ways but they all fail. One example:

If ALL of these conditions are TRUE:

Subtotal equals or greater than 95.00

If an item is FOUND in the cart with ALL of these conditions true:
    Category does not contain 9, 79 <-- these are the closeout categories

And then set the action to apply free shipping.
I have also tried to do the opposite - essentially, removing the subtotal and setting the category to "does contain", then setting action to free shipping -> no.
Regardless of what I try it never works. Free shipping is always present when price is above $95 (this is a global free-shipping rule in shipping methods).

Is the global rule always going to override the shopping cart rule? Is there a way to keep this from happening?


texts: Magento2: Need current URL in HTML-head: Scripts and Style Sheets for hreflang

texts:
My question is about using Magento2 HTML-head to generate hreflang links.

In Admin Content Configuration Store View HTML-Head Scripts & Styles I need the current URL for hreflang.

I have tried with following, but this does not work:

<link rel="alternate" hreflang="en" href="{{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::geturlhreflang.phtml"}}" />

And in this file :

  app/design/frontend/vendor/theme/template/geturlhreflang.phtml:

<?php
$actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$parsed_url = parse_url($actual_link);
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
$host   = isset($parsed_url['host']) ? $parsed_url['host'] : '';
$path   = isset($parsed_url['path']) ? $parsed_url['path'] : '';
echo "$scheme$host$path";
?>

How can I get the current URL into the header?


texts: Magento 2 how to get custom attribute title and its value in phtml file.


texts:
On my site there is a script after the body tag, both on frontend and adminhtml. I can't find where it is included:

It adds links in the header. Has anyone seen this?


texts: Magento 2 notification message formatting

texts:
Can anyone tell me how do I bold this highlighted text "Product name" from notification message.

Note: Message comes from .csv file.


texts: Magento 2.3.2 : Old Customer are not able to login

texts:
I have the same issue after migrating from 1.14.0.1 to 2.3.1 to 2.3.2

server2@server2-MS-7636:/var/www/html/Project1$ php bin/magento customer:hash:upgrade
    PHP Fatal error:  Uncaught TypeError: explode() expects parameter 2 to be string  , null given in /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php:322
    Stack trace:
    #0 /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php(322): explode(':', NULL, 3)
    #1 /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php(301): Magento\Framework\Encryption\Encryptor->explodePasswordHash(NULL)
    #2 /var/www/html/Project1/vendor/magento/module-customer/Console/Command/UpgradeHashAlgorithmCommand.php(69): Magento\Framework\Encryption\Encryptor->validateHashVersion(NULL)
    #3 /var/www/html/Project1/vendor/symfony/console/Command/Command.php(255):Magento\Customer\Console\Command\UpgradeHashAlgorithmCommand->execute(Object(Symfo      ny\Component\Console\Input\ArgvInput),Object(Symfony\Component\Console\Output\ConsoleOutput))
    #4 /var/www/html/Project1/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\C in/var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php                                                                              on line 322
    Fatal error: Uncaught TypeError: explode() expects parameter 2 to be string,null given in /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php:322
    Stack trace:
    #0 /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php(322): explode(':', NULL, 3)
    #1 /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php(301): Magento\Framework\Encryption\Encryptor->explodePasswordHash(NULL)
    #2 /var/www/html/Project1/vendor/magento/module-customer/Console/Command/Upgr                                                                             adeHashAlgorithmCommand.php(69): Magento\Framework\Encryption\Encryptor->validateHashVersion(NULL)
    #3 /var/www/html/Project1/vendor/symfony/console/Command/Command.php(255): Ma                                                                             gento\Customer\Console\Command\UpgradeHashAlgorithmCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #4 /var/www/html/Project1/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\C in /var/www/html/Project1/vendor/magento/framework/Encryption/Encryptor.php    on line 322


texts: Secure store url with store code in CMS page or block

texts:
How can I get secure store url with store code in CMS page or block?

e.g. https://www.mydomain.com/storecode/ should be generated..


texts: Sending custom email to multiple email address issue

texts:
This is my code:

$mail = Mage::getModel('core/email');
        $mail->setToName('My Name');
        $mail->setToEmail('email1@gmail.com','email2@gmail.com');
//        $mail->setToEmail($this->getStoreSalesEmail(), $this->getCustomerEmail());
        $mail->setBody($html);
        $mail->setSubject('You have changed your subscription date');
        $mail->setFromEmail('noreply@myemail.com');
//        $mail->setFromName("Msg to Show on Subject");
        $mail->setType('html');// YOu can use Html or text as Mail format

I received the email to this address: email1@gmail.com. But for email2@gmail.com I do not receive any email. Why ?


texts: Configurable Products Images Not Showing

texts:
I have a configurable product set up with two simple products associated to it. For demonstration purposes I have used the configurable product "Pet Test" with the two simple products "Test Product Dog" & "Test Product Cat".
The url for demonstration is: https://www.design-a-cake.co.uk/pet-test.html

The initial problem I had was I got the error:
Invalid method Mage_Catalog_Block_Product_View_Media::isGalleryImageVisible

I added the function as such in Media.php that I found in a template file online (cannot be sure if it is correct)

    public function isGalleryImageVisible($image)
{
    if (($filterClass = $this->getGalleryFilterHelper()) && ($filterMethod = $this->getGalleryFilterMethod())) {
        return Mage::helper($filterClass)->$filterMethod($this->getProduct(), $image);
    }
    return true;
}

Now the url loads fine but it does not get the child images when they are selected in the dropdown, it simply shows the parent image but larger? The description changes but is duplicated. If you look at the url you will see quite clearly the issues.

Does anybody have any ideas about this?
Thank you.


texts: Error Report - There has been an error processing your request

texts:
After moving site to local server, getting the following error on frontend:

There has been an error processing your request

This is what I'm getting in reports:

/Applications/MAMP/htdocs/mysite.local/store/var/report/1260889028470 ; exit;
users-iMac-3:~ user$ /Applications/MAMP/htdocs/mysite.local/store/var/report/1260889028470 ; exit;
/Applications/MAMP/htdocs/mysite.local/store/var/report/1260889028470: line 21: syntax error near unexpected token `}'
/Applications/MAMP/htdocs/mysite.local/store/var/report/1260889028470: line 21: `#20 {main}";s:3:"url";s:30:"/store/tools-and-supplies.html";s:11:"script_name";s:16:"/store/index.php";}'

Any idea what the issue and/or resolution is? Thanks in advance.

UPDATE

I was able to resolve by removing an additional and alternatively named local.xml (OFFlocal.xml) file that I had in same dir. I had one for local server and one for live server.  Just used same local.xml and commented unused db credentials accordingly.


texts: Magento 2 : which event should I use when want to add free item in cart?

texts:
when purchase a Product X, want to add product Y automatically to code.
It saves in cart but 'save' function is goes into loop because it also has event as 'checkout_cart_save_after'.

events.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_cart_save_after"> <!-- checkout_cart_save_after, checkout_cart_product_add_after -->
    <observer name="add_gift_to_cart" instance="Product\AddGift\Observer\AddFreeProductToCart" />
</event>
</config>

and observer :

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $items = $this->_cart->getQuote()->getAllVisibleItems();
    $isFreeItem = 0;

    foreach($items as $item) {
        $productId = $item->getProductId();
        $_product = $this->_product->create()->load($productId);
        $has_free_product = $_product->getHasFreeProduct();

        if($has_free_product){
            $free_product_sku = $_product->getFreeProductSku();

            if($free_product_sku){
                $isFreeItem = 1;
            }

        }
    }

    if($isFreeItem) {
        $free_product = $this->_product->create()->load($_product->getIdBySku($free_product_sku));
        $params = array(
            'form_key' => $this->formKey->getFormKey(),
            'product_id' => $free_product->getId(), //product Id
            'qty'   => 1, //quantity of product
            'price' => 0
        );

        $free_product->setPrice(0.00);
        $this->_cart->addProduct($free_product, $params);
        $this->_cart->save();
    }
}

Please suggest any solution.
Thanks in Advance.


texts: Change Salesrule DiscountAmount in Install Script

texts:
I want to change the amount of a specific sales rule via an instsall script.

This is my install code:

$inviterValue = "5";
$inviterId = Mage::getStoreConfig('xxx/bm_invitation_coupon_ids/inviter_coupon_id');
$inviteeValue = "15";
$inviteeId = Mage::getStoreConfig('xxx/bm_invitation_coupon_ids/invitee_coupon_id');

/** @var Bm_SalesRule_Model_Rule $couponsChange */
$couponsChange = Mage::getModel('salesrule/rule');
$couponsChange->load($inviterId)->setDiscountAmount($inviterValue)->save();

If I use this code in a phtml file, the change is applied. If I have this in my install-0.0.1.php, it does not.

Why and how could I fix it?


texts: Size dropdown not coming in Magento 2 CE

texts: I am facing an issue in Magento 2 CE. I have created configurable products with their respective simple products with size options. But I am unable to see the dropdowns of size on product detail page.


texts:
I'm trying to export a set of image information from Magento 1.9 via SQL. I'm trying to get an output format like this:

sku, value, position
1234, a/b/example.jpg, 2

Tables involved:

catalog_product_entity (sku)
catalog_product_entity_media_gallery (value)
catalog_product_entity_media_gallery_value (position)


texts: tables which are affected by the save button of magento admin panel?

texts:
I would like to know which tables are affected by the save button im trying it into magento admin panel, and i wanna know it cuz i have to know wich are this tables in my data base

please help me as soon as possible


texts: how to get a dynamic customer attribute option from eav_atrribute_option _value table in magento 2

texts:
how to get a dynamic attribute options from eav_atrribute_option _value table in magento 2

  app/code/Cm/CustomerAttribute/Model/Plugin/Checkout/LayoutProcessor.php

  <?php
namespace Cm\CustomerAttribute\Model\Plugin\Checkout;

class LayoutProcessor
{
    /**
     * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
     * @param array $jsLayout
     * @return array
     */
     public function __construct(\Bootsgrid\CustomerAttribute\Helper\Customerattribute $helper)
    {
        $this->helper = $helper;
    }

    public function afterProcess(
        \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
        array  $jsLayout
    ) {

 $attributeCollection = $this->helper->getUserDefinedAttribures();

    if ($attributeCollection->getSize() > 0)
    {
         foreach ($attributeCollection as $attribute)

       {
        if ($this->helper->isAttribureForCheckoutRegister($attribute->getAttributeCode()))
        {
        $frontEndLabel = $attribute->getStoreLabel($this->helper->getStoreId());
        $attributeCode = $attribute->getAttributeCode();
        $getAttributeCodeFunction = "get" .  str_replace(' ', '', ucwords(str_replace('_', ' ', $attribute->getAttributeCode())));
        $fieldRequiredClass = ($attribute->getIsRequired()) ? 'true' : '' ;
        $fieldFrontendClass = ($attribute->getFrontendClass()) ? $attribute->getFrontendClass() : '';
        $fieldInput =$attribute->getFrontendInput();
        if($fieldInput == 'text')
        {
            $fieldInputType = 'input';
            $fieldAbstract =  'abstract';
        }
        elseif ($fieldInput == 'date') {
           $fieldInputType = 'date';
           $fieldAbstract =  'abstract';
        }
        elseif ($fieldInput == 'select') {
           $fieldInputType = 'select';
           $fieldAbstract =  'select';
        }
        elseif ($fieldInput == 'multiselect') {
           $fieldInputType = 'multiselect';
           $fieldAbstract =  'abstract';

        }
        elseif ($fieldInput == 'boolean') {
           $fieldInputType = 'boolean';
           $fieldAbstract =  'abstract';

        }
         elseif ($fieldInput == 'textarea') {
           $fieldInputType = 'textarea';
           $fieldAbstract =  'abstract';

        }
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children'][$attributeCode] = [
            'component' => 'Magento_Ui/js/form/element/'.$fieldAbstract.'',
            'config' => [
                'customScope' => 'shippingAddress.custom_attributes',
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/'.$fieldInputType.'',
                'id' => $attributeCode
            ],
            'dataScope' => 'shippingAddress.custom_attributes.'.$attributeCode.'',
            'label' => $frontEndLabel,
            'provider' => 'checkoutProvider',
            'visible' => true,
            'validation' =>[$fieldFrontendClass , 'required-entry' => $fieldRequiredClass],
            'sortOrder' => 250,
             'options' => [
                [
                    'value' => '',
                    'label' => 'Please select a value ',
                ],

 [
                    'value' => '1',
                    'label' => 'Silver level ',
                ],
            ],
            'id' => $attributeCode
        ];

        }
       }
     }
     return $jsLayout;
    }
}

image:


texts: signup for the newsletter is not working, another user is using the same email address

texts:
I want to start using the newsletter on my site. I have three users so I know which email is used.
When I try to register a user for the newsletter it gives me an error:

"Er was een probleem bij het inschrijven: Dit emailadres wordt al door een andere gebruiker gebruikt"

That is Dutch for:

"This email address is already assigned to another user." coming from locale mage_newsletter

Tried different email addresses but always the same message. Anyone who can help me with this? I could not find anything on google about this.
I am rather new to magento.
version 1.9.0.1

Thanks in advance.
Aaron