Post by johnrsherwood » Wed Aug 24, 2016 4:35 pm

Im using OCV 1.5.4.6. Ive installed a random module that gives me a random product each time no matter where the module is placed. That works fine. id like to add product options to that random product, eliminating the need to go to the product page to select options to add to cart...

How would I do this? I have php/tpl experience so coding is ok with me for a solution...

Thank you

New member

Posts

Joined
Mon Nov 03, 2014 3:04 am
Location - Usa

Post by IP_CAM » Thu Aug 25, 2016 12:09 pm

this is MVC-Framework Style, you have to define/declare all the Values, you want to add,
in an i.E. random_x.tpl File, in the corresponding:
controller/module/random_x.php
and:
language/english/module/random_x.php
Files. for some DB-Access, you may also have/use a
model/module(or whatever)/random_x.php
file in your Extension, possibly required, to be 'adapted' as well.
---
Below, a much simplied (not working!) VqMod Routine, to show, how a custom description Variable desc
is added to an existing Product.tpl file, to allow a Related Product Short-Description Display.
A language related CONTROLLER-File entry has not been needed/used, since there are no 'Words' involved in
the Changes. Therefore, there was also no need to add the new Variable into the corresponding language File.
---
Just to give you a basic Idea, I am UnCoder, by Nature, not by Will, but it does not keep me from trying.

Good Luck ;)
Ernie

<file name="catalog/view/theme/*/template/product/product.tpl">
<after><![
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
]><add><![
<p><?php echo $product['desc']; ?></p>
]>
</file>

<file name="catalog/controller/product/product.php">
<after><![
'product_id' => $result['product_id'],
]><add><![
'desc' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 64) . '..',
]>
</file>

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 8 guests