texts: magento2 how to upload image into databse table from front end

texts:
this is my input form given below what are the steps to save the image in database

<html>
<body>
<form action="<?php echo $this->getUrl("helloworld/index/FileUpload");?>" method="post" enctype="multipart/form-data">

    <label for="bs_image">Image</label>
    <input type="file" id="bs_image" name="bs_image" required="true"/>
    <input type="submit" value="Submit" />

</form>
</body>
</html>


texts: How to add the product name to the product details div

texts:
I want to add the product name in the top of the right div in the propduct page.

Here is my template path enabled:

Here is my custom theme catalog_product_view.xml

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="mage/gallery/gallery.css"/>
    </head>
    <update handle="catalog_product_opengraph" />
    <update handle="page_calendar"/>
    <body>
        <referenceContainer name="sidebar.main">
            <block class="Magento\Cms\Block\Block" name="fasony-custom-block" after="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">fasony-custom-block</argument>
                </arguments>
            </block>
            <block class="Magento\Cms\Block\Block" name="fasony-sidebar-products2" after="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">fasony-sidebar-products2</argument>
                </arguments>
            </block>
            <block class="Magento\Cms\Block\Block" name="fasony-sidebar-banner" after="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">fasony-banner-sidebar</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>


texts: Create an option value for product attribute when importing a product

texts:
I am importing products with the help of avs-fastsimeplimport. The way I do it is I create an array with keys - the name of the attribute, and values - the corresponding value for that attribute that I get from an XML. If some value of an option does not exist (but I have it in the XML), then it is being created on the fly. before I'd do it like this:

creating some parts of the import array...
$this->_createOptionValueIfNotExists('manufacturer', (string)value);
$importArray['manufacturer'] = (string)value;
creating some more parts of the import array...

and at the end, when the array is created, another method is called, that does the job with the AVS-fastsimpleimport module.

But now I should move this creation of option values into another class. And it comes after creating the array but BEFORE calling the function that actually does the importing process. I get exception (custom made) that notifies me, that the value set for ['manufacturer'] is invalid, and then gives me a list of the possible options, where I can actually see also the newly created option...!

I experimented with putting die(); before and after the function that does the importing of the created array:

if I put it before - I don't even get the exception (which means the error happens when I try to import the array values), and when I go to the back-end I can see my newly created value for that option (and the importing hasn't happened at that point).
if I put it after - I ofcourse get the exception... (because it is almost a complete process of importing).

Summarizing: if I create the option value before I set the value for that value into the product array, to be imported, it works. If I create the option value after the value is set into the product array - it is saved in the back-end before the importing takes place, but I still get exception. And the bad part is that it is basically not possible to create the option value before I set the value in the array in another way than it's now. And I don't want that way.

UPDATE:
Can be closed.


texts:
I tried below code in my TestController.php but I do not understand how to put text on rectangle

$pdf = new Zend_Pdf();
    $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     // $this->_setFontRegular($page, 10);
        $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
        $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
        $page->setLineWidth(0.5);

        $this->y -= 10;

        $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));

    $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);

    define('FONT_SIZE'      , 12);
    define('MARGIN_LEFT'    , 40);
    define('MARGIN_TOP'     , 40);
    define('COL_WIDTH'      , 100);
    define('COL_LEFT_MARGIN', 10);
    define('COL_SEPARATOR'  , '|');
    define('ROW_HEIGHT'     , 20);

    $row = 1;
    $x = MARGIN_LEFT;
    $y = MARGIN_TOP;
$linecolor = "#cccccc";
$fillcolor = "#000000";
    $page->setFont($font, FONT_SIZE);
    $page->drawText('Text on Rectangle', $x, $page->getHeight() - $y);
    $page->setFillColor(Zend_Pdf_Color_Html::color($fillcolor));
$page->setFillColor(Zend_Pdf_Color_Html::color($linecolor));
    //$page->drawRectangle(10, 50, 200, 450);
    $page->drawRectangle(25, 0, 570, $page->getHeight() - 45);

    $x += COL_WIDTH;

    $x += COL_LEFT_MARGIN;

    $x = MARGIN_LEFT;
    $y += ROW_HEIGHT;
    //echo "<pre>";
    //print_r($page->getContents());
    $pdf->pages[] = $page;
    //$pdf->save("test_{$now->getTimestamp()}.pdf");
    $this->_prepareDownloadResponse('invoice.pdf', $pdf->render(), 'application/pdf');

I want to similar like below image in pdf


texts: I want to update price before product added to cart

texts:
I am new in Magento, I am using Magento 1.9. I am making a module that will update price based on the width and height of the print,
for that I create a module /app/code/local/Cart/Updates.
I created a file Cart_Updates.xml that I uploaded to a directory /app/etc/modules then module start showing on admin with code

<?xml version="1.0" encoding="UTF-8"?>
  <config>
     <modules>
       <Cart_Updates>
         <codePool>local</codePool>
         <active>true</active>
       </Cart_Updates>
    </modules>
  </config>

I created files config.xml and Observer.php

<?xml version="1.0"?>
<config>
  <global>
    <models>
        <cart_updates>
             <class>Cart_Updates_Model</class>
        </cart_updates>
    </models>
    <events>
      <checkout_cart_update_items_after><!--Event to override price after adding product to cart-->
        <observers>
          <cart_updates_observer><!--Any unique identifier name -->
            <type>singleton</type>
            <class>updates/observer</class><!--Our observer class name-->
            <method>updatePrice</method><!--Method to be called from our observer class-->
          </cart_updates_observer>
        </observers>
      </checkout_cart_update_items_after>
    </events>
  </global>
</config>

I upload config.xml to /app/code/local/Cart/Updates/etc

and Observer.php to /app/code/local/Cart/Updates/Model

<?php
class Cart_Updates_Model_Observer
    {

 public function updatePrice($observer){
        $event = $observer->getEvent();
        $product = $event->getProduct();
        $quote_item = $event->getQuoteItem();
        $new_price = 30;
        $quote_item->setOriginalCustomPrice($new_price);

        $quote_item->getQuote()->save();

    }

      }
?>


texts:
I have a problem with my theme. When I am using a registered account, the dropdown does not appear, the white space remains.
I am attaching the photo:

I tried the original LUMA theme, and it appears.
But when I enable the theme I bought gives me this error, unfortunately the assistance has expired and I can't ask for help directly.
What could the use be?


texts: Is is possible to add custom attributes to a shopping cart item?

texts:
I need to add an attribute to a product as soon as I add it to the shopping cart.

I have seen that you can add a custom attribute via the admin panel, but it just applies to the product itself. Is this even possible?


texts: ReflectionException: Class Interceptor does not exist in /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php:19

texts:
I'm getting this error on my homepage

ReflectionException: Class Magento\Framework\App\Http\Interceptor does not exist in /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php:19 Stack trace: #0 /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Framewo...') #1 /var/www/html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(49): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...') #2 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(48): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...') #3 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...', Array) #4 /var/www/html/vendor/magento/framework/App/Bootstrap.php(235): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...', Array) #5 /var/www/html/index.php(38): Magento\Framework\App\Bootstrap->createApplication('Magento\Framewo...') #6 {main}

So I tried to setup:di:compile
I had an error in vendor/aheadworks/module-acr/Controller/Adminhtml/Wysiwyg/Directive.php
It was using a missing class use Magento\Framework\App\Action\HttpGetActionInterface;
So I wrote that class in order to make the setup:di:compile works

Compilation was started.
Interception cache generation... 7/7 [============================] 100% 31 secs 380.0 MiB
Generated code and dependency injection configuration successfully.

But I keep getting the same error on my main page, any ideas ?


texts: Adding a phone number to create account, and html style sheet

texts:
There are few things I am trying to accomplish here, I want to add a phone number to the “create my account” form of my website, along with that I want to add a style sheet to my html that links to that phone number, (kind of creates a user ID, with phone number), would this be possible?

I am using Magento 2 via AWS lightsail.

Thank you for your help.


texts: When and where is used the getAllowedMethods method?

texts:
I'm implementing a custom carrier and did notice the getAllowedMethods method defined at Mage_Shipping_Model_Carrier_Interface. I know that it returns an array with the allowed methods but I can't yet figure out in which scenario this method is used/called.

Also, what's the format that the data in the array should have? What does the keys are and what does the values represent?


texts: Magento : Quickpay Payment Extension Doesn't Work at All in Frontend

texts: it should go to payment page after select payment method and clicking place order button but it redirects to a blank page example.com/quickpaypayment/payment/redirect with nothing in it.


texts: Sorry, no quotes are available for this order at this time | Magento 2

texts:
Sometimes i get this error on checkout shipping page with login users (random times):

"Sorry, no quotes are available for this order at this time"

the problem is that rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id is empty when i found the error

  estimate-shipping-methods-by-address-id is empty (response [])
  No errors on console
  If a use guest checkout i have no error with same products in cart
  Json "window.checkoutConfig" country_id and weight are right value
  Magento 2.2.6 - Developer mode
  Same error with fixed rate and table rate

How can i debug?

  If i click "Update Shopping Cart" in cart page the problem solved and shipping calculation is right


texts: Get current customer collection in custom account navigation link

texts:
I have created the custom link in customer account left navigation. I am successfully created it.

I am trying to get current customer Data in template file. I am getting 500 server error. Below is the code i used in my block file

 class Lists extends \Magento\Framework\View\Element\Template
 {
  protected $helperData;
  public function __construct(
    \[vendor]\[Module]\Helper\Data $helperData,
  ) {
        $this->helperData = $helperData;
  }
  public function _prepareLayout()
   {
    return parent::_prepareLayout();
   }

  public function currentCustomer(){
    return $this->helperData->getCurrentCustomer();
  }

}

Used like below in template file.

$customerObj = $this->currentCustomer();
echo '<pre>';
print_r($customerObj);die;

Helper file is like below.

  class Data extends \Magento\Framework\App\Helper\AbstractHelper
   {
    protected $customerSession;
    protected $customerRepository;
     public function __construct(
    \Magento\Framework\App\Helper\Context $context,
    \Magento\Customer\Model\Session $customerSession,
    \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository

) {
    $this->customerSession = $customerSession;
    $this->customerRepository = $customerRepository;
    parent::__construct($context);
}
    public function getCurrentCustomer() {
      $customer = $this->customerSession->getCustomer();
      $customerId = $customer->getId();
      $customer = $this->customerRepository->getById($customerId);

      return $customer;
    }
 }

Please anyone look the code and suggest me.Thanks


texts: filter a product collection by attribute and tag

texts:
How can I filter a collection by both an attribute and by a tag?

I can filter a product collection by doing:

Mage::app()->setCurrentStore( $storeId );

$collection = Mage::getModel( 'catalog/product' );

/** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
$collection = $product->getCollection();
$collection->addAttributeToSelect( '*' );

$collection->addAttributeToFilter( 'attribute_set_id', $attribute_set_id );

And I can get the tag ID by doing:

$tag = Mage::getModel('tag/tag')->loadByName($tag_name);

I've found that you can do like this to filter by tag:

$products = Mage::getResourceModel('tag/product_collection')
                    ->addAttributeToSelect( '*' ) //
                    ->addTagFilter($tag->getId()) //filter by the tag object
                    ->addStoreFilter(Mage::app()->getStore()->getId());

But I'd like to combine the first type of filter with the second, as to be able to filter both by attribute and optionally by tag.


texts: Separate store view which reverts back to the default store view

texts:
I am setting up a store view for my mobile app which I am going to strip away the header and footer along with some other customisation.

After creating a store view and then going to it I have noticed that going to the main URL: www.example.com will not go back to the default store view.

This will cause a problem with people using the app then going to the website using there mobile browser.

How can I make the main domain the default store view?


texts:
I run soon my site e-commerce international I am looking to know how to put taxes on magento for all countries.
There is the possibility of using an extension or a csv file?


texts: Magento Bootstrap Menu expands on reload then collapses

texts:
I have a bootstrap nav in my store. When the page loads the whole expanded menu shows then flashes to normal. Im not sure what Im missing.

<?php if ($_menu): ?>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
                    <?php echo $this->__('Toggle Navigation') ?>

                </button>

                    <?php echo $_menu ?>

Brands

Scratch &amp; Dent

Promotions &amp; Rebates

Parts Department

<?php endif ?>


texts:
Configuring cron with the following lines (using sudo crontab -u daemon -e)

* * * * * bash /path/to/magento/cron.sh --mode default >> /path/to/magento/var/log/cron.log 2>&1
* * * * * bash /path/to/magento/cron.sh --mode always >> /path/to/magento/var/log/cron.log 2>&1

or running the following line from shell

bash /path/to/magento/cron.sh --mode always

gives this error:

Could not open input file: /path/to/magento/--mode

Why does the filename get truncated?


texts: Long response time for Mage_Core_Model_Session_Abstract_Varien::start

texts:
So I have been noticing in New Relic on a lot of our sites, a lot of our long page loads are happening due to Mage_Core_Model_Session_Abstract_Varien::start. I have done some research and haven't really seen anyone else talking about this.

We use Nginx, PHP FPM, Redis for Caching and Memcache for sessions. Some of my ideas are that maybe it is something else that is taking forever and it just appears that loading the session is the problem. Or somehow there is some custom code adding a lot of data to the session causing huge sessions.

I am not that knowledgeable in terms of sessions and how they are managed, however I found some articles talking about Session locking. However I don't think that people would be opening so many pages at the same time.

Some of these loads are like 20 - 30 seconds. I am just curious if anyone else has noticed this or had more knowledge on how to analyze these types of long requests due to sessions.


texts:
I'm getting the next error after docker-compose up.

  Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to
  allocate 12288 bytes) in
  /var/www/html/vendor/zendframework/zend-modulemanager/src/ModuleManager.php

Magento ver. 2.1.7
I'm using mageinferno/magento2-php:7.0-fpm-1

Here is docker-compose code:

version: '3'
services:

phpfpm:
    build: ./.docker/phpfpm
    links:
        - database
    volumes:
        - ./:/var/www/html
    environment:
        - XDEBUG_CONFIG=remote_host=10.200.10.1
        - PHP_IDE_CONFIF=serverName=terp

  nginx:
      build: ./.docker/nginx
      links:
          - phpfpm
      volumes:
          - .:/var/www/html
      ports:
          - "8083:80"

  database:
      image: mysql:5.7
      environment:
          - MYSQL_ROOT_PASSWORD=qwerqwer
          - MYSQL_DATABASE=terp
          - MYSQL_USER=terp
          - MYSQL_PASSWORD=qwerqwer
      ports:
          - "3311:3306"
      volumes:
          - ./mysql-data:/var/lib/mysql

What could be the reason of that?


texts: Magento 2 - Prevent saving customer address on checkout to customer account

texts:
By default, when a user first checks out they are presented with the shipping address form because they have no shipping address.  Once they complete an order, the address they used is being saved to their account.

I would like to disable the address being saved to their account so that the user presented with the address form every time they order.

Updated in response to Ramkishan's reply

MyModule\Observer\SalesOrderPlaceAfterObserver.php

    <?php
namespace Company\Vendors\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class SalesOrderPlaceAfterObserver implements ObserverInterface
{
  public function execute(\Magento\Framework\Event\Observer $observer)
      {
    $order = $observer->getOrder();
    $customerAddressId =  $order->getShippingAddress()->getCustomerAddressId();
    // Inject Magento\Customer\Api\AddressRepositoryInterface in constructor and remove customer address.
    $this->customerAddressRepository->deleteById($customerAddressId);
      }
}

Company\MyModule\etc\events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_place_after">
        <observer name="sales_order_place_after" instance="Company\Vendors\Observer\SalesOrderPlaceAfterObserver" />
    </event>
</config>

This is what I currently have and when I go to complete the order, i get the error just above the "Place Order" button after pressing it but it says nothing at all.  No text appears, just the error icon and error colour background

This is my first time creating an observer, where have I gone wrong?

Update

I've just noticed that each time it failed, it was saving the address.  As I pressed the button 4 times to try and see an error message, I now have the same address saved 4 times as different addresses to the same user.


texts: How to get local storage in magento controller to use as available?

texts:
I writing a plugin to add condition into beforeLoad function of product collection. I set local storage example js to set local storage:

if (typeof(Storage) !== "undefined") {
    // Store
    localStorage.setItem("inventory", "HAN");
    // Retrieve
    document.getElementById("inventory").innerHTML = localStorage.getItem("inventory");
}

In the magento plugin I want to get inventory value 'HAN' from local storage to use in php class. I wrote the code as below but it can't get inventory in local storage:

    public function beforeLoad(\Magento\Catalog\Model\ResourceModel\Product\Collection $subject, $printQuery = false, $logQuery = false)
    {

        $inventory = "<script>document.write(parseInt(Object.keys(JSON.parse(window.localStorage.getItem('inventory')))))</script>";
        $test = "<script>document.write(localStorage.getItem('inventory'));</script>";

        $joinCondition[] = "e.sku = isi.sku";
        $joinCondition[] = "isi.source_code = '".$inventory."'";
        $joinCondition = implode(' AND ', $joinCondition);
        //var_dump($requestParams);
        if (!$subject->isLoaded()) {
            // you can do your customzation/custom logic with $subject object
            //addFieldToFilter('sku', 'MG-854693')
            $subject->getSelect()->join(
                    [ 'isi' => $subject->getTable('inventory_source_item') ],
                    $joinCondition,
                    []
                );
        }

        return [$printQuery, $logQuery];
    }
}

Please help me, How to get inventory value in php class?

Thank you so much,
BienHV


texts: Magento 2.1 spam users even when captcha is enabled

texts:
In Magento 2.1.10, I have successfully enabled captcha for customer registration form but I am still getting fake users registered on website.

This is the registration form:

These are fake users in admin:

I have tested the registration form and it seems to be working fine. Then from where these users are getting registered and how to prevent this?


texts:
I am unable to change the Website title name.

Can any one help me to change website name on browser tab in magento2.


texts:
We have written media query for iPhone resolution for our site. Now, we want to check it in real iPhone devices but we don't have an iPhone. However, we have Mac Laptop, is it possible to imitate iPhone through Mac laptop?

Please guide me!


texts:
How can I create a drop down fly-out menu with images? Similar to the Microsoft's menu. Screenshot and link to Microsoft's example.

http://www.microsoft.com/en-us/default.aspx

Thank you


texts: Display attribute set groups with product

texts:
I need to display groups with attributes when I display product informations.
For example, I have an attribute set with there informations :

Group 1 : Attribute1 Attribute2
Group 2 : Attribute1 Attribute2

I like to display all attributes and also the group's name in the product.


texts: Change layout in adminhtml to columns with left sidebar on product edit and add new product page

texts: In magetno1 product edit page looks with left sidebar tabs, but in magento2 it looks without tabs in left sidebar and it is too long page. How can i change page layout in adminhtml on add product page?


texts: Can I used SSL certificate on my testing/staging developement server?

texts:
I have to install SSL certificate on my domain but before that I want to test it on my testing domain which have same  so I can find out unknown error.

Is it possible to  use it on testing domain first then used for main domain after that?

I have hostgator basic dedicated server plan ..

 Intel E3-1220v3
 3.10 GHz Quad Core
 6 GB RAM
 1000 GB HDD in RAID 1
2 free IP
1 TB transfer

I have single domain certificate.

I want to do so because it may cause down website for unknown time


texts:
How to prevent spam account registration, aside from enabling CAPTCHA on forms (which I've already tried)? We're dealing with a steady flood of them.

The first name field is always Russian characters, so failing an easier route, maybe a way to detect a certain character and blocking the registration in that case?


texts: How to make textarea product attribute value to use default value for specific store?

texts:
I'm using magento 2.4.1 and I tried to set the product textarea attribute to use default value like this for specific store id:
$insertAttData['textarea_attribute'] = NULL;
$this->productAction->updateAttributes(array(
            $productId
        ) , $insertAttData, '1');

but the result is the attribute value does not got change at all


texts:
We have almost 300 products on our site. For each product, we have created the images. Let say, the average size of images for one product is 4MB. But as far as I understand, cache serves the Storefront images and the cache images are less in size compared to the original image size. In this case, can I directly upload the created images without using any compression? or is it good to use a compression tool to compress the images before uploading them to site?

Looking forward to your help.


texts: How to write own method for Lifetime sales calculation in magento2?

texts:
Hi I want lifetime closed order sales accurate record in my magento2 store

I write a code for it using core php :

<?php
$servername = "localhost";
$username = "aaa";
$password = "aaaa";
$dbname = "mydb";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT sum(base_grand_total) as total FROM `sales_order` WHERE status='processing_closed'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo  $row["total"];
    }
} else {
    echo "0 results";
}
$conn->close();
?>

It gives me accurate revenue my store generated from the start . now i want to display that result over here

For this i paste that code in below file location:

vendor/module-backend/Block/Dashboard/Sales.php

but that gives me error refuse to pass new connection inside file , i am new in magento2 please help me how can i get my results over here , i have learned that magento2 have builtin calculation for this using reports but every time when i  refresh stats it gives me wrong value so that's why i wants to write my own method for it because my last status of order is collected_closed   which i manually create , Please guide for solutions thanks !


texts: Modify Fishpig splash Attribute Splash page

texts:
I have installed the Fishpig Attribute Splash Pages and all is working well.

https://www.magentocommerce.com/magento-connect/attribute-splash-pages.html

We have a group page for publishers (see below).

http://www.books.ie/publishers

This page by default has a layout of grid. Is it possible to change this to a list and what files do I need to modify to execute this?


texts:
I have a requirement to print Tamil Unicode characters in Invoice which is not possible with PDF. In magento 1.9 i was using custom module. Is there a similar kind available for Magento2?

If not some pointers should be help. I am looking for just redirecting PDF output to html.


texts: Is it necessary to add requirejs-config.js when we need to add custom js in magento 2 theme

texts:
I have added a custom js file in my child theme and added the link in the default_head_blocks.xml. I am getting errors.

<link src="js/custom.js"/>

<!-- Add external resources -->
<link rel="stylesheet" type="text/css" src="http://fonts.googleapis.com/css?family=Montserrat" src_type="url" />

Is it necessary to specify the custom js in requirejs-config.js ?


texts: Magento 1.9 Patch MPERF-10509 - Invalid HTTP response version

texts:
We're on Magento 1.9.2.4 CE and applied patch MPERF-10509-CE.

In the admin dashboard, the dashboard sales chart is broken and returning a 503 error in console. Magento error report shows:

a:5:{i:0;s:32:"Invalid HTTP response version: 2";i:1;s:1412:"#0 /lib/Zend/Http/Response.php(665): Zend_Http_Response->__construct(200, Array, '\x89PNG\r\n\x1A\n\x00\x00\x00\rIHD...', '2', false)
#1 /lib/Zend/Http/Client.php(1098): Zend_Http_Response::fromString('HTTP/2 200 \r\nda...')
#2 /lib/Varien/Http/Client.php(61): Zend_Http_Client->request('GET')
#3 /app/code/core/Mage/Adminhtml/controllers/DashboardController.php(100): Varien_Http_Client->request('GET')
#4 /app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_DashboardController->tunnelAction()
#5 /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('tunnel')
#6 /app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 /app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#8 /app/Mage.php(684): Mage_Core_Model_App->run(Array)

Any ideas what is going on and how to resolve?


texts: Create cron group and assign it to a custom module

texts: As the title suggests, how can I create a cron group and assign it to the custom module in magento 1??


texts: Sort product collection on attribute value instead of id

texts:
On Magento 1.9.x.x. I want to get the product with the lowest value in a given category. I use the following code:

$product = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('page_number')
    ->addAttributeToSelect('sku')
    ->addFieldToFilter('category_id',$category->getId())
    ->addFieldToFilter('page_number',array('notnull' => true))
    ->addAttributeToFilter('status', array('eq' => 1))
    ->addAttributeToSort('page_number', 'ASC')
    ->getFirstItem();

The page_number is an multi-select with integers as key and value. For example: Page 1 can have ID 512 and page 2 can have 412 as ID. So sorting on the ID's won’t work, I need to sort on the actual values.

Is it possible to do this directly? I don’t want to get all products and loop trough them because of performance.


texts:
We are trying to get all the products to have the tax Class to Taxable goods. I tried modifying the database in order to change the value to '2'- It did indeed change in the database but even after upgrading database, compiling and deploying and flushing cache it did not change the value. I also did reindex.

The SQL I have used:

UPDATE catalog_product_index_price SET tax_class_id = 2;

UPDATE catalog_product_index_price_idx SET tax_class_id = 2;

UPDATE catalog_product_index_price_tmp SET tax_class_id = 2;

I basically did the update anywhere I could see the tax_class_id;

What I managed to do next is going to:

Backend > Catalog > Manage Products > Select all.
Going to Top left Actions dropmenu, selected “Update attributes” and submitted.
I went to find Tax Class and selected Taxable Goods and saved.

That managed to change the value in the backend, but still, the frontend appears to not change.

And the tax class succesfully created:

You can see there is no change:


texts: Magento 2: Checkout Page New Address Not Saved

texts:
On Checkout page, I'm Adding " + New Address" by clicking on that.

While saving "Save In Address Book" Checkbox is already checked. Still, it's not saving that address.

Once I Logout & Login that address is not longer available. I didn't complete "Place Order" process.

I have checked by Placing Order as well. Still it's not working.

Is it issue with Cache or Cookie?


texts: Category Selection is not getting saved in updating products

texts:
When i'm trying to change category of my product, it does not getting saved, See below screenshot, after changing from Test Category to Another Category when click on Save it does not saved. Everything else (like attributes, short description, description, name, sku) changes does get saved.

If i go to Catelog >> Manage Categories and then select Another Category, under category products if i select product and press Save - it does get saved.

please guide me if anyone came across this situation


texts: access custom customer attribute in email template

texts:
I have created a custom attribute for customers.
In the next step I want to access it in email templates. For example in the password forgotten template.
The variable "customer" contains the following information:
            ...
            [email] => doe@example.com
            [firstname] => John
            [lastname] => Doe
            [prefix] => Mr.
            [gender] => 0
            [store_id] => 1
            [website_id] => 1
            [addresses] => Array
                (
                )

            [disable_auto_group_change] => 0
            [custom_attributes] => Array
                (
                    [0] => Array
                        (
                            [attribute_code] => my_custom_attribute
                            [value] => 1234
                        )

                )

            [name] => John Doe
        )

The only way that works is to use {{var customer.custom_attributes.0.value}}. But this doesn't seem to be a reasonable way, because the array key "0" is not reliably the one of my_custom_attribute.
How can I access my_custom_attribute reliable?
side note:
Creating a plugin for the EmailNotification::getFullCustomerData() method doesn't work either, because this method is private.


texts: Change the way magento2 is installed so its upgradeable

texts:
There are many ways to install magento2, deploying from GIT, Downloading from magentocommerce or doing a composer installation.

What i find odd is that those 3 different ways of installing result in 3 different structures. One where the files are in app/code/magento and the other in vendor/magento/

Also one where you can use the upgrade and connect wizard in the backend, and the other where you can do a easy composer update.

What i did a while back since composer kept failing on my dev location, is a git deploy which went smooth but now gives me a hard time updating. Having some dependencies installed from composer, but still stuck on 2.0.0.

Whats the best way to proceed, and whats normally the best-practice way to install, i'd say composer, but not sure what the community thinks. You guys think a fresh install, migration of extensions and theme + adding my DB is the right way to proceed? For now its not running that smooth.

For example what i did now is i made a fresh install via composer, looks the most clean to be honest. Connected it to my existing 2.0.0 db and did

bin/magento setup:upgrade
bin/magento setup:di:compile

but then the next errors pop-up

a:4:{i:0;s:1755:"Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Magento_Theme schema: current version - 2.0.1, required version - 2.0.0
Magento_Theme data: current version - 2.0.1, required version - 2.0.0
Magento_Customer schema: current version - 2.0.7, required version - 2.0.6
Magento_Customer data: current version - 2.0.7, required version - 2.0.6
Magento_Cms schema: current version - 2.0.1, required version - 2.0.0
Magento_Cms data: current version - 2.0.1, required version - 2.0.0
....


texts:
Can someone please advise me on the following problem

Here is a link to a video showing what is happening  https://vimeo.com/228143296

I strongly believe this is a permissions problem

In video clip one I do the following steps

In terminal I type in command - php bin/magento setup:upgrade
This brings up a warning message in red

  (Permission denied in
  /var/www/html/top-property-store/vendor/colinmollenhour/cache-backend-file/File.php
  on line 663)

I refresh the page the site is still working
I put in command sudo php bin/magento setup:upgrade
I refresh the site and the site is down with a warning message

In video clip two I do the following

I put in command sudo php bin/magento setup:upgrade

2 I put in command sudo php bin/magento setup:di:compile

Go to the site then click on a link and the site is down again with the same warning

  Warning:
  file_put_contents(/var/www/html/top-property-store/var/cache//mage-tags/mage---cc6_COMPILED_CONFIG):
  failed to open stream: Permission denied in
  /var/www/html/top-property-store/vendor/colinmollenhour/cache-backend-file/File.php
  on line 663


texts: magento 2 logout customer after successful registration works only first time

texts:
I have implemented this logic to logout customer after registration, Its only working before logging in a new user.

After clearing cache and when I register a user it logout the user and for second third ... it works perferct, If I login a user and come back and create a new user it's not working it takes me to home page.

If I clear cache again it works. Not sure why its happening.

Magento 2 - Redirect user to specific page after register


texts:
i am looking for a review plugin for my magento 1.9.x.
Review plugin should have an option to post without being registered
Review plugin should be possible to activate only on certain products not all
Review plugin should have posibility to uplod pictures
Review plugin should have a posibility to disable  DATE posting of the review
anyone knows some plugin like that ?
Regards


texts:
I'm trying to make a function that return all related product of a product, using the productId

So I make this in /var/www/website/api/catalog/get_collection.php :

require_once dirname(__FILE__).'/../app/Init.php';

$task = new Init(__FILE__);
        > try {
        >
        >         $client = $task->getSOAPClient();
        >         $session = $task->getSOAPSession($client);
        >
        >         $productId = $_GET['productId'];
        >         $productId = (string)$productId;
        >         $result = $client->call($session, 'catalog_product_link.list', array('type' => 'related', 'product' => $productId));
        >         var_dump ($result);
              }
        catch(Exception $e) {
        >     $task->errorResponse($e->getMessage());
              }

I call this "get_collection.php" file from my google chrome with this line :

http://magento.dev.website.com/api/catalog/get_collection.php?productId=557

And this is the result I get :

{
error: "Product not exists."
}

I try to replace $productId in the array of argument by the value of the productId, but still the same error.

Please, help me >.<
Oh, it's on Magento 1.8.0, if this can help someone helping me ^^


texts:
I installed magento 2 and successfully implemented custom theme.

I used magento blank as my theme's parent theme. I'm new to magento, so this may seem like a stupid question, but please help me without actually down-voting or locking this question.

My problem is, how do I change the storefront look in my theme? All I get is usual Magento 2 page with only my logo in it.

How do I edit header section?
Which files I may need to edit or add?
I need to edit top links section (usually contains links like sign in, my account, register)?

Please help.


texts: How to override js files in Child theme? Magento 2.4

texts:
I've been overriding a few files in our child theme which seems to work perfectly, however, I don't seem to be able to override JS files.
In this case, I'm trying to increase the yearRange in the formfield datepicker. I found this solution and editing this in the core file (\lib\web\jquery\ui-modules\datepicker.js) works like a charm.
Ofcourse I don't want to change this in the core file so I tried adding this in our child theme.
I copied the entire datepicker.js document to app/design/frontend/theme/child/web/js and changed the variable to my preferred settings.
I then created requirejs-config.js in app/design/frontend/theme/child with the following code:
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

var config = {
   map: {
          '*': {
           'jquery':'js/datepicker'
       }
   }
};

However, this gives me the following error:
Failed to load resource: the server responded with a status of 404 ()
require.js:141 Uncaught Error: Script error for: js/datepicker/jquery.mobile.custom
http://requirejs.org/docs/errors.html#scripterror
   at makeError (require.js:166)
   at HTMLScriptElement.onScriptError (require.js:1681)
static/version1621499056/frontend/Olegnax/at2_child/nl_NL/js/datepicker/jquery-migrate.js:1 Failed to load resource: the server responded with a status of 404 ()
require.js:141 Uncaught Error: Script error for: js/datepicker/jquery-migrate
http://requirejs.org/docs/errors.html#scripterror
   at makeError (require.js:166)
   at HTMLScriptElement.onScriptError (require.js:1681)
static/version1621499056/frontend/Olegnax/at2_child/nl_NL/js/datepicker/jquery.cookie.js:1 Failed to load resource: the server responded with a status of 404 ()
require.js:141 Uncaught Error: Script error for: js/datepicker/jquery.cookie
http://requirejs.org/docs/errors.html#scripterror
   at makeError (require.js:166)
   at HTMLScriptElement.onScriptError (require.js:1681)

How do I do this properly?


texts:
Can't create the page in the Store View programmatically.

I have two stores:

English
French

$pageModel = \Magento\Framework\App\ObjectManager::getInstance()
    ->create(\Magento\Cms\Model\PageFactory::class)->create();
$pageModel->load($submission['content_id']);
$pageModel->setId(null);
$pageModel->setContent($content);
$pageModel->setStoreId($storeId);
\Magento\Framework\App\ObjectManager::getInstance()
    ->create(\Magento\Cms\Api\PageRepositoryInterface::class)
    ->save($pageModel);

Result:

$origialStoreId = 1;

$storeId = 2;

Could not save the page: URL key for specified store already exists.


texts:
I'm trying to add a certain process in the Magento\Checkout\Controller\Onepage\SaveOrder so I decided to implement a plugin for that. But after creating the di.xml and the classes needed when I try to purchase an item and fill out all the shipping details and selected the needed payment method. Upon submission of the order, I was expecting the function to be run. But somehow it's not being called. Can any help me with this or if anyone has any idea what I did wrong. Below are my codes

  content of  di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
   <type name="Magento\Checkout\Controller\Onepage\SaveOrder">
        <plugin name="Custom_Module_Plugin" type="Custom\Module\Plugin\SaveOrderPlugin" sortOrder="10" />
    </type>
</config>

  content of SaveOrderPlugin.php

<?php
namespace Custom\Module\Plugin;

class SaveOrderPlugin
{
    public function aroundExecute(\Magento\Checkout\Controller\Onepage\SaveOrder $subject, \Closure $proceed)
    {
        // logging to test override
        $logger = \Magento\Framework\App\ObjectManager::getInstance()->get('\Psr\Log\LoggerInterface');
        $logger->debug("********** " . __METHOD__ . ' - ' . __LINE__);

        // call the core observed function
        $returnValue = $proceed();

        // logging to test override
        $logger->debug("********** " . __METHOD__ . ' - ' . __LINE__);

        return $returnValue;
    }
}
?>

As you can see I was expecting an output in the console log as shown below but this does not show. Also, I tried intercepting other classes like Magento\Quote\Model\QuoteManagement and it worked as expected. But the reason I want to override the Magento\Checkout\Controller\Onepage\SaveOrder is primarily that I want to retrieve a certain parameter when the order of item is submitted.

Does anyone have an idea what I did wrong here?


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

    /** @var \Magento\Eav\Api\AttributeOptionManagementInterface $attributeOptions */

    $attributeOptionsManagement = $objectManager->get(\Magento\Eav\Api\AttributeOptionManagementInterface::class);

    /** @var \Magento\Eav\Api\Data\AttributeOptionInterface[] $attributeOptions */

    $attributeOptions = $attributeOptionsManagement->getItems(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, 'feature_products');
    $featuredOptions = [];
    foreach ($attributeOptions as $attributeOption) {
    $featuredOptions[$attributeOption->getValue()] = $block->escapeHtml($attributeOption->getLabel());
    }
echo $featuredOptions['option_id']


texts: I'm creating a store where each product has one or more "contributors" and each contributor has a contributor type (composer, arranger, artist, author, or editor). So, for instance, there may be an item with three contributors: John Doe, composer; Bob Smith, arranger; Jane Adams, arranger. I can't figure out a good way to store this information using the standard attribute types. Can anyone suggest a solution or, at least, point me in a potential right direction?


texts: Run native csv import product magento 2, no way to set csv file in custom module

texts:
I followed steps in this topic Magento 2 run native product csv import programtically, but it didn't work. When I try to import product through a CSV file in back-office, the check data is correct and the import too. But, when I try to use the same file in my custom module, the check data function (validateSource) gives me an error.

I think I didn't upload the CSV file correctly.

I put it in a personal folder, then I copy it in /var/importexport/ renamed as catalog_product.csv. The function importSource seems to work but no product is imported, and the file isn't copied in /var/import_history/.

In my function, I got an argument that is the file path of my CSV file. My code :

$dataImport =
[
    "entity"=>"catalog_product",
    "behavior"=>"append",
    "validation_strategy"=>"validation-stop-on-errors",
    "allowed_error_count"=>"10",
    "_import_field_separator"=>";",
    "_import_multiple_value_separator"=>",",
    "import_images_file_dir"=>""
];

$newFilvecsv = "/root/var/importexport/catalog_product.csv";
copy($filecsv->getFilepath(), $newFilvecsv);

$importModel = $this->importModelFactory->create();
$importModel->setData($dataImport);

$source = $this->importAdapter->findAdapterFor(
    $newFilvecsv,
    $this->fileSystem->getDirectoryWrite(DirectoryList::ROOT),
    $importModel->getData('_import_field_separator')
);
$isValid = $importModel->validateSource($source);

if ($importModel->getProcessedRowsCount() === 0 || $importModel->getErrorAggregator()->getErrorsCount() || !$isValid){ // Fichier non valide
}

try {
    $importModel->importSource();
} catch (\Exception $e) {
    $this->logger->info("Import impossible");
}

return "Import fini";

I'm lost. Can you help me ?


texts:
I don't know when this error comes out. I saw this in the exception log the first time. I never got this initially. Why this error comes. My log is like

  main.CRITICAL: The element "form" can't have a child because "form"
  already has a child with alias "shipment_tracking".
  {"exception":"[object]
  (Magento\Framework\Exception\LocalizedException(code: 0): The
  element \"form\" can't have a child because \"form\" already has a
  child with alias \"shipment_tracking\". at
  vendor/magento/framework/Data/Structure.php:625)"} []


texts: How to remove default generated canonical tag in category page?

texts:
In Catalog > Categories > [my category] > Design > Layout Update XML, I put my own canonical link.

However, when I inspected the HTML, I noticed there were two canonical tags. One of them is mine, and another appears to be autogenerated.

The highlighted one is my canonical tag. The one below is the one I don't want. I want to prioritize the first link (/all-cards) over the second (/most-popular), but the autogenerated canonical tag isn't letting me do that.

How can I remove it?


texts: Magento 1.9: Massive set customer confirmation attribute

texts: I imported over 3000 customers in magento, I need to set them all as confirmed. How can I do?


texts:
My catalog_product_flat indexing take too long time.

How to make this indexing faster in Magento 1.9


texts: Import Export both are not responding anything both is not working

texts:
Trying to export Magento single products but only a blank page is appearing. could not export any products either from System ->Import/Export->Export or from System->Import/Export/Dataflow-profile.

When trying to import just five products from System ->Import/Export->Import and by choosing a file to import when I click on "check data" button, file is just loading but it doesn't respond any thing, neither it generate any error/warning nor Import button is appearing.

I checked log file to see the error I got

 2014-05-08T09:33:05+00:00 ERR (3): Notice: Undefined offset: 58233  in /var/www/vhosts/Outletzon.secureserver.net/httpdocs/testdocs/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php on line 873

 2014-05-08T09:47:41+00:00 ERR (3): Warning: simplexml_load_string():     </catalog_product_view>  in /var/www/vhosts/Outletzon.secureserver.net/httpdocs/testdocs/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
 2014-05-08T09:47:41+00:00 ERR (3): Warning: simplexml_load_string():                            ^  in /var/www/vhosts/Outletzon.secureserver.net/httpdocs/testdocs/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
 2014-05-08T09:47:41+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 104: parser error : Extra content at the end of the document  in /var/www/vhosts/Outletzon.secureserver.net/httpdocs/testdocs/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
 2014-05-08T09:47:41+00:00 ERR (3): Warning: simplexml_load_string():       <catalog_category_default>  in /var/www/vhosts/Outletzon.secureserver.net/httpdocs/testdocs/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
 2014-05-08T09:47:41+00:00 ERR (3): Warning:      ^  in /var/www/vhosts/Outletzon.secureserver.net/httpdocs/testdocs/app/code/core/Mage/Core/Model/Layout/Update.php on line 444


texts: Cant find Adwords tab in Magento 1.7.0.2

texts:
When I want to set up my adwords info under the
System-->Configuration-->Sales-->Google API

there is no tab for Google AdWords - Conversion Tracking???

I thought that feature came preinstalled?

What I want to do in the end is to activate google shopping.

I am using Magento community 1.7.0.2

Regards,
Oliver.


texts: Magento 2: Model edit form fields not loading

texts:
I've created a grid for my "profile" model. Add and delete works fine, but when I click on the "Edit" action, the resulting page doesn't load the profile's existing fields.

I understand that we pull from the model storage when editing, which is working, but how do we populate the edit form with existing fields? Here's my Edit class.

<?php
namespace mycompany\mymodule\Controller\Adminhtml\Profile;

class Edit extends \Magento\Backend\App\Action
{
    /**
    * @var \Magento\Framework\View\Result\PageFactory
    */
    protected $_resultPageFactory;

    /**
    * @var \mycompany\mymodule\Model\Profile\ProfileFactory
    */
    protected $_profileFactory;

    /**
    * @var \Magento\Framework\Registry
    */
    protected $_coreRegistry;

    /**
    * @var \Magento\Backend\Model\Session
    */
    protected $_backendSession;

    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Framework\Registry $coreRegistry,
        \mycompany\mymodule\Model\Profile\ProfileFactory $profileFactory
    ) {
        parent::__construct($context);
        $this->_resultPageFactory = $resultPageFactory;
        $this->_coreRegistry = $coreRegistry;
        $this->_backendSession = $this->_getSession();
        $this->_profileFactory = $profileFactory;
    }

    /**
    * @return \Magento\Framework\View\Result\Page
    */
    public function execute()
    {
        $id = $this->getRequest()->getParam('id');
        $profile = $this->_initProfile();
        $resultPage = $this->_resultPageFactory->create();
        $resultPage->getConfig()->getTitle()->set(__('Profiles'));
        if ($id) {
            $profile->load($id);
            if (!$profile->getId()) {
                $this->messageManager->addError(__('This profile no longer exists.'));
                $resultRedirect = $this->_resultRedirectFactory->create();
                $resultRedirect->setPath(
                    'myroute/profile/profiles',
                    [
                        'profile_id' => $profile->getId(),
                        '_current' => true
                    ]
                );
                return $resultRedirect;
            }
        }
        $title = $profile->getId() ? $profile->getName() : __('New Profile');
        $resultPage->getConfig()->getTitle()->prepend($title);
        $data = $this->_backendSession->getData('profile_form', true);
        if (!empty($data)) {
            $profile->setData($data);
        }
        return $resultPage;
    }

    /**
     * Init Profile
     *
     * @return \mycompany\mymodule\Model\Profile
     */
    protected function _initProfile()
    {
        $profileId = (int) $this->getRequest()->getParam('id');
        $profile = $this->_profileFactory->create();
        if ($profileId) {
            $profile->load($profileId);
        }
        $this->_coreRegistry->register('mymodule_profile', $profile);
        return $profile;
    }
}


texts: How to solve date and time problem in magento?

texts:
I am using datepicker in magento form

This is my code:

$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
        $fieldset->addField('created_at', 'date', array(
        'name'   => 'created_at',
        'label'  => Mage::helper('example)->__('Created At'),
        'title'  => Mage::helper('example')->__('Created At'),
        'image'  => $this->getSkinUrl('images/grid-cal.gif'),
        'format'       => $dateFormatIso,
        'time' => true
    ));

But in frontend same date is not display

At front end

This code is use to display date in frontend

<?php echo $this->formatDate($val->getCreatedAt(), 'medium', true) ;?>


texts: Magento : Send/Mail custom form data in PDF file

texts:
I have create one module for custom form fill by the user while click on submit button the form send two person one for user and second for website owner. This is working fine but i want to send this details of form as a pdf while click on submit button.

  Convert the email output content into PDF

So, how that is possible. please let me know if you have any suggestion.

Thanks


texts: How to add active class for active step at checkout page in Magento 2?

texts: I want to add active class for respected checkout step like Shipping, Review and payments step in body tag.


texts: How to add price for the customer group and add it to the customer registration page

texts: I need to add price for the customer group from magento admin so each customer group have a different price. I also need to show these group with group price on the customer registration page on the frontend so when some customer create his/her account he/she need to select a customer group plan after filling the form user will be redirect to the payment gateway like paypal for the payment of the selected group price after successful payment customer will redirect back to our website and this way his/her registration is completed. How I can implement this logic as I am new to magento. Any help would be appreciated.


texts: Plugin for backend order create that sets attribute value on created order

texts:
I am attempting to set a custom attribute require_verification on a newly created order from the Magento backend using a plugin in Magento 2.

Many suggestions I have found recommend using events, which I was able to successfully implement. But I am specifically looking for information about how this can be done using a plugin. This is because the use of plugins is preferred over events in Magento 2.

I am attempting to run my plugin after the \Magento\Sales\Controller\Adminhtml\Order\Create\Save execute() method.

Save.php

namespace Training\RequireVerification\Controller\Adminhtml\Order\Create;

class Save
{
    public function afterExecute(\Magento\Sales\Controller\Adminhtml\Order\Create\Save $controller, $result)
    {

        $order = $controller->getOrder(); // DOES NOT WORK
        $order->setRequireVerification(0);
        return $result;
    }
}
?>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Sales\Controller\Adminhtml\Order\Create\Save">
        <plugin name="training-order-create-after-controller-plugin" type="Training\RequireVerification\Controller\Adminhtml\Order\Create\Save" sortOrder="10"/>
    </type>
</config>

The plugin is firing, so I know it is setup properly, I just need help understanding how to get access to the newly created order in the afterExecute method.


texts: Magento 2.2 - It is possible to change the font on the Magento Admin?

texts: Do we need any themes or we can change the font from the existing Magento files as we change the fonts on the frontend?


texts: Magento : How To Create Edit Product Page On Frontend

texts:
I've created this page on frontend.

I want input field fills with values product based on product id.

I have blank controller. How can I update product attribute in this form trough my controller and my .phtml file.


texts: How to add contact us form and functionality programmatically in frontend magento 2?

texts:
Actually, I want to add contact us form  and functionality
programmatically in Magento 2 custom theme in frontend.


texts: When press browser back button cart is empty

texts:
Its my first question so I am very excited to become part of this big community.

I am experiencing an issue with the cart.The point is when I press the browser back button after adding some product to my cart the cart appears empty. But when I reload the page the cart is now with the product I added before.

Is there any way to get the cart updated when I press the browser back button like when I refresh the page?

Thank you!


texts: How to move the "IN STOCK" above Add to cart button

texts: How to move the Stock availability (In Stock) next to the Quantity button.


texts:
In Magento 1.9 we want to use localized product URL keys for different storeviews. The url key is a global variable and can't be changed by storeview.
Example:

English: www.example.com/en/addidas-shoes

German: www.example.com/en/addidas-schuhe

Is there any solution or best practise for this case?
Thanks


texts: Where default email template  like forget password,reset password,new account create etc. is stored in Magento 2.1.12.What is path?


texts: Insert block inside static block magento 2

texts:
I create static block with reference name 'seller_registration_form'  from Magento 2 backend which loaded in home page like this:

Now i want to insert additional content from my module, so i created cms_index_index.xml:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <referenceBlock name="seller_registration_form">
     <block class="Test\Customlayout\Block\Sellerform" name="sellerform" template="Test_Customlayout::sellerform.phtml"/>
  </referenceBlock>
</page>

but the phtml file never loaded in home page, i already make sure the block file in correct place and the phtml inside view/frontend/templates folder


texts: Magento 2 How to display custom text instead of shipping method title and carrier title

texts: How to display only "Shipping" text instead of "Shipping(Flat Rate - Fixed)" text in Cart, Checkout and Emails.


texts: Use class from vendor module in custom controller

texts:
I'm trying to call a 'new FPDF()' in my custom controller, i keep getting the following error:

Uncaught Error: Class 'setasign\fpdf\FPDF' not found in ../app/code/Forza/catalogPrintPdf/Controller/category/pdf.php

Can anyone point me in the right direction?

<?php

  namespace Forza\catalogPrintPdf\Controller\category;

  use Magento\Framework\View\Result\PageFactory;
  use Magento\Framework\App\Action\Context;
  use Magento\Framework\Controller\Result\JsonFactory;
  use Forza\catalogPrintPdf\Model\ProductCollection;
  use setasign\fpdf\fpdf;

  class pdf extends \Magento\Framework\App\Action\Action
  {
     protected $pageFactory;
     protected $resultJsonFactory;
     protected $productCollection;

    public function __construct(
      Context $context,
      PageFactory $pageFactory,
      JsonFactory $resultJsonFactory,
      ProductCollection $ProductCollection

   )
  {
    parent::__construct($context);
    $this->resultJsonFactory = $resultJsonFactory;
    $this->productCollection = $ProductCollection;

  }

   public function execute() {

     $pdf  = new FPDF();
     $this->fpdf->addPage('hello');
     $this->fpdf->Output();
   }
}


texts: Magento Test Framework(MTF) Change the default Behaviour of frontend/backend - Magento 2.0.1

texts:
I am learning about Magento Test Framework, I had good knowledge about selenium webdriver with java but in magento I am newbie. I have successfully install MTF. I have run one sample test, it will affect the frontend(Adding unnecessary categories in header).

My question is

How to run the test without affecting frontend/backend?


texts: Can anyone suggest tutorial for creating own Magento theme?

texts:
I searched the web to find any tutorial which guides step by step to create a custom theme. Basically what I expect is to convert a HTML and CSS code to a Magento theme. But still couldn't find a proper tutorial or a book. Can anyone suggest the relevant resources please?

Thanks in advance.


texts: Add tab in product edit page in magento2?

texts:
How to create a Customtab( which contains grid) in product edit page (like product Review tab in product edit page)using php in magento2?

Is there any possible?

Thanks


texts: Product Types: custom options vs bundle vs configurable

texts:
I am about to start working on a shop that has around 1000 products, which normally is nice and easy. Some are simple products (no problem here) but around half have the possibility to be configured.

Each product has 2-5 sections that the user can configure with colour options. There is a total of 25 colours across the store. Normally I would use a configurable product, but my understanding is I would have to create a simple product for each possible combination of colours. With this set of options that would lead to a massive amount of products.

I have two alternative ideas:

Create a simple product for the configurable product and add custom options for each section,
Create a bundle product where each configurable section is itself a product,

Is there any major plus or negative side to custom options on simple products or bundle products?


texts: Magento2 Create simple Product programmatically only works once

texts:
I have the following in our helper:

public function __construct(
    \Magento\Framework\App\Helper\Context $context,
    \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection,
    \Magento\Catalog\Model\ProductFactory $productFactory,
    \Magento\Catalog\Model\Product $product,
    \Magento\Catalog\Model\Product\Option $option,
    \Magento\Checkout\Model\Cart $cart,
    array $data = []
) {
    $this->_productCollection = $productCollection;
    $this->_productFactory = $productFactory;
    $this->_prod = $product;
    $this->_option = $option;
    $this->_cart = $cart;
    parent::__construct($context);
}

public function createProduct($sku, $name, $weight, $price, $jsonMix, $jsonPost, $type = 'simple')
{
    $mixProduct = $this->_productFactory->create();

    $mixProduct->setSku($sku); // Set your sku here
    $mixProduct->setName($name); // Name of Product
    $mixProduct->setWeight($weight); // weight of product
    $mixProduct->setPrice($price); // price of product
    $mixProduct->setDescription('' . $jsonMix . ' ' . $jsonPost);

    // defaults
    $mixProduct->setAttributeSetId(4); // Attribute set id
    $mixProduct->setStatus(1); // enabled/ disabled 1/0
    $mixProduct->setVisibility(4); // visibilty of product (catalog / search / catalog, search / Not visible individually)
    $mixProduct->setTaxClassId(1); // Tax class id
    $mixProduct->setTypeId($type); // type of product
    $mixProduct->setWebsiteIds(array(1));

    $mixProduct->setStockData(
        array(
            'use_config_manage_stock' => 0,
            'manage_stock' => 0,
            'is_in_stock' => 1,
            'qty' => 1
        )
    );

    // now save the product
    try{
        $mixProduct->save();
    } catch(Exception $e){
        echo $e->getMessage();
    }

    var_dump($mixProduct->getId()); die();

}

Calling it from a controller works only the first time, successfully creating a product in the backend.
But any subsequent tries seem to edit the already existing product instead of creating a new one.

Does anyone know why?


texts: How can I make product price dynamic on Magento page?

texts: So I have a Magento Page with 3 products on it and the images/prices/product title are all hard coded. in HTML how can I make it so that the price is not hard coded and whenever the product price changes, the price will change on that page too for those 3 products? I say html because it's on a Magento page.


texts:
I want to build a Composer repo which can be integrated with Magento 2 Composer repo.Then my team can use Composer to install the paid extensions with an authentication key.
I have aready read many documents but I still have not got any solution for this.
Hope that someone can give me a solution to do this.
Thank you so much.


texts: Running out of memory (512MB) with image helper

texts:
I'm having a strange problem where the following single operation causes an out-of-memory problem (limit at 512MB) when the following conditions are met:

$product is a configurable product with no image. (placeholder/fallback image is available)
$product has no simple products associated.
$this->helper...->resize(135) is assigned to a variable (no problem when simply echoed in HTML).

Following is the code:

$variable = $this->helper('catalog/image')->init($product, 'small_image')->resize(135)

I tried casting it as a string and that relieves the problem and memory usage is not abnormal. Below...

$variable = (string)$this->helper('catalog/image')->init($product, 'small_image')->resize(135)

Any idea what's happening?

Additional info:

nginx error.log shows PHP message: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 501481472 bytes)... (*!*this seems very abnormal to me. It's trying to allocate ~500MB on just that one call?)

Placeholder image is available.


texts: How to remove edit and remove buttons/links from the top header cart.


texts:
I want to print different invoices, which aren't printed out with all data. Like the color. I see the product is deleted from Magento.

Is there any way to fix this?

Edit:

Invoice.phtml:

<?php echo $_product->getAttributeText('color'); ?>
<?php echo $_product->getAttributeText('size'); ?>


texts:
I tried looking for answers before posting but couldn't find any.

I hosted my magento site in siteground and added integration.

Then I tried accessing the API using Postman but I get either 401 error or could not get any response.

Can someone help me with this?

UPDATED:
Turns out the problem is on the hosting site. Tried accessing on localhost and its working. But when I tried accessing in my host server I got 401. Any idea? I'm using siteground for hosting my magento.


texts: Featured Product update based on latest product

texts:
I want to know about featured product update. I have limited the number of featured product to 25. So, the currently 25 products are showing. Now i added more 25 products as featured product now the total number of featured product is 50. I want to show 25 featured product on home page which have been added recently and previous featured product should automatically goes off from home page. One more thing, there is different sort by options like price, name are available in featured widget but i want to have sort by latest product.

So the question is: How to order the products on homepage by the date I added the "featured" flag?


texts: Get Primary Key identifier of static block (integer not string)

texts:
In magento 1.9.1:

I'm building a system that includes a table with a FK pointing to a static block ID ( see cms_block table in Magento, that's the table I'm correlating to ).  For the system to work dependably, I need to be able to store a record referencing the primary key on the cms_block table.

Put simply:  I need a variation of $block->getBlockId() that always returns the primary key (an integer) associated with the static block in question.

It seems, as far as I can tell, $myBlock->getBlockId() returns an integer only if the block is invoked with an integer.  If the block is invoked with its corresponding identifier string (a common scenario), it returns the identifier string instead.

Is there a way for me to get at that primary key without having to talk to the database directly?

Answer

Props to Rajeev K Tomy :)

Here is my code that got the job done:

    $model = Mage::getModel( 'cms/block' );
    $collection = $model->getCollection()
        ->addFieldToFilter( 'identifier', $this->getBlockId() );

    $block = $collection->getFirstItem();

    return $block->getId();


texts: After Migration from local to server only page title loading, Front page blank and Admin page 404 error

texts:
After migration to AWS server from local getting weird error. The front page of site showing complete blank page only page title is visible.

And Admin page showing 404 error. I am using Magento CE 1.9.x

Does curl required to active to resolve this?

Because i have tried all possible solutions. Like, Disabled compile mode, Deleted Cache files and removed comment from ini_set('display_errors', 'On');

Please guide me.


texts: Displaying last bought quantity by current customer in product view page

texts:
I am trying to get the last quantity of the current product from the product view page bought by the logged in customer and display it with a button to add the same amount into the cart.
It should only display it if the customer had bought it before and it is still in stock.


texts: Is it possible to use text swatches as multiselect on category pages? (Magento 2)

texts:
The webshop has a attribute called weight. On the product page of a configurable product, the customer can choose the attribute value of this attribute. To show these attribute values as little tiles, I made a text swatch attribute, so they show up like this:

That's exactly what I wanted for the product page. But now, the filter on the category page of the attribute weight lost it's multiselect functionality. We use Mageplaza's Layered Navigation so the customer can select multiple attribute values to filter the products. If I switch the attribute from a text swatch to a dropdown, the filters on the category page are multiselect, but the filters on the product page are a dropdown (which is impossible to style like the little tiles).

Is there a way to get the best of both worlds? Show the product tiles on the product page, but the multiselect on the category page.


texts: Magento 2 Theming - How are page layout and page configurations connected?

texts:
I am creating a theme in Magento 2. So far I've figured out how to create a custom page layout for my homepage and how to style it with css. I'm moving on into adding JavaScript and more custom CSS, but I can't figure out how to do this for a specific page.

Every article and document I've come across mentions adding a script or link to the head using the defaults_head_blocks.xml or default.xml, which is great for something I need globally, but how would I add a script to the head of only one Page Layout?

For clarity and people new to this like me, this is my theme structure:

<theme_dir>/
  - Magento_Theme/
      - layout/
          - default_head_blocks.xml (as far as I can tell no use in my situation)
          - default.xml (nor this)

      - page_layout/
          - homepage.xml (my target page layout)

    layouts.xml (defines my Homepage layout)

Theres more to my theme, but these are the relevant files.

Is there specific naming convention or xml attribute (within default.xml) I can use if I want to configure homepage.xml? How would I configure my homepage.xml page layout?

EDIT
My question is about targeting a specific page layout, this is not a question about coding homepages specifically, it's just an example using my current situation. For example, if I make a custom 'About' page, how do I figure out what xml file to override? (keywords 'figure out')


texts: Magento 1.9.3.8 - Customers as "Guest" do not appear in "Manage Customers" on back end

texts:
If I generate an order from "logged in" accounts or "creating" an account during the check-out it all works fine, but if I check-out like "guest" the order complete with no problems and I can see it well displayed in Magento back-end even clearly stating that Customer Group is "NOT LOGGED IN", but then if I go to "Manage Customers" there is not trace about "guests" (not logged in) customers.

What could be the problem?
Thanks in advance.


texts:
I recently started a Magento 1.9.2.1 website that now has around 250 products. Whilst developing this, Magento 2 came out and I'm very keen to migrate my products and categories over to it. I've tried using the official Magento 2 data migration tool but it just doesn't work, it's awful to use and I get loads of errors every time I try to use it.

Is there an easier way I can migrate these products and categories over? I'm not bothered about migrating any other data across.


texts: Can anyone guide on which order I should put security patches 8788, 6285, 6482, 7405, 5344, 6788?

texts:
I am getting fatal error ie.  Fatal error: Class 'Mage_Core_Helper_UnserializeArray' not found in app/Mage.php

I have referred below 2 links -
i) Blank admin page after installing SUPEE7405
ii) Blank admin page after installing SUPEE7405 in magen1.9.2.2 and error Fatal error: Class 'Unserialize_Parser'

But that is for version 1.9.2.2.  I want it for magento 1.7.0.1.

Please help me what shall I do to apply security patches. I am trying to find SUPEE-6788 and supee7405 for magento version 1.7.0.1 but not able to get.

I got the link i.e https://github.com/magecomp/Magento-Pre-Patched-Files

Following security patches are not available -
8788, 6285, 6482, 7405, 5344, 6788.

Can anyone guide on which order I should put above security patches


texts: how to delete custom table in magento 1.9, from database with all it's references?

texts: Is dropping table from database is enough , or I need to delete some other things too, so that I can create table with same name again.


texts: drop down menu doesn't workafter Fooman Speedster uninstall

texts:
After uninstalling Fooman speedster the drop down menus and drop down category's no longer works.

Anyone have an idea how to solve this?


texts:
I am trying to remove some js files from Magento 2 upload in the frontend.
This is my code but it doesn't work because when reload category page and i open sources->coverage of chrome i see ever all js files loaded from browser:
app/design/frontend/Parent/CustomTheme/Magento_Theme/layout/default_head_blocks.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <remove src="datepicker.js"/>
        <remove src="timepicker.js"/>
    </head>
</page>

Thanks for any help


texts: Error after add to whistlist Magento 2.2.4

texts:
I have installed the Magento 2.2.4 and market place theme pioneer. I have tried to add to wishlist the product but I am getting below error.

  Fatal error: Uncaught TypeError: Argument 1 passed to
  Magento\Catalog\Pricing\Price\ConfiguredOptions::getItemOptionsValue()
  must be of the type float, boolean given, called in
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/ConfiguredRegularPrice.php
  on line 74 and defined in
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/ConfiguredOptions.php:24
  Stack trace: #0
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/ConfiguredRegularPrice.php(74):
  Magento\Catalog\Pricing\Price\ConfiguredOptions->getItemOptionsValue(false,
  Object(Magento\Wishlist\Model\Item)) #1
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/BasePrice.php(32):
  Magento\Catalog\Pricing\Price\ConfiguredRegularPrice->getValue() #2
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/FinalPrice.php(44):
  Magento\Catalog\Pricing\Price\BasePrice->getValue() #3
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/ConfiguredPrice.php(101):
  Magento\Catalog\Pricing\Price\FinalPrice in
  /var/www/html/gomm/vendor/magento/module-catalog/Pricing/Price/ConfiguredOptions.php
  on line 24


texts: Error 400 while trying to POST to orders

texts:
When I try to create an order, I get the error 400, can someone help me?
Things that may help you guys help me

I'm using NodeJS with Express
Data that I'm trying to post

    {
      "entity": {
        "base_grand_total": 10,
        "customer_email": "teste@teste.com",
        "grand_total": 10,
        "items": [
          {
            "sku": "PXL-TL-PRETO-1598467196"
          }
        ]
        }
    }

This is my userController.js (only the post order part)

const Magento = require('magento-api-rest').default;

const client = new Magento({
  'url': process.env.URL,
  'consumerKey': process.env.COMSUMERKEY,
  'consumerSecret': process.env.CONSUMERSECRET,
  'accessToken': process.env.ACCESSTOKEN,
  'tokenSecret': process.env.TOKENSECRET,
  'sha': 256
});

module.exports = {
  async createOrder(req, res) {
    const { entity } = req.body;

    try {
      await client.post('orders', { entity });
      res.send(req.body);
    } catch(e) {
      res.send(e);
    }
  },

};

The error

{
    "message": "Request failed with status code 400",
    "name": "Error",
    "stack": "Error: Request failed with status code 400\n    at createError (/home/jhonny/Área de Trabalho/Pixls-master/Backend/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/home/jhonny/Área de Trabalho/Pixls-master/Backend/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/home/jhonny/Área de Trabalho/Pixls-master/Backend/node_modules/axios/lib/adapters/http.js:236:11)\n    at IncomingMessage.emit (events.js:327:22)\n    at endReadableNT (_stream_readable.js:1220:12)\n    at processTicksAndRejections (internal/process/task_queues.js:84:21)",
    "config": {
        "url": "http://magento-11707-0.cloudclusters.net/rest/V1/orders",
        "method": "post",
        "data": "{\"entity\":{\"base_grand_total\":10,\"customer_email\":\"teste@teste.com\",\"grand_total\":10,\"items\":[{\"sku\":\"PXL-TL-PRETO-1598467196\"}]}}",
        "headers": {
            "Accept": "application/json",
            "Content-Type": "application/json",
            "Authorization": "OAuth oauth_consumer_key=\"fnklgt4yjjlo1xj08zjmckuiqb5b0b9s\", oauth_nonce=\"pi7UZld5OSMcWuLCuWv3KJowR8vWj0GF\", oauth_signature=\"ft7RdJLI%2FQtSj3eLd2eyICCmHaGJVRgPuDcK66Nku4o%3D\", oauth_signature_method=\"HMAC-SHA256\", oauth_timestamp=\"1598973019\", oauth_token=\"oanc0ajzw7a1gtma4l3gmgpx7a4f4l42\", oauth_version=\"1.0\"",
            "User-Agent": "Magento REST API - JS Client/2.0.3",
            "Content-Length": 130
        },
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1
    }
}


texts: Magento 2 how to make sticky header for frontend?

texts:
I am using Magento 2.1.5 and I need to make header sticky for the frontend. how can I make header sticky?

When user scroll page then header should be sticky at the top, how we can do this? this code should apply for desktop view only not for a mobile and iPad view.

Thanks in advance.


texts:
I suddenly get "ERR_INVALID_RESPONSE" on my website. I have no clue how to debug it.
Nothing new is added to the servers error log if I attempt to reload.
I tried clearing the cache.
I also set the rights with:
find var generated vendor pub/static pub/media app/etc -type f -exec chmod u+w {} + && find var generated vendor pub/static pub/media app/etc -type d -exec chmod u+w {} + && chmod u+x bin/magento

It started after changing deploy mode from production to developer.


texts:
I would like to download Magento complete with the Madison Island theme, if it is possible.

Can anyone point me in the right direction.


texts: Magento 1.x : Accessing Magento Rest Api as Admin

texts:
I am trying to access magento rest api with following script, but is uses default guest role to access, so I cannot access orders and other stuffs. How can I access Magento Rest api as admin.

<?php

$callbackUrl = "http://192.168.1.144/o2/api/rest/orders";
$temporaryCredentialsRequestUrl =
"http://192.168.1.144/o2/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://192.168.1.144/o2/admin/oAuth_authorize';
$accessTokenRequestUrl = 'http://192.168.1.144/o2/oauth/token';
$apiUrl = 'http://192.168.1.144/o2/api/rest';
$consumerKey = '**********************';
$consumerSecret = '**********************';

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/orders";
       $oauthClient->fetch($resourceUrl);
       $productsList = json_decode($oauthClient->getLastResponse());
       print_r($productsList);
   }
} catch (OAuthException $e) {
   print_r($e);
}


texts: How to Add Scrollbar to Minicart Dropdown Content in Magento 2.1.x

texts:
Currently, when 5+ products are added to Cart and a user clicks on the minicart icon, so that the dropdown is initialized - the dropdown contents go beyond screen fold, effectively hiding a portion of itself.

The minicart icon is fixed on a sticky top menu, so that when the screen is scrolled down, the hidden minicart dropdown contents stay beyond the screen fold. It's ugly and very user unfriendly.

I wonder what would be the best way to add scrollbar to the minicart dropdown and make the minicart dropdown content scrollable after, say, 5 items have been added to it? Or, make the contents scrollable after a certain pixel length of the dropdown is exceeded? What would the JS code be for achieving this?

How can I make the minicart dropdown content scrollable?

I have a Magento 2.1.9 instance. All teaching is welcome! Thanks!


texts:
Rewriting this question as it's easier to look at the SQL queries, what I'm working on is to return all attributes at all times, so wether I am filtering by an attribute or not.

SELECT a.entity_id,a.attribute_id, a.value,cp.sku,COUNT(a.attribute_id) AS     count FROM catalog_product_index_eav AS a
LEFT JOIN catalog_product_entity AS cp ON a.entity_id = cp.entity_id
#WHERE (cp.type_id = 'bundle') AND (a.value IN('3394'))
GROUP BY a.value

So the above query returns all the attributes and their values but as soon as I add on the where statements, it's only returning the products with those attributes.

As i'm displaying all the attributes in a checkbox style, I need this to always return the full count.

Any ideas on how I need to amend the query to do this?


texts: Magento 2 configurable product price not update

texts: Magento 2.2.8 .I have created Configurable product with Color + Size attribute. Product price is not update When select(Click) attribute on Product details page. I am using Luma theme.


texts:
I dont know how can I add multiple words search using magento 2 product api.
Example :

https://www.store.com/index.php/rest/V1/products?searchCriteria[pageSize]=8&searchCriteria[filterGroups][0][filters][0][field]=name&searchCriteria[filterGroups][0][filters][0][condition_type]=like&searchCriteria[filterGroups][0][filters][0][value]=%25test%20word%25&searchCriteria[filterGroups][1][filters][0][field]=status&searchCriteria[filterGroups][1][filters][0][condition_type]=eq&searchCriteria[filterGroups][1][filters][0][value]=1&searchCriteria[filterGroups][2][filters][0][field]=visibility&searchCriteria[filterGroups][2][filters][0][condition_type]=eq&searchCriteria[filterGroups][2][filters][0][value]=4

I tried severals things, each time I add a search name with 2 words, it does not return any result.

MAgento 2 API.


texts:
In checkout when click on Place order button take time around 1 minutes .

And when

Store > Configration > Sales > Sales Emails > General Settings > Asynchronous sending > Enable.

Then it take 45 seconds.


texts: Magento 1.9.3.0 SUPEE-11314 1 out of 1 hunk FAILED

texts:
Getting error "1 out of 1 hunk FAILED", I am applying SUPEE-11314 patch in Magento 1.9.3.0 using ssh.

Please suggest.


texts: knockout data-bind issue on the Frontend Magento 2

texts:
I have added file-uploader component in the review form. I have used below code to add browse button in the form.
<div class="upload-wrapper" data-bind="scope: 'uploader'">
    <!-- ko template: getTemplate() --><!-- /ko -->
</div>
<script type="text/x-magento-init">
                {
                    "#review-form": {
                        "Magento_Review/js/error-placement": {},
                        "Magento_Review/js/validate-review": {},
                        "Magento_Ui/js/core/app": {
                        "components": {
               "uploader": {
                   "component": "Magento_Ui/js/form/element/file-uploader",
                   "template": "ui/form/element/uploader/uploader",
                   "allowedExtensions": "csv",
                   "uploaderConfig": {
                        "url": "<?php echo $block->getUrl('{router}/{controller}/upload'); ?>"
                   }
               }
           }
       }
                    }
                }
</script>

If i put this code in the form tag then it is now working. If i put this code outside the form tag then it is visible. May be there is an issue related to the data-bind scope.
As in the review form, the form tag like below,
<form action="<?= $block->escapeUrl($block->getAction()) ?>" class="question-form" method="post" id="review-form" data-role="product-review-form" data-bind="scope: 'review-form'" enctype="multipart/form-data">

As you can see, form has data-bind="scope: 'review-form'" and my file-uploader has data-bind="scope: 'uploader'". So it may be an issue.
So, How can i fix this issue? Please help me. You help would be appreciated.


texts: how to disable minicart remove product confirmation popup?

texts:
i want to remove minicart product remove confirmation popup in magento 2.3 theme porto smartwave
https://prnt.sc/u3kh1f


texts: Magento 2 : Add Additional Cart Item Notice to Transactional Emails (Out of stock notice)

texts:
I am relatively new to Magento and am developing a site on version 2.2.5. I am trying to figure out how to display the cart item message notice in the transactional email.

This is the notice that is displayed on the shopping cart page if there is not enough inventory to fulfill the order (See attached image).

I've copied Magento_Sales/templates/email/items.phtml to my child theme folder and can make edits there. It seems that the code for this notice is located in vendor/magento/module-checkout/view/frontend/templates/cart/additional/info.phtml, but I am not sure how to display it on the emails.

Has anyone successfully displayed the out of stock notice in the new order email? I would greatly appreciate any assistance. Thank you in advance.


texts: Exclude Promotion Price Rules from a Category

texts:
I have a Category, which i don't wants to apply any Promotion Price Rules (both Catalog Price Rules and Shopping Cart Price Rules).

Even when i create a price rule and leaving blank as condition, so that this rule apply to all the products. For me this rule should also exclude this category and its products even leaving blank condition.

And also, Even its have any condition which should also exclude this category.

For a Category and its products, i don`t want to apply any promotion rules even promotion rule condition have or not, I don't want to allow any discount for this category products.

Any Ideas?

Thanks in advance.


texts:
I'm currently building a store where I want a user to be able to share their cart with someone via email.  So that say a child could send their cart to their parents who could open the link in the email and their cart would be populated with whatever was in the child's account when he/she generated the link.

Does anyone have experience doing this in Magento 2 and could point me in the right direction?  Or, if anyone knows an extension that offers this that would be great.


texts: How do I set up Magento 2.3.3 with a sandbox Auth.net account?

texts:
Using Magento 2.3.3, I've set up a sandbox Auth.net account, and added the API Login ID, Transaction Key, Public Client Key and Signature Key to the admin configuration, enabled the Payment Method and cleared the cache.

On checkout, selecting the Auth.net payment method and clicking 'Place Order', I'm getting an error displayed on the payment page:

User authentication failed due to invalid authentication values.

But I'm seeing a different error in the requests to the API:

Request URL: https://apitest.authorize.net/xml/v1/request.api
Request Method: OPTIONS
Status Code: 200 OK

Response:

{"messages":{"resultCode":"Error","message":[{"code":"E00001","text":"Error reading JToken from JsonReader. Path '', line 0, position 0."}]}}

I guess this could be a result of the configuration, but afaict, there's nothing further required than the above.


texts:
Hello I'm using Magento 2 .3.5
I want to know if its possible to use Magento Colissimo official https://marketplace.magento.com/laposte-magento2-colissimo-module.html and a module click and collect
and have at the same time free shipping for more than 49€ for France and 99€ for Europe using Cart Price Rules ?
Thanks


texts: Shipping cost in cart view only shown when the customer is logged in

texts: Why the shipping cost is only shown when the customer is logged in in the cart view totals section?


texts:
What would be the best way to link products and customers.

I want that all products are assigned to customers. So customers can create their own products. As I am new to Magento I can think of 2 ways:

Creating a new table where I link customer ID and product ID
Creating a product attribute (EAV) for customer ID with a custom backend model.

What are the pros and cons of them?

As EAV consists of many tables I am afraid that it can become slow. At the same time, Magento EAV has a lot of features that could be beneficial.


texts:
Currently I am developing an extension for Magento 2.1 and have incorporated a wysiwyg editor for some fields in that extension. Testing it in Chromium ( or Chrome ) works like a charm.

However when I tried it in Firefox, or Edge, there was no wysiwyg modus, though I didn't change settings in configuration.

Next I tried the already present wysiwyg fields in core extensions -like the field Description, area Content, in Categories- and found the same problem. No wysiwyg mode for any field in Magento 2.1 in Firefox nor Edge, though in Chromium there was no problem.

What I'd like to know is this a known issue, have anyone other the same problem? Or am I missing some sort of setting?

Forcing my customers to use only Chromium ( Chrome ) is not the answer imho.


texts: Magento 2.2 theme designing not applying

texts:
I am learning to create a theme in Magento 2.2, the directory structure for the theme is as follows

  a) app/design/frontend/compstore/web/css/source/_theme.less

_theme.less code is as follows

   //Change navigation background color
@navigation__background: @color-white;
//Change the link color
@link__color: @color-white;

  b) app/design/frontend/Packt/compstore/web/css/_style.less

_style.less code is as follows

    @import 'source/lib/_lib.less';
@import 'source/_sources.less';
@import 'source/_components.less';
@import 'source/helloworld.less';

  c) app/design/frontend/Packt/helloworld/web/css/source/helloworld.less

hellowworld.less code is as follows

 @color-compstore: #000;

body{
background: @color-compstore;
}

The theme is not adding the background color black and the link color which is white.

Please help me solve this


texts: Payment Method not showing in magento 2.1.7

texts: I have enabled the Cash On Delivery option in back end. But it's not showing in magento 2 front end. I tried to create back order but it's not showing to me. I checked country too it's for  All Allowed Country, but it's not working tell me how to debug and fix.


texts:
Magento Automatic backup I've been having trouble with for a while. Installed Scheduler timeline view and seen the error message "Missed" with;

exception 'Mage_Core_Exception' with message 'Too late for the schedule.' in /home/pctekcom/public_html/app/Mage.php:595
Stack trace:
#0 /home/pctekcom/public_html/app/code/core/Mage/Cron/Model/Observer.php(293): Mage::throwException('Too late for th...')
#1 /home/pctekcom/public_html/app/code/core/Mage/Cron/Model/Observer.php(72): Mage_Cron_Model_Observer->_processJob(Object(Aoe_Scheduler_Model_Schedule), Object(Mage_Core_Model_Config_Element))
#2 /home/pctekcom/public_html/app/code/core/Mage/Core/Model/App.php(1339): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#3 /home/pctekcom/public_html/app/code/core/Mage/Core/Model/App.php(1318): Mage_Core_Model_App->_callObserverMethod(Object(Zero1_Crondoctor_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#4 /home/pctekcom/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#5 /home/pctekcom/public_html/cron.php(77): Mage::dispatchEvent('default')
#6 {main}

I've tried with different times and weekly/daily with the same affect. A manual backup works (takes a long time though, many items) but Automatic fails with this same error message.

I posted this last week with no answer. Maybe this week someone might see and know whats wrong. Thanks