Version Notes
Implemented "set order date" on checkout. With this the date of the order can be set by the customer.
Implemented possibility to create bulk orders using a list of SKUs. The optioin is added to the "My Account" section of the shop frontend.
Now xmlrpc api is working when extension is enabled.
Download this release
Release Info
Developer | Sitewards Magento Team |
Extension | Sitewards_B2BProfessional |
Version | 2.5.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.5.0
- app/code/community/Sitewards/B2BProfessional/Block/Adminhtml/Order.php +19 -0
- app/code/community/Sitewards/B2BProfessional/Block/Order.php +47 -0
- app/code/community/Sitewards/B2BProfessional/Block/Order/Form.php +12 -0
- app/code/community/Sitewards/B2BProfessional/Helper/Data.php +7 -0
- app/code/community/Sitewards/B2BProfessional/Model/Observer.php +123 -10
- app/code/community/Sitewards/B2BProfessional/Model/Order.php +39 -0
- app/code/community/Sitewards/B2BProfessional/Model/Quote.php +24 -0
- app/code/community/Sitewards/B2BProfessional/Model/Resource/Order.php +46 -0
- app/code/community/Sitewards/B2BProfessional/Model/Resource/Order/Collection.php +8 -0
- app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote.php +37 -0
- app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote/Collection.php +8 -0
- app/code/community/Sitewards/B2BProfessional/controllers/CartController.php +87 -38
- app/code/community/Sitewards/B2BProfessional/controllers/OrderController.php +45 -0
- app/code/community/Sitewards/B2BProfessional/controllers/ProductController.php +82 -0
- app/code/community/Sitewards/B2BProfessional/etc/config.xml +104 -5
- app/code/community/Sitewards/B2BProfessional/sql/sitewards_b2bprofessional/upgrade-2.3.0-2.4.0.php +20 -0
- app/design/adminhtml/default/default/layout/sitewards/b2bprofessional.xml +13 -0
- app/design/adminhtml/default/default/template/sitewards/b2bprofessional/order.phtml +22 -0
- app/design/adminhtml/default/default/template/sitewards/b2bprofessional/sales/order/info.phtml +2 -0
- app/design/frontend/base/default/layout/sitewards/b2bprofessional.xml +77 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/checkbox.phtml +34 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/multi.phtml +31 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/radio.phtml +47 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/select.phtml +37 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/checkout/billing/extra.phtml +31 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/order.phtml +21 -0
- app/design/frontend/base/default/template/sitewards/b2bprofessional/order/form.phtml +37 -0
- app/locale/de_DE/Sitewards_B2BProfessional.csv +13 -2
- app/locale/en_US/Sitewards_B2BProfessional.csv +3 -1
- js/sitewards/b2bprofessional.js +358 -0
- package.xml +9 -6
- skin/frontend/base/default/css/sitewards/b2bprofessional.css +22 -0
- skin/frontend/base/default/images/sitewards/loading.gif +0 -0
app/code/community/Sitewards/B2BProfessional/Block/Adminhtml/Order.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitewards_B2BProfessional_Block_Adminhtml_Order
|
4 |
+
*
|
5 |
+
* @category Sitewards
|
6 |
+
* @package Sitewards_B2BProfessional
|
7 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
8 |
+
*/
|
9 |
+
class Sitewards_B2BProfessional_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Sales_Order_Abstract {
|
10 |
+
/**
|
11 |
+
* @return array
|
12 |
+
*/
|
13 |
+
public function getB2BProfessionalVars () {
|
14 |
+
$oModel = Mage::getModel('b2bprofessional/order');
|
15 |
+
return $oModel->getByOrder(
|
16 |
+
$this->getOrder()
|
17 |
+
->getId());
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Block/Order.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitewards_B2BProfessional_Block_Order
|
4 |
+
*
|
5 |
+
* @category Sitewards
|
6 |
+
* @package Sitewards_B2BProfessional
|
7 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
8 |
+
*/
|
9 |
+
class Sitewards_B2BProfessional_Block_Order extends Mage_Core_Block_Template {
|
10 |
+
/**
|
11 |
+
* return special b2bprof vars
|
12 |
+
*
|
13 |
+
* @return mixed
|
14 |
+
*/
|
15 |
+
public function getB2BProfessionalVars() {
|
16 |
+
$oModel = Mage::getModel('b2bprofessional/order');
|
17 |
+
return $oModel->getByOrder(
|
18 |
+
$this->getOrder()
|
19 |
+
->getId()
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return Mage_Sales_Model_Order
|
25 |
+
*/
|
26 |
+
public function getOrder () {
|
27 |
+
return Mage::registry('current_order');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @return bool
|
32 |
+
*/
|
33 |
+
public function canCancel() {
|
34 |
+
$oModel = Mage::getModel('b2bprofessional/order');
|
35 |
+
return $oModel->canCancel(
|
36 |
+
$this->getOrder()
|
37 |
+
->getId()
|
38 |
+
);
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function getCancelUrl() {
|
45 |
+
return $this->getUrl('b2bprofessional/order/cancel', array('id' => $this->getOrder()->getId()));
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Block/Order/Form.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitewards_B2BProfessional_Block_Order_Form
|
4 |
+
* - content of New Order Form page
|
5 |
+
*
|
6 |
+
* @category Sitewards
|
7 |
+
* @package Sitewards_B2BProfessional
|
8 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
9 |
+
*/
|
10 |
+
class Sitewards_B2BProfessional_Block_Order_Form extends Mage_Core_Block_Template {
|
11 |
+
|
12 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Helper/Data.php
CHANGED
@@ -170,4 +170,11 @@ class Sitewards_B2BProfessional_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
170 |
}
|
171 |
return $bValidCart;
|
172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
170 |
}
|
171 |
return $bValidCart;
|
172 |
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
public function getOrderHistoryUrl() {
|
178 |
+
return $this->_getUrl('sales/order/history');
|
179 |
+
}
|
180 |
}
|
app/code/community/Sitewards/B2BProfessional/Model/Observer.php
CHANGED
@@ -44,6 +44,7 @@ class Sitewards_B2BProfessional_Model_Observer {
|
|
44 |
* 1) Cms related for cms pages,
|
45 |
* 2) A front action to allow for admin pages,
|
46 |
* 3) Customer account to allow for login
|
|
|
47 |
*/
|
48 |
if(
|
49 |
!$oControllerAction instanceof Mage_Cms_IndexController
|
@@ -53,6 +54,8 @@ class Sitewards_B2BProfessional_Model_Observer {
|
|
53 |
$oControllerAction instanceof Mage_Core_Controller_Front_Action
|
54 |
&&
|
55 |
!$oControllerAction instanceof Mage_Customer_AccountController
|
|
|
|
|
56 |
){
|
57 |
// Redirect to the homepage
|
58 |
/* @var $oResponse Mage_Core_Controller_Response_Http */
|
@@ -297,18 +300,20 @@ class Sitewards_B2BProfessional_Model_Observer {
|
|
297 |
*/
|
298 |
/* @var $oCategoryFilter Mage_Catalog_Block_Layer_Filter_Category */
|
299 |
$oCategoryFilter = $oBlock->getChild('category_filter');
|
300 |
-
$
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
|
|
307 |
|
308 |
-
|
309 |
-
|
|
|
|
|
310 |
}
|
311 |
-
Mage::register('b2bprof_category_filters', $aCategoryOptions);
|
312 |
|
313 |
if($oB2BHelper->isActive()) {
|
314 |
$aFilterableAttributes = $oBlock->getData('_filterable_attributes');
|
@@ -322,4 +327,112 @@ class Sitewards_B2BProfessional_Model_Observer {
|
|
322 |
}
|
323 |
}
|
324 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
}
|
44 |
* 1) Cms related for cms pages,
|
45 |
* 2) A front action to allow for admin pages,
|
46 |
* 3) Customer account to allow for login
|
47 |
+
* 4) Magento API to allow api requests
|
48 |
*/
|
49 |
if(
|
50 |
!$oControllerAction instanceof Mage_Cms_IndexController
|
54 |
$oControllerAction instanceof Mage_Core_Controller_Front_Action
|
55 |
&&
|
56 |
!$oControllerAction instanceof Mage_Customer_AccountController
|
57 |
+
&&
|
58 |
+
!$oControllerAction instanceof Mage_Api_Controller_Action
|
59 |
){
|
60 |
// Redirect to the homepage
|
61 |
/* @var $oResponse Mage_Core_Controller_Response_Http */
|
300 |
*/
|
301 |
/* @var $oCategoryFilter Mage_Catalog_Block_Layer_Filter_Category */
|
302 |
$oCategoryFilter = $oBlock->getChild('category_filter');
|
303 |
+
if($oCategoryFilter instanceof Mage_Catalog_Block_Layer_Filter_Category) {
|
304 |
+
$oCategories = $oCategoryFilter->getItems();
|
305 |
+
$aCategoryOptions = array();
|
306 |
+
foreach($oCategories as $oCategory) {
|
307 |
+
/* @var $oCategory Mage_Catalog_Model_Layer_Filter_Item */
|
308 |
+
$iCategoryId = $oCategory->getValue();
|
309 |
+
$aCategoryOptions[] = $iCategoryId;
|
310 |
+
}
|
311 |
|
312 |
+
if (Mage::registry('b2bprof_category_filters') !== null){
|
313 |
+
Mage::unregister('b2bprof_category_filters');
|
314 |
+
}
|
315 |
+
Mage::register('b2bprof_category_filters', $aCategoryOptions);
|
316 |
}
|
|
|
317 |
|
318 |
if($oB2BHelper->isActive()) {
|
319 |
$aFilterableAttributes = $oBlock->getData('_filterable_attributes');
|
327 |
}
|
328 |
}
|
329 |
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* caused by some magento magic we have to save each quote item individually if we're adding multiple of them in the same request
|
333 |
+
*
|
334 |
+
* @param Varien_Event_Observer $oObserver
|
335 |
+
*/
|
336 |
+
public function onCheckoutCartProductAddAfter(Varien_Event_Observer $oObserver) {
|
337 |
+
if (
|
338 |
+
Mage::app()->getRequest()->getModuleName() == 'b2bprofessional'
|
339 |
+
AND Mage::app()->getRequest()->getControllerName() == 'cart'
|
340 |
+
AND Mage::app()->getRequest()->getActionName() == 'addmultiple'
|
341 |
+
) {
|
342 |
+
$oObserver->getQuoteItem()->save();
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* This function is called just before $quote object get stored to database.
|
348 |
+
* Here, from POST data, we capture our custom field and put it in the quote object
|
349 |
+
*
|
350 |
+
* @param Varien_Event_Observer $oObserver
|
351 |
+
*/
|
352 |
+
public function saveQuoteBefore (Varien_Event_Observer $oObserver) {
|
353 |
+
$oQuote = $oObserver->getQuote();
|
354 |
+
$aPost = Mage::app()
|
355 |
+
->getFrontController()
|
356 |
+
->getRequest()
|
357 |
+
->getPost();
|
358 |
+
if (isset($aPost['b2bprofessional']['delivery_date'])) {
|
359 |
+
$sVar = $aPost['b2bprofessional']['delivery_date'];
|
360 |
+
$oQuote->setDeliveryDate($sVar);
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* This function is called, just after $quote object get saved to database.
|
366 |
+
* Here, after the quote object gets saved in database
|
367 |
+
* we save our custom field in the our table created i.e sales_quote_custom
|
368 |
+
*
|
369 |
+
* @param Varien_Event_Observer $oObserver
|
370 |
+
*/
|
371 |
+
public function saveQuoteAfter (Varien_Event_Observer $oObserver) {
|
372 |
+
$oQuote = $oObserver->getQuote();
|
373 |
+
if ($oQuote->getDeliveryDate()) {
|
374 |
+
$sVar = $oQuote->getDeliveryDate();
|
375 |
+
if (!empty($sVar)) {
|
376 |
+
$oModel = Mage::getModel('b2bprofessional/quote');
|
377 |
+
$oModel->deleteByQuote($oQuote->getId(), 'delivery_date');
|
378 |
+
$oModel->setQuoteId($oQuote->getId());
|
379 |
+
$oModel->setKey('delivery_date');
|
380 |
+
$oModel->setValue($sVar);
|
381 |
+
$oModel->save();
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* When load() function is called on the quote object,
|
388 |
+
* we read our custom fields value from database and put them back in quote object.
|
389 |
+
*
|
390 |
+
* @param Varien_Event_Observer $oObserver
|
391 |
+
*/
|
392 |
+
public function loadQuoteAfter (Varien_Event_Observer $oObserver) {
|
393 |
+
$oQuote = $oObserver->getQuote();
|
394 |
+
$oModel = Mage::getModel('b2bprofessional/quote');
|
395 |
+
$aData = $oModel->getByQuote($oQuote->getId());
|
396 |
+
foreach ($aData as $sKey => $sValue) {
|
397 |
+
$oQuote->setData($sKey, $sValue);
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* This function is called after order gets saved to database.
|
403 |
+
* Here we transfer our custom fields from quote table to order table i.e sales_order_custom
|
404 |
+
*
|
405 |
+
* @param Varien_Event_Observer $oObserver
|
406 |
+
*/
|
407 |
+
public function saveOrderAfter (Varien_Event_Observer $oObserver) {
|
408 |
+
$oOrder = $oObserver->getOrder();
|
409 |
+
$oQuote = $oObserver->getQuote();
|
410 |
+
if ($oQuote->getDeliveryDate()) {
|
411 |
+
$sVar = $oQuote->getDeliveryDate();
|
412 |
+
if (!empty($sVar)) {
|
413 |
+
$oModel = Mage::getModel('b2bprofessional/order');
|
414 |
+
$oModel->deleteByOrder($oOrder->getId(), 'delivery_date');
|
415 |
+
$oModel->setOrderId($oOrder->getId());
|
416 |
+
$oModel->setKey('delivery_date');
|
417 |
+
$oModel->setValue($sVar);
|
418 |
+
$oOrder->setDeliveryDate($sVar);
|
419 |
+
$oModel->save();
|
420 |
+
}
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* This function is called when $order->load() is done.
|
426 |
+
* Here we read our custom fields value from database and set it in order object.
|
427 |
+
*
|
428 |
+
* @param Varien_Event_Observer $oObserver
|
429 |
+
*/
|
430 |
+
public function loadOrderAfter (Varien_Event_Observer $oObserver) {
|
431 |
+
$oOrder = $oObserver->getOrder();
|
432 |
+
$oModel = Mage::getModel('b2bprofessional/order');
|
433 |
+
$aData = $oModel->getByOrder($oOrder->getId());
|
434 |
+
foreach ($aData as $sKey => $sValue) {
|
435 |
+
$oOrder->setData($sKey, $sValue);
|
436 |
+
}
|
437 |
+
}
|
438 |
}
|
app/code/community/Sitewards/B2BProfessional/Model/Order.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sitewards_B2BProfessional_Model_Order extends Mage_Core_Model_Abstract{
|
3 |
+
public function _construct() {
|
4 |
+
parent::_construct();
|
5 |
+
$this->_init('b2bprofessional/order');
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @param int $iOrderId
|
10 |
+
* @param string $sKey
|
11 |
+
*/
|
12 |
+
public function deleteByOrder($iOrderId, $sKey) {
|
13 |
+
$this->_getResource()->deleteByOrder($iOrderId, $sKey);
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @param int $iOrderId
|
18 |
+
* @param string $sKey
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function getByOrder($iOrderId, $sKey = '') {
|
22 |
+
return $this->_getResource()->getByOrder($iOrderId, $sKey);
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @param int $iOrderId
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function canCancel($iOrderId) {
|
30 |
+
/* @var $oOrder Mage_Sales_Model_Order */
|
31 |
+
$oOrder = Mage::getModel('sales/order')->load($iOrderId);
|
32 |
+
if ($oOrder->getCustomerId() == Mage::getSingleton('customer/session')->getCustomerId()) {
|
33 |
+
$sDeliveryDate = current($this->getByOrder($iOrderId, 'delivery_date'));
|
34 |
+
return (strtotime($sDeliveryDate) > now());
|
35 |
+
} else {
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Model/Quote.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sitewards_B2BProfessional_Model_Quote extends Mage_Core_Model_Abstract {
|
3 |
+
public function _construct() {
|
4 |
+
parent::_construct();
|
5 |
+
$this->_init('b2bprofessional/quote');
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @param int $iQuoteId
|
10 |
+
* @param string $sKey
|
11 |
+
*/
|
12 |
+
public function deleteByQuote($iQuoteId, $sKey) {
|
13 |
+
$this->_getResource()->deleteByQuote($iQuoteId, $sKey);
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @param int $iQuoteId
|
18 |
+
* @param string $sKey
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function getByQuote($iQuoteId, $sKey = '') {
|
22 |
+
return $this->_getResource()->getByQuote($iQuoteId, $sKey);
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Model/Resource/Order.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sitewards_B2BProfessional_Model_Resource_Order extends Mage_Core_Model_Mysql4_Abstract {
|
3 |
+
public function _construct () {
|
4 |
+
$this->_init('b2bprofessional/order', 'id');
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @param int $iOrderId
|
9 |
+
* @param string $sKey
|
10 |
+
*/
|
11 |
+
public function deleteByOrder ($iOrderId, $sKey) {
|
12 |
+
$sTable = $this->getMainTable();
|
13 |
+
$sWhere = $this->_getWriteAdapter()
|
14 |
+
->quoteInto('order_id = ? AND ', $iOrderId)
|
15 |
+
. $this->_getWriteAdapter()
|
16 |
+
->quoteInto('`key` = ?', $sKey);
|
17 |
+
$this->_getWriteAdapter()
|
18 |
+
->delete($sTable, $sWhere);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param int $iOrderId
|
23 |
+
* @param string $sKey
|
24 |
+
* @return array
|
25 |
+
*/
|
26 |
+
public function getByOrder ($iOrderId, $sKey = '') {
|
27 |
+
$sTable = $this->getMainTable();
|
28 |
+
$sWhere = $this->_getReadAdapter()
|
29 |
+
->quoteInto('order_id = ?', $iOrderId);
|
30 |
+
if (!empty($sKey)) {
|
31 |
+
$sWhere .= $this->_getReadAdapter()
|
32 |
+
->quoteInto(' AND `key` = ? ', $sKey);
|
33 |
+
}
|
34 |
+
$sSql = $this->_getReadAdapter()
|
35 |
+
->select()
|
36 |
+
->from($sTable)
|
37 |
+
->where($sWhere);
|
38 |
+
$aRows = $this->_getReadAdapter()
|
39 |
+
->fetchAll($sSql);
|
40 |
+
$aReturn = array();
|
41 |
+
foreach ($aRows as $row) {
|
42 |
+
$aReturn[$row['key']] = $row['value'];
|
43 |
+
}
|
44 |
+
return $aReturn;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Model/Resource/Order/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sitewards_B2BProfessional_Model_Resource_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
public function _construct () {
|
5 |
+
parent::_construct();
|
6 |
+
$this->_init('b2bprofessional/order');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sitewards_B2BProfessional_Model_Resource_Quote extends Mage_Core_Model_Mysql4_Abstract {
|
3 |
+
public function _construct() {
|
4 |
+
$this->_init('b2bprofessional/quote', 'id');
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @param int $iQuoteId
|
9 |
+
* @param string $sKey
|
10 |
+
*/
|
11 |
+
public function deleteByQuote($iQuoteId, $sKey){
|
12 |
+
$sTable = $this->getMainTable();
|
13 |
+
$sWhere = $this->_getWriteAdapter()->quoteInto('quote_id = ? AND ', $iQuoteId)
|
14 |
+
. $this->_getWriteAdapter()->quoteInto('`key` = ?', $sKey);
|
15 |
+
$this->_getWriteAdapter()->delete($sTable, $sWhere);
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param int $iQuoteId
|
20 |
+
* @param string $sKey
|
21 |
+
* @return array
|
22 |
+
*/
|
23 |
+
public function getByQuote($iQuoteId, $sKey = ''){
|
24 |
+
$sTable = $this->getMainTable();
|
25 |
+
$sWhere = $this->_getReadAdapter()->quoteInto('quote_id = ?', $iQuoteId);
|
26 |
+
if (!empty($sKey)){
|
27 |
+
$sWhere .= $this->_getReadAdapter()->quoteInto(' AND `key` = ? ', $sKey);
|
28 |
+
}
|
29 |
+
$sSql = $this->_getReadAdapter()->select()->from($sTable)->where($sWhere);
|
30 |
+
$aRows = $this->_getReadAdapter()->fetchAll($sSql);
|
31 |
+
$aReturn = array();
|
32 |
+
foreach($aRows as $row){
|
33 |
+
$aReturn[$row['key']] = $row['value'];
|
34 |
+
}
|
35 |
+
return $aReturn;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Sitewards/B2BProfessional/Model/Resource/Quote/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sitewards_B2BProfessional_Model_Resource_Quote_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
public function _construct () {
|
5 |
+
parent::_construct();
|
6 |
+
$this->_init('b2bprofessional/quote');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Sitewards/B2BProfessional/controllers/CartController.php
CHANGED
@@ -8,41 +8,90 @@
|
|
8 |
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
9 |
*/
|
10 |
require_once 'Mage/Checkout/controllers/CartController.php';
|
11 |
-
class Sitewards_B2BProfessional_CartController extends Mage_Checkout_CartController
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
9 |
*/
|
10 |
require_once 'Mage/Checkout/controllers/CartController.php';
|
11 |
+
class Sitewards_B2BProfessional_CartController extends Mage_Checkout_CartController
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* On checkout cart controller preDispatch
|
15 |
+
* - validate that all products are active for customer/customer group,
|
16 |
+
* - assign error message,
|
17 |
+
* - redirect to customer login page,
|
18 |
+
*/
|
19 |
+
public function preDispatch()
|
20 |
+
{
|
21 |
+
parent::preDispatch();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Check customer authentication
|
25 |
+
*/
|
26 |
+
|
27 |
+
$sLoginUrl = Mage::helper('customer')
|
28 |
+
->getLoginUrl();
|
29 |
+
|
30 |
+
if (!Mage::getSingleton('customer/session')
|
31 |
+
->authenticate($this, $sLoginUrl)
|
32 |
+
) {
|
33 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
34 |
+
}
|
35 |
+
|
36 |
+
$oRequest = $this->getRequest();
|
37 |
+
$iProductId = $oRequest->get('product');
|
38 |
+
/* @var $oB2BHelper Sitewards_B2BProfessional_Helper_Data */
|
39 |
+
$oB2BHelper = Mage::helper('b2bprofessional');
|
40 |
+
|
41 |
+
// check for grouped products
|
42 |
+
$bAllowed = true;
|
43 |
+
$aMultiProducts = $oRequest->getPost('super_group');
|
44 |
+
if (!empty($aMultiProducts)) {
|
45 |
+
foreach ($aMultiProducts as $iMultiProductId => $iMultiProductValue) {
|
46 |
+
if ($iMultiProductValue > 0) {
|
47 |
+
if ($oB2BHelper->isProductActive($iMultiProductId)) {
|
48 |
+
$bAllowed = false;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
if ((!empty($iProductId) && $oB2BHelper->isProductActive($iProductId)) || ! $bAllowed) {
|
55 |
+
/* @var $oB2BMessagesHelper Sitewards_B2BProfessional_Helper_Messages */
|
56 |
+
$oB2BMessagesHelper = Mage::helper('b2bprofessional/messages');
|
57 |
+
|
58 |
+
$this->setFlag('', 'no-dispatch', true);
|
59 |
+
Mage::getSingleton('customer/session')->addError(
|
60 |
+
$oB2BMessagesHelper->getMessage($oB2BMessagesHelper::MESSAGE_TYPE_CHECKOUT)
|
61 |
+
);
|
62 |
+
Mage::app()->getResponse()->setRedirect(Sitewards_B2BProfessional_Helper_Redirects::getRedirect(Sitewards_B2BProfessional_Helper_Redirects::REDIRECT_TYPE_ADD_TO_CART))->sendHeaders();
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* adds multiple products to cart
|
68 |
+
*/
|
69 |
+
public function addmultipleAction()
|
70 |
+
{
|
71 |
+
$oRequest = $this->getRequest();
|
72 |
+
$aSkus = $oRequest->getParam('sku');
|
73 |
+
$aQtys = $oRequest->getParam('qty');
|
74 |
+
$bSuccess = false;
|
75 |
+
|
76 |
+
$oQuote = $this->_getQuote();
|
77 |
+
foreach ($aSkus as $iKey => $sSku) {
|
78 |
+
$oProduct = Mage::getModel('catalog/product');
|
79 |
+
$oProduct->load($oProduct->getIdBySku($sSku));
|
80 |
+
if ($oProduct->getId() && !Mage::helper('b2bprofessional')->isProductActive($oProduct->getId())) {
|
81 |
+
$oRequest->setParam('product', $oProduct->getId());
|
82 |
+
$iQty = isset($aQtys[$iKey]) ? $aQtys[$iKey] : 1;
|
83 |
+
$oRequest->setParam('qty', $iQty);
|
84 |
+
$this->addAction();
|
85 |
+
$bSuccess = true;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
if ($bSuccess) {
|
89 |
+
$oQuote->save();
|
90 |
+
} else {
|
91 |
+
Mage::getSingleton('customer/session')->addError(
|
92 |
+
$this->__('Please enter valid product sku.')
|
93 |
+
);
|
94 |
+
$this->_redirect('b2bprofessional/order/form');
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
app/code/community/Sitewards/B2BProfessional/controllers/OrderController.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitewards_B2BProfessional_OrderController
|
4 |
+
* implements actions for new order form and cancel an order
|
5 |
+
*
|
6 |
+
* @category Sitewards
|
7 |
+
* @package Sitewards_B2BProfessional
|
8 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
9 |
+
*/
|
10 |
+
class Sitewards_B2BProfessional_OrderController extends Mage_Core_Controller_Front_Action {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Check customer authentication
|
14 |
+
*/
|
15 |
+
public function preDispatch () {
|
16 |
+
parent::preDispatch();
|
17 |
+
$sLoginUrl = Mage::helper('customer')
|
18 |
+
->getLoginUrl();
|
19 |
+
|
20 |
+
if (!Mage::getSingleton('customer/session')
|
21 |
+
->authenticate($this, $sLoginUrl)
|
22 |
+
) {
|
23 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
public function formAction() {
|
28 |
+
$this->loadLayout();
|
29 |
+
$this->_initLayoutMessages('customer/session');
|
30 |
+
$this->renderLayout();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* cancels an order
|
35 |
+
*/
|
36 |
+
public function cancelAction() {
|
37 |
+
$iOrderId = $this->getRequest()->getParam('id');
|
38 |
+
$oB2BModel = Mage::getModel('b2bprofessional/order');
|
39 |
+
$oMageModel = Mage::getModel('sales/order')->load($iOrderId);
|
40 |
+
if ($oB2BModel->canCancel($iOrderId)) {
|
41 |
+
$oMageModel->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
|
42 |
+
}
|
43 |
+
$this->getResponse()->setRedirect(Mage::helper('b2bprofessional')->getOrderHistoryUrl());
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Sitewards/B2BProfessional/controllers/ProductController.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sitewards_B2BProfessional_ProductController
|
4 |
+
* implements infoAction to validate a product request by sku
|
5 |
+
*
|
6 |
+
* @category Sitewards
|
7 |
+
* @package Sitewards_B2BProfessional
|
8 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
9 |
+
*/
|
10 |
+
class Sitewards_B2BProfessional_ProductController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Check customer authentication
|
14 |
+
*/
|
15 |
+
public function preDispatch()
|
16 |
+
{
|
17 |
+
parent::preDispatch();
|
18 |
+
$sLoginUrl = Mage::helper('customer')
|
19 |
+
->getLoginUrl();
|
20 |
+
|
21 |
+
if (!Mage::getSingleton('customer/session')
|
22 |
+
->authenticate($this, $sLoginUrl)
|
23 |
+
) {
|
24 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* gets a sku as input parameter
|
30 |
+
* sets JSON response with product data if it is allowed to be viewed
|
31 |
+
*/
|
32 |
+
public function infoAction()
|
33 |
+
{
|
34 |
+
$sSku = $this->getRequest()->getParam('sku');
|
35 |
+
/* @var Mage_Catalog_Model_Product $oProduct */
|
36 |
+
$oProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $sSku);
|
37 |
+
if ($this->isUserAllowed() and $oProduct) {
|
38 |
+
if (Mage::helper('b2bprofessional')->isProductActive($oProduct->getId())) {
|
39 |
+
$sMessage = Mage::helper('b2bprofessional')->__('Your account is not allowed to access this product.');
|
40 |
+
$sResponse = json_encode(
|
41 |
+
array(
|
42 |
+
'result' => 1,
|
43 |
+
'error' => $sMessage,
|
44 |
+
)
|
45 |
+
);
|
46 |
+
} else {
|
47 |
+
$sResponse = json_encode(
|
48 |
+
array(
|
49 |
+
'result' => 0,
|
50 |
+
'sku' => $oProduct->getSku(),
|
51 |
+
'name' => $oProduct->getName(),
|
52 |
+
'price' => Mage::helper('core')->currency($oProduct->getPrice()),
|
53 |
+
'qty' => $oProduct->getStockItem()->getMinSaleQty(),
|
54 |
+
)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
$this->getResponse()->setHeader('Content-type', 'text/json');
|
58 |
+
$this->getResponse()->setBody($sResponse);
|
59 |
+
} else {
|
60 |
+
$this->getResponse()->setHttpResponseCode(404);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* checks if user is allowed to view products
|
66 |
+
*
|
67 |
+
* @return bool
|
68 |
+
*/
|
69 |
+
private function isUserAllowed()
|
70 |
+
{
|
71 |
+
/* @var $oHelper Sitewards_B2BProfessional_Helper_Data */
|
72 |
+
$oHelper = Mage::helper('b2bprofessional');
|
73 |
+
$oB2BCustomerHelper = Mage::helper('b2bprofessional/customer');
|
74 |
+
return (
|
75 |
+
$oHelper->isExtensionActive() == true
|
76 |
+
&& (
|
77 |
+
$oB2BCustomerHelper->isLoginRequired() == false
|
78 |
+
|| Mage::getSingleton('customer/session')->isLoggedIn()
|
79 |
+
)
|
80 |
+
);
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Sitewards/B2BProfessional/etc/config.xml
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
<config>
|
19 |
<modules>
|
20 |
<Sitewards_B2BProfessional>
|
21 |
-
<version>2.
|
22 |
</Sitewards_B2BProfessional>
|
23 |
</modules>
|
24 |
<global>
|
@@ -60,14 +60,36 @@
|
|
60 |
<models>
|
61 |
<b2bprofessional>
|
62 |
<class>Sitewards_B2BProfessional_Model</class>
|
|
|
63 |
</b2bprofessional>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
</models>
|
65 |
<rewrite>
|
66 |
-
<
|
67 |
<from><![CDATA[#^/checkout/cart/#]]></from>
|
68 |
-
<to>
|
69 |
-
</
|
70 |
</rewrite>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</global>
|
72 |
<frontend>
|
73 |
<routers>
|
@@ -75,7 +97,7 @@
|
|
75 |
<use>standard</use>
|
76 |
<args>
|
77 |
<module>Sitewards_B2BProfessional</module>
|
78 |
-
<frontName>
|
79 |
</args>
|
80 |
</Sitewards_B2BProfessional>
|
81 |
</routers>
|
@@ -88,6 +110,13 @@
|
|
88 |
</Sitewards_B2BProfessional>
|
89 |
</modules>
|
90 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
<events>
|
92 |
<controller_action_predispatch>
|
93 |
<observers>
|
@@ -129,6 +158,69 @@
|
|
129 |
</b2bprofessional>
|
130 |
</observers>
|
131 |
</core_layout_block_create_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
</events>
|
133 |
</frontend>
|
134 |
<adminhtml>
|
@@ -141,6 +233,13 @@
|
|
141 |
</Sitewards_B2BProfessional>
|
142 |
</modules>
|
143 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
</adminhtml>
|
145 |
<phpunit>
|
146 |
<suite>
|
18 |
<config>
|
19 |
<modules>
|
20 |
<Sitewards_B2BProfessional>
|
21 |
+
<version>2.5.0</version>
|
22 |
</Sitewards_B2BProfessional>
|
23 |
</modules>
|
24 |
<global>
|
60 |
<models>
|
61 |
<b2bprofessional>
|
62 |
<class>Sitewards_B2BProfessional_Model</class>
|
63 |
+
<resourceModel>b2bprofessional_resource</resourceModel>
|
64 |
</b2bprofessional>
|
65 |
+
<b2bprofessional_resource>
|
66 |
+
<class>Sitewards_B2BProfessional_Model_Resource</class>
|
67 |
+
<entities>
|
68 |
+
<quote>
|
69 |
+
<table>sales_quote_b2bprofessional</table>
|
70 |
+
</quote>
|
71 |
+
<order>
|
72 |
+
<table>sales_order_b2bprofessional</table>
|
73 |
+
</order>
|
74 |
+
</entities>
|
75 |
+
</b2bprofessional_resource>
|
76 |
</models>
|
77 |
<rewrite>
|
78 |
+
<sitewards_b2bprofessional_cart>
|
79 |
<from><![CDATA[#^/checkout/cart/#]]></from>
|
80 |
+
<to>b2bprofessional/cart/</to>
|
81 |
+
</sitewards_b2bprofessional_cart>
|
82 |
</rewrite>
|
83 |
+
<resources>
|
84 |
+
<sitewards_b2bprofessional>
|
85 |
+
<setup>
|
86 |
+
<module>Sitewards_B2BProfessional</module>
|
87 |
+
</setup>
|
88 |
+
<connection>
|
89 |
+
<use>core_setup</use>
|
90 |
+
</connection>
|
91 |
+
</sitewards_b2bprofessional>
|
92 |
+
</resources>
|
93 |
</global>
|
94 |
<frontend>
|
95 |
<routers>
|
97 |
<use>standard</use>
|
98 |
<args>
|
99 |
<module>Sitewards_B2BProfessional</module>
|
100 |
+
<frontName>b2bprofessional</frontName>
|
101 |
</args>
|
102 |
</Sitewards_B2BProfessional>
|
103 |
</routers>
|
110 |
</Sitewards_B2BProfessional>
|
111 |
</modules>
|
112 |
</translate>
|
113 |
+
<layout>
|
114 |
+
<updates>
|
115 |
+
<b2bprofessional>
|
116 |
+
<file>sitewards/b2bprofessional.xml</file>
|
117 |
+
</b2bprofessional>
|
118 |
+
</updates>
|
119 |
+
</layout>
|
120 |
<events>
|
121 |
<controller_action_predispatch>
|
122 |
<observers>
|
158 |
</b2bprofessional>
|
159 |
</observers>
|
160 |
</core_layout_block_create_after>
|
161 |
+
<checkout_cart_product_add_after>
|
162 |
+
<observers>
|
163 |
+
<b2bprofessional>
|
164 |
+
<class>b2bprofessional/observer</class>
|
165 |
+
<method>onCheckoutCartProductAddAfter</method>
|
166 |
+
</b2bprofessional>
|
167 |
+
</observers>
|
168 |
+
</checkout_cart_product_add_after>
|
169 |
+
<sales_quote_save_before> <!-- Event Called Before Quote Object is saved -->
|
170 |
+
<observers>
|
171 |
+
<save_before>
|
172 |
+
<type>singleton</type>
|
173 |
+
<class>Sitewards_B2BProfessional_Model_Observer</class>
|
174 |
+
<!-- Over Model Class -->
|
175 |
+
<method>saveQuoteBefore</method>
|
176 |
+
<!-- name of function -->
|
177 |
+
</save_before>
|
178 |
+
</observers>
|
179 |
+
</sales_quote_save_before>
|
180 |
+
<sales_quote_save_after> <!-- Event called After Quote Object is saved -->
|
181 |
+
<observers>
|
182 |
+
<save_after>
|
183 |
+
<type>singleton</type>
|
184 |
+
<class>Sitewards_B2BProfessional_Model_Observer</class>
|
185 |
+
<!-- Over Model Class -->
|
186 |
+
<method>saveQuoteAfter</method>
|
187 |
+
<!-- name of function -->
|
188 |
+
</save_after>
|
189 |
+
</observers>
|
190 |
+
</sales_quote_save_after>
|
191 |
+
<sales_quote_load_after> <!-- Event called when Quote Object is loaded -->
|
192 |
+
<observers>
|
193 |
+
<load_after>
|
194 |
+
<type>singleton</type>
|
195 |
+
<class>Sitewards_B2BProfessional_Model_Observer</class>
|
196 |
+
<!-- Over Model Class -->
|
197 |
+
<method>loadQuoteAfter</method>
|
198 |
+
<!-- name of function -->
|
199 |
+
</load_after>
|
200 |
+
</observers>
|
201 |
+
</sales_quote_load_after>
|
202 |
+
<sales_model_service_quote_submit_after> <!-- Event called after order placed -->
|
203 |
+
<observers>
|
204 |
+
<sales_model_service_quote_submit_after>
|
205 |
+
<type>singleton</type>
|
206 |
+
<class>Sitewards_B2BProfessional_Model_Observer</class>
|
207 |
+
<!-- Over Model Class -->
|
208 |
+
<method>saveOrderAfter</method>
|
209 |
+
<!-- name of function -->
|
210 |
+
</sales_model_service_quote_submit_after>
|
211 |
+
</observers>
|
212 |
+
</sales_model_service_quote_submit_after>
|
213 |
+
<sales_order_load_after> <!-- Event called after Order Object is loaded -->
|
214 |
+
<observers>
|
215 |
+
<sales_order_load_after>
|
216 |
+
<type>singleton</type>
|
217 |
+
<class>Sitewards_B2BProfessional_Model_Observer</class>
|
218 |
+
<!-- Over Model Class -->
|
219 |
+
<method>loadOrderAfter</method>
|
220 |
+
<!-- name of function -->
|
221 |
+
</sales_order_load_after>
|
222 |
+
</observers>
|
223 |
+
</sales_order_load_after>
|
224 |
</events>
|
225 |
</frontend>
|
226 |
<adminhtml>
|
233 |
</Sitewards_B2BProfessional>
|
234 |
</modules>
|
235 |
</translate>
|
236 |
+
<layout>
|
237 |
+
<updates>
|
238 |
+
<b2bprofessional>
|
239 |
+
<file>sitewards/b2bprofessional.xml</file>
|
240 |
+
</b2bprofessional>
|
241 |
+
</updates>
|
242 |
+
</layout>
|
243 |
</adminhtml>
|
244 |
<phpunit>
|
245 |
<suite>
|
app/code/community/Sitewards/B2BProfessional/sql/sitewards_b2bprofessional/upgrade-2.3.0-2.4.0.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$oInstaller = $this;
|
3 |
+
$oInstaller->startSetup();
|
4 |
+
$oInstaller->run("
|
5 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('sales_quote_b2bprofessional')} (
|
6 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
7 |
+
`quote_id` int(11) unsigned NOT NULL,
|
8 |
+
`key` varchar(255) NOT NULL,
|
9 |
+
`value` text NOT NULL,
|
10 |
+
PRIMARY KEY (`id`)
|
11 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
12 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('sales_order_b2bprofessional')} (
|
13 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
14 |
+
`order_id` int(11) unsigned NOT NULL,
|
15 |
+
`key` varchar(255) NOT NULL,
|
16 |
+
`value` text NOT NULL,
|
17 |
+
PRIMARY KEY (`id`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
");
|
20 |
+
$oInstaller->endSetup();
|
app/design/adminhtml/default/default/layout/sitewards/b2bprofessional.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="order_info">
|
5 |
+
<action method='setTemplate'>
|
6 |
+
<template>sitewards/b2bprofessional/sales/order/info.phtml</template>
|
7 |
+
</action>
|
8 |
+
<block type="adminhtml/sales_order_view_info" name="order_info2"
|
9 |
+
template="sales/order/view/info.phtml"></block>
|
10 |
+
<block type="b2bprofessional/adminhtml_order" name="b2bprofessional.order" template='sitewards/b2bprofessional/order.phtml'/>
|
11 |
+
</reference>
|
12 |
+
</adminhtml_sales_order_view>
|
13 |
+
</layout>
|
app/design/adminhtml/default/default/template/sitewards/b2bprofessional/order.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="box-left">
|
2 |
+
<div class="entry-edit">
|
3 |
+
<div class="entry-edit-head">
|
4 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Additional') ?></h4>
|
5 |
+
</div>
|
6 |
+
<div class="fieldset">
|
7 |
+
<table cellspacing="0" class="form-list">
|
8 |
+
<?php
|
9 |
+
$aData = $this->getB2BProfessionalVars();
|
10 |
+
foreach ($aData as $sKey => $sValue) {
|
11 |
+
?>
|
12 |
+
<tr>
|
13 |
+
<td style="width:10%" class="label"><strong><?php echo Mage::helper('sales')->__($sKey) ?></strong></td>
|
14 |
+
<td class="value"><?php echo $sValue; ?></td>
|
15 |
+
</tr>
|
16 |
+
<?php }
|
17 |
+
?>
|
18 |
+
</table>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
</div>
|
22 |
+
<div class="clear"></div>
|
app/design/adminhtml/default/default/template/sitewards/b2bprofessional/sales/order/info.phtml
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<?php echo $this->getChildHtml('order_info2'); ?>
|
2 |
+
<?php echo $this->getChildHtml('b2bprofessional.order'); ?>
|
app/design/frontend/base/default/layout/sitewards/b2bprofessional.xml
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* layout.xml
|
5 |
+
* - adds link "New Order Form"
|
6 |
+
* - sets customer_account design for order form
|
7 |
+
* - integrates module specific javascript on order form
|
8 |
+
*
|
9 |
+
* @category Sitewards
|
10 |
+
* @package Sitewards_B2BProfessional
|
11 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
12 |
+
*/
|
13 |
+
-->
|
14 |
+
<layout version="0.1.0">
|
15 |
+
<customer_account>
|
16 |
+
<reference name="customer_account_navigation">
|
17 |
+
<action method="addLink" ifconfig="b2bprofessional/generalsettings/active" translate="label">
|
18 |
+
<name>order_form</name>
|
19 |
+
<path>b2bprofessional/order/form</path>
|
20 |
+
<label>New Order Form</label>
|
21 |
+
</action>
|
22 |
+
</reference>
|
23 |
+
</customer_account>
|
24 |
+
<sitewards_b2bprofessional_order_form translate="label">
|
25 |
+
<label>New Order Form</label>
|
26 |
+
<update handle="customer_account"/>
|
27 |
+
<reference name="my.account.wrapper">
|
28 |
+
<block type="b2bprofessional/order_form" name="order_form"
|
29 |
+
template="sitewards/b2bprofessional/order/form.phtml"/>
|
30 |
+
</reference>
|
31 |
+
<reference name="head">
|
32 |
+
<action method="addJs">
|
33 |
+
<script>sitewards/b2bprofessional.js</script>
|
34 |
+
</action>
|
35 |
+
<action method="addCss">
|
36 |
+
<name>css/sitewards/b2bprofessional.css</name>
|
37 |
+
</action>
|
38 |
+
</reference>
|
39 |
+
</sitewards_b2bprofessional_order_form>
|
40 |
+
<checkout_onepage_index>
|
41 |
+
<reference name="checkout.onepage.billing">
|
42 |
+
<action method="setTemplate">
|
43 |
+
<value>sitewards/b2bprofessional/checkout/billing/extra.phtml</value>
|
44 |
+
</action>
|
45 |
+
</reference>
|
46 |
+
<reference name="head">
|
47 |
+
<reference name="head">
|
48 |
+
<action method="addItem">
|
49 |
+
<type>js_css</type>
|
50 |
+
<name>calendar/calendar-system.css</name>
|
51 |
+
<!--<params/><if/><condition>can_load_calendar_js</condition>-->
|
52 |
+
</action>
|
53 |
+
<action method="addItem">
|
54 |
+
<type>js</type>
|
55 |
+
<name>calendar/calendar.js</name>
|
56 |
+
<!--<params/><if/><condition>can_load_calendar_js</condition>-->
|
57 |
+
</action>
|
58 |
+
<action method="addItem">
|
59 |
+
<type>js</type>
|
60 |
+
<name>calendar/calendar-setup.js</name>
|
61 |
+
<!--<params/><if/><condition>can_load_calendar_js</condition>-->
|
62 |
+
</action>
|
63 |
+
<action method="addItem">
|
64 |
+
<type>js</type>
|
65 |
+
<name>sitewards/b2bprofessional.js</name>
|
66 |
+
<!--<params/><if/><condition>can_load_calendar_js</condition>-->
|
67 |
+
</action>
|
68 |
+
</reference>
|
69 |
+
</reference>
|
70 |
+
</checkout_onepage_index>
|
71 |
+
<sales_order_view>
|
72 |
+
<reference name="my.account.wrapper">
|
73 |
+
<block type="b2bprofessional/order" name="b2bprofessional.order" template="sitewards/b2bprofessional/order.phtml"
|
74 |
+
after='sales.order.info'/>
|
75 |
+
</reference>
|
76 |
+
</sales_order_view>
|
77 |
+
</layout>
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/checkbox.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bundle product checkbox option price template
|
4 |
+
*
|
5 |
+
* @category Sitewards
|
6 |
+
* @package Sitewards_B2BProfessional
|
7 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox */ ?>
|
12 |
+
<?php $_option = $this->getOption() ?>
|
13 |
+
<?php $_selections = $_option->getSelections() ?>
|
14 |
+
<dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
|
15 |
+
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
|
16 |
+
<div class="input-box">
|
17 |
+
<?php if (count($_selections) == 1 && $_option->getRequired()): ?>
|
18 |
+
<?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
|
19 |
+
<input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
|
20 |
+
<?php else:?>
|
21 |
+
<ul class="options-list">
|
22 |
+
<?php foreach($_selections as $_selection): ?>
|
23 |
+
<li><input onclick="bundle.changeSelection(this)" class="change-container-classname checkbox bundle-option-<?php echo $_option->getId() ?> <?php if ($_option->getRequired()) echo 'validate-one-required-by-name' ?>" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" type="checkbox" name="bundle_option[<?php echo $_option->getId() ?>][]"<?php if ($this->_isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?> value="<?php echo $_selection->getSelectionId() ?>"/>
|
24 |
+
<span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionQtyTitlePrice($_selection); endif;?></label></span>
|
25 |
+
<?php if($_option->getRequired()): ?>
|
26 |
+
<?php echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
|
27 |
+
<?php endif; ?>
|
28 |
+
</li>
|
29 |
+
<?php endforeach; ?>
|
30 |
+
</ul>
|
31 |
+
<div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
|
32 |
+
<?php endif; ?>
|
33 |
+
</div>
|
34 |
+
</dd>
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/multi.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bundle product multiselect option price template
|
4 |
+
*
|
5 |
+
* @category Sitewards
|
6 |
+
* @package Sitewards_B2BProfessional
|
7 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi */ ?>
|
12 |
+
<?php $_option = $this->getOption() ?>
|
13 |
+
<?php $_selections = $_option->getSelections() ?>
|
14 |
+
<dt><label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label></dt>
|
15 |
+
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
|
16 |
+
<div class="input-box">
|
17 |
+
<?php if (count($_selections) == 1 && $_option->getRequired()): ?>
|
18 |
+
<?php echo $this->getSelectionQtyTitlePrice($_selections[0]) ?>
|
19 |
+
<input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
|
20 |
+
<?php else: ?>
|
21 |
+
<select onchange="bundle.changeSelection(this)" multiple="multiple" size="5" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>][]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select multiselect change-container-classname">
|
22 |
+
<?php if(!$_option->getRequired()): ?>
|
23 |
+
<option value=""><?php echo $this->__('None') ?></option>
|
24 |
+
<?php endif; ?>
|
25 |
+
<?php foreach ($_selections as $_selection): ?>
|
26 |
+
<option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionQtyTitlePrice($_selection, false); endif;?></option>
|
27 |
+
<?php endforeach; ?>
|
28 |
+
</select>
|
29 |
+
<?php endif; ?>
|
30 |
+
</div>
|
31 |
+
</dd>
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/radio.phtml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bundle product radio option price template
|
4 |
+
*
|
5 |
+
* @category Sitewards
|
6 |
+
* @package Sitewards_B2BProfessional
|
7 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio */ ?>
|
12 |
+
<?php $_option = $this->getOption(); ?>
|
13 |
+
<?php $_selections = $_option->getSelections(); ?>
|
14 |
+
<?php $_default = $_option->getDefaultSelection(); ?>
|
15 |
+
<?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
|
16 |
+
|
17 |
+
<dt>
|
18 |
+
<label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
|
19 |
+
</dt>
|
20 |
+
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
|
21 |
+
<div class="input-box">
|
22 |
+
<?php if ($this->_showSingle()): ?>
|
23 |
+
<?php echo $this->getSelectionTitlePrice($_selections[0]) ?>
|
24 |
+
<input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>" />
|
25 |
+
<?php else:?>
|
26 |
+
<ul class="options-list">
|
27 |
+
<?php if (!$_option->getRequired()): ?>
|
28 |
+
<li><input type="radio" onclick="bundle.changeSelection(this)" class="radio" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php echo ($_default && $_default->isSalable())?'':' checked="checked" ' ?> value=""/>
|
29 |
+
<span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>"><?php echo $this->__('None') ?></label></span>
|
30 |
+
</li>
|
31 |
+
<?php endif; ?>
|
32 |
+
<?php foreach ($_selections as $_selection): ?>
|
33 |
+
<li><input type="radio" onclick="bundle.changeSelection(this)" class="radio<?php echo $_option->getRequired()?' validate-one-required-by-name':'' ?> change-container-classname" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php if ($this->_isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>value="<?php echo $_selection->getSelectionId() ?>"/>
|
34 |
+
<span class="label"><label for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionTitlePrice($_selection); endif;?></label></span>
|
35 |
+
<?php if ($_option->getRequired()): ?>
|
36 |
+
<?php echo $this->setValidationContainer('bundle-option-'.$_option->getId().'-'.$_selection->getSelectionId(), 'bundle-option-'.$_option->getId().'-container') ?>
|
37 |
+
<?php endif; ?>
|
38 |
+
</li>
|
39 |
+
<?php endforeach; ?>
|
40 |
+
</ul>
|
41 |
+
<div id="bundle-option-<?php echo $_option->getId() ?>-container"></div>
|
42 |
+
<?php endif; ?>
|
43 |
+
</div>
|
44 |
+
<span class="qty-holder">
|
45 |
+
<label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?> </label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>
|
46 |
+
</span>
|
47 |
+
</dd>
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/catalog/product/view/type/bundle/option/select.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bundle product select option price template
|
4 |
+
*
|
5 |
+
* @category Sitewards
|
6 |
+
* @package Sitewards_B2BProfessional
|
7 |
+
* @copyright Copyright (c) 2013 Sitewards GmbH (http://www.sitewards.com/)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select */ ?>
|
12 |
+
<?php $_option = $this->getOption(); ?>
|
13 |
+
<?php $_selections = $_option->getSelections(); ?>
|
14 |
+
<?php $_default = $_option->getDefaultSelection(); ?>
|
15 |
+
<?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
|
16 |
+
|
17 |
+
<dt>
|
18 |
+
<label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->htmlEscape($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
|
19 |
+
</dt>
|
20 |
+
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
|
21 |
+
<div class="input-box">
|
22 |
+
<?php if ($this->_showSingle()): ?>
|
23 |
+
<?php echo $this->getSelectionTitlePrice($_selections[0]) ?>
|
24 |
+
<input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
|
25 |
+
<?php else:?>
|
26 |
+
<select onchange="bundle.changeSelection(this)" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select change-container-classname">
|
27 |
+
<option value=""><?php echo $this->__('Choose a selection...') ?></option>
|
28 |
+
<?php foreach ($_selections as $_selection): ?>
|
29 |
+
<option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php if (Mage::helper('b2bprofessional')->isProductActive($_selection->getId())): echo $_selection->getName(); else: echo $this->getSelectionTitlePrice($_selection, false); endif;?></option>
|
30 |
+
<?php endforeach; ?>
|
31 |
+
</select>
|
32 |
+
<?php endif; ?>
|
33 |
+
</div>
|
34 |
+
<span class="qty-holder">
|
35 |
+
<label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?> </label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>
|
36 |
+
</span>
|
37 |
+
</dd>
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/checkout/billing/extra.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var $this Mage_Checkout_Block_Onepage_Billing
|
4 |
+
*/
|
5 |
+
$sDeliveryDate =
|
6 |
+
'<span class="form-list">' .
|
7 |
+
'<label for="delivery_date">' . $this->__('Order Date:') .
|
8 |
+
'</label> </span> <input
|
9 |
+
type="text"
|
10 |
+
id="delivery_date"
|
11 |
+
name="b2bprofessional[delivery_date]"
|
12 |
+
value="' . $this->escapeHtml($this->getQuote()->getDeliveryDate()) . '"
|
13 |
+
title="' . $this->__('Order Date') . '"
|
14 |
+
class="input-text validate-date"
|
15 |
+
id="b2bprofessional:delivery_date" />'.
|
16 |
+
'<script type="text/javascript">'.
|
17 |
+
' document.observe("dom:loaded", (function () {'.
|
18 |
+
' var oOrderDatePicker = new OrderDatePicker();'.
|
19 |
+
' oOrderDatePicker.initialize();'.
|
20 |
+
' }));'.
|
21 |
+
'</script>'
|
22 |
+
;
|
23 |
+
|
24 |
+
$this->setTemplate('persistent/checkout/onepage/billing.phtml');
|
25 |
+
$sHtml = $this->toHtml();
|
26 |
+
// replace field in the billing.phtml, so we don't have to rewrite full billing.phtml and this is a bit more upgrade safe
|
27 |
+
$iPosition = strpos($sHtml, '<div class="buttons-set" id="billing-buttons-container">');
|
28 |
+
echo substr($sHtml, 0, $iPosition) .
|
29 |
+
$sDeliveryDate .
|
30 |
+
substr($sHtml, $iPosition);
|
31 |
+
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/order.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="col-set order-info-box">
|
2 |
+
<div class="col">
|
3 |
+
<div class="box">
|
4 |
+
<div class="box-title">
|
5 |
+
<h2><?php echo $this->__('Additional') ?></h2>
|
6 |
+
</div>
|
7 |
+
<div class="box-content">
|
8 |
+
<?php
|
9 |
+
$aData = $this->getB2BProfessionalVars();
|
10 |
+
foreach ($aData as $sKey => $sValue) {
|
11 |
+
?>
|
12 |
+
<b><?php echo $this->__($sKey); ?></b> : <?php echo $sValue; ?> <br/>
|
13 |
+
<?php }
|
14 |
+
if ($this->canCancel()) {
|
15 |
+
?>
|
16 |
+
<div><a href="<?php echo $this->getCancelUrl(); ?>"><?php echo $this->__('Cancel order'); ?></a></div>
|
17 |
+
<?php } ?>
|
18 |
+
</div>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
</div>
|
app/design/frontend/base/default/template/sitewards/b2bprofessional/order/form.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php echo $this
|
2 |
+
->getMessagesBlock()
|
3 |
+
->getGroupedHtml() ?>
|
4 |
+
<ul class="messages" style="display: none;"><li class="error-msg"><ul><li></li></ul></li></ul>
|
5 |
+
<div class="fieldset">
|
6 |
+
<form method="POST" id="order_form" action="<?php echo $this->getUrl('checkout/cart/addmultiple'); ?>">
|
7 |
+
<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')
|
8 |
+
->getFormKey(); ?>"/>
|
9 |
+
<table>
|
10 |
+
<thead>
|
11 |
+
<tr>
|
12 |
+
<th><?php echo $this->__('SKU'); ?></th>
|
13 |
+
<th><?php echo $this->__('Name'); ?></th>
|
14 |
+
<th><?php echo $this->__('Price'); ?></th>
|
15 |
+
<th><?php echo $this->__('Quantity'); ?></th>
|
16 |
+
<th><?php echo $this->__('Action'); ?></th>
|
17 |
+
</tr>
|
18 |
+
</thead>
|
19 |
+
<tbody>
|
20 |
+
<tr class="product">
|
21 |
+
<td><input type="text" name="sku[]" class="sku input-text"/></td>
|
22 |
+
<td class="name"></td>
|
23 |
+
<td class="price"></td>
|
24 |
+
<td><input type="text" name="qty[]" class="qty input-text" disabled="disabled"/></td>
|
25 |
+
<td><a class="remove"><?php echo $this->__('Remove this entry'); ?></a></td>
|
26 |
+
</tr>
|
27 |
+
</tbody>
|
28 |
+
</table>
|
29 |
+
<input type="submit" value="<?php echo $this->__('Submit Data')?>" title="<?php echo $this->__('Submit Data')?>"/>
|
30 |
+
</form>
|
31 |
+
<div class="invisible">
|
32 |
+
<img class="loading" src="<?php echo $this->getSkinUrl('images/sitewards/loading.gif'); ?>"/>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
<script type="text/javascript">
|
36 |
+
Translator.add('The product does not exist.', '<?php echo $this->__('The product does not exist.')?>');
|
37 |
+
</script>
|
app/locale/de_DE/Sitewards_B2BProfessional.csv
CHANGED
@@ -43,5 +43,16 @@
|
|
43 |
"Add to cart button","In den Warenkorb Button"
|
44 |
"Replace the add to cart button","Warenkorb Button ersetzen"
|
45 |
"What tag wraps the add to cart button?","Welcher Tag umschließt den Warenkorb Button?"
|
46 |
-
"On 'Add To Cart' Redirect User To Page","Seite, auf die Nutzer nach dem Hinzufügen eines Produkts zum Warenkorb weitergeleitet werden"
|
47 |
-
"Select which page to redirect a user to when they try to add an invalid product to their cart.","Wählen Sie eine Seite, zu der ein Nutzer weitergeleitet werden soll, wenn versucht wurde, ein ungültiges Produkt in den Warenkorb zu legen."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
"Add to cart button","In den Warenkorb Button"
|
44 |
"Replace the add to cart button","Warenkorb Button ersetzen"
|
45 |
"What tag wraps the add to cart button?","Welcher Tag umschließt den Warenkorb Button?"
|
46 |
+
"On \'Add To Cart\' Redirect User To Page","Seite, auf die Nutzer nach dem Hinzufügen eines Produkts zum Warenkorb weitergeleitet werden"
|
47 |
+
"Select which page to redirect a user to when they try to add an invalid product to their cart.","Wählen Sie eine Seite, zu der ein Nutzer weitergeleitet werden soll, wenn versucht wurde, ein ungültiges Produkt in den Warenkorb zu legen."
|
48 |
+
"New Order Form","Neuer Bestellzettel"
|
49 |
+
"Remove this entry","Eintrag entfernen"
|
50 |
+
"The product does not exist.","Dieses Produkt ist nicht vorhanden."
|
51 |
+
"SKU","Artikelnummer"
|
52 |
+
"Name","Name"
|
53 |
+
"Price","Preis"
|
54 |
+
"Quantity","Anzahl"
|
55 |
+
"Action","Aktion"
|
56 |
+
"Submit Data","Daten Senden"
|
57 |
+
"Your account is not allowed to access this product.","Ihr Benutzerkonto ist für dieses Produkt nicht freigeschaltet."
|
58 |
+
"Please enter valid product sku.","Bitte geben Sie eine gültige SKU an."
|
app/locale/en_US/Sitewards_B2BProfessional.csv
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
"Your account is not allowed to access this store.","Your account is not allowed to access this store."
|
2 |
"Please login","Please login"
|
3 |
-
"You do not have access to view this store.","You do not have access to view this store."
|
|
|
|
1 |
"Your account is not allowed to access this store.","Your account is not allowed to access this store."
|
2 |
"Please login","Please login"
|
3 |
+
"You do not have access to view this store.","You do not have access to view this store."
|
4 |
+
"delivery_date","Defined order date"
|
5 |
+
"Order Date:","Define order date:"
|
js/sitewards/b2bprofessional.js
ADDED
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.observe(
|
2 |
+
'dom:loaded',
|
3 |
+
/**
|
4 |
+
* initializes first product
|
5 |
+
*/
|
6 |
+
function() {
|
7 |
+
var oProduct = new OrderProduct($$('form#order_form .product')[0]);
|
8 |
+
}
|
9 |
+
);
|
10 |
+
|
11 |
+
/**
|
12 |
+
* presentation of a product row
|
13 |
+
*/
|
14 |
+
var OrderProduct = Class.create(
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* prototype element of the .product element
|
18 |
+
*/
|
19 |
+
_oLine: null,
|
20 |
+
|
21 |
+
/**
|
22 |
+
* URL of loading image
|
23 |
+
*/
|
24 |
+
_sLoadingImage: null,
|
25 |
+
|
26 |
+
/**
|
27 |
+
* initializes observer for sku
|
28 |
+
*
|
29 |
+
* @param oLine
|
30 |
+
*/
|
31 |
+
initialize: function (oLine) {
|
32 |
+
if (typeof oLine == 'undefined') {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
this._oLine = oLine;
|
36 |
+
this.getElement('input.sku').observe(
|
37 |
+
'change',
|
38 |
+
this._onChangeSku.bind(this)
|
39 |
+
);
|
40 |
+
this.getElement('.qty').style.display = 'none';
|
41 |
+
this._sLoadingImage = $$('.sitewards-b2bprofessional-order-form .loading').first().src;
|
42 |
+
|
43 |
+
var that = this;
|
44 |
+
this.getElement('.remove')
|
45 |
+
.observe('click', function (oEvent) {
|
46 |
+
that._onRemove();
|
47 |
+
oEvent.preventDefault();
|
48 |
+
return false;
|
49 |
+
})
|
50 |
+
.hide()
|
51 |
+
;
|
52 |
+
},
|
53 |
+
|
54 |
+
/**
|
55 |
+
* displays more information about product, if allowed
|
56 |
+
*
|
57 |
+
* @private
|
58 |
+
*/
|
59 |
+
_onChangeSku: function () {
|
60 |
+
new Ajax.Request('/b2bprofessional/product/info', {
|
61 |
+
method: 'get',
|
62 |
+
parameters: {
|
63 |
+
'sku' : this.getElement('input.sku').value
|
64 |
+
},
|
65 |
+
requestHeaders: {Accept: 'application/json'},
|
66 |
+
onSuccess: this._onSuccess.bind(this),
|
67 |
+
onFailure: this._onFailure.bind(this)
|
68 |
+
});
|
69 |
+
this.getElement('.name').update('<img src="'+this._sLoadingImage+'">');
|
70 |
+
this.getElement('.qty').style.display = 'none';
|
71 |
+
},
|
72 |
+
|
73 |
+
/**
|
74 |
+
* returns element of this product element
|
75 |
+
*
|
76 |
+
* @param sSelector
|
77 |
+
* @returns {*}
|
78 |
+
*/
|
79 |
+
getElement: function (sSelector) {
|
80 |
+
return this._oLine.down(sSelector);
|
81 |
+
},
|
82 |
+
|
83 |
+
/**
|
84 |
+
* duplicates current line
|
85 |
+
*
|
86 |
+
* @private
|
87 |
+
*/
|
88 |
+
_duplicateLine: function () {
|
89 |
+
var oParent = this._oLine.up();
|
90 |
+
oParent.insert(this._oLine.outerHTML);
|
91 |
+
var oProduct = new OrderProduct(oParent.childElements().last());
|
92 |
+
oProduct._reset();
|
93 |
+
},
|
94 |
+
|
95 |
+
/**
|
96 |
+
* displaysinformation about product
|
97 |
+
*
|
98 |
+
* @param transport
|
99 |
+
* @private
|
100 |
+
*/
|
101 |
+
_onSuccess: function(transport) {
|
102 |
+
this._clearMessages();
|
103 |
+
var oResponse = transport.responseText.evalJSON(true);
|
104 |
+
if (oResponse.result == 0) {
|
105 |
+
var oQty = this.getElement('input.qty');
|
106 |
+
|
107 |
+
oQty.value = Math.max(1, oResponse.qty);
|
108 |
+
oQty.disabled = false;
|
109 |
+
this.getElement('.name').update(oResponse.name);
|
110 |
+
this.getElement('.price').update(oResponse.price);
|
111 |
+
if (this._hasEmptyLineInForm() == false) {
|
112 |
+
this._duplicateLine();
|
113 |
+
}
|
114 |
+
this.getElement('.qty').style.display = 'block';
|
115 |
+
oQty.focus();
|
116 |
+
oQty.select();
|
117 |
+
|
118 |
+
if (this.getElement('input.sku').value.length > 0) {
|
119 |
+
this.getElement('.remove').show();
|
120 |
+
}
|
121 |
+
} else {
|
122 |
+
this._reset();
|
123 |
+
this.getElement('input.sku').value = '';
|
124 |
+
this._showMessage(oResponse.error);
|
125 |
+
this.getElement('input.sku').focus();
|
126 |
+
}
|
127 |
+
},
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Show standard magento message
|
131 |
+
*
|
132 |
+
* @param sText
|
133 |
+
* @param sType
|
134 |
+
* @private
|
135 |
+
*/
|
136 |
+
_showMessage : function (sText) {
|
137 |
+
$$('.messages')[0].style.display = 'block';
|
138 |
+
$$('.messages>li>ul>li')[0].update(sText);
|
139 |
+
},
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Remove all messages
|
143 |
+
*
|
144 |
+
* @private
|
145 |
+
*/
|
146 |
+
_clearMessages : function () {
|
147 |
+
$$('.messages>li>ul>li')[0].update('');
|
148 |
+
$$('.messages')[0].style.display = 'none';
|
149 |
+
},
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Determines if there is an empty line in the form
|
153 |
+
*
|
154 |
+
* @return {Boolean} true if there is an empty line
|
155 |
+
* @private
|
156 |
+
*/
|
157 |
+
_hasEmptyLineInForm : function () {
|
158 |
+
var aLines = this._oLine.up('tbody').select('tr');
|
159 |
+
for (var i=0; i < aLines.length; i++) {
|
160 |
+
var oInput = $(aLines[i]).select('input').first();
|
161 |
+
if (oInput.value == '') {
|
162 |
+
return true;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return false;
|
166 |
+
},
|
167 |
+
|
168 |
+
/**
|
169 |
+
* resets information about product
|
170 |
+
*
|
171 |
+
* @private
|
172 |
+
*/
|
173 |
+
_reset: function () {
|
174 |
+
this.getElement('input.qty').update('');
|
175 |
+
this.getElement('input.qty').disabled = 'disabled';
|
176 |
+
this.getElement('.name').update('');
|
177 |
+
this.getElement('.price').update('');
|
178 |
+
},
|
179 |
+
|
180 |
+
/**
|
181 |
+
* remove last empty row after a failed ajax request, except current row is last row
|
182 |
+
*
|
183 |
+
* @private
|
184 |
+
*/
|
185 |
+
_removeEmptyRows: function () {
|
186 |
+
var oLastLine = this._oLine.up().childElements().last();
|
187 |
+
if (oLastLine != this._oLine) {
|
188 |
+
oLastLine.remove();
|
189 |
+
}
|
190 |
+
},
|
191 |
+
|
192 |
+
/**
|
193 |
+
* removes the line from the form
|
194 |
+
*
|
195 |
+
* @private
|
196 |
+
*/
|
197 |
+
_onRemove: function () {
|
198 |
+
var oLinesContainer = this._oLine.up();
|
199 |
+
this._oLine.remove();
|
200 |
+
// hide "remove line" if only one line is left
|
201 |
+
if (oLinesContainer.childElements().length <= 1) {
|
202 |
+
oLinesContainer.down('.remove').hide();
|
203 |
+
}
|
204 |
+
},
|
205 |
+
|
206 |
+
/**
|
207 |
+
* called on ajax request failure
|
208 |
+
*
|
209 |
+
* @private
|
210 |
+
*/
|
211 |
+
_onFailure: function () {
|
212 |
+
this._reset();
|
213 |
+
this._removeEmptyRows();
|
214 |
+
this._showMessage(Translator.translate('The product does not exist.'));
|
215 |
+
this.getElement('.name').focus();
|
216 |
+
}
|
217 |
+
}
|
218 |
+
);
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Date picker for the order date
|
222 |
+
*/
|
223 |
+
var OrderDatePicker = Class.create(
|
224 |
+
{
|
225 |
+
/**
|
226 |
+
* Sets up all events of the input fields and
|
227 |
+
* the Calender
|
228 |
+
*/
|
229 |
+
initialize: function () {
|
230 |
+
|
231 |
+
// initialize date picker with correct date format
|
232 |
+
Calendar.setup({
|
233 |
+
inputField : 'delivery_date',
|
234 |
+
ifFormat : '%Y-%m-%d',
|
235 |
+
align : 'Bl',
|
236 |
+
button: 'delivery_date',
|
237 |
+
singleClick : true
|
238 |
+
});
|
239 |
+
|
240 |
+
// initialize the input
|
241 |
+
var oDateInput = $('delivery_date');
|
242 |
+
if (oDateInput.value == '') {
|
243 |
+
var oToday = new Date(),
|
244 |
+
sDay = ('0' + oToday.getDate()).slice(-2),
|
245 |
+
sMonth = ('0' + (oToday.getMonth()+1)).slice(-2),
|
246 |
+
sYear = oToday.getFullYear()
|
247 |
+
;
|
248 |
+
$('delivery_date').value = sYear + '-' + sMonth + '-' + sDay;
|
249 |
+
}
|
250 |
+
// date can only be changed via date picker
|
251 |
+
oDateInput.on('focus', function () {
|
252 |
+
oDateInput.blur();
|
253 |
+
});
|
254 |
+
|
255 |
+
this._initializeLoca();
|
256 |
+
},
|
257 |
+
|
258 |
+
/**
|
259 |
+
* initialize the localization of the calendar, if not already initialized
|
260 |
+
*
|
261 |
+
* @private
|
262 |
+
*/
|
263 |
+
_initializeLoca: function () {
|
264 |
+
|
265 |
+
if (this._isUndefined('enUS', window)) {
|
266 |
+
window.enUS = {
|
267 |
+
"m": {
|
268 |
+
"wide": [
|
269 |
+
"January", "February", "March", "April", "May", "June", "July", "August",
|
270 |
+
"September", "October", "November", "December"
|
271 |
+
],
|
272 |
+
"abbr": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
273 |
+
}
|
274 |
+
};
|
275 |
+
}
|
276 |
+
|
277 |
+
this._initCalendarLocaField('_DN', new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"));
|
278 |
+
this._initCalendarLocaField('_SDN', new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"));
|
279 |
+
this._initCalendarLocaField('_FD', 0);
|
280 |
+
this._initCalendarLocaField('_MN', window.enUS.m.wide);
|
281 |
+
this._initCalendarLocaField('_SMN', window.enUS.m.abbr);
|
282 |
+
this._initCalendarLocaField('_TT', {
|
283 |
+
INFO: "About",
|
284 |
+
ABOUT: "DHTML Date/Time Selector\n" +
|
285 |
+
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
|
286 |
+
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
|
287 |
+
"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
|
288 |
+
"\n\n" +
|
289 |
+
"Date selection:\n" +
|
290 |
+
"- Use the \xab, \xbb buttons to select year\n" +
|
291 |
+
"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
|
292 |
+
"- Hold mouse button on any of the above buttons for faster selection.",
|
293 |
+
ABOUT_TIME: "\n\n" +
|
294 |
+
"Time selection:\n" +
|
295 |
+
"- Click on any of the time parts to increase it\n" +
|
296 |
+
"- or Shift-click to decrease it\n" +
|
297 |
+
"- or click and drag for faster selection.",
|
298 |
+
PREV_YEAR : "Prev. year (hold for menu)",
|
299 |
+
PREV_MONTH: "Prev. month (hold for menu)",
|
300 |
+
GO_TODAY: "Go Today",
|
301 |
+
NEXT_MONTH : "Next month (hold for menu)",
|
302 |
+
NEXT_YEAR: "Next year (hold for menu)",
|
303 |
+
SEL_DATE: "Select date",
|
304 |
+
DRAG_TO_MOVE: "Drag to move",
|
305 |
+
PART_TODAY: "(today)",
|
306 |
+
DAY_FIRST: "Display %s first",
|
307 |
+
SELECT_COLUMN: "Select all %ss of this month",
|
308 |
+
SELECT_ROW: "Select all days of this week",
|
309 |
+
WEEKEND: "0,6",
|
310 |
+
CLOSE: "Close",
|
311 |
+
TODAY: "Today",
|
312 |
+
TIME_PART: "(Shift-)Click or drag to change value",
|
313 |
+
DEF_DATE_FORMAT: "%Y-%m-%d",
|
314 |
+
TT_DATE_FORMAT: "%a, %b %e",
|
315 |
+
WK: "wk",
|
316 |
+
TIME: "Time:",
|
317 |
+
LAM: "am",
|
318 |
+
AM: "AM",
|
319 |
+
LPM: "pm",
|
320 |
+
PM: "PM"
|
321 |
+
})
|
322 |
+
;
|
323 |
+
this._initCalendarLocaField('_DIR', 'ltr');
|
324 |
+
this._initCalendarLocaField('_am', 'am');
|
325 |
+
this._initCalendarLocaField('_pm', 'pm');
|
326 |
+
},
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Inits a localization part of the calendar
|
330 |
+
*
|
331 |
+
* @param {string} sFieldname name of the part
|
332 |
+
* @param {mixed} mValue value of the field (array, string or number)
|
333 |
+
* @private
|
334 |
+
*/
|
335 |
+
_initCalendarLocaField: function (sFieldname, mValue) {
|
336 |
+
if (this._isUndefined(sFieldname, Calendar)) {
|
337 |
+
Calendar[sFieldname] = mValue;
|
338 |
+
}
|
339 |
+
},
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Checks if element is undefined
|
343 |
+
*
|
344 |
+
* @param {mixed} mElement object or (string) name of property of oParent object
|
345 |
+
* @param {object} oParent object to check the property mElement of (not required)
|
346 |
+
* @return {Boolean} true if the element is undefined
|
347 |
+
* @private
|
348 |
+
*/
|
349 |
+
_isUndefined : function (mElement, oParent) {
|
350 |
+
if (typeof oParent == 'undefined') {
|
351 |
+
return (typeof mElement == 'undefined');
|
352 |
+
} else {
|
353 |
+
return (typeof oParent[mElement] == 'undefined');
|
354 |
+
}
|
355 |
+
}
|
356 |
+
}
|
357 |
+
);
|
358 |
+
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sitewards_B2BProfessional</name>
|
4 |
-
<version>2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
@@ -20,11 +20,14 @@ Features of the B2BProfessional Extension:
|
|
20 |
· Activation for specific product categories
|
21 |
· Activation for specific customer groups
|
22 |
· Optional require login to access store</description>
|
23 |
-
<notes>
|
|
|
|
|
|
|
24 |
<authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
|
25 |
-
<date>2013-
|
26 |
-
<time>
|
27 |
-
<contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="List.php" hash="4c8e213915c4c7c177b503916921a392"/><file name="New.php" hash="3da0bc1cb1bd562f1a41e2169f6da061"/><dir name="Widget"><file name="New.php" hash="f263ee41756685c78959082ff2a38b5a"/></dir></dir></dir><dir name="Checkout"><file name="Links.php" hash="f88d8e603f98a282b2d6f678f03d974d"/></dir><dir name="Reports"><dir name="Product"><file name="Compared.php" hash="abe90ddad8722f7f3b41eef2cf9d7411"/><file name="Viewed.php" hash="c89044322ca310b450e7e8b95c17de69"/><dir name="Widget"><file name="Compared.php" hash="427bd3640335044572ccb4a6966d1d31"/><file name="Viewed.php" hash="f943f7cff7e0858c23527bcdf82f4b19"/></dir></dir></dir></dir><dir name="Docs"><file name="Sitewards B2B Professional_Deutsch V4.pdf" hash="69c5aabb9eba3cb4d060206f68bfffa9"/><file name="Sitewards B2B Professional_ENG_V4.pdf" hash="ec57137d81856521207e5014dfad133d"/></dir><dir name="Helper"><dir name="Catalog"><dir name="Product"><file name="Compare.php" hash="29d7ee722666ceeed48ac0e43c937b1d"/></dir></dir><file name="Category.php" hash="c7ac2551cc37516ea44002b08021c27b"/><file name="Core.php" hash="8a9ed86d5aead09fad8a6c372904005d"/><file name="Customer.php" hash="6664c3fa3745cd1df1220bc4bff02d0a"/><file name="Data.php" hash="
|
28 |
<compatible/>
|
29 |
-
<dependencies><required><php><min>5.
|
30 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sitewards_B2BProfessional</name>
|
4 |
+
<version>2.5.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
|
7 |
<channel>community</channel>
|
20 |
· Activation for specific product categories
|
21 |
· Activation for specific customer groups
|
22 |
· Optional require login to access store</description>
|
23 |
+
<notes>Implemented "set order date" on checkout. With this the date of the order can be set by the customer.
|
24 |
+
Implemented possibility to create bulk orders using a list of SKUs. The optioin is added to the "My Account" section of the shop frontend.
|
25 |
+
Now xmlrpc api is working when extension is enabled. 
|
26 |
+
</notes>
|
27 |
<authors><author><name>Sitewards Magento Team</name><user>sitewards</user><email>magento@sitewards.com</email></author></authors>
|
28 |
+
<date>2013-10-24</date>
|
29 |
+
<time>19:20:12</time>
|
30 |
+
<contents><target name="magecommunity"><dir name="Sitewards"><dir name="B2BProfessional"><dir name="Block"><dir name="Adminhtml"><file name="Order.php" hash="1079907aaeb1f57c753635899032ff38"/></dir><dir name="Catalog"><dir name="Product"><file name="List.php" hash="4c8e213915c4c7c177b503916921a392"/><file name="New.php" hash="3da0bc1cb1bd562f1a41e2169f6da061"/><dir name="Widget"><file name="New.php" hash="f263ee41756685c78959082ff2a38b5a"/></dir></dir></dir><dir name="Checkout"><file name="Links.php" hash="f88d8e603f98a282b2d6f678f03d974d"/></dir><dir name="Order"><file name="Form.php" hash="9b3a9d07b9a7eb537e898578d0ce0466"/></dir><file name="Order.php" hash="c421edb98f77b39b0abdb68262a018f6"/><dir name="Reports"><dir name="Product"><file name="Compared.php" hash="abe90ddad8722f7f3b41eef2cf9d7411"/><file name="Viewed.php" hash="c89044322ca310b450e7e8b95c17de69"/><dir name="Widget"><file name="Compared.php" hash="427bd3640335044572ccb4a6966d1d31"/><file name="Viewed.php" hash="f943f7cff7e0858c23527bcdf82f4b19"/></dir></dir></dir></dir><dir name="Docs"><file name="Sitewards B2B Professional_Deutsch V4.pdf" hash="69c5aabb9eba3cb4d060206f68bfffa9"/><file name="Sitewards B2B Professional_ENG_V4.pdf" hash="ec57137d81856521207e5014dfad133d"/></dir><dir name="Helper"><dir name="Catalog"><dir name="Product"><file name="Compare.php" hash="29d7ee722666ceeed48ac0e43c937b1d"/></dir></dir><file name="Category.php" hash="c7ac2551cc37516ea44002b08021c27b"/><file name="Core.php" hash="8a9ed86d5aead09fad8a6c372904005d"/><file name="Customer.php" hash="6664c3fa3745cd1df1220bc4bff02d0a"/><file name="Data.php" hash="1b43a1aaa6aa968a1d9ecfd8aa2b2102"/><file name="Messages.php" hash="54ce3aae10919721bb3545988d6aa564"/><file name="Redirects.php" hash="5670879b38bc078e36fb32f739b3a1f5"/><file name="Replacements.php" hash="cb5b3162388618b1d8c512c5b83918a0"/></dir><dir name="Model"><file name="Customer.php" hash="ceb9778dfb4725c8cd087f2595b3ccff"/><file name="Observer.php" hash="716c0e06ec9c08ee286c83ca13b63e3c"/><file name="Order.php" hash="5ba1832297e6f95a7b14787298bd9f2a"/><file name="Quote.php" hash="9401c027ab3b4949f0db15200d591c6d"/><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="32b8e20dce599b6455232af83199e8cf"/></dir><file name="Order.php" hash="82300aaebd70030ce59b48f0bb68a275"/><dir name="Quote"><file name="Collection.php" hash="5f6dc10e88b36d1535432def4c8f11a2"/></dir><file name="Quote.php" hash="8560f55cdbcfe7312f1c1208ddcf9378"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Category.php" hash="e9642d20bb0bc0f542b07ecdf8d021c5"/><file name="Identifiers.php" hash="018e168fb31fffa33b3889612e0336be"/><file name="Page.php" hash="042ef4e679e8e8c7b6a2c696119712b3"/><file name="Tags.php" hash="af72690991f6f91a5aecb5f5fd7f621a"/></dir></dir></dir></dir><dir name="Test"><dir name="Helper"><dir name="Data"><dir name="fixtures"><file name="testIsExtensionActive.yaml" hash="1597dbaa9909bf2cd6cdc41188d79a40"/></dir></dir><file name="Data.php" hash="19407fd03acd55753b08b472f4004c57"/></dir></dir><dir name="controllers"><file name="CartController.php" hash="01d5763dd4eeb16750cc0cf6747fd33e"/><file name="OrderController.php" hash="0c8f8fc04d5920bb2d4fb8abbe5e4ea2"/><file name="ProductController.php" hash="3837d695d65cdfb361bcc21bf5e884b7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1c7cde3689b2da69458c39c3508f7e1a"/><file name="config.xml" hash="ee5af8fed9d5896dac396e00fd289977"/><file name="system.xml" hash="20344173951dcaf070b8882eb97a35eb"/></dir><dir name="sql"><dir name="sitewards_b2bprofessional"><file name="upgrade-2.3.0-2.4.0.php" hash="b203deb87585780983f5a16f19b88b34"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sitewards_B2BProfessional.xml" hash="3eb7e7a0f796d39faf60cf3f30c40ff2"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Sitewards_B2BProfessional.csv" hash="e2f335efa0e6b206580aca1ce2cd595d"/></dir><dir name="en_US"><file name="Sitewards_B2BProfessional.csv" hash="e3e35d922900bad93fee16ecdbb09f69"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="sitewards"><dir name="b2bprofessional"><dir name="catalog"><dir name="product"><dir name="view"><dir name="type"><dir name="bundle"><dir name="option"><file name="checkbox.phtml" hash="43233f86f7e8529e5bc997f448ca250a"/><file name="multi.phtml" hash="43797266868e249b34a228a4ad9797e7"/><file name="radio.phtml" hash="770363afcc009271d58a15f02ae4fdbe"/><file name="select.phtml" hash="47b3b35fe986ab31fdc8e239e8ec9bb1"/></dir></dir></dir></dir></dir></dir><dir name="checkout"><dir name="billing"><file name="extra.phtml" hash="ecc02d2548ca43b2424f88ac4cc3b0e0"/></dir></dir><dir name="order"><file name="form.phtml" hash="07382e7c71e8e0a8c9de39e8b1e255c7"/></dir><file name="order.phtml" hash="9591a8cc45c05df038807157a6f07537"/></dir></dir></dir><dir name="layout"><dir name="sitewards"><file name="b2bprofessional.xml" hash="bdc8ab6c35aea5bd155fb34c41e58090"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sitewards"><dir name="b2bprofessional"><file name="order.phtml" hash="acd14610cfb5ae3af32d29d4fb97dee9"/><dir name="sales"><dir name="order"><file name="info.phtml" hash="f15665316c8b577c00f3a6d079a00f63"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="sitewards"><file name="b2bprofessional.xml" hash="dd9927dd56d60c6499e591623d4c4ad8"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="sitewards"><file name="loading.gif" hash="1836c963dec1eb6dab0e0a41b8121cd3"/></dir></dir><dir name="css"><dir name="sitewards"><file name="b2bprofessional.css" hash="6d6ce9426f7f397c0488a82188c3bba5"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="sitewards"><file name="b2bprofessional.js" hash="953f75bd31bcd1dcb639d9582cf30292"/></dir></dir></target></contents>
|
31 |
<compatible/>
|
32 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Netzarbeiter_CustomerActivation</name><channel>community</channel><min>0.3.0</min><max/></package></required></dependencies>
|
33 |
</package>
|
skin/frontend/base/default/css/sitewards/b2bprofessional.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.sitewards-b2bprofessional-order-form TABLE TR TD,
|
2 |
+
.sitewards-b2bprofessional-order-form THEAD TR TH
|
3 |
+
{
|
4 |
+
padding-right: 20px;
|
5 |
+
padding-bottom: 10px;
|
6 |
+
}
|
7 |
+
|
8 |
+
.sitewards-b2bprofessional-order-form THEAD TR TH {
|
9 |
+
font-weight: bold;
|
10 |
+
}
|
11 |
+
|
12 |
+
.sitewards-b2bprofessional-order-form .price {
|
13 |
+
text-align: right;
|
14 |
+
}
|
15 |
+
|
16 |
+
.sitewards-b2bprofessional-order-form .invisible {
|
17 |
+
display: none;
|
18 |
+
}
|
19 |
+
|
20 |
+
.sitewards-b2bprofessional-order-form A {
|
21 |
+
cursor: pointer;
|
22 |
+
}
|
skin/frontend/base/default/images/sitewards/loading.gif
ADDED
Binary file
|