검색에 불필요한 테이블을 추가하고 나는 오토바이를 다른 플러그인을 추가하는 플러그인을 복제. 두 플러그인은 잘 작동하지만 검색시 치명적인 오류가 발생합니다. 어떻게 든 그들은 검색시 다른 불필요한 테이블을 추가합니다 (플러그인을 디버깅 할 때 테이블을 봅니다). 예를 들어 자동차 카테고리를 검색 할 때 검색어가 오토바이 표를 추가합니다. 자동차 테이블이 아닌 자동차 테이블을 추가합니다. 그렇지 않으면 오토바이 카테고리를 검색 할 때 쿼리가 자동차 테이블을 추가합니다. 그것은 나를 혼란스럽게 만든다. 결과는 결코 바뀌지 않습니다. 이거 버그 야? 나는이 문제를 해결Osclass 플러그인 내가 <a href="http://market.osclass.org/plugins/cars-attributes_7" rel="nofollow">cars plugin</a> 사용
0
A
답변
0
Osclass 3.3.2을 사용하고 있습니다. 내 솔루션이 깨끗한 아니지만 그것은 나를 위해 작동합니다. 내가에/Search.php 파일을 편집해야 OC-포함/osclass/모델/디렉토리. addTable과 addConditions의 두 함수를 복제했습니다. 카테고리 ID 인 새 매개 변수를 추가했습니다. 그래서 수 있습니다 : addTableNew ($ 테이블, $의 CATID) 및 addConditionsNew ($ 조건, $ CATID)
public function addTableNew($tables,$catID)
{
if(is_array($tables)) {
foreach($tables as $table) {
$table = trim($table);
if($table!='' && in_array($catID, $this->categories)) {
$this->tables[] = $table;
}
}
} else {
$tables = trim($tables);
if($tables!='' && in_array($catID, $this->categories)) {
$this->tables[] = $tables;
}
}
}
public function addConditionsNew($conditions,$catID)
{
if(is_array($conditions)) {
foreach($conditions as $condition) {
$condition = trim($condition);
if($condition!='') {
if(in_array($catID, $this->categories)) {
$this->conditions[] = $condition;
}
}
}
} else {
$conditions = trim($conditions);
if($conditions!='') {
if(in_array($catID, $this->categories)) {
$this->conditions[] = $conditions;
}
}
}
}
다음 각 플러그인 디렉토리에 index.php를 파일입니다. 나는 cars_search_conditions 기능과 motorbikes_search_conditions 기능을 변경했습니다.
function cars_search_conditions($params) {
// we need conditions and search tables (only if we're using our custom tables)
$cats = ModelCars::newInstance()->getCategoryId('Cars'); //-->search the category id in the database
$catID = $cats['fk_i_category_id'];
$has_conditions = false ;
foreach($params as $key => $value) {
// we may want to have param-specific searches
switch($key) {
case 'make':
if(is_numeric($value)) {
Search::newInstance()->addConditionsNew(sprintf("%st_item_car_attr.fk_i_make_id = %d", DB_TABLE_PREFIX, $value),$catID);
$has_conditions = true;
}
break;
//others search param
}
}
// Only if we have some values at the params we add our table and link with the ID of the item.
if($has_conditions) {
Search::newInstance()->addConditionsNew(sprintf("%st_item.pk_i_id = %st_item_car_attr.fk_i_item_id ", DB_TABLE_PREFIX, DB_TABLE_PREFIX),$catID);
Search::newInstance()->addTableNew(sprintf("%st_item_car_attr", DB_TABLE_PREFIX),$catID);
}
}
function motorbikes_search_conditions($params) {
// we need conditions and search tables (only if we're using our custom tables)fk_i_category_id
$cats = ModelMotorBikes::newInstance()->getCategoryId('Motorbikes');
$catID = $cats['fk_i_category_id'];
$has_conditions = false ;
foreach($params as $key => $value) {
// we may want to have param-specific searches
switch($key) {
case 'make':
if(is_numeric($value)) {
Search::newInstance()->addConditionsNew(sprintf("%st_item_motorbike_attr.fk_i_motorbike_make_id = %d", DB_TABLE_PREFIX, $value),$catID);
$has_conditions = true;
}
break;
//others search param
}
}
// Only if we have some values at the params we add our table and link with the ID of the item.
if($has_conditions) {
Search::newInstance()->addConditionsNew(sprintf("%st_item.pk_i_id = %st_item_motorbike_attr.fk_i_motorbike_item_id ", DB_TABLE_PREFIX, DB_TABLE_PREFIX),$catID);
Search::newInstance()->addTableNew(sprintf("%st_item_motorbike_attr", DB_TABLE_PREFIX),$catID);
}
}
관련 문제
- 1. 내가 <a href="http://formvalidation.io/" rel="nofollow">FormValidation</a> 플러그인을 사용하고
- 2. 내가 <a href="http://jscolor.com/" rel="nofollow">http://jscolor.com/</a>을 사용하고
- 3. 내가 <a href="http://html2canvas.hertzen.com/" rel="nofollow">html2canvas</a> 함께 일하고 있어요
- 4. ~~ 내가 <a href="http://www.postgresql.org/" rel="noreferrer">Postgres</a>에서 쿼리가
- 5. 사용자 정의 헤더 내가 AMsul <a href="http://amsul.ca/pickadate.js/" rel="nofollow noreferrer">Pickadate</a> 사용
- 6. 잭슨의 사용 : 내가 <a href="http://jackson.codehaus.org/" rel="nofollow">Jackson</a> 주석과 POJO가
- 7. A "_"나는 <A HREF 코드
- 8. JSF 사용 <a href="myPicture.png" .../>
- 9. A HREF
- 10. <a href>
- 11. 빔은 : 나는 "<a href="http://goo.gl/RXPfB" rel="nofollow">Buffet</a>을"플러그인 사용하십시오 시간 제한
- 12. 성 윈저 : <a href="http://mef.codeplex.com/" rel="nofollow">MEF</a>에서 객체
- 13. <a href="#">
- 14. <a href
- 15. CSS는 내가 자동 완성 <a href="http://www.yiiframework.com/extension/tokeninput/" rel="nofollow">Yii tokeninput</a> 플러그인 tokeninput YII을 사용하고 플러그인
- 16. jqtree가 <a href="http://mbraak.github.io/jqTree/" rel="nofollow">jqtree docs</a>에서
- 17. 객체는 [] <a href="http://dozer.sourceforge.net" rel="nofollow">Dozer</a>의 도움으로 도저
- 18. 유 좋은 플러그인 즉 <a href="http://www.trirand.com/blog/" rel="nofollow noreferrer">jqGrid</a> 및 <a href="http://www.flexigrid.info/" rel="nofollow noreferrer">Flexigrid</a>의 몇 가지가 있습니다
- 19. <a href> inside mobile:SelectionList
- 20. <a href="http://knockoutjs.com/documentation/plugins-mapping.html" rel="nofollow">mapping</a> 코 플러그인을 사용
- 21. JVisualVM은 (<a href="http://commons.apache.org/daemon/procrun.html" rel="noreferrer">Apache-Procrun</a> 사용) --openpid 인수
- 22. JQuery와 유효성 검사의 <a href="http://jqueryvalidation.org/Validator.showErrors/" rel="nofollow">showErrors() function</a>를 사용 showErrors()
- 23. 마스크는 내가 가진이 입력 <a href="http://jsfiddle.net/oqys6kk7/" rel="nofollow">FIDDLE</a> 마스크 RobinHerbots inputmask 플러그인
- 24. 나는 <a href="http://guides.rubyonrails.org/layouts_and_rendering.html" rel="nofollow">official page</a> DoubleRenderError
- 25. 그래서, <a href="http://itextpdf.com/" rel="nofollow">Itext library</a>와 페이지
- 26. <a href="http://www.datatables.net/" rel="nofollow">DataTables</a> 테이블에서
- 27. 가 <a href="https://github.com/nedbat/coveragepy" rel="noreferrer">coverage</a> 커버리지
- 28. URL 형식은 <a href="http://api.jquery.com/jQuery.getJSON/" rel="nofollow">jQuery.getJSON</a>에서
- 29. 둘은 JasperReports와 Grails의 렌더링 플러그인 내가 모두 <a href="http://community.jaspersoft.com/project/jasperreports-library" rel="nofollow noreferrer">Jasper Reports</a> 사용할
- 30. 내가 <a href="http://jsfiddle.net/fvus9/" rel="nofollow">this</a> 코드가 이러한 배경