Jump to content
Sign in to follow this  
mrjohnpc

Expertise needed for development of contribution.

Recommended Posts

Hi,

 

I've put together a very simple contribution that I am using on a site.

It is a very basic way of listing the products from a particular category.

It's available at -

http://www.oscommerce.com/community/contributions,4595

I've put this together using an online tutorial and it mostly does what I need.

I'd like to add a couple of things to it, so I was hoping for your input.

I'd like to have the image from the first product in the list displayed, but not displayed for any of the other products listed.

I'd also like to have an "All Products in this category" link at the end of the list.

Any help would be greatly appreciated.

Thanks,

 

John

Share this post


Link to post
Share on other sites

Looks do able, post the script you need altered, I will look at it to do the following:

 

Add a link to the all_prodcats.php

 

make the first product show it's image

 

is that correct?

Share this post


Link to post
Share on other sites

Hi Jeff,

 

Thanks for the reply.

 

Here's the code or the contribution (so far)

 

<?php
// The really simple product listing by category box for osCommerce MS2.
// by John Behan, Mr. John PCS
// enquiries@mrjohnpcs.ie
// www.mrjohnpcs.ie
// 10-10-2006

// Take info from database
// This is what calls the data from your database, there are a few parameters to set here
// "&& products_to_categories.categories_id = 2" change the 2 to the category number you want to limit the list to. (You can find out the category number by opening your site in your browser and under the categories list infobox find the link to the category you need, then hover over the link with your mouse pointer, the staus bar of your browser will display the link to this category. the number you need is at the end of the link, should be something like "cPath=2".
// "LIMIT 4" limits the list to 4 items, you can change this to whatever you want, if you delete this the list will include all items in that category
$result = mysql_query("SELECT products_description.products_name, products_to_categories.categories_id, products_to_categories.products_id, products_description.products_id FROM products_to_categories, 
products_description WHERE products_to_categories.products_id=products_description.products_id && products_to_categories.categories_id = 2 ORDER BY products_viewed DESC LIMIT 4") 
or die(mysql_error());  
// end take info from database

// Heading of List
// This can be removed or changed to whatever you want
echo "Theatre Tickets";
echo "<br>";
// End of Heading

// Keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {

// Print out the contents of each row
// This will create a nice, tableless list of products, change it as you see fit
echo "<div class='tickets_list'>";
// Again the "2"on this line should be changed to match the category you are using
// (If anyone knows how to change this link to link to dynamically link to each product let me know please!)
echo "<a href='index.php?cPath=2'>";
echo $row['products_name'];
echo "</a>";
echo "</div>";
echo "<br>"; 
//End of Print
} 
?>

 

This is doing exactly what I need to a point.

It's really very simple, but if I'd realised what was needed a few days ago I'd have saved myself a lot of time trying to hack existing contributions!

 

What this does is create a list of the top 4 prducts from a specfic category (in this case category 2)

What I'd like to add to it is-

The first product listed will display it's image and name, the rest of the prducts will just display their name.

I'd also like to add a "Click here for all products in this category" link at the bottom of the list.

 

I've one other request that I forgot to mention before.

I'd like to have each product in the list linking to the product rather than back to the category.

At the moment they are linking to the category using a static link coded into the script.

I've been trying to get this link to be dynamic created using the product_id parameter, but I haven't had any success. I feel the syntax I'm using is wrong as the way I'm trying to create the link seems to make sense, here's the code I've been trying to use -

 

	echo "<a href='product_info.php?products_id='>";
	echo ['products_id'];
echo $row['products_name'];
echo "</a>";

 

Thanks again.

Can you let me know if I've over-simplified the code I'm using for this?

I'm afraid I may have left a gaping security hole or bug there that will come back to haunt me.

 

Talk to you soon,

John

Share this post


Link to post
Share on other sites

why not use the product listing that comes with OSc and modify it using something like "Product List by Category" mod?

Share this post


Link to post
Share on other sites

Hi Jeff,

 

Thanks again for the reply.

That contribution - Product Listing by Category is the one I added.

It's my basic attempt at accomplishing this task.

I'm hoping to develop, or work with someone to develop, it to include the extra functionality outlined in the previous message.

Share this post


Link to post
Share on other sites

Hi john,

 

I like the great " Productlist by category" of yours. GREAT!

I have only one question about this contribution. I like the price of the product in the code.

Can you tell me how to do that, or do you have the code of that? The price ( incl. special price) is missing at the moment.

 

Can you or someone help me!

 

Greetings from a rainy Holland!

Share this post


Link to post
Share on other sites

Hi john,

 

I like the great " Productlist by category" of yours. GREAT!

I have only one question about this contribution. I like the price of the product in the code.

Can you tell me how to do that, or do you have the code of that? The price ( incl. special price) is missing at the moment.

 

Can you or someone help me!

 

Greetings from a rainy Holland!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×