AndreasG Posted December 10, 2006 Posted December 10, 2006 Hello! As contribution PDF Catalog 2.0.2 generates a catalog of the whole database, I would like to generate a catalog of the shopping cart products. Can anybody tell me which changes I have to make? Thanks a lot! Andreas Quote
Jack_mcs Posted December 10, 2006 Posted December 10, 2006 (edited) I don't understand what you mean by "whole database." Are you saying it lists your customers? It should just list your products. You can control how they are listed by the options in the config file for that contribution. Have you tried that? Jack Edited December 10, 2006 by Jack_mcs Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
AndreasG Posted December 12, 2006 Author Posted December 12, 2006 Thanks for your quick answer and help. By "whole database" I just mean the products. This works fine. I can modify the way they are listed etc. as it is supposed to be. My question goes into a new direction: I would like to generate a catalog with just the products of the shopping cart (and not the whole catalog or categories etc.). Do you have any idea which changes I have to make (probably in pdf_catalogue_info.php)?? Andreas Quote
Jack_mcs Posted December 13, 2006 Posted December 13, 2006 Have you looked at the options in the pdf config file? Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
AndreasG Posted December 14, 2006 Author Posted December 14, 2006 Hello again! I tried the config, but there is no such option. The solution is probably as follows: I have to push all information from the shopping cart in an array (as it is done in shopping_cart.php in the main directory). Then I have to modify pdf_catalogue_info.php in order to send the shopping cart products to the pdf generator. But how to do this? I'm not familiar to writing php and just figured this out - can you help me with that array in pdf_catalogue_info.php?? Thanks for your support! Andreas Quote
AndreasG Posted December 14, 2006 Author Posted December 14, 2006 If you have time to take a look at it I just add my modification of the code of pdf_catalogue_info.php (I post only the relevant table). THIS CODE HAS A BUG!!! It correctly displays the shopping cart information on the first and second site of the pdf generation with PDF Catalog. But it does NOT send the shopping cart information to the pdf generator and therefore does not create the PDF with the shopping cart products (as I intend to). <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main" align="left"><?php echo TEXT_PDF_DESCRIPTION2; ?></td> </tr> <tr> <td class="main"> <?php $file = DIR_WS_PDF_CATALOGS . PDF_FILENAME_CATEGORIES; //******************************************************************************** ********************************************************************************* ************************************************************************* if(!isset($GO_ON)){ // Neuerung v 1.6 by Michael Palmer. Anzeigen der Kategorien und Auswahl über Checkbox mit Speicherung in einem Array // Übergeben des Arrays über Standardvariable, da die Session durch Behinderung der Admin-Session nicht benutzt werden konnte. echo '<form action="" method="post">'; $i = 0; echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td class="main">'; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array (as it is done in shopping_cart.php) if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $categories_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); } } } for ($i=0, $n=sizeof($products); $i<$n; $i++) { echo '<input name="KATEGORIE_SELECTED2['.$i.']" type="checkbox" checked value="'. $products[$i]['id'] .'"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a><br>'; } while ($categories = tep_db_fetch_array($categories_query)) { $i++; } echo '<br><input name="no_of_files" type="radio" value="one_file" checked="checked" />'. PDF_TXT_ONE_FILE.'<br><input name="no_of_files" type="radio" value="more_files" />'.PDF_TXT_ONE_FILE_PER_CATEGORY; echo '<input type="hidden" name="GO_ON" value="1">'; echo '<br><input type="hidden" name="ANZAHL" value="'.$i.'">'; echo '<br><p align="right"><input type="submit" name="submit" value="' . IMAGE_BUTTON_CONTINUE .'"></p>'; echo '</form>'; echo '</td></tr></table>'; } if(isset($GO_ON) && isset($KATEGORIE_SELECTED2)){ //Neuerung v 1.6 by Michael Palmer //Bestätigung der ausgewählten Kategorien und abschicken des Formulars zur Erzeugung der PDF echo tep_draw_form('pdf_quantity', tep_href_link(FILENAME_PDF_SHOPPING_CART, tep_get_all_get_params(array('action')) . '')); //echo "<form action=". FILENAME_PDF_SHOPPING_CART ." method=post>"; echo PDF_TXT_AUSWAHL ; $iCOUNT = 0; for ($i = 0; $i < $ANZAHL; $i++) { if ($KATEGORIE_SELECTED2[$i] != "") { $KATEGORIE_SELECTED[$iCOUNT] = $KATEGORIE_SELECTED2[$i]; $iCOUNT++; $categories_query = tep_db_query("select cd.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.categories_id= '$KATEGORIE_SELECTED2[$i]' and cd.language_id='" . (int)$languages_id ."' order by cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { echo "<b>".$products[$i]['name']."</b><br>"; break; } } } echo PDF_TXT_KLICK; //Array in Normale Variable Speichern, damit die Daten mit einem iFrame weiter gegeben werden können for ($i = 0; $i < $iCOUNT; $i++) { if (!isset($KAT_SELECTED_ARRAY)) { $KAT_SELECTED_ARRAY = $KATEGORIE_SELECTED[$i]; } else { $KAT_SELECTED_ARRAY = $KAT_SELECTED_ARRAY."|".$KATEGORIE_SELECTED[$i]; } } //Übergeben der Anzahl, PDF_ACTION und Array Variable echo '<input type="hidden" name="file" value="'.$file.'"><input type="hidden" name="KAT_SELECTED_ARRAY" value="'.$KAT_SELECTED_ARRAY.'"><input type="hidden" name="PDF_ACTION" value="1">'; echo '<br><br><input type="hidden" name="no_of_files" value="'.$no_of_files.'"><input type="hidden" name="ANZAHL_KATEGORIEN" value="'.$iCOUNT.'">'; echo '<p align="right"><input type="submit" name="submit" value="' . PDF_TXT_GENERATE .'"></p>'; echo "</form>"; } elseif(isset($GO_ON)) { echo '<font color="#FF0000">'.PDF_TXT_ERROR1 .'<a href="java script:history.back()" TARGET="_self">'.PDF_TXT_ERROR2 ."</a>".PDF_TXT_ERROR3; } //******************************************************************************** ********************************************************************************* ************************************************************************* ?> </td> </tr> </table> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.