texts: Change the Position Of Layered Navigation

texts:
I have found lots of discussion regarding the title, but the position is not changing. I want to move layered navigation from left side to top of the category page. I have found the same question at this link Move layered navigation block between product list toolbar and product list,but that doesn't seem to be working.

catalog.xml:

<catalog_category_layered translate="label">
        <label>Catalog Category (Anchor)</label>

       <reference name="left_first">

            <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
                <block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
            </block>
        </reference>

        <reference name="content">
            <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <block type="core/text_list" name="product_list.name.after" as="name.after" />
                    <block type="core/text_list" name="product_list.after" as="after" />
                    <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
                    <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <block type="page/html_pager" name="product_list_toolbar_pager"/>

                    </block>
                    <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                    <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>

                    <action method="setColumnCount"><count>4</count></action>
                </block>
            </block>
        </reference>
    </catalog_category_layered>

local.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalog_category_layered>
        <reference name="left">
            <action method="unsetChild"><alias>catalog.leftnav</alias></action>
        </reference>
        <reference name="product_list">
            <action method="insert"><blockName>catalog.leftnav</blockName></action>
        </reference>
    </catalog_category_layered>
</layout>

I know the solution mentioned at the link is correct,.. any idea?

Thanks!.


texts: How to make cache for specific url by programmatically?

texts:
I need suggestion. I do not have an Idea to set cache for specific page url.
For example
I have an Url : http://127.0.0.1/magento234/women/tops-women/jackets-women.html
How can I set full page cache for above page programmtically ?
I do not have any idea how to do it and which observer which classes should be used for that ?
If someone post a code to set cache for specific url ,it would be great help.
Thank you


texts: Magento 2 error occurs when using  to override a model class

texts:
I'm trying to override a model class Customer.php, maybe I've configure it wrongly, this error occurs:

 a:4:{i:0;s:316:"Recoverable Error: Argument 21 passed to Magento\Customer\Model\AccountManagement::__construct() must be an instance of Magento\Customer\Model\Customer, instance of Vendor\ModuleName\Model\Customer given in C:\xampp2\htdocs\magento2ce\vendor\magento\module-customer\Model\AccountManagement.php on line 263";i:1;s:9721:"#0 C:\xampp2\htdocs\magento2ce\vendor\magento\module-customer\Model\AccountManagement.php(263): Magento\Framework\App\ErrorHandler->handler(4096, 'Argument 21 pas...', 'C:\\xampp2\\htdoc...', 263, Array)

Here is my di.xml:

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

<preference for="Magento\Customer\Model\Customer" type="Vendor\ModuleName\Model\Customer" />

</config>

I also tried using plugin, but failed too. when I use plugin, this error occurs:

Fatal error: Call to undefined method Magento\Customer\Model\ResourceModel\Customer::afterLoad() in C:\xampp2\htdocs\magento2ce\vendor\magento\framework\Model\AbstractModel.php on line 572

And my custom model class extended:

class Customer extends \Magento\Framework\Model\AbstractModel

Anyone can give me some ideas how to deal with it? Thanks


texts: Store Quantity of product in meters,cm in magento 2.1.12

texts: I want to make a website for custom shirt.I want to store quantity in meters,centimeters.It is possible in magento 2.1.12.


texts: Any action required? (Update PayPal Integration until 18. January 2017)

texts:
I received an e-mail (see below) to update the paypal integration. I am not able to find any information through google. Did anyone else receive this email?

When I had a call with the paypal, they could not answer me if I need to make any changes since we use the standard paypal payment method on Magento already.

I unfortunately donot know if I need to take any action personally or this change should have been already reflected through Magento? We are running on Version 1.9.0.1

Any tips are highly aqppreciated.

  Update your integration before 18 January 2017.
  Name Here, On 18 January 2017, we’ll be making some updates to make the checkout
  process on Website Payments Standard even better, which means your
  integration will be affected. We’ve noticed that your integration has
  been passing either invalid or incorrect data to PayPal from one or
  more of your payment buttons. To make sure your payments continue to
  be processed, you’ll need to update your integration as soon as
  possible. Here are some of the benefits you’ll receive with your
  updated integration: • PayPal One Touch™, our fastest, easiest
  checkout experience enabling your shoppers to check out at the click
  of a button • A mobile-optimised checkout experience, so buying is
  easy no matter how your customers shop • A new, simpler design that is
  consistent across both desktop and mobile What do you need to do?
  Please check out these FAQs for more information on common integration
  issues. Additional details can be found in our developer documentation
  here. When you’ve updated your integration, your customers will see
  the updated experience. As always, if you need help or have any
  questions, call us or visit our Help Centre.


texts: Using Magento as backend ONLY for website

texts:
I want to use my own frontend for my website, and only use Magento for the cart and backend. Most of the site is not a commerce site and I don't want Magento taking it all over. I've read about how to do this with Zen Cart, and I was wondering if it's feasible to do with Magento as I much prefer Magento's backend.

Basically I want to figure out how Magento adds items to the cart and use that code in a button on my website while using my own theme. Then I want to use the code that displays the cart and allows you to checkout in another page.

I'm not even sure this is allowed with Magento's licensing.


texts:
Is there a way in the admin panel to filter products by some weird attribute such as "tax class"?

The only way I found 'till now is:

select distinct value `product name`
from catalog_product_entity_varchar n
join catalog_product_index_price p on n.entity_id = p.entity_id
join eav_attribute a on a.attribute_id = n.attribute_id  and a.attribute_code = 'name'
join tax_class t on t.class_id = p.tax_class_id
where class_name = 'Integratori'

Obviously this filters only on the "tax class name" attribute and lacks of a "user friedly" interface.


texts: Catalog Advance Search in left sidebar 1.9

texts:
Added advance catalog search on left side bar in category page but breadcrumb not show correctly. So how to remove catalog advance search breadcrumb from category view page.
my code is as below

<catalog_category_layered>
    <reference name="left">
        <block type="catalogsearch/advanced_form" name="catalogsearch.leftnav" template="catalogsearch/advanced/left_form.phtml"/>
    </reference>
</catalog_category_layered>


texts: magento 2 disable shipping calculation on cart page

texts:
How can i disable shipping calculation on cart page.

Thanks.


texts: How to import products/categories in magento1.8.0.0 from oscommerce 2.3.2

texts:
I have Online Store setup in Oscommerce 2.3.2 with more than 15000 products, now i want to migrate my store from oscommerce to latest version of magento (i.e. magento 1.8.0.0).

Is there any way that i can achieve functionality like export products/categories from oscommerce and import products/categories in magento?


texts: How can I login my website with Google Account?

texts:
We have a Magento 2 website and want to implement the feature where the user can login using their Google Account as below if already they logged-in their Gmail/Google account on the system.

Can anyone please guide me here?


texts:
Hi I'm using very nice plugin 'login-as-customer' by magefan.
I'd like to override an execute method of login-as-customer.
this is first time to try overriding third pirty's controller so I stuck now.
I put files like this and expect to ignite Plugin/Login but does not.
how can i solve this?
MyModule
├── Plugin
│   └── Login.php
├── etc
│   ├── di.xml
│   └── module.xml
└── registration.php

di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
   <type name="Magefan\LoginAsCustomer\Controller\Login\Index">
        <plugin name="intercept_login" type="MyCompany\MyModule\Plugin\Login" sortOrder="1"/>
    </type>
</config>

namespace MyCompany\MyModule\Plugin;

class Login
{
    /**
     * Login as customer action
     *
     * @return \Magento\Framework\Controller\ResultInterface
     */

    public function aroundExecute()
    {
        echo "here";
        die;
    }
}

finary, i want to inject an admin info into customer session. after i could solve this problem, i gonna write script in the aroundExceute.


texts:
im working on Magento 1.9.3
i'm trying to override the admin grid of a custom module.
The original module strucutre is:

Miravist
- Helpdesk
-- Block
--- Adminhtml
---- Ticket
----- Grid.php

original module config.xml

<blocks>
  <helpdesk>
    <class>Mirasvit_Helpdesk_Block</class>
  </helpdesk>
</blocks>

my module config.xml is

...
    <global>
        <blocks>
            <helpdesk>
                <rewrite>
                    <adminhtml_ticket_grid>MyCompany_Helpdesk_Block_Adminhtml_Ticket_Grid</adminhtml_ticket_grid>
                </rewrite>
            </helpdesk>
        </blocks>
...

For what i've found around it should works but it does not.
Any help?

--EDIT--
what i'm trying to do is override protected function _prepareColumns() maybe is it the problem?


texts: Magento grid _addButton that filters collection from the controller. How?

texts:
we have a grid where we add a button. It triggers the shownewonlyAction in the controlller. But I have no idea how to set a filter (or even reset all filters) in the controller shownewonlyAction ().

question: How do I set a filter in the controller action? (something like state=processing) or preorder_status IS NULL

thx

    $this->_addButton('shownewonly', array(
        'label'   => Mage::helper('catalog')->__('Show new only'),
        'onclick' => "setLocation('{$this->getUrl('*/*/shownewonly')}')",
        'class'   => 'index'
    ));

this is what I have tried

    public function shownewonlyAction()
{;
    //$this->setDefaultFilter(array('preorder_status' => null));
    //$data = $this->prepareFilterString('pp.preorder_status IS NULL');
    //$this->_setFilterValues($data);
    //$filter = base64_encode('preorder_status=');
    //Mage::app()->getFrontController()->getRequest()->setParam('filter', $filter);
    $this->indexAction();
}


texts: SQL Profiler shows over 5000 Queries running on Magento 1.9

texts:
I am having a site on Magento 1.9.2 . Past few days i am seeing some issues on the backend. The First Byte of the Site takes too long. After hours of R&D I came to know that there are over 5000 queries running at one time.
The Website is hosted on AWS EC2(It was on t2.micro but while debugging we have increased it to c4.large) and We are using RDS for DB.
I have tried repairing the database with the Database Repair Tool
and it showed me some issues like missing Auto Increments from tables.

Error #1062: Duplicate entry '0' for key 'PRIMARY' on SQL: ALTER TABLE `eav_entity_attribute` ADD PRIMARY KEY (`entity_attribute_id`)
Error #1062: Duplicate entry '140' for key 'IDX_PERSISTENT_SESSION_CUSTOMER_ID' on SQL: ALTER TABLE `persistent_session` ADD UNIQUE `IDX_PERSISTENT_SESSION_CUSTOMER_ID` (`customer_id`)
Repair Log
Add missing index(es) "UNQ_INDEX_EVENT_TYPE_ENTITY_ENTITY_PK" to table "index_event"
Add missing index(es) "UNQ_REPORT_VIEWED_PRODUCT_INDEX_VISITOR_ID_PRODUCT_ID, UNQ_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID, IDX_REPORT_VIEWED_PRODUCT_INDEX_STORE_ID, IDX_REPORT_VIEWED_PRODUCT_INDEX_ADDED_AT, IDX_REPORT_VIEWED_PRODUCT_INDEX_PRODUCT_ID" to table "report_viewed_product_index"
Add missing index(es) "PRIMARY, IDX_REVIEW_ENTITY_ID, IDX_REVIEW_STATUS_ID, IDX_REVIEW_ENTITY_PK_VALUE" to table "review"
Add missing index(es) "IDX_REVIEW_DETAIL_REVIEW_ID, IDX_REVIEW_DETAIL_STORE_ID, IDX_REVIEW_DETAIL_CUSTOMER_ID" to table "review_detail"
Add missing foreign key(s) "FK_INDEX_PROCESS_EVENT_EVENT_ID_INDEX_EVENT_EVENT_ID, FK_INDEX_PROCESS_EVENT_PROCESS_ID_INDEX_PROCESS_PROCESS_ID" to table "index_process_event"
Add missing foreign key(s) "FK_RATING_OPTION_VOTE_REVIEW_ID_REVIEW_REVIEW_ID" to table "rating_option_vote"
Add missing foreign key(s) "FK_REVIEW_DETAIL_REVIEW_ID_REVIEW_REVIEW_ID, FK_REVIEW_DETAIL_STORE_ID_CORE_STORE_STORE_ID" to table "review_detail"
Add missing foreign key(s) "FK_REVIEW_STORE_REVIEW_ID_REVIEW_REVIEW_ID, FK_REVIEW_STORE_STORE_ID_CORE_STORE_STORE_ID" to table "review_store"

I used AOEScheduler to disable the cron for temporary basis. But it doesnt work
Can anyone suggest how do I go forward on this ? I don't have much traffic right now as the site is still in development.It is loading too slow.
While using Neor Sql Profiler I saw, There is a huge load on Mysql. I just dont know from where is this coming from ..
Thanks


texts: Issue with setting fields in payload for POST "/v1/invoices" api

texts:
I have a query regarding following Magento2 API

  POST "V1/invoices"

with payload

{
    "entity": {
        "base_discount_tax_compensation_amount": null,
        "base_shipping_discount_tax_compensation_amnt": null,
        "discount_tax_compensation_amount": null,
        "order_id": 58,
        "shipping_discount_tax_compensation_amount": 0,
        "total_qty": 2,
        "grand_total": 155,
        "subtotal": 150,
        "items": [
            {
                "base_discount_tax_compensation_amount": null,
                "discount_tax_compensation_amount": null,
                "order_item_id": 74,
                "sku": null,
                "qty": 56,
                "row_total": 150,
                "tax_amount": 152,
                "discount_amount": 23,
                "price": 154
            }
        ]
    }
}

Please clarify following points

Am I supposed to set fields grand_total, subtotal on body level?
Fields qty, row_total, tax_amount, discount_amount inside items array?

These fields are visible on invoice created on Magento2.
Attaching screenshot of created invoice below:

OR mentioning order_id and order_item_id should be enough??

OR there is some other way , Please do provide info.


texts: review form not showing - update: it was ebizmarts magemonkey!

texts:
This one is puzzling me - the review form is simply not showing on the review page

The reviews themselves are showing fine - but no form.

I have a theme set up but all the theme has is a local.xml, and that is not touching reviews at all - and neither is it changing or setting product.info.product_additional_data

From looking at things with my debug module, the block doesn't seem to be called at all

Things I have checked:

My theme does not change anything related to reviews, or even that "additional info" tab
I have no other theme installed
reviews are enabled
ratings are defined
guest can leave reviews


texts: Magento 2.3: InvalidAgumentException: Composer could not find the config file

texts:
I have a problem with Magento, I use X-debug for trying to debug Magento and I have the following Exception:

  Exception Has ocurred.   InvalidArgumentException: Composer could not find the config file:
  /var/www/site/magento/var/composer_home/composer.json   To initialize
  a project, please create a composer.json file as described in the
  https://getcomposer.org/ "Getting Started" section

So yeah it's right in magento/var there is no composer.json, BUT this is a Magento core folder and included in .gitignore given by Magento to one of this famous "don't touch" folder from Magento.

This exception is thrown by the function createComposer in vendor/composer/composer/src/Composer/Factory.php

Someone had similar error ? If yes how did you deal with it ?

PS: in case of minus please let me know why so then I can upgrade this post


texts: Magento 2: best practice to add/delete product Images programmatically?

texts:
I want to upload images to the existing products.
The images are in import_dir. And they need to be added to the product that already exists in the catalog.

I could find only 2 ways how to do it.
1. "Bad practice" way - using product model \Magento\Catalog\Model\Product::addImageToMediaGallery

1. Copy the images from `import_dir` to `pub/media/tmp`
2. Add the images to the product
3. Save product

Code

    /* copy files from import_dir to pub/media/tmp */

    /** @var \Magento\Catalog\Api\Data\ProductInterface $product */
    /* Init media gallery */
    $mediaGalleryEntries = $product->getMediaGalleryEntries();
    if (empty($mediaGalleryEntries) === true){
        $product->setMediaGalleryEntries([]);
    }

    /* Add an image to the product's gallery */
    $product->addImageToMediaGallery(
        $filePathFromTmpDir,
        [
          "image",
          "small_image",
          "thumbnail",
          "swatch_image"
        ],
        $moveImage,
        $disableImage
    );

    /* Save */
    $this->_productRepository->save($product);

2. "Good practice" way - using API \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::create

1. Create image content object via **\Magento\Framework\Api\Data\ImageContentInterfaceFactory**
2. Create image object via **\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory**
3. Create an image via API

Code

    $imageContent = $this->_imageContentInterfaceFactory->create()
        ->setBase64EncodedData(base64_encode(file_get_contents($filePathImportDir)))
        ->setType($this->_mime->getMimeType($filePathImportDir))
        ->setName($file_name);

    $newImage = $this->_productAttributeMediaGalleryEntryInterfaceFactory->create()
        ->setMediaType(\Magento\Catalog\Model\Product\Attribute\Backend\Media\ImageEntryConverter::MEDIA_TYPE_CODE)
        ->setFile($filePathImportDir)
        ->setDisabled($disableImage)
        ->setContent($imageContent)
        ->setLabel('label');

    $this->_productAttributeMediaGalleryManagement->create($product->getSku(), $newImage);

Concerns:

In 1 I'm getting an error, which is known issue

  Undefined index: media_type

In 2 is way too complicated and it should be the easier way

Questions:

Is there "best practice" way to manage(add, remove, replace) product's images?
Maybe there is a way with \Magento\CatalogImportExport\Model\Import\Product


texts: Magento 2 - Location of .phtml containing page header

texts:
I'm creating a custom template and am trying to figure out which .phtml needs to be extended so I can edit the page header. I would like to edit the links: Sign in or Create an Account.

Using the debug template path hints, I don't see a .phtml that encompasses the page header unlike subscribe.phtml for the footer/subscribe/newsletter and copyright.phtml for the copyright banner.

=======

EDIT: Used PhpStorm to recursively search the entire project for the text 'panel wrapper' and it was found in:

public_html/vendor/magento/theme-frontend-blank/Magento_Theme/layout

line 11 of default.xml

However, in my template's composer.json I have 'magento/theme-frontend-luma' in the require field.


texts: How to make drop-down or vertical list in CMS block?

texts:
In my multi-vendor setup I have created a static CMS block which is visible at the navigation menu. It shows the vendor_id and logo together.

I use the identifier pt_item_menu_list_vendors with the following code.

{{block type="vendors/list" name="vendors.list" vendor_ids="3,13"}}

This works but it doesn't get well organized as vendors are located horizontal next to each other. How to make a list or drop-down for my vendors so that you can see name and logo. Logo has to be resized till thumbnail.


texts: How to remove body class from specific page?

texts:
I'm using an extension that adds a class name vnecoms-cp to the body of adminhtml pages. This is then used to style the pages using css.

My problem is, this affects 1 specific page in a negative way. I would like a solution to remove the style from this specific page only. I believe the solution is to find a way to remove the vnecoms-cp class from the body tag of the page i want to remove the style from, so the style cannot be applied to that page at all.

here the code that is used to add the class to the body

<reference name="root">
        <action method="addBodyClass" ifconfig="vadmin/config/enabled"><className>vnecoms-cp</className></action>
    </reference>

as you can see it adds this to each pages body class.

i want to remove it from .../admin/inbox/index/...

Any help will be greatly appreciated!


texts: Magento PDF invoice - edit order and names of subtotal, tax and total field

texts:
I see that when I print my Magento PDF invoice for an order, I get wrong names and order at the bottom of the document for price of the product, product tax, delivery costs and total fields.

Is it possible to edit thoose fields from some phtml file, or all magento pdf invoices are edited through invoice and abstract.php files?

If second option is true, how to change names and order for pdf invoice items mentioned before ?

Thanks in advance


texts: What is the benefit of explicitly specify `short_cache_id` in Magento Block

texts:
I can see below code in the class Mage_Catalog_Block_Navigation atapp/code/core/Mage/Catalog/Block/Navigation.php

public function getCacheKeyInfo()
{
    $shortCacheId = array(
        'CATALOG_NAVIGATION',
        Mage::app()->getStore()->getId(),
        Mage::getDesign()->getPackageName(),
        Mage::getDesign()->getTheme('template'),
        Mage::getSingleton('customer/session')->getCustomerGroupId(),
        'template' => $this->getTemplate(),
        'name' => $this->getNameInLayout(),
        $this->getCurrenCategoryKey()
    );
    $cacheId = $shortCacheId;

    $shortCacheId = array_values($shortCacheId);
    $shortCacheId = implode('|', $shortCacheId);
    $shortCacheId = md5($shortCacheId);

    $cacheId['category_path'] = $this->getCurrenCategoryKey();
    $cacheId['short_cache_id'] = $shortCacheId;

    return $cacheId;
}

I know that getCacheKeyInfo() method will generate unique cache key for catalog navigation block. But my doubt is on following section

$cacheId['category_path'] = $this->getCurrenCategoryKey();
$cacheId['short_cache_id'] = $shortCacheId;

What is the benefit of setting category_path and short_cache_id in this particular method ?

Someone please enlighten me with this because it seems absurd to me.


texts: Loading Product collection based on custom attribute filter in magento 2.3.3

texts:
Please help me in achieving my below requirement.
I have one category called as Tires.
When user goes to that category page. It displayes 3 dropdown on the top of the product listing page https://prnt.sc/ujf14d
Based on the values selected in the dropdown. Product collection should be displayed when clicked on Find Tires button.
Can someone give me some idea on this?
Is there any free extension available?


texts: v1.9.2.4 order confirmation email resent multiple times after the shipping email is sent?

texts:
I am running v1.9.2.4.  I use AOE scheduler for my cron and SMTP pro by aschroder for my email.

When a customer places an order they get their order confirmation email.  Then when their order is shipped and the shipping email is sent the order confirmation email is often resent between 1 and 4 times.  This happens straight away after the shipping email is sent. Occasionally the shipping email is sent twice as well.  There does not appear to be any pattern to it and it is getting worse.  I did not notice it as it was only happening occasionally however looking at my email logs (from SMTP pro) it is getting worse and is now happening with every order.

This is not realted to the email problem with early 1.9 versions (New order email being sent twice) as the emails are going to the right customer and the core_email_queue and core_email_queue_recipients tables have no records in them.

I have also read that there are problems sending a copy of sales emails to a seperate address in v1.9 but i dont do this. I bcc them to my email address.

I have been hesitant to uninstall SMTP pro to see if that is the problem as my emails end up in spam without a smtp plugin (and i would rather my customers get multple emails than not at all) but I will try that now. I did send an email to the developer but have not heard back form him however it is a very popular plugin and if it were at fault I am sure that someone else would have encountered the problem

Anyone have any ideas as to what is causing this?


texts: Need validation with comma separated email address

texts:
i have used System > Configuration > email field

i need to comma-separated validation.

we can validate single email with the help of validate-email but i need to use in comma separated fields.

any solution for system configuration comma-separated email validation ?


texts: Products on multi-store Magento installation will display for one website but not the other

texts:
I have a Magento 1.9 store and we're trying to implement a multi store set up on it as we're in the UK and we want to cater for the US market too. I've installed the Mageworx Store & Currency Auto Switcher, and so far the extension works. If it detects a user from the USA, it switches the store to a different view.

But here lies the problem. If I'm viewing the site from the UK I have access to all the products like I should do. The site is the same as it was before we implemented the store auto switcher. Here's a screenshot of it in action.

However, when I switch to a US IP address, no products appear. Here's a screenshot to show what I mean:

Both screenshots are from the same product page.

I have reindexed the store multiple times, using the Admin panel and through the shell in the command line. I've cleared the cache in a similar fashion. All of the products are set to be visible on both sites too as well as the categories.

One interesting thing I have noted is that if I go to the product page directly when on the UK side I get the full product page (like normal), as seen here:

However, if I visit this product while using a US IP address (meaning the store should switch) I get the following screen:

So for whatever reason the moment products are viewed on the US side, the website does switch to the view/store it should switch to but the products aren't displayed.

It's an usual issue, and I can't seem to find any errors within the log files. I've re-indexed, cleared the cache, and made sure the categories and products are set to be enabled for both sites. I've even disabled and enabled products and categories and that hasn't made a difference.

Has anyone got any suggestions?

EDIT: From playing about, I've nailed the issue (I think) to the product image. I went in to the view file and started to tear out a lot of the code. When I removed this line of code, the products displayed:

<img id="product-collection-image-<?php echo $_product->getId(); ?>"
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_imgSize); ?>"
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

With further hacking away at the code, it's this line that seems to be causing all my problems:

src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_imgSize); ?>"

Once I remove that, the products display but without the image displayed, just the contents of the alt field.

EDIT 2:
This is the output of the error.log on the server:

[Tue Aug 15 07:31:06 2017] [error] [client 194.74.148.204] PHP Notice:  Use of undefined constant \xe2\x80\x99display_errors\xe2\x80\x99 - assumed '\xe2\x80\x99display_errors\xe2\x80\x99' in /var/www/website.com/public_html/index.php on line 44
[Tue Aug 15 07:31:16 2017] [error] [client 207.244.86.238] PHP Notice:  Use of undefined constant \xe2\x80\x99display_errors\xe2\x80\x99 - assumed '\xe2\x80\x99display_errors\xe2\x80\x99' in /var/www/website.com/public_html/index.php on line 44, referer: http://www.website.com
[Tue Aug 15 07:31:20 2017] [error] [client 207.244.86.238] PHP Notice:  Use of undefined constant \xe2\x80\x99display_errors\xe2\x80\x99 - assumed '\xe2\x80\x99display_errors\xe2\x80\x99' in /var/www/website.com/public_html/index.php on line 44, referer: http://www.website.com
[Tue Aug 15 07:31:48 2017] [error] [client 207.244.86.238] PHP Notice:  Use of undefined constant \xe2\x80\x99display_errors\xe2\x80\x99 - assumed '\xe2\x80\x99display_errors\xe2\x80\x99' in /var/www/website.com/public_html/index.php on line 44, referer: http://www.website.com
[Tue Aug 15 07:32:03 2017] [error] [client 207.244.86.238] PHP Notice:  Use of undefined constant \xe2\x80\x99display_errors\xe2\x80\x99 - assumed '\xe2\x80\x99display_errors\xe2\x80\x99' in /var/www/website.com/public_html/index.php on line 44, referer: http://www.website.com


texts: Magento 2 : How to access the registry in controller defined in template fiile

texts:
I have registered a variable in customer checkout view template link.phtml with code:

<?php
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$registry = $_objectManager->get('Magento\Framework\Registry');
$reg_val = $registry->register('user_not_logged', '1');
?>

Again I wanted to access that registry through customer overridden controller createPost.php

 1. Defined protected variable :
   protected $_coreRegistry;
 2. passed in constructor
  \Magento\Framework\Registry $coreRegistry;
 3. Accessed coreRegistry object using :
   $this->_coreRegistry = $coreRegistry;
 4. Inside execute() function
   $user_logged_registry = $this->_coreRegistry->registry('user_not_logged');
   var_dump($user_logged_registry);

This returns me NULL.

Can anybody explain me why I couldn't access the value of registered variable in controller.


texts: How to get product collection by "not find_in_set" for a custom attribute?

texts:
I'm trying to fetch a product collection by custom attribute:

hidden_countries

The products will be saved in the backend with this attribute, which is a multi-select field. So there will be comma separated values like AE,ES,DK.  The product will be hidden in these countries. If the user is browsing from any of these countries the product will not be displayed.

I have the current country code of user browsing from:

$current_country = 'AE';

While I'm trying to filter attribute, I cannot filter the product collection as per my requirement. I tried:

....
....
->addAttributeToFilter('hidden_countries', array('nin'=>array('finset'=>$current_country)));

Don't know how to check !finset.

Magento 1.9

EDIT

Example :
The database field(hidden_countries
) will hold the value as : 'AE,DK,US,ES' etc
Current country based on IP address : 'DK'

i don't want to select the row(s) that have DK in the field(hidden_countries)


texts:
I need to make discount oin several product wich skus contain "1513437" like
sku1 = 1513437_01
sku2 = 1513437_02
etc...
So i set a new rule setting condition as

  sku contains 1513437

but it doesn't work.

Can anyone help?

EDIT

Magento version 1.9.2.2

with flat mode off it works.

with flat mode on it does not work.

If I use "contain" condition those product are not affected.

If I use "does not contain" condition those product are affected.

If I use "contain" condition whit perfect match it works.

So I think the problem is that the sql query use LIKE instead %LIKE% when flat mode is on


texts: Magento 2.0.3 Upgrade fails - Conflicting component dependencies

texts:
I am trying to upgrade Magento 2.0.2 to 2.0.3

The readiness check fails as below:

Any Idea how to fix it? All crons have been set and permissions are also fine.


texts: How to set values of billing info and shipping info in custom email templates?

texts:
This is my email_template.html

{{trans "Billing Info"}}

{{var  formattedBillingAddress|raw}}

                     {{depend order.getIsNotVirtual()}}

{{trans "Shipping Info"}}

{{var formattedShippingAddress|raw}}

                    {{/depend}}

and in my observer

$templateVars = array(
            'store' => $this->storeManager->getStore(),
            'message'   => 'We processed your order ID We will contact you soon in mail for the acknowledgement if you not receive mail within 4 hours please get help from support@xxx.com',
            'order' => $order,
            'store'=> $store,
            'productName'=> $productName
       );

->setTemplateVars($templateVars)

My question is how can i set values of billing info, shipping info and payment method in this email template.


texts:
How can i use depends like in system.xml in my ui grid or edit form

lines from system.xml

<depends>
    <field id="section_id/group_id/field_id">1</field>
</depends>


texts: Magento :2.3 addAttachement() is not working

texts:
I got the below error while using addAttachement function in my cron file.

[2019-09-13 06:31:20] main.CRITICAL: Error when running a cron job {"exception":"[object] (RuntimeException(code: 0): Error when running a cron job at C:\
ew\\xampp\\htdocs\\Project\\vendor\\magento\\module-cron\\Observer\\ProcessCronQueueObserver.php:327, Error(code: 0): Call to undefined method Magento\\Framework\\Mail\\Template\\TransportBuilder\\Interceptor::addAttachment() at C:\
ew\\xampp\\htdocs\\Project\\app\\code\\KiwiCommerce\\AdminActivity\\Cron\\Test.php:62)"} []

I have shared my current code below please check and if possible to help me.

<?php
/**
 * KiwiCommerce
 *
 * Do not edit or add to this file if you wish to upgrade to newer versions in the future.
 * If you wish to customize this module for your needs.
 * Please contact us https://kiwicommerce.co.uk/contacts.
 *
 * @category   KiwiCommerce
 * @package    KiwiCommerce_AdminActivity
 * @copyright  Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/)
 * @license    https://kiwicommerce.co.uk/magento2-extension-license/
 */
namespace KiwiCommerce\AdminActivity\Cron;

use KiwiCommerce\AdminActivity\Mail\Template\TransportBuilder;
use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Exception\MailException;

/**
 * Class ClearLog
 * @package KiwiCommerce\AdminActivity\Cron
 */
class Test extends \Magento\Framework\App\Action\Action
{

    const TEST_TEMPLATE_IDENTIFIER = 'modulename_test_template';
    const TEST_FROM_EMAIL = 'general';
    const TEST_TO_EMAIL = 'akhil.mokariya@fghgh.com';
    const TEST_FILE_CONTENT = 'Test file content.';
    const TEST_FILE_NAME = 'test';
    const TEST_FILE_TYPE = 'txt';
    /**
     * @var \Magento\Framework\Mail\Template\TransportBuilder
     */
    protected $_transportBuilder;

    protected $state;

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
        State $state
    )
    {
        $this->_transportBuilder = $transportBuilder;
        $this->state = $state;
        parent::__construct($context);
    }

    public function execute()
    {
        try {
            // $this->state->setAreaCode(Area::AREA_FRONTEND);

            $this->_transportBuilder
                ->setTemplateIdentifier(self::TEST_TEMPLATE_IDENTIFIER)
                ->setTemplateOptions(['area' => Area::AREA_FRONTEND, 'store' => 1])
                ->setTemplateVars([])
                ->addAttachment(self::TEST_FILE_CONTENT, self::TEST_FILE_NAME, self::TEST_FILE_TYPE)
                ->setFrom(self::TEST_FROM_EMAIL)
                ->addTo(self::TEST_TO_EMAIL)
                ->getTransport()
                ->sendMessage();
            print_r(__('Everything is fine, email has been sent.'));
        } catch (MailException $me) {
            print_r(__('MailException: %1', $me->getMessage()));
        } catch (\Exception $e) {
            print_r(__('Exception: %1', $e->getMessage()));
        }
        return null;
    }
}


texts: Migration from Squarespace to Magento Addressing 301 Redirects on Mass

texts:
Long story short, we want to add only .html at the end of every category for the purpose of 301 redirects.

So an old category in Squarespace is like below:

www.domainname.com/categoryname

And in Magento2 we need it to be the below:

www.domainname.com/categoryname.html

Yes, I could add them in 1 by 1 through normal Magento 2 fashion. Looking for a concept to do on mass though? So essentially just adding .html to the end of the URL redirect for categories only. Thanks.


texts: Upgrade customer hash according M2 algorithm versions - What is happening here?

texts:
I got reference from data-migration-tool vendor/magento/data-migration-tool/src/Migration/Step/Customer/Helper.php for changing M1 password hash to M2 password hash. I applied the same logic in my controller for testing purpose.

Custom controller:

<?php

namespace Vendor\Helloworld\Controller\Index;

class Index extends \Magento\Framework\App\Action\Action
{

    protected $resultPageFactory;
    protected $_account;
        /**#@+
     * Exploded password hash keys
     */
    const PASSWORD_HASH = 0;
    const PASSWORD_SALT = 1;

    /**
     * Constructor
     *
     * @param \Magento\Framework\App\Action\Context  $context
     * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Customer\Model\AccountManagement $account

    ) {
        $this->resultPageFactory = $resultPageFactory;
        $this->_account=$account;
        parent::__construct($context);
    }

    /**
     * Execute view action
     *
     * @return \Magento\Framework\Controller\ResultInterface
     */
    public function execute()
    {
        //password hash from M1
        $recordAttributesData['password_hash']="b1999e4f386208d438134f3ad3d5ab21:MGPHnykFc2IJ9mxQ8tZ6vNwEghzXcezv";
        //print M2 password hash
        echo $this->upgradeCustomerHash($recordAttributesData);
    }

    /**
     * Upgrade customer hash according M2 algorithm versions
     *
     * @param array $recordAttributesData
     * @return array
     */
    private function upgradeCustomerHash($recordAttributesData)
    {
        if (isset($recordAttributesData['password_hash'])) {
            $hash = $this->explodePasswordHash($recordAttributesData['password_hash']);

            if (strlen($hash[self::PASSWORD_HASH]) == 32) {
                $recordAttributesData['password_hash'] = implode(
                    ':',
                    [$hash[self::PASSWORD_HASH], $hash[self::PASSWORD_SALT], '0']
                );
            } elseif (strlen($hash[self::PASSWORD_HASH]) == 64) {
                $recordAttributesData['password_hash'] = implode(
                    ':',
                    [$hash[self::PASSWORD_HASH], $hash[self::PASSWORD_SALT], '1']
                );
            }
        }

        return $recordAttributesData['password_hash'];
    }

    /**
     * @param string $passwordHash
     * @return array
     */
    private function explodePasswordHash($passwordHash)
    {
        $explodedPassword = explode(':', $passwordHash, 2);
        $explodedPassword[self::PASSWORD_SALT] = isset($explodedPassword[self::PASSWORD_SALT])
            ? $explodedPassword[self::PASSWORD_SALT]
            : ''
        ;
        return $explodedPassword;
    }
}

it print the password hash b1999e4f386208d438134f3ad3d5ab21:MGPHnykFc2IJ9mxQ8tZ6vNwEghzXcezv:0 after that I have updated the M2 Database, when I try to login, It allows. But after login it automatically update the password hash as 34bbb0468f2881c9f60964b66990bf26d9fb34d433b4df86bdb221148d775f5f:Oxrrm8cgdRf38fM5JzbPrI2E0VuFgZbp:1 in database, I have no issues in login, I'm curious to know what is happening here?

which code part is responsible for this?


texts:
We are using 1.9.3.1 with follwing fedex settings

Product Weight : 0.5 kg
Service type : International Priority
Shipping Origin : UAE
Shipping Destination : USA

Our Shipping Fedex account is opened in Dubai. So all the amount is calculated in AED.

The problem is system base currency is setup as EURO and according to current fedex behaviour shipping amount is calculated based on shipping account origin.

So we are getting response in AED which Magento assumes as base currency (EURO) which results wrong calculation.

One solution I got from other resources is to set the base currency of Magento to AED but its a Multistore Website with different currency setup and its live.

Is there any other solution for this or I have to override Fedex Modal and covert the base currency(EURO) to AED on request and AED to base currency(EURO) on response object.


texts: Magento 2: What are `resources.xml` Files Used For?

texts:
In Magento 2, one of the XML configuration files a module may have is resources.xml file.  For example, the sales module has one

#File: vendor/magento/module-sales/etc/resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/resources.xsd">
    <resource name="sales_setup" extends="core_setup" />
    <resource name="sales" extends="core" />
</config>

Does anyone know what these files are used for in Magento 2?  They appear to be the old Magento 1 top level <resources/> node.  However, since Magento no longer uses Setup Resource Model/Migrations (instead Magento 2 uses classes in Setup/InstallSchema.php, Setup/InstallData.php, Setup/UpgradeSchema.php, Setup/UpgradeData.php for install/migration-like scripts), its not 100% clear what the sales_setup resource is for.

For the non setup resource, is this just another way to add a database connection class with different credentials/connection string information? Or something else?


texts:
New Order mail is not working while other mails like forgotten password,register are working.But new order mail is not working.I had installed "new order Email" free magento extension.Still it is not working.Can anyone help me how to achieve this task?

http://www.magentocommerce.com/magento-connect/new-order-email.html


texts: Magento2 - update to custom status after shipment creation

texts:
I created an Observer that makes some execution based on the company needs using event sales_order_shipment_save_after. It does everything I need except changing the order status to a specific.

I both using Magento setState/setStatus and running an SQL update script directly, but none won´t make the change.

I looked for running a plugin instead of the observer but I could not find where should the plugin fit.

It´s important to let you know that the state is the same as the one set by shipment - complete. Only the status needs to be updated.

$orderState = Order::STATE_COMPLETE;
    $order2 = $objectManager->create('\Magento\Sales\Model\Order')->load($order_id);
    $order2->setState($orderState)->setStatus("entregue_transportadora");

    $order2->save();

Anyone can help me ?

Thanks !!


texts: Showing the 100 most recently added products

texts:
I want to add a page to my Magento site which displays the 100 most recently added products sorted by date added. I want this page to appear like a normal category page with pagination and layered navigation.

I was wondering if this is possible in Magento as I've read that layered navigation needs to work on one specific category, whereas I need it to work across multiple.

Ideally I would like a solution which adds layered navigation to any product collection as I would like to create a few different pages with different lists of products that will all need the layered navigation added.
Thanks


texts: What is the alternative for magento registry?

texts: Magento registry has been deprecated since Magento V2.3+, what is the new alternative for that?


texts:
New to magento.

Hi, So we are having a problem where some of the sales items are not showing their original pricing on the product page.

How other sale items look like: http://imgur.com/laXVS7H

How this item looks like: http://imgur.com/BC6GJq9

Any suggestions would be really helpful.


texts: Is it safe to empty downloader/pearlib/download?

texts:
Download directory under downloader/pearlib/is really heavy as I've never deleted.

I read on some page that you can empty the contents of this directory.

Is it safe? Or would it cause any problems?
Need when uninstalling extensions??


texts: Onepage checkout order successful page is blank no errors Magento 2.2.6

texts:
I have problem with one page checkout ordering page after placing an order and prossesing to checkout Success Page is blank...
I tryed to change magento mode from production to developer but then checkout page crashes ... also debugging have no errors logs too  i checked success.phtml from /vendor/magento/module-checkout/view/frontend/templates
here is code from 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') ?>

but all seems alright i realy dont know what to do ..


texts: Magento 2 get product id from admin product edit page

texts:
I am creating a custom grid on the product edit page, for the grid collection I need to filter based on the product id, for that I am trying to get the product id from the URL using below code

$this->getRequest()->getParam('id')

But the above code is always throwing empty result. Also, I tried to get the value from the registry using the below code

protected $_registry;
public function __construct(\Magento\Framework\Registry $registry) {
    $this->_registry = $registry;
}

public function getCurrentProduct() {
    $currentProduct = $this->_registry->registry('current_product');
    $currentProduct->getId();
}

But from the registry itself, I am unable to get the current product id.

I need the product id from URL or else from the registry, how to get that.
Thanks in advance for your support and idea

full code

namespace Namespace\Module\Ui\DataProvider\Product;
use Magento\Framework\App\RequestInterface;
use Magento\Ui\DataProvider\AbstractDataProvider;

class QuestionAnswerDataProvider extends AbstractDataProvider {

    protected $request;
    public function __construct(

        RequestInterface $request,

    ) {
        $this->request = $request;
    }

    public function getData() {
       echo $this->request->getParam('id',false);
    }
}


texts:
Item (Magento\Cms\Model\Page) with the same ID "566" already exists.

when i create cms page this error coming


texts: Where i can find the contents of this section getModulesByPosition('left') ?>

texts:
I am using a theme name venus and here i have to find the content of sidebar to set the order of my sidebar blocks I have tried by ordering them in catalog.xml but no luck.

<reference name="left">
        <block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml">
            <block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
        </block>
        <block type="ves_productcarousel2/list" after="catalog.leftnav" name="productcarousel2.list"/>
        <block type="catalog/product_compare_sidebar" before="tags_popular" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
</reference>

As i want to move Compare product and Best Sellers after the product filters in sidebar.

here is the code in my page template that showing it:

<aside class="col-lg-<?php echo $SPAN[0];?> col-md-<?php echo $SPAN[0];?> col-sm-12 col-xs-12">

<?php echo $helper->getModulesByPosition('left') ?>

Here is my site: https://www.profabrication.com/products/bends.html


texts: how to disable Input Radio button using css

texts:
I need to disable Input Radio button using css.
Don't want to use <input type="radio" disabled>


texts: magento 2: session length recommendation

texts:
I was asked today to increase the php session length to 86400 (24 hrs) for one of our magento 2 sites.  I am guessing this is to make guest's cart items be persistent for 1 day.  I am used to session length being ~20 minutes so I am unsure of the effects of such an increase.

Are there any security/performance drawbacks to this increase.  If so, are cookies a better alternative for persistence than increasing the php session length?


texts: Newletter missing from admin panel in magento 1.9

texts:
I have an interesting problem and I don't know where to find the issue. Newsletter tab from admin doesn't show, you can see the photos I attached to compare:

In this photo you can see how it should display the newsletter tab.

I've checked in the System->Configuration->Advanced and the module is enabled, so that's not the problem.

More than that I've inspected the element from my browser and I found the problem but I don't know how to resolve it. The code looks like this:

 Șabloane

 Coadă Newsletter

 Abonați

 Rapoarte Probleme Newsletter

Mailchimp

 Mailchimp Errors

So, the element exists but no text is completed between the  tags. If I completed manually will appear in the menu. I think the problem could be a conflict between modules. Can anyone help me with this problem. Thank you!


texts: Security patch 8788 not patched in magento 1.9.3.1

texts: I have recently installed 1.9.3.1 and when I run a MageReport scan, it states that the website is still at risk and vulnerable against the 8788 patch.


texts: In Magento 2.2 how to add sample customer attribute?

texts:
How can I add customer attribute in Magento 2.2?

Please help me in frontend and backend step wise step

if anybody have solution please share it


texts:
This is the sample search attributes parameter in url:

  zip_code=123456&tire_cities=1&tire_state=1

If any one of attributes matches then search result is displayed. If first attributes are correct and rest are false then also results displayed.

What I want is I need to display result if all attributes are true else no result shown be shown.

Thanks in Advanced.


texts: Magento2.4.2 own module class does not appear in generated (no error while setup:ci:compile)

texts:
sorry to bother but I'm really stuck with a strange problem. My goal is to have the invoice PDF changed but the class I've created to do this (which is currently a bunch of code from another guy) does not appear in the generated/code folder. When I try to "print" the invoice I'm receiving the "Class not found" exception but no exception during setup:di:compile. I already studied every thread concerning this task but couldn't solve my problem. I've tried various things like renaming the files, add leading backslashes, remove leading backslashes, fixed dir permissions, deleted everything manually but nothing worked. I've checked the config.php file and I could find the module itself. So what am I doing wrong. Many thanks in advance for any hint!
Here's my code which is currently placed in app/code:
schraubermarkt/module-sales/Model/Order/Pdf/CustomInvoice.php

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Schraubermarkt\Sales\Model\Order\Pdf;

use \Magento\Sales\Model\Order\Pdf\Invoice;

/**
 * Sales Order Invoice PDF model
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class CustomInvoice extends Invoice
{
       /**
     * Set font as regular
     *
     * @param \Zend_Pdf_Page $object
     * @param int $size
     * @return \Zend_Pdf_Resource_Font
     */
    protected function _setFontRegular($object, $size = 7)
    {
        $font = \Zend_Pdf_Font::fontWithPath(
            $this->_rootDirectory->getAbsolutePath('lib/internal/dejavu-sans/DejaVuSansCondensed.ttf')
        );
        $object->setFont($font, $size);
        return $font;
    }

    /**
     * Set font as bold
     *
     * @param \Zend_Pdf_Page $object
     * @param int $size
     * @return \Zend_Pdf_Resource_Font
     */
    protected function _setFontBold($object, $size = 7)
    {
        $font = \Zend_Pdf_Font::fontWithPath(
            $this->_rootDirectory->getAbsolutePath('lib/internal/dejavu-sans/DejaVuSansCondensed.ttf')
        );
        $object->setFont($font, $size);
        return $font;
    }

    /**
     * Set font as italic
     *
     * @param \Zend_Pdf_Page $object
     * @param int $size
     * @return \Zend_Pdf_Resource_Font
     */
    protected function _setFontItalic($object, $size = 7)
    {
        $font = \Zend_Pdf_Font::fontWithPath(
            $this->_rootDirectory->getAbsolutePath('lib/internal/dejavu-sans/DejaVuSansCondensed.ttf')
        );
        $object->setFont($font, $size);
        return $font;
    }
}

schraubermarkt/module-sales/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Sales\Model\Order\Pdf\Invoice" type="Schraubermarkt\Sales\Model\Order\Pdf\CustomInvoice" />
</config>

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

schraubermarkt/module-sales/registration.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Schraubermarkt_Sales', __DIR__);


texts: cant acess magento connect manager magento 1.9 ,

texts:
i tried to install fooman extension   ( disabled compilation mode etc)

now when i try to go to magento connect manager at my site
it shows error

update : cant access site   says  "There has been an error processing your request
Exception printing is disabled by default for security reasons"

tried solution given here but it didn't worked


texts: Magento 2 Data Migration - SQLSTATE[42S22]: Column not found

texts:
I am executing a Magento Migration using version 2.1.1 of the migration tool for M2 CE version 2.1.1. I'm migrating from 1.9.2.4 CE.

bin/magento migrate:settings -r vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.2.4/config.xml
Reset the current position of migration to start from the beginning

[2016-09-14 14:48:50][INFO][mode: settings][stage: integrity check][step: Settings Step]: started
100% [============================] Remaining Time: 1 sec
[2016-09-14 14:48:50][INFO][mode: settings][stage: integrity check][step: Stores Step]: started
100% [============================] Remaining Time: 1 sec
[2016-09-14 14:48:50][INFO][mode: settings][stage: data migration][step: Settings Step]: started
100% [============================] Remaining Time: 1 sec

  [PDOException]
  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'created_at' in 'field list'

I understand that some of the additional configuration files in the Migration tool will help me exclude unwanted data or map it differently, however, the exception isn't detailed enough to offer any insight into which table may be causing the error.


texts: Magento 2 : How to show ProductName and ProductPrice in custom email template?

texts:
This is my observer file from where I am passing values to email_template.html

 foreach($items as $item) {
        $productIds[]= $item->getProductId();
        $productName[]= $item->getSku();
        $productPrice[] = $item->getPrice();
  //      $productQuantity[]= $item->getQty();
    }

$transport = $this->_transportBuilder->setTemplateIdentifier('order_template')
            ->setTemplateOptions($templateOptions)
            ->setTemplateVars($templateVars)
            ->setFrom($from)
            ->addTo($to)
            ->getTransport();
        $transport->sendMessage();
        $this->inlineTranslation->resume();

How can I get the values of $productName and $productPrice in my email template.
I tried but not working

email_template.html

                        {{trans "Items"}}
                        {{trans "Qty"}}
                        {{trans "Sku"}}

                        {{var $productName.getSku()}}
                        {{var myvar8|raw}}
                        {{var $productPrice.getPrice()}}


texts: Magento 2.3 How to pass custom input field data to the sidebar Summary

texts:
I have created a custom input field attribute which will show up once a specific custom Shipping method is selected.
I have it working already. And now I want the data from the custom input field to be passed on the Summary Order in the sidebar together(below) with the selected custom Shipping Method.

I have a look into these Reference 1 and Reference but what I want is to pass the custom input field data just below the selected custom Shipping Method.

Note: Data of the custom input field has been saved to the database already.


texts: How can place the discount amount during order process programmatically?

texts:
For more details:-  I am facing the same issue as this given below link.
https://magento.stackexchange.com/questions/99767/creating-an-order-in-magento-with-fixed-discount-amount-via-models

My Magento version is 1.9.

Would you please help me for the same?

Thanks in advance!


texts: Magento 1.9: Get product id from wishlist remove item event

texts:
When I remove an item from wishlist, I need to get the product id of that item.
Anyone please help me on this.

See my code below:

config.xml

 <wishlist_item_save_after>
                <observers>
                    <data_wishlist_delete>
                        <class>data/observer</class>
                        <method>deleteFromWishlist</method>
                    </data_wishlist_delete>
                </observers>
 </wishlist_item_save_after>

Observer.php

public function deleteFromWishlist()
    {
        $item = Mage::app()->getRequest()->getParam('item');
        $action = Mage::app()->getRequest()->getActionName();

        if (($action == 'remove') && !empty($item)) {

            $resource = Mage::getSingleton('core/resource');
            $readConnection = $resource->getConnection('core_read');
            $query = 'SELECT product_id FROM wishlist_item WHERE wishlist_item_id = ' . $item . ' LIMIT 1';
            $id = $readConnection->fetchOne($query);
            echo 'Product Id: ' . $id . '<br/>';
        } else {
            return;
        }
    }

The product id is not getting here is because the record in the wishlist_item table is deleting when we remove an item from wishlist.


texts: Search Product Attribute for Product Year Range

texts:
I need to create a year range for my products. For example, 2006-2008. I know I can do this with product attributes.

The problem comes with search. Ideally, I would like to add this attribute to the quick search like so:

My question is should this be done with two fields (year_from, year_to text fields) or one (year dropdown)?

Two attributes would be easier to manage and display, but one attribute would be easier to search and likely work out of the box.

I would appreciate any guidance on how I can functionally achieve the search depicted above.


texts:
I want to call catalog_product_collection_load_after event in magento 2

How can i call that event in my custom module in magento 2?

EDIT

Filter is not working

events.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_product_collection_load_before">
    <observer name="product_filter" instance="Custom\Example\Observer\Productfilter" />
</event>

Productfilter.php

namespace Custom\Example\Observer;
use Magento\Framework\Event\ObserverInterface;
class Productfilter implements ObserverInterface
{

   public function execute(\Magento\Framework\Event\Observer $observer)
   {
       $observer = $observer->getEvent()->getCollection();
       $observer->addAttributeToFilter('name_day',array(
                            array('finset'=> array("Fri")),
                        ));
       return $this;
   }
}


texts: Magento 2 - All sales emails to same address (no emails to customer)?

texts:
When sending order confirmations, I wish to have them all go to a specified email address and disable them going to the customer.

Please note, this is for internal use, where everything is free and no legal requirements to offer invoices/etc.  I need to send data for the order and customer via this order email, formatted so that it can be captured by another system.

I found within Magento/vendor/magento/module-sales/Model/Order.php on line 2501:

/**
 * Returns customer_email
 *
 * @return string
 */
public function getCustomerEmail()
{
    return $this->getData(OrderInterface::CUSTOMER_EMAIL);
}

and then again on line 4045:

/**
 * {@inheritdoc}
 */
public function setCustomerEmail($customerEmail)
{
    return $this->setData(OrderInterface::CUSTOMER_EMAIL, $customerEmail);
}

Editing this works, in that I can redirect all emails to a static address (example@domain.com) but it also replaces the customer's email as it appears in the order to the same address (example@domain.com).  I still need to have the CUSTOMER_EMAIL value = the customer's email as I need to send that within the email as part of the email body.

Which is the right file to edit where the sending of the email is executed so I can change the address there?

Thank you very much in advance!


texts:
I have the following in my robots.txt for months now:

  Disallow: /catalogsearch/
  Disallow: /catalogsearch/*
  Disallow: /webshop/catalogsearch/*
  Disallow: /webshop/catalogsearch/

My webshop url is like www.webshopdomain.com/webshop

The problem is:
Google still shows and crawling all search results (39.000 ..)

What am I doing wrong?


texts:
How to install the most recent security path?

Is there any particular way to do it?

Getting a lot of errors: "Skipping patch ...... 1 out of 1 ignored ..."

Is it because is already patched or ...?

My Magento version is 1.9.2.3.

checking file
app/design/adminhtml/default/default/template/customer/tab/view.phtml
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
checking file app/design/adminhtml/default/default/template/login.phtml
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
checking file
app/design/adminhtml/default/default/template/notification/toolbar.phtml
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
checking

... just a part of it.

Problem already solved.
Don't need to comment anymore ;)


texts: Magento custom cache issue on product view page

texts:
We added the custom cache for product view page.

We rewrite the view.php file and write below code :

<?php
/**
 * Rewriting Product View block
 */
class XXX_YYY_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
{

    protected function _construct()
    {
        $this->addData(array(
         //'cache_key'   =>
            //'cache_lifetime'  =>
            'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG . "_" . $this->getProduct()->getId()),
        ));
    }

    public function getCacheKey()
    {
        if (!$this->hasData('cache_key')) {
         //$cacheKey = LAYOUTNAME_STORE+ID_PRODUCT+ID
         $cacheKey = $this->getNameInLayout().'_STORE'.Mage::app()->getStore()->getId().'_PRODUCT'.$this->getProduct()->getId();
         //.'_'.Mage::getDesign()->getPackageName().'_'.Mage::getDesign()->getTheme('template'). //_PACKAGE_THEME ?
         $this->setCacheKey($cacheKey);
        }
        return $this->getData('cache_key');
    }

    public function getCacheLifetime()
    {   //to prevent sub-blocks caching
       if($this->getNameInLayout()!='product.info') return null;
       //return false; //false creates default lifetime (7200)
       return 9999999999;
    }

}
?>

After the rewrite code added the add to cart functionality and global messages not working in product view page.

Help to fix this issue.

Thanks


texts: The catalog price rules cause error when re-indexing in Magento 2

texts:
When I created a Catalog Price Rule in the admin and click Save, I got the error below but it's still saved. Then I tried to re-index via SSH and got the same error message.

Fatal error: Uncaught TypeError: Argument 1 passed to
Magento\CatalogRule\Model\Rule\Condition\ConditionsToSearchCriteriaMapper::reverseSqlOperatorInFilter()
must be an instance of Magento\Framework\Api\Filter, instance of
Magento\Framework\Api\CombinedFilterGroup given, called in
/vendor/magento/module-catalog-rule/Model/Rule/Condition/ConditionsToSearchCriteriaMapper.php
on line 114 and defined in
/vendor/magento/module-catalog-rule/Model/Rule/Condition/ConditionsToSearchCriteriaMapper.php:193

Has anyone encountered this issue before? Thank you so much for any solutions.


texts: Magento 2, Google Tag Manager script in header creates display issue in cart page in IE browser

texts:
Throughout debugging I realized Google Tag Manager script in header leads to displaying extra text ---------Tracking code: Standard (Asynchronous) "Add To Car"------- in cart page as follow:

Any clue how to remove this?


texts: Magento 2 How to show static block based on current category id

texts:
Anyone can help me to show show static block based on current category id

In this following file

Magento_Swatches/templates/product/view/renderer.phtml

I tried this code to get current id

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');//get current category
echo $category->getId();
echo $category->getName();

Its returns with this error Fatal error: Uncaught Error: Call to a member function getId()

Magento 2.1.6


texts: How to Insert record in database-table through custom module in magento2

texts:
I have create a custom module and database-table using following this steps and i understand the table displaying in customer_side.
Now I Need to Know the Insert operation in customer_side please give me any example or link for insertion process custom module in magento2.


texts:
Can anyone please help me to upgrade magento2 .  I am trying to update it using CLI, I got some error while update. It's not getting updated using web setup wizard also.

user@user MINGW64 /e/htdocs/mage2
$ composer require magento/product-community-edition 2.1.7 --no-update
./composer.json has been updated

user@user MINGW64 MINGW64 /e/htdocs/mage2
$ composer update
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
    - The requested package magento/product-community-edition 2.1.7 exists as magento/product-community-edition[2.1.0] but these are rejected by your constraint.


texts: Magento Marketplace extension Installation & Varnish Test failed composer memory limit error

texts:
I am trying to upload one module in Magento Marketplace but in technical review the Installation & Varnish Test is failed
http://prntscr.com/mr5lt5

when I view the report then I see below error.
http://prntscr.com/mr5mgg

Environment: PHP 5.6.37 Magento 2.1 CE

composer require insider/module-integration:1.0.0 2>&1

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals

proc_open(): fork failed - Cannot allocate memory
The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
Unzip with unzip command failed, falling back to ZipArchive class

The following exception is caused by a lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

PHP Warning:  proc_open(): fork failed - Cannot allocate memory in phar:///usr/bin/composer/vendor/symfony/console/Application.php on line 959

Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/bin/composer/vendor/symfony/console/Application.php on line 959

[ErrorException]
proc_open(): fork failed - Cannot allocate memory

How can I solve this error ?


texts: Applying shopping cart price rules to one brand

texts:
We have over multiple brands on our site. I want to create a rule “30% off when you spend over $100 on that brand”

Problem is if you have another brand in the cart that takes you over the $100 threshold then the discount is still being applied.

Is this possible? I feel like I’ve tried every combo.

It’s worth noting the products in the brand I want to discount are between $40-$80 so customers will need at least 2 of them in the cart. But I want people to still be able to buy other brands in the same transaction if they want.

Thanks


texts: update attribute showing black page magento2

texts:
Steps to reproduce:

Go to catalog->product.
Select 2 or more products.
Click Action and select update attributes.


texts: Magento order showing "Suspected Fraud" status for paypal payment

texts:
I have added paypal standard payment option in my magento store. In my magento store base currency is INR. But order status showing "Suspected Fraud" after successfully payment transaction.

How to resolve it?


texts: Very slow URL rewrite reindex on specific products

texts:
I have latest magento 1.9 shop with 2000 configurable products and each product have approximately 30 associated products (apparel store with sizes and colors as configurable options). Total 60.000 products. I have two store views. My VPS server has 4 cores, 2GB ram, PHP 7 and Percona 5.6 MySQL server optimized with mysqltuner.

If I truncate core_url_rewrite table, URL reindex is finished in few minutes. But if URL Rewrite reindex is started again, without truncate, it can take up to few hours or it does not finish at all due to PHP fatal error, memory exhausted (1GM of ram in limit for php).

A strange thing is, that I see a mysql process doing this:

SELECT MAX(CAST(SUBSTRING(`request_path`, 24, LENGTH(`request_path`) - 23 - 5) AS SIGNED)) FROM `core_url_rewrite` WHERE (store_id = '1') AND (request_path LIKE 'james-amp-nicholson-jn-%.html') AND (request_path REGEXP '^james\\-amp\\-nicholson\\-jn\\-[0-9]*\\.html$')

almost all the time of url reindex process. The mysql transaction is filling very slowly and I assume that this is taking a lot of ram. I have around 20.000 (1000 configurable products with 20 associated products) products named like this: James & Nicholson | JN XYZ

Any suggestions on speeding or solving this problem?


texts: How to convert Delivery Day to Delivery Date?

texts:
We can set Deliver Day such as Delivery: 2 to 4 Days through creating attribute.

But I want to show the DATE instead of DAYS.

Example: Delivery: Between 18 March & 20 March (if today is 16 March)

Click here to Check the live Example


texts:
I'm getting this error on a Magento EE products listing page, Magento stops rendering HTML.

<img src=" <-- FROM THIS POINT MAGENTO STOPS RENDERING HMTL

It seems that Magento goes on a Fatal Error when it try to render Product Image Url.

By Excluding Writing Permission errors i've modified every file permission to 777 (i'm in Dev Env !! )

 chmod -R [doocument_root] 777

Nothing change , so i think that this is not a permission error.

Where can i fing additional information about this error ?

SOLVED

It was a GD Librar issue. It wasn't installed on my server.


texts:
I installed theme "A" in magento 1.9.3 it looked good but the image size and grid layout was not good or even. I then installed theme "B" that had a good image size and grid layout but the rest wasn't good.

I switched back to theme "A" and the image size and grid layout was now good.

Are there specific files I can copy from theme B into the folders for theme A to enforce the good grid layout and image size?

I have noticed that installing specific extensions that I require causes the layout to return to the default theme "A" problems. I expect that if the theme "B" files were placed locally in the theme "A"'s directory structure the good parts of theme "A" and theme "B" would be retained.  The particular issues are category grid layout and detail page image size.


texts:
I am trying to extend the core block here.

This is my block :

<?php

/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Vendor\Review\Block\Product;

/**
 * Product Review Tab
 *
 * @author     Custom Team
 */
class ListView extends \Magento\Review\Block\Product\View\ListView {

    /**
     *
     * @var \Vendor\Review\Model\LikedislikeFactory
     */
    protected $likedislikeFactory;

    /**
     * @param \Vendor\Review\Model\LikedislikeFactory $likedislikeFactory
     * @param array $data
     */
    public function __construct(
    \Vendor\Review\Model\LikedislikeFactory $likedislikeFactory
    ) {
        $this->likedislikeFactory = $likedislikeFactory;
    }

    public function getReviewLikesData($id = '') {
        if (!empty($id)) {
            $countDisLike = $this->likedislikeFactory->create()->getCollection();
            $countDisLike->addFieldToFilter('review_id', $id);
            $countDisLike->addFieldToFilter('like_status', 1);
            if (count($countDisLike) > 0) {
                return count($countDisLike);
            }
        }
        return 0;
    }

    public function getReviewDisLikesData($id = '') {
        if (!empty($id)) {

            $countDisLike = $this->likedislikeFactory->create()->getCollection();
            $countDisLike->addFieldToFilter('review_id', $id);
            $countDisLike->addFieldToFilter('like_status', 0);

            if (count($countDisLike) > 0) {
                return count($countDisLike);
            }
        }
        return 0;
    }

}

The problem is that I have to inject all the dependencies used in parent class.

If I am extending some class, I should have all its dependencies and I should be able to add other dependencies in my block. What if core magento changes its dependencies in future, in that case my module will stop working due to mismatch of dependencies.

Let me know the possible solution or an alternative way to achieve this.

Thanks and apology for using the dependencies word frequently !


texts: Magento2 2.0.7 enterprise - Menu Override is just showing a blank page after adding a simple override

texts:
I'm just doing a simple override to modify the structure of the menu. But weird thing is after creating the module and just extending the topMenu. It just gives a blank page.

Here is my current code :

Registration.php :

<?php \Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_SPMenu',
    __DIR__
    );

di.xml

<preference for="Magento\Theme\Block\Html\Topmenu" type="Vendor\SPMenu\Block\Html\SPMenu" />

module.xml

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

SPMenu/Block/Html

<?php
/*** Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace SPCommerce\SPMenu\Block\Html;
class SPMenu extends \Magento\Theme\Block\Html\Topmenu {

{
}

I just find it weird for such a simple task to have such an issue.

Hope somebody can help me :)


texts: how to use highcharts.js in magento frontend?

texts:
I have followed require js config to include highchats.js in the cms page

app/design/frontend/Namesapce/Theme/Magento_Theme/requirejs-config.js
Code

var config = {
    paths: {
            'owl':'Magento_Theme/js/owl.carousel.min',
            'highchart':'Magento_Theme/js/highcharts'

    },
    shim: {
        'owl': {
            'deps': ['jquery']
        },
        'highchart': {
            'deps': ['jquery']
        }
    }
};

Highchart function is called in .phtml file

app/design/frontend/Namesapce/Theme/Magento_Theme/templates/highchart.phtml

And Script

require([
        "jquery",
        "highchart"
    ], function ($) {
        $(document).ready(function($){
        $(".learn-btn").click(function(){

            $(function(){
                $('#container').highcharts(
                {chart:{type:'bar'},colors:['#de0202','#ffa903','#19d800'],title:{text:'Results'},xAxis:{categories:['50% Probability','20% Probability','5% Probability','1% Probability']},yAxis:{min:0,title:{text:'Maximum Number of Weeks to Resolve'}},legend:{reversed:true},plotOptions:{series:{stacking:'normal'}},credits:{enabled:false},series:[{name:'Weeks in  May End',data:[c50F,c80F,c95F,c99F]},{name:'Weeks Your ',data:[Weeks,Weeks,Weeks,Weeks]},{name:'Weeks ',data:[age,age,age,age]}]}
                );
            });

          });
        });
    });

Even tried this

require([
        "jquery",
        "highchart"
    ], function ($,highchart) {
        $(document).ready(function($){
        $(".learn-btn").click(function(){

            var myChart = highchart.chart('container', {
           {
            chart:{type:'bar'},
            colors:['#de0202','#ffa903','#19d800'],
            title:{text:'Results'},
            xAxis:{categories:['50% Probability','20% Probability','5% Probability','1% Probability']},
            yAxis:{min:0,title:{text:'Maximum Number of Weeks to Resolve'}},
            legend:{reversed:true},
            plotOptions:{series:{stacking:'normal'}},
            credits:{enabled:false},
            series:[{name:'Weeks',
                data:[c50F,c80F,c95F,c99F]},
                {name:'Weeks',
                data:[Weeks,Weeks,Weeks,Weeks]},
                {name:'Weeks ',data:[age,age,age,age]}
            ]}

        });

          });
        });
    });

Still getting this error TypeError: highcharts is undefined  and TypeError: highchart is undefined for the 2nd way


texts: Magento 2: How to display top rated products?

texts: Is there a build-in feature in Magento 2 by which top rated products can be shown? If not, then how can i display it in left side of category page. Any type of sample code would be helpful for me :)


texts:
I get the following error:
"exception 'exception' with message 'this letter cannot be sent.' magento" , in magento php.
below is the code i have used.

Observer.php

<?php
class Metro_Purchaseorder_Model_Observer extends Mage_Core_Model_Abstract
{
    public function shipmentEmail($observer)
                {
                    $event = $observer->getEvent();
                    if(!$order = $event->getOrder())
                    {
                                    $order_Id = Mage::getSingleton('checkout/type_onepage')->getCheckout()
                      ->getLastOrderId();
                                    $order = Mage::getModel('sales/order')->load($order_Id);
                                    $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
                    }
                    $payment = $order->getPayment()->getMethod();
                    $storeId = $order->getStoreId();
                    $emailTemplate  = Mage::getModel('core/email_template')->loadDefault('custom_email_po_template');
                    $emailTemplateVariables = array();
                    $emailTemplateVariables['myvar1'] = 'Branko';
                    $emailTemplateVariables['myvar2'] = 'Ajzele';
                    $emailTemplateVariables['myvar3'] = 'ActiveCodeline';
                    $emailTemplateVariables['storeid'] = $storeId;
                    $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
                    /*  $emailTemplate->setSenderName('MetroCC');
                    $emailTemplate->setSenderEmail('info@metrocc.com');
                    $emailTemplate->setTemplateSubject($this->__('PO Test mail'));  */
                    //send mail
                    $emailTemplate->send('sachin301190@gmail.com', 'sachin', $emailTemplateVariables);
                    return true;
                }
}

in Config.xml

------------------------------
<?xml version="1.0"?>
<config>
   <modules>
        <Metro_Purchaseorder>
            <version>0.1.0</version>
        </Metro_Purchaseorder>
    </modules>
          <frontend>
            <events>
                <checkout_onepage_controller_success_action>
                    <observers>
                        <purchaseorder_observer>
                            <type>singleton</type>
                            <class>Metro_Purchaseorder_Model_Observer</class>
                            <method>shipmentEmail</method>
                        </purchaseorder_observer>
                    </observers>
                </checkout_onepage_controller_success_action>
            </events>
            </frontend>
                <global>
                  <template>
                        <email>
                                <purchaseorder_custom_email1 translate="label" module="purchaseorder">
                                        <label>Purchaseorder module</label>
                                        <file>sales/purchaseorder_custom_email1.html</file>
                                        <type>html</type>
                                </purchaseorder_custom_email1>
                        </email>
                        </template>
                  </global>
</config>

Please help me in correcting the above error for sending custom email template


texts: Magento 2 Constructor returns Fatal error: Uncaught TypeError. How to resolve?

texts:
<?php

namespace Module\Name\Controller\Index;

class Myclass extends \Magento\Framework\App\Action\Action
{

protected $formKey;
protected $cart;
protected $product;

public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Data\Form\FormKey $formKey,
\Magento\Checkout\Model\Cart $cart,
\Magento\Catalog\Model\Product $product,
array $data = []) {
    $this->formKey = $formKey;
    $this->cart = $cart;
    $this->product = $product;
    parent::__construct($context);
}

public function execute()
 {
  $productId =481;
  $params = array(
                'form_key' => $this->formKey->getFormKey(),
                'product' => $productId, //product Id
                'qty'   =>1 //quantity of product
            );
    //Load the product based on productID
    $_product = $this->product->load($productId);
    $this->cart->addProduct($_product, $params);
    $this->cart->save();
 }

}


texts:
I want to add extra fields for customer (not on registration) where there should around 20 fields. We can do this easily in magento 1 but i didn't see any thing same in M2.

looking for guidance and if this can be achieved from admin that would be great.


texts: Magento 2 rest api: Ignore out of stock products in get products search criteria

texts:
I am using the following api call to get products.

{{base_url}}/rest/V1/products?searchCriteria[filter_groups][0][filters][0][condition_type]=like&searchCriteria[filter_groups][0][filters][0][field]=description&searchCriteria[filter_groups][0][filters][0][value]=%t shirt%&searchCriteria[filter_groups][1][filters][0][field]=type_id&searchCriteria[filter_groups][1][filters][0][value]=configurable

The above call will list all configurable products with a word tshirt in its description field. And all are working fine.

The issue is it also lists the products which are in out of stock. (All the configurable variant of the product is in out of stock).

Is there any way to filter out the outofstock products? How can I specify thant in search criteria?


texts: How to change anchor links to checkbox in list page?

texts:
In default Layered navigation Magento uses anchor links to filter products.
I want to add checkbox instead.
The code of filter.phtml is this:

<?php foreach ($this->getItems() as $_item): ?>

        <?php if ($_item->getCount() > 0): ?>
            <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
                <?php echo $_item->getLabel() ?>
                <?php if ($this->shouldDisplayProductCount()): ?>
                (<?php echo $_item->getCount() ?>)
                <?php endif; ?>

        <?php else: ?>

                <?php echo $_item->getLabel(); ?>
                <?php if ($this->shouldDisplayProductCount()): ?>
                    (<?php echo $_item->getCount() ?>)
                <?php endif; ?>

        <?php endif; ?>

<?php endforeach ?>

Please help.


texts: Multiple Domains, multiple Store Views, redirect and cookies problem

texts:
I have a  website with 2 store views and different domains assigned to them through System > Web > Unsecure/Secure > Base URL (default one with en code at http://tea-and-coffee.tk/ and additional with ru code at http://teaandcoffeeuk.tk/).

I can switch between them with default language switcher in header and everything works fine except one thing. When I go to incognito mode in my browser and open any page at ru store view like http://teaandcoffeeuk.tk/tea.html, it always redirects me to an index page of default store - http://tea-and-coffee.tk/.

After I manually switch to ru store view through language switcher, links start working fine, so my guess is that different stores require some cookies set in my browser. Can anybody help me?


texts: checkout error Undefined class constant 'CHECK_USE_FOR_COUNTRY'

texts:
I am having a rather serious problem with my magento installation.

when trying to put through a  test order i note that suddenly my checkout is no longer working
 i get the error

  Fatal error: Undefined class constant 'CHECK_USE_FOR_COUNTRY' in
  /public_html/includes/src/Mage_Payment_Block_Form_Container.php on
  line 65

I have not actually done any changes to that file.

can anyone help


texts: Without using a SQL query, how can I set the category position of a product?

texts:
I am creating products in code and adding them to categories. I want to be able to set a position too.

I am familiar with the catalog_category_product table but I see no obvious means of updating a product to have a given position value when using Magento methods (direct SQL seems easy in comparison).

I am creating a product at a time, sometimes I might want to post to more than one category


texts: How to get product's frontend url from backend?

texts:
I am developing a extension of Magento 2. I need to get a product's frontend url from backend. I have tried to use:

//$storeManager->->setCurrentStore(2);
$url = $product->setStoreId(2)->getProductUrl();
$url = $product->setStoreId(2)->getUrlInStore();

but the $url always return a backend url, like http://<domain>/admin/catalog/product..... they may work in Magento 1.x but not for 2.x. Is there any way to get frontend url?


texts: Which extension would you recommend for my Multivendor solution?

texts:
I want to setup my site to act as a multivendor/multi warehouse ecommerce site.

In my business model, I don't have stock but the stock is owned by the local shops and distributors. The process flow should work as follows:

Customer orders product A which is owned by vendor 10. Payment is done via a credit card but before payment is taken product has to be verified if it is in stock. An email with the order should be automatically send as soon when the order was made.
In other words each product should be assigned to a vendor or warehouse and mailing address.
On confirmation of the order in stock, (how can this be manage?) the payment can be processed.Now invoice can be send to customer and Vendor 10 which should also be attached to the shipped product A.
At the same time the shipping company should receive the order for them to collect at Vendor 10.
The same process should be followed when product B is owned by Vendor 13 for example. It might be possible to do this with a multi warehouse setup?

Is there someone here who has experience with a similar setup and is there a low cost solution to get this in a nice way done?


texts: Magento: Show Top Level Products on Homepage without Hovering

texts:
I'm looking to have our top nav on the homepage already "flown-out" or expanded. And, when the customer navigates to any other pages it would be collapsed or hidden, and would only show when hovered overed. I'm looking to achieve an effect similar to Amazon Supply:

Homepage: http://www.amazonsupply.com/

When Navigated: http://www.amazonsupply.com/s/2233994011/ref=gw_c_ht

Does anyone have an idea of how I could achieve this within Magento?

Currently I have 'All Products' as the top level category with all of my main categories as subcats, so I get just "All Products" on the top with the fly-out.


texts: Override Placeholder Image function in Magento2

texts:
I have a requirement like below.

I have uploaded a placeholder images for "Base Image", "Small Image" and "Thumbnail Image" in admin settings.

So whenever there is no product image is available, Magento gets this image and show in front end.

Here I need to change the functionality Instead of loading image from Placeholder path, Can we load from the Theme file image folder?

I have created a custom theme by extending Luma,

Inside Theme frontend/web/images/placeholder.png I have moved the Image file.

How can I change/modify the code where placeholder image reads the file from my theme path instead of default placeholder image path.

How this can be done? Any suggestions please.


texts: We have a magento website. I found that It takes 6-10 min to receive the order email. It supposes to receive it right away. Does any of you know why?  It shouldn't be so slow.


texts:
I have Block class

class Abc_AddressManager_Block_Address_Book extends

Mage_Customer_Block_Address_Book {
       public function getAdditionalAddresses() {
          $addresses = $this->getCustomer()->getAddresses();
          return $addresses;
      }
}

And Helper class

class Abc_AddressManager_Helper_Data extends Mage_Core_Helper_Abstract {...}

want to call getAdditionalAddresses() in Helper

Have tried

$addressBookBlock = $this->getLayout()->getBlockSingleton('Abc_AddressManager_Block_Address_Book');
$_pAddsses = $addressBookBlock->getAdditionalAddresses();


texts: Providing Site Wide Search for Community Edition

texts:
Over the years there's been numerous attempts at improving the Magento's search features.  (Solr, Lucene, etc.)  In 2013, is there a preferred/dominant way of providing a catalog search in Magento that's available for community edition?  What about a site wide search — something that searches content pages?

Are people just sticking with out of the box search, or is there something better?


texts: No checkbox let me to choose to reindex in enterprise

texts:
i had been using community version there will be a column of checkbox let me to reindex what i want see the pic

but in enterprise, there is no checkboxs

Anyone knows?


texts: Magento 2 - Can not add grouped product child to cart

texts:
In Magento 2, I have a grouped product with 3 childs.

Child 1 and Child 2 are out of stock.

Child 3 is in stock.

When I try to add Child 3 into cart, there is an error about the two other product that are out of stock.

Result : it's impossible to add a grouped product child to cart if other childs are out of stock.

Do you know why and how to solve this problem ?

Thanks


texts:
When a user is making a search on my website I would like to search into categories name, for example if the user is searching for "house" I would like to display all products containing "house" in their name (default behavior) but also all products of categories containing "house" in their name.

I wrote the code below, it's working great I have all products but the toolbar is not working anymore (order, limit, pager...).Is there any way to "reload" the toolbar with my new collection?

Thanks !

  File: di.xml

<!-- Set plugin -->
<type name="Magento\Catalog\Model\Layer\Search\CollectionFilter">
    <plugin name="CategoryName_Search" type="My\Module\Model\Layer\Search\Plugin\CollectionFilter" />
</type>

  File: My\Module\Model\Layer\Search\Plugin\CollectionFilter

public function afterFilter(
\Magento\Catalog\Model\Layer\Search\CollectionFilter $subject,
$result,
$collection,
Category $category
) {
$query = $this->queryFactory->get();

if (!$query->isQueryTextShort()) {
    //Get categories list by name
    $categoryCollection = $this->collectionFactory
      ->create()
      ->addAttributeToFilter('name', array('like' => '%'.$query->getQueryText().'%'));

    //For each product in these categories add product to search collection
    foreach($categoryCollection as $category) {
      $categoryProducts = $category->getProductCollection()->addAttributeToSelect('*');

      foreach($categoryProducts as $product) {
        if (!$collection->getItemById($product->getId())) {
          $collection->addItem($product);
        }
      }
    }
}


texts: product list not responsive within responsive theme

texts:
My Magento website www.buitengewoonbier.nl has a responsive theme. However if the website is visited with a mobile device the product list seems not to be responsive. So if you turn the mobile device to landscape more products show up.

Doe anyone know where to look and how to solve this problem?


texts:
I am getting

Uncaught TypeError: url.build is not a function

I need to use ajax in JS to get the controller method on the checkout page on click of place order.

This is my JS file

require(['jquery', 'mage/url'], function( url ){
            console.log( url );
});

How can i use url.build function to get the baseurl in js file.
Does anyone know how to do it? Thanks in advance.


texts:
I've got nested arrays in my config JSON:

Each Step node contains own products array.

Foreach binding in a template for steps array works fine (the title value is displayed). However, I can't list products array within single step node.

Here is my code:


texts:
I am trying to redirect user from https to http if user request nonsecure page from https.
I got solution for same here, see solution provided by @user2432030 or @Johnboy

If secure URL has GET parameter like

https://example.com/catalogsearch/result/?ref=abd&q=demo

then _getCurrentUnsecureUrl returns URL

http://example.com/catalogsearch/result/

means nonsecure URL looses all GET parameter which break results.

How to fix _getCurrentUnsecureUrl function so it will return correct http URL?

PS. If anyone have better solution for my real problem ie. redirecting user from https to http if page is nonsecure.


texts: Mage::app()->getLocale()->currency('AED')->getSymbol() return NULL in magento 1.9

texts:
I have created multi currency website in Magento 1.9. On product page I'm trying to get current currency symbol using below code :

$symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();

This code is working for all currency except AED. For AED currency above code return NULL.

Why this is happening?
How to resolve it?


texts: Searching fore a specifiic function at the core! (Custom Option Attachment)

texts:
I'm searching for a specific function at the Mage Core but i cannot find it!
We're selling temporary tattoos online and customer are able to upload their image (Custom Option File Attachment).

It would be awesome, if the uploaded image would be displayd as thumbnail in the shopping cart.

I got an idea how i can solve my problem, but i cannot find this one function I need!

Here is the place where the thumbnail should be displayed:

Here is the code i need to change.

Thx for your help!


texts: Minimal Magento2 installation a CMS framework

texts:
Just want to setup Magento2 as a minimal CMS framework for an internal project, I am only interested in the following modules:

Backend
Authentication
ACL
ORM
API

I tried to define the magento modules in the composer.json but was not successful, seem most of the magento modules have dependencies defined with catalog module.... like the backend module etc

Can anyone suggest how this can be achieved ?