danjapro Posted March 27, 2012 Share Posted March 27, 2012 This is my order form that produce my coupon code and stores it in DB. I can get all my fields but this field line 198 If you look at the entire code. I am gathering all the information form the order, but this setAssignedOrderId is placeing the value 1 in DB table field. $externalCoupon->setAssignedOrderId($couponeOrderId); private function getExternalCoupon($extCouponKey) { // Used to Set the Date Purchased of the coupon, the datetime rightnow // Also, gather the Order Id to join with coupon // MG 032012. added these features // $couponeOrderId = $coupon->setCodeType($externalCoupon->getOrderId()); $coupon = Mage::getModel('coupon/coupon'); $couponeOrderId = $this->generateCoupons($coupon->getOrderId()); $rightNow = date('Y-m-d H:i:s', strtotime(Mage::getSingleton('core/date')->gmtDate()) + Mage::getSingleton('core/date')->getGmtOffset()); // load external available coupon, limit 1, where the key matches $externalCoupons = Mage::getModel("coupon/external_coupon") ->getCollection() ->addFieldToFilter('coupon_code_group_key', array("eq" => $extCouponKey)) ->addFieldToFilter('code_status', array("eq" => 'AVAIL')) //->addFieldToFilter('used_dt', array("eq" => '')) //->addFieldToFilter('assigned_order_id', array("eq" => '')) ->setPageSize(1) ->setCurPage(1); $externalCoupon = $externalCoupons->getFirstItem(); Mage::log("Loaded external coupon for use: " . $externalCoupon->getCouponCode()); // mark external coupon as used and save //MG 03-2012. added the Order ID and the Date Used to added to DB $externalCoupon->setCodeStatus('USED'); $externalCoupon->setUsedDt($rightNow); $externalCoupon->setAssignedOrderId($couponeOrderId); //echo 'Coupon Id here:' . $externalCoupon->setOrderId($item->getOrderId()); $externalCoupon->save(); return $externalCoupon; } Link to comment https://forums.phpfreaks.com/topic/259775-how-to-get-my-seassignedorderid/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.