texts: Magento 2.2.6: Product collection does not apply the filter

texts:
EDIT:
I have seen that in magento 2 the ListProduct page is cached, for this reason once loaded it does not enter.

Is there any way to modify the query returned by ListProduct?

I extend the class:

  \Magento\Catalog\Block\Product\ListProduct

And the method:

  addAttributeToFilter

I do not apply the changes, when I look at the products that are inside the collection, they all come out to me.

If I get the query and use it in the sql server it shows me the well filtered products.

public function getLoadedProductCollection()
{

    $idCustomer = $this->getLoggedInCustomerId();

    if ($idCustomer) {
        $productCollection = $this->_getProductCollection();

        /**
         * items collection of table representative_brand
         */
        $brandCollection = $this->representativeBrandCollection;
        $brandCollection->addFieldToFilter(self::CUSTOMER_FIELD, $idCustomer);

        $items = $brandCollection->toArray()['items'];

        $arr_groups = [];
        if (count($items) > 0) {
            foreach ($items as $item) {
                $arr_groups[] =  $item[self::GROUP_FIELD];
            }
        }

        try {
            /**
             * attribute: sgi_itemgroup
             */
            $productCollection->addAttributeToFilter(self::GROUP_ATTRIBUTE, ['in' => $arr_groups]);
        } catch (LocalizedException $e) {
            $this->logger->debug('Representative Brand: ' . $e);
        }

        var_dump($productCollection->toArray()); die("stop");

        return $productCollection;
    }

    return null;

}

Query of $productCollection:

  SELECT e.*, cat_index.position AS cat_index_position, stock_status_index.stock_status AS is_salable, price_index.price, price_index.tax_class_id, price_index.final_price, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS minimal_price, price_index.min_price, price_index.max_price, price_index.tier_price, at_sgi_itemgroup.value AS sgi_itemgroup FROM catalog_product_entity AS e INNER JOIN catalog_category_product_index_store1 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='3' AND cat_index.is_parent=1 INNER JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = '1' INNER JOIN search_tmp_5bb499868517e4_20951822 AS search_result ON e.entity_id = search_result.entity_id INNER JOIN catalog_product_entity_int AS at_sgi_itemgroup ON (at_sgi_itemgroup.entity_id = e.entity_id) AND (at_sgi_itemgroup.attribute_id = '205') AND (at_sgi_itemgroup.store_id = 0) WHERE (stock_status_index.stock_status = 1) AND (at_sgi_itemgroup.value IN('7', '7', '3')) ORDER BY cat_index.position asc, cat_index.position asc LIMIT 9


texts: createMock vs createPartialMock vs createConfiguredMock (PHP unit methods in Magento 2)

texts: What is the difference between createMock, createPartialMock and createConfiguredMock methods of PHPUnit\Framework\TestCase class in Magento 2?


texts:
How do I change the Quantity text input box to a dropdown on configurable products?

I've got this piece of code in my /catalog/product/view/addtocart.phtml file

<select name="qty" id="qty" title="<?php /* @escapeNotVerified */ echo __('Qty') ?>" class="input-text qty" data-validate="<?php// echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>">
<?php $i = 1 ; ?>
<?php
while( $i < 5) { ?>
    <option value="<?php echo $block->getProductDefaultQty() * $i; ?>"><?php echo $block->getProductDefaultQty() * $i; ?></option>
    <?php $i++; ?>
<?php } ?>
</select>

It works fine.but In my scenario for ex:
Boots:

Size 6 - 3 pairs

Size 7 - 2 pairs

Size 8 - 1 pair

Size 9 - 4 pairs

When I select "Size 6," I'd like the Quantity dropdown to be 1-3. If I select size 9, it should go up to 4.
How to get qty in this template file.
If anyon knows please expain me.


texts: How to get customer id , customer firstname with customer_account_edited event ? Magento2

texts:
event.xml

 <?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="customer_account_edited">
        <observer name="customer_customer_account_edited" instance="Customer\CustomerAccountEdit\Observer\CustomerAccountEdit"/>
    </event>
</config>

CustomerAccountEdit.php

<?php
namespace Customer\CustomerAccountEdit\Observer;

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

class CustomerAccountEdit implements ObserverInterface
{
    protected $_request;
    protected $_layout;
    protected $_objectManager = null;
    protected $_customerGroup;

    /**
     * @param \Magento\Framework\ObjectManagerInterface $objectManager
     */
    public function __construct(
        \Magento\Framework\View\Element\Context $context,
        \Magento\Framework\ObjectManagerInterface $objectManager
    ) {
        $this->_layout = $context->getLayout();
        $this->_request = $context->getRequest();
        $this->_objectManager = $objectManager;
    }

    /**
     * @param \Magento\Framework\Event\Observer $observer
     * @return void
     */
    public function execute(EventObserver $observer)
    {
        $event = $observer->getEvent();
        $customer = $event->getCustomer();
        $email = $customer->getEmail();
        $id = $customer->getId();
        print_r($customer->debug());
    }
}

Result.

Fatal error: Uncaught Error: Call to a member function getEmail() on null in ...


texts: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/amasty_paction/template/grid/tree-massactions.html Magento 2

texts:
I have installed Amasty Mass product action extension for Magento 2.When i enabled that extension product grid does not load in the backend.
Please check below Screenshot,

I have checked log file and i got below error in my log file,

[2019-05-08 07:00:21] main.CRITICAL: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/amasty_paction/template/grid/tree-massactions.html' [] []

Can anyone help me?


texts: Assign all products in a category to all it's ancestor categories programmatically, in Magento 2

texts:
I am working on a Magento 2.1.7 shop and I have created a child-theme of Magento Blank

The products are organized into categories and subcategories. In other words, they are organized into parent categories and children categories.

Whenever a product is assigned, through the Magento admin, to a child category, I want it to be automatically assigned to all the ancestor categories of that child category.

I want to manually assign all the boot brands in the store to the "Boots" child category add I want all boots to be automatically put, by Magento, in the "Footwear" parent category.

Question: What is the programming solution that would do the job, recursively?


texts:
I am exploring Magento 2 for the 1st time (I am not familiar with Magento 1 either).
I manage to figure out how the static blocks work but cannot find out how certain blocks work.

For example how the layered navigation block is setup?
How can i change the position of that block?


texts: How to schedule a transactional email locally?

texts:
I want to test any transactional email by a schedule in my local environment.

How could I do that in my local?


texts: How to display the products which have a tag? When I go to the page /tag/product/list/tagId/3/ the page is empty (but the sidebar is shown). I enabled template path hints but there doesn't seem that the product list block is called. How to display the products?


texts:
I'm trying to have 2 pieces of static content on a category page. One directly beneath the category title and another below the product listings. I notice Categories have a "description" and support a static block, so my plan is to use "description" for one section of text and a static block for the other.

The problem I'm having is moving the static block with a layout update. What I'm doing is using the identifier of the static block and a layout update like this:

<move element="test-category-block" destination="content" after="-"/>

However the static block is not moving. Any idea why not?


texts: How to create static block to display banners in home page in magento 2

texts:
I have created admin grid and form using ui-component for adding banners.

In frontend I have displayed the banners collection by hitting the controller path. Without controller path, how do I show my template(phtml) which contains collection of banners in home page?

How do I create static block in admin to display my collection(phtml) in homepage.Please provide me a solution.


texts:
In my store I have some grouped product that they show in a table and I change it to show the simple products of a group product in a drop down list. Now I want to get price of each simple product in option tag that I can use it for show the price in some where that I want.

Now I test this code for get the price but it doesn't show any thing. How can I get the price and tier price of product?

<select id="productsHolder">
    <?php if ($_hasAssociatedProducts): ?>
    <?php foreach ($_associatedProducts as $_item): ?>
        <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
                <option value="<?php echo $this->escapeHtml($_item->getName()) ?>"
                        price="<?php echo $this->getPriceHtml($_item, true) ?>"
                        tierprice="<?php echo $this->getTierPriceHtml($_item) ?>">
                        <?php echo $this->escapeHtml($_item->getName()) ?>
                </option>
    <?php endforeach; ?>
</select>

Also I try <?php echo $_product->getPrice(); ?> but it doesn't work.


texts: Can't see product even in Backoffice after added product via C# SOAP V2 Magento 1.9.2.4

texts:
I am trying to add a product in C# with SOAP V2 here is my code :

PortTypeClient ptc = new PortTypeClient();

string sessionId = ptc.login("dev", "123456789");
        catalogProductCreateEntity np = new catalogProductCreateEntity();
        np.name = "My new product";
        np.description = "my description";
        np.status = "1";
        np.price = "10.00";

        np.category_ids = new string[] { "8"};
        int a = ptc.catalogProductCreate(sessionId, "simple", "9","mysku1", np, "1");

I get a returned value a which is the entity_id in the catalog_product_entity table, i can see the entry in that table, but it is not showing up in the backoffice (even after I flushed Magento Cache and Cache Storage)


texts: Enable persistent connections with Redis cache / sessions?

texts:
Using Redis as the backend for Magento cache and Magento sessions (through Cm_Cache_Backend_Redis and Cm_RedisSession with phpredis), what is the best performance wise with respect to the "persistent" section in local.xml?

The example configs Colin gives show no unique value for persistent. The comments say there may be bugs. The Tuning section says to enable persistent connections.

What are the pros/cons to enabling persistent connections with Redis and Magento for caching and sessions? Thanks for any details.


texts:
how to add these order status in order view page

Order Status:

Pending
Approve
Processing
Invoice
Shipment
Complete
Staus


texts: Redirected automatically to a store view based on a user group (B2C & B2B) - M2

texts:
I have created two store views, one for B2C and one for B2B. I need that when a B2B customer login will be redirected automatically to the view created for their user group. But for B2C customers can use the normal store view. I'm creating a plugin to do this. I created these files in these paths:

/app/code/MyPlugin/CustomerLogin/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="\Magento\Customer\Controller\Account\LoginPost">
        <plugin name="myPluginCustomerloginLoginpostplugin" type="\MyPlugin\CustomerLogin\Plugin\LoginPostPlugin" sortOrder="1" />
    </type>
</config>

/app/code/MyPlugin/CustomerLogin/Plugin/LoginPostPlugin.php

<?php

namespace MyPlugin\CustomerLogin\Plugin;

class LoginPostPlugin
{
    public function afterExecute(
        \Magento\Customer\Controller\Account\LoginPost $subject,
        $result)
    {
        //-- check group is retail customer or not
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customerSession = $objectManager->create('Magento\Customer\Model\Session');
        if ($customerSession->isLoggedIn()){
            $groupId = $customerSession->getCustomerGroupId();
            if ($groupId == 2){
                $result->setPath('?___store=Wholesale&___from_store=Wholesale');
            }
        }
        return $result;
    }
}

And the view changes to the selected view (wholesale), but when I open a product or a category, the view changes to the predefined view, the change does not become effective. Any other idea of being able to make the fixed exchange?

This is the line that I do not know what to put in order that the scope of view remains:

$result->setPath('?___store=Wholesale&___from_store=Wholesale');

Any ideas to solve this problem? I need to make a change of store view and keep the change.


texts:
I want to create a dynamic menu and link it to the pages. In the tab "Create Link" I create a link for the menu, and in the "Links Grid" tab I have to assign this link to any cms page.
I now need to at least appear hidden field, which will be written values checkboxes.

I'm adding a serialization block. But it does not create a hidden field, in which the values of checkboxes should be written

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="content">
        <block class="Namespace\Module\Block\Adminhtml\Grid\Edit" name="add_row" />
    </referenceContainer>
    <referenceContainer name="left">
        <block class="Namespace\Module\Block\Adminhtml\Grid\Edit\Tabs" name="company_module_grid_edit_tabs">
            <block class="Namespace\Module\Block\Adminhtml\Grid\Edit\Tab\Main" name="edit_tab_main"/>
            <block class="Namespace\Module\Block\Adminhtml\Grid\Edit\Tab\Conditions" name="edit_tab_conditions"/>

            <action method="addTab">
                <argument name="name" xsi:type="string">main</argument>
                <argument name="block" xsi:type="string">edit_tab_main</argument>
            </action>
            <action method="addTab">
                <argument name="name" xsi:type="string">conditions</argument>
                <argument name="block" xsi:type="string">edit_tab_conditions</argument>
            </action>
        </block>
        <block class="Magento\Backend\Block\Widget\Grid\Serializer" name="productgrid_grid_serializer">
            <arguments>
                <argument name="input_names" xsi:type="string">indexAA</argument>
                <argument name="grid_block" xsi:type="string">edit_tab_conditions</argument>
                <argument name="callback" xsi:type="string">getSelectedPages</argument>
                <argument name="input_element_name" xsi:type="string">pages</argument>
                <argument name="reload_param_name" xsi:type="string">pages_related</argument>
            </arguments>
        </block>
    </referenceContainer>

</body>

Why not create a hidden field? I looked through all the articles, but I can not find the answer ... Thanks


texts: Magento problem in sub admin user for catalog visibility

texts: I am working on magento admin - subadmin setup. When i add a product from subadmin in "Not Visible Individually" Visibility. It is display in same mode in subadmin magento section. But it is display in "Catalog Search" in admin section. I dont know why this is happens. Its a bug and how to fix this functionality.


texts: Magento 1.9.3.1 Sales Order Grid limit records

texts:
I have a Magento store running with over 18,000 order records all the other pages within admin load within 1 - 2 seconds apart from Sales>Orders this can take anything between 5 - 20 seconds to load.

It is set at the standard displaying 20 records per page | Total 18000 records found

How can I either speed this page load time or limit the records to the last 3,000 total records so the page loads faster?

I have optimised the Database, Optimised the Server everything I've done has improved the rest of the site on the frontend and backend apart from this page?

Any help appreciated as this is having an impact on the daily running of the site for anyone working within the admin.


texts: SMTP pro not sending emails(Magento 1.9)

texts:
Magento 1.9

SMTP pro showing message "Email sent successfully !", but actually it is not sending email to given addresses.


texts:
I’m trying to build a site with CE v1.9.1 that will allow users to select and configure a customized DVD on-screen menu from 41 choices, then change the look of that menu by changing things like the menu’s Chapters (41 choices) and navigation buttons (50 choices).
The next customer step would be select a DVD Label that would applied to it and it’s case from 146 pre-configured ones or choose one of 386 backgrounds that we would configure. We will then use their choices to create the finished Burned / Labeled DVD with their content on it for them.
I’m assuming that Configurable Products and Swatches are the way to go but any suggestions would be appreciated. I should add, I’ve created over 4700 1123x841 .jpg’s as possible customer choices for the Menu’s options plus 532 1120x807 .jpg’s for Label’s. I hope they can be somehow used as Swatch images.
I’ve installed v1.9.1 and think I’m at the point of creating my 1st configurable product. I started by creating some Attributes but don’t really know how detailed they have to be or quite how to structure them or if this is the correct order of the steps involved etc. I seem to be going in circles reading the manual and Magento site.
I want the customer’s flow of the site after creating their account to be as follows:

Pick one of (41) available on-screen Menus (each one it’s own Configurable Product with images), leave it Default or change the Chapter Frames and / or Navigation Buttons.

Select one of 146 pre-configured Label designs or one of 386 backgrounds we make the decisions on.

Add any additional instructions for their completed product and their finished

So here are the questions... I think.

Should I be proceeding with Configurable Products or would one of the other product types be better.

How do I create a Configurable Product with this many options (what are the steps in their correct order)

Does each of the 41 DVD menus require it’s own set of Attributes i.e.: 41 Chapters x 50 Nav Buttons

When it comes time to create the Label I’m not sure which product type or how to lay out presentation on the site that would best provide the customer with the 532 options just yet.

Moderator Edit: Flynn, here's your response which you posted as an edit to Pakicle's answer (this is not proper on StackExchange):

Thanks so much for the response Pakicle. I’ve come to the realization I’ll be 100 years doing this so I switched gears.. As I mentioned, I find Magento confusing for the average guy (me) and have 1 more question if you don’t mind. Let me explain:
Step 1. I want to have the customer select 1 product (a menu) from 42 individually displayed products, in either a DVD (eg:$15.00) or Blu-Ray (eg:$18:00) format. (I did this with a configurable Product)
Now I don’t know how to proceed, I don’t think a configurable product or bundled product will work to do the rest.
Step 2. I want the customer to be forced to a part 2 before they checkout where they have to pick a Label from (143 Designs) or (386 Backgrounds) to complete the process. There are too many Labels to display as 1 large group so I want to display the Labels as images in similar groups where eg: all the outdoor scenes, styles including squares, wavy designs, circles, etc. would be displayed separately, the customer would browse through the groups to make their Label choice and any special instructions they may have to finish the process prior to checkout. I don’t want to have to add 143 + 386 simple products 42 times.
Step 3. Checkout
So to summarize, the customer would add a menu, 1 of 42 in either DVD or Blu-Ray to their cart, then be re-directed to another page where they would have to pick a label before they check-out.


texts: How to put ACL on customer grid's export to CSV, based on roles?

texts:
Trying to put ACL on customer Grid's export to CSV functionality based on user role.

Add following fode in my module's adminhtml.xml file acl section

<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <customer translate="title" module="customer">
                        <children>
                            <export translate="title">
                                <title>Export to CSV</title>
                                <sort_order>100</sort_order>
                            </export>
                        </children>
                    </customer>
                </children>
            </admin>
        </resources>
    </acl>
</config>

and Mymodule/Block/Adminhtml/Customer/Grid.php added the following code

protected function _prepareColumns()
{
----
if ($this->_admin_session_acl_custom->isAllowed('admin/customer/export')) {
            $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
            $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
}

ACL admin/customer/export is in the admin nsession allowed list but the code is not working


texts: Magento 2 Get product collection in a custom template block

texts:
I have defined a featured product template in a cms static page as below:

{{block class="Magento\Catalog\Block\Product\ListProduct" template="Magento_Catalog::product/featured.phtml"}}

Now I want to load original product collection(without any filters applied, which I am gonna apply later) inside my template "featured.phtml", but I can't find a way to do it directly without creating a module for such a tiny task.

Somebody let me know, how to do something like below in Magento2, in this case: Mage::getModel('catalog/product')->getCollection()


texts: Changing the Continue Shopping Button URL in Magento

texts: How do I change where the continue shopping button is redirecting my customers to?


texts: Complete checkout without shipping method available

texts:
For example, I have only one shipping method (Flat Rate) configured that is available for the US country only. When another country selected and the "No shipping method available" message received I still want to proceed with payment as I will send custom shipping offer to the client via E-Mail. By default, if no shipping method selected I could not finish the checkout.

How is it possible to proceed with payment in checkout without shipping method for address entered available?

A virtual product is not an option.


texts: T-Hub Shipping tracking number not pairing with order

texts: I have Magento 2.2.2 and T-Hub for shipping.  In version 1.9, T-Hub would send the shipping tracking number directly to the "Shipment" file.  Both the product detail and the tracker would appear together.  Now with version 2.2.2, the tracking number comes over, but does not merge with the product detail (see below).  I now have to copy the tracker number and hit the "Ship" button and manually past the tracker into a second shipment.  Has anyone experienced this and have you been able to resolve the issue so once the tracker is created in T-Hub, it get sent to the shipper in Magento and associated to the product order detail?


texts: magento offline orders and payment later

texts:
I have a website that handles Whole-sellers.

our business process

1) whole-sellers need to place an order without doing any payment.
2) Then email will send to the admin and the manufacturer about the order
3) After manufacturing process is completed manufacturer is informing that is completed
4) then we need to inform to our customer and collect the payment from the customer via online payment method.

My question is can we have this kind of a process in Magento. by placing orders without any payment and after that requesting the payment to done through the website.


texts: Configurable products show option box without any options

texts:
Below is a screenshot of my configurable product that has two simple products correctly associated:

The configurable product is visible (catalog/search) and the simple products are not visible individually.

When I go view my configurable product, I find that I do see a "Select Size" option but with no options inside for some reason.

Below is a screenshot:

Does anyone have any idea what could be causing this?

I have not edited or overridden any core files but I did notice that the options were being inputted by a foreach loop in configurable.phtml

The code is included below: (frontend/base/default/template/catalog/product/view/options/configurable.phtml)

<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>

    <?php foreach($_attributes as $_attribute): ?>

*<?php echo $_attribute->getLabel() ?>

        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>

                <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                    <option><?php echo $this->__('Choose an Option...') ?></option>
                  </select>

    <?php endforeach; ?>

<?php endif;?>

UPDATE:

I tried to debug this issue and noticed that on another store view with its own design theme, the configurable product worked fine. Also I noticed that on my original design theme, the add to cart button did not function. I figured perhaps some javascript was interfering and after removing my local.xml file which included all my external JS scripts, everything functioned just fine. Now... to figure out what specifically is causing the error.


texts: Product page - How to move price block next to 'Add to Cart' button

texts: What is the best way to move the price block down to the 'Add to Cart' button on a product page? It needs to be in line with the button. I've read various answers on google to do something similar but can't find exactly what my client wants.


texts: Why my favicon isn't updating / changing?

texts:
I'm very new to Magento so maybe there's something I'm missing, but I'm totally lost as to what to try next.

I have a favicon that I would like to put on my brand new Magento 1.9.3.6 install. The file is 32x32 pixels and named "favicon.gif". Using the admin panel, I uploaded the file to

System > Config > General > Design > HTML Head > Favicon Icon

After saving the file, it shows its location as "default/favicon.gif". (The design package is set to "RWD" by default. I'm not sure if that's affecting it...?)

After uploading, clearing both Magento's cache and my browser's cache, I see the same, default Magento icon. Viewing the source code shows me the favicon location as

<link rel="icon" href="<WEBSITE_NAME>/media/favicon/default/favicon.gif" type="image/x-icon" />

Upon navigation to this folder, I see the favicon I uploaded (?!). So the browser finds the right image, but still puts the Magento icon up?

I'm so confused. Any help is greatly appreciated.


texts: How to overwrite a template via module in Magento2

texts:
I am creating a module and want to overwrite the template app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml.

Is this possible in a module (not a theme)

Unfortunately it does not seem super-easy to change the module name via layout XML, as this is set hard-coded in https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options.php#L21


texts: How to redirect default store view to en?

texts:
I've got a store with 2 stores, one with 2 languages and the other just 1.

So:

  Website > Store1 > English (www.site.com/en)
  Website > Store1 >    French (www.site.com/fr)
  Website > Store2 > English    (www.site2.com/eng)

The problem is that I've setup an in-house dev environment, and on this environment, I am able to go to www.site.com and www.site.com/en and it loads the same content, yet I can remove "use default" and actually show different content between the two store views.

Now I know the best way, would be to get rid of the English specific store_view and have that rely on the default (which is actually in the plan, but not scheduled for awhile).  But for now, I'd like to simply force all www.site.com -> www.site.com/en/ when /fr/ has not been explicitly chosen.

Does anybody know of an easy way to apply this in Apache2?


texts: Uploading Products through CSV excel sheet - Site loading very slow

texts:
we bought magento extension for uploading the products through excel sheet.

we are uploading Products using csv file.

But when we are uploading the csv file , its taking more time to upload.

At the time of uploading, site will load very slowly and backend will not open

Is it the problem with the extension or with the server.

What steps we need to take solve these issues

After a quick search in google

1)we did Truncating log tables

2)Delete not required attributes

3)change Index Mode to Manual update

4) increased server requirements :

OS: Ubuntu Server Edition
Server: Apache
RAM: 16GB
Hard Disk: 160 GB SSD

what else we need to do to speed up the uploading.

please give me some tips to speed up. because we are struggling a lot for this.


texts:
updated today to Version 2.1
On nearly every page I get the error in js console:
Error: You cannot apply bindings multiple times to the same element.

Therefore nothing is really working:
In the Frontend:
No adding to cart in frontend
In the Backend:
Site all customers showing nothing
Site products/catalog showing nothing
Site products/categories showing nothing

and so on.

Does somebody have the same probleme and maybe the solution?

Forgot to mention:

Error is caused in knockout.js


texts: issue on saving category image in backend

texts: After saving category image in backend, on inspect that element src comes with rootfolder/pathof the image .so that category image is not displayed on the front end .


texts:
I have configured a product with the "Qty increments" (100) / and " Minimum Qty Allowed in Shopping Cart" (100).
When I go to the product page, the quantity is 100 by default but when I click on "+", the quantity is increase to 101 and not 200.

Can you help me?

Thanks in advance.


texts:
I install Magento 2.1.2 on a vagrant powered virtualbox with Ubuntu 16.04 64bit with 4GB RAM and 2 processors on a MacBook Pro 2015 with 16GB RAM and 2,9 Ghz Intel Core i5.
I have faked a domain https://www.testing.com for that box.
Magento is installed in a subdirectory https://www.testing.com/shop

On the machine itself the folder structure in short is:

/var/www/share/testing.com/htdocs (webroot)                  -> symlink to /var/www/share/testing.com/cms/current
/var/www/share/testing.com/cms/current                       -> symlink to /var/www/share/testing.com/cms/deploy/<datetime>/htdocs
/var/www/share/testing.com/cms/deploy/<datetime>/htdocs/shop -> symlink to /var/www/share/testing.com/shop/current
/var/www/share/testing.com/shop/current                      -> symlink to /var/www/share/testing.com/shop/deploy/<datetime>/htdocs

Already the installation is super slow. With the web wizard it fails to install as it gets stuck at installing the user configuration.

As adviced in other tickets I thus install it via composer and commandline. But also on the commandline "generating autoload files" takes >5min.

After the successful installation the whole bare shop is super slow. Pages take >1min to load. No difference in the backend.
Deploying static files does not change the behavior.

Changing to production mode is impossible as it generates seemingly infinitely.
I let the script run for about 3 hours until I stopped it.

One other thing that is strange is that all scripts run with "php bin/magento ..." take a lot of time to "start".
I send the command and then it takes about a minute to actually produce the first output. After it produces the first output the scripts seem to run at a fair speed (except the one for switching to production mode).
This happens for everything I do. Like clearing/flushing caches, deploying static files, installing and so on.

Maybe there is a problem with the autoloader?
Could that time be the time the autoloader indexes all needed files?

Well anyway the question is: why is my Magento slow? What else could I do find the reason?

edit

This is the install command I use:

php current/bin/magento setup:install --admin-firstname=xxx --admin-lastname=xxx --admin-email=xxx --admin-user=admin --admin-password=admin1234 --base-url=https://www.testing.com/shop/ --backend-frontname=xxx --db-host=localhost --db-name=xxx --db-user=xxx --db-password=xxx --language=de_DE --currency=EUR --timezone=Europe/Berlin --use-rewrites=0 --use-secure=1 --base-url-secure=https://www.testing.com/shop/ --use-secure-admin=1 --admin-use-security-key=1 --session-save=db --cleanup-database

I tried with use-rewrite on and off. No change in behaviour though.

edit2

Here is a har file of the second call of the frontend:
https://gist.github.com/anonymous/318d183e1be5d4ea5b674654c8fc5f0e

You can view it in http://www.softwareishard.com/har/viewer/

Also I attached a htop screenshot while loading the admin backend.

And one other thing I found strange is the admin url:
https://www.testing.com/shop/index.php/zoo/admin/index/index/key/<key/

Why is are there 2 index in there?


texts: Magento 2 admin email templates shows old data

texts:
if i change template text from admin panel and use that email template in custom email then email is sending but it shows old data only not showing my text even after it is saved in database.

    $alltemplele = $this->_objectManager->get('\Magento\Email\Model\Template')->load(7);
$emailTemplate = $alltemplele->getData('orig_template_code');

$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
$transport = $this->_transportBuilder
// ->setTemplateIdentifier('send_email_email_template') // this code we have mentioned in the email_templates.xml
  ->setTemplateIdentifier($emailTemplate)
  ->setTemplateOptions(
[
'area' => \Magento\Framework\App\Area::AREA_FRONTEND, // this is using frontend area to get the template file
'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
]
  )
  ->setTemplateVars(['data' => $postObject])
  ->setFrom($sender)
  ->addTo('psuryawanshi@example.com','paras')
  ->getTransport();
  $transport->sendMessage();

Can anyone help me how can I get latest text or changes in email template?

Any help would be appreciated.

Thanks In advance..!

  this is my admin template content :
  {{template config_path="design/email/header_template"}}

{{trans "Custom Email for subcription"}}

{{template config_path="design/email/footer_template"}}


texts:
I have two views english store and german. The switch for switching the two languages works without problems. I find myself as on the German side imprint. From there I would like to switch to the English site. Instead of seeing the English imprint, I get an error 404 Page not found. I was able to solve the problem as follows.

Impressum = german site, english Site not active.

Page title: impressum
URL Key: impressum
Store view: deutsch
Status: active

And the english page as follows

imprint = englisch Site, german Site not active
Page title: imprint
URL Key: imprint
Store view: englisch
Status: aktiviert

German Site
Type: User configurated
Store. Deutsch
ID Path: impressum
Request Path: imprint
Target Path: impressum
Redirect: permanent

English Site
Type: User configurated
Store: Englisch
ID Path: imprint
Request Path: impressum
Target Path: imprint
Redirect: permanent

Now I wanted to do the same for each category . Unfortunately without success
Under Rewrite Url i have the following:

German Categorie
Type: User configurated
ID Path: category/3
Requet Path: bleistift
Target Path: catalog/category/view/id/3
Redirect: permanent

English Categorie
Type: Benutzerdefiniert
ID Path: category/4
Request Path: pencil
Target Path: catalog/category/view/id/4
Redirect: permanent

What is wrong?


texts:
I have deleted /pub/static/ and /var folder except .htaccess and run cmd

setup:upgrade
setup:static-content:deploy
indexer:reindex
cache:clean
cache:flush

But still some content is not showing,like shopping cart, menu left.


texts: Magento 2: How to store credit card with the authorize.net method

texts: Right now, I am using the Magento 2.2 version and want to allow the customer to save his/her credit information. Does it possible to store the credit card information with the Magento when the customer places an order.


texts: Magento2 : How to remove delete item button from cart page?

texts:
I want to remove delete item button from cart page.

I am using below xml code to remove this but not working:-

Path:

app/design/frontend/vendor/theme/Magento_Checkout/layout/checkout_cart_item_renderers.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.item.renderers.default.actions.remove" remove="true"/>
        <referenceBlock name="checkout.cart.item.renderers.simple.actions.remove" remove="true"/>

    </body>
</page>

Please help me to do this using xml and if my approach is not correct what is the right way to do this.


texts:
This is how I got my last URL:

 $url = Mage::getSingleton('core/session')->getLastUrl();

For some reason the result of the var_dump($url) is  /cms/index/noRoute/default/images/. Afther I press several times ctrl+shift+r button , to clear the browser I got the right URL. Why ? I removed all files from var/cache/ and I got the same result. Thx in advance for any idea :)


texts: Why some delivery methods are not available for some customers?

texts:
I have 4 shipping methods.

The old customer gets only 2 methods.
I've created the same customer with another email. It gets all 4 shipping methods.

I dived into code and DB table sales_flat_quote_shipping_rate.

Sorting by address_id we have:
for old customer: 2 rate records;
for the same new customer: 4 rate records.

Why does it happens? and where is rate record created?

UPDATE 1:

I doesn't depends on address. It depends on product. If product has filled weight then customer cannot see some shipping methods. Now the question is why?)


texts: Magento 2.3.4: How to serve images in next generation format?

texts: Web.dev performance metrics suggest "Image formats like JPEG 2000, JPEG XR, and WebP often provide better compression than PNG or JPEG, which means faster downloads and less data consumption" The two images on my Magento site's home page are as seen in the screenshot below. How can I change their format to the ones suggested by web.dev?


texts:
I have created an api for wishlist.

If I add the same product with option to wishlist for second time,

then I got the new product with same option for every addtowishlist.

I already refer below link...
Magento 2 : Wish list of customer Using API  . But it does not help me.
Because it get only wishlist items for customer.But i need to add the same product with option to wishlist for second time condition

try {
            $product = $this->_productRepository->getById($productId);
            $product->setStoreId(1)->save();
        } catch (\Magento\Framework\Exception\NoSuchEntityExceptionNoSuchEntityException $e) {
            $product = null;
        }
        if (!$product || !$product->isVisibleInCatalog()) {
            $message = __('We can\'t specify a product');
        }
        try {
            $requestParams = [
                'product_id' => $productId,
                'super_attribute' => [$sizeAttributeId => $sizeoptionId],
                'store_id' => 1
            ];

            $wishlist = $this->_wishlistRepository->create()->loadByCustomerId($customerId, true);
            $buyRequest = new \Magento\Framework\DataObject($requestParams);
            $result = $wishlist->addNewItem($product, $buyRequest);

            if (is_string($result)) {
                $message = $result;
            }
            $wishlist->save();
            $message = __('Added to your Wishlist.');
            $status = true;
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            $message = __('We can\'t add the item to Wish List right now: %1.', $e->getMessage());
        } catch (\Exception $e) {
            $message = __('We can\'t add the item to Wish List right now: ');
        }


texts: How can Apply multiple coupon codes in one order in magento 2.1?

texts: I am trying by setting yes to Discard subsequent rule it is not helping!


texts: Magento 2: Force CSS reload with query string

texts:
When I want to force reload CSS and JS on my sites (non-Magento 2), I usually just add a query string to the end of the URLs. For example: css/styles.css?v=1

I tried this in M2 by adding adding the above to my style files in my custom default_head_blocks.xml Although the style files are being loaded (I can click on the links in 'View Source' and it shows me the correct CSS file content) but the page isn't being styled.

Any idea why it's not working? Or, do you know how to force reload CSS / JS on the client side in M2?


texts: Magento2 : How To Solve Out Of Memory Limit Error While Using Composer Update Command

texts:
I got out of memory error while run "composer update" command,
I already check memory_limit and that is 2048 M than also  I am getting above error
.
Does anyone know how can I solve this problem ?


texts: Magento 2 - Call list phtml by passing collection variable

texts:
I have collection loaded in variable $collection and I want to pass collection variable in my list.phtml

$block = $viewBlock->getLayout()
                ->createBlock('Vendor\Module\Block\ProductList')
                ->setTemplate('Magento_Catalog::product/list.phtml')
                ->toHtml();

So that list.phtml create product list according to my collection. My query is how can I pass collection variable to list.phtml

Note: I don't want to change any thing in list phtml it also include calling any custom function from block object. My product collection must be loaded by default function which is already in list phtml i.e: $_productCollection = $block->getLoadedProductCollection();


texts: How to get is_active column value from quote table ? Magento2

texts: I want to get the value of the is_active column through the method $this-> getQuoteCollection ($customerId) -> getLastItem (), I used getColumnValues('is_active'), but it doesn't return the last column (is_active) of the element


texts: Stock not updated when removing product from an order in magento Programmatically

texts:
I tried to remove all products from a order. All products will removed from order but quantity not revert from stock.

$order_id = 1010101010;
$_order = Mage::getModel('sales/order')->load($order_id);
$items = $_order->getAllItems();
foreach ($items as $item) {
    //-- Get Order Stuff
    $base_grand_total = $_order->getBaseGrandTotal();
    $base_subtotal = $_order->getBaseSubtotal();
    $base_tva = $_order->getBaseTaxAmount();
    $grand_total = $_order->getGrandTotal();
    $subtotal = $_order->getSubtotal();
    $tva = $_order->getTaxAmount();
    $base_subtotal_incl_tax = $_order->getBaseSubtotalInclTax();
    $subtotal_incl_tax = $_order->getSubtotalInclTax();
    $total_item_count = $_order->getTotalItemCount();

    $item_price = $item->getPrice();
    $item_tva = $item->getTaxAmount();
    $item->delete(); //-- Remove Product

    //-- Update Order Stuff
    $_order->setBaseGrandTotal($base_grand_total - $item_price - $item_tva);
    $_order->setBaseSubtotal($base_subtotal - $item_price);
    $_order->setBaseTaxAmount($base_tva - $item_tva);
    $_order->setGrandTotal($grand_total - $item_price - $item_tva);
    $_order->setSubtotal($subtotal - $item_price);
    $_order->setTaxAmount($tva - $item_tva);
    $_order->setBaseSubtotalInclTax($base_subtotal_incl_tax - $item_price);
    $_order->setSubtotalInclTax($subtotal_incl_tax - $item_price);
    $_order->setTotalItemCount(count($items) - 1);
    $_order->save(); //-- Save Order
}

I found that code on magento.stackexchange post - Delete products from order programmatically . I don't understand what is the problem, Can anyone please tell me what is the issue?


texts: How to get Configurable Products to appear when out of stock

texts:
In STORES > Configuration > CATALOG > inventory I have "Display Out of Stock Products" set to "Yes.

I can get Simple Products that are out of stock to appear but I cannot get a configured item that has a quantity of 0 to appear on the product attribute drop down list on the public side of the site.

How can I get configured products that are out of stock to appear?


texts: Magento 1.9 - How to add if-else condition on Sales order email template HTML file?

texts:
Following is my sales order email template sample,

Docroot = app\locale\en_US\template\email\sales\order_new.html

Thank you for your order from {{var store.getFrontendName()}}.

Once your package ships we will send an email with a link to track your order. Your order summary is below. Thank you again for your business.

Order Questions?

                            {{depend store_phone}}
                            Call Us:
                            {{var store_phone}}

                            {{/depend}}
                            {{depend store_hours}}
                            {{var store_hours}}

                            {{/depend}}
                            {{depend store_email}}
                            Email: {{var store_email}}
                            {{/depend}}

I just want to alter my thank you message based on the website in my multistore website.

If website id  == 1 my message should be

Thank you for your order from {{var store.getFrontendName()}}.

else

Welcome our land your order from {{var store.getFrontendName()}}.


texts: 404 Error. Magento2 admin page not working

texts:
Problem

Was creating a module. Everything was good, but at some point admin page just stopped working. Can't say on what paticular moment, cause I used bin/magento to flush caches, compile and deploy. Now it's loading only main page localhost/. No other links. Error 404.

What was done

Checked, if the right admin url in /Library/WebServer/Documents/app/etc/env.php.
sudo chmod -R 777 ./ -> Flush cache -> sudo chmod -R 777 ./ -> Deploy static content -> sudo chmod -R 777 ./ -> Compile -> sudo chmod -R 777 ./.
Copied .htaccess to the root from source folder on the site.

Additional information

It happens the second time. First time I thought it was one-time mistake. I can't remember, if the symptoms are exactly the same, but they are similar. That time was Magento 2.0. Now it is 2.1.


texts:
I have my store set up so an account is created for every order (unless the email address already exists in which case the order gets added to the corresponding email addresses account)
i would like to give my customers the ability to set the password for their new account on the success page since the account has already been created (without a password) how could I do that?
i tried resetting the password with a form like this on the success page

<form action="https://mystore.com/customer/account/resetpasswordpost/?id=<?php echo $order->getCustomerId() ?>&amp;token=......." method="post" id="form-validate">
    *New Password

            <input type="password" class="input-text required-entry validate-password" name="password" id="password">

        *Confirm New Password

                <input type="password" class="input-text required-entry validate-cpassword" name="confirmation" id="confirmation">

        <button type="submit" title="Reset a Password" class="button">Create A Password</button>

</form>

but i need a way to get the tokens value any thoughts? thanks


texts: I need to get product url on product save after event in magento 2

texts:
I want to access product url from product collection after product save event in magento 2. i have try to some code but its return url with admin code and key.

i want to clean url no need to key and other paramenter in url.

event file

$product = $observer->getEvent()->getProduct();
echo "<pre>"; print_r($product->getProductUrl());

Get Following output :

admin/catalog/product/view/id/36/s/aim-analog-watch/key/7a1aeddd7ca27d6fc9daf52478db967c889d95d6d74350e6009ed44e06779fa5/

I Need to clean url

http://localhost/magento121new/aim-analog-watch.html


texts: How to make custom option price be added only once undependently on the qty chosen?

texts:
I am building a store, which sells flowers. And there is a functionality I am trying to implement, where I want to have a custom option, which allows customers to add a bit more grass on the bouquet.

The problem is that, if I am on the rose page, I want to select 5 roses, each of which cost 3.00. And I choose that extra grass option for 2.00. Magento calculates it as (2.00 + 3.00) * 5.

What I need is to append that price only once, like 3.00 * 5 + 2.00.

I am trying to find the code, which does the calculation but struggling due to the Magento complexity.

Currently I have found a javascript reloadPrice function in the options.phtml file, but I think it doesn't actually change the price of the product itself, but just the visual representation on the frontend, when an option is selected on the product page.
I have also found this bit of code:

    public function getCalculationPrice()
    {
        $price = $this->_getData('calculation_price');
        if (is_null($price)) {
            if ($this->hasCustomPrice()) {
                $price = $this->getCustomPrice();
            } else {
                $price = $this->getConvertedPrice();
            }
            $this->setData('calculation_price', $price);
        }
        return $price;
    }

in the Sales/Model/Quote/Item/Abstract.php file. But I still can't find where it sets the calculation_price. The only place where Magento sets the value:

    public function setCustomPrice($value)
    {
        $this->setCalculationPrice($value);
        $this->setBaseCalculationPrice(null);
        return $this->setData('custom_price', $value);
    }

is located in the same file as the previous function. But the break point is never hit there when I am choosing an option or adding it to the cart.

I have also found a different syntax like setData('calculation_price'). But the thing is, after digging up further, it still calling the getPrice function which just returns the 2.00 + 3.00 as a unit price.

I am starting to feel that the value (as a sum) is retrieved from the database (I didn't check though yet).
In that case, how to implement that functionality? Will I have to play with prices by subtracting the custom option part from it and append it only once after it fetches the the price as a sum? Ideally, I would like to amend the logic of how that unit price is calculated by having a little flag in the admin in the custom option menu something like a checkbox with "Is Global?" label.

Can you help me please with that?


texts: GeoIp-based default currency selection behind Varnish

texts:
I want a store to intelligently choose a default currency based on the customer's IP using GeoIP when they first visit (with no preselected currency cookie). The store is behind Varnish using Nexcess's excellent Turpentine extension.

The extension handles currency fine as long as the standard Magento currency cookie is set on a given request.

My thoughts at this stage are:

Add VCL into the Varnish config to do the GeoIP lookup (in C) and set the cookie on the inbound request, if it's not already set, of course.
Add a per-user cached block that does the lookup and sets the cookie (though this would then not apply on the first page load)

Am I missing an obvious technique - maybe some client-side JS to a non-varnish-cached URL path that makes the determination?

Does anyone know the best way to do this?


texts: I cannot create new account. Please help finding the file path to register in the Porto theme (cannot change)


texts:
I have a custom report based on the tutorial at http://wrightcreativelabs.com/create-a-custom-magento-report-product-skus-in-new-orders/.  The report is working well as is.  Now I'm trying to add a customer comments column to the report.  The customer comments are coming from the One Page Checkout extension.  I have the column added with:

    $this->addColumn('comment', array(
        'header' => Mage::helper('reportneworders')->__('Special Instructions'),
        'align' => 'left',
        'sortable' => false,
        'index' => 'comment'
    ));

The problem is in the collection.  The gift message works, but when the comment is added, the report is broken.  I know I must be using the wrong id or reference to the comment.

    ->joinLeft(
            array('c' => 'order_comment'),
                  'c.order_comment = order_items.order_comment',
                  array(
                          'comment' => 'comment'
                  ))

    ->joinLeft(
            array('g' => 'gift_message'),
                  'g.gift_message_id = order_items.gift_message_id',
                  array(
                          'message' => 'message'
                  ))

The One Page Checkout textarea for the comment looks like this:

<textarea name="order-comment" id="order-comment"><?php echo trim(Mage::getSingleton('customer/session')->getOrderCustomerComment()) ?></textarea>

I appreciate any advice.


texts:
How to show Minimum price and Maximum price of this category product. In Below code i displayed category name, image and url. I want to show Minimum price and Maximum price of this category product

$layer = Mage::getSingleton('catalog/layer'); $category = Mage::getModel('catalog/category')->load($this->getCategoryId()); if ($category->getId()) { $origCategory = $layer->getCurrentCategory(); $layer->setCurrentCategory($category); } $collection = $layer->getProductCollection(); $collection->getSelect()->reset('order'); $collection->getSelect()->order('minimal_price','asc'); $collection->getSelect()->limit(1);

            <?php
            $catIds = explode(',', $this->getIds());

              $categories = array();
            foreach ($catIds as $catId) {
                $category = Mage::getModel('catalog/category')->load($catId);
                $categories[$category->getName()] = array(
                    'url' => $category->getUrl(),
                    'img' => $category->getImageUrl()
                );
            }

            ksort($categories, SORT_STRING);
            ?>
                <?php if ($category->getIsActive()): ?>
                    <?php foreach ($categories as $name => $data): ?>

                            <a href="<?php echo $data['url']; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>">
                                <img id="cat-image" src="<?php echo $data['img']; ?>" class="img-responsive"/>

<a href="<?php echo $data['url']; ?>"><?php echo $name; ?>

                            <button type="button" title="<?php echo $this->__('SELECT BOUQUETS') ?>" class="btn btn-default custom-btn" onclick="setLocation('<?php echo $data['url']; ?>')"><?php echo $this->__('SELECT BOUQUETS') ?></button>
<?php echo $collection->getFirstItem()->getMinimalPrice();?>

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

I want to Show Min Price - Max Price in after category name


texts: Magento 2. Declarative Schema. How to uninstall a patch without uninstalling the module?

texts:
The official docs say this.

  Revertable data patch - A patch that can be reverted as a module or patch is uninstalled or deleted.

I know that Revertable patches must implement Magento\Framework\Setup\Patch\PatchRevertableInterface and when a module is un-installed the logic in the revert() method is called.

How can one revert a Patch without uninstalling the module


texts: How to add "Starting at:" price prefix for configurable products?

texts:
For grouped products, prices are prefixed with "Starting at:" - I'd like to do the same thing for configurable products. I'm thinking the file I want is app/design/frontend/mytheme/default/template/catalog/product/price.phtml, but I'm having trouble getting it to work. I tried changing this:

$showMinPrice = $this->getDisplayMinimalPrice();

To this:

$showMinPrice = $this->getDisplayMinimalPrice() || $_product->isConfigurable();

But no luck.


texts: Magento 2 - Debugging Hints showing on emails sent programmatically

texts:
I have a bootstrap script that is used to mark orders as shipped. After shipping the order it used ShipmentNotifier to send out the shipment email.  Despite Debugging Hints being turned off everywhere, the email that it sends still includes the red path hints.

I have tried setting the script to run in the 'frontend' state instead of 'adminhtml', but it makes no difference, the red boxes remain.

If I send the email out manually using the Magento backend then it sends correctly (no debug hints).  This leaves me to believe there is something I am missing in the bootstrap script.

Has anyone encountered this issue before?  What did you do to resolve it?

// Register shipment
        $shipment->register();
        $shipment->getOrder()->setIsInProcess(true);

        try
            {
            // Save created shipment and order
            $shipment->save();
            $shipment->getOrder()->save();
            }
        catch (\Exception $e)
            {
            echo "EXCEPTION: ". $e->getMessage(); exit;
            }

        //send email
        $shipmentNotifier = $objectManager->create('Magento\Shipping\Model\ShipmentNotifier');
        $shipmentNotifier->notify($shipment);


texts:
I want to override wishlist block in my custom theme. Whenever Customer increases the QTY on wishlist page for add to cart, I want to place the condition that QTY should be less than 5.

This function is already written in /Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php.

I want to override this in my custom theme.

app/code/local/Gt/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php

class Gt_Wishlist_Block_Customer_Wishlist_Item_Column_Cart extends

Mage_Wishlist_Block_Customer_Wishlist_Item_Column
{
    /**
     * Returns qty to show visually to user
     *
     * @param Mage_Wishlist_Model_Item $item
     * @return float
     */
    public function getAddToCartQty(Mage_Wishlist_Model_Item $item)
    {
        $qty = $item->getQty();
        return $qty ? $qty : 1;
    }

    /**
     * Retrieve column related javascript code
     *
     * @return string
     */
    public function getJs()
    {
        $js = "
            function addWItemToCart(itemId) {
                var url = '" . $this->getItemAddToCartUrl('%item%') . "';
                url = url.gsub('%item%', itemId);
                var form = $('wishlist-view-form');
                if (form) {
                    var input = form['qty[' + itemId + ']'];
                    if (input) {
                        var separator = (url.indexOf('?') >= 0) ? '&' : '?';
                        url += separator + input.name + '=' + encodeURIComponent(input.value);
                        if(input.value > 5){
                            alert('Select between 1 to 5');
                            return false;
                        }
                    }
                }
                setLocation(url);
            }
        ";

        $js .= parent::getJs();
        return $js;
    }
}

app/code/local/Gt/Wishlist/etc/config.xml

<?xml version="1.6.0.0"?>
<config>
  <modules>
    <Gt_Wishlist>
      <version>1.0</version>
    </Gt_Wishlist>
  </modules>
    <resources>
        <Gt_Wishlist_setup>
            <setup>
                <module>Gt_Wishlist</module>
            </setup>
        </Gt_Wishlist_setup>
    </resources>
  <global>
    <blocks>
      <wishlist>
        <rewrite>
          <column_cart>Gt_Wishlist_Block_Customer_Wishlist_Item_Column_Cart</column_cart>
        </rewrite>
    </wishlist>
    </blocks>
  </global>
</config>

These two files i have overriden in my custom theme as i shared folder path. Please help me.


texts: Magento2 rewrite javascript file from a core module in a custom module

texts:
I have created a custom module that uses the UI component

<uiComponent name="product_listing"/>

Basically, I want to create a javascript file in my module that rewrites/overrides only the fallowing part of that component js file:

vendor/magento/module-ui/view/base/web/js/grid/provider.js:

/**
 * Reloads data with current parameters.
 */
    reload: function () {
        this.trigger('reload');

        if (this.request && this.request.readyState !== 4) {
            this.request.abort();
        }
        console.log(this);
        this.request = $.ajax({
            url: this['update_url'],
            method: 'GET',
            data: this.get('params'),
            dataType: 'json'
        });

        this.request
            .done(this.onReload)
            .error(this.onError);
    },

Can someone please guide me trough how to do that in the best and efficient way ? Thank you!


texts: Magento2 - php bin/magento setup:upgrade - Access denied for user 'user'@'localhost' (using password: NO)

texts:
Fairly new to Magento, I am trying to develop a custom module and have run the CLI command php bin/magento setup:upgrade.
However I am getting the following error;
SQLSTATE[HY000] [1045] Access denied for user 'user'@'localhost' (using password: NO).
I have checked my .env file and granted all permission to the user on phpmyadmin.
I am on a macOS and using MAMP. Any advice or suggestions?
Thanks in advance!


texts: Magento 2 - where to find \Magento\Catalog\Model\Product\ImageFactory

texts:
In vendor\magento\module-catalog\Helper\Image.php you can find this parameter in the constructor:

\Magento\Catalog\Model\Product\ImageFactory $productImageFactory

but where is the class located? I searched in vendor\magento\module-catalog\Model\Product\ but there is no such file??


texts: Magento2 Filters custom module dropdown in admin

texts:
Can anyone help me, how to fetch the custom module admin collection for filters drop down section in magento 2 admin.

Please find the screen shots below:

https://prnt.sc/hpesq6

Here is the fields to display in dropdown:

https://prnt.sc/hpeu3x

This is my drop down code: under view/adminhtml/Ui_component

<column name="department" class="Ewall\HelpDesk\Ui\Component\Listing\Column\TicketDepartment">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">Ewall\HelpDesk\Model\Ticket\Source\DepartmentCollection</item>
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">select</item>
                    <item name="label" translate="true" xsi:type="string">Department123</item>
                    <item name="editor" xsi:type="array">
                        <item name="editorType" xsi:type="string">select</item>
                        <item name="validation" xsi:type="array">
                            <item name="required-entry" xsi:type="boolean">false</item>
                        </item>
                    </item>
                </item>
            </argument>
        </column>

and
This is DepartmentCollection.php

<?php

/**
* A Magento 2 module named Ewall/HelpDesk
* Copyright (C) 2017  Ewall Solutions Pvt Ltd
*
*/
namespace Ewall\HelpDesk\Model\Ticket\Source;

class DepartmentCollection implements \Magento\Framework\Data\OptionSourceInterface
{
    /**
     * @var \Ewall\HelpDesk\Api\GroupRepositoryInterface
     */
    private $departmentRepositoryInterface;

    /**
     * @var \Magento\Framework\Api\SearchCriteriaBuilder
     */
    private $searchCriteriaBuilder;

    /**
     * @var \Magento\Framework\Convert\DataObject
     */
    private $objectConverter;

    /**
     * @param \Ewall\HelpDesk\Api\DepartmentRepositoryInterface $departmentRepositoryInterface
     * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
     * @param \Magento\Framework\Convert\DataObject $objectConverter
     * @param \Ewall\HelpDesk\Model\ResourceModel\Department\CollectionFactory $collectionFactory
     */
    public function __construct(
        \Ewall\HelpDesk\Api\DepartmentRepositoryInterface $departmentRepositoryInterface,
        \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
        \Magento\Framework\Convert\DataObject $objectConverter,
        \Ewall\HelpDesk\Model\ResourceModel\Department\CollectionFactory $collectionFactory
   ) {
        $this->departmentRepositoryInterface = $departmentRepositoryInterface;
        $this->searchCriteriaBuilder = $searchCriteriaBuilder;
        $this->objectConverter = $objectConverter;
        $this->_departmentCollectionFactory = $collectionFactory;

   }
   public function toOptionArray($addEmpty = true)
   {
      /** @var \Ewall\HelpDesk\Model\ResourceModel\Department\Collection $collection */
      $instance = \Magento\Framework\App\ObjectManager::getInstance();
      $product_collections = $instance ->get('\Ewall\HelpDesk\Model\ResourceModel\Department\CollectionFactory');
$collections = $product_collections->create();
      $options = [];
      if ($addEmpty) {
         $options[] = ['label' => __('-- Please Select a Category --'), 'value' => ''];
      }
      foreach ($collections as $category) {
         $options[] = ['label' => $category->getTitle(), 'value' => $category->getDepartmentId()];
      }
      return $options;
   }

Thanks


texts:
I want to change my product tax value, it shows round off values.

My Product rate is $49.95 and tax value is 10%. It shows $5.00 but I want it to show $4.99.

I don't know where to change the round off value. I created a tax rule and it's class is properly. I think I need to edit the core files. I want to know which file to change the round off value into normal tax value.

Can anyone please help me?


texts: Want to make email is not necessary for both guest and customers in magento2

texts: I need to make email is not necessary for guest checkout and customer account creation. I can't able to find anyways. please anyone guide me to do this.


texts: Instructions in a Custom Offline Payment not showing

texts:
I am building a custom offline payment for magento 2.2.2

After a week working on this I gave up and I am asking for help.
The extension works fine the only problem I have is to be able to display the instructions in the frontend, as the Bank Transfer Payment has.

Here you can see my code.
https://github.com/techbertu/Offline_Payment

I really appreciate the help on this, since I am going crazy on this.


texts: how to track down my custom module issue?it throw out error

texts:
how do I track where the problem of my custom module.
I got below error.

Fatal error: Uncaught Error: Call to undefined method ABC\NewsletterCrm\Controller\Subscriber\Confirm\Interceptor::loadByCustomerId() in /app/vendor/magento/module-customer/Block/Account/Dashboard/Info.php:105 Stack trace:
#0 /app/vendor/magento/module-customer/Block/Account/Dashboard/Info.php(120): Magento\Customer\Block\Account\Dashboard\Info->getSubscriptionObject()
#1 /app/vendor/magento/module-customer/view/frontend/templates/account/dashboard/info.phtml(39): Magento\Customer\Block\Account\Dashboard\Info->getIsSubscribed()
#2 /app/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/app/vendor/mag...')
#3 /app/vendor/magento/framework/View/Element/Template.php(271): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Customer\Block\Account\Dashboard\Info), '/app/vendor/mag...', Array)
#4 /app/vendor/magento/framework/View/Element/Template.php(301): Magento\Framework\View\Element\Template->fetchView('/app/vendor/mag...')
#5 /app/vendor/magento/module-customer/Block/Account/Dashboard in /app/vendor/magento/module-customer/Block/Account/Dashboard/Info.php on line 105

I wrote a override module at app\code\ABC\NewsletterCrm\Controller\Subscriber\Confirm.php
using Object Manager to getCustomerID, please help

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$subscribeCollection = $objectManager->create('Magento\Newsletter\Model\Subscriber');
$collection = $subscribeCollection->getCollection()
                                  ->addFieldToFilter('subscriber_id', $id);

foreach ($collection as $subscribe){

    $customerid = $subscribe->getCustomerId();

}


texts:
I'm working on a problem at the moment in the layered navigation. I need to change how the filters are working. Currently they are called like so;

    $_filters = $this->getFilters();
    foreach ($_filters as $_filter):
    //various mark up and calls are made here

Then to output the individual options the following is used.

   $_filter->getHtml()

I need to find another way of getting this data, preferably unformatted. I am able to get each filters attribute code like so;

  $_filter->getFilterOptions()->getCode()

But I can't figure out how to use this to get the options belonging to each filter attribute.

The two most important pieces of information that I need are the option name and id. After this I can work everything out.


texts: Magento 2.1.8 is taking too much time to load

texts:
We just developed our website with Magento 2.1.8 but it takes time to load.

http://megabooklet.com/beta/

Can someone please tell where is the lag?


texts: Use External Database for a Custom Collection

texts:
I've been following this thread but I couldn't get it to work, How do I get my Collection to use a different DB connection?.

I'm trying to load a collection from an external database separate from the main magento database.

config.xml:

<otherdb_setup>
    <connection>
        <host><![CDATA[127.0.0.1]]></host>
        <username><![CDATA[root]]></username>
        <password><![CDATA[]]></password>
        <dbname><![CDATA[otherdb]]></dbname>
        <model>mysql4</model>
        <initstatements>SET NAMES utf8</initstatements>
        <type>pdo_mysql</type>
        <active>1</active>
    </connection>
</otherdb_setup>
<otherdb_write>
    <connection>
        <use>otherdb_setup</use>
    </connection>
</otherdb_write>
<otherdb_read>
    <connection>
        <use>otherdb_setup</use>
    </connection>
</otherdb_read>

Then on my collection file (class Custom_Module_Model_Mysql4_Mod_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract):

public function _construct()
{
    $this->_init('custom_module/mod');

    $resource = Mage::getSingleton('core/resource');
    $conn = $resource->getConnection('otherdb_read');

    $this->setConnection($conn);
}

I'm stuck on this part.


texts: Removing options from the customer account dashboard menu

texts: I need to remove some options from the customer account dashboard menu (eg: billing agreements and Recurring Profiles). Where are these defined?


texts: How to apply wordpress shortcode in sidebar using fishpig extension in magento?

texts:
I've installed fishpig extension in magento for wordpress blog. But I'm not able to apply shortcode in sidebar. But its works in post.

Please help me on this situation.


texts:
I have a custom module that needs to overwrite the new order email template, the location for the default email template is
vendor\magento\module-sales\view\frontendemail\order_new.html,
and this file get the data from
vendor\magento\module-sales\Model\Order\Email\Sender\OrderSender.php,
I need to override these two files from my custom module but I don't know how to do it


texts: get magento 2 rest api data on specific page or record between such as 100-150

texts:
I am finding solution get magento2 product data via rest api page by page  .
I am currently using below search Criteria

mydomaim.com/index.php/rest/V1/products?searchCriteria[pageSize]=12

but I need get results page by page because if i have 5000 product i have to set page size 5000 .

I checked doc there is searchCriteria[currentPage] but nothing found for  nth page results.

is there any searchCriteria to accomplish this.

I need Get Results using multiple requests

as example
first request return  1-200 products
second request return 201-400 results
I need some searchCriteria to accomplish this


texts: Magento 2 how create CMS page programmatically

texts:
I need any query or code to create CMS page programmatically, Please help me or suggest me if any module available for the same.

Thanks :)


texts: Add additional fee to product based on attribute set or category

texts:
I would like to add additional cost to basic product cost based on attribute set or category or additional field can be added upon adding a new product product.

There are two requirements:

A fixed price can be added to product.
By percentage

I have looked at Promotions -> Catalog Price Rules, which is handy option to offer discounts on products based on attribute set or category price.

Is it possible to achieve something similar but instead of discount, it will add fixed cost or by percentage to the catalog price?

This is kind of service cost based on product variation. It will vary from product groups. I do not want to show such cost separately on shopping cart. So this will be calculated and added to catalog price.

Thanks in advance.


texts: It is possible to save only one column in a database table?

texts: I want a helper which will save only one specific column in database table(not eav).


texts:
I'm using Magento ver. 1.9.3.2 and I have no idea why Refund Totals not get shown in Magento, and I don't know what I need to do to resolve it.

2017-11-28T13:19:44+00:00 ERR (3):  Mage_Core_Exception: Invalid block type: Mage_Adminhtml_Block_Sales_Order_Totals_Subtotal in /var/www/vhts/bsus.es/wehn.bsus.es/app/Mage.php:595 Stack trace: 0 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28754): Mage::throwException('Invalid block t...') 1 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28696): Mage_Core_Model_Layout->_getBlockInstance('Mage_Adminhtml_...', Array) 2 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28731): Mage_Core_Model_Layout->createBlock('adminhtml/sales...', 'subtotal') 3 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28498): Mage_Core_Model_Layout->addBlock('adminhtml/sales...', 'subtotal') 4 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28464): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element)) 5 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28465): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 6 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28465): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 7 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28465): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 8 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28465): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 9 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28465): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 10 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(28469): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) 11 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(14260): Mage_Core_Model_Layout->generateBlocks() 12 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(14185): Mage_Core_Controller_Varien_Action->generateLayoutBlocks() 13 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/Mage_Adminhtml_Controller_Action.php(275): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true) 14 /var/www/vhts/bsus.es/wehn.bsus.es/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php(233): Mage_Adminhtml_Controller_Action->loadLayout() 15 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(14334): Mage_Adminhtml_Sales_Order_CreditmemoController->newAction() 16 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(18813): Mage_Core_Controller_Varien_Action->dispatch('new') 17 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(18343): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) 18 /var/www/vhts/bsus.es/wehn.bsus.es/includes/src/__default.php(21279): Mage_Core_Controller_Varien_Front->dispatch() 19 /var/www/vhts/bsus.es/wehn.bsus.es/app/Mage.php(683): Mage_Core_Model_App->run(Array) 20 /var/www/vhts/bsus.es/wehn.bsus.es/index.php(83): Mage::run('', 'store') 21 {main}

AND <?php echo $this->getChildHtml('creditmemo_totals') ?> show null in

app\design\adminhtml/default/default/template/sales/order/creditmemo/create/items.phtml


texts: Payment methods are not displayed, suddenly

texts:
Suddenly, all payment methods are not shown in checkout. I have a custom payment method together with bank transfer payment, and none of them appears in checkout.

What may be happening?

Thanks
Jaime


texts: How can I apply Payment Charge as %, For CCAVENUE MCPG to Customer

texts: I have installed ccavenue mcpg for payment gateway, how can i apply payment charge for every transaction.


texts: Some PHP guidance re a multi store site please

texts:
I have a multi store site a retail and a wholesale site. The wholesale site requires that out of stock, cart and price not be shown whereas the retail site should display this information.

I located info on how to do this by editing the php files however the instructions will affect all my stores what kind of additional info can i apply to the changes to specify what store the edits apply to?

Here's an example of an edit to remove price for guests
<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()){echo 'Login to See Pricebr>';return;}?>"

from  http://www.templatemonster.com/help/magento-how-to-hide-prices-and-add-to-cart-button-for-non-logged-in-visitors.html#gref

@Aric Watson
see my reply in comments


texts: Product attribute must be set, but is greyed out

texts:
So I am getting this error message when I try to save a configurable product. I've made the field mandatory and entered sizes on all the simple products, but now Magento (2) wants me to put in a size for the configurable product even though I can't...

Is there a way to fix this? Or will I have to have the field as optional, rather than mandatory?

This is the greyed out field it would like me to enter a size into.


texts: I have disabled a category of products that are only for Christmas, but if I use the search engine, the products appear although the category is disabled. How can I do so that the products are also hidden? Do I have to disable the products one by one?


texts: Extend Class Without Repeating All Constructor Parameters?

texts:
I often find it annoying that I have to repeat all of the dependencies after extending a class. Am I missing a trick here?

For example the Block Template class only requires that you inject and pass two parameters to the parent. Would I have to create my own context object if I wanted to do something like that?


texts: Last step of how to add a customer attribute

texts:
I am a newbie, could you please explain the last step of this tutorial? How can I retrieve it?
Adding custom attribute to Customer

Then to retrieve or edit you use:

$customer = Mage::getModel('customer/customer')->load($custid);
$customer->getCustomattribute();
$customer->setCustomattribute($yourjson);


texts: Magento2: force cron job to run as admin scope only?

texts:
We have a custom CRON command defined in the etc/di.xml file but we noticed that when it runs it fires frontend events. The job runs data export. We see that if we use the admin UI to run a standard Magento export, the scope is in the admin and no frontend events fire, but when we run our export job via CRON, frontend events fire. This causes problems as the product collection has extra filters added that we don't want.

Anyone know how to set the CRON command to only run as admin scope?


texts:
I have generated an add to cart url on the frontend, but it do not seem to work. When I click on the link, I get the "You have no items in your shopping cart." page.

I have got this add to cart url from Magento: http://test.com/magento2/checkout/cart/add/uenc/aHR0cDovL2xvY2FsaG9zdC9tYWdlbnRvMi8,/product/7/

And here is the code how I created the url:

$id = 7;

$om = \Magento\Framework\App\ObjectManager::getInstance();

$productHelper = $om->get('\Magento\Catalog\Model\Product');

$cartHelper = $om->get('\Magento\Checkout\Helper\Cart');

echo $cartHelper->getAddUrl($productHelper->load($id));


texts: core_config_data table keeps on reloading in Magento 2

texts:
To make a change, I opened core_config_data table in Magento 2 DB, but it keeps on reloading even after I disabled the new module.

What should I do ?

Now all the tables have the same issue.


texts:
I am trying to change the payment method codes for Paypal and M2E Pro

The current method codes appear as pro_hosted and m2epropayment respectively.

I have tried to create a custom module to override the files the define these strings ,however, this did not work and prevented the payment methods from rendering.

Is there a better way this can be done, maybe through the database or another angle?

I have searched google but cannot seem to find a question relating to this.


texts:
I am trying to get all product details via:

https://domain.com/index.php/rest/V1/products/:sku

but, I can't find a full product rewrite link, How to get that?


texts: Magento 2 - How to allow certain html elements in system.xml config field?

texts:
I try to add this HTML (*)to the content of a field with type text.

But the html is getting stripped. How can I allow all secure html elements but disallow unsecure elements like script?
MODULE/etc/system.xml
...
<field id="methodTitle" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
    Method title
</field>
...


texts: Check if Product is in Category A, and not in Category B

texts:
I'm hoping someone can help me with the code to achieve the following... I'm working in the tabs.phtml file which is responsible for a custom tab on my product pages.

I need a function to check whether a product is in a certain category, but not in another category. In other words, If product A is in category with ID number 73, and it is NOT in category with ID number 83, then display the following custom tab...

The code I have so far works perfectly fine to check if a product is in either of the two categories, as seen here:

$yourCatIds = array(73,83);
$productCats = $p->getAvailableInCategories();

if (count(array_intersect($yourCatIds,$productCats)) && $currentProduct!="Gift") {

 code to display a certain tab goes here...
}

So how would I expand the above If statement to check if a product is in category 73, but not in category 83? You can ignore the $currentProduct!="Gift" part, as this is use to exclude products with a certain attribute.

I also don't need the code to actually display the tab, as I have this already. I just need the If statement.

Thank you.


texts: Who can help, why the redirect does't work when the product is added to the cart?

texts:
Redirecttohome.php

namespace namespace\modul\Observer;

use Magento\Framework\Event\Observer;

class RedirectToHome implements \Magento\Framework\Event\ObserverInterface

{

    protected $_objectManager;

    protected $_storetManager;

    public function __construct(

        \Magento\Store\Model\StoreManagerInterface $storetManager

    ) {

        $this->_storetManager = $storetManager;
    }

    public function execute(Observer $observer)
    {
        $redirectUrl = $this->_storeManager->getStore()->getBaseUrl();
        $observer->getControllerAction()->getResponse()->setRedirect($redirectUrl);
    }
}

using the checkout_cart_add_product_complete event


texts: Is there any way to modify the magento php code (backend)?

texts:
In magento 2:
Where can I modify the login code?
How can I see the user that is logged in?
Where are the php files that control the backend?


texts: Make zip/postal code field required in 'Estimate Shipping and Tax' section - Shopping Cart page

texts:
Referring to the  'Estimate Shipping and Tax' section on Shopping Cart page - Magento EE 1.12.0.0, by default the 'Country', 'State/Province' and 'Zip/Postal Code' are not required.

This block is in the following template
frontend\enterprise\default\template\checkout/cart/shipping.phtml

As in the code snippet below, the 'required' (CSS) class is added only if $this->isZipCodeRequired() is set to true.

    <label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>>
<?php if ($this->isZipCodeRequired()) echo '*' ?>
<?php echo $this->__('Zip/Postal Code') ?>

My question is: where is Magento checking for these values and can they be set in Magento Admin?

Note that the field "Postal Code is Optional for the following countries" in Magento Admin may not be an answer for this as, the above code snippet doesn't depend on the country.


texts: get Custom attributes category Magento 2

texts:
after add new custom attribute, i am trying to get my custom attribute category, filter by the parent id, actually it return me a null value or empty array I used $category->getData('label_text'), $category->getLabelText(), $category->getCustomAttribute('label_text')...
Do i have to join catalog_category_varchar and eav_attribute to reach it ? If someone of you have some advices.
thanks


texts: Trying to set magento developing version on subdomain

texts:
I'm trying to set Magento on a development subdomain and update it to 1.9., but it keeps me redirecting to old domain.

This is wat I did:

I installed a clean version of 1.9 (without setting up the database) in my subdomain directory
Copied all custom files from production to development (skins, modules etc)
Duplicated the database (Magento 1.8)
Copied local.xml to development and pointed to new database
Replaced al secure en unsecure path's to http://dev.domain.com
chmod -R o+w media var
chmod o+w app/etc
Visiting dev.domain.com

For some reason, It keeps me redirecting to my old domain.


texts:
Need to add today date and 2020096 in 'number' => $consignmentNo, so it will be 201803222020096$consignmentNo

$tracks = array(
    '1'=>array(
        'carrier_code' => $carrier_code,
        'title' => $trackTitle,
        'number' => $consignmentNo
    )
);

Unable to figure out, any help?


texts: Add new packing method one rate in fedex in magento1

texts:
I need to add new packing method one rate in fedex packing serive in magento1. Any suggestion would be appreciated.

I had a reply from fedex saying
As per the Developer Resource Guide- To specify FedEx One Rate Pricing Option in the Web Service Transaction, perform the following steps:

Specify the "FEDEX_ONE_RATE" ShipmentSpecialService.
The FedEx Packaging Types that are valid/available with the One Rate pricing option are the following:

FEDEX_ENVELOPE
FEDEX_SMALL_BOX
FEDEX_MEDIUM_BOX
FEDEX_LARGE_BOX
FEDEX_EXTRA_LARGE_BOX
FEDEX_PAK
FEDEX_TUBE

Specify a U.S. origin and a U.S. destination.

Note: Intra-Hawaii shipments are not allowed for One Rate pricing.

Specify one of the following FedEx Express services:

FIRST_OVERNIGHT
PRIORITY_OVERNIGHT
STANDARD_OVERNIGHT
2_DAY
2_DAY_AM
EXPRESS_SAVER

Note: Web Services clients can request both One Rate and weight-based (non-One Rate) rates in a single RateRequest by specifying "FEDEX_ONE_RATE" as a ServiceOptionType in the RateRequest.variableOptions.


texts: Price on request back to normal 0.00 multistore

texts:
Some while ago I added this code to show "price on request" instead of 0.00

/app/design/frontend/default/yourtemplate/template/catalog/product/view/type/default.html.

<?php echo $this->getPriceHtml($_product) ?>

to:

<?php if($_product->price==0): ?>
  <?php echo 'Prijs op Aanvraag

'; ?>
<?php else: ?>
  <?php echo $this->getPriceHtml($_product) ?>
<?php endif; ?>

Now I need to change it back to normal
So I've uploaded the complete original filemap "catalog"

However: only on the mainsite the priceview is back to normal
The rest of the shops still show "price on request".
No price is showing up, even when it's not 0.00 (only in shoppingcart)

Probably there is an other file or shop setting involved.
Can someone help me to get my prices back?


texts: Create product attribute type is file in magento 2

texts:
How to create a product attribute in file type in Magento 2
our requirement is a particular product-wise Pdf upload in Magento
2 and shows a product view page in Magento 2. So How can I sort it?
please give me suggestions.
Thank you.


texts: How to create new container inside  tag in magento 2?

texts:
I am working with magento 2 layout containers. I need to create a container inside  and below
 .

My HTML should be like below,

If anyone come across this case, kindly help me

Thanks


texts: Plugin to add functionality to sendEmailConfirmation (after) does not work

texts:
We are trying to add a functionality to send an additional email to the admin when a user has registered an account.

The core code we want to modify is located at Magento\Customer\Model\AccountManagement.php class: sendEmailConfirmation.

The code we currently believe should work:

di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Customer\Model\AccountManagement">
    <plugin name="EmailAanpassing" type="Sprite\EmailAanpassing\Customer\Model\After" sortOrder="10" disabled="false" />
</type>
</config>

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="Sprite_EmailAanpassing" setup_version="1.0.0">
  <sequence>
   <module name="Magento_Customer"/>
  </sequence>
 </module>
</config>

Sprite/EmailAanpassing/Customer/Model/After.php

<?php
namespace Sprite\EmailAanpassing\Customer\Model;

use \Magento\Customer\Model\AccountManagement;

class After extends \Magento\Customer\Model\AccountManagement
{

protected function afterSendEmailConfirmation()//Magento\Customer\Api\Data\CustomerInterface $customer, $redirectUrl)//)//SomeType $iets)
{
       // sendmail test
       mail("email@domain.com","New Registration",'Hello World!');
}
}
?>

When adding to code directly to the core it works fine. The module's basic files are created via Mage2gen.

Magento ver. 2.1.5


texts: Syntax error or access violation: 1118 Row size too large Reindexing

texts:
I am facing : SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs, query was: CREATE TEMPORARY TABLE catalog_product_entity_int_tmp_indexer_value

while trying to reindex. I can't update mysql configurations as my site is on shared hosting. Let me know what I am missing or what can do to solve this issue?
How can I update the table structure and which table I need to change the fields.


texts: How to sort Response alphabetically in magento 1.9?

texts:
Here I wish to sort my response alphabetical to the college names :

   if($collegeid!=null)
                {
                        $res['status']  = true;
                        $res['message'] = "High Priority Students";
                        $res['hpstu']   = $customerData;
                }else
                {
                    $collegeData = array();
                    $i = 0;
                    foreach ($data as $key => $value)
                    {
                        $college =Mage::getModel("manager/campus")->load($key);
                        $collegeData[$i]['id'] =$college->getId();
                        $collegeData[$i]['college'] = $college->getName();
                        $collegeData[$i]['hpstudents'] = $value;
                        $i++;
                    }
                }

               $res['page_size'] = $HighPriCollection->getLastPageNumber();
               $res['college'] = sort($collegeData);
               $res['total'] = sizeof($HighPriCollection);

            }

Response is coming :

{"page_size":1,"college":[{"id":"77","college":"C. University - Linken Road Campus","hpstudents":17},{"id":"537","college":"ASC Engnierring College","hpstudents":5}],"total":22}

Desired :
 [{"id":"537","college":"ASC Engnierring College","hpstudents":5},{"id":"77","college":"C. University - Linken Road Campus","hpstudents":17}]


texts: Change category meta title and meta discription

texts:
A lot of different people filled the the category's of magento, at the moment we have a lot of difference phrases in the meta discription of meta title.

I have written a script that update the category, but none of it worked.

Option 1:

            $_category->setMetaTitle($general['meta_title']);
            $_category->setMetaDescription($general['meta_description']);

Option 2:

        $_category->setData(array(
            'meta_title'    => $general['meta_title'],
            'meta_discription'  => $general['meta_description']
        ));

Ofcourse started and end with :

      $_category = Mage::getModel('catalog/category')->load($_category->getId());
       $_category->save();

Any ideas how i can update a category programmatically ?

As requested complete script:

<?php
 ini_set("memory_limit","2048M");
 set_time_limit(0);
 require 'app/Mage.php';
Mage::app()->setCurrentStore(8);

$_helper = Mage::helper('catalog/category');
$_categories = $_helper->getStoreCategories();
$currentCategory = Mage::registry('current_category');

 if (count($_categories) > 0):
foreach($_categories as $_category):
echo $_category->getName();
    echo "\n";

    $general['meta_title'] = trim($_category->getName()).' kopen? Bestel online bij Wortel'; //Page title
                    $general['meta_description'] = "Koop '.trim($_category->getName()).' bij Wortel. .
                            Het juiste advies voor '.trim($_category->getName()).'. Wortel maakt blij.";

                $_category = Mage::getModel('catalog/category')->load($_category->getId());

                $_category->setMetaTitle($general['meta_title']);
                $_category->setMetaDescription($general['meta_description']);
        /*
                 $_category->setData(array(
                    'meta_title'    => $general['meta_title'],
                    'meta_discription'  => $general['meta_description']
                ));
*/
               $_category->save();

            // getMetaTitle

            $check = Mage::getModel('catalog/category')->load($_category->getId())->getMetaTitle();
        echo $check;
        echo "\n";

        endforeach;
 endif;


texts:
I'm a complete newbie to magento so excuse me if this is a silly question.
I need to add some code for a toggle function so something like this :

<script type="text/javascript">
    $("#Category1").click(function(){
        $(".moreCategory1").toggle();
    });
</script>

I need to add this to a static block so I tried adding it just at the end of the static block as usually I'd add it to the end of the body or the footer, but it doesn't work. So where would I need to put the jquery code for a static block?