fix path of export controller, fix empty values

This commit is contained in:
Alex Lushpai 2014-08-15 14:43:43 +04:00
parent 76a4fa6b70
commit e00b16397c
2 changed files with 29 additions and 19 deletions

View File

@ -9,10 +9,12 @@
<?php if ($error_warning) : ?> <?php if ($error_warning) : ?>
<div class="warning"><?php echo $error_warning; ?></div> <div class="warning"><?php echo $error_warning; ?></div>
<?php endif; ?> <?php endif; ?>
<?php if (isset($saved_settings['intarocrm_url'])): ?>
<div class="success"> <div class="success">
<?php echo $text_notice; ?> <?php echo $text_notice; ?>
<a href="<?php echo $saved_settings['intarocrm_url']; ?>/admin/settings#t-main"><?php echo $saved_settings['intarocrm_url']; ?>/admin/settings#t-main</a> <a href="<?php echo $saved_settings['intarocrm_url']; ?>/admin/settings#t-main"><?php echo $saved_settings['intarocrm_url']; ?>/admin/settings#t-main</a>
</div> </div>
<?php endif; ?>
<div class="box"> <div class="box">
<div class="heading"> <div class="heading">
@ -26,14 +28,14 @@
<h3><?php echo $intarocrm_base_settings; ?></h3> <h3><?php echo $intarocrm_base_settings; ?></h3>
<div class="intarocrm_unit"> <div class="intarocrm_unit">
<label for="intarocrm_url"><?php echo $intarocrm_url; ?></label><br> <label for="intarocrm_url"><?php echo $intarocrm_url; ?></label><br>
<input id="intarocrm_url" type="text" name="intarocrm_url" value="<?php echo $saved_settings['intarocrm_url']; ?>"> <input id="intarocrm_url" type="text" name="intarocrm_url" value="<?php if (isset($saved_settings['intarocrm_url'])): echo $saved_settings['intarocrm_url']; endif; ?>">
</div> </div>
<div class="intarocrm_unit"> <div class="intarocrm_unit">
<label for="intarocrm_apikey"><?php echo $intarocrm_apikey; ?></label><br> <label for="intarocrm_apikey"><?php echo $intarocrm_apikey; ?></label><br>
<input id="intarocrm_apikey" type="text" name="intarocrm_apikey" value="<?php echo $saved_settings['intarocrm_apikey']; ?>"> <input id="intarocrm_apikey" type="text" name="intarocrm_apikey" value="<?php if (isset($saved_settings['intarocrm_apikey'])): echo $saved_settings['intarocrm_apikey']; endif;?>">
</div> </div>
<?php if ($saved_settings['intarocrm_apikey'] != '' && $saved_settings['intarocrm_url'] != ''): ?> <?php if (isset($saved_settings['intarocrm_apikey']) && $saved_settings['intarocrm_apikey'] != '' && isset($saved_settings['intarocrm_url']) && $saved_settings['intarocrm_url'] != ''): ?>
<?php if (!empty($intarocrm_errors)) : ?> <?php if (!empty($intarocrm_errors)) : ?>
<?php foreach($intarocrm_errors as $intarocrm_error): ?> <?php foreach($intarocrm_errors as $intarocrm_error): ?>
@ -47,7 +49,7 @@
<div class="intarocrm_unit"> <div class="intarocrm_unit">
<select id="intarocrm_delivery_<?php echo $key; ?>" name="intarocrm_delivery[<?php echo $key; ?>]" > <select id="intarocrm_delivery_<?php echo $key; ?>" name="intarocrm_delivery[<?php echo $key; ?>]" >
<?php foreach ($delivery['intarocrm'] as $k => $v): ?> <?php foreach ($delivery['intarocrm'] as $k => $v): ?>
<option value="<?php echo $v['code'];?>" <?php if($v['code'] == $saved_settings['intarocrm_delivery'][$key]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['intarocrm_delivery'][$key]) && $v['code'] == $saved_settings['intarocrm_delivery'][$key]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
@ -62,7 +64,7 @@
<div class="intarocrm_unit"> <div class="intarocrm_unit">
<select id="intarocrm_status_<?php echo $uid; ?>" name="intarocrm_status[<?php echo $uid; ?>]" > <select id="intarocrm_status_<?php echo $uid; ?>" name="intarocrm_status[<?php echo $uid; ?>]" >
<?php foreach ($statuses['intarocrm'] as $k => $v): ?> <?php foreach ($statuses['intarocrm'] as $k => $v): ?>
<option value="<?php echo $v['code'];?>" <?php if($v['code'] == $saved_settings['intarocrm_status'][$uid]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['intarocrm_status'][$uid]) && $v['code'] == $saved_settings['intarocrm_status'][$uid]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
@ -76,7 +78,7 @@
<div class="intarocrm_unit"> <div class="intarocrm_unit">
<select id="intarocrm_payment_<?php echo $key; ?>" name="intarocrm_payment[<?php echo $key; ?>]" > <select id="intarocrm_payment_<?php echo $key; ?>" name="intarocrm_payment[<?php echo $key; ?>]" >
<?php foreach ($payments['intarocrm'] as $k => $v): ?> <?php foreach ($payments['intarocrm'] as $k => $v): ?>
<option value="<?php echo $v['code'];?>" <?php if($v['code'] == $saved_settings['intarocrm_payment'][$key]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['intarocrm_payment'][$key]) && $v['code'] == $saved_settings['intarocrm_payment'][$key]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -12,7 +12,8 @@ class ControllerExportIntarocrm extends Controller {
private function xml() private function xml()
{ {
$this->dd = DOMDocument::loadXML('<?xml version="1.0" encoding="UTF-8"?> $this->dd = new DOMDocument();
$this->dd->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="'.date('Y-m-d H:i:s').'"> <yml_catalog date="'.date('Y-m-d H:i:s').'">
<shop> <shop>
<name>'.$this->config->get('config_name').'</name> <name>'.$this->config->get('config_name').'</name>
@ -84,20 +85,27 @@ class ControllerExportIntarocrm extends Controller {
) )
); );
$sku = $this->dd->createElement('param'); if ($offer['sku'] != '') {
$sku->setAttribute('name', 'article'); $sku = $this->dd->createElement('param');
$sku->appendChild($this->dd->createTextNode($offer['sku'])); $sku->setAttribute('name', 'article');
$e->appendChild($sku); $sku->appendChild($this->dd->createTextNode($offer['sku']));
$e->appendChild($sku);
}
$weight = $this->dd->createElement('param'); if ($offer['weight'] != '') {
$weight->setAttribute('name', 'weight'); $weight = $this->dd->createElement('param');
$weight->appendChild($this->dd->createTextNode($offer['weight'] . ' ' . $offer['weight_class'])); $weight->setAttribute('name', 'weight');
$e->appendChild($weight); $weightValue = (isset($offer['weight_class'])) ? $offer['weight'] . ' ' . $offer['weight_class'] : $offer['weight'];
$weight->appendChild($this->dd->createTextNode($weightValue));
$e->appendChild($weight);
}
$size = $this->dd->createElement('param'); if ($offer['length'] != '' && $offer['width'] != '' && $offer['height'] != '') {
$size->setAttribute('name', 'size'); $size = $this->dd->createElement('param');
$size->appendChild($this->dd->createTextNode($offer['length'] .'x'. $offer['width'] .'x'. $offer['height'])); $size->setAttribute('name', 'size');
$e->appendChild($size); $size->appendChild($this->dd->createTextNode($offer['length'] .'x'. $offer['width'] .'x'. $offer['height']));
$e->appendChild($size);
}
} }
} }