Jump to content
Sign in to follow this  
valley

Support for Price Hammer contrbution.

Recommended Posts

Hello,

I did a post a request for some support for the Price Hammer

contribution which is still included in the contribution section

though the author has offered no email or forum support

 

http://www.oscommerce.com/community/contri...ch,price+hammer

 

For some unexplained reason my request has been deleted from the forum.

Could someone please explain if this contribution is banned from OSC?

 

If this is authorised, I have got it sort of working

at http://affiliatesexcel.com

 

However though the Auction price is correctly passed on to

the shopping cart, it appers only as SUB TOTal and the product

price is still shown as original price . Consequently the order

process carries the original price and not the Auction Price.

 

Here is the view of the shopping cxart.

 

Auction_price.gif

 

Here is the bit of code inserted in catalog/includes/classes/shopping cart

by the contribution

EN: Add following in includes/classes/shopping_cart.php 
DE: Folgenden Code in includes/classes/shopping_cart.php  einf?gen

Between / zwischen  
function add_cart
and / und
function update_quantity

line 119

// Begin Happy Hours Specials Advanced add

function add_cart_happy($products_id, $qty = '1', $happy , $attributes = '', $notify = true) {
  global $new_products_id_in_cart, $customer_id;

  $products_id = tep_get_uprid($products_id, $attributes);
  if ($notify == true) {
	$new_products_id_in_cart = $products_id;
	tep_session_register('new_products_id_in_cart');
  }

  if ($this->in_cart($products_id)) {
	$this->update_quantity($products_id, $qty, $attributes);
  } else {
	$this->contents[] = array($products_id);
	$this->contents[$products_id] = array('qty' => $qty);


// insert into database
	if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added, final_price ) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "', '" . $happy . "')");

	if (is_array($attributes)) {
	  reset($attributes);
	  while (list($option, $value) = each($attributes)) {
		$this->contents[$products_id]['attributes'][$option] = $value;
// insert into database
		if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
	  }
	}
  }
  $this->cleanup();

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
  $this->cartID = $this->generate_cart_id();
}

/// End Happy Hours Specials Advanced add


EN: Add following in includes/classes/shopping_cart.php
DE: Folgenden Code in includes/classes/shopping_cart.php  einf?gen


Below /unterhalb von  

Between  / zwischen  

line213

 function calculate() {
and / und
$this->total = 0;

// Begin Happy Hours Specials Advanced add
global  $customer_country_id, $customer_zone_id, $customer_id;
// End Happy Hours Specials Advanced add


EN: Add following in includes/classes/shopping_cart.php in function calculate
DE: Folgenden Code in includes/classes/shopping_cart.php  einf?gen in function calculate


below/unter 

	  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }
line235

// Begin Happy Hours Specials Advanced add
				if (tep_session_is_registered('customer_id')) {
	  $happy_query = tep_db_query("SELECT final_price from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "' and products_id = '" . (int)$products_id . "'");
	  if (tep_db_num_rows($happy_query)) {
				while($happyerg=tep_db_fetch_array($happy_query)) {
					   $products_price_happy = $happyerg[final_price];
					   		if($products_price_happy > 0) {
			 			 $products_price = $products_price_happy;
				}
				}
				}
				}
/// End Happy Hours Specials Advanced add






EN: Add following in includes/classes/shopping_cart.php in function get_products
DE: Folgenden Code in includes/classes/shopping_cart.php  einf?gen in function get_products


below/unter 

	  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }

line 293 

// ----------- Start Happy Hours Specials Advanced  price
	$happy_query = tep_db_query("select final_price from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . (int)$prid . "'");
	if (tep_db_num_rows($happy_query)) {
		$happy = tep_db_fetch_array($happy_query);
		if ($happy['final_price'] > 0) {
				$products_price = $happy['final_price'];
		}
	}
// ----------- End Happy Hours Specials Advanced price

*****************************************************************************
EN: Add following in includes/application_top.php
DE: Folgenden Code in includes/application_top.php einf?gen

below/unter	


  // customer adds a product from the products page
  case 'add_product' :	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']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

line 376

// Begin Happy Hours Specials Advanced add

  // performed by the 'add_happy' button in Happy_hours_specials_advanced box
	  case 'add_happy' :	if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
			   $cart->add_cart_happy($_POST['products_id'], $cart->get_quantity($_POST['products_id'])+1, $_POST['flash'] /(1 + $_POST['products_tax']/100),  $HTTP_POST_VARS['id']);

						  }

						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

// End Happy Hours Specials Advanced price

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

 

The original codeseems to be suitable for a shop with Prices inclusive of tax

which I have corrected to suit our shop which excludes tax. The price

passed on to the cart is correct, however not replacing the entry of

the original price.

 

Could someone suggest a solution.

 

This contribution is really great and meets the trend of Auction sales

which is very popular on the tele.

 

Many thanks in advance

 

Shred

Share this post


Link to post
Share on other sites

Hi, has anyone managed to successfully install and use this contribution? It seems such a great concept and one that I would use a lot on my site. However the lack of support and the fact that it doesn't seem to work is a bit of a hurdle...

 

I've read the support thread on the "Happy Hour" contribution, which this seems to be based on but the code appears to be totally different so there's not much help there.

 

Just to summarise the problem -

 

The package appears to install correctly and the admin side works fine (ie the price hammer data is written to the new table in the db). However, regardless of what date/time you set neither the Happy Hour or the Price Hammer info boxes appear at the set times, nor do the prices appear to change if you go in and view the product directly.

 

I'm not enough of a code-warrior to be able to identify the problem, but it would be nice if we could get this contribution working properly between us, as I think it's got a lot of potential.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×