Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter jcc5018

    (@jcc5018)

    A site built on wordpress that puts everything in the same post table. So every plugin whether still active or not adds a stupid post type cause creating dedicated tables in wordpress as it should be, just seems to much to ask.

    But even if it were the ones i created myself, i’d have a decent amount, as thats really the only good way to create a 1:m relationship that is quarriable. My Laravel version of this site would have 150 tables/ models to handle this.

    Thread Starter jcc5018

    (@jcc5018)

    David, again thank you for informing me about expanding the list of photos per page, that helps a lot, and adding the RML folder ids. I am wondering if you have a way to include the hidden taxonomy in the term search?

    Thread Starter jcc5018

    (@jcc5018)

    Well the goal is to have woo commerce with the products, but as of now, there is no method to attach a photo to a product, so Ive got two methods that would allow this. One, select photo, then product to ttach it too. Two, select product, then select photo. But to prevent people from navigating thousands of images to find a photo for a product, they could simply create a gallery of favorites and choose from those.

    I actually have been working on an entire content management system for photographers and creative types, but I would need someone to help me build it after I design it. If you would be interested in partnering on a project that could be sold to other people as well, please shoot me a message. Thanks.

    I’m debating if i want to keep it within wordpress, or have it as an independent platform.

    Thread Starter jcc5018

    (@jcc5018)

    Thanks for the feed back, i will try your suggestions. Between the three of your plugins, you have allowed me to accomplish what i have been trying to do with my premium theme (THE7) for a long time. I like their theme, but the workflow to upload images was way to complicated for what it needed to be, and someone with thousands of images, i need the fastest method possible to upload, and assign images to a particular taxonomy and album.

    Now if either of you can help me figure out how to add a favorite button to images in particular galleries (all images but supporting site content) And then allow me to attach those images to products to sell, that would be awesome.

    I can write the UML for it, but I don’t know wordpress hooks and all to do it myself. Thanks

    Thread Starter jcc5018

    (@jcc5018)

    This is what I’m working with so far. I’d be happy to do it within php and wordpress, but I’m not entirely sure how. If i can just set variables, run foreach statements, ect, then I may be able to figure it out. But If I have to use the $wpdb methods to accomplish this, I may need some assistance. This is not a complete list, but should be a good start.

    update ‘wp_hyhg_post’ p set ‘post_parent’= @id1

    set @id = select ‘ID’ from ‘wp_hyhg_post’ where ‘post_type’=’uc-collections’
    select ‘meta_value’ from ‘wp_hyhg_postmeta’ where ‘meta_key’ = ‘group_id’ AND ‘post_id’ =@id1
    set @id1 = select ‘post_id’ from ‘wp_hyhg_postmeta’ where ‘meta_value’ = ‘variant’

    set @product = select ‘post_id’ from ‘wp_hyhg_postmeta’ where ‘meta_value’ = ‘product’

    Thread Starter jcc5018

    (@jcc5018)

    ok, So I added the post meta by running the import plugin again to update the fields.

    Now I’ve got another similar problem that the import plugin didnt fix for me. I previously had the product post uploaded, and I just now added the variations to that. So each variation needs its parent post defined. I have over 600 entries so its another thing, I dont really want to do manually. But I am having trouble figuring out how to word the function to make this work.

    The Tables: columns in question are wp_hyhg_postmeta(pm) :post_id, meta_key, meta_value wp_hyhg_post (p): ID, post_content, post_parent, post_type

    So I need to create a query that updates p.post_parent with pm.post_id If meta_key=’group_id’ And meta_value is in post_content.

    post_content for the relevant post types contains a product sku in the form of “SKU: $product_sku” (SKU: AB_1000)

    So for example if the postmeta row is post_id=1, meta_key= group_id, and meta_value= AB

    and the post data has post_content = “SKU: AB_1000” then post_parent will be updated to 1 because AB appears in the string.

    For an extra check, the corresponding post meta for each post with a sku code should also have meta_value =product

    If comparing to the post_content field could cause problems, I also have the product_sku listed in the post meta table as a meta_key/ value

    There may be an easier way to do what I need to do, but right now, Im seeing that I have to pass the post id back and forth to do several different comparisons. I’m assuming some sort of join statement is what I’m going to need, but I not sure how to write it.

    Thread Starter jcc5018

    (@jcc5018)

    I’m starting to wonder if I should just include the taxonomy terms as parents to the product groups in the customer post type opposed to a taxonomy. I would just need a different template for each level of the hierarchy. Not sure if that’s possible either.

    something along the lines of: (this is just a very rough outline that I’m making up as I go. I’m not worried bout correct syntax or function names at this point. If it makes sense, maybe we can go with this with the correct functions defined. Note I am using SQL, cause it makes a little more sense to me than the wordpress loop at this point.

    Create post selection box that has values (collection, product, variant)
    Each collection must have at least one product and each product must have one variant for data to be displayed.

    function get_collection ()
    {$product=select * from Product where type='collection'
    IF (count(get_product())>=1)
    {echo "Post_title";
    content();
    }
    
    function (get_product)
    {$id=get_parent_id();
    $products[]=select * from Product where parent_Id=$id AND type='product'
    
    Foreach ($Products as $Product)
    IF (count(get_variant())>=1)
         {echo "Post_title";
         content();
    //display or return post meta data from $product
    }
    
    function get_variant()
    {$id=get_parent_id();
    $variant[]=select * from Product where parent_Id=$id AND type='variant'
    //display or return post meta data from $variant
    }
    
    $var=get_post_meta (post_id(), 'variant');
    
    switch ($var)
    case 'collection':
    get_collection();
    break;
    
    case 'product':
    get_product();
    break;
    case 'variant':
    get_variant();
    break;

    Again, that was a very rough outline of something that could work. Then I could just upload collections, products, and variants all in one custom post type with hierachical pages.

    I am probably missing a variable that relates the functions together, but I think you get the idea. Do you think this would be easier than trying to deal with two different post types and a taxonomy that doesn’t want to display in the permalink?

    Thread Starter jcc5018

    (@jcc5018)

    well, no, google actually wasnt much help. I ended up getting help from stack exchange, but I did get my initial code from the wordpress codex.

    anyway, there is a chance that I am not explaining myself the best. There is really only one way to get to a product.

    I have my products arranged in collections, each collection (taxonomy) has many products (product groups), and each product has many variants (sizes)

    So an 11×14 glossy print (variant) will be in the Print/ Glossy (product group/subgroup), which is in the “Looking Good collection” which is in the Collection Index. so the url would be domain/collection/looking-good/Prints/Glossy

    Variants do not have their own page, because they will be displayed in a list on the Glossy page.

    The product description and photos are all in the (Product group) cpt, but both Product-group and product variant have data needed to calculate the final price, and some variants may have additional descriptions in which case a pop up box displaying that content will appear.

    I have a demo site built in a wireframe software that explains what I need to do. Im working on the products folder right now.

    https://rxajhx.axshare.com

    you will need a password: demosite to access it.

    Thread Starter jcc5018

    (@jcc5018)

    thanks for the reply. I actually got that part to work. I did have to create a page template. Trying to google what I wanted to accomplish was a pain in the butt.

    Anyway, next order of business is getting the actual post to display when clicked on in the archive.

    I am using PODS to create my CPT’s and taxonomies if that makes a difference.

    I’m guessing it is a rewrite issue, but whatever it is, the permalinks are not working correctly. I need them to display as “Domain/collection/%collection%/%post_title/” where %collection% is the term of the collection taxonomy and %post_title% is the post related to the term

    In the pods rewrite form, I have collection/%collection% set thinking that the %collection% would display the actual collection selected (it doesn’t).

    I also have the archive page rewrite set to the same thing, but that didnt work either. I also tried just having collection itself.

    In addition, the breadcrumbs links for individual products are not displaying the right hierarchy either. It is displaying “Home>product group>(Item) opposed to Home>Collections>%collection%>%product%

    Here is the code so far:

    page-collection.php – WORKS!

    <?php
    /*
    Template Name: Collections
    */
    get_header();
    $terms = get_terms( 'collection' );
    
    echo '<ul>';
    
    foreach ( $terms as $term ) {
    
    // The $term is an object, so we don't need to specify the $taxonomy.
    $term_link = get_term_link( $term );
    
    // If there was an error, continue to the next term.
    if ( is_wp_error( $term_link ) ) {
        continue;
    }
    
    // We successfully got a link. Print it out.
    echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></li>';
    echo  $term->description; // This will return the description of the term
    
    }
    
    echo '</ul>';
    
    ?><?php get_footer(); ?>

    taxonomy-collection.php — Works from collections, but not from product going up.

    <?php get_header(); ?>
    
      <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
      <div id="container">
        <div id="content" >
    
          <h1 class="page-title"><?php echo $term->name; ?> </h1>
    
          <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
    
    /*Create filter to only display top level product groups if variants exist in any child post type relationship*/
    
              <div >
                <h2 class="entry-title">
                  <a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark">
                    <?php the_title(); ?>
                  </a>
                </h2>
    
                          <div class="entry-summary">
                  <?php the_excerpt(); ?>
                </div><!-- .entry-summary -->
              </div>
    
            <?php endwhile; ?>
          <?php endif; ?>
    
        </div><!-- #content -->
      </div><!-- #container -->
    
    <?php get_footer(); ?>

    single-pods_product_grps.php — the main part works, but not my custom functions that display product variants

    <?php
    
    get_header();
    
    if ( have_posts() ) {
    	while ( have_posts() ) {
    		the_post();
    		if ( has_post_thumbnail() ) {
    	$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
    
             echo '<div><a href="' . $large_image_url[0] . '" title="' . the_title_attribute( 'echo=0' ) . '">';
    	the_post_thumbnail( 'medium' );
    	echo '</a></div>';
    }
    ?><div>
        <?php
        echo "Test if this is working";
    
        the_content();?> </div> <div>
            <?php
            //determine if child groups exist
            /*If product group has child groups
             * Loop child groups into drop down selection box :returns group_ID
    If no child group: just return parents group ID
             */
    
            do_action('display_products');
            echo '</div>';
    
    } // end while
    } // end if
    ?>
    <?php get_footer(); ?>
    Thread Starter jcc5018

    (@jcc5018)

    Well the developer won’t help so I could use some general advice on what I need to look for, add, or change when applying templates to other post types and creating the custom categories

    Thread Starter jcc5018

    (@jcc5018)

    Themeforest

    Forum: Plugins
    In reply to: sql change for page map
    Thread Starter jcc5018

    (@jcc5018)

    IT took a while but I figured it out.

    I had some issue where a few of my pages were displaying multiple times due to different ID’s. I’m not exactly sure what caused this.

    And I’m not sure if I really have the JOIN’s connected correctly as I just copied them from one of the help pages and altered a bit to get what I want. I had to add DISTINCT to remove the duplicates.

    $pageslist = $wpdb->get_results("SELECT DISTINCT ID, post_title
    FROM $wpdb->posts
    LEFT JOIN $wpdb->term_relationships ON ( $wpdb->posts.ID = $wpdb->term_relationships.object_id )
    LEFT JOIN $wpdb->term_taxonomy ON ( $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id )
    LEFT JOIN $wpdb->terms ON ( $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id )
    WHERE $wpdb->posts.post_type = 'page'
    AND $wpdb->posts.post_status = 'publish'
    OR $wpdb->posts.post_type = 'post'
    AND $wpdb->term_taxonomy.parent = '35'
    
    ORDER BY post_title
     ");

    I’m going leave this unresolved for a bit to see if anyone has a suggestion to get the same result with a little more simplified code. I think the current way it is set up may end up displaying any unpublished post. Though this probably wont be a big issue since I usually post my stuff right away, I’d like to have it set right just in case.

Viewing 12 replies - 1 through 12 (of 12 total)