Jump to content

[SOLVED] Help with product catalog


claffin

Recommended Posts

need some help creating a product catalog

website = http://cashzone.seitservices.com.au

 

currently have it set up as follows

index is setup using the following code

<?php
$page = 'main.php';   // Default page
$pages = array('main', 'about','./products/products','contact','new');

// Check if p is set
if(isset($_GET['p'])) {

    // Check if the page in the url is in the defined array
    if(in_array($_GET['p'], $pages)) {
        
        $page = $_GET['p'].'.php';

    } else {

        $page = 'main.php';

    }

}
?>

 

products has its own folder

products.php is set up as follows

<?php
$page = 'productsmain.php';   // Default page
$pages = array('productsmain', 'cards','collectables','dvds','electronics');

// Check if p is set
if(isset($_GET['p'])) {

    // Check if the page in the url is in the defined array
    if(in_array($_GET['p'], $pages)) {
        
        $page = $_GET['p'].'.php';

    } else {

        $page = 'productsmain.php';

    }

}
?>

<table border="0" width="750" height="100%">
<tr>
	<td height="100%" width="150" valign="top"><?php include('productcatergory.php');?></td>
	<td height="100%" width="600" valign="top"><?php include($page);?></td>
</tr>
</table>

 

productscatergory.php is set up as follows

<a href="./products/products.php?p=cards"><b>Cards</a><br>
<a href="./products/products.php?p=collectables"><b>Collectables</a><br>
<a href="./products/products.php?p=dvds"><b>DVDs</a><br>
<a href="./products/products.php?p=electronics"><b>Electronics</a><br>

 

you ca see the results at http://cashzone.seitservices.com.au

 

obviously i do not want a new page open for the products except I would like them to stay within the original site. I would like it to load in the productsmain section.

 

If u require me to extend on my explanation please let me know

Link to comment
https://forums.phpfreaks.com/topic/155134-solved-help-with-product-catalog/
Share on other sites

Go to http://cashzone.seitservices.com.au

click on products

you will notice a list of product categorys on the left and the products main page on the right

when you click on one of the product catergorys on the left it opens up in the wrong manner

What I would like it to do is if you click on cards it will open up the cards for sale on the right replacing the products main page.

 

It currently does that but outside of the current layout

fixed it by creating the products.php to be set up like the index

 

 <head>
<title>Cash Zone Products</title>
</head>
<body bgcolor="#000000" link="#000000" vlink="#000000" alink="#9F9F00">
<?php
$page = 'productsmain.php';   // Default page
$pages = array('productsmain', 'cards','collectables','dvds','electronics');

// Check if p is set
if(isset($_GET['d'])) {

    // Check if the page in the url is in the defined array
    if(in_array($_GET['d'], $pages)) {
        
        $page = $_GET['d'].'.php';

    } else {

        $page = 'productsmain.php';

    }

}
?>

<center><table border="0" width="810" height="800" cellspacing="0" cellpadding="0" bgcolor="#FFFF99">
   <tr>
      <td height="100" width="810" bgcolor="#000000" colspan="4"><?php include('../heading.php');?> </td>
   </tr>
   <tr>
      <td height="30" width="30" valign="top" background="../images/corner.png"> </td>
      <td height="30" width="750" valign="top" background="../images/links.png" colspan="2"><?php include('../topmenu.php');?></td>
      <td height="30" width="30" valign="top" background="../images/corner.png"> </td>
   </tr>
   <tr>
      <td height="100%" width="30" valign="top" background="../images/border.png"> </td>
      <td height="100%" width="150" valign="top"><?php include('../products/productcatergory.php');?></td>
      <td height="100%" width="600" valign="top"><?php include($page);?></td>
      <td height="100%" width="30" valign="top" background="../images/border.png"></td>
   </tr>
   <tr>
      <td height="30" width="30" background="../images/corner.png"> </td>
      <td height="30" width="750" background="../images/links.png" colspan="2"><?php include('../bottom.php');?></td>
      <td height="30" width="30" background="../images/corner.png"> </td>
   </tr>
</table>

 

for refrence

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.