fatum112 Posted September 12, 2006 Share Posted September 12, 2006 Hi,i'm trying to make a mambo virtuemart mod, i'm currently trying to make a script so i can update the product quantety, subtotal, and total price..i need this all in one..the current script without any update function is:[code] <?php $dbt = new ps_DB; $qt = "SELECT product_quantity,order_item_name,order_item_sku,product_id,product_item_price,product_final_price, product_attribute FROM `#__{vm}_order_item` WHERE #__{vm}_order_item.order_id='$order_id' "; $dbt->query($qt); $i = 0; while ($dbt->next_record()){ if ($i++ % 2) $bgcolor=SEARCH_COLOR_1; else $bgcolor=SEARCH_COLOR_2; $t = $dbt->f("product_quantity") * $dbt->f("product_final_price"); ?> <tr bgcolor="<?php echo $bgcolor; ?>" valign="top"> <td width="5%"> <?php $dbt->p("product_quantity") ?></td> <td width="42%"><?php $dbt->p("order_item_name"); echo "<br /><font size=\"-2\">" . ps_product::getDescriptionWithTax($dbt->f("product_attribute")) . "</font>"; ?> </td> <td width="9%"><?php $dbt->p("order_item_sku") ?> </td> <td width="12%" align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($dbt->f("product_item_price"), 5); ?></td> <td width="12%" align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($dbt->f("product_final_price")); ?></td> <td width="19%" align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($t); ?> </td> </tr> <?php } ?> <tr> <td colspan="6"> </td> </tr> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong> <?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_SUBTOTAL ?>: </strong></div></td> <td width="19%"><div align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($db->f("order_subtotal"), 5); ?> </div></td> </tr> <?php /* COUPON DISCOUNT */ $coupon_discount = $db->f("coupon_discount"); if( PAYMENT_DISCOUNT_BEFORE == '1') { if ($db->f("order_discount") != 0) { ?> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php if( $db->f("order_discount") > 0) echo $VM_LANG->_PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT; else echo $VM_LANG->_PHPSHOP_FEE; ?>:</div></strong></td> <td width="19%"><div align="right"><?php if ($db->f("order_discount") > 0 ) echo "-" . $CURRENCY_DISPLAY->getFullValue(abs($db->f("order_discount"))); elseif ($db->f("order_discount") < 0 ) echo "+" . $CURRENCY_DISPLAY->getFullValue(abs($db->f("order_discount"))); ?> </div> </td> </tr> <?php } if( $coupon_discount > 0 || $coupon_discount < 0) { ?> <tr> <td colspan="5"><div align="right"><?php echo $VM_LANG->_PHPSHOP_COUPON_DISCOUNT ?>:</div> </td> <td><div align="right"><?php echo "- ".$CURRENCY_DISPLAY->getFullValue( $coupon_discount ); ?> </div> </td> </tr> <?php } } ?> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_TOTAL_TAX ?>: </div></strong></td> <td width="19%"><div align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($db->f("order_tax")) ?> </div></td> </tr> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_SHIPPING ?>: </div></strong></td> <td width="19%"><div align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($db->f("order_shipping")) ?> </div></td> </tr> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_SHIPPING_TAX ?>: </div></strong></td> <td width="19%"><div align="right"><?php echo $CURRENCY_DISPLAY->getFullValue($db->f("order_shipping_tax")) ?> </div></td> </tr> <?php if( PAYMENT_DISCOUNT_BEFORE != '1') { if ($db->f("order_discount") != 0) { ?> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php if( $db->f("order_discount") > 0) echo $VM_LANG->_PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT; else echo $VM_LANG->_PHPSHOP_FEE; ?>:</strong></div></td> <td width="19%"><div align="right"><?php if ($db->f("order_discount") > 0 ) echo "-" . $CURRENCY_DISPLAY->getFullValue(abs($db->f("order_discount"))); elseif ($db->f("order_discount") < 0 ) echo "+" . $CURRENCY_DISPLAY->getFullValue(abs($db->f("order_discount"))); ?> </div> </td> </tr> <?php } if( $coupon_discount > 0 || $coupon_discount < 0) { ?> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php echo $VM_LANG->_PHPSHOP_COUPON_DISCOUNT ?>:</div></strong> </td> <td><div align="right"><?php echo "- ".$CURRENCY_DISPLAY->getFullValue( $coupon_discount ); ?> </div> </td> </tr> <?php } } ?> <tr> <td width="5%"> </td> <td width="42%"> </td> <td colspan="3"><div align="right"><strong><?php echo $VM_LANG->_PHPSHOP_CART_TOTAL ?>:</div> </strong></td> <td width="19%"><div align="right"><strong><?php echo $CURRENCY_DISPLAY->getFullValue($db->f("order_total")); ?> </div></strong> </td>[/code]now i need to make a script to update the quantety, total price and subtotal all at once to the database,anyone a idea?(PS: for anyone that helps will be placed in the copyright file when the full mod is released.)Regards,Marco Quote Link to comment https://forums.phpfreaks.com/topic/20501-need-help-with-mysql-update-quiry/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.