texts: Magento 2 : Payment Gateway - Terms of Service

texts:
The default/core payment gateways in Magento 2 check if user has accepted terms of service before allowing checkout.

There is a sample payment gateway here for Magento 2:
https://github.com/magento/magento2-samples/tree/master/sample-module-payment-gateway

It doesn't implement terms of service validation and even if they are activated, they are not displayed for this payment gateway => the user can checkout without agreeing with the TOS.

There is some doc about field validators but nothing about the TOS validation in particular. The TOS checkbox is a bit different from other fields as it doesn't seem to be created in the module template files.

How is the TOS validation supposed to be implemented in a custom payment gateway?


texts: How to add custom row in totals section after grand total row?

texts:
I need to add a custom row below grand total row. I have tried code from

http://excellencemagentoblog.com/blog/2012/01/27/magento-add-fee-discount-order-total/

It adds custom row but above grand total. I have tried to add a large value to tag totals_sort in config.xml but it is not working.

Also when I pass value for custom row it is formatted to amount with store currency. Like if I pass value as 100 then in totals section it will be shown as $100. But I need to show it as 100 ABC

EDIT

Please see screen shot below.


texts:
Im having an issue where soap calls are failing intermittently - The calls are made from a warehouse management system so when they do fail I loose order status updates and product availability changes.

I was wondering if anyone knew of a way to run the (Soap V2) api calls on another server.

I use NGINX / PHP-FPM with a separate server running MySQL and Redis.


texts: Export script: walking through a product collection and get associatedProducts from grouped

texts:
Hey guys...

I've been working on an export script which later on should fit for MAGMI import. It will/should include category and position (which I already worked out) and associated products of grouped products which is where I got stuck with now...

Code so far looks like this:

<?php
define('SAVE_FEED_LOCATION','export.csv');
set_time_limit(1800);
require_once 'app/Mage.php';
Mage::app('default');
try{
    $handle = fopen(SAVE_FEED_LOCATION, 'w');

$heading = array(
                 '"id"',
                 '"type"',
                 '"sku"',
                 '"grouped_skus"',
                 );
$feed_line=implode(",", $heading)."\r\n";
fwrite($handle, $feed_line);

$products = Mage::getModel('catalog/product')->getCollection();
$products->addAttributeToFilter('status', 1);
$products->addAttributeToSelect('*');
$products->getSelect()->order(new Zend_Db_Expr('FIELD(e.entity_id, ' . implode(',', $productIds).')'));
$prodIds=$products->getAllIds();

$model = Mage::getModel('catalog/product');

foreach($prodIds as $productId) {

        $product = $model->load($productId);
        $product_id = $product->getId();
        $product_data = array();

        $product_data['id'] = $product_id;
        $product_data['type'] = $product->getTypeId();
        $product_data['sku'] = $product->getSku();

        $associated = "";
        #get associated skus
        if ($product->getTypeId() == 'grouped'){
            $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);

            foreach ($associatedProducts as $associatedProduct) {
                $associated .= $associatedProduct->getSku().',';
            }

        };
        $product_data['grouped_skus'] = $associated;

        $feed_line = implode(",", $product_data)."\r\n";
        fwrite($handle, $feed_line);
        fflush($handle);

}

fclose($handle);
}
catch(Exception $e){
    die($e->getMessage());
}
?>

I am not an expert in php as you can see.
Problem which appears is that the export of associated product only uses the first product of the product collection and fills the grouped_sku column with all the same entries...
I think that is because those are not loaded by product id but by the model something?
But I can't see anything to make it work...
Any ideas in this?


texts: Magento Migration from 1.9.1 to 2.1.2 error

texts:
I am using magento data migration tool. When i try to run this code

bin/magento migrate:data C:\xampp\htdocs\xxxxxx\vendor\magento\data-migration-tool\etc\ce-to-ce\1.9.1.0\config.xml

It returns an error

  [0;31m[2016-12-26 08:48:20][ERROR]: Source fields are not mapped. Document: customer_eav_attribute. Fields: is_used_for_customer_segment

There were other errors and I used map.xml to ignore them but it is not working for this error. I added this code block in my map.xml

<ignore>
<field>customer_eav_attribute.is_used_for_customer_segment</field>
</ignore>

But the error is still there. How can I fix this error?


texts: additional catalog attributes not working in catalog_category_view

texts:
In my templates I want to have access to custom product attributes on the detail page, the cart and also the category list view. This can be (or should be) easily achieved by creating a Vendor/Module/etc/catalog_attributes.xml with for example the following content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd">
    <group name="catalog_product">
        <attribute name="my_attribute"/>
    </group>
    <group name="quote_item">
        <attribute name="my_attribute"/>
    </group>
</config>

This works great in the cart or whenever I load a collection myself in custom controllers for example. The additional attributes are automatically loaded.

However for some reason it does not work in the product list of catalog_category_view. The attribute is not present in the loaded collection of the list/grid view.

Shouldn't the <group name="catalog_product"> also affect the category list view? Am I missing something?


texts: Setting a default value to the Region field in the checkout

texts:
I've been using Magento_Checkout\layout\checkout_index_index.xml to set predefined values in some of the fields like this:
<item name="company" xsi:type="array">
    <item name="config" xsi:type="array">
        <item name="default" xsi:type="string">Some value here</item>
    </item>
</item>

And it works fine for company for example. But when I try to do the same with region it doesn't work.
I understand there's some behind the scenes stuff going on with it depending on the country you choose.
Is there some way to set a default/predefined value for the region field in the checkout?


texts: Force start / add sales_clean_quotes to cron job list in Magento 2

texts:
We started to have some issues with our quotes not being cleaned correctly.
I checked list of cron jobs and could not find sales_clean_quotes in the list.
We are currently running Magento 2.3.3. How can I force sales_clean_quotes to be run? Is there a setting somewhere that might be turned off?
Shopping cart settings look ok. Is there any other settings I need to configure for the cron task to be run?


texts: Anyone know how to set offset in Magento products collection? I need to get 11 products on first collection page than on other pages I want to have 8 products, and I must know how many pages by 8 (with offset of 11) I have.


texts: magento 1 - How to addClass without JS to the dropdown filter in Admin custom grid

texts:
I want to add class to the magento admin custom grid filter dropdown.

I have dropdown in one filter column and I dont want to use JS to reduce client side load.

Is there anyway to add class while preparing column to the grid.php?

$this->addColumn('mfg', array(
   'header' => Mage::helper('manufacturer')->__('Manufacturer'),
   'index' => 'mfg_id',
   'filter_index' => 'SFOIA.mfg_id',
   'type' => 'options',
   'options' => $this->getManufacturersWithExtraOption(),
   'filter_condition_callback' => array($this, '_manufacturerCallback'),
));

I dont want add class to the column - Need class to the filter dropdown only. just in to its  html

Thank you


texts: Calling same template from 2 different layout files Magento2

texts:
Is it possible to keep the same templates phtml files in different modules and call them in different layout files?

Eg:  i have a template1.phtml in Vendor/Module1/view/front/templates/template1.phtml

where template1.phtml is called from Module1's layout file.

I need to keep the same content of template1 in template2.phtml

and can I call that template with Modules two's layout file?

If I did so, template2 is not getting called!!

UPDATE:

\Vendor\Module1\view\frontend\layout\catalogsearch_result_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\Module1\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_Module1::layer/view.phtml</argument>
      </action>
    </referenceBlock>
</body>

view.phtml in templates/layer folder

** IN Vendor\Module2\view\frontend\layout\m_result_index.xml**

 <referenceBlock class="Vendor\Module1\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_Module1::layer/view.phtml</argument>
      </action>
    </referenceBlock>

Here, calling the same view.phtml in this layout file.

But it's not getting called. (I need to get the filters in the product page, which is coming from 1st modules layout file, but not from a 2nd layout file)


texts: How to get link immediate to a tab in product in magento 2

texts:
I have a Grid View using UI and i want when click edit a record in this grid, it redirect immediate to tab custom option in Product(#product_info_tabs_customer_options).

In Magento 1.x, i create link when pass params as 'params' => array('tab' => 'id_of_tab') in function getUrl.
In Magento 2, What do i should to pass params in function getUrl ?

Thanks in advance.


texts: Magento 2, why data-mage-init validation not working when I use knockout component

texts:
I have a phtml file with a form that used data-mage-init

<form data-mage-init='{"validation": {}}' class="form" id="custom-form" method="post" autocomplete="off">
</form>

and then I initialize a knockout component at the bottom of the page

<script type="text/x-magento-init">
    {
        "#custom-form": {
            "Magento_Ui/js/core/app": {
               "components": {
                    "mycomponent": {
                        "component": "Company_Module/js/mycomponent"
                    }
                }
            }
        }
    }
</script>

For some reason the validation only works when I remove the "x-magento-init" script at the bottom. I had to make the validation work by calling click using knockoutjs on the button and validating in the component
When the "x-magento-init" script is on the page, the submit call on the validation never seems to happen. I can't figure out why? Anyone know?


texts: Zero count on product collection after adding a price attribute

texts:
$collection = Mage::getResourceModel('catalog/product_collection');

If I echo count($collection); I get the expected response. However, if prior to that

$collection->addFinalPrice();

I get a zero size on the collection count. What is causing this?


texts:
I've overridden price-options.js's function _onOptionChanged(), but I got the error on changes variable to get defaultGetOptionValue() function.

requirejs-config

var config = {
    config: {
        mixins: {
            'Magento_Catalog/js/price-options': {
                 'VENDOR_MODULE/js/price-options': true
            }
        }
    }
};

price-options.js

define([
     'jquery',
     'underscore',
     'mage/template',
     'priceUtils',
     'priceBox',
     'jquery/ui'
 ], function ($, _, mageTemplate, utils) {
     'use strict';
     return function (priceOptions) {
         return $.widget('mage.priceOptions', priceOptions, {

             _onOptionChanged: function onOptionChanged(event) {
             ...
             else{
                    changes = defaultGetOptionValue(option, this.options.optionConfig);
                 }
             ...

Error from console

ReferenceError: defaultGetOptionValue is not defined


texts: Magento1.9.3: How to Send email with file attachment?

texts:
We have created custom form module. We don't want to save the attachment, but send it via mail. I have tried below code :

<?php
class Vendor_Module_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
    $this->loadLayout();
    $this->renderLayout();
}

public function postAction()
{
    $post = $this->getRequest()->getPost();

    if ($post){
        try {
            $name = $post["name"];
            $email = $post["email"];
            $address_line_1 = $post["address_line_1"];
            $phone_number = $post["phone_number"];
            $adhar_number = $post["adhar_number"];
            $pan_number = $post["pan_number"];
            /* $image=$_FILES["uploaded_file"]["name"]; */
                    /* $target_path = "image/";
                    $folder = $target_path.basename( $_FILES['fileToUpload']['name']);
                    move_uploaded_file($_files["uploaded_file"]["tmp_name"],$folder);  */

            $lone_type = $post["lone_type"];

            $to = "nehaseekhwal31@gmail.com";
            $subject = "Inquiry Form For Lone";
            $body .= "
The following customer have requested for lone.
";
            $body .= "
Name : " . $name . "
";
            $body .= "
Email  : " . $email . "
";
            $body .= "
Full Address : " . $address_line_1 . "
";
            $body .= "
Phone Card Number : " . $phone_number . "
";
            $body .= "
Adhar Card Number : " . $adhar_number . "
";
            $body .= "
Pan Card Number : " . $pan_number . "
";
            $body .= "
Lone Type : " . $lone_type . "
";
            $body .= "

Kind regards,

$name
";

            $from = $email;

            $mail = Mage::getModel('core/email');
            $mail->setToName($name);
            $mail->setToEmail($to);
            $mail->setBody($body);
            $mail->setSubject($subject);
            $mail->setFromEmail($from);
            $mail->setType('html');// YOu can use Html or text as Mail format

            $mail->send();

            Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.');
            $this->_redirect('*/*/');
            return;
        } catch (Exception $e) {
            Mage::getSingleton('core/session')->addError('Unable to submit your request. Please, try again later');
            $this->_redirect('*/*/');
            return;
        }
    } else {
        $this->_redirect('*/*/');
    }
}
}


texts: Magento 2 how to save my custom link titles from Magento 2 admin end

texts:
We have created a custom link type products like related at admin end & we created custom link_title for the table catalog_product_link to save the custom titles.

By custom import, we are able to save the custom titles in the catalog_product_link table.
But the problem is if the admin user saves the product at the admin end the respected link type records are being deleted and recreated by the default behavior of Magento2.

There is a file vendor/magento/module-catalog/Model/Product/Link/SaveHandler.php:: execute() which has been triggering after saving product and which is responsible for saving links.

How to overcome this issue.


texts: How to get quantity and subtotal for all products added to cart on Magento 2

texts:
I tired to get the total qty of products added to cart and also the subtotal in a custom phtml on product page.

For that i use this code but without success:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');
$totalQuantity = $cart->getQuote()->getItemsCount();
$grandTotal = $cart->getQuote()->getGrandTotal();

and:

$helper = $this->helper('\Magento\Checkout\Helper\Cart');
echo $helper->getItemsCount();

Is there another solution?


texts:
new to Magento so if i just ask something silly please be soft with me.
I'm trying to create a website using Magento 2.3. I already have translated the strings of the theme located in /app/design/mytheme/i18n - en_EN.csv. Everything is fine here but I have some other parts that I have to translate, and these stings are located no where in that csv file. For example In my registration form when i create weak password the system popups a string "Password too weak".
I want to make a store complately on my native language so I tried this.
I went in the hosting account - cPanel -> Terminal, and i did a

grep -Ril "text-to-find-here" /

command to look for that string somewhere in the files. It poped me a message saying i have no permision to do that. Anyway I also checked some modules i18n folders in the public_html/vendor/magento and no progress for now.
Here is a screenshot of the things exactly I want to translate
But keep in mind that about the pages on the screenshot (Contact, Blog for examp) I find them no where in the admin panel - blocks or CMS sections. Also the contact form and the checkout page.
Any ideas please ? :(


texts: Magento 2 Products Not Showing in Category (but are visible via search)

texts:
Got a little issue here with Categories.

Running Magento 2.1.3

All other categories display the correct amount of product, except this one

Under Products->Categories->"Kingdom Death" category shows 66 products.

However, when you go to a front-end it would only display 16 products.

Things I've done so far:

Cleared Cached
Re-indexed everything
Remove/Re-added products to the same category
Made sure the products are enabled
Made sure the items are in stock
Made sure the product visibility is set to "Catalog, Search"

I've compared those 16 products that are visible to the "invisible" ones and there is no visible changes all the parameters and attributes are identical.

Also, if I search for the "invisible" product on the site, it will display it and find it, but doesn't work if i try to find it using a category .

Greatly appreciate the help!


texts:
I found an issue on Magento 2.2.3 Customer Group.

What I did is create a new customer group named "tabellone"

Then I created i new user and selected that group: http://nimb.ws/fzQRm5

Then if I go on customers I can't see the group i just created and assigned to customer: http://nimb.ws/KTy7NJ

Also if I edit the row there is not such crated group: http://nimb.ws/malgRW

There are just the 3 defaults groups "Retailer, Wholsale, General"

I tested on my magento and on other magento.

Is that a bug?

David


texts: Regex for starting with character and rest all are digits

texts: I want a regex of length 13 in which starting word is a alphabet and rest 12   entries are digit. Something like this : A123456789764


texts: main.CRITICAL: Saving order ####### failed: Request does not match any route

texts: After upgrading to magento 2.3.5, I am getting the following error when creating an order through the admin. Front end orders are still working, but we dont know how to troubleshoot from here. We would like to be able to create orders from our admin side.


texts: how to set regionId and region Name in default shipping address

texts: how to get the value of regionId and region Name and also how could i set regionId and region name to setDefaultShipping address


texts: Customers belong to a specific group can not place order due to Invalid VAT ID error

texts:
The Invalid VAT ID error does not let the wholesale group customer place order in my wholesale store view. I have disabled Automatic Group Change Based on VAT ID and set the Default Value for Disable Automatic Group Changes Based on VAT ID. I have following questions:

1) To Enable and Configure VAT ID Validation when I go to System > Configuration and Set Current Configuration Scope to wholesale store view, in "Create New Account Options", I set the Enable Automatic Assignment to Customer Group to “Yes.” How about other fields like "Default Group"? does it matter it be General or wholesale?

2) In step 4 of this link says when Current Configuration Scope is set to the applicable store view, "Validate VAT Number button" is seen in Store Information section. However, in my case this button is visible when current store view is set to “Default Config! Should I make some configuration changes to have this button on my wholesale store view?

Thanks in advance.


texts: Magento 2 rest API not working in online server

texts:
I'm trying to integrate Magento REST API web service, but it answers me always:

  {"message":"Consumer is not authorized to access %resources","parameters":{"resources":"Magento_Backend::store"}}

I'm creating an integration and generating the keys, and locally all runs fine, but when I put it online, the communication doesn't work.

This is the result with postman:


texts: Magento 2.1: how to remove argument and/or argument item from block?

texts:
I need to remove "from - to" price in bundle product page.

So the question is how to remove item from argument?

Block is created in

  magento2/vendor/magento/module-bundle/view/base/layout/catalog_product_prices.xml

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<referenceBlock name="render.product.prices">
    <arguments>
        <argument name="bundle" xsi:type="array">
            <item name="prices" xsi:type="array">
                <item name="tier_price" xsi:type="array">
                    <item name="render_template" xsi:type="string">Magento_Bundle::product/price/tier_prices.phtml</item>
                </item>

                <!-- start: this should be removed -->
                <item name="final_price" xsi:type="array">
                    <item name="render_class" xsi:type="string">Magento\Bundle\Pricing\Render\FinalPriceBox</item>
                    <item name="render_template" xsi:type="string">Magento_Bundle::product/price/final_price.phtml</item>
                </item>
                <!-- end: this should be removed -->

                <item name="bundle_option" xsi:type="array">
                    <item name="amount_render_template" xsi:type="string">Magento_Bundle::product/price/selection/amount.phtml</item>
                </item>
            </item>
        </argument>
    </arguments>
</referenceBlock>

other possibility is that if i could override hole catalog_product_prices.xml

I tried using method http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/layout-override.html


texts: Extension preventing before_body_end from rendering anything else

texts:
I'm using an extension from Firebear for configurable products and bundled products. When I enable that extension, before_body_end only shows the Firebear block and none of the other blocks which should be there. If I disable Firebear, all the other blocks show up fine.

The only code I can see where Firebear references before_body_end is in layout/firebear_configurl.xml:

<layout version="0.1.0">
    <catalog_product_view>
        <reference name="before_body_end">
            <block type="page/html_head" name="fbfoot" as="fbfoot" template="firebear/html/foot.phtml">
                <action ifconfig="firebear_configurl/general/enabled" method="addItem"><type>skin_js</type><name>js/firebear/configurl.js</name></action>
                <action ifconfig="firebear_configurl/general/enabled" method="addItem"><type>skin_js</type><name>js/firebear/jquery.history.min.js</name></action>
            </block>
        </reference>
    </catalog_product_view>
</layout>

How could Firebear be doing this and how might I prevent it?

Update

Extension Disabled - The extension has a property called "Enable Improved Configurable Product". I set that property to "No" to disable it:

Extension enabled:


texts: addSearchFilter fails if being used in SOAP call

texts:
I have this code in a SOAP call:

private function doSearchResults($terms)
{
    try {
        $collection = Mage::getResourceModel('catalogsearch/fulltext_collection')
            ->addAttributeToSelect('*')
            ->addSearchFilter($terms);
        return $collection->getSelect();
        $collection = $collection
            ->setStore(1)
            ->addMinimalPrice()
            ->addFinalPrice()
            ->addTaxPercents()
            ->addStoreFilter()
            ->addUrlRewrite();
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
    } catch (Exception $e) {
        return $e->getMessage();
    }

    //$collection->load();
    //return $collection;
}

Notice that, to narrow the problem, I put a return sentence in the middle.

If I call this inside a custom controller, it works. If I call this inside a SOAP call, it returns the following error message:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `query_id`, `s`.`product_id` FROM `catalogsearch_fulltext` AS `s`
 INNER JOIN' at line 1

edit: How do I know that the failing method is that? Because the former code I tested was:

private function doSearchResults($terms)
{
    try {
        $collection = Mage::getResourceModel('catalogsearch/fulltext_collection')
            ->addAttributeToSelect('*');
        return $collection->getSelect();
        $collection = $collection
            ->addSearchFilter($terms)
            ->setStore(1)
            ->addMinimalPrice()
            ->addFinalPrice()
            ->addTaxPercents()
            ->addStoreFilter()
            ->addUrlRewrite();
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
    } catch (Exception $e) {
        return $e->getMessage();
    }

    //$collection->load();
    //return $collection;
}

And it worked : I debugged the select object. The text in "terms" is always set.

My question is: why does it work in a controller but not in soap?

My SOAP user has access to every resource.


texts:
I have four categories and each category has individual CMS page, and each individual page has left bar with image. Where in another Category CMS page of another image. So this continuous till four categories. So how to achieve this by call up media or should I create each template page to do this.

Can anyone help me. Thank you in advance.


texts:
I am using Magento 1.9. Let's just say the documentation and community support is extremely lacking. I have spent the last week trying to figure out how to make a simple static HTML page for the admin area of Magento. Between incomplete tutorials and outdated documentation, it's a nightmare.

I BELIEVE I am at a point now where the admin page is actually loading, but it's blank so I can't tell. I guess now I am trying to figure out how to tell the system to use the layout for this page. (Again, it's going to be a static HTML page with a paragraph of text and an embedded YouTube video).

Let's get to the work here:
This is my config.xml: - UPDATED

<config>
  <modules>
    <Cen_Tutorial>
      <version>0.1.0</version>
    </Cen_Tutorial>
  </modules>
  <global>
    <helpers>
      <cen_tutorial>
        <class>Cen_Tutorial_Helper</class>
      </cen_tutorial>
    </helpers>
  </global>
  <layout>
    <updates>
      <tutorial>
        <file>pdftutorial.xml</file>
      </tutorial>
    </updates>
  </layout>
  <admin>
    <routers>
      <adminhtml>
        <args>
          <modules>
            <Cen_Tutorial after="Mage_Adminhtml">Cen_Tutorial_Adminhtml</Cen_Tutorial>
          </modules>
        </args>
      </adminhtml>
    </routers>
  </admin>
</config>

And this is my adminhtml.xml: - UPDATED

<config>
  <menu>
    <cen translate="title" module="cen_tutorial">
      <title>PDF Tutorial</title>
      <sort_order>99</sort_order>
      <action>adminhtml/cen_tutorial/index</action>
    </cen>
  </menu>
</config>

This is my TutorialController.php: - UPDATED

Now in /app/code/community/Cen/Tutorial/controllers/Adminhtml/Cen/TutorialController.php:

<?php

class Cen_Tutorial_Adminhtml_Cen_TutorialController extends Mage_Adminhtml_Controller_Action
{
  public function indexAction()
  {
    $this->loadLayout();
    $this->renderLayout();
  }
}

This is the contents of my /app/design/adminhtml/default/default/layout/pdftutorial.xml:

<layout>
  <adminhtml_cen_tutorial_index>
    <update handle="adminhtml_cen_tutorial_index" />
    <reference name="content">
      <block type="adminhtml/template" name="tutorial" template="cen/index.phtml" />
    </reference>
  </adminhtml_cen_tutorial_index>
</layout>

And finally, the contents of my /app/design/adminhtml/default/default/template/cen/index.phtml:

<?php
  echo 'Hello, world!';
?>

This entire system and structure seems completely complicated, not well documented, and difficult to do anything with, even something as simple as creating one single use-page. What seems to be the problem with what I've pasted? I am on Magento 1.9.

I forgot to include my Helper class but it's in the source.


texts: How to get items tax_amount in magento 2.3 collectTotals()

texts:
All data I need in my module visible in next print

print_r($quote->collectTotals()->debug());

Output is show me

 Array
(
    [entity_id] => 3
    [store_id] => 1
    [base_subtotal_with_discount] => 1452.8
    [is_changed] => 1
    [trigger_recollect] => 0
    [is_persistent] => 0
    [items] => Array
        (
            [0 (Magento\Quote\Model\Quote\Item\Interceptor)] => Array
                (
                    [item_id] => 5
                    [quote_id] => 3
                    [base_price] => 54
                    [discount_percent] => 20
                    [discount_amount] => 356.4
                    [base_discount_amount] => 356.4
                    [tax_percent] => 8.375
                    [tax_amount] => 119.39
                    [base_tax_amount] => 119.39

It looks simple but how do I get the
collectTotals()->items->items['tax_amount'] ?

Simple var assign is also crash Magento

$myvar = $quote->collectTotals();


texts: How to check if a session variable exists

texts:
How we can check if a session variable exists in Mangento. I know how to create a new variable.

Mage::getSingleton('core/session')->setMyValue($myValue);

My aim is to check if session variable MyValue exists. If exists do nothing otherwise create one


texts: $_product->getQty() return 0 - Magento_Catalog default.phtml

texts:
I'm trying to override Magento/Catalog/templates/product/view/type/default.phtml
With this code :
<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Catalog\Block\Product\View\AbstractView */?>
<?php $_product = $block->getProduct() ?>

<?php if ($block->displayProductStockStatus()): ?>
    <?php if ($_product->isAvailable() && $_product->getQty() >= 1): ?>
        <div class="stock available" title="<?php /* @escapeNotVerified */ echo __('Availability') ?>">
            <?php /* @escapeNotVerified */ echo __('In stock') ?>

    <?php elseif($_product->isAvailable() && $_product->getQty() <= 0): ?>
        <div class="stock available" title="<?php /* @escapeNotVerified */ echo __('Availability') ?>">
            <?php /* @escapeNotVerified */ echo __('Preorder') ?>

    <?php else: ?>
        <div class="stock unavailable" title="<?php /* @escapeNotVerified */ echo __('Availability') ?>">
            <?php /* @escapeNotVerified */ echo __('Out of stock') ?>

    <?php endif; ?>
<?php endif; ?>

It seem that $_product->getQty() always return 0
How can I get the true stock available for my products ?
Thank you in advance !
Regards


texts: Customer receiving two order emails in magento 2.3.2

texts:
When a customer places an order, they are receiving order confirmation email twice. What is the issue with this? Please help.
I am using magento 2.3.3


texts: Where should i start working with extension development using test driven approach, with Magento 2. I do not see any resources and tutorials from where I get idea. I believe I have a fair amount of idea of unit tests in php, but doing it in magento seems very much complex. From, Where should i start working with it.


texts: Configurable product isn't displaying in categories?

texts:
I have an issue where items are not displaying in there categories, sale for example, and I am wondering if it has anything to do with the configurable product quantity which is zero, although the simple products it contains have quantities?

ss-2018-24 contains the following:
ss-2018-24-s (qty 1)
ss-2018-24-m (qty 2)
ss-2018-24-l (qty 2)

ss-2018-24 inventory has the following settings:
Manage Stock - Yes (use config settings: tick)
Enable Qty Increments - No (use config settings: tick)
Enable Qty Increments - Yes

Is the fact that the configurable product has a quantity of zero, the reason the product isn't displaying under the sale category, even though it's assigned?

Some help would be really appreciated.


texts: how many technologies are there used in magento 2?

texts:
When I started to learn Magento 2 architecture and its working flow, I found many more sub-technologies they had implemented into M2 core than PHP, prototypeJs, CSS, jQuery & html.

E.g.

nodeJs
KnowkoutJs
CSS pre-processor – LESS
JavaScript Task Runner – Grunt
M2 framework – Composition of Zend Framework
Bootstrap composer
ui_component
Dependency Injection
requireJs
Asynchronous Module Definition (AMD) & SHIM
PHP Standard Recommendations (PSR)
PHP 5.5 to 7 [Traits, ]
Redis – Key Value Cache Storage Engine
Varnish 4.0 HTTP accelerator
CSS3
HTML5
Xdebug – Debugger and Profiler Tool for PHP
Command Line Tool
Reflection
Interception
phpunit
symfony

Can any one please list all the sub-technologies list with best tutorial link of that.

By the way, I will find the tutorial from search engine. I just need to know the list.


texts: How add to category "Custom Layout Update" through install/update script

texts:
How add to category Custom Layout Update through install/update script

This don't work:

$category = Mage::getModel('catalog/category')->load($id);
$category->setCustomLayoutUpdate('some_update_there')->save();


texts:
When I want to start over with a clean database in a local/dev environment, is it enough to delete all tables and let the setup/update/data scripts (Mage, custom modules, own modules...) build up everything again?

Would you end up with a ready to go database or will I miss some important table data?

I gave it a try and at first it seems to go well, but I just wanted to double check...


texts: Magento 1.9: Simple Product is not adding To Cart programmatically

texts:
When I try to add the product to cart programmatically then give an error

  The product could not be found.

Here is my code for product add to cart programmatically.

$productId = 2783;
$cart = Mage::getSingleton('checkout/cart');
$params = array('product' => $productId ,'qty' => 1);
$product = Mage::getModel('catalog/product')
        ->setStoreId(Mage::app()->getStore()->getId())
        ->load($productId);
print_r($product->getId());
$cart->addProduct($product,$params);
$cart->save();
$session = Mage::getSingleton('checkout/session');
$session->setCartWasUpdated(true);


texts: ChannelGrabber Issues: Identical SKU's for Variants

texts:
I'm having an interesting issue with a new retail shop that's being set up. At the moment my client has a vast name for themselves on ebay and amazon and are looking to expand on this. As such, we've been building a magento shop for a while. After thinking that we were ready for launch it was picked up that some of the products weren't working the way they were supposed to. In fact, A LOT of the products weren't linked into channel grabber at all.

After a little playing around we found that the issue is to do with SKU's and the way the product variations have been laid out in channel grabber.

An example would be: We have a shirt. But the shirt has both colours and sizes listed all under the one sku for the shirt.

This wouldn't be an issue but on the retail site we're looking to SPLIT the different colours into different products.

So each colour for the shirt on magento will end up using the same sku for the configurable product listing which leads to duplicate entries.

What is the best way to work around this problem? I know editting and removing the ability for sku's to be unique is a nono. That's a given.

There are literally thousands of products so i'm trying to find out the best way to lower the amount of time required to set this up correctly. I know i can at least make new listings and split up the old ones.. are there any other ways to go about making this work that anyones had experience with?


texts: Magento 2: Allow to select swatch and option of Out of Stock product of Configurable Product

texts:
I have to allow customer to select Out of Stock product options and after this selection display stock status.

I have checked all things related this but m not getting any solution.

Please provide me some solution.


texts:
I understood that for Magento2 configurable products the associated products are created as virtual products instead of simple products, when weight is not given.

But is there any disadvantages for this? What would be different if I give weight for those virtual products and make them simple products?


texts: Magento2: Get all orders using REST API?

texts:
I want to get all orders using REST Api.
I am using this code but it's not returning any result.

Request:

$this->get('rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=entity_id');

Response:

How to get all orders using REST Api?


texts:
I've tryed to use this example (and other examples on the internet) https://webkul.com/blog/reindexing-programmatically-magento-2/ to execute reindexing programatically.

The case is I want to call reIndexing() from my custom class outside Magento 2 (example), but I almost always get "Uncaught TypeError: Argument 1 passed to CronReindexer::__construct() must be an instance of Magento\\Indexer\\Model\\IndexerFactory, instance of Magento\\Framework\\ObjectManager\\ObjectManager given..."

How to solve this?

EDIT:

/main.php

require $_SERVER['DOCUMENT_ROOT'].'/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('CronReindexer');
$bootstrap->run($app);

/CronReindexer.php

class CronReindexer {

    protected $indexerFactory;

    protected $indexerCollectionFactory;

    public function __construct(
        \Magento\Indexer\Model\IndexerFactory $indexerFactory,
        \Magento\Indexer\Model\Indexer\CollectionFactory $indexerCollectionFactory
    ){
        $this->indexerFactory = $indexerFactory;
        $this->indexerCollectionFactory = $indexerCollectionFactory;
    }

    public function reIndexing(){
       $indexerCollection = $this->indexerCollectionFactory->create();
       $ids = $indexerCollection->getAllIds();

       foreach ($ids as $indexerId) {
            $indexer = $this->_objectManager->get('Magento\Framework\Indexer\IndexerRegistry')->get($indexerId);
            $indexer->reindexAll();
        }

    }

}

Still doesn't work.


texts: Magento2 static attributes and varchar attributes

texts:
What can be said about both static attributes and varchar attributes?

  Can have exactly the same value at all store levels
  Can have different values at all store levels
  Can have backend_component
  Can be created via the admin

as per me, it is 1 and 3 ..can anyone else suggest?


texts: Magento 2: How Can I build the website front-end from scratch with API

texts:
I want to build my website front-end without using any of the default tools (Knockout, less, etc) provided by Magento2.

What are the pros and cons of this approach?


texts:
The below code is part of the login.phtml file in magento.

&nbsp;

   <button type="button" class="button" onclick="checkout.setMethod();"><?php echo ($this->getQuote()->isAllowedGuestCheckout() ? $this->__('DummyContinue') : $this->__('Register')) ?></button>

I have a couple of questions on this
1. Why is button type = "button" used - from what i gather it stays on the same page
2. What is the checkout.setMethod() for ?


texts:
I am cloning hellyhansen site. In that i need to do the checkout page.

Hellyhansen checkout page

My local magento. Based on the hellyhansen site, I need to clone the page.

Kindly help and suggest.


texts:
while installing magento manually I'm getting this error

  Forbidden

  You don't have permission to access /multifacet/ on this server.

  Additionally, a 404 Not Found error was encountered while trying to
  use an ErrorDocument to handle the request.

when I change the file name of htaccess to htaccess.1 the installation page come but it doesn't proceed further


texts: Magento 2: Order Summary expanded on page load?

texts:
I've been trying to figure out how to have the Order Summary at the checkout page expanded on page load.

I attempted many approaches, all of which failed.


texts: Discount on whole category if product from different category in cart

texts:
I got a bike category and a bike-related-products category.

If customer adds a bike to the cart there should be a global discount on bike-related-products category like 10%.

To make it clear: I only need the discount appear in cart - not in listing itself after adding a bike.

Can this be done with shopping cart rules?

Thx


texts: Show a message under shipping method in magento 2

texts:
I have created a shipping method by following this link
https://www.mageplaza.com/devdocs/magento-2-create-shipping-method/
I just wish to display a custom message under the specific shipping method.
How to display it?
Please anyone


texts:
I cannot understand the logic of what magento is doing after login submit action in onestepcheckout page.

My problem is that after login the user is redirected to My Account and I want the user to stay in the same onestepcheckout page.

Can anyone throw some light here?

<form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post" class="checkout-step-body checkout-step-style form form--checkout clearfix">

function onepageLogin(button)
{
    if(loginForm.validator && loginForm.validator.validate()){
        button.disabled = true;
        loginForm.submit();
    }
}

 <customer_login>
    <observers>
      <loadCustomerQuote>
        <class>checkout/observer</class>
        <method>loadCustomerQuote</method>
      </loadCustomerQuote>
    </observers>
 </customer_login>


texts: Staging Shopsite live on active shop. Database?

texts:
I have created a staging for our onlineshop.
I also upgraded and installed all patches.

Now I would like to put the upgraded site live.
The main question is:
Was the database also changed during the upgrade or can I continue to use the active web database?


texts: No such entity for customer grid magento2

texts:
i face the issue in magento223 version after data migration for only customer data to magento223 setup migration was successfully completed.

but in admin login in all customer grid it shows like "No such entity." how to resolve this issue can any one help out for this ?

i also done with index:reindex command and cache:clean commange still not display.

Thanks


texts:
I'd like to display a block which is currently working on my custom theme on base theme section.

<?php echo $this->getLayout()->createBlock('fblogin/fblogin') ->setTemplate('fblogin/bt_fblogin.phtml')->toHtml() ; ?>

I'm using a one-page checkout plugin and it is installed in base theme folder, How can i Display the above block there.?


texts: Magento 2 Intermittent Cache Issue - Showing a JSON code Instead of Homepage

texts:
We have a multi store running with Magento 2 and sometimes when we try to load the homepage it shows the JSON below instead of the home page, it only works again if we clean cache.

Strange enough is that if we try to navigate in any other page of the website it works just fine, it is just the homepage.

Any idea what may cause that?

{"categoryProducts":"","navigation":"","navigationTop":"","breadcrumbs":"","h1":"","title":"HIDDENSITE.com","categoryData":"

","bottomCmsBlock":"","url":"https://www.HIDDENSITE.com/","productsCount":"0","js_init":"","isDisplayModePage":"","currentCategoryId":"0","currency":"","store":"
\n
\n
\n
\n \n Canada\n \n
\n
 .options",\n "triggerTarget":"#switcher-language-trigger-website",\n "closeOnMouseLeave": false,\n "triggerClass":"active",\n "parentClass":"active",\n "buttons":null}}'>\n
\n UNITED STATES\n
\n
\n
\n
\n\n
\n Language\n
\n
\n \n \n English\n \n
\n
 .options",\n "triggerTarget":"#switcher-language-trigger",\n "closeOnMouseLeave": false,\n "triggerClass":"active",\n "parentClass":"active",\n "buttons":null}}'>\n
\n \n \n Portugu\u00eas\n
\n
\n
\n
\n
\n","store_switcher":"","behaviour":"","cmsPageData":""}


texts: Similarity between Magento Object Manager and the Spring (Java) framework

texts:
I am currently in the process of understanding the Magento 2 Object Manager.

Really good documentation by Alan Storm here

There are a lot of similarities between the Magento Object Manager and Spring (Java) core concepts. Especially -

Dependency Injection (Spring container, beans, DI via XML)
AOP (Spring does this via annotations, Magento 2 does this via XML, but both implementations are pretty similar)

Did the Magento 2 development team actively use Spring as a benchmark to re-architect Magento?


texts:
I tried to update magento 2.3 to magento 2.3.1, but it failed. I tried to backup from my server and that failed too. How do I roll back the changes to get it to back to 2.3? I followed the steps listed here, and got to step 3. I'm not sure what broke but now the site is down.
I am using ubuntu on plesk with lightsail. I do have sudo access and can ssh

EDIT
from answer below I am getting the error: rm cannot remove ... Permission denied for a lot of folders. I also got this error when I tried to update.


texts: Magento redirect from all pages if not logged in

texts:
So, I need to redirect user to some page(tt can be CMS or customer/account) if he did not logged. And on this page(CMS or customer/account) I will have a form to login/register. So, I made an observer for controller_action_predispatch event and method which will be implemented it,  I did:

public function redirectNotLogged(Varien_Event_Observer $observer)
    {
        if(! Mage::helper('customer')->isLoggedIn()){
            Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
        }
    }

But I have a problem, I cannot get to this page, because it infinitely redirect me. Any advices?


texts: Magento 2 Base Url path issue custom theme

texts:
I have a Magento 2.3.1 site installed in a subfolder and I have a problem with base URL.
When I have a link like this < a href="#" > LINK < /a > Instead of this www.domainname.com/subfolder/# I got a wrong redirect to www.domainname.com/#

This occurs only when I enable a theme I purchased (Porto Theme), with default Magento 2 this issue not occur.

I wrote to Porto Theme support but they told me that they tried to find out what/where the issue was but did not succeed.

My base URL configuration (secure and insecure) are correct, folder permission is right and mod_rewrite in my server is enabled.

In essence if in a link there is href="#" like in the remove product from cart button the site with Porto Theme enabled  redirects always and in any case to the root.

What can be the issue?

Thanks in advance


texts: What is the 'best practise' to manage Multilingual stores in Magento?

texts:
In Magento, multilingual sites are managed with store views, then we can choose different approach regarding how to manage the URLs:

"Add Store Code to URLs" (a backend setting)
Have different domain for each store views (Multi-Site, Multi-Domain Setup)

The first option will add store code at the end of the URL so if the code is en, the URL will be MYDOMAIN/en/.

This option sounds good but the note under it says:
"Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.)."

Is it safe ?

The second option is only possible if you have more than one domain and let you assign the domain to store views.

My question is what are the best practices?

There are other better solutions?


texts: How do I change Magento Success Page XML layout?

texts:
This is the content of my layout:

<checkout_onepage_success>
    <reference name="content">
        <remove name="checkout.success"></remove>
        <block type="mynamespace_mymodule/cmscontent" name="successpage3" output="toHtml">
            <action method="setData">
                <name>identifier</name>
                <value>contact</value>
            </action>
        </block>
    </reference>
</checkout_onepage_success>

This is part of the content of my cms content block:

protected function _toHtml()
{
    echo "Hello"; exit();
    $identifier = $this->getData('identifier');
    //..........
    return $html;
}

My string "Hello" is never been displayed. I guess smth is wrong with my layout xml configuration. Any idea how do I get my string to be displayed?


texts: Magento 2.3 Store Switcher provides wrong/old urls

texts:
Hi we have a Magento store. (2.3.6) ...
... and have the problem with the store switcher switching to wrong / outdated pages. We simply need the corresponding page in the other store/language to be the correct one.
I found out the following.
The is switcher works by writing a base64 encoding URL string (uenc) into the data-post attribute for each different language page via /magento/module-store/Block/Switcher.php->getTargetStorePostData().

Problem
When the page is regenerated, the store switcher takes the correct URL of the other-language page. However, once the cache is filled and the page comes out of the cache, the old opposite page (which was correct when the cache was filled) remains on all other pages. This is wrong/outdated when the page comes out of the cache. The function and template will also not be called again.
Example:

Cache emptied
call en_EN/page1 (uenc is correct)
store switch to en_EN/page1 redirects correctly
from en_EN/page1 switch to en_EN/page2
but here is now in the switchertemplate a string that leads to de_DE/page1 instead of page2 (testable on the conslole with php -a and echo base64_decode(strtr('uencstring', '-_,', '+/='));
the store change is executed accordingly to de_DE/page1

What I need is that the switcher block is not cached once for all pages but it should be cached seperately for each page.
Does anyone have any idea how to set for individual blocks to be re-cached for each different url. Is the problem otherwise known I haven't found anything about it?
What I tried:

I tried to set the block in the theme to no-cache, which I think is a bad solution though.  Since the whole page is then no longer cached.
$block->setCacheLifetime(0);in the block.

Info about our setup.

Magento 2.3.6 store (and that can't be changed).
varnish full page cache.
custom theme (magetigue/templatemonster theme/007)


texts: get id of simple product of any configurable product on cart.phtml magento

texts:
I am working with configurable product, I want simple product id of configurable product on cart.phtml, I am using this code

 <?php foreach($this->getItems() as $_item): ?>
$_product = $_item->getProduct();
echo $_product->getId();
 <?php endforeach ?>

but it always gives main product id, but I need its simple product id , any one help please.


texts: How to trigger a custom method after registration (core method) in Magento?

texts:
I would like to send a SMS after each registration in Magento.

Can I write a method which should be triggered after user registration from core or should I write a entire registration on my local code pool?


texts: How to retrieve category Id using url in magento2

texts:
I want to retrieve the category Id using only the Category URL that I already have with me.

Is it possible to do so?


texts: Magento2 How to get Custom order attributes value in response in rest api v1

texts:
down vote
favorite
I have installed Amasty order attributes extension

I followed http://magehit.com/blog/how-to-get-value-of-custom-attribute-on-magento-2-rest-api/

and created

app/code/Amasty/Orderattr/etc/extension_attributes.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
  <extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
   <attribute code="order_source" type="string" />
 </extension_attributes>
</config>

2.Created events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_load_after">
  <observer name="sales_order_load_order_source" instance="Amasty\Orderattr\Observer\Sales\OrderLoadAfter" />
 </event>
</config>

3.created Observer app/code/Amasty/Orderattr/Observer/Sales/OrderLoadAfter.php

    <?php
     namespace Amasty\Orderattr\Observer\Sales;
     use Magento\Framework\Event\ObserverInterface;
     use Magento\Sales\Api\Data\OrderExtensionInterface ;
     class OrderLoadAfter implements ObserverInterface
   {
     public function execute(\Magento\Framework\Event\Observer $observer)
   {
     $order = $observer->getOrder();
     $extensionAttributes = $order->getExtensionAttributes();
     if ($extensionAttributes === null) {
        $extensionAttributes = $this->getOrderExtensionDependency();
     }
      $attr = $order->getData('order_source');
      $extensionAttributes->setOrderSource($attr);
      $order->setExtensionAttributes($extensionAttributes);
    }
    private function getOrderExtensionDependency()
   {
     $orderExtension = \Magento\Framework\App\ObjectManager::getInstance()->get(
    '\Magento\Sales\Api\Data\OrderExtension'
    );
     return $orderExtension;
    }
}

After deleting the generation folder ,the OrderExtension.php was auto generated with get and set methods

var\generation\Magento\Sales\Api\Data\OrderExtension.php

But in Api response I did not see any of my custom order attributes for order created by amasty extension.

Where I am going wrong or another way to do this.


texts: Magento 2 : How to override price functionality on cart

texts:
Want to override cart price display functionality.
Want to apply some additional formula before displaying Price on the cart and mini cart.
Can anyone tell me how can I achieve this?

Any help would be appreciated.

Thanks in advance..!

How to override Add to cart functionality in Magento 2.2


texts: Magento 2 : Top menu count subcategories

texts:
I have a top menu like Parent > Category > Subcategories.

I need to count the subcategories of category and if > 4, to show All categories as a link to the Category level. I have to mention that I am a newbie on Magento. Thanks for any help.


texts: Magento 2 Functional Testing using Phantom JS (or other headless)

texts: Curious as to if there is a way to configure the functional testing xml, in order to allow for other web-drivers such as Phatomjs? I already know of the way to change them to Chome and Firefox, but looking for a headless solution if at all possible in this scenario.


texts:
The Store is defined under magentoA.com but the Store Mails (Newsletter, orders, etc) is on shop@developer.com - i think i don't have to say that this is a pity.

So even if i change the store mails it doesn't change - i think these mails are hardcoded?

May someone can give me a hint -

mailq (@debian sys) is showing me that something is sent by this shop@developer.com (www-data) may this gives someone an idea?


texts:
I a website setup in magento with 2 store views.
1 store view is the main website with normal product prices
2nd store view is set with country specific products

I want to make sure that anyone who visitied the country specific site is automatically redirected to the main website when they next visit. Even if they saved the specific URL to the country specific store, it would still redirect them to main store. The only condition where they would not be redirected is if they have landed on the site from google shopping.

Is it possible to setup on magento, for it to check the arriving location of the user...
If from google* then it would take user to country specific store view
else if any other location or URL entered directly in browser or from bookmark, then the user would be redirected to the store view 1 which is main store.

Any help would be much appreciated.


texts: Unable to include js in magento product view page

texts:
I am trying to add a custom js file into my catalog product view page but the same is not happening.

I placed my js file inside skin\frontend\default\ucs_personalization\js\personalization.js

And below is the snippet of layout catalog.xml

<catalog_product_view translate="label">
.
.
.
<reference name="head">
<action method="addJs"><script>ucs_personalization/js/personalization.js</script></action>
</reference>
.
.
.
</catalog_product_view>

On the page view source i can see it takes the js from root\js. Below is page source script. It says that magento looks the js file inside root js directory

<script type="text/javascript" src="http://192.168.100.68/magento/js/ucs_personalization/js/personalization.js"></script>


texts: Magento Bank Transfer transaction failed

texts:
In checkout (onestepcheckout) selecting payment method "Bank Transfer"
Clicking "Place Order Now" then spinning and finally page is not reloading or doing anything to confirm the payment is done. In backend I can see order, amount and status "Pending"
but If I click again on "Place Order Now" getting (obviously) error:

"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update
 a child row: a foreign key constraint fails`database_name`.`sales_flat_order`
, CONSTRAINT `FK_SALES_FLAT_ORDER_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID`
 FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE S), query was: INSERT INTO `sales_flat_order` (`coupon_code`,
`protect_code`, `shipping_description`, `is_virtual`, `store_id`, `customer_id`, `base_discount_amount`, `base_grand_total`, `base_shipping_amount`, `base_shipping_tax_amount`, `base_subtotal`, `base_tax_amount`,
`base_to_global_rate`, `base_to_order_rate`, `discount_amount`, `grand_total`, `shipping_amount`, `shipping_tax_amount`, `store_to_base_rate`,
`store_to_order_rate`, `subtotal`, `tax_amount`, `total_qty_ordered`, `customer_is_guest`, `customer_note_notify`, `customer_group_id`, `quote_id`, `base_shipping_discount_amount`, `base_subtotal_incl_tax`,
`shipping_discount_amount`, `subtotal_incl_tax`, `weight`, `customer_dob`, `increment_id`, `applied_rule_ids`, `base_currency_code`, `customer_email`, `customer_firstname`, `customer_lastname`, `customer_middlename`,
`customer_prefix`, `customer_suffix`, `customer_taxvat`, `discount_description`, `global_currency_code`, `order_currency_code`, `remote_ip`, `shipping_method`, `store_currency_code`, `store_name`, `x_forwarded_for`, `customer_note`, `created_at`, `updated_at`,
`total_item_count`, `customer_gender`, `hidden_tax_amount`, `base_hidden_tax_amount`, `shipping_hidden_tax_amount`,
`base_shipping_hidden_tax_amnt`, `shipping_incl_tax`, `base_shipping_incl_tax`, `gift_message_id`, `customer_credit_amount`, `base_customer_credit_amount`, `onestepcheckout_customercomment`,
`onestepcheckout_customerfeedback`, `iosc_ddate`, `iosc_ddate_slot`, `iosc_dnote`) VALUES (... ?, ?, ?, ?, ?, '2017-06-20 11:20:30', '2017-06-20 11:20:30', ?, ?, ?, ?, ?... ?, "

Did anyone of you guys met this or similar problem ?
Urgently need to solve it :(


texts: Programmatically change price in product and catalog pages

texts:
I need to set the price of a product dynamically (based on the value of a variable that I will populate) when the catalog and the product page are loaded.

Currently I use this code in the Module of a catalog_controller_product_view observer:

$event = $observer->getEvent();
$product = $event->getProduct();
$product_id = $product->getId();

function setPrice($item, $new_price){
  $product->setOriginalCustomPrice($new_price);
  $product->save();
}
switch($product_id){
  case 22116:
    $new_price = 9999;
    setPrice($item, $new_price);
    break;
  case 22076:
    $new_price = 9999;
    setPrice($item, $new_price);
    break;
  default:
    break;
}

The code cause a 404 error page. Any idea why? Is the catalog_controller_product_view event the right one to use?


texts: Website received malicious customers : Magento 2

texts:
Website receiving the customers with emails, names, and addresses contains only strings of numerical values followed by the @qq.com/@843145.com domain.

We have received every day more than 10 customers and newsletters subscription. See below screenshots.

Please suggest how to avoid these type of issue?


texts: relation/communication between `getEstimateRates()` & `collectRates()` these methods to collect the shipping & Tax rates?

texts:
I am new to magento, When url goes to checkout/cart/index or checkout/onepage/index magento should be showing Shipping Rates. These Shipping Rates are getting from $this->getEstimateRates() method from magento\app\design\frontend\easylife\default\template\shpmethod\cart\shipping.phtml file. from  getEstimateRates() these method or sub methods doesn't have method of collectRates(), but it's returning an result of Shipping Rates.

When I Creating Log from collectRates() method which is located on magento\app\code\core\Mage\Usa\Model\Shipping\Carrier\Ups.php this file log's are creating.

My Question is:

1) How the scenario was going on to collect shipping & Tax rates?

2) where is the relation/communication between getEstimateRates() & collectRates() these methods to collect shipping & Tax rates?

3) Is it possible to save the xml request & response when it collectrates?


texts: Magento 2.2 - Want to implement blackfire for community edition

texts:
I have heard about blackfire php profiler and automated performance tool that can be used in three environments.

If i wanted to implement in Magento 2.2 based website using nginx server then is it possible to add blackfire.io into it.

Need to investigate following stuffs

SQL query logs
performance issues

Went through following url but not able to find any particular guide for Magento 2 community edition.
https://devdocs.magento.com/guides/v2.3/cloud/project/project-integrate-blackfire.html


texts: Magento 2 : Unable to set custom customer attributes programmatically

texts:
I have a cron job that runs once a day, that reads a file uploaded to the server, and registers users from that file. The code works fine, but now I added a custom attribute to the customer (lets call it customId), which I also want to set programatically, when registering the users, but the problem is, that it only seems to add the custom attribute to the first user, and the others have that field empty.

Here is my code:

namespace Path\UserRegistration\Cron;

class RegisterUsers
{
    private $storeManager;
    private $customerFactory;
    private $customerModel;
    private $baseUrl;

    public function __construct(
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Customer\Model\CustomerFactory $customerFactory,
        \Magento\Customer\Model\Customer $customerModel)
    {
        $this->storeManager = $storeManager;
        $this->customerFactory = $customerFactory;
        $this->customerModel = $customerModel;
        $this->baseUrl = $this->storeManager->getStore()->getBaseUrl();

    }

    public function register($customId, $email, $password, $name, $websiteId, $storeId)
    {
        $customer = $this->customerFactory->create();
        $customer->setWebsiteId($websiteId);
        $customer->setStoreId($storeId);
        $customer->setEmail($email);
        $customer->setFirstname($name);
        $customer->setPassword($password);
        $customer->setCustomId($customId);
        $customer->save();
    }

    public function execute()
    {
        $handle = fopen($this->baseUrl . "upload/NewUsers.csv", "r");

        if ($handle) {
            $lineNum = 0;

            while (($line = fgets($handle)) !== false) {
                $lineNum++;

                // Ignore first line of csv file
                if ($lineNum > 1) {
                    $lineItems = explode(';', $line);

                    $customId = trim($lineItems[1]);
                    $email = trim($lineItems[4]);
                    $password = trim($lineItems[2]);
                    $name = trim($lineItems[3]);

                    $websiteId = $this->storeManager->getWebsite()->getId() == 0 ? '1' : $this->storeManager->getWebsite()->getId();
                    $storeId = $this->storeManager->getStore()->getId() == 0 ? '1' : $this->storeManager->getStore()->getId();

                    if ($email && $name && $password) {
                        $customerExisting = $this->customerModel->setWebsiteId($storeId)->loadByEmail($email);

                        $customerExists = $customerExisting->getId() ?? false;

                        if ($customerExists === false) {
                            $this->register($customId, $email, $password, $name, $websiteId, $storeId);
                        }
                    }
                }
            }

            fclose($handle);
        }
    }
}

The strange thing is, if I call $customer->getCustomId() right after the $customer->save(), i get back the correct value. So it is saved into the db, but then deleted?

I can also manually add the customId to any user I want, and it works fine.

Any help would be appreciated.


texts:
How to get Search result count and keyword in result.phtml in magento2.

I have overriden the Magento_CatalogSearch/templates/result.phtml file.

I need to show the count returned from the search result as well as the key searched here.

Is that possible to get it. Please anyone suggest on this.

Thanks


texts:
I'm totally new with Magento, I have 10 years of experience with Drupal, but it's the first time I'm working with Magento so please pardon any approximation and lack of culture about it.

I'm just given this project which is in the middle. And I have some bugs to correct.

Initially it was in Magento 1.9.2.2.
Users couldn't save their address, which is indeed critical. I have upgraded to 1.9.3.1 and the problem persists, as I am absolutely not aware about the internals at the moment, I have no idea about what can cause this.

Simply the address is never saved, and when I try to save, it is falling back on the empty form.

Any clue so that I can provide more information to solve that ?

Here is the log when i try to save address.

    ==> axis_exception.log <==
2016-11-16T11:15:28+00:00 ERR (3):
Mage_Core_Exception: Invalid block type: Mage_Page_Block_Header in /var/www/mybabyhk/mybabyhk/app/Mage.php:595
Stack trace:
#0 /var/www/mybabyhk/mybabyhk/app/code/local/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /var/www/mybabyhk/mybabyhk/app/code/local/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('Mage_Page_Block...', Array)
#2 /var/www/mybabyhk/mybabyhk/app/code/local/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('page/header', 'header')
#3 /var/www/mybabyhk/mybabyhk/app/code/local/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('page/header', 'header')
#4 /var/www/mybabyhk/mybabyhk/app/code/local/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /var/www/mybabyhk/mybabyhk/app/code/local/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#9 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#10 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#11 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /var/www/mybabyhk/mybabyhk/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#14 /var/www/mybabyhk/mybabyhk/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#15 /var/www/mybabyhk/mybabyhk/index.php(83): Mage::run('', 'store')
#16 /var/www/magento_debugger/index.php(203): require('/var/www/mybaby...')
#17 {main}

Also strangely the current url always appears in the search bar as shown on the screenshot below :


texts: Website Layout doesn't change after changing the language

texts: So If I change the language of my Website - I will have the old static blocks in the default language like contact (In german it should be "Kontakt") I need to clear the cache all time to get the actual language layout. I'm using rwd theme 1.9+. How can I fix this?


texts:
When my website, https://liquidnicotinewholesalers.com , changes to have a responsive mobile menu, it is extremely hard to click using a tablet and a phone. I will continue to click the mobile menu on my iphone and it will open and close again so fast that the menu items are unable to be selected.

Please help!


texts: Composer and Travis Ci with Magento modules

texts:
We have an existing module that contains a composer.json file which is working well on its own but we are also wanting to set-up travis-ci with this extension.

When the travis-ci runs it fails with the error.

magento root dir "" is not valid

I think this error is happening because we are actually using the extension's composer.json file rather than a clean composer.json file for a Magento instance.

Does anyone know how the travis.yml file should be set-up for an extension? Does anyone have an extension that is successfully being tested via travis-ci that I could use as an example?

Our extension: https://github.com/sitewards/B2BProfessional

Another broken example: https://github.com/magento-hackathon/FrontendMonitoring


texts: wishlist simple product of configured deleting / replacing one another

texts:
In the core wishlist indexcontroller I am replacing the configurable product with it's configured child product before i add it to the wishlist using:

    $productId = (int)$this->getRequest()->getParam('product');
    $product = Mage::getModel('catalog/product')->load($productId);
    if($product->getTypeId() == 'configurable'){
        $params = $this->getRequest()->getParams();
        $child = $product->getTypeInstance(true)->getProductByAttributes($params['super_attribute'], $product);
        $product = Mage::getModel('catalog/product')->load($child->getId());
    }

This works well to get the simple product into the wishlist.  However, when I add a different configuration (color = red) to the wishlist it will replace the previous configuration(color = blue) with a new one (color = red).  When I add the same configuration(color = red) again it will delete that configuration entirely leaving the wishlist empty.

Without the above alteration, the configurable item will not be replaced and the quantity will simply iterate upon addition of the same item.

Thx


texts: Magento2: creating the registry in controller & getting the same registry in block

texts:
please help me if I m missing something as, I m unable to get the registry in Block from controller..

here is my code in controller to set regitry..

$this->_coreRegistry->register('user_id', $userId);

below is the code in block to retrieve registry..

public function getUserId(){
    return $this->coreRegistry->registry('user_id');
}

please help... or if any body knows to store the string in session which is accessible in block please guide me

Thanks in advance


texts: How to do Product Collection print_r In category List page For Configurable Product?

texts:
How to do Product Collection  print_r In category List page  For Configurable Product ?

i want to check all attributes for products  single Products ?


texts:
I want to use swatches on site, after reading various posts, the option in the admin site is listed on the left hand navigation is missing. I am currently using CE 1.9.2, I recently upgraded from 1.9.1.

Any help would be greatly appreciated

S


texts: Programmically deleting product image that exist on multiple stores

texts:
I have followed the following post Magento2: How to remove product images programmatically? which looks like it should work.

However from digging into the Magento 2 code it looks like the image won't delete if it is being used on another store.

So how do I delete an image for all the stores at the same time? For context what I am trying to do is it write a CLI that updates products in for a customers multiple stores.


texts: Magento 2.3.5p2: Can't hide payment method in last step any more

texts:
I have an urgent problem with magento 2.3.5p2. I can't hide a payment method based one previous step in the last checkout screen anymore.

It works quite well if I hide the method on the first step using a "payment_method_is_active" observer. In the last step the payment method is hidden as expected.
The same observer is triggered during the last step and worked flawless setting the is_available" to false. But the method is shown. If the customer chooses this, magento shows an "unavailable" error (which is nice, but not enough).

The "payment_method_is_active" observer is defined in the global events.xml. So this could not be the mistake.
Is there anybody else with this error?
Hawkeye


texts:
So i cannot save categories and attempting to do so produces below error in system.log:
    [2021-04-15 16:16:30] main.CRITICAL: Error: Call to a member function getAttributeCode() on bool in /home/sites/buzzcateringsupplies.com/public_html/vendor/magento/module-catalog/Observer/InvalidateCacheOnCategoryDesignChange.php:67
    Stack trace:
    #0 /home/sites/magento/public_html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Magento\Catalog\Observer\InvalidateCacheOnCategoryDesignChange->execute(Object(Magento\Framework\Event\Observer))
    ...
    ...

Strange as seems to work in my dev environment so seems some update have not occured in live database when running setup upgrade. I notice that my custom layout update attribute is empty like below:

So i am assuming there are potentially a few things wrong here.
Other solutions suggest running queries like below in to database:
INSERT INTO `eav_attribute` (`entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_label`, `frontend_class`, `source_model`, `is_required`, `is_user_defined`, `default_value`, `is_unique`, `note`) VALUES

(4, 'custom_layout_update_file', NULL, 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\LayoutUpdate', 'varchar', NULL, NULL, 'select', 'Custom Layout Update', NULL, 'Magento\\Catalog\\Model\\Product\\Attribute\\Source\\LayoutUpdate', 0, 0, NULL, 0, NULL),
(3, 'custom_layout_update_file', NULL, 'Magento\\Catalog\\Model\\Category\\Attribute\\Backend\\LayoutUpdate', 'varchar', NULL, NULL, 'select', 'Custom Layout Update', NULL, 'Magento\\Catalog\\Model\\Category\\Attribute\\Source\\LayoutUpdate', 0, 0, NULL, 0, NULL);

However not a big fan and would like to get to bottom of why this update has not run. The above does actually allow saving of categories however the dropdown is still empty. I'm also confused as thought in 2.3.4 and above the Layout update XML field should no longer be present...
Have searched around and cannot see a solution or explanation and hoping someone might be able to point me in the right direction. Have tried a few DB imports and updates since however same thing happens.


texts: What is the proper way to perform a SEARCH with logic AND using the APIs?

texts:
I'm having trouble performing a search using the APIs. Below is the request I'm performing to my Magento backend:

http://www.mybackend.com/rest/it/V1/products?searchCriteria[filterGroups][0][filters][0][field]=type_id&searchCriteria[filterGroups][0][filters][0][value]=simple&searchCriteria[pageSize]=6&searchCriteria[current_page]=1&searchCriteria[filter_groups][1][filters][0][field]=color&searchCriteria[filter_groups][1][filters][0][value]=41

What I want to get from this request is the first page (size of the page should be 6) of my SIMPLE products (not configurable) and they should have color 41 (which is green for me).

The result I receive is the following:

{"search_criteria":{"filter_groups":[{"filters":[{"field":"color","value":"41","condition_type":"eq"}]}],"page_size":6,"current_page":1},"total_count":2}

Along with all the green products, simple and configurable (that are not listed here for security). As you can see the filter I set to get only simple products, is overwritten by the second one, to get all the green products.

What is going wrong here? Can you help me?

Thank you!


texts:
I am able to get my last order thanks to this code:

    $collection = $this->collection->create();
        $collection->addFieldToFilter('customer_id', $customerId);
//        echo "
".print_r($collection->getLastItem()->getData(), true)."
"; //show data of last quote
        $quoteId = $collection->getLastItem()->getData('entity_id'); //get id of last quote
        echo "quote id : " . $quoteId;

        $quote = $this->_quoteRepository->get($quoteId);
        $products = $quote->getItemsCollection()->getData();
//        echo "
".print_r($products, true)."
"; //show data of last quote

        $productsRenew = array();
        foreach($products as $product){
            $productsRenew[] = array(
              'product_id' => $product['product_id'],
                'qty' => $product['qty'],
                'price' => $product['price'],
                'sku' => $product['sku'],
                'name' => $product['name'],
            );
        }
        echo "
".print_r($productsRenew, true)."
"; //show items data

I also got the products detail, now I want to put products details inside the cart.

I've used this to add product one by one on one on my page:

public function getAddToCartPostParams($product)
{
    return $this->listProductBlock->getAddToCartPostParams($product);
}

Now I want to add several products in a row, but I don't know how to do this.

EDIT : solution :

        $customerId  = $this->_customerSession->getCustomer()->getId();
    $collection = $this->collection->create();
    $collection->addFieldToFilter('customer_id', $customerId);
    $quoteId = $collection->getLastItem()->getData('entity_id'); //get id of last quote

    $quote = $this->_quoteRepository->get($quoteId);
    if ($quoteId) {
        try {
            $quote->setIsActive(1)->setReservedOrderId(null);
            $this->_quoteRepository->save($quote);
        } catch (\Exception $e) {
        }
        $this->_checkoutsession->replaceQuote($quote);
    }


texts:
Hello Magento Community,

I am trying to integrate the Magento Rest API in my App. But while doing the OAuth authentication for request token I am getting error as Consumer Key has Expired. I have read on different forums that we need to increase the time. So I did that but still getting the same error.

Is this the issue with Magento Rest API or something wrong with my code. Below is the code I am using for authentication.

string ConsumerKey = "13ijbmvmimljnwrs0v929nnc4mh20nc9";
            string ConsumerSecret = "mdb87wcr6ir50s5t4p8fwwxfuwyhfvl7";
            string StoreBaseURL = "http://www.mymagento.com";

            var authenticator = OAuth1Authenticator.ForRequestToken(ConsumerKey, ConsumerSecret);
            authenticator.SignatureMethod = RestSharp.Authenticators.OAuth.OAuthSignatureMethod.HmacSha1;
            RestClient rClient = new RestClient(StoreBaseURL)
            {
                Authenticator = authenticator
            }; ;
            RestRequest request = new RestRequest("/oauth/token/request", Method.POST);
            IRestResponse d = rClient.Execute(request);

Thanks


texts:
looking for some advanced help here.

I am working with abandoned cart emails and I can not get the emails to send on command (by using the admin>run now or via command line: "php cron.php"

Customers have been matched up - so I am assuming that its not my rules. Once email has been sent after I set active dates. Then I set the repeat schedule to 1,2,3,...19,20, but nothing is being re-sent.

Other email transactions send out just fine.

Looking for advice on where and what to look for.


texts:
How to remove logout page 5 seconds when logout after?please help
using magento 2.2.4.
thank you!


texts: Magento 2 - How to read the values in etc/config.xml?

texts:
How to define and read the values in etc/config.xml in a custom module?
What is the best practice to use it?


texts: Extract higher and lower price list products

texts:
I need to extract the higher and lower price in category page.

My script:

<?php if($_product->isConfigurable()) {

//get associative (child) products
                    $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$_product);
                    $childPriceLowest = "";
                    $childPriceHighest = "";
                    $prezzo_pieno="";
                    foreach($childProducts as $child){

                    $_child = Mage::getModel('catalog/product')->load($child->getId());

                    $prezzo_scontato =  $_child->getFinalPrice();
                    $prezzo_pieno_down=$_child->getPrice();

                    $price_array[] = array($prezzo_scontato);
                    $prezzo_pieno[]= array($prezzo_pieno_down);

                    }
        asort($price_array);
        asort($prezzo_pieno);
        echo $price_array[0];
        echo $prezzo_pieno[0];

 }

does not work.

Print:

arrayarray

why? where is my error?


texts: Eway Rapid 3.1 integration for Magento EE

texts: Is there any extensions available for integrating Rapid 3.1 payment for Magento enterprise version 1.12.0?


texts: How to configure a promotion in Magento 2 that combines an Advanced Price (Group Price) with a Coupon

texts:
We are trying to configure set pricing for customers in a Customer Group that also requires them to enter a valid coupon code.
So far we have only been able to achieve half of this requirement using two different methods as follows:

Advanced Pricing for the group in question is easily configured with the special price per product but does not allow us to apply the coupon restriction on top.
Cart Price Rules allow us to setup the Coupons for the specific Customer Group but not attach this to the special price.

We basically need a combination of these or another solution if anyone knows of a way to achieve this.
Happy to consider third party plugins too if they can help.
Any help greatly appreciated.


texts: Magetno 2 : Get Customer FirstName and LastName with Custom Resource Model

texts:
I've custom model same as Core Code. (Vendor)

  ../Model/Grid.php

class Grid extends \Magento\Framework\Model\AbstractModel implements
GridInterface
{

const CACHE_TAG = 'customer_entity';

protected $_cacheTag = 'customer_entity';

protected $_eventPrefix = 'customer_entity';

protected function _construct()
{
    $this->_init('{Vendor}\{Module}\Model\ResourceModel\Grid');
}

public function getEntityId()
{
    return $this->getData(self::ENTITY_ID);
}

public function setEntityId($entityId)
{
    return $this->setData(self::ENTITY_ID, $entityId);
}

public function getFirstname()
{
    return $this->getData(self::FIRSTNAME);
}

public function setFirstname($firstName)
{
    return $this->setData(self::FIRSTNAME, $firstName);
}

public function getLastname()
{
    return $this->getData(self::LASTNAME);
}

public function setLastname($lastName)
{
    return $this->setData(self::LASTNAME, $lastName);
}

public function getGroupId()
{
    return $this->getData(self::GROUP_ID);
}

public function setGroupId($groupId)
{
    return $this->setData(self::GROUP_ID, $groupId);
}
}

Below is my interface

interface GridInterface
{
 const ENTITY_ID = 'entity_id';
 const LASTNAME = 'lastname';
 const GROUP_ID = 'group_id';

 public function getEntityId();
 public function setEntityId($entityId);

 public function getLastname();
 public function setLastname($lastName);

 public function getGroupId();
 public function setGroupId($groupId);
}

When i am dumping model data in block form i am getting everything smilar as

  \Magento\Customer\Api\CustomerRepositoryInterface

Note : I've added group_id for test purpose. And group_id is rendering to form Not Last Name.

I've cheked DB i think there's Index in customer_entity table for firstname and lastname that's why it can't render to form.

Check this.

What's solution for this ?? Any Help would be really appreciated.

If you need more details than Refer this: Here


texts: Changing Product/Category URL_KEY doesn't create a 301 redirect ( EE 1.13)

texts:
I'm on EE 1.13.10 and I noticed that changing URL key for a product/category doesn't create a redirect from the previous URL to the new one, instead both URL still works.

Any hint on out to debug/solve the issue ?

UPDATE
-- Example --
I changed URL key from abc123 to 123abc (prod. id:123) and ran a full re-index.

After that:

The link in the frontend are correct but Url_Rewrite table shows following data:

abc123.html  -> catalog/product/view/id/123
123abc.html  -> catalog/product/view/id/123

So:

The redirect from abc123 to 123abc is missed here
Both URLs point to the controller (so both links works)

As said above the correct behavior should be that the previous Url redirect to the new one and this is not happening


texts: How to add approval process after customer registration?

texts:
How to add approval process after customer registration in Magento 2?
Whenever customer register, after that it should be go for the approval and Magento admin can approve or reject the account.
Only after the approval from admin, customer can log-in.


texts: Magento 2 Block error of Call to a member function create() on null

texts:
I want to display my custom database's data on customer side but when I try to get the data from the collection factory I am getting this error.

Call to a member function create() on null in /var/www/html/magento/app/code///Block/.php:40

Below this is my block's code.

class Webkul extends \Magento\Framework\View\Element\Template
{

protected $_gridFactory;

public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Webkul\Grid\Model\GridFactory $gridFactory)
{
    parent::__construct($context);
    $this->_girdFactory = $gridFactory;
}

public function getCollectionFor()
{
    $custom_variable = $this->_gridFactory->create();
    $collection = $custom_variable->getCollection();
    foreach($collection as $item){
        var_dump($item->getData());
    }
    exit;
}
}

I tried to get value in the $custom_variable but it has nothing.

Collection.php file

<?php

namespace Webkul\Grid\Model\ResourceModel\Grid;

class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    protected $_idFieldName = 'entity_id';
    /**
     * Define resource model.
     */
    protected function _construct()
    {
        $this->_init('Webkul\Grid\Model\Grid', 'Webkul\Grid\Model\ResourceModel\Grid');
    }
}


texts: Magento Configurable Product Price Overriding Simple Product Price

texts:
I have products set up identically (as far as I can tell) and they were all imported with a universal CSV template.

Configurable price is 29.99
Associated Simple Product Short Sleeve is 29.99
Associated Simple Product Long Sleeve is 39.99

An invoice recently billed a long sleeve product (ZTWS-SBLS-XL) that has a price of 39.99 with the configurable product price of 29.99. How can I force the simple product price to override the configurable product price? Both products below are set up identically with their parent configurable product and as simple products.

Invoice:

Item             Sku             Qty    Subtotal
Item one         ZLOB-SBLS-XL    1      $39.99
Item Two         ZTWS-SBLS-XL    1      $29.99

EDIT: Still working on resolving this. What would cause Magento to prefer the simple product price over the configurable product price or the associated product attribute price?


texts: E-mail for order Button in stead if Add to Cart

texts:
for some products we want to replace the add to cart button with a "Email to Order" button.

I will use an alternative theme for this.

I know how to disable the "Add to cart button".

But now i would like to have a button "Mail to order"

And when the customers clicks on this button, a small form shows up with the ability to fill in their name and e-mailadress.

And we get an email with their contactdata and the product they want to order (automatically) with the selected configurable option.

Is that possible, and how do i do that?

I use magento 1.8.1 CE


texts: Cannot add the item to shopping cart with exception - A non-numeric value encountered in

texts:
I am learning Magento and getting this error: Cannot add the item to shopping cart.

I am stucked here anyone can help

Exception.log

Exception: Warning: A non-numeric value encountered  in \app\code\core\Mage\Shipping\Model\Carrier\Abstract.php on line 466 in \app\code\local\Mage\Core\functions.php:246
Stack trace:
#0 \app\code\core\Mage\Shipping\Model\Carrier\Abstract.php(466): mageCoreErrorHandler(2, 'A non-numeric v...', 'E:\\xampp\\htdocs...', 466, Array)
#1 \app\code\core\Mage\Shipping\Model\Carrier\Abstract.php(432): Mage_Shipping_Model_Carrier_Abstract->_getPerorderPrice('7.95', 'F', '')
#2 \app\code\core\Mage\Shipping\Model\Carrier\Flatrate.php(85): Mage_Shipping_Model_Carrier_Abstract->getFinalPriceWithHandlingFee('7.95')
#3 \app\code\core\Mage\Shipping\Model\Shipping.php(209): Mage_Shipping_Model_Carrier_Flatrate->collectRates(Object(Mage_Shipping_Model_Rate_Request))
#4 \app\code\core\Mage\Shipping\Model\Shipping.php(129): Mage_Shipping_Model_Shipping->collectCarrierRates('flatrate', Object(Mage_Shipping_Model_Rate_Request))
#5 \app\code\local\Amasty\Shiprestriction\Model\Shipping\Shipping.php(9): Mage_Shipping_Model_Shipping->collectRates(Object(Mage_Shipping_Model_Rate_Request))
#6 \app\code\core\Mage\Sales\Model\Quote\Address.php(944): Amasty_Shiprestriction_Model_Shipping_Shipping->collectRates(Object(Mage_Shipping_Model_Rate_Request))
#7 \app\code\core\Mage\Sales\Model\Quote\Address.php(875): Mage_Sales_Model_Quote_Address->requestShippingRates()
#8 \app\code\core\Mage\Sales\Model\Quote\Address\Total\Shipping.php(155): Mage_Sales_Model_Quote_Address->collectShippingRates()
#9 \app\code\core\Mage\Sales\Model\Quote\Address.php(1013): Mage_Sales_Model_Quote_Address_Total_Shipping->collect(Object(Mage_Sales_Model_Quote_Address))
#10 \app\code\core\Mage\Sales\Model\Quote.php(1331): Mage_Sales_Model_Quote_Address->collectTotals()
#11 \app\code\local\Idev\OneStepCheckout\Model\Sales\Quote.php(27): Mage_Sales_Model_Quote->collectTotals()
#12 \app\code\core\Mage\Checkout\Model\Cart.php(461): Idev_OneStepCheckout_Model_Sales_Quote->collectTotals()
#13 \app\code\core\Mage\Checkout\controllers\CartController.php(240): Mage_Checkout_Model_Cart->save()
#14 \app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Checkout_CartController->addAction()
#15 \app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('add')
#16 \app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 \app\code\core\Mage\Core\Model\App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#18 \app\Mage.php(683): Mage_Core_Model_App->run(Array)
#19 \index.php(83): Mage::run('', 'store')
#20 {main}

Help will be appreciated.

Thanks


texts: Magento 2 Use backend backend invoice pdf print to print pdf file in frontend

texts:
Does any way to override the print invoice pdf file function in admin to use it in the frontend?
I have tried to use controller Magento\Sales\Controller\Adminhtml\Invoice\Pdfinvoices. However, it returns to the admin panel.
Thanks for any help!


texts: Product Attribute on Products Grid/List View (manufacturer)

texts:
I try to show Product-Attributes on the Grid-View (catalog(products/list.phtml).

At app/code/coreMage/Catalog/Block/Product/List.php I found this

public function addAttribute($code)
{
    $this->_getProductCollection()->addAttributeToSelect($code);
    return $this;
}

At my catalog.xml (theme/layout/catalog.xml) I add the following "addAttribute in my block

    <catalog_category_default translate="label">
    <label>Catalog Category (Non-Anchor)</label>
    <reference name="left">
        <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
    </reference>
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

                <action method="addAttribute"><attribute>Manufacturer</attribute></action>

At my PHTML-Template, I try to show the Manufacturer like this:

<?php echo $_product->getAttributeText('manufacturer') ?>

But it doesen't work. I don't know why. I found the tutorial via Google and I'm sure that I 've done it right. I work with Magento Enterprise 1.13. Where is my fault? Thanks for your help.


texts: Programitically Import products using CSV in video url not set magento2?

texts:
I have created a script for import CSV products everything's working perfect but one issue is product video url not set.

<?php
use \Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');

// add bootstrap
$bootstraps = Bootstrap::create(BP, $_SERVER);
$object_Manager = $bootstraps->getObjectManager();

$app_state = $object_Manager->get('\Magento\Framework\App\State');
$app_state->setAreaCode('frontend');

// get date
$today_date = date("m/d/Y");
$added_date = date('m/d/Y',strtotime("+17 day"));

$set_product = $object_Manager->create('\Magento\Catalog\Model\Product');

try{
    $set_product->setWebsiteIds(array(1));
    $set_product->setAttributeSetId(4);
    $set_product->setTypeId('simple');
    $set_product->setCreatedAt(strtotime('now'));
    $set_product->setName('Test Sample Products');
    $set_product->setSku('add-sku-1');
    $set_product->setWeight(1.0000);
    $set_product->setStatus(1);
    $category_id= array('3,4,5');
    $set_product->setCategoryIds($category_id);
    $set_product->setTaxClassId(0);
    $set_product->setPrice(100.99) ;

    $set_product->setStockData(
        array(
        'use_config_manage_stock' => 0,
        // checkbox for 'Use config settings'
        'manage_stock' => 1, // manage stock
        'min_sale_qty' => 1, // Shopping Cart Minimum Qty Allowed
        'max_sale_qty' => 2, // Shopping Cart Maximum Qty Allowed
        'is_in_stock' => 1, // Stock Availability of product
        'qty' => 100 // qty of product
        )
    );

     $set_product->save();
    // get id of product
    $get_product_id = $set_product->getId();
    echo "Upload simple product id :: ".$get_product_id."\n";
}
catch (\Exception $e) {
    echo $e->getMessage();
}

$set_product->setVideoUrl('youtub.com/magento');

But it's not working category save and set product video URL?


texts: android magento - customer login(authentication) using SOAP API

texts:
We are devoloping an android app for a Magento site.

I am facing problem while I try to login(authentication) as magento customer.

I can't find a proper way to login as a customer using email and password.

how can I authenticate or login as a customer?

I followed this links answer: https://stackoverflow.com/questions/25055700/android-magento-customer-loginauthentication-using-using-soap-api

according to that, I created this file: http://pastebin.com/RJAGxTDS under http://hotwheelstoys.in/testing/testing/Mage3.php

But when we pass the values using JSON, we are getting "null".

I saw this link : http://www.magentocommerce.com/api/soap/introduction.html

But there is no API for login through android.


texts:
I am using Magento CE 1.7.0.2. My Store product catalog have 1245 products with last product id 1245.

Yesterday I uploaded new 5 products using Magmi which create new products with product ids  1246 to 1250. All these products were disabled so no order placed for these new products.  Now due to some reason I need to delete these 5 products and upload (using Magmi) new 5 products.

How I can reset product id so new product ids start again from 1246?


texts: Has anyone noticed that after upgrading to Magento 2.4.2, Catalog Price Rule is being applied to Custom Options?

texts: After upgrading to Magento 2.4.2, we ran a sale starting Palm Sunday.  We just noticed today, three days later that the Sale discount is being applied to Custom Options.  That is not a good thing because some of our custom options are $495 deposits(refundable).  In Magento 2.4.1 and all previous versions the Catalog Price Rule Action "Apply as percentage of original" only applied to the Original Price of the item before Custom Options altered the price.  Ideally each Custom Option should have an option to Apply Discount Yes or No.  Does anyone know if this is an intended fix?