texts: Magento Installation on xampp windows 10

texts:
I was installing Magento on my pc on xampp. First I had a lot of errors worked through it but now am getting the message below would please advise. Thank you in advance
PHP Parse error:  syntax error, unexpected 'protected' (T_PROTECTED) in C:\xampp
\htdocs\magento24\vendor\magento\framework\Image\Adapter\Gd2.php on line 108

Parse error: syntax error, unexpected 'protected' (T_PROTECTED) in C:\xampp\htdo
cs\magento24\vendor\magento\framework\Image\Adapter\Gd2.php on line 108
PHP Fatal error:  Uncaught Exception: User Error: Some transactions have not bee
n committed or rolled back in C:\xampp\htdocs\magento24\vendor\magento\framework
\DB\Adapter\Pdo\Mysql.php on line 4050 in C:\xampp\htdocs\magento24\vendor\magen
to\framework\App\ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(256, 'Some t
ransactio...', 'C:\\xampp\\htdocs...', 4050, Array)
#1 C:\xampp\htdocs\magento24\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(4
050): trigger_error('Some transactio...', 256)
#2 [internal function]: Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()
#3 {main}
  thrown in C:\xampp\htdocs\magento24\vendor\magento\framework\App\ErrorHandler.
php on line 61

Fatal error: Uncaught Exception: User Error: Some transactions have not been com
mitted or rolled back in C:\xampp\htdocs\magento24\vendor\magento\framework\DB\A
dapter\Pdo\Mysql.php on line 4050 in C:\xampp\htdocs\magento24\vendor\magento\fr
amework\App\ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(256, 'Some t
ransactio...', 'C:\\xampp\\htdocs...', 4050, Array)
#1 C:\xampp\htdocs\magento24\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(4
050): trigger_error('Some transactio...', 256)
#2 [internal function]: Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()
#3 {main}
  thrown in C:\xampp\htdocs\magento24\vendor\magento\framework\App\ErrorHandler.
php on line 61


texts: M2.3-ce Failed to set ini option "session.save_path" when use memcached for session

texts:
OS-Ubuntu18.04 I configured php7.2-fpm with memcached for session

session.save_handler = "memcached"
session.save_path = "127.0.0.1:11211"

Checked with cache-test.php. It was OK.
Configured Magento

app/etc/env.php
    'session' => [
            'save' => 'memcached',
            'save_path' => '127.0.0.1:11211'
    ],

But storefront page throws error

InvalidArgumentException: Failed to set ini option "session.save_path" to value "127.0.0.1:11211". in /home/magento/shop1/vendor/magento/framework/Session/SessionManager.php:632 Stack trace: #0 ...

I tried to use socket, but it didn't help either.

Could you advise how to fix it, please?


texts:
Is there a possibility to create symlinks for duplicate images instead of adding another file?

If there is a grouped product which has the same image as the related products magento will add another file for each of the products. But the images are identical. This causes magento to use a lot of diskspace. Is there a module or shelscript which copes with this behaviour?


texts: WYSIWYG editor not working for IE and Microsoft Edge browers in magento 2.1 on first loading screen

texts:
In IE and Microsoft browsers, the WYSIWYG editor of Magento 2.1.6 is not working when the user clicks on it after the first loading. But it is working fine on the second loading. Quick answer for this issue will be great. A screenshot for this issue is attached here.

Thanks in advance.


texts: magento 2 move inactive quote to checkout

texts:
I want to move an inactive quote to the checkout page.

A customer searches for products and adds them in the cart but doesn't want to checkout on that day.

Now on next day he wants to order some products which are not present in the current cart. He also wants to keep all the current product in the cart.

My solution to this is, the customer will make the current cart(quote) to inactive (By clicking some button on the cart page). This quote will be visible in my account section.

I need an ability to move this inactive cart to an active cart. That is when the customer wants to continue to do checkout of this quote.


texts: Magento 2: How to add date of birth and gender fields in checkout

texts: I enabled Gender and Date of Birth from Customer Configuration in back-end. Those fields are showing in registration page but I also want to add those fields in checkout page too where customer enters address information.


texts: New/Modified files won't inherit group ownership

texts:
This is happening for the first time after months of developing. I don't know what changed.

We set file permissions and then We run in Magento2 root folder:

sudo chown -R user:apache .

But, every time We run commands like.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
composer install
composer update

and every time some of the users in apache group modifies any file We get that file changes to user:user group. So, nobody else in apache group can access files (neither apache itself, so naturally website breaks).

How can I set to keep :apache as group owner?

EDIT:

So, I followed this instructions and was able to get modified files to keep the apache group ownership: https://serverfault.com/questions/46886/linux-losing-group-ownership-of-files but still the new uploaded files by different users are owned by user:user instead of user:apache. How could  I solve this?


texts: Is it valid for an order to have  that is not defined in System > Order Statuses?

texts: System > Order Statuses allows one to create order statuses and link them to order states. What's the meaning of this link in terms of data validity? Should it be considered invalid to assign to an order <state, status> that is not in System > Order Statuses? Does Magento itself expect those pairs to match and does it somehow makes sure to validate the data? From what I see in Mage_Sales_Model_Order::_setState() there's no validation on <state, status> but maybe it's done somewhere up in the call chain?


texts:
I wrote a module that adds a mass action for creating invoices and shipments from the invoice. This gets done by calling the URL ./sales_order/finishorder (calls the finish_order function.

After finishing creating the invoices and shipments I wanted to redirect to pdfinvoices to directly print the PDFs for the orders. I tried this using

 $this->_redirect('*/*/pdfinvoices');

or

$this->_redirect('*/*/*/pdfinvoices');

but neither will work: The first one just leads back to the order grid, the second one displays a blank page.
 I think the second one is correct but the required POST parameters are missing. Is there a way to redirect them to sales_order/pdfinvoices?


texts: adding a sale image if the product is on sale

texts:
I have a table on my home page which shows 5 products from a category, I made called "Recommended For You". This works perfectly fine.

The only thing I want to add is if the product has a special price (is on sale), I want a little image to appear in the product image. I have done this in other places on my website by giving them the class "sale-label". However, I can't set this class to all the product images as not all of them are on sale.

I assume I need an if statement to check if the product has a special price. If true, then set the class to "sale-label".

However, I do not know how to code this if anyone could help.

This is my code which I use to show the products on my home page.

<?php
Mage::getSingleton('catalog/layer')->setData("product_collection",NULL);
$this->_productCollection = null;
$_productCollection=$this->getLoadedProductCollection();
$_productCollection->getSelect()->order(new Zend_Db_Expr('RAND()'));

?>

    <?php echo $this->__("Recommended For You");?>

<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php if(!$_productCollection->count()): ?>

    <?php echo $this->__('There are no products matching the selection.') ?>

<?php else: ?>

<?php // Grid Mode ?>

<?php $_collectionSize = $_productCollection->count() ?>

<?php $_items = $_productCollection->getItems();
           shuffle($_items); ?>

    <?php $i=0; foreach ($_items as $_product): ?>
    <?php if ($i++%4==0): ?>

    <?php endif ?>

                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getShortName()) ?>">
                    <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" alt="<?php echo $this->htmlEscape($_product->getShortName()) ?>"/>

<a  href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getShortName()) ?>"><?php echo $this->htmlEscape($_product->getShortName()) ?>

            <?php if($_product->getRatingSummary()): ?>

                <?php echo $this->getReviewsSummaryHtml($_product) ?>
            <?php endif; ?>

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

    <?php if ($i%5==0 && $i!=$_collectionSize): ?>

    <?php endif ?>

    <?php if ($i==5) break;  // show 5 products max ?>

    <?php endforeach ?>
    <?php for($i;$i%5!=0;$i++): ?>
          &nbsp;
    <?php endfor ?>
    <?php if ($i%5==0): ?>

    <?php endif ?>

<?php endif; ?>

Thanks for any help


texts: Recursively Replace certain characters on server (Cent0s) to import images in Magento 2

texts: I have a folder for all my product images which are structured to mimic the categories. Now some of these folders, and some product images have some special characters in them. Mostly & and Ë, Now the CSV I import I can simply Find and replace these with a word or letter. But how do I do it for the actual folders so the new file paths match the actual file structure


texts:
I found in di.xml from the catalog module this:

<type name="Magento\Framework\Model\OrchestratorPool">
    <arguments>
        <argument name="operations" xsi:type="array">
            <item name="default" xsi:type="array">
                <item name="read" xsi:type="object">Magento\Framework\Model\Operation\Read</item>
                <item name="create" xsi:type="object">Magento\Framework\Model\Operation\Write\Create</item>
                <item name="update" xsi:type="object">Magento\Framework\Model\Operation\Write\Update</item>
                <item name="delete" xsi:type="object">Magento\Framework\Model\Operation\Write\Delete</item>
            </item>
        </argument>
    </arguments>
</type>

What does it do? what does it mean? Where is this used and what for?


texts: How we can create admin grid using block (without using UiComponent)?


texts: Magento creates multiple quotes each minute - database is huge after few years

texts:
A customer called to complain about his Magento Shop. The MySQL database is 10GB large even though the shop is rather small and does not have that many sales.
I found out that magento inserts a new quote into sales_flat_quote at rate of 3-4 per minute, and it goes on 24/7. There are no cronjobs that could automatically create theese. I believe it could be some kind of inefficient DoS attack, since it has been going for years now, and only now did we notice it.

The Magento version is 1.4.1.1 (I know it should have been updated, but the customer does not want to pay for an update) and all the security patches have been installed.

Is is a known issue? What can i do to stop it?


texts: ERP needs to have a configurable map to a single SKU

texts:
We are trying to figure something out and I'm at a loss.
We have 20 pound bags of BBQ wood pellets in 7 flavors. Which we sell as individuals or a three pack that has free shipping.
We have these currently set up as a bundled product, you choose the three flavors, add to cart and go. It's worked for years. The hitch is that when that order comes into our current ERP, it hangs up so accounting can delete the parent bundle and replace it with the three flavors chosen. The order is then released to move on.
We had to do it this way because of how our old ERP worked.
Now we a new ERP on the way, Netsuite. Which wants these items to be handled like a configurable product. We have hundreds of configurables, so we are no strangers to setting them up. We literally do it daily.
We are trying to figure out how to get Magento 2.3.x to do this with a configurable, or some other method of getting a single SKU out of a 3 bag combination. I have 7 flavors for each of the three bag selections. But there will only be one SKU for each of the 84 possible flavor combinations (I'm assuming their math is right).
A combination of three bags like X-X-X will map to a SKU just fine. But the problem is that combination X-X-Y can also be Y-X-X or X-Y-X. They are all three the same its the order the customer selected them.
In other words, these are all the exact same...
Oak-Pecan-Cherry
Cherry-Pecan-Oak
Cherry-Oak-Pecan
etc-etc-etc
After the customer picks the flavors, I have to map those back to their parent SKU for that combination and send that to the new ERP in the order JSON.
We are trying to figure out a way to set up Magento to know
X-Y-Z = SKU123
Y-X-Z = SKU123
Z-Y-X = SKU123
etc


texts: retrieve the oauth access code in magento 1.9

texts:
$callbackUrl ="http://host/mgstore/customApi/test.php";
$temporaryCredentialsRequestUrl = "http://host/mgstore/oauth /initiate?oauth_callback=".urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://host/mgstore/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://host/mgstore/oauth/token';
$apiUrl = 'http://host/mgstore/api/rest';
$consumerKey = 'dfsfdsdf';
$consumerSecret = 'sdfsdfsdf';

session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
    $_SESSION['state'] = 0;
}
try {
  $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
  $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
  $oauthClient->enableDebug();

if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
    $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
    $_SESSION['secret'] = $requestToken['oauth_token_secret'];
    $_SESSION['state'] = 1;
    header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
    exit;
} else if ($_SESSION['state'] == 1) {
    $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
    $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
    $_SESSION['state'] = 2;
    $_SESSION['token'] = $accessToken['oauth_token'];
    $_SESSION['secret'] = $accessToken['oauth_token_secret'];

    header('Location: ' . $callbackUrl);
    exit;
} else {
    $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
    $resourceUrl = "$apiUrl/products";
    $productData = json_encode(array(
        'name'              => 'TEST PRODUCT',
        'price'             => 11.11
    ));

$resourceUrl = "$apiUrl/products/337";
$oauthClient->fetch($resourceUrl, $productData , 'PUT',  array('Content-Type' => 'application/json'));
$responseArr = json_decode($oauthClient->getLastResponse());
print_r($responseArr);
}
} catch (OAuthException $e) {
  print_r($e);
}

the script redirect to the admin confirmation page,
how to get and use the access token without confirmation


texts: Magento2 Is Varnish cache helpful with https?

texts:
Magento2 I am planning to install Varnish Cache in my Magento2 Website, but I have a question will Varnish cache actually helpful for me as my is in https?

Being in https won't it just not ignore the traffic?

Can someone guide me on this?


texts: Integrity checking new install built on AWS to fix problems

texts:
I have a new Magento 2.3.3 install that is causing me various problems and I'd really appreciate it if someone could point me to a set of things to check to ensure its integrity that may help point me to a solution.
I figure its a post installation step I've missed and particularly think its a Cron issue as its quite strange.
I have this new install running on an AWS architecture, the server is a t3a.medium Ubuntu machine with 4GB's of RAM, I've set PHP to 3GB and all .htaccess files to 3GB also.
I've linked this DB to a RDS MySQL server thats running the database, its a small DB server.
Once the installation was completed and I was happy all seemed to be running fine I created an AWS AMI, machine image.
I could view the site and enter the admin system and start configuring stuff, so all seemed good.

However, when I started to try and expand functionality by installing extensions problems showed up.
The first issue involved 2 extensions which where the Stripe payments system and DragDropr, although I don't think the problem has anything to do with the extensions themselves.
Installation of the extensions fails with a Rollback message from the admin interface.
Checking logs says that PHP had a memory allocation blow-out even though I've set everything to 3GB.
Then the server goes stupidly slow and starts hanging and when I do a 'top -c' in the terminal it clearly shows that my cron setup must be wrong or is somehow getting stuck as there seem to be stalled Magento cron jobs stuck at the top of the list.

Anyway, when this happens I terminate the server and restart a fresh one from the AMI and everything is back running.
As another example, the weird thing is, and it just happened, I logged into a fresh AMI that i started a couple of weeks ago and have not worked on or touched since.
I went to the web-setup panel to try and upgrade to 2.3.4 and the Readiness check fails the 'Checking Component dependency' stage.

I decided to terminate that server, start a new one from the same AMI and hey presto it passes the 'Checking Component dependency' stage.
The only difference between the 2 servers was the failed 1 has been running untouched by anyone for a couple of weeks.
The only changes on it, I reckon, will be through automated elements that are running on the server, i.e. the cron stuff probably.

Sorry for the long winded detail but I can't get past what I could have set wrong and how Magento's Cron systems work to link the various system elements, DB, file structure, etc. that could be causing the issues.
I've been very diligent, I thought, making sure settings and permissions are all correct but I do reckon my Cron set-up is related.
I'm also not sure if having the DB off server on RDS could be an issue, although it doesn't seem to be for any other system interaction.


texts: Magento2: Cannot instantiate interface Magento\Vault\Api\Data\PaymentTokenInterfaceFactory in Cart and Checkout

texts:
Recently, I upload my Magento 2 site to production server, and everything looks fine, except by Cart and Checkout. When I enter to these, the server throw me a HTTP ERROR 500, and the page keep blank.

In Php Error Log, is displayed this error:

PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\Vault\Api\Data\PaymentTokenInterfaceFactory in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:93
Stack trace:
#0 vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Vault\\A...', Array)
#1 vendor/magento/framework/ObjectManager/Factory/Compiled.php(130): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Vault\\A...')
#2 vendor/magento/framework/ObjectManager/Factory/Compiled.php(67): Magento\Framework\ObjectManager\Factory\Compiled->get('Magento\\Vault\\A...')
#3 vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Paypal\\...', Array)
in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93

The other sections display well, only cart and checkout have this problem. Additional, this occurs only in Production. In my developer server, all is fine.


texts: Magento 2 How to Render Child blocks in controller

texts:
I want to remove the 'Proceed to Checkout' button when the qty reaches a specified limit. For that I add a condition check in this page

module-checkout\view\frontend\templates\onepage\link.phtml

On qty update I have added an ajax call to the controller and passing the layouts as the ajax response and load the section. I am following the below link
How to Render an HTML Using an Ajax Call in Magento 2 Module
In my controller I have added the below code
$block = $resultPage->getLayout()
            ->createBlock('Magento\Checkout\Block\Cart')
            ->setTemplate('Magento_Checkout::cart/methods.phtml')
            ->toHtml();

The issue is that, the checkout button is not loading since it is a child of this block.
    <block class="Magento\Checkout\Block\Cart" name="checkout.cart.methods.bottom" template="Magento_Checkout::cart/methods.phtml">
        <container name="checkout.cart.methods" as="methods" label="Payment Methods After Checkout Button">
            <block class="Magento\Checkout\Block\Onepage\Link" name="checkout.cart.methods.onepage.bottom" template="Magento_Checkout::onepage/link.phtml" />
            <block class="Magento\Checkout\Block\QuoteShortcutButtons" name="checkout.cart.shortcut.buttons" />
        </container>
   </block>

Now, I need to render the child blocks along with this.
How can I do this?


texts:
I would like to export all details of products to import in another Magento platform. I know the easy way is from the following:
system>under Data Transfer- export> choose entity type: product + Export File Format: CSV + choose all attribute> continue.

but i get all the following coulumes empty in CSV file, why? and How to fix it ?
name,description,short_description,weight,product_online,tax_class_name,visibility, price, pecial_price, special_price_from_date, special_price_to_date, url_key    meta_title, meta_keywords, meta_description base_image, base_image_label    small_image small_image_label, thumbnail_image, thumbnail_image_label,  swatch_image, swatch_image_label, created_at, updated_at, new_from_date new_to_date display_product_options_in, map_price, msrp_price, map_enabled  gift_message_available, custom_design, custom_design_from, custom_design_to custom_layout_update, page_layout, product_options_container, msrp_display_actual_price_type, country_of_manufacture, additional_attributes

Version: Magento 2.1.9


texts:
for some reason we need to clear APC Opcode cache

so i am adding below lines at the end of index.php file

apc_clear_cache();
apc_clear_cache('user');

after i run the index.php file from browser,

than i am getting following error at the end of the frontend and backend :

Fatal error: Call to undefined function apc_clear_cache() in /var/www/html/site/index.php on line 92

so is there any way to clear APC cache through index.php file or how we can do this from server side.


texts: Add the "Only x Left" in product list page

texts:
I have a custom theme template for my magento 1.9.1 and would like to add the "only X left" in my product list page. It is already in my product view page however I want it to show on every single product in the grid list page.
How do I add to it?


texts: How to link a customer's addresses to a specific address

texts:
How to point all customer's addresses to one specific address? When a new customer is created, the address ID is assigned to the customer's shipping and billing, but it seems that the address' parent_id is set to the latest created customer. In other words I want to change the 1-to-1 --> 1-to-many in address-customer relationship with minimum impact on everything else.

I've done a trace in \Magento\Customer\Model\Address::setCustomerId($id) by

$e = new \Exception();
var_dump(explode("\n", $e->getTraceAsString()));die;

and got (first lines)

array(57) {
  [0]=>
  string(131) "#0 /var/www/magento/magento2/sandbox/vendor/magento/framework/DataObject.php(207): Magento\Customer\Model\Address->setCustomerId(5)"
  [1]=>
  string(158) "#1 /var/www/magento/magento2/sandbox/vendor/magento/module-customer/Model/Address.php(150): Magento\Framework\DataObject->setDataUsingMethod('customer_id', 5)"
  [2]=>
  string(203) "#2 /var/www/magento/magento2/sandbox/vendor/magento/module-customer/Model/ResourceModel/AddressRepository.php(115): Magento\Customer\Model\Address->updateData(Object(Magento\Customer\Model\Data\Address))"
  [3]=>
  string(222) "#3 /var/www/magento/magento2/sandbox/vendor/magento/module-customer/Model/ResourceModel/CustomerRepository.php(212): Magento\Customer\Model\ResourceModel\AddressRepository->save(Object(Magento\Customer\Model\Data\Address))"
  [4]=>
  string(202) "#4 /var/www/magento/magento2/sandbox/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Customer\Model\ResourceModel\CustomerRepository->save(Object(Magento\Customer\Model\Data\Customer), NULL)"

where would be the appropriate place, should I skip the setCustomer() or will it affect the address integrity?

Note:
I've also had to override \Sqli\User\Model\Quote\QuoteAddressValidator::validate($addressData) to skip the verification of if a cusomter's addressId references an address that have that customer in it's parent_id.


texts: URL Building Changes in Backend from 2.1.12 to 2.2.5

texts:
We are facing a regression during an Magento update from 2.1.12 to 2.2.5 which I want to understand better.

Our code looks like this and is in a block on a tab of the backend order sales

public function getPostUrl()
{
    return $this->getUrl('orderattachments/upload/index');
}

The result of this call includes the order_id key in the URL, for example is

https://example.com/admin/orderattachments/upload/index/order_id/123/key/ada29d4295d76eaabd08a9c8ec6842bf2891da81a3e3c3bd5d5b0f7b8af3c4b8/

Now in 2.2.5 we get only

https://example.com/admin/orderattachments/upload/index/key/ada29d4295d76eaabd08a9c8ec6842bf2891da81a3e3c3bd5d5b0f7b8af3c4b8/

After lots of debugging I tracked this down to

https://github.com/magento/magento2/blob/2.2.5/app/code/Magento/Backend/Model/Url.php#L231

vs

https://github.com/magento/magento2/blob/2.1.12/app/code/Magento/Backend/Model/Url.php#L231

In the recent version, _getRouteParams is not called anymore, which, during my debugging session, revealed that this adds they order_id parameter.

Is this intended (so essentially like https://xkcd.com/1172/) and I should now add the order_id manually or is this a regression in the core that should be patched?


texts: Images is not uploading in backend using csv in magento version 1.9

texts:
I am trying to upload product images using csv .

    if ($key === 'image') {
         if (trim($data[$key])) {
              $img_path = $base_dir . "/media/catalog/product/" . trim($data[$key]);

    if (file_exists($img_path)) {

       try {
           $p->addImageToMediaGallery($img_path, array( 'image',  'small_image',  'thumbnail' ) , false, false);

           $p->setThumbnail($p->getImage());
           $p->setSmallImage($p->getImage());
           $p->setImage($p->getImage());                                            $p->setThumbnail(Mage::helper('catalog/image')->init($p, array('thumbnail','small_image','image')));

          $p->save();
        }
       catch(Exception $e) {
           Mage::log('Exception Arrised in Updating Product with sku ' . $sku . " Exception " . $e->getMessage() , null, date('Y-m-d--H', strtotime('now')) . "__" . 'product_create_error.log');
        $i++;
          continue;
     }

  }
}
}else{
     if (trim($data[$value])) {
          $p->setData($key, trim($data[$value]));
      }
   }
}

this is my code but it is not saving the image.. Any help would be appreciated!!!


texts:
I'd like to capture all email events in Magento before they're sent and prevent magento from sending them.
I know I can disable all emails under system > mail sending settings, but this is not enough. I want to send data from that email to another system.
Something like this:

Magento wants to send email
Some method captures the email
Same method prevents magento from sending the email
Same method sends data through api to another system

How can I achieve this?


texts: Magento product url not working after magento upgrade from 1.5 to 1.8

texts:
I have upgraded magento from 1.5 to 1.8, everything is working fine apart from custom URL.
Custom product URL is not working even after reindexing everything.

is there any way we make old custom URL workable in Magento 1.8.


texts:
I need to edit price that is displayed on paypal page on top right. I have set a condition that if the order total is > 25 then free shipping is set else 10$ flat rate. When I land on paypal login page on top right near cart symbol it displayed + 10 cost.

For ex in attach screenshot I made a order of 26 & on top right on paypal page it is displaying 36. Can any one guide me from where can I edit this?


texts: Magento 2 - Orders saving as local timzezone

texts:
I have an issue with how a Magento 2 store is saving orders.

My understanding was that orders are saved in UTC.

However, when new orders are placed, it is saving them as our local timezone in the database (AEST)

We have a mixture of orders that have been migrated from Magento 1 (UTC) and new orders placed in M2 (for some reason currently being saved as AEST), so when it displays these dates, its not performing any conversion on them at all and it looks like they were placed 10 hours earlier. Newly placed orders "look" correct in the backend. Older migrated orders are 10 hours off.

I have updated the settings under

  Stores -> Configuration -> General ->Locale Options -> Timezone to
  reflect "Australian Eastern Standard Time".

Should this impact how the orders are actually saved in the database? I would assume it would work the same way as Magento 1 - however looking at the timestamps it definitely is saving them as AEST in the database.

Any help would be greatly appreciated.


texts: Issue with API bulk action using RabbitMQ

texts:
I'm using RabbitMQ with Magento Community 2.3.1 version to handle Bulk REST API actions to update products.

That works fine.

But sometimes, with same messages, one item of the bulk action is not handled and the status of my bulk action stay in "Pending" because 2 messages were handled instead of 3 !

Do you have any idea of this issue?

Magento Community 2.3.1
RabbitMQ version : 3.7.9 Erlang 21.2.5

Thanks for your help !


texts: Magento 2 - display and hidden column grid by permission

texts:
I added a new column to product grid on back-office Magento, but I want to display it where the role is " admin " and hide it if not.

I add the column using this code :

<column name="user_id">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="filter" xsi:type="string">text</item>
            <item name="editor" xsi:type="array">
            <item name="editorType" xsi:type="string">text</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">true</item>
            </item>
        </item>
        <item name="label" xsi:type="string" translate="true">User</item>
        </item>
    </argument>
</column>


texts: Access Magento 2 session data outside of Magento

texts: I have Magento 2 installed in a directory at mydomain.com/shop and I want to access the user's session data outside of that folder (specifically user id and isLoggedIn) so I can use it to log them into another app. I set my Magento cookie path to "/" but what code do I need to grab the session from domain.com/file.php?


texts: Magento2 - Can not save value of custom column in table customer_entity

texts:
I want to add new column, let's call it test, to customer_entity table.

I managed to add the column to the table but values aren't saved for this column when I write something like:

$customer->setData("test", "something");
$customer->save();

The code I used to add the new column in my module's InstallSchema.php:

$eavTable = $installer->getTable('customer_entity');
$columns = [
    'test' => [
        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
        'length' => '6',
        'nullable' => false,
        'default' => null,
        'comment' => 'test',
    ]
];
foreach ($columns as $name => $definition) {
    $connection->addColumn($eavTable, $name, $definition);
}
$installer->endSetup();


texts: factory class duplicate insert check in magento2

texts:
I have created a model class as like below.

Vendor\Module\Model/Bulider.php

namespace Vendor\Module\Model;

use Magento\Framework\Exception\QualificationException;
 class Builder extends \Magento\Framework\Model\AbstractModel
{

   public function __construct(
    \Magento\Framework\Model\Context $context,
    \Magento\Framework\Registry $registry,
    \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
    \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
    array $data = []
) {
    parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}

/**
 * @return void
 */
public function _construct()
{
    $this->_init('Vendor\Module\Model\ResourceModel\Builder');
 }

}

then Vendor\Module\Model\ResourceModel\Builder.php

 namespace Vendor\Module\Model\ResourceModel;

 class Builder extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{

protected $_builderFactory;

public function __construct(
    \Magento\Framework\Model\ResourceModel\Db\Context $context,
    \Vendor\Module\Model\BuilderFactory $_builderFactory
)
{
    $this->_builderFactory = $_builderFactory;
    parent::__construct($context);
}

public function _construct()
{
    $this->_init('builder_table', 'id');
}

public function builder($pid,$type,$id,$date) {
    $log = $this->_builderFactory->create();
    $log->setPId($pid);
    $log->setProductType($type);
    $log->setUnitId($id);
    $log->setCreatedAt($date);
    $log->save();
  }
}

I have injected this class in my controller and inserting data as like below.

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

 protected $_builderResourceModel;
 protected $_storeManager;

 public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Vendor\Module\Model\ResourceModel\Builder $builderResourceModel
 ) {
    $this->_storeManager     = $storeManager;
    $this->_builderResourceModel = $builderResourceModel;
    parent::__construct($context);
 }

 public function execute()
 {
   $result = array();// this is the model data
   $modelId = $result['id'];
   $date = date('Y-m-d H:i:s');
   foreach($result['core_units'] as $unit){
      $type = "C";
      $this->_builderResourceModel->builder($modelId,$type,$unit,$date);
   }

    foreach($data['optional_units'] as $option){
       $type = "O";
      $this->_builderResourceModel->builder($modelId,$type,$option,$date);
    }

   }
}

the current data structure is like below

A sample result data is given here

  Array
   (
     [id] => 2
     [core_units] => Array
     (
        [0] => 31
        [1] => 63
     )
      [optional_units] => Array
    (
        [0] => 31
        [1] => 63
        [2] => 82
       )
     )

so, while inserting data i need to check for the duplicate data insert.

Before inserting i need to check if same data exist or not in the table, if data exist with same i need to update otherwise i need to insert new row.

Can this be achieved any other way. Please someone look into it and update me your ideas. Thanks


texts: Magento 2 : Where Put External Dependency?

texts: I'm developing module to call REST API and I want to use an external package via composer. In which composer.json I should put dependency? In composer.json in root directory or composer.json in module directory?


texts: magento 2 how to secure Cookie mage-cache-sessid and enable Secured Flag

texts:
Here Am trying to enable HttpOnly and Secured Flag for Cookies mage-cache-sessid or my domain. I did configuration in admin Panel >> store >> configuration >> general >> web

but still flags not enabled for domain and Cookies.
Can I get help? Thanks in advance


texts: Magento 2.1.1 two add to cart button in product view page

texts:
I want to have two add to cart in product view page.

So from somewhere I've found the following code

<?php
    $postDataHelper = $this->helper('Magento\Framework\Data\Helper\PostHelper');
    $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()])
?>
<button class="action tocart primary"
        data-post='<?php /* @escapeNotVerified */ echo $postData; ?>'
        type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
    <?php /* @escapeNotVerified */ echo __('Add to Cart') ?>
</button>

Where $_product is my product. well this code is working fine for the simple products but not working for configurable products where I've to choose options(like size,color etc.)..

Even if I select all those attributes the default add to cart button is working fine but that button created by code is giving me error

  You need to choose options for your item.

So anyidea how can I solve this issue for configurable products??


texts: Magento 1.9.2.2 Contact form error (unable to send request)

texts:
I'm using Magento 1.9.2.2 version, For contact form, I used this code

 {
  {
    block type="core/template" name="contactForm" template="contacts/form.phtml" action="/contact-us/index/post"
  }
}.

Contact form mail is not sending I'm getting unable to send request error. I'm using SMTP pro extension form email communication, The Run self-test is working fine and getting mail to admin, but the front end I'm not getting success message also mail not working.

please help thanks.


texts: unable to add product in shopping cart in magento 1.8

texts:
require_once '../../app/Mage.php';
umask(0);
Mage::app();

Mage::getSingleton('checkout/session');
Mage::getSingleton('customer/session')->loginById($customerID);

$params = array(
    'product' => $productIds,
    'qty'     => $p_qty,
    'price'   => $price
    );

$_product = Mage::getModel("catalog/product")->load($productIds);

$cart = Mage::getModel('checkout/cart');
$cart->init();

$cart->addProduct($_product, $params ); -->error

==>error on above line.

exception 'Mage_Core_Exception' with message 'Please specify product link(s).' in /app/Mage.php:594
Stack trace:
#0 /app/code/core/Mage/Checkout/Model/Cart.php(284): Mage::throwException('Please specify ...')
#1 addcart.php(54): Mage_Checkout_Model_Cart->addProduct(Object(Mage_Catalog_Model_Product), 1)
#2 {main}


texts: Magento 2: How to hide quantity box for certain products which has only quantity?

texts:
I have certain products, which customers can buy only one.

So whether needs to remove Qty box for that products only or can be managed from settings?


texts: Magento 2 integration with External System via API

texts:
I'm currently in process of creating a Magento 2 module that will handle and pull product data from external system into Magneto database using API requests (SOAP and REST)
Any guide or module recommendation would be highly appreciated.


texts: Link to Product Page from Product Edit Screen

texts:
What is the best way to add a link to a product's front-end page from the its back-end edit screen?
I am using Magento 1.9.2.1 CE. I tried
http://www.magentocommerce.com/magento-connect/vs-preview-product-from-backend.html

But it does not work with 1.9 (as one would expect).


texts: Product and category url rewrite concept

texts:
I have a confusion in product and category url rewrite concept. Is magento stores the url in database? If yes which table? If no how we get the category and product url from collections? like this.

$product_collection = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToFilter('entity_id', 16)
    ->addUrlRewrite();
$product_collection_url = $product_collection->getFirstItem()->getProductUrl();

and what is addUrlRewrite() ?
Please explain.


texts: OWL Carousel new product slider not showing up

texts:
I have installed Magento 2 Responsive Banner Slider and OWL Carousel by Welt Pixel and I configured enabled it for New products & last viewed products.

Widget code was already placed but sliders are not displaying at front end


texts:
I'm trying to create a custom text-area in admin panel and I need to attach the afterRender event to it.

Config XML:

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="behavior">
        <field name="behavior_field_feed_template">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Feed Template</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">textarea</item>
                    <item name="component" xsi:type="string">Feeds/js/form/export-feed-template</item>
                    <item name="source" xsi:type="string">export</item>
                    <item name="sortOrder" xsi:type="number">20</item>
                    <item name="dataScope" xsi:type="string">behavior_field_feed_template</item>
                    <item name="imports" xsi:type="array">
                        <item name="toggleVisibility" xsi:type="string">${$.parentName}.behavior_field_file_format:value</item>
                    </item>
                    <item name="valuesForOptions" xsi:type="array">
                        <item name="feeds_product" xsi:type="string">feeds_product</item>
                    </item>
                    <item name="notice" xsi:type="string">
                        To generate Feed you need to prepare template.
                        You can do this with existing templates which we've prepared for you or can create your own.
                    </item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

JS:

define(
    [
        'Magento_Ui/js/form/element/textarea',
        'Feed/js/lib/codemirror'
    ],
    function (Element, CodeMirror) {
        'use strict';

        return Element.extend(
            {
                defaults: {
                    valuesForOptions: [],
                    isShown: false,
                    inverseVisibility: false,
                    visible: false
                },

                afterRender: function() {
                    // Do something here!!!
                }
            }
        );
    }
);

What setting I'm I missing to achieve this? Thanks


texts: How to show Recently Searched Products without using Widget on HomePage (Luma). Magento2

texts: I want to show recently searched products on homepage without using Recently Viewed Products Widget I want to get this in my custom block and also want to show this in my custom .phtml file how it would be possible?


texts: Send automatic mail after completed order

texts:
I would like to send my customers a mail, after a week, when the order has been completed.

Can someone help me? (Magento 1.9.2).

I also found a topic about this issue, but it is not updated for a while.

My code for so far:

Config.xml:

    <?xml version="1.0"?>
<config>
  <modules>
    <Productreviews_Productreview>
      <version>0.1.0</version>
    </Productreviews_Productreview>
  </modules>
  <global>
    <helpers>
      <cronexample>
        <class>Productreviews_Productreview_Helper</class>
      </cronexample>
    </helpers>
    <models>
      <cronexample>
        <class>Productreviews_Productreview_Model</class>
        <resourceModel>cronexample_mysql4</resourceModel>
      </cronexample>
    </models>
  </global>
    <crontab>
        <jobs>
            <send_productreview>
                <schedule><cron_expr>5 * * * *</cron_expr></schedule>
                <run><model>cronexample/cron::cronSendReviewMail</model></run>
            </send_productreview>
        </jobs>
    </crontab>
</config>

Cron.php:

<?php
class Productreviews_Productreview_Model_Cron{
    public function cronSendReviewMail(){
        Mage::log("Cron Test ".now(),null,"mageCronExample.log");

$time = time();
$to = date('Y-m-d H:i:s', $time);
$lastTime = $time - 604800; // 60*60*7*24
$from = date('Y-m-d H:i:s', $lastTime);

$order_collection = Mage::getModel('sales/order')
->getCollection()
->addAttributeToSelect('*')
->setPageSize(5)
->setOrder('created_at', 'desc')
->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to))
->addAttributeToFilter('status', array('==' => array('complete')));

                foreach ($order_collection as $item) {
                    // echo $item->getId();

                    $sendtoemail = $item->getShippingAddress()->getEmail();

                    $idid = $item->getIncrementId();
                    $order = $item->loadByIncrementId($idid);
                    $items = $order->getAllVisibleItems();

                        // EMAIL LAYOUT
                        $email = 'Email content here';

                            // EMAIL VERSTUREN
                            $to      = $sendtoemail;
                            $subject = 'Subject';
                            $headers = 'From: x@example.com' . "\r\n" .
                                'Reply-To: x@example.com' . "\r\n" .
                                'X-Mailer: PHP/' . phpversion();
                            $headers .= "MIME-Version: 1.0\r\n";
                            $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

                            mail($to, $subject, $email, $headers);
                }

    }
}


texts:
Since upgrading from Magento 2.2.4 to Magento 2.4.0, the Order by position doesn't work.
The ordering by price and name, neither of which we want to use, are working fine, it's just the position ordering that isn't working.
Instead of using the Position given in the backend, it's ordering them by product ID. When I use the descending/ascending button, it still sorts by ID and doesn't change the ordering.
Has anyone has similar issue? We're using Porto theme but the Position ordering wasn't working before we installed the theme so it's not a theme issue.


texts: Possible to use Multi-Select Attribute on Configurable Product?

texts:
So, I may have hit a Magento limitation with this issue. We are working to customize a shopping experience for automotive products. We have only simple products loaded currently. Several of them all have the same name and only vary by the vehicle they fit. The issue with this is if you load up a category page, you see hundreds of products with the same name. In reality, those are a single "product" and the vehicle fitment data is what determines the final SKU.

We have implemented several different Year/Make/Model extensions, each excelling over the other in some way, finally settling on Amasty's Product Parts Finder extension. Currently, we are filtering the simple products based on the customers selection of year/make/model. If we can get the customer to first select their vehicle before shopping, this works sufficiently. However, if they do not select a YMM, they are presented with a terrible shopping experience.

Forcing the customer to select a YMM is not the solution I'm after here. I would like to somehow be able to assign a single SKU to multiple vehicles, as it is in the real world. When the customer lands on the product page, I would like them to be presented with Year, Make, and Model attribute value dropdowns. Selecting those values would dictate the single, selected SKU.

The problem comes in when we try to assign multiple vehicles to a single SKU. Currently, our "vehicle" attribute is a dropdown, so it will work with configurable products. However, it really needs to be a multi-select so I can assign multiple vehicles to a single sku. Unfortunately, Magento doesn't allow multi-select attributes to be used for configurable products.

Any ideas?


texts: How do i upgrade my magento 2.1.0 to lastest version?

texts:
I have a testing site (magento 2.1.0) run in my windows with xampp, how do i upgrade to lastest version?

just tried composer update but

  Problem 1
    - Installation request for magento/product-community-edition 2.1.5 -> satisfiable by magento/product-community-edition[2.1.5].
    - magento/product-community-edition 2.1.5 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp\php\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

what is the meaning of " Problem 1
    - Installation request for magento/product-community-edition 2.1.5 -> satisfiable by magento/product-community-edition[2.1.5]."?


texts: I tried to change the password but it not working.


texts:
I deleted a category from my magento installation and then i started getting this error

  "Top-menu renderer isn't fully configured."

on the page and nothing else would work.


texts: How to add custom tab to My account(frontend)

texts:
I need to add new tab in my custom module to frontend(my account)

         -> this may be addLink or customer_account_navigation (its depend on the requirment)
            viewwedding_couplewedding_couple/customer/view/ZZZZZZZZ

<wedding_couple_customer> –> controller path
    <update handle="customer_account"/>
    <reference name="my.account.wrapper">
        <block type="wedding_couple/customer" name="wedding_couple_newtab_newtab" template="customer/newtab/newtab.phtml"/>
    </reference>
</wedding_couple_customer>


texts: TypeError: require.config is not a function in Magento 2


texts: authorized.net Direct post payment error while place order with magneto 2.2.5

texts:
while place order with authorized.net Direct post-payment it shows error sorry something went wrong please contact seller, I double-checked authorized.net Direct post  configured, and applied patch also from  https://support.magento.com/hc/en-us/articles/360024368392-Update-Authorize-Net-Direct-Post-from-MD5-to-SHA-512

all are correct,

please  suggest a proper clue


texts: Fatal error: Class 'Mage_Storemainteance_Helper_Data' Not Found

texts:
I was trying to create a User Role for the first time and I've got the following error:

  Fatal error: Class 'Mage_Storemainteance_Helper_Data' not found in
  /home/alex/public_html/app/Mage.php on line 547

Please let me know how I can solve this.

Thanks


texts: My standard search and frontend categories are broken!

texts:
The Magento multi-store site I was building for my work was very nearly complete when I went to search for a product and it didn't work. Not only did it not work but the footer disappeared on the search page aswell, so I've done all of the normal stuff (re-indexing, flushing cache, Apache error logs and the magento logs) the only error i could find was this one:

"[Fri Mar 10 12:34:46.426260 2017] [:error] [pid 1719] [client 192.168.0.9:50662] PHP Fatal error:  Call to undefined method Activo_CatalogSearch_Model_Resource_Fulltext::getFoundData() in /home/new/public_html/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php on line 148, referer: http://new.va-technologies.com/catalogsearch/result/?q=asus"

I then begin disabling extensions until the search looked relatively normal again (i.e. the footer came back) the extension responsible was "VE Ajax Cart & Filters".

When this is disabled the search still doesn't work, as in nothing is displayed other than the breadcrumbs. But the footer is there. Also when it is disabled the categories no longer show products like they used to they are the same as the search pages.

The advanced search works throughout all changes.

I then decided to uninstall the plugin, clear cache all that stuff all over again. The search then goes back to how it originally was with the extension activated and the categories were all showing products again.

So i install another Ajax cart to see if it makes any difference, it doesn't.

I reinstall the original "VE Ajax Cart & Filters" extension. And the cycle continues no matter what I try I can't get the search to work properly at all and cant get the categories to show products and for the search page to look right at the same time. I have tried multiple themes and the issue is across all 3 sites, all using different themes.

EDIT:
I also just found this error code:

"[access_compat:error] [pid 30423] [client 192.168.0.131:52914] AH01797: client denied by server configuration: /home/new/public_html/app/etc/local.xml"


texts: How to override template in magento 2.0?

texts: Based on the theme development documentation http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html here I could create a space for new theme in magento 2.0 but overriding the base template become more difficult to understand like altering page layout etc.


texts:
I have a store in Magento 2.x.x
I want to update Magento 2.3 to 2.4 but when I update it using the command:

composer require magento/product-community-edition=2.4.0 --no-update

I get the following errors:
Warning from repo.magento.com: Your Magento authentication keys are invalid. Please double-check your keys in your Marketplace account. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
Warning from repo.magento.com: Your Magento authentication keys are invalid. Please double-check your keys in your Marketplace account. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
Warning from repo.magento.com: Your Magento authentication keys are invalid. Please double-check your keys in your Marketplace account. For instructions, visit https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html
Invalid credentials for 'https://repo.magento.com/packages.json', aborting.
https://repo.magento.com could not be fully loaded, package information was loaded from the local cache and may be out of date

I have my keys but where to put these keys is an issue.


texts:
This question came to mind after I've seen the edits made by Vinai to my answer here.
Let's say we have a class to test with a constructor like this

namespace Some\Namespace;

class SomeClass
{
    public function __construct(
        \Product $product,
        \Category $category
    ) {
        $this->product = $product;
        $this->category = $category;
    }
}

I've seen in the core Magento 2 unit tests this way to mock it:

$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$productMock = $this->getMockBuilder('Product')
    ->disableOriginalConstructor()
    ->getMock();
$categoryMock = $this->getMockBuilder('Category')
    ->disableOriginalConstructor()
    ->getMock();
$model = $objectManager->getObject(
    'Some\Namespace\SomeClass',
    [
         'product' => $product,
         'category' => $category
    ]
);

And this works. I've used similar approaches in my own tests.
But Vinai made an edit (and I trust that this edit works).

This

$this->getMockBuilder('Product')

Became this

$this->getMockBuilder(\Product::class).

What's the difference? (I know what ::class means and does so don't explain this).

Then this:

$model = $objectManager->getObject(
    'Some\Namespace\SomeClass',
    [
         'product' => $product,
         'category' => $category
    ]
);

became this:

$model = new \Some\Namespace\SomeClass($product, $category);

When should I use the object manager helper to instantiate classes and when should I just use new? Or why should I use one instead of the other?


texts: Hide State/Province from Estimate and shipping tax from cart page magento2

texts:
How to remove State/Province field from the cart page?

I tried using jquery to remove it, that didn't work for me.

<script>
  require(['jquery', 'jquery/ui'], function($){

    $(document).ready(function($){
        var checkList = setInterval(function() {
            if($("#shipping-zip-form").length > 0 ){

                    //$("input[name='shippingAddress.region']").hide();
                    setTimeout(function() {
                        $("input[name='shippingAddress.region']").hide();
                    }, 2000);
                    clearInterval(checkList);
                  }
            }, 2000); // check every 1000ms

      });
  });
 </script>

Is there anyway available to remove it from xml or php code? Please anybody help on this thanks.


texts: Magento C.E 1.9.1.1 Missing Mage_XmlConnect table

texts:
I have just install magento C.E latest version: 1.9.1.1

And after install completed, i have checked the database and find that all table for Mage_XmlConnect modules are missing.But i have check it exit till magento C.E 1.9.0.1.

Missing Table Are:

xmlconnect_application
xmlconnect_config_data
xmlconnect_history
xmlconnect_images
xmlconnect_notification_template
xmlconnect_queue

Can any one tell me.is this bug or feature on magento C.E 1.9.1.1


texts: How to logout from all other devices in Magento 2?

texts: I want to manage all the logged in instances of a customer and give them an option to log out of all other devices by clicking on a link. What's the way to go about it?


texts: Ways of overidding core phtml files magento 2

texts:
I need confirmation as to are there different methods of overriding the core phtml files in magento 2.

I referred this link:
https://stackoverflow.com/questions/34601248/how-to-replace-phtml-files-in-magento-2-0

1) Are 'Custom theme' and 'Custom Module' 2 different ways of overriding phtml files?

2) I need an example for the same.


texts: One SKU, multiple products in Magento 1.9

texts:
In my store, I sell products for automobiles. My products fit many vehicles and I would like to display them separately.  Example:

Sku 808-99-2000 fits Honda, Acura, Toyota, Scion and Lexus.  I would like to display this on part as 5 different products in my one store as:

DBW for Honda
DBW for Acura
Etc.

As opposed to one long-winded product called: DBW for Honda/Acura/Toyota...


texts: How can I reopen a closed order through REST API or programmatically to enable the shipping option again on the order? I have tried changing order status to new and processing still no result. Any other way how can I do so?


texts:
I would like to call an Action from a custom block that I created which is extending the \Magento\Catalog\Block\Product\View class. Now the idea here is that I will be clicking on the Add to cart button this will trigger an Jquery ajax request that process the form and upload an image. After the processing it will return the generated image back to the frontend (jquery ajax). This url will be used during the actual Add to cart function is done. Below is my code

This is my Custom block from my Custom Module

namespace Custom\Module\Block;

use Magento\Framework\View\Element\Template;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\Product;

class ImageUploader extends \Magento\Catalog\Block\Product\View
{
    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Framework\Url\EncoderInterface $urlEncoder,
        \Magento\Framework\Json\EncoderInterface $jsonEncoder,
        \Magento\Framework\Stdlib\StringUtils $string,
        \Magento\Catalog\Helper\Product $productHelper,
        \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig,
        \Magento\Framework\Locale\FormatInterface $localeFormat,
        \Magento\Customer\Model\Session $customerSession,
        ProductRepositoryInterface $productRepository,
        \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
        array $data = []
    )
    {
        parent::__construct(
            $context,
            $urlEncoder,
            $jsonEncoder,
            $string,
            $productHelper,
            $productTypeConfig,
            $localeFormat,
            $customerSession,
            $productRepository,
            $priceCurrency,
            $data
        );
    }

    public function process()
    {
        // Return image path here to Jquery Ajax;
    }

    protected function _toHtml()
    {
        $this->setModuleName($this->extractModuleName('Magento\Catalog\Block\Product\View'));
        return parent::_toHtml();
    }
}

Now in my .phtml template I'm using an JQuery Ajax to call this ImageUploader->process() function (I'm not sure if this is the correct approach)

Below is my code

<?php $_product = $block->getProduct(); ?>

Personalise Your Label

How can I call the block action from a JQuery Ajax?


texts: The composer is installing different module versions than the required one

texts:
On a Magento 2 branch, when I am running the composer will get different module versions than the required one. Let's say for the Magento_Store module I do need the 2.0.0 version, but the composer is installing the 2.1.0 version.

So after a succesful install when I am trying to access the website, I am getting error messages for both schema_version and data_version for lot's of modules.

Example:

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Magento_Store schema: current version - 2.1.0, required version - 2.0.0
Magento_Store data: current version - 2.1.0, required version - 2.0.0
Magento_Directory schema: current version - 2.0.1, required version - 2.0.0
Magento_Directory data: current version - 2.0.1, required version - 2.0.0

And the list is very long! Only part of it has been copied above.

Until now, I was trying to modify the version number in the setup_module table from database, but no luck. Before that, I was running the bin/magento setup:upgrade command and also cleared the cache but I had the feeling I'm in a loop and always got back to the same error list. So, I guess my aproach was wrong.

Is there a solution to set up the right way the composer in order to avoid in future such problems? Or what should be the direction to aproach?


texts:
If I do the following

php bin/magento maintenance:enable
composer require magento/product-community-edition 2.3.3 --no-update
composer update
rm -rf var/di var/generation
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento maintenance:disable

This all seems to work and the upgrade works as expected. The issue is though any files changed in the following DIRs do not get updated

/lib
/setup
/dev
/ (the root)

What's the correct way of getting these files updated?

I know these are not being updated as if I create a brand new project and compare files in these folders I can see the files are different in the brand new project to the project I am upgrading


texts: How can I have different inventory for different colors for a single item?

texts:
I am working with Magento 2.1.3 and am currently trying to get my products configured on my site.

I have a few t-shirts that are available in multiple colors and I am wondering how I can get them to display on the site without appearing as "out of stock" when only one color is unavailable. (ie.. I have 70 black shirts and 0 white - same design..)

I have created product attributes that I then put into an attribute set which I then use to create a configurable product. I configure the attributes and end up with the 10 different simple products (5 sizes/2 colors). When I go to my main site, the item shows up, but displays as out of stock even though I have 70 shirts listed in the inventory.


texts:
I am facing a problem, whenever I am editing CMS page by using editor that time all of the {{skin url=''}} is being removed automatically.

Can anyone please advice me some solution?


texts: Magento 2 Custom PHP code in Admin email template

texts:
I have an email template that I'm updating using the Magento admin interface.  Essentially what I'm trying to do is get the Order ID, hash it, and send it as part of the email.

I read that PHP short tags can be used in email templates, but all of them render blank when the email is actually sent.  Here are a few variations I've tried:

This is a paragraph

<?php echo 'Hello World';?>

<?php 'Hello World';?>

<?= 'Hello World';?>

'Hello World' is not echoed out in any of these scenarios.

My question is, is it possible to inject PHP code directly into the templates via the admin portal?

Thanks in advance.


texts: PHP Fatal error on inventory:reservation:list-inconsistencies command

texts:
Magento 2.4.0
PHP 7.3
MariaDB 10.4
When I try to run this command: bin/magento inventory:reservation:list-inconsistencies -r
I get the following error:
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\InventoryReservationCli\Model\SalableQuantityInconsistency::setOrderStatus() must be of the type string, null given, called in /magento/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/Collector.php on line 129 and defined in /magento/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency.php:166
Stack trace:
#0 /magento/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/Collector.php(129): Magento\InventoryReservationCli\Model\SalableQuantityInconsistency->setOrderStatus(NULL)
#1 /magento/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/AddExpectedReservations.php(86): Magento\InventoryReservationCli\Model\SalableQuantityInconsistency\Collector->addOrderData(Array)

I have a feeling that this could be because of some data formatting error in the db. I tried running the query suggested in this thread and I get a bunch of warnings
Warning: #1292 Truncated incorrect DOUBLE value: '11-1606368878'
Warning: #1292 Truncated incorrect DOUBLE value: '11-1606369154'

The order number format is what is used by the MageStore PWA POS module.
Any idea how I can fix this? There are a bunch of products that are visible as in stock on the website but can't be purchased.
Thanks!


texts: How can i create multi store and every store have their own products.At the end, grouping the product in a specific groups or categories.Any help please.


texts: Magento 2 main.CRITICAL: Invalid template file error

texts:
I'm trying to load a simple template in the Magento 2 admin panel but the error I get in the system.log is:

main.CRITICAL: Invalid template file: 'Test_Main::dashboard/index.phtml' in module: 'Test_Main' block's name: 'test.dashboard.index' [] []

My Controller class is:

Test\Main\Controller\Adminhtml\Dashboard\Index.php

My Block class is:

Test\Main\Block\Adminhtml\Dashboard.php

My layout file is:

Test\Main\view\adminhtml\layout\test_dashboard_index.xml

My template file is:

Test\Main\view\adminhtml\template\dashboard\index.phtml

Any help would be greatly appreciated.


texts: How to join 3 tables using collection in Magento 2

texts:
I have 3 different tables each table has some data, now i want to join all 3 tables and get the data.

How to do that??

When i searched in google i found this function but its not working for me

protected function _renderData() {
    $joinTable = $this->getTable('table_1');
    $this->getSelect()->join($joinTable.' as tab','main_table.item_code = tab.item_id', array('*'));
}


texts: Can some tell me what gridTotalsCustomer in the following code?

texts:
As per my understanding its path of grid block file. If yes, then I have my code in respective place then it's giving me an error.

  Uncaught ReferenceError: gridTotalsCustomerJsObject is not defined
      at HTMLButtonElement.onclick ((index):364)

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="reports_report_customer_orders_grid"/>
    <body>
        <referenceBlock name="adminhtml.report.grid">
            <arguments>
                <argument name="id" xsi:type="string">gridTotalsCustomer</argument>
                <argument name="dataSource" xsi:type="object" shared="false">Magento\Reports\Model\ResourceModel\Customer\Totals\Collection\Initial</argument>
            </arguments>
        </referenceBlock>
        <referenceBlock name="adminhtml.report.grid.export">
            <arguments>
                <argument name="exportTypes" xsi:type="array">
                    <item name="csv" xsi:type="array">
                        <item name="urlPath" xsi:type="string">*/*/exportTotalsCsv</item>
                    </item>
                    <item name="excel" xsi:type="array">
                        <item name="urlPath" xsi:type="string">*/*/exportTotalsExcel</item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
        <referenceBlock name="adminhtml.report.grid.columnSet">
            <arguments>
                <argument name="count_totals" xsi:type="string">1</argument>
                <argument name="id" xsi:type="string">gridTotalsCustomerSet</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>


texts:
I've created a magento 2.3.2 that works locally on pc (using laragon, if it matters). Now I need to transfer site to working server, so I made a backup using phpmyadmin and tried to import .sql file into server.

I edited file to use correct database on server, as well as user that has privileges on server. User on local machine is root. User on server is an user in a shared environment.

CREATE ALGORITHM=UNDEFINED DEFINER=`SHARED_USERNAME_IN_SERVER`@`localhost` SQL SECURITY INVOKER VIEW `inventory_stock_1` AS
SELECT DISTINCT `legacy_stock_status`.`product_id` AS `product_id`,
    `legacy_stock_status`.`website_id` AS `website_id`,
    `legacy_stock_status`.`stock_id` AS `stock_id`,
    `legacy_stock_status`.`qty` AS `quantity`,
    `legacy_stock_status`.`stock_status` AS `is_salable`,
    `product`.`sku` AS `sku`
FROM (`cataloginventory_stock_status` `legacy_stock_status`
JOIN `catalog_product_entity` `product` ON `legacy_stock_status`.`product_id` = `product`.`entity_id`)

Problem is I get:

  MySQL: #1227 - “Access denied; you need (at least one of) the SUPER privilege(s) for this operation”

How can I solve this? Thanks.


texts:
I have a Magento 1.9 site and the customer login form does not work. when I try to login it just redirects back to the login page. when a user creates an account that works and they are automatically logged in. Also I am able to login to the admin panel. just not able to login as a customer.

I confirmed I am using the correct user/password and also confirmed that the form_key input is there.The customer login worked fine. However I recently moved the website from a VPS to an Amazon AWS cloud and that has been the only thing that has changed with this website.
I confirmed I have php_mbstring installed and enabled.

Looking in the system.log I only see the below
DEBUG (7): XML_ERROR:
DEBUG (7): XML_ERROR:

Any suggestions?


texts: Loading CMS blocks with 'status' set to 'disabled'

texts:
Trying to load a block for a store

$cms_block = Mage::getModel('cms/block')->setStoreId($storeId)->load($block);

and printing it I obtain two different arrays.

If the block is enabled the result is an array full of informations ([block_id], [title], [is_active] etc.)

Mage_Cms_Model_Block Object
(
    [_cacheTag:protected] => cms_block
    [_eventPrefix:protected] => core_abstract
    [_eventObject:protected] => object
    [_resourceName:protected] => cms/block
    [_resource:protected] =>
    [_resourceCollectionName:protected] => cms/block_collection
    [_dataSaveAllowed:protected] => 1
    [_isObjectNew:protected] =>
    [_data:protected] => Array
        (
            [block_id] => 214
            [title] => Home slide 1 - ES
            [identifier] => block_slide1
            [content] =>

            [creation_time] => 2016-08-17 08:41:53
            [update_time] => 2016-08-17 13:33:04
            [is_active] => 1
            [store_id] => Array
                (
                    [0] => 5
                )

            [stores] => Array
                (
                    [0] => 5
                )

        )

    [_hasDataChanges:protected] =>
    [_origData:protected] => Array
        (
            [block_id] => 214
            [title] => Home slide 1 - ES
            [identifier] => block_slide1
            [content] =>

            [creation_time] => 2016-08-17 08:41:53
            [update_time] => 2016-08-17 13:33:04
            [is_active] => 1
            [store_id] => Array
                (
                    [0] => 5
                )

            [stores] => Array
                (
                    [0] => 5
                )

        )

    [_idFieldName:protected] => block_id
    [_isDeleted:protected] =>
    [_oldFieldsMap:protected] => Array
        (
        )

    [_syncFieldsMap:protected] => Array
        (
        )

)

but if the block is disabled these data are not available:

Mage_Cms_Model_Block Object
(
    [_cacheTag:protected] => cms_block
    [_eventPrefix:protected] => core_abstract
    [_eventObject:protected] => object
    [_resourceName:protected] => cms/block
    [_resource:protected] =>
    [_resourceCollectionName:protected] => cms/block_collection
    [_dataSaveAllowed:protected] => 1
    [_isObjectNew:protected] =>
    [_data:protected] => Array
        (
            [store_id] => 1
        )

    [_hasDataChanges:protected] =>
    [_origData:protected] => Array
        (
            [store_id] => 1
        )

    [_idFieldName:protected] => block_id
    [_isDeleted:protected] =>
    [_oldFieldsMap:protected] => Array
        (
        )

    [_syncFieldsMap:protected] => Array
        (
        )

)

So, how can I load the info for a disabled CMS blocks?

I need to set them to enabled status.


texts:
I want to have a specific CSS file at the onepage checkout and I was simply wondering if there is a layout handle for that (so I don't have to make one).

Probably answered my own question, but I found this in my search: http://itpscan.info/blog/magento/layout_handles.php

Might come in handy for other people searching for default XML handles


texts: Custom IP address filtering for Magento Maintenance mode

texts:
I'm currently using some custom code to filter out IP addresses on a Magento store so I can access it whilst in development (maintenance mode).

My current code works fine except it's only for singular IP addresses added to an array.

How would I be best altering this to include cidr format addresses?

My current code is as follows:

    $ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('81.155.118.210','86.136.148.200'); // these are the IP's that are allowed to view the site.

and then further down

    if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

I would like to be able to use IP addresses such as 195.170.169.0/255 so that I don't have to add them all in singular format however I'm unsure on the best way to add cidr style IP addresses to the array?

Can someone please help?


texts: magento2 enable/disable value get and set value

texts:
I have a module which shows value in the frontend, and from admin system configuration I want to disable that module options are coming like yes/no no I want to get that value of enabling/ disable module in magento2

as you can see in the picture that options are coming now I want to enable/disable module through these options
reference:https://www.mageplaza.com/magento-2-module-development/create-system-xml-configuration-magento-2.html


texts: $order()->getSubtotal() > "Fatal error: Function name must be a string" on success checkout page

texts:
Im currently inserting google adwords tracking script on my success.phtml and trying to get the total amount from the last order.

Im trying with the following but getting an error:

<?php
    $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
    Mage::getModel('sales/order')->load($orderId);
    $total = (float)number_format($order()->getSubtotal(),2);
?>

This triggers the following error:

Fatal error: Function name must be a string

The line error reference points to: $total = (float)number_format($order()->getSubtotal(),2);


texts: Error : cron job has not been configured yet

texts:
I am running Magento 2.1.0 on Lamp-Ubuntu 16.04 with PHP 7.0.8.
I am getting an error while installing a new theme using system > web setup wizard > component manager.
In the readiness check process I am getting the following errors:
Cron script readiness check failed.

Error from Setup Application Cron Script:
Cron job has not been configured yet
Other checks will fail as a result (PHP version, PHP settings, and PHP extensions)

Error from Updater Application Cron Script:
Cron job has not been configured yet

I had created a cron job, not sure I have done it correctly (I am newbie in Linux platform). Here is how I created the cron job:
In terminal:
crontab -u user -e

and then I added the following contents:
*/5 * * * * /usr/bin/php /var/www/html/ecommerce/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/ecommerce/var/log/magento.cron.log
*/5 * * * * /usr/bin/php /var/www/html/ecommerce/update/cron.php >> /var/www/html/ecommerce/var/log/update.cron.log
*/5 * * * * /usr/bin/php /var/www/html/ecommerce/bin/magento setup:cron:run >> /var/www/html/ecommerce/var/log/setup.cron.log

I got this from official Magento documentation, I changed the php and magento directory according to my setup.
But I am still getting this error. How can I check whether those jobs are running?
Is there anything else I should do?  Should I create any files ?
I added the following job below those 3 jobs for testing purpose
*/5 * * * * /usr/bin/php /var/www/html/ecommerce/testcron/testcron.php >> /var/www/html/ecommerce/testcron/cron.out

testcron.php:
<?php
    echo "Hello " ;
?>

cron.out file was working fine (showing the text hello).
So whats the problem with those 3 jobs?


texts:
I have created a customer product attribute called "payer". It is a drop down attribute & its value is yes or no.
Now on the checkout page, I want to get the "payer" attribute values of the cart products. How can I do this?
On which page do I need to write the code?


texts: Magento2 admin tab product grid filter reload issue

texts:
I have been struggling with this for a couple days now... I have created a module that add a new tab to the customer admin page.

It works fine when loading and displaying the information I need but when I use the filters to find a product it reloads the whole tab instead of just the current grid overwriting the whole container.

In short I have 1 controller to generate the page from the following layout

  Morello\Customerproducts\view\adminhtml\layout\customerproducts_index_customer.xml

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <container name="content" label="Root">

        <block class="\Morello\Customproducts\Block\Adminhtml\Edit\Page\Frame" name="customer_product_edit_frame"  template="Morello_Customproducts::frame.phtml">

            <block class="\Morello\Customproducts\Block\Adminhtml\Edit\Page\CustomerProducts" template="Morello_Customproducts::products.phtml" name="customer_products">
                <block class="\Morello\Customproducts\Block\Adminhtml\Edit\Page\CustomerProductsGrid" name="customer_products_grid" as="customer_products_grid" />
            </block>

            <block class="\Morello\Customproducts\Block\Adminhtml\Edit\Page\Search" template="Morello_Customproducts::search.phtml" name="customer_product_search">
                <block class="\Morello\Customproducts\Block\Adminhtml\Edit\Page\SearchProductGrid" name="customer_product_search_grid" as="customer_product_search_grid" />
            </block>

        </block>

    </container>

</layout>

As you can see I actually have 2 grids customer_products_grid and customer_product_search_grid for simplicity I will focus on the latter because I need to understand the process and I'll apply it to the former as well later on...

The grid module class file reference by \Morello\Customproducts\Block\Adminhtml\Edit\Page\SearchProductGrid contains the following

  Morello\Customerproducts\Block\Adminhtml\Edit\Page\SearchProduct.php

<?php

namespace Morello\Customproducts\Block\Adminhtml\Edit\Page;

use Magento\Backend\Block\Template\Context;
use Magento\Backend\Helper\Data;
use Magento\Backend\Model\Session\Quote;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;

class SearchProductGrid extends \Magento\Backend\Block\Widget\Grid\Extended
{

    private $productCollectionFactory;
    private $sessionQuote;

    public function __construct(
        //...
    )
    {
        //...
    }

    protected function _construct()
    {
        //..
    }

    public function getStore()
    {
        //...
    }

    public function getProductCollection()
    {
        //...
    }

    protected function _prepareCollection()
    {
        //...
    }

    protected function _prepareColumns()
    {
        //...
        return parent::_prepareColumns();
    }

    /*************************************************************************/

    // I KNOW I HAVE TO USE THIS TO GET WHAT I WANT BUT I CAN'T FIGURE OUT HOW

    /*************************************************************************/
    public function getGridUrl()
    {
        return $this->getUrl(
            'customproducts/*/???', ['_current' => true, 'collapse' => null]
        );
    }

}

This is currently my ONLY controller

  Morello\Customerproducts\Controller\Adminhtml\Index\Customer.php

class Customer extends \Magento\Customer\Controller\Adminhtml\Index
{
    public function execute()
    {
        $this->initCurrentCustomer();
        $resultLayout = $this->resultLayoutFactory->create();
        return $resultLayout;
    }
}

WHAT AM I MISSING?

Any help is appreciated, thanks guys.


texts: Add custom data on Order view frontend page in magento 1.9

texts:
How to add my custom data or field under shipping method section in the frontend order view page without overriding template file(app\design\frontend\default\yourtheme\template\sales\order\info.phtml).
can i do it by using Event Observer(core_block_abstract_to_html_after) Please Help.


texts: Magento 1.9 : Magereport warning 7405 not installed

texts:
We have upgraded Magento to 1.9.3.4 and check in magereport.com , everything is fine but it is showing 7405 not installed.

How can i solve this, please find the below screenshot:

http://prntscr.com/fvx810

Thanks


texts: Disable billing address for virtual products

texts:
I have a Magento 2.1.2 and I am using it to sell some products
My issue is not being able to place order on virtual products
Where I live, banks do not need the billing address when you are using a Visa/Mastercard for online purchases but I guess Magento requires it as a default rule for security
When users add virtual products and proceed to the checkout page and fill the payment fields, they cannot press on the “Place Order” button. However Physical products doesn’t have that issue
The picture below shows the fields and information required by users to fill when they are purchasing a virtual product


texts: Magento 2: How to setup layerd navigation in custom product collection?

texts:
I am trying to set a layered navigation filter on the custom cms page.
for that, I have created a 1 cms page name test with two-column with left bar.
and inside it, I have called one template file

  {{block class="Magento\Framework\View\Element\Template"
  template="Magento_Theme::html/test.phtml"}}

in the CMS layout update, I have placed this code

<referenceContainer name="sidebar.main">
        <block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="layer/view.phtml">
            <block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalog.navigation.state" as="state" />
            <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
        </block>
</referenceContainer>

for calling product filter

inside the test.phtml file I have searched the products from the collection.

if(isset($_REQUEST["test"])) {
        $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
        $imageHelper = $objectManager->get('\Magento\Catalog\Helper\Image');
        $collection = $productCollection->create()
                        ->addAttributeToSelect('*')
                        ->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
                        ->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
                        ->addAttributeToFilter('test', $_REQUEST["test"])
                        ->load();
    }

when I click on any of the filter options then my URL becomes

  http://127.0.0.1/test?price=-1000&test=code

so can I get the filter request but it is a very tedious task to set a filter in collection manually.

And on the home page, I have set one search box for search products.

    <form id="testsearch" action="http://127.0.0.1/magento/test" >

Find Matching Part

        <input type="text" name="test">
        <button type="submit">SEARCH</button>

    </form>

  I know that this is not a standard way to do that but anyone can help
  me to set this filter in custom cms page.

Any help would be appreciated.

Thanks in advance..!


texts: Rendering STL file into a STL viewer which is in a new web page

texts:
Here is another question....
I've uploaded a STL file as an additional file for a product. And it gets downloaded in frontend as shown in screen shot.

When I click on that link for STL Downloader, then that STL file will be downloaded successfully. Tried and tested too many times and it worked like a charm. But I don't want that STL file to be downloaded. I want it to be rendered to a STL viewer which I built. That STL viewer is in another web page. So clicking Click here to download associated STL file link should render the STL file to the STL viewer which is in another web page. How can I do it? I don't want users to download STL files because it is the intellectual property of my company.


texts: How to calculate taxes based on shipping address?

texts:
Taxes are calculated using the address in the customer profile.
A customer can just register with an address from a country without taxes, set his default shipping address to this address, then checkout and enter another address.
He should pay taxes based on the shipping address entered during checkout, but he isn't because magento uses the profile data to calculate the taxes!
How to change this?


texts: When No value is entered for multiselect attribute whose values are mapped with image, Broken image is getting displayed

texts:
I have created an Multiselect attribute featuredetail in magento 1.9.2.4.
Then mapping is done  with an image for every attribute value.

My phtml file for calling this attribute is:

    <?php
    $Feature = explode(",",$_product->getResource()
    ->getAttribute('featuredetail')->getFrontend()
    ->getValue($_product));

      foreach($Feature as $key => $value): ?>
         <a href="<?php echo $_product->getProductUrl() ?>" ?>
            <?php echo ""; ?>

    <?php echo $value; ?>
  <?php endforeach; ?>

Then I called this attribute to be displayed in product-collateral tab in product details page. When value is not entered for any attribute that is included inside the product collateral tab, the tab should be hidden. So I modified the product-collateral tab code in view.phtml like this:

    <?php if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>

            <?php foreach ($detailedInfoGroup as $alias => $html):?>
            <?php

                    **if(trim($html)=="") continue;**
            ?>

<?php echo $this->escapeHtml($this->getChildData($alias, 'title')) ?>

<?php echo $html ?>

            <?php endforeach;?>

    <?php endif; ?>

This modified code is working well for the description attribute. But for the multiselect attribute with mapped image, when no value is selected for this attribute it is displaying broken image instead of hiding the tab.

What modification should be done to resolve this?


texts:
I want to set shipping address for a particular quote.

I load quote:

$quote = Mage::getModel('sales/quote')->load($quoteId);

I load address from a customer model:

$shippingAddress = Mage::getModel('customer/address')->load($addressId);

after that i want to set shipping address by this code:

$quote->setShippingAddress($addressId)->save();

but setShippingAddress method returns me an error:

Internal Error. Please see log for details

I have no idea how to resolve that.


texts: Magento rwd custom theme add rounded corners compass

texts:
i am building a custom theme based on the default Magento 1.9 rwd-theme. What is the best way to add rounded corners (for my buttons etc)?

If have seen this, but how do i add them to my Magento theme?

Thanks!


texts: How to add custom registration plugin in my CUSTOM FOrm

texts:
Hello I have one Custom registration filed plugin i want to add field in my custom form how can i do that? i share the code they use customer attribute to add field how can i add field in my custom form

$attributeObj->setData('used_in_forms', $usedInForms);
        $fieldset->addField(
            'used_in_forms',
            'multiselect',
            [
                'name' => 'used_in_forms[]',
                'label' => __('Display Fields in Form'),
                'title' => __('Display Fields in Form'),
                'values' => [
                    ['label' => __('Admin Customer Form'), 'value' => 'adminhtml_customer'],
                    ['label' => __('Customer Account'), 'value' => 'customer_account_edit'],
                    ['label' => __('Registration Form'), 'value' => 'customer_account_create'],

                    ['label' => __('Custom Registration Form'), 'value' => 'customer_index_index'],
                ],
                'required' => true
            ]
        );


texts: Magento 2 : Hide default review rich snippets

texts:
In Magento 2, I want to hide the default rich snippets. I already figured out how to remove the price and product rich snippets by reading this blog: http://blog.mageworx.com/2016/09/extending-rich-snippets-functionality-in-magento-2/

But if you have your reviews enabled in Magento, it will automatically create rich snippets for the rating and reviews. Does anybody know how to remove the structured data of the rating and reviews?


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

texts:
I changed the color of "Availability: In stock" in green but i want to change the color "Availability: In stock" programmly.
For example

if the quantity of product  < 5 i want to color "Availability: In
stock" in red

if the quantity of product  > 5 and the quantity of
product < 10, i want to color "Availability: In stock" in orange

if the quantity of product  > 5 and the quantity of product <
 10, i want to color "Availability: In stock" in green


texts: Search Results Sorting Recently Edited Items to the Bottom

texts:
If I search for a brand on my site, by default I get back all items of that brand, sorted by relevance. Since they all are the same brand and therefor equally relevant for that search, they are sorted by a second condition. This conditions appears to be when the item was last updated, in reverse. So whenever I change a product on the admin backend and save it, it then shows up at the bottom of the search list.

I want to find where this is being done, then reverse it so that the secondary sort put items most recently updated at the top of the results instead. Anyone have any ideas of where the relevant section of code may be found?


texts: How to show all in one step shipping address, shipping method, payment method billing address and summary?

texts:
I want to make functionality to display all steps on one page with show mode.
So right now default functionality is to 2 steps on the checkout page but I need all in one step.


texts: Disk space issue with Advanced Reporting after update from 2.2.3 to 2.2.6

texts:
I'm experiencing a big weird issue. I have updated 3 days ago from Magento 2.2.3 to 2.2.6. Everything went just fine. But on the day after the update, I received a warning from server health monitor regarding a disk space issue.
A file had been created on sever root, in /tmp/analytics folder:

~tmp-1537660818.7487tar.tar : 11G

3 days after that, I have 3 files in that folder:

~tmp-1537660818.7487tar.tar : 11G

~tmp-1537747210.659tar.tar : 6,5M

~tmp-1537833608.7409tar.tar : 2G

File owner is the website owner. When I open file with terminal, I get endless lines repetitions :

x order_addresses.csv
x ../: Path contains '..'
x .././: Path contains '..'
x ../././: Path contains '..'
x .././././: Path contains '..'
x ../././././: Path contains '..'
x .././././././: Path contains '..'
x ../././././././: Path contains '..'
x .././././././././: Path contains '..'
x ../././././././././: Path contains '..'
x .././././././././././: Path contains '..'
x ../././././././././././: Path contains '..'

Files seem to be created along with the database backup each night. But I can't find logic between database backup and csv files. I disabled database backup for the coming night to see if the problem remains.

I found 2 files mentionning order_addresses:

vendor/magento/module-sales-analytics/etc/analytics.xml

vendor/magento/module-sales-analytics/etc/reports.xml

Any idea on what could cause this issue ?

**** EDIT 1 ****

Disabling the database auto backup did not  change my issue. Tonight a 6.5M file has been created. I will not delete this one as it's not a big problem of disk space and keep on checking this issue.

**** EDIT 2 ****

Uncompressing the tar files with tar ztvf yourfile.tar.gz gives me other results:

-rw-rw-r--  0 domainuser psacln 100669 26 sep 02:00 order_addresses.csv
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 ../
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 .././
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 ../././
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 .././././
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 ../././././
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 .././././././
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 ../././././././
drwxrwxr-x  0 domainuser psacln      0 26 sep 02:00 .././././././././

Last night the server got stuck again with a 13G file.

**** EDIT 3 ****

I tried to open the file with 7zX, it loops endlessly. I also tried with an application called Décompresser (2.0.2), and it creates a folder with an error alert. The folder contains a order_addresses.csv file with 5 columns : entity_id, customer_id, city, region, country_id.
But I can't find what creates or tries to create, or at least tries to handle that file every night...

Again, only place I can find order_addresses mentionned is in vendor/magento/module-sales-analytics... Any idea ?

**** EDIT 4 ****

module-sales-analytics seems to be used by Advanced Reporting module which on my side is very buggy from the start! It always leads me to a 404. I will try to reconfigure the module, or disable it.

**** EDIT 5 ****

Setup / Configuration:

Linux dedicated server
CentOS 6.9
Plesk Onyx Version 17.5.3
PHP 7.0.32
Document root : httpdocs/pub
Include_path : .:/var/www/vhosts/mydomain.com/httpdocs/vendor/magento/zendframework1/library

**** EDIT 6 ****

Reauthorizing Magento Analytics user did not change the thing, still got a 13G file this night. I just disabled Advanced Reporting module to see the change.

**** EDIT 7 ****

Disabling Advanced Reporting module solved the issue, but it's not the best solution I think, more of a workaround. I tried to reach Advanced Reporting module devs but no answers.


texts: Not able to save Custom field in customer registration

texts:
My magento version 1.9
I created one custom field in customer registration form using below tutorial.
http://phpmagento.blogspot.in/2012/02/custom-field-in-customer-registration.html

field is showing in database but while registration not saving the value.
after registration.If we are editing the value it will save smoothly.

Thanks in advance.


texts: I would like to be able to disable customers' accounts temporarily

texts: Just disabling the login would be sufficient. I can't seem to find a plugin that does that and then allows the account to be reactivated. Would simply unconfirming the account do or would someone be able to just send a reactivation email to get around it?


texts:
I recently installed Magento-2. I want Zapier to connect to Magento 2.

In Magento 1.9, I simply had to create and account and a role with an API key for Zapier to connect to the application.

Does anyone know the solution for how to proceed from here?


texts:
I try to install extension Magento 2 SMTP.

https://www.mageplaza.com/magento-2-smtp/

So I downloaded the extension and upload FTP to folder:
app/code/Mageplaza/magento-2-smtp-master

Then I run the SSH command:

wget https://getcomposer.org/composer.phar

php composer.phar require mageplaza/module-smtp

When I run this command I get error, below is screenshot. Anyone know how to solve it ?