VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 Customization
 Randomproducts showing out of homepage flow
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 24 2007 :  09:13:26  Show Profile  Reply with Quote
It's probably staring me in the face but I can't see it.

I'm converting VPASP tables to DIV's where necessary and for some reason, random products are being written out in the source before my container div.

My code is as follows...
<div id="container">
  <h1>[translate message]</h1>
  <div id="randomproducts">
    [Add_randomproducts]
  </div>
</div>


So from that, I expect that within the randomproducts DIV, to see random products with the tmp_frontpage.htm template applied.

tmp_frontpage does get applied, but in the source it appears BEFORE the code snippet above. I've stepped through the code to try and trace the order it's executed but nothing seems out of place.

Anyone got any suggestions?

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 29 2007 :  11:10:54  Show Profile  Reply with Quote
Further to my OP, the template (tmp_default.htm) looks like:


<!-- main content -->
<div id="container">
	<div id="homecontent">
		<h1>[translate message]</h1>
		[translate message2]
		[Add_randomproducts] 
	</div>
</div>
	<!-- / end of main content-->


My output HTML looks like:
<!-- random products -->
<div style="padding:2px; margin:2px;">
	<div style="width:20%;float:left;">
		<a href="shopexd.asp?id=22&bc=no">
			<img src="images/thumbs/vpaspdemo_apple.jpg" border="0" alt="Virtual Apple Set" />
		</a>
	</div>
	<div style="width:50%;float:left;">
		<span class="hdrproduct">
			<a href="shopexd.asp?id=22&bc=no">Virtual Apple Set</a>
		</span>
		<br />
		Non slip apple peeler.
	</div>
	<div style="width:30%;float:left;" class="vt ar">
                  Our Price: <span class='price'>9.99</span><br />
	 <p><b><a href="shopexd.asp?id=22&bc=no">More!</a></b></p>
	</div>
</div>


<!-- / end of random products -->
<!-- main content -->


<div id="container">
	<div id="homecontent">
		<h1>Welcome to my shop</h1>
		<p>Catchy slogan promoting the business</p>
	</div>
</div>
	<!-- / end of main content-->


I can see that [Add_randomproducts] is being called and written to the browser before tmp_default is - it should appear within the main content, just after the catchy slogan.
So how do I change it?

Edited by - Joff on May 29 2007 11:12:00
Go to Top of Page

MarkPavlich
Starting Member

USA
4 Posts

Posted - May 31 2007 :  04:34:19  Show Profile  Reply with Quote
I'm interested in this topic, too.

I have (random) "Feature Products" turned off at the store home page:
http://www.buysantabarbarawine.com.

I have a link in the header called "New Arrivals" and would like to create a separate page displaying "New Arrivals" in "random order" rather than as just a series of alphabetized links (displayed in 8 pages) at:
http://www.buysantabarbarawine.com/shopping/shopdisplayproducts.asp?id=42&cat=++New+Arrivals

Could someone please help me with this?

Thanks so much!
- Mark
Go to Top of Page

carfin
VP-ASP Expert

United Kingdom
948 Posts

Posted - May 31 2007 :  05:26:07  Show Profile  Reply with Quote
Hi Joff,

the [Add_randomproducts] is a server side operation and therefore will be called before any client side formatting is done for your browser (html templates etc). This could be why you see the random products display code appearing in the source code for your browser before the main content. The browser source code will not show any server side code - only the results. Does the page not display in the way you expected?

Regards,
Carrol
Go to Top of Page

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 31 2007 :  06:01:31  Show Profile  Reply with Quote
Hi Carrol,

No the page displays items "out of order".

The way I'd expect it to happen is...

  • index.asp page is requested

  • Server gets to my content html block

  • call to display random products is run

  • random products are generated and templates applied

  • result of random product generation is returned and written within the content block



It's because the ASP flow is parsed out of order due to the way VPASP handles it's templates - the function to display the products is called from within a template, which gets processed and written to the browser BEFORE the calling template is processed.

I've just read that back and it doesn't make sense any more but hopefully you can pick through what I'm trying to say :D

It's not a bug with VPASP, it's just how the templating engine works.

I think it'll be easier to rewrite the function to display the random products (still keeping the VPASP code to trundle off to the DB and generate it all though). It won't be as flexible as VPASP's way of doing things but needs must.








Edited by - Joff on May 31 2007 06:02:01
Go to Top of Page

carfin
VP-ASP Expert

United Kingdom
948 Posts

Posted - May 31 2007 :  08:08:50  Show Profile  Reply with Quote
Hi Joff,

have you tried putting the [Add_randomproducts] after the <div> tags. I know it seems like it's defeating the purpose of your divisions, but the placing of tmp_frontpage.htm by the random products call inside the nested tags may be causing the problem. (Height, width issues with CSS)
Regards,
Carrol
Go to Top of Page

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 31 2007 :  08:41:28  Show Profile  Reply with Quote
Hi Carrol, yes that doesn't solve it.

I've tried it with stripped down HTML with just:
xyz[Add_randomproducts]xyz


And I end up with:

Product 2
Product 1
Product 3
xyzxyz

Go to Top of Page

carfin
VP-ASP Expert

United Kingdom
948 Posts

Posted - May 31 2007 :  09:11:13  Show Profile  Reply with Quote
That's weird especially if the code was stripped right to the basics -unless you've changed the table styles to division styles for the templates. I don't have the random products on my default page but in the last 15 minutes I've played about with tmp_default.htm and I've added the random products call to display at the top, middle, bottom and even inside <tr> tags with no problems.
I think this might be one for the Support Team.
Sorry I can't be more help.
Regards,
Carrol
Go to Top of Page

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 31 2007 :  09:25:21  Show Profile  Reply with Quote
So if you stick "xyz" around the [Add_randomproducts] place holder so it reads "xyz[Add_randomproducts]xyz", what do you get out in the HTML?

Is it something like


xyz

<table width="90%" align="center" border="0" cellspacing="2" cellpadding="2">
  <tr>
	<td width="20%" class="vt">Random Product</td>
  </tr>
</table>
<hr />

<table width="90%" align="center" border="0" cellspacing="2" cellpadding="2">
  <tr>
	<td width="20%" class="vt">Random Product</td>
  </tr>
</table>
<hr />

xyz

Edited by - Joff on May 31 2007 09:25:50
Go to Top of Page

carfin
VP-ASP Expert

United Kingdom
948 Posts

Posted - May 31 2007 :  09:58:34  Show Profile  Reply with Quote
Ok, here's the code snippet I've set up from tmp_default.htm

<table id="al" width="600">
<tr>
<font size="1">xyz</font>
[Add_randomproducts]
<font size="1">xyz</font>
</tr>
</table>


This results in the browser source code as follows:

........etc etc
<!-- END OF SHOPPAGE_HEADER.HTM -->
<table id="al" width="600">
<tr>
<font size="1">xyz</font>
<table border="0" align="center" cellpadding="5" width="90%" cellspacing="0">
<tr>
<td class="vt ac" width="33%"><table width="90%" align="center" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="20%" class="vt">
<a href="shopexd.asp?id=44&bc=no">
<img src="images/thumbs/101747.gif" border="0" alt="Carl Table Lamp" />
</a>
</td>
<td width="50%" class="vt al"><span class="hdrproduct"><a href="shopexd.asp?id=44&bc=no">Carl Table Lamp</a></span><br />
Carl Table Lamp, Metal Oxide
</td>
<td width="30%" class="vt ar">
<p><font size="2" face="Verdana">
<a href="shopaddtocart.asp?productid=44&quantity=1">Order</a></font></p>
</td>
</tr>
</table>
<hr />
</td>
</tr>
</table>
<font size="1">xyz</font>
<!--START COPYRIGHT--> .............etc etc


Not sure how this will help but here's hoping.
Regards,
carrol
Go to Top of Page

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 31 2007 :  10:30:40  Show Profile  Reply with Quote
Gawd that's annoying - yours works how I want mine to! What version are you using? Mine's 6.50
Go to Top of Page

carfin
VP-ASP Expert

United Kingdom
948 Posts

Posted - May 31 2007 :  10:44:03  Show Profile  Reply with Quote
I'm using 6.50. Depending on the number of changes that you've made so far, I think that it might be worth going back to the original 'clean sheet' templates (tmp_default.htm & tmp_frontpage.htm)and the original CSS file and work in your additions one by one until you find the cause. Not sure what else you can do.
I'm away home for my tea soon. :)
Regards,
Carrol
Go to Top of Page

Joff
Starting Member

United Kingdom
43 Posts

Posted - May 31 2007 :  10:45:39  Show Profile  Reply with Quote
Likewise, I think I'll save it for the morning when I'm back in the code.

I'll let you know my findings!

Cheers,
Joff
Go to Top of Page

carfin
VP-ASP Expert

United Kingdom
948 Posts

Posted - June 01 2007 :  05:14:24  Show Profile  Reply with Quote
This is a reply to Mark from earlier in this thread. Hello Mark.
This solution will only work if you are sure that you will only be using random products for your New Arrivals page and no other pages. You will only be able to display the results on a single page so a maximum of 15 random records I think would be enough. Maybe you can use your "just arrived" products.
First you need to create a new template say tmp_newarrivals.htm
Within this template you need to insert [Add_randomproducts]
In the Admin Panel go to Add Content
New record type: NewArrivals
Content Header: Latest Additions (or whatever you want)
Content Body: leave blank
Template file: insert the name of your new template
Save the record
Go to Edit/View Products
For each product that you want to include in the random selection add Yes to the frontpage field and "new" in pother1 (or any other empty field)
Go to Set Up
xfrontpagevalue set to random
xfrontpagerandomfield set to pother1
xfrontpagerandomvalue set to new
xfrontpagemaxrecords set to 15 (or as many as you feel is ok for one page)
Add the link to this content page shopcontent.asp?type=NewArrivals wherever you need it.
You can still keep the category of New Arrivals for all your new products, but this page could be for the newest ones. This is a very simple solution which does limit this category but i've tried it on a test site and it seems to work fine.

I hope this helps
Carrol

ps your site is really nice. I'm partial to a nice Cabernet Sauvignon myself
Go to Top of Page

devshb
Senior Member

United Kingdom
1898 Posts

Posted - June 01 2007 :  06:48:33  Show Profile  Visit devshb's Homepage  Reply with Quote
I'm not sure if this'll help, but we've got a "showcase products" addon (which uses templates for the formatting), but which has a huge degree of extra flexibility built into it, including the option of having context-sensitive displays, and being able to use totally different templates/parameters for each call to it (eg you can call the same function in multiple places on the same page using different formats/results/parameters etc) -

http://www.bigyellowzone.com/shopexd.asp?id=105

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons
Go to Top of Page

Alex
VP-ASP New User

50 Posts

Posted - June 24 2007 :  20:34:13  Show Profile  Reply with Quote
Carrol,

I like your idea for New Arrivals. Simple and eazy to manage addition. However, it can increase product managment time.

I have other solution but will never be able to implement it, I'm not a programmer.

I believe every product entered into dB has some date stamp.

The routing for new arrivals will pull randomly the products.

The once for all time limit for new arrival products must be set so some of those product can be excluded from New arrivals upon that time expires. There is no need to trace a product and remove it manually.

The only thing i don't like above above is that if no new products entered the New Arrival might become empty in whatever expire time set.

Is it really difficult and costly to implement my idea?

Thanks
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000