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

how can i see object data returned by node_load() method in Drupal?
drupal_get_form : Manual call to render a form isn't working
Query in Override of node.tpl
Design a site in drupal: General Overview
use drupal hook_nodeapi
Creating a CCK record in a MySQL database
Aggregate various feeds and display them as blog entries?
hook_menu giving 404
Drupal 6 backport of Drupal 7 admin-bar and overlay?
Adding extra multiple fields in Drupal(6.19) comment form
How to modify the HTML tag in Drupal 6?
working with forms and ajax in drupal 6
How to do form validation in drupal?
Drupal: Problem with installing Drupal6
How to conditionally hide a field in a drupal view?
toggle between views in drupal

Categories

HOME
sendgrid
wso2-am
openstack
reflection
angular-material
session
rsync
yahoo-oauth
yarn
amazon-ecs
c#-2.0
sql-server-2016
windows-server
yum
opengl-es-2.0
podio
qore
esper
dacpac
gorm
kibana-4
offline
quicklook
dynamics-crm-online
jsprit
highlight.js
invantive-sql
nhibernate-envers
textfield
extjs5
chromium-embedded
centos6.5
ejabberd-module
iframe-resizer
xquery-3.0
perlin-noise
phpfreechat
asset-pipeline
subset-sum
accelerate-framework
google-api-nodejs-client
mapdb
overriding
plsql-psp
devextreme
multilingual
abstract-class
occlusion
starteam
code-search-engine
webix-treetable
leading-zero
optix
fakeiteasy
http-redirect
menuitem
winscp-net
aurelia-validation
drupal-6
nativeapplication
windows-mobile-6.5
capacity
orthogonal
topbeat
removechild
vmware-tools
probability-density
sts-springsourcetoolsuite
elements
py2app
django-debug-toolbar
dlna
ios8-today-widget
deis
apache-commons-fileupload
pick
titanium-modules
terminfo
reactfx
rtmfp
datagridviewcolumn
oracle-warehouse-builder
commoncrypto
inbox
spring-io
gridcontrol
limejs
html-editor
distutils
itmstransporter
google-email-migration
first-responder
errai
punbb
locationlistener
table-footer
propagation
lpeg
sproutcore-2
msdev
grid-system

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App