Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer Add Product


empo

Recommended Posts

Dear Empo,

 

Thanks a lots of this great contribution. I finally installed it, i can see it in admin and able to make approval. but when i go to Administrator, there is a error message on the top:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/hongkon2/public_html/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /home/hongkon2/public_html/admin/includes/classes/object_info.php on line 18

 

and when i clicked " ADD PRODUCT" and "EDIT PRODUCT" , it appeared the error message:

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/hongkon2/public_html/includes/header.php:160) in /home/hongkon2/public_html/includes/boxes/categories.php on line 60

 

below is the /includes/boxes/categories.php

 

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

Welcome to MagC Gifts Store - Unique gift shopping online, jewelry gift shop

 

http://www.magcgifts.com

 

Copyright © 2006 MagC Gifts Store

 

Released under the GNU General Public License

*/

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

for ($i=0; $i<$tree[$counter]['level']; $i++) {

$categories_string .= "  ";

}

 

$categories_string .= '<a href="';

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '<b>';

}

 

// display category name

$categories_string .= $tree[$counter]['name'];

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '</b>';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '->';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

$categories_string .= ' (' . $products_in_category . ')';

}

}

 

$categories_string .= '<br>';

 

if ($tree[$counter]['next_id'] != false) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, true, false);

 

$categories_string = '';

$tree = array();

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if (tep_not_null($cPath)) {

$new_path = '';

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

unset($parent_id);

unset($first_id);

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

if (tep_db_num_rows($categories_query)) {

$new_path .= $value;

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$row['categories_id']] = array('name' => $row['categories_name'],

'parent' => $row['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $row['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

$new_path .= '_';

} else {

break;

}

}

}

tep_show_category($first_element);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $categories_string);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

 

 

I am not good at this. don't know where is the problem.

 

Mag

Link to comment
Share on other sites

Oooops...

 

I have gone through the whole thread, read all the replies and found out empo stop supporting the thread anymore. And Zane86 has sent some helpful posts. I carefully and correctly followed all the steps of the installation. But still got the error message, the parse one has been solved and i comment out some part of the box/category.php then finally i can see the cap contribution on my site, although the tep show error is not solved.

 

Ok, When i click the add product and add a product into it, then clicked preview , it redirect me to the index page, i have added the suggestion from Zane86, but still redirect me to index page. Just don't know what is going wrong.

and there are only two buttons in the add product page, " Preview " and " Back " , no upload image button or submit button. Besides the drop down button of calendar works well, the rest is :'(

 

I am using RC2a version and installed cap 1.4.3. I am going to try to install it with RC1 to see whether is it working or not.

 

For sure the idea of this contribution is wonderful. but it is a pity i still cannot use it.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 3 weeks later...

Need help to work 2 contributions together in includes/aplication_top.php:

 

1.from Product Quantity Drop Down Box in Product Info

     // customer adds a product from the products page
     case 'add_product' :    if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
			if (tep_has_product_attributes($_POST['products_id']) && PRODUCT_LIST_OPTIONS != 'true' && basename($PHP_SELF) != FILENAME_PRODUCT_INFO) tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_POST['products_id']));
			$add_quantity = (isset($_POST['cart_quantity']) ? (int)$_POST['cart_quantity'] : 1);
                               $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$add_quantity, $_POST['id']);
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

 

2.from XSELL add_recommended product

 // customer adds a product from the products page
     case 'add_products' :
if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
$add_quantity = (isset($_POST['cart_quantity']) ? (int)$_POST['cart_quantity'] : 1);                           	  
 if (isset($HTTP_POST_VARS['add_recommended'])) {
   foreach ($HTTP_POST_VARS['add_recommended'] as $value) {
   if (ereg('^[0-9]+$', $value)) {	
   $cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
   }
 }
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;

 

Does anyone get these two to work together?. What could be the correct code??

Edited by bhbilbao
Link to comment
Share on other sites

  • 8 months later...

Hi there.

Im running osCommerce 2.2 RC2. Don't this Add-On work with that version?

 

I've installed it and tried, but when the customers add an product, and press Preview, he get sent to the starting page of the catalog. No product gets added.

Have i done anything wrong? Or is it not compatible with osCommerce 2.2 RC2?

 

 

Did we get an answer to solve this issue? I am having the same problem, hit Preview, and I am sent back to starting page...

Link to comment
Share on other sites

  • 3 months later...

Hi

 

Is this post still active, just need bit of help and advice more than help

 

Would this add on work on a 2.3.1 store or does it need to be converted and secondly, is it easy to convert to 2.3 if it does need converting

 

Thanks in advance

 

Ian

Link to comment
Share on other sites

@@ianhaney

 

It would need to be updated to work with v2.3.1. The standard updates would apply as well as some code edits for the administrators access tables.

 

 

 

Chris

Link to comment
Share on other sites

  • 3 weeks later...

Help I am getting an error when I go to the admin page. Looks like the file column_right.php is missing. I have tried searching the zip file I recieved and it is not there.

 

ning: require(includes/column_right.php) [function.require]: failed to open stream: No such file or directory in /home/shopobxc/public_html/account.php on line 236

 

 

Warning: require(includes/column_right.php) [function.require]: failed to open stream: No such file or directory in /home/shopobxc/public_html/account.php on line 236

Fatal error: require() [function.require]: Failed opening required 'includes/column_right.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/shopobxc/public_html/account.php on line 236

Link to comment
Share on other sites

Read posts #407 and #408

 

The contribution is written for osC2.2 and you've installed it on a 2.3 version most likely.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 1 year later...

Hi Henry, I'm looking for an updated version for 2.3.x (as I'm fully up tot date with 2.3.3.4 and probably not moving to 2.4)......if not available I will try to create it myself...

 

Just forget my request....took me some time to convert some php code, but got 1.4.3 working on osc 2.3.3.4

Link to comment
Share on other sites

Are you now going to add a new package to the addond area.

 

Depending on the needs!!

I updated the php code on the fly, moreless debugging step by step, which i'm still doing as the layout is not 100% inline with the 2.3.3.4 version (almost done), but the addon itself is functional as it suppose to be.

Next to that I did not register all my changes...so need to dig into the code to see what i changed.....

Link to comment
Share on other sites

  • 3 weeks later...

Hi Maxim,

 

Firstly, thank you for this great contribution - it is fantastic!

 

Secondly, I cannot get TinyMCE to work with it - it's driving me nuts! Any ideas?

 

Thirdly, did you ever do a Manufacturers Add Product one? I was wondering if you could help me as I have created a monster in that I am trying to get my customers to be able to add manufacturers. I have written the forms but now struggling with the functionality. Would you be willing to look into it for me?

 

I don't get notifications from this site so please feel free to email me on hello at womensbusinessclub.co.uk

 

Have a lovely weekend.

Angela

account_add.php

Link to comment
Share on other sites

  • 3 years later...

Hello
A very nice contribution! ! ! Congratulations!
The contribution works very well with oscommerce2.2rc1 in php 4.3.10.
On the other hand, with oscommerce2.2.rc2a and php 5.5, I am redirected to the index at the time of the preview.

None of the links you have mentioned are working.
How to do.
Thank you

Edited by burt
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...