Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

Have you given any thought to the Ultra Pics contribution. If so, Iggy came up with the code to get STS and Ultra Pics to work nicely together:

 

Just in case anyone out there is using Ultrapics here's some code that works for /includes/modules/sts_inc/popup_image.php.

<?php
// Ultrapics mods
 $products_query = tep_db_query("select pd.products_name, p.products_image, p.products_image_lrg, p.products_image_xl_1, p.products_image_xl_2, p.products_image_xl_3, p.products_image_xl_4, p.products_image_xl_5, p.products_image_xl_6 from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$_GET['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
 $products = tep_db_fetch_array($products_query);
 $sts->template['productname'] = $products['products_name'];
 $sts->template['productmodel'] =  $products['products_model'];

	   if ($_GET['image'] ==0) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_lrg'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==1) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_xl_1'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==2) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_xl_2'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==3) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_xl_3'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==4) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_xl_4'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==5) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_xl_5'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==6) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image_xl_6'],'','','', 'name="prodimage"');
 } elseif ($_GET['image'] ==7) {
 $sts->template['popupimage'] = tep_image(DIR_WS_IMAGES . $products['products_image'],'','','', 'name="prodimage"');
 } ?>

 

 

Hi there, well I've installed the ultrapics and I've got these codes (Image Large: $imagelarge$) (Image Small: $imagesmall$) in product_info.php_26.html but it only shows the original first image of the product. Which code do I have to put to display the images from Ultra pics module?

 

 

Thank you!

Link to comment
Share on other sites

I am in need of a little guidance. I have attained a pretty good grasp of the STS Template system (I think :blink: ) but I believe that what I am wanting to do may be a little out of the ordinary everyday STS users need. I want to create a custom pop up that I can control with an STS Template that I create for it. I have already managed to create the code required to show what I want to show in the Pop up and I have created a tag to call the link needed for someone to click on it to call the pop up. I am stuck at this point however.

 

...

 

What I would like to do is create the same structure that the popup_image.php has but I just can't seem to wrap my head around everything that needs to be done. By following the pop_up I can see that I am going to have to create three files. One in the STS folder, one in the STS_Inc folder and the template file in my template folder. Can anyone give me any direction on how I would go about that from the code that I have pasted above? I am gathering the information from different tables and rows when displaying the view_more_info pop up or I would just coppy the pop_up files and rename them. Sorry for the long post!

 

You can see how this works now if you want if it will help. Just have a look at any product in our store and click on the link below the product description that says "click here for more information on this manufacturer blah blah blah ....".

This site is live. here is a good example http://gourmetsoiree.com/chocolate-assortment-p-170.html

 

Even if you don't have the whole answer I would be thrilled to have a part. Sooner or later it will come together.

Thanks,

 

Gary

 

The file in includes/modules/sts is used to detect which template is to be used, and contains the logic to be visible in admin so you can turn it on/off. To create another popup page, copy the sts_popup_image.php and rename it according to your own popup name. Class must be renamed too. At the end of the file are function needed for admin, parameters names must be changed too.

 

The file in includes/modules/sts_inc is where the placeholders are created.

 

The template file, I guess you know what it is.

 

- Rigadin2

Link to comment
Share on other sites

Hi there, when I use the STS template I can't see the new_products section in my catalog. Can you please tell me which code should I use to display it in the template page. When I disable the STS the New Products are coming straight away.

 

 

I think the code must be put in the middle of the page under $content.... but which code???

 

 

 

Many thanks!

Link to comment
Share on other sites

Jessica,

In STSv4.4, it would be included with the $content tag unless you have some custom contribution installed that modifies the New Products box in some way. If that is the case, then you would need to create your own STS tag and then insert it where you want it in your template.

 

Hope this helped,

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Jessica,

In STSv4.4, it would be included with the $content tag unless you have some custom contribution installed that modifies the New Products box in some way. If that is the case, then you would need to create your own STS tag and then insert it where you want it in your template.

 

Hope this helped,

 

 

Hi again, well I have the tag $content but didn't show the new products and this is a fresh copy of oscommerce, can you please help me with the tag? Which tag I need to put to display the new products section?

 

And also the $content tag where it gets the information from - which file??? index.php???

 

 

 

Thanks again for your answer!

Edited by jasper77
Link to comment
Share on other sites

Hi again, well I have the tag $content but didn't show the new products and this is a fresh copy of oscommerce, can you please help me with the tag? Which tag I need to put to display the new products section?

 

And also the $content tag where it gets the information from - which file??? index.php???

 

 

 

Thanks again for your answer!

Do you have the following line of code in your index.php?

<tr><td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td></tr>

$content is taken from the php script you are running. For example, the $content for index.php is the piece of code you find in index.php, between the call of column_left and the call of column_right. If you want to modify it, you have to modify the script itself.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

I am trying to add a custom code to show a simple searchbox on the front page, but I keep getting this error:

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /data/12/1/132/60/1132060/user/1201336/htdocs/.../.../.../modules/sts_inc/sts_user_code.php on line 53

 

I am new to PHP and some help would be appreciated :)

 

Code is below:

 

    $sts->start_capture();
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SEARCH);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_
ADVANCED_SEARCH_RESULT,
'', 'NONSSL', false), 'get'),
                              'align' => 'center',
                              'text' => tep_draw_input_field('keywords', '', 'size="10" maxlength="30" 
style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit
('button_quick_find.gif', BOX_HEADING_SEARCH) . '<br>' . BOX_SEARCH_TEXT . '<br>
<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_
ADVANCED_SEARCH . '</b></a>');

 new infoBox($info_box_contents);
?>
$sts->stop_capture('customsearch');

Edited by SMFGGUY

What happens when a crazy man goes insane?

Link to comment
Share on other sites

Do you have the following line of code in your index.php?

<tr><td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td></tr>

$content is taken from the php script you are running. For example, the $content for index.php is the piece of code you find in index.php, between the call of column_left and the call of column_right. If you want to modify it, you have to modify the script itself.

 

 

 

Hi again, yes I have this code in my index.php, but it only works when I disable the STS module? I don't know why is that?

 

 

If I select STS true can't see the new products, everything else but not the New products section?

 

 

Please, I need help!

Link to comment
Share on other sites

Hi again, yes I have this code in my index.php, but it only works when I disable the STS module? I don't know why is that?

 

 

If I select STS true can't see the new products, everything else but not the New products section?

 

 

Please, I need help!

My suggestion would be to use a file comparison tool such as Beyond Compare or WinMerge to compare ALL of your stores files with that of a stock 060817 osCommerce release. Then, compare all of your files with the files included in the STS contribution.

By doing the above, you will find out what code is causing you the problem of not seeing your New Products for the month box.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Making a simple text link that does not lose the session ID.

 

If you want to just make a regular text link, you would use the tep_href_link function like all of the other links on the page, and title it whatever you want... For example, using your products_new.php from above, you can do it in one of the following examples:

 

<a href="<?php echo tep_href_link(FILENAME_PRODUCTS_NEW); ?>">Click here to see our new products</a>

 

Orrrrr...

 

<a href="<?php echo tep_href_link('products_new.php'); ?>">Click here to see our new products</a>

What about making links using things like index.php?Path=21

I want to link to categories and products without losing the user session

 

I tried using the above methods, but they do not work...

 

Anyone knwo how to do this?

Link to comment
Share on other sites

Disregard Previous question, it did work...but I do have anotehr question:

 

The following code is showing up at the top of my website:

<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<!-- footer_eof //-->
<br>
</body>
</html>

 

...Than thebeginning of the real code starts. I'm afraid this is going to hurt the search engine ranking of the website and is also creating a bit of a gap at the top. I don't knwo where to look to remove it, can anyone lend a hand? I checked the tpl files and it isn't in either.

Link to comment
Share on other sites

What version are you using? Have you upgraded from a previous version? There is something wrong with your installation, check the STS code in column_right.php, footer.php and application_bottom.php

 

- Rigadin2

Link to comment
Share on other sites

The file in includes/modules/sts is used to detect which template is to be used, and contains the logic to be visible in admin so you can turn it on/off. To create another popup page, copy the sts_popup_image.php and rename it according to your own popup name. Class must be renamed too. At the end of the file are function needed for admin, parameters names must be changed too.

 

The file in includes/modules/sts_inc is where the placeholders are created.

 

The template file, I guess you know what it is.

 

- Rigadin2

Thank you Rigadin2!

 

This is what I needed. I have run into one problem that I am unfamiliar with. I need to pass a variable from Product page to the pop up page where I conduct my query so that I can match the info with the Vendor. Here is what I have (in my sts_inc/product_info.php file):

 

	$sts->template['view_more_info'] = '<a href="java script:popupWindow(\'' . tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL', 'products_id=' . $products_id) . '\')">' . HEADER_TITLE_VIEW_MORE_INFO . '</a>';
$sts->template['url_view_more_info'] = tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL');

 

I think I have gotten everything else but this. The pop up processes the tags correctly because they are not showing as text (just blank where the info should be). I placed some text beside each tag so that I could tell where it should be and it shows up. So the only other thing that I can figure is there is no data to return because there is no match. The only reason there would not be a match is if the $products_id is not getting sent over to the query in the pop up. Is there a way to see what value a variable has like you can in Visual Basic? Can I determine the value of $product_id from within the pop up?

 

Thanks,

 

Gary

Edited by gmltw
Link to comment
Share on other sites

Thank you Rigadin2!

 

This is what I needed. I have run into one problem that I am unfamiliar with. I need to pass a variable from Product page to the pop up page where I conduct my query so that I can match the info with the Vendor. Here is what I have (in my sts_inc/product_info.php file):

 

	$sts->template['view_more_info'] = '<a href="java script:popupWindow(\'' . tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL', 'products_id=' . $products_id) . '\')">' . HEADER_TITLE_VIEW_MORE_INFO . '</a>';
$sts->template['url_view_more_info'] = tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL');

 

I think I have gotten everything else but this. The pop up processes the tags correctly because they are not showing as text (just blank where the info should be). I placed some text beside each tag so that I could tell where it should be and it shows up. So the only other thing that I can figure is there is no data to return because there is no match. The only reason there would not be a match is if the $products_id is not getting sent over to the query in the pop up. Is there a way to see what value a variable has like you can in Visual Basic? Can I determine the value of $product_id from within the pop up?

 

Thanks,

 

Gary

I have went over and over the code in all of the effected files and I can not for the life of me figure out why the query is not picking up the Product ID variable (if that is indeed the problem even.).

 

I changed

$sts->template['view_more_info'] = '<a href="java script:popupWindow(\'' . tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL', 'products_id=' . $products_id) . '\')">' . HEADER_TITLE_VIEW_MORE_INFO . '</a>';
$sts->template['url_view_more_info'] = tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL');

 

to read:

$sts->template['view_more_info'] = '<a href="java script:popupWindow(\'' . tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL', 'pID=' . $products_id) . '\')">' . HEADER_TITLE_VIEW_MORE_INFO . '</a>';
$sts->template['url_view_more_info'] = tep_href_link(FILENAME_VIEW_MORE_INFO, '', 'SSL');

which is the same variable that the POP up image uses for product Id. I then also changed it in the query to reflect the new value.

 

Query in the file that I put in catalog/includes/modules/sts_inc/view_more_info.php (same place the pop_up.php is):

  $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_text, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.manufacturers_id = m.manufacturers_id");

 $maninfo = tep_db_fetch_array($manufacturer_query);

$sts->template['man_id'] = $maninfo['manufacturers_id'];
$sts->template['man_url'] =  $maninfo['manufacturers_url'];
$sts->template['man_info'] = $maninfo['manufacturers_text'];
$sts->template['man_name'] = $maninfo['manufacturers_name'];
$sts->template['man_image'] = tep_image(DIR_WS_IMAGES . $maninfo['manufacturers_image'],'','','', 'name="manimage"');

 

Perhaps there is a problem with my SQL? Does anyone see anything that needs to be changed?

 

Can someone tell me how I can find out what the value of each variable is during run time? That would help if I could actually find out what the value is of each variable in my query.

 

Thanks,

 

Gary

Link to comment
Share on other sites

What version are you using? Have you upgraded from a previous version? There is something wrong with your installation, check the STS code in column_right.php, footer.php and application_bottom.php

 

- Rigadin2

Thanks, I was missing a line of code in application_bottom.php

$sts->stop_capture();

Link to comment
Share on other sites

Greetings! Please forgive me if the answer to my question is already here... I search for it with the box and don't have time to read 36 pages of responses to be sure that I missed something that was actually here and not something that was actually not here...

 

ANYHOW, I have installed the STS and changed all the values to what they should be in order to see the default template. I am getting the following error in the left upper corner:

Template file does not exist: [includes/sts_templates/full/boxes/infobox_header.php.html]

 

I can't find this file anywhere and have no ideas of where to find a new one of this file... Is there a file I might have that I could rename and use? For example, I do have a file called infobox_information_header.php.html which I downloaded in another STS version hoping I might find the missing file I need...

 

Please help as soon as possible as I am going nuts trying to find this file or an acceptable replacement for it...

 

Thanks!!

~Sarah~ aka Candy Cuteness

Link to comment
Share on other sites

@Gary:

 

I think there is a problem with your SQL, the mi.languages_id=... in the left join sounds strange to me, this part should be in the WHERE clause I think. If you want to see what STS put in the placeholders, you can add sts_debug=debug in the URL: all placeholders and their value will be displayed in the bottom of your page so you can see if the product ID exists in $sts->template['view_more_info'].

From where you call catalog/includes/modules/sts_inc/view_more_info.php? Have you made a new module based on sts_popup_image.php module?

 

@Sarah:

Two solutions: upgrade STS to the latest version (4.5 SP2) or create the missing file, it can just be an empty file.

 

- Rigadin2

Link to comment
Share on other sites

@Gary:

 

I think there is a problem with your SQL, the mi.languages_id=... in the left join sounds strange to me, this part should be in the WHERE clause I think. If you want to see what STS put in the placeholders, you can add sts_debug=debug in the URL: all placeholders and their value will be displayed in the bottom of your page so you can see if the product ID exists in $sts->template['view_more_info'].

From where you call catalog/includes/modules/sts_inc/view_more_info.php? Have you made a new module based on sts_popup_image.php module?

 

@Sarah:

Two solutions: upgrade STS to the latest version (4.5 SP2) or create the missing file, it can just be an empty file.

 

- Rigadin2

Since this is in a Pop up, how can I go about getting it to load with the address bar so that I can enter the debug code? I guess I could add it to the filenames link (or where ever it was I named that link).

 

It's late and my eyes are beginning to cross but I am going to have another look at the query tomorrow. I agree with you on the language being in the join. Not sure why I did that? >_< Maybe it'll come to me after I have slept a little. Maybe!

 

Yes on the sts_popup_image.php module

 

Can you verify that I am covering all bases with where I have my code located. I have a view_more_info.php located in the catalog/ folder which will work if STS is set to false.

 

A copy of sts_pop_up.php called sts_view_more_info.php and modified so that the class is correct and all variables are correctly named.

 

A file that I created for the sts_inc folder where I set the values of my sts tags. Similar to the pop_up.php file in the sts_inc folder but with different variables and a different query (of course).

 

The template for my view_more_info.php file located in my template folder - catalog/includes/sts_templates/gourmet_soiree/ called view_more_info.php.html.

 

If I am understanding the way this is working, the catalog/includes/module/sts_inc/view_more_info.php should be taking the place of the catalog/view_more_info.php if I have it turned on in Admin (which is controlled by the file located in the sts folder). Is that correct?

 

Do I have to keep the view_more_info.php located in the catalog/ for it to work without errors?

 

Does this look like I have everything covered or have I missed something as far as files go?

 

Thanks for your help!

 

Gary

Link to comment
Share on other sites

Since this is in a Pop up, how can I go about getting it to load with the address bar so that I can enter the debug code? I guess I could add it to the filenames link (or where ever it was I named that link).

You can add $sts->display_debug_output=true after the call application_top.php, in your catalog/ script

 

A copy of sts_pop_up.php called sts_view_more_info.php and modified so that the class is correct and all variables are correctly named.

That's good.

 

A file that I created for the sts_inc folder where I set the values of my sts tags. Similar to the pop_up.php file in the sts_inc folder but with different variables and a different query (of course).

That's good.

 

The template for my view_more_info.php file located in my template folder - catalog/includes/sts_templates/gourmet_soiree/ called view_more_info.php.html.

That's good too.

 

If I am understanding the way this is working, the catalog/includes/module/sts_inc/view_more_info.php should be taking the place of the catalog/view_more_info.php if I have it turned on in Admin (which is controlled by the file located in the sts folder). Is that correct?

Not correct. The file in catalog/ is processed anyway and you cannot remove it without getting errors. The file in sts_inc should be included in another way, generally from the configuration of the module in admin, parameter "Files to include".

 

Do I have to keep the view_more_info.php located in the catalog/ for it to work without errors?

Yes

 

Does this look like I have everything covered or have I missed something as far as files go?

Module must be configured to include the extra file in sts_inc/

 

Now, if you are always using STS, your script in catalog can be made quite simply:

- include application_top.php

- include your file in sts_inc/ (or copy its code here)

- include application_bottom.php

 

It can also work without the sts_view_more_info.php module, but then all tags created in sts_inc/general.php and sts_inc/sts_user_code.php will be processed and you don't need them in your popup.

Link to comment
Share on other sites

What about making links using things like index.php?Path=21

I want to link to categories and products without losing the user session

 

I tried using the above methods, but they do not work...

 

Anyone knwo how to do this?

<a href="<?php echo tep_href_link('index.php', 'cPath=21&', 'NONSSL'); ?>">Category Name Here</a>

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Hi

 

I need to have a facility to have a message on the template of my site Meccanoman. The message needs to be editable via the admin. At pressent I have to edit the template file evety time I want to change it! I'm currently running sts 2.01 and I realise I could do this via PHP in the later versions but I'm a bit worried that the upgrade will break the site.

 

Can anyone point me in the direction of an easier way to do this or give me advice on the implications of upgrading.

 

Many thanks in advance

 

Ian

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...