Page 1 of 1

Blank template needed for product area...

Posted: Wed Feb 23, 2011 4:13 am
by harryusa
I am sure I'm not the only person who needs the ability to place a strictly informational page that would occupy center area where the products normally show up in. I would like to place some html and perhaps php calculated fields. How can I generate an alternate template?

Re: Blank template needed for product area...

Posted: Wed Feb 23, 2011 5:06 am
by trapson
Maybe an iframe an option?

Re: Blank template needed for product area...

Posted: Wed Feb 23, 2011 5:23 am
by Chones
Do you mean you don't want products on the Home Page? If so, just edit the home.tpl template file.

If you don't want products to show up elsewhere then I don't understand... why use Opencart?

Can you be more clear?

Re: Blank template needed for product area...

Posted: Wed Feb 23, 2011 6:17 am
by harryusa
Thanks for the reply.
I would like the flexibility to provide strictly information about a product or service in the product.tpl generated area. One reason might be that a particular service is not offered for purchase online, only in the physical store location. Another reason would be to provide an area where you could run a custom php script to allow your customers to upload files you will then provide a service on. Another would be to provide a custom quote script for a particular product or service. Yet another could be that you need to provide a calculator for estimating or pricing. I have a corollary need to price a product out by the square inch and as far as I can tell, that will have to be a specially written script. I would like to have this flexibility without leaving the store front.
What are your ideas?

Re: Blank template needed for product area...

Posted: Wed Feb 23, 2011 7:16 am
by Chones
That's not just changing the display of the product page, that's making major changes to the way Opencart works, including database changes. With some minor changes you could change "Add to Cart" to "Contact Us" for services not available to buy online. Also, the Global Mega Options extension allows File Upload and may have some of the other functionality you're after.
http://www.alreadymade.com/shop/index.p ... duct_id=82

That may get you part of the way there. It may be worth contacting Readyman, who developed the extension.

Re: Blank template needed for product area...

Posted: Wed Feb 23, 2011 10:40 am
by harryusa
Chones,
I will have to look into that add-on further. At first glance it looks like his mod can change drop-down lists into radio buttons or check boxes as well as having text areas which I can think of a few applications for. Relating more to my desire to create a completely customizable area in the products area, why couldn't I use a template like "Privacy Policy" (which is blank by default) and make a template that would be part of another sidebar box "Online Services" and this collection of template pages would perhaps do calculations and such that could then update the products table and provide the $_SESSION[user] with a discrete product code generated the instant they hit "Order" and then forwarding them to that discrete products page where they can add it to the basket? The appeal is to still be within the store front since you are selling or preparing to sell but the price calculation may be a bit more complex than How Many? and What Size?

BTW, do you know if the shopping cart items are stored in a $_SESSION[] array or in the database?
Thanks,
Harry

Re: Blank template needed for product area...

Posted: Wed Feb 23, 2011 10:04 pm
by harryusa
I am starting to understand the MVC structure. Here are some resources for folks who need the flexibility of writing their own modules and templates (.tpl files, not to be confused with the "skin" design)
I don't have time to enumerate the relevance of each link but after searching the site and noodling around for a couple of hours I am able to understand the overall structure of the MVC architecture and how to customize module boxes and template files (.tpl) I hope this saves somebody some research time. They aren't necessarily in order and some of the posts are inconclusive, but overall there is information in each link which is useful. As I find more stuff I'll edit this list. Please feel free to add your own useful links. And if anyone still has insights into the issues raised above, please post replies here.
Thanks.
http://www.opencart.com/index.php?route ... path=43_45
http://forum.opencart.com/viewtopic.php ... ustom+page
http://forum.opencart.com/viewtopic.php ... age#p26491
http://forum.opencart.com/viewtopic.php ... ler#p76824
http://forum.opencart.com/search.php?st ... tom+module

Re: Blank template needed for product area...

Posted: Thu Feb 24, 2011 3:10 am
by Chones
Hi Harry,

You can actually include any PHP you want in a product page .tpl file. If it was me I'd probably run a check to see what sort of product was being displayed (probably by what category it was in) and then output the PHP that you want. It sounds like you know what you're doing. Doesn't seem to be a need to use an information page like Privacy Policy, if I understand you correctly.

And the cart items are stored in a Session array.

Hope that helps. You may also be interested in this extensive collection of links that Qahar has collected.
http://forum.opencart.com/viewtopic.php?f=20&t=17933

Re: Blank template needed for product area...

Posted: Thu Feb 24, 2011 4:00 am
by harryusa
Excellent- http://forum.opencart.com/viewtopic.php?f=20&t=17933 should be a sticky.
I have started a work around to the products template which makes more sense to actually have it called "Services".
These would be things that require a more complex calculation to generate pricing, such as area, circumference, linear distance, volume, etc. I am now working on figuring out the module parsing and variable passing code. Ran a Print_r on $_SESSION and found the cart array. I now have to figure out how the cart's discrete code for the product and how it knows what options were selected. I put the same item in the basket with 2 different options and the cart array only identifies them as 2 instances of the same number pattern.
Do you know anything about that?
-Harry

Re: Blank template needed for product area...

Posted: Thu Feb 24, 2011 4:42 am
by Chones
Hi Harry,
It is a sticky:
http://forum.opencart.com/viewforum.php?f=20

When I started working with Opencart it was simpler and I was able to use the session to complete a cart in other programs such as Wordpress, however it's got a bit more complicated recently and I have to admit I've not tried it for a while so I'm afraid that one's up to you. It's probably something I'll look into in the near future, a client of mine wants a Wordpress blog and will probably want the cart displayed in it, so will probably end up doing it. But it's not a job for tonight...

Re: Blank template needed for product area...

Posted: Thu Feb 24, 2011 5:12 am
by harryusa
I figured it out. The options are in product_option_value table of the database. The first number in the array is the product number id and subsequent numbers are the ids of the option in the product_option_value table.

Re: Blank template needed for product area...

Posted: Thu Feb 24, 2011 5:51 am
by Chones
Hi Harry,
As far as I remember, that's the easy bit - getting the price is more difficult, but you can probably use some internal functions. The problems arise because you have to check if a buyer is wholesale or public, if the product is on special offer, and if there is a discount based on volume.

You might try seeing what the arrays of the following functions spill out
$this->cart->getProducts()
$this->cart->getTaxes()
etc.

Have a look at catalog/controller/module/cart.php to see how the cart module is built.