Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

under the title of an product put

<?php  echo print_r($_SESSION); ?>

 

you should get some information printed out. that towords the bottom has

[sppc_customer_group_id] => 0 [sppc_customer_group_show_tax] => 1 [sppc_customer_group_tax_exempt] => 0 [sppc_customer_specific_taxes_exempt] => ) 1

 

try login in different accounts, and see if any of those details change

Phoenix support now at https://phoenixcart.org/forum/
App created for phoenix
TinyMCE editor for admin

 

Link to comment
Share on other sites

  • 2 weeks later...

that should go in product_info.php

and should be removed after testing

e.g. if login into different accounts which are in different customer gorups

if that part is staying the same then theres a problem with sppc, that would then need to be fixed

Phoenix support now at https://phoenixcart.org/forum/
App created for phoenix
TinyMCE editor for admin

 

Link to comment
Share on other sites

Here is my product_info file where exactly should i put the echo script?

 

 

 

require('includes/application_top.php');

 

if (!isset($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_check = tep_db_fetch_array($product_check_query);

// BOF Separate Pricing per Customer

if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {

$customer_group_id = $_SESSION['sppc_customer_group_id'];

} else {

$customer_group_id = '0';

}

// EOF Separate Pricing per Customer

 

require(DIR_WS_INCLUDES . 'template_top.php');

 

if ($product_check['total'] < 1) {

?>

<div class="breadcrumb"><?php echo '  ' . $breadcrumb->trail('»'); ?></div>

<div id="productnotfound" class="contentContainer">

<div class="contentText" >

<?php echo TEXT_PRODUCT_NOT_FOUND; ?>

</div>

<br />

<div style="float: right;">

<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>

</div>

</div>

 

<?php

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

// BOF Separate Pricing per Customer

if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

} // end if ($customer_group_id > 0)

// EOF Separate Pricing per Customer

$products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

} else {

// BOF Separate Pricing per Customer

if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

} // end if ($customer_group_id > 0)

// EOF Separate Pricing per Customer

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';

} else {

$products_name = $product_info['products_name'];

}

?>

 

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

 

<div class="breadcrumb"><?php echo '  ' . $breadcrumb->trail('»'); ?></div>

<div>

<h1 class="headingproductinfo"><?php echo $products_name, '<div style="text-align: right; margin-top: -20px; padding-bottom: 10px;">' . $products_price . '</div>';?></h1>

</div>

 

<div class="contentContainer">

<div class="contentText">

 

<?php

if (tep_not_null($product_info['products_image'])) {

$pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");

 

if (tep_db_num_rows($pi_query) > 0) {

?>

 

<div id="piGal" style="float: left; padding-right: 10px;">

<ul>

 

<?php

$pi_counter = 0;

while ($pi = tep_db_fetch_array($pi_query)) {

$pi_counter++;

 

$pi_entry = ' <li> class="thumbs"<a href="';

 

if (tep_not_null($pi['htmlcontent'])) {

$pi_entry .= '#piGalimg_' . $pi_counter;

} else {

$pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image'], '', 'NONSSL', false);

}

 

$pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';

 

if (tep_not_null($pi['htmlcontent'])) {

$pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';

}

 

$pi_entry .= '</li>';

 

echo $pi_entry;

}

?>

 

</ul>

</div>

 

<script type="text/javascript">

$('#piGal ul').bxGallery({

maxwidth: 300,

maxheight: 200,

thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,

thumbcontainer: 300,

load_image: 'ext/jquery/bxGallery/spinner.gif'

});

</script>

 

<?php

} else {

?>

 

<div id="piGal" style="float: right;">

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image'], '', 'NONSSL', false) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>

</div>

 

<?php

}

?>

 

<script type="text/javascript">

$("#piGal a[rel^=fancybox]").fancybox({

cyclic: true

});

</script>

 

<?php

}

?>

 

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

 

<?php

// BOF SPPC Hide attributes from customer groups

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

?>

 

<p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>

 

<p>

<?php

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$products_options_array = array();

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

$list_of_prdcts_attributes_id = '';

$products_options = array(); // makes sure this array is empty again

while ($_products_options = tep_db_fetch_array($products_options_query)) {

$products_options[] = $_products_options;

$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";

}

 

if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') {

$select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";

$pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");

while ($pag_array = tep_db_fetch_array($pag_query)) {

$cg_attr_prices[] = $pag_array;

}

 

// substitute options_values_price and prefix for those for the customer group (if available)

if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {

for ($n = 0 ; $n < count($products_options); $n++) {

for ($i = 0; $i < count($cg_attr_prices) ; $i++) {

if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {

$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];

$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];

}

} // end for ($i = 0; $i < count($cg_att_prices) ; $i++)

}

} // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))

} // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

 

for ($n = 0 ; $n < count($products_options); $n++) {

$products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);

if ($products_options[$n]['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

// EOF SPPC attributes mod

while ($products_options = tep_db_fetch_array($products_options_query)) {

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

if ($products_options['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

 

if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

?>

<strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />

<?php

}

?>

</p>

 

<?php

}

?>

 

<div style="clear: both;"></div>

 

<?php

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {

?>

 

<p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>

 

<?php

}

?>

 

</div>

 

<?php

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");

$reviews = tep_db_fetch_array($reviews_query);

?>

<br />

 

 

<br />

<div class="buttonSet">

<span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>

 

<?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>

</div>

 

<?php

if ((USE_CACHE == 'true') && empty($SID)) {

echo tep_cache_also_purchased(3600);

} else {

include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);

}

?>

 

</div>

 

</form>

 

<?php

}

 

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

Link to comment
Share on other sites

I am using SPPC 4.2.2 and wishlist 2.3.3R1 can someone direct me to what I need to modify in the wishlist.php file ?

 

When someone logs in with a Designer level pricing and puts the item on the wishlist, the pricing on the wishlist reflects default price level.

 

any help would be appreciated.

 

running 2.3.3 OSC

 

 

thanks !

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Hi.

Is this contribution compatible with version osC v2.3.3? According to upper post the answer should be yes, but can someone confirm that? If yes, which version of SPPC?

Regards,

Matjaz

Yes indeed, The versión I am using 4.2.2, albeit have just finished intalling it, and have not tested its full functionality yet; is nevertheless compatible with OSC 2.3.3.

Edited by osas
Link to comment
Share on other sites

I don't know if this has been asked before, but is it possible to set specials for different customer groups using sppc? I have multiple groups and if I set my test account to a test group, I don't see any specials, all I see is a blank space where the specials should be. However if I put my test account into the retail group, I see the specials.

 

So is there a way to set special prices for other groups or is that just set for retail?

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I 'm trying to finish installing SPPC 4.2.2 on 2.3.3 version of OsCom. All files seems to be OK, but the following three files make some troubles:

- catalog/admin/customers.php,

- catalog/includes/modules/product_listing.php

- catalog/product_info.php

 

I asume that the issue might be somehow connected with already installed QTpro and Header Tags SEO contributions on my page. Did someone have the same problem? Any advise would be appreciate.

Regards,

Matjaz

Link to comment
Share on other sites

Hi,

I 'm trying to finish installing SPPC 4.2.2 on 2.3.3 version of OsCom. All files seems to be OK, but the following three files make some troubles:

- catalog/admin/customers.php,

 

The one file you have listed above is the one I had the biggest problem with initially modifying. I'm trying to make SPPC work in my development site. It was too difficult for me to determine what, especially near the end of the mod, what changes needed to be made. So, after I applied all bug fixes to all the other files from the contribution by fedondimopoulos, I just swapped out the admin/customers.php file from the SPPC 4.2.2 original file for 2.3.1. Now it works. I may still need to go back and apply fedondimopoulos's fix for this file, but now I have a page that comes up and so far the contribution works.

 

For you, it may be easier to the same as I did and then go back and make the other modifications for your other contributions. I don't know the other contributions you are using and if the mods are blended with SPPC mods which I can see would make it more difficult.

 

You can see below what I have.

Production:
osCommerce V. 2.3.4BS
VPS Box

Link to comment
Share on other sites

Hi,

Can someone point me to the right solution... I would just like to apply to each of our customers, a specific % of discount; but only for certain products or groups of products. Not the same % of discount to all products. Is there any contribution to solve this issue at all?

Regards,

Matjaz

Link to comment
Share on other sites

Hi, Alan.

Thanks for your reply. Actually, after realy hard work I managed to solve that issue. At least I thing it is solved, because the web page works just fine:) I checked the code several times, before I was successful. The code needed to be updated because of previous installs of other contributions.

But SPPC does not fits perfectly to my needs. What I need is described one poste above and I am trying to solve this issue too. Hope to get some information about it...

Link to comment
Share on other sites

  • 2 months later...

I haven't looked at that because my feeling is the form will take up a lot of space when you have to add room for displaying 11 checkboxes for those customers groups.

However, as long as you haven't added customers to that group you could do an update of the table products. Say you want to hide the same products from customer group 3 as you hide from customer group 1. Then this query (should) add customer group 3 to those products for hiding:

 

update products set products_hide_from_groups = concat(products_hide_from_groups, ',3') where find_in_set('1', products_hide_from_groups) > 0;

 

You could do that in phpMyAdmin. As usual make a backup of your table products and your whole database before testing this out. It worked for me but my test database is very small smile.gif

 

This worked fine for me too.

Now I'll be adding a few customer groups who will only see 20 or 30 different products of the total of approximately 1500.

I would really want to start with a customer group where all products (and maybe categories too) are hidden and then manually "unhide" them at product level.

Having a checkbox for "Hide all products" when adding a new customer group would be ulitmate for me but I'm sure there must be a neat query for that too.

How would a query for that look?

 

//Micke

Link to comment
Share on other sites

Is it as simple as this - if the ID of the group is 13?

update products set products_hide_from_groups = concat(products_hide_from_groups, ',13')
update categories set categories_hide_from_groups = concat(categories_hide_from_groups, ',13');

...or am I missing something?

Link to comment
Share on other sites

  • 3 months later...

Hi,

 

I know you don't technically help people who are trying to combine two addons, but hoping you will make an exception or at least look at this for me....

 

Im trying to combine this addon with Advanced Address management....

 

When I go into Admin and try to edit/delete or do any other changes to a customer profile i get the following SQL error...

 

********************************************

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.customers_group_id, c.customers_group_ra, c.customers_payment_allowed, c.custo' at line 1

 

select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_firstname, a.entry_lastname, a.entry_company, c.entry_company_tax_id, a.entry_street_address, a.entry_address2, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_alternate_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_billing_address_id, c.customers_default_shipping_address_id c.customers_group_id, c.customers_group_ra, c.customers_payment_allowed, c.customers_shipment_allowed, c.customers_order_total_allowed, c.customers_specific_taxes_exempt, c.customers_default_address_id from customers c left join address_book a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '1'

****************************************************

 

I assume what this means is that I need to make changes to the SPPC related database fields to make it all mesh together ... do you think this is correct and if so do you have any tips on what to change....

 

I'm happy to stuff around with my DB as this is a new install with no active customers etc

 

Thanks for any guidance you can offer.

Link to comment
Share on other sites

  • 3 weeks later...

Hi

 

I'm sure im missing something really simple, But I cant seem to get the red light to work for the requires authentication function on the admin/customers.php page... is there a switch or a function or something that I need to activate to get this to work, and if so where is it?

Link to comment
Share on other sites

Hallo to all osc users and the readers of this topic.

 

I'm new to osc so be gentle with me. I am using version 4.3.3.4, php version 5.3.27, provider uses linux.

I would like to use this addon (Hide products from customer groups for SPPC, modded version for osc 2.3.1) but after installing I am getting errors concerning deprecated code and others, like the search function not working because a certain function is missing, categories box failed to load etc, etc... I believe it has to do with the fact that the published addon is not fully corrected for osc 2.3.x.x I tried with the little knowledge I have to get it working, reading the suggestions here but in the end I had more errors, so I decided to ask you guys:

Is there, some where out there, a really compatible version with 2.3.x.? I'm not a coder just a beginning store owner.

I would like to use this addon because it gives SPPC more power and gives me a way to get really started.

My setup at the moment: version (was) clean 4.3.3.4 + SPPC 2.3.3.4 Revised + Specials by category

And... if I have tredded any rules/guidelines I apologize.

 

Thanks in advance!

Let's build the Metaverse! May the Code be with you!

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