Hi!
Link: http://terra.artcolorit.com/schools-en/spanish-en/enforex-marbella-camp-albergue-en
Site using Zoo + JBZoo.
I have a calculator on Chronoforms V5 and want to migrate it on Chronoforms V6. For me, it's a little hard and I need your advice.
I need to fill options of all selects with values from xls file. I have PHP code which was written for Chronoforms V5, I did some changes for it:
Look on the image please: https://prnt.sc/km5jxn - How I can get this values in first select?
I'd try writing this:
Link: http://terra.artcolorit.com/schools-en/spanish-en/enforex-marbella-camp-albergue-en
Site using Zoo + JBZoo.
I have a calculator on Chronoforms V5 and want to migrate it on Chronoforms V6. For me, it's a little hard and I need your advice.
I need to fill options of all selects with values from xls file. I have PHP code which was written for Chronoforms V5, I did some changes for it:
$zoo = App::getInstance('zoo');For the first select, I did another PHP action with courses and I can't to get options from it.
$itemId = JRequest::getInt('item_id');
$item = $zoo->table->item->get($itemId);
$this->data['itemname'] = $item->name;
$this->data['itemalias'] = $item->alias;
include_once('prices/classes/PHPExcel/IOFactory.php');
try {
$objPHPExcel = PHPExcel_IOFactory::load('prices/'.$item->alias.'.xlsx');
$allSheets = $objPHPExcel->getAllSheets();
$courses = $allSheets[0]->toArray(null,false,false,true);
$accomodations = $allSheets[1]->toArray(null,false,false,true);
$sbor = $allSheets[2]->toArray(null,false,false,true);
//Registration Fee
if ($sbor[1]['A']) {
$this->data['registration']=$sbor[1]['A'];
} else {
$this->data['registration']=0;
}
//Weeks
foreach($courses[1] as $col => $week)
$this->data['weeks'][]=array('week'=>$week);
//Accomodation
foreach($accomodations as $row => $type){
if (trim($type['A']) != '') {
$this->data['accomodations'][]=array('value'=>$row,'text'=>$type['A']);
}
}
//Course Prices
$this->data['prices_c'] = 'var p=new Array();';
foreach($courses as $row => $course){
if (trim($course['A']) != '') {
$this->data['courses'][]=array('value'=>$row,'text'=>$course['A']);
}
if($course['A']){
$this->data['prices_c'] .= "p[$row]=new Array();";
foreach($courses[1] as $col => $week){
if($week && $courses[$row][$col])
$this->data['prices_c'].= "p[$row][$week]={$courses[$row][$col]};";
}
}
}
unset($accomodations[1]['A'],$accomodations[1]['B']);
$this->data['prices_a'] = 'var a=new Array();';
foreach($accomodations as $row => $accomodation){
if($accomodation['A'] && $row > 2){
$this->data['prices_a'] .= "a[$row]=new Array();";
foreach($accomodations[1] as $col => $week){
if($week && $accomodations[$row][$col])
$this->data['prices_a'] .= "a[$row][$week]={$accomodations[$row][$col]};";
}
}
}
//Extra night
unset($accomodations[1],$accomodations[2]);
//currency symbol
$this->data['curr_symbol'] = $sbor[1]['C'];
} catch(Exception $e) {
echo $e->getMessage();
}
Look on the image please: https://prnt.sc/km5jxn - How I can get this values in first select?
I'd try writing this:
{var:courses.row}But it doesn't work. Maybe I did a mistake. Help please to fill this select
Hi zeus07,
The one thing I can see immediately is that the PHP is using $this->data - that is no longer supported in CFv6. PLease check the CFv6 manual for the correct syntax to save to the form data.
Bob
The one thing I can see immediately is that the PHP is using $this->data - that is no longer supported in CFv6. PLease check the CFv6 manual for the correct syntax to save to the form data.
Bob
Hi, Bob!
It's strange, because in your manual https://www.chronoengine.com/faqs/74-chronoforms/chronoforms6/5288-v5-form-to-v6-migration-guide I read this:Any $form->data calls in v5 custom code should be replaced by $this->data
It's strange, because in your manual https://www.chronoengine.com/faqs/74-chronoforms/chronoforms6/5288-v5-form-to-v6-migration-guide I read this:Any $form->data calls in v5 custom code should be replaced by $this->data
This topic is locked and no more replies can be posted.