texts: Magento 2.3 : Css files not generating while static content deploy

texts:
In File.php line 150:

The contents from the

"D:/projects/directory/m2/pub/static/frontend/Smartwave/porto/en_US/css/styles-l.css" file can't be read. Warning!file_get_contents(D:/projects/directory/m2/pub/static/frontend/Smartwave/porto/en_US/css/styles-l.css): failed to open stream: No such file or directorysetup:static-content:deploy [-f|--force] [-s|--strategy [STRATEGY]] [-a|--area [AREA]] [--exclude-area [EXCLUDE-AREA]] [-t|--theme [THEME]] [--exclude-theme [EXCLUDE-THEME]] [-l|--language [LANGUAGE]] [--exclude-language [EXCLUDE-LANGUAGE]] [-j|--jobs [JOBS]] [--symlink-locale] [--content-version CONTENT-VERSION] [--refresh-content-version-only] [--no-javascript] [--no-css] [--no-less] [--no-images] [--no-fonts] [--no-html] [--no-misc] [--no-html-minify] [--] [<languages>...]


texts: Magebuzz manufacturers extension on a static block

texts:
I'm tring to display the manufacturer list in a Static Block on Magento 1.9.3.2

But cannot understand how to do this:

{{block type="Magebuzz/Manufacturer" name="manufacturer" template="Product/manufacturer.phtml"}}

Where can I find "type" and "template" in the extension file and folder to make it works?


texts: count of unique orders by product id or sku magento

texts:
Is it possible to show how count of unique orders(not qty sold, but count of orders).
Also which means exclude multiple orders from same customer ID in magento

Ex:
We wanted to know the how many times the product is sold.
If customer purchases the same product 2 or 3 or 4, the result should be 1

customer_name     product_sku    ordered

test1              rasp123       2

test1              rasp123       1

test2              rasp123       1

test3              rasp123       5

Result should be product sku(rasp123) is sold 3 times

Thanks in advance help me a great.


texts: Magento 2 disable order copy email when the admin sending mail manually from the admin

texts:
I want to disable the order copy email while the Admin user manually sending by click on "Send Email"

So I want to disable order copy mail when it sends manually from Admin.


texts:
I want to have a specific layout for some of my category pages but instead of always using the XML Layout Update

<reference name="right">
<remove name="left.reports.product.viewed"/>
<remove name="newsletter"/>
</reference>

and so on....

Like this I would prefer to have my normal 3 page column layout and have this for specific categories as a Page Layout.
So that instead of copying and pasting the code I could just pick
LAYOUT A from the dropdown and this removing of the blocks would be done for me.

I thought I could create a somehting like this but then my page wouldn´t load any css and it would also not remove the blocks as I thought.


texts: Magento 2: Can't translate New Shipping Address Popup Form label in checkout page

texts:
I'm using Magento 2.3.4 and i tried to translate the City input label inside the new address popup form in checkout page (when we already have an address). I tried using the en_US.csv inside the theme, but it wont change at all:
app/design/frontend/Vendor/module/theme/Magento_Checkout/i18n/en_US.csv
app/design/frontend/Vendor/module/theme/i18n/en_US.csv
City,District
"City","District"
"city","District"
city,District


texts: Display default billing address selected in options. Magento 2

texts:
I want to display the default billing autoselected
in the dropdown menu https://prnt.sc/rmyqwo in checkout page
Magento 2


texts: How to change SQL server password in Magento?

texts: I would like to change the password for my sql server but I got the access denied message from Magento once I changed the password. So how can I change the setting in Magento to reflect the password change? Thanks.


texts: Enable Brantree Payment methods on multi shipping addresses

texts:
I don't get why Magento not giving a solution for Payment methods on multi shipping addresses, for credit card.

Could someone help me how to get Braintree to be enable on multi shipping addresses


texts: magento 2 how to set previous order shipping rate in reorder?

texts:
I have an extension installed for custom shipping rates for backend order creation.

Now there is an issue in that extension. If I create order from backend with custom shipping rate then it works properly and order will be created with added shipping rate, But if I reorder that created order again then it is not prepopulating my previously added custom shipping rate in the latest order. It should be prepopulated.

So how can I make previously selected rates prepopulated in the latest order ?

Thanks In Advance.


texts:
I wish to add a custom home page layout in Magento 2.

In Magento 1, it's very simple, i create my module :

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

and i create a config.xml

<?xml version="1.0"?>
<config>
    <global>
        <page>
            <layouts>
                <custom_home_page>
                    <label>Custom Home Page</label>
                    <template>page/home.phtml</template>
                </custom_home_page>
            </layouts>
        </page>
    </global>
</config>

It's possible to do something similar in Magento 2?


texts:
Which is the most efficient way to load desired model data if you have the flexibility to use any of the available methods?

My guess is via factory and load due to my assumption that the repositories are state-less and a single selection would be faster than filtering a collection down. However, with all of the caching and other optimizations I would like a confirmation.


texts:
I have successfully installed magento 2. I want to import products in csv file related to drinks. If anyone can help to provide an excel sheet with such data, it would be a great help for me.

Thanks in advance.


texts:
I have a small problem with product QTY, i have an ajax update cart extension and i need to display product qty, everything is ok until I add two products in cart. For example if I add first product in cart the quantity is perfect, but when I add the second product the quantity for all product is the last product quantity. I have the following code:

$cart_items = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
    foreach($cart_items as $items) {
            $qtyr = $items->getQty();
    }

           $htmlItem .=' <div class="qty-btngroup">
                            <input type="text" class="input-text qty" maxlength="12" title="Qty" size="4" value="'.$qtyr.'" name="" readonly="readonly">
                        </div>

        $_response = Mage::getModel('ajaxminicart/response')
                ->setCartitem($html)

How can I solve this, I need the qty to be display for each product ..

Update: I paste here my entire public function: http://codepad.org/2ovDqy4i


texts: Magento 1.9 - Use backorder stock instead of actual stock for certain products

texts:
For some "Special" products in a webshop I want to use Backorder stock instead of actual stock which is available for those products but not sure how to proceed with it.

I have looked into MAGE_CATALOGINVENTORY_STOCK_ITEM and its functions CheckQty() and VerifyQty() but still do not how shall I tell Magento to not use actual stock when I place order for those products. Because I do not want Magento to reduce the stock for them. Also I am not sure if I do it in an event or by overriding MAGE_CATALOGINVENTORY_STOCK_ITEM class.

I be very grateful if someone can give me ideas or share some code regarding this.

No, I have not written any code so far as I am not sure how to proceed with it.


texts: Adding amount in reports_report_product_sold_grid.xml magento 2.3.2

texts:
i want to add amount field to reports_report_product_sold_grid.xml in magento 2.3.2. Can anybody help. This is the code i am currently added. but not working.
app\code\Magento\Reports\view\adminhtml\layout\reports_report_product_sold_grid.xml
<block class="Magento\Backend\Block\Widget\Grid\Column" name="adminhtml.report.grid.columnSet.price_incl_tax" as="ordered_price_incl_tax">
                <arguments>
                    <argument name="header" xsi:type="string" translate="true">Amount</argument>
                    <argument name="total" xsi:type="string">sum</argument>
                    <argument name="type" xsi:type="string">number</argument>
                    <argument name="index" xsi:type="string">ordered_price_incl_tax</argument>
                    <argument name="id" xsi:type="string">ordered_price_incl_tax</argument>
                    <argument name="column_css_class" xsi:type="string">col-price_incl_tax</argument>
                    <argument name="header_css_class" xsi:type="string">col-price_incl_tax</argument>
                </arguments>
            </block>

vendor/magento/module-reports/Model/ResourceModel/Product/Sold/Collection.php
  public function addOrderedQty($from = '', $to = '')
{
    $connection = $this->getConnection();
    $orderTableAliasName = $connection->quoteIdentifier('order');

    $orderJoinCondition = [
        $orderTableAliasName . '.entity_id = order_items.order_id',
        $connection->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED),
    ];

    if ($from != '' && $to != '') {
        $fieldName = $orderTableAliasName . '.created_at';
        $orderJoinCondition[] = $this->prepareBetweenSql($fieldName, $from, $to);
    }

    $this->getSelect()->reset()->from(
        ['order_items' => $this->getTable('sales_order_item')],
        [
            'ordered_qty' => 'SUM(order_items.qty_ordered)',
            'order_items_name' => 'order_items.name',
            'order_items_sku' => 'order_items.sku',
            'order_items_price_incl_tax' => 'SUM(order_items.price_incl_tax)'
        ]
    )->joinInner(
        ['order' => $this->getTable('sales_order')],
        implode(' AND ', $orderJoinCondition),
        []
    )->where(
        'order_items.parent_item_id IS NULL'
    )->group(
        'order_items.product_id'
    )->having(
        'SUM(order_items.qty_ordered) > ?',
        0
    );
    return $this;
}

can you pls help


texts: what is the definition of '$_product->unsFinalPrice()'?

texts:
Magento: what is the definition of '$_product->unsFinalPrice()' ? Please explain me.

My issue is When I'm update the product price in admin panel, Price not getting updated in product listing page. But details page was fine.
If I load the product Mage::getModel('catalog/product')->load($_product->getId()) was fine, But I don't want to load the product each time.


texts: What are some important concepts to learn in Magento 2 for Interview?

texts:
This is a general question. I don't know whether it's correct to ask here but I hope I will certainly get help with this.

Currently, I'm looking for a Job in Magento. I know Magento is like a Sea :), so I don't know what are the important topics to learn in Magento that will make me the best Magento developer.

For your info, so far I have known the below things in Magento:

Installing Magento
Installing plugins
Admin Configuration
Basic module development
Custom theme development

Apart from the above-said things, what are the important concepts in Magento?

Could anyone please help guide me?


texts: Update product custom option price in observer

texts:
I need to modify the price of a specific custom option set to a product when the user adds the product to the cart.

Business logic requires that prices be stored with 5 decimals of precision. Since this is not possible in Magento without significant core and database changes (see: Pricing precision beyond 4 digits ), I am exploring the use of a text field attribute (as this is only way to store values such as 0.02992) that will modify the price during add to cart (via observer on sales_quote_add_item event).

Typical use of an observer like this would probably be similar to: https://stackoverflow.com/questions/5104482/programmatically-add-product-to-cart-with-price-change

This is great if I want to simply change the price of the simple product, but I require changing the price of one the custom options instead, and leaving the rest of the price calculation alone.

From what I can tell, $observer->getEvent()->getQuoteItem() only includes the custom options' ids and values which leads me to believe that custom option prices are then later grabbed from another resource.

I feel like there is probably a more appropriate event to observe where the custom options' price is accessed, but am not finding much help.

How can I change the price of a single specific custom option through an observer when adding a product to the cart?


texts: To show coupon (shopping cart discount) amount including tax

texts:
As I try to show correct EU taxes I need to show correct coupon discount(shopping cart discount). My current options are:

These options including tax are recommended on EU while end customer must see their prices always including tax. The problem is that Magento shopping cart rule discount (coupon) amount is always excluding tax.
How to include tax into this label and show it in totals correctly ?

Thank You


texts: How to filter and get shipping address on checkout page based on custom address attribute?

texts:
I want to filter the shipping address visible on the Magento2 checkout page based on a custom address attribute.
I want to show only those address which has the required custom attribute value in them.
From which Magento2 class/file this comes on the checkout page? where I can add my logic.


texts: Exclude certain products from Magento sitemap.xml generation

texts:
I need to make sure a handful of products are NOT in the generated Sitemap.xml file in Magento. I found a couple of example for things like CMS Pages but nothing for doing product pages, and more then 1 product. I am brand new to Magento

Anyone know how this can be done?


texts: Creating a custom helper class in module

texts:
I've made a new module called test_helper and I want to create a helper class in this module so that I can add custom functions to be called all over my site.

I can't however seem to find any examples of just how to go about doing this. I assume I have to create some extra xml in config and ad another file somewhere that extends a base helper but I've not had any luck finding an example to build upon.


texts: Magento 2 - How to remove catalog.leftnav only from category pages with 2columns-right.xml

texts:
I have created a Magento 2 module which has some customization for the category pages.

I would like to remove catalog.leftnav when the category is using the "2 columns with right bar" layout. Is there anyway I can do this in my modules Layout files?

So far I've tried adding <referenceBlock name="catalog.leftnav" remove="true" /> to <my_module_dir>/view/frontend/page_layout/2columns-right.xml but this did nothing.

Then I tried adding <referenceBlock name="catalog.leftnav" remove="true" /> to <my_module_dir>/view/frontend/layout/catalog_category_view.xml but this removed it from everywhere, even pages with 3 column layout.

UPDATE

After reading through the docs on this, I have now also tried creating the following file
app/design/frontend/Holy/mytheme/Magento_LayeredNavigation/page_layout/2columns-right.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <body>
        <!--<move element="catalog.leftnav" destination="sidebar.main" before="-"/>-->
        <!--<update handle="2columns-right"/>-->
        <referenceBlock name="catalog.leftnav" remove="true" />
    </body>
</layout>

But this did not work either.


texts: Magento 2 ERR_TOO_MANY_REDIRECTS in MAMP

texts: I'm having a major issue that I cannot figure out after googling for hours.  I have magento 2 installed on my local MAMP server.  I've run through the installation process and can access the frontend with no problem, but the admin is giving me the ERR_TOO_MANY_REDIRECTS error and won't load.  I installed magento 2 with http://127.0.0.1:8888 as the domain instead of localhost as I've seen that has caused some issues with others.  The full path is http://127.0.0.1:8888/magento2.  I've cleared cookies/cache, edited .htaccess files but nothing is working.  Can anyone please assist me?  I'd greatly appreciate it!


texts:
Originally: There are 2 blocks like this:

namespace Vendor\Module_1\Block;
class ParentBlock{}
class ChildBlock extends ParentBlock {}

Now, I need to rewrite ParentBlock using di.xml:

<preference for="Vendor\Module_1\Block\ParentBlock" type="Vendor\Module_2\Block\ParentBlock" />

namespace Vendor\Module_2\Block;
class ParentBlock extends \Vendor\Module_1\Block\ParentBlock {}

How can I make \Vendor\Module_1\Block\ChildBlock extend from \Vendor\Module_2\Block\ParentBlock?

If there is any more information needed, please tell me.

Thanks in advanced.

===

Updated following answers from @Raphael at Digital Pianism.

Thanks for your explanation. And I thought as you said too, but in my case, it doesn't work.

I have to create a new preference for Module_1\ChildBlock. Then I have to create new Module_2\ChildBlock like this:

namespace Vendor\Module_2\Block;
class ChildBlock extends \Vendor\Module_2\Block\ParentBlock {}

Finally, I have to copy all methods from Module_1\ChildBlock to this one.

This is so crazy!!! I don't know what's wrong, as well as how to fix this problem.


texts: Magento system.xml case sensitive module name issue

texts:
I have created a custom controller in custom module in Magento ce-1.9.2.4.
Module name is given in camelcase as I want to try if Magento accepts camel-case module name in system.xml also other than config.xml.

But when I create the system.xml as below it doesn't create tab in System >> Configuration page.

<?xml version="1.0"?>
<config>
    <tabs>
        <custom translate="label" module="myModule">
            Custom FirmInfo
            <sort_order>100</sort_order>
        </custom>
    </tabs>
    <sections>
        <myModule translate="label" module="myModule">
            Mymodule
            <tab>Autofill</tab>
            <frontend_type>text</frontend_type>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <settings translate="label">
                    Settings
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enable translate="label">
                            Enable
                            <comment><![CDATA[Enable or Disable this extension.]]></comment>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enable>
                    </fields>
                </settings>
            </groups>
        </myModule>
    </sections>
</config>

Please can anybody let me know what could be the issue with the system.xml here.


texts: Category sidebar divider in the category admin panel

texts:
In the topic "Category sidebar width in the category admin panel" at Category sidebar width in the category admin panel @Marius gave instructions to change the width of the sidebar and main section.

What CSS style or other source controls the position of the divider between the two? It would be helpful to move this too.


texts: Random product collection, getPriceHTML gives wrong values

texts:
I am creating a random list of products that refreshes every hour. I've got most of it done but there is one problem: getPriceHTML is returning NULL. This function is used in the normal category product lists and works perfectly there.

This code does give a correct getPriceHTML

$_productCollection = Mage::getModel('catalog/product')->getCollection();

But what I need is to get a random product, no matter what category it is in, so that is not an option.

The following code is the code I use to get random products:

$this->_productCollection = Mage::getResourceModel('catalog/product_collection');
Mage::getModel('catalog/layer')->prepareProductCollection($this->_productCollection);
$this->_productCollection->getSelect()->order('rand()');
$this->_productCollection->addStoreFilter();
$this->_productCollection->setPage(1, 3);

And later on:

foreach($this->_productCollection AS $_product)
{
    echo $this->getPriceHtml($_product, true);
}

For simple products this does give the correct price, but it returns NULL for grouped products. Yes, I am extending to Mage_Catalog_Block_Product.

Please keep in mind that I know that there are other functions to get the price, but I specifically want to know why this isn't working as it should.


texts:
I have imported product from another shop using Magmi. And enabled Use category paths in product urls.

Truncated core_url_rewrite table .
reindexed everything.

3.cleared cache

But still full product path doesn't work.

$item->getProductUrl() returns path like http://website.com/catalog/product/view/id...

I need urls to look like http://website.com/category/subcategory/product.html

I'v tried to use some function to return product url with full path but still i can't enter that product it goes to 404 page.

What should i do? I really need help on this one.


texts: How or when get invoice it's increment id

texts:
I need to work with invoice, just after it's payed but already has increment_id.

Is there event after invoice save? Or which function generate increment_id, so i can create plugin on it.

Thanks.

PS: I tried those to observe those two events, but none of them gave me invoice with increment_id.

sales_order_invoice_register
sales_order_invoice_pay


texts: how to resize the modal popup image in magento 2

texts: I am trying to resize the image for my custom newsletter popup so that if user upload a bigger image from my custom system configuration it will not disturb the popup design.


texts: How to override arguments in layout file?

texts:
module-sales/view/frontend/layout/sales_order_view.xml

    <referenceContainer name="content">
        <block class="Magento\Sales\Block\Order\View" name="order.comments" template="Magento_Sales::order/order_comments.phtml" before="sales.order.info.links"/>
        <block class="Magento\Sales\Block\Order\View" name="sales.order.view" cacheable="false" after="sales.order.info.links">
            <block class="Magento\Sales\Block\Order\Items" name="order_items" template="Magento_Sales::order/items.phtml">
                <block class="Magento\Framework\View\Element\RendererList" name="sales.order.items.renderers" as="renderer.list"/>
                <block class="Magento\Theme\Block\Html\Pager" name="sales_order_item_pager"/>
                <block class="Magento\Sales\Block\Order\Totals" name="order_totals" template="Magento_Sales::order/totals.phtml">
                    <arguments>
                        <argument name="label_properties" xsi:type="string">colspan="4" class="mark"</argument>
                        <argument name="value_properties" xsi:type="string">class="amount"</argument>
                    </arguments>
                    <block class="Magento\Tax\Block\Sales\Order\Tax" name="tax" template="Magento_Tax::order/tax.phtml"/>
                </block>
            </block>
        </block>
        <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info" after="sales.order.view"/>
    </referenceContainer>

I want to change only colspan="4" to colspan="7"

       <argument name="label_properties" xsi:type="string">colspan="7" class="mark"</argument>

I tried,

app/code/Test/Module/view/frontend/layout/sales_order_view.xml

   <?xml version="1.0"?>
   <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <body>
    <referenceBlock name="order_totals">
        <arguments>
            <argument name="label_properties" xsi:type="string">colspan="7" class="mark"</argument>
        </arguments>
    </referenceBlock>
   </body>

Page is getting overrided but some phtml files are missing. It is not overrided in proper way.


texts: Magento 2 : Get value and name of cookie in phtml

texts:
I have a cookie like this:

How can i get value and name of this in phtml file?

Any help? Thank in advance.


texts: Can't see SKU as an option on shopping cart price rules

texts:
We're new to Magento community and I'm trying to set up a shopping cart price rule offer on a single product however I want to set it against a single SKU. When I click in the dropdown for conditions subselection, under Product attribute I only see categories and attribute set as options., This is where SKU sits as an option in Magento Go and I can't see any reason why it wouldn't on Community. Does anyone know? Is this an issue to take up with my web developer?
many thanks in advance
faye


texts: Use Categories Path for Product URLs NO not working for one store of multi-store setup

texts:
I have 2 stores on a my Magento setup ver. 1.7.0.2

http://www.gmesupply.com and http://www.colsafety.com

I am trying to use the option "Use Categories Path for Product URL" NO for both store but the rewrites are not being created correctly for one of the stores.

Colsafety.com creates rewrites for all of the product pages. Gmesupply.com only creates rewrites for URLs containing categories.

For example...
Colsafety rewrite:

67600-elkriver-peregrine-platinum-harness --> catalog/product/view/id/3718

Gmesupply rewrite:

safety-equipment/harnesses/elkriver-67600-peregrine-platinum-harness --> catalog/product/view/id/3718/category/12368

Both stores use the exact same product database so I'm not sure why it's working for one and not the other. I have made sure setting are correct under both store views. I have tried emptying the core_url_rewrite tables, reindexed, and cleared the cache.

Any ideas on why it isn't working on GME Supply?


texts: Magento 2 - editing module structure and functions

texts:
in Magento 1.x you could duplicate the extensions to app/design/frontend/themeName/default/template/or/layout and then modify it's layout or functionality via xml or phtml files.

How do we duplicate and edit certain modules now in M2? I have looked over the docs but couldn't find this info. For example i wish to edit phtml of module-catalog/view/frontend/templates/product/gallery.phtml correct way by having theme based module overwrite and now edit core modules within vendor/magento*/ folder.

Thanks for the help.


texts: Setting Magento 1.9.x Lock file storage DB or FILE

texts:
how can we change Magento 1 lock file storage from FILE to DB?
We see the setting global/index/lock/storage being checked for in Mage_Index_Model_Lock
And see it is used in method protected function _getLockStorage()
Question: do we set this in local.xml? and what are the accepted values?
(and while we are on the subject, as I understand DB locks are better than file locks?)
Appreciate your help
Thanks!


texts: What is the difference between eav/attribute and eav/entity_attribute?

texts:
Looking at eav_setup file and trying to understand the difference between the eav/attribute and eav/entity_attribute table.
If I have to guess,

eav/attribute is the entity that represents the concept of attribute
eav/entity_attribute is also an attribute which additionally carries the concept of

attribute (the actual attribute)
entity type that I can describe (entity_type_id)
attribute set that I belong  (attribute_set_id)
attribute group that I belong (attribute_group_id)

I'm not sure about the entity_type_id
When I create the attribute in Magento admin, I create the raw eav/attribute.
When I assign it to attribute set in the admin, I create the eav/entity_attribute. (but where does entity_type_id come from?)
Above statements are pure guesswork, please correct me if I'm wrong.


texts:
I am adding a menu item to Admin.

Could someone tell me why I get a 404?

app/etc/modules/Privacybuilder_Pbtab.xml

<config>
<modules>
    <Privacybuilder_Pbtab>
        <active>true</active>
        <codePool>local</codePool>
    </Privacybuilder_Pbtab>
</modules>
</config>

app/code/local/Privacybuilder/Pbtab/etc/config.xml

<config>
<modules>
 <Privacybuilder_Pbtab>
   <version>0.1.0</version>
 </Privacybuilder_Pbtab>
</modules>
<global>
    <models />
    <blocks />
    <resources />
    <extraconfig />
    <helpers>
      <pbtab>
  <class>Privacybuilder_Pbtab_Helper</class>
      </pbtab>
    </helpers>
</global>
<admin>
    <routers>
     <adminhtml>
            <args>
                <modules><pbtab>Privacybuilder_Pbtab</pbtab></modules>
    </args>
 </adminhtml>
    </routers>
</admin>
</config>

app/code/local/Privacybuilder/Pbtab/etc/adminhtml.xml

<config>
<menu>

<pbtab>
        <title>Privacy Builder</title>
        <sort_order>9999</sort_order>
        <action>adminhtml/pbtab</action>
 </pbtab>
</menu>
</config>

The new menu item links to

http://magento.local:8080/magento/index.php/admin/pbtab/index/key/2b00863c2b8246bc9d553c89ce39d523/

app/code/local/Privacybuilder/Pbtab/controllers/IndexController.php - OK

app/code/local/Privacybuilder/Pbtab/Helper/Data.php - OK

app/design/adminhtml/default/default/layout/privacybuilder.xml

<layout>
<adminhtml_pbtab_index>
 <reference name="content">
   <block type="adminhtml/template" name="pbadminform" template="privacybuilder/adminform.phtml"/>
 </reference>

app/design/adminhtml/default/default/template/adminform.phtml - OK

I believe that the controller is now loading correctly. The 404 is happening at some point after this.

Thanks

Robert


texts: Getting a copy of Magento 2 Commerce for development/testing

texts:
There are 3 versions of Magento 2

Magento 2 Open Source
Magento 2 Commerce
Magento 2 Commerce Cloud

Open Source is publically available and downloadable to everyone. Commerce Cloud is hosted on their servers with restricted access (via git and pipelines).

Magento 2 Commerce should, from my understanding, have the same code as Cloud but be hosted on your own server. This means once you have signed up to a Commerce subscription you will be given a copy of the code for development/customization/testing.

I want to know if it is possible to get a copy of Commerce code without having an active subscription. I have searched several places and the closest I can see on Magento site is this request a demo page https://magento.com/schedule-a-demo though it is unclear if this is a business demo or technical demo.

I was able to find a demo Magento 2 Commerce store that a module developer had made publically available for people to test both front end and admin. However, it did not have some features enabled that I was interested in (B2B/company accounts) and I could not see the code/files.

If it is possible to get a copy of this code can you then install it on a server (local or via a service such as AWS)? What are the licensing restrictions on what you can do on such a server?

I have searched for information on this online but I have yet to find a concrete answer if this is possible or not. Ideally, I would like an official Magento 2 source that this is possible/not possible or a recommendation on which track I need to go down to get this (Magento University, contact Magento via phone).


texts: Magento2 : Display Review Form any where in Product Detail Page

texts: How to display Review form in any where in product page using new .phtml file?


texts: How to add the fonts for email in magento 2?

texts:
When i am changing the fonts in Magento_Email/email/header.html
  template the fonts are not changing. If i import the url in email
  template also not changing the fonts.

  Kindly please provide a solution for that.


texts:
This is not something that happens instantaneously that I would be able to record and send in a video. What happens is that one day I will have a section organized and a few days later I’ll notice that a random product items has floated to the top of the category and mess up the organization that I set up for it.

Im using Magento 1 Enterprice Edition . Im not using third party extensions.

Does anybody knows for this issue ? If it`s related to any cache or configuration ?


texts: Extension supported on multiple versions

texts:
When creating an extension for commercial use it would be nice if it works on multiple Magento versions, maybe CE and EE also.
But sometimes this doesn't work as planned because the core changes from version to version.
My question is about, how should I handle the small core changes that affect my extension. I'm not talking about huge changes that require a re-factoring.
Here is an example to make it clearer.
Starting CE 1.8.1 (and EE 1.13.1) the method Varien_Io_File::write changed the way it works (the signature is the same) and the method filePutContent appeared that does something similar to what write used to do previously.
Right now I do something hacky and check the version of Magento in order to know what method to use to achieve the same result

/** @var Varien_Io_File $io */
if (version_compare(Mage::getVersion(), '1.8.1', '<')) {
    $io->write($destinationFile, $contents, 0777);
} else {
    $io->filePutContent($destinationFile, $contents);
}

Now, it I want this to work on EE also It gets even more ugly because 1.8.1 is specific to CE. So the code above becomes

/** @var Varien_Io_File $io */
if (version_compare(Mage::getVersion(), $this->getCurrentVersion(), '<')) {
    $io->write($destinationFile, $contents, 0777);
} else {
    $io->filePutContent($destinationFile, $contents);
}

where the method getCurrentVersion looks like this

public function getCurrentVersion()
{
    if (Mage::getEdition() == Mage::EDITION_ENTERPRISE) {
        return '1.13.1';
    }
    return '1.8.1';
}

The code above is a bit simplified (I use proper constants for versions in my real code)

But this works for CE 1.7 and above when the method Mage::getEdition() was introduced. If I want it to work on version prior to ce 1.7 it gets even crazier.

Now imagine this changes again in version CE 1.11 and EE 1.16. Chaos is bound to happen.

Is there a cleaner way of doing this without doing if or case statements?


texts: Can not Place Order, Is it Migrate JS Error at Magento 2.2.7 Error?

texts:
I have installed Magento ver. 2.2.7 for A MarketPlace Site also Purchased MarketPlace Extension and Installed it Successfully.

Before Order Place was working, But Now click on Order Place Button, The loader starts and Stops. No Order Being placed.

When i checked the console, I found :

jquery-migrate.js:41 JQMIGRATE: jQuery.browser is deprecated
migrateWarn @ jquery-migrate.js:41
get @ jquery-migrate.js:58
(anonymous) @ jquery.ba-hashchange.min.js:9
(anonymous) @ jquery.ba-hashchange.min.js:9
(anonymous) @ jquery.ba-hashchange.min.js:9
jquery-migrate.js:43 console.trace
migrateWarn @ jquery-migrate.js:43
get @ jquery-migrate.js:58
(anonymous) @ jquery.ba-hashchange.min.js:9
(anonymous) @ jquery.ba-hashchange.min.js:9
(anonymous) @ jquery.ba-hashchange.min.js:9

No Error is Showing, How can I Trace the error? Please Suggest.
Thanks in Advance.
What could be the probable errors & How can we solve this?


texts: How to display category name in product page?

texts:
I'm using Magento 2, I want to display the category name of the product on the product page.

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**
 * Product view template
 *
 * @var $block \Magento\Catalog\Block\Product\View
 */
?>
<?php
   $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
   $category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');//get current category
   //echo $category->getId();
   echo $category->getname();
?>
<?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?>
<?php $_product = $block->getProduct(); ?>

<?php echo $category->getId();?>

    <form action="<?php /* @escapeNotVerified */ echo $block->getSubmitUrl($_product) ?>" method="post"
          id="product_addtocart_form"<?php if ($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
        <input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $_product->getId() ?>" />
        <input type="hidden" name="selected_configurable_option" value="" />
        <input type="hidden" name="related_product" id="related-products-field" value="" />
        <?php echo $block->getBlockHtml('formkey')?>
        <?php echo $block->getChildHtml('form_top'); ?>
        <?php if (!$block->hasOptions()):?>
            <?php echo $block->getChildHtml('product_info_form_content'); ?>
        <?php else:?>
            <?php if ($_product->isSaleable() && $block->getOptionsContainer() == 'container1'):?>
                <?php echo $block->getChildChildHtml('options_container') ?>
            <?php endif;?>
        <?php endif; ?>

        <?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2'):?>
            <?php echo $block->getChildChildHtml('options_container') ?>
        <?php endif;?>
        <?php echo $block->getChildHtml('form_bottom'); ?>
    </form>


texts: Enabled profiler in admin and index.php but emtpy tables

texts:
I did enabled the profiler at System->Configuration->Developer->Debug->Profiler and I commented out the line Varien_Profiler::enable(); inside the index.php file.

But when I refresh the page, the table at the bottom is displayed empty.
How can I fix this?


texts: Magento custom admin module - use template instead of grid?

texts: I need to create a custom admin module and I want to use a template file instead of using a grid. Can someone give me an example of how I would do this. Not sure if it is possible to do this in the controller or if I still need a block and then reference the template there?


texts:
Can any one please share links for the

  study material for magento 2 certification exam (dump)

I know many questions related to this is asked before many times. But all those question are not satisfactory, and as we know day by day era is changing, with positive vibes, I want to know is something get update regarding magento2. Hope some body can help me for the same.

I HAVE REFERED THESE LINKS AS WELL

For Developer Certification: Fundamentals of Magento 2 Development

For Frontend Certification: Core Principles of Theming in Magento 2

except these if any information is updated regarding this. I am glad to thank for the participation of that guy who help me for the same.

Thank you.


texts: magento 2.1 how to switch to default design "luma" or "blank"?

texts:
I have installed custom theme in magento and need to check working of fuctionality inside clean magento.

But I couldn't find how to change design.

At the image attached you can see "Search Robots" configuration, but before there was themes switching.

Where did they gone? Or is that magento bug?


texts: SSMTP cannot send purchase confirmation email

texts:
I am using Magento 1.9.2.1 on my Ubuntu localhost. I installed ssmtp to send email. I tried subscribe letter on my website and receive confirmation email, so it worked.

However, when I checkout a product. It didn't send any email to customer's email address.

I opened var/log/mail.log. All subscription confirmation mails are here, but there isn't any checkout mail.

I guess the problem is between Magento and SSMTP..

Please help. I don't understand why...


texts: How to create wild card sub domain in Magento 1.9.x

texts:
I am coming with question of how to create a wildcard subdomain in Magento 1.9.x without using store view. I know creating more store view will cause the issues in price indexing, flat tables, etc.,

I have countless subdomains.

I tried:

Created the wild card setup in cpanel using A record. *.example.com  IN  A 127.0.0.1
then when calling sub1.example.com & sub2.example.com & sub3.example.com its pointed to example.com.
added needed stuff in .htaccess.

Problems am having:

when we load sub1.example.com all urls needs to http://sub1.example.com/... but currently loads http://example.com/... I know its from db, so how to rewrite getUrl() for this case.

So I need a suggestion for load sub domains same like a main website without creating multiple store views.

Note: I did lot of digging in google & SO & ME.

Please suggest the possible ways to solve.


texts: Filtering custom value from rendering column issue in Magento 1

texts:
I created my own collection with custom data. This is part from my grid class:

 my grid class extends Mage_Adminhtml_Block_Widget_Grid
 ...
 $this->setCollection($collection);
 array_walk($data['data'], function($order) use (&$collection) {
            $collection->addItem(new Varien_Object([
                'store_id' => $order['store_reference'],
                'shipping_date' => $order['shipping_date'],
                'order_reference' => $order['order_reference'],
                'customer_reference' => $order['customer_reference'],
                'updated_at' => $order['updated_at'],
                'shipping_fullname' => "{$order['shipping_firstname']} {$order['shipping_middlename']} {$order['shipping_lastname']}",
            ]));
        });
        $collection->setCurPage($page);
        $collection->setLastPageNumber($lastPage);
        $collection->setSize($lastPage * $limit);

        $this->setCollection($collection);
        return $this;

where $collection is an instance of class which extends Varien_Data_Collection. The content of that class is:

    protected $hardSetSize = 1;
    protected $setLastPageNumber = 1;
    /**
     * @param int $size
     */
    public function setSize(int $size)
    {
        $this->hardSetSize = $size;
    }
    /**
     * Retrieve collection all items count
     *
     * @return int
     */
    public function getSize()
    {
        return $this->hardSetSize;
    }

    public function setLastPageNumber(int $lastPage)
    {
        $this->setLastPageNumber = $lastPage;
    }

    public function getLastPageNumber()
    {
        return $this->setLastPageNumber;
    }

My grid is displayed, I got my custom data. But there is filtering problem.
I created my column like:

    $this->addColumn('store_id', [
        'header'    => Mage::helper('ffm_fulfillment')->__('Store'),
        'align'     => 'left',
        'index'     => 'store_id',
        'renderer'  => 'Mynamespace_Mymodule_Block_Adminhtml_Test_Grid_Renderer_Store',
        'filter_condition_callback' => [$this, '_storeFilter'],
    ]);

I got the render data, which are store ids from 1-20. I want to filter them. I created my _storeFilter function. What should I do next ? I put a message and the exit() in my function and on filtering I do not get my message.

protected function _storeFilter($collection, $column)
{
    $value = $column->getFilter()->getValue();
    echo 'Test'; exit();
}


texts: magento2 payment form after order complete

texts:
I have successfully created a module from

  http://devdocs.magento.com/guides/v2.1/payments-integrations/base-integration/integration-intro.html

It's working and shown in checkout page.

The question: How do I add a button called "Pay" after order is complete, which will contain a payment provider form or open a popup with new order data such as orderId and etc..?


texts: I want the average rating of a product in Magento 2. How can I get the average or aggregate rating of product ?


texts: SILK module generator add single table module

texts: I'm trying to figure out what the function of "Add Single Table Model" is in the SILK Magento Module Generator. I see it ads a table in admin, but is this table for anything specifically or can I display any data I want? Where is this data stored?


texts:
I faced a problem with the menu item "Web services". I tried to add a 3d party module, but I couldn't do that because in my admin menu System I couldn't find the "Web services" menu item.
I already check all models, controllers, and config XML files. All the same as in default Magento installation. I have not any modules that can impact on that menu. Also, SOAP installed and enabled.


texts: Magento 2 - Product is not showing in categories after upgrade Magento 2.2.6 to 2.3.3

texts:
I did update Magento version 2.2.6 to 2.3.3 after that product is not showing in categories, I can search product it's showing as well on homepage.

Can you please guide me on this issue?


texts:
I am willing to clarify my magento related doubts with some of magento experts.

Did magento use event driven architecture?
If magento use event driven architecture, Where did they use?
Give one example of event driven architecture in magento:


texts:
Controller file code below, data get print successfully but throw Exception #0 (Exception): Warning: Illegal offset type in isset or empty
    public function execute()
    {
        try {
            $data = $this->getRequest()->getPostValue();
            $id = $this->getRequest()->getParam('id');

                if ($data) {
                    if(!$this->customerSession->isLoggedIn()){
                        $websiteId  = $this->storeManager->getWebsite()->getWebsiteId();
                            $name = $data['customer_name'];
                            $email = $data['customer_email'];
                            $password = $data['password'];

                        //print_r ($name); die('');
                        //Here data get print

                            // $name = 'af';
                            // $email = 'abc@gmail.com';
                            // $password = '123123123';

                            //Using custom values it works fine

                            // Instantiate object
                            $customer = $this->customerFactory->create();
                            $customer->setWebsiteId($websiteId);

                            // Preparing data for new customer
                            $customer->setEmail("$email");
                            $customer->setFirstname("$name");
                            $customer->setLastname(" ");
                            $customer->setPassword("$password");

                            // Save data
                            $customer->save();
                            //$customer->sendNewAccountEmail();
                        }

                    $model = $this->investmentFactory->create();
                    $model->setData($data)->save();
                    $this->messageManager->addSuccessMessage(__("Data Saved Successfully."));
            }

        } catch (\Exception $e) {
            $this->messageManager->addErrorMessage($e, __("We can\'t submit your request, Please try again."));
        }


texts: Exclude particular  tag moving to bottom of the page- Magento 2.3

texts:
In my Magento site, we found there was configuration in admin.

Admin -> Store -> Configuration -> Advanced -> Developer (Enabled only on Developer mode).
JavaScript settings -> Move JS code to the bottom of the page

When this is YES, all the scripts tags on the site moves to the bottom of the page.

But I need to include a script which shouldn't move to the bottom.

Is there any way to achieve this?

Thanks in advance.


texts:
Magento doesn't update content on homepage (changed thorugh cms -> pages -> electronics-home). I can even disable the Electronics-home page and it doesn't change a thing.

Any ideas?


texts: Calling 'layered navigation' attributes into a static block

texts:
So to explain what i'm trying to do:

I want to take my filterable results such as brand or product type that you would find in the left navigation to a static block.

I'm no coder, but I figured I was in the right area using code like this inside a static block.

<reference name="content">
<block type="catalog/navigation" name="catalog.leftnav" template="..." />
</reference>

I'm convinced it doesn't need to be difficult, pulling attributes like that onto a static block but the more I look the more confused I get. What I'm effectively trying to do is just make customers more aware that they can narrow down their results.

This is the page in question, as you'll see i've added some basic images that link to filterable results but I'm considering using the brands or pet type in the static block just to make it a little easier for customers.

http://naturalpetsupply.co.uk/dogs-4/dogfood.html

Any help is appreciated.


texts: Enabling the "Check / Money Order" Payment option in Admin does not make it appear on the front-end

texts:
I selected Enabled YES on the "Check / Money Order" Payment option in SYSTEM - CONFIGURATION - SALES - PAYMENT METHODS but the option does NOT show up on the front end (only the other option which is Saved CC shows up)
It takes a long time to save after I make that change but eventually saves that choice (even when I go out and come back in - it shows ENABLED - YES). What do you think the problem might be?
I restarted the Apache Web Server AND SQL Server (MySQL), deleted ALL CACHE AND re-indexed but it did not seem to help.
There is currently no load on the server at all: Load Averages: 0.16 0.30 0.35
Recently - we had an episode with hosting - categories would not load properly on the back-end. They said this: It looks like mod_security is blocking this.
And then:

We have whitelisted mod security rules that were blocking your site.
(that fixed the problem with the categories not loading back then)

Do you think this is likely the problem now?
Magento version 1.9.1.0 with the following modifications:

free Access theme installed
(http://accessshopthemes.com/magento-themes/accessshop-lite/ )
calendar installed (BSS GROUP EXTENSION)
ASchroder.com SMTP Pro Email Extension


texts: Magento 2 load phtml file through Ajax in admin panel

texts:
I am trying to load phtml file though ajax in admin panel. Can one please suggest right way to approach that.

$resultPage = $this->resultPageFactory->create();
$block = $resultPage->getLayout()
                    ->createBlock('Magento\Test\Block\Adminhtml\Category')
                    ->setTemplate('Magento_Test::ajax.phtml');
$block->assign([
    'swatchid' => "Hello"
]);
if ($this->getRequest()->getQuery('isAjax')) {
    $this->getResponse()->setBody($block->toHtml());
}


texts: Payment method instructions not changing

texts:
I am using Magento 1.7. I am not the original developer of the website, that's why I don't know how everything was configured.

I want to change the instructions of the payment method bank transfer. I found that they are defined in Admin -> System -> Configuration -> Sales -> Payment methods -> Bank Transfer Payment -> Instructions. I also saw that the templated being used is banktransfer.phtml, under app/design/frontend/base/default/template/payment/info).

However, I changed the text in the Admin and I don't see any change in the frontend. I already cleared Magento's and browser's cache.

Any ideas on what I am missing or doing wrong? Thank you.

Edit After the discussion with @Sunil Patel, I couldn't manage to find what was happening. Instead, I commented the code responsible for printing the text, in banktransfer.phtml, and I included the following line, which finally worked fine:

        <?php echo $instructionsBankTransfer = Mage::getStoreConfig('payment/banktransfer/instructions'); ?>


texts: How can I capture emails without creating customer accounts?

texts:
A lot of the activity on our Magento store (eyewear) will involve active customer engagement (entering Rx info) and I believe users will be willing to enter their email, but they will bounce if requested to create password.

Is there a Magento best practice to capturing emails like this? I want the ability to follow up on their abandon cart (or abandon Rx) and provide discount, etc.


texts: Difference between StockStateInterface and StockRegistryInterface

texts:
I was using StockStateInterface to get stock qty, it was working fine in development and staging server but was not working in production server.

Then I used StockRegistryInterface to get the result and it worked on the production server.

Why it happened so?

I used this:

\Magento\CatalogInventory\Api\StockStateInterface $stockState,
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,


texts: Possible ways of installing Magento other than localhost server

texts: Currently I have tried Magento with XAMPP localhost. Eventually I'm experiencing a terrible slowness in loading up Magento. Hope anyone could help me out in finding a proper solution other than the localhost server.


texts:
In Magento2 the admin grids and forms are built as I can see with a mix of require js and knockout js. Now the forms and grids are built via the ui_component xml files as well but because a lot of the work is done, or at least appears to be done, via js standard debugging tools like xdebug will not work.

So my question is this. What is the best way to debug the Magento 2 admin grids and forms?


texts:
I have implemented 2 observers for checkout_cart_product_add_after, sales_order_place_after event. But these observers didn't catch events.

events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_place_after">
        <observer name="websoftpro_utm_after_checkout_event" instance="WebSoftPro\UTM\Observer\SalesOrderAfterPlaceObserver" />
    </event>
    <event name="checkout_cart_add_product_complete">
        <observer name="websoftpro_utm_after_add_to_cart_event" instance="WebSoftPro\UTM\Observer\CheckoutCartProductAddAfterObserver" />
    </event>
</config>

Observer file

namespace WebSoftPro\UTM\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class CheckoutCartProductAddAfterObserver implements ObserverInterface
{

    /**
     * @param Observer $observer
     * @return void
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $product = $observer->getEvent()->getProduct();
        $quoteItem =  $observer->getEvent()->getQuoteItem();
    }
}

I have used xdebug to debug. It went through this code:

$this->_eventManager->dispatch(
            'checkout_cart_product_add_after',
            ['quote_item' => $result, 'product' => $product]
        );

But it doesn't go to the Observer file.

What is the problem ?

Somebody, please help me out.
Please!


texts:
I need to set expire time of a custom gateway invoice to be the same as the Pending Payment Order Lifetime.
So that, how to get the "pending payment order lifetime" programmatically.
eg: i want to replace the $cofig->getPendingPaymentOrderLifetime(); with right code
$lifetime = $Conf->getPendingPaymentOrderLifetime();

$currentDate = new \DateTime('now');
$currentDate->modify("+$lifetime minutes");

$expiryDate = $currentDate->format('Y-m-d\TH:i:s');


texts: Ship to all countries selection not disabling to select specific countries in Shipping methods

texts:
Admin end shipping methods countries selection not disabling when I choose to allow all countries.

Please help me. Urgent task.


texts: Programmatically created product Urls are not generated for french storeview in Magento 2

texts:
I am trying to create a product programmatically in magento 2.1.3. I have 2 storeviews, be and fr. when I create product, product URLs(in URL rewrite) are only created for 'be' storeview, not created for 'fr' storeview. Can anyone Please help me to solve this issue??

This is my code

<?php

use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\Catalog\Model\Product\Type;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Catalog\Setup\CategorySetup;
use Magento\ConfigurableProduct\Helper\Product\Options\Factory;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\Eav\Api\Data\AttributeOptionInterface;
use Magento\Framework\App\Bootstrap;

include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);

$ob = $bootstrap->getObjectManager();

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

/** @var $installer CategorySetup */
$installer = $ob->create(CategorySetup::class);

/** @var ProductRepositoryInterface $productRepository */
$productRepository = $ob->create(ProductRepositoryInterface::class);

/** @var AttributeOptionInterface[] $options */
$attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default');

$p = $ob->get(\Magento\Catalog\Api\Data\ProductInterface::class);

$p->setSku('simple_sku');
$p->setName('simple_name');
$p->setPrice(100);
$p->setAttributeSetId($attributeSetId);
$p->setTypeId('simple');
$p->setVisibility(1);
$p->setWeight(1);
$p->setStoreIds(array(2,3)); // 2 and 3 are my store ids
$p->setCategoryIds(array(1,3,5));
$p->setStockData(array(
    'use_config_manage_stock' => 0,
    'manage_stock' => 1,
    'min_sale_qty' => 1,
    'max_sale_qty' => 2,
    'is_in_stock' => 1,
    'qty' => 5
    )
);
$p = $productRepository->save($p);


texts: Updating checkout validations without typing in the field

texts:
By default, the validations on checkout fields get updated on "keyup" of the field you're typing in.

Is there a way to update validations when clicking a button or by some other action, that is not- directly typing in the field?


texts: Select logic changed with latest versions - product resource collection

texts:
While performing an upgrade of a Magento 1 shop, noticed a change in core class Mage_Catalog_Model_Resource_Product_Collection, within method _initSelect

The change that has happened is, that condition :

->columns(array('status' => new Zend_Db_Expr(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)));

has been replaced with :

->where('e.status = ?', new Zend_Db_Expr(Mage_Catalog_Model_Product_Status::STATUS_ENABLED));

Does anyone knows the reasoning behind this change, and what could be the problems if I decide to revert to original version ? I'm asking this because, due to this change, some custom listing pages have started to throw following error now :

  Column not found: 1054 Unknown column 'e.status' in 'where clause'


texts: Magento 2: Changing default minimum length of customer password from admin not working. (Seems like a bug)

texts: I have changed the default minimum length of password from admin side but still I am unable to save customer from front end.The default length is being taken from some core constant apparently.


texts: How can i create admin grid using layout

texts:
I want to create admin grid in Magento 2. if you have any article or blog then please share
Thank you


texts: How to add validation in input type for only number and alphabet with one special character?

texts:
I have a filed and want to apply some validation that user want to add only number's and alphabet with one special character.
My input filed is
<input type="text" name="age"
   class="input-text"
   id="order-age"
   data-validate="{required:true}"
   data-bind="event: {change: saveAge}"
   placeholder="Age"
/>


texts:
I am running Magento 1.9.2.4 and it does not call some of the inbuilt static blocks.

For example the following static blocks will not display on my home page (main content area), product page (right column)

<!-- Upsell Items - Dynamic per slide -->

{{block type="ultimo/product_list_featured" template="catalog/product/list_featured_slider.phtml" category_id="" product_count="12" hide_button="1" block_name="You may also be interested in the following product(s)" breakpoints="[0, 2], [768, 3], [960, 4], [1280, 4]"  centered="1" is_random="1" timeout="6000" loop="1" move="4"}}

This has previously been working, but I can not understand why it has stopped working.

I have researched previous topics that suggest I check in system/permissions/blocks and there are two blocks listed as allowed:

1 core/template
 2 catalog/product_new

Can anyone advise how I might be able to resolve this?


texts: Magento 2: Move text "This is a required field" below swatch options

texts:
When a user don't select a size option and clicks the "Add to cart" button, the warning "This is a required field" appears under the button.

I'd like that warning appear just below the swatches, not below the "Add to cart" button.


texts: magento-coding-standard how to make magento 2 standard work?

texts:
i'am install this https://github.com/magento/magento-coding-standard, i installed it via composer and i see there is a package in vendor/magento/magento-coding-standard, and also i modified composer.json according to composer.json
"scripts": {
    "post-install-cmd": [
      "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"
    ],
    "post-update-cmd": [
      "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"
    ]
}

vendor/bin/phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend

Magento2 standard still not being added, anyone know how to get it works?


texts: Magento 2 Catalog Pricing Rules for Out of Stock Items

texts:
I am trying to set up pricing rule for out of stock items in Magento 2.3.5 but seems it doesn't work with out of stock items.
I have tried Available Qty = 0

and Quantity = Out of Stock

But it works when I use other attributes as conditions, for example, I have tried using particular SKU and it worked for an out of stock item.


texts: Adding condition to custom tab product detail page

texts:
I added custom tabs to product detail page. Below is my code:

<block type="catalog/product_view_description" name="product.new.tab" as="new.tab" template="catalog/product/view/mynewcustomtab.phtml">
    <action method="addToParentGroup"><group>detailed_info</group></action>
    <action method="setTitle" translate="value"><value>Stock Details</value></action>
</block>

I have added this code into catalog.xml

My problem is that

I want to add condition that it will show only if user type is wholeseller
I want to show if only for configurable products?


texts: Using the secret admin frontname in a new adminhtml router

texts:
I have a module that uses an abnormal naming convention.  Instead of NAMESPACE_MODULE it uses NAMESPACE_MODULE_SUBMODULE:

$ find app/code/community -type f
app/code/community/Acme/ModuleName/Bar/etc/config.xml
app/code/community/Acme/ModuleName/Bar/Model/Observer.php
app/code/community/Acme/ModuleName/Core/etc/config.xml
app/code/community/Acme/ModuleName/Core/Model/Observer.php
app/code/community/Acme/ModuleName/Foo/controllers/IndexController.php
app/code/community/Acme/ModuleName/Foo/etc/config.xml
app/code/community/Acme/ModuleName/Foo/Helper/Data.php
app/code/community/Acme/ModuleName/Foo/Model/Foo.php

This works fine for everything except controllers, since they don't use the autoloader.  Specifically this piece from core:

# File app/code/core/Mage/Core/Controller/Varien/Router/Standard.php

public function getControllerFileName($realModule, $controller)
{
    $parts = explode('_', $realModule);
    $realModule = implode('_', array_splice($parts, 0, 2));
    $file = Mage::getModuleDir('controllers', $realModule);
    if (count($parts)) {
        $file .= DS . implode(DS, $parts);
    }
    $file .= DS.uc_words($controller, DS).'Controller.php';
    return $file;
}

Because array_splice is only taking 2 parts it ends up looking for my controllers in Acme/ModuleName/controllers instead of Acme/ModuleName/Foo/controllers.  To work around this I am using my own router with a modified getControllerFileName() that can correctly load the controller file.

This works great in the frontend, where there is no issue with accessing the frontname directly (example.com/modulenamefoo).

However, now I need to create an adminhtml controller/router.  I've set things up the same:

<adminhtml>
    <routers>
        <acme_modulename_admin>
            <use>acme_modulename_admin</use>
            <args>
                <module>Acme_ModuleName_Core</module>
                <frontName>acme_modulename_admin</frontName>
            </args>
        </acme_modulename_admin>
    </routers>
</adminhtml>

And this too is working.  However, I've hardcoded the frontname which means anyone can access example.com/acme_modulename_admin and brute force my admin login.

Is it possible to use the same adminhtml frontname in a different router?

I've tried overriding collectRoutes() in my router so that it uses the configured secret admin frontname but it is not working.  Even throwing in a

$this->addModule(
    (string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME),
    array('Acme_ModuleName_Core'),
    'adminhtml'
);

doesn't work.

Even if I modify app/etc/local.xml and set the secret frontname for admin/routers/acme_modulename_admin/args/frontName, what's the magic that replaces adminhtml in things like the menu urls in adminhtml.xml or $this->getUrl('adminhtml/foo/*')?


texts: Magento 2.2.0 - Upgrade / Migrate from Magento 2.1.9

texts:
Followed the commands below to upgrade Magento 2.2.0, I am on 2.1.9

composer require magento/product-enterprise-edition 2.2.0 --no-update
composer update magento/product-enterprise-edition 2.2.0

I am getting the following error message.

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: magento/framework-foreign-key[100.2.0, 100.1.3].
    - Can only install one of: magento/framework-foreign-key[100.2.0, 100.1.3].
    - Can only install one of: magento/framework-foreign-key[100.1.3, 100.2.0].
    - magento/product-enterprise-edition 2.2.0 requires magento/framework-foreign-key 100.2.0 -> satisfiable by magento/framework-foreign-key[100.2.0].
    - Installation request for magento/product-enterprise-edition 2.2.0 -> satisfiable by magento/product-enterprise-edition[2.2.0].
    - Installation request for magento/framework-foreign-key (locked at 100.1.3) -> satisfiable by magento/framework-foreign-key[100.1.3].

Installation failed, reverting ./composer.json to its original content.

What is magento/framework-foreign-key? Is there anything that needs to be done prior to upgrade?


texts: What designates the default shipping on one-page checkout?

texts:
I am implementing my own custom shipping carrier that gives you five free options for shipping.  I need to be able to set the default selected shipping based on the order.

I found where in the one-page checkout the default shipping is being set:

<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>

$this->getAddressShippingMethod() is set to callcenter_ccshipping_firstclass - an awfully specific shipping method.  I discover that Mage_Checkout_Block_Onepage_Shipping_Method_Available::getAddressShippingMethod() is actually just using Mage_Sales_Model_Quote_Address::getShippingMethod() - a model method.

But here is where I get totally lost - I'm not exactly sure what is involved in setting the default shipping method, or why it selected callcenter_ccshipping_firstclass.  There are lots of promising leads, mentions of setShippingMethod() several places in the code, but I'm not sure which place is the correct place to look at, and there's just enough indirection going on to make things confusing.


texts: How to add a CMS block programmatically in Magento 2?

texts:
I need to add a CMS block via an install/upgrade script. I've already figured out how to add "normal" CMS pages as seen in the script below. But since I can't find any way to add CMS blocks in Magento 2's code, on Google or here, I'm quite jammed.

namespace [Vendor]\[Module]\Setup;

use Magento\Cms\Model\Page;
use Magento\Cms\Model\PageFactory;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;

class UpgradeData implements UpgradeDataInterface
{
    /**
     * Page factory.
     *
     * @var PageFactory
     */
    private $pageFactory;

    /**
     * Init.
     *
     * @param PageFactory $pageFactory
     */
    public function __construct(PageFactory $pageFactory)
    {
        $this->pageFactory = $pageFactory;
    }

    /**
     * Upgrade.
     *
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     */
    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        if (version_compare($context->getVersion(), '0.0.1') < 0) {
            $testPage = [
                'title' => 'Test page title',
                'identifier' => 'test-page',
                'stores' => [0],
                'is_active' => 1,
                'content_heading' => 'Test page heading',
                'content' => 'Test page content',
                'page_layout' => '1column'
            ];

            $this->pageFactory->create()->setData($testPage)->save();
        }

        $setup->endSetup();
    }
}

I understand I don't need all values defined in the $testPage array, so I stripped it down to the following:

$testPage = [
    'title' => 'Test block title',
    'identifier' => 'test-block',
    'stores' => [0],
    'is_active' => 1
    'content' => 'Test block content'
];

Does anyone know what I need to change to make this test page into a test block?

Note: I based my script on the install data script in the Magento 2 CMS module located in vendor/magento/module-cms/Setup/InstallData.php.


texts: How to hide shipping and billing address from checkout page as per quote value

texts:
As per my project requirement, I need to hide the address field for quote data.

when ($quote->getDeliveryMethod=='curbside') //custom data saving properly in quote table.

Anyone can help me.

Thanks in advance.


texts: Admin - Add Secret Key to URLs - Yes : Is this option necessary?

texts:
I found this 'yes' option is default when I install

Admin - Add Secret Key to URLs - Yes

whenever I use admin, the url seems so complicate due to this option.

e.g.) http://my-domain.com/index.php/mydomain_admin/system_config/edit/section/admin/key/d7b0ccc20349109f7d533de7bea8ff9b/

Using this option have some benefit?  is it effect some admin speed performance badly?

Do you recommend to set 'yes' to this option and can I know the reason?


texts:
I have made a theme, lets call it Mytheme/custom. I want to add a .phtml file to the sidebar. How do I do that?

I have already made this but it doesn't work:

Mytheme/custom/Magento_Catalog/layout/default.xml

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

        <referenceContainer name="sidebar.additional">
            <block class="Magento\Framework\View\Element\Template" name="seotext_sidebar"
                   template="Mytheme_Custom::product/sidebar/seotext.phtml">
            </block>
        </referenceContainer>

</page>

Mytheme/custom/Magento_Catalog/templates/product/sidebar/seotext.phtml

test

Also I want the current category information be available to seotext.phtml should I change Magento\Framework\View\Element\Template to something else?


texts: Paypal express really confusing for customers

texts:
Paypal express is really confusing how it works.

Most ecommerce sites you see. You click paypal express on basket, Fill out your username and password. Then get redirected to a Thank you for your order page with order number

However Magento seems to have this extra step to confirm details.
Has anyone any idea on how to skip this section completely?
Go straight from paypal to completing order?


texts:
I have been trying to create an Observer which automatically creates shipping whenever an invoice has been created by hooking into the:

sales_order_invoice_register_handler

Event, whenever I create an invoice my observer fires but I get a warning "Cannot create empty shipment"

I've checked the var/report and can see

Cannot send headers; headers already sent

I am not sure what is the cause of this but have spent hours trying to figure out the cause...

Here is my Observer.php code

<?php

class MyModule_SendShipment_Model_Observer
{

        public function salesOrderShipmentCreate($observer)
        {
//            echo("My Observer is Observing");
//            die();

            $itemsQty = array();
            $comment = null;
            $email = true;
            $includeComment = false;

            $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
            if ($order->canShip()){

                $itemsQty = array();
                foreach ($order->getAllItems() as $item) {
                    $itemsQty[$item->getId()] = $item->getQtyOrdered();
                }

                $shipment = $order->prepareShipment($itemsQty);

            }

            if ($order->canShip() && $shipment){
                $shipment->register();
                $shipment->addComment($comment, $email && $includeComment);
                if ($email) {
                    $shipment->setEmailSent(true);
                }
                $shipment->getOrder()->setIsInProcess(true);
                try {
                    $transactionSave = Mage::getModel('core/resource_transaction')
                        ->addObject($shipment)
                        ->addObject($shipment->getOrder())
                        ->save();
                    $shipment->sendEmail($email, ($includeComment ? $comment : ''));
                } catch (Mage_Core_Exception $e) {
                    Mage::logException($e);
                }
                echo $shipment->getIncrementId();
            }

        }

}

If anyone can help I'd be very grateful...


texts: I'm working on a module which needs to detect if there are multiple stores activated .Do someone have any function or know any function present in Magento that can help me?


texts: Magento 1.9 : Value not working on submit button in edit form?

texts:
I created an edit form of custom module, all other fields are working fine but submit button value is not working  my code of button is

Matrid_Feedmanager_Block_Adminhtml_Web_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
{
 protected function _prepareForm()
{
 $form = new Varien_Data_Form();

 $this->setForm($form);

$fieldset = $form->addFieldset('web_form', array('legend'=>Mage::helper('web')->__('Configuration')));

    $fieldset->addField('submit', 'submit', array(
              'label'     => Mage::helper('web')->__('Submit'),
              'required'  => true,
              'value'  => 'Submit',
              'after_element_html' => '<small>Comments</small>',
              'tabindex' => 1
            ));

it does not display the button .


texts: Attributes: Changing back-end variable type and front-end input type

texts:
I'm working on a product migration that involves about 200 attributes. I'm making most of these as a dropdown so that the clients can pick and choose which ones to utilize on the layered navigation (LN). They are not sure which attributes they would want exactly on the LN, so that's why I'm making them all as dropdown, instead of text field, to give them flexibility.

If I want to switch them as a text field without deleting and re-creating attributes, what do I need to do in the database? I've tested modifying values in eav_attribue's columns backend_type and frontend_input and that seems to do it without causing any problems. This is under the assumption that associated products will be removed and re-created, obviously, so that the respective attribute value are in the correct EAV tables.

Are those all I need to change in order to manually change a dropdown attribute to a text field attribute, or are there other tables involves that may potentially cause errors?


texts: How can I customize the filter of the product grid on the admin side in order to filter by RANGE

texts:
hope you are all good and in great shape.
TLDR: How can I filter my product grid on the admin side using a WEIGHT RANGE?
I am a newbie in Magento and I have been doing some progress over the last months on the basics of customizing Magento to our small company.
I had a request from the sales team which I am struggling to get to term. We sell a kind of product which has a different weight to every item and the final price of the product is calculated by multiplying a variable rate by the weight. It makes the weight a very important attribute in the system not only for the sales/logistics, but also for the client's decision making.
Therefore, I need to filter the product catalog grid on the admin side by weight, but not by a specific number, instead, I need a RANGE of weight. (From ...kg to ...kg)
I managed to create the field, but I am struggling on the part were the action happens. Please take a look on the screenshots below:

This is the structure of the module that I created:

And here is the code on the file AddWeightFieldToCollection.php which I am struggling with:
<?php

namespace Diamwill\WeightFilter\Ui\DataProvider\Product;

use Magento\Framework\Data\Collection;

use Magento\Ui\DataProvider\AddFieldToCollectionInterface;

class AddWeightFieldToCollection implements AddFieldToCollectionInterface

{

    public function addField(Collection $collection, $field, $alias = null)

    {

      $mg_eav_attribute = $collection->getResource()->getTable('mg_eav_attribute');
      $mg_catalog_product_entity_decimal = $collection->getResource()->getTable('mg_catalog_product_entity_decimal');
      $collection->getSelect()->joinLeft(
          ['soa' => $mg_eav_attribute],
          'soa.entity_type_id = 4 AND soa.attribute_code = \'weight\'',
          null
      );
      $collection->getSelect()->joinLeft(
          ['dcrt' => $mg_catalog_product_entity_decimal],
          'soa.attribute_id = dcrt.attribute_id',
          ['code']
      );

        $collection->joinField(

            'weight_range',

            'mg_catalog_product_entity',

            'value',

            'mg_catalog_product_entity.entity_id = soa.entity_id AND soa.store_id = 0',

            null,

            'left'

        );

    }

}

Basically, I know that I have to join the product tables to get weight, which in SQL terms would be something like this:
SELECT
    w1.value AS 'weight'
FROM
    mg_catalog_product_entity AS prod
        LEFT JOIN
            mg_catalog_product_entity_decimal w1 ON
                prod.entity_id = w1.entity_id
                AND w1.store_id = 0
                AND w1.attribute_id = (SELECT
                        attribute_id
                    FROM
                        mg_eav_attribute
                    WHERE
                        attribute_code = 'weight'
                            AND entity_type_id = (SELECT
                                entity_type_id
                            FROM
                                mg_eav_entity_type
                            WHERE
                                entity_type_code = 'catalog_product'));

Which I am not capable of linking with the Collection class and apply to the column, in order to filter.
Can someone help me with the code?
I am happy to read a tutorial to learn or to get a certain book/article with more information on the topic.
Please, I do not want to buy a plugin/module in order to do that. I would like to learn how to do it.
Thanks to anyone who can help me.
Have a great day!


texts:
So I have a product that comes in 5 different colors. So basically I make a Configurable Product, then under Associated Products I make the 5 Simple Products (for my colors).

So I have 6 records now (1 config, 5 simple)

Then I want to make a Bundled Product out of it. I entered that in and under Bundled Products, I use the 5 Simple Products plus another product that works with it and save all that.

Is this the correct way?


texts: attributes not hiding unavailable product options on product page

texts:
I switched from an old magento version ( 1.9.0.1) to the latest stable release (1.9.2.4) and suddenly discovered that the new version has a lot of issue with product attributes.
I've managed to solve the attribute ordering, but now seems that I have another strange behaviour .

If I have more than a single attribute used for a configurable product it doesn't work correctly It doesn't force the customer to select a choice in the first required option , and it doesn't exclude ( hide) products that don't have the corresponding attribute value .
 Ex : I have a configurable product (T-Shirt) with 2 attributes with dropdown menu.
1st is color
2nd is size.
Attributes are set correctly.
Both are requested to purchase the product
I have made an attribute set for this specific products.
Attribute order is set correctly on configurable product page
If I have in stock 3 "XL" in brown color and 1 "M" in green color ,Magento should display ONLY the "M" option for the "SIZE" if I choose the green color on the first dropdown option, and not all the option related to the other attribute .
Also, it should hide even the products that are out of stock....
It looks like if the standard Magento filtering process for attributes is not working anymore , and if I go on with the purchase I get a popup message stating "the quantity is not available".
I'm not much of an expert, so I don't know where to look to find where is the problem.
I've spent 2 days searching on the web , but nothing helped me.


texts: How does the Category Ids of a product are stored and retrieved?

texts:
I've been trying to understand, How Magento is managing the category_ids attribute for product in database and on code level? I noticed this attribute is handled in a different way to the other static backend_type  eav attributes.

If someone has already got chance to analyze it, his finding can save time for me. Thanks


texts: Remove shpping methods from checkout page and apply shipping methods programatically in magento 2?

texts:
We have scenario with GDex and Yamato shipping partner and our shipping cost will be changing at run-time so we don't want to allow to select shipping methods(HIDE) to customer but want to apply shipping method programmatically based on our condition.  This things, we need to implement in magento 2.
Thanks In advance


texts: Orders going to cancelled if payment not made

texts:
We have a web-store that was previously using sage-pay to handle customer transactions, however after multiple issues with the service we decided to another option for PayPal Pro that is built into magento.

PayPal is working fine, however, if user adds items to their cart and then goes to check out and clicks the "continue with PayPal" button and then closes the web page or goes back, the order is added to the system and has a status of cancelled. This never happened before on the previous payment system and we are not interested in orders that the user decided not to place in the end.

How do I make orders that did not actually go through not appear?


texts:
I have added in order count and last order date to the customer grid which is working fine, however it is not sortable or filterable in the grid.

I have done some searching but can't seem to find a solution that makes any sense, can someone explain how I can achieve this?

protected function _prepareCollection()
{
    $collection = Mage::getResourceModel('customer/customer_collection')
        ->addNameToSelect()
        ->addAttributeToSelect('email')
        ->addAttributeToSelect('created_at')
        ->addAttributeToSelect('group_id')
        ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
        ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
        ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
        ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
        ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left')
        ->joinAttribute('billing_company', 'customer_address/company', 'default_billing', null, 'left');

    $sql = 'SELECT COUNT(*) FROM sales_flat_order AS o WHERE o.customer_id=e.entity_id';

    $expr = new Zend_Db_Expr('(' . $sql . ')');

    $collection->getSelect()->from(null, array('orders_count'=>$expr));

    $sql ='SELECT MAX(o.created_at) FROM sales_flat_order AS o WHERE o.customer_id = e.entity_id ';
    $expr = new Zend_Db_Expr('(' . $sql . ')');

    $collection->getSelect()->from(null, array('last_order_date'=>$expr));

    $this->setCollection($collection);

    return parent::_prepareCollection();
}

//Rest of code omitted for brevity

protected function _prepareColumns()
{
     //code omitted for brevity
     $this->addColumn('orders_count', array(
          'header'    => Mage::helper('customer')->__('Total Orders'),
          'align'     => 'left',
          'width'     => '40px',
          'index'     => 'orders_count',
          'type'  => 'number',
     ));

     $this->addColumn('last_order_date', array(
          'header'    => Mage::helper('customer')->__('Last Order Date'),
          'type'      => 'datetime',
          'align'     => 'center',
          'index'     => 'last_order_date',
          'gmtoffset' => true,
     ));
    //additional code omitted
}


texts: How to get registered customer details in order success page(success.phtml) in M2.2?

texts:
I am using Magento 2.2. I want to display customer name, address line 1, adrdress line 2, city, phone, email in order success page.

This is my code in success.phtml:

    <?php /** @var $block \Magento\Checkout\Block\Onepage\Success */ ?>

    <?php if ($block->getOrderId()):?>
        <?php if ($block->getCanViewOrder()) :?>

<?= __('Your order number is: %1.', sprintf('%s', $block->escapeHtml($block->getViewOrderUrl()), $block->escapeHtml($block->getOrderId()))) ?>

        <?php  else :?>

<?= __('Your order # is: %1.', $block->escapeHtml($block->getOrderId())) ?>

        <?php endif;?>

<?= /* @escapeNotVerified */ __('We\'ll email you an order confirmation with details and tracking info.') ?>

    <?php endif;?>

    <?= $block->getAdditionalInfoHtml() ?>

            <a class="action primary continue" href="<?= /* @escapeNotVerified */ $block->getContinueUrl() ?>"><?= /* @escapeNotVerified */ __('Continue Shopping') ?>

<?php

$lid = $this->getOrderId();
echo  "Order ID:".$lid."
";

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->load($lid);

$totall = $order->getGrandTotal();
echo "Order Total:".$totall."
";

$shippingAddress = $order->getShippingAddress();

if ($shippingAddress)
{
    $telephone_tmp  = $shippingAddress->getTelephone();
    $customer_email = $shippingAddress->getEmail();
    $postal         = $shippingAddress->getPostcode();
    $city           = $shippingAddress->getCity();
    $address_tmp    = $shippingAddress->getData('street');
}

/* getting Guest Account Details */
if($order->getCustomerId() === NULL){
    $firstname      = $order->getBillingAddress()->getFirstname();
    $lastname       = $order->getBillingAddress()->getLastname();
    $customer_name  = $firstname.' '.$lastname;
    $telephone_tmp  = $order->getBillingAddress()->getTelephone();
    $customer_email = $order->getBillingAddress()->getEmail();
    $postal         = $order->getBillingAddress()->getPostcode();
    $city           = $order->getBillingAddress()->getCity();
    $address_tmp    = $order->getBillingAddress()->getData('street');
    echo $customer_name."<-------- new customer";
}
/* getting Register Account Details */
else {
    $customer  = $objectManager->create('Magento\Customer\Model\Customer')->load($order->getCustomerId());
    //else, they're a normal registered user.
    $firstname = $customer->getDefaultBillingAddress()->getFirstname();
    $lastname  = $customer->getDefaultBillingAddress()->getLastname();
    echo $customer_name = $firstname.' '.$lastname ."<--------   exist customer";

}
$telephone = substr($telephone_tmp, 0, 10);

$space_count = (int)substr_count($address_tmp," ");
if ($space_count > 2)
{
    $address_pieces = explode(' ', $address_tmp);
    $address1       = $address_pieces[0].' '.$address_pieces[1].' '.$address_pieces[2];
    $address2       = $address_pieces[3].' '.$address_pieces[4];
}
else
{
    $address1 = $address_tmp;
}

echo "Name:".$customer_name."
";

echo "Telephone No:".$telephone."
";

echo "Email:".$customer_email."
";

echo "postcode".$postal."
";

echo "city".$city."
";

echo "address1".$address1."
";

echo "address2".$address2."
";

Please help to do this.


texts: Can't Save Role Resource for Custom Module

texts:
I've created a custom module and my adminhtml.xml is as follows...

<config>
<menu>
    <web translate="title" module="adminhtml">
        <title>Custom</title>
        <sort_order>110</sort_order>
        <children>
            <web>
                <title>User Info</title>
                <action>web/adminhtml_web</action>
            </web>
        </children>
    </web>
</menu>
<acl>
    <resources>
        <admin>
            <children>
                <Company_Web>
                    <title>Custom</title>
                    <sort_order>60</sort_order>
                    <children>
                        <web>
                            <title>User Info</title>
                            <action>web/adminhtml_web</action>
                        </web>
                    </children>
               </Company_Web>
           </children>
       </admin>
   </resources>
</acl>

The module works as expected if an admin account is logged in. I can see the module in the admin panel and in the Role Resource Tab (System->Permissions->Roles), but when I tried to check the module and save the user role, it will say that it has been saved. But when I rechecked the user role, it is still unchecked.

And when I tried to log in using the account with the said user role, the custom module is hidden. What seems to be the problem?


texts: How to get checkout form data for logged in and guest customers in magento 2

texts:
I need to get checkout form data before placing order, but I am only getting  default shipping address below is the code snippet I tried:

  \Magento\Checkout\Model\Session

$customerId = $this->_customerSession->getCustomer()->getId();
$customerInfo = $this->customerFactory->create()->load($customerId);
$customerAddress = $customerInfo->getDefaultShippiingAddress();

getshipiingAddress() method returning null

I want to get form data for logged in and guest customer both.


texts: Magento 2 : How to delete the record in custom table?

texts:
How to delete the record from my custom table. without using object manager?

  Example : delete from customer_comments where comments_id=124


texts: i want to  create a new registration form for wholesaler  the form should be same as new customer registration form which is provided by magento.when i register wholesaler customer data should be save in same table as new customer registration data is stored the only difference is that groupid should be stored as "2" in table  below is the form image which is provided by magento i want same form for wholesaler.


texts:
In admin when i click on product edit get a error
[2021-04-06 13:14:56] main.INFO: Broken reference: the 'product.reviews' element cannot be added as child to 'product_tabs', because the latter doesn't exist [] []
Why this error is occured? Please help me


texts: Magento2: How to add an orange border on the search engine

texts:
I am trying to add orange border in search engine.

https://zabezcen.pl/

Here is style.css file for reference:

      .searchbox-header {
            .search-wrapper {

                .block-content {
                    position: relative;

                    .nested {
                        display: none;
                    }

                    .input-text {
                        height: 44px;
                        border: none;
                        padding-right: 40px;
                        color: #444;
                        font-size: 108.33%;
                        .border_radius(3px);
                    }

                    .btn-search-header {
                        position: absolute;
                        right: 0;
                        top: 0;
                        width: 34px;
                        height: 34px;
                        opacity: 1;
                        padding: 0 !important;
                        background: transparent;
                        text-align: center;

                        &:hover {
                            color: #444 !important;
                        }

                        &:before {
                            .font-awesome(f002, 14px);
                            line-height: 34px;
                        }

                        span {
                            display: none;
                        }
                    }
                }

            }
        }

        // SEARCH BOX PRO

        .sm-searchbox {
            .sm-searchbox-content {
                position: relative;

                .control {
                    .searchbox-cat {
                        position: absolute;
                        left: 0;
                        top: 0;
                        background-color: #fafafa;
                        border: none;
                        height: 44px;
                        width: 170px;
                        color: #444;
                        padding-left: 15px;
                        font-size: 108.33%;
                        border-right: 1px solid #e5e5e5;
                        .border_radius(3px 0 0 3px);

                        &:hover {
                            cursor: pointer;
                        }
                    }

                    #searchbox {
                        padding-left: 190px;
                        height: 44px;
                        border: none;
                        color: #444;
                        padding-right: 40px;
                        font-size: 108.33%;
                        .border_radius(3px);
                    }
                }

                .actions {
                    .btn-searchbox {
                        height: 40px;
                        opacity: 1;
                        padding: 0 !important;
                        position: absolute;
                        right: 2px;
                        text-align: center;
                        top: 2px;
                        width: 40px;
                        .border_radius(3px);

                        &:before {
                            .font-awesome(f002, 18px);
                            line-height: 40px;
                        }

                        span {
                            display: none;
                        }

                        &:hover {
                            color: #333 !important;
                        }
                    }
                }
            }

        }

        // END SEARCH BOX PRO

    }
}

photo:


texts: Customer Session is Empty In Custom Module

texts:
I have made a custom module which uses the customer session, but its strange, on live site its not returning customer data.

I have tried following methods:

$sessCustomer = Mage::getSingleton('customer/session', array('name' => 'frontend'));
echo '<pre>';print_r($sessCustomer->getCustomer()->getData()); echo '</pre>';exit;

It returns:

Array
(
    [website_id] => 1
)

If I print the customer session:

Mage::getSingleton('customer/session')->getData();

This returns:

array(
    [_session_validator_data] => Array
        (
            [remote_addr] => <MY IP>
            [http_via] =>
            [http_x_forwarded_for] => <MY IP>
            [http_user_agent] => Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0
        )

    [session_hosts] => Array
            (
                [bestevalue.info] => 1
            )
    [messages] => Mage_Core_Model_Message_Collection Object
            (
                [_messages:protected] => Array
                    (
                    )

                [_lastAddedMessage:protected] =>
            )
    [id] =>
)

I am logged in, can see the customer dashboard with customer info on it but not able to use that session in my custom module.

Please guide me how to fix this.

Update:

I have checked in /app/etc/local.xml that session type is file

<session_save><![CDATA[files]]></session_save>

So is there different method of extracting session info with PHP? What am I doing wrong?

Update 2:

i have used router as well to make pretty url

public function match(Zend_Controller_Request_Http $request)

on start of this action i placed

Mage::getSingleton('core/session', array('name' => 'frontend'));

but still not working with router without one it is working for example directly accessing the action :

site.com/module/controller/action

it works but not with router. any thoughts? thanks,


texts: Email Attachment is not work for magento 2.3.1

texts:
I have try to send email with PDF attachment but not work in magento 2.3.1.
I am looking for some reference link:

https://magento.stackexchange.com/questions/104044/magento-2-send-email-with-attachment

excellencemagentoblog

and git link for mageplaza/magento-2-email-attachments

Please help me, if you have faces above issue and find the right solution.