News:

Looking for documentation? Take a look on our wiki

Main Menu

Different descriptions for same product depending on what catagory is viewed?

Started by TurnTex, January 06, 2016, 01:07:23 AM

Previous topic - Next topic

TurnTex

First, to get the software specifics out there.  I am running J! 3.4.8 and VM 3.0.13 using Virtueplanet Merchant Template.  My php version is 5.6.16.

I building a new website for myself to replace an aging J1.5.26 VM1.1.9 site.  On the new site, I have a product that is applicable to 2 different categories so I have them both assigned in the product categories section.  The problem is even though it is the same product and sku, it is used differently for category A than for category B.  Is it possible to have a description displayed depending on what category the customer is viewing?  In other words, if the customer is viewing category A and clicks on this product, I would like the description to be applicable for using it with other products in Category A.  If they view the product through Category B, I want a different description that is applicable to Category B products.  I really do not want to have 2 different products/skus for the same product because it will make inventory management difficult.

Does anyone have any suggestions to do this?  Thank you in advance for any help you can provide.  I am not a coder so I can't custom code something and was hoping there might be an option I am not thinking of "out of the box".

GJC Web Design

Even if u use another field for prod desc 2 or a custom field you still have to switch which one to use depending on the cat -
and for that IMHO you need to have some code in the template .. detect the catid.. show the correct desc
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

TurnTex

Unfortunately that is over my head, GJC.  Maybe I should contact the template creator to see if he can help me with it?


GJC Web Design

Once u sort how you will fill-in two descriptions in the admin (custom field or use another field like Internal note) you just need the logic in the template to switch them according to the cat id
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

Studio 42

Another solution, is to use 2 layout file for product desc, and associate the layout for the product.
See in categorie edition form : Default Product Details Page

PRO


I just did a little with this,

I created a customfield "textarea"
Named it   cat92   (92 for the category id)
Then in my product template
added this

   <?php   
          if (!empty($this->product->customfieldsSorted[cat92]))   {
          $jinput = JFactory::getApplication()->input;
        $ccat = $jinput->getInt('virtuemart_category_id', '0');
   foreach ($this->product->customfieldsSorted[cat92] as $field) {
   $ccheck  = str_replace( 'cat', '', $field->custom_title);
   if ($ccheck==$ccat)   {
   $this->product->product_desc=$field->customfield_value;}
   }
       } ?>

This will display the "textarea" field when the product is in category id 92.

of course this could easily be scale able with a little more logic, technically the code would only work on 1 category per custom field.

Studio 42

WHy changing the code when you have native code to do this ?
Read my answer.
Copy the dafault layout and remove product desc or any field you need to remove.
And Add in this copy of default to render customfield with position YOURPOSITION
echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'YOURPOSITION'));

TurnTex

Thank you all for the replies.  Unfortunately, I am not a coder and know just enough about PHP to make changes when I am told what to change or add and where.  If anyone is willing to give me a little more in depth details on how to implement this, it would be greatly appreciated.  If not, I completely understand!

One thing that I wonder about...I am using Virtueplanet Merchant template.  The template creates a tab for the description as well as other custom fields that are set a certain way.  How would either of the options mentioned be affected by that?  Here is a screen shot of what I mean.  If anyone wants to see the site www.pensandbeyond.com.  This is still in development and not publicized yet.  It is on a shared hosting account I use for development.  Once I am done with it, I will move it back to my VPS to replace the old site.


GJC Web Design

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

PRO

Quote from: TurnTex on January 07, 2016, 01:55:08 AM
The template creates a tab for the description as well as other custom fields that are set a certain way.  How would either of the options mentioned be affected by that? 


the code I posted above actually CHANGES the product description
so, no layout changes are made.
It simply switches the product description for the customfield text

GJC Web Design

Quoteyou would need to make the changes within the desc tab area...

of course dependent on what solution you go for
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

TurnTex

Folks, than you so much for your help!  I was able to get it implemented and it is fully functional!  I have to give a huge Thank You to Jumbo with Virtueplanet on this.  I am using his Merchant template and he is one of the absolute best template providers I have worked with.  He is willing to help out and did some custom coding for me to implement this.  After posting here, I decided to post on his support forum like I have many times asking if this could be done.  He said it was not possible so I directed him to this thread to get some of your ideas.  He went to work and implemented it for me as I do not have the technical abilities to do this.  All if this was done without him asking for a penny!  (of course I sent him some money anway!).

So, thank you all for the ideas and inspiration to help me get this done and for providing some ideas for Jumbo to work with!  I sincerely appreciate it!

GJC Web Design

Nice to hear and see feedback about users experiences with templaters and coders .. should be encouraged..   :)
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