Index: openacs-4/packages/ecommerce/ecommerce.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/ecommerce.info,v diff -u -r1.28 -r1.29 --- openacs-4/packages/ecommerce/ecommerce.info 19 Sep 2002 23:38:19 -0000 1.28 +++ openacs-4/packages/ecommerce/ecommerce.info 27 Sep 2002 04:46:46 -0000 1.29 @@ -599,6 +599,7 @@ <file type="query_file" db_type="oracle" path="www/admin/products/toggle-active-p-oracle.xql"/> <file type="query_file" db_type="postgresql" path="www/admin/products/toggle-active-p-postgresql.xql"/> <file type="content_page" path="www/admin/products/toggle-active-p.tcl"/> + <file type="query_file" path="www/admin/products/toggle-active-p.xql"/> <file type="query_file" db_type="oracle" path="www/admin/products/toggle-no-shipping-avail-p-oracle.xql"/> <file type="query_file" db_type="postgresql" path="www/admin/products/toggle-no-shipping-avail-p-postgresql.xql"/> <file type="content_page" path="www/admin/products/toggle-no-shipping-avail-p.tcl"/> @@ -744,8 +745,6 @@ <file type="content_page" path="www/credit-card-correction.adp"/> <file type="content_page" path="www/credit-card-correction.tcl"/> <file type="query_file" path="www/credit-card-correction.xql"/> - <file type="content_page" path="www/default-ec-master.adp"/> - <file type="content_page" path="www/default-ec-master.tcl"/> <file type="content_page" path="www/delete-address.tcl"/> <file type="query_file" path="www/delete-address.xql"/> <file type="documentation" path="www/doc/audit.adp"/> @@ -970,53 +969,53 @@ <file type="query_file" path="www/update-user-classes.xql"/> </files> <parameters> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ExpressShippingP" default="1" description="Is express shipping available to your customers?" section_name="shipping"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="PickupP" default="0" description="Can orders be picked up from your location by customers?" section_name="shipping"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="PaymentRetryPeriod" default="8" description="The time in hours that temporarily failed transactions should be repeated for. Transactions that do not receive a definitive answer from the gateway with this period fail at the end of the period." section_name="payment information"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="PaymentGateway" description="The package-key of the payment gateway to use. Leave empty if you don't want to use a gateway." section_name="payment information"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="SaveCreditCardDataP" default="1" description="Whether to save credit card data (you have to save it if you're going to do manual billing) -- if you save it, then your users can reuse their credit card with one click" section_name="payment information"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="ImageMagickPath" default="/usr/local/bin/convert" description="ImageMagick's Convert utility is required to make thumbnails of products. This parameter points to the path of convert" section_name="technical"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="httpsModule" default="nsopenssl" description="The preferred AOLserver module that implements SSL. Typical behavior favors nsopenssl over nsssl. This parameter is only important if your site, for some unusual reason supports both nsopenssl as well as nsssl and you prefer nsssl." section_name="SSL"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="SystemName" default="Store" description="name of ecommerce system"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="SystemOwner" description="email address of owner of shop" section_name="technical"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="CacheRefresh" default="600" description="Seconds between cache (util_memoize) updates" section_name="technical"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="OfferTaxExemptStatusP" default="0" description="Should we ask people if their organization is tax exempt?" section_name="associated charges"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="MultipleRetailersPerProductP" default="0" description="Set to 1 if you have a comparison shopping service -- Note: support for multiple retailers does not work yet in Version 1.0 of the Ecommerce Module, so leave it as 0" section_name="technical"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="ProductDataDirectory" default="product/" description="This path goes on the end of the EcommerceDataDirectory. IF YOU DON'T SET THIS CORRECTLY, YOUR SYSTEM WON'T WORK! Make sure to replace yourservername with the correct name. You also have to create the directories you specify in the file-system. See technical setup document." section_name="technical"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="EcommerceDataDirectory" default="/web/yourservername/data/ecommerce/" description="path to Product data directories (where product files like images are kept). It is useful to keep this away from the normal pageroot so that uploaded .tcl or .adp files cannot be executed with a URL. IF YOU DON'T SET THIS CORRECTLY, YOUR SYSTEM WON'T WORK! Make sure to replace yourservername with the correct name. You also have to create the directories you specify in the file-system. See technical setup document." section_name="technical"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="GiftCertificateMonths" default="12" description="number of months until user-purchased gift certificates expire" section_name="gift certificates"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="MaxGiftCertificateAmount" default="300" description="maximum gift certificate amount they can buy" section_name="gift certificates"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="MinGiftCertificateAmount" default="5" description="minimum gift certificate amount they can buy (this does not impose minimum amount for administrators giving users gift certificates)" section_name="gift certificates"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="SellGiftCertificatesP" default="1" description="whether to allow users to buy gift certificates" section_name="gift certificates"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="DisplayTransactionMessagesDuringFulfillmentP" default="1" description="you may or may not wish to have the people recording shipments receive messages like 'unable to authorize payment for shipment' -- depending on whether they they're in a position to do anything about the problem (e.g. abort shipment)" section_name="fulfillment"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="CustomerServiceEmailDescription" default="Ecommerce Customer Service" description="the description of the outgoing email address" section_name="technical"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="CustomerServiceEmailAddress" default="service@yourdomain.com" description="all outgoing email is sent from this address" section_name="technical"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="AllowPreOrdersP" default="1" description="whether customers will be able to place orders for items whose available_date has not yet come" section_name="shopping cart"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="CartDuration" default="30" description="# of days an 'in_basket' order will remain in the system before a cron job expires it" section_name="shopping cart"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageI" default="In Stock" description="in stock" section_name="messages"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageS" default="Usually Ships Within 2-4 Weeks" description="text of ships slowly message" section_name="messages"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageM" default="Usually Ships Within 2-3 Days" description="text of hips moderately quickly message" section_name="messages"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageQ" default="Usually Ships Within 24 Hours" description="text of ships quickly message" section_name="messages"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageO" default="Out of Stock" description="text of out of stock message" section_name="messages"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ThumbnailHeight" default="100" description="for thumbnails of products, specify either width or height (whichever is more important, and then the other will be determined based on the original image size, keeping aspect ratio constant) -- if both are specified, the width setting will take precedence, and if neither is specified, the thumbnail will be width default=100" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ThumbnailWidth" default="100" description="for thumbnails of products, specify either width or height (whichever is more important, and then the other will be determined based on the original image size, keeping aspect ratio constant) -- if both are specified, the width setting will take precedence, and if neither is specified, the thumbnail will be width default=100" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="EnabledP" default="1" description="set this to 1 if you're using the ecommerce module"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ShippingRefundPercent" default="0" description="percentage refunded if an item is returned" section_name="associated charges"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="UserClassApproveP" default="1" description="if a user requests to be in a user class, is approval required before that user becomes a member of the user class" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="UserClassAllowSelfPlacement" default="1" description="whether a user can request to be a member of a user class" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="UserClassUserViewP" default="1" description="whether users can see what user classes they are in" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="CalcProductRelationshipsP" default="0" description="whether the system should calculate additional product relationships" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ProductCommentsNeedApprovalP" default="1" description="whether user comments on products (if allowed) need approval before becoming live" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ProductCommentsAllowP" default="1" description="whether to allow user comments on products" section_name="display"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ProductsToDisplayPerPage" default="10" description="this is used on the category browse page (and for subcategories/subsubcategories)" section_name="display"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="Currency" default="USD" description="currency units, USD, dollars, lira, etc." section_name="units"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="WeightUnits" default="lbs" description="weight units such as pounds, carats, ounces, etc." section_name="units"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="SecureLocation" description="A URL fragment (protocol, hostname, and port) appended before transactions URLs. Defaults to "". If the value is "" ecommerce will examine the values of httpModule and httpsModule to determine the secure location." section_name="SSL"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="InsecureLocation" description="A URL fragment (protocol, hostname, and port) appended before "insecure" transactions URLs. Defaults to """ section_name="SSL"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="httpModule" description="The AOLserver module that implements "normal" communications (usually nsunix or nssock) Typical behavior favors nsunix over nssock, if both are present. You only need to set this parameter if your site supports both nsunix and nssock, but you prefer nssock." section_name="SSL"/> - <parameter datatype="string" min_n_values="1" max_n_values="1" name="ShippingGateway" description="The shipping gateway that should be used to calculate the shipping charges instead of the default ecommerce calculations." section_name="shipping"/> - <parameter datatype="number" min_n_values="1" max_n_values="1" name="ECTemplatesMayContainTclFunctionsP" default="1" description="Set to 1 if Tcl functions are allowed in the product and e-mail templates. Set to 0 if not." section_name="style"/> <parameter datatype="string" min_n_values="1" max_n_values="1" name="CreditCardsAccepted" default="VISA {American Express} MasterCard" description="A list of accepted credit card types" section_name="payment information"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ECTemplatesMayContainTclFunctionsP" default="1" description="Set to 1 if Tcl functions are allowed in the product and e-mail templates. Set to 0 if not." section_name="style"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="ShippingGateway" description="The shipping gateway that should be used to calculate the shipping charges instead of the default ecommerce calculations." section_name="shipping"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="httpModule" description="The AOLserver module that implements "normal" communications (usually nsunix or nssock) Typical behavior favors nsunix over nssock, if both are present. You only need to set this parameter if your site supports both nsunix and nssock, but you prefer nssock." section_name="SSL"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="InsecureLocation" description="A URL fragment (protocol, hostname, and port) appended before "insecure" transactions URLs. Defaults to """ section_name="SSL"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="SecureLocation" description="A URL fragment (protocol, hostname, and port) appended before transactions URLs. Defaults to "". If the value is "" ecommerce will examine the values of httpModule and httpsModule to determine the secure location." section_name="SSL"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="WeightUnits" default="lbs" description="weight units such as pounds, carats, ounces, etc." section_name="units"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="Currency" default="USD" description="currency units, USD, dollars, lira, etc." section_name="units"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ProductsToDisplayPerPage" default="10" description="this is used on the category browse page (and for subcategories/subsubcategories)" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ProductCommentsAllowP" default="1" description="whether to allow user comments on products" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ProductCommentsNeedApprovalP" default="1" description="whether user comments on products (if allowed) need approval before becoming live" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="CalcProductRelationshipsP" default="0" description="whether the system should calculate additional product relationships" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="UserClassUserViewP" default="1" description="whether users can see what user classes they are in" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="UserClassAllowSelfPlacement" default="1" description="whether a user can request to be a member of a user class" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="UserClassApproveP" default="1" description="if a user requests to be in a user class, is approval required before that user becomes a member of the user class" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ShippingRefundPercent" default="0" description="percentage refunded if an item is returned" section_name="associated charges"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="EnabledP" default="1" description="set this to 1 if you're using the ecommerce module"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ThumbnailWidth" default="100" description="for thumbnails of products, specify either width or height (whichever is more important, and then the other will be determined based on the original image size, keeping aspect ratio constant) -- if both are specified, the width setting will take precedence, and if neither is specified, the thumbnail will be width default=100" section_name="display"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ThumbnailHeight" default="100" description="for thumbnails of products, specify either width or height (whichever is more important, and then the other will be determined based on the original image size, keeping aspect ratio constant) -- if both are specified, the width setting will take precedence, and if neither is specified, the thumbnail will be width default=100" section_name="display"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageO" default="Out of Stock" description="text of out of stock message" section_name="messages"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageQ" default="Usually Ships Within 24 Hours" description="text of ships quickly message" section_name="messages"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageM" default="Usually Ships Within 2-3 Days" description="text of hips moderately quickly message" section_name="messages"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageS" default="Usually Ships Within 2-4 Weeks" description="text of ships slowly message" section_name="messages"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="StockMessageI" default="In Stock" description="in stock" section_name="messages"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="CartDuration" default="30" description="# of days an 'in_basket' order will remain in the system before a cron job expires it" section_name="shopping cart"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="AllowPreOrdersP" default="1" description="whether customers will be able to place orders for items whose available_date has not yet come" section_name="shopping cart"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="CustomerServiceEmailAddress" default="service@yourdomain.com" description="all outgoing email is sent from this address" section_name="technical"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="CustomerServiceEmailDescription" default="Ecommerce Customer Service" description="the description of the outgoing email address" section_name="technical"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="DisplayTransactionMessagesDuringFulfillmentP" default="1" description="you may or may not wish to have the people recording shipments receive messages like 'unable to authorize payment for shipment' -- depending on whether they they're in a position to do anything about the problem (e.g. abort shipment)" section_name="fulfillment"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="SellGiftCertificatesP" default="1" description="whether to allow users to buy gift certificates" section_name="gift certificates"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="MinGiftCertificateAmount" default="5" description="minimum gift certificate amount they can buy (this does not impose minimum amount for administrators giving users gift certificates)" section_name="gift certificates"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="MaxGiftCertificateAmount" default="300" description="maximum gift certificate amount they can buy" section_name="gift certificates"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="GiftCertificateMonths" default="12" description="number of months until user-purchased gift certificates expire" section_name="gift certificates"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="EcommerceDataDirectory" default="/web/yourservername/data/ecommerce/" description="path to Product data directories (where product files like images are kept). It is useful to keep this away from the normal pageroot so that uploaded .tcl or .adp files cannot be executed with a URL. IF YOU DON'T SET THIS CORRECTLY, YOUR SYSTEM WON'T WORK! Make sure to replace yourservername with the correct name. You also have to create the directories you specify in the file-system. See technical setup document." section_name="technical"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="ProductDataDirectory" default="product/" description="This path goes on the end of the EcommerceDataDirectory. IF YOU DON'T SET THIS CORRECTLY, YOUR SYSTEM WON'T WORK! Make sure to replace yourservername with the correct name. You also have to create the directories you specify in the file-system. See technical setup document." section_name="technical"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="MultipleRetailersPerProductP" default="0" description="Set to 1 if you have a comparison shopping service -- Note: support for multiple retailers does not work yet in Version 1.0 of the Ecommerce Module, so leave it as 0" section_name="technical"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="OfferTaxExemptStatusP" default="0" description="Should we ask people if their organization is tax exempt?" section_name="associated charges"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="CacheRefresh" default="600" description="Seconds between cache (util_memoize) updates" section_name="technical"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="SystemOwner" description="email address of owner of shop" section_name="technical"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="SystemName" default="Store" description="name of ecommerce system"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="httpsModule" default="nsopenssl" description="The preferred AOLserver module that implements SSL. Typical behavior favors nsopenssl over nsssl. This parameter is only important if your site, for some unusual reason supports both nsopenssl as well as nsssl and you prefer nsssl." section_name="SSL"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="ImageMagickPath" default="/usr/local/bin/convert" description="ImageMagick's Convert utility is required to make thumbnails of products. This parameter points to the path of convert" section_name="technical"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="SaveCreditCardDataP" default="1" description="Whether to save credit card data (you have to save it if you're going to do manual billing) -- if you save it, then your users can reuse their credit card with one click" section_name="payment information"/> + <parameter datatype="string" min_n_values="1" max_n_values="1" name="PaymentGateway" description="The package-key of the payment gateway to use. Leave empty if you don't want to use a gateway." section_name="payment information"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="PaymentRetryPeriod" default="8" description="The time in hours that temporarily failed transactions should be repeated for. Transactions that do not receive a definitive answer from the gateway with this period fail at the end of the period." section_name="payment information"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="PickupP" default="0" description="Can orders be picked up from your location by customers?" section_name="shipping"/> + <parameter datatype="number" min_n_values="1" max_n_values="1" name="ExpressShippingP" default="1" description="Is express shipping available to your customers?" section_name="shipping"/> </parameters> </version> Index: openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.tcl 26 May 2002 04:36:49 -0000 1.8 +++ openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.tcl 27 Sep 2002 04:46:45 -0000 1.9 @@ -54,18 +54,26 @@ } { - # For each product find other products that are items of orders - # with the same user_id. + # First prune expired combinations. A combination is deemed + # expired when one of the products is inactive. - db_foreach products_select "select product_id from ec_products" { + ec_prune_product_purchase_combinations + + # For each active product find other active products that are + # items of orders with the same user_id. + + db_foreach products_select "select product_id from ec_products where active_p = 't'" { + + # Then find current product combinations. + set correlated_product_counter 0 set insert_cols [list] set insert_vals [list] set update_items [list] db_foreach correlated_products_select " select i2.product_id as correlated_product_id, count(*) as n_product_occurrences - from ec_items i2 + from ec_items i2, ec_products p where i2.order_id in (select o2.order_id from ec_orders o2 where o2.user_id in (select user_id @@ -74,6 +82,8 @@ from ec_items i where product_id = :product_id))) and i2.product_id <> :product_id + and i2.product_id = p.product_id + and p.active_p = 't' group by i2.product_id order by n_product_occurrences desc" { if { $correlated_product_counter >= 5 } { Index: openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.xql 26 May 2002 04:36:50 -0000 1.5 +++ openacs-4/packages/ecommerce/tcl/ecommerce-scheduled-procs.xql 27 Sep 2002 04:46:45 -0000 1.6 @@ -4,23 +4,25 @@ <fullquery name="ec_calculate_product_purchase_combinations.products_select"> <querytext> - select product_id from ec_products + select product_id from ec_products where active_p = 't' </querytext> </fullquery> <fullquery name="ec_calculate_product_purchase_combinations.correlated_products_select"> <querytext> select i2.product_id as correlated_product_id, count(*) as n_product_occurrences - from ec_items i2 + from ec_items i2, ec_products p where i2.order_id in (select o2.order_id from ec_orders o2 where o2.user_id in (select user_id from ec_orders o where o.order_id in (select i.order_id from ec_items i where product_id = :product_id))) - and i2.product_id <> :product_id + and i2.product_id = p.product_id + and p.active_p = 't' + and i2.product_id <> :product_id group by i2.product_id order by n_product_occurrences desc </querytext> Index: openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl 12 Sep 2002 02:41:56 -0000 1.10 +++ openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl 27 Sep 2002 04:46:45 -0000 1.11 @@ -1027,3 +1027,19 @@ set userag [ns_set iget $header "USER-AGENT"] return $userag } + +ad_proc ec_prune_product_purchase_combinations { +} { + Prune expired product purchase combinations. A combination is + deemed expired when one of the products is inactive. + +} { + db_dml prune_expired_combinations { + delete from ec_product_purchase_comb + where exists (select product_id + from ec_products p + where p.active_p = 'f' + and p.product_id in (ec_product_purchase_comb.product_id, ec_product_purchase_comb.product_0, + ec_product_purchase_comb.product_1, ec_product_purchase_comb.product_2, + ec_product_purchase_comb.product_3, ec_product_purchase_comb.product_4))} +} Index: openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.xql 26 May 2002 04:36:50 -0000 1.4 +++ openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.xql 27 Sep 2002 04:46:45 -0000 1.5 @@ -83,4 +83,16 @@ </querytext> </fullquery> + <fullquery name="ec_prune_product_purchase_combinations.prune_expired_combinations"> + <querytext> + delete from ec_product_purchase_comb + where exists (select product_id + from ec_products p + where p.active_p = 'f' + and p.product_id in (ec_product_purchase_comb.product_id, ec_product_purchase_comb.product_0, + ec_product_purchase_comb.product_1, ec_product_purchase_comb.product_2, + ec_product_purchase_comb.product_3, ec_product_purchase_comb.product_4)) + </querytext> + </fullquery> + </queryset> Index: openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.tcl 10 Sep 2002 22:22:45 -0000 1.2 +++ openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.tcl 27 Sep 2002 04:46:42 -0000 1.3 @@ -6,7 +6,7 @@ @cvs-id $Id$ @author ported by Jerry Asher (jerry@theashergroup.com) } { - product_id:integer,notnull + product_id:integer,notnull } ad_require_permission [ad_conn package_id] admin @@ -17,12 +17,15 @@ set peeraddr [ns_conn peeraddr] db_dml toggle_active_p_update " -update ec_products -set active_p = logical_negation(active_p), - last_modified = sysdate, - last_modifying_user = :user_id, - modified_ip_address = :peeraddr -where product_id = :product_id -" + update ec_products + set active_p = logical_negation(active_p), last_modified = sysdate, last_modifying_user = :user_id, + modified_ip_address = :peeraddr + where product_id = :product_id" +# Recalculate product purchase combinations to remove combinations +# involving the discontinued product. + +if {![template::util::is_true [db_string is_product_active_p "select active_p from ec_products where product_id = :product_id"]]} { + ec_prune_product_purchase_combinations +} ad_returnredirect "one.tcl?[export_url_vars product_id]" Index: openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ecommerce/www/admin/products/toggle-active-p.xql 27 Sep 2002 04:46:42 -0000 1.1 @@ -0,0 +1,13 @@ +<?xml version="1.0"?> + +<queryset> + + <fullquery name="is_product_active_p"> + <querytext> + select active_p + from ec_products + where product_id = :product_id + </querytext> + </fullquery> + +</queryset>