public function actionCreate()
 {
     if (!is_numeric($_POST['amount']) || $_POST['amount'] <= 0) {
         Shop::setFlash(Shop::t('Illegal amount given'));
         $this->redirect(array('//shop/products/view', 'id' => $_POST['product_id']));
     }
     if (isset($_POST['Variations'])) {
         foreach ($_POST['Variations'] as $key => $variation) {
             $specification = ProductSpecification::model()->findByPk($key);
             if ($specification->required && $variation[0] == '') {
                 Shop::setFlash(Shop::t('Please select a {specification}', array('{specification}' => $specification->title)));
                 $this->redirect(array('//shop/products/view', 'id' => $_POST['product_id']));
             }
         }
     }
     $cart = Shop::getCartContent();
     // remove potential clutter
     if (isset($_POST['yt0'])) {
         unset($_POST['yt0']);
     }
     if (isset($_POST['yt1'])) {
         unset($_POST['yt1']);
     }
     $cart[] = $_POST;
     Shop::setCartcontent($cart);
     Shop::setFlash(Shop::t('The product has been added to the shopping cart'));
     $this->redirect(array('//shop/products/index'));
 }
Beispiel #2
0
function getSpecifications($position)
{
    $string = '<table class="specifications">';
    foreach ($position->getSpecifications() as $key => $specification) {
        if ($model = ProductSpecification::model()->findByPk($key)) {
            if ($model->input_type == 'textfield') {
                $title = $model->title;
                $value = $specification[0];
            } else {
                $title = $model->title;
                $productvariation = ProductVariation::model()->findByPk($specification[0]);
                if ($productvariation) {
                    $value = $productvariation->title;
                } else {
                    $value = '';
                }
            }
        } else {
            if ($key == 'image') {
                $title = Shop::t('Filename');
                $value = $specification;
            }
        }
        $string .= sprintf('<tr><td>%s</td><td>%s</td></tr>', @$title, @$value);
    }
    $string .= '</table>';
    return $string;
}
 public function init()
 {
     if ($this->products === null) {
         throw new CException(Shop::t('Please provide a product that can be bought with the ImageUploadWidget'));
     }
     return parent::init();
 }
 public function actionCreate()
 {
     // if some data has been entered before or the user is already logged in,
     // take the already existing data and prefill the input form
     if ($model = Shop::getCustomer()) {
         $address = $model->address;
     } else {
         $model = new Customer();
     }
     if (isset($_POST['Customer'])) {
         $model->attributes = $_POST['Customer'];
         if (isset($_POST['Address'])) {
             $address = new Address();
             $address->attributes = $_POST['Address'];
             if ($address->save()) {
                 $model->address_id = $address->id;
             }
         }
         if (!Yii::app()->user->isGuest) {
             $model->user_id = Yii::app()->user->id;
         }
         $model->validate();
         if (Shop::module()->useWithYum && isset($_POST['register']) && ($_POST['register'] = true)) {
             if (isset($_POST['Customer']['password']) && isset($_POST['Customer']['passwordRepeat'])) {
                 if ($_POST['Customer']['password'] != $_POST['Customer']['passwordRepeat']) {
                     $model->addError('password', Shop::t('Passwords do not match'));
                 } else {
                     if ($_POST['Customer']['password'] == '') {
                         $model->addError('password', Shop::t('Password is empty'));
                     } else {
                         $user = new YumUser();
                         $profile = new YumProfile();
                         $profile->attributes = $_POST['Customer'];
                         $profile->attributes = $_POST['Address'];
                         if ($user->register(strtr($model->email, array('@' => '_', '.' => '_')), $_POST['Customer']['password'], $profile)) {
                             $user->status = YumUser::STATUS_ACTIVE;
                             $user->save(false, array('status'));
                             $model->user_id = $user->id;
                             Shop::setFlash(Shop::t('Successfully registered user'));
                         } else {
                             $model->addErrors($user->getErrors());
                             $model->addErrors($profile->getErrors());
                             Shop::setFlash(Shop::t('Error while registering user'));
                         }
                     }
                 }
             }
         }
         if (!$model->hasErrors()) {
             if ($model->save()) {
                 Yii::app()->user->setState('customer_id', $model->customer_id);
                 $this->redirect(array('//shop/order/create', 'customer' => $model->customer_id));
             }
         }
     }
     $this->render('create', array('customer' => $model, 'address' => isset($address) ? $address : new Address()));
 }
Beispiel #5
0
 public function actionInstall()
 {
     if ($this->module->debug) {
         if (Yii::app()->request->isPostRequest) {
             if ($db = Yii::app()->db) {
             } else {
                 throw new CException(Yii::t('shop', 'Database Connection is not working'));
             }
         } else {
             $this->render('install');
         }
     } else {
         throw new CException(Shop::t('Webshop is not in Debug Mode'));
     }
 }
Beispiel #6
0
        </tr>
<?php 
}
?>
 

 </table>
	</td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td nowrap> <table width="100%" border="0" cellpadding="3" cellspacing="0">
        <tr> 
          <td nowrap width="100%" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Total value');
?>
              <?php 
echo Shop::priceFormat($model->getTotalPrice());
?>
</font></div></td>
        </tr>
        </table></td>
  </tr>
</table>

<br />
<br />
<br />
<?php 
$this->renderPartial(Shop::module()->footerView);
Beispiel #7
0
        $this->renderPartial('position', array('position' => $position));
    }
}
die("jo");
?>

<div style="clear:both;"> </div>

<ul class="buttons">
<li> <?php 
echo CHtml::link(Shop::t('Update order status'), array('//shop/order/update', 'id' => $model->order_id));
?>
 </li>

<li> <?php 
echo CHtml::link(Shop::t('Delivery slip'), array('//shop/order/slip', 'id' => $model->order_id));
?>
  </li>

<li> <?php 
echo CHtml::link(Shop::t('Invoice'), array('//shop/order/invoice', 'id' => $model->order_id));
?>
  </li>

<li> <?php 
echo CHtml::link(Shop::t('Back to Orders'), array('//shop/order/admin'));
?>
  </li>

</ul>
Beispiel #8
0
            echo ' <span class="required">*</span>';
        }
        echo '<br />';
        if ($variation[0]->specification->input_type == 'textfield') {
            echo CHtml::textField($field);
        } else {
            if ($variation[0]->specification->input_type == 'select') {
                // If the specification is required, preselect the first field. Otherwise
                // let the customer choose which one to pick
                echo CHtml::radioButtonList($field, $variation[0]->specification->required ? $variation[0]->id : null, ProductVariation::listData($variation));
            } else {
                if ($variation[0]->specification->input_type == 'image') {
                    echo CHtml::fileField($field);
                }
            }
        }
        echo '</div>';
        if ($i % 2 == 0) {
            echo '<div style="clear: both;"></div>';
        }
    }
}
echo '<div style="clear: both;"></div>';
echo '<br />';
echo CHtml::hiddenField('product_id', $model->product_id);
echo CHtml::label(Shop::t('Amount'), 'ShoppingCart_amount');
echo ': ';
echo CHtml::textField('amount', 1, array('size' => 3));
echo '<br />';
echo CHtml::submitButton(Shop::t('Add to shopping Cart'), array('class' => 'btn-add-cart'));
echo CHtml::endForm();
Beispiel #9
0
<?php

$this->breadcrumbs = array(Shop::t('Payment Methods') => array('index'), $model->title => array('view', 'id' => $model->id), Shop::t('Update'));
$this->menu = array(array('label' => 'Create PaymentMethod', 'url' => array('create')), array('label' => 'View PaymentMethod', 'url' => array('view', 'id' => $model->id)), array('label' => 'Manage PaymentMethod', 'url' => array('admin')));
?>

<h2><?php 
echo $model->title;
?>
</h2>

<?php 
echo $this->renderPartial('_form', array('model' => $model));
 public function init()
 {
     $this->title = Shop::t('Product Categories');
     return parent::init();
 }
Beispiel #11
0
<?php

if (!isset($hideEmail)) {
    echo '<h3>' . Shop::t('Customer information') . '</h3>';
    $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('email', 'phone')));
}
if ($model->address && !isset($hideAddress)) {
    echo '<h3>' . Shop::t('Address') . '</h3>';
    $this->widget('zii.widgets.CDetailView', array('data' => $model->address, 'attributes' => array('title', 'firstname', 'lastname', 'street', 'zipcode', 'city', 'country')));
}
if (Yii::app()->controller->id == 'customer') {
    echo CHtml::link(Shop::t('Update customer data'), array('//shop/customer/update'));
}
echo '<div class="box-delivery-address">';
echo '<h3>' . Shop::t('Delivery address') . '</h3>';
$this->widget('zii.widgets.CDetailView', array('data' => $model->deliveryAddress ? $model->deliveryAddress : $model->address, 'attributes' => array('title', 'firstname', 'lastname', 'street', 'zipcode', 'city', 'country')));
if (Yii::app()->controller->id == 'order') {
    echo CHtml::link(Shop::t('Delivery address') . ' ' . Shop::t('Edit'), array('//shop/shippingMethod/choose', 'order' => true));
}
echo '</div>';
echo '<div class="box-billing-address">';
echo '<h3>' . Shop::t('Billing address') . '</h3>';
$this->widget('zii.widgets.CDetailView', array('data' => $model->billingAddress ? $model->billingAddress : $model->address, 'attributes' => array('title', 'firstname', 'lastname', 'street', 'zipcode', 'city', 'country')));
if (Yii::app()->controller->id == 'order') {
    echo CHtml::link(Shop::t('Billing address') . ' ' . Shop::t('Edit'), array('//shop/paymentMethod/choose', 'order' => true));
}
echo '</div>';
echo '<div class="clear"></div>';
Beispiel #12
0
<?php

$this->breadcrumbs = array(Shop::t('Products') => array('index'), $model->title => array('view', 'id' => $model->product_id), Shop::t('Update'));
?>

<h2> <?php 
echo $model->title;
?>
</h2>

<?php 
echo $this->renderPartial('_form', array('model' => $model));
?>

Beispiel #13
0
$this->breadcrumbs = array(Shop::t('Product Specifications') => array('admin'), $model->title);
$this->menu = array(array('label' => Shop::t('Create Product specification'), 'url' => array('create')), array('label' => Shop::t('Update Product specification'), 'url' => array('update', 'id' => $model->id)), array('label' => Shop::t('Delete Product specification'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => Shop::t('Are you sure you want to delete this product specification?'))), array('label' => Shop::t('Manage Product specifications'), 'url' => array('admin')));
?>

<h2> <?php 
echo Shop::t('Product specification');
?>
 <?php 
echo $model->title;
?>
</h2>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'title', 'input_type', 'required')));
?>

<h2> <?php 
echo Shop::t('Variations of this specification');
?>
 </h2>

<?php 
if ($model->variations) {
    echo '<ul>';
    foreach ($model->variations as $variation) {
        printf('<li>%s: %s</li>', CHtml::link($variation->product->title, array('//shop/products/view', 'id' => $variation->product_id)), $variation->title);
    }
    echo '</ul>';
} else {
    echo Shop::t('This specification is not used in any product variation yet');
}
Beispiel #14
0
 public function attributeLabels()
 {
     return array('order_id' => Shop::t('Order number'), 'customer_id' => Shop::t('Customer number'), 'ordering_date' => Shop::t('Ordering Date'), 'ordering_done' => Shop::t('Ordering Done'), 'ordering_confirmed' => Shop::t('Ordering Confirmed'));
 }
Beispiel #15
0
 /**
  * @return array customized attribute labels (name=>label)
  */
 public function attributeLabels()
 {
     return array('id' => 'ID', 'firstname' => Yii::t('ShopModule.shop', 'Firstname'), 'lastname' => Yii::t('ShopModule.shop', 'Lastname'), 'street' => Shop::t('Street'), 'zipcode' => Shop::t('Zipcode'), 'city' => Shop::t('City'), 'country' => Shop::t('Country'));
 }
Beispiel #16
0
<?php

$points = array(Shop::t('Customer information'), Shop::t('Shipping'), Shop::t('Payment'), Shop::t('Confirm'), Shop::t('Success'));
$links = array(array('//shop/customer/create'), array('//shop/shippingMethod/choose'), array('//shop/paymentMethod/choose'), array('//shop/order/create'));
echo '<div id="waypointarea" class="waypointarea">';
printf('<span class="waypoint %s">%s</span>', $point == 0 ? 'active' : '', CHtml::link(Shop::t('Shopping Cart'), array('//shop/shoppingCart/view')));
foreach ($points as $p => $pointText) {
    printf('<span class="waypoint%s">%s</span>', $point == ++$p ? ' active' : '', $point < ++$p ? $pointText : CHtml::link($pointText, @$links[$p - 2]));
}
echo '</div>';
Beispiel #17
0
 /**
  * @return array customized attribute labels (name=>label)
  */
 public function attributeLabels()
 {
     return array('id' => Shop::t('ID'), 'title' => Shop::t('Title'), 'description' => Shop::t('Description'), 'tax_id' => Shop::t('Tax'), 'price' => Shop::t('Price'));
 }
Beispiel #18
0
				<td>1</td>
				<td>%s</td>
				<td></td>
				<td class="text-right shipping_costs">%s</td>
				<td class="text-right shipping_costs">%s</td>
				<td>%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->getPrice()), Shop::priceFormat($shippingMethod->getPrice()), CHtml::link(Shop::t('edit'), array('//shop/shippingMethod/choose')));
    }
    echo '<tr>
<td class="text-right no-border" colspan="6">
<p class="price_total">' . Shop::getPriceTotal() . '</p></td>
<td class="no-border"></td></tr>';
    echo '</table>';
    ?>

<?php 
    if (Yii::app()->controller->id != 'order') {
        echo '<div class="buttons">';
        echo CHtml::link(Shop::t('Buy additional Products'), array('//shop/products'), array('class' => 'btn-previous'));
        echo CHtml::link(Shop::t('Buy this products'), array('//shop/order/create'), array('class' => 'btn-next'));
        echo '</div>';
    }
    ?>
<div class="clear"></div>

<?php 
} else {
    echo Shop::t('Your shopping cart is empty');
}
?>

Beispiel #19
0
<?php

$this->breadcrumbs = array('Product Specifications' => array('admin'), 'Manage');
$this->menu = array(array('label' => Shop::t('Specifications'), 'url' => array('admin')), array('label' => Shop::t('New Specification'), 'url' => array('create')));
?>

<h2><?php 
echo Shop::t('Manage Product Specifications');
?>
</h2>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'product-specification-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('title', 'input_type', array('name' => 'required', 'value' => '$data->required ? Shop::t("Yes") : Shop::t("No")'), array('class' => 'CButtonColumn'))));
Beispiel #20
0
<?php

$this->breadcrumbs = array(Shop::t('Payment Methods') => array('index'), Shop::t('Manage'));
?>

<h2><?php 
echo Shop::t('Manage Payment Methods');
?>
</h2>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'payment-method-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'title', 'description', 'tax_id', 'price', array('class' => 'CButtonColumn'))));
Beispiel #21
0
    echo $form->passwordField($customer, 'passwordRepeat', array('size' => 45, 'maxlength' => 45));
    ?>
		<?php 
    echo $form->error($customer, 'passwordRepeat');
    ?>
	</div>
	</div>

	<?php 
    Yii::app()->clientScript->registerScript('registration', "\r\n\t\t\t\$('#register').click(function() { \r\n\t\t\t\t\$('.registration').toggle(500);\r\n\t\t\t\t});\r\n\t\t\t");
    ?>


	<?php 
}
?>

	<div style="clear: both;"> </div>

	<div class="row buttons">
	<?php 
echo CHtml::submitButton($customer->isNewRecord ? Shop::t('Register') : Shop::t('Save'), array('id' => 'next'));
?>
	</div>

<?php 
$this->endWidget();
?>

</div><!-- form -->
Beispiel #22
0
<?php

$model = new Products();
$this->widget('zii.widgets.grid.CGridView', array('id' => 'products-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('title', 'price', array('class' => 'CButtonColumn', 'template' => '{view}{update}{delete}{images}', 'viewButtonUrl' => 'Yii::app()->createUrl("/shop/products/view",
			array("id" => $data->product_id))', 'updateButtonUrl' => 'Yii::app()->createUrl("/shop/products/update",
			array("id" => $data->product_id))', 'deleteButtonUrl' => 'Yii::app()->createUrl("/shop/products/delete",
			array("id" => $data->product_id))', 'buttons' => array('images' => array('label' => Yii::t('ShopModule.shop', 'images'), 'url' => 'Yii::app()->createUrl("/shop/image/admin",
					array("product_id" => $data->product_id))'))))));
echo CHtml::link(Shop::t('Create a new Product'), array('products/create'));
Beispiel #23
0
 public function attributeLabels()
 {
     $labels = array('tax_id' => Shop::t('Tax'), 'product_id' => Shop::t('Product'), 'title' => Shop::t('Title'), 'description' => Shop::t('Description'), 'price' => Shop::t('Price'), 'category_id' => Shop::t('Category'));
     if (Shop::module()->useWithYum && Yii::app()->user->isAdmin()) {
         $labels['price'] = Shop::t('Price (net)');
     }
     return $labels;
 }
Beispiel #24
0
<?php

$this->breadcrumbs = array(Shop::t('Payment Methods') => array('index'), Shop::t('Create'));
$this->menu = array(array('label' => Shop::t('Manage Payment Methods'), 'url' => array('admin')));
?>

<h2> <?php 
echo Shop::t('Create Payment method');
?>
</h2>

<?php 
echo $this->renderPartial('_form', array('model' => $model));
Beispiel #25
0
 /**
  * @return array customized attribute labels (name=>label)
  */
 public function attributeLabels()
 {
     return array('id' => 'ID', 'order_id' => Shop::t('Order'), 'product_id' => Shop::t('Product'), 'amount' => Shop::t('Amount'), 'specifications' => Shop::t('Specifications'));
 }
Beispiel #26
0
</strong></font></td>
  </tr>
  <tr>
    <td>
	<table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="f1f1f1">
        <tr> 
          <td colspan="2" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Amount');
?>
</font></strong></div></td>
          <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Product');
?>
</font></strong></td>
		  <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Product number');
?>
</font></strong></td>
        </tr>
<?php 
foreach ($model->products as $position) {
    ?>
        <tr> 
          <td width="20" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php 
    echo $position->amount;
    ?>
</font></div></td>
          <td width="20" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">x</font></div></td>
          <td style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><?php 
    echo $position->product->title;
    ?>
Beispiel #27
0
<div id="shopping-cart">
<div id="shopping-cart-content">
<?php 
if ($products) {
    echo '<h3>' . CHtml::link(Shop::t('Shopping cart'), array('//shop/shoppingCart/view')) . '</h3>';
    echo '<table cellpadding="0" cellspacing="0">';
    foreach ($products as $num => $position) {
        $model = Products::model()->findByPk($position['product_id']);
        printf('<tr>
				<td class="cart-left widget_amount_' . $num . '">%s</td>
				<td class="cart-middle">%s</td>
				<td class="cart-right price_' . $num . '">%s</td></tr>', $position['amount'], $model->title, Shop::priceFormat($position['amount'] * $model->getPrice(@$position['Variations'])));
    }
    if ($shippingMethod = Shop::getShippingMethod()) {
        printf('<tr>
				<td class="cart-left">1</td>
				<td class="cart-middle">%s</td>
				<td class="cart-right">%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->price));
    }
    printf('<tr>
			<td colspan="3" class="cart-right cart-sum price_total"><strong>%s</strong></td>
			</tr>', Shop::getPriceTotal());
    echo '</table>';
}
?>
</div>
<div id="shopping-cart-footer"></div>
</div>
Beispiel #28
0
<?php

if (!isset($this->breadcrumbs)) {
    $this->breadcrumbs = array('Shipping Methods' => array('index'), $model->title);
}
if (!isset($this->menu)) {
    $this->menu = array(array('label' => 'List ShippingMethod', 'url' => array('index')), array('label' => 'Create ShippingMethod', 'url' => array('create')), array('label' => 'Update ShippingMethod', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete ShippingMethod', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage ShippingMethod', 'url' => array('admin')));
}
?>

<h2> <?php 
echo Shop::t('Shipping method');
?>
</h2>

<?php 
if ($model) {
    $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('title', 'description', 'price')));
}
Beispiel #29
0
?>
	
</div>

<div class="product-options"> 
	<?php 
$this->renderPartial('/products/addToCart', array('model' => $model));
?>
</div>


<div class="product-description">
	<p> <?php 
echo $model->description;
?>
 </p>
</div>


<?php 
$specs = $model->getSpecifications();
if ($specs) {
    echo '<table>';
    printf('<tr><td colspan="2"><strong>%s</strong></td></tr>', Shop::t('Product Specifications'));
    foreach ($specs as $key => $spec) {
        if ($spec != '') {
            printf('<tr> <td> %s: </td> <td> %s </td> </td>', $key, $spec);
        }
    }
    echo '</table>';
}
Beispiel #30
0
<?php 
$i = 0;
foreach (ShippingMethod::model()->findAll() as $method) {
    echo '<div class="row">';
    echo CHtml::radioButton("ShippingMethod", $i == 0, array('value' => $method->id));
    echo '<div class="float-left">';
    echo CHtml::label($method->title, 'ShippingMethod');
    echo CHtml::tag('p', array(), $method->description);
    echo CHtml::tag('p', array(), Shop::t('Price: ') . Shop::priceFormat($method->price));
    echo '</div>';
    echo '</div>';
    echo '<div class="clear"></div>';
    $i++;
}
?>

	

<?php 
Yii::app()->clientScript->registerScript('toggle', "\n\tif(\$('#toggle_delivery').attr('checked'))\n\t\t\$('#delivery_information').show();\n\t\$('#toggle_delivery').click(function() { \n\t\t\$('#delivery_information').toggle(500);\n\t});\n");
?>

    <div class="row buttons">
		<?php 
echo CHtml::submitButton(Shop::t('Continue'), array('id' => 'next'));
?>
	</div>
</div>
<?php 
$this->endWidget();