Display a discount description on the product page
| Project: | UC Discounts |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
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
| Attachment | Size |
|---|---|
| uc_discounts_line_discount_description.patch | 4.38 KB |

#1
error in the patch, wait a little moment for another commit
#2
should work now
#3
#4
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 :
<?phpforeach($node->discounts as $discount) {
drupal_set_message('<pre>'.print_r($discount['description'], true).'</pre>');
}
?>
#5
#6
Automatically closed -- issue fixed for two weeks with no activity.