how to send data-id to another page - javascript

im trying to send the id of the product selected in portfolio.php page to the page portfolio-detail.php and display the information from database according to the selected id
this is portfolio.php page
<ul class="portfolio-area da-thumbs">
<?php foreach ($product as $value): ?>
<li class="portfolio-item" data-id="id-0" data-type="web">
<div class="span3">
<div class="thumbnail">
<div class="image-wrapp">
<img src="<?php echo $target_dir.'/'.$value['product_pic']; ?>" alt="Portfolio name" title="" />
<article class="da-animate da-slideFromRight">
<a class="zoom" data-pretty="prettyPhoto" href="<?php echo $target_dir.'/'.$value['product_pic']; ?>">
<i class="icon-zoom-in icon-rounded icon-48 active"></i>
</a>
<a href="portfolio-detail.php" data-id="<?=$value['id']; ?>">
<i class="icon-link icon-rounded icon-48 active"></i>
</a>
<div class="hidden-tablet">
<p>
<?php echo $value['product_name']; ?>
</p>
</div>
</article>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
and this is portfolio-detail.php page
<section id="<?php echo $product['id']; ?>">
<div class="container">
<div class="row">
<div class="span12">
<article>
<div class="heading">
<h4><?php echo $product['product_name']; ?></h4>
</div>
<div class="clearfix">
</div>
<div class="row">
<div class="span8">
<!-- start flexslider -->
<div class="flexslider">
<ul class="slides">
<li>
<img src="<?php echo $target_dir.'/'.$product['product_pic']; ?>" alt="" />
</li>
</ul>
</div>
<!-- end flexslider -->
<p>
<?php echo $product['product_desc']; ?>
</p>
</div>
<div class="span4">
<aside>
<div class="widget">
<div class="project-widget">
<h4 class="rheading">Portfolio detail<span></span></h4>
<ul class="project-detail">
<li><label>Project name :</label> <?php echo $product['product_name']; ?></li>
<li><label>Category :</label> <?php echo $product['product_code']; ?></li>
<li><label>Project date :</label> 12 Apr 2013</li>
<li><label>Project link :</label>www.somelink.com</li>
</ul>
</div>
</div>
</aside>
</div>
</div>
</article>
<!-- end article full post -->
</div>
</div>
</div>
</section>
how to show the details of a product according to the one selected ?

Here's a solution:
In portfolio.php
Change:
<a href="portfolio-detail.php" data-id="<?=$value['id']; ?>">
To:
<a href="portfolio-detail.php?data-id=<?php echo $value['id']; ?>">
Top of portfolio-detail.php add:
$id = $_GET['data-id'];
Do your DB query with $id
$product = {db stuff here};
Of course all proper validation will need to get added.

Related

MACOS | When I click on the "a" tag in the Swiper Slider it does not go to the page

When I click on the "a" tag in the swiper slider, it does not go to the page and the slider starts to slide
this problem happens on mac
``
<div class="swiper-wrapper">
<?php do { ?>
<div class="swiper-slide">
<div class="slider-left-box">
<a href="<?php echo $SiteURL ?>tur-bilgisi/<?php echo $row_rsOneCikan['Seo']; ?>" title="<?php echo $row_rsOneCikan['Baslik']; ?>">
<img src="<?php echo $SiteURL ?>images/turlar/<?php echo $row_rsOneCikan['ResimBuyuk']; ?>" alt="<?php echo $row_rsOneCikan['Baslik']; ?>">
<div class="slider-left-box-content">
<div class="slider-left-box-content-wrapper">
<h3>ÖNE ÇIKAN TURLAR<span>yeni</span></h3>
<h4><?php echo $row_rsOneCikan['Baslik']; ?></h4>
<ul>
<li>
<h5><?php echo $row_rsOneCikan['KisaBilgi']; ?> </h5>
</li>
</ul>
<span style="color:#fff">Rezervasyon Yap</span> <img src="<?php echo $SiteURL ?>images/view-icone.png" alt="Rezervasyon Yap">
</div>
</div>
</a>
</div>
</div>
<?php } while ($row_rsOneCikan = mysql_fetch_assoc($rsOneCikan)); ?>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"><i class="fa fa-angle-left"></i></div>
<div class="swiper-button-next"><i class="fa fa-angle-right"></i></div>
```

Clicking links in content not working (non css issue)

I have a Wordpress + Webpack theme with a custom post type archive page for careers. Problem is that none of the links are clickable in the content (breacrumbs (yoast module), content links, post permalinks). The issue appeared recently. The header menu works fine.
So far I've tried:
removing the content text: no effect
remove post listing to see if the issue is related to the listing only
Tried moving the post loop to another template: still not clickable
absolute position css to see if anything is overlapping: no effect
remove all styles, leave only html: no effect
disabling all plugins: no effect.
oddly it works from time-to-time on safari but cant see a logic in it (but not firefox, opera, chrome)
Issue is not present on local install either (codebase for theme is the same)
The jobs listing archive template looks as follows:
<?php /* Template Name: Jobs */ ?>
<?php get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="page-content">
<div class="jobs-listing">
<div class="blob-wrap">
<div class="blob blob-right-top"><img src="<?php bloginfo('template_url'); ?>/assets/page-blob_4.svg" alt="NEXD Blob"></div>
<div class="blob blob-left-top is-hidden-mobile"><img src="<?php bloginfo('template_url'); ?>/assets/blog-blob.svg" alt="NEXD Blob"></div>
<div class="blob blob-left-bottom"><img src="<?php bloginfo('template_url'); ?>/assets/table-blob-left.svg" alt="NEXD Blob"></div>
</div>
<div class="positions-wrap above-fold_wrap">
<div class="container positions-container">
<div class="breadcrumbs">
<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
</div><!-- breadcrumbs -->
<div class="columns is-centered" data-aos="fade-up">
<div class="column">
<div class="positions-title has-text-centered columns is-centered">
<div class="column is-8">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<img src="<?php bloginfo('template_url'); ?>/assets/scroll-mouse--blue.svg" alt="Scroll icon">
</div>
</div><!-- title -->
<div class="positions columns">
<?php $args = array(
'post_type' => 'jobs',
'posts_per_page' => -1, //show all posts
);
$posts = new WP_Query($args); if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post(); ?>
<div class="column">
<a href="<?php echo get_permalink(); ?>" title="Read more about <?php echo get_the_title(); ?>">
<div class="positions-inner">
<div class="position-title">
<h3><?php echo get_the_title(); ?></h3>
</div>
<div class="position-link">
<span><?php the_field('starting_from'); ?></span>
</div>
<div class="position-locations">
<img src="<?php bloginfo('template_url'); ?>/assets/icon-map--pin.svg" alt="map-pin"><span class="location-name"><?php the_field('location'); ?></span>
</div>
</div>
</a>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
</div><!-- column is-10 -->
</div><!-- columns -->
</div><!-- container -->
</div><!-- positions -->
</div><!-- jobs listing-->
</div>
</div>
</div><!-- .content-area -->
<?php get_footer(); ?>
When I switch to the common template, all links in content work and rest of the site is fine.
View here
I test your website, if you click the link before an external/internal source is loaded the link work.
So you have 2 option, try to find which of that source block your link or use this code for exceed the problem:
<div class="column">
<div class="positions-inner">
<a href="https://www.nexd.com/career/technical-writer/" title="Read more about
Technical Writer">
<div class="position-title">
<h3>Technical Writer</h3>
</div>
<div class="position-link">
<span>ASAP</span>
</div>
<div class="position-locations">
<img src="https://www.nexd.com/wp-content/themes/nexd_theme/assets/icon-map--pin.svg"
alt="map-pin"><span class="location-name">Tallinn, Estonia</span>
</div>
</a>
</div>
</div>
This is with php code:
<div class="column">
<div class="positions-inner">
<a href="<?php echo get_permalink(); ?>" title="Read more about <?php echo
get_the_title(); ?>">
<div class="position-title">
<h3><?php echo get_the_title(); ?></h3>
</div>
<div class="position-link">
<span><?php the_field('starting_from'); ?></span>
</div>
<div class="position-locations">
<img src="<?php bloginfo('template_url'); ?>/assets/icon-map--pin.svg" alt="map-pin"><span class="location-name"><?php the_field('location'); ?></span>
</div>
</a>
</div>
</div>

Get multiple checkbox values in Yii

I have a page in which a user is able to select his desired category and get a listing of organizations. As for now, I've managed to get data from one selected category.
My issue now is getting multiple selected categories and retrieve data from multiple ids.
List of categories:
<div class="col-md-4 sidebar well col-md-push-8">
<div class="sidebar__block">
<div class="sidebar__inner">
<h4 class="h4">Filter by category</h4>
<?php foreach ($categories as $c): ?>
<div class="form-group">
<div class="checkbox">
<input type="checkbox" name="category[]" id="<?php echo $c->id;?>" value="<?php echo $c->id;?>" class="styled" <?php if($c->id==$_GET['category']){ echo 'checked="checked"'; } ?>>
<label for="<?php echo $c->title; ?>"><?php echo $c->title;?></label>
</div>
</div>
<?php endforeach ?>
<div class="form-group">
<button type="submit" class="btn btn-sd btn-sd-green full-width filter_button" name="subscribe">Filter <i class="icon-right-small"></i></button>
</div>
</div>
</div>
</div>
List of data(organizations according to category selected):
<div class="col-md-8 col-md-pull-4">
<!--start show category with title-->
<div class="lgi__block lgi__block-2" id="appnendGridId">
<!--start show single category with title-->
<?php if(!empty($enterprises)): ?>
<?php foreach ($enterprises as $e): ?>
<div class="lgi__item category1">
<a class="lgi__item-inner" target="_blank" href="<?php echo $this->createUrl('frontend/enterprise', array('id' => $e->id)) ?>">
<div class="lgi__block-img">
<h5 class="lgi__label"><?php if($e->isIdeaEnterpriseActiveAccreditedMembership()): ?><?php echo $e->renderIdeaEnterpriseMembership('text')?><?php endif; ?></h5>
<img class="img-responsive-full lgi__img wp-post-image" src="<?php echo $e['imageLogoUrl']; ?>" alt="">
<div class="overlay"></div>
</div>
<div class="lgi__title stripe">
<h4><?php echo $e['title']; ?></h4>
<p><?php echo ysUtil::truncate($e['text_oneliner'], 85) ?></p>
</div>
</a>
</div>
<?php endforeach ?>
<?php else: ?>
<?php echo Notice::inline('Enterprises not found in this category or keyword') ?>
<?php endif; ?>
<!--end show single category with title-->
</div>
<!--end show category with title-->
<div class="row load_more_div">
<div class="col-sm-12 text-center">
<button type="button" class="btn btn-sd btn-sd-green full-width load-more-posts collapse please_wait_btn_class">
<h4 style="margin-top: 7px; color: #fff;">Loading...</h4>
</button>
<button type="button" class="btn btn-sd btn-sd-green full-width load-more-posts load_more_btn_class">
Load More <i class="icon-arr-down"></i>
</button>
</div>
</div>
</div>
JS :
$(document).on('click','.filter_button',function(e){
e.preventDefault();
var category = [];
$.each($("input[name='category[]']:checked"), function(){
window.location.replace('/idea/frontend/explore/category/'+$(this).val());
});
});
Appreciate if anyone could help me in this matter.

How can i create a new set of columns to my code below instead of row?

I am trying to create a information site for my coworkers where they can add all the info they have so they don't need to write it down. The variable $cam_loc displays the location of certain equipment. When i use the code below instead of using one panel title per location it duplicates the location if there is more than 1 equipment in that place. I would like to make a conditional that verifies if the location is duplicated and if so instead of adding another panel-title it should add another column with the second pair of information in that location.
This is the code:
<?php
$cam = $db->prepare('select * from camere');
$cam->execute();
while ($cams = $cam->fetch(PDO::FETCH_OBJ)) {?>
<ul class="list" style="list-style: none;">
<div class="panel panel-primary">
<div class="panel-heading">
<li><h3 class="panel-title"><?php $cam_loc = $cams->locatie; ?><?php echo $cam_loc;?></h3> </li>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-2" align="center">
<div class="list-group">
<a class="list-group-item">Model: <strong><?php echo $cams->model; ?></strong></a>
<a class="list-group-item">Ip Intern: <strong><?php echo $cams->ip_int; ?></strong></a>
<a class="list-group-item">Ip Extern: <strong><?php echo $cams->ip_ext; ?></strong></a>
<a class="list-group-item">Port: <strong><?php echo $cams->port; ?></strong></a>
<a class="list-group-item">User: <strong><?php echo $cams->user; ?></strong></a>
<a class="list-group-item">Pass: <strong><?php echo $cams->pass; ?></strong></a>
</div>
</div>
</div>
</div>
</div>
</ul>
<?php } ?>
Firstly you'd need to sort your results by title in your SQL statement which will group them together, then use an if statement to work out if the current record has the same title as the previous one.
<?php
$cam = $db->prepare('select * from camere');
$cam->execute();
$heading = "";
while ($cams = $cam->fetch(PDO::FETCH_OBJ)) {?>
<ul class="list" style="list-style: none;">
<div class="panel panel-primary">
<?php $cam_loc = $cams->locatie;
if ($heading != $cam_loc) { ?>
<div class="panel-heading">
<li><h3 class="panel-title"><?php echo $cam_loc; ?></h3> </li>
</div>
<?php }
//Update $heading ready for the next row.
$heading = $cam_loc;
} ?>
<div class="panel-body">
<div class="row">
<div class="col-md-2" align="center">
<div class="list-group">
<a class="list-group-item">Model: <strong><?php echo $cams->model; ?></strong></a>
<a class="list-group-item">Ip Intern: <strong><?php echo $cams->ip_int; ?></strong></a>
<a class="list-group-item">Ip Extern: <strong><?php echo $cams->ip_ext; ?></strong></a>
<a class="list-group-item">Port: <strong><?php echo $cams->port; ?></strong></a>
<a class="list-group-item">User: <strong><?php echo $cams->user; ?></strong></a>
<a class="list-group-item">Pass: <strong><?php echo $cams->pass; ?></strong></a>
</div>
</div>
</div>
</div>
</div>
</ul>
<?php } ?>
You may have to move some of your HTML tags around a bit within those new code lines to give you the desired layout you require but as it is above you won't get a new heading for every record.

Radio submit in Magento header.phtml

Magento v1.7
How can I submit a form in the header.phtml by listening for changes on a radio button?
This is my code, if I change the radio buttons to a select dropdown it submits fine. I can't understand
$groupId = null;
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
/* Get the customer data */
$customer = Mage::getSingleton('customer/session')->getCustomer();
/* Get the customer's full name */
$customer = Mage::getModel('customer/customer')->load($customer->getId()) ;
$groupId = $customer->getGroupId();
}
$cookieGroupId = Mage::getModel('core/cookie')->get('customer_group_id');
if ($cookieGroupId) {
$groupId = $cookieGroupId;
}
?>
<div id="alt-nav-container">
<ul id="alt-nav">
<li class="icon-reorder"><span>Navigation</span></li>
</ul>
</div>
<div class="header-container">
<header class="header">
<h1>
<figure>
<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><span><?php echo $this->getLogoAlt() ?></span>
</a>
</figure>
</h1>
<div class="player-container">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li class="control-left"><span class="play-button"></span><span class="pause-button"></span></li>
<li class="control-center"><strong>Playing: <span class="jp-track-title"></span></strong> by <span class="jp-composer-name"></span></li>
<li class="control-right"><span class="volume-on-button"></span><span class="volume-off-button"></span></li>
</ul>
<div class="jp-time-holder">
<div class="jp-current-time"></div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-duration"></div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your Flash plugin.
</div>
</div>
</div>
</div>
<!--
<div style="z-index:9999;">
<?php
// var_export(get_class_methods(get_class($GroupId)));
?>
</div> -->
<div class="license-type">
<ul class="select-license-tab">
<li><span>Select your license type <sub class="icon-chevron-down"></sub></span>
<ul>
<li>
<div class="license-form">
<form action="<?php echo $this->getUrl('mcustomer/group/update') ?>" method="post" id="form-group-update" name="form-group-update">
<dl class="accordion">
<?php $groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
<?php foreach($groups as $group){ ?>
<div class="license-item">
<dt>
<?php if($groupId != null && $group['value'] == $groupId):?>
<input id="license-type-<?php print $group['value'] ?>" name="validate-one-required" type="radio" value="<?php print $group['value'] ?>" class="required-entry validate-one-required" checked="checked" />
<label for="license-type-<?php print $group['value'] ?>"><?php print $group['label'] ?></label>
<?php else: ?>
<input id="license-type-<?php print $group['value'] ?>" name="validate-one-required" type="radio" value="<?php print $group['value'] ?>" class="required-entry validate-one-required" />
<label for="license-type-<?php print $group['value'] ?>"><?php print $group['label'] ?></label>
<?php endif; ?>
</dt>
<dd>
<?php print $group['customer_description'] ?>
</dd>
</div>
<?php } ?>
</dl>
</form>
</div>
</li>
</ul>
</li>
</ul>
</div>
</header>
</div>
<div class="navigation-bar">
<div class="navigation-bar-wrapper">
<?php echo $this->getChildHtml('topContainer'); ?>
<?php echo $this->getChildHtml('topSearch') ?>
<?php echo $this->getChildHtml('topLinks') ?>
<?php echo $this->getChildHtml('store_language') ?>
<?php echo $this->getChildHtml('topMenu') ?>
</div>
</div>
<script type="text/javascript">
//< ![CDATA[
var customForm = new VarienForm('form-group-update');
Event.observe($("validate-one-required"),'change', function(event){
$('form-group-update').submit();
});
//]]>
</script>
Thanks in advance
You should add a new class to your radio to prevent conflict with forms on other page since validate-one-required is not unique, or use more unique class selector eg $$('.license-form .validate-one-required').each..
$$('.license-form_radios').each(function(curInput) {
Event.observe(curInput, 'click', function() {
$('form-group-update').submit();
});
});

Categories