Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Is SPPC compatible with the Authorize.net AIM contribution? I have installed this module, but it does not show up as a payment method in my customer groups. Consequently (or incidentally), it (Authorize.net AIM module) isn't showing up in my checkout. Is this an incompatability issue? Is there a resolution? Any help would be appreciated.

Link to comment
Share on other sites

Is SPPC compatible with the Authorize.net AIM contribution? I have installed this module, but it does not show up as a payment method in my customer groups. Consequently (or incidentally), it (Authorize.net AIM module) isn't showing up in my checkout. Is this an incompatability issue? Is there a resolution?

If it is an installed payment method it should come up in e.g. admin/customer_groups.php. That it doesn't seems to indicate that the install of the payment method didn't go well. You can try an unedited includes/classes/payment.php to see if it shows up in checkout_payment.php but I'm afraid the error is not with SPPC.

Link to comment
Share on other sites

Hi,

 

I'm trying to add Separate Pricing Per Customer 4.2.0 to RC2a but there are some problems with:

 

catalog/admin/product_attributes.php

 

catalog/includes/classes/shopping_cart.php

 

catalog/includes/modules/new_products.php

 

I think this wonderful contribution needs an update.

 

Thanks.

Link to comment
Share on other sites

If it is an installed payment method it should come up in e.g. admin/customer_groups.php. That it doesn't seems to indicate that the install of the payment method didn't go well. You can try an unedited includes/classes/payment.php to see if it shows up in checkout_payment.php but I'm afraid the error is not with SPPC.

 

The Authorize.net AIM module was a fairly easy and straight-forward installation--as simple as any I've done, and I've done a lot. It showed up in my payment modules just fine and allowed me to install it. I don't get any errors or other messages. Though it is possible that I didn't install it correctly, the likelihood is slim, and with the exception of it not showing up in SPPC and the shopping cart, there is no indication that it was installed wrong. That having been said, I don't know that the problem is with SPPC. I'm just starting here, because this is the only lead that I have at this point. If anyone has had success installing these two contribs togather, please let me know.

Link to comment
Share on other sites

Though it is possible that I didn't install it correctly, the likelihood is slim, and with the exception of it not showing up in SPPC and the shopping cart, there is no indication that it was installed wrong. That having been said, I don't know that the problem is with SPPC.

The fact that it doesn't show up in SPPC indicates it is not an installed module. Check your database with phpMyAdmin, table configuration and look for configuration_key:

MODULE_PAYMENT_INSTALLED (List of payment module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: cc.php;cod.php;paypal.php))

Link to comment
Share on other sites

The fact that it doesn't show up in SPPC indicates it is not an installed module. Check your database with phpMyAdmin, table configuration and look for configuration_key:

MODULE_PAYMENT_INSTALLED (List of payment module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: cc.php;cod.php;paypal.php))

 

I did this, and Authorize.net AIM was not listed as an installed module, but according to my OSC admin pannel, it is. What do I do about this? I realize that this no longer falls under the realm of this forum, so I will be posting it in the Authorize.net AIM forum, but any help here would also be appreciated, especially because help in that forum is lean and slow-coming.

Link to comment
Share on other sites

What do I do about this?

I would try adding it manually to that configuration item. Just add a sem-colon and the name of the Authorize AIM module and then see what happens. Of course you should not have need to do that but I don't know that module either so can't be of help here.

Link to comment
Share on other sites

The problems I have are the followings:

 

In catalog/includes/classes/shopping_cart.php I cannot find

			  $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		} else {
		  $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

Rc2a has this code:

			  $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
		} else {
		  $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);

 

In catalog/includes/modules/new_products.php cannot find:

 $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

RC2a has the following code:

	$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {

And in catalog/admin/product_attributes.php almost everything is different.

 

All other files are ok, i think there's no need to make any change.

Link to comment
Share on other sites

The problems I have are the followings:

 

In catalog/includes/classes/shopping_cart.php I cannot find

			  $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		} else {
		  $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

Rc2a has this code:

			  $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
		} else {
		  $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);

Correct, this is wrong in 4.2.0 because in RC1 the $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); was already changed to $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);

 

The SPPC should use that too but now with the [$n] to:

// now loop through array $attribute_price to add up/substract attribute prices

  for ($n = 0; $n < count($attribute_price); $n++) {
		if ($attribute_price[$n]['price_prefix'] == '+') {
		  $this->total += $currencies->calculate_price($attribute_price[$n]['options_values_price'], $products_tax, $qty);
		} else {
		  $this->total -= $currencies->calculate_price($attribute_price[$n]['options_values_price'], $products_tax, $qty);
	}
  } // end for ($n = 0; $n < count($attribute_price); $n++)

 

In catalog/includes/modules/new_products.php cannot find:

SPPC already contained the improvement that went into RC2. Just ignore the changes in the queries and replace them with the SPPC ones.

And in catalog/admin/product_attributes.php almost everything is different.

If you click on the paperclip icon in front of Seperate Pricing Per Customer v3.5 in the listing you will find the new SPPC adjusted admin/product_attributes.php in a pop-up window.

Link to comment
Share on other sites

Thanks for your reply, I made the modification in catalog/includes/classes/shopping_cart.php, and for catalog/includes/modules/new_products.php I use your file.

But I really can't see where should I click to see the new admin/product_attributes.php

Link to comment
Share on other sites

Hi

 

I installed a new empty OScommerce online Merchant 2 RC2a shop and directly after i copied the Files from the new installation to my shop, an override the "old" ones.

After that i made the SQL change, and now i have this nice error message in product_info page:

 

1267 - Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (utf8_general_ci,IMPLICIT) for operation 'find_in_set'

select count(*) as total from products_options popt, products_attributes patrib where patrib.products_id='21' and patrib.options_id = popt.products_options_id and popt.language_id = '2' and find_in_set('0', attributes_hide_from_groups) = 0

[TEP STOP]

 

Before i copied the files, no error was shown.

 

Anyone here who can help me?

Link to comment
Share on other sites

Hi there,

 

I modified my sppc version the last weeks ant the actual result is:

- Added Base Price

- Added an Information Box on the frontend where all usefull data is placed for the actual custumer (discount, minimal and maximal order amount, tax info, group name (it's multilanguage able), customers group icon)

- Added a new Discount module

- Added Qantity Price Breaks per Product and Category (I hate it because of the priceFormatter.php!!).

- Added Printer Friendly Product Page contribution

- Added parts of Account Enhancements (AE)

If there is someone interessted inform me and I will upload the addons in the contribution area.

 

The discount module is nearly finished. I only need a function that calculates the discount when a product price is changed and i have to integrate products_listing.php (the ugly priceFormatter.php is the problem).

 

The Tax Info module is also nearly finished. I just need to insert a value if no product is placed (because than the tax rate is zero). So I will add a string calling the aviable tax rates. for example in germany we have 7% for food etc. and 19% for the rest.

 

Base Price is working expect of products_listing.php (the ugly priceFormatter.php is the problem).

 

The Information Box is also working and I have created a contribution (but I have to actualize it). Also I need to change the image function because at the moment when no image is selected and you modify the group the image is deleted.

 

Price Breaks are working (I used the contribution from Jan Zonjee (http://www.oscommerce.com/community/contributions,3039).

 

Printer Friendly Product Page is also working but at the moment I use the default print-page as long as I'm not finished modifing products_info.php.

 

Account Enhancements (AE): Now you can change the customers number and you can login with the customers number.

Edited by Grinse
Link to comment
Share on other sites

Hi

 

I installed a new empty OScommerce online Merchant 2 RC2a shop and directly after i copied the Files from the new installation to my shop, an override the "old" ones.

After that i made the SQL change, and now i have this nice error message in product_info page:

 

1267 - Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (utf8_general_ci,IMPLICIT) for operation 'find_in_set'

select count(*) as total from products_options popt, products_attributes patrib where patrib.products_id='21' and patrib.options_id = popt.products_options_id and popt.language_id = '2' and find_in_set('0', attributes_hide_from_groups) = 0

[TEP STOP]

 

Before i copied the files, no error was shown.

Looks like the character set for the field attributes_hide_from_groups is different than the character set for the database. See for example this thread that I found with Google. Perhaps you can see that in phpMyAdmin?

Link to comment
Share on other sites

I am trying to do something like this but I need customer group price 4 to be 5 percent off of customer group price 3. Not sure how to do this.

 

 

 

First you backup the database, or just the table products_groups and then try:

insert into products_group select '6' as customers_group_id, customers_group_price, products_id from products_groups where customers_group_id = '1';

If it not right, use the backup :)

Better yet, try it on your local server.

 

 

Thanks Mike

Edited by paq1200
Link to comment
Share on other sites

I am trying to do something like this but I need customer group price 4 to be 5 percent off of customer group price 3. Not sure how to do this.

A simple sql query that I thought would not work seems to insert the correct prices in the database:

insert into products_groups select '4' as customers_group_id, 0.95 * customers_group_price, products_id  from products_groups where customers_group_id = '3';

although it ends with the cryptic message:

Error message from server:

Data truncation: Data truncated for column 'customers_group_price' at row 27

Otherwise the more reliable method would seem to use a PHP page (this one worked when put on the catalog side and named insert_group_prices.php) which has the advantage than you can check what will be inserted before actually do the insert (other numbers and factors chosen: customer group id 5 and factor 0.5)

<?php
include_once("includes/application_top.php");

$comma_linefeed = ',' . "\n";

if (isset($_POST['submit_form'])) {
$price_query = tep_db_query("select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS ." where customers_group_id = '1' order by products_id");

$insert_query = "insert into " . TABLE_PRODUCTS_GROUPS ." (`customers_group_id`, `customers_group_price`, `products_id`) values \n";

while ($group_prices = tep_db_fetch_array($price_query)) {
 $insert_values[] = "(5, '" . 0.5 * $group_prices['customers_group_price'] . "', " . $group_prices['products_id'] . ")";
}

$values_imploded = implode($comma_linefeed, $insert_values);
$insert_query .= $values_imploded . ";\n";
} // end if (isset($_POST['submit']))
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body style="margin-left: 10px;">
<h1 class="productListing-heading" style="font-size: 20px;">Insert group prices based on other group prices</h1>
<?php echo tep_draw_form('insert_cg_prices', $_SERVER['PHP_SELF']) . "\n"; ?>
<p class="messageBox">To view the query on screen hit continue without checking the checkbox.</p>
<p class="messageBox">To actually insert the prices, check the checkbox: <?php echo tep_draw_checkbox_field('do_insert'); ?></p>
<p style="margin-top: 20px; text-align: center;"><?php 
// echo tep_image_submit('button_continue.gif', IMAGE_CONTINUE, 'name="submit"') . "<br>\n";
?><button name="submit_form" type="submit" value="submit">Hit it</button></p>
</form>
<?php
 if (isset($_POST['submit_form']) && isset($_POST['do_insert'])) {
 // $delete_query = "delete from " . TABLE_PRODUCTS_GROUPS ." where customers_group_id = '5'";
 // $result_delete_query = tep_db_query($delete_query);
 tep_db_query($insert_query);
 echo '<h1>Done</h1>';
 exit;
 } elseif (isset($_POST['submit_form'])) {
 echo '<pre>';
 echo $insert_query;
 echo '</pre>';
 exit;
 }
?>
</body>
</html>

Link to comment
Share on other sites

A simple sql query that I thought would not work seems to insert the correct prices in the database:

insert into products_groups select '4' as customers_group_id, 0.95 * customers_group_price, products_id  from products_groups where customers_group_id = '3';

although it ends with the cryptic message:

Error message from server:

Data truncation: Data truncated for column 'customers_group_price' at row 27

Otherwise the more reliable method would seem to use a PHP page (this one worked when put on the catalog side and named insert_group_prices.php) which has the advantage than you can check what will be inserted before actually do the insert (other numbers and factors chosen: customer group id 5 and factor 0.5)

<?php
include_once("includes/application_top.php");

$comma_linefeed = ',' . "\n";

if (isset($_POST['submit_form'])) {
$price_query = tep_db_query("select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS ." where customers_group_id = '1' order by products_id");

$insert_query = "insert into " . TABLE_PRODUCTS_GROUPS ." (`customers_group_id`, `customers_group_price`, `products_id`) values \n";

while ($group_prices = tep_db_fetch_array($price_query)) {
 $insert_values[] = "(5, '" . 0.5 * $group_prices['customers_group_price'] . "', " . $group_prices['products_id'] . ")";
}

$values_imploded = implode($comma_linefeed, $insert_values);
$insert_query .= $values_imploded . ";\n";
} // end if (isset($_POST['submit']))
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body style="margin-left: 10px;">
<h1 class="productListing-heading" style="font-size: 20px;">Insert group prices based on other group prices</h1>
<?php echo tep_draw_form('insert_cg_prices', $_SERVER['PHP_SELF']) . "\n"; ?>
<p class="messageBox">To view the query on screen hit continue without checking the checkbox.</p>
<p class="messageBox">To actually insert the prices, check the checkbox: <?php echo tep_draw_checkbox_field('do_insert'); ?></p>
<p style="margin-top: 20px; text-align: center;"><?php 
// echo tep_image_submit('button_continue.gif', IMAGE_CONTINUE, 'name="submit"') . "<br>\n";
?><button name="submit_form" type="submit" value="submit">Hit it</button></p>
</form>
<?php
 if (isset($_POST['submit_form']) && isset($_POST['do_insert'])) {
 // $delete_query = "delete from " . TABLE_PRODUCTS_GROUPS ." where customers_group_id = '5'";
 // $result_delete_query = tep_db_query($delete_query);
 tep_db_query($insert_query);
 echo '<h1>Done</h1>';
 exit;
 } elseif (isset($_POST['submit_form'])) {
 echo '<pre>';
 echo $insert_query;
 echo '</pre>';
 exit;
 }
?>
</body>
</html>

 

 

when I try to run this I get a error

 

1064 - You have an error in your SQL syntax near '; ' at line 1247

 

Thanks

Link to comment
Share on other sites

when I try to run this I get a error

 

1064 - You have an error in your SQL syntax near '; ' at line 1247

 

Thanks

 

at the bottom of the insert_group_prices.php page I have the following:

 

(4, '10.4025', 2784),

(4, '10.4025', 2785),

(4, '10.4025', 2786),

(4, '13.775', 2787),

(4, '12.635', 2788);

 

when I looked at the script it looks like it should say "Done" .

 

No changes are being made to the products_groups table in the database.

 

I think it is not finishing the script. I checked the error logs and no errors are shown in the log file.

 

Thanks

Mike

Edited by paq1200
Link to comment
Share on other sites

at the bottom of the insert_group_prices.php page I have the following:

 

(4, '10.4025', 2784),

(4, '10.4025', 2785),

(4, '10.4025', 2786),

(4, '13.775', 2787),

(4, '12.635', 2788);

 

when I looked at the script it looks like it should say "Done" .

 

No changes are being made to the products_groups table in the database.

 

I think it is not finishing the script. I checked the error logs and no errors are shown in the log file.

 

Thanks

Mike

 

 

 

My Mistake I had to go in and delete all the products_group 4 by:

DELETE FROM `products_groups` WHERE `customers_group_id` = 4;

 

then ran the code again and all is fine now. Thanks for all your help.

 

Your php script runs great.

 

Mike

Link to comment
Share on other sites

Hi Jan,

 

I hope you are able to shed a little light for me on a strange issue that I am having.

 

I am running SPPC with all the bells and whistles and it works great apart from that I can not seem to select/deselect the payment and shipping modules when editing the groups, they still appear during the checkout.

 

Now I am not looking for a fix just a shove in the right direction to which file I should actually be looking in.

 

Apologies if I have missed this in the thread somewhere or in the install instructions.

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Looks like the character set for the field attributes_hide_from_groups is different than the character set for the database. See for example this thread that I found with Google. Perhaps you can see that in phpMyAdmin?

 

 

I dont find any field attributes_hide_from_groups

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