texts: Get product position from specific category in attribut.phtml

texts:
In Magento 1 we used this code, to get and display the position number in attributes.phtml. How can I change it for Magento 2?
$yourCatIds = array(111);
$productCats = $_product->getAvailableInCategories();
if (count(array_intersect($yourCatIds,$productCats))) {
    echo $this->__('Position: ');}

$yourCatIds = array(111);
$productCats = $_product->getAvailableInCategories();
// Returns all product ids with its position
$category = Mage::getModel('catalog/category')->load($yourCatIds);
$productPositions = Mage::getResourceModel('catalog/category')->getProductsPosition($category);
$CatIds = array(2);
$productCats = $_product->getAvailableInCategories();
    if (count(array_intersect($yourCatIds,$productCats))) {
    echo $productPositions[$_product->getId()];
}


texts: Add custom 'select' statement to Collection Magento 1.9

texts:
I am working with custom grid. I have a literal value I need to pass to _prepareColumns(). Rather than setting up a custom renderer, I want to just add the literal value to the main collection.

In mysql it would be something like:

SELECT *, "my literal value" as "my_column" from some_table;

Is there any way I can add this to:

$collection = Mage::getModel('me/mymod')->getCollection();

Else, is there another way I can pass a value from _prepareCollection() to _prepareColumns() without using custom renderer?


texts:
When I upload a product image the file uploads fine but on completion magento then shows this error:

  Warning: Invalid argument supplied for foreach() in
  ..../app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php
  on line 91

I have checked that there the protected_extensions node is present in

app/code/core/Mage/Core/etc/config.xml

And also I have grepped for protected_extensions across the whole site so I know this is not being interfered with elsewhere.

This link : http://www.codegithub.com/watch?v=CBN6qgxxgUxX
suggested that the presence of a null value for the

path => 'general', value => NULL

in the core_config_data table stops something working but deleting this didn't help. It doesn't suggest further actions and I don't understand how to investigate that further.

Can anyone advise ways to resolve where this problem has come from.
The site was working fine until recently and can't identify any changes we have made that would have this affect.

UPDATE:
Have tried disabling all extensions but that doesn't help, can anyone point me to where I can get more understanding of this aspect of the system I am bogged down in terms of understanding how this is happening.

UPDATE2:
SQL query suggested below does return no records as suggested.
config.xml is also as it should appear.

var_dump(Mage::helper('core')->getProtectedFileExtensions());

returns null not array so to get the site working I have hacked the validator function to check for an array but this has effectively disabled the protected files function so I need to resolve this in the long term.

this is defined as the constant in getProtectedfileExtensions:

const XML_PATH_PROTECTED_FILE_EXTENSIONS= 'general/file/protected_extensions';

and

Mage::getStoreConfig(self::XML_PATH_PROTECTED_FILE_EXTENSIONS, $store);

returns null not any kind of array.

In desperation I even tried changing config.xml to 775 just in case there was some permissions issue.

I feel like I am missing some piece of understanding about magento config, anyone suggest the next step?


texts:
The stockqty text (only 4 left) moves my in stock-label from being displayed beside the price.

Where would I go to make sure that the qty is shown below the label instead?


texts:
I have create Custom login form. Copy default login.phtml file and create other login-details.phtml file.

Now in Product List page i want to Login Form After login Customer see products in listing. Now i set condition to check login with session its working fine but after login i want to redirect Product Listing page. Currently its redirect to My Account Dashboard.

Any one have solution for thi.


texts: How to show loader on custom checkout page in Magento 2?

texts:
I have created some steps in magento 2 on saving the data an ajax is fired.
I want to show loader between start and complete process how to i achieve that.
My JS file for saving the data is :
define(
[
    'jquery',
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/model/url-builder',
    'Magento_Checkout/js/model/error-processor',
    'mage/url'
],
function ($, quote, urlBuilder, errorProcessor, urlFormatter) {
'use strict';

return {
    /**
     * Save SimpleNote ibn the quote
     *
     * @param simpleNote
     */
    $('body').trigger('processStart');
    save: function (simpleNote) {
        if (simpleNote) {
            var quoteId = quote.getQuoteId();
            var url;

            url = urlBuilder.createUrl('/carts/mine/set-simple-note', {});

            var payload = {
                cartId: quoteId,
                simpleNote: {
                    simpleNote: simpleNote
                }
            };

            if (!payload.simpleNote.simpleNote) {

                return true;
            }

            var result = true;

            $.ajax({
                url: urlFormatter.build(url),
                data: JSON.stringify(payload),
                global: false,
                contentType: 'application/json',
                type: 'PUT',
                async: false
            }).done(
                function (response) {
                    result = true;
                    $('body').trigger('processStop');
                }
            ).fail(
                function (response) {
                    result = false;
                    errorProcessor.process(response);
                    $('body').trigger('processStop');
                }
            );

            return result;
        }
    }
};
});


texts:
I'm using 2.3 centos7 vpserver

I have Access denied in domaine.com/index.php/customer/account/ after login ?

How can fix it, please help!

exception.log

  [2018-12-30 18:27:04] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'XXX_sql_name1.inventory_stock' doesn't exist, query was: SELECT inventory_stock.stock_id FROM inventory_stock {"exception":"[object] (Zend_Db_Statement_Exception(code: 42): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'XXX_sql_name1.inventory_stock' doesn't exist, query was: SELECT inventory_stock.stock_id FROM inventory_stock at /home/XXX/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'XXX_sql_name1.inventory_stock' doesn't exist at /home/XXX/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []


texts: Magento 2 Templates: How `$block` is assign in template?

texts:
Can you please tell me where the assignment of the $block variable to the template occurs?

\Magento\Framework\View\TemplateEngine\Php::render()

I found :

 $tmpBlock = $this->_currentBlock;
 $this->_currentBlock = $block;
 extract($dictionary, EXTR_SKIP);
 include $fileName;
 $this->_currentBlock = $tmpBlock;

But I don’t understand how the $block variable gets into the current symbol table? From where is $block taken in the template?


texts:
I have one bundle product with some options. When I change status or available stock of simple product,

this is not reflected in bundle product. this disble product is showing in api response,


texts: "Create an Account" Button sends user to Home page

texts:
When the user clicks the "Create an Account" button on the login page, instead of being directed to the account creation page they are taken to the home page.

  I cannot see any reason for this, this feature used to work. I can
  only guess that it has something to do with the SSL
  implementation. Does anyone have any ideas?


texts: Error during upgrade from Magento 2.4.1 to 2.4.2

texts:
I'm trying to upgrade to Magento 2.4.2, and looking for a fix to the following message that appeared. Please suggest what I should have done to prevent it.
equire magento/product-community-edition=2.4.2 --no-update
Warning from https://repo.packagist.org: You are using an outdated version of Co                                                                                mposer. Composer 2 is now available and you should upgrade. See https://getcompo                                                                                ser.org/2
Magento Open Source 2.4.2 is trying to change the existing order of the require                                                                                section.
Local order:
   [
      magento/composer-root-update-plugin,
      magento/product-community-edition
   ]
Magento Open Source 2.4.2 order:
   [
      magento/product-community-edition,
      magento/composer-root-update-plugin
   ] but it will not be changed. Re-run using --use-default-magento-values or --                                                                                interactive-magento-conflicts to override with the Magento order.
Magento Open Source 2.4.2 is trying to update require-dev:dealerdirect/phpcodesn                                                                                iffer-composer-installer to ^0.7.0 from ^0.5.0 in Magento Open Source 2.4.1 but                                                                                the field has been removed in this installation and will not be changed.  Re-run                                                                                using --use-default-magento-values or --interactive-magento-conflicts to overri                                                                                de with Magento values.
Updating composer.json for Magento Open Source 2.4.2 ...
./composer.json has been updated

Message below displayed on running the command composer require magento/product-community-edition=2.4.2 --no-update --use-default-magento-values
Magento Open Source 2.4.2 is trying to change the existing order of the require                                                                                section. Local order: [ magento/composer-root-update-plugin, magento/product-community-edition ] Magento Open Source 2.4.2 order: [ magento/product-community-edition, magento/composer-root-update-plugin ] Overriding local order due to --use-default-magento-values. Magento Open Source 2.4.2 is trying to update require-dev:dealerdirect/phpcodesn                                                                                iffer-composer-installer to ^0.7.0 from ^0.5.0 in Magento Open Source 2.4.1 but                                                                                the field has been removed in this installation Overriding local changes due to --use-default-magento-values. Updating composer.json for Magento Open Source 2.4.2 ... ./composer.json has been updated


texts: Fatal error: Call to undefined method Controller::getProductUrl()

texts:
once we click on button in product view page, we are creating New Product Programatically & now i am trying to redirect to Newly created Product's url after click on same button.

Error :

Fatal error: Call to undefined method Amasty_Example_AmastyController::getProductUrl() in line :

$result['redirect'] = $product->getProductUrl();

  code

public function createSimpleProductAndRedirectAction()
{

$originalProductId = $this->getRequest()->getParam("id");
$originalProduct = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($originalProductId);

      if ($product = $this->_createProduct(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, true, $originalProduct))
         {
            if(Mage::getSingleton('customer/session')->isLoggedIn())
                {
                   $result['redirect'] = $product->getProductUrl();
                   $result['message'] = "Your Image Saved";
                   return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
                }
         }
}

protected function _createProduct($type, $doSave = true, $originalProduct, $newImagePath = "")
    {

        try {
            if (isset($login) && (is_array($login) && !empty($login)) || ($login != "")) {

                $result['redirect'] = $this->_getRefererUrl() ? $this->_getRefererUrl() : Mage::getUrl('customer/account', array(
                    '_secure' => true
                ));
                $result['success'] = true;

                $customerId = Mage::getSingleton('customer/session')->getCustomerId();

                $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
                return $this;
            } else {
                $customerId = "";

            }

            if(Mage::getSingleton('customer/session')->isLoggedIn()) {
                $res = $this->saveProduct($type, $doSave, $originalProduct, $newImagePath);
                $result['success'] = true;
                $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
                return $this; exit;
            } else {

            }

        } catch (Mage_Core_Exception $e) {}

        } catch (Exception $e) { }
    }

public function saveProduct($type, $doSave = true, $originalProduct)
{

            Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

            $product = Mage::getModel('catalog/product');
            $rand = rand(11, 999999999);
            $product->setUrlKey($rand);

            $product->setName($originalProduct->getName());
            $product->save();

            return $product;
}

js

_ajaxCreateImg: function(dataUrl, startNumber)
{
    new Ajax.Request(this.createImgUrl, {
        onComplete: function(response) {
            var responseData = response.responseText.evalJSON();
            if(lastRequest == 1){
                this._processAjaxResponse(response);
                window.location.replace(responseData.redirect);
            }
         }.bind(this)
     });
},


texts:
Is there any way in Magento where I can integrate Paypal with base currency INR?

I am using magento 1.9.1

PayPal gateway has rejected request. Currency is not supported (#10605:

i tried these but facing same issue

https://github.com/Meabed/Paypal-Multi-Currency-Magento

http://chandreshrana.blogspot.in/2014/07/inr-currency-convert-issue-with-paypal.html


texts: Response of rest api in magento 2.1.12 is too slow

texts:
Response of rest API in Magento 2.1.12 is too slow.

It take 15 to 20sec for load the data in website. I'm using default mode.

Anybody help me to how to increase speed of website?


texts:
I do want Order details/view rest API which is "rest/V1/orders/1" with image URL of products in an Order.

Thanks.


texts: How to install magento extension from .zip file?

texts: When I am try to install Magento extension from .zip file that time I have received some errors. Please suggest me what should I do to install it properly.


texts:
I want to display orders that are in status pending 4 days after the creation date.

In sql this work with this => SELECT * FROM sales_flat_order where DATE_ADD(updated_at, INTERVAL 4 DAY) and status = pending;

But with orm in magento this not work why ?

  $collection = Mage::getModel('sales/order')->getCollection()
                ->addFieldToFilter('status', 'pending')
                ->addFieldToFilter('updated_at',  new Zend_Db_Expr("DATE_ADD('updated_at', INTERVAL 4 DAY)"));

that does not give me the result I expect from my sql query at the top.

Can you help me please


texts: Magento 2 import new and update current products with a CSV file and cron job

texts:
I previously used Danslo ApiImport in several of my Magento 1.9.X projects  in combination with a cron job to import new products and update existing products with CSV files automatically/periodically.

I'm wondering if there is a similar free extension/module for Magento 2.X that offers the same basic import/update functionality of default Magento 2 product attributes (preferably with basic documentation on how to use it)?

Or if someone could help with an example script on how to load data from a CSV file and update product qty and price or a script to create new simple products?


texts: Purge specific Link from Magento 2 Varnish

texts:
I am trying from console to purge and refresh one specific link of my magento 2 store in Varnish.
I don't want to clear the whole cache but just one link.

I tried:

  curl -X PURGE http://www.example.com/my/link

or

  curl -X PURGE https://www.example.com/my/link

but don't work.

Result of curl is:

<!DOCTYPE html>

    <title>400 X-Magento-Tags-Pattern or X-Pool header required</title>

Error 400 X-Magento-Tags-Pattern or X-Pool header required

X-Magento-Tags-Pattern or X-Pool header required

Guru Meditation:

XID: 3000241

Varnish cache server

Then I tried with varnishadm

varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret ban "req.http.host == example.com && req.url == /my/link"

This seems working but I am not sure. I used "ban" there and I don't know if with this I excluded this link from Varnish?

I use Magento 2 default.vcl, Varnish 6 and Nginx.
I saw that Magento's vcl has this section for purging:

acl purge {
    "localhost";
}
sub vcl_recv {
    if (req.method == "PURGE") {
    # check if the client is allowed to purge content
        if (client.ip !~ purge) {
            return (synth(405, "Method not allowed"));
        }
        # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header
        # has been added to the response in your backend server config. This is used, for example, by the
        # capistrano-magento2 gem for purging old content from varnish during it's deploy routine.
        if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) {
            return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
        }
        if (req.http.X-Magento-Tags-Pattern) {
          ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
        }
        if (req.http.X-Pool) {
          ban("obj.http.X-Pool ~ " + req.http.X-Pool);
        }
        return (synth(200, "Purged"));
    }

As I understand this section with the appropriate insert in

  env.php

it permits to clean Varnish from magento admin which for me it works.

But why with

  curl -X purge

can't clear one link?

What I do wrong? Can somebody explain please all these?


texts: Creating a Transactional Email for a Contact Form

texts:
I want to create a transactional email to send to customers when they complete our contact form.

I have no issues with creating the content and copy for the email, but need guidance on a couple of points.

Is there way to personalise the email to each customer? I want the email to say Hello [Customer Name]. Is this possible?
Once the transactional email is created, how do I ensure it is send out when the contact form has been completed?

Many Thanks


texts: Blank "column main" if static block only on CMS Page

texts:
I created a CMS Page, where I included a ".phtml" file with block-->Widget.

On that CMS Page, I only have that ".phtml" file pulling in and no other content at all.

Now there is a blank "column main" div on that CMS page. How can I remove this?

The "Column main" shouldn't even be there, if there is no content in it..


texts: Fatal error after changing robot.txt setting

texts:
Working on Magento 2.1.8 and PHP 7.
I have changed in Admin Panel

  Stores -> Configuration -> Catalog -> XMLSitemap -> Search Engine Submission Settings the value of "Enable Submission to Robots.txt" to
  Yes.

Following error message I got:

  Fatal error: Class Zend\Stdlib\ArrayObject contains 1 abstract method
  and must therefore be declared abstract or implement the remaining
  methods (IteratorAggregate::getIterator) in
  C:\xampp\htdocs\pferd\vendor\zendframework\zend-stdlib\src\ArrayObject.php
  on line 22

Following the beginning of file ArrayObject.php

namespace Zend\Stdlib;

use ArrayAccess;
use Countable;
use IteratorAggregate;
use Serializable;

 **line 22** class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable

How can I reverse the change? I have no access anymore to AdminPanel to reverse the change.
Thanks


texts: Is there an easy way to "flag" all orders that are created due to a Google shopping click?  E.g. set an attribute to 1 where orders had come via Google shopping?


texts: Random search term showing up in the searchbox

texts:
I've noticed recently that on one of our stores, random search terms start showing up in the searchbox. They're specific terms, previously searched by customers. The problem is however, it happens at random, and I haven't been able to reproduce the issue ever since, but it does happen to our customer.
For example:

Does anyone happen to know where this is coming from?


texts: I have installed theme it works fine but later I found that some links on my theme not working ..so I want to know how to install theme on localhost and how to import database of theme on localhost in magento 2.3


texts: Upload file using Ajax in custom form in Magento

texts:
I have created a Custom Module for admin in Magento.

I am using a form and I have a file field in that form.

How I can upload image using Ajax in my custom module in Magento.

I have searched on Google but didn't find any perfect solution.

Somebody please suggest me what to do.?


texts: Magento 1.9.1- vsprintf() Too few arguments in app/code/core/Mage/Core/Model/Translate.php line 416

texts:
After an update from Magento 1.7 to 1.9.1 .I get the following error:

Array (

[type] = 2 [message] = vsprintf(): Too few arguments [file]   /home/admin/domains/domainname.com/public_html/app/code/core/Mage/Core/Model/Translate.php [line] = 416

)

On line 416 this line is visible: $result = @vsprintf($translated, $args);
Does anyone know how i can solve this?

Below the full code of the function

    /**
     * Translate
     *
     * @param   array $args
     * @return  string
     */

    public function translate($args)
    {
        $text = array_shift($args);

        if (is_string($text) && ''==$text
            || is_null($text)
            || is_bool($text) && false===$text
            || is_object($text) && ''==$text->getText()) {
            return '';
        }
        if ($text instanceof Mage_Core_Model_Translate_Expr) {
            $code = $text->getCode(self::SCOPE_SEPARATOR);
            $module = $text->getModule();
            $text = $text->getText();
            $translated = $this->_getTranslatedString($text, $code);
        }
        else {
            if (!empty($_REQUEST['theme'])) {
                $module = 'frontend/default/'.$_REQUEST['theme'];
            } else {
                $module = 'frontend/default/default';
            }
            $code = $module.self::SCOPE_SEPARATOR.$text;
            $translated = $this->_getTranslatedString($text, $code);
        }

        //array_unshift($args, $translated);
        //$result = @call_user_func_array('sprintf', $args);

        $result = @vsprintf($translated, $args);
        if ($result === false) {
            $result = $translated;
        }

        if ($this->_translateInline && $this->getTranslateInline()) {
            if (strpos($result, '{{{')===false || strpos($result, '}}}')===false || strpos($result, '}}{{')===false) {
                $result = '{{{'.$result.'}}{{'.$translated.'}}{{'.$text.'}}{{'.$module.'}}}';
            }
        }

        return $result;
    }


texts: How to take Product attribute value and pass in JS?

texts:
I want to get attribute value which is date and wants to pass it into JS file, I have my JS files linked up properly, basically I am displaying timer in product detail page and I want to display timer based on dynamic attribute value.

I am very new to magento 2 and I don't know where to start:

I am using this in my hello.phtml

<?php
$attribute = $_product->getResource()->getAttribute('attribute_code');
$attribute->getFrontend()->getValue($_product);
$attribute->getFrontendLabel();
?>
<div data-mage-init='{"hello": {"message": "HELLO WORLD!"}}' id="testdiv">
    Content
</div>

My hello.js

define([
        "jquery"
    ], function($){
        "use strict";
        return function(config, element) {
            console.log("Asd");
            var deadline = new Date("Apr 15, 2020 15:37:25").getTime();
            var x = setInterval(function() {
                var now = new Date().getTime();
                var t = deadline - now;
                var days = Math.floor(t / (1000 * 60 * 60 * 24));
                var hours = Math.floor((t%(1000 * 60 * 60 * 24))/(1000 * 60 * 60));
                var minutes = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60));
                var seconds = Math.floor((t % (1000 * 60)) / 1000);
                document.getElementById("testdiv").innerHTML = days + "d "
                    + hours + "h " + minutes + "m " + seconds + "s ";
                if (t < 0) {
                    clearInterval(x);
                    document.getElementById("testdiv").innerHTML = "EXPIRED";
                }
            }, 1000);
            //document.getElementById("testdiv").innerHTML="newtext";
            //alert("test");
        }
    }
)

Can anyone help me out, from where I can get attribute value and pass it to JS.


texts: Completely removing the  element at the top that page

texts:
I am new to Magento, and am modifying Magento 2.2.
There is a  element at the top of the page which I cannot get it removed. This is what I have already done:

I have tried to remove the content within the CustomTheme > Magento_Theme > template > html > header.phtml , but even removing the entire content in this file will not remove the  element.

I tried to remove the element through the default.xml in my custom template, using the following code:
 <referenceBlock name="authorization-link" remove="true" />

But I am guessing I am using the wrong reference block name since the code did not remove it.
Any help would be greatly appreciated, also note that this is appearing after the customer is logged in. I have attached a screenshot showing what  element I want to remove, thank you.


texts: Unable to upload Category Thumbnail and Category Hover thumnail image

texts:
I am uploading the Category thumbnail image and category hover thumbnail image, but after saving the configuration both image links seems broken.

when i am clicking on the link, its not correct, it is like

i can see that the directory path is repeating itself, so , kindly help


texts: how to override $_template variable through di.xml

texts:
I am trying to update the template through di.xml in the admin section. I want to change the template of Admin > Catalog > bundle > option template.

I tried the below code, but it's not working for me.

module.xml

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

di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option">
        <arguments>
            <argument name="template" xsi:type="string">Rmsundar_Bundle::product/edit/bundle/option.phtml</argument>
        </arguments>
    </type>
</config>


texts: Magento 2 : why module-checkout overrides country order?

texts:
I just wasted 3 hours trying to figure out why I couldn't seem to manipulate the order of the country_id field in the checkout shipping address only to find out that any value I insert in the customer_eav_attribute table is overridden by the magento CE code in the vendor/magento/module-checkout package. Why?!?!
What's the point of having sort order if the core code is going to override the value in the source code?
vendor/magento/module-checkout/view/frontend/layout/checkout_index_index.xml

 <item name="country_id" xsi:type="array">
       <item name="sortOrder" xsi:type="string">115</item>
   </item>


texts: How to create custom table field in system.xml of the module

texts:
Problem

I need two-column table. First — simple text field and the second should be an image.

What was done

Now I have this. The second column should be an image.

Code

class Customermap extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
{

    protected $_customerGroupRenderer;

    protected $_addAfter = false;

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Framework\Data\Form\Element\Factory $elementFactory,
        array $data = [ ]
    ) {
        parent::__construct($context, $data);
    }

    protected function _prepareToRender()
    {
        $this->addColumn('field1', [ 'label' => __('Адрес'), 'size' => 300 ]);
        $this->addColumn('customer_group', [
                'label'    => __('Customer Group'),
                'renderer' => $this->_customerGroupRenderer
            ]);

    }

}

Additional information

Saw one example with something called "GroupRender", but suppose it was wrong. In source files saw some "renders" to transfer in "addColumn" method, but can't understand how to use it.


texts: Magento2: How can I access Zend\Stdlib\Parameters Object array?

texts:
I have below result:

echo "<pre>";
print_r($data); die();

  Result

Zend\Stdlib\Parameters Object
(
    [storage:ArrayObject:private] => Array
        (
            [success_url] =>
            [error_url] =>
            [company_name] => fdgdg
            [name] =>  fgfdg
            [email] =>
            [telephone] =>  dfgdf
            [address] =>  gdfg
            [city] =>
            [state] =>
            [zipcode] =>
            [industry] =>
            [how_did_you_here] =>
        )

)

I want to access only array?


texts: Magento 1.9 Mysql Query to pull out data

texts:
I am kind of stuck getting data from magento 1.9.
The solution i needed is mysql query so that I can collect all data in one table.

The values in table i needed from different table are
product id, name, sku, description, price, imagename, image path, meta title, meta description.
I don't know much coding so definite needed mysql query.
Looking forward a solution from experience developers. Cheers


texts: What is the function of Magento\Payment\Gateway\Command\CommandPool and how to use it properly?

texts:
I installed a custom extension for my Magento 2.3 payment gateway, then i want to process the order payment in another extension, then i come across this code within the extension:
   <virtualType name="VendorModuleGatewayCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
    <arguments>
        <argument name="commands" xsi:type="array">
            <item name="capture" xsi:type="string">VendorModuleCaptureCommand</item>
            <item name="settlement" xsi:type="string">VendorModuleSettleCommand</item>
            <item name="sale" xsi:type="string">VendorModuleSettleCommand</item>
            <item name="void" xsi:type="string">VendorModuleVoidCommand</item>
            <item name="retrieve_status" xsi:type="string">Vendor\Module\Gateway\Command\RetrieveStatus</item>
            <item name="cancel" xsi:type="string">VendorModuleCancelCommand</item>
            <item name="refund_later" xsi:type="string">VendorModuleRefundCommand</item>
            <item name="refund" xsi:type="string">VendorModuleRefundCommand</item>
        </argument>
    </arguments>
  </virtualType>

I'm a little bit confused when I analyzed the above code in Vendor/Module/etc/di.xml , is it correct the above code related to \Magento\Sales\Model\Order\Payment, because when I ran $payment->void() it triggers the extension void function somewhere in the code, but when I called $payment->retrieve_status() it said undefined function. Is my understanding for this code correct? or perhaps i missed something?


texts: How to setup multi websites in the same domain?

texts:
We have website with multi stores with different languages and currencies.

We had Problem with our payment gateway because we have only one base currency , and we want our customers to buy with different currency in each store .

I have been notified that i need to create a website for each store if i want multi base currency for each store.

Would someone please guide me step by step how to do this.

Thank you in advanced .


texts: Executing JS function onclick button which is present inside form

texts:
We have button "create" and onclick "Create" button, it will create product programmatically and assign custom image to that product.

app/design/frontend/rwd/Theme3/template/aitcg - js_styles1.phtml

we are trying to do the same [ create product programtically and assign custom image ] , once we submit form by clicking "login button".
here we are creating product sucessfully, but custom image is not saving in server, to save custom image in server onclick "login" button, we are using same function that "create" button is using as below code :

app/design/frontend/rwd/Theme3/template/productlike - index.phtml

<form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect',
array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'),
'id' => Mage::registry('current_product')->getId())) ?>" id="ajaxlogin-login-form">

// code for email id and password //

<button onclick="initObservers()" type="submit" title="<?php echo $this->__('Login') ?>"
name="send" id="send2"><?php echo $this->__('Login') ?>
</button>

</form>

but still custom image is not saving in server onclick "login" button.

Is this right way ?

updated code - >

                    $images = array(
                        'thumbnail' => 'image.png', // displaying under cart
                        //'small_image' => 'image.png',
                        'image' => 'image.png' // displaying under my design
                    );

                    foreach ($images as $imageType => $imageFileName) {
                        if ($newImagePath != "") {
                            $dir  = Mage::getBaseDir('media') . DS . 'custom_product_preview/quote/';
                            $path = $dir . $newImagePath;
                        } else {
                            $dir  = Mage::getBaseDir('media') . DS . 'example/amasty/';
                            $path = $dir . $imageFileName;
                        }


texts: position attribute in whishlist.xml does not work

texts:
I would like to reorder the wishlist in top links through xml file not editing the

app\code\core\Mage\Wishlist\Block\Links.php

Wondering why below code does not work?

  <default>
        <reference name="top.links">
            <block type="wishlist/links" name="wishlist_link" />
            <action method="addLinkBlock"><blockName>wishlist_link</blockName><prepare/><urlParams/><position>100</position></action>
        </reference>
</default>


texts: Wrong URL for category image when root is set to pub directory

texts:
I want to use pub/ directory for security reasons as document root for Magento website but when i switch it, images for categories and for manufacturers (in product detail) are not displayed.

I follow Modify docroot to improve security instructions from Magento documentation and products pictures are displayed well, but URLs for categories and manufacturers images are still generated with pub/ prefix and so it ends with 404 Not found

I use

GNU/Linux Debian 10
Apache 2.4
MariaDB 10.3
PHP 7.2
Redis 5.0
Magento 2.3

Does anyone have an idea what should I do to fix this? Thanks

Update: Few other findings

Category images are show correctly in admin interface
php bin/magento indexer:reindex does not help


texts: layout file not able to render changes on certain category pages

texts:
I have made some changes to the layout using local.xml. With the original sample products and category data that I used to test the site the product listing page works as I want it to.
I recently got some more sample product and category data and the changes don't seem to work with these. One example is the top.links. In my local.xml I have

  <catalog_category_default>
    <remove name="top.links" />
    <remove name="left.reports.product.viewed" />
    <remove name="catalog.leftnav" />
    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
</catalog_category_default>

This removes the toplinks for pages containing the original products but not with the new ones. There are no layout updates set in the db for the new products and categories. The templates are also coming from the correct theme. It just looks like my custom layout file is not able to render certain changes.

In addition to the toplinks, the layered navigation is not displaying but I think it is probably the same issue.


texts: Magento 2 is there any way to add site url in admin wysiwyg editor

texts:
I am just want to put the site url in the admin wysiwyg editor. So I have search the site url like we use the {{view url=""}} in the admin.

Please suggest if anyone have used the site url in the admin wysiwyg editor.


texts: Show Regular Price (old-price) in Addition to Special Price of Bundle Products

texts:
We apply a special price or a promotion (catalog price rule e.g.) to the bundle or to a containing product.
Is it possible to show regular and special price of a bundle product like in standard simple products?

The price model and price template of bundle products seems to be completely different from standard price model. It looks like we have to duplicate lots of code to achieve this.


texts: Add same group to different sections of configuration fields

texts: Can I use already defined group with a bunch of fields in different sections of system.xml without again specifying them all ? ( Like inherit the same specific group in different sections in system.xml file but with different config_path)


texts: Magento 2: Removing "You added  to your shopping cart" message

texts:
In the file:

vendor/magento/module-checkout/Controller/Cart/Add.php

There are the lines:

$message = __(
  'You added %1 to your shopping cart.',
  $product->getName()
);
$this->messageManager->addSuccessMessage($message);

I'd like to remove this message the proper "Magento way", e.g. not just by commenting it out in the core files.

If I were to do it via a plugin, how would I remove that particular message from the queue?

I have a custom module up-and-running and have written plugins before, so I don't require a detailed answer, just the specifics for this case.


texts: How to add a 'gift basket' option during checkout?

texts:
Magento 1.9.4
Porto theme

We would like to offer our customers 2 options somewhere during check-out:

Option #1: deliver normal @ no additional charge
Option #2: deliver as gift basket for an additional charge of $30

What would be the easiest way to do that?


texts:
Does anybody know true-way to setup SendFriend page title?

There is no default title in vanilla Magento 2. It is empty.
In details: Magneto add title-suffix, if you are setup it before.

I suppose there are 2 methods only:

New Module (via XML)
Override title in themes templates

Note: title must be translatable.

Ex.:


texts: Magento 1: cookie update stops the cart from being emptied

texts:
Here's an interesting one, I have an observer on the customer_logout event:

<customer_logout>
    <observers>
        <vendor_module_customer_logout>
            <class>module/observer</class>
            <method>updateCartCountCookie</method>
        </vendor_module_customer_logout>
    </observers>
</customer_logout>

Then in my observer I have the following:

public function updateCartCountCookie(Varien_Event_Observer $observer)
{
    Mage::getSingleton('core/cookie')->set(
        $name       = "cart-count",
        $value      = Mage::helper('checkout/cart')->getSummaryCount(),
        $period     = null, // default 3600
        $path       = "/",
        $domain     = null,
        $secure     = null,
        $httponly   = null
    );
}

Following this process:

(logged out) add stuff to my cart
login
items are still in my cart
logout
items are still in my cart

Expected result: my cart should be empty, why is it still containing all my items ?


texts: Dropdown list to select model on category page

texts:
I Am Working on a cell phones battery project, so there are so many categories like micromax, intex etc.

I want a drop down menu on category page where visitors can select there phone model and then website will show result as per model, can anybody guide me how can I do that?

There are 500 products.


texts: Print Shop Product Creation, I Need Help Setting Products Up Right

texts:
I have made this thread in the hopes that someone having had my difficulty can shed light on my issue or even just some brilliant mind find a solution that I have not seen yet.  Thanks in advance!

My name is Forrest and I own a digital and screenpriting shop in Ontario.  I purchased a print shop theme a few weeks back with multiple plugins including ajax cart and file upload etc.. and everything went very well until I started creating my products. In digital printing (business cards, post cards etc..) There are many simple changeable variables (shipping option, finish option etc) that must change according to the complex variables (size, quantity etc) and inside the complex variables such as size, I must have very specific sizes as I have small printers and very large printers so from 100,250,500,750 to 1000 I will use my small printer and after that I jump to 2,500,5000,7500,10000 for my large printer as it becomes very inexpensive at that point.

With Magento I am unable to set those specific quantities and I can not simply print 1,250 it must be either 1000 or 2,500 as I know if I could print other quantities I could just set the quantity increase to 250 and leave it at that.

All this being said, my initial thought was to make quantity a custom option.. Until I realized I would not be able to change the other variables according to the price of the quantity (size, finish, shipping etc)  which is a big problem.

I looked everywhere for a solution and found a few that looked viable but turned out not to be.  I found a extension that allowed me to set custom quantity breaks however it did not format well with my theme and looked awful.. Next up I found Absolute price which allows me to set a custom option to be absolute price which will change the base price on the product which would work amazing if it worked in coalition with percentage markup on custom options.. I found that when I would set quantity as a custom option to absolute price and then make the shipping a % markup of the price, it would not change according to the new absolute price.

Any thoughts on the matter and ideas on how I can set this up to work properly?

Thanks,


texts:
Is there a way when a product is duplicated so the 'Save After Event' is not fired or the product is not actually 'saved' until the product is 100% finished.
As the product is actually getting 'created' even though it's not finished. I'm trying to prevent this.

Thanks!


texts: How to change product price to custom text Magento 2

texts:
I am planning to change product price from
Category view and product page to “coming soon” I have a new product attribute which I have created and I can see that when I edit product page from admin area.
If I enable that attribute the price is meant to change from the amount to “coming soon”
This is my Di.xml file
    <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!-- Product page -->
    <type name="Magento\Catalog\Model\Product">
        <plugin name="change_product" type="[vendor]\[module]\Plugin\Model\Product"/>
    </type>

    <!-- Price changed in category level -->
    <type name="Magento\Catalog\Block\Product\ListProduct">
        <plugin name="cataloghideprice_finalpricebox" type="[vendor]\[module]\Block\Product\ListProduct" />
    </type>

</config>

The category level works perfectly
I can see coming soon, but the issue I am having is product page isn’t changing
Please can someone direct me to the right path.


texts: Adding single template block to multiple places

texts:
I need to add a small template into multiple places in the store: catalog, search results page, product details page.

Currently in my module's layout file I have:

<layout>
    ...

    <catalog_product_view>
        <reference name="before_body_end">
            <block type="core/template"
                   template="<path_to_my_template>"/>
        </reference>
    </catalog_product_view>

    <catalog_category_default>
        <reference name="before_body_end">
            <block type="core/template"
                   template="<path_to_my_template>"/>
        </reference>
    </catalog_category_default>

    <catalog_category_layered>
        <reference name="before_body_end">
            <block type="core/template"
                   template="<path_to_my_template>"/>
        </reference>
    </catalog_category_layered>

    <catalogsearch_result_index>
        <reference name="before_body_end">
            <block type="core/template"
                   template="<path_to_my_template>"/>
        </reference>
    </catalogsearch_result_index>

    ...
</layout>

And it works like a charm.

But I do not like this solution, cause it's pretty long. Are there any ways to make the same in more short and beautiful way?


texts: Hide customer navigation links based on user group

texts:
I would like to hide link in user account customer_account.xml based on role they are in. Let say we have group B2B and i want to hide block customer-account-navigation-product-reviews-link.
To remove this block I need flowing code:
<referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>
To remove it in condition i know that I will require ifconfig
<referenceBlock name="customer-account-navigation-product-reviews-link" ifconfig="??" remove="true"/>
However i have no idea how to get that true/false condition here. Is this require special class if so were to put it and how it might look ?


texts: Magento 2: How Can I Add Field Notice To Checkout Fields?

texts:
I'd like to add a comment to some checkout fields on Magento 2.1.10 without using tooltips (that I need to remove). So I edited the checkout_index_index.xml and in shipping-address-fieldset section I've added the following:
    <item name="shipping-address-fieldset" xsi:type="array">
         <item name="children" xsi:type="array">
            <item name="telephone" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="tooltip" xsi:type="boolean">false</item>
                </item>
            </item>
            <item name="company" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="notice" xsi:type="string">My notice</item>
                </item>
            </item>
        </item>
    </item>

Tooltip is hidden but no notice appears...
Any help would be very appreciated...


texts: Where magento2.x stores country full name list for default store?

texts:
Using below code in magento2.x I can find out the list of countries with name

<?php
namespace Readymate\Samplemodule\Block;

class HelloWorld extends \Magento\Framework\View\Element\Template
{
        protected $_countryCollectionFactory;
        public function __construct(
            \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
            \Magento\Framework\View\Element\Template\Context $context,
            array $data = []
        ) {
            parent::__construct($context, $data);
            $this->_countryCollectionFactory = $countryCollectionFactory;
        }

        public function getCountryCollection()
        {
            $collection = $this->_countryCollectionFactory->create()->loadByStore();
            return $collection;
        }

        public function getCountries()
        {
            return $options = $this->getCountryCollection()
                        ->toOptionArray();
        }
}

But, I want to know where magento2.x stores all country name for "Locale- English (United States)"?
Because, I want to modify some country names e.g "Macau SAR China" to "Macau" and want to delete some country from list.


texts:
I can list all products in a CMS page using something like:

{{block type='catalog/product_list_promotion' template='catalog/product/list.phtml' toolbar_block_name='product_list_toolbar'}}

but is it possible to call the products using a block like that, while at the same time filtering on an attribute? In a ideal world, you would have a text saying attribute="my attribute name" filter="yes" but I'm guessing this doesn't exist? All googling shows so far is that I would need to custom code a new list.phtml

Is that correct? There's no quick shortcut through the admin, to filtering on an attribute?

Thanks.


texts: How to filter customer collection with its attribute?

texts: I've bunch of customer attributes, So how can I filter customer collection with its custom attribute ?


texts: Magento 2 Ui Component admin form: Can i add timezone to datetimepicker?

texts:
I have created a datetime picker in adminpanel form with ui component.

<field name="event_time">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Event Time</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="formElement" xsi:type="string">date</item>
                <item name="source" xsi:type="string">post</item>
                <item name="dataScope" xsi:type="string">event_time</item>
                <item name="sortOrder" xsi:type="number">21</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">false</item>
                </item>
                <item name="options" xsi:type="array">
                    <item name="dateFormat" xsi:type="string">yyyy-MM-dd</item>
                    <item name="timeFormat" xsi:type="string">HH:mm:ss</item>
                    <item name="showsTime" xsi:type="boolean">true</item>
                </item>
            </item>
        </argument>
    </field>

My server has utc time wich is different than my local time. So if set my time to 18:00 i get 15:00 in front end.

Is there any option that i can set so that my time saves not with my store localtime but with server time?


texts:
It seems system product stock and real stock are not in-sync.We have matched real stock and product stocks on System several times, still it gets differ after some period of time (weeks/days) it's just matter of time.

I know this is a silly question. I don't know how to reproduce this but we experience this issue for a long time. What do I need to know, what could be the possible reason for this? What can I do to prevent this? Is this is a known bug?

I'm using Magento 2.1.


texts: Apply price rule to variants of a configurable product?

texts:
Our apparel store is built with configurable products. We'd like to create a Catalog Price Rule that targets only specific variants of a configurable product. For example, all 'Guys' shirts.

It doesn't appear that this is possible out of the box with Magento unless I'm missing something. Has anyone found a way to do something like this just using Mage configuration?

Originally asked:  https://stackoverflow.com/questions/14224108/apply-price-rule-to-variants-of-a-configurable-product


texts: Add text field for each product in cart and output it in the email

texts:
I want to extend my checkout by giving my customers the possibility to write comments for each single product in their cart.

What do I need to do in order to add a field to the cart, that gets stored in the DB and is useable in emails?

Or where would I start to develop here?


texts: Magento i can get subtotal value in template files but nowhere else?

texts:
I am currently working on Magento 1.9.1 and i have really strange problem.

Right now i am using this line of code to call the subtotal value of my shopping cart in any of my template files:

$subs = Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();

When i do that i get the value in any template .phtml file.

But there is something strange..

When i try to get this value in non template files like php files stored in /app/code/local/ i can not get the value ?
The whole function:

    <?php
        class AG_Fee_Model_Fee extends Varien_Object{

            public static function getFee(){
            $subtotal = Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
                $feeAmt = Mage::getStoreConfig('checkout/fee/fee_amt');
                return $subtotal;
            }
            public static function canApply($address){
                $setFee = Mage::getStoreConfig('checkout/fee/active');
                if($setFee==1)
                {
                    return true;
                }
            }
        }

Why i can not get it there ?


texts: Magento 1.9.2.2 SUPEE-8788 v2 Hunk #1 FAILED

texts:
I have attempted to apply the new Magento security patch Magento 1.9.2.2 SUPEE-8788 but it is failing on one file as follows:

patching file app/code/core/Mage/Paypal/Model/Express/Checkout.php
Hunk #1 FAILED at 947.
Hunk #2 FAILED at 1063.
2 out of 2 hunks FAILED -- saving rejects to file app/code/core/Mage/Paypal/Model/Express/Checkout.php.rej

I had exactly the same problem with V1 of the patch but hoped the new one may resolve it.

We are using Magento 1.9.2.2 and already have patch SUPEE-7405 installed.

Can anyone help please?

Adam


texts:
I have a cron job set up where I need to get all simple products.
This is working perfectly well when I'm running the script manually but when Cron runs it it fails to retrieve the products.

I've been trying to figure out exactly what is going wrong, but it doesn't seem like any errors regarding this is getting logged.

My guess is that it might have to do with when running the cron job manually from the adminpanel the store is set or something like that. I've tried setting this manually in the cron job itself as well.

I also tested to see if I could retrieve a single product by using the regular Mage::getModel('catalog/product')->load($productId) which worked fine.

Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
try{
  $i = 0;
  $productCollection = Mage::getResourceModel('catalog/product_collection')
    ->addStoreFilter(0)
    ->addAttributeToSelect('entity_id')
    ->addAttributeToSelect('parent_sku')
    ->addAttributeToSelect('qty')
    ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
    ->addAttributeToFilter('type_id', array('eq' => 'simple'));

  Mage::log($productCollection->getSelect()->__toString(), null, 'cronlog.log');

  foreach ($productCollection as $product) {
    $this->updateStock($product);
    Mage::log("Product: " . $i++, null, 'cronlog.log');
  }

} catch (Exception $e){
  Mage::logException("Exception whit aggregating stock");
  throw new Exception($e->getMessage());
}

Mage::app()->cleanCache('catalog_product_view');


texts: Magento 2: Shipping Methods not reload automatically

texts: I have problem regarding Shipping Methods update. Shipping Methods value does not update automatically. I have to reload the page every time, so can anybody have a solution for this. I added a custom shipping method so can it be possible this thing is happening because of that.


texts: Shipment confirmation email option not showing

texts:
I have various instances of Magento running and I have a discrepancy in the admin for 2 of them - on one order section when I go to ship an order I have an option to notify the customer and on the other I don't - please see attached screengrabs - can anyone advise?

thanks


texts: Magento2.3.2: How to redirect customer to login page if not logged in before checkout?

texts: How to redirect the customer to the signin/signup page if not logged in before proceeding to checkout?


texts: Split order amount to accept offline and online payment based on vendor

texts:
I have a multi-vendor marketplace where some sellers will accept offline payments only and some sellers will accept online payments. I want the users to be able to order products from these sellers in a single order.
How can I split the amount and payment method based on the seller's chosen payment method in a single order?
My payment gateway is Stripe.


texts:
After implementing among others the Facebook Pixel, there is a strange white-space above the header of our magento website: https://www.oplader.com

Does anybody have any idea what this could be? Even with DevTools there is no way to find out.


texts:
I am trying to set up a local instance of Magento to play around with.

I am having difficulties using this image: bitnami/magento

I am able to get the homepage up but doing anything else ends with the site can't be reached.

I wasn't even able to get the homepage before. I'm getting stuck at the homepage.

I made a docker-compose file which I got a template from bitnami:

version: '2'
services:
  mariadb:
    image: 'bitnami/mariadb:10.2'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=bn_magento
      - MARIADB_PASSWORD=magento_db_password
      - MARIADB_DATABASE=bitnami_magento
    volumes:
      - 'mariadb_data:/bitnami'
  magento:
    image: 'bitnami/magento:2'
    environment:
      - MARIADB_HOST=mariadb
      - MARIADB_PORT_NUMBER=3306
      - MAGENTO_DATABASE_USER=bn_magento
      - MAGENTO_DATABASE_PASSWORD=magento_db_password
      - MAGENTO_DATABASE_NAME=bitnami_magento
      - ELASTICSEARCH_HOST=elasticsearch
      - ELASTICSEARCH_PORT_NUMBER=9200
      - MAGENTO_HOST=localhost
      - EXTERNAL_HTTP_PORT_NUMBER=8085
    ports:
      - '80:80'
      - '8085:80'
    volumes:
      - 'magento_data:/bitnami'
    depends_on:
      - mariadb
      - elasticsearch
  elasticsearch:
    image: 'bitnami/elasticsearch:6'
    volumes:
      - 'elasticsearch_data:/bitnami/elasticsearch/data'
volumes:
  elasticsearch_data:
    driver: local
  mariadb_data:
    driver: local
  magento_data:
    driver: local


texts: How to make observable array in knockout js model and bind it to html via view js in magento2

texts:
I want to make one observable array in knockout js model and this array need updating on click event:

That is what I have tried:

js/model/test.js

var testArray = ko.observableArray();

test : function(){
testArrayy()[0]=true;
testArray()[1]=false;

}

Now in js/view/test.js

I have made a test variable: test.test; and bind it with test.html:

<div data-bind:"visible:test.[0]:>test0 div</div>

But it's not working.

Does anyone know how to observe array through model and bind it via view js

All other logic I already know. I have just written pseudo for a basic idea here.

My main question is:
How to bind observable array using key and value in Magento 2?

let me give me example what i want actually to do:

INDIA
GUJARAT(visible if click on india)
RAJKOT(visible if click on gujarat)
GONDAL(visible if click on gondal)
AMERICA

there are many options which we need to visible on click

it's just a simple example


texts: Magento 2 - Overriding CSS without using !important everywhere

texts:
I'm working on a Magento 2 site at the moment for a client. Suppose my client's brand is boofar and the theme I'm trying to extend/override is foobar I've set as the parent theme using frontend/Foobarthemes/boofar/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Boofar</title>
<parent>Foobarthemes/foobar1</parent>
<media>
    <preview_image>media/preview.jpg</preview_image>
</media>

Then under frontend/Foobarthemes/boofar/web/css/source/_theme.less I've written the CSS code that I want to override. I have also tried this with _extend.less.

.magicmenu {
  .home {
    display: none !important;
  }
  .nav-desktop .level0 .level-top > span {
    font-size: 12px;
    font-weight: normal;
    text-transformation: none;
  }
}

I'm forced to use !important for anything to work here. None of the font and text stuff works in the above code.

Have I not understood the Magento 2 frontend workflow correctly?


texts: Show registration and login form on the Homepage

texts:
I need to set Registration and Login form to show on homepage of my Magento site.

I have now tried to make custom extension that enables me to choose custom template inside admin for the homepage (CMS > homepage > design > select template) and I have copied magento registration form inside my custom template - but its not working. I need to render all of the layouts, and I am not seeing registration fields.

I supose more apropriate way would be to edit layouts and set homepage to load registration and login templates. Inside local.xml of my theme.

Can anyone give me a hint, is that possible, how to do it?


texts: Plugin wont set Stock level and status - Module wont fire on Product Load

texts:
Please advise on this
I'm trying to update a stock level and status via a seperate API, and will code that when I get this working, however, I'm struggling to even set the Stock status and count to update based on information I've found on the net.

I need to run this before the product loads, as the product will most likely update and I need the screen to show the correct information. I want to use a product object as I might actually do some update on custom fields too, but for now, I'm starting simple, so any advice would be good.

UPDATE:

So I've gone done the module route, and it doesn't look like my module is firing, here is the files in the module. What kind of debugging can I use? or can anyone see anything obvious:

  /app/code/Olisco/Tpcconnector/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Helper\Product">
      <plugin name="calltpc" type="Olisco\Tpcconnector\Plugin\ApiCall" sortOrder="1" disabled="false"/>
    </type>
</config>

  /app/code/Olisco/Tpcconnector/Plugin/ApiCall.php

<?php
namespace Olisco\Tpcconnector\Plugin;

class ApiCall
{

    public function beforeinitProduct(Magento\Catalog\Helper\Product $subject, $result)
    {

        error_log("TEST");
        var_dump("TEST");
         echo "#########";
        curl_setopt($ch, CURLOPT_URL, "https://dealer.theperformance.co/");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);
        curl_close($ch);

        return $result;
    }
}


texts: Empty cart by adding product to cart /magento 2

texts:
i'm getting empty cart by adding product to cart.

what i already did:

Set cookie lifetime: 86400
Set cookie domain: http://www.domain.com/
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindexphp
bin/magento cache:clean

but still the same.
what can i do else to resolve this problem?

my magento version is : 2.1.3
thanks


texts:
Good Morning
I have uploaded (for test) all the Magento files in a directory (magento) because in the root I have installed my official domain.

When I open magento in the browser (http://www.mydomain.ext/magento) instead the installation process this error is displayed:
500 Internal Server error

Maybe magento does not support installation in a dir ?
I should perhaps modify some configuration files?

Thank for Help
Gaetano


texts: Licence in composer.json for Magento 2 marketplace

texts:
What type of licence should I use to sell my module in Magento marketplace?

Here is my example. How it could be improved?

{
    "name": "vendor/module",
    "description": "Desc",
    "type": "magento2-module",
    "version": "1.0.0",
    "license": [
    ],
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
    },
    "extra": {
        "map": [
            [
                "*",
                "vendor/module"
            ]
        ]
    }
}


texts:
I am facing an issue of cart item merge.
I have set Max cart allowed qty to 1.

Create a customer add 1 item to cart & logout, now add same item to cart as guest & now login as previously registered customer this will increase the qty to 2 in cart.
Create a customer add 1 item to cart & logout, now add different item to cart as guest & now login as previously registered customer this will merge cart.

Due to cart merge of customer & guest. This is failed As the requirement is only 1 item is allowed in cart at a time with 1 qty.


texts: How to change customer address frontend validation rules?

texts:
I have a question, How to change rules for customer address validation form ?

I found backend validation rules in Magento_Customer/view/base/ui_component/customer_form.xml, but I can't find frontend javascript rules


texts:
I want to add 3rd party module from artifacts in my project. required all modules with composer but when I run composer update at the end I have following error

Fatal error: Uncaught LogicException: Module 'Infortis_Ultimo' from '/var/www/html/app/code/Infortis/Ultimo' has been already defined in '/var/www/html/vendor/Infortis/Ultimo'. in /var/www/html/vendor/magento/framework/Component/ComponentRegistrar.php:50
Stack trace:
#0 /var/www/html/app/code/Infortis/Ultimo/registration.php(6): Magento\Framework\Component\ComponentRegistrar::register('module', 'Infortis_Ultimo', '/var/www/html/a...')
#1 /var/www/html/app/etc/NonComposerComponentRegistration.php(29): require_once('/var/www/html/a...')
#2 [internal function]: Magento\NonComposerComponentRegistration\{closure}('/var/www/html/a...')
#3 /var/www/html/app/etc/NonComposerComponentRegistration.php(29): array_map(Object(Closure), Array)
#4 /var/www/html/app/etc/NonComposerComponentRegistration.php(33): Magento\NonComposerComponentRegistration\{closure}()
#5 /var/www/html/vendor/composer/autoload_real.php(70): require('/var/www/html/a...')
#6 /var/www/html/vendor/composer/autoload_real.php(60): composerRequire5d53fefe7010e16b8a45c in /var/www/html/vendor/magento/framework/Component/ComponentRegistrar.php on line 50
Script ([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/) handling the post-update-cmd event returned with error code 255

something is wrong with the script https://i.imgur.com/UxyFP2L.png how may I fix this ?


texts:
I am looking for where the locale name declared in language pack?

We can see the list of language in admin or using command line

Store > Configuration > General > Locale Option

or

bin/magento info:language:list

I have searched in /var/www/html/magento2/vendor/magento/language-de_de (composer.json, language.xml, registration.php) but unable to find the exact name of the locale like listed in admin(German (Germany)).

Thanks.


texts: How to update product stock quantity when placing order in magento 2?

texts:
Can anyone help How to update product stock quantity when placing an order in Magento 2 programmatically?

I am new to Magento.

I need a sample example.


texts: PHP Fatal error: Class Mock_LoggerInterface contains 8 abstract >methods and must therefore be declared abstract or implement the remaining

texts:
Preconditions (*)

Magento 2.3.1 upgraded from Magento 2.3.0
Php 7.2.15
OS : Ubuntu 18.04 Bionic
Phpstorm 2019.1.1
Evnironemnt : Magento development
PHPUnit 6.5.0
magento/magento2-functional-testing-framework": "~2.3.13"

Steps to reproduce (*)

Follow the code to reproduce the error

Error

  PHP Fatal error: Class Mock_LoggerInterface_a49cf619 contains 8 abstract >methods and must therefore be declared abstract or implement the remaining >methods (Psr\Log\LoggerInterface::emergency, Psr\Log>\LoggerInterface::alert, Psr\Log\LoggerInterface::critical, ...) in /var/www/html/myproject/vendor/phpunit/phpunit-mock-objects>/src/Generator.php(264) : eval()'d code on line 1

My class code is given below

use Psr\Log\LoggerInterface;

class Foo {

    private $logger;
    private $myclassObject;

    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }
    public function Bar ()
    {
      // some code
      $logger->debug ('debug message')

    }
}

My Test Class Code is

use PHPUnit\Framework\TestCase;

class FooTest extends TestCase
{

    private $logger;
    public function setUp()
    {
        $this->logger = $this->getMockBuilder('\Psr\Log\LoggerInterface')
            ->setMethods(null)
            ->getMock();

        $this->logger->expects($this->any())
            ->method('debug')
            ->willReturn('Message Logged');
    }

    $this->myclassObject = $this->getMockBuilder('MyVendor\MyModule\Model\Foo')
    ->setMethods(['__construct'])
    ->setConstructorArgs(['$logger'])
    ->disableOriginalConstructor()
    ->getMock();

    public function testBar()
    {

        $this->assertEquals($expected_result,$this->myclassObject->Bar());
    }
}

I'm expecting a successful unit test.


texts: Trying to get property of non-object in CheckActivation

texts:
I have install via composer module disable debug log file.
https://marketplace.magento.com/maharyta-disable-debug.html

composer require maharyta/disable-debug:1.0.0

During update database:

php bin/magento setup:upgrade

get error:

 Notice: Trying to get property of non-object in /home/b2b/domains/style.pl/public_html/ven
  dor/maharyta/disable-debug/Helper/CheckActivation.php on line 62

CheckActivation.php on line 62:

/**
 * Check the activation key for the extension
 *
 * @throws Exception
 * @return bool
 */
public function checkActivationKey()
{
    if (!file_exists($this->_reader->getModuleDir('', 'Magexsto_DisableDebug') . DIRECTORY_SEPARATOR . 'key.txt')) {
        throw new Exception("\r Install the activation key, please.");
    }
    $checkKeyResponse = $this->_sendCheckKeyRequest(
        file_get_contents($this->_reader->getModuleDir('', 'Magexsto_DisableDebug') . DIRECTORY_SEPARATOR . 'key.txt')
    );
    if($checkKeyResponse->success !== true) {
        if(isset($checkKeyResponse->error_message)) {
            throw new Exception("\r" . $checkKeyResponse->error_message);
        } else {
            throw new Exception("\rYou have some problem with activation key");
        }
    }
   return true;
}

How to activate extension ?


texts: Magento 2 : Error when trying to create invoice

texts:
When trying to create invoice for order placed with bank transfer payment i got this error with message the order status is changed successfully but the order status still pending any explanation please.

  Error Message : We can't save the invoice right now


texts: update price of configurable product in product view page

texts:
Hi I am having multiple websites, for each website the price of a product is different. The price is based on the percentage given in admin panel system configuration. Each website has its own percentage value to hike the price of all the products

Suppose there is product A of 10 Rs

In website->store 1 the product price is 10 + (10*price_percentage/100)

So, to display it correctly on product details page I am editing
/default/template/catalog/product/price.phtml like

$_price = $_productPrice * $percentageValue;

Its working fine for simple product. But I have some products with custom option where the custom option is a select box. The price is not updating with percentage value by above code.

Products with custom option shows the original price only. 10Rs as per above example

How can I update the price for these products?


texts: When I type in "localhost/magento2" instead of going to the setup page, I get "Object not found" What do I need to adjust in xampp?

texts: I'm convinced that there is a configuration file in XAMPP that needs to be altered.  When I type in "localhost" I'm taking to a project that I've been working on for the past 3 weeks, instead of the htdocs folder, which is where I initially installed it(i think).  Any help will be greatly appreciated.


texts: How to change the value "privacy-policy-cookie-restriction-mode"?

texts: How can I change the value of privacy-policy-cookie-restriction-mode link to a link of my choice? I am using Magento 2.3.2. I saw this Magento 1.9 but I do not have such page. Is there something I am missing or did wrong?


texts:
<catalog>
            <rewrite>
                <category_view>FME_Layerednav_Block_Rewrite_RewriteCatalogCategoryView</category_view>
            </rewrite>
        </catalog>

class FME_Layerednav_Block_Rewrite_RewriteCatalogCategoryView extends Mage_Catalog_Block_Category_View
{
    public function getProductListHtml()
    {
        $html = parent::getProductListHtml();
        if ($this->getCurrentCategory()->getIsAnchor()){
            $html = Mage::helper('layerednav')->wrapProducts($html);
        }
        return $html;
    }
}

Can anyone know what could be wrong ?

  exception 'Mage_Core_Exception' with message 'Invalid block type:
  FME_Layerednav_Block_Rewrite_RewriteCatalogCategoryView' in
  /Applications/MAMP/htdocs/trgovine/keramoteka/app/Mage.php:595


texts: Add to cart ajax buttons not working with secure(https) cart

texts:
we added secure url to entire site by follwoing this link :

site not loading properly after adding ssl certificate

than we added secure url https to cart page by following link :

http://magento.dijksterhuis.org/securing-the-magento-shopping-cart-with-https/

i added following code in config.xml [ http://pastebin.com/HaLDM4Qn ]

under

after this add to cart button is not working .

please check the site :

http://videomergerapp.com/learners-play-number-picture-knob-puzzle.html

i followed this link :

https://stackoverflow.com/questions/11692029/magento-add-to-cart-ajax-buttons-not-working-with-securehttps-cart

but i did't got what code need to be edited for our theme.

this is our view.phtml :

http://pastebin.com/4R3ht5yg


texts:
I am trying to edit my view.phtml in my theme to build a tierprice table on my product view page so I am trying to first just list the price tiers but nothing is showing up.

I have found the following code in  : /app/design/frontend/base/default/template/bundle/catalog/product/view/tierprices.phtml

<?php
 $_product = $this->getProduct();
 $_tierPrices = $this->getTierPrices();
?>
<?php if (count($_tierPrices) > 0): ?>

 <?php foreach($_tierPrices as $_price): ?>

<?php echo $this->__('Buy %1$s with %2$s discount each', $_price['price_qty'], ''.($_price['price']*1).'%') ?>

<?php endforeach ?>

<?php endif;?>

But when I paste it the view.phtml it shows nothing. But it is working at the top of the page next to the add to cart button ( default location ).

Can anyone point me in  right direction here or see what I am doing wrong.


texts: Magento 2 Accessing specific page and redirect it to login account page if not login

texts:
I am creating a download catalog page, I want that if the customer is not logged in and try to open that URL page they will be directed to account login page.

Thanks.


texts: magento category page load time is more than2 mins

texts:
this is the category view.phtml

   <?php
    $_helper    = $this->helper('catalog/output');
    $_category  = $this->getCurrentCategory();
    $_imgHtml   = '';
    if ($_imgUrl = $_category->getImageUrl()) {
        //$_imgHtml = '
htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" />
';
        $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
    }
?>

    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

    <?php if($_imgUrl): ?>
        <?php echo $_imgHtml ?>
    <?php endif; ?>

    <?php if($_description=$this->getCurrentCategory()->getDescription()): ?>

            <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>

    <?php endif; ?>

    <?php echo $this->getChildHtml("product_finder"); ?>

    <?php echo $this->getChildHtml("top_layered_nav"); ?>
    <?php if($this->isContentMode()): ?>
        <?php //echo $this->getCmsBlockHtml() ?>

    <?php elseif($this->isMixedMode()): ?>

<?php echo $this->getProductListHtml() ?>

    <?php else: ?>

<?php echo $this->getProductListHtml() ?>

    <?php endif; ?>


texts: Call Mirasvit Sphinx Search from own controller?

texts: I am using Mirasvit Sphinx Search with good success. However, I would like to handle certain types of requests using my own controller, from which I would perform a search and process the search results. (I want to call, not override, the Mirasvit Sphinx Search controller.) I am able to trigger my own controller. How do I call the Mirasvit Sphinx Search code and process the search results?


texts:
I put the form for the checkbox how many items the user want to buy:

<?php $haveProds = $this->getHaveProducts();?>
            <?php if($_product->isAvailable() && $haveProds) { ?>

                    <?php if(!$_product->isGrouped()): ?>
                    Wählen Sie Ihre gewünschte Menge
                    <?php endif; ?>
                    <select name="qty" id="qty">
                      <?php $i = 1 ?>
                      <?php do { ?>
                        <option value="<?php echo $i?>">
                          <?php echo $i?>
                          <?php $i++ ?>
                        </option>
                        <?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMaxSaleQty()) ?>
                    </select>
                    <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                        <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
                    <?php endif;?>
                    <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                        <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
                    <?php endif;?>

            <?php }?>

from my app/design/frontend/base/default/template/catalog/product/view-adopted.phtml
to .../view/addtocart.phtml

so the user will be able to change the quantity directly above the add-to-cart button in the right box.

After that the selected value of the dropdown won't be overtaken in the cart anymore. If I click on "add to cart" now, just one item is added.

Unfortunately I can't find the function that reads this value. Can anyone help me?

Best
Vanessa


texts: Redirect contact page to the same page and add message too

texts:
I use magento 1.9.x version, I add a new contact form in product view page, but after I press Submit button the magento is redirect me to the Contact page how I can stop this redirect and remain in the same page.

I try to put this code in contact controller

            Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
           if(Mage::helper('core/http')->getHttpReferer(true)){
            $this->_redirectUrl(Mage::helper('core/http')->getHttpReferer(true));
            }
             else{
            $this->_redirect('*/*/');
            }

is work is stay in the same page but I don't see that success message:

"Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us."

How I can add that message too?


texts: into magento, I create new customer form from mobile and how to insert its value into customer table?

texts:
I want to insert some information of customer into all customer tables from outside form but I am not able to insert it and I have also used following code :

$address = Mage::getModel("customer/address");
$address->setCustomerId($customer->getId())
    ->setFirstname($customer->getFirstname())
    ->setMiddleName($customer->getMiddlename())
    ->setLastname($customer->getLastname())
    ->setCountryId('US')
    //->setRegionId('1') //state/province, only needed if the country is USA
    ->setPostcode('90210')
    ->setCity('Beverly Hills')
    ->setTelephone('123')
    ->setFax('123')
    ->setCompany('Company')
    ->setStreet('Street')
    ->setIsDefaultBilling('1')
    ->setIsDefaultShipping('1')
    ->setSaveInAddressBook('1');

try{
    $address->save();
}
catch (Exception $e) {
    Zend_Debug::dump($e->getMessage());
}

But I am getting some error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`customer_address_entity`, CONSTRAINT `FK_CUSTOMER_ADDRESS_ENTITY_PARENT_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`parent_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE )' in C:\wamp\www\magento\mmm\magento\lib\Zend\Db\Statement\Pdo.php:228
Stack trace:
#0 C:\wamp\www\magento\mmm\magento\lib\Zend\Db\Statement\Pdo.php(228): PDOStatement->execute(Array)
#1 C:\wamp\www\magento\mmm\magento\lib\Varien\Db\Statement\Pdo\Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 C:\wamp\www\magento\mmm\magento\lib\Zend\Db\Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 C:\wamp\www\magento\mmm\magento\lib\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 C:\wamp\www\magento\mmm\magento\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `cu...', Array) in C:\wamp\www\magento\mmm\magento\lib\Zend\Db\Statement\Pdo.php on line 234

Please help me and suggest me how to solve it so that I can insert some information of customer into database from outside form.
Thanks


texts: Add new tab in product edit page in admin Magento 2

texts: I'm trying to create a custom module that will add a new tab on product edit page, right under Basic Settings. Can someone provide an answer?


texts: send mail to admin if any user click on " get notified when this product is back in stock "

texts:
when out-of-stock products become available again in-stock then send automatic mail to user

So How to send email to administrator if any customer click on Sign up to get notified when this product is back in stock.


texts: How to get selected dropdown attribute in front end?

texts:
I got drop down attribute in front end with all value (attribute id = silktype)

<?php echo $this->__('Silk Type'); ?>

    <select class=" required-entry required-entry select" name="product[silktype]" id="silktype">
        <?php
             $attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product','silktype');
             $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
             $attributeOptions = $attribute->getSource()->getAllOptions();
             foreach($attributeOptions as $each){?>
               <option value="<?php echo $each[value]?>"><?php echo $each["label"]?></option><?php
             }
        ?>
    </select>

Here i need selected attribute come first in option box. Please suggest me


texts: Magento module layout xml file not working

texts:
In Magento 1.9, I have created a module and also declared financing.xml file in config.xml file.
But this financing.xml file is not calling. Actually i have written script to remove JS file. But it is not working.

   <frontend>
      <layout>
        <updates>
            <icebox_financing>
                <file>financing.xml</file>
            </icebox_financing>
        </updates>
    </layout>
</frontend>

financing.xml file content

<?xml version="1.0"?>
<layout>
    <financing_index_index>
        <reference name="head">
            <action method="removeItem"><type>js</type><name>jquery-ui-1.8.16.custom.min.js</name></action>
        </reference>
    </financing_index_index>
</layout>


texts:
I'm dealing with the Magento out of the box zoom function and I can't find a way to modify the level of zoom of it. The requirement is simple, the zoom level is to big.
Changing the image with one of better quality to reduce the size of the zoomed square is not an option for now.

Is there any chance to do this? I don't need to change the proportion of the images or anything like the things I read in other questions.
I only need to pass a value to the zoom function and make the image in the zoom square smaller.


texts: Event to add product attribute to quote item, just once and not on sales_quote_item_set_product

texts:
I am looking for a way to transfer a product attribute to quote item whenever a product is added. I came across a method in which I could write an observer to hook onto th event:sales_quote_item_set_product and set the quote item attribute based on the product attribute.

But, I don't like this approach since sales_quote_item_set_product is dispatched every time a quote item is loaded from the DB. I'd like a one time thing wherein I fetch a product attribute at the time of add to cart and add it's value in a column in quote item. Is there an event I could hook onto?

I think checkout_cart_product_add_after should be a good prospect to explore...any thoughts?


texts: Programmatically sort product Collection

texts: I have a product collection.  How does one go about sorting this collection the Magento Way?


texts:
I apologize if this is a duplicate request someplace else, but I could not find an easy way to locate it if it exists, so here we go.

I want a simple breakdown how to use the fields in the URL rewrite tool, none of the answers I see give a clear cut simple answer (maybe layman terms are needed to help).

Hopefully others can find this useful as well.

Fields used in the form:

Type: Custom
ID Path: ? - (best way to do this?)

Request Path: ? (is the old url slug such as /earrings/cubic-zircon/bella-gold?)

Target Path: ? - (is the new url path?)

Redirect: No - Yes (simple logic tells me - Yes?)

Description: ? (is this a note relating to why you redirected, internal purposes?)

Thank you for your help in advance on this.


texts: Overriding constructors for dependency injection

texts:
So, the new dependency injection approach requires me to inject everything I need into the contructor of an object. I get that.

But how is this more flexible?

For instance...

I have my own Topmenu class in my own module. It extends \Magento\Theme\Block\Html\Topmenu.

In my custom code I am missing the DataObjectFactory. So I created my own constructor. There are two issues that really bug me:

I have to copy the entire parent constructor into my own just to inject one additional object.

This is for real? It is not that I am stupid and did not get the point? I really have to do it this way? To me this is just tedious and extremely redundant. But if I don't do it, PHP just stops with an error. How is this an advantage?

Now that I have copied the constructor...

public function __construct(
    Template\Context $context,
    NodeFactory $nodeFactory,
    TreeFactory $treeFactory,
    array $data = []
) {
    parent::__construct($context, $data);
    $this->nodeFactory = $nodeFactory;
    $this->treeFactory = $treeFactory;
}

... I notice that $this->nodeFactory and $this->treeFactory are declared private. How am I supposed to extend a class/block this way?

And all this fuzz so I can have a simple dataobject that I can pass to an event I need to dispatch from my custom Topmenu.

Am I missing something here?


texts: I am New in Magento i want to Develop magento Extension I know Php and MySql and web Development . I am finding easiest way to Learn Magento developing


texts: Specific category not recognizing subcategories

texts:
I want to show a form in product view only for a specific category.

<?php if ($specificCatID == 3 ): ?>
form code
<?php endif; ?>

It is working but do not recognize the subcategories products. I need it to show the form on category (3) and all subcategories products view.

How to show the form also on subcategories products view?


texts: Implementing service contract Magento 2 deletebyid()

texts:
Implementing service contract using this method getting error of "Class string does not exist."

model/userrepository.php

 public function deletebyid($del)
    {
        $hamburger = $this->hamburger;
        $hamburger->load($del);
        if (! $hamburger->getId())
        {
            throw new NoSuchEntityException(__('Unable to find hamburger with ID "%1"', $del));
        }
         return $hamburger->delete();
    }

api/userrepositoryinterface.php

/**
 * @param int $del
 * @return string
 * @throws \Magento\Framework\Exception\NoSuchEntityException
 */
public function deletebyid($del);

../etc/webapi.xml

  <route method="GET" url="/V1/del/:del">
        <service class="Assign\RestService\Api\HamburgerRepositoryInterface" method="deletebyid"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>

i must be not using delete function properly...but i am not clear.


texts: Crop Images (category Image) on own templates

texts:
I create a new template in Magento. On that I'll get the Image-Output with this code.

  <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$categoryImage  ?>" />

How can I crop that image with max-width of 250px and keep the image ratio as well?

Thanks for your help!


texts: How to implement Magento Captcha in Contact- Us form?

texts: I need to show default magento captcha in contact-us page.


texts: How to get the Terms and conditions content in phtml?

texts:
I need help, please.

I created a cms page with id=terms
I insert in the content of web page this code:

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

I create the test.phtml file in folder:

public_html/app/design/frontend/VENDOR/THEME/Magento_Theme/templates/test
Into test.phtml I insert the code:

<?php echo "Hello World!"; ?>;

All it's alright. The output of www.dominio.com/terms is "hello world".

Now I would like changing the php code for display the Terms and Conditions configured in STORE, SETTINGS.

Can you help me, please?

Thanks


texts: How to use \Magento\Framework\HTTP\Client\Curl without self signed certificate

texts:
I am consuming API in magento 2 using

  \Magento\Framework\HTTP\Client\Curl

Its working with http but not working with https so I am getting following error.

SSL certificate problem: self signed certificate

So how to disable SSL verification using Curl class.


texts: How to get imageUrl using Jquery in magento2?

texts:
I want to change Image src using jquery in magento2,

So how can I get Imageurl in jQuery?

    <field name="default_template">
                <argument name="data" xsi:type="array">
                    <item name="options" xsi:type="object">Ktpl\BannerManagement\Model\Config\Source\Template</item>
                    <item name="config" xsi:type="array">
                        <item name="label" xsi:type="string">Demo template</item>
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="dataType" xsi:type="string">select</item>
                        <item name="formElement" xsi:type="string">select</item>
                        <item name="dataScope" xsi:type="string">default_template</item>
                        <item name="component" xsi:type="string">Ktpl_BannerManagement/js/form/element/defaultTemplate</item>
                    </item>
                </argument>
            </field>
    <field name="default_image">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="visible" xsi:type="boolean">true</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="elementTmpl" xsi:type="string">Ktpl_BannerManagement/form/element/defaultTemplate</item>
                    </item>
                </argument>
            </field>

defaultTemplate.html

<button id="id_lq27ZKqKzkY3i4p7JLoi57aNy7f2PDSk" title="Load Template" type="button" class="action-default scalable" data-ui-id="widget-button-0">
                    Load Template
                   </button>

if I will update default_template value I want to change default_image src using jQuery


texts: Collection Sort Order in Text Field - Same values are ordered randomly

texts:
I am sorting a custom collection by a text field EAV attribute (UMC was originally used to scaffold the module which has been heavily modified since).

$myCollection->setOrder('my_name', 'ASC')

my_name in this case often has the same value for many entries. Consider a collection of dogs. Many entries would have labrador as a value for breed field. There are many possible fields so keeping them enumerated in a <select> list would be cumbersome, I'd rather keep them as a text field (with my own validation so that labrador isn't mistaken as labredor or something).

The problem is that my returned results will randomly order the my_name field so that any entries with the same value will be clustered together but will be listed in a different order every time. How can I make sure this ordered collection is the same each time?


texts:
I have installed 4 price sliders from 3rd party extensions and in each one I am facing the same issue. The slider is not functioning the way I would like it.

For example, we have products from $99 - $200.

But on some of the products, the custom option is set for drop-down with different sizes of the product with a higher price for the larger product.

Product ABC is $99 but you can select the larger product from the drop-down menu for +$50 more.

The price sliders are displaying and filtering the products with the additional prices in the custom option.

The slider will display the range of $99-$200 but when you filter the slider to $120-$200 it will still display product ABC, even though product ABC is $99.


texts:
Magento 2.1.0-rc2 - Admin > Products > Catalog Listing

Its giving an below error. I have installed it with sample data.

  a:4:{i:0;s:207:"Warning:
  Magento\Framework\Locale\TranslatedLists::getCountryTranslation():
  Cannot load resource element 'AN' in
  F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Locale\TranslatedLists.php
  on line 206";i:1;s:8248:"#0
  F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Locale\TranslatedLists.php(206):
  Magento\Framework\App\ErrorHandler->handler(2, 'Magento\Framewo...',
  'F:\xampp\htdocs...', 206, Array)

Any suggestion or solution?


texts: Programmatically import multiple products with same image name in 1 transaction - Magento 2.2.6

texts:
I'm running into an error while importing multiple products with the same image name in one transaction.

  The file "/var/www/magento/pub/media/tmp/catalog/product/t/e/test.jpg" doesn't exist or not a file

=> FileSystemException in vendor/magento/framework/Filesystem/Directory/Write.php line 70:

Importing every single product in one transaction seems to work fine (duplicates the image file), but is slow for importing 50.000 - 100.000 products.

Code Snippet:

$transactionFactory = $objectManager->get('\Magento\Framework\DB\TransactionFactory');
$transaction = $transactionFactory->create();

foreach ($xml->product as $productXml) {
    $mageProduct = $productFactory->create();
    $mageProduct->setSku(...);
    $mageProduct->setName(...);
    ...

    foreach ($productXml->images as $image) {
        // /var/www/magento/pub/media/import/product/IMAGE.jpg
        if (file_exists($checkPath)) {
            try {
                $imgAttributes = [];
                if ($imageCnt === 1) {
                    $imgAttributes = ['image', 'small_image', 'thumbnail', 'swatch_image'];
                }

                // $mediaPath = import/product/IMAGE.jpg
                $mageProduct->addImageToMediaGallery($mediaPath, $imgAttributes, false, false);
                ++$imageCnt;
            }
        }
    }

    $mageProduct->setIsMassupdate(true);
    $transaction->addObject($mageProduct);
}

$transaction->save();

Example data in xml file:

Product 1 - SKU ABC

Imagename 1: abc.jpg
Imagename 2: test.jpg

Product 2 - SKU DEF

Imagename 1: def.jpg
Imagename 2: test.jpg => causing the error

While saving the first image Magento creates a tmp file and removes that file after its finished. But for the next product it doesn't create a tmp file?

Is there anything wrong with my addImageToMediaGallery call?


texts:
Does anybody know a good import module for csv?

I want an easy GUI import for remote images or/and sheets. Also I need a mapping function.

For wordpress I once used : www.wpallimport.com  wich I totally loved! Is there something similair for Magento?

gr


texts: Magento 2 Oauth request token - oauth_problem=Invalid+signature

texts: Magento 2 Oauth error invalid signature while try to get request token from postman


texts: How to get loggedin user session in magento

texts:
I created a module,that show list of user . I want to show that page to any user who is logged-in magento2 admin panel

// world.php

<?php
namespace Pulsestorm\HelloWorldMVVM\Controller\Hello;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\App\Action\Context;
class World extends \Magento\Framework\App\Action\Action
{
    protected $pageFactory;
    public function __construct(Context $context, PageFactory $pageFactory)
    {
        $this->pageFactory = $pageFactory;
        return parent::__construct($context);
    }
    public function execute()
    {
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customerSession = $objectManager->get('Magento\Customer\Model\Session');
        var_dump($customerSession->isLoggedIn());
        $page_object = $this->pageFactory->create();;
        return $page_object;
    }
}

I want to check in world.php that a person is logged in or not if it is logged in allow him to proceed else return to magento admin panel login page