function vafUrl(Elite_Vaf_Model_Vehicle $vehicle) { $params = http_build_query($vehicle->toValueArray()); if ($vehicle->getLeafValue()) { if ('/' == $this->getRequest()->getBasePath()) { return '/vaf/product/list?' . $params; } return $this->getRequest()->getBasePath() . '/vaf/product/list?' . $params; } return '?' . $params; }
<?php session_start(); require_once 'F:\\dev\\vaf\\app\\code\\local\\Elite\\Vaf\\bootstrap-tests.php'; $schemaGenerator = new Elite_Vaf_Model_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); $schema = new Elite_Vaf_Model_Schema(); $vehicle = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'year' => '2002')); $vehicle->save(); $values = $vehicle->toValueArray(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" href="../qunit/qunit.css" type="text/css"/> <link rel="stylesheet" href="/skin/adminhtml/default/default/multiTree.css" type="text/css"/> <script src="/skin/adminhtml/default/default/jquery-1.4.2.min.js"> </script> <script src="/skin/adminhtml/default/default/jquery.metadata.pack.js"> </script> <script type="text/javascript" src="../qunit/qunit.js"></script> <script type="text/javascript" src="/vaf/ajax/js"></script> <script type="text/javascript" src="../common.js"></script> <script type="text/javascript"> jQuery(document).ready(function($){ QUnit.done = function (failures, total) { top.testPageComplete( 'multiTreeTest/MMY.php', failures, total ); };
function vehicleParams() { $params = $this->vehicle->levelIdsTruncateAfter($this->grain); return $params; }
<?php require_once 'F:\\dev\\vaf\\app\\code\\local\\Elite\\Vaf\\bootstrap-tests.php'; $schemaGenerator = new Elite_Vaf_Model_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); $schema = new Elite_Vaf_Model_Schema(); $vehicle1 = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Civic', 'year' => '2002')); $vehicle1->save(); $vehicle2 = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Accord', 'year' => '2002')); $vehicle2->save(); $mapping = new Elite_Vaf_Model_Mapping(1, $vehicle2); $mapping->save(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" href="../qunit/qunit.css" type="text/css"/> <script src="/skin/adminhtml/default/default/jquery-1.4.2.min.js"> </script> <script src="/skin/adminhtml/default/default/jquery.metadata.pack.js"> </script> <script type="text/javascript" src="../qunit/qunit.js"></script> <script type="text/javascript" src="/vaf/ajax/js?front=1"></script> <script type="text/javascript" src="../common.js"></script> <script type="text/javascript"> jQuery(document).ready(function($){ QUnit.done = function (failures, total) { top.testPageComplete( 'ajaxTestJs/MMYMultiple.php', failures, total ); };
function getMappingId(Elite_Vaf_Model_Vehicle $vehicle) { $schema = new Elite_Vaf_Model_Schema(); $select = $this->getReadAdapter()->select()->from('elite_mapping', 'id')->where($schema->getLeafLevel() . '_id = ?', $vehicle->getLeafValue())->where('entity_id = ?', $this->getId()); return $select->query()->fetchColumn(); }
/** * @var integer entity_id of the product row * @var Elite_Vaf_Model_Vehicle to check for assocation with * @return boolean true only if the mapping between the product+definition exists */ function hasMapping($entity_id, Elite_Vaf_Model_Vehicle $vehicle) { $sql = sprintf("SELECT count(*) FROM elite_mapping WHERE entity_id = %d AND %s = %d LIMIT 1", (int) $entity_id, $this->getReadAdapter()->quoteIdentifier($this->getSchema()->getLeafLevel() . '_id'), (int) $vehicle->getLeafValue()); $r = $this->query($sql); return (bool) 0 != $r->fetchColumn(); }
<?php require_once 'F:\\dev\\vaf\\app\\code\\local\\Elite\\Vaf\\bootstrap-tests.php'; $schemaGenerator = new Elite_Vaf_Model_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'chassis', 'trim')); $schema = new Elite_Vaf_Model_Schema(); $vehicle = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'chassis' => 'chassis', 'trim' => 'trim')); $vehicle->save(); $mapping = new Elite_Vaf_Model_Mapping(1, $vehicle); $mapping->save(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" href="../qunit/qunit.css" type="text/css"/> <script src="/skin/adminhtml/default/default/jquery-1.4.2.min.js"> </script> <script src="/skin/adminhtml/default/default/jquery.metadata.pack.js"> </script> <script type="text/javascript" src="../common.js"></script> <script type="text/javascript" src="../qunit/qunit.js"></script> <script type="text/javascript" src="/vaf/ajax/js?front=1"></script> <script type="text/javascript"> jQuery(document).ready(function($){ QUnit.done = function (failures, total) { top.testPageComplete( 'ajaxTestJs/MMTC.php', failures, total ); }; module("Loading Levels");
function merge_vehicle($slave_vehicle, $master_vehicle) { $titles = $slave_vehicle->toTitleArray(); $levelsToReplace = $this->getSchema()->getPrevLevelsIncluding($this->operatingGrain()); foreach ($levelsToReplace as $levelToReplace) { $titles[$levelToReplace] = $master_vehicle->getLevel($levelToReplace)->getTitle(); } $new_vehicle = Elite_Vaf_Model_Vehicle::create($this->getSchema(), $titles); $new_vehicle->save(); $this->mergeFitments($slave_vehicle, $new_vehicle); }