Display a discount description on the product page

zmove - October 30, 2008 - 13:35
Project:UC Discounts
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,

This patch for the 6.x branch allow to display a description of a discount on the product page.

This patch only apply on the latest bazaar version of the Ubercart 6.x branch, cause it depend on the core modification about product fields administration page (more details here).

So ATM, it couldn't be backported until the 5.x branch of ubercart get this core improvement too.

So, basically, it add a discount line in admin/store/settings/products/edit/fields, if enabled, it display matching discount description into the node.

To do that, I had to alter the return value of uc_discounts_product_discount_price(). Instead of returning a value, it return an array that is interpreted in the nodeapi function. I think it's a good thing for extensibility and this is a first step to make this module work with attributes too..

Here is the patch

AttachmentSize
uc_discounts_line_discount_description.patch4.38 KB

#1

zmove - October 30, 2008 - 14:27

error in the patch, wait a little moment for another commit

#2

zmove - October 30, 2008 - 14:39

should work now

AttachmentSize
uc_discounts_discount_description.patch 4.87 KB

#3

psynaptic - November 1, 2008 - 00:31
Version:5.x-1.x-dev» 6.x-1.x-dev

#4

zmove - November 3, 2008 - 15:53

I committed it on the latest 6.x dev version. I added the description entry to the discount array that is associated to a product. So you can access a discount description like that :

<?php
 
foreach($node->discounts as $discount) {
   
drupal_set_message('<pre>'.print_r($discount['description'], true).'</pre>');
  }
?>

#5

zmove - November 3, 2008 - 16:00
Status:needs review» fixed

#6

System Message - November 17, 2008 - 16:02
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.