User Tools

Site Tools


public:cs-cart

This is an old revision of the document!


Design

Cache

Clear the cache in v4 by appending ?ctpl&cc to the admin.php URI.

Template Override

Suggested way for overriding an entire template is to edit the original, putting a hook around the entire thing. Then override the hook.

Code / Addons

Database

table cscart_payment_processors

  processor_id        int
  processor           string
  processor_script    string
  processor_template  string
  admin_template      string
  callback            char default 'N' -- not used
  type                char default 'P'

Codes

Areas:
  'C' client
  'A' admin

notifications:
  'C' customer
  'A' department
  'V' vendor

Front End / Javascript

var/themes_repository/basic/templates/common/scripts.tpl
  includes the core javascript libraries
  executes $.runCart('C'), defined in js/tygh/core.js

js/tygh/core.js
  defines the Tygh object
  Tygh is generally passed as _
  assigns document to _.doc
  extends jquery
  $.runCart():
    attaches click, mousedown, keyup, keydown, and change events to $(_.doc)

Addon Development Notes

For each parameter in the callback url, verify that it is correct for the stored order.

// paypal.php
$account_type = fn_validate_email($processor_data['processor_params']['account']) ? 'receiver_email' : 'receiver_id';
if ($_REQUEST[$account_type] != $processor_data['processor_params']['account']) {
    $pp_response['order_status'] = $paypal_statuses['denied'];
    $pp_response['reason_text'] = __('paypal_security_error');
    fn_finish_payment($_REQUEST['order_id'], $pp_response);
    exit;
}

Payment Processing Integration Notes

payment_processors table is queried from functions (incomplete list):

  app/functions/fn.cart.php fn_get_payment_methods
  app/functions/fn.cart.php fn_get_checkout_payment_buttons
    creates empty array $checkout_buttons
    "include"s each payment processor's processor_script
    returns $checkout_buttons
    amazon and google payment methods populate $checkout_buttons

definitions

BOOTSTRAP

PAYMENT_NOTIFICATION

variables

$_payment_id

$processor_data['processor_params']

$cart

$checkout_buttons[$_payment_id]

main payment functions

fn_cart_is_empty(cart)

fn_finish_payment(order_id, pp_response)

pp_response - dictionary pp_response['order_status'] - 'P' for placed, 'F' for failed (?) pp_response['reason_text'] - reason for failure

fn_order_placement_routines

other payment functions

fn_check_payment_script

fn_change_order_status

'N' canceled?
'O' open
'I' canceled?
'F'

fn_get_order_info

fn_get_processor_data

fn_get_payment_method_data

other functions

fn_flush()

fn_set_notification()

fn_url()

fn_format_price()

public/cs-cart.1392605479.txt.gz · Last modified: 2014/02/17 02:51 by squires

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki