$obj_excel_draw->setPath($img_path); $obj_excel_draw->setCoordinates(chr($column_ai[$ai]) . $row_products_images); $obj_excel_draw->setOffsetX($offset_ai[$ai]); $obj_excel_draw->setOffsetY($img_offset); } } } $row_total = $row_products_images; foreach ($p->articles as $aid => $a) { if ($p->isArticleKilled($aid)) { continue; } $article_counter++; //ELEMENTS! $ean = $p->getEAN($aid); $size = $p->getLengthOrSizeAsText($aid); $cell_ean = 'A' . ($row_total + 2); $element_rowstart = $row_total + 3; $obj_ws->getStyle($cell_ean)->getFont()->setBold(true); $obj_ws->setCellValue($cell_ean, "EAN Code: {$ean} ({$size})"); $range_elements_header = $obj_ws->getStyle('A' . $element_rowstart . ':I' . $element_rowstart); $range_elements_header->getFont()->setBold(true); $range_elements_header->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB($table_header_bgcolor); $obj_ws->setCellValue('A' . $element_rowstart, 'Element'); $obj_ws->setCellValue('B' . $element_rowstart, 'ID'); $obj_ws->setCellValue('C' . $element_rowstart, 'Description'); $obj_ws->setCellValue('D' . $element_rowstart, 'Material'); $obj_ws->setCellValue('E' . $element_rowstart, 'Finishing'); $obj_ws->setCellValue('F' . $element_rowstart, 'Qty'); $obj_ws->setCellValue('G' . $element_rowstart, 'Weight (gram)'); $obj_ws->setCellValue('H' . $element_rowstart, "Total Silver\nWeight (gram)");
function generateLabelHSE($product_id, $article_id, $ean = '') { $result = array(); if ($ean != '') { $obj_product = Product::loadObjectFromEAN($ean); $article_id = $obj_product->getArticleIDFromEAN($ean); } else { $obj_product = new Product($product_id); $ean = $obj_product->getEAN($article_id); } $sales_partner_id = '12'; //Use product code from SP (HSE) //SP is not yet created, maybe will have a different ID $code = $obj_product->getSalesPartnerProductCode($sales_partner_id); if ($code == '') { $code = 'N/A'; } $name = $obj_product->getSalesPartnerProductName($sales_partner_id); if ($name == '') { $name = 'No SP Name'; } $length = $obj_product->getLengthOrSizeAsText($article_id); //Set label size (in dots) $label_width = '340'; $text_block_width = '300'; //Set default x and y position $posx_start = 20; $posy_start = 35; //Start setting x and y position to be used and changed dynamically //can be set to default size again when needed $posx = $posx_start; $posy = $posy_start; //CONSTRUCT label //==> START COMMAND ^XA $label = "^XA"; //==> Change International Font/Encoding ^CI //6 = German Character Set $label .= "^CI6"; //==> Media Type //^MT //D for Direct Thermal (need special media) //T for Thermal Transfer (need ribbon) $label .= "^MTD"; //==> Media Darkness //^MD //0 : 0 (-30 to 30) $label .= "^MD0"; //==> Print Mode //^MM //T = Tear-off $label .= "^MMT"; //==> Measurement Unit //^MU //d = dots //300 = dpi format //300 = dpi conversion $label .= "^MUd,300,300"; //==> Label Home //^LH //0,0 = x,y axis position (0 - 32000) $label .= "^LH0,0"; //==> Media Tracking //^MN //Y = non-continues web sensing //N = continues $label .= "^MNY"; //$label .= "^MNN"; //==> Label Length //^LL //only needed for continues media //$label .= "^LL384.5"; //==> Print Width //^PW //Specify label width in dots $label .= "^PW" . $label_width; //==> Set Dots per Milimiter //^JM //will affect sizes of result that will be printed on label //A = 24 dots/mm, 12 dots/mm, 8 dots/mm or 6 dots/mm //B = 12 dots/mm, 6 dots/mm, 4 dots/mm or 3 dots/mm $label .= "^JMA"; //==> Field Origin //^FO //x axis in dots //y axis in dots //z = justification (0 = left, 1 = right, 2 = auto) $label .= "^FO{$posx},{$posy}"; //==> Set Scalable/Bitmapped Font //^A //font name : A-Z, 0-9 (saved in printer memory) //orientation : N = normal, R = 90CW, I = 180, B = 270 //character height in dots //width in dots $label .= "^A0N,35,35"; //==> Field Block //^FB //set field data to be printed as a block which can be aligned //width in dots //maximum lines : 1 to 9999 //line spaces : -9999 to 9999 //alignment : L = Left, C = Center, R = Right, J = Justified //hanging indent : 0 to 9999 $label .= '^FB' . $text_block_width . ',1,0,C,0'; //==> Field Data (set barcode value) //^FD ... ^FS //Data to print (in this case Product Code) $label .= '^FD' . 'HSE 24' . '^FS'; $posy += 38; //==> Field Origin //^FO //x axis in dots //y axis in dots //z = justification (0 = left, 1 = right, 2 = auto) $label .= "^FO{$posx},{$posy}"; //==> Set Scalable/Bitmapped Font //^A //font name : A-Z, 0-9 (saved in printer memory) //orientation : N = normal, R = 90CW, I = 180, B = 270 //character height in dots //width in dots $label .= "^A0N,60,60"; //==> Field Block //^FB //set field data to be printed as a block which can be aligned //width in dots //maximum lines : 1 to 9999 //line spaces : -9999 to 9999 //alignment : L = Left, C = Center, R = Right, J = Justified //hanging indent : 0 to 9999 $label .= '^FB' . $text_block_width . ',1,0,C,0'; //==> Field Data (set barcode value) //^FD ... ^FS //Data to print (in this case Product Code) $label .= '^FD' . $code . '^FS'; $posy += 50; $posx_barcode = 35; //==> Bar Code Field Default //^BY //could make barcode on smallest size //width : 1 - 10 //ratio : 2.0 - 3.0 //height : in dots $label .= "^BY2"; //==> Field Origin //^FO //x axis in dots //y axis in dots //z = justification (0 = left, 1 = right, 2 = auto) $label .= "^FO\${$posx_barcode},{$posy}"; //==> Set Barcode Type and Format //^B //C = Code 128 //orientation : N = normal, R = 90CW, I = 180, B = 270 //height in dots //print interpretation : Y = Yes, N = No //print interpretation above : Y = Yes, N = No (print below) $label .= "^BCN,80,N,N"; //==> Field Data (set barcode value) //^FD ... ^FS //Data to print (in this case EAN Code) $label .= '^FD' . $code . '^FS'; $posy += 85; //==> Field Origin //^FO //x axis in dots //y axis in dots //z = justification (0 = left, 1 = right, 2 = auto) $label .= "^FO{$posx},{$posy}"; //==> Set Scalable/Bitmapped Font //^A //font name : A-Z, 0-9 (saved in printer memory) //orientation : N = normal, R = 90CW, I = 180, B = 270 //character height in dots //width in dots $label .= "^A0N,30,30"; //==> Field Block //^FB //set field data to be printed as a block which can be aligned //width in dots //maximum lines : 1 to 9999 //line spaces : -9999 to 9999 //alignment : L = Left, C = Center, R = Right, J = Justified //hanging indent : 0 to 9999 $label .= '^FB' . $text_block_width . ',2,0,C,0'; //==> Field Data (set barcode value) //^FD ... ^FS //Data to print (in this case the Article Length) $label .= '^FH^FD' . $this->convertToGermanHex($name) . '^FS'; //$label .= '^FD' . $name . ' ' . $length . '^FS'; //END COMMAND ^XZ $label .= "^XZ"; $result['barcode_type'] = 'label_product_hse'; $result['label'] = $label; $result['label_name'] = "{$ean}.data"; return $result; }
$chain_type[0] = 'None'; $q_chain = tep_db_query("SELECT element_chain_id, name FROM element_chain"); while ($chain = tep_db_fetch_array($q_chain)) { $chain_type[$chain['element_chain_id']] = $chain['name']; } $comma_info = '<span class="notice">(Use . "dot" as decimal separator)</span>'; $input_unit_info = '<span class="notice">(sample input: 1 cm, 2.2 gr, 3 in, etc.)</span>'; $content .= '<div class="bold" style="margin:10px 0 20px 0;">Fields marked with <span class="red">Auto Update</span> text will be automatically<br />updated by system whenever there are changes in Elements Used</div>'; $content .= '<fieldset>'; $content .= '<table class="form" border="0" cellpadding="0" cellspacing="0">'; //ARTICLE MEASUREMENTS START --- $measurements = $class_pmr->getList($product->category_id, 1); $content .= '<tr><td colspan="2"><h2 style="margin:0 0;">Article Measurement</h2>' . '<div class="notice" style="margin-bottom:10px;">* Press enter to save changes<br/>' . '* Measurement unit is required ' . $input_unit_info . '</div></td></tr>'; if (count($measurements) > 0) { foreach ($product->articles as $aid => $a) { $content .= '<tr><td colspan="2"><h3>Size - ' . $product->getLengthOrSizeAsText($aid) . '</h3></td></tr>'; foreach ($measurements as $msr_id => $msr_data) { $measurements_data = $class_pa->getMeasurementDetail($products_id, $aid, $msr_id); $msr_value = $measurements_data === false ? '' : $measurements_data['measurements_value']; $content .= '<tr><td>' . $msr_data['name'] . '</td><td>' . '<input id="pmsr-' . $aid . '-' . $msr_id . '" title="press enter to save" value="' . $msr_value . '" class="measurements_articles input" /></td></tr>'; } $content .= '<tr><td colspan="2"> </td></tr>'; } } else { $content .= '<tr><td colspan="2">No Measurement found for this category</td></tr>'; } $link_measurement_add = '<a href="?open=products-measurements" target="_blank">add new measurement</a>'; $content .= '<tr><td colspan="2">' . $link_measurement_add . '</td></tr>'; $content .= '<tr><td colspan="2"> </td></tr>'; //ARTICLE MEASUREMENTS DONE --- $content .= '</table>';
/** * Get cell value for Matahari catalog cell * @global Int $jng_sp_id * @global Array $sp_detail * @param String $column_key * @param Product $product * @param Int $aid * @return String */ function getMatahariCatalogCellValue($column_key, $product, $aid) { global $class_pb, $jng_sp_id, $sp_detail, $sp_values_brand, $sp_values_colors, $sp_values_navcat, $sp_values_navsubcat, $category_top_id; $lid = $sp_detail['languages_id']; if (!isset($sp_values_brand[$product->brand_id])) { $sp_brands = $class_pb->getSPbrands($product->brand_id); $sp_values_brand[$product->brand_id] = $sp_brands[$jng_sp_id]; } $product_old_function = $product->getOldProductFunction()->retrieveDetail($product->id, 'p,pd,pd2,pc,pnc,cat,pei,pci'); if ($category_top_id == '1') { if ($product_old_function['pci']['products_clear_image'] != '') { $main_image = substr($product_old_function['pci']['products_clear_image'], 23); } else { $main_image = substr($product_old_function['p']['products_image'], 23); } } else { $main_image = substr($product_old_function['p']['products_image'], 23); } $additional_images = array_values($product_old_function['pei']); $category_id = $product->category_id; $selling_points = $product->getSellingPointsAsArray($lid); switch ($column_key) { case 'Title*': if ($category_top_id == '1') { //JEWELRY $value = ucwords(strtolower($sp_values_brand[$product->brand_id])) . ' ' . $product_old_function['pd'][3]['products_name'] . ' ' . $product->getColors($lid); // $value = 'VON LORENZ' . ' ' . // $product_old_function['pd'][3]['products_name'] . ' ' . $product->getColors($lid); } else { $value = ucwords(strtolower($sp_values_brand[$product->brand_id])) . ' ' . $product->getName($lid) . ' ' . $product->getColors($lid); } break; case 'Brand': $value = $sp_values_brand[$product->brand_id]; // $value = 'VON LORENZ'; break; case 'Model': $value = ''; break; case 'Color*': $value = $product->getColors($lid); break; case 'Sale Price (Amount)*': $price = $product->getPriceSelling($jng_sp_id); $price_old = $product->getPriceSellingOld($jng_sp_id); if ($price_old <= $price) { //show blank if its not discounted $price = ''; } $value = $price; break; case 'Price (Amount)*': $price = $product->getPriceSelling($jng_sp_id); $price_old = $product->getPriceSellingOld($jng_sp_id); if ($price_old <= $price) { $price_old = $price; } $value = $price_old; break; case 'SKU*': $value = $product->getSKU($aid); break; case 'Size': //todo: translate ring sizes if ($category_top_id == '1') { if ($category_id == '29') { $value = $product->convertRingSizeToJapaneseSize($product->getLengthOrSizeAsText($aid)); } else { $value = 'One Size'; } } else { $value = $product->getLengthOrSizeAsText($aid); } break; case 'Model Number': $value = $product->getEAN($aid); break; case 'Stock': $value = $product->retrieveStockQuantity($aid); break; case 'Product Line': $value = 'Wanita'; break; case 'Normal Price (Amount)*': $value = $product->getPriceDefault(); break; case 'Normal Price (Currency)*': $value = 'IDR'; break; case 'Main Material': $value = ''; break; case 'Description*': $value = $product->getDescription($lid); break; case 'Youtube URL': $value = ''; break; case 'Highlight 1': $value = $selling_points[0]; break; case 'Highlight 2': $value = $selling_points[1]; break; case 'Highlight 3': $value = $selling_points[2]; break; case 'Highlight 4': $value = $selling_points[3]; break; case 'Highlight 5': $value = $selling_points[4]; break; case 'Highlight 6': $value = ''; break; case 'Highlight 7': $value = ''; break; case 'Highlight 8': $value = ''; break; case 'Highlight 9': $value = ''; break; case 'Highlight 10': $value = ''; break; case 'Highlight 11': $value = ''; break; case 'Highlight 12': $value = ''; break; case 'Insurance option': $value = '1'; break; case 'Handling fee (IDR)': $value = '0'; break; case 'Product Dimension': //Measurements is from Zalora Template $value = $product->displayMeasurement($lid); break; case 'Product Weight': $value = $product->displayWeight($lid); break; case 'Package Dimension (L x W x H cm)': //todo: use dynamic data $value = '40 x 35 x 3 cm'; break; case 'Certification': $value = ''; break; case 'Product Country': $value = ProductAttribute::displayAttributeName($product->id, ProductAttribute::GROUP_ID_ORIGIN, $lid); break; case 'Item Condition*': $value = 'new'; break; case 'Product Waranty': $value = ''; break; case 'Image 1*': //Currently Kristel will copy the link to this field manually. $value = $main_image; break; case 'Image 2': $value = $additional_images[0] == '' ? '' : substr($additional_images[0], 23); break; case 'Image 3': $value = $additional_images[1] == '' ? '' : substr($additional_images[1], 23); break; case 'Image 4': $value = $additional_images[2] == '' ? '' : substr($additional_images[2], 23); break; case 'Image 5': $value = $additional_images[3] == '' ? '' : substr($additional_images[3], 23); break; case 'Product Line': $value = ucfirst($product->getProductGender('1')); break; case 'Price (Currency)*': $value = 'IDR'; break; case 'Type': $value = ''; break; case 'Package Weight (Kg)': $value = 0.4; break; case 'product_id(MUST BE DELETED BEFORE UPLOAD)': $value = $product->id; break; default: $value = ''; } return $value; }