Bloke
Forum Replies Created
-
Forum: Plugins
In reply to: [WP eCommerce] Is it possbile to choose category in permalinkThanks I will check it out. Maybe this could get put into WP-ecommerce. Because if a product is in category “abc” and “def” the permalink for the category will always be “abc” because it’s doing it in alphabetical order. In my case its “sale” and I don’t want all products in the “sale” category to have “sale” as the permalink.
Forum: Fixing WordPress
In reply to: Creating a shortcode to accept multiple IDsI got it to work using explode.
add_shortcode('my_wpsc_access', 'my_wpsc_access_shortcode'); function my_wpsc_access_shortcode($atts) { global $post; extract(shortcode_atts( array( 'post_type' => 'wpsc-product', 'posts_per_page' => -1, 'wpsc_product_category'=>'accessories', 'post__in' => '', ), $atts ) ); $args = array( 'post_type' => $post_type, 'posts_per_page' => $posts_per_page, 'wpsc_product_category'=>$accessories, 'post__in' => explode(',', $post__in), ); $myquery = new WP_Query($args);Forum: Plugins
In reply to: [WP eCommerce] Expanding navigation keep open on page refreshInstead of using the list of product categories, I used this plugin. I created a custom menu of all the product categories.
Forum: Plugins
In reply to: [WP eCommerce] Category image missing on product category pageAnyone else have this issue?
Forum: Plugins
In reply to: [WP eCommerce] Expanding navigation keep open on page refreshHere are the only two references to doing this I can find online. I need a way to keep the menu expanded on page load.
http://ken.ph/wp-e-commerce-expandablecollapsible-menu/http://www.eclipse-creations.com/blog/other/collapsing-categories-in-wp-e-commerce/
Forum: Plugins
In reply to: [WP eCommerce] Expanding navigation keep open on page refreshDoes anyone have a working example of long list of product categories that expands and stays open when you load the next page?
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseSo I got to thinking, if I send the cat_id when the form is submitted, I should send the prod_order. I have this piece of code. So I added a text box next to each check box. if I can find a way to send a value for the order it could work.
$cats = $prod->getProductCategories(); if(count($cats)>0) { foreach($cats as $cat) { ?> <tr> <td><?php echo $cat['cat_name'];?></td> <td><input type='checkbox' name='prodCategories[]' value='<?php echo $cat['cat_id']; ?>' <?php if($editProduct) echo $prod->isCheckSelected($cat['cat_id'], $vals['prod_id']); ?>/></td> </tr> <tr><td><input type="text" name="pcatorder" value=''/></td></tr> <?php } }Forum: Fixing WordPress
In reply to: Help saving araay data to databaseYes the whole form that has the product name, title, description, images, and files associated gets updated. So even though I cam not changing a category, it has to reassign the associations with all the files and categories. This then gives it a new assoc_id number. But looking over it today, I can’t get it to work as done above. Because it loops dynamically with the categories check boxed selected. So when cat_id 2 and 3 are checked, it has no connection to the order. (Category -to- Order)relation doesn’t apply. I was manually adding values in the database yet the database dynamically doesn’t include the order. Thus wiping out my order column.
Basically, for every category selected for this item, create a new line. Doesn’t account for the order.
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseShould it go before or after this line
for($i= 0; $i < count($cats); $i++)I will elaborate what the entire script currently does and how I am trying to revise it.
Each product id can appear in multiple categories. So there is the cat_assoc table. Each product id has (pdf) files associated with it so there is a addition_files table. When a product is edited and saved, it deletes the records associated in the categories and files tables. Then assignes the associations again. So assoc_id 123, prod_id 1, cat_id 2, prod_order 5
becomes assoc_id 124, prod_id 1, cat_id 2, prod_order 5. The problem I am having is if 2 or more records are entered, it randomly places the prod_order value. So below in category 2 should keep order of 5 and category 3 should keep order of 6.Record 1: 124, 1, 2, 5
Record 2: 125, 1, 3, 6Maybe there is a better way to record the product order in a table. I assume the category_assoc was the best way.
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseWhere would I put it around this code? I already have this line for the categories.
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseif($edit) $wpdb->query("DELETE FROM category_assoc WHERE prod_id = '$lastID'"); for($i= 0; $i < count($cats); $i++) { $wpdb->insert("category_assoc", array( "prod_id" => $lastID, "cat_id" => $cats[$i] , "prod_order" => => $order ), array('%d', '%d', '%d' )); $wpdb->query($catCategory); }Forum: Fixing WordPress
In reply to: Help saving araay data to databasecategory_assoc has these values: cat_assoc_id, prod_id, cat_id, prod_order
123,18,13,6 where 6 is the order. It is keeping the values but not in order. Product id 18 appear in category 13 in prod_order of 6 and it needs to remain that way. It will save it like this
123, 18, 13, 4. Either way I need to find a way to get multiple records back and reinsert them to the database in order.
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseThe $i is something I was trying. “prod_order” => $array[$i] works but the order is not correct. And “prod_order” => $array[] throws error. So its the formatting I have wrong. I guess its not correct. But at lease this was holding the values when it insert to the database. If it should be something else let me know.
I can change the integer type to.
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseOk its formatted now. I guess I need to match up the value of the prod_order to cat_id?
Forum: Fixing WordPress
In reply to: Help saving araay data to databaseSorry it puts the in there when I pasted it.
It sort of got it working. It holds keeps the values of the prod_order but not assigned to the correct record.
It will save it as:
123, 18, 13, 4
124, 18, 11, 6
instead of:
123, 18, 13, 6
124, 18, 11, 4$getem1 = $wpdb->get_results("SELECT * FROM category_assoc WHERE prod_id = '$lastID'"); $array = array(); foreach ($getem1 as $res){ $array[] = $res->prod_order; } $wpdb->insert("category_assoc", array( "prod_id" => $lastID, "cat_id" => $cats[$i] , "prod_order" => $array[$i] ), array('%s', '%s', '%s' ));