Example #1
0
 public function processCheckoutForm($data)
 {
     $orderID = $data['order_id'];
     $amount = $data['amount'];
     $order = Order::getByID($orderID);
     // get or make user account
     $u = new User();
     $userExists = $u->isLoggedIn();
     if (!$userExists) {
         $ui = $this->addUserAccount($data);
     } else {
         $ui = UserInfo::getByID($u->getUserID());
     }
     // save user field data
     foreach ($data['akID'] as $key => $value) {
         Field::update($key, $value['value'], 'user');
     }
     // process payment
     $payment_type = $data['payment_type'];
     $payment_method = PaymentMethod::getByHandle($payment_type);
     $charge = $payment_method->process($order, $ui, $data);
     // record payment
     $typeReference = json_encode($charge);
     Payment::add($orderID, $payment_type, $amount, $typeReference);
     // update order status
     $order = Order::getByID($orderID);
     $order->updateStatus('checkout_complete');
     // redirect user to finish page
     return true;
 }
Example #2
0
 public function install()
 {
     // stripe payment fields
     $field = new Field($this->pkg);
     $field->addSet('stripe_payment_settings', 'Stripe Payment Settings');
     $field->add('stripe_mode', 'Stripe Mode', 'select');
     $field->set('stripe_payment_settings');
     $field = new Field($this->pkg);
     $field->getByHandle('stripe_mode');
     $field->selectValue('Testing Mode');
     $field->selectValue('Live Mode');
     $field->add('stripe_test_secret_key', 'Test Secret Key');
     $field->set('stripe_payment_settings');
     $field->add('stripe_test_publishable_key', 'Test Publishable Key');
     $field->set('stripe_payment_settings');
     $field->add('stripe_live_secret_key', 'Live Secret Key');
     $field->set('stripe_payment_settings');
     $field->add('stripe_live_publishable_key', 'Live Publishable Key');
     $field->set('stripe_payment_settings');
     // stripe customer id
     $field = new Field($this->pkg, 'user');
     $field->addSet('stripe_customer', 'Stripe Customer');
     $field->add('stripe_customer_id', 'Stripe Customer ID');
     // checkout settings
     $field = new Field($this->pkg);
     $field->addSet('razor_general_settings', 'Razor General Settings');
     /*
     $field->add( 'collect_customer_addresses', 'Collect Customer Addresses', 'boolean' );
     $field->set( 'razor_general_settings' );
     $field->add( 'enable_anonymous_checkout', 'Enable Anonymous Checkout', 'boolean' );
     $field->set( 'razor_general_settings' );
     */
     $field->add('store_location', 'Store Location');
     $field->set('razor_general_settings');
     // shipping fields
     $shipping = new Shipping();
     $shipping->install_fields();
 }
Example #3
0
 public function save()
 {
     $page = Page::getByPath('/dashboard/razor/payment');
     $this->set('page', $page);
     if (!$this->post()) {
         $this->redirect('/dashboard/razor/payment');
     }
     $data = $this->post();
     foreach ($this->fields as $field) {
         $value = $data['akID'][$field->id];
         Field::update($field->id, $value['value'], 'collection', $page);
     }
     $this->redirect('/dashboard/razor/payment');
 }
Example #4
0
 public function save()
 {
     $sp = Page::getByPath('/dashboard/razor/shipping');
     $this->set('page', $sp);
     // save user field data
     if (!$this->post()) {
         $this->redirect('/dashboard/razor/shipping');
     }
     $data = $this->post();
     foreach ($this->fields as $field) {
         $value = $data['akID'][$field->id];
         Field::update($field->id, $value['value'], 'collection', $sp);
     }
     $this->redirect('/dashboard/razor/shipping');
 }
Example #5
0
 public function get_field()
 {
     $fields = array('first_name', 'last_name', 'phone', 'billing_address', 'shipping_address');
     $fieldJSON = array();
     foreach ($fields as $handle) {
         $field = new Field(false, 'user');
         $fieldJSON[$handle] = $field->getByHandle($handle);
     }
     print json_encode($fieldJSON);
     exit;
 }
Example #6
0
<?php

use Razor\Core\Checkout\Pane\Pane as CheckoutPane;
use Razor\Core\Field\Field;
$pane = CheckoutPane::getByKey('billing');
?>

<div class="row billing-pane">
  <div class="col-xs-12">
    <h3>Billing Address</h3>
    <div class="row">
      <?php 
Field::render('billing_address', 'user');
?>
    </div>
  </div>
</div>
Example #7
0
    </div>

    <div class="form-group">
      <legend>Pickup Shipping</legend>
      <div class="checkbox" style="margin-left: 20px;">
        <?php 
Field::render('enable_pickup_shipping', 'collection', $page->getCollectionID());
?>
      </div>
    </div>

    <div class="form-group">
      <?php 
print $form->label('pickup_shipping_location', 'Pickup Location');
?>
      <?php 
Field::render('pickup_shipping_location', 'collection', $page->getCollectionID());
?>
    </div>

    <div class="ccm-dashboard-form-actions-wrapper">
      <div class="ccm-dashboard-form-actions">
        <?php 
print $form->submit('save_settings', 'Save', array('class' => 'btn btn-success pull-right'));
?>
      </div>
    </div>

  </fieldset>

</form>
Example #8
0
 public function install()
 {
     $field = new Field();
     $field->getByHandle('product_type');
     $field->selectValue('Dynamic Product');
 }
Example #9
0
?>
  </div>

  <div class="col-xs-6">
    <?php 
print $form->label('last_name', 'Last Name');
?>
    <?php 
Field::render('last_name', 'user');
?>
  </div>

  <div class="col-xs-6">
    <?php 
print $form->label('email', 'Email');
?>
    <?php 
print $form->email('email', $uEmail);
?>
  </div>

  <div class="col-xs-6">
    <?php 
print $form->label('phone', 'Phone');
?>
    <?php 
Field::render('phone', 'user');
?>
  </div>
</div>
Example #10
0
 public function install_fields()
 {
     $pkg = Package::getByHandle('razor');
     $field = new Field($pkg);
     $field->addSet('razor_shipping_settings', 'Razor Shipping Settings');
     $field->add('enable_shipping', 'Enable Shipping', 'boolean');
     $field->set('razor_shipping_settings');
     $field->add('enable_flat_rate_shipping', 'Enable Flat Rate Shipping', 'boolean');
     $field->set('razor_shipping_settings');
     $field->add('enable_free_shipping', 'Enable Free Shipping', 'boolean');
     $field->set('razor_shipping_settings');
     $field->add('flat_rate_shipping_cost_per_order', 'Cost Per Order', 'number');
     $field->set('razor_shipping_settings');
     $field->add('free_shipping_minimum_order', 'Minimum Order', 'number');
     $field->set('razor_shipping_settings');
     $field->add('enable_pickup_shipping', 'Enable Pickup Shipping', 'boolean');
     $field->set('razor_shipping_settings');
     $field->add('pickup_shipping_location', 'Pickup Location');
     $field->set('razor_shipping_settings');
 }
Example #11
0
 public function install()
 {
     $field = new Field($this->pkg);
     $field->addSet('product_required', 'Product Required');
     // product type
     $field->add('composer_menu', 'Composer Menu', 'composer_menu');
     $field->set('product_required');
     $field->add('product_type', 'Product Type', 'select');
     $field->set('product_required');
     // virtual
     $field->add('is_virtual', 'Virtual', 'boolean');
     $field->set('product_required');
     // downloadable
     /* $field->add( 'is_downloadable', 'Downloadable', 'boolean' );
        $field->set( 'product_required' ); */
     // prices
     $field->add('price_regular', 'Regular Price', 'number');
     $field->set('product_required');
     // product image
     $field->add('product_image', 'Product Image', 'image_file');
     $field->set('product_required');
     // sku
     $field->add('sku', 'SKU');
     $field->set('product_required');
     // descriptions
     $field->add('summary_description', 'Summary Description', 'textarea', false, array('akTextareaDisplayMode' => 'rich_text'));
     $field->set('product_required');
     $field->add('full_description', 'Full Description', 'textarea', false, array('akTextareaDisplayMode' => 'rich_text'));
     $field->set('product_required');
     // shipping fields
     $field = new Field($this->pkg);
     $field->addSet('product_shipping', 'Shipping');
     // weight
     $field->add('shipping_weight', 'Weight', 'number');
     $field->set('product_shipping');
     // dimensions
     $field->add('shipping_length', 'Length', 'number');
     $field->set('product_shipping');
     $field->add('shipping_width', 'Width', 'number');
     $field->set('product_shipping');
     $field->add('shipping_height', 'Height', 'number');
     $field->set('product_shipping');
     // shipping class
     /*
     $field->add( 'shipping_class', 'Shipping Class', 'select' );
     $field->set( 'product_shipping' );
     $field->getByHandle( 'shipping_class' );
     $field->selectValue( 'No Shipping' );
     $field->selectValue( 'Free Shipping' );
     */
     // downloadable
     /*
     $field = new Field( $this->pkg );
     $field->addSet( 'product_downloadable', 'Product Downloadable' );
     $field->add( 'download_file', 'Download File' );
     $field->set( 'product_downloadable' );
     $field->add( 'download_limit', 'Download Limit', 'number' );
     $field->set( 'product_downloadable' );
     $field->add( 'download_expiry', 'Expiry Date' );
     $field->set( 'product_downloadable' );
     $field->add( 'download_type', 'File Type' );
     $field->set( 'product_downloadable' );
     */
     // sale pricing
     $field = new Field($this->pkg);
     $field->addSet('sale_pricing', 'Product Sale Pricing');
     $field->add('sale_price', 'Sale Price');
     /*
     $field->add( 'sale_price_start', 'Start Date' );
     $field->add( 'sale_price_end', 'End Date' );
     */
     // taxes
     /*
     $field = new Field( $this->pkg );
     $field->addSet( 'taxes', 'Product Taxes' );
     $field->add( 'tax_status', 'Tax Status' );
     $field->add( 'tax_class', 'Tax Class' );
     */
     // catalog fields
     $field = new Field($this->pkg);
     $field->addSet('catalog_basics', 'Catalog Basics');
     $field->add('catalog_image', 'Catalog Image', 'image_file');
     $field->set('catalog_basics');
 }
Example #12
0
?>
        </div>
        <div class="form-group">
          <?php 
print $form->label('stripe_live_secret_key', 'Live Secret Key');
?>
          <?php 
Field::render('stripe_live_secret_key', 'collection', $page->getCollectionID());
?>
        </div>
        <div class="form-group">
          <?php 
print $form->label('stripe_live_publishable_key', 'Live Publishable Key');
?>
          <?php 
Field::render('stripe_live_publishable_key', 'collection', $page->getCollectionID());
?>
        </div>
      </fieldset>

      <div class="ccm-dashboard-form-actions-wrapper">
        <div class="ccm-dashboard-form-actions">
          <?php 
print $form->submit('save_settings', 'Save', array('class' => 'btn btn-primary pull-right'));
?>
        </div>
      </div>

    </form>
  </div>
</div>
Example #13
0
<?php

use Razor\Core\Checkout\Pane\Pane as CheckoutPane;
use Razor\Core\Field\Field;
$form = Core::make('helper/form');
?>

<div class="row shipping-pane">

  <div class="col-xs-12 shipping-address-choice">
    <?php 
print $form->label('shipping_copy_billing', 'Ship to Different Address?');
print $form->checkbox('shipping_copy_billing', 'Ship to Different Address?');
?>
  </div>

  <div class="col-xs-12">
    <div class="shipping-address-form-wrap">
      <h3>Shipping Address</h3>
      <div class="row">
        <?php 
Field::render('shipping_address', 'user');
?>
      </div>
    </div>
  </div>
</div>
Example #14
0
    </div>

    <div class="checkbox" style="margin-left: 20px;">
      <?php 
// Field::render( 'enable_anonymous_checkout', 'collection', $page->getCollectionID() );
?>
    </div>

    -->

    <div style="margin-top: 15px;">
      <?php 
print $form->label('store_location', 'Store Location');
?>
      <?php 
Field::render('store_location', 'collection', $page->getCollectionID());
?>
    </div>

    <div class="ccm-dashboard-form-actions-wrapper">
      <div class="ccm-dashboard-form-actions">
        <?php 
print $form->submit('save_settings', 'Save', array('class' => 'pull-right btn btn-success'));
?>
      </div>
    </div>

  </fieldset>

</form>
 public function add_fields()
 {
     $field = new Field($this->pkg, 'user');
     // customer contact fields
     $field->addSet('customer_contact', 'Customer Contact');
     $field->add('first_name', 'First Name');
     $field->set('customer_contact');
     $field->add('last_name', 'Last Name');
     $field->set('customer_contact');
     $field->add('phone', 'Phone');
     $field->set('customer_contact');
     // customer addresses
     $field->addSet('customer_address', 'Customer Address');
     $field->add('billing_address', 'Billing Address', 'address');
     $field->set('customer_address');
     $field->add('shipping_address', 'Shipping Address', 'address');
     $field->set('customer_address');
     // product fields
     $pfi = new InstallProductFields($this->pkg);
     $pfi->install();
     $pfi->composer();
     // other fields
     $f = new InstallFields($this->pkg);
     $f->install();
 }