drupal-6


Ubercart 2.x - Add produkt line to order via php


I'm trying to add a product to an ubercart order in Drupal 6, for a "free gift for recurring customer". I have already integrated it with ubercart's conditional actions, and that works fine.
What I am struggleing with, is adding the product to the order. I'm able to add the produkt to the cart, using:
uc_cart_add_item($settings[ 'gift_product'], $settings['gift_product_quantity'] );
To avoid fraud, and the customer not just clicking back and change the quantity of the free product, I would like to add it after checkout, so the line will apear on the order confirmation, and when packing the order. (If there is a better way to achieve this, please enlighten me)
The following code, does not add a product line, but a "charge", but it's the closest I have gotten:
uc_order_line_item_add($order->order_id, $settings[ 'gift_product' ], $product->title, $settings[ 'gift_product_quantity']);
As a side thing, I would like to know, if it's possible, and then how, to set the price, on the added product line, or add a 100% discount to that one order line.
I've been searching for a solution for this, for the most of a week, but I can't seem to find the right solution.
Thank you in advance.
I was unable to find any modules doing this, so I ended up making my own. The ubercart cart bonus module, was a great inspiration regarding a possible way to do this: http://drupalmodules.com/module/ubercart-cart-bonus
I did not change the order, but only the cart, and then made the necessary checks to try and prevent fraud.

Related Links

Fix Drupal 6 menu urls on test server
Drupal 6 - is node_submit() needed when saving node?
Apache Solr : Filter results by minimum relevancy in drupal 6.x
How can I add the tracking number to the message the users receive?
How can I get the term id after using taxonomy_save_term?
Why can't my user access a certain page?
jqModal popup does not opens
Access alias of a node programatically using Drupal 6
When variable_get() can be used while variable_set() has not been used?
How can I redirect users to login page and then add item to wishlist?
How to change Ubercart status messages in Drupal?
How do you add Fedex SmartPost as a shipping option?
Group Checkboxes in webform in drupal
Drupal 6 - How can I disable comments on all nodes / content_types?
Webservice creation in Drupal 6.22
Authorize.net returning multiple deliminators

Categories

HOME
dictionary
google-api-php-client
fft
yarn
c#-2.0
wamp
django-imagekit
adobe-analytics
izpack
handsontable
qt-creator
resize
hex-editors
fortumo
event-handling
hapi
saxon
windows-7-x64
interop
django-cms
visual-composer
emulator
google-search-api
captiveportal
social-media
xacml
file-rename
microsoft-chart-controls
wixsharp
main
neuroscience
withings
abstract-class
hilbert-curve
reportbuilder
unobtrusive-validation
android-mediaprojection
azure-application-gateway
winscp-net
dropbox-php
veracode
rdfs
knockout-components
sqlclient
hittest
color-profile
pintos
parallel-data-warehouse
httplistener
qpid
firebaseui
dataview
libressl
browser-bugs
map-projections
graph-drawing
skos
codeigniter-url
qcodo
rdtsc
id3v2
bitcoinj
uitouch
yorick
android-2.2-froyo
html4
hungarian-algorithm
yui-compressor
comaddin
jquery-knob
frameset
venn-diagram
netbeans-6.9
spring-portlet-mvc
xmlspy
hamachi
xtype
datareader
createwindow
jquery-ui-droppable
filtered-index
swing-app-framework

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App