texts: Why is PHP function file_exist() doesn't return FALSE when passed empty file name?

texts: I have a piece of code shown in the screenshot that should check for the existence of a file. I am not sure why file_exists() doesn't return FALSE in case of non-existing files. I passed an empty string to the $this->get_custom_js_file_contents('') but the else block doesn't get the control. Please point out to me what is not right in it.


texts: How to save credit card info using saved cc options?

texts:
I just enabled saved cc option for saving credit card numbers for customer login.
But its not saving. I have enabled that option.

Each time if I login as customer its asking to enter the card everything. What is the issue over here?What am I doing wrong.?

Thanks in advance.


texts: Error importing csv - detected an illegal character in input string

texts:
I'm recently having an issue importing a csv file of new products (system>import/export>import). I select entity type: Products, Import Behavior: Append Complex Data, then I add my csv file.

After checking the data, I get the following error:
Notice: iconv_strlen() [function.iconv-strlen]: Detected an illegal character in input string in /home/MYDOMAIN/public_html/app/code/core/Mage/Core/Helper/String.php on line 86

When looking at this line, it shows the following:

public function strlen($string)
    {
        return iconv_strlen($string, self::ICONV_CHARSET);
    }

I've triple checked my csv file for characters that could potentially set off an error, but I'm struggling to find anything.


texts: Is it possible to create a configurable product with multiple product types?

texts:
I'm trying to see if its possible to create a configurable product with both a virtual and a downloadable product in it. The idea would be if it is a virtual product, I would be adding a link to his Account page with some additional information. If the product is downloadable, the normal process of would happen through the Account page or email.

After toying with the Magento backend, this doesn't seem possible out of the box, but perhaps there is a class I could extend or something without a lot of difficulty?


texts: Design Strategy - Helper methods that throw Exceptions

texts:
I am implementing a plugin for a client that will use the 'Max Sale Quantity' value of a Magento Stock Item on a product as a means of setting an upper-bound on total customer purchases.

Because I need to check this condition in multiple events, controller actions, I cannot contain it to merely an Observer where I could create a local protected function that checks this condition from my Resource Model.

In my requirements I will be limiting the cart additions. But I find myself in a dilemma: from the controller addAction I need to rely on throw - however from sales_quote_merge_before it seems that I could effectively unset the offending products and post a message to the customer/session, though, I could throw and catch, respectively as with the controller action instead.

My questions are:

Is this bad practice to effectively rely on throw from the module helper?
Is this, rather, a model method that I need to invoke?
What is the best design strategy that allows me to keep my module DRY?

Edit:

As of EE 1.12 I see only 4 instances of Helper/Data.php files that throw - 3 of them are Api2/Oauth. Mage/Core does it once as well, but this seems to be the only other instance. Various 3rd parties look like they take different approaches here.

Any feedback is welcome.


texts: Apply class to radio button at Permission User Role form

texts:
I am working with System->user->Add new user->User Role.
I am changing in core file for temporary purpose.
Expected Result:
Want to apply class 'validate-one-required-by-name' to user role radio button.
What I Done:-

  magento\app\code\core\Mage\Adminhtml\Block\Permissions\User\Edit\Tab\Roles.php

I have added class to radio button. as below. But it is not reflecting on webpage.

protected function _prepareColumns()
{

    $this->addColumn('assigned_user_role', array(
        'header_css_class' => 'a-center',
        'header'    => Mage::helper('adminhtml')->__('Assigned'),
        'type'      => 'radio',
        'class'     => 'validate-one-required-by-name',
        'html_name' => 'roles[]',
        'values'    => $this->_getSelectedRoles(),
        'align'     => 'center',
        'index'     => 'role_id'
    ));

Current Outout is

  input type="radio" class="radio" value="1" name="roles[]"

Required

  input type="radio" class="radio validate-one-required-by-name" value="1" name="roles[]"

Thanks in advance.


texts: Move product attributes inside details tab

texts:
Using the Luma theme. On the product page I want to move the "More information" content where it lists the attributes, into the first tab "Details".

I tried to use XML in catalog_product_view.xml

This puts it in a tab:

<move element="product.attributes" destination="product.info.details" />

This makes it go invisible:

<move element="product.attributes" destination="product.info.description" />

Is there a simple way?

Alternatively, I just want to remove the tabs altogether and make them headings instead.


texts: Magento Grouped Products With Tier Pricing

texts:
I've created a group product with two simple products.Each simple product has tier pricing.For example,

Simple product -1: tier pricing : Qty   Price
                                   2     100
                                   3      75
                                   5      60

Simple product -2: tier pricing:  Qty   Price
                                   2     110
                                   3      80

<?php if ($_hasAssociatedProducts): ?>
    <?php foreach ($_associatedProducts as $_items): ?>
        <?php $_items->setData('tier_price',null); ?>
        <?php $_tierPrices = $this->getTierPrices($_items); ?>
            <?php foreach ($_tierPrices as $key => $value): ?>
                <?php echo $value['price_qty']; ?>
            <?php endforeach; ?>
    <?php endforeach; ?>
<?php endif; ?>

The above code returns all the qty 2 3 5 2 3.How do I remove the repeated "qty" values and show only unique values?


texts:
I have several footer and several header for different pages and I insert them through XML as follows in my local.xml:

<checkout_cart_index>
    <reference name="header">
        <action method="setTemplate">
             <template>page/html/header_checkout.phtml</template>
        </action>
     </reference>
     <reference name="footer">
        <action method="setTemplate">
             <template>page/html/footer_checkout.phtml</template>
        </action>
     </reference>
</checkout_cart_index>

The header is working perfectly, but the footer is not. For example, I load the home with a footer and I go to the page of the cart, even adding it by XML, it finishes that the footer of the home continues to appear in the cart. Thanks in advance.


texts: Custom layout extending 2columns-left.xml

texts:
I'm trying to create a custom layout based on 2columns-left.xml. The layout was created correctly and I can select it from the Admin. This is what I did so far:

I created the layouts.xml file THEME/Magento_Theme/layouts.xml

<layout id="customlayout">
    <label translate="true">Custom Layout</label>
</layout>

And then I created the customlayout.xml file THEME/Magento_Theme/page_layout/customlayout.xml
With the same content as:
vendor/magento/module-theme/view/frontend/page_layout/2columns-left.xml

The problem is that the layout has only 1 column, instead of 2columns-left, why?


texts: Magento 2: how to overide adminhtml phtml file

texts:
As I don't have implemented admin theme I have to override /vendor/magento/module-payment/view/adminhtml/templates/info/default.phtml file in my custom module.
how can I write my layout file to call this file?

I have copied default.phtml in my custom module


texts: Move cart & compare blocks to top links - Problem with dynamic/lazy block

texts:
I'm trying to move the cart & compare blocks to top links and when the user goes over the li the cart/product compare appears: it works.
Minicart

<reference name="header">
    <reference name="top.links">
        <remove name="checkout_cart_link"/>
        <block type="minicart/view" name="minicart_toplink" template="minicart/toplink.phtml" >
            <block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"/>
        </block>
        <action method="addLinkBlock"><blockName>minicart_toplink</blockName></action>
        <block type="checkout/links" name="checkout_cart_link_minicart">
            <action method="addCheckoutLink"></action>
        </block>
    </reference>
</reference>

Minicompare

<!-- Disable compare product block on left and right sidebar -->
    <reference name="right">
        <action method="unsetChild">
            <name>catalog.compare.sidebar</name>
        </action>
    </reference>
    <reference name="left">
        <action method="unsetChild">
            <name>catalog.compare.sidebar</name>
        </action>
    </reference>

    <!-- Add Compare product block to top links -->
    <reference name="header">
        <reference name="top.links">
            <block type="minicompare/view" name="minicompare_toplink" template="minicompare/toplink.phtml" >
                <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" as="topcompare" template="catalog/product/compare/sidebar.phtml"/>
            </block>
            <action method="addLinkBlock"><blockName>minicompare_toplink</blockName></action>
        </reference>
    </reference>

The problem is that when I use Lesti:FPC or Varnish these blocks create problems: with varnish they are duplicated(double link for cart, checkout and product cmopare) and with Lesti (if added under lazy blocks) they don't appear when I visit the (any and every) page for the first time, if I relaod they appear, but if I change the page the block reset (no item, total=0, but the items are in the cart) and I have to refresh.
Any idea?


texts: Magento 2 : Show admin category tree on frontend

texts:
I want to display categories tree on frontend like admin default categories tree.

Need to display category tree structure in my custom module and content area for frontend side.

Any Help would be appreciated.

Thanks.


texts:
How can I solve this error:

# bash PATCH_SUPEE-10266_CE_1.9.1.0_v1-2017-09-13-06-34-33.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

checking file app/code/core/Mage/Admin/Model/Session.php
checking file app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Notice.php
checking file app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php
Hunk #1 succeeded at 108 (offset 12 lines).
checking file app/code/core/Mage/Adminhtml/Controller/Action.php
checking file app/code/core/Mage/Adminhtml/Model/LayoutUpdate/Validator.php
checking file app/code/core/Mage/Adminhtml/controllers/CustomerController.php
checking file app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php
checking file app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php
checking file app/code/core/Mage/Checkout/controllers/CartController.php
Hunk #2 succeeded at 686 (offset 1 line).
checking file app/code/core/Mage/Core/Model/Email/Template/Abstract.php
checking file app/code/core/Mage/Core/Model/File/Validator/Image.php
checking file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
checking file app/code/core/Mage/Core/etc/config.xml
Hunk #1 succeeded at 459 (offset 3 lines).
checking file app/code/core/Mage/Rss/Helper/Data.php
Hunk #2 FAILED at 57.
Hunk #3 FAILED at 77.
2 out of 3 hunks FAILED
checking file app/code/core/Mage/Sales/Model/Resource/Order/Item/Collection.php
checking file app/code/core/Zend/Serializer/Adapter/PhpCode.php
checking file app/design/adminhtml/default/default/template/backup/dialogs.phtml
Hunk #1 succeeded at 120 (offset 26 lines).
Hunk #2 succeeded at 155 (offset 26 lines).
checking file app/design/adminhtml/default/default/template/catalog/product/edit/options/type/file.phtml
checking file app/design/adminhtml/default/default/template/customer/tab/view.phtml
checking file app/design/adminhtml/default/default/template/login.phtml
checking file app/design/adminhtml/default/default/template/notification/toolbar.phtml
checking file app/design/adminhtml/default/default/template/oauth/authorize/form/login-simple.phtml
Hunk #1 succeeded at 58 (offset 1 line).
checking file app/design/adminhtml/default/default/template/oauth/authorize/form/login.phtml
Hunk #1 succeeded at 46 with fuzz 1 (offset 1 line).
checking file app/design/adminhtml/default/default/template/resetforgottenpassword.phtml
checking file app/design/adminhtml/default/default/template/sales/order/view/history.phtml
checking file app/design/adminhtml/default/default/template/sales/order/view/info.phtml
checking file app/design/install/default/default/template/install/create_admin.phtml
Hunk #1 FAILED at 66.
1 out of 1 hunk FAILED
checking file app/locale/en_US/Mage_Adminhtml.csv
checking file downloader/template/login.phtml

It's a Magento 1.9.1.0 CE installation.


texts: Magento 2.3.0 Shared Server Are Different PHP Version(s) An Issue

texts: I’m trying to install Magento 2.3 with Composer, with php 72. I am hosted on a shared cloud server that has php 70 as the server version (what php -v returns). I can set the local version of php to php 72 in cpanel but php -v still indicates I have 70, when I run phpinfo.php it shows php 72 running locally. In order to install Magento 2.3 using the CLI I have had to use a full path to the binary for php 7.2 in front of bin/magento commands. The results seems to run with no problem. My question is does this situation with php cause any issues during runtime or development? If so what do I need to do?


texts: Whenever you add an item to the cart it resizes the entire header

texts:
When you add an item to the cart it changes the header from full width and only having a blue menu bar to being a box completely blue. It fixes the problem when you remove the item from the cart.

Images to how what I mean

without items - http://i.imgur.com/EI4awRm.png
with items - http://i.imgur.com/559imZU.png

the link to the site is image-displays.com


texts: Magento2: update-cron.ERROR: Cron readiness check failure!

texts:
I have some issue with cron:

[2018-08-08 09:19:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:20:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:21:03] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:22:03] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:23:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:24:03] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:25:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:26:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:27:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:28:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []
[2018-08-08 09:29:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /home/czasowe/domains/domain.com/public_html/pub/static/.htaccess [] []

Can anyone suggest how to solve it?


texts: Override Onepage Checkout Page Layout - Magento 2

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

This is the layout defined for checkout (layout="checkout"), I want to override this to 1column, however playing a checkout_index_index.xml file in my theme's Magento_Checkout override directory replaces the entire layout and leaves me with a blank page, whereas a checkout_index_index.xml file in a custom module has no effect.

Is this a load order problem or am I making a beginner mistake?


texts: working with css.less on client side compilation mode and then transitioning to server side

texts:
I need to compile CSS.less files, however node.js is very resource-consuming which therefore cannot be used in our current hosted account. To work on themes, documentation recommends to change mode to client side compilation. Accordingly, asides node.js what do I need installed on windows 10, and how do the revisions take effect once I switch to server side compilation as I move from development mode to production mode?

Accordingly, stylesheet revisions when frontend development workflow is set to server side throws errors, and when switching to client side less compilation it also produces errors, however when switched back again to server side less compilation, the edits do "compile", even though this seems like an atrocious way to go about doing this. This is unclear exactly how the CSS is being compiled.

All I need are minor revisions to a template which should be done by  inspecting elements in the browser, and then making the revisions in the less files or by adding a custom css file when needed.


texts: getAttributes() from product returns old results in magento

texts:
Fetching attributes for a different product results in old data, see:

$product = Mage::getModel('catalog/product')->load(1);
$attributes = $product->getAttributes();

-> count: 50 (correct)

$product = Mage::getModel('catalog/product')->load(2);
$attributes = $product->getAttributes();

-> count: 70 (correct)

$product = Mage::getModel('catalog/product')->load(1);
$attributes = $product->getAttributes();
$product = Mage::getModel('catalog/product')->load(2);
$attributes = $product->getAttributes();

-> count: 50 -> wrong, this is from the first product! why???

Magento version is 1.9.2.4


texts: How to render a block/template after page load

texts:
I need to know whether we can render a block or a phtml template file after the page load.

I have added the block and template file in the layout file and it works fine.

But i dont want that data to be loaded at the beginning. I want that block to be rendered after the page load.

Is there anything that can be done in xml layout file to load the block after the page loads?


texts: default.xml in my custom module isn't working

texts:
I'm trying to add custom template from my custom module.

Layout file: app/code/Foo/Bar/view/frontend/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

        <referenceContainer name="footer">
            <block class="Foo\Bar\Block\FooterTest" name="footer_assets" template="footer/test.phtml" />
        </referenceContainer>

</page>

my template: app/code/Foo/Bar/view/frontend/templates/footer/test.phtml

test

When i rename layout file from default.xml to cms_index_index.xml then template is displayed, but only on home page. What i have to change to display this template on all pages?


texts: how to send variable from js to phtml magento 2

texts:
i want to pass the value of qty from js to my phtml file so how to proceed
here is my code:

$("#qty").change(function () {
                            var value = Number($("#qty").val());
                            console.log(value);
                            if (value > 0) {
                                var variableToSend = document.getElementById('qty').value;
                                console.log(variableToSend);

                                $.post('Magento_Catalog::product/view/addtocart.phtml', {variable: variableToSend});

                            }
                        });


texts:
I have a custom page where users can fill out their e-mail to receive a quotation. I would like to add a column with a list of items currently in the shopping cart. How to achieve this?

When I Google for the above question, the only results I get are how to add custom content to the checkout page, which is exactly the other way around.

I am fairly new to Magento, these are the things I've tried:

<block class="Magento\Checkout\Block\Cart" name="checkout.cart" template="Magento_Checkout::cart.phtml" />

or:

<referenceBlock class="Magento\Checkout\Block\Cart" name="checkout.cart" template="Magento_Checkout::cart.phtml" />

Both options don't show anything. I even tried to add the full container contents from checkout_cart_index.xml from the Magento_Checkout module, but that doesn't seem right and of course I got a lot of reference errors.


texts: Magento 1.9 : How to change URL /customer/account/login to /kupac/nalog/prijava/

texts:
What is the easiest way to

change the /customer/account/login/ URL to  /kupac/nalog/prijava/ but to preserve the functionality too?
I will also need to change /product/id/X to proizvod/X where X can be arbitrary string or number.
Lastly, I need to change URL:
http://localhost/darnik/catalogsearch/result/?q=lajsna
to this URL:
http://localhost/darnik/katalog/pretrazi/?q=lajsna


texts:
I have magento 2.1.3, with two store Arabic and English. I set languages each for store view.

I went production mode did static content deploy and enabled compress and minify js and css.

I see some arabic strings translated in English store view and not all translated strings appear.


texts:
Is it possible in Magento2 to get the initial state of the layered navigation even if there is some filter applied?

For example: I have a custom filterable without results attribute with three possible values: A, B and C. When I visit the layered navigation page the filters show as follow:

Custom attribute:
  A (1)
  B (2)
  C (3)

When I click on the link to filter products by value A, what I get is

Custom attribute:
  A Remove
  Remove All

What can I do to keep the initial state of the layered navigation instead of showing the applied filter?


texts: Product price is not set when programmatically creating quote

texts:
I am creating a rest api for cart.

 $product = Mage::getModel('catalog/product')->load(1);
 $quote = Mage::getModel('sales/quote');
 $quote->addProduct($product, $qty);
 $quote->collectTotals()->save();

Quote is generated as expected. The only issue is with price.
Item price is not set in quote_item table.
Also in quote tables base_price, subtotal, etc are not set.


texts: How to hide Price tab in admin under creating or editing products?

texts:
I have a problem on hiding or removing the price tab in admin where you create or edit product since I don't have to type any price. Can you help me about this? or do you have any suggestions?

Here is the related question (Remove Price attribute from a custom product type) but I don't really know what it means and the solution.

Thanks,

Nino


texts: product object showing last product data in magento2

texts:
I am just trying to load a product and displaying its values but facing an issue -

Here is my code:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get ('Magento\Catalog\Model\Product')->load(2135);
echo "<pre>"; echo $product->getId().'======'.$product->getSellerId();
$product = '';
$product = $objectManager->get ('Magento\Catalog\Model\Product')->load(2140);
echo "<pre>"; echo $product->getId().'======'.$product->getSellerId();

Here product '2135' have seller_id so its printing right value but product '2140' didn't have SellerId but its printing last product's sellerId value here.

Don't know why it's behaving like this. I am  using Magento2.1.6.

even if I changed the product object parameter to $product_1 and loading product 2140 after 2135 its showing seller_id in 2140 - here is my code -

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get ('Magento\Catalog\Model\Product')->load(2135);
echo "<pre>"; echo $product->getId().'======'.$product->getSellerId();
$product = '';
$product_1 = $objectManager->get ('Magento\Catalog\Model\Product')->load(2140);
echo "<pre>"; echo $product_1->getId().'======'.$product_1->getSellerId();

Result -
2135======1450

2140======1450

Expected result -

2135======1450

2140======

Please let me know what going wrong over here.


texts: Magento 2 : Override core Interface and Model

texts:
I am trying to override core interface of Customer Group.

I add my custom get and set methods to core Api interface.

  Vendor\magento\customer-module\Api\Data\GroupInterface.php

Where its working fine.

But when i am trying to override it its doesn't seems to be work.

Here i am sharing my module code.

  ZeroCool\AdvacedReviews\Api\Data\GroupInterface.php

<?php

namespace ZeroCool\AdvancedReviews\Api\Data\GroupInterface;

interface GroupInterface extends ExtensibleDataInterface
{
const SHIPPING_METHOD = 'shipping_method';

/**
 * Get shipping method
 *
 * @return string
 */
public function getShippingMethod();

/**
 * Set shipping method
 *
 * @param int $shippingMethod
 * @return $this
 */
public function setShippingMethod($shippingMethod);

}

  ZeroCool\AdvancedReviews\etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Customer\Block\Adminhtml\Group\Edit\Form">
    <plugin name="add_form_field" type="ZeroCool\AdvancedReviews\Model\Plugin\Form" sortOrder="1"/>
</type>
<type name="Magento\Customer\Controller\Adminhtml\Group\Save">
    <plugin name="save_field" type="ZeroCool\AdvancedReviews\Model\Plugin\Form" sortOrder="1"/>
</type>
<preference for="Magento\Customer\Model\Data\Group" type="ZeroCool\AdvancedReviews\Model\Data\Group" />
<preference for="Magento\Customer\Api\Data\GroupInterface" type="ZeroCool\AdvancedReviews\Api\Data\GroupInterface" />

There's also one question available but it doesn't have any answers till now.

Stack Exchange

Thanks in advance.


texts: What are the requirements to develop login/ Sign up API's to use Magento 2.?

texts:
i am new in magento , but i need to use Rest API's to my mobile app, but i don't know how it is uses this API's ad how can i check these API's.

First what are the requirements to call REST API's in magento based to use mobile apps.

i have a sample megento api's path lists below.
Please give me any suggestion how to use and how can we develop REST API's to use magento.

https://devdocs.magento.com/swagger/index_20.html


texts:
Is it possible to add/update a customers cart from admin?

        $productId = 700;

        $storeId = Mage::app()->getStore()->getId();

        $product = Mage::getModel('catalog/product')
                        ->setStoreId($storeId)
                        ->load($productId);

        $qty = 1;
        $cart = Mage::getModel('sales/quote');

        $cart->setStore(Mage::app()->getStore())->loadByCustomer($customer->getId());

        if (!$cart->getId())
        {
            $cart->assignCustomer($customer);
            $cart->save();
        }

        $info = new Varien_Object(array(
                            'product_id' => $product->getId(),
                            'qty' => $qty
                        ));

        $cart->addProduct($product, $info );

        $cart->collectTotals()->save();

This is writing an entry into the sales_flat_quote table but it is not showing up in the customers cart. I am doing something wrong or missing something.


texts: Magento2- Login required to move forward on the site

texts:
Hi i have a client that wants to make the login a required thing, to be able to move forward through the page. The idea is to make the client use its credentials to see the products and if you dont have the credentials then you cant see the site.
How can i make this possible? Can anybody help me with this?
thanks


texts: Add property to AttributeSet class/database

texts:
I'm working on an import algorithm and I have to keep different IDs to identify attribute-sets at a later time.

Is there an option to extend the class/database-object of attribute-sets? I mean not to add an attribute like length/height/weight/etc. (i.e. for products) but an additional property next to attribute-set-name, ..., . This property does not have to be visible to the backend-user.

In short: What class do I have to extend in my install script (is there even a more or less simple solution to this problem)? How do I set and get those additional properties?


texts: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket

texts:
There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: 174749344571

 #1 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /var/www/html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /var/www/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php(141): Mage_Core_Model_Resource->getConnection('core_setup')
#8 /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php(234): Mage_Core_Model_Resource_Setup->__construct('core_setup')
#9 /var/www/html/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#10 /var/www/html/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#11 /var/www/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#12 /var/www/html/index.php(87): Mage::run('', 'store')
#13 {main}";s:3:"url";s:6:"/admin";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}


texts:
i add Mobile Status below is my code for cms block section it show out form section and i want to move it after status dropdown

protected function _prepareForm()
{
    $model = Mage::registry('cms_block');
    $form = parent::_prepareForm()->getForm();
    // $fieldset = $form->addFieldset('fieldset_cms',
    array('legend'=>Mage::helper('core')->__('Mobile')));
        $form->addField('is_active_mobile', 'select', array(
            'name'      => 'is_active_mobile',
            'label'     => Mage::helper('cms')->__('Mobile Status'),
            'title'     => Mage::helper('cms')->__('Mobile Status'),
            'value'     => $model->getIsActiveMobile(),
            'class' => 'fieldset-wide',
            'required'  => true,
            'options'   => array(
                '1' => Mage::helper('cms')->__('Yes'),
                '0' => Mage::helper('cms')->__('No'),
            ),
     ));
     return $this;
}


texts:
Today I took a look into the system.log from one of our Magento shops and I saw that there is an error:

  2019-01-20T09:05:52+00:00 CRIT (2): Not valid template file:frontend/base/default/template/checkout/cart/mini.phtml

Does anyone know where I have to look to change the path where it's looking for? The file doesn't exists on the server so the file that is asking for mini.phtml needs te be located, but how can I know which file is asking for mini.phtml?

Thanks!

More info

I see this in the system.log every time when an order is placed:

  2019-01-25T08:51:18+00:00 ERR (3): Notice: iconv(): Wrong charset, conversion from MacRoman' toUTF-16BE' is not allowed  in /home/website/domains/websitename.nl/public_html/lib/Zend/Pdf/FileParser.php on line 451


texts:
i have one product with two different url's

https://dutchmanaxles.com/products/axle-housing-rearend-hardware/rcv-934-cv-joint-lightened.html

and

https://dutchmanaxles.com/rcv-934-cv-joint-lightened.html

I'm trying to remove duplicate content from my site and this seems to be a problem that is appearing

Also, as an "SEO" standard, would the shorter url be more seo friendly


texts: Is there a way of writing layout such that all the controllers refering to that layout will automatically display the block?

texts:
Is there a way of writing layout such that all the controllers refering to that layout will automatically display the block's if no specific handle has been defined.

what i actually want is that, Is there any specific handle which acts as default handle such that any URl(handle) that is not specified in the layout will use that as their default..?

ex

<xyz_handle>
   <block type="core/template" name="default" template="def/default.phtml" />

</xyz_handle>

and if i call a handle in my url as aaa_index_index and that this hanle is  not defined in our layout file then by default it will use the <xyz_handle> handle .

Is there a way of doing this ?


texts: Configurable items in related and upsell areas

texts:
I have been following a tutorial - http://catgento.com/2012/02/09/adding-configurable-product-options-to-category-list-in-magento/ - to add configurable products dropdowns to the configurable products on different pages.
I have successfully added a block of configurable products that are set as new on the home page.

My issue is when I try and add configurable products to the related products and upsell products in a single product page then one of the areas (upsell or related products) doesn't show up. Within the tutorial it mentions about using the registry to unset and set the product object and I think this is where my problem lies.
 Can anyone see any way around this?


texts: How to get total price for product with qty before adding to cart in Magento

texts: I have shopping cart promotion rules which gives discount for buying 4 products. This works fine on shopping cart page. I mean it applies discount and shows discounted price in TOTAL row. I want to show customer this discounted price on another page before he adds product to cart. How can I do it? Basically it is calculating price where product id and qty is given applying shopping cart price rules.


texts: Can't create Magento\Cms\Model\Wysiwyg\Config instance in Magento 2.3

texts:
I am working with Magento 2.3. But everytime I try to create an instance of

  Magento\Cms\Model\Wysiwyg\Config by ObjectManager

I meet this error

  Exception #0 (BadMethodCallException): Missing required argument $variablePluginConfigProvider of Magento\Cms\Model\Wysiwyg\CompositeConfigProvider.

Did anyone meet and resolve this one?


texts:
I have installed Solr search and configured in magento admin, Test Connection successfully. After that I tried to Reindex. I am getting error while reindex catalog search via SSH.

"Catalog Search indexer process unknown error:
Solr HTTP error: OK (400)
{"responseHeader":{"status":400,"QTime":0},"error":{"msg":"undefined field store_id","code":400}}"

If I change change search engine to solr to other(MySQL), I am able to reindex catalog search. But I can't reindex catalog search while using solr search engine.

Anyone knows solution. Thanks in advance.


texts: “AS LOW AS:” price is showing the price including VAT (TAX) but should be without

texts:
I have a product which has tiered prices but when i search for the item it show the lowest prices but includes VAT (tax) how could i get it so the VAT is not included.

This is the block of code which displays the price.

<?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_convertedFinalPrice): ?>

        <?php $_minimalPriceDisplayValue = $_minimalPrice; ?>
        <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?>
            <?php $_minimalPriceDisplayValue = $_minimalPrice + $_weeeTaxAmount; ?>
        <?php endif; ?>

        <?php if ($this->getUseLinkForAsLowAs()): ?>
            <a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link">
        <?php else: ?>

        <?php endif ?>
        <?php echo $this->__('As low as:') ?>
        <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                <?php echo $_coreHelper->formatPrice($_minimalPriceDisplayValue, false) ?>

        <?php if ($this->getUseLinkForAsLowAs()): ?>

        <?php else: ?>

        <?php endif ?>
    <?php endif;

I have tried just taking out the

$_weeeTaxAmount

from the code but that did nothing if anyone could help that would be brilliant

Thank you


texts: error oauth_problem=signature_invalid for POST

texts:
i am using magento rest api for get data and it work very well but when i wanna send data return this error

   "messages": {
        "error": [
            {
                "code": 401,
                "message": "oauth_problem=signature_invalid"
            }
        ]
    }

i use post man for this ... is there any one that can tell me why i get this error  ?


texts:
Can we call model methods in Magento setup scripts? I tried this, setup script is executed (new entry appears in the database table core_resource) but model methods are not executed (I added Mage:log('test'); inside methods to check if they were fired):

$installer = $this;
$installer->startSetup();

Mage::getModel('myextension/mymodel1')->doSomething();
Mage::getSingleton('myextension/mymodel2')->doSomethingElse();

$installer->endSetup();


texts: Does variant product dropdown attribute can multi-select filter in layer navigation in Magento 2

texts:
Magento 2 Size attribute, by default used Text Swatches attribute and from layer navigation we can multi-select filter, like will show S size & M size product.
But now the problem i want to use dropdown attribute instead fo text swatches, but in frontend i can then make multi-select filter.
does this possible or any extension suggestion


texts:
I'm working with a legacy enterprise site and have a question about the current state of Magento and prototype.

Current state

I've read that when prototype 1.7 was released it resulted in issues with IE9 in Magento. At the time, to resolve this issue our developer forced all versions of IE to use IE8 document mode using:

<meta http-equiv="X-UA-Compatible" content="IE=8,chrome=1">

Additionally, prototype was downgraded to 1.6.1. This issue and solution are further documented in this issue. Further solutions for this issue are on this page (Google cache used as source site is down for maintenance).

Since then

Since this initial change, we have upgraded Magento to 1.13.x. Along the way prototype was upgraded and the site is currently using version 1.7.

What I'd like to do

I would like to restore the meta tag to the following to improve experience on IE9+:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

The question

Clearly, forcing IE8 document mode is not ideal because it disallows IE9+ from displaying features it supports and results in an overall poorer experience. using IE=8 solved the issue at the time, but does this original issue still exist?

Am I able to use IE=edge with prototype 1.7?


texts: Magento 1.9 - Foreach for sum values is not correct

texts:
I recollect the question because I explained myself badly in the previous one.

I have 40 clients in my Magento and I have created a custom attribute (input text) called attribute2. Only 3 customers have a numerical value in this attribute, the others have no value, the value of the input is empty.

In my report dashboard I wanted to create a foreach to see the sum of all the numeric values in the clients' attribute2. With this code it makes me the sum but there is a problem. I have seen that the foreach automatically assigns a value to the input of a customer id to those with an empty input field.

Why is this?

This is my code:

$CustomersId = Mage::getModel('customer/customer')->getCollection()->getAllIds();
$collectionCustomers = Mage::getModel('customer/customer');
$eavAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'attribute2');
$attributeTable = $eavAttribute->getBackendTable();

$collectionCustomers->getSelect()
        ->joinLeft(
            array('ca'=>$attributeTable),
            'ca.entity_id = main_table.customer_id',
            array('*')
        );
$collectionCustomers->addFilterToMap("attribute2","ca.value");

$sum = 0;
$result = $collectionCustomers->getData('attribute2');

foreach($CustomersId as $CustomersIds)
{
    $sum += $collectionCustomers->load($CustomersIds)->getData('attribute2');
}

echo $sum;


texts: Magento 2. How to send confirmation email for two emails at once?

texts:
How to programmatically send an order confirmation email for two customer email addresses at once?
I created additional customer attribute for "contact email" field and need send confirmation to contact email and customer account email. How to it?
And I created Observer for sales_order_place_before event and wrote next code. But it's send only for contact email/customer account email. I need to send confirmation email to two emails at once.
<?php

declare(strict_types=1);

namespace Vendor\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
use Magento\Framework\Mail\Template\TransportBuilder;

/**
 * Class AfterOrderSave
 *
 * @package Vendor\Module\Observer
 */
class AfterOrderSave implements ObserverInterface
{
    /**
     * @var RequestInterface
     */
    protected $request;

    /**
     * @var OrderSender
     */
    protected $orderSender;

    /**
     * @var TransportBuilder
     */
    protected $transportBuilder;

    public function __construct(
        RequestInterface $request,
        OrderSender $orderSender,
        TransportBuilder $transportBuilder
    ) {
        $this->request = $request;
        $this->orderSender = $orderSender;
        $this->transportBuilder = $transportBuilder;
    }

    public function execute(Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();

        $postParams = $this->request->getParams();
        $orderAccount = $postParams['order']['account'];
        $contactEmail = $orderAccount['id_contact_email'];
        $isContactEmailOnly = $orderAccount['id_contact_email_only'];

        if ($contactEmail && $isContactEmailOnly == true) {
            $this->transportBuilder->addTo($contactEmail);
        } else if ($contactEmail && $isContactEmailOnly == false) {
            $this->transportBuilder->addCc($contactEmail);
        }
    }
}


texts: Show Notes for this Order Comments on sales order grid

texts:
Trying to show order comments on sales order grid. I have the column but can't seem to show the data. I can show data with eg city or phone number but not the order comments.
Comments.php
namespace Fitzcode\AdminEdits\Ui\Component\Listing\Column;

use \Magento\Sales\Api\OrderRepositoryInterface;
use \Magento\Framework\View\Element\UiComponent\ContextInterface;
use \Magento\Framework\View\Element\UiComponentFactory;
use \Magento\Ui\Component\Listing\Columns\Column;
use \Magento\Framework\Api\SearchCriteriaBuilder;

class Comment extends Column
{
    protected $_orderRepository;
    protected $_searchCriteria;

    public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, OrderRepositoryInterface $orderRepository, SearchCriteriaBuilder $criteria, array $components = [], array $data = [])
    {
        $this->_orderRepository = $orderRepository;
        $this->_searchCriteria  = $criteria;
        parent::__construct($context, $uiComponentFactory, $components, $data);
    }

    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {

                $order  = $this->_orderRepository->get($item["entity_id"]);
                $comment = $order->getStatusComment();
                $item[$this->getData('name')] = $comment;
            }
        }

        return $dataSource;
    }
}

sales_order_grid.xml
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="sales_order_columns">
        <column name="telephone" class="Fitzcode\AdminEdits\Ui\Component\Listing\Column\Telephone">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Phone Number</item>
                    <item name="sortOrder" xsi:type="number">6</item>
                </item>
            </argument>
        </column>
        <column name="comment" class="Fitzcode\AdminEdits\Ui\Component\Listing\Column\Comment">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Comment</item>
                    <item name="sortOrder" xsi:type="number">7</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>


texts:
How to add discount to Orders after it made.

I'm using Magento Community Edition 2.1.9.

I've tried it but I can't in prestashop its very easy in order page I can add discount in percentage or fixed price


texts: (Configurable products) Change the color of “Availability: In stock ” depending the quantity from the stock?

texts:
I have to make something like this:

Change the color of "Availability: In stock " depending the quantity from the stock?

but I've configurable products.

What's the way?
Thanks


texts: How to know user was guest or registered when order placed?

texts:
How can I know that a person was a guest or registered user from the order placed?
Is it possible to identify this from sales data?


texts: Magento2 Installation error - Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '('

texts:
I have been trying to install the Magento 2 framework ahead of the upcoming webinar but I have been getting errors.

Has anyone been able to install via CLI or the web UI?

Here is the error:

Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home/magento2/dev/shell/run_data_fixtures.php on line 25'

And here is line 25

use Magento\Framework\App\State as AppState;

I've downloaded directly from the GitHub repo and haven't made any code changes yet!


texts:
I am looking for multiple wishlists programmatically in magento2.1, till yet I tried like when customer click on wishlist I gave popup so there he can select already created wishlist if not have to create wishlist working fine but then I am sending that to wishlist id to override magento2's default but it's not
so please do the needful.


texts: Blocked mixed content error in console when I try to edit a product in my magento

texts:
When I try to click next product page in my magento admin panel, The loading never stop and when I go to console, it says like this.:

I tried using, firefox,chrome,safari but same problem occurs. I cleared already the cache and index. but nothing happen. I hope someone will help me. Thank you. I know only basic programming .


texts: Magento 2: PaymentFee and MSP extension issue Class MultiSafepay\PaymentFee\Helper\Data does not exist

texts:
we're trying to use this plugin (payment fee for paypal):
https://github.com/mageprince/magento2-paymentfee/tree/2.1.4
it's working with paypal
but we have also enabled this payment provider plugin:
https://github.com/MultiSafepay/Magento2Msp
which enables visa/mastercard etc.
if we choose one of this, it's getting a exception error
this is the error after clicking on "place order" in exception.log
main.CRITICAL: Class MultiSafepay\PaymentFee\Helper\Data does not exist {"report_id":"2470096ab1419534558c1294b8865d835d33523e261bc2146f06fe3cb55b28bb","exception":"[object] (ReflectionException(code: -1): Class MultiSafepay\PaymentFee\Helper\Data does not exist at /var/www/magento2/vendor/magento/framework/Code/Reader/ClassReader.php:26)"} []
seems to be that it trys to use the PaymentFee Helper Data but coudn't
if we choose paypal (what's integrated with default magento provider) then it works


texts: How to edit or update the ordered item data in magento 2

texts:
I want to edit some data's of ordered items like weight, price and some more.

For that, I got the ordered item collection for the specific order.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderItemId = '3';
$orderItem = $objectManager->create('\Magento\Sales\Api\OrderItemRepositoryInterface')->get($orderItemId);
$orderItems = $orderItem->getData()

So $orderItems has the ordered item collection.

And then I have tried to edit the ordered items like below.

foreach ( $orderItems->getData() as $val ) {
    $val->setWeight(1)->save();
}

But the weight not gets updated.

Full Code:

$orderId = $_GET['id'];
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Api\Data\OrderInterface')->load($orderId);

// Edit the order items data
foreach ($order->getAllItems() as $key => $value) {
    $orderItemId = $value->getData('item_id');
    $orderItem = $objectManager->create('\Magento\Sales\Api\OrderItemRepositoryInterface')->get($orderItemId);
    $orderItems = $orderItem->getData();
    foreach ( $orderItems as $val ) {
        $val->setWeight(1)->save();
    }
}
$orderResourceModel->save($order);

I've just referred this link here. But I'm not having a clear idea about the orderquote.

I'm using magento 2.3 version.

Please help me. I am a novice in magento and I am stuck at this point. Thank you in advance!!


texts: Magento2 : How to Get All Payment Methods in Plugin

texts:
I am trying to disable all payment methods when specific payment method is enabled for some set of pin codes.

Please find below code to get an idea of what I am doing.

di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Vendor\Module\Model\Module">
        <plugin sortOrder="1" name="restrictByCustomer" type="Vendor\Module\Plugin\Payment\Method\Module\Available"/>
    </type>
</config>

app/code/Vendor/Module/Plugin/Payment/Method/Module/Available.php

<?php

namespace Vendor\Module\Plugin\Payment\Method\Module;

use Magento\Customer\Model\Session as CustomerSession;
use Magento\Backend\Model\Auth\Session as BackendSession;
use Vendor\Module\Model\Module;
use \Magento\Checkout\Model\Session as CheckoutSession;

class Available
{
    protected $checkoutSession;

    protected $customerSession;

    protected $backendSession;

    public function __construct(
        CustomerSession $customerSession,
        BackendSession $backendSession,
        CheckoutSession $checkoutSession
    ) {
        $this->customerSession = $customerSession;
        $this->backendSession = $backendSession;
        $this->checkoutSession = $checkoutSession;
    }

    public function afterIsAvailable(\Magento\Payment\Model\Method\AbstractMethod $subject, $result)
    {
        $paymentMethods =  $subject->getCode(); //I am getting only one payment method. I want to get all payment methods here.

        if($subject->getCode() == 'clickcanarias')
        {
            return false;
        }

        return $result;
    }
}

Basically, I am trying to disable all payment methods when my payment method is active. I want to get all the payment methods list in $subject. For that purpose which class needs to override?


texts: Check if product has uploaded image In Magento 2

texts:
I need to generate an email template with product image included in it, i need to check if the product image exist or not , if product image not exist i want to generate magento 2 default product image thumbnail with custom size, now i'm generating custom size product image with this:

$product = $objectManager->create('Magento\Catalog\Model\Product')->load($data['item_id']);
$imageHelper = $objectManager->get('\Magento\Catalog\Helper\Image');
$width = 150; $height = 150;
$imageUrl = $imageHelper->init($product,'product_page_image_small')->setImageFile($product->getFile())->resize($width,$height)->getUrl();
echo $imageUrl;

because the product doesn't have image it produce url like this:

http://test.com/pub/static/version1496373583/adminhtml/Magento/backend/en_US/Magento_Catalog/images/product/placeholder/.jpg


texts: Adding script that is not in a .js file in the  Magento 2 without using 'misc scripts' in admin

texts:
I have some js script which I'd like to place in the  section of my Magento 2 site. I do not want to add in 'miscellaneous scripts' section. I want to add this in my themes default.xml file. However, the below code in XML does not show on the frontend.

default.xml

<head>
    <css src="css/enmasse.css" />
    <script src="js::bootstrap.js"/>
    <script src="js::custom.js"/>
    <script>Some jquery script goes here</script>
</head>

All other items here are called correctly - so I know there's something wrong in the way I've added the final script element.

Can an edit be suggested to the above to get this working?


texts: Magento 2 pub/media/catalog/product/n/o folder size too big

texts:
Magento ver. 2.1.2 BUG "multiple image generation on product copy

Magento 2.1.2 pub/media/catalog/product/n/o 12 GB folder size too big

Now currently 1900 products in my store and issue is duplicate images generated.

this link not working for me

Advance thanks for help


texts:
I just add a new line of html code to navbar... now the navbar is not open on hover, i do have to click on the nav and to close, i have to click it agan.

But what i want , is that the nav open it by hover mouse.

here is the html tag:

ASSORTIMENTO

The new piece of html code is this one:

ASSORTIMENTO


texts: Magento 1.9.1.0 to 2.2.3 Migration mapping error

texts:
I'm trying to migrate the settings from a 1.9.1.0 install to a 2.2.3 install however I'm getting the following error with debugging enabled:

I thought it was due to having settings.xml.dist still as .dist in the directory I change that to settings.xml and I then get a slightly different error message:

Has anyone had this problem before or any ideas on how I can go about debugging this?

Thanks


texts: Magento2 - custom color picker on product page

texts:
I would like to add a custom colour picker to an attribute that isn't a swatch colour. I have followed this tutorial for my attribute 'hue' and it is not working:

https://kiwicommerce.co.uk/blog/how-to-add-a-color-picker-in-product-edit-form-in-magento-2/

The swatch box shows but if I click on it then I get no pop up colour picker.

There is no error in the console or signs that anything is missing.


texts: gstatic.com/generate_204 believed to be slowing down my website

texts:
We recently are experiencing issues where our website is taking over a minute to load and when looking into the webpagetest results to see what can be causing the issue, a new (we believe it to be new atleast) thing that is displaying and being the clear culprit is after loading the domain, it goes into loading gstatic.com/generate_204 which almost appears to time out every time, then everything after that loads in.

The CPU utilization seems to be fluctuating the whole time as it tries to load as well so something is going on, I am just not sure exactly what. (The generate_204 may not even be the issue, but it does appear new as we run tests all the time and looks to be whats causing the issue in our eyes)

I am unaware of what this generate_204 is, and when googling it, you see a lot of it being a type of malware or similar that you remove from your computer, but this seems to be on my website (maybe within the files) that is now suddenly trying to load on all pages and destroying its load time.
Another point that may help, is a lot of the time after trying to load pages now, we start seeing these errors show up in the var/reports section and the magento store just errors for the customer;
a:5:{i:0;s:215:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away, query was: SELECT `main_table`.* FROM `design_change` AS `main_table` WHERE (store_id = :store_id) AND (date_from = :required_date or date_to IS NULL)";i:1;s:3066:"#0 .../lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 .../app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 .../lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 .../lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 .../lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#5 .../lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 .../app/code/core/Mage/Core/Model/Resource/Design.php(179): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select), Array)
#7 .../app/code/core/Mage/Core/Model/Design.php(62): Mage_Core_Model_Resource_Design->loadChange('1', NULL)
#8 .../app/code/core/Mage/Core/Model/App/Area.php(162): Mage_Core_Model_Design->loadChange('1')
#9 .../app/code/core/Mage/Core/Model/App/Area.php(124): Mage_Core_Model_App_Area->_initDesign()
#10 .../app/code/core/Mage/Core/Model/App/Area.php(92): Mage_Core_Model_App_Area->_loadPart('design')
#11 .../app/code/core/Mage/Core/Model/App.php(789): Mage_Core_Model_App_Area->load()
#12 .../app/code/core/Mage/Core/Controller/Varien/Action.php(512): Mage_Core_Model_App->loadArea('frontend')
#13 .../app/code/core/Mage/Core/Controller/Front/Action.php(69): Mage_Core_Controller_Varien_Action->preDispatch()
#14 .../app/code/core/Mage/Core/Controller/Varien/Action.php(407): Mage_Core_Controller_Front_Action->preDispatch()
#15 .../app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#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(684): Mage_Core_Model_App->run(Array)
#19 .../index.php(83): Mage::run('', 'store')
#20 {main}";s:3:"url";s:33:"/catalogsearch/result/?q=camera";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Does anyone know what this may be, how we could possibly find it and remove it? -- And if this may not be the problem, any ideas on better ways to determine the possible culprit?


texts: HTTP 500 error when trying to edit magento theme setting

texts:
I just installed Magento 2.3 with sample data on an Ubuntu 18 VM.

I'm playing around with creating themes based on tutorials I found online. I created a sample theme, uploaded it, logged into admin, and then switched to it with no issues.

Now, I'm having an issue trying to switch to an alternative theme. For some reason, I can't seem to change themes anymore; even though I could before.

Here are the steps I go through:

  Log in to the admin panel
  Go to Menu -> Content -> Configuration
  Click 'Edit' under 'Action' column

What I now get is a page that looks like this:

I don't recall doing anything noteworthy after I first switched themes from the default to the new one I created.

How can I fix this?

UPDATE

The URL reporting the 500 error is the following:

  https://<my-magento-install-url>/admin/theme/design_config/edit/scope/stores/scope_id/1/key/<some-long-number>/


texts: Customer password reset in magento 2: "Something went wrong while resetting customer password"

texts:
I want to change customer password from backend. I clicked on reset password but I am getting error as lik:

  Something went wrong while resetting customer password.


texts:
Lets say I have two cronjobs:

 <vendor_module_task1>
    <schedule><cron_expr>0,10,20,30,40,50 * * * *</cron_expr></schedule>
    <run><model>sometask</model></run>
  </vendor_module_task1>

  <vendor_module_task2>
    <schedule><cron_expr>9,19,29,39,49,59 * * * *</cron_expr></schedule>
    <run><model>sometask</model></run>
  </vendor_module_task2>

If the cron runs every minute, its obvious that the buttom task will always execute one minute before the first task (or 9 minutes after, depends on perspective..)

However, some magento sites are configured to run cron every 5 minutes or more, instead of every minute. On those systems those two tasks will run together, which is fine, but I want to make sure they maintain their original order.

So my questions:

Am I guaranteed that the bottom task will execute before the top task, even if cron is every 5 minutes?
Am I guaranteed that the latter task will only start executing after the first task is done, and not simultaneously (provided it doesn't use any async calls)?

On my system it seems to be the case, but I want to make sure its the defined behavior and not just by luck.


texts: Please correct the XML data and try again with simple settemplate

texts:
So I have set a really simple set template for the checkout cart to be edited.

Module vendor/name : Designit/LiveUpdate

Designit/LiveUpdate/view/frontend/layout/checkout_cart_index/xml :

<referenceBlock name="checkout.cart.form">
    <action method="setTemplate">
        <argument name="template" xsi:type="string">Designit_LiveUpdate::cart/form.phtml</argument>
    </action>
</referenceBlock>

Everything seems to work fine but i have a bunch of errors in system.log now :

[2017-07-28 14:13:59] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_4e13260053f56644d576f1e487266f9a1 and handles default, checkout_cart_index: Please correct the XML data and try again.  [] []
[2017-07-28 14:13:59] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_40a98983867a1770682b48d9a0ad63441 and handles 1column: Please correct the XML data and try again.  [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'catalog.compare.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'sale.reorder.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'checkout.cart.item.renderers.gift-card.actions.gift_options' element cannot be added as child to 'checkout.cart.item.renderers.gift-card.actions', because the latter doesn't exist [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'sticky.catalog.topnav' tries to reorder itself towards 'sticky.logo', but their parents are different: 'sticky.header.right' and 'sticky.header.left' respectively. [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'checkout.cart.item.renderers.gift-card.actions.gift_options' tries to reorder itself towards '', but their parents are different: 'checkout.cart.item.renderers.gift-card.actions' and '' respectively. [] []
[2017-07-28 14:13:59] main.CRITICAL: Broken reference: the 'currency' tries to reorder itself towards 'store_language', but their parents are different: 'header.top.inner.right' and 'header.panel' respectively. [] []
[2017-07-28 14:13:59] main.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_46f1b068ec7ccf4878f9284dd1137afd1 and handles catalog_product_prices: Please correct the XML data and try again.  [] []

Any idea what I'm doing wrong? I've used this method before to change other things.

NOTE :

I'm not having any issue with the template itself. It works. Its only the error that i get which seems to have no consequences at all.

Do not link me duplicates if they do not specifically talk about this scenario where you have 1 xml , 1 template fille , template works fine and xml has only a setTemplate.


texts:
My magento acts up weird.
I have normall magento caching enabled, but also OPcache enabled on php 7.1.10.
The problem i have is when i load the website in one browser i see the following:

When i look at it in another browser(that previously loaded the website before the cache was cleared) i see the following (it grabs the html of a widget that shows above this one) :

Bonus; when i look at the 'wrong' browser incognito. It shows correctly. So if i'm correct the cache on the browser side isn't invalidated as it should after a cache clear?
How come, and more important. How can i solve it?


texts: Magento 2 - REST API filter customer data by address fields

texts:
I want to filter customers in a country,state,city or street in REST API. How can I do it?
I am using the /V1/customers/search API Call. Now I can only filter by the customers default billing address values.
When I try to filter by address fields, it throws an error "Invalid attribute name: %1".
How can I filter customers by address fields?


texts: Magento 2: How to create easy editable collapsible content pages in magento

texts:
I need some opinions to build a proper page in my Magento website.

The requirement is to show a list of collapsible contents in a page which in future can be easy to edit the content by the client itself.

My client doesn't want me to put HTML inside the CMS Page editor.


texts:
I'm seeing this in a widget and would like to know what it does.  I'm unsure as to where to look for documentation in regards to issues like this as well, any helpful pointers / ways to streamline search are appreciated.

In the expressed widget on the page i'm seeing the page number, however, i'd like to modify this code and would like to know where this function is defined.


texts: Delete related url_rewrites when category is deleted

texts:
Any one have idea when we delete a Category from the admin panel does it also deletes the url_rewrites related to that category or do we have to delete those manually.
Note: if we don't delete the url_rewrites of deleted category sometimes it gives error in saving category from admin panel.


texts: Magento 2 Uninstall or update Authorize.net module

texts:
I wan't to know how can I uninstall Authorize.net module from Magento 2.2.7 without affecting other modules, because as far as I know it's a core module. The reason I want to do this is because Authorize.net module in Magento Marketplace seems to have Vault option.
Furthermore, I tried to update the composer package for a newer version: composer require authorizenet/magento-module-authorizenet:1.0.1

Sadly did not work because I cannot see the vault option in admin panel.
If I cannot update the module, can I delete the whole module and install the one from Market Place?


texts: What is the event called for Cheque received and cheque cleared?

texts:
In admin

Sales->Orders->Cheque Received->Notify customer by Email

I want to know either which event is called or which template is used.


texts: Magento 2.3.X: GraphQL does not reflect catalog rule discounts

texts:
I'm using Magento 2.3.2. I've successfully completed all cart-related tasks (create cart, add a product, select shipping& payment methods, and place the order) using GraphQL.

GraphQL seems not to include the product real final price after applying the catalog rule.


texts: url structure is not working well in magento site with categories and sub categories

texts:
we used following format under " age" menu in [Current Demo URL][2]

code  : [PASTEBIN DEMO][3]

**"shop by age "**is main category and all other are sub category.

but urls are generating like as in the image

  shop-by-age/shop-by-age/shop-by-age/shop-by-age/0-6-months.html

click on 0-6 months for 3 or 4 times

please help me to find solution.

thanks in advance


texts: Local installation of Magento 2 doest not generate files in the pub/static folder

texts:
I've just installed Magento 2 Community Edition with sample data (downloaded from their website and not installed with composer) locally via MAMP. The installation process was succesful, but all files in the pub/static folder are missing except .htaccess. That means all css, js etc. return 404 for both frontend and backend.

I've spent several hours trying to fix this without luck. This is what I've done so far:

Changed Options Indexes FollowSymLinks AllowOverride from 'None' to 'All' in the /MAMP/conf/apache/httpd.conf and restarted MAMP
Made sure LoadModule rewrite_module modules/mod_rewrite.so is uncommented in httpd.conf
Set up a development domain (magento.dev) in MAMP
Tried running php bin/magento setup:static-content:deploy in the magento.dev root using Terminal. This however returns:

  Fatal error: Class 'Locale' not found in
  /Applications/MAMP/htdocs/magento.dev/vendor/magento/framework/Locale/Bundle/DataBundle.php
  on line 64

Uncommented and changed RewriteBase to RewriteBase / in the .htaccess-file in the magento.dev root directory.
Set Magento in development mode
Clearing the cache manually and running php bin/magento setup:static-content:deploy again

Most guides and forum posts tell me to run: php bin/magento setup:static-content:deploy but I'm not sure, if I'm doing it correctly.

OS: OSX 10.11.2

MAMP version: 3.5

PHP version: 7.0

Apache version: 2.4.16

MySQL version: 5.6.25

Any help would be appreciated.


texts:
I run manually cron via cron:run first I got the error that email address isn't valid when I correct that, now in cron.log I don get nothing about newsletter sending, I don't receive the email either.

I am using Magento 2.3 v


texts: I made some changes to js/varien/configurable.js but they don't seem to work as expected, I open the file in a built in debugger in my browser and set a break point at desired location, however it looks like it is never reached. When I move my breakpoint to the start of function it stops at that breakpoint(meaning function is being called) however the usuall shortcuts to step into function does not work. Any guidance would be appreciated.


texts: Magento 1.9.x - Create store dependent attributes for entity customer

texts:
Earlier add a new custom attribute biography_desc was added for customer:

$installer = $this;
$installer->startSetup();

$installer->addAttribute("customer", "biography_desc", array(
    "type" => "text",
    "backend" => "",
    "label" => "Biography",
    "input" => "textarea",
    "source" => "",
    "visible" => true,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique" => false,
    "note" => ""

));

$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "biography_desc");

$used_in_forms = array();

$used_in_forms[] = "adminhtml_customer";
$used_in_forms[] = "customer_account_edit";
$attribute->setData("used_in_forms", $used_in_forms)
    ->setData("is_used_for_customer_segment", true)
    ->setData("is_system", 0)
    ->setData("is_user_defined", 1)
    ->setData("is_visible", 1)
    ->setData("sort_order", 100);
$attribute->save();

Now, i had to make it store dependent, so that i could add description on differnet languages: en, fr и etc.

For products this is not a problem, because table eav_entity_text has a field store_id. And all examples where it requires to do such things work on products.

Please advice how to solve this problem,now i can see only one solution json or create attributes biography_desc_en, biography_desc_fr etc.


texts: Magento 2 add custom button next to cart button

texts:
I want to add a button next to the cart showed in the screenshot.

Any ideas how to achieve this?

(EDIT) Only need to know what to write in the layout.xml

This is the current XML code

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <referenceContainer name="minicart.addons">
            <block class="MassiveArt\ShoppingCart\Block\Button" name="minicart.movetoquote" template="MassiveArt_ShoppingCart::button_getcart.phtml"/>
        </referenceContainer>
</page>

and this is how it gets displayed at the moment:


texts: Is the API method catalogCategoryAssignedProducts usable anymore?

texts:
I am calling catalogCategoryAssignedProducts to retrieve the products that belong to a certain category ID however am facing the following error:

Fatal error: Uncaught SoapFault exception: [2] Access denied. in /home/magento/www/test.php:25 Stack trace: #0 /home/magento/www/test.php(25): SoapClient->__call('catalogCategory...', Array) #1 /home/magento/www/test.php(25): SoapClient->catalogCategoryAssignedProducts(Object(stdClass)) #2 {main} thrown in /home/magento/www/test.php on line 25

The code I am running is:

$result = $proxy->catalogCategoryAssignedProducts((object)array('sessionId' => $sessionId->result, 'categoryId' => '8'));

After searching around for a little bit, I read on the Magento forum that this method does not work since 1.4 - is it true?


texts: Is it possible to redirect the Magento 2 Contact Form without a custom module?

texts:
I'm trying to get the Magento 2 Contact form to redirect not to /contact/index but someplace else.
Here is what I have so far:

We use a custom theme, in which I have created a the following folders

Magento_Contact
    -email
        -submitted_form.html
    -templates
        - form.phtml

I've edited the form.phtml to add / edit the fields as required.

I've created a content block and added the form to it with:

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}

And I've created a CMS Page with this block in it, using

{{block class="Magento\\Cms\\Block\\Block" block_id="myContact"}}

Now I want to the user to stay on that CMS Page after submitting the form, so I presume I will need to change $this->_redirect('contact/index'); to $this->_redirect('*/*/'); in the modules post controller.

I was wondering if there wasn't a quicker way to add the redirect, maybe as a block comment or similar.

Thank you.


texts: Using Varien_File_Csv and _prepareDownloadResponse to return csv

texts:
I am creating csv exporter for some custom tables where multiple tables are combined in a way that is not like any model or grid in the back end. In the controller I have a action function that collects the data and combines it into a 2 dimensional array. I am currently trying to refine the function that converts the array into a string for _prepareDownloadResponse and am wondering if it can be used together with Varien_File_Csv to convert an array to a csv.

I know the following works, though some extra processing is needed around the implode.

$csv_data = array();

// Add data to $csv_data

$fileName = "example.csv";

$content = "";
foreach($csv_data as $line){
  $content .= implode(",", $line)."\n";
}

$this->_prepareDownloadResponse($fileName, $content);

I am wondering if the following is possible

$csv_data = array();

// Add data to $csv_data

$fileName = "example.csv";

$var_csv = new Varien_File_Csv();

$var_csv->saveData($fileName, $csv_data);

// a step here is need to get the string out of the file into $content

$this->_prepareDownloadResponse($fileName, $content);


texts: How to Manually install magento extensions and themes?

texts: I tired of searching in google and also in MSE but didn't find the exact way of installing magento extensions and themes MANUALLY as I use LINUX I cannot able to install through Magento Connect manager so please someone help me with this and also Iam getting error 503.


texts:
When saving any configuration in the admin I get this;

> Exception: Notice: Undefined variable: _ENV in
> /home/selectli/public_html/vendor/magento/module-config/Model/Config/Processor/EnvironmentPlaceholder.php
> on line 57 in
> /home/selectli/public_html/vendor/magento/framework/App/ErrorHandler.php:61
> Stack trace: #0
> /home/selectli/public_html/vendor/magento/module-config/Model/Config/Processor/EnvironmentPlaceholder.php(57):
> Magento\Framework\App\ErrorHandler->handler(8, 'Undefined varia...',
> '/home/selectli/...', 57, Array) #1
> /home/selectli/public_html/vendor/magento/framework/App/Config/PreProcessorComposite.php(35):
> Magento\Config\Model\Config\Processor\EnvironmentPlaceholder->process(Array)
> #2 /home/selectli/public_html/vendor/magento/module-config/App/Config/Type/System/Reader.php(60):
> Magento\Framework\App\Config\PreProcessorComposite->process(Array) #3
> /home/selectli/public_html/generated/code/Magento/Config/App/Config/Type/System/Reader/Proxy.php(95):
> Magento\Config\App\Config\Type\System\Reader->read() #4
> /home/selectli/public_html/vendor/magento/module-config/App/Config/Type/System.php(292):
> Magento\Config\App\Config\Type\System\Reader\Proxy->read() #5
> /home/selectli/public_html/vendor/magento/module-config/App/Config/Type/System.php(191):
> Magento\Config\App\Config\Type\System->readData() #6
> /home/selectli/public_html/vendor/magento/module-config/App/Config/Type/System.php(152):
> Magento\Config\App\Config\Type\System->loadDefaultScopeData('default')
> #7 /home/selectli/public_html/vendor/magento/framework/App/Config.php(131):
> Magento\Config\App\Config\Type\System->get('default/newreli...') #8
> /home/selectli/public_html/vendor/magento/framework/App/Config.php(80):
> Magento\Framework\App\Config->get('system', 'default/newreli...') #9
> /home/selectli/public_html/vendor/magento/module-new-relic-reporting/Model/Config.php(91):
> Magento\Framework\App\Config->getValue('newrelicreporti...') #10
> /home/selectli/public_html/vendor/magento/module-new-relic-reporting/Plugin/HttpPlugin.php(49):
> Magento\NewRelicReporting\Model\Config->isNewRelicEnabled() #11
> /home/selectli/public_html/vendor/magento/framework/Interception/Interceptor.php(121):
> Magento\NewRelicReporting\Plugin\HttpPlugin->beforeCatchException(Object(Magento\Framework\App\Http\Interceptor), Object(Magento\Framework\App\Bootstrap), Object(Exception)) #12
> /home/selectli/public_html/vendor/magento/framework/Interception/Interceptor.php(153):
> Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Bootstrap),
> Object(Exception)) #13
> /home/selectli/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(39):
> Magento\Framework\App\Http\Interceptor->___callPlugins('catchException',
> Array, Array) #14
> /home/selectli/public_html/vendor/magento/framework/App/Bootstrap.php(261):
> Magento\Framework\App\Http\Interceptor->catchException(Object(Magento\Framework\App\Bootstrap),
> Object(Exception)) #15 /home/selectli/public_html/index.php(39):
> Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
> #16 {main}

Any Ideas?

Thanks,


texts: Cart price rule discount description does not displayed on cart page in magento

texts:
The cart price rule "Default Rule Label" and "Store View Specific Labels" are not displayed in the cart. (see screenshot) However the labels are nicely displayed in the confirmation email and on the invoice.

Youd should expect the description displayed between brackets after Discount (where you see now as an example in red 'no label'

I have search an hour on the internet, but I couldn’t find a proper fix or solution. Anybody an idea how to solve this?

Thanks


texts: Calling M2 REST API from browser for anonymous users

texts:
I'm trying to call REST endpoints from the browser. Initially, I'd like to be able to fetch product information.

It looks like session-based authorization is what I'm after.

I started by grabbing a Javascript swagger client from npm.

Now I'm trying to make a simple call to fetch products (I have but one in my local site currently).

m2.catalogProductRepositoryV1GetListGet().done((rsp) => {
  console.log('Products: ', rsp.body)
});

However, I'm getting a 401. Then I see this note in that same session-based-auth doc mentioned above

  Customers can access resources that are configured with anonymous or
  self permission in the webapi.xml configuration file.

So I look in vendor/magento/module-catalog/etc/webapi.xml

<route url="/V1/products" method="GET">
    <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="getList"/>
    <resources>
        <resource ref="Magento_Catalog::products" />
    </resources>
</route>

Notice no anonymous or self permission here. Now I'm thinking really? Products are not allowed to be consumed by the browser out of the box?

I'm understand Magento_Catalog::products refers to a Resource Model. I'm now trying to define and ACL, however, I'm unsure how to associate the ACL with public (not-logged in) users.


texts: Magento 2: How Should Module Developers Read their Own Configuration Files

texts:
Scenario: I am a Magento 2 module developer.  I want to create a configuration file in app/etc.  I want this file to be "scoped" by area

app/etc/my_file.xml
app/etc/frontend/my_file.xml
app/etc/adminhtml/my_file.xml

In Magento 1 I'd just create a config.xmland be on my way.  The area scoping happened in the XML file itself.  However, Magento 2 approaches this very differently

In Magento 2, what class file(s?) should I create for reading these scoped configuration files.  It's not clear from the Magento 2 source what "the right" way to do this is.  The core code take multiple approaches, and none of them are marked with an @api method.  This makes it difficult to know how to proceed with this common module developer task. As a secondary side-effect, it also makes it difficult to know how a Magento module developer should read from core configuration files.

On one hand, it seems like "the right" thing to do is create a file system reader object.  For example, Magento seems to load the import.xml file with the following

#File: vendor/magento/module-import-export/Model/Import/Config/Reader.php
namespace Magento\ImportExport\Model\Import\Config;

class Reader extends \Magento\Framework\Config\Reader\Filesystem
{

    public function __construct(
        //...
        $fileName = 'import.xml',
        //...
    ) {
        parent::__construct(
            $fileResolver,
            $converter,
            $schemaLocator,
            $validationState,
            $fileName,
            $idAttributes,
            $domDocumentClass,
            $defaultScope
        );
    }
    //...
}

The base Magento\Framework\Config\Reader\Filesystem class looks like it has code to resolve the area scope.

However some of the  Magento configuration files seem to eschew this pattern. While there are readers for these files (event.xml in this example)

vendor/magento/framework/Event/Config/Reader.php

There's also "scoped data" classes that use these readers.

#File: vendor/magento/framework/Event/Config/Data.php
class Data extends \Magento\Framework\Config\Data\Scoped
{
    public function __construct(
        \Magento\Framework\Event\Config\Reader $reader,
        //...
    ) {
        parent::__construct($reader, $configScope, $cache, $cacheId);
    }
}

This makes it seem like the scoped reader classes are what a module developer should create. But not all configuration files have these scoped readers.

Is there a clear path for Magento 2 module developers to follow?  Or is this just something Magento 2 module developers should approach in their own way, and the resulting chaos/non-standard-configuration-loading is just the cost of doing business?

The official documentation does a good job of covering some of the available classes, but nothing that reconciles the fact there's no clear guidance on which concrete implementation we're suppose to use, or if the expectation is every module decides how to do this on its own.


texts: magento display custom attribute in sales order grid

texts:
For: Simple Product

As you can see the image i displayed the color attribute in dropdown in view page. now the customer can select the color. after they clicking buy now i need to save the color in sales grid....


texts: How to set value of an image custom option programmatically Magento 2?

texts:
I'm trying to set a image Custom Option in a php script before adding the product to cart. Relevant code looks like this:

$specialId = 123;
$customOptions[$specialId] = "Special instruction custom option";

// $imageId = 124;
// $url = 'http://example.com/url/to/image.png';
// $customOptoins[$imageId] = $url;

$params = [
    'product' => $product_id,     //product Id
    'qty'     => $qty,            //quantity of product
    'options' => $customOptions   //custom options
];

$this->_cart->addProduct(
    $_product,
    $params
);

I'm starting with an image url as the code implies. I think I have to use Magento\Framework\Api\Data\ImageContentInterface, Magento\Catalog\Model\Webapi\Product\Option\Type\File\Processor and maybe curl, but I'm unsure how to proceed.


texts:
I want to update the value of amount column in custom database table where customer_id with value of $total.

$total = $array['amount'] - $arr['base_grand_total'];
$sortedData = $prepaidModel->getCollection()->addFieldToSelect('amount')->addFieldToFilter('customer_id',1);
foreach($sortedData as $sData)
{
    $sData->setData('amount',$total);
    $sData->save();
}

Not updating the value. But multiple records are adding in database table

Kindly guide.


texts: On my products page I have set the layout to be 2 columns with right bar. What I am trying to do is make the col-right sidebar border height to be the same as the col-main. I have tried doing this in the CSS and have been only able to do it by manually setting the pixel height. Obviously the main class and the col-main class heights are set by the content. I was just wondering if there is a way to set the col-right sidebar class border height to automatically be the same as the col-main class?


texts:
I am not able to place order using Cash on Delivery. it takes very long time to and not processing the order, it comes back to the cart with items listed.

this site loads very slow can, please let me know any observations to improve the speed of the http://www.alaincooponline.com

Here is the screenshot after clicking on place order.


texts: Sending PDF via email works when command run on console, but not when run by a cron job

texts:
I've become stuck, I want to send a custom report via email in a pdf format. It's strange because it works correctly when I run the command via the console, but when it's run via a cron job nothing happens.
I'll appreciate it greatly if someone can point me in the right direction.
P.S. I know the cron functions correctly as it works perfectly if the attachment is a pdf.
Please see my code below.
Many thanks!
        $config = array('auth' => 'login',
            'username' => 'someemail@gmail.co.uk',
            'password' => 'somepassword',
            'ssl' => 'tls');

        $transport = new \Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);

        $mail = new \Zend_Mail();
        $mail->setBodyText("Hello, please see " . $fileName . " attached.");
        $mail->setSubject($fileName . " " . $this->getNextDeliveryDate());
        $mail->setFrom('someemail@gmail.co.uk', $fileName . $this->getNextDeliveryDate());
        $mail->addTo('someemail@gmail.co.uk', 'Info');
        $mail->addTo('someemail2@gmail.co.uk', '');

        $fileContents = fopen($this->directory->getAbsolutePath($filepath), 'r');
        $attachment = new \Zend_Mime_Part($fileContents);
        $attachment->type = 'application/pdf';
        $attachment->disposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
        $attachment->encoding = \Zend_Mime::ENCODING_BASE64;
        $attachment->filename = $fileName . $this->getNextDeliveryDate() . ".pdf";

        $mail->addAttachment($attachment);

        try {
            $transport->send($mail);
        } catch (\Exception $e) {
          //  var_dump($e->getMessage());
        }
    }

Since posting this, I still haven't had any luck. I've switched it to sending via csv on the corn job and it works perfectly, would anyone know what I'm doing wrong?
Update:
From further investigation, it appears to stop working when this function runs via cron;
    public function generatePDF($itemDataRaw, $filename){

    ksort($itemDataRaw);

    $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
    $html =  $this->_blockFactory->createBlock('Magento\Backend\Block\Template')
        ->setTemplate('Ozark_Managment::stocklist/stock.phtml')
        ->setData('itemDataRaw', $itemDataRaw)
        ->setData("nextDeliveryDate", $this->getNextDeliveryDate())
        ->toHtml();

    // instantiate and use the dompdf class
    $dompdf = new Dompdf();
    $dompdf->loadHtml($html);
    $options = $dompdf->getOptions();
    $options->set(['isRemoteEnabled' => true]);
    $dompdf->setOptions($options);
    // (Optional) Setup the paper size and orientation
    $dompdf->setPaper('A4', 'portrait');

    // Render the HTML as PDF
    gc_collect_cycles();
    gc_disable();
    $dompdf->render();
    gc_enable();
    gc_collect_cycles();

    $name = date('m-d-Y-H-i-s');
    $filepath = 'export/itemsreq/'. $filename . $name . '.pdf';
    $this->directory->create('export/itemsreq');
    $sheet = $dompdf->output();

    $stream = $this->directory->openFile($filepath, 'w+');
    $stream->write($sheet);
    $stream->close();
    return $filepath;
}

Update 2:
I checked the cron_schedule table for the message, and it was "Area Code already set" So I set up a try and except block on the below, and it worked! Now the problem is my PDF is blank!
try {
        $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
    } catch (\Exception $e) {
        var_dump($this->state->getAreaCode());
    }


texts: Use new field "Full Name" to replace "First Name" and "Last Name" in Checkout

texts:
My idea is to use to add a new field called "Full Name" and it will fill out the "First Name" and the "Last Name" while you type in the checkout.
I have almost everything ready but I can't let know to "First Name" and "Last Name" that those values were updated.
Let show what I did and someone can tell me what I'm missing.

Edit the frontend/di.xml

/app/code/CustomVendor/CustomModule/etc/frontend/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
    <plugin name="checkout_custom_fields" type="CustomVendor\CustomModule\Plugin\Checkout\Model\LayoutProcessor" sortOrder="1"/>
</type>
</config>

2.Add the LayoutProcessor.php
app/code/CustomVendor/CustomModule/Plugin/Checkout/Model/LayoutProcessor.php

    /**
 * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
 * @param array $jsLayout
 * @return array
 */
public function afterProcess(
    \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
    array  $jsLayout
) {
    $shippingConfiguration = &$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
    ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'];

    $shippingConfiguration = $this->setFullName($shippingConfiguration);

    return $jsLayout;
}

    /**
 * Set "Full Name"
 * @param array $shippingConfiguration
 * @return array
 */
private function setFullName(array  $shippingConfiguration){

    $shippingConfiguration['full_name'] = [
        'component' => 'AdditionalProducts_AdditionalProductsModule/js/checkout/abstract',
        'config' => [
            'customScope' => 'shippingAddress',
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/input',
            'options' => [],
            'id' => 'full-name'
        ],
        'dataScope' => 'shippingAddress.full_name',
        'label' => __('Full Name'),
        'provider' => 'checkoutProvider',
        'visible' => true,
        'validation' => [
            'required-entry' => true
        ],
        'sortOrder' => 0,
        'id' => 'full-name',
    ];

    return $shippingConfiguration;
}

Added abstract.js but with a custome code
app/code/CustomVendor/CustomModule//view/frontend/web/js/checkout/abstract.js

/**
 * Update whether value differs from default value
 */
setDifferedFromDefault: function () {
    var value = typeof this.value() != 'undefined' && this.value() !== null ? this.value() : '',
        defaultValue = typeof this.default != 'undefined' && this.default !== null ? this.default : '';

    this.isDifferedFromDefault(value !== defaultValue);

    this.setFirstLastNameFromFullName(value);
},

/**
 * Extract from the 'Full Name' the 'First' and 'Last' Name
 *
 * @param value
 */
setFirstLastNameFromFullName : function(value){
    var fullValue = value;
    var lastSpacePos = fullValue.lastIndexOf(" ");
    var nameLimit = 10;
    var lastNameLimit = 10;

    if (lastSpacePos > 0) { // Ignore values with no space character
        if(fullValue.substring(0, lastSpacePos).length < nameLimit){
            // Update "firstName"
            $($('[name="shippingAddress.firstname"]').find('input')[0]).val(fullValue.substring(0, lastSpacePos));
        }
        if(fullValue.substring(lastSpacePos + 1).length < lastNameLimit){
            // Update "lastName"
            $($('[name="shippingAddress.lastname"]').find('input')[0]).val(fullValue.substring(lastSpacePos + 1));
        }
    }else{
        if(fullValue.length < nameLimit){
            // Update "firstName"
            $($('[name="shippingAddress.firstname"]').find('input')[0]).val(fullValue);
            console.log(this.firstname);
        }
    }
},


texts:
After searching around I still haven't found a solution so I thought I would post it here. Any help would be greatly appreciated.

When I go to filter one of the columns it redirects me to dashboard then when I click on sales -> orders it loads the following error:

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous, query was: SELECT COUNT(*) FROM mg_sales_flat_order_grid AS main_table
 INNER JOIN mg_sales_flat_order AS order ON order.entity_id=main_table.entity_id WHERE (store_id = '1')


texts: No connection with Magento 1 SOAP API via https (SSL)

texts:
I try to get customer datas via a PHP script and the Magento 1 SOAP API. At my development system, every thing is works well.

But now when I try to use it at the online Shop with active SSL, I get no connections to the wsdl object.

My PHP call

$wsdl = 'https://urltoshop/api/v2_soap/index/?wsdl=1';
$user = 'soapuser';
$pass = 'paasword';
...
//options for ssl in php 5.6.5
$opts = array(
    'ssl' => array(
            'ciphers' => 'SHA-256',
            'verify_peer' => false,
            'verify_peer_name' => false
    )
);
// SOAP 1.2 client
$params = array(
    'encoding' => 'UTF-8',
    'verifypeer' => false,
    'verifyhost' => false,
    'soap_version' => SOAP_1_2,
    'trace' => 1,
    'exceptions' => 1,
    'connection_timeout' => 180,
    'stream_context' => stream_context_create($opts)
);
$proxy = new SoapClient($wsdl);
...
try {
   $sessionId = $proxy->login($user, $pass);
} catch (Exception $e) {
   $sessionId = null;
   echo $e->getMessage();
}

And I get always the error message like this:

  SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://urltoshop/api/v2_soap/index/?wsdl=1' : failed to load external entity

This url works in a webbrowser, and I get the xml structure. I have already try a lot of SoapClient options like:

'verifyhost' => false,
'verify_peer' => false, '
'verify_peer_name' => false
 'ssl' => array('allow_self_signed' => true));

etc...

But nothing works for me.

Is this a problem with my PHP script, or a config problem in my Apache Webserver? Or something in the Magento configuration?

Has any of you guys any experience with such a constellation like this?

Does everyone know a good manual page, how to setup the SOAP API in Magento incl. a https:// connection?


texts: trying to dump my cms_block and cms_page tables to new working Database. I get the Duplicate Entry for Primary Key ...what is the best way to go about this? when I export tables from old db I have Disable foreign key checks as well.


texts: getCurrentUrl does not give me current url

texts:
I want to get current url and check it (if matching) so that I can add 'active' class into my nav bar '< li >' tags. After searching, I found Mage::helper('core/url')->getCurrentUrl() could do that but it is not working for me. It gives me http://mydomain/app/etc/local.xml

Any reasons why I got that url string?


texts: Add a MySQL index key to a column in Magento 1 flat tables

texts:
How can I have the Magento product flat tables (catalog_product_flat_1 etc) built with a MySQL index (key) on a specific column?

It seems that by default each flat table has these indexes:

PRIMARY KEY (`entity_id`),
KEY `IDX_CATALOG_PRODUCT_FLAT_2_TMP_INDEXER_TYPE_ID` (`type_id`),
KEY `IDX_CATALOG_PRODUCT_FLAT_2_TMP_INDEXER_ATTRIBUTE_SET_ID` (`attribute_set_id`),
KEY `IDX_CATALOG_PRODUCT_FLAT_2_TMP_INDEXER_NAME` (`name`),
KEY `IDX_CATALOG_PRODUCT_FLAT_2_TMP_INDEXER_PRICE` (`price`),
KEY `IDX_CATALOG_PRODUCT_FLAT_2_TMP_INDEXER_SKU` (`sku`),

I would like to add another key to that. My understanding is that I can't simply run an SQL migration to add the key, as it will be lost the next time the Magento indexer runs. I would also have to manually add migrations for each new flat table built for any new store scopes that might be added in future.

Is there a standard way of achieving this within Magento?

This has been quite difficult to search for due to Magento using the term "index" to mean its flat table design as opposed to MySQL indexes.