AttachSerial Plugin - Pack ID disappears on Save

  • Posts: 2
  • Thank you received: 0
10 years 1 month ago #178715

-- HikaShop version -- : Ess 2.3.4
-- HikaSerial version -- : 1.8.3
-- Joomla version -- : 3.2.1
-- PHP version -- : 5.4.34
-- Browser(s) name and version -- : Firefox 33.0.3

I have been through the tutorials and all of the posts I can find on here, and can find no mention of the issue I am encountering.
What I am trying to do: Set up a Gift Certificate that can be purchased and the related image is attached to the email confirmation sent out.
What I have done:
1. Set up a Coupon Template
2. Set up Coupon Generator
3. Set up a pack and added the serial to the Gift Certificate Product (tested both before and after generating serials)
4. Set up AttachSerial (You will notice in the screen shot that the pack ID - which should be 3 - is missing. I add this and when I click "Save" or "Save & Close" this value is removed).
5. Tested
What happens:
When I test purchase the Gift Certificate, it does send out a new serial each time in the confirmation email; however, it does not include the image as I wish.

The pluing_params field in the hikaserial_plugin record from the DB for the attachserial record shows:

O:8:"stdClass":14:{s:12:"attach_email";s:1:"1";s:15:"attach_download";s:1:"0";s:10:"image_path";s:25:"/shop/image/1_hour_gc.png";s:12:"default_font";s:20:"opensans-regular.ttf";s:18:"serial_text_format";s:5:"date.";s:21:"serial_text_format_ex";s:9:"%d/%m/%yy";s:13:"serial_text_x";s:3:"350";s:13:"serial_text_y";s:3:"220";s:13:"serial_text_w";s:0:"";s:13:"serial_text_h";s:0:"";s:16:"serial_text_size";s:2:"12";s:17:"serial_text_color";s:6:"000000";s:16:"serial_text_font";s:0:"";s:5:"texts";a:1:{i:0;a:11:{s:4:"type";s:18:"serial.serial_data";s:7:"type_ex";s:0:"";s:6:"format";s:3:"raw";s:9:"format_ex";s:0:"";s:1:"x";s:3:"350";s:1:"y";s:3:"255";s:1:"w";s:0:"";s:1:"h";s:0:"";s:4:"size";s:2:"12";s:5:"color";s:0:"";s:4:"font";s:0:"";}}}

I am sure I have missed something - probably glaringly obvious.... can you help?

Please Log in or Create an account to join the conversation.

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
10 years 1 month ago #178716

Hi,

Right.
In HikaShop 2.3.4 there is the new "namebox" system and HikaSerial 1.8.3 is using the old one.
I will see to make a new release as soon as possible.

Before that, you can edit the file "administrator/components/com_hikaserial/types/pack.php" and replace the function "displayMultiple" by this content

	public function displayMultiple($map, $values) {
		if(empty($this->values)){
			$this->load(true);
		}

		if(empty($values)) {
			$values = array();
		} else {
			if(is_string($values))
				$values = explode(',', $values);
		}

		$shopConfig = hikaserial::config(false);
		hikaserial::loadJslib('otree');

		if(substr($map,-2) == '[]')
			$map = substr($map,0,-2);
		$id = str_replace(array('[',']'),array('_',''),$map);
		$ret = '<div class="nameboxes" id="'.$id.'" onclick="window.oNameboxes[\''.$id.'\'].focus(\''.$id.'_text\');">';
		if(!empty($values)) {
			foreach($values as $key) {
				if(isset($this->values[$key]))
					$name = $this->values[$key]->text;
				else
					$name = JText::sprintf('UNKNOWN_PACK_X', $key);

				$ret .= '<div class="namebox" id="'.$id.'_'.$key.'">'.
					'<input type="hidden" name="'.$map.'[]" value="'.$key.'"/>'.$name.
					' <a class="closebutton" href="#" onclick="window.oNameboxes[\''.$id.'\'].unset(this,\''.$key.'\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>'.
					'</div>';
			}
		}

		$ret .= '<div class="namebox" style="display:none;" id="'.$id.'tpl">'.
				'<input type="hidden" name="{map}" value="{key}"/>{name}'.
				' <a class="closebutton" href="#" onclick="window.oNameboxes[\''.$id.'\'].unset(this,\'{key}\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>'.
				'</div>';

		$ret .= '<div class="nametext">'.
			'<input id="'.$id.'_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\''.$id.'\'].focus(this);" onkeyup="window.oNameboxes[\''.$id.'\'].search(this);" onchange="window.oNameboxes[\''.$id.'\'].search(this);"/>'.
			'<span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="'.$id.'_span">span</span>'.
			'</div>';

		$data = array();
		foreach($this->values as $key => $value) {
			if(empty($key))
				continue;
			$data[$key] = $value->text;
		}

		$namebox_options = array(
			'mode' => 'list',
			'img_dir' => HIKASHOP_IMAGES,
			'map' => $map,
			'min' => $shopConfig->get('namebox_search_min_length', 3),
			'multiple' => true
		);

		$ret .= '<div style="clear:both;float:none;"></div></div>
<div class="namebox-popup">
	<div id="'.$id.'_olist" style="display:none;" class="oList namebox-popup-content"></div>
</div>
<script type="text/javascript">
new window.oNamebox(
	\''.$id.'\',
	'.json_encode($data).',
	'.json_encode($namebox_options).'
);';
			if(!empty($values)) {
				$ret .= '
try{
	window.oNameboxes[\''.$id.'\'].content.block('.json_encode($values).');
}catch(e){}';
			}

			$ret .= '
</script>';
		return $ret;
	}
It will fix the issue.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: fythien

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
10 years 1 month ago #178718

Jerome - you are a star! It works perfectly now B)
Thank you

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.059 seconds
Powered by Kunena Forum