47 votes
Accepted

call static block in view.phtml insted of phtml file

You can use the below code: in .phtml file : <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); ?> sample : <?php echo $...
Qaisar Satti's user avatar
  • 32.5k
34 votes
Accepted

Change standard quantity on product page from 0 to 1 (Magento 2)

--The easiest way is that we can change the input value from template: (override this template - not recommend) vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml --...
Khoa TruongDinh's user avatar
14 votes

How to add "Buy Now" button in Magento 2.1 Product detail page along with add to cart?

Here is a module that adds a 'Buy Now' button that takes customer directly to checkout with the choosen product in cart. Module Directory: | registration.php | +---Controller | \---Cart | ...
Aaron Allen's user avatar
  • 9,009
9 votes

Magento2 : Set Product limit in Related and Upsell Product

You can also use the layout if you don't want to create a plugin. Assuming you have a theme "Vendor_default" and running Magento >= 2.1.2 Upsell Products: Create the file app/design/frontend/Vendor/...
ocornu's user avatar
  • 190
9 votes

How to change div fotorama__stage height on product view page

You will have to override vendor/magento/module-catalog/view/frontend/templates/product/gallery.phtml file by putting it into app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/view/...
Rizwan Dhuka's user avatar
7 votes

How to integrate ImageMagick to magento

You can install imagick "easily" if you have access to the server with, one of the following commands: pecl install imagick sudo apt-get install php5-imagick && sudo php5enmod imagick or you ...
Fabian Blechschmidt's user avatar
7 votes
Accepted

How to trigger self.openFullScreen() function into my custom jQuery in Product details page

After spending some time, i found the answer as mentioned below, hope this will help for someone. <script type="text/javascript"> require([ 'jquery', '...
Krishna ijjada's user avatar
6 votes

How to get simple product id of configurable product on Product details page

I have select box at attribute of configurable product. This is what i have done to get simple product id. Put following code in your configurable product phtml file. require(["jquery"], function(...
Bhupendra Jadeja's user avatar
6 votes
Accepted

Guest can't create product programtaically [ similar to wishlist ]

what happens in wish list product , when a guest is adding a product to a wish list in the preDispatch method on controller they are checking whether the customer is logged in or not. If customer is ...
magento noob's user avatar
5 votes

Remove "product information, reviews, tags" block from product page

Create local.xml and paste the below code. <?xml version="1.0" ?> <layout> <default> <remove name="product_tag_list" /> </default> <layout>
Amir Iqbal's user avatar
5 votes
Accepted

Adding new page to Front end

Problem resides in your layout update xml file, particularly in the following block declaration. <block type="abc_helloworld/index" name="helloworld_any_block" template="helloworld/index.phtml" /&...
Rajeev K Tomy's user avatar
5 votes

Magento2 : Set Product limit in Related and Upsell Product

You need to use the plugin system of Magento 2. The objective of plugin is to add a limit on the product items without overriding the module Magento_Catalog itself with an after plugin. This is an ...
TaKe_Da_ShAkEr's user avatar
5 votes

How to integrate ImageMagick to magento

There is presently no free extension that meet your requirements. I suggest you look into some HTML5 Canvas javascript libraries to achieve at least the 'designer' portion of your requirement. There ...
Bhupendra Jadeja's user avatar
5 votes
Accepted

How can i get total view count of a product in Magento2?

For any product, you can set the product_id to the report collection /** * @param int $id * * @return mixed */ public function getProductCount($id) { /** * @var \Magento\Catalog\Model\...
leo's user avatar
  • 1,236
5 votes

Change standard quantity on product page from 0 to 1 (Magento 2)

Khoa's second option is the preferred one. Anyways, this sometimes does not work for bundles. There you have to also carefully check the bundles option's and quantities. The logic for the default ...
Alex's user avatar
  • 13.8k
5 votes

Change standard quantity on product page from 0 to 1 (Magento 2)

--The second way is the Magento default config: STORES > Configuration > Catalog > Inventory > Product Stock Options > Minimum Qty Allowed in Shopping Cart > > Add Customer Group > change to 1 For ...
Rebecca Brocton's user avatar
5 votes
Accepted

How to add SKU in the attribute list in the More Information tab of the product view page?

You don't need to do anything like that You just follow below step to display sku in More Information tab on product view page Go to Stores -> Attributes -> Product Search SKU attribute and edit it ...
Naresh Rupareliya's user avatar
4 votes

How to get product category id on product detail page Magento 2

Try this, Create a custom module like below code. create a module block file to get current category name. <?php namespace Namespace\Modulename\Block; class Blockname extends \Magento\Framework\...
Magento 2's user avatar
  • 3,834
4 votes

How to change div fotorama__stage height on product view page

in Magento_Catalog::product/view/gallery.phtml you can see config for gallery: var config = { "width": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('...
adyry's user avatar
  • 271
4 votes
Accepted

Add CMS block as custom tab in product view page Magento 2

Add Vendor_Module before template path Try this, catalog_product_view.xml <?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Prince Patel's user avatar
  • 22.7k
4 votes
Accepted

Magento 2: More Information Tab Attribute order

You can change the order of attributes in frontend by changing the order that they appear on your attribute set.
Jancy Abraham's user avatar
4 votes

Image sizes in detail page

To change Size of product images and other listing page images or related item image Edit your view.xml at below location in your extended theme /app/design/frontend/vendor-name/theme-name/etc/view....
Manoj Deswal's user avatar
  • 5,785
4 votes

Magento2 display price in 2.5 lac, 3.5 crore, 25 lac etc

app/code/Package/Modulename/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/...
B00MER's user avatar
  • 8,307
4 votes
Accepted

Hide Tabs on product details page for specific product Magento2

Yes you can achieve this thing by writing small code. What you can do is add add layout via event layout_load_before, you can use this event to add your dynamic layout. Here is sample code for you, ...
Murtuza Zabuawala's user avatar
4 votes
Accepted

How to add a custom block after product info in product view page magento2?

Why you need phtml, You can directly call static block. You can use below code in: [VENDOR_NAME]/[THEME_NAME]/Magento_Catalog/layout/catalog_product_view.xml <referenceContainer name="product....
Pawan's user avatar
  • 5,846
4 votes
Accepted

Magento 2: Internal link on product detail page to tab

I think you should do just trigger a click event for the tab on your button click if you just want to display on click like add below script in your details.phtml file <script type="text/...
Hitesh's user avatar
  • 1,569
4 votes
Accepted

In magento 2 How to customize a sidebar additional in product details page?

Use this code in your /app/design/frontend/[Vendor]/[Themename]/Magento_Catalog/layout/catalog_product_view.xml to add additional sidebar in your product details page <referenceContainer name="...
Aasim Goriya's user avatar
  • 5,444
3 votes

Add vertical slider to product page (view more images)

You must create the view.xml file on your theme app/design/frontend/VendorPackage/Theme/etc/view.xml <?xml version="1.0"?> <view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
St3phan's user avatar
  • 2,907
3 votes

call static block in view.phtml insted of phtml file

If you have created CMS block named 'block_identifier' from admin panel. Then following will be code to call them in .phtml <?php echo $this->getLayout()->createBlock('cms/block')->...
J.wiston's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible