Zen Cart has a products_model field. If you populate that with the SKU number, when you're inserting all their products into your database, then you could customize the code to do add-to-cart actions based on products_model instead of products_id.
Zen Cart has a products_model field. If you populate that with the SKU number, when you're inserting all their products into your database, then you could customize the code to do add-to-cart actions based on products_model instead of products_id.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Another thing is that there are about 16k parts in one of the manufacturers catalog, I got to upload around 20 of them. And I have no idea what might be the chance that some of the parts could have same sku...
But anyway, could you please tell me where do I look to change products_id to products_model
Easy
Just add a new file, as follows:
/includes/extra_cart_actions/buy_now_by_model_number.php
Now you can use URLs like this:Code:<?php /** * Custom shopping Cart actions * * @package initSystem * @copyright Copyright 2003-2011 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } /** * check whether an "action" has been set. And if m= is set but no products_id is set, * then lookup products_id from products_model (m) */ if (isset($_GET['action']) && $_GET['action']=='buy_now' && isset($_GET['m']) && !isset($_GET['products_id'])) { $sql= "select products_id from " . TABLE_PRODUCTS . " where products_model = :themodel: LIMIT 1"; $sql = $db->bindvars($sql, ':themodel:', $_GET['m'], 'string'); $lookup = $db->Execute($sql); if ($lookup->RecordCount() == 1) { $_GET['products_id'] = $lookup->fields['products_id']; unset($_GET['m']); zen_redirect(zen_href_link($goto, zen_get_all_get_params('m'))); } }
index.php?action=buy_now&m=THEMODELNUMBER
.. where THEMODELNUMBER is the case-sensitive model number assigned to your products_model field in your database's products table. (Same as the model number on the admin edit-product screen)
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Doc, you the best! The only thing you forgot is to close php
THANK YOU!![]()
Actually, that was very intentional: https://www.zen-cart.com/tutorials/i...hp?article=313You're welcome.
Happy Thanksgiving.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.