این کد فایلشه میشه برام تغییر بدین و بزارین تو همین پست ؟؟ status_pending) and $method->status_pending!="") { return $method->status_pending; } else { return 'P'; } } /** * Display stored payment data for an order * */ function plgVmOnShowOrderBEPayment ($virtuemart_order_id, $virtuemart_payment_id) { if (!$this->selectedThisByMethodId ($virtuemart_payment_id)) { return NULL; // Another method was selected, do nothing } if (!($paymentTable = $this->getDataByOrderId ($virtuemart_order_id))) { return NULL; } VmConfig::loadJLang('com_virtuemart'); $html = '[TABLE=class: adminlist table]
' . "\n"; $html .= $this->getHtmlHeaderBE (); $html .= $this->getHtmlRowBE ('COM_VIRTUEMART_PAYMENT_NAME', $paymentTable->payment_name); $html .= $this->getHtmlRowBE ('mellat_PAYMENT_TOTAL_CURRENCY', $paymentTable->payment_order_total . ' ' . $paymentTable->payment_currency); if ($paymentTable->email_currency) { $html .= $this->getHtmlRowBE ('mellat_EMAIL_CURRENCY', $paymentTable->email_currency ); } $html .= '[/TABLE]
' . "\n"; return $html; } /* function getCosts (VirtueMartCart $cart, $method, $cart_prices) { if (preg_match ('/%$/', $method->cost_percent_total)) { $cost_percent_total = substr ($method->cost_percent_total, 0, -1); } else { $cost_percent_total = $method->cost_percent_total; } return ($method->cost_per_transaction + ($cart_prices['salesPrice'] * $cost_percent_total * 0.01)); } */ /** * Check if the payment conditions are fulfilled for this payment method * * @author: Valerie Isaksen * * @param $cart_prices: cart prices * @param $payment * @return true: if the conditions are fulfilled, false otherwise * */ protected function checkConditions ($cart, $method, $cart_prices) { $this->convert_condition_amount($method); $amount = $this->getCartAmount($cart_prices); $address = (($cart->ST == 0) ? $cart->BT : $cart->ST); //vmdebug('mellat checkConditions', $amount, $cart_prices['salesPrice'], $cart_prices['salesPriceCoupon']); $amount_cond = ($amount >= $method->min_amount AND $amount max_amount OR ($method->min_amount max_amount == 0))); if (!$amount_cond) { return FALSE; } $countries = array(); if (!empty($method->countries)) { if (!is_array ($method->countries)) { $countries[0] = $method->countries; } else { $countries = $method->countries; } } // probably did not gave his BT:ST address if (!is_array ($address)) { $address = array(); $address['virtuemart_country_id'] = 0; } if (!isset($address['virtuemart_country_id'])) { $address['virtuemart_country_id'] = 0; } if (count ($countries) == 0 || in_array ($address['virtuemart_country_id'], $countries) ) { return TRUE; } return FALSE; } /* * We must reimplement this triggers for joomla 1.7 */ /** * Create the table for this plugin if it does not yet exist. * This functions checks if the called plugin is active one. * When yes it is calling the mellat method to create the tables * * @author Valérie Isaksen * */ function plgVmOnStoreInstallPaymentPluginTable ($jplugin_id) { return $this->onStoreInstallPluginTable ($jplugin_id); } /** * This event is fired after the payment method has been selected. It can be used to store * additional payment info in the cart. * * @author Max Milbers * @author Valérie isaksen * * @param VirtueMartCart $cart: the actual cart * @return null if the payment was not selected, true if the data is valid, error message if the data is not vlaid * */ public function plgVmOnSelectCheckPayment (VirtueMartCart $cart, &$msg) { return $this->OnSelectCheck ($cart); } /** * plgVmDisplayListFEPayment * This event is fired to display the pluginmethods in the cart (edit shipment/payment) for exampel * * @param object $cart Cart object * @param integer $selected ID of the method selected * @return boolean True on succes, false on failures, null when this plugin was not selected. * On errors, JError::raiseWarning (or JError::raiseError) must be used to set a message. * * @author Valerie Isaksen * @author Max Milbers */ public function plgVmDisplayListFEPayment (VirtueMartCart $cart, $selected = 0, &$htmlIn) { return $this->displayListFE ($cart, $selected, $htmlIn); } /* * plgVmonSelectedCalculatePricePayment * Calculate the price (value, tax_id) of the selected method * It is called by the calculator * This function does NOT to be reimplemented. If not reimplemented, then the default values from this function are taken. * @author Valerie Isaksen * @cart: VirtueMartCart the current cart * @cart_prices: array the new cart prices * @return null if the method was not selected, false if the shiiping rate is not valid any more, true otherwise * * */ public function plgVmonSelectedCalculatePricePayment (VirtueMartCart $cart, array &$cart_prices, &$cart_prices_name) { return $this->onSelectedCalculatePrice ($cart, $cart_prices, $cart_prices_name); } function plgVmgetPaymentCurrency ($virtuemart_paymentmethod_id, &$paymentCurrencyId) { if (!($method = $this->getVmPluginMethod ($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement ($method->payment_element)) { return FALSE; } $this->getPaymentCurrency ($method); $paymentCurrencyId = $method->payment_currency; return; } /** * plgVmOnCheckAutomaticSelectedPayment * Checks how many plugins are available. If only one, the user will not have the choice. Enter edit_xxx page * The plugin must check first if it is the correct type * * @author Valerie Isaksen * @param VirtueMartCart cart: the cart object * @return null if no plugin was found, 0 if more then one plugin was found, virtuemart_xxx_id if only one plugin is found * */ function plgVmOnCheckAutomaticSelectedPayment (VirtueMartCart $cart, array $cart_prices = array(), &$paymentCounter) { return $this->onCheckAutomaticSelected ($cart, $cart_prices, $paymentCounter); } /** * This method is fired when showing the order details in the frontend. * It displays the method-specific data. * * @param integer $order_id The order ID * @return mixed Null for methods that aren't active, text (HTML) otherwise * @author Max Milbers * @author Valerie Isaksen */ public function plgVmOnShowOrderFEPayment ($virtuemart_order_id, $virtuemart_paymentmethod_id, &$payment_name) { $this->onShowOrderFE ($virtuemart_order_id, $virtuemart_paymentmethod_id, $payment_name); } /** * @param $orderDetails * @param $data * @return null */ function plgVmOnUserInvoice ($orderDetails, &$data) { if (!($method = $this->getVmPluginMethod ($orderDetails['virtuemart_paymentmethod_id']))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement ($method->payment_element)) { return NULL; } //vmdebug('plgVmOnUserInvoice',$orderDetails, $method); if (!isset($method->send_invoice_on_order_null) or $method->send_invoice_on_order_null==1 or $orderDetails['order_total'] > 0.00){ return NULL; } if ($orderDetails['order_salesPrice']==0.00) { $data['invoice_number'] = 'reservedByPayment_' . $orderDetails['order_number']; // Nerver send the invoice via email } } /** * @param $virtuemart_paymentmethod_id * @param $paymentCurrencyId * @return bool|null */ function plgVmgetEmailCurrency($virtuemart_paymentmethod_id, $virtuemart_order_id, &$emailCurrencyId) { if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) { return NULL; // Another method was selected, do nothing } if (!$this->selectedThisElement($method->payment_element)) { return FALSE; } if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) { // JError::raiseWarning(500, $db->getErrorMsg()); return ''; } if (empty($payments[0]->email_currency)) { $vendorId = 1; //VirtueMartModelVendor::getLoggedVendor(); $db = JFactory::getDBO(); $q = 'SELECT `vendor_currency` FROM `#__virtuemart_vendors` WHERE `virtuemart_vendor_id`=' . $vendorId; $db->setQuery($q); $emailCurrencyId = $db->loadResult(); } else { $emailCurrencyId = $payments[0]->email_currency; } } /** * This event is fired during the checkout process. It can be used to validate the * method data as entered by the user. * * @return boolean True when the data was valid, false otherwise. If the plugin is not activated, it should return null. * @author Max Milbers public function plgVmOnCheckoutCheckDataPayment( VirtueMartCart $cart) { return null; } */ /** * This method is fired when showing when priting an Order * It displays the the payment method-specific data. * * @param integer $_virtuemart_order_id The order ID * @param integer $method_id method used for this order * @return mixed Null when for payment methods that were not selected, text (HTML) otherwise * @author Valerie Isaksen */ function plgVmonShowOrderPrintPayment ($order_number, $method_id) { return $this->onShowOrderPrint ($order_number, $method_id); } function plgVmDeclarePluginParamsPaymentVM3( &$data) { return $this->declarePluginParams('payment', $data); } function plgVmSetOnTablePluginParamsPayment ($name, $id, &$table) { return $this->setOnTablePluginParams ($name, $id, $table); } } // No closing tag