PDA

View Full Version : is this possible with dynamic tabs?



lew9e
10-13-2007, 05:38 AM
1) Script Title: Tab Content Script (v 2.0) or Ajax Tabs Content Script

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

or

http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm


3) Describe problem:

I would like to use either of these with my shopping cart program. I want to have the tabs show up on the product detail page. On one of the tabs, I'd like to have recommended accessories, which are set in my admin panel for each product. On another tab, I'd like to have product reviews, which are specific to each product of course.

Both of these are php include files through my ecommerce program (ecommercetemplates).

I'm able to display the tab and basic html content with no problem.

The problem is, to enter the set of tabs for each page, I have to enter the html code into the product description field for each product (in my admin panel). The program does not allow me to enter php include files.

I tried using an iframe to call the php script, but when it loads, it does not load the content specific to that pages product.

Can anyone tell me if there's any way I can make this work. I haven't tried the other php yet (prod review).

I only have basic knowledge of this, so I would really appreciate any guidance. I've spent a few days trying things and researching, so I would definitely appreciate any help!!!

Thank you,
Tony

ddadmin
10-14-2007, 07:31 AM
Not sure I fully understand what you're looking to do, as it's something that probably involves multiple factors. But it looks like using an iframe would be your best bet. How is it not able to load content specific pages if you're able to specify within the iframe src what page exactly to load?

lew9e
10-14-2007, 07:54 PM
Thanks for your reply. Here's an example of what I"m trying to do...

Let's say I'm selling a TV. I can assign an HDMI cable, mounting bracket, and stand to show as options, specific to this model on it's product page.

I can assign any product to show for only the product I assign them to, or not at all.

I'm not sure why the iframe wasn't working in this way. It did display additional global content, so I don't think it's a problem with the iframe. It seems upon loading it just wasn't identifying with the specific pages product, so it wasn't pulling from the database the add ons that were matched for this product.

I'm definitely not a programmer, so it may be something way over my head :(

Unless there's an easy way to do it, I will just place the add ons below the tabs, and when you select "accessories" I will have the tab collapse to show it. But I'd much rather include it in the tabs.

Thanks again for taking the time to try to help.

Tony

ddadmin
10-16-2007, 10:29 AM
I'm not sure why the iframe wasn't working in this way. It did display additional global content, so I don't think it's a problem with the iframe. It seems upon loading it just wasn't identifying with the specific pages product, so it wasn't pulling from the database the add ons that were matched for this product.

Just to verify you've set things up correctly, inside each external page to fetch, you have an IFRAME element that then points to the desired product page to show right? Is the correct product page being displayed initially, only to no longer work after the user clicks on another tab to view a different product page?

lew9e
10-16-2007, 11:45 PM
that's correct. I have an iframe which loads into one of the tab content fields. It loads fine and I can switch tabs no problem.

The page I'm loading is from a php file. On the php file, I can have 3 options for cross selling.

1) Top selling items
2) Products I recommend which will show the same products on every page I display this php file.
3) Products I select in my admin file which will ONLY show with the product page you're viewing.

1 and 2 show up in the tabs with no problems. 3 does not show up. I don't know enough about this, but it seems that because it's called from another page, it's not referencing which product it's supposed to for that specific page, and thus it's not showing option 3.

I'm sure it's possible, but I have a feeling it would take a lot of code, most likely above my scope of understanding.

Thank you,
Tony

ddadmin
10-17-2007, 10:38 AM
Mainly what I'm trying to determine if the problem you're describing is simply an IFRAME cache issue. Both Firefox and IE may cache the contents of an IFRAME, so even if you load a new page into it, the old page still appears. When you say it's not showing option 3, what gets shown instead? Is it the old content from option 1 or 2, or a different page altogether?

BTW, Ajax Tabs will be completely updated soon following the footsteps of Tab Content script (http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm), to version 2.0.

lew9e
10-17-2007, 09:04 PM
Awesome...I look forward to the update! It's really an awesome script...I'm just not smart enough to make it work :o

Well, if I specify that this product page should show options 1, 2, and 3, then I only see option 1 and 2. If I specify it to only show option 3, then the tab is blank.

I guess it's related, so I'll ask you about this...maybe I should start another post...but maybe it might help with this problem. I'm also trying to load the content of a php for product review. The review is called up (again product specific for each page/product) by clicking on a link called "view reviews" which brings up the contents of review.php (http://www.mysite.com/review.php) in a popup window using js. I tried to include the contents of this in one of the tab content fields also. I tried using

<li><a href="reviews.php rel="ajaxcontentarea">Cat</a></li>

I also tried referencing reviews.php in an iframe. On ff I get the page but it doesn't include the information being called (it says read reviews for, but doesn't fill in the page specific review info...also says click here to close - which is from the popup menu, but I'll remove that). On ie I get a completely blank tab.

Here is the code that is used to pull from the db and generate the popup window filled with the proper page's content:

<tr><td colspan="4" align="center" ><b>...See our Customer Reviews</b><br>
<?php include "vsadmin/db_conn_open.php";?>
<?
$prod=trim(@$_GET["prod"]);
$revSQL=mysql_query("SELECT * FROM reviews WHERE revProd='$rs[pId]' AND revAdmin=1");
if(mysql_num_rows($revSQL)>0) {
$revSQL2=mysql_query("SELECT SUM(revScore) AS totalscores FROM reviews WHERE revProd='$rs[pId]' AND revAdmin=1");
$reviews=mysql_fetch_array($revSQL2);
$totalRev=$reviews[totalscores];
$numberRev=mysql_num_rows($revSQL);
$avgRev=$totalRev/$numberRev;
$avgRev=sprintf("%01.1f", $avgRev);
$remainder=5-$avgRev;
echo "Average Rating:<br> $avgRev out of 5<br>";
for($x;$x<$avgRev;$x++) {
echo "<img src=\"images/star.jpg\">";
}
if($avgRev<4.5) {
for($y;round($y<(($remainder-1)));$y++) {
echo "<img src=\"images/starback.jpg\">";
}
{
echo "<img src=\"images/starback.jpg\">";
}
}
echo "<br>";
} else {
echo "Currently no product reviews<br>";
}
?>

<script>
function openreviews() {
window.open("reviews.php?prod=<?= $prod; ?>&a=view", "reviews", "width=400, height=400, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no");
}
function writereview() {
window.open("vsadmin/inc/increviews.php?prod=<?= $prod; ?>&a=write", "reviews", "width=400, height=400, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no");
}
</script>
<?
if(mysql_num_rows($revSQL)>0) {
?>
<b> <a href="javascript:openreviews()">View Reviews</a></b><br>
<? } ?>
<b> <a href="javascript:writereview()">Add a Review</a></b>
<? // End of Review ?>

So, I'd like to be able to click on the "review" tab and call this content to the review tab.

I'd also like to be able to click on the "accessories" tab and display the content recommended for that particular page, although the first option (reviews) is more important for me.

I'm hoping this will help you understand my problem more. I really do appreciate all of your time and efforts to help me. Please let me know if there's any more information i can provide that might help.

Thank you,
Tony