Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

could use some direction


Donna321

Recommended Posts

Hi everybody,

 

I am trying to convert a really big site to oscommerce and I'm kinda stuck , here is my situation, this site consistent

of a pull down box which, when making a selection in the one box, another drop down box appears and when you select an item there it takes you to a page, well I'm trying to re-create this in oscommerce but I find myself having to create all these pages to link to the manufacture I have tried to understand easy populate but I just don't get it,

(if that's what I should be using to try and generate all these products) I can offer links if someone would be so kind as to direct me on where I can find documents or tutorial where I wouldn't have to be a burden to all the more qualified talent here, Please let me know Thank you for your time

 

Donna

Link to comment
Share on other sites

Easy Populate is for uploading product data via CSV files. It has nothing to do with how products are displayed or the navigation to get to them. What you may be looking for is an add-on for "product attributes"? There may be some flavors which let the user go through several dropdown menus.

 

Rather than slavishly reproducing the interface on an existing site, what are you trying to accomplish here? Do your products naturally fall into certain categories and subcategories? osC already has drilldown menus for that. It also lets you list by manufacturer and get to products that way. How are your products related to each other, and what are you looking for in a way to navigate to them that's different from the standard osC ways?

Link to comment
Share on other sites

MrPhil,

 

Thank you for your quick response but maybe I didn't explain my situation well, I was wondering is there a way to do a php include in the description box of a product, see I have many products that are going to be available only through the manufactures box but recreating all these products that share some of the HTML size and price tables from my category products is become a rather large task, so if somehow I could just call those HTML tables into a product description it would save a ton of time of cut and paste, just curious since I'm a newbie I apologize if this is a dumb question. Thanks again to you all for all your help and direction.

 

Donna

 

 

 

 

 

 

 

Easy Populate is for uploading product data via CSV files. It has nothing to do with how products are displayed or the navigation to get to them. What you may be looking for is an add-on for "product attributes"? There may be some flavors which let the user go through several dropdown menus.

 

Rather than slavishly reproducing the interface on an existing site, what are you trying to accomplish here? Do your products naturally fall into certain categories and subcategories? osC already has drilldown menus for that. It also lets you list by manufacturer and get to products that way. How are your products related to each other, and what are you looking for in a way to navigate to them that's different from the standard osC ways?

Link to comment
Share on other sites

OK, your references to the "manufacture's box" was confusing me. I still don't know what you're doing there, but it sounds like your primary problem is that you have large chunks of HTML code in common among product description pages. You want to pull them out into a single file and "include" them in some way?

 

I think that osC just takes the HTML descriptive text stored for a product in the database and tosses over the wall to the browser. I don't recall seeing it do any processing of the text (except perhaps converting hardcoded end-of-lines to <br>). You might check around the "add-ons" pages to see if there are any modifications available to do "BBCode" or other tag processing in that text. What would be ideal would be something like [include="sizes-table.html"/] that would pull in the file sizes-table.html. Is that what you're looking for?

 

If there isn't an existing add-on to do that (it sounds like it would be useful), let me know and I can take a look at the code and see if it doesn't look too complicated. If the entire product description is available as a single string, it should be easy enough to locate such a tag and substitute in the appropriate file.

Link to comment
Share on other sites

MrPhil,

 

you are indeed a life saver, ok, here is the site I am working on, you will see most my products are listed "by style" , but when you click on any manufacture from the manufactures box they too share some of the products Description tables, but I need to keep the products I have under "by style" separate from the pages I have created that are linked to the manufactures because although they are the same tables they do have different names, I'm sorry if I'm confusing you, thank you so much again for trying to help me, I await your response

 

Donna

 

 

OK, your references to the "manufacture's box" was confusing me. I still don't know what you're doing there, but it sounds like your primary problem is that you have large chunks of HTML code in common among product description pages. You want to pull them out into a single file and "include" them in some way?

 

I think that osC just takes the HTML descriptive text stored for a product in the database and tosses over the wall to the browser. I don't recall seeing it do any processing of the text (except perhaps converting hardcoded end-of-lines to <br>). You might check around the "add-ons" pages to see if there are any modifications available to do "BBCode" or other tag processing in that text. What would be ideal would be something like [include="sizes-table.html"/] that would pull in the file sizes-table.html. Is that what you're looking for?

 

If there isn't an existing add-on to do that (it sounds like it would be useful), let me know and I can take a look at the code and see if it doesn't look too complicated. If the entire product description is available as a single string, it should be easy enough to locate such a tag and substitute in the appropriate file.

Link to comment
Share on other sites

OK, so is what you're looking for a way to drop a tag like this: [include="sizes-table.html"/] into your product descriptions, where /some-common-path/sizes-table.html is some boilerplate HTML code? Or are you looking for something else? I'm still confused because in your latest reply you came back to the subject of why you're doing this listing by manufacturer. Are you listing the exact same product under several different titles and stock numbers, because you want customers to get to it by different methods? That seems like it would confuse customers, but you're the boss...

Link to comment
Share on other sites

I'm sorry for not giving you a good explanation, so let me try and show you what I'm after, if you go to this site

here and click on Find My Boat in the right hand side under Have a Hard Top or T-Top? the next window you see is Select your manufacturer: click on the ok button and in the next drop down that pops up just click ok, now on that page look for the yellow box which says;

Styled-to-Fit

Semi-Custom Boat Covers

(7INF11) this is just an example, click on this number(7INF11) and you will see an example of a table which has prices, part numbers and so on, that table is shared with many different products and manufactures that all have different product title, so I am cutting and pasting those tables to create new products and then attaching them to a manufacture when I create my product in oscommerce, but I have so many manufacture pages that I need to create using those same product tables that all this cutting and pasting is driving me crazy, I was just wondering if there any better way to achieve what I'm trying to do. Again please accept my THANK YOU and most sincerer appreciation for your time

 

Donna

 

 

 

 

OK, so is what you're looking for a way to drop a tag like this: [include="sizes-table.html"/] into your product descriptions, where /some-common-path/sizes-table.html is some boilerplate HTML code? Or are you looking for something else? I'm still confused because in your latest reply you came back to the subject of why you're doing this listing by manufacturer. Are you listing the exact same product under several different titles and stock numbers, because you want customers to get to it by different methods? That seems like it would confuse customers, but you're the boss...

Link to comment
Share on other sites

So when editing a product description, you would like to insert a tag [include="sizes-table.html"/] instead of cutting and pasting the table HTML code? If we can establish that's what you want, I'm sure I can come up with some code to do the trick.

 

I see that you do have a ton of manufacturers! If you have a lot of common HTML markup across multiple products, I could see an [include] tag being handy. Let me know if that would satisfy your needs, and I'll see what I can do.

Link to comment
Share on other sites

MrPhil,

 

Yes you are right, that is exactly what I'm looking for, as you've seen all the manufactures and now know all the products I have to create,it's quite a lot of work, I also agree with you but my boss has asked me to do it this way unless you can suggest another way of doing this so I won't have to create all these products that have to be linked to the manufacture, again thanks so much, without you I would be literally in a manufacture nightmare.

 

Thank you so much for your kindness

 

Donna

 

 

 

So when editing a product description, you would like to insert a tag [include="sizes-table.html"/] instead of cutting and pasting the table HTML code? If we can establish that's what you want, I'm sure I can come up with some code to do the trick.

 

I see that you do have a ton of manufacturers! If you have a lot of common HTML markup across multiple products, I could see an [include] tag being handy. Let me know if that would satisfy your needs, and I'll see what I can do.

Link to comment
Share on other sites

MrPhil,

 

Thank you so much I can't begin to thank you enough I will wait to hear from you

 

Donna

 

 

 

OK, I'm building a BBCode [tag] system that you can drop into your site. I hope it will be ready in a day or two.

Link to comment
Share on other sites

In waiting for MrPhil to respond to me about adding includes in the description box I came across this old post which may help other with the same problem, All credit goes to "asim0s" for his post. although the links on the old post don't work any longer I have tried this with some small differences and it seems to work well

 

in your catalog/product_info.php find the code

 

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

and replace it with this

 

<?php

function evalFromDB($php){

$questionMark = "?";

$phpOpenTag = "<${questionMark}php";

$phpCloseTag = "${questionMark}>";

return eval("$phpCloseTag" . stripslashes($php) . "$phpOpenTag ");

}

?>

 

<p><?php echo evalFromDB($product_info['products_description']); ?></p>

 

 

Then when creating your product I have added this to the description box and saved my page in the includes folder

 

<?php require(DIR_WS_INCLUDES . 'your-file-name.php'); ?>

 

also note that you will not see the page until you view it from outside the admin as a customer would browsing your catalog.

 

I am so grateful to have received help here that even being a newbie I thought I could at least try to help anyone that is having the same problem I am having, I would like to especially thank MrPhil for taking time to help me and I still await his response, he may have a better way of doing this, but I feel that one should always try and give when they receive, Thank you to all for a great experience here

 

Donna

Link to comment
Share on other sites

OK, I've been working on this, and found that a full, general-purpose BBCode function will take a bit longer than a day or two! What I've done is just hard code the [include=URL] tag for you, and will continue to work on the other stuff. Here is the function itself. You can put it in its own file (e.g., includes/bbcode.php) and at the top of /product_info.php import it:

include('includes/bbcode.php');

or you can stick it at the end of /product_info.php (after the original closing ?>).

<?php

/*
* $Id: $
*
* author: Phil M Perry
* (c) copyright 2010, Catskill Technology Services, LLC
*                     http://www.catskilltech.com
* 
* Released under the GNU General Public License
*
* This file is for handling BBCode tags in various input.
* THIS IS A TEMPORARY VERSION. It only hardcodes [include=URL] tag, and
*  does nothing with HTML. It also has no permission levels. It is expected
*  to be replaced with a more general purpose version soon.
*/

// text: raw text/HTML markup to be expanded/sanitized. may be part of string
// CURRENTLY all that happens is [include=URL] tags are expanded
function parse_bbcode($text) {

// nothing to expand?
if (strlen($text) == 0) return '';

/* start with $text string
 *  loop until no more matches found for tag
 *
 * end result: $text with BBCode tags expanded 
 */

// between = and ], anything except ] permitted as URL/file
$openPattern = '/\[ *include *= *([^\]]+) *]/i';

$foundTag = true;
while ($foundTag) {
	$foundTag = false;

	// find opening (or only) tag
	if (!preg_match($openPattern, $text, $matches,
		PREG_OFFSET_CAPTURE)) break;
	$open = array($matches[0][1], strlen($matches[0][0]));
	// $open points to [ and length (thru ]) of opening tag
	// $matches[1..] contains any subpattern matches needed
	// $matches[1][0] = URL, [1][1] = offset in $text

	// read URL (file or site) into $subText
	$fp = fopen($matches[1][0], 'r');
	if (!$fp) {
		// failed to open. output unexpanded tag
//			$subText = substr($text, $open[0], $open[1]);
//  need to figure out how to suppress fopen() error message if no such URL
		$subText = "{{ could not open file/URL ".$matches[1][0]." }}";
	} else {
		// read in 1K chunk at a time, until EOF
		$subText = '';
		while (!feof($fp)) {
			$subText .= fgets($fp, 1024);
		}
	}

	// self closing tag
	$beforeText = substr($text, 0, $open[0]);
	$afterText = substr($text, $open[0]+$open[1]);
	$text = $beforeText . $subText . $afterText;
	$foundTag = true;
	// done processing one occurence of this tag
} // end while loop to pick up multiple occurences of a tag

return $text;
} // end parse_bbcode()
?>

 

In /product_info.php, find the line

<p><?php echo stripslashes($product_info['products_description']); ?></p>

and replace with

<p><?php echo parse_bbcode(stripslashes($product_info['products_description'])); ?></p>

That is, insert parse_bbcode( and ).

 

I think that's the only place that the product_description is displayed. If not, you can do something similar in other functions.

 

A few notes:

1) This is hardcoded for just this one tag. I am working on a more general function. Check back here in a week or so to see if I've announced it.

2) The "URL" can be a file name (including the path to it), e.g., size-table.html or a full http://www.yourstore.com/path/filename. Note that if you give a file name and path, the path must either be relative to the current directory, or absolute starting at the filesystem root (not the site root).

3) If you give a URL that doesn't exist or can't be opened or read, you will get an ugly error message. I am looking for a way to reliably suppress this -- that may take some time. So for now, be careful that the file exists!

4) Do not put PHP code in the included file -- it will not be evaluated (only text and HTML markup may be used).

5) Any other problems -- please feel free to report them here, or PM me.

Link to comment
Share on other sites

MrPhil,

 

You are an angel, Thank you so, so, much I will start working on adding this and await you next post, I can't begin to thank you enough!!! so what exactly do I enter in the description box? This? parse_bbcode( and ) where it says and in brackets do I enter the URL?

 

Sincerely,

 

Donna

 

OK, I've been working on this, and found that a full, general-purpose BBCode function will take a bit longer than a day or two! What I've done is just hard code the [include=URL] tag for you, and will continue to work on the other stuff. Here is the function itself. You can put it in its own file (e.g., includes/bbcode.php) and at the top of /product_info.php import it:

include('includes/bbcode.php');

or you can stick it at the end of /product_info.php (after the original closing ?>).

<?php

/*
* $Id: $
*
* author: Phil M Perry
* (c) copyright 2010, Catskill Technology Services, LLC
*                     http://www.catskilltech.com
* 
* Released under the GNU General Public License
*
* This file is for handling BBCode tags in various input.
* THIS IS A TEMPORARY VERSION. It only hardcodes [include=URL] tag, and
*  does nothing with HTML. It also has no permission levels. It is expected
*  to be replaced with a more general purpose version soon.
*/

// text: raw text/HTML markup to be expanded/sanitized. may be part of string
// CURRENTLY all that happens is [include=URL] tags are expanded
function parse_bbcode($text) {

// nothing to expand?
if (strlen($text) == 0) return '';

/* start with $text string
 *  loop until no more matches found for tag
 *
 * end result: $text with BBCode tags expanded 
 */

// between = and ], anything except ] permitted as URL/file
$openPattern = '/\[ *include *= *([^\]]+) *]/i';

$foundTag = true;
while ($foundTag) {
	$foundTag = false;

	// find opening (or only) tag
	if (!preg_match($openPattern, $text, $matches,
		PREG_OFFSET_CAPTURE)) break;
	$open = array($matches[0][1], strlen($matches[0][0]));
	// $open points to [ and length (thru ]) of opening tag
	// $matches[1..] contains any subpattern matches needed
	// $matches[1][0] = URL, [1][1] = offset in $text

	// read URL (file or site) into $subText
	$fp = fopen($matches[1][0], 'r');
	if (!$fp) {
		// failed to open. output unexpanded tag
//			$subText = substr($text, $open[0], $open[1]);
//  need to figure out how to suppress fopen() error message if no such URL
		$subText = "{{ could not open file/URL ".$matches[1][0]." }}";
	} else {
		// read in 1K chunk at a time, until EOF
		$subText = '';
		while (!feof($fp)) {
			$subText .= fgets($fp, 1024);
		}
	}

	// self closing tag
	$beforeText = substr($text, 0, $open[0]);
	$afterText = substr($text, $open[0]+$open[1]);
	$text = $beforeText . $subText . $afterText;
	$foundTag = true;
	// done processing one occurence of this tag
} // end while loop to pick up multiple occurences of a tag

return $text;
} // end parse_bbcode()
?>

 

In /product_info.php, find the line

<p><?php echo stripslashes($product_info['products_description']); ?></p>

and replace with

<p><?php echo parse_bbcode(stripslashes($product_info['products_description'])); ?></p>

That is, insert parse_bbcode( and ).

 

I think that's the only place that the product_description is displayed. If not, you can do something similar in other functions.

 

A few notes:

1) This is hardcoded for just this one tag. I am working on a more general function. Check back here in a week or so to see if I've announced it.

2) The "URL" can be a file name (including the path to it), e.g., size-table.html or a full http://www.yourstore.com/path/filename. Note that if you give a file name and path, the path must either be relative to the current directory, or absolute starting at the filesystem root (not the site root).

3) If you give a URL that doesn't exist or can't be opened or read, you will get an ugly error message. I am looking for a way to reliably suppress this -- that may take some time. So for now, be careful that the file exists!

4) Do not put PHP code in the included file -- it will not be evaluated (only text and HTML markup may be used).

5) Any other problems -- please feel free to report them here, or PM me.

Link to comment
Share on other sites

Are you asking what to enter for the product description? Any place in that text where you have a big chunk of boilerplate text (e.g., a table of sizes), you can instead enter [include=size-table.html]. You would have a file named size-table.html in the same directory as product_info.php, containing the table's HTML code. This way, you can have the HTML code in one common file, and just "pull it in" to multiple product descriptions. No need to cut and paste big chunks of HTML code from one product description to another. You can have multiple [include] tags in the description, and you can have different [include] tag files for different classes of products. I thought that was what you were asking for.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...