Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

The space between boxes is really big. Is there any way to change it? I tried use <br> to instead <p> but still didn't make the space shorter. I added a spacer.gif in between still didn't work well!!! Please help. Thanks.

Click Here

 

Go down 5 posts for answer.

 

Hopefully it helps.

Link to comment
Share on other sites

Hi There!

 

I'm just trying to get STS to bend to my will and so far it's going pretty well but I had a few questions that a quick look through the last 50 pages in this thread doesn't seem to solve.

 

The site I'm working on has been designed to have individual templates for categories. So the questions are:

 

Once I set up a category template is it supposed to be picked up for all subsequent requests in that category? In other words I have a template for /index.php?cPath=22 in sts_templates as index.php_22.html and it works fine. Should that template then apply to /index.php?cPath=22_24 without having to create index.php_22_24.html?

 

Is the behavior of the product info template the same as the other pieces of the template system? Can I have a layout for product info specific to a category?

 

Right now my main problem is that I set up a category template, a sub-category template but when I get to product info it defaults to the main template for display? Any ideas what I'm doing wrong or is this expected behavior?

 

Thanks much for any help!

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Hi, it looks like STS might be just what I want, but I have installed it and i have a second repetition of the page layout below the first one... but with no content bits... what is going on? :S

 

 

p.s. double posted so that i can check the email notification bit... couldnt edit my last one for some reason to do this...

Link to comment
Share on other sites

Hi There!

 

I'm just trying to get STS to bend to my will and so far it's going pretty well but I had a few questions that a quick look through the last 50 pages in this thread doesn't seem to solve.

 

The site I'm working on has been designed to have individual templates for categories. So the questions are:

 

Once I set up a category template is it supposed to be picked up for all subsequent requests in that category? In other words I have a template for /index.php?cPath=22 in sts_templates as index.php_22.html and it works fine. Should that template then apply to /index.php?cPath=22_24 without having to create index.php_22_24.html?

 

Is the behavior of the product info template the same as the other pieces of the template system? Can I have a layout for product info specific to a category?

 

Right now my main problem is that I set up a category template, a sub-category template but when I get to product info it defaults to the main template for display? Any ideas what I'm doing wrong or is this expected behavior?

 

Thanks much for any help!

Iggy

I think I know what you mean. You need to have a product_info.php.html page to set up different templates for your products.

Link to comment
Share on other sites

It looks like the standard behavior for product info is to display the default template. Poking around I found that this particular issue is referenced on DiamondSea's site

 

HOW TO CREATE PRODUCT-SPECIFIC TEMPLATES IN STS v2.01

http://www.oscommerce.com/forums/index.php?sho...ndpost&p=377128

http://www.oscommerce.com/forums/index.php?sho...ndpost&p=378616

 

As always 95% of the battle is just finding the info you need. :) Not having much luck so far but we'll see!

 

Still, should STS display a template throughout a category and it's subcategories or do you need to create a file for each?

 

Thanks again!

Iggy

Edited by Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Hi Brian, and everyone else here not sitting on a cushion,

 

I am doing pretty well with STS and have just finished a store here : www.dottiedoolittle.com

 

Brian, I would like to send you a more "tangible" form of my appreciation for all the hard work you are doing and for supporting the Open Source community, but I dont know where to look for that paypal button. Maybe you can direct me? Some of the money I earn is due to standing on your shoulders. I always try to send something when I can.

:D

Anyways, on to my question. Starting another storefront here:

www.impeccablecollectibles.com/test/sub_page.html

(you can see my work in progress here: www.impeccablecollectibles.com/store)

and I really REALLY need to do a horizontal dropdown using DHTML for those top categories.

 

Please dont tell me about any of the contribs. I have tried them all. Blechh! I hate uninstalling all that mess when it doesnt work the way I need it to.

 

After wading through all the garbage here (can someone PLEASE tell the Osc Gods to make a better search function) I have found this primer:

 

http://www.oscommerce.com/forums/index.php?showtopic=35830

 

So, my question to all the humble and contrite developers here is easy: How to get a horizontal dropdown DHTML working with STS? Is there anyone who would like to work this out with me? I am not a professional PHP coder but I can hold my own. I think I have done a few Hiermenus some time ago. Maybe it is worth trying to fit this type of menu system into STS? Or .... maybe someone has gotten this to work already? Enlighten me.

 

The client wants the drop downs so I have no choice. The designer had wanted to put them in for me but I told them to not waste their time knowing I was using STS and that I would need to code this in the backend somehow.

 

OK I am rambling. Its 2:30 AM. I guess I can sleep when I die.

:: smile ::

 

Any thoughts anyone? Brian?

 

Regards,

 

Deborah

Link to comment
Share on other sites

Erik, i got the same problem. Did you resolve this?

Nope.

This is regarding using templates other than the basic sts_template.php file...

 

I'm facing the same problem. To be clear, is the presence of the substitute templates (e.g. product_info.php.html, index.php.html) in the catalog/includes/sts_templates/ folder all that is required to activate their use?

I figure this out for my installation. It seems as the the $scriptbasename variable was not set in the sts_display_output.php file and therefore when the script looked for the substitute templates ($sts_check_file = STS_TEMPLATE_DIR . $scriptbasename . ".html";) - there was nothing there. I'm not sure why other people's installations would work, but this is how I got it to work on mine:

 

Find :

$scriptname = $_SERVER['PHP_SELF'];

 

Add After:

$scriptbasename = basename($scriptname);

Link to comment
Share on other sites

completely unrelated to the last couple of posts, but i have tried every other part of this forum for an answer, and i get the feeling i will find the answer in here if anywhere - if i turn gzip compression on in admin, my site displays a completly blank page - no error message, no anything. I am pretty sure this is a conflict with sts - anybody else had this problem, and if so, anybody else find a solution? My page load times are really bad, i need gzip to work and ran out of ideas about a month ago! Any help appreciated. :D

Please note - if I have suggested a contrib above, it doesnt mean it will work! Most of the contribs are not ones I've used, but may be useful for your particular problem....

Have you tried a refined search? Chances are your problem has already been dealt with elsewhere on the forums.....

if (stumped == true) {

return(square_one($start_over)

} else {

$random_query = tep_fetch_answer($forum_query)

}

Link to comment
Share on other sites

Clearing it up - To make product info template work:

 

modify sts_display_output.php

 

Before: (Lines 41-44)

 

// Override if we need to show a pop-up window

$scriptname = $_SERVER['PHP_SELF'];

$scriptname = strstr($scriptname, "popup");

$scriptname2 = strstr($scriptname, "info_shopping_cart");

 

After: (Lines 41-45)

 

// Override if we need to show a pop-up window

$scriptname = $_SERVER['PHP_SELF'];

$scriptbasename = basename($scriptname);

$scriptname = strstr($scriptname, "popup");

$scriptname2 = strstr($scriptname, "info_shopping_cart");

Edited by benfiesta
Link to comment
Share on other sites

Hello..

 

Got a fast question.

 

In the read me file it says I can make specific links to specific cagories on my site.

 

It says I make the like "...php?cPath=XX_YY"

 

What do i include in the XX_YY??

 

Here is a link for example..

 

http://MYSITE.com/Store/index.php?cPath=22...2627ebcd72dae17

 

What would I do exactly to call this page up?

 

BTW if I just use the whole link the cart doesnot work correctly when adding products so I assume there is a correct way..

Link to comment
Share on other sites

Hello..

 

Got a fast question.

 

In the read me file it says I can make specific links to specific cagories on my site.

 

It says I make the like "...php?cPath=XX_YY"

 

What do i include in the XX_YY??

 

Here is a link for example..

 

http://MYSITE.com/Store/index.php?cPath=22...2627ebcd72dae17

 

What would I do exactly to call this page up?

 

BTW if I just use the whole link the cart doesnot work correctly when adding products so I assume there is a correct way..

I'm pretty new to STS as well and I hope I understand your question correctly but it's not so much an issue of the url itself but that you have a template in the sts_templates dir named index.php_XX-YY.html where XX is the category and YY is the subcategory.

 

So in your case it would be /catalog/includes/sts_templates/index.php_22.html and then call the page as usual. Sweet and neet. Take a careful look at the README as it's in there.

 

MULTIPLE CATEGORY TEMPLATES: Create custom templates for any or each category:

 

1) You can have a default site template by creating

creating /catalog/includes/sts_template.html

 

2) You can have a default category template by

creating /catalog/includes/sts_templates/index.php.html

 

3) You can have a different template for the Main Catalog Page (cPath=0) by

creating /catalog/includes/sts_templates/index.php_0.html

 

4) You can have a different template for the other Catalog pages (cPath=XX_YY)

by creating /catalog/includes/sts_templates/index.php_XX-YY.html (where XX_YY

is the cPath=XX_YY value you see in the categories URL

 

Hope that helps a bit!

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Runtime Errors

 

Working on new shop with STS v2.0. All working fine except that when you run through the order processing functions on the site (logged in as customer) and you want to order and check out you receive a number of Run Time errors.

 

For example: in checkout_shipping.php - When you load the page and try to fill in the form the following error pops up.

 

Runtime Error

Line 282

Error: Object Expected.

 

It appears to be the following line:

 

<tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">

 

Have reinstalled all necessary check out files files in Catalog over and over without success. Checked oout existing files on non STS sites. All OK and working. Appears only to be a problem with STS. Any ideas???? as I cannot take orders at present, as the systme bugs out. Using IE 6.01 as browser.

 

Thanks,

Link to comment
Share on other sites

Hello!

One issue. Now in sts system, i define the title of the page in title tags. problem is that the same title appears on all pages. can i do a dynamic title so it shows may be the product name instead of the title i have in sts_template.html file.

plz help.

Link to comment
Share on other sites

I'm having a problem with the custom category templates. While it works fine if someone clicks on the category, it reverts back to the main page template when someone clicks on a product within that category. Does anyone have any ideas on how to correct this?

 

JP

Link to comment
Share on other sites

There are a couple posts listed on DiamondSea's website

 

http://www.oscommerce.com/forums/index.php?sho...ndpost&p=377128

http://www.oscommerce.com/forums/index.php?sho...ndpost&p=378616

 

I haven't been able to make these work but the store I tried applying them to is pretty heavily modified. Please post back if you try these and they work.

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

Anybody who wishes to add the "Customers Also Purchased" module and/or "Cross Sell" module to your product info pages (you have to have the cross sell contrib already installed to use that particular part)

 

Just add the following to your sts_user_code.php file:

//Begin Also Purchased Module
  $sts_block_name = 'alsopurchased';
  require(STS_START_CAPTURE);
  if ( (USE_CACHE == 'true') && !SID) { 
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
  require(STS_STOP_CAPTURE);
  $template['alsopurchased'] = strip_unwanted_tags($sts_block['alsopurchased'], 'alsopurchased');
// End Also Purchased Module

//Begin Cross Sell Module
  $sts_block_name = 'xsell';
  require(STS_START_CAPTURE);
  if ( (USE_CACHE == 'true') && !SID) { 
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);
   }
  require(STS_STOP_CAPTURE);
  $template['xsell'] = strip_unwanted_tags($sts_block['xsell'], 'xsell');
// End Cross Sell Module

 

You can then call the appropriate variables w/ $alsopurchased and $xsell appropriately. Another little note: if you have no "also purchased" products or "cross sell" products associated w/ your product id, nothing will be displayed in your product info page.

 

Hope you find this a little useful!! :D

I only do what my Rice Krispies tell me to do!

Link to comment
Share on other sites

i've a problem during to create product-specific templates in sts. regard to your solution , i dont know where is the right place to add the code in point 4b & 4c . please help to solve the problem asap.

 

beside, for multilingual, how to name the template????did "dvd_movies.php_eng.html" is the right format??

 

many thanks.

 

martin

Link to comment
Share on other sites

a little bit better than you. ;) I stuck on 4g. I cannot find PRODUCTS_WEIGHT rows! If you still want try it,

 

4b & 4c (arround line 288-308):

 

          } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
           $product = tep_db_fetch_array($product_query);

           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
           $dup_products_id = tep_db_insert_id();

          $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
           while ($description = tep_db_fetch_array($description_query)) {
             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
           }

           tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
           $products_id = $dup_products_id;
         }

         if (USE_CACHE == 'true') {
           tep_reset_cache_block('categories');
           tep_reset_cache_block('also_purchased');
         }
       }

change to

          } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
           $product = tep_db_fetch_array($product_query);

           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
           $dup_products_id = tep_db_insert_id();

           $description_query = tep_db_query("select language_id, products_name, products_description, products_sts_templ_filename, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
           while ($description = tep_db_fetch_array($description_query)) {
             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_sts_templ_filename, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
           }

           tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
           $products_id = $dup_products_id;
         }

         if (USE_CACHE == 'true') {
           tep_reset_cache_block('categories');
           tep_reset_cache_block('also_purchased');
         }
       }

 

Good luck.

Link to comment
Share on other sites

thank you for iecwillow, now i can go to admin page , but when i edit the product, the error is come out , please help me again , thanks a lots!!!!!!!

 

beside, how to name the template in multilingual ????

 

1054 - Unknown column 'pd.products_head_title_tag' in 'field list'

select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, pd.products_sts_templ_filename, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from products p, products_description pd where p.products_id = pd.products_id and p.products_id = '1'

[TEP STOP]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...