Skip to content

Instantly share code, notes, and snippets.

@nclundsten
Created July 9, 2013 05:08
Show Gist options
  • Save nclundsten/5954863 to your computer and use it in GitHub Desktop.
Save nclundsten/5954863 to your computer and use it in GitHub Desktop.
<?php
...
/*
*
* Option tests below here.
*
*
*/
public function top_level_product_no_options($params)
{
extract($params);
if (
$this->topLevel($product)
&& $option_count === 0
) {
$model->setProductTypeId($this->TYPE_PRODUCT);
return __METHOD__;
}
return false;
}
public function single_option_distributor_id_1($params)
{
extract($params);
if (
$option_count === 1
&& 1 === (int) $product['distributor_id']
) {
$model->setProductTypeId($this->TYPE_SHELL);
$option = $this->createOption($product['options'][0]);
$model->addOption($option);
return __METHOD__;
}
return false;
}
public function single_option_no_sub_options($params)
{
extract($params);
if (
$option_count === 1
&& !$this->hasSubOptions($product['options'][0])
) {
$model->setProductTypeId($this->TYPE_SHELL);
$option = $this->createOption($product['options'][0]);
$model->addOption($option);
return __METHOD__;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment