Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Option Type Feature v1.6 (for osc 2.2 MS2)


Guest

Recommended Posts

hi all.

i have a problem with this contrib. i am getting the error

 

Fatal error: Call to undefined function: count_contents() in /home/pamelas/public_html/shop/includes/boxes/shopping_cart.php on line 28

 

i have checked this thread for answers and found this

 

 

That function SHOULD be in catalog/includes/classes/shopping_cart.php - it's used by more than just this contribution.

 

Mine looks like this:

function count_contents() { // get total number of items in cart

$total_items = 0;

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$total_items += $this->get_quantity($products_id);

}

}

return $total_items;

}

 

If you add that to the file specified above, it should overcome your error....

A.

 

the problem is, i had that code in the catalog/includes/classes/shopping_cart.php file before i started the install, its still there, and i cant seem to get rid of the error.

i don t know why its started now as all was fine before the install, and there are no mods that have any code to do with the count_contents() function that i can find.

 

can someone please help.

Link to comment
Share on other sites

  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

hi all.

 

was just having another look at this and thought that i would test some of the site functionality and found that the add to cart button is broken (and im sure that i will find other bits that dont work).

 

this is the error

 

Fatal error: Call to undefined function: get_quantity() in /home/pamelas/public_html/shop/includes/application_top.php on line 358

 

it looks like this contrib has made a bit of a mess of the shop front end, and i am seriously thinking about removing it.

its a shame as its exactly what i want, but its no good if it wont work.

 

i am now worried about it affecting the paypal websites payment pro module, and other mods that i have already installed.

 

im off to check that i followed the instructions to the letter, and if no one can help me then the mod has to go.

 

any ideas??????

 

many thanks.

Link to comment
Share on other sites

This code in this mod is a mess and needs a serious upgrade. I need this as well and have asked nicely for someone to fix it, but there is no way I would install it until someone is good enough to fix up the code and combine the two mods together. I cant cause Im not that cluely. Its what happens when people post bits of this and that in the contribution section instead of uploading complete packages with the correct fixes. Bits of code fixes should be kept for the forum.

Link to comment
Share on other sites

Hello all!

 

I am using the package:

Product Attributes - Option Type Feature v. 2.0 (manual install) by jsruok dated 2 Jul 2007

 

In the instructions for the file catalog/includes/functions/general.php it calls to make the change listed below. However, this change results in a MySQL error, "1064 - You have an error in your SQL syntax", whenever a comma is used in the textarea box and the product is added to the cart.

 

I changed the code back to the original and the product is successfully added to the cart with the comma.

 

My questions are this: Why doesn't the new function work with a comma in the textarea box and what kind of problems will occur using the original code with this contribution?

 

Thanks in advance for your thoughts and comments.

 

Tim

 

FIND: (around line 970)

//// 
// Return a product ID with attributes
 function tep_get_uprid($prid, $params) {
if (is_numeric($prid)) {
  $uprid = $prid;

  if (is_array($params) && (sizeof($params) > 0)) {
	$attributes_check = true;
	$attributes_ids = '';

	reset($params);
	while (list($option, $value) = each($params)) {
	  if (is_numeric($option) && is_numeric($value)) {
		$attributes_ids .= '{' . (int)$option . '}' . (int)$value;
	  } else {
		$attributes_check = false;
		break;
	  }
	}

	if ($attributes_check == true) {
	  $uprid .= $attributes_ids;
	}
  }
} else {
  $uprid = tep_get_prid($prid);

  if (is_numeric($uprid)) {
	if (strpos($prid, '{') !== false) {
	  $attributes_check = true;
	  $attributes_ids = '';

// strpos()+1 to remove up to and including the first { which would create an empty array element in explode()
	  $attributes = explode('{', substr($prid, strpos($prid, '{')+1));

	  for ($i=0, $n=sizeof($attributes); $i<$n; $i++) {
		$pair = explode('}', $attributes[$i]);

		if (is_numeric($pair[0]) && is_numeric($pair[1])) {
		  $attributes_ids .= '{' . (int)$pair[0] . '}' . (int)$pair[1];
		} else {
		  $attributes_check = false;
		  break;
		}
	  }

	  if ($attributes_check == true) {
		$uprid .= $attributes_ids;
	  }
	}
  } else {
	return false;
  }
}

return $uprid;
 }

REPLACE with

// OTF contrib begins
//// 
// Return a product ID with attributes
 //function tep_get_uprid($prid, $params) {
 //  if (is_numeric($prid)) {
 //	$uprid = $prid;
 //
 //	if (is_array($params) && (sizeof($params) > 0)) {
 //	  $attributes_check = true;
 //	  $attributes_ids = '';
 //
 //	  reset($params);
 //	  while (list($option, $value) = each($params)) {
 //		if (is_numeric($option) && is_numeric($value)) {
 //		  $attributes_ids .= '{' . (int)$option . '}' . (int)$value;
 //		} else {
 //		  $attributes_check = false;
 //		  break;
 //		}
 //	  } 
 //
 //	  if ($attributes_check == true) {
 //		$uprid .= $attributes_ids;
 //	  }
 //	}
 //  } else {
 //	$uprid = tep_get_prid($prid);
 //
 //	if (is_numeric($uprid)) {
 //	  if (strpos($prid, '{') !== false) {
 //		$attributes_check = true;
 //		$attributes_ids = '';
 //
 //  // strpos()+1 to remove up to and including the first { which would create an empty array element in explode()
 //		$attributes = explode('{', substr($prid, strpos($prid, '{')+1));
 //
 //		for ($i=0, $n=sizeof($attributes); $i<$n; $i++) {
 //		  $pair = explode('}', $attributes[$i]);
 //
 //		  if (is_numeric($pair[0]) && is_numeric($pair[1])) {
 //			$attributes_ids .= '{' . (int)$pair[0] . '}' . (int)$pair[1];
 //		  } else {
 //			$attributes_check = false;
 //			break;
 //		  }
 //		}
 //
 //		if ($attributes_check == true) {
 //		  $uprid .= $attributes_ids;
 //		}
 //	  }
 //	} else {
 //	  return false;
 //	}
 //  }
 //
 //  return $uprid;
 //}
////
// Return a product ID with attributes
 function tep_get_uprid($prid, $params) {
$uprid = $prid;
if ( (is_array($params)) && (!strstr($prid, '{')) ) {
  while (list($option, $value) = each($params)) {
	//CLR 030714 Add processing around $value. This is needed for text attributes.
	$uprid = $uprid . '{' . $option . '}' . htmlspecialchars(stripslashes(trim($value)), ENT_QUOTES);
  }
//CLR 030228 Add else stmt to process product ids passed in by other routines.
} else {
  $uprid = htmlspecialchars(stripslashes($uprid), ENT_QUOTES);
}
return $uprid;
 }  
 // OTF contrib ends

Link to comment
Share on other sites

  • 3 weeks later...

I didn't see anything about this yet, I have a customer that wants to charge for adding text to an Item, When we assign a dollor amount to the thext feild and the customer types something in the feild, it does not add the xtra amount. Is there a fix for this, or is it even possible.

Thanks

Link to comment
Share on other sites

Hi

 

I added a fix to this contribution "Broken quantity update after OTF" posted by dracono 16/7/07 which solves the problem of the text attributes being lost when the shopping basket quantity is updates.

 

I have tested this and on the whole, it sorts out this problem for my installation. However, whenever the text cotains any special characters such a " the attributes enterg by the customer still get lost.

 

Please could anyone who has installed this, test on their implementation and let mw know if they also get this problems

 

The scenario to test is to enter some text containing for example some quotation characters e.g "Fred", and then in the shopping basket to amend the products quantity. Do you loose the text at that point?

 

I want to rule out me having messed up my installation of the contribution

 

 

Thanks

Andrew

Edited by allrightpet
Link to comment
Share on other sites

Hello,

 

I installed the contribution Option Type Feature.

 

I have a problem with the display of the text option.

 

At first, the text option appeared fine in shopping_cart.php but it did not appear at all in checkout_confirmation.php and in the order email : it says TEXT instead.

 

I checked the catalog/checkout_process.php and the catalog/includes/classes/order.php files and I ended up making some changes to the file.

 

Well, the text option now appears fine in checkout_confirmation.php and in ther order e-mail but... only for those who pay their order by check ! If my customer pays with a credit card or paypal, it appears in checkout_confirmation.php but does not appear in the order e-mail : it still says TEXT !

 

I am kinda lost... Any idea ?

Edited by mluce
Link to comment
Share on other sites

  • 4 weeks later...

I am having the same problem with the TEXT showing up in the orders_products_attributes table field products_options_values. Did you have any luck solving this?

 

Thanks,

Bob

Hello,

 

I installed the contribution Option Type Feature.

 

I have a problem with the display of the text option.

 

At first, the text option appeared fine in shopping_cart.php but it did not appear at all in checkout_confirmation.php and in the order email : it says TEXT instead.

 

I checked the catalog/checkout_process.php and the catalog/includes/classes/order.php files and I ended up making some changes to the file.

 

Well, the text option now appears fine in checkout_confirmation.php and in ther order e-mail but... only for those who pay their order by check ! If my customer pays with a credit card or paypal, it appears in checkout_confirmation.php but does not appear in the order e-mail : it still says TEXT !

 

I am kinda lost... Any idea ?

Link to comment
Share on other sites

  • 3 weeks later...

I had this same problem. Here's the solution to make the OPTION NAME appear in Email (assuming it's appearing in the shopping cart and on the order pages, but just not in email).

 

Edit 'checkout_process.php' and around line #233 on a pretty basic OSC install, change this line:

 

$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']);

 

To the following:

 

$products_ordered_attributes .= "\n\t" . $attr_name . ' ' . tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']);

 

 

(Essentially you are chaing the $attributes_values['products_options_name'] to the $attr_name variable because you want the name from the most recent db query).

 

Hope that helps someone else - as it stumped me for a couple hours and I couldn't find the solution in this forum.

 

-rob

 

Thank you for the contribuition below. It works almost perfectly with PayPal IPN V1.1, however I am having problems with the email being sent. The email being sent does not show the OPTION NAME such as

- Custom Line #3: CCCCCCCCCCCCCC

- Custom Line #2: GGGGGGGGGGGGG

- Custom Line #1: XXXXXXXXXXXXXXX

 

Instead it shows:

 

CCCCCCCCCCCCCC

GGGGGGGGGGGGG

XXXXXXXXXXXXXXX

 

this only happens on the email side. I do get everything working during checkout. Does anyone know how I can get this fixed?

 

Your help would be greatly appreciated.

 

Ski

Link to comment
Share on other sites

issue with this module just installed on a clean install of oscommerce version with buysafe.

2.2 MS2 (060817)

 

includes/classes/shopping_cart.php had caused error in install at line 452 with bracket.

so used the manual install directions and overwrote that file. All was well.

Then added option to cart, but ... product will not add to cart.

Cart does work, as other products can be added.

Any help would be greatly appreciated.

 

Thanks!

Link to comment
Share on other sites

I had installed this contribution, but while I am generally able to figure out minor issues, this one has me stumped.

 

Under Product Options in admin/products_attributes.php

 

All of the contribution changes turned the Option Names (Color, Size, etc. ) into Option Names (textarea, radio buttons, etc.)

 

Is that the NORMAL function of this contribution?

Because while I'd like to have some ability to personalize clothing products, I still require the Option Names of Color, Size, Gender, etc. To have the Option Name overwritten seems to be not optimal. It would be better to have Option Type Names for the textarea, radio buttons, etc.

 

If I have somehow screwed up the installation then I'd greatly appreciate that knowledge so I can find my error.

Otherwise I'll have to trash about 10 hours of work to get this installed and go back to the backups.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I had a working oscommerce with some contribs, and moved to another server.

Same PHP4 version but mysql 4.1 to 5.0.

 

The option type feature is not working. It acts like the person below (see quote)

Only dropdown boxes are shown, no radio, text

He managed to solve it by changing his configure.php, but mine is set up right i think.

Are there any changes from Mysql 4 to Mysql 5?

I had OTF 1.7.2 installed.

 

greets

 

I'm using Options Type Feature v1.71 on several stores successfully. These stores are using MySQL 4.0.17

 

I recently moved a store from this server to a new server with updated MySQL -- MySQL 4.1.11

 

Now all the options show as "selects" rather than "text", "radio", etc.

 

Any help would be greatly appreciated.

 

Thanks, Jody

Link to comment
Share on other sites

Hi,

I had a working oscommerce with some contribs, and moved to another server.

Same PHP4 version but mysql 4.1 to 5.0.

 

The option type feature is not working. It acts like the person below (see quote)

Only dropdown boxes are shown, no radio, text

He managed to solve it by changing his configure.php, but mine is set up right i think.

Are there any changes from Mysql 4 to Mysql 5?

I had OTF 1.7.2 installed.

 

greets

 

found it,

it needed the local/config.php file (i was thinking of the mysql configure php)

 

now it runs smoothly yay

Link to comment
Share on other sites

Hi there.

I'm having troubles with this contribution. Everytime I edit a product, after I update it, the option type feature gets deleted on that product. So I have to go to products attributes, and add it once again.

 

 

Any tip?

 

Thanks

 

I had the same problem, and this solved it for me:

 

 

 

Hello

 

After patching osC 2.2 with last PA-OTF I have noticed that quantity update in shopping_cart.php is broken. After updating all attributes vanished (?). I found in application_top.php some issue in /case 'update_product'/ part. $attributes doesn't use that fancy '+++N' and it should be:

 

(near 360 line)

 

$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i] : '';

 

AfterER

Link to comment
Share on other sites

I tried that fix as well, but the text attributes displayed in the cart still disappeared after clicking the update button. I did add the Attributes Sort contribution and I wonder if that may have caused problems.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I had the same problem, and this solved it for me:

Hello

 

After patching osC 2.2 with last PA-OTF I have noticed that quantity update in shopping_cart.php is broken. After updating all attributes vanished (?). I found in application_top.php some issue in /case 'update_product'/ part. $attributes doesn't use that fancy '+++N' and it should be:

 

(near 360 line)

 

$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i].'+++'.$i] : '';

 

AfterER

Link to comment
Share on other sites

I found what I think was the problem. After sifting through this code, which I am not an expert on, I found a piece that was commented out for a contribution. I think the contribution was OTF, but I would have to confirm that. I can't believe nobody else had this problem.

 

 

The shopping_cart.php in catalog was like this:

 

 

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

while (list($option, $value) = each($products[$i]['attributes'])) {

// BOF Option Type Value - Commented out php echo

//echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

// EOF Option Type Value

 

 

I removed the comment ("//") that blocked the echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

Don't know why that needed to be blocked, but it works now with it back in.

 

 

 

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

while (list($option, $value) = each($products[$i]['attributes'])) {

// BOF Option Type Value - Commented out php echo

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

// EOF Option Type Value

 

 

 

 

 

 

I tried that fix as well, but the text attributes displayed in the cart still disappeared after clicking the update button. I did add the Attributes Sort contribution and I wonder if that may have caused problems.
Link to comment
Share on other sites

Sorry, I just noticed that I commented out the "checkbox" feature in product_info.php while I was playing around with the code.

You can uncomment that with no ill effects.

 

It is marked as "BOF COMMENTED OUT CHECKBOX"

Link to comment
Share on other sites

  • 4 weeks later...

Has anyone installed this contrib and the file upload contrib on the osCommerce Online Merchant v2.2 RC1 and got it working on Apache2/MYSQL5/PHP5 server?

I have problems with this when people click on a product already in the shopping cart, it doesn't transfer the file/text and textarea options back to the product_info page.

 

Vidar

Link to comment
Share on other sites

Hi,

 

I've installed Option Type Feature v1.6 (for osc 2.2 MS2).

 

I'm trying to achieve that quantity and text values selected in the product info page will be reflecting in the shopping cart infobox, and when I'll click on the product text in the

shopping cart infobox, the product info page shows the options previously selected.

 

Do I have to install some update to OTF 1.6 or paste some new code?

 

 

Thanks a lot

Link to comment
Share on other sites

  • 4 weeks later...

First of all let me say thanks for this mod. This is excellent and a great contribution.

 

Now on to my problem. I was able to get this mod workign with little effort and it works great. The problem I'm having is as follows. I am using the "3images with admin V1.0" mod to add additional images to my products. After installing this mod, the "Click to enlarge" links on my products no longer work. I get an Error on page message at the bottom of the browser and nothing happens. I'm assuming something has changed that references the Picture Id, but have absolutly no knowledge of PHP or MySQL so I'm at a serious disadvantage. Can anyone maybe point me in teh right direction to get me started on how to troubleshoot this? Thanks.

 

Shawn Cothern

Co-Owner, www.broadwyn-wear.com

Link to comment
Share on other sites

Hi

 

Nice mod!!

 

I have installed the mod with quantity multiplier and modified it a bit.

 

I would like to be able to let the costumer enter a length as text and choose a width as drop down.

 

I then want the price to be calculated based on that: width(text) X length(drop down) X (price pr. square meter(products price))

 

That work almost.

But when I add new products it calculates wrongly.

 

Can any of you see how this could be made simple...because I think my way of doing it is a bit too complex.

Please help

Link to comment
Share on other sites

Okay, So I figured out how to fix my previous issue. Now I have more of a question.

 

I want to use the radio button's to select from different font options. I want the font name displayed next to the radio box to actually typed in in the appropriate font. For example, if the first radio option is for Comic Sans MS, then I want it to say Comic Sans MS, but actually display in that font. Is this posible? Thanks.

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...