### Install Ubercart using Composer Source: https://www.drupal.org/project/ubercart/releases/7.x-3.3 This command installs the Ubercart 7.x-3.9 version using Composer. ```bash composer require 'drupal/ubercart:^3.9' ``` -------------------------------- ### Patch diff example Source: https://www.drupal.org/project/ubercart/issues/2656634 Example of a patch diff showing the expected path for the uc_authorizenet module. ```diff diff --git a/uc_authorizenet.module b/uc_authorizenet.module index c994b54..d6508da 100644 --- a/uc_authorizenet.module +++ b/uc_authorizenet.module ``` ```diff diff --git a/payment/uc_authorizenet/uc_authorizenet.module b/payment/uc_authorizenet/uc_authorizenet.module index c994b54..d6508da 100644 --- a/payment/uc_authorizenet/uc_authorizenet.module +++ b/payment/uc_authorizenet/uc_authorizenet.module ``` -------------------------------- ### Install Ubercart 8.x-4.0-alpha5 Source: https://www.drupal.org/project/ubercart Command to install the alpha version of Ubercart 4.x using Composer. ```bash composer require 'drupal/ubercart:^4.0@alpha' ``` -------------------------------- ### Getting ready to create or apply patches Source: https://www.drupal.org/project/ubercart/git-instructions Updates the local repository with the latest changes from the origin. ```bash git pull origin ``` -------------------------------- ### Patch Command Example Source: https://www.drupal.org/project/ubercart/issues/1192018 Example of how to apply a patch file using the `patch` command. ```bash patch -p1 < xxx.patch ``` -------------------------------- ### SQL Query Example Source: https://www.drupal.org/project/ubercart/issues/1234446 An example of a SQL query that might not work correctly if the SKU has been adjusted by uc_attribute. ```php db_query("SELECT p.nid FROM {uc_products} p WHERE p.model = :sku", array('sku'=>$sku))->fetchField() ``` -------------------------------- ### Accessing Payment Method Plugin Configurations Source: https://www.drupal.org/project/ubercart/issues/2656634 Example of how to access payment method plugin configurations. ```php $configuration = PaymentMethod::load($order->getPaymentMethodId())->getPlugin()->getConfiguration(); ``` -------------------------------- ### Hook implementation example Source: https://www.drupal.org/project/ubercart/issues/1192018 Example of how a module might implement a custom order hook, showing potential naming conflicts. ```php // Invoke it on a per-module basis instead of all at once. foreach (module_list() as $module) { $function = $module .'_order'; if (function_exists($function)) { // $order must be passed by reference. dpm("submit: $function " . $_SESSION['cart_order']); $result = $function('submit', $order, NULL); ``` -------------------------------- ### Proposed Schema Installation Function Source: https://www.drupal.org/project/ubercart/issues/1097668 A suggestion for how the `uc_multicurrency_install` function might be implemented to correctly install the necessary database schema. ```php function uc_multicurrency_install() { drupal_install_schema('uc_product_multicurrency'); } ``` -------------------------------- ### Git Apply Example Source: https://www.drupal.org/project/ubercart/issues/881606 Demonstrates applying a patch file to the 7.x-3.x branch using git. ```bash % git checkout 7.x-3.x Switched to branch '7.x-3.x' % git am 881606-57.uc_paypal-IPN-fixes.patch Applying: Issue #881606 by danrasband, that0n3guy, dww: More fixes for IPN processing. % git log commit d7b1c92a62df65be8056463cda6d8ccddde1b163 Author: Derek Wright Date: Wed May 11 16:08:53 2011 -0500 Issue #881606 by danrasband, that0n3guy, dww: More fixes for IPN processing. ... ``` -------------------------------- ### Comment #17 Fix for Currency Settings Example Source: https://www.drupal.org/project/ubercart/issues/1097668 This code snippet provides a fix for the 'Example field in Currency settings' issue, ensuring it displays the correct currency formatting. ```php case 'amount': if (isset($context['subject']['order'])) { $code = $context['subject']['order']->currency; } elseif (isset($context['currency'])) { $code = $context['currency']; } else { $code = uc_multicurrency_code(); } $options = uc_multicurrency_options($code) + $options; break; ``` -------------------------------- ### Order Status Log Example Source: https://www.drupal.org/project/ubercart/issues/644538 Example log entries showing order status changes and PayPal payment processing. ```log Fri, 2010-12-03 14:29 7143 * Order status changed from In checkout to Pending. Fri, 2010-12-03 14:29 - * PayPal payment for $68 entered by -. Fri, 2010-12-03 14:29 - * Order status changed from Pending to Payment received. ``` -------------------------------- ### Patch File Example Source: https://www.drupal.org/project/ubercart/issues/1876496 This lists the available patch files for the issue, indicating code contributions or fixes. ```text #19| ubercart_add_ordered_product_views_fields-1876496-19.patch| 7.51 KB| DanZ #18| ubercart_add_ordered_product_views_fields-1876496-18.patch| 7.51 KB| DanZ #17| ubercart_add_ordered_product_views_fields-1876496-17.patch| 7.51 KB| DanZ #15| ubercart_add_ordered_product_views_fields-1876496-14.patch| 7.35 KB| DanZ #13| 1876496-order_product_total_price-13.patch| 2.67 KB| longwave #10| order_product_total_price-1876496-10.patch| 4.69 KB| DanZ Show 1 more file ``` -------------------------------- ### Order Comments Log Example Source: https://www.drupal.org/project/ubercart/issues/644538 Example log entries from order comments, including stock level decrease and order creation. ```log 2010.12.03 2:29:46 PM - The stock level for 0019100104-01 has been decreased to 0. 2010.12.03 2:29:46 PM - Order created through website. 2010.12.03 2:29:56 PM - PayPal IPN reported a payment of 68 CAD. ``` -------------------------------- ### Hook output example Source: https://www.drupal.org/project/ubercart/issues/1192018 The output from the dpm() function showing the order of hook calls. ```text submit: date_order 827 submit: uc_credit_order 827 submit: uc_payment_order submit: uc_quote_order submit: uc_affiliate2_order submit: uc_coupon_order submit: uc_recurring_product_order submit: uc_recurring_order submit: uc_taxes_order submit: uc_extra_fields_pane_order submit: uc_googleanalytics_order ``` -------------------------------- ### Example of duplicate email content Source: https://www.drupal.org/project/ubercart/issues/644538 This is an example of the content of the second, duplicate email that the user is receiving, which provides username and password details. ```text **testgirl333,** Thank you for registering at MC. You may now log in by clicking this link or copying and pasting it to your browser: This link can only be used once to log in and will lead you to a page where you can set your password. After setting your password, you will be able to log in at http:///user in the future using: username: testgirl333 password: Your password -- MC team ``` -------------------------------- ### Patching command example with specific file Source: https://www.drupal.org/project/ubercart/issues/644538 Instructions on how to apply a specific patch file to the Ubercart directory. ```bash patch -p1 < 644538-328-duplicate-complete-sale.patch ``` -------------------------------- ### Sample Order Log with PayPal Source: https://www.drupal.org/project/ubercart/issues/590934 A sample log entry illustrating the duplicate email and stock reduction issue when using PayPal. ```log 10/05/2009 4:15:52 PM - The stock level for gear-snug-harness-red-4 has been decreased to 5. 10/05/2009 4:15:52 PM - Order created through website. 10/05/2009 4:15:58 PM - The stock level for gear-snug-harness-red-4 has been decreased to 4. 10/05/2009 4:15:58 PM - PayPal IPN reported a payment of 36.25 USD. ``` -------------------------------- ### Example of desired trigger order Source: https://www.drupal.org/project/ubercart/issues/644538 This code snippet shows the preferred order of trigger pulls to ensure conditional actions are executed in the correct sequence, preventing potential issues. ```php ``` -------------------------------- ### PayPal IPN Array from Express Checkout Source: https://www.drupal.org/project/ubercart/issues/644538 An example of the Instant Payment Notification (IPN) array returned by PayPal when using Express Checkout. This is provided for debugging purposes to understand the data received from PayPal. ```php Array ( [mc_gross] => 4.00 [invoice] => 17-1291900879 [protection_eligibility] => Eligible [address_status] => confirmed [payer_id] => 6EEE4NZTJ6QQN [tax] => 0.00 [address_street] => 1 Main Terrace [payment_date] => 05:21:21 Dec 09, 2010 PST [payment_status] => Completed [charset] => windows-1252 [address_zip] => W12 4LQ [first_name] => Test [mc_fee] => 0.34 [address_country_code] => GB [address_name] => Test User [notify_version] => 3.0 [custom] => [payer_status] => verified [address_country] => United Kingdom [address_city] => Wolverhampton [quantity] => 1 [verify_sign] => A7ZIRsIqq6KUrjeM-Qnnkko3duWnALEFdeZNWWrFyLLg4EeA9JPlicWe [payer_email] => removed@example.com [txn_id] => 35F82042RK2030151 [payment_type] => instant [last_name] => User [address_state] => West Midlands [receiver_email] => removed@example.com [payment_fee] => [receiver_id] => ARP5QRTQR32PJ [txn_type] => express_checkout [item_name] => 1× Classified Advert [mc_currency] => GBP [item_number] => [residence_country] => GB [test_ipn] => 1 [handling_amount] => 0.00 [transaction_subject] => [payment_gross] => [shipping] => 0.00 ) ``` -------------------------------- ### Example of incorrect trigger order Source: https://www.drupal.org/project/ubercart/issues/644538 This code snippet illustrates a scenario where the order of trigger pulls can lead to conditional actions being executed in different orders, potentially causing issues with email receipts and status updates. ```php ``` -------------------------------- ### Setting up repository for the first time Source: https://www.drupal.org/project/ubercart/git-instructions Clones the Ubercart repository and changes the directory to the cloned repository. ```bash git clone https://git.drupalcode.org/project/ubercart.git cd ubercart ``` -------------------------------- ### Incorrect Patch Format Example Source: https://www.drupal.org/project/ubercart/issues/952648 This code block shows the incorrect format of a Drupal patch, which starts with '--- uc_paypal/uc_paypal.module.orig'. ```diff --- uc_paypal/uc_paypal.module.orig 2011-07-30 08:00:20.000000000 +1000 +++ uc_paypal/uc_paypal.module 2011-10-08 16:31:47.000000000 +1100 ``` -------------------------------- ### Correct Patch Format Example Source: https://www.drupal.org/project/ubercart/issues/952648 This code block shows the correct format for a Drupal patch, which should be in -p1 format and rooted at the base Ubercart directory, starting with '--- a/payment/uc_paypal/uc_paypal.module.orig'. ```diff --- a/payment/uc_paypal/uc_paypal.module.orig 2011-07-30 08:00:20.000000000 +1000 +++ b/payment/uc_paypal/uc_paypal.module 2011-10-08 16:31:47.000000000 +1100 ``` -------------------------------- ### Price Revision Table Source: https://www.drupal.org/project/ubercart/issues/449546 A table illustrating the different price revision types and their corresponding values. ```markdown | original value | altered value ---------------------------------------------- numeric | original | altered formatted | formatted-original | formatted themed | themed-original | themed ``` -------------------------------- ### uc_currency_format() call example Source: https://www.drupal.org/project/ubercart/issues/1097668 Example of calling uc_currency_format() with a new parameter for currency. ```php uc_currency_format($order->order_total, TRUE, TRUE, NULL, $order->currency); ``` -------------------------------- ### Corrected usage of theme_uc_product_price() Source: https://www.drupal.org/project/ubercart/issues/449546 This code snippet provides the correct way to use theme_uc_product_price() by passing a context array with specific keys like 'location', 'class', and 'subject', along with an optional 'options' array. ```php $context = array( 'location' => 'product-view', 'class' => array( 'product', 'display', // or 'list, 'cost', or 'sell' ), 'subject' => array( 'node' => $node, 'field' => 'sell_price', // or 'list_price', or 'cost' ), ); ``` ```php $options = array( 'label' => FALSE, ); ``` -------------------------------- ### theme_uc_price() reference example Source: https://www.drupal.org/project/ubercart/issues/1097668 Example of how references to theme_uc_price() can be updated with an extra value. ```php array('#theme' => 'uc_price', '#price' => $shipment->cost, '#currency' => $order->currency) ``` -------------------------------- ### uc_price FAPI element example Source: https://www.drupal.org/project/ubercart/issues/1097668 Example of how a uc_price FAPI element can be updated with a new entry. ```php $form['amount'] = array( '#type' => 'uc_price', ... '#currency' => $order->currency, ); ``` -------------------------------- ### Applying a patch Source: https://www.drupal.org/project/ubercart/git-instructions Applies a downloaded patch file to the working directory. ```bash git apply -v [patchname.patch] ``` -------------------------------- ### Order Notification Example Source: https://www.drupal.org/project/ubercart/issues/1192018 Example of an order notification received by a user. ```text Your Order at ***** ``` -------------------------------- ### User Email Example Source: https://www.drupal.org/project/ubercart/issues/1192018 Example of an email received by a user after a payment. ```text Hello *****, You sent a payment of $0.50 CAD to ******. This charge will appear on your credit card statement as payment to PAYPAL *BILLING. ``` -------------------------------- ### Switching to a different branch Source: https://www.drupal.org/project/ubercart/git-instructions Lists all available branches and tags, then checks out a specified branch. ```bash git branch -a git checkout [branchname] ``` -------------------------------- ### Creating a patch Source: https://www.drupal.org/project/ubercart/git-instructions Generates a patch file based on the changes made in the working directory. ```bash git diff > [description]-[issue-number]-[comment-number].patch ``` -------------------------------- ### Admin Email Example Source: https://www.drupal.org/project/ubercart/issues/1192018 Example of an email received by the administrator regarding a payment. ```text Payment received from ******** ``` -------------------------------- ### Existing hook example Source: https://www.drupal.org/project/ubercart/issues/781720 An example of an existing hook used in Ubercart for payment entered events. ```php module_invoke_all('uc_payment_entered', $order, $method, $amount, $account, $data, $comment); ```