texts: Overriding server-side validation rule from positive number to number in admin page

texts:
I am trying to change a validation rule from positive number to any number (so it allows negative numbers too) for the following field:

[Admin Area] -> Promotions -> Catalogue Price Rules -> Add New Rule -> Actions -> Discount Amount

I have successfully changed the client-side validation rule but am struggling with the server-side validation rule.

Here's where I have got to:

app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php

Mage_Adminhtml_Promo_CatalogController::saveAction

That function seems to fetch a rule_id from $_GET or $_POST and sends it to a load() method on the catalog/rule model, and then validateData() is called on that model with the data from $_POST.

I have searched all files for discount_amount but didn't seem to find any validation rules.


texts:
I have been playing around with bundled products and was wondering if you guys could help with something. In this situation the base product is a phone and the bundle options are different phone plans.

I would like to create a bundled product with these features:

1) Product with no bundle option selected displays one price (e.g. buying a phone without a plan will cost you full retail price)

2) Adding a bundle option will reduce the base price of the item, often for promotional purposes (E.g. the phone is $60 by itself, but if you buy it with a plan, the phone is free - or $1 if needed).

3) This is a nice-to-have, not essential. I would like to be able to specify precisely which bundle options (plans) will drop the price of the base product (phone). It would also be great if I could even specify how much ($ or %) each bundle option drops the price of the base product.

Please let me know if this is possible! If you guys have any extension suggestions that might be able to do this, that's great!

Thanks!


texts: M2/ How to fix "Incompatible argument type: Required type: string. Actual type ..."

texts:
A compilation was started.

  Interception cache generation... 6/7 [========================>---]
  85% 1 min 404.0 MiB Errors during compilation:
    SkyFox\Supplier\UI\DataProvider\Supplier\DataProvider

  Incompatible argument type: Required type: string.

  Actual type:\SkyFox\Supplier\UI\DataProvider\Supplier\name;

  File: /var/www/html/sky.local/app/code/SkyFox/Supplier/UI/DataProvider/Supplier/DataProvider.php

  Total Errors Count: 1
                                            [Magento\Framework\Validator\Exception]
  Error during compilation

  setup:di:compile

This's my code:

namespace SkyFox\Supplier\Model\Company;

use Magento\Framework\App\Request\DataPersistorInterface;

class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider {

    /**
     * @var \SkyFox\Supplier\Model\ResourceModel\Supplier\Collection
     */
    protected $collection;

    /**
     * @var DataPersistorInterface
     */
    protected $dataPersistor;

    /**
     * @var array
     */
    protected $loadedData;

    /**
     * @var \Magento\Framework\DB\Adapter\AdapterInterface
     */
    protected $connection;

    /**
     * DataProvider constructor.
     * @param $name
     * @param $primaryFieldName
     * @param $requestFieldName
     * @param \SkyFox\Supplier\Model\ResourceModel\Supplier\CollectionFactory $collectionFactory
     * @param DataPersistorInterface $dataPersistor
     * @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection
     * @param array $meta
     * @param array $data
     */
    public function __construct(
        $name,
        $primaryFieldName,
        $requestFieldName,
        \SkyFox\Supplier\Model\ResourceModel\Supplier\CollectionFactory $collectionFactory,
        DataPersistorInterface $dataPersistor,
        \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
        array $meta = [],
        array $data = []
    ) {
        $this->collection = $collectionFactory->create();
        $this->dataPersistor = $dataPersistor;
        $this->connection = $connection;
        parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
    }

    /**
     * @return array
     */
    public function getData()
    {
        if (isset($this->loadedData)) {
            return $this->loadedData;
        }
        $items = $this->collection->getItems();

        foreach ($items as $supplier) {
            $this->loadedData[$supplier->getData('company_id')] = $supplier->getData();
        }

        $data = $this->dataPersistor->get('supplier');
        if (!empty($data)) {
            $supplier = $this->collection->getNewEmptyItem();
            $supplier->setData($data);
            $this->loadedData[$supplier->getData('company_id')] = $supplier->getData();
            $this->dataPersistor->clear('supplier');
        }

        return $this->loadedData;
    }
}

Thanks all


texts: The web setup wizard does not show up. Instead ..../app/Mage.php not found error occurs on Magento 1.14 install

texts:
..../app/Mage.php not found

I am trying to install Magento 1.14 sample data on Hyper V machine with CentOS. After all the necessary steps are done, the web setup wizard does not open. Instead, I get ../app/Mage.php not found error.


texts:
I want to change the title of the review page.

Currently it is display as "Productname | Websitename".
But I want to change it in "Reviews of Productname | Websitename"

How can I achieve that?

Because I cannot change the XML file, because I need to load the title dynamic because of the productname.


texts: How to change the cart subtotal value using observer in magento 2?

texts:
I want to change the cart subtotal calculation in magento 2

but i try this code but not changing

 $quoteQty = $quote->getQuoteQty();
 $priceOne=$priceOne/$quoteQty;
 $quoteItem->setCustomPrice($priceOne);

 $quoteItem->setOriginalCustomPrice($priceOne);
 quoteItem->setRowTotal(($priceOne/$quoteQty) * $quoteQty); //Here i edited the Cart values

setRowTotal()

method not working how I change the cart subtotal value and what is the use of setRowTotal() ??


texts: I have created a custom column to filter in sales order and the filters have been move to the bottom of the page. How could I move to the top?


texts: customize controller using a plugin doesn't work

texts:
I want to customize the catalog product view controller using a plugin the following plugin.
In app/etc/di.xml i have added:

<?xml version="1.0" encoding="utf-8"?>
<type name="Magento\Catalog\Controller\Product\View">
     <plugin name="product-view-controller-plugin" type="MyNamespace\MyModule\Controller\Product\View" sortOrder="10"/>
</type>

Here is View Class:

<?php

namespace MyNamespace\MyModule\Controller\Product;
class View {
public function beforeExecute() {

echo "BEFORE<BR>"; exit;

}

public function afterExecute(\Magento\Catalog\Controller\Product\View $controller, $result) { echo "AFTER ...."; exit; }

}

when i go to http://mymagento-installation.com/catalog/product/view/id/125 nothing is happening ... can you help me to know what is missing?


texts: Issue with IntlDateFormatter breaking page load

texts:
Across multiple pages on my Magento installation I'm getting errors like this:

So it seems to be breaking the page load and echoing out:

object(IntlDateFormatter)#2176 (0) { }

I'm running 7.1, have php7.1-intl installed and showing up in phpinfo. The date.timezone setting is set to UTC.

Nothing is coming up in my php or nginx log and nothing seems to be in any of the Magento logs.

It seems to be happening on more and more pages, currently it's showing up on the admin index, a single attribute when trying to edit and the accounts page of the M2E Pro extension.

Any help is greatly appreciated as I'm at a total loss on this one.


texts: Magento 2: Layout override sequence custom theme vs extensions

texts:
I created a custom storefront theme and override the catalog_product_view.xml file in my custom theme. Below is the path.

app\design\frontend\Akhilg\custom\Magento_Catalog\layout\catalog_product_view.xml

It's working as expected.

Now let's say I have downloaded a third party extension (EXTENSION1) which using set template for the reference product.info.addtocart in the same layout file i.e catalog_product_view.xml. like below

<action method="setTemplate">
    <argument name="template" xsi:type="string">Vendername_Modulename::product/view/addtocart.phtml</argument>
</action>

also uses sequence definition in their module.xml

<sequence>
    <module name="Magento_Catalog"/>
</sequence>

Now let's say there is one more third party extension (EXTENSION2) doing the same.

I have two questions

1. How Magento decide priority between Custom Theme, Extension1 Extension2.

Is there any naming convention?

1. How I make all functionality(Changes in custom theme, Extension1 and Extension2) works together.

Do I need to make a single file and merge all changes in one file?


texts: how do get all parent of curent category in magento2?

texts:
ex: I have category list as follows:
    Men--top---shoes--bottomI have current_category is shoes. so how to add class to this and all parent of this.


texts: Why does core code use ::class to get class name as string?

texts:
Many places in the core code that need to use the name of a class as a string will use it as \Magento\Module\Classname::class rather than simply '\Magento\Module\Classname'.

The benefit is clear if you've imported the class with use, in which case it is a shortcut to repeating the full namespace, but in many instances ::class is used even with the fully-qualified name. This seems to be most common in test classes, but it's not only true there.

What is the reason for this pattern?

Edit: Franck Garnier pointed out in an earlier version of answer that this is required by the coding standards, but that just pushes the question back a level. Why do the standards require this (particularly in contrast to an absolute class name string literal)?


texts: Remove Price from New Products block on Homepage

texts:
Hi I wanted to see if anyone knew how to remove(Hide) the price from Magento's main home page under the new products section block. I was able to remove the price from the list/grid thanks to some other post suggestions. Not Sure where else to look for the new products section on the home page.

I've tried commenting out under template/catalog/product/new.phtml

<?php echo $this->getPriceHtml($_product, true, '-new') ?>

But that didn't do anything.
CMS Page homepage layout

<reference name="content">
    <block type="core/template" template="catalog/msrp/popup.phtml" name="product.tooltip"></block>
    <block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms.wrapper">
        <action method="setColumnCount"><columns>4</columns></action>
        <action method="setProductsCount"><count>8</count></action>
        <action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
    </block>
</reference>

Thanks for any help.
References.
https://stackoverflow.com/questions/4510528/magento-remove-price-phtml-from-the-category-list-of-products


texts: How can i change Attribute FIlter as a Drop Down Instead of list

texts:
I need to change my attribute selection as a drop down instead list. User can manually click what they are need to be applied  filter of products.

Attribute List :


texts: 2.3.3: Moving to an updated version of a website

texts: I need to move from my old version of my site to my new one. I have imported all the orders although I did this manually as the products structures completely changed. I would like to know a reliable way to change the auto increment of all the tables: orders, invoices, transactions etc so that when a customer phones up they don't have an order number someone else once had.


texts: Magento dataflow profile - import products error - Please set available and/or protected paths list(s) before validation.

texts:
I tried to save the dataflow profile import products but i can't. I just receive the error "Please set available and/or protected paths list(s) before validation"

After some code investigation i can find this error is because of the following array of import and export file paths are missing are missing

Array ( [available] => Array ( [export_xml] => var/export//.xml [export_csv] => var/export//.csv [import_xml] => var/import//.xml [import_csv] => var/import//.csv )

The file paths are saved in Mage ImportExport config.xml as follows

<default>
<general>
<file>
<importexport_local_valid_paths>
<available>
<export_xml>var/export//.xml</export_xml>
<export_csv>var/export//.csv</export_csv>
<import_xml>var/import//.xml</import_xml>
<import_csv>var/import//.csv</import_csv>
</available>
</importexport_local_valid_paths>
</file>
</general>
</default>

Manual Trace

Mage_Dataflow_Model_Profile->_beforeSave()

Mage_ImportExport_Helper_Data -> getLocalValidPaths()

Basically the following method doesn't return any paths. Not sure why its so. Kindly let me know why this weird error happens and help me if you have some time for this.

/**
 * Get valid path masks to files for importing/exporting
 *
 * @return array
 */
public function getLocalValidPaths()
{
    $paths = Mage::getStoreConfig(self::XML_PATH_EXPORT_LOCAL_VALID_PATH);
    return $paths;
}

Magento Version : 1.6.1.0. C.E. Single locale and store.

Thanks for your time !


texts:
Some products are duplicate in my homepage. Only name and descriptions are same. No image is showing for the duplicate record. And when I move cursor over it then the link redirects me to 404 Page . In the backend(admin) when I search that duplicate product by its link(name) then I found nothing.
For ex:- In the backend a product has following...

Product name:- Powerlock 3m/10ft 0-523
id :- 311
SKU :- STA033523
Website :- abc.com

Product name:- Powerlock 3m/10ft 0-523
id :- 12
SKU :- STA033523 Amazon
Website :- abc.com

In frontend :-

$storeId = Mage::app()->getStore()->getId();
$_productCollection=Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToSelect('*')
    ->addAttributeToFilter('is_featured', 1)
    ->addAttributeToFilter('status', 1)
    ->joinField('value','catalog_product_entity_tier_price','value', 'entity_id=entity_id','{{table}}.website_id='.$storeId, 'left')
    ->setPageSize(9)
    ->setStoreId($storeId)
    ->addStoreFilter($storeId);
<?php foreach ($_productCollection as $_product): ?>
        <a href="<?php echo $_product->getProductUrl(); ?>" title="<?php echo $_productNameStripped; ?>">
            <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(180); ?>" alt="<?php echo $_productNameStripped; ?>" />

<?php endforeach; ?>

It was good . But suddenly today it shows duplicate.No changes has done.

I can't understand how to solve this issue ?
Kindly suggest how to deal with it ?
Thanks.


texts: CRITICAL: Broken reference: No element found with ID 'content_schedule_block0'

texts:
I got this error on product details page.

Added product using CSV import.

  1 exception(s): Exception  0 (OutOfBoundsException): No element found
  with ID 'content_schedule_block0'.

  Exception  0 (OutOfBoundsException): No element found with ID
  'content_schedule_block0'.  0


texts: Magento admin CMS page not working throw exception

texts:
For some reason the admin CMS page is not working , return "Bookmark with id "0" does not exist.". I am able to access all other admin panel , its just the CMS link return error. I tried re-deploying static content, but no luck.

1 exception(s):
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): Bookmark with id "0" does not exist.


texts: Magento 2.3.4 fresh install getting ReflectionException error on windows xampp

texts:
How to solve the following error,
Permission CMD not working in windows:
> chmod -R 777 var/

Fatal error: Uncaught ReflectionException: Class
Magento\Framework\App\ResourceConnection\Proxy does not exist in
C:\xampp\htdocs\magento\vendor\magento\framework\Code\Reader\ClassReader.php:26
Stack trace: #0
C:\xampp\htdocs\magento\vendor\magento\framework\Code\Reader\ClassReader.php(26):
ReflectionClass->__construct('Magento\Framewo...') #1
C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Definition\Runtime.php(54):
Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...')
#2 C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(48):
Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...')
#3 C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\ObjectManager.php(70):
Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...')
#4 C:\xampp\htdocs\magento\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(167):
Magento\Framework\ObjectManager\ObjectManager->get in
C:\xampp\htdocs\magento\vendor\magento\framework\Code\Reader\ClassReader.php
on line 26


texts:
I have try to install magento CE Version 1.9.0.1.But when i am trying   to install magento  from browser.it show permission issue :

Path "/var/www/html/magento/app/etc" must be writable.
Path "/var/www/html/magento/media" must be writable.
Path "/var/www/html/magento/media/downloadable" must be writable.
Path "/var/www/html/magento/media/xmlconnect" must be writable.
Path "/var/www/html/magento/media/xmlconnect/system" must be writable.
Path "/var/www/html/magento/media/xmlconnect/system/ok.gif" must be writable.
Path "/var/www/html/magento/media/xmlconnect/custom" must be writable.
Path "/var/www/html/magento/media/xmlconnect/custom/ok.gif" must be writable.
Path "/var/www/html/magento/media/xmlconnect/original" must be writable.
Path "/var/www/html/magento/media/xmlconnect/original/ok.gif" must be writable.
Path "/var/www/html/magento/media/dhl" must be writable.
Path "/var/www/html/magento/media/dhl/logo.jpg" must be writable.
Path "/var/www/html/magento/media/customer" must be writable.

I am using Fedora my Os System and was give permission 777 to /var/www/html

using chmod 777 -R /var/www/html and show same issue.
Can anyone help me ??


texts: sort products by newest, discount, most sold, reviews" in products list page

texts:
On the products list page, we can see sort by "Position, name, price" as in default Magento.

How to sort by

newest products (uploaded recently)
Discount (highest discount products first)
Best seller (most sold products first)
Reviews (high rated products display first)

Please let me know if you need any clarification...


texts: Magento 2.2: Want to add a category tree like structure field in admin custom module

texts:
I have created 2 custom admin module, I want to add a category like tree structure in my module 2, that will take values from module 1.

Or can create multiselect for show as below senario:

┳ RootName
├─┬ SubRoot1
│ ├── Child1
│ ├── Child2
│ └── Child3
└─┬ SubRoot2
  ├── Child1
  └── Child2

My form is created via Ui Component.


texts: Magento Password encription and decryption

texts:
We have 2 instances of Magento running on 2 servers.

Whenever a User is created on 1st instance, we need to replicate the same user on other instance.

Replication process works fine, however the newly created user on instance 2 is not able to login because the password doesn’t work. This is happening due to the security salt which is different on both the server.

Is there a way were we get the password during account creation and we can use the same during the data replication by decryption?

Process Used: We created some API to send the post data to the other server.Other server consumed the API and created a customer.


texts: M 2.3.1: Imprint variables are not showing up in E-Mail templates

texts:
I have the following problem.

I have populated the bank and imprint data as per Configuration -> General -> Imprint for all my store views under Magento 2.3.1

Now I am populating my e-mail template, via "Insert Variable" for example with

{{config path="general/imprint/bank_account"}}

{{config path="general/imprint/bank_code_number"}}

{{config path="general/imprint/swift"}}

{{config path="general/imprint/iban"}}

but whatever I do, the data is not showing in my e-mail preview.

However, when I use the variables

{{config path="trans_email/ident_general/name"}}

{{config path="web/unsecure/base_url"}}

all is working fine and showing in my template.

Does anyone have a hint, why the data from imprint (I have filled data under Imprint in Default Config, Main Website and all Store Views) is not showing up at all?

Best regards

Ben


texts: Magento 2 : Get Custom Attribute Value of Product

texts:
I'm trying to get custom attribut from my product.
I tried various methods like below, but non of them worked.

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
            /** @var \Magento\Catalog\Model\Product $product */
            $product = $objectManager->get('Magento\Catalog\Model\Product')->load($item->getId());
            $attr = $product->getAttributes();
            $test1 = $product->getData('metal_pads');
            $test2 = $product->getCustomAttribute('metal_pads');
            $test3 = $product->getResource()->getAttribute('metal_pads');
            $test4 = $ddd->getFrontend()->getValue($product);

I'm able to get the Interceptor, but not value.

* edit *
I'm using a default value which is also not visible


texts:
We have a Magento install running on www.wondercide.com and it experiences random JS issues on the pages. Sometimes it works perfectly sometimes it's a mess. The minicart won't work, can't add to cart, etc. Console errors are different every time. Seems to suggest that the JS is loading out of order.

But here is the big kicker. We are running multi-site, and the other site is using the same template, and it doesn't have the issue. We disabled all modules and still the issue persists. We reinstalled the whole system identically on www3.wondercide.com and it works perfectly over there. It literally only affects the website if it's running on www.wondercide.com. It makes no sense and it's been driving us bonkers for 4 days. Any help or advice would be appreciated.


texts: Virtual product order status after issuing invoice

texts:
We are selling workshops/seminars on our eshop as virtual products. If the customer purchases the workshop on its own and selects Paypal/Credit card payment, the order status immediately goes to "COMPLETED". If he selects bank transfer, the status is "PROCESSING" but after issuing invoice (we do this in bulk) it changes to "COMPLETED" as well.

This is a huge problem for us because we lose track of the order in the back end (we need to issue invoice through our external software). Is there a solution for the virtual product orders to follow the same order statuses as simple products?

Thank you ...


texts: Magento2.3.1 Redirecting to Cart Page after payment is successful

texts:
I have issue with payment , When i make payment with razorpay gateway and after successful payment it is redirecting back to cart page instead of thank you page.
Can anyone found solution for this. I referred few stackoverflow questions and tried
Magento\Checkout\Controller\Onepage

Commented out the following line
$session->clearQuote();

After that as well i am unable to place order with razorpay


texts: how to add shipping cost magento report?

texts:
i have followed
 http://inchoo.net/magento/how-to-create-a-custom-grid-from-scratch/comment-page-1/#comment-429849
for creating report for magento 1.8 it was OK
now i want to add new column for "Shipping Cost"

please hrlp

Thanks


texts: Product page goes into infinite loop after reindexing

texts:
Every time I reindex using command line:

php shell/indexer.php reindexall

And try to load the product page, it goes into infinite redirect loop.
For example in firefox, the browser results as:

But all the other pages: Homepage, Product listing(category) page etc. just works fine.

But one strange thing is, when you go through each category in backend to resave it and try to re-load the product page, it works fine.

I am trying to debug this strange issue. One thing I have noticed in product listing (category page) is: body class is empty for css selector:
categorypath-[empty] category-[empty]
After resaving that category, then only body class shows the proper selector value for categorypath- & category-

Has anyone faced this kind of issue? Any idea/suggestions on the fixings?

Note: I am using Magento EE 1.13 & flat catalog is turned on. And we have updated the category & product url_key attribute from global to store view (to have different urls for different stores):

UPDATE catalog_eav_attribute SET is_global=0 WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code IN('url_key'))

[Edit]
After debugging, it is found that catalog_category_flat_store_[store_id] table's url_key field is NULL after reindexing. Also, catalog_category_entity_varchar has no entries for url_key for those categories for which product are not loading.


texts: How to add image slider to other parts of the homepage?

texts:
We have an image slider on out website homepage, and we want to add the same slider to other parts. This would be good to give visitors different banners to look at. I am having trouble editing it on the magento static block.

I have made a graphical example attached so you can get an idea of what we are trying to do.

Any feedback/help would be great, I am having a lot of trouble with such a small task as I am new to web coding.

Thanks in advance,

Brandon.


texts: Tax subtotal excluding from sale price although settings are not

texts:
I have running Magento 1.9.3.7 on PHP5

for some weird reason, tax is acting weird on checkout and cart, first prices are displaying as normal, then on the subtotal, tax is deducted from selling price, and then it adds taxes again, so the total amount is finally the original selling price, instead of price + tax.

Settings seems to be right, prices are supposed to be excluding taxes, i attached screens of both, checkout and settings, i've read somewhere that there is a bug, but with PHP7, and i have 5.5


texts: Magento display empty parts in Category page when click on toolbar

texts:
I am currently working on Magento and installed one custom theme Porto.

When I clicked on any option of toolbar at that time all products load using ajax but display some empty part.

Here blank place come when click on pagination using Ajax Toolbar.
Any thing wrong ?


texts: Magento 2 run setup:di:compile command on a shared hosting with limited memory_limit (max 512M)

texts:
I am trying to execute php bin/magento setup:di:compile after enabling a custom module created on my Magento2 store. However, I am using a shared hosting which allows me to set memory_limit upto 512 MB.

Due to this compile command fails. How to run Magento 2 commands successfully on shared hosting with limited memory_limit?

[ym@webcloud1 testbed]$ php bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/7 [====>-----------------------]  14% < 1 sec 54.0 MiB
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

Suggestions much appreciated.


texts: Magento sales order grid - add shipping and tax

texts:
So I wanted to change the columns in the sales - order - grid

I created my own version of the Grid.php (located at app\code\local\Mage\Adminhtml\Block\Sales\Order\Grid.php)

in _prepareCollection() I added

$collection->getSelect()->join(
    'sales_flat_order',
    'main_table.entity_id = sales_flat_order.order_id',
    array(Shipping_column)
);

(not correct shipping column - this just an example)

and also added the column to _prepareColumns()

Logged in to Magento admin and I have a new column - no problem

Then I wanted to add the tax from sales_flat_order

Again I added in _prepareCollection() and _prepareColumns()

$collection->getSelect()->join(
    'sales_flat_order',
    'main_table.entity_id = sales_flat_order.order_id',
    array(tax_column)
);

Logged into Magento admin and page went crashing - never loaded and ended in temporary error (502) - both backend and frontend. Had to call support to restart.

What did I do wrong?


texts: checkout_submit_all_after Observer only triggered from one store view?

texts:
Afternoon all,

Run into a curious problem, I'm setting up an observer that will be triggered every time an order is made. Code is below;

Config XML:

<?xml version="1.0"?>
<config>
  <global>
    <models>
        <orderemail>
            <class>Mod_Orderemail_Model</class>
        </orderemail>
    </models>
    <events>
        <checkout_submit_all_after>
            <observers>
                <anything>
                    <type>singleton</type>
                    <class>orderemail/observer</class>
                    <method>sendEmail</method>
                </anything>
            </observers>
        </checkout_submit_all_after>
    </events>
  </global>
</config>

Model:

<?php
class Mod_Orderemail_Model_Observer
{
    public function sendEmail($observer)
    {
        mail('me@mydomain.co.uk', "Order Submitted", "Mod Orderemail Observer Submitted");
    }
}

The issue I'm having is that the observer is only triggered when orders are submitted from one particular store view, and typically this is the store view I'm not interested in detecting orders from!

Edit: I omitted to say I also use OneStepCheckout, although (even though I need to check again) I'm sure triggers this observer. Interestingly the working Store View doesn't use OSC, just the standard One Page Checkout

Am I missing something stupid here? Mage version is (unfortunately) 1.4.1.1

Thanks,


texts: products csv import categories not updated in magento2

texts:
I'm importing product sku and category ids using product import in magento2.
but not working please anyone help me.

eg: sku,category_ids
test_123,2,5,12

thanks


texts:
I've created programmaticaly a Widget. Then I've created the widget in the backend (widget 2 => Marketing).
Based on my user attribute, the widget should switch between 2 and 3 (which I have not created yet).
On my homepage, how to I load the widget based on this attribute ?
See my class :
use Magento\Customer\Model\Session;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Widget\Block\BlockInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Widget\Model\WidgetFactory;
use Portail\Customer\Helper\CustomerUserData;

class Marketing extends Template implements BlockInterface
{

    protected $_template = "widget/marketing.phtml";
    private $categoryRepository;
    private $customerSession;
    private $customerHelper;
    private $widgetCollection;

    public function __construct(
        Context $context,
        \Magento\Catalog\Model\CategoryRepository $categoryRepository,
        Session $customerSession,
        WidgetFactory $widgetFactory,
        array $data = []
    )
    {
        $this->categoryRepository = $categoryRepository;
        $this->customerSession = $customerSession;
        $this->customerHelper = new CustomerUserData();
        $this->widgetCollection = $widgetFactory;
        parent::__construct($context, $data);
    }

    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate($this->_template);
    }

    /**
     * @return array
     */
    public function getAllData()
    {
        $widget = $this->getWidget();
        $data = [];
        $data['marketing'] = [
            'marketing_description' => $this->getData('marketing_description'),
            'logo_marketing' => $this->getData('logo_marketing'),
        ];
        $data['discover'] = [
            'image_bg_marketing' => $this->getData('image_bg_marketing'),
            'title' => $this->getData('title'),
            'content' => $this->getData('content'),
            'link' => $this->getData('link'),
        ];
        return $data;
    }

    public function getWidget() {
        $type = "Portail\Widget\Block\Widget\Marketing";
        $filters = ['type' => "$type", 'select_enterprise' => "XXX"];
        return $this->widgetCollection->create()->getWidgetsArray($filters);
    }
}

This is my widget layout :
<?php /** @var $block \Portail\Widget\Block\Widget\Marketing */ ?>
<?php $data = $block->getAllData();
?>

                marketing

                données

and custom_home.xml
<container name="actuPortail" label="actuPortail" htmlTag="div" htmlId="actuPortail" before="containerRecette" htmlClass="container">
    <block class="Magento\Framework\View\Element\Template" template="Portail_Theme::marketing.phtml"/>
</container>


texts: How to set cms block to category in Magento 2 programmatically?

texts: I would like to add CMS block to a category programmatically, how to achieve it?


texts:
We are currently working with a requirement that first response from the web server must come in under 200ms in the UK. Currently under 2 dedicated web servers under load balancer and 1 db server, we are coming in at 800ms.

The site at the moment has less than 5 customers, 2 products, 4 categories, there is no frontend to the site at the moment, it is style free and image free.

It is also being run on nginx with Varnish.

Can anyone give me any advice on web server setups? Why is ours coming in slowly? What can you recommend to optimize this? Need to get 400% quicker!


texts: Deadlock error during adding products to cart Magento 2

texts:
We have upgraded the Magento website from Magento V2.1.4 to Magento V2.3.3-p1 on End of the March and running well. Recently having problem with Deadlock see error below.

LATEST DETECTED DEADLOCK

2020-08-12 16:13:04 7fe6ac13b700
*** (1) TRANSACTION:
TRANSACTION 3177263110, ACTIVE 1 sec inserting mysql tables in use 2,
locked 2 LOCK WAIT 51 lock struct(s), heap size 6544, 112 row lock(s),
undo log entries 143 MySQL thread id 3280994, OS thread handle
0x7fe6d17f4700, query id 499582068 127.0.0.1 xxxxxx update INSERT INTO
catalog_product_link (product_id, linked_product_id,
link_type_id) VALUES ('754', '788', '4')
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 2010616 page no 8 n bits 320 index PRIMARY of
table xxxxxx.catalog_product_entity trx id 3177263110 lock mode S
locks rec but not gap waiting
*** (2) TRANSACTION:
TRANSACTION 3177263497, ACTIVE 1 sec inserting, thread declared inside
InnoDB 900 mysql tables in use 2, locked 2
52 lock struct(s), heap size 6544, 147 row lock(s), undo log entries
167 MySQL thread id 3279882, OS thread handle 0x7fe6ac13b700, query id
499582576 127.0.0.1 xxxxxx update INSERT INTO catalog_product_link
(product_id, linked_product_id, link_type_id) VALUES ('788',
'754', '4')
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 2010616 page no 8 n bits 320 index PRIMARY of
table xxxxxx.catalog_product_entity trx id 3177263497 lock_mode X
locks rec but not gap
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 2010616 page no 8 n bits 320 index PRIMARY of
table xxxxxx.catalog_product_entity trx id 3177263497 lock mode S
locks rec but not gap waiting
*** WE ROLL BACK TRANSACTION (1)

Any suggestion will appreciate.


texts:
I have magento and joomla sites same saver.I need to implement single sign in for both sites.any user login via joomla can access magento as log in user and.any user login via magento can access joomla site as logged  in user  .

i haven't any idea about that.


texts: Magento - get uploaded file name in form upload field

texts:
I successfully create a module that upload file to the directory and save the path to the database.

My problem is that, when I tried to update the uploaded file, the form upload field and button don't display the name of the uploaded file. To make it short, the upload field value was empty, supposed to be it was populated coming from the database. Also if I tried to select another file and save it, the path was save on the database and the file was uploaded in the directory, however the problem was the old file was not deleted or updated.

I tried to view class Varien_Data_Form_Element_File and saw that it has

public function __construct($attributes=array())
{
    parent::__construct($attributes);
    $this->setType('file');
    $this->setExtType('file');
}

only this function. Unlike in the class Varien_Data_Form_Element_Image that has different functions that adds select box and input hidden fields.

Question:

How do I update the uploaded file?
How do I Delete the uploaded file?

This is my form fields

$fieldset->addField('title', 'text', array(
    'label' => Mage::helper('pmadmin')->__('Matrix Title'),
    'class' => 'required-entry',
    'required' => true,
    'name' => 'title',
));

$fieldset->addField('file_path', 'file', array(
    'label' => Mage::helper('pmadmin')->__('File'),
    'value'  => '',
    'class' => 'required-entry',
    'required' => true,
    'disabled' => false,
    'readonly' => true,
    'name' => 'file_path',

));

$fieldset->addField('short_description', 'text', array(
    'label' => Mage::helper('pmadmin')->__('Short Description'),
    'class' => 'required-entry',
    'required' => true,
    'name' => 'short_description',
));

Note:

I am able to successfully update other form fields and the file path from the records but not the file uploaded.

UPDATE:

Grid page:

Edit page:


texts: how to update Select Attribute (add more option ) via Magento-upgrade-script

texts:
i need some custom attribute on every category so i create a module and in mysql4-install-0.0.1.php i write :

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

$tagline  = array(
    'type'     => 'text',
    'label'    => 'tag-line',
    'input'    => 'text',
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'           => true,
    'required'          => false,
    'user_defined'      => false,
    'default'           => "",
    'group'         => "General Information",
    'visible_on_front'  => 1
);

$visible  = array(
    'type'     => 'int',
    'label'    => 'is visible on homepage',
    'input'    => 'select',
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'           => true,
    'required'          => false,
    'user_defined'      => false,
    'default'           => 0,
    'group' => "General Information",
    'visible_on_front'  => 1,
    'source' => 'eav/entity_attribute_source_boolean'
);

$installer->addAttribute('catalog_category', 'tagline', $tagline);
$installer->addAttribute('catalog_category', 'on_index_page', $visible);

$installer->endSetup();

setup work as expected and eveything is good, now i want to update the option of the on_index_page attribute so i create an other file name mysql4-upgrade-0.0.1-0.0.2.php in my setup folder, change the version form the config file and write this code :

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

file_put_contents("filename.txt", "data5"); // checking if file ever executed
$options = array ( 'value' => array(
                            '0' => array('no'),
                            '1' => array('Brands'),
                            '2' => array('Fruits'),
                            )
            );

//$installer->updateAttribute('catalog_category','on_index_page','source','Hsn_Cat/Cat');
$installer->updateAttribute('catalog_category','on_index_page', 'option' , $options);

$installer->endSetup();

Magento run this file , as i do get the "filename.txt", but the option remain the same.

information
 1. the setup file is properly configured,and it execute without error.

while creating the attribute i use the 'source' =>
'eav/entity_attribute_source_boolean' so i also test to undo that
by doing this
$installer->updateAttribute('catalog_category','on_index_page','source','');
i also tried to set the source to my own class  as i see that the eav/entity_attribute_source_boolean have a function which return the array of option so i create a class like:

class Hsn_Cat_Model_Cat extends Mage_Core_Model_Abstract{

public function getAllOptions() {

    file_put_contents("called", "im called");
    if (is_null($this->_options)) {
        $this->_options = array(
            array(
                'label' => 'Brands',
                'value' => 2
            ),
            array(
                'label' =>'Fruits',
                'value' => 1
            ),
            array(
                'label' => 'No',
                'value' => 0
            ),
        );
    }
    return $this->_options;
}

}


texts: How to call widget with products of specific category in “.phtml” file?

texts:
How can I call a widget that displays product from a specific category in a phtml file?

Currently I can only display "all_products" in my phtml file like that:

echo $this->getLayout()->createBlock("Magento\Catalog\Block\Product\Widget\NewWidget")-  >setDisplayType("all_products")->setProductsCount("5")-  >setTemplate("product/widget/new/content/new_grid.phtml")->toHtml();

How to do this with products from specific category and not all products?


texts:
How to add a product to Magento 2 via REST api.
Do I need some kind of authentication and if so how can I achieve that?
Thanks


texts: Will $product->save() trigger catalog_product_save_after?

texts:
I have an module A will save a product using

$product->save();

This module will run in cron job.

And another module B has

<catalog_product_save_after>
   <observers>
      <warehouse_save_product_batch_special_prices>
        <class>warehouse/catalog_product_price_observer</class>
        <method>saveBatchSpecialPrices</method>
      </warehouse_save_product_batch_special_prices>
   </observers>
</catalog_product_save_after>

Anyone know module A will or will not trigger module B function?


texts: Error when trying to change Caching Application

texts:
I was trying to get a Magento 2.3.2 store to use a different caching mechanism rather than the built in one but every time I attempt to change this I am met with a 500 error and the store just reverts back to the default caching. I have ruled out any issues with the caching application I am trying to use as attempting to switch to any other method including the built in cache results in the same error.

Whenever I recreate this, the following error appears in the error.log

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\Config\Model\Config::getOriginalFieldId() must be an instance of Magento\Config\Model\Config\Structure\Element\Group, instance of Magento\Config\Model\Config\Structure\Element\Field\Interceptor given, called in /vendor/magento/module-config/Model/Config.php on line 279 and defined in /vendor/magento/module-config/Model/Config.php:248
Stack trace:
#0 /vendor/magento/module-config/Model/Config.php(279): Magento\Config\Model\Config->getOriginalFieldId(Object(Magento\Config\Model\Config\Structure\Element\Field\Interceptor), 'use_separate_pr...')
#1 /vendor/magento/module-config/Model/Config.php(429): Magento\Config\Model\Config->getField('system/cron', 'template', 'use_separate_pr...')
#2 /vendor/magento/module-config/Model/Config.php(488): Magento\Config\Model\Config->_processGroup('template', Array, Array, 'system/cron', Array, Array,  in /vendor/magento/module-config/Model/Config.php on line 248

Has anyone else come across this problem before?


texts: Magento2 : How can checked by default radio button estimate shipping options

texts:
I need default checked radio button in shipping method section on cart and checkout page. I was tried with jquery but it's not working, because its render through Json on country drop-down selection.

Anyone have any solution?

Thanks


texts: Magento2: Could not save product "104877" with position 0 to category 346

texts:
I have seen a lot of topics related to this problem but I have not found any solution.
I deleted url rewrites in the database and regenerated etc.
The problem persists. Issue is related to "Duplicate URL key".
Does anyone have any solution to display all duplicates products ID in the logs?
Currently when I try assign products to categories then script (mass product actions) stop proccess when found duplicate URL product key.

https://x-mage2.com/mass-product-actions.html
Is any way to skip product with duplicate url key and assign others products without breaking the script?


texts: When adding a product in admin side then product name should be created automatically using product attributes like color,brands

texts:
I want to create a dynamic name for a product. I want to add color and brand as product name after saving a product it should create name as color + brand.
I'll give an example. I'm selecting "black" as color and "acer" as brand then my product name should save as "black acer".

Is this possible? Please Give example or about that I'm using magento 1.9.1.0 version.


texts: How to Change Text and Sort Data in Checkout Cart Summary Section in Magento 2.3.2

texts:
I want to Change Text of Subtotal (Incl. Tax) only not the Subtotal (Excl. Tax). and Move VAT(20%) or Tax section on 2nd place between Subtotal (Excl. Tax) and Subtotal (Incl. Tax). See Screenshot..

please help me ....

First Image-

Second Image:-


texts: Create link in cart sidebar to view all added items After limit reached

texts: I have set my cart sidebar to show only 2 items that have been added to the basket through the admin panel, what I want to be able to do is create a link if more than 2 items have been added, so if a user added say 5 products the cart sidebar would display 2 items as normal and a link saying "view all 5 products in basket". I don't want the link to be visible if there are 2 or less items in the basket.


texts: Session destroyed in N genius payment gateway magento 2.3

texts: I have created a N Genius hosted session payment gateway module for my project in magento 2.3 version. I have used an iframe to show the 3d secure form in this module. After the 3d secure submit i am setting some value in the checkout session for later use. Payment and order are placed successfully on the first try and from the next time, its not working because the data that i have saved in the session is not getting in the 3d response controller file. The sessions are getting destroyed and i have tried with customer session also, but no luck. Url i have checked, request and response use the same https url. Anyone have faced such issue? any idea about this?


texts: Magento 2 : How to override a Abstract Class?

texts:
I made some modification related to magento2 order pdf.

I want to know how to override a abstract class AbstractPdf extends \Magento\Framework\DataObject


texts: Magento2: What is the best way to overwrite shipping.js in checkout

texts:
In checkout, shipping.js file included by xml. that means inside checkout_index_index.xml.

<item name="component" xsi:type="string">Magento_Checkout/js/view/shipping</item>

So my need: add some functionality to initialize method without changing in main method.

something like :

initialize: function () {
    //call main method
    // custom functionality
},

What is the best way to modify some code of shipping.js ?


texts: Display my block after product grid in list.phtml

texts:
I am overwriting list.phtml via catalog_category_view.xml file

now I want to move my custom block after grid, can anyone tell me how can I do it?

<referenceBlock name="category.products.list"  template="Ktpl_QuickShop::product/list.phtml">
             <block class="Magento\Catalog\Block\Product\ListProduct" name="dummy" />
        </referenceBlock>
        <referenceContainer name="category.view.container">
            <block class="Ktpl\QuickShop\Block\CustomOptions" name="custom.category.form"
                   template="Ktpl_QuickShop::quickshop/quickshop.phtml" after="category.products.list" />
        </referenceContainer>
        <referenceBlock name="product.info.main">
            <container name="product.info.water" as="product.info.water" htmlTag="div" htmlClass="product-info-water">
                <block template="Ktpl_QuickShop::quickshop/calculator.phtml"
                       class="Ktpl\QuickShop\Block\Calculator" name="ktpl.quickshop.calculator">
                    <block template="Ktpl_QuickShop::quickshop/views/business.phtml"
                           class="Ktpl\QuickShop\Block\Calculator" name="ktpl.quickshop.calculator.business"/>
                    <block template="Ktpl_QuickShop::quickshop/views/home.phtml"
                           class="Ktpl\QuickShop\Block\Calculator" name="ktpl.quickshop.calculator.home"/>
                </block>
            </container>

        </referenceBlock>

I want to move this container after product grid:

<referenceContainer name="category.view.container">
            <block class="Ktpl\QuickShop\Block\CustomOptions" name="custom.category.form"
                   template="Ktpl_QuickShop::quickshop/quickshop.phtml" after="category.products.list" />
        </referenceContainer>

Any help will be appreciated.


texts: Where are extension attributes persisted?

texts:
By following the docs, I have somewhat successfully implemented an extension_attribute for order items, but they are not persisted and I can't find out how this is suposed to work.
My extension attribute is a simple string field that a want so set on the order item directly after placing an order. And I want to read it anytime so I can display it in the backend's order details table.

In summary, my question is: where are extension attributes persisted? Or what do I have to implement, if they are not automagically persisted?


texts:
I am using ultimo theme in my Magento 2.1.3 and I have installed one of extension but both gets conflict as slideshow is not showing properly and after inspecting I have found classes added from the installed module.
When i disabled the module, its working fine.

Can anyone suggest how to resolve the confliction in Magento 2?


texts: How to filter coloums with no value in grid?

texts:
In Store>Manage Grid , I have added a "empty" value to drop downs which filters out all the records in which this particular field is empty. It works fine for all but is having problems for those drop downs whose back-end type is int.Please
do Suggest some solution for it.

// I am adding this only to dropdowns:
    $selectValues["None"] = "-empty-";
                $this->addColumn($attribute->getAttributeCode(), array(
                    'header' => $attribute->getFrontendLabel(),
                    'type' => 'options',
                    'index' => $attribute->getAttributeCode(),
                    'type' => 'options',
                    'options' => $selectValues,
                    'filter_condition_callback' => array($this, '_filterEmpty')
                ));

and I am fitering out these as follows

protected function _FilterEmpty($collection, $column) {

    $value = $column->getFilter()->getValue();
    $columnName = $column->getId();

        if (!($value = $column->getFilter()->getValue())) {
            return;
        }
        else if ($value == "None")
            $this->getCollection()->addFieldToFilter($columnName, array('null' => true));
        else
            $this->getCollection()->addFieldToFilter($columnName, $value);

    return $this;
}

But problem here is that, those attributes which are having backend type as int don't have a null value(as default). So what should I do with these  to filter out thoes coloums in which we don't hava a value.


texts: The image is not assigning to the correct attribute option after sorting when use visual swatch- Magento 2.3.1

texts:
Summary of Issue:

I am looking to sort the color attribute options programmatically with input type 'Visual Swatch'.
I have made customization in below files to sort the attribute options:

  File 1:
  vendor/magento/module-swatches/view/adminhtml/templates/catalog/product/attribute/Visual.phtml

in the above file, I have added code before last script tag. (after line 109)

<?php
    $values = [];
    $color = [];

    foreach($block->getOptionValues() as $value) {
        $value = $value->getData();
        $values[] = is_array($value) ? array_map(function($str) {
            return htmlspecialchars_decode($str, ENT_QUOTES);
        }, $value) : $value;
    }
    foreach($values as $key => $val) {
      $color[ucwords($key)]  = ucwords($val['store0']);
    }
    array_multisort($color, SORT_ASC, $values);
    ?>

also added the code in below file in getJsonConfig() after line 71

  vendor/magento/module-swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php

public function getJsonConfig()
    {
        $values = [];
        foreach ($this->getOptionValues() as $value) {
            $values[] = $value->getData();
        }
        //custom code
        foreach($values as $key => $val) {
          $mid[ucwords($key)]  = ucwords($val['store0']);
        }
        array_multisort($mid, SORT_ASC, $values);
        //custom code end
        $data = [
            'attributesData' => $values,
            'uploadActionUrl' => $this->getUrl('swatches/iframe/show'),
            'isSortable' => (int)(!$this->getReadOnly() && !$this->canManageOptionDefaultOnly()),
            'isReadOnly' => (int)$this->getReadOnly()
        ];

        return json_encode($data);
    }

after adding the above code, I am able to sort the attribute options.
But the visual swatches don't sort with respective options.

Please check the below images:

A) Below image is before adding the swatch option.

B) Below image is after adding the option. Here option is sorted correctly alphabet-wise but the image is not assigning to that option. See below image

  Steps to replicate:  (Before replicating the above issue, please add
  above custom code)
  - Go to Store >> Attribute >> Product
  - Search for the color attribute
  - Add swatch option with image.
  - Check that option get sorted
  - But image assigned to last option.

Expected result:
The image should assign to newly added option after sorting.

Actual result:
The image does not assign against newly added option after sorting.

Is anything wrong happens after sorting the array?


texts: Display dynamic Content in Magento Static Block

texts:
I have declared a static block in Magento 1.9.3.2 named 'subcategory_listing' that has the following code:

{{block type="subcategory/listing" name="subcategory.listing"  template="category/subcategory.listing.phtml"}}

This block is set on Category View as Display Setings->Static Block Only -> Subcategory Listing (my block) and it has to display all subcategories.
The problem is When I have Blocks HTML output enabled. In this situation  my block displays the same output when i change categories:

if I get first in Category 1, I get:
Ex: Category 1: Subcategories from category 1
Category 2: Subcategory from Category 1

if I get first in Category 2, I get:
Category 2: Subcategories from category 2
Category 1: Subcategory from Category 2

I've read that it is a cache problem but I can't get it. Any ideas?

UPDATE:

category/subcategory.listing.phtml

<?php $count = 0; ?>
    <?php foreach ($subcategories as $subcategory) { ?>
        <div class="row section main_prod_section <?php echo (++$count%2 ? "reg_bg" : "text-right grey_bg");  ?>">

                <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$subcategory->getListingImage(); ?>" alt="<?php echo $subcategory->getName()?>" class="pr_img">

<?php echo $subcategory->getName()?>

<?php echo $subcategory->getDescription() ?>

                <a href="<?php echo $subcategory->getUrl() ?>" class="main_btn">Descoperă

    <?php } ?>


texts: my price are from 191 to 900 but in price filter currently shopping by it is showing  Rs.191.00 - Rs 899.99 i want the exact price like 191 - 900 kindly help me to solve the issue


texts: Design Configuration Not Saving showing 404 page on sub-directory

texts:
Preconditions

Magento 2.2.4  PHP 7  Sub-directory setup

Steps to reproduce

Setup sub-directory magento 2 mine site/buy/
Install a supported theme for Magento 2. I have install novetty theme
Update theme using ssh access and putty
Trying to change the theme from Design Configuration section
Showing 404 page from root site.

Details
I have install magento 2.2.4 on my site sub-directory. Every thing was properly installed and worked. But when I install a new theme, its was setup properly. I try to change the from the default one to new theme its showing 404 page. Example are given. Could you please help me fix it.


texts: Is it possible to get a cart link from a quote ID create from the magento API. ie I want to add items to the cart using the magento API that would be initiated from a 3rd party website. And when they are ready to check out id have provided them a link to their magento cart.


texts: Is there a way of moving my products to another store view? I tried to change the store view of a product and saving it but it did not work. Can anybody help?


texts: Magento 2 - can't access admin (backend) after setting up custom Admin URL

texts:
I changed the custom admin URL via the admin.
I've set Stores -> Settings: Configuration -> Advanced: Admin -> Admin Base URL -> Use Custom Admin URL to Yes
I've set Stores -> Settings: Configuration -> Advanced: Admin -> Custom Admin URL -> Custom Admin URL to adminxyz
but just after saving it showed me the 404 site.

Now I can't access the admin (backend) anymore:
So I opened phpMyAdmin and noticed that in the table core_config_data the entries with path web/unsecure/base_url and web/secure/base_url changed to adminxyz.
So I changed them back to my domain https://www.example.com/
I also set the of path admin/url/use_custom from 1 to 0.
But I still can't login in the backend.
I already flushed the cache and reindexed.
If I execute php bin/magento info:adminuri then I get:
Admin URI: /adminxyz

I even made this entry in my app/etc/env.php:
<?php
return [
    'backend' => [
        'frontName' => 'adminxyz'
    ],


texts: How to set selectbox options based on other selectbox value change in magento grid form

texts:
I have two select box field in my grid form. one is country and other one is states list.
I have two countries(Us and Canada). based on the country input selection i have to change the options value in state list input.

How can i perform this task in magento adminhtml grid form side?. Please advice me on this.


texts: Elasticsearch installation and MySQL RDS

texts: I have elasticsearch installed in the same Magento 2.4 instant, but my MySQLdatabase is on AWS RDS, How should I configure elasticsearch?


texts: How To change Position Of category Using Query in magento2?

texts:
How To change Position Of category Using Query in magento2 ?

->Magento@ admin Side Default category Position change Drag and Drop Through. But but i have to use it code for the changing  postion of category?


texts: Getting Missing required argument $routerList of Magento\Framework\App\RouterList in Magento 2

texts:
I'm getting this error message:
Missing required argument $routerList of Magento\Framework\App\RouterList.

I copied my project from my server to my local. First I believed that is the config.php file is missing, but it is there.

This is the method from where i got this error:

protected function _resolveArguments($requestedType, array $parameters, array $arguments = [])
    {
        $resolvedArguments = [];
        $arguments = count($arguments)
            ? array_replace($this->config->getArguments($requestedType), $arguments)
            : $this->config->getArguments($requestedType);
        foreach ($parameters as $parameter) {
            list($paramName, $paramType, $paramRequired, $paramDefault) = $parameter;
            $argument = null;
            if (!empty($arguments) && (isset($arguments[$paramName]) || array_key_exists($paramName, $arguments))) {
                $argument = $arguments[$paramName];
            } elseif ($paramRequired) {
                if ($paramType) {
                    $argument = ['instance' => $paramType];
                } else {
                    $this->creationStack = [];
                    throw new \BadMethodCallException(
                        'Missing required argument $' . $paramName . ' of ' . $requestedType . '.'
                    );
                }
            } else {
                $argument = $paramDefault;
            }

            $this->resolveArgument($argument, $paramType, $paramDefault, $paramName, $requestedType);

            $resolvedArguments[] = $argument;
        }
        return $resolvedArguments;
    }


texts:
I am trying to update the category using following code.

$category = $this->categoryFactory->create()->load($categoryId);

foreach($data as $d) {
    $category->setDataUsingMethod($d['code'], $d['value']);
}

$category->save();

$this->categoryFactory is object of \Magento\Catalog\Model\CategoryFactory

But the category is not getting updated.

I have checked after reindexation as well, but the category is showing the old data and not the updated data.

What is the issue here?


texts: Creating a shipment using the REST API changes the order status

texts:
I have created an extra order status of 'partial_shipment' with a state of 'processing' in Magento.
Consider the following scenario:

Customer has placed an order with three items that will be shipped as three separate packages.
The order is created and set as Processing.
I manually create a shipment for one item and then set the status as 'partial_shipment'.
I create another shipment in the Magento admin.
I check order and order status is still partial_shipment.
I create a final shipment.
I check the order and it is marked as complete.

The above scenario works how I expect and how I want.
Now if I try and do the same process but using the REST API to create the shipments, it goes wrong at step 5, as after you create a shipment in the API, it sets the order status back to the 'default' processing status, instead of leaving it alone (and keeping it as partial_shipment in this case.
The issue seems to be here:
vendor/magento/module-sales/Model/ShipOrder.php
$order->setState(
    $this->orderStateResolver->getStateForOrder($order, [OrderStateResolverInterface::IN_PROGRESS])
);
$order->setStatus($this->config->getStateDefaultStatus($order->getState()));
$this->shipmentRepository->save($shipment);

This method is completely bypassed when using the Magento admin.
So the question(s) is:

Does anyone know what the 'correct' flow is?
Is this a bug?
Is there a better way to do this?


texts: Trying to rewrite Catalog Product Collection

texts:
I'm trying to rewrite the Magento Catalog Product Collection - basically I have a specific filtering rule that must be applied every time a product collection is loaded, so I'm figuring that putting it into the collection directly is the best way of doing it.

However, I've never really played with this before, and I've not been able to get it working so far.

The relevant part of my config.xml is

  <global>
        <models>
            <catalog>
                <rewrite>
                    <resource_product_collection>Lw_Restrict_Model_Resource_Product_Collection</resource_product_collection>
                </rewrite>
            </catalog>

And for testing, my app/code/local/Lw/Restrict/Model/Resource/Product/Collection.php just contains:

 <?php
 die("??");
 class Lw_Restrict_Model_Resource_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection {

     protected function _beforeLoad() {
         echo "Load!!";
         parent::_beforeLoad();
     }

 }

So if I go to a category page for example, I'd actually expect the page to die, which it isn't!

Could someone point out whatever obvious thing I've obviously missed is please!!

Thanks!


texts: Assigning the correct URL for your controller

texts:
So i'm developing an ajax application in which a controller intakes and outputs information for a user.  What is the standard way to figure out the URL for the controller?  I'm unsure of the best route to take.

thx.


texts: Magento 2 multi store with ubuntu and apache

texts:
I have magento instance running on 8090 port. I have created an another store call store2 I followed all the steps and also change base url and added store code with base url as per this link

My virtual host file is below.

<VirtualHost *:80>

        ServerName http://192.168.1.179:8090/

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

 <VirtualHost *:80>
    ServerName          http://192.168.1.179:8090/store2/
    DocumentRoot        /var/www/html/
    SetEnv MAGE_RUN_CODE "store2"
    SetEnv MAGE_RUN_TYPE "website"
 </VirtualHost>

My index.php is below.

<?php

try {
    require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
    echo <<getMessage()}

HTML;
    exit(1);
}

$params = $_SERVER;
$customstore = array(
    'http://192.168.1.179:8090/store2'=>'store2' // Website, Store or Storeview Code

    );
if(isset($customstore[$_SERVER['HTTP_HOST']]))
    $websitecode = $customstore[$_SERVER['HTTP_HOST']];
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = isset($websitecode) ? $websitecode : '';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';//use website or store or view
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

but my http://192.168.1.179:8090/store2 returns 404 error.


texts: Magento test automation framework ambiguity

texts:
We are using Magento 1.4 at the moment to develop an e-commerce website. I don't know why we are using old version, but we are.

My task is to set up some automation tests. If possible the idea is to use these tests across different websites which also have been built using Magento 1.4.

I am completely new to Magento. I did some research, found some good links for installation. I could not find this information though.

Can you please answer the below questions and help me please?

taf is the link I found for test automation framework. This does not come with prewritten regression tests. Is that correct? Is this compatible with Magento 1.4?

I found that the above repo is deprecated now and there is a new one being maintained mtf. On seeing the installation prerequisites (www.github.com/magento/mtf/blob/master/docs/install-config.md) of this it says  Magento 2 is a must.

I am confused now. I must to use Magento 1.4. Which automation framework can I use? Any ideas? Preferably I am looking for one which has some pre-written testcases for Magento, so that it easier to start off with and build atop.

To install and run Magento I found this as the best link so far. (www.dhmedia.com.au/article/how-install-and-run-magento-test-automation-framework). If you have come across something else better please share.

Overall, is it any better and easier to just forget about MTAF and write own automation tests using say testng(Java) or PHPUnit and selenium? I am talking about user-journey tests on e-commerce platform like Placing an order, Browsing through, Creating wishlist, etc..


texts: Module works when in app/code but not when in vendor folder

texts:
Seem to have quite an odd issue. I've got a custom module that essentially is just a class which extends a Template.

When I install it using composer; it installs the module into the vendor folder. However, when trying to render a block using the class of the custom module - it won't work if the file is in the vendor folder. If I copy the module files into the app/code folder then it runs perfectly.

Any help would be greatly appreciated.

It is just odd because as soon as I drag the file from the vendor folder which is where composer automatically loads the module into

vendor/[Vendor-Name][Module-Name]/Block/Home/View/Home.php

to the app/code folder - it then works perfectly.

app/code/[Vendor-Name][Module-Name]/Block/Home/View/Home.php

Error:

  Class [Vendor-Name][Module-Name]\Block\Home\View\Home does not exist

I also occasionally get this error:

  2 exception(s): Exception #0
  (Magento\Framework\Exception\LocalizedException): Invalid block type:
  Wholesome\Display\Block\Home\View\Home Exception #1
  (ReflectionException): Class Wholesome\Display\Block\Home\View\Home
  does not exist

Template File: vendor/[Vendor-Name][Module-Name]/view/frontend/templates/home/home.phtml

File: vendor/[Vendor-Name][Module-Name]/Block/Home/View/Home.php

<?php

namespace[Vendor-Name]\[Module-Name]\Block\Home\View;
use \Magento\Framework\View\Element\Template;

class Home extends Template
{

/**
 * Core registry
 *
 * @var \Magento\Framework\Registry
 */
protected $_coreRegistry = null;
/**
 * @var \Magento\Framework\App\Http\Context
 */
protected $httpContext;
protected $pageFactory;
protected $brandPage;

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Framework\Registry $registry,
    \Magento\Cms\Model\PageFactory $pageFactory,
    \Magento\Framework\App\Http\Context $httpContext,
    array $data = []
) {
    $this->_coreRegistry = $registry;
    $this->pageFactory = $pageFactory;
    $this->httpContext = $httpContext;
    parent::__construct($context, $data);
}

}

File: vendor/[Vendor-Name]/[Theme-Name]/layout/cms_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <referenceContainer name="page.top">
     <block class="[Vendor-Name]\[Module-Name]\Block\Home\View\Home" name="wholesome_home" template="home/home.phtml">
        <arguments>
            <argument name="section" xsi:type="string">homepage</argument>
            <argument name="position" xsi:type="number">0</argument>
        </arguments>
     </block>
  </referenceContainer>
</page>

File: registration.php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    '[Vendor-Name]_[Module-Namme]',
    __DIR__
);

Composer.json

{
    "name": "[vendor-name]/[module-name]",
    "description": "",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0|~7.1.12"
    },
    "type": "magento2-module",
    "version": "1.0.1",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}


texts: Magento2: Different domain for each store view

texts:
I'm struggling to get my magento2 website set up on different domains for each storeview and was wondering whether anyone could please advise how I can get this working?

I've created my store views for each language and have changed my Base URL within the store configuration for each to be correct domain.

I've also added the following SetEnvIf Host within my .htaccess file however visiting each store domain it redirects me back to my default store view?

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on

    SetEnvIf Host .*staging.autosmart.fr.* MAGE_RUN_CODE=fr
    SetEnvIf Host .*staging.autosmart.fr.* MAGE_RUN_TYPE=website

    SetEnvIf Host .*staging.autosmart.de.* MAGE_RUN_CODE=de
    SetEnvIf Host .*staging.autosmart.de.* MAGE_RUN_TYPE=website

    SetEnvIf Host .*staging.autosmart.nl.* MAGE_RUN_CODE=nl
    SetEnvIf Host .*staging.autosmart.nl.* MAGE_RUN_TYPE=website

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
</IfModule>

How can I get different domains for each store view?


texts:
This is a lame question, I know, but for some reason I can't get my href link to download the file properly in a cms page.  I have some text, then a table, and inside one of the table cells is a link to download a file but it throws me to a 404 Not Found page.  I've changed the link a couple times but can't seem to get it to work properly.  Any ideas on why this is not working or why the wysiwyg removes my download="file.pdf" link?

Download File

I have also tried:

Download File

so the 'download="file.pdf"' gets stripped out as soon as I save my changes, so I guess the wysiwyg doesn't like html5 tags yet.  But although the url is correct when I inspect it on the frontend it doesn't download the file.

~===== Answer =====~

Ok so it wasn't an issue with my link being in a cms page but rather the file location & permissions.  I had my permissions set to 775 and upped them to 777 on the folder downloadable & the file itself, but for some reason moving the file to the media folder and using the following worked just fine:

Link

I changed the permissions back to 775.  Not sure why it didn't like being in a sub-folder.


texts: Need suggestions for mining an attribute in magento 1

texts:
We have an attribute 'Size' in Magento 1.

It has lots of different types of values in it. For example:

2.64 lbs. ,
2.5 OZ  ,
20 Strips ,
200 Tablets ,
21 Packs  ,
22 Oz - Box of 12 ,
230 Grams ,
237 ml ,
250 Capsules ,
25 Servings ,
3 in 1 Pack ,
30 Caplets ,
etc..

So there is just one attribute combined with another attribute for configurable products.

Now we need to provide filters in product listing page with size attribute but because of different types of values we can't effectively use it for filters.

So we basically need to mine all the values and may need to create different size attributes for different types.

And we have lot of products so question is how to replace newly created attribute with the existing one with making sure the existing products will not break.

any suggestions are most welcome..

Thanks in advance..


texts: any step by step simple procedure to move magento from wamp local to live server

texts:
I have developed my store on wampserver local now i want to place my Magento store on live server and i want to know step by step procedure. please guide me that what is better approach
approach1= add all products on local then migrate on live server
approach2= add all products after putting store on live server


texts: Observer not assigning a custom cart price

texts:
I've been working on this problem for some time now. When I add Item A to my basket I currently have it so it adds Item B with a custom price. Based on the number of Item A added to the basket, the price of Item B will change (not at a fixed amount) so i've created an observer to try and do this.
The first time Item B gets added to basket i'm able to set its custom price. However, if it is already within the basket I can't then update its price.
This is my Controller:
if($itemInBasket == true){
    $product = $this->_product->load(7);
    $product->setData('custom_overwrite_price', $customPrice);

    $this->_eventManager->dispatch(
        'checkout_cart_product_add_after',
        ['quote_item' => $frontCoverReference, 'product' => $product]
    );
}
else{
    if($numFrontCovers > 0){
        $params = array(
            'form_key' => $this->_formKey->getFormKey(),
            'product' => 7,
            'qty' => 1
        );

        $product = $this->_product->load(7);
        $product->setData('custom_overwrite_price', $customPrice);
        $this->_cart->addProduct($product, $params);
        $this->_cart->save();
    }
}

This is my Observer (Event - checkout_cart_product_add_after):
public function execute(\Magento\Framework\Event\Observer $observer)
{
    $item = $observer->getEvent()->getData('quote_item');
    $item = ( $item->getParentItem() ? $item->getParentItem() : $item );

    $_product = $observer->getEvent()->getProduct();
    $_id = $_product->getId();

    if($_id == 7 || $_id == 8){
        $product = $this->_product->load($_id);
        $price = $product->getData('custom_overwrite_price');
        if($price){
            $item->setCustomPrice($price);
            $item->setOriginalCustomPrice($price);
            $item->getProduct()->setIsSuperMode(true);
        }
    }
    return $this;
}

Within the observer I have made sure the price is pulling through correctly and that it is getting into the if statement checking the product ID. The issue is that the price is never actually assigned to the product


texts: How to remove bundle product from cart programmatically?

texts:
I want to remove the bundle product from cart programmatically I am using

`$skunew="demobundle";
     $bundled_product_id = Mage::getModel("catalog/product")->loadByAttribute('sku',trim($skunew));
     $cartHelper = Mage::helper('checkout/cart');
        $items = $cartHelper->getCart()->getItems();
        foreach ($items as $item) {
            if ($item->getProduct()->getId() == $bundled_product_id) {
                $itemId = $item->getItemId();
                $cartHelper->getCart()->removeItem($itemId)->save();
                break;
            }
        }`

In my cart bundle product sku="demobundle-demoprod1-demoprod4-demoprod5" give me some solution.how to remove or how to update this bundle.


texts: Magento 2 override admin Controller Address Save.php

texts:
How to override admin controller address save.php
I am using this code -
di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Customer\Controller\Adminhtml\Address\Save"
                type="Companyname\Namespace\Controller\Adminhtml\Address\Save" />

</config>

Save.php
<?php
namespace Companyname\Namespace\Controller\Adminhtml\Address;

class Save extends \Magento\Customer\Controller\Adminhtml\Address\Save
{

    public function execute()
    {
       echo "hello"; die;

        $customerId = $this->getRequest()->getParam('parent_id', false);
        $addressId = $this->getRequest()->getParam('entity_id', false);

        $error = false;
        try {
            /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
            $customer = $this->customerRepository->getById($customerId);

            $addressForm = $this->formFactory->create(
                'customer_address',
                'adminhtml_customer_address',
                [],
                false,
                false
            );
            $addressData = $addressForm->extractData($this->getRequest());
            $addressData = $addressForm->compactData($addressData);

            $addressData['region'] = [
                'region' => $addressData['region'] ?? null,
                'region_id' => $addressData['region_id'] ?? null,
            ];
            $addressToSave = $this->addressDataFactory->create();
            $this->dataObjectHelper->populateWithArray(
                $addressToSave,
                $addressData,
                \Magento\Customer\Api\Data\AddressInterface::class
            );
            $addressToSave->setCustomerId($customer->getId());
            $addressToSave->setIsDefaultBilling(
                (bool)$this->getRequest()->getParam('default_billing', false)
            );
            $addressToSave->setIsDefaultShipping(
                (bool)$this->getRequest()->getParam('default_shipping', false)
            );
            if ($addressId) {
                $addressToSave->setId($addressId);
                $message = __('Customer address has been updated.');
            } else {
                $addressToSave->setId(null);
                $message = __('New customer address has been added.');
            }
            $savedAddress = $this->addressRepository->save($addressToSave);
            $addressId = $savedAddress->getId();
        } catch (NoSuchEntityException $e) {
            $this->logger->critical($e);
            $error = true;
            $message = __('There is no customer with such id.');
        } catch (LocalizedException $e) {
            $error = true;
            $message = __($e->getMessage());
            $this->logger->critical($e);
        } catch (\Exception $e) {
            $error = true;
            $message = __('We can\'t change customer address right now.');
            $this->logger->critical($e);
        }

        $addressId = empty($addressId) ? null : $addressId;
        $resultJson = $this->resultJsonFactory->create();
        $resultJson->setData(
            [
                'message' => $message,
                'error' => $error,
                'data' => [
                    'entity_id' => $addressId
                ]
            ]
        );

        return $resultJson;
    }
}

It is just giving errors when trying to save "A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later."


texts: Magento2: How to translate search box input field

texts:
How can I translate text in i18n Enter keywords to search...shows in this way?
I add to file translate:
"Enter keywords to search...","Szukaj produktu" but no result.

<input id="search"
                       data-mage-init='{"quickSearch":{
                            "formSelector":"#search_mini_form",
                            "url":"<?php /* @escapeNotVerified */
                       echo $block->getUrl('search/ajax/suggest'); ?>",
                            "destinationSelector":"#search_autocomplete"}
                       }'
                       type="text"
                       name="<?php /* @escapeNotVerified */
                       echo $helper->getQueryParamName() ?>"
                       onfocus="if(this.value=='Enter keywords to search...') this.value='';"
                       onblur="if(this.value=='') this.value='Enter keywords to search...';"
                       value="Enter keywords to search..."
                       class="input-text"
                       maxlength="<?php /* @escapeNotVerified */
                       echo $helper->getMaxQueryLength(); ?>"
                       role="combobox"
                       aria-haspopup="false"
                       aria-autocomplete="both"
                       autocomplete="off"/>


texts: How to check magento users are logged in or not?

texts:
I have 3 Magento users with certain roles and access permission in
backend end, i want to know that how many users where logged in,
depends up on the logged In users user specific pop up will appear,
Suppose i have 3 users called

1.Don1
2.Don2
3.Don3

I want to know that who is currently logged in and depends upon the user role i need to show a popup magento, is there any method to find out the logged in users.


texts:
When i edit my account information in "customer/account/edit", after submits it goes to my account page. I need the form to stay in same page after submitting and saving information. In my module config.xml i made a redirect:

<frontend>
    <events>
        <controller_action_postdispatch_customer_account_editPostAction>
            <observers>
              <customerredirect>
                <class>customerredirect/observer_customer</class>
                <method>editRedirect</method>
              </customerredirect>
            </observers>
        </controller_action_postdispatch_customer_account_editPostAction>
    </events>
</frontend>

Then in Model -> Observer -> Customer.php i have the function:

   public function editRedirect(Varien_Event_Observer $observer){
      $url = Mage::getUrl('sales/order/history');
      Mage::app()->getResponse()->setRedirect($url);
      return $this;
    }

If i change

  controller_action_postdispatch_customer_account_editPostAction

into

  controller_action_postdispatch_customer_account_edit

it redirects account edit page into sales history. But what i want to redirect is after form submits. I'm also trying to redirect my account inital page "customer/account" to "sales/order/history" page, but this method it's not working when i put controller_action_postdispatch_customer_account.

Any ideas?


texts: Get value changed in admin grid SaveButton magento 2

texts:
I created a custom magento 2 form.
As far as saving, I would like to take the modified value in the save.php of the controller.
Is there any method I can use?

This is my save.php controller

<?php
namespace Vendor\Module\Controller\Adminhtml\Index;

class Save extends \Magento\Backend\App\Action
{

const ADMIN_RESOURCE = 'Index';

protected $resultPageFactory;
protected $contactFactory;

public function __construct(
    \Magento\Backend\App\Action\Context $context,
    \Magento\Framework\View\Result\PageFactory $resultPageFactory,
    \Vendor\Module\Model\ProfileFactory $contactFactory
)
{
    $this->resultPageFactory = $resultPageFactory;
    $this->contactFactory = $contactFactory;
    parent::__construct($context);
}

public function execute()
{
    $resultRedirect = $this->resultRedirectFactory->create();
    $data = $this->getRequest()->getPostValue();

    $formKey = $data['form_key'];
    $data = $data['info']['manage_profile'];
    $data['form_key'] = $formKey;

    if($data)
    {
        try{

            $id = $data['profile_id'];

            $contact = $this->contactFactory->create()->load($id);

            $data = array_filter($data, function($value) {return $value !== ''; });

            $contact->setData($data);
            $contact->save();
            $this->messageManager->addSuccess(__("Profilo {$data['name']} salvato con successo"));
            $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false);
            return $resultRedirect->setPath('*/*/');
        }
        catch(\Exception $d)
        {
            $this->messageManager->addError($e->getMessage());
            $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($data);
            return $resultRedirect->setPath('*/*/edit', ['id' => $contact->getId()]);
        }
    }

    return $resultRedirect->setPath('*/*/');
}

}

Instead of $data = $this->getRequest()->getPostValue();

I would like to use a method to get all the values modified in the form`


texts: Trying to log in as customer with external script, then redirect to store

texts:
I'm working on a script that will allow me to log in as a specific customer programmatically, then redirect me to the main store page. I've tried a number of things, but none of them have worked.

The Mage file is correct and I'm not getting any exceptions. On redirect, I am simply not logged in. Removing the redirect, letting the script run and then navigating manually to the site does not keep me logged in.

Here's what I've tried:

require_once('../app/Mage.php');
Mage::setIsDeveloperMode(true);
Mage::app("default");
try{

Mage::getSingleton('core/session', array('name' => 'frontend'));
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());

$customer->loadByEmail('nsteuver@sportys.com');
$session = Mage::getSingleton("customer/session");
$session->loginById($customer->getId());
$session->setCustomerAsLoggedIn($customer);
}
catch(Exception $e) { echo $e; }
$url = 'http://mystore.com';
header('Location: '. $url);

require_once('../app/Mage.php');
Mage::setIsDeveloperMode(true);
Mage::app("default");
try{

$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($email);

Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer)
->renewSession();
}
catch(Exception $e) { echo $e; }
$url = 'http://mystore.com';
header('Location: '. $url);

require_once('../app/Mage.php');
Mage::setIsDeveloperMode(true);
Mage::app("default");
try{

function loginId($customerId)
 {
     Mage::app(); // to make sure that Mage::getModel() works
     $customer = Mage::getModel('customer/customer')->load($customerId);
     if ($customer->getWebsiteId()) {
         Mage::init($customer->getWebsiteId(), 'website');
         $session = Mage::getSingleton('customer/session');
         $session->loginById($customerId);
         return $session;
     }
     throw new Exception('Login failed');
 }

    loginId(274660); //This is my test customer Id
}
catch(Exception $e) { echo $e; }
$url = 'http://mystore.com';
header('Location: '. $url);

I've tried various permutations of these, as well as replacing Mage::app("default") with Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID)) and have found no difference. The behavior is exactly the same. Adding exit() after the redirect stops the redirect but has no effect on retaining the session, just like leaving the redirect off entirely.

Can anyone point me in the right direction?


texts: Magento is ignoring host in local.xml and attempting to connect via Unix Socket

texts:
I have a magento site that works just fine in production.  However, when I create an identical clone of the site in a 'dev' subdomain on the same hosting site (for maintenance work) I get the dreaded: "SQLSTATE[HY000] [2002] No such file or directory" error.

My investigation has revealed that indicates that Zend PDO is attempting to connect to a local database using a Unix socket but none exists.   This makes sense since MySQL isn't running on localhost, but on a separate server.

What doesn't make sense is why Magento / Zend are attempting to connect to MySQL via unix socket when there is a remote hostname specified in my local.xml !

And, since it will be asked...

yes, the credentials and host are correct and connectivity is fine

several other webapps in the same subdomain work just fine
this is a connection error, not an authentication error

yes, I cleared the cache


texts: Module productive minds SiteSwitcher and changing countries

texts:
I have this module currently installed and when i use the top drop down Change Language it switches to the correct store utilizing the correct language and currency. No problem here, see picture below.

The second drop down change country on the other hand does nothing at all.

Now on to what I'm trying to accomplish. So i've been trying to add a few new countries to the list when someone changes country. Here are a few:

I'm currently working in the Lib/zend/locale/data/en.xml

Am I working in the wrong file? It seems to have all the standard countries etc...  but when i select anything on the frontend from "Change Country" it just defaults back to the US. Please help. Thank you.

I will post xml file if needed.


texts: How to add new column to existing table in Magento programmatically?

texts:
How can I add a new column to existing Magento core table via install script? (without using pure SQL)

I want to use the Magento way which is using alias methods to create install script.

So far I followed few tutorials. But seems to be not working properly. This StackOverflow ALTER TABLE in Magento setup script without using SQL answer was somewhat similar to my question. But what is the content should be put into module's confg.xml file? Do I need to just define resource model, model and setup data would be enough?

The relevant portion of the config.xml (of my module) is as follow.

<config>
 . . .
<global>
        <models>
            <mymodule>
                <class>Mynamespace_Mymodule_Model</class>
                <resourceModel>mymodule_resource</resourceModel>
            </mymodule>
            <mymodule_resource>
                <class>Mynamespace_Mymodule_Model_Resource</class>
            </mymodule_resource>
        </models>
        <resources>
            <mymodule_setup>
                <setup>
                    <module>Mynamespace_Mymodule</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </mymodule_setup>
            <mymodule_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </mymodule_read>
            <mymodule_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </mymodule_write>
        </resources>
. . . .
</config>

And my install script is as follows.

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

$installer->getConnection()
        ->addColumn($installer->getTable('sales_flat_order'),'custom_value', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
        'nullable'  => false,
), 'Title');
$installer->endSetup();

But I'm getting the following error.

  SQLSTATE[42S02]: Base table or view not found: 1146 Table '255.sales_flat_order' doesn't exist

Any suggestion to fix this would be appreciated.


texts: How can I get the correct product url based on store view?

texts:
I have 2 store view:

www.example.com (EN Store)
www.example.it (IT Store)

and I have 2 different urls that point at the same products:

www.example.com/car-honda-civic.html (<--- I want obtain this url)
www.example.it/auto-honda-civic.html (<--- and I want obtain this url)

and I use some php function to redirect the users to the right store based on user's language browser.

So, if I try to get product url (from my browser with italian language set) with:

$product->getUrlInStore(array("_store" => "en")); --> http://www.example.com/auto-honda-civic.html?SID=2fdsfsd34fsdfsdf34$__store=en

$product->getUrlInStore(array("_store" => "it")); --> http://www.example.it/auto-honda-civic.html?SID=2fdsfsd34fsdfsdf34$__store=it

How can I get both clean above urls product?

--- EDIT ---

For completeness I add this:

I'm trying to get these links into a separate Magento folder:

www.example.com/myproject/mypage.php

and to load products I use:

require_once("../app/Mage.php");
umask(0);

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

// I need to get only grouped products
foreach($collection as $product) {
    if ($product->getTypeId() == 'grouped') {
      //echo $product->getId();
      array_push($grouped_collection, $product->getId());
    }
}

// e.g.: load Product 12
$productId = $grouped_collection[12];

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

$productLinkEn = $product->getUrlInStore(array("_store" => "en"));
$productLinkIt = $product->getUrlInStore(array("_store" => "it"));

echo $productLinkEn; //Output: http://www.example.com/auto-honda-civic.html?SID=2fdsfsd34fsdfsdf34$__store=en
echo $productLinkIt; //Output: http://www.example.it/auto-honda-civic.html?SID=2fdsfsd34fsdfsdf34$__store=it


texts:
I've been searching for some days for a solution but can't find anything perhaps someone can help me with my problem :

I want to display the number of the product before the product name in my grouped product. I've create an attribute and put the number of the product in the product information but I don't know how to show it in the fronted, here are some pictures :

I've added the "position vue eclatee" in a phtml but I don't know how to put the right number of the product.


texts:
Is there a way that I can warn admin users that they will be logged out after a set period of time.

EG 60 seconds before the session is timed out and forcing the admin user to login it pops up a screen stating "click here to renew" or something.

The reason is because an admin user spent 1 hour building up a CMS page however lost all of their changes as their session timed out.


texts:
I haven't found the right trigger to nottify my client after the product was confirmed as received.

In other words, I change the Order status to complete, but no email is sent. I've created a new template as usual, but can't figure out how to set the trigger that will send the message automatically when the product I define the order as delivered.

Any tip is appreciated.