News:

Support the VirtueMart project and become a member

Main Menu

More than standard views for product details ?

Started by RobertG, July 13, 2014, 10:58:40 AM

Previous topic - Next topic

RobertG

Hello,

Sorry if my post is not as the right place!
I am looking for a solution to add a new view for product details page, not for overriding default.php view.
I need to add a donation product to a website, and let customers decide how much they want to donate.
So I created a product with price=0 and add custom field for donation.
But on product detail view appears price=0 I don't want to see!

I tried to duplicate "productdetails/tmpl/default.php" and named it "no_price.php", I modified it to not display price but I don't know how to add "no_price" view to "default", "pdf" and "notify": how can I do?

Thanks for your answers!

GJC Web Design

products->product->product information->product details page  dropdown
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

RobertG

Thanks but it's not the solution: "no_price" doesn't appear in dropdown list, only "No override", "default", "pdf" and "notify"!
How can I add "no_price" to that list?

GJC Web Design

add a template over ride called no_price.php to your product details over rides
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

RobertG

Sorry but no!
I added "no_price.php" in "my_template/html/com_virtuemart/productdetails" folder, but dropdown list remains "no override, default, pdf, notify" in product category form and product information.

jenkinhill

Works every time for me in VM2.6.6  Make sure that the path is correct, with no typos, and that the correct template has been chosen. There is one commercial template developer that uses a different path for overrides, so check that if you have a commercial teamplate.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

RobertG

I'm using beez5 as default template on a test site (J! 2.5.22 VM 2.6.6), override in "templates/beez5/html/com_virtuemart/productdetails/no_price.php" where "no_price.php" is a modified copy of "components/com_virtuemart/views/productdetails/default.php", but "no_price" don't appear on dropdown list.
I don't understand what to do for listing "no_price" in this list.

jenkinhill

Just realised you have an underscore in the file name. That prevents the file being seen, it should be a hyphen if you need a spacer.  http://docs.joomla.org/Layout_Overrides_in_Joomla
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

RobertG

#8
Thanks Kelvyn! It's OK now.

Another question: is it possible to duplicate and modify default_addtocart.php -> no-price_addtocart.php to not show quantity and "+" and "-" buttons, and change text for addtocart button?

RobertG

Quote from: RobertG on July 13, 2014, 15:49:01 PM
Another question: is it possible to duplicate and modify default_addtocart.php -> no-price_addtocart.php to not show quantity and "+" and "-" buttons, and change text for addtocart button?
I reply to myself ;):yes, it's the right way!
View named "no-price.php" and addtocart file named "no-price.addtocart.php" work together!

RobertG

New problem! In 2.9.8 version, there is no more "default_addocart.php", because addtocart is now in "sublayouts/addtocart.php" and called line 167 of "productdetails/default.php" by
Quoteecho shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$this->product));
So my question is: how to override this sublayout?

You may add "components/com_virtuemart/sublayouts/addtocart.php", rename and modify it: "my_template/html/com_virtuemart/sublayouts/noshipping.php" when special detail view for product is "my_template/html/com_virtuemart/productdetails/noshipping.php" where the previous quoted line is now
Quoteecho shopFunctionsF::renderVmSubLayout('noshipping',array('product'=>$this->product));

jenkinhill

Don't play with 2.9.8 yet - but if you do please report your findings on the dev & testing board, http://forum.virtuemart.net/index.php?board=136.0

Not only is is a test/development pre-release version, but as you found it uses a somewhat different templating system with sublayouts. These are overriden by placing the files in yourtemplate/html/com_virtuemart/sublayouts/
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum