cart integration

This commit is contained in:
Etienne Roudeix
2013-09-16 14:31:34 +02:00
parent e0a48df23e
commit c7b3aea7f0
4 changed files with 17 additions and 8 deletions

View File

@@ -37,7 +37,7 @@ class LoopResult implements \Iterator
public function __construct($modelCollection = null)
{
$this->position = 0;
if ($modelCollection instanceof ObjectCollection || $modelCollection instanceof PropelModelPager) {
if ($modelCollection instanceof ObjectCollection || $modelCollection instanceof PropelModelPager || is_array($modelCollection)) {
$this->modelCollection = $modelCollection;
}
}

View File

@@ -73,9 +73,14 @@ class Feed extends BaseLoop
$limit = min(count($items), $this->getLimit());
$loopResult = new LoopResult();
$indexes = array();
for ($idx = 0; $idx < $limit; $idx++) {
$indexes[] = $idx;
}
$loopResult = new LoopResult($query);
foreach ($indexes as $idx) {
$item = $items[$idx];
@@ -87,7 +92,7 @@ class Feed extends BaseLoop
$date = $item->get_date('d/m/Y');
$loopResultRow = new LoopResultRow();
$loopResultRow = new LoopResultRow($loopResult, $item, $this->versionable, $this->timestampable, $this->countable);
$loopResultRow->set("URL", $item->get_permalink());
$loopResultRow->set("TITLE", $item->get_title());

View File

@@ -23,13 +23,16 @@
namespace Thelia\Module;
use Thelia\Model\Country;
interface DeliveryModuleInterface extends BaseModuleInterface
{
/**
*
* calculate and return delivery price
*
* @param Country $country
*
* @return mixed
*/
public function calculate($country = null);
public function calculate(Country $country);
}

View File

@@ -25,6 +25,7 @@ namespace Colissimo;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Model\Country;
use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface;
@@ -57,10 +58,10 @@ class Colissimo extends BaseModule implements DeliveryModuleInterface
*
* calculate and return delivery price
*
* @param null $country
* @param Country $country
* @return mixed
*/
public function calculate($country = null)
public function calculate(Country $country)
{
// TODO: Implement calculate() method.
return 2;