Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Custom Product Builder


TENCENTS

Recommended Posts

MWNNVA79,

 

Haven't been around for a while, but I'm back for a visit :thumbsup:

 

If you're going to do this, back the site up first...Just in case

 

I had the same problems when I installed this onto my site too. It looks like it's because the database has changed with the last few editions of OSCommerce, and the code in this offering hasn't been updated to make it compatible.

 

You'll have to make these changes for it to work. All three of the main admin files need changing and a few of the sales ones too.

 

open admin\builder_catagories.php at line 23 change this

 

// create tables if they dont exist ---------------------------

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

to this

 

// create tables if they dont exist ---------------------------

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

then line 166-168 from this

 

} else {

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

tep_redirect(tep_href_link(FILENAME_BUILDER_OPTIONS));

}

 

to this

 

} else {

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

tep_redirect(tep_href_link(FILENAME_BUILDER_OPTIONS));

 

then another at 190

 

// be sure the tables already exist

if( mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_CATEGORIES. "'"))==1) {

 

change to this

 

// be sure the tables already exist

if(tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_CATEGORIES. "'"))==1) {

 

Save the file and open this one..admin\builder_dependences.php

 

at line 16 you'll find this line

 

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

tep_redirect(tep_href_link(FILENAME_BUILDER_OPTIONS));

}

 

change it to this

 

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

tep_redirect(tep_href_link(FILENAME_BUILDER_OPTIONS));

}

 

Ok that's the only instance of the error in this file save and then close the file and open the last admin file.

 

admin\builder_options.php go to line 22 where you'll find this

 

// create tables if they dont exist ---------------------------

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

 

change it to this

 

// create tables if they dont exist ---------------------------

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

 

the goto line 551 and find this

 

// be sure the tables already exist

if( mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

change it for this

 

// be sure the tables already exist

if(tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

now goto line 667-669 and find this

 

<?php

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

?>

 

change it to this

 

<?php

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))!=1) {

?>

 

That's it for the admin section.

 

Basically just exchanging the internal

tep_db_num_rows(tep_db_query
for the
mysql_num_rows(mysql_query

 

You'll have to make these changes in the cataloge half of your shop also. Files effected are builder_main.php, at line 24 in builder_product_info.php at line 18 and builder_product_list.php at line 22.

 

One word of caution, if you've already put the database onto the server (pressed the update button), and got the green bar at the top of the screen AND the red bar saying the tables still don't exist. Then clicked update for a second time, you'll get an error message saying "this row already exists in the database" and the php will stop, this will also actually delete your other two database tables (builder_categories and builder_dependences), and it won't work properly, Unless you either manually put these back in or delete the builder_options tables and start from scratch.

 

Best way to do this is go into myphpadmin and drop the row called builder_options (don't touch anything else or you may break the site!), then you should be back at the red war saying that the database tables don't exist..

 

Hope this helps....

Edited by Nefandous
Link to comment
Share on other sites

Well it seems I can't edit the above to make more sense. Hopefully if you need to use it, you get it! ;) Should make this work with oscommerce 2.3.3.4 and higher after changing it.

Edited by Nefandous
Link to comment
Share on other sites

  • 2 weeks later...

@@Nefandous

 

Hello,

 

I have done everything you have listed above and it seems to be starting to work now but still got a few errors, Could you help me out.

 

I will attach the error and the code from the file (Also will highlight the line of code which is causing the problem.

 

Here they are:

 

#1

( ! ) Deprecated: Function split() is deprecated in C:\wamp\www\store\catalog\admin\builder_options.php on line 813 Call Stack # Time Memory Function Location 1 0.0020 703808 {main}( ) ..\builder_options.php:0

 

 

<?php
$the_files_array = Array();
$handle = opendir(DIR_FS_CATALOG . DIR_WS_IMAGES);
while (false!== ($file = readdir($handle))) {
if ($file!= "." && $file!= ".." &&!is_dir($file)) {
$namearr = split('\.',$file);
if (($namearr[count($namearr)-1] == 'gif') || ($namearr[count($namearr)-1] == 'jpg') || ($namearr[count($namearr)-1] == 'png')) {
 $the_files_array[] = array( 'text' => $file, 'id' => $file);
}
}
}

 

#2

( ! ) Deprecated: Function split() is deprecated in C:\wamp\www\store\catalog\admin\builder_options.php on line 937 Call Stack # Time Memory Function Location 1 0.0020 703808 {main}( ) ..\builder_options.php:0

 

 

<?php
$the_files_array = Array();
$handle = opendir(DIR_FS_CATALOG . DIR_WS_IMAGES . $cpb_category_images_folder);
while (false!== ($file = readdir($handle))) {
if ($file!= "." && $file!= ".." &&!is_dir($file)) {
$namearr = split('\.',$file);
if (($namearr[count($namearr)-1] == 'gif') || ($namearr[count($namearr)-1] == 'jpg') || ($namearr[count($namearr)-1] == 'png')) {
 $the_files_array[] = array( 'text' => $file, 'id' => $file);
}
}
}

 

#3

( ! ) Deprecated: Function split() is deprecated in C:\wamp\www\store\catalog\admin\builder_options.php on line 1463 Call Stack # Time Memory Function Location 1 0.0020 703808 {main}( ) ..\builder_options.php:0

 

 

 

<?php
$the_files_array = Array();
$handle = opendir(DIR_FS_CATALOG . DIR_WS_IMAGES . $cpb_product_images_folder);
while (false!== ($file = readdir($handle))) {
 if ($file!= "." && $file!= ".." &&!is_dir($file)) {
   $namearr = split('\.',$file);
   if (($namearr[count($namearr)-1] == 'gif') || ($namearr[count($namearr)-1] == 'jpg') || ($namearr[count($namearr)-1] == 'png')) {
     $the_files_array[] = array( 'text' => $file, 'id' => $file);
   }
 }
}

 

I noticed that is seems to be the same line but do not know how to fix it. Line: $namearr = split('\.',$file);

Edited by RS Designs
Link to comment
Share on other sites

@@burt

 

Hello,

 

You are correct that it has been looked at a bunch before but can not seem to find one to fix this problem.

 

Here is the split line of test:

 

$namearr = split('\.',$file);

 

Do you know what I should change it too

Link to comment
Share on other sites

@@RS Designs

 

On the newer version of PHP "split" is no longer used and split_preg is used instead. Haven't tried it, but should work if you change the above to

 

$namearr = split_preg('\.',$file);

 

Just another thing that needed to be updated. I'll take a look later to see if it's right. :)

Link to comment
Share on other sites

Ooops Sorry just realised, I put that on backwards...ignore that, it should be...

 

 

$namearr = preg_split('\.',$file);

 

Embarrassing :blush:

Link to comment
Share on other sites

@@Nefandous

 

Thank you for the response but it does not work either. All 5 errors are still there and now they have a second line. (See picture)

 

Here is a pastebin of the builders categories file: http://pastebin.com/m0Zhb6gE

 

Here is a pastebin of the builders option file: http://pastebin.com/h3xkw5cp

 

I don't understand why I isn't working and do not know enough about the code to be able to fix it. any help is greatly appreciated.

post-329241-0-98883900-1401871138_thumb.jpg

Link to comment
Share on other sites

That's because I got the syntax wrong...here's the real working one...sorry for that :-

 

$namearr = preg_split('/\./',$file);

 

And this works. I didn't have a chance to try it till now.

Link to comment
Share on other sites

The reason it didn't work is that preg_split has changed from split, with the syntax it uses to split each file. this particular function is splitting graphics file names so they'll show in a pull down menu. It would work, but you'll get errors thrown back at you.

 

What used to be

 

$whatever = split('\.', $file) to $whatever = preg_split('/\./', $file) So this worked till split was deprecated...

Edited by Nefandous
Link to comment
Share on other sites

Just found another error in the bm_builder.php found in Catalog/includes/modules/boxes. And it's another MySQL change at line 38

 

should be

if(tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

rather than the line that's there.

Link to comment
Share on other sites

@@RS Designs

 

It's not displaying the builder because there's another error with the code. In builder_main.php in your catalog. It's on line 24. And should read

 

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {
rather than the line
if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

And the page displays correctly now. However, there may be another error in the code. When I put in the first component, it displays a database error. Will look into this when I have a little more time.

Edited by Nefandous
Link to comment
Share on other sites

Yes. Worked it out.

 

Look in builder_product_list.php in your catalog

 

line 22 should read

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

I'll test it some more later just to make sure it's all working on every part.

Link to comment
Share on other sites

On the off chance there were any more of the same error.

 

I found one more in builder_products_info.php at line 18. Should read

 

if (tep_db_num_rows(tep_db_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

instead of

 

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . TABLE_BUILDER_OPTIONS . "'"))==1) {

 

That looks like the last instance of this error. I'll try it out later and see how it works...

Link to comment
Share on other sites

Hi, i recently install the Custom Product Builder 2.3 on my Oscommerce 2.3.1 all was great, i configured the categories and the databases, apparently all right but when i go to the front end i don't see anything of the custom builder. What can i do for solve this ??

 

Thank you.

Link to comment
Share on other sites

@@Nefandous

 

Hello Sir,

 

Well we are almost out of the woods. Everything seems to be working good except when you try to preview the order.

 

I have attached a picture of the error I get.

 

Also I am just using standard currency $0.00 (Canada) Nothing fancy or custom.

post-329241-0-03624700-1402012440_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...